diff --git a/libs/sdk-js/src/react/stream.tsx b/libs/sdk-js/src/react/stream.tsx index a2cbf9e28..72c25bbe4 100644 --- a/libs/sdk-js/src/react/stream.tsx +++ b/libs/sdk-js/src/react/stream.tsx @@ -896,7 +896,12 @@ export function useStream< if (isLoading) return undefined; const interrupts = threadHead?.tasks?.at(-1)?.interrupts; - if (interrupts == null || interrupts.length === 0) return undefined; + if (interrupts == null || interrupts.length === 0) { + // check if there's a next task present + const next = threadHead?.next ?? []; + if (!next.length || error != null) return undefined; + return { when: "breakpoint" }; + } // Return only the current interrupt return interrupts.at(-1) as Interrupt | undefined; diff --git a/libs/sdk-js/src/schema.ts b/libs/sdk-js/src/schema.ts index 1a549dfc4..84596c82c 100644 --- a/libs/sdk-js/src/schema.ts +++ b/libs/sdk-js/src/schema.ts @@ -142,9 +142,9 @@ export interface AssistantGraph { * An interrupt thrown inside a thread. */ export interface Interrupt { - value: TValue; - when: "during"; - resumable: boolean; + value?: TValue; + when: "during" | (string & {}); + resumable?: boolean; ns?: string[]; }