From 2ee279a977745d0f4e3919fdf0f06471fe0d3293 Mon Sep 17 00:00:00 2001 From: bracesproul Date: Tue, 26 Nov 2024 11:26:18 -0800 Subject: [PATCH] fix(sdk-js): Add typing for interrupts on threads --- libs/sdk-js/src/schema.ts | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/libs/sdk-js/src/schema.ts b/libs/sdk-js/src/schema.ts index 1b9dae1fe..8884708e4 100644 --- a/libs/sdk-js/src/schema.ts +++ b/libs/sdk-js/src/schema.ts @@ -137,6 +137,16 @@ export interface AssistantGraph { }>; } +/** + * An interrupt thrown inside a thread. + */ +export interface Interrupt { + value: unknown; + when: "during"; + resumable: boolean; + ns?: string[]; +} + export interface Thread { /** The ID of the thread. */ thread_id: string; @@ -155,6 +165,9 @@ export interface Thread { /** The current state of the thread. */ values: ValuesType; + + /** Interrupts which were thrown in this thread */ + interrupts: {} | { [id: string]: Array }; } export interface Cron { @@ -210,12 +223,7 @@ export interface ThreadTask { name: string; result?: unknown; error: Optional; - interrupts: Array<{ - value: unknown; - when: "during"; - resumable: boolean; - ns?: string[]; - }>; + interrupts: Array; checkpoint: Optional; state: Optional; }