diff --git a/libs/sdk-js/package.json b/libs/sdk-js/package.json index 71a0976bb..8b9718872 100644 --- a/libs/sdk-js/package.json +++ b/libs/sdk-js/package.json @@ -1,6 +1,6 @@ { "name": "@langchain/langgraph-sdk", - "version": "0.0.20", + "version": "0.0.21", "description": "Client library for interacting with the LangGraph API", "type": "module", "packageManager": "yarn@1.22.19", diff --git a/libs/sdk-js/src/schema.ts b/libs/sdk-js/src/schema.ts index 86a668d01..52908a47b 100644 --- a/libs/sdk-js/src/schema.ts +++ b/libs/sdk-js/src/schema.ts @@ -79,7 +79,17 @@ export interface GraphSchema { export type Subgraphs = Record; -export type Metadata = Optional>; +export type Metadata = Optional<{ + source?: "input" | "loop" | "update" | (string & {}); + + step?: number; + + writes?: Record | null; + + parents?: Record; + + [key: string]: unknown; +}>; export interface AssistantBase { /** The ID of the assistant. */ @@ -110,7 +120,22 @@ export interface Assistant extends AssistantBase { /** The name of the assistant */ name: string; } -export type AssistantGraph = Record>>; + +export interface AssistantGraph { + nodes: Array<{ + id: string | number; + name?: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + data?: Record | string; + metadata?: unknown; + }>; + edges: Array<{ + source: string; + target: string; + data?: string; + conditional?: boolean; + }>; +} export interface Thread { /** The ID of the thread. */ @@ -184,7 +209,7 @@ export interface ThreadTask { id: string; name: string; error: Optional; - interrupts: Array>; + interrupts: Array<{ value: unknown; when: "during" }>; checkpoint: Optional; state: Optional; } diff --git a/libs/sdk-js/src/types.ts b/libs/sdk-js/src/types.ts index 3f4e90764..93b025fa4 100644 --- a/libs/sdk-js/src/types.ts +++ b/libs/sdk-js/src/types.ts @@ -45,12 +45,12 @@ interface RunsInvokePayload { /** * Interrupt execution before entering these nodes. */ - interruptBefore?: string[]; + interruptBefore?: "*" | string[]; /** * Interrupt execution after leaving these nodes. */ - interruptAfter?: string[]; + interruptAfter?: "*" | string[]; /** * Strategy to handle concurrent runs on the same thread. Only relevant if