From c82ca137da918c252104a175c2794376dfbec3c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Necati=20Y=C3=B6net?= Date: Sun, 9 Aug 2026 13:03:17 +0300 Subject: [PATCH] fix: unblock workspace build by typing bot session result as AIResult packages/bot/core and packages/bots/core both fail to compile with TS2345: the finish() callback parameter was typed with a loose { type: string; ... } shape, which is not assignable to AIResult (type must be the literal "result"). Type it as AIResult so the workspace build (tsc -p tsconfig.json) passes in both trees. Also fixes packages/bots/signal compile errors in the test file: - IncomingMessage.groupId widened to string | null | undefined (the implementation already falls back with ??, so undefined is valid) - test literal now includes isGroup and drops the unused raw field --- packages/bot/core/src/index.ts | 11 +---------- packages/bots/core/src/index.ts | 11 +---------- packages/bots/signal/src/index.test.ts | 2 +- packages/bots/signal/src/index.ts | 2 +- 4 files changed, 4 insertions(+), 22 deletions(-) diff --git a/packages/bot/core/src/index.ts b/packages/bot/core/src/index.ts index 00073aba..434f6517 100644 --- a/packages/bot/core/src/index.ts +++ b/packages/bot/core/src/index.ts @@ -111,16 +111,7 @@ export class SessionManager { proc.stderr?.on("data", (chunk) => (stderr += chunk.toString())); return new Promise((resolve) => { - const finish = (result: { - type: string; - subtype: string; - is_error: boolean; - result: string; - duration_ms: number; - num_turns: number; - session_id: string; - total_cost_usd: number; - }) => { + const finish = (result: AIResult) => { session.busy = false; session.abortController = null; resolve(result); diff --git a/packages/bots/core/src/index.ts b/packages/bots/core/src/index.ts index 9284cf07..e15d0383 100644 --- a/packages/bots/core/src/index.ts +++ b/packages/bots/core/src/index.ts @@ -111,16 +111,7 @@ export class SessionManager { proc.stderr?.on("data", (chunk) => (stderr += chunk.toString())); return new Promise((resolve) => { - const finish = (result: { - type: string; - subtype: string; - is_error: boolean; - result: string; - duration_ms: number; - num_turns: number; - session_id: string; - total_cost_usd: number; - }) => { + const finish = (result: AIResult) => { session.busy = false; session.abortController = null; resolve(result); diff --git a/packages/bots/signal/src/index.test.ts b/packages/bots/signal/src/index.test.ts index 4a479d93..c074aafb 100644 --- a/packages/bots/signal/src/index.test.ts +++ b/packages/bots/signal/src/index.test.ts @@ -59,8 +59,8 @@ describe('toBotEvent', () => { text: 'hello', timestamp: Number.POSITIVE_INFINITY, groupId: undefined, + isGroup: false, attachments: [], - raw: {}, }).timestamp).toBe('1970-01-01T00:00:00.000Z'); }); }); diff --git a/packages/bots/signal/src/index.ts b/packages/bots/signal/src/index.ts index a9bec189..8a28777f 100644 --- a/packages/bots/signal/src/index.ts +++ b/packages/bots/signal/src/index.ts @@ -24,7 +24,7 @@ export interface IncomingMessage { sourceName: string; text: string; timestamp: number; - groupId: string | null; + groupId: string | null | undefined; isGroup: boolean; attachments: Array<{ filename: string; url: string }>; }