@langchain/langgraph-sdk 1.5.5 → 1.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/{rolldown_runtime.cjs → _rolldown/runtime.cjs} +1 -1
- package/dist/auth/index.cjs +2 -1
- package/dist/auth/index.cjs.map +1 -1
- package/dist/auth/index.js +1 -1
- package/dist/auth/index.js.map +1 -1
- package/dist/client.cjs +35 -2
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +13 -1
- package/dist/client.d.cts.map +1 -1
- package/dist/client.d.ts +13 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +34 -2
- package/dist/client.js.map +1 -1
- package/dist/index.cjs +1 -0
- package/dist/logging/index.cjs +1 -0
- package/dist/logging/index.cjs.map +1 -1
- package/dist/react/index.cjs +1 -0
- package/dist/react/stream.cjs +1 -1
- package/dist/react/stream.custom.cjs +1 -1
- package/dist/react/stream.lgp.cjs +39 -39
- package/dist/react/stream.lgp.cjs.map +1 -1
- package/dist/react/stream.lgp.js +38 -38
- package/dist/react/stream.lgp.js.map +1 -1
- package/dist/react/thread.cjs +1 -1
- package/dist/react-ui/client.cjs +4 -4
- package/dist/react-ui/index.cjs +1 -0
- package/dist/react-ui/index.cjs.map +1 -1
- package/dist/react-ui/server/index.cjs +1 -0
- package/dist/react-ui/server/server.cjs +4 -4
- package/dist/react-ui/server/server.cjs.map +1 -1
- package/dist/react-ui/server/server.js +3 -3
- package/dist/react-ui/server/server.js.map +1 -1
- package/dist/schema.d.cts +2 -0
- package/dist/schema.d.cts.map +1 -1
- package/dist/schema.d.ts +2 -0
- package/dist/schema.d.ts.map +1 -1
- package/dist/types.d.cts +17 -1
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.ts +17 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.stream.d.cts.map +1 -1
- package/dist/ui/branching.cjs +7 -7
- package/dist/ui/branching.cjs.map +1 -1
- package/dist/ui/branching.js +7 -7
- package/dist/ui/branching.js.map +1 -1
- package/dist/ui/manager.cjs +4 -4
- package/dist/ui/manager.cjs.map +1 -1
- package/dist/ui/manager.js +4 -4
- package/dist/ui/manager.js.map +1 -1
- package/dist/ui/messages.cjs +1 -1
- package/dist/utils/async_caller.cjs +3 -3
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","names":["uuidv4"
|
|
1
|
+
{"version":3,"file":"server.js","names":["uuidv4"],"sources":["../../../src/react-ui/server/server.ts"],"sourcesContent":["import { v4 as uuidv4 } from \"uuid\";\nimport type { ComponentPropsWithoutRef, ElementType } from \"react\";\nimport type { RemoveUIMessage, UIMessage } from \"../types.js\";\n\ninterface MessageLike {\n id?: string;\n}\n\n/**\n * Helper to send and persist UI messages. Accepts a map of component names to React components\n * as type argument to provide type safety. Will also write to the `options?.stateKey` state.\n *\n * @param config LangGraphRunnableConfig\n * @param options\n * @returns\n */\nexport const typedUi = <Decl extends Record<string, ElementType>>(\n config: {\n writer?: (chunk: unknown) => void;\n runId?: string;\n metadata?: Record<string, unknown>;\n tags?: string[];\n runName?: string;\n configurable?: {\n __pregel_send?: (writes_: [string, unknown][]) => void;\n [key: string]: unknown;\n };\n },\n options?: {\n /** The key to write the UI messages to. Defaults to `ui`. */\n stateKey?: string;\n }\n) => {\n type PropMap = { [K in keyof Decl]: ComponentPropsWithoutRef<Decl[K]> };\n const items: (UIMessage | RemoveUIMessage)[] = [];\n const stateKey = options?.stateKey ?? \"ui\";\n\n const runId = (config.metadata?.run_id as string | undefined) ?? config.runId;\n if (!runId) throw new Error(\"run_id is required\");\n\n function handlePush<K extends keyof PropMap & string>(\n message: {\n id?: string;\n name: K;\n props: PropMap[K];\n metadata?: Record<string, unknown>;\n },\n options?: { message?: MessageLike; merge?: boolean }\n ): UIMessage<K, PropMap[K]>;\n\n function handlePush<K extends keyof PropMap & string>(\n message: {\n id?: string;\n name: K;\n props: Partial<PropMap[K]>;\n metadata?: Record<string, unknown>;\n },\n options: { message?: MessageLike; merge: true }\n ): UIMessage<K, Partial<PropMap[K]>>;\n\n function handlePush<K extends keyof PropMap & string>(\n message: {\n id?: string;\n name: K;\n props: PropMap[K] | Partial<PropMap[K]>;\n metadata?: Record<string, unknown>;\n },\n options?: { message?: MessageLike; merge?: boolean }\n ): UIMessage<K, PropMap[K] | Partial<PropMap[K]>> {\n const evt: UIMessage<K, PropMap[K] | Partial<PropMap[K]>> = {\n type: \"ui\" as const,\n id: message?.id ?? uuidv4(),\n name: message?.name,\n props: message?.props,\n metadata: {\n merge: options?.merge || undefined,\n run_id: runId,\n tags: config.tags,\n name: config.runName,\n ...message?.metadata,\n ...(options?.message ? { message_id: options.message.id } : null),\n },\n };\n items.push(evt);\n config.writer?.(evt);\n config.configurable?.__pregel_send?.([[stateKey, evt]]);\n return evt;\n }\n\n const handleDelete = (id: string): RemoveUIMessage => {\n const evt: RemoveUIMessage = { type: \"remove-ui\", id };\n items.push(evt);\n config.writer?.(evt);\n config.configurable?.__pregel_send?.([[stateKey, evt]]);\n return evt;\n };\n\n return { push: handlePush, delete: handleDelete, items };\n};\n"],"mappings":";;;;;;;;;;;AAgBA,MAAa,WACX,QAWA,YAIG;CAEH,MAAM,QAAyC,EAAE;CACjD,MAAM,WAAW,SAAS,YAAY;CAEtC,MAAM,QAAS,OAAO,UAAU,UAAiC,OAAO;AACxE,KAAI,CAAC,MAAO,OAAM,IAAI,MAAM,qBAAqB;CAsBjD,SAAS,WACP,SAMA,SACgD;EAChD,MAAM,MAAsD;GAC1D,MAAM;GACN,IAAI,SAAS,MAAMA,IAAQ;GAC3B,MAAM,SAAS;GACf,OAAO,SAAS;GAChB,UAAU;IACR,OAAO,SAAS,SAAS;IACzB,QAAQ;IACR,MAAM,OAAO;IACb,MAAM,OAAO;IACb,GAAG,SAAS;IACZ,GAAI,SAAS,UAAU,EAAE,YAAY,QAAQ,QAAQ,IAAI,GAAG;IAC7D;GACF;AACD,QAAM,KAAK,IAAI;AACf,SAAO,SAAS,IAAI;AACpB,SAAO,cAAc,gBAAgB,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC;AACvD,SAAO;;CAGT,MAAM,gBAAgB,OAAgC;EACpD,MAAM,MAAuB;GAAE,MAAM;GAAa;GAAI;AACtD,QAAM,KAAK,IAAI;AACf,SAAO,SAAS,IAAI;AACpB,SAAO,cAAc,gBAAgB,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC;AACvD,SAAO;;AAGT,QAAO;EAAE,MAAM;EAAY,QAAQ;EAAc;EAAO"}
|
package/dist/schema.d.cts
CHANGED
|
@@ -189,6 +189,8 @@ interface Cron {
|
|
|
189
189
|
next_run_date: Optional<string>;
|
|
190
190
|
/** The metadata of the cron */
|
|
191
191
|
metadata: Record<string, unknown>;
|
|
192
|
+
/** Whether the cron is enabled */
|
|
193
|
+
enabled: boolean;
|
|
192
194
|
}
|
|
193
195
|
type DefaultValues = Record<string, unknown>[] | Record<string, unknown>;
|
|
194
196
|
type ThreadValuesFilter = Record<string, unknown>;
|
package/dist/schema.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.cts","names":["JSONSchema7","Optional","T","RunStatus","ThreadStatus","MultitaskStrategy","CancelAction","Config","GraphSchema","Subgraphs","Record","Metadata","AssistantBase","AssistantVersion","Assistant","AssistantsSearchResponse","AssistantGraph","Array","Interrupt","TValue","Thread","DefaultValues","ValuesType","TInterruptValue","Cron","ThreadValuesFilter","ThreadState","Checkpoint","ThreadTask","Run","ListNamespaceResponse","Item","SearchItem","SearchItemsResponse","CronCreateResponse","CronCreateForThreadResponse","Omit","AssistantSortBy","ThreadSortBy","CronSortBy","SortOrder","AssistantSelectField","ThreadSelectField","RunSelectField","CronSelectField"],"sources":["../src/schema.d.ts"],"sourcesContent":["import type { JSONSchema7 } from \"json-schema\";\ntype Optional<T> = T | null | undefined;\nexport type RunStatus = \"pending\" | \"running\" | \"error\" | \"success\" | \"timeout\" | \"interrupted\";\nexport type ThreadStatus = \"idle\" | \"busy\" | \"interrupted\" | \"error\";\ntype MultitaskStrategy = \"reject\" | \"interrupt\" | \"rollback\" | \"enqueue\";\nexport type CancelAction = \"interrupt\" | \"rollback\";\nexport type Config = {\n /**\n * Tags for this call and any sub-calls (eg. a Chain calling an LLM).\n * You can use these to filter calls.\n */\n tags?: string[];\n /**\n * Maximum number of times a call can recurse.\n * If not provided, defaults to 25.\n */\n recursion_limit?: number;\n /**\n * Runtime values for attributes previously made configurable on this Runnable.\n */\n configurable?: {\n /**\n * ID of the thread\n */\n thread_id?: Optional<string>;\n /**\n * Timestamp of the state checkpoint\n */\n checkpoint_id?: Optional<string>;\n [key: string]: unknown;\n };\n};\nexport interface GraphSchema {\n /**\n * The ID of the graph.\n */\n graph_id: string;\n /**\n * The schema for the input state.\n * Missing if unable to generate JSON schema from graph.\n */\n input_schema?: JSONSchema7 | null | undefined;\n /**\n * The schema for the output state.\n * Missing if unable to generate JSON schema from graph.\n */\n output_schema?: JSONSchema7 | null | undefined;\n /**\n * The schema for the graph state.\n * Missing if unable to generate JSON schema from graph.\n */\n state_schema?: JSONSchema7 | null | undefined;\n /**\n * The schema for the graph config.\n * Missing if unable to generate JSON schema from graph.\n */\n config_schema?: JSONSchema7 | null | undefined;\n /**\n * The schema for the graph context.\n * Missing if unable to generate JSON schema from graph.\n */\n context_schema?: JSONSchema7 | null | undefined;\n}\nexport type Subgraphs = Record<string, GraphSchema>;\nexport type Metadata = Optional<{\n source?: \"input\" | \"loop\" | \"update\" | (string & {});\n step?: number;\n writes?: Record<string, unknown> | null;\n parents?: Record<string, string>;\n [key: string]: unknown;\n}>;\nexport interface AssistantBase {\n /** The ID of the assistant. */\n assistant_id: string;\n /** The ID of the graph. */\n graph_id: string;\n /** The assistant config. */\n config: Config;\n /** The assistant context. */\n context: unknown;\n /** The time the assistant was created. */\n created_at: string;\n /** The assistant metadata. */\n metadata: Metadata;\n /** The version of the assistant. */\n version: number;\n /** The name of the assistant */\n name: string;\n /** The description of the assistant */\n description?: string;\n}\nexport interface AssistantVersion extends AssistantBase {\n}\nexport interface Assistant extends AssistantBase {\n /** The last time the assistant was updated. */\n updated_at: string;\n}\nexport interface AssistantsSearchResponse {\n /** The assistants returned for the current search page. */\n assistants: Assistant[];\n /** Pagination cursor from the X-Pagination-Next response header. */\n next: string | null;\n}\nexport interface AssistantGraph {\n nodes: Array<{\n id: string | number;\n name?: string;\n data?: Record<string, any> | string;\n metadata?: unknown;\n }>;\n edges: Array<{\n source: string;\n target: string;\n data?: string;\n conditional?: boolean;\n }>;\n}\n/**\n * An interrupt thrown inside a thread.\n */\nexport interface Interrupt<TValue = unknown> {\n /**\n * The ID of the interrupt.\n */\n id?: string;\n /**\n * The value of the interrupt.\n */\n value?: TValue;\n /**\n * Will be deprecated in the future.\n * @deprecated Will be removed in the future.\n */\n when?: \"during\" | (string & {});\n /**\n * Whether the interrupt can be resumed.\n * @deprecated Will be removed in the future.\n */\n resumable?: boolean;\n /**\n * The namespace of the interrupt.\n * @deprecated Replaced by `interrupt_id`\n */\n ns?: string[];\n}\nexport interface Thread<ValuesType = DefaultValues, TInterruptValue = unknown> {\n /** The ID of the thread. */\n thread_id: string;\n /** The time the thread was created. */\n created_at: string;\n /** The last time the thread was updated. */\n updated_at: string;\n /** The thread metadata. */\n metadata: Metadata;\n /** The status of the thread */\n status: ThreadStatus;\n /** The current state of the thread. */\n values: ValuesType;\n /** Interrupts which were thrown in this thread */\n interrupts: Record<string, Array<Interrupt<TInterruptValue>>>;\n /** The config for the thread */\n config?: Config;\n /** The error for the thread (if status == \"error\") */\n error?: Optional<string | Record<string, unknown>>;\n}\nexport interface Cron {\n /** The ID of the cron */\n cron_id: string;\n /** The ID of the assistant */\n assistant_id: string;\n /** The ID of the thread */\n thread_id: Optional<string>;\n /** What to do with the thread after the run completes. Only applicable for stateless crons. */\n on_run_completed?: \"delete\" | \"keep\";\n /** The end date to stop running the cron. */\n end_time: Optional<string>;\n /** The schedule to run, cron format. Schedules are interpreted in UTC. */\n schedule: string;\n /** The time the cron was created. */\n created_at: string;\n /** The last time the cron was updated. */\n updated_at: string;\n /** The run payload to use for creating new run. */\n payload: Record<string, unknown>;\n /** The user ID of the cron */\n user_id: Optional<string>;\n /** The next run date of the cron */\n next_run_date: Optional<string>;\n /** The metadata of the cron */\n metadata: Record<string, unknown>;\n}\nexport type DefaultValues = Record<string, unknown>[] | Record<string, unknown>;\nexport type ThreadValuesFilter = Record<string, unknown>;\nexport interface ThreadState<ValuesType = DefaultValues> {\n /** The state values */\n values: ValuesType;\n /** The next nodes to execute. If empty, the thread is done until new input is received */\n next: string[];\n /** Checkpoint of the thread state */\n checkpoint: Checkpoint;\n /** Metadata for this state */\n metadata: Metadata;\n /** Time of state creation */\n created_at: Optional<string>;\n /** The parent checkpoint. If missing, this is the root checkpoint */\n parent_checkpoint: Optional<Checkpoint>;\n /** Tasks to execute in this step. If already attempted, may contain an error */\n tasks: Array<ThreadTask>;\n}\nexport interface ThreadTask<ValuesType = DefaultValues, TInterruptValue = unknown> {\n id: string;\n name: string;\n result?: unknown;\n error: Optional<string>;\n interrupts: Array<Interrupt<TInterruptValue>>;\n checkpoint: Optional<Checkpoint>;\n state: Optional<ThreadState<ValuesType>>;\n}\nexport interface Run {\n /** The ID of the run */\n run_id: string;\n /** The ID of the thread */\n thread_id: string;\n /** The assistant that wwas used for this run */\n assistant_id: string;\n /** The time the run was created */\n created_at: string;\n /** The last time the run was updated */\n updated_at: string;\n /** The status of the run. */\n status: RunStatus;\n /** Run metadata */\n metadata: Metadata;\n /** Strategy to handle concurrent runs on the same thread */\n multitask_strategy: Optional<MultitaskStrategy>;\n}\nexport type Checkpoint = {\n thread_id: string;\n checkpoint_ns: string;\n checkpoint_id: Optional<string>;\n checkpoint_map: Optional<Record<string, unknown>>;\n};\nexport interface ListNamespaceResponse {\n namespaces: string[][];\n}\nexport interface Item {\n namespace: string[];\n key: string;\n value: Record<string, any>;\n createdAt: string;\n updatedAt: string;\n}\nexport interface SearchItem extends Item {\n score?: number;\n}\nexport interface SearchItemsResponse {\n items: SearchItem[];\n}\nexport interface CronCreateResponse {\n cron_id: string;\n assistant_id: string;\n thread_id: string | undefined;\n user_id: string;\n payload: Record<string, unknown>;\n schedule: string;\n next_run_date: string;\n end_time: string | undefined;\n created_at: string;\n updated_at: string;\n metadata: Metadata;\n}\nexport interface CronCreateForThreadResponse extends Omit<CronCreateResponse, \"thread_id\"> {\n thread_id: string;\n}\nexport type AssistantSortBy = \"assistant_id\" | \"graph_id\" | \"name\" | \"created_at\" | \"updated_at\";\nexport type ThreadSortBy = \"thread_id\" | \"status\" | \"created_at\" | \"updated_at\";\nexport type CronSortBy = \"cron_id\" | \"assistant_id\" | \"thread_id\" | \"created_at\" | \"updated_at\" | \"next_run_date\";\nexport type SortOrder = \"asc\" | \"desc\";\nexport type AssistantSelectField = \"assistant_id\" | \"graph_id\" | \"name\" | \"description\" | \"config\" | \"context\" | \"created_at\" | \"updated_at\" | \"metadata\" | \"version\";\nexport type ThreadSelectField = \"thread_id\" | \"created_at\" | \"updated_at\" | \"metadata\" | \"config\" | \"context\" | \"status\" | \"values\" | \"interrupts\";\nexport type RunSelectField = \"run_id\" | \"thread_id\" | \"assistant_id\" | \"created_at\" | \"updated_at\" | \"status\" | \"metadata\" | \"kwargs\" | \"multitask_strategy\";\nexport type CronSelectField = \"cron_id\" | \"assistant_id\" | \"thread_id\" | \"end_time\" | \"schedule\" | \"created_at\" | \"updated_at\" | \"user_id\" | \"payload\" | \"next_run_date\" | \"metadata\" | \"now\";\nexport {};\n"],"mappings":";;;KACKC,cAAcC;KACPC,SAAAA;AADPF,KAEOG,YAAAA,GAFOF,MAAC,GAAA,MAAA,GAAA,aAAA,GAAA,OAAA;AACpB,KAEKG,iBAAAA,GAFgB,QAAA,GAAA,WAAA,GAAA,UAAA,GAAA,SAAA;AACTD,KAEAE,YAAAA,GAFY,WAAA,GAAA,UAAA;AACnBD,KAEOE,MAAAA,GAFPF;EACOC;AACZ;;;M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,CAAA,CAAA,CAAA;EACjBC;AACZ;;;;;;;;;;UAxIiBvB,oBAAoBC;;;;;;;;YAQvBV;;UAEFP;;UAEAkB;;cAEIZ,eAAeO,MAAMC,UAAUK;;WAElChB;;UAEDN,kBAAkBS;;UAEbc,IAAAA;;;;;;aAMFvB;;;;YAIDA;;;;;;;;WAQDS;;WAEAT;;iBAEMA;;YAELS;;KAEFW,aAAAA,GAAgBX,4BAA4BA;KAC5Ce,kBAAAA,GAAqBf;UAChBgB,yBAAyBL;;UAE9BC;;;;cAIIK;;YAEFhB;;cAEEV;;qBAEOA,SAAS0B;;SAErBV,MAAMW;;UAEAA,wBAAwBP;;;;SAI9BpB;cACKgB,MAAMC,UAAUK;cAChBtB,SAAS0B;SACd1B,SAASyB,YAAYJ;;UAEfO,GAAAA;;;;;;;;;;;;UAYL1B;;YAEEQ;;sBAEUV,SAASI;;KAErBsB,UAAAA;;;iBAGO1B;kBACCA,SAASS;;UAEZoB,qBAAAA;;;UAGAC,IAAAA;;;SAGNrB;;;;UAIMsB,UAAAA,SAAmBD;;;UAGnBE,mBAAAA;SACND;;UAEME,kBAAAA;;;;;WAKJxB;;;;;;YAMCC;;UAEGwB,2BAAAA,SAAoCC,KAAKF;;;KAG9CG,eAAAA;KACAC,YAAAA;KACAC,UAAAA;KACAC,SAAAA;KACAC,oBAAAA;KACAC,iBAAAA;KACAC,cAAAA;KACAC,eAAAA"}
|
|
1
|
+
{"version":3,"file":"schema.d.cts","names":["JSONSchema7","Optional","T","RunStatus","ThreadStatus","MultitaskStrategy","CancelAction","Config","GraphSchema","Subgraphs","Record","Metadata","AssistantBase","AssistantVersion","Assistant","AssistantsSearchResponse","AssistantGraph","Array","Interrupt","TValue","Thread","DefaultValues","ValuesType","TInterruptValue","Cron","ThreadValuesFilter","ThreadState","Checkpoint","ThreadTask","Run","ListNamespaceResponse","Item","SearchItem","SearchItemsResponse","CronCreateResponse","CronCreateForThreadResponse","Omit","AssistantSortBy","ThreadSortBy","CronSortBy","SortOrder","AssistantSelectField","ThreadSelectField","RunSelectField","CronSelectField"],"sources":["../src/schema.d.ts"],"sourcesContent":["import type { JSONSchema7 } from \"json-schema\";\ntype Optional<T> = T | null | undefined;\nexport type RunStatus = \"pending\" | \"running\" | \"error\" | \"success\" | \"timeout\" | \"interrupted\";\nexport type ThreadStatus = \"idle\" | \"busy\" | \"interrupted\" | \"error\";\ntype MultitaskStrategy = \"reject\" | \"interrupt\" | \"rollback\" | \"enqueue\";\nexport type CancelAction = \"interrupt\" | \"rollback\";\nexport type Config = {\n /**\n * Tags for this call and any sub-calls (eg. a Chain calling an LLM).\n * You can use these to filter calls.\n */\n tags?: string[];\n /**\n * Maximum number of times a call can recurse.\n * If not provided, defaults to 25.\n */\n recursion_limit?: number;\n /**\n * Runtime values for attributes previously made configurable on this Runnable.\n */\n configurable?: {\n /**\n * ID of the thread\n */\n thread_id?: Optional<string>;\n /**\n * Timestamp of the state checkpoint\n */\n checkpoint_id?: Optional<string>;\n [key: string]: unknown;\n };\n};\nexport interface GraphSchema {\n /**\n * The ID of the graph.\n */\n graph_id: string;\n /**\n * The schema for the input state.\n * Missing if unable to generate JSON schema from graph.\n */\n input_schema?: JSONSchema7 | null | undefined;\n /**\n * The schema for the output state.\n * Missing if unable to generate JSON schema from graph.\n */\n output_schema?: JSONSchema7 | null | undefined;\n /**\n * The schema for the graph state.\n * Missing if unable to generate JSON schema from graph.\n */\n state_schema?: JSONSchema7 | null | undefined;\n /**\n * The schema for the graph config.\n * Missing if unable to generate JSON schema from graph.\n */\n config_schema?: JSONSchema7 | null | undefined;\n /**\n * The schema for the graph context.\n * Missing if unable to generate JSON schema from graph.\n */\n context_schema?: JSONSchema7 | null | undefined;\n}\nexport type Subgraphs = Record<string, GraphSchema>;\nexport type Metadata = Optional<{\n source?: \"input\" | \"loop\" | \"update\" | (string & {});\n step?: number;\n writes?: Record<string, unknown> | null;\n parents?: Record<string, string>;\n [key: string]: unknown;\n}>;\nexport interface AssistantBase {\n /** The ID of the assistant. */\n assistant_id: string;\n /** The ID of the graph. */\n graph_id: string;\n /** The assistant config. */\n config: Config;\n /** The assistant context. */\n context: unknown;\n /** The time the assistant was created. */\n created_at: string;\n /** The assistant metadata. */\n metadata: Metadata;\n /** The version of the assistant. */\n version: number;\n /** The name of the assistant */\n name: string;\n /** The description of the assistant */\n description?: string;\n}\nexport interface AssistantVersion extends AssistantBase {\n}\nexport interface Assistant extends AssistantBase {\n /** The last time the assistant was updated. */\n updated_at: string;\n}\nexport interface AssistantsSearchResponse {\n /** The assistants returned for the current search page. */\n assistants: Assistant[];\n /** Pagination cursor from the X-Pagination-Next response header. */\n next: string | null;\n}\nexport interface AssistantGraph {\n nodes: Array<{\n id: string | number;\n name?: string;\n data?: Record<string, any> | string;\n metadata?: unknown;\n }>;\n edges: Array<{\n source: string;\n target: string;\n data?: string;\n conditional?: boolean;\n }>;\n}\n/**\n * An interrupt thrown inside a thread.\n */\nexport interface Interrupt<TValue = unknown> {\n /**\n * The ID of the interrupt.\n */\n id?: string;\n /**\n * The value of the interrupt.\n */\n value?: TValue;\n /**\n * Will be deprecated in the future.\n * @deprecated Will be removed in the future.\n */\n when?: \"during\" | (string & {});\n /**\n * Whether the interrupt can be resumed.\n * @deprecated Will be removed in the future.\n */\n resumable?: boolean;\n /**\n * The namespace of the interrupt.\n * @deprecated Replaced by `interrupt_id`\n */\n ns?: string[];\n}\nexport interface Thread<ValuesType = DefaultValues, TInterruptValue = unknown> {\n /** The ID of the thread. */\n thread_id: string;\n /** The time the thread was created. */\n created_at: string;\n /** The last time the thread was updated. */\n updated_at: string;\n /** The thread metadata. */\n metadata: Metadata;\n /** The status of the thread */\n status: ThreadStatus;\n /** The current state of the thread. */\n values: ValuesType;\n /** Interrupts which were thrown in this thread */\n interrupts: Record<string, Array<Interrupt<TInterruptValue>>>;\n /** The config for the thread */\n config?: Config;\n /** The error for the thread (if status == \"error\") */\n error?: Optional<string | Record<string, unknown>>;\n}\nexport interface Cron {\n /** The ID of the cron */\n cron_id: string;\n /** The ID of the assistant */\n assistant_id: string;\n /** The ID of the thread */\n thread_id: Optional<string>;\n /** What to do with the thread after the run completes. Only applicable for stateless crons. */\n on_run_completed?: \"delete\" | \"keep\";\n /** The end date to stop running the cron. */\n end_time: Optional<string>;\n /** The schedule to run, cron format. Schedules are interpreted in UTC. */\n schedule: string;\n /** The time the cron was created. */\n created_at: string;\n /** The last time the cron was updated. */\n updated_at: string;\n /** The run payload to use for creating new run. */\n payload: Record<string, unknown>;\n /** The user ID of the cron */\n user_id: Optional<string>;\n /** The next run date of the cron */\n next_run_date: Optional<string>;\n /** The metadata of the cron */\n metadata: Record<string, unknown>;\n /** Whether the cron is enabled */\n enabled: boolean;\n}\nexport type DefaultValues = Record<string, unknown>[] | Record<string, unknown>;\nexport type ThreadValuesFilter = Record<string, unknown>;\nexport interface ThreadState<ValuesType = DefaultValues> {\n /** The state values */\n values: ValuesType;\n /** The next nodes to execute. If empty, the thread is done until new input is received */\n next: string[];\n /** Checkpoint of the thread state */\n checkpoint: Checkpoint;\n /** Metadata for this state */\n metadata: Metadata;\n /** Time of state creation */\n created_at: Optional<string>;\n /** The parent checkpoint. If missing, this is the root checkpoint */\n parent_checkpoint: Optional<Checkpoint>;\n /** Tasks to execute in this step. If already attempted, may contain an error */\n tasks: Array<ThreadTask>;\n}\nexport interface ThreadTask<ValuesType = DefaultValues, TInterruptValue = unknown> {\n id: string;\n name: string;\n result?: unknown;\n error: Optional<string>;\n interrupts: Array<Interrupt<TInterruptValue>>;\n checkpoint: Optional<Checkpoint>;\n state: Optional<ThreadState<ValuesType>>;\n}\nexport interface Run {\n /** The ID of the run */\n run_id: string;\n /** The ID of the thread */\n thread_id: string;\n /** The assistant that wwas used for this run */\n assistant_id: string;\n /** The time the run was created */\n created_at: string;\n /** The last time the run was updated */\n updated_at: string;\n /** The status of the run. */\n status: RunStatus;\n /** Run metadata */\n metadata: Metadata;\n /** Strategy to handle concurrent runs on the same thread */\n multitask_strategy: Optional<MultitaskStrategy>;\n}\nexport type Checkpoint = {\n thread_id: string;\n checkpoint_ns: string;\n checkpoint_id: Optional<string>;\n checkpoint_map: Optional<Record<string, unknown>>;\n};\nexport interface ListNamespaceResponse {\n namespaces: string[][];\n}\nexport interface Item {\n namespace: string[];\n key: string;\n value: Record<string, any>;\n createdAt: string;\n updatedAt: string;\n}\nexport interface SearchItem extends Item {\n score?: number;\n}\nexport interface SearchItemsResponse {\n items: SearchItem[];\n}\nexport interface CronCreateResponse {\n cron_id: string;\n assistant_id: string;\n thread_id: string | undefined;\n user_id: string;\n payload: Record<string, unknown>;\n schedule: string;\n next_run_date: string;\n end_time: string | undefined;\n created_at: string;\n updated_at: string;\n metadata: Metadata;\n}\nexport interface CronCreateForThreadResponse extends Omit<CronCreateResponse, \"thread_id\"> {\n thread_id: string;\n}\nexport type AssistantSortBy = \"assistant_id\" | \"graph_id\" | \"name\" | \"created_at\" | \"updated_at\";\nexport type ThreadSortBy = \"thread_id\" | \"status\" | \"created_at\" | \"updated_at\";\nexport type CronSortBy = \"cron_id\" | \"assistant_id\" | \"thread_id\" | \"created_at\" | \"updated_at\" | \"next_run_date\";\nexport type SortOrder = \"asc\" | \"desc\";\nexport type AssistantSelectField = \"assistant_id\" | \"graph_id\" | \"name\" | \"description\" | \"config\" | \"context\" | \"created_at\" | \"updated_at\" | \"metadata\" | \"version\";\nexport type ThreadSelectField = \"thread_id\" | \"created_at\" | \"updated_at\" | \"metadata\" | \"config\" | \"context\" | \"status\" | \"values\" | \"interrupts\";\nexport type RunSelectField = \"run_id\" | \"thread_id\" | \"assistant_id\" | \"created_at\" | \"updated_at\" | \"status\" | \"metadata\" | \"kwargs\" | \"multitask_strategy\";\nexport type CronSelectField = \"cron_id\" | \"assistant_id\" | \"thread_id\" | \"end_time\" | \"schedule\" | \"created_at\" | \"updated_at\" | \"user_id\" | \"payload\" | \"next_run_date\" | \"metadata\" | \"now\";\nexport {};\n"],"mappings":";;;KACKC,cAAcC;KACPC,SAAAA;AADPF,KAEOG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IQ,SAiJJR,CAAAA,SAAAA,OAAAA,CAAAA,CAAAA;;;AAQb;EAA4C,EAAA,CAAA,EAAA,MAAA;;;;EAGhC2B,KAAAA,CAAAA,EApJAlB,MAoJAkB;EACAC;AACZ;AACA;AACA;EACYI,IAAAA,CAAAA,EAAAA,QAAAA,GAAAA,CAAAA,MAAiB,GAAA,CAAA,CAAA,CAAA;EACjBC;AACZ;;;;;;;;;;UA1IiBvB,oBAAoBC;;;;;;;;YAQvBV;;UAEFP;;UAEAkB;;cAEIZ,eAAeO,MAAMC,UAAUK;;WAElChB;;UAEDN,kBAAkBS;;UAEbc,IAAAA;;;;;;aAMFvB;;;;YAIDA;;;;;;;;WAQDS;;WAEAT;;iBAEMA;;YAELS;;;;KAIFW,aAAAA,GAAgBX,4BAA4BA;KAC5Ce,kBAAAA,GAAqBf;UAChBgB,yBAAyBL;;UAE9BC;;;;cAIIK;;YAEFhB;;cAEEV;;qBAEOA,SAAS0B;;SAErBV,MAAMW;;UAEAA,wBAAwBP;;;;SAI9BpB;cACKgB,MAAMC,UAAUK;cAChBtB,SAAS0B;SACd1B,SAASyB,YAAYJ;;UAEfO,GAAAA;;;;;;;;;;;;UAYL1B;;YAEEQ;;sBAEUV,SAASI;;KAErBsB,UAAAA;;;iBAGO1B;kBACCA,SAASS;;UAEZoB,qBAAAA;;;UAGAC,IAAAA;;;SAGNrB;;;;UAIMsB,UAAAA,SAAmBD;;;UAGnBE,mBAAAA;SACND;;UAEME,kBAAAA;;;;;WAKJxB;;;;;;YAMCC;;UAEGwB,2BAAAA,SAAoCC,KAAKF;;;KAG9CG,eAAAA;KACAC,YAAAA;KACAC,UAAAA;KACAC,SAAAA;KACAC,oBAAAA;KACAC,iBAAAA;KACAC,cAAAA;KACAC,eAAAA"}
|
package/dist/schema.d.ts
CHANGED
|
@@ -189,6 +189,8 @@ interface Cron {
|
|
|
189
189
|
next_run_date: Optional<string>;
|
|
190
190
|
/** The metadata of the cron */
|
|
191
191
|
metadata: Record<string, unknown>;
|
|
192
|
+
/** Whether the cron is enabled */
|
|
193
|
+
enabled: boolean;
|
|
192
194
|
}
|
|
193
195
|
type DefaultValues = Record<string, unknown>[] | Record<string, unknown>;
|
|
194
196
|
type ThreadValuesFilter = Record<string, unknown>;
|
package/dist/schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","names":["JSONSchema7","Optional","T","RunStatus","ThreadStatus","MultitaskStrategy","CancelAction","Config","GraphSchema","Subgraphs","Record","Metadata","AssistantBase","AssistantVersion","Assistant","AssistantsSearchResponse","AssistantGraph","Array","Interrupt","TValue","Thread","DefaultValues","ValuesType","TInterruptValue","Cron","ThreadValuesFilter","ThreadState","Checkpoint","ThreadTask","Run","ListNamespaceResponse","Item","SearchItem","SearchItemsResponse","CronCreateResponse","CronCreateForThreadResponse","Omit","AssistantSortBy","ThreadSortBy","CronSortBy","SortOrder","AssistantSelectField","ThreadSelectField","RunSelectField","CronSelectField"],"sources":["../src/schema.d.ts"],"sourcesContent":["import type { JSONSchema7 } from \"json-schema\";\ntype Optional<T> = T | null | undefined;\nexport type RunStatus = \"pending\" | \"running\" | \"error\" | \"success\" | \"timeout\" | \"interrupted\";\nexport type ThreadStatus = \"idle\" | \"busy\" | \"interrupted\" | \"error\";\ntype MultitaskStrategy = \"reject\" | \"interrupt\" | \"rollback\" | \"enqueue\";\nexport type CancelAction = \"interrupt\" | \"rollback\";\nexport type Config = {\n /**\n * Tags for this call and any sub-calls (eg. a Chain calling an LLM).\n * You can use these to filter calls.\n */\n tags?: string[];\n /**\n * Maximum number of times a call can recurse.\n * If not provided, defaults to 25.\n */\n recursion_limit?: number;\n /**\n * Runtime values for attributes previously made configurable on this Runnable.\n */\n configurable?: {\n /**\n * ID of the thread\n */\n thread_id?: Optional<string>;\n /**\n * Timestamp of the state checkpoint\n */\n checkpoint_id?: Optional<string>;\n [key: string]: unknown;\n };\n};\nexport interface GraphSchema {\n /**\n * The ID of the graph.\n */\n graph_id: string;\n /**\n * The schema for the input state.\n * Missing if unable to generate JSON schema from graph.\n */\n input_schema?: JSONSchema7 | null | undefined;\n /**\n * The schema for the output state.\n * Missing if unable to generate JSON schema from graph.\n */\n output_schema?: JSONSchema7 | null | undefined;\n /**\n * The schema for the graph state.\n * Missing if unable to generate JSON schema from graph.\n */\n state_schema?: JSONSchema7 | null | undefined;\n /**\n * The schema for the graph config.\n * Missing if unable to generate JSON schema from graph.\n */\n config_schema?: JSONSchema7 | null | undefined;\n /**\n * The schema for the graph context.\n * Missing if unable to generate JSON schema from graph.\n */\n context_schema?: JSONSchema7 | null | undefined;\n}\nexport type Subgraphs = Record<string, GraphSchema>;\nexport type Metadata = Optional<{\n source?: \"input\" | \"loop\" | \"update\" | (string & {});\n step?: number;\n writes?: Record<string, unknown> | null;\n parents?: Record<string, string>;\n [key: string]: unknown;\n}>;\nexport interface AssistantBase {\n /** The ID of the assistant. */\n assistant_id: string;\n /** The ID of the graph. */\n graph_id: string;\n /** The assistant config. */\n config: Config;\n /** The assistant context. */\n context: unknown;\n /** The time the assistant was created. */\n created_at: string;\n /** The assistant metadata. */\n metadata: Metadata;\n /** The version of the assistant. */\n version: number;\n /** The name of the assistant */\n name: string;\n /** The description of the assistant */\n description?: string;\n}\nexport interface AssistantVersion extends AssistantBase {\n}\nexport interface Assistant extends AssistantBase {\n /** The last time the assistant was updated. */\n updated_at: string;\n}\nexport interface AssistantsSearchResponse {\n /** The assistants returned for the current search page. */\n assistants: Assistant[];\n /** Pagination cursor from the X-Pagination-Next response header. */\n next: string | null;\n}\nexport interface AssistantGraph {\n nodes: Array<{\n id: string | number;\n name?: string;\n data?: Record<string, any> | string;\n metadata?: unknown;\n }>;\n edges: Array<{\n source: string;\n target: string;\n data?: string;\n conditional?: boolean;\n }>;\n}\n/**\n * An interrupt thrown inside a thread.\n */\nexport interface Interrupt<TValue = unknown> {\n /**\n * The ID of the interrupt.\n */\n id?: string;\n /**\n * The value of the interrupt.\n */\n value?: TValue;\n /**\n * Will be deprecated in the future.\n * @deprecated Will be removed in the future.\n */\n when?: \"during\" | (string & {});\n /**\n * Whether the interrupt can be resumed.\n * @deprecated Will be removed in the future.\n */\n resumable?: boolean;\n /**\n * The namespace of the interrupt.\n * @deprecated Replaced by `interrupt_id`\n */\n ns?: string[];\n}\nexport interface Thread<ValuesType = DefaultValues, TInterruptValue = unknown> {\n /** The ID of the thread. */\n thread_id: string;\n /** The time the thread was created. */\n created_at: string;\n /** The last time the thread was updated. */\n updated_at: string;\n /** The thread metadata. */\n metadata: Metadata;\n /** The status of the thread */\n status: ThreadStatus;\n /** The current state of the thread. */\n values: ValuesType;\n /** Interrupts which were thrown in this thread */\n interrupts: Record<string, Array<Interrupt<TInterruptValue>>>;\n /** The config for the thread */\n config?: Config;\n /** The error for the thread (if status == \"error\") */\n error?: Optional<string | Record<string, unknown>>;\n}\nexport interface Cron {\n /** The ID of the cron */\n cron_id: string;\n /** The ID of the assistant */\n assistant_id: string;\n /** The ID of the thread */\n thread_id: Optional<string>;\n /** What to do with the thread after the run completes. Only applicable for stateless crons. */\n on_run_completed?: \"delete\" | \"keep\";\n /** The end date to stop running the cron. */\n end_time: Optional<string>;\n /** The schedule to run, cron format. Schedules are interpreted in UTC. */\n schedule: string;\n /** The time the cron was created. */\n created_at: string;\n /** The last time the cron was updated. */\n updated_at: string;\n /** The run payload to use for creating new run. */\n payload: Record<string, unknown>;\n /** The user ID of the cron */\n user_id: Optional<string>;\n /** The next run date of the cron */\n next_run_date: Optional<string>;\n /** The metadata of the cron */\n metadata: Record<string, unknown>;\n}\nexport type DefaultValues = Record<string, unknown>[] | Record<string, unknown>;\nexport type ThreadValuesFilter = Record<string, unknown>;\nexport interface ThreadState<ValuesType = DefaultValues> {\n /** The state values */\n values: ValuesType;\n /** The next nodes to execute. If empty, the thread is done until new input is received */\n next: string[];\n /** Checkpoint of the thread state */\n checkpoint: Checkpoint;\n /** Metadata for this state */\n metadata: Metadata;\n /** Time of state creation */\n created_at: Optional<string>;\n /** The parent checkpoint. If missing, this is the root checkpoint */\n parent_checkpoint: Optional<Checkpoint>;\n /** Tasks to execute in this step. If already attempted, may contain an error */\n tasks: Array<ThreadTask>;\n}\nexport interface ThreadTask<ValuesType = DefaultValues, TInterruptValue = unknown> {\n id: string;\n name: string;\n result?: unknown;\n error: Optional<string>;\n interrupts: Array<Interrupt<TInterruptValue>>;\n checkpoint: Optional<Checkpoint>;\n state: Optional<ThreadState<ValuesType>>;\n}\nexport interface Run {\n /** The ID of the run */\n run_id: string;\n /** The ID of the thread */\n thread_id: string;\n /** The assistant that wwas used for this run */\n assistant_id: string;\n /** The time the run was created */\n created_at: string;\n /** The last time the run was updated */\n updated_at: string;\n /** The status of the run. */\n status: RunStatus;\n /** Run metadata */\n metadata: Metadata;\n /** Strategy to handle concurrent runs on the same thread */\n multitask_strategy: Optional<MultitaskStrategy>;\n}\nexport type Checkpoint = {\n thread_id: string;\n checkpoint_ns: string;\n checkpoint_id: Optional<string>;\n checkpoint_map: Optional<Record<string, unknown>>;\n};\nexport interface ListNamespaceResponse {\n namespaces: string[][];\n}\nexport interface Item {\n namespace: string[];\n key: string;\n value: Record<string, any>;\n createdAt: string;\n updatedAt: string;\n}\nexport interface SearchItem extends Item {\n score?: number;\n}\nexport interface SearchItemsResponse {\n items: SearchItem[];\n}\nexport interface CronCreateResponse {\n cron_id: string;\n assistant_id: string;\n thread_id: string | undefined;\n user_id: string;\n payload: Record<string, unknown>;\n schedule: string;\n next_run_date: string;\n end_time: string | undefined;\n created_at: string;\n updated_at: string;\n metadata: Metadata;\n}\nexport interface CronCreateForThreadResponse extends Omit<CronCreateResponse, \"thread_id\"> {\n thread_id: string;\n}\nexport type AssistantSortBy = \"assistant_id\" | \"graph_id\" | \"name\" | \"created_at\" | \"updated_at\";\nexport type ThreadSortBy = \"thread_id\" | \"status\" | \"created_at\" | \"updated_at\";\nexport type CronSortBy = \"cron_id\" | \"assistant_id\" | \"thread_id\" | \"created_at\" | \"updated_at\" | \"next_run_date\";\nexport type SortOrder = \"asc\" | \"desc\";\nexport type AssistantSelectField = \"assistant_id\" | \"graph_id\" | \"name\" | \"description\" | \"config\" | \"context\" | \"created_at\" | \"updated_at\" | \"metadata\" | \"version\";\nexport type ThreadSelectField = \"thread_id\" | \"created_at\" | \"updated_at\" | \"metadata\" | \"config\" | \"context\" | \"status\" | \"values\" | \"interrupts\";\nexport type RunSelectField = \"run_id\" | \"thread_id\" | \"assistant_id\" | \"created_at\" | \"updated_at\" | \"status\" | \"metadata\" | \"kwargs\" | \"multitask_strategy\";\nexport type CronSelectField = \"cron_id\" | \"assistant_id\" | \"thread_id\" | \"end_time\" | \"schedule\" | \"created_at\" | \"updated_at\" | \"user_id\" | \"payload\" | \"next_run_date\" | \"metadata\" | \"now\";\nexport {};\n"],"mappings":";;;KACKC,cAAcC;KACPC,SAAAA;AADPF,KAEOG,YAAAA,GAFOF,MAAC,GAAA,MAAA,GAAA,aAAA,GAAA,OAAA;AACpB,KAEKG,iBAAAA,GAFgB,QAAA,GAAA,WAAA,GAAA,UAAA,GAAA,SAAA;AACTD,KAEAE,YAAAA,GAFY,WAAA,GAAA,UAAA;AACnBD,KAEOE,MAAAA,GAFPF;EACOC;AACZ;;;MAsBwBL,CAAAA,EAAAA,MAAAA,EAAAA;EAAQ;AAIhC;;;iBAcoBD,CAAAA,EAAAA,MAAAA;;;;EAeY,YAAA,CAAA,EAAA;IAEpBS;;;IAAYC,SAAAA,CAAAA,EAvCJT,QAuCIS,CAAAA,MAAAA,CAAAA;IAAM;AAC9B;;IAGaA,aAAAA,CAAAA,EAvCWT,QAuCXS,CAAAA,MAAAA,CAAAA;IACCA,CAAAA,GAAAA,EAAAA,MAAAA,CAAAA,EAAAA,OAAAA;;CAJiB;AAOdE,UAvCAJ,WAAAA,CAuCa;EAAA;;;EAYR,QAAA,EAAA,MAAA;EAQLK;AAEjB;AAIA;AAMA;EAA+B,YAAA,CAAA,EA9DZb,WA8DY,GAAA,IAAA,GAAA,SAAA;;;;;E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;;UAEfO,GAAAA;;;;;;;;;;;;UAYL1B;;YAEEQ;;sBAEUV,SAASI;;KAErBsB,UAAAA;;;iBAGO1B;kBACCA,SAASS;;UAEZoB,qBAAAA;;;UAGAC,IAAAA;;;SAGNrB;;;;UAIMsB,UAAAA,SAAmBD;;;UAGnBE,mBAAAA;SACND;;UAEME,kBAAAA;;;;;WAKJxB;;;;;;YAMCC;;UAEGwB,2BAAAA,SAAoCC,KAAKF;;;KAG9CG,eAAAA;KACAC,YAAAA;KACAC,UAAAA;KACAC,SAAAA;KACAC,oBAAAA;KACAC,iBAAAA;KACAC,cAAAA;KACAC,eAAAA"}
|
|
1
|
+
{"version":3,"file":"schema.d.ts","names":["JSONSchema7","Optional","T","RunStatus","ThreadStatus","MultitaskStrategy","CancelAction","Config","GraphSchema","Subgraphs","Record","Metadata","AssistantBase","AssistantVersion","Assistant","AssistantsSearchResponse","AssistantGraph","Array","Interrupt","TValue","Thread","DefaultValues","ValuesType","TInterruptValue","Cron","ThreadValuesFilter","ThreadState","Checkpoint","ThreadTask","Run","ListNamespaceResponse","Item","SearchItem","SearchItemsResponse","CronCreateResponse","CronCreateForThreadResponse","Omit","AssistantSortBy","ThreadSortBy","CronSortBy","SortOrder","AssistantSelectField","ThreadSelectField","RunSelectField","CronSelectField"],"sources":["../src/schema.d.ts"],"sourcesContent":["import type { JSONSchema7 } from \"json-schema\";\ntype Optional<T> = T | null | undefined;\nexport type RunStatus = \"pending\" | \"running\" | \"error\" | \"success\" | \"timeout\" | \"interrupted\";\nexport type ThreadStatus = \"idle\" | \"busy\" | \"interrupted\" | \"error\";\ntype MultitaskStrategy = \"reject\" | \"interrupt\" | \"rollback\" | \"enqueue\";\nexport type CancelAction = \"interrupt\" | \"rollback\";\nexport type Config = {\n /**\n * Tags for this call and any sub-calls (eg. a Chain calling an LLM).\n * You can use these to filter calls.\n */\n tags?: string[];\n /**\n * Maximum number of times a call can recurse.\n * If not provided, defaults to 25.\n */\n recursion_limit?: number;\n /**\n * Runtime values for attributes previously made configurable on this Runnable.\n */\n configurable?: {\n /**\n * ID of the thread\n */\n thread_id?: Optional<string>;\n /**\n * Timestamp of the state checkpoint\n */\n checkpoint_id?: Optional<string>;\n [key: string]: unknown;\n };\n};\nexport interface GraphSchema {\n /**\n * The ID of the graph.\n */\n graph_id: string;\n /**\n * The schema for the input state.\n * Missing if unable to generate JSON schema from graph.\n */\n input_schema?: JSONSchema7 | null | undefined;\n /**\n * The schema for the output state.\n * Missing if unable to generate JSON schema from graph.\n */\n output_schema?: JSONSchema7 | null | undefined;\n /**\n * The schema for the graph state.\n * Missing if unable to generate JSON schema from graph.\n */\n state_schema?: JSONSchema7 | null | undefined;\n /**\n * The schema for the graph config.\n * Missing if unable to generate JSON schema from graph.\n */\n config_schema?: JSONSchema7 | null | undefined;\n /**\n * The schema for the graph context.\n * Missing if unable to generate JSON schema from graph.\n */\n context_schema?: JSONSchema7 | null | undefined;\n}\nexport type Subgraphs = Record<string, GraphSchema>;\nexport type Metadata = Optional<{\n source?: \"input\" | \"loop\" | \"update\" | (string & {});\n step?: number;\n writes?: Record<string, unknown> | null;\n parents?: Record<string, string>;\n [key: string]: unknown;\n}>;\nexport interface AssistantBase {\n /** The ID of the assistant. */\n assistant_id: string;\n /** The ID of the graph. */\n graph_id: string;\n /** The assistant config. */\n config: Config;\n /** The assistant context. */\n context: unknown;\n /** The time the assistant was created. */\n created_at: string;\n /** The assistant metadata. */\n metadata: Metadata;\n /** The version of the assistant. */\n version: number;\n /** The name of the assistant */\n name: string;\n /** The description of the assistant */\n description?: string;\n}\nexport interface AssistantVersion extends AssistantBase {\n}\nexport interface Assistant extends AssistantBase {\n /** The last time the assistant was updated. */\n updated_at: string;\n}\nexport interface AssistantsSearchResponse {\n /** The assistants returned for the current search page. */\n assistants: Assistant[];\n /** Pagination cursor from the X-Pagination-Next response header. */\n next: string | null;\n}\nexport interface AssistantGraph {\n nodes: Array<{\n id: string | number;\n name?: string;\n data?: Record<string, any> | string;\n metadata?: unknown;\n }>;\n edges: Array<{\n source: string;\n target: string;\n data?: string;\n conditional?: boolean;\n }>;\n}\n/**\n * An interrupt thrown inside a thread.\n */\nexport interface Interrupt<TValue = unknown> {\n /**\n * The ID of the interrupt.\n */\n id?: string;\n /**\n * The value of the interrupt.\n */\n value?: TValue;\n /**\n * Will be deprecated in the future.\n * @deprecated Will be removed in the future.\n */\n when?: \"during\" | (string & {});\n /**\n * Whether the interrupt can be resumed.\n * @deprecated Will be removed in the future.\n */\n resumable?: boolean;\n /**\n * The namespace of the interrupt.\n * @deprecated Replaced by `interrupt_id`\n */\n ns?: string[];\n}\nexport interface Thread<ValuesType = DefaultValues, TInterruptValue = unknown> {\n /** The ID of the thread. */\n thread_id: string;\n /** The time the thread was created. */\n created_at: string;\n /** The last time the thread was updated. */\n updated_at: string;\n /** The thread metadata. */\n metadata: Metadata;\n /** The status of the thread */\n status: ThreadStatus;\n /** The current state of the thread. */\n values: ValuesType;\n /** Interrupts which were thrown in this thread */\n interrupts: Record<string, Array<Interrupt<TInterruptValue>>>;\n /** The config for the thread */\n config?: Config;\n /** The error for the thread (if status == \"error\") */\n error?: Optional<string | Record<string, unknown>>;\n}\nexport interface Cron {\n /** The ID of the cron */\n cron_id: string;\n /** The ID of the assistant */\n assistant_id: string;\n /** The ID of the thread */\n thread_id: Optional<string>;\n /** What to do with the thread after the run completes. Only applicable for stateless crons. */\n on_run_completed?: \"delete\" | \"keep\";\n /** The end date to stop running the cron. */\n end_time: Optional<string>;\n /** The schedule to run, cron format. Schedules are interpreted in UTC. */\n schedule: string;\n /** The time the cron was created. */\n created_at: string;\n /** The last time the cron was updated. */\n updated_at: string;\n /** The run payload to use for creating new run. */\n payload: Record<string, unknown>;\n /** The user ID of the cron */\n user_id: Optional<string>;\n /** The next run date of the cron */\n next_run_date: Optional<string>;\n /** The metadata of the cron */\n metadata: Record<string, unknown>;\n /** Whether the cron is enabled */\n enabled: boolean;\n}\nexport type DefaultValues = Record<string, unknown>[] | Record<string, unknown>;\nexport type ThreadValuesFilter = Record<string, unknown>;\nexport interface ThreadState<ValuesType = DefaultValues> {\n /** The state values */\n values: ValuesType;\n /** The next nodes to execute. If empty, the thread is done until new input is received */\n next: string[];\n /** Checkpoint of the thread state */\n checkpoint: Checkpoint;\n /** Metadata for this state */\n metadata: Metadata;\n /** Time of state creation */\n created_at: Optional<string>;\n /** The parent checkpoint. If missing, this is the root checkpoint */\n parent_checkpoint: Optional<Checkpoint>;\n /** Tasks to execute in this step. If already attempted, may contain an error */\n tasks: Array<ThreadTask>;\n}\nexport interface ThreadTask<ValuesType = DefaultValues, TInterruptValue = unknown> {\n id: string;\n name: string;\n result?: unknown;\n error: Optional<string>;\n interrupts: Array<Interrupt<TInterruptValue>>;\n checkpoint: Optional<Checkpoint>;\n state: Optional<ThreadState<ValuesType>>;\n}\nexport interface Run {\n /** The ID of the run */\n run_id: string;\n /** The ID of the thread */\n thread_id: string;\n /** The assistant that wwas used for this run */\n assistant_id: string;\n /** The time the run was created */\n created_at: string;\n /** The last time the run was updated */\n updated_at: string;\n /** The status of the run. */\n status: RunStatus;\n /** Run metadata */\n metadata: Metadata;\n /** Strategy to handle concurrent runs on the same thread */\n multitask_strategy: Optional<MultitaskStrategy>;\n}\nexport type Checkpoint = {\n thread_id: string;\n checkpoint_ns: string;\n checkpoint_id: Optional<string>;\n checkpoint_map: Optional<Record<string, unknown>>;\n};\nexport interface ListNamespaceResponse {\n namespaces: string[][];\n}\nexport interface Item {\n namespace: string[];\n key: string;\n value: Record<string, any>;\n createdAt: string;\n updatedAt: string;\n}\nexport interface SearchItem extends Item {\n score?: number;\n}\nexport interface SearchItemsResponse {\n items: SearchItem[];\n}\nexport interface CronCreateResponse {\n cron_id: string;\n assistant_id: string;\n thread_id: string | undefined;\n user_id: string;\n payload: Record<string, unknown>;\n schedule: string;\n next_run_date: string;\n end_time: string | undefined;\n created_at: string;\n updated_at: string;\n metadata: Metadata;\n}\nexport interface CronCreateForThreadResponse extends Omit<CronCreateResponse, \"thread_id\"> {\n thread_id: string;\n}\nexport type AssistantSortBy = \"assistant_id\" | \"graph_id\" | \"name\" | \"created_at\" | \"updated_at\";\nexport type ThreadSortBy = \"thread_id\" | \"status\" | \"created_at\" | \"updated_at\";\nexport type CronSortBy = \"cron_id\" | \"assistant_id\" | \"thread_id\" | \"created_at\" | \"updated_at\" | \"next_run_date\";\nexport type SortOrder = \"asc\" | \"desc\";\nexport type AssistantSelectField = \"assistant_id\" | \"graph_id\" | \"name\" | \"description\" | \"config\" | \"context\" | \"created_at\" | \"updated_at\" | \"metadata\" | \"version\";\nexport type ThreadSelectField = \"thread_id\" | \"created_at\" | \"updated_at\" | \"metadata\" | \"config\" | \"context\" | \"status\" | \"values\" | \"interrupts\";\nexport type RunSelectField = \"run_id\" | \"thread_id\" | \"assistant_id\" | \"created_at\" | \"updated_at\" | \"status\" | \"metadata\" | \"kwargs\" | \"multitask_strategy\";\nexport type CronSelectField = \"cron_id\" | \"assistant_id\" | \"thread_id\" | \"end_time\" | \"schedule\" | \"created_at\" | \"updated_at\" | \"user_id\" | \"payload\" | \"next_run_date\" | \"metadata\" | \"now\";\nexport {};\n"],"mappings":";;;KACKC,cAAcC;KACPC,SAAAA;AADPF,KAEOG,YAAAA,GAFOF,MAAC,GAAA,MAAA,GAAA,aAAA,GAAA,OAAA;AACpB,KAEKG,iBAAAA,GAFgB,QAAA,GAAA,WAAA,GAAA,UAAA,GAAA,SAAA;AACTD,KAEAE,YAAAA,GAFY,WAAA,GAAA,UAAA;AACnBD,KAEOE,MAAAA,GAFPF;EACOC;AACZ;;;MAsBwBL,CAAAA,EAAAA,MAAAA,EAAAA;EAAQ;AAIhC;;;iBAcoBD,CAAAA,EAAAA,MAAAA;;;;EAeY,YAAA,CAAA,EAAA;IAEpBS;;;IAAYC,SAAAA,CAAAA,EAvCJT,QAuCIS,CAAAA,MAAAA,CAAAA;IAAM;AAC9B;;IAGaA,aAAAA,CAAAA,EAvCWT,QAuCXS,CAAAA,MAAAA,CAAAA;IACC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,4BAA4BA;KAC5Ce,kBAAAA,GAAqBf;UAChBgB,yBAAyBL;;UAE9BC;;;;cAIIK;;YAEFhB;;cAEEV;;qBAEOA,SAAS0B;;SAErBV,MAAMW;;UAEAA,wBAAwBP;;;;SAI9BpB;cACKgB,MAAMC,UAAUK;cAChBtB,SAAS0B;SACd1B,SAASyB,YAAYJ;;UAEfO,GAAAA;;;;;;;;;;;;UAYL1B;;YAEEQ;;sBAEUV,SAASI;;KAErBsB,UAAAA;;;iBAGO1B;kBACCA,SAASS;;UAEZoB,qBAAAA;;;UAGAC,IAAAA;;;SAGNrB;;;;UAIMsB,UAAAA,SAAmBD;;;UAGnBE,mBAAAA;SACND;;UAEME,kBAAAA;;;;;WAKJxB;;;;;;YAMCC;;UAEGwB,2BAAAA,SAAoCC,KAAKF;;;KAG9CG,eAAAA;KACAC,YAAAA;KACAC,UAAAA;KACAC,SAAAA;KACAC,oBAAAA;KACAC,iBAAAA;KACAC,cAAAA;KACAC,eAAAA"}
|
package/dist/types.d.cts
CHANGED
|
@@ -182,6 +182,22 @@ interface CronsCreatePayload extends RunsCreatePayload {
|
|
|
182
182
|
* You are responsible for cleaning up kept threads.
|
|
183
183
|
*/
|
|
184
184
|
onRunCompleted?: "delete" | "keep";
|
|
185
|
+
/**
|
|
186
|
+
* Whether the cron is enabled.
|
|
187
|
+
*/
|
|
188
|
+
enabled?: boolean;
|
|
189
|
+
}
|
|
190
|
+
interface CronsUpdatePayload extends RunsInvokePayload {
|
|
191
|
+
schedule?: string;
|
|
192
|
+
endTime?: string;
|
|
193
|
+
/**
|
|
194
|
+
* What to do with the thread after the run completes.
|
|
195
|
+
* - "delete" (default): Automatically deletes the thread after the run completes.
|
|
196
|
+
* - "keep": Preserves the thread after the run completes, allowing you to retrieve run results later.
|
|
197
|
+
* You are responsible for cleaning up kept threads.
|
|
198
|
+
*/
|
|
199
|
+
onRunCompleted?: "delete" | "keep";
|
|
200
|
+
enabled?: boolean;
|
|
185
201
|
}
|
|
186
202
|
interface RunsWaitPayload extends RunsStreamPayload {
|
|
187
203
|
/**
|
|
@@ -190,5 +206,5 @@ interface RunsWaitPayload extends RunsStreamPayload {
|
|
|
190
206
|
raiseError?: boolean;
|
|
191
207
|
}
|
|
192
208
|
//#endregion
|
|
193
|
-
export { Command, CronsCreatePayload, DisconnectMode, Durability, MultitaskStrategy, OnCompletionBehavior, OnConflictBehavior, RunsCreatePayload, RunsInvokePayload, RunsStreamPayload, RunsWaitPayload, StreamEvent };
|
|
209
|
+
export { Command, CronsCreatePayload, CronsUpdatePayload, DisconnectMode, Durability, MultitaskStrategy, OnCompletionBehavior, OnConflictBehavior, RunsCreatePayload, RunsInvokePayload, RunsStreamPayload, RunsWaitPayload, StreamEvent };
|
|
194
210
|
//# sourceMappingURL=types.d.cts.map
|
package/dist/types.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.cts","names":["LangChainTracer","Checkpoint","Config","Metadata","StreamMode","MultitaskStrategy","OnConflictBehavior","OnCompletionBehavior","DisconnectMode","Durability","StreamEvent","Send","Command","Record","RunsInvokePayload","Omit","AbortController","RunsStreamPayload","TStreamMode","TSubgraphs","RunsCreatePayload","Array","CronsCreatePayload","RunsWaitPayload"],"sources":["../src/types.d.ts"],"sourcesContent":["import { LangChainTracer } from \"@langchain/core/tracers/tracer_langchain\";\nimport { Checkpoint, Config, Metadata } from \"./schema.js\";\nimport { StreamMode } from \"./types.stream.js\";\nexport type MultitaskStrategy = \"reject\" | \"interrupt\" | \"rollback\" | \"enqueue\";\nexport type OnConflictBehavior = \"raise\" | \"do_nothing\";\nexport type OnCompletionBehavior = \"complete\" | \"continue\";\nexport type DisconnectMode = \"cancel\" | \"continue\";\nexport type Durability = \"exit\" | \"async\" | \"sync\";\nexport type StreamEvent = \"events\" | \"metadata\" | \"debug\" | \"updates\" | \"values\" | \"messages/partial\" | \"messages/metadata\" | \"messages/complete\" | \"messages\" | (string & {});\nexport interface Send {\n node: string;\n input: unknown | null;\n}\nexport interface Command {\n /**\n * An object to update the thread state with.\n */\n update?: Record<string, unknown> | [string, unknown][] | null;\n /**\n * The value to return from an `interrupt` function call.\n */\n resume?: unknown;\n /**\n * Determine the next node to navigate to. Can be one of the following:\n * - Name(s) of the node names to navigate to next.\n * - `Send` command(s) to execute node(s) with provided input.\n */\n goto?: Send | Send[] | string | string[];\n}\nexport interface RunsInvokePayload {\n /**\n * Input to the run. Pass `null` to resume from the current state of the thread.\n */\n input?: Record<string, unknown> | null;\n /**\n * Metadata for the run.\n */\n metadata?: Metadata;\n /**\n * Additional configuration for the run.\n */\n config?: Config;\n /**\n * Static context to add to the assistant.\n * @remarks Added in LangGraph.js 0.4\n */\n context?: unknown;\n /**\n * Checkpoint ID for when creating a new run.\n */\n checkpointId?: string;\n /**\n * Checkpoint for when creating a new run.\n */\n checkpoint?: Omit<Checkpoint, \"thread_id\">;\n /**\n * Whether to checkpoint during the run (or only at the end/interruption).\n * @deprecated Use `durability` instead.\n */\n checkpointDuring?: boolean;\n /**\n * Whether to checkpoint during the run (or only at the end/interruption).\n * - `\"async\"`: Save checkpoint asynchronously while the next step executes (default).\n * - `\"sync\"`: Save checkpoint synchronously before the next step starts.\n * - `\"exit\"`: Save checkpoint only when the graph exits.\n * @default \"async\"\n */\n durability?: Durability;\n /**\n * Interrupt execution before entering these nodes.\n */\n interruptBefore?: \"*\" | string[];\n /**\n * Interrupt execution after leaving these nodes.\n */\n interruptAfter?: \"*\" | string[];\n /**\n * Strategy to handle concurrent runs on the same thread. Only relevant if\n * there is a pending/inflight run on the same thread. One of:\n * - \"reject\": Reject the new run.\n * - \"interrupt\": Interrupt the current run, keeping steps completed until now,\n and start a new one.\n * - \"rollback\": Cancel and delete the existing run, rolling back the thread to\n the state before it had started, then start the new run.\n * - \"enqueue\": Queue up the new run to start after the current run finishes.\n */\n multitaskStrategy?: MultitaskStrategy;\n /**\n * Abort controller signal to cancel the run.\n */\n signal?: AbortController[\"signal\"];\n /**\n * Behavior to handle run completion. Only relevant if\n * there is a pending/inflight run on the same thread. One of:\n * - \"complete\": Complete the run.\n * - \"continue\": Continue the run.\n */\n onCompletion?: OnCompletionBehavior;\n /**\n * Webhook to call when the run is complete.\n */\n webhook?: string;\n /**\n * Behavior to handle disconnection. Only relevant if\n * there is a pending/inflight run on the same thread. One of:\n * - \"cancel\": Cancel the run.\n * - \"continue\": Continue the run.\n */\n onDisconnect?: DisconnectMode;\n /**\n * The number of seconds to wait before starting the run.\n * Use to schedule future runs.\n */\n afterSeconds?: number;\n /**\n * Behavior if the specified run doesn't exist. Defaults to \"reject\".\n */\n ifNotExists?: \"create\" | \"reject\";\n /**\n * One or more commands to invoke the graph with.\n */\n command?: Command;\n /**\n * Callback when a run is created.\n */\n onRunCreated?: (params: {\n run_id: string;\n thread_id?: string;\n }) => void;\n /**\n * @internal\n * For LangSmith tracing purposes only. Not part of the public API.\n */\n _langsmithTracer?: LangChainTracer;\n}\nexport interface RunsStreamPayload<TStreamMode extends StreamMode | StreamMode[] = [], TSubgraphs extends boolean = false> extends RunsInvokePayload {\n /**\n * One of `\"values\"`, `\"messages\"`, `\"messages-tuple\"`, `\"updates\"`, `\"events\"`, `\"debug\"`, `\"custom\"`.\n */\n streamMode?: TStreamMode;\n /**\n * Stream output from subgraphs. By default, streams only the top graph.\n */\n streamSubgraphs?: TSubgraphs;\n /**\n * Whether the stream is considered resumable.\n * If true, the stream can be resumed and replayed in its entirety even after disconnection.\n */\n streamResumable?: boolean;\n /**\n * Pass one or more feedbackKeys if you want to request short-lived signed URLs\n * for submitting feedback to LangSmith with this key for this run.\n */\n feedbackKeys?: string[];\n}\nexport interface RunsCreatePayload extends RunsInvokePayload {\n /**\n * One of `\"values\"`, `\"messages\"`, `\"messages-tuple\"`, `\"updates\"`, `\"events\"`, `\"debug\"`, `\"custom\"`.\n */\n streamMode?: StreamMode | Array<StreamMode>;\n /**\n * Stream output from subgraphs. By default, streams only the top graph.\n */\n streamSubgraphs?: boolean;\n /**\n * Whether the stream is considered resumable.\n * If true, the stream can be resumed and replayed in its entirety even after disconnection.\n */\n streamResumable?: boolean;\n}\nexport interface CronsCreatePayload extends RunsCreatePayload {\n /**\n * Schedule for running the Cron Job. Schedules are interpreted in UTC.\n */\n schedule: string;\n /**\n * What to do with the thread after the run completes.\n * - \"delete\" (default): Automatically deletes the thread after the run completes.\n * - \"keep\": Preserves the thread after the run completes, allowing you to retrieve run results later.\n * You are responsible for cleaning up kept threads.\n */\n onRunCompleted?: \"delete\" | \"keep\";\n}\nexport interface RunsWaitPayload extends RunsStreamPayload {\n /**\n * Raise errors returned by the run. Default is `true`.\n */\n raiseError?: boolean;\n}\n"],"mappings":";;;;;KAGYK,iBAAAA;KACAC,kBAAAA;AADAD,KAEAE,oBAAAA,GAFiB,UAAA,GAAA,UAAA;AACjBD,KAEAE,cAAAA,GAFkB,QAAA,GAAA,UAAA;AAClBD,KAEAE,UAAAA,GAFAF,MAAoB,GAAA,OAAA,GAAA,MAAA;AACpBC,KAEAE,WAAAA,GAFc,QAAA,GAAA,UAAA,GAAA,OAAA,GAAA,SAAA,GAAA,QAAA,GAAA,kBAAA,GAAA,mBAAA,GAAA,mBAAA,GAAA,UAAA,GAAA,CAAA,MAAA,GAAA,CAAA,CAAA,CAAA;AACdD,UAEKE,IAAAA,CAFK;EACVD,IAAAA,EAAAA,MAAAA;EACKC,KAAAA,EAAI,OAAA,GAAA,IAAA;AAIrB;AAAwB,UAAPC,OAAAA,CAAO;;;;EAcF,MAAA,CAAA,EAVTC,MAUS,CAAA,MAAA,EAAA,OAAA,CAAA,GAAA,CAAA,MAAA,EAAA,OAAA,CAAA,EAAA,GAAA,IAAA;EAELC;;;QAQFX,CAAAA,EAAAA,OAAAA;;;;;;MAqDFa,CAAAA,EA/DFL,IA+DEK,GA/DKL,IA+DLK,EAAAA,GAAAA,MAAAA,GAAAA,MAAAA,EAAAA;;AAkBMR,UA/EFM,iBAAAA,CA+EEN;;;;EA2BFS,KAAAA,CAAAA,EAtGLJ,MAsGKI,CAAAA,MAAiB,EAAA,OAAA,CAAA,GAAA,IAAA;EAAA;;;UAIjBC,CAAAA,EAtGFf,QAsGEe;;;;EAgBAE,MAAAA,CAAAA,EAlHJlB,MAkHIkB;EAAiB;;;;SAASN,CAAAA,EAAAA,OAAAA;EAAiB;AAe5D;
|
|
1
|
+
{"version":3,"file":"types.d.cts","names":["LangChainTracer","Checkpoint","Config","Metadata","StreamMode","MultitaskStrategy","OnConflictBehavior","OnCompletionBehavior","DisconnectMode","Durability","StreamEvent","Send","Command","Record","RunsInvokePayload","Omit","AbortController","RunsStreamPayload","TStreamMode","TSubgraphs","RunsCreatePayload","Array","CronsCreatePayload","CronsUpdatePayload","RunsWaitPayload"],"sources":["../src/types.d.ts"],"sourcesContent":["import { LangChainTracer } from \"@langchain/core/tracers/tracer_langchain\";\nimport { Checkpoint, Config, Metadata } from \"./schema.js\";\nimport { StreamMode } from \"./types.stream.js\";\nexport type MultitaskStrategy = \"reject\" | \"interrupt\" | \"rollback\" | \"enqueue\";\nexport type OnConflictBehavior = \"raise\" | \"do_nothing\";\nexport type OnCompletionBehavior = \"complete\" | \"continue\";\nexport type DisconnectMode = \"cancel\" | \"continue\";\nexport type Durability = \"exit\" | \"async\" | \"sync\";\nexport type StreamEvent = \"events\" | \"metadata\" | \"debug\" | \"updates\" | \"values\" | \"messages/partial\" | \"messages/metadata\" | \"messages/complete\" | \"messages\" | (string & {});\nexport interface Send {\n node: string;\n input: unknown | null;\n}\nexport interface Command {\n /**\n * An object to update the thread state with.\n */\n update?: Record<string, unknown> | [string, unknown][] | null;\n /**\n * The value to return from an `interrupt` function call.\n */\n resume?: unknown;\n /**\n * Determine the next node to navigate to. Can be one of the following:\n * - Name(s) of the node names to navigate to next.\n * - `Send` command(s) to execute node(s) with provided input.\n */\n goto?: Send | Send[] | string | string[];\n}\nexport interface RunsInvokePayload {\n /**\n * Input to the run. Pass `null` to resume from the current state of the thread.\n */\n input?: Record<string, unknown> | null;\n /**\n * Metadata for the run.\n */\n metadata?: Metadata;\n /**\n * Additional configuration for the run.\n */\n config?: Config;\n /**\n * Static context to add to the assistant.\n * @remarks Added in LangGraph.js 0.4\n */\n context?: unknown;\n /**\n * Checkpoint ID for when creating a new run.\n */\n checkpointId?: string;\n /**\n * Checkpoint for when creating a new run.\n */\n checkpoint?: Omit<Checkpoint, \"thread_id\">;\n /**\n * Whether to checkpoint during the run (or only at the end/interruption).\n * @deprecated Use `durability` instead.\n */\n checkpointDuring?: boolean;\n /**\n * Whether to checkpoint during the run (or only at the end/interruption).\n * - `\"async\"`: Save checkpoint asynchronously while the next step executes (default).\n * - `\"sync\"`: Save checkpoint synchronously before the next step starts.\n * - `\"exit\"`: Save checkpoint only when the graph exits.\n * @default \"async\"\n */\n durability?: Durability;\n /**\n * Interrupt execution before entering these nodes.\n */\n interruptBefore?: \"*\" | string[];\n /**\n * Interrupt execution after leaving these nodes.\n */\n interruptAfter?: \"*\" | string[];\n /**\n * Strategy to handle concurrent runs on the same thread. Only relevant if\n * there is a pending/inflight run on the same thread. One of:\n * - \"reject\": Reject the new run.\n * - \"interrupt\": Interrupt the current run, keeping steps completed until now,\n and start a new one.\n * - \"rollback\": Cancel and delete the existing run, rolling back the thread to\n the state before it had started, then start the new run.\n * - \"enqueue\": Queue up the new run to start after the current run finishes.\n */\n multitaskStrategy?: MultitaskStrategy;\n /**\n * Abort controller signal to cancel the run.\n */\n signal?: AbortController[\"signal\"];\n /**\n * Behavior to handle run completion. Only relevant if\n * there is a pending/inflight run on the same thread. One of:\n * - \"complete\": Complete the run.\n * - \"continue\": Continue the run.\n */\n onCompletion?: OnCompletionBehavior;\n /**\n * Webhook to call when the run is complete.\n */\n webhook?: string;\n /**\n * Behavior to handle disconnection. Only relevant if\n * there is a pending/inflight run on the same thread. One of:\n * - \"cancel\": Cancel the run.\n * - \"continue\": Continue the run.\n */\n onDisconnect?: DisconnectMode;\n /**\n * The number of seconds to wait before starting the run.\n * Use to schedule future runs.\n */\n afterSeconds?: number;\n /**\n * Behavior if the specified run doesn't exist. Defaults to \"reject\".\n */\n ifNotExists?: \"create\" | \"reject\";\n /**\n * One or more commands to invoke the graph with.\n */\n command?: Command;\n /**\n * Callback when a run is created.\n */\n onRunCreated?: (params: {\n run_id: string;\n thread_id?: string;\n }) => void;\n /**\n * @internal\n * For LangSmith tracing purposes only. Not part of the public API.\n */\n _langsmithTracer?: LangChainTracer;\n}\nexport interface RunsStreamPayload<TStreamMode extends StreamMode | StreamMode[] = [], TSubgraphs extends boolean = false> extends RunsInvokePayload {\n /**\n * One of `\"values\"`, `\"messages\"`, `\"messages-tuple\"`, `\"updates\"`, `\"events\"`, `\"debug\"`, `\"custom\"`.\n */\n streamMode?: TStreamMode;\n /**\n * Stream output from subgraphs. By default, streams only the top graph.\n */\n streamSubgraphs?: TSubgraphs;\n /**\n * Whether the stream is considered resumable.\n * If true, the stream can be resumed and replayed in its entirety even after disconnection.\n */\n streamResumable?: boolean;\n /**\n * Pass one or more feedbackKeys if you want to request short-lived signed URLs\n * for submitting feedback to LangSmith with this key for this run.\n */\n feedbackKeys?: string[];\n}\nexport interface RunsCreatePayload extends RunsInvokePayload {\n /**\n * One of `\"values\"`, `\"messages\"`, `\"messages-tuple\"`, `\"updates\"`, `\"events\"`, `\"debug\"`, `\"custom\"`.\n */\n streamMode?: StreamMode | Array<StreamMode>;\n /**\n * Stream output from subgraphs. By default, streams only the top graph.\n */\n streamSubgraphs?: boolean;\n /**\n * Whether the stream is considered resumable.\n * If true, the stream can be resumed and replayed in its entirety even after disconnection.\n */\n streamResumable?: boolean;\n}\nexport interface CronsCreatePayload extends RunsCreatePayload {\n /**\n * Schedule for running the Cron Job. Schedules are interpreted in UTC.\n */\n schedule: string;\n /**\n * What to do with the thread after the run completes.\n * - \"delete\" (default): Automatically deletes the thread after the run completes.\n * - \"keep\": Preserves the thread after the run completes, allowing you to retrieve run results later.\n * You are responsible for cleaning up kept threads.\n */\n onRunCompleted?: \"delete\" | \"keep\";\n /**\n * Whether the cron is enabled.\n */\n enabled?: boolean;\n}\nexport interface CronsUpdatePayload extends RunsInvokePayload {\n schedule?: string;\n endTime?: string;\n /**\n * What to do with the thread after the run completes.\n * - \"delete\" (default): Automatically deletes the thread after the run completes.\n * - \"keep\": Preserves the thread after the run completes, allowing you to retrieve run results later.\n * You are responsible for cleaning up kept threads.\n */\n onRunCompleted?: \"delete\" | \"keep\";\n enabled?: boolean;\n}\nexport interface RunsWaitPayload extends RunsStreamPayload {\n /**\n * Raise errors returned by the run. Default is `true`.\n */\n raiseError?: boolean;\n}\n"],"mappings":";;;;;KAGYK,iBAAAA;KACAC,kBAAAA;AADAD,KAEAE,oBAAAA,GAFiB,UAAA,GAAA,UAAA;AACjBD,KAEAE,cAAAA,GAFkB,QAAA,GAAA,UAAA;AAClBD,KAEAE,UAAAA,GAFAF,MAAoB,GAAA,OAAA,GAAA,MAAA;AACpBC,KAEAE,WAAAA,GAFc,QAAA,GAAA,UAAA,GAAA,OAAA,GAAA,SAAA,GAAA,QAAA,GAAA,kBAAA,GAAA,mBAAA,GAAA,mBAAA,GAAA,UAAA,GAAA,CAAA,MAAA,GAAA,CAAA,CAAA,CAAA;AACdD,UAEKE,IAAAA,CAFK;EACVD,IAAAA,EAAAA,MAAAA;EACKC,KAAAA,EAAI,OAAA,GAAA,IAAA;AAIrB;AAAwB,UAAPC,OAAAA,CAAO;;;;EAcF,MAAA,CAAA,EAVTC,MAUS,CAAA,MAAA,EAAA,OAAA,CAAA,GAAA,CAAA,MAAA,EAAA,OAAA,CAAA,EAAA,GAAA,IAAA;EAELC;;;QAQFX,CAAAA,EAAAA,OAAAA;;;;;;MAqDFa,CAAAA,EA/DFL,IA+DEK,GA/DKL,IA+DLK,EAAAA,GAAAA,MAAAA,GAAAA,MAAAA,EAAAA;;AAkBMR,UA/EFM,iBAAAA,CA+EEN;;;;EA2BFS,KAAAA,CAAAA,EAtGLJ,MAsGKI,CAAAA,MAAiB,EAAA,OAAA,CAAA,GAAA,IAAA;EAAA;;;UAIjBC,CAAAA,EAtGFf,QAsGEe;;;;EAgBAE,MAAAA,CAAAA,EAlHJlB,MAkHIkB;EAAiB;;;;SAASN,CAAAA,EAAAA,OAAAA;EAAiB;AAe5D;AAiBA;EAYiBU,YAAAA,CAAAA,EAAAA,MAAe;;;;eAjJfT,KAAKd;;;;;;;;;;;;;eAaLQ;;;;;;;;;;;;;;;;;;;sBAmBOJ;;;;WAIXW;;;;;;;iBAOMT;;;;;;;;;;;iBAWAC;;;;;;;;;;;;;YAaLI;;;;;;;;;;;;qBAYSZ;;UAENiB,sCAAsCb,aAAaA,+DAA+DU;;;;eAIlHI;;;;oBAIKC;;;;;;;;;;;;UAYLC,iBAAAA,SAA0BN;;;;eAI1BV,aAAaiB,MAAMjB;;;;;;;;;;;UAWnBkB,kBAAAA,SAA2BF;;;;;;;;;;;;;;;;;UAiB3BG,kBAAAA,SAA2BT;;;;;;;;;;;;UAY3BU,eAAAA,SAAwBP"}
|
package/dist/types.d.ts
CHANGED
|
@@ -182,6 +182,22 @@ interface CronsCreatePayload extends RunsCreatePayload {
|
|
|
182
182
|
* You are responsible for cleaning up kept threads.
|
|
183
183
|
*/
|
|
184
184
|
onRunCompleted?: "delete" | "keep";
|
|
185
|
+
/**
|
|
186
|
+
* Whether the cron is enabled.
|
|
187
|
+
*/
|
|
188
|
+
enabled?: boolean;
|
|
189
|
+
}
|
|
190
|
+
interface CronsUpdatePayload extends RunsInvokePayload {
|
|
191
|
+
schedule?: string;
|
|
192
|
+
endTime?: string;
|
|
193
|
+
/**
|
|
194
|
+
* What to do with the thread after the run completes.
|
|
195
|
+
* - "delete" (default): Automatically deletes the thread after the run completes.
|
|
196
|
+
* - "keep": Preserves the thread after the run completes, allowing you to retrieve run results later.
|
|
197
|
+
* You are responsible for cleaning up kept threads.
|
|
198
|
+
*/
|
|
199
|
+
onRunCompleted?: "delete" | "keep";
|
|
200
|
+
enabled?: boolean;
|
|
185
201
|
}
|
|
186
202
|
interface RunsWaitPayload extends RunsStreamPayload {
|
|
187
203
|
/**
|
|
@@ -190,5 +206,5 @@ interface RunsWaitPayload extends RunsStreamPayload {
|
|
|
190
206
|
raiseError?: boolean;
|
|
191
207
|
}
|
|
192
208
|
//#endregion
|
|
193
|
-
export { Command, CronsCreatePayload, DisconnectMode, Durability, MultitaskStrategy, OnCompletionBehavior, OnConflictBehavior, RunsCreatePayload, RunsInvokePayload, RunsStreamPayload, RunsWaitPayload, StreamEvent };
|
|
209
|
+
export { Command, CronsCreatePayload, CronsUpdatePayload, DisconnectMode, Durability, MultitaskStrategy, OnCompletionBehavior, OnConflictBehavior, RunsCreatePayload, RunsInvokePayload, RunsStreamPayload, RunsWaitPayload, StreamEvent };
|
|
194
210
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","names":["LangChainTracer","Checkpoint","Config","Metadata","StreamMode","MultitaskStrategy","OnConflictBehavior","OnCompletionBehavior","DisconnectMode","Durability","StreamEvent","Send","Command","Record","RunsInvokePayload","Omit","AbortController","RunsStreamPayload","TStreamMode","TSubgraphs","RunsCreatePayload","Array","CronsCreatePayload","RunsWaitPayload"],"sources":["../src/types.d.ts"],"sourcesContent":["import { LangChainTracer } from \"@langchain/core/tracers/tracer_langchain\";\nimport { Checkpoint, Config, Metadata } from \"./schema.js\";\nimport { StreamMode } from \"./types.stream.js\";\nexport type MultitaskStrategy = \"reject\" | \"interrupt\" | \"rollback\" | \"enqueue\";\nexport type OnConflictBehavior = \"raise\" | \"do_nothing\";\nexport type OnCompletionBehavior = \"complete\" | \"continue\";\nexport type DisconnectMode = \"cancel\" | \"continue\";\nexport type Durability = \"exit\" | \"async\" | \"sync\";\nexport type StreamEvent = \"events\" | \"metadata\" | \"debug\" | \"updates\" | \"values\" | \"messages/partial\" | \"messages/metadata\" | \"messages/complete\" | \"messages\" | (string & {});\nexport interface Send {\n node: string;\n input: unknown | null;\n}\nexport interface Command {\n /**\n * An object to update the thread state with.\n */\n update?: Record<string, unknown> | [string, unknown][] | null;\n /**\n * The value to return from an `interrupt` function call.\n */\n resume?: unknown;\n /**\n * Determine the next node to navigate to. Can be one of the following:\n * - Name(s) of the node names to navigate to next.\n * - `Send` command(s) to execute node(s) with provided input.\n */\n goto?: Send | Send[] | string | string[];\n}\nexport interface RunsInvokePayload {\n /**\n * Input to the run. Pass `null` to resume from the current state of the thread.\n */\n input?: Record<string, unknown> | null;\n /**\n * Metadata for the run.\n */\n metadata?: Metadata;\n /**\n * Additional configuration for the run.\n */\n config?: Config;\n /**\n * Static context to add to the assistant.\n * @remarks Added in LangGraph.js 0.4\n */\n context?: unknown;\n /**\n * Checkpoint ID for when creating a new run.\n */\n checkpointId?: string;\n /**\n * Checkpoint for when creating a new run.\n */\n checkpoint?: Omit<Checkpoint, \"thread_id\">;\n /**\n * Whether to checkpoint during the run (or only at the end/interruption).\n * @deprecated Use `durability` instead.\n */\n checkpointDuring?: boolean;\n /**\n * Whether to checkpoint during the run (or only at the end/interruption).\n * - `\"async\"`: Save checkpoint asynchronously while the next step executes (default).\n * - `\"sync\"`: Save checkpoint synchronously before the next step starts.\n * - `\"exit\"`: Save checkpoint only when the graph exits.\n * @default \"async\"\n */\n durability?: Durability;\n /**\n * Interrupt execution before entering these nodes.\n */\n interruptBefore?: \"*\" | string[];\n /**\n * Interrupt execution after leaving these nodes.\n */\n interruptAfter?: \"*\" | string[];\n /**\n * Strategy to handle concurrent runs on the same thread. Only relevant if\n * there is a pending/inflight run on the same thread. One of:\n * - \"reject\": Reject the new run.\n * - \"interrupt\": Interrupt the current run, keeping steps completed until now,\n and start a new one.\n * - \"rollback\": Cancel and delete the existing run, rolling back the thread to\n the state before it had started, then start the new run.\n * - \"enqueue\": Queue up the new run to start after the current run finishes.\n */\n multitaskStrategy?: MultitaskStrategy;\n /**\n * Abort controller signal to cancel the run.\n */\n signal?: AbortController[\"signal\"];\n /**\n * Behavior to handle run completion. Only relevant if\n * there is a pending/inflight run on the same thread. One of:\n * - \"complete\": Complete the run.\n * - \"continue\": Continue the run.\n */\n onCompletion?: OnCompletionBehavior;\n /**\n * Webhook to call when the run is complete.\n */\n webhook?: string;\n /**\n * Behavior to handle disconnection. Only relevant if\n * there is a pending/inflight run on the same thread. One of:\n * - \"cancel\": Cancel the run.\n * - \"continue\": Continue the run.\n */\n onDisconnect?: DisconnectMode;\n /**\n * The number of seconds to wait before starting the run.\n * Use to schedule future runs.\n */\n afterSeconds?: number;\n /**\n * Behavior if the specified run doesn't exist. Defaults to \"reject\".\n */\n ifNotExists?: \"create\" | \"reject\";\n /**\n * One or more commands to invoke the graph with.\n */\n command?: Command;\n /**\n * Callback when a run is created.\n */\n onRunCreated?: (params: {\n run_id: string;\n thread_id?: string;\n }) => void;\n /**\n * @internal\n * For LangSmith tracing purposes only. Not part of the public API.\n */\n _langsmithTracer?: LangChainTracer;\n}\nexport interface RunsStreamPayload<TStreamMode extends StreamMode | StreamMode[] = [], TSubgraphs extends boolean = false> extends RunsInvokePayload {\n /**\n * One of `\"values\"`, `\"messages\"`, `\"messages-tuple\"`, `\"updates\"`, `\"events\"`, `\"debug\"`, `\"custom\"`.\n */\n streamMode?: TStreamMode;\n /**\n * Stream output from subgraphs. By default, streams only the top graph.\n */\n streamSubgraphs?: TSubgraphs;\n /**\n * Whether the stream is considered resumable.\n * If true, the stream can be resumed and replayed in its entirety even after disconnection.\n */\n streamResumable?: boolean;\n /**\n * Pass one or more feedbackKeys if you want to request short-lived signed URLs\n * for submitting feedback to LangSmith with this key for this run.\n */\n feedbackKeys?: string[];\n}\nexport interface RunsCreatePayload extends RunsInvokePayload {\n /**\n * One of `\"values\"`, `\"messages\"`, `\"messages-tuple\"`, `\"updates\"`, `\"events\"`, `\"debug\"`, `\"custom\"`.\n */\n streamMode?: StreamMode | Array<StreamMode>;\n /**\n * Stream output from subgraphs. By default, streams only the top graph.\n */\n streamSubgraphs?: boolean;\n /**\n * Whether the stream is considered resumable.\n * If true, the stream can be resumed and replayed in its entirety even after disconnection.\n */\n streamResumable?: boolean;\n}\nexport interface CronsCreatePayload extends RunsCreatePayload {\n /**\n * Schedule for running the Cron Job. Schedules are interpreted in UTC.\n */\n schedule: string;\n /**\n * What to do with the thread after the run completes.\n * - \"delete\" (default): Automatically deletes the thread after the run completes.\n * - \"keep\": Preserves the thread after the run completes, allowing you to retrieve run results later.\n * You are responsible for cleaning up kept threads.\n */\n onRunCompleted?: \"delete\" | \"keep\";\n}\nexport interface RunsWaitPayload extends RunsStreamPayload {\n /**\n * Raise errors returned by the run. Default is `true`.\n */\n raiseError?: boolean;\n}\n"],"mappings":";;;;;KAGYK,iBAAAA;KACAC,kBAAAA;AADAD,KAEAE,oBAAAA,GAFiB,UAAA,GAAA,UAAA;AACjBD,KAEAE,cAAAA,GAFkB,QAAA,GAAA,UAAA;AAClBD,KAEAE,UAAAA,GAFAF,MAAoB,GAAA,OAAA,GAAA,MAAA;AACpBC,KAEAE,WAAAA,GAFc,QAAA,GAAA,UAAA,GAAA,OAAA,GAAA,SAAA,GAAA,QAAA,GAAA,kBAAA,GAAA,mBAAA,GAAA,mBAAA,GAAA,UAAA,GAAA,CAAA,MAAA,GAAA,CAAA,CAAA,CAAA;AACdD,UAEKE,IAAAA,CAFK;EACVD,IAAAA,EAAAA,MAAAA;EACKC,KAAAA,EAAI,OAAA,GAAA,IAAA;AAIrB;AAAwB,UAAPC,OAAAA,CAAO;;;;EAcF,MAAA,CAAA,EAVTC,MAUS,CAAA,MAAA,EAAA,OAAA,CAAA,GAAA,CAAA,MAAA,EAAA,OAAA,CAAA,EAAA,GAAA,IAAA;EAELC;;;QAQFX,CAAAA,EAAAA,OAAAA;;;;;;MAqDFa,CAAAA,EA/DFL,IA+DEK,GA/DKL,IA+DLK,EAAAA,GAAAA,MAAAA,GAAAA,MAAAA,EAAAA;;AAkBMR,UA/EFM,iBAAAA,CA+EEN;;;;EA2BFS,KAAAA,CAAAA,EAtGLJ,MAsGKI,CAAAA,MAAiB,EAAA,OAAA,CAAA,GAAA,IAAA;EAAA;;;UAIjBC,CAAAA,EAtGFf,QAsGEe;;;;EAgBAE,MAAAA,CAAAA,EAlHJlB,MAkHIkB;EAAiB;;;;SAASN,CAAAA,EAAAA,OAAAA;EAAiB;AAe5D;
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":["LangChainTracer","Checkpoint","Config","Metadata","StreamMode","MultitaskStrategy","OnConflictBehavior","OnCompletionBehavior","DisconnectMode","Durability","StreamEvent","Send","Command","Record","RunsInvokePayload","Omit","AbortController","RunsStreamPayload","TStreamMode","TSubgraphs","RunsCreatePayload","Array","CronsCreatePayload","CronsUpdatePayload","RunsWaitPayload"],"sources":["../src/types.d.ts"],"sourcesContent":["import { LangChainTracer } from \"@langchain/core/tracers/tracer_langchain\";\nimport { Checkpoint, Config, Metadata } from \"./schema.js\";\nimport { StreamMode } from \"./types.stream.js\";\nexport type MultitaskStrategy = \"reject\" | \"interrupt\" | \"rollback\" | \"enqueue\";\nexport type OnConflictBehavior = \"raise\" | \"do_nothing\";\nexport type OnCompletionBehavior = \"complete\" | \"continue\";\nexport type DisconnectMode = \"cancel\" | \"continue\";\nexport type Durability = \"exit\" | \"async\" | \"sync\";\nexport type StreamEvent = \"events\" | \"metadata\" | \"debug\" | \"updates\" | \"values\" | \"messages/partial\" | \"messages/metadata\" | \"messages/complete\" | \"messages\" | (string & {});\nexport interface Send {\n node: string;\n input: unknown | null;\n}\nexport interface Command {\n /**\n * An object to update the thread state with.\n */\n update?: Record<string, unknown> | [string, unknown][] | null;\n /**\n * The value to return from an `interrupt` function call.\n */\n resume?: unknown;\n /**\n * Determine the next node to navigate to. Can be one of the following:\n * - Name(s) of the node names to navigate to next.\n * - `Send` command(s) to execute node(s) with provided input.\n */\n goto?: Send | Send[] | string | string[];\n}\nexport interface RunsInvokePayload {\n /**\n * Input to the run. Pass `null` to resume from the current state of the thread.\n */\n input?: Record<string, unknown> | null;\n /**\n * Metadata for the run.\n */\n metadata?: Metadata;\n /**\n * Additional configuration for the run.\n */\n config?: Config;\n /**\n * Static context to add to the assistant.\n * @remarks Added in LangGraph.js 0.4\n */\n context?: unknown;\n /**\n * Checkpoint ID for when creating a new run.\n */\n checkpointId?: string;\n /**\n * Checkpoint for when creating a new run.\n */\n checkpoint?: Omit<Checkpoint, \"thread_id\">;\n /**\n * Whether to checkpoint during the run (or only at the end/interruption).\n * @deprecated Use `durability` instead.\n */\n checkpointDuring?: boolean;\n /**\n * Whether to checkpoint during the run (or only at the end/interruption).\n * - `\"async\"`: Save checkpoint asynchronously while the next step executes (default).\n * - `\"sync\"`: Save checkpoint synchronously before the next step starts.\n * - `\"exit\"`: Save checkpoint only when the graph exits.\n * @default \"async\"\n */\n durability?: Durability;\n /**\n * Interrupt execution before entering these nodes.\n */\n interruptBefore?: \"*\" | string[];\n /**\n * Interrupt execution after leaving these nodes.\n */\n interruptAfter?: \"*\" | string[];\n /**\n * Strategy to handle concurrent runs on the same thread. Only relevant if\n * there is a pending/inflight run on the same thread. One of:\n * - \"reject\": Reject the new run.\n * - \"interrupt\": Interrupt the current run, keeping steps completed until now,\n and start a new one.\n * - \"rollback\": Cancel and delete the existing run, rolling back the thread to\n the state before it had started, then start the new run.\n * - \"enqueue\": Queue up the new run to start after the current run finishes.\n */\n multitaskStrategy?: MultitaskStrategy;\n /**\n * Abort controller signal to cancel the run.\n */\n signal?: AbortController[\"signal\"];\n /**\n * Behavior to handle run completion. Only relevant if\n * there is a pending/inflight run on the same thread. One of:\n * - \"complete\": Complete the run.\n * - \"continue\": Continue the run.\n */\n onCompletion?: OnCompletionBehavior;\n /**\n * Webhook to call when the run is complete.\n */\n webhook?: string;\n /**\n * Behavior to handle disconnection. Only relevant if\n * there is a pending/inflight run on the same thread. One of:\n * - \"cancel\": Cancel the run.\n * - \"continue\": Continue the run.\n */\n onDisconnect?: DisconnectMode;\n /**\n * The number of seconds to wait before starting the run.\n * Use to schedule future runs.\n */\n afterSeconds?: number;\n /**\n * Behavior if the specified run doesn't exist. Defaults to \"reject\".\n */\n ifNotExists?: \"create\" | \"reject\";\n /**\n * One or more commands to invoke the graph with.\n */\n command?: Command;\n /**\n * Callback when a run is created.\n */\n onRunCreated?: (params: {\n run_id: string;\n thread_id?: string;\n }) => void;\n /**\n * @internal\n * For LangSmith tracing purposes only. Not part of the public API.\n */\n _langsmithTracer?: LangChainTracer;\n}\nexport interface RunsStreamPayload<TStreamMode extends StreamMode | StreamMode[] = [], TSubgraphs extends boolean = false> extends RunsInvokePayload {\n /**\n * One of `\"values\"`, `\"messages\"`, `\"messages-tuple\"`, `\"updates\"`, `\"events\"`, `\"debug\"`, `\"custom\"`.\n */\n streamMode?: TStreamMode;\n /**\n * Stream output from subgraphs. By default, streams only the top graph.\n */\n streamSubgraphs?: TSubgraphs;\n /**\n * Whether the stream is considered resumable.\n * If true, the stream can be resumed and replayed in its entirety even after disconnection.\n */\n streamResumable?: boolean;\n /**\n * Pass one or more feedbackKeys if you want to request short-lived signed URLs\n * for submitting feedback to LangSmith with this key for this run.\n */\n feedbackKeys?: string[];\n}\nexport interface RunsCreatePayload extends RunsInvokePayload {\n /**\n * One of `\"values\"`, `\"messages\"`, `\"messages-tuple\"`, `\"updates\"`, `\"events\"`, `\"debug\"`, `\"custom\"`.\n */\n streamMode?: StreamMode | Array<StreamMode>;\n /**\n * Stream output from subgraphs. By default, streams only the top graph.\n */\n streamSubgraphs?: boolean;\n /**\n * Whether the stream is considered resumable.\n * If true, the stream can be resumed and replayed in its entirety even after disconnection.\n */\n streamResumable?: boolean;\n}\nexport interface CronsCreatePayload extends RunsCreatePayload {\n /**\n * Schedule for running the Cron Job. Schedules are interpreted in UTC.\n */\n schedule: string;\n /**\n * What to do with the thread after the run completes.\n * - \"delete\" (default): Automatically deletes the thread after the run completes.\n * - \"keep\": Preserves the thread after the run completes, allowing you to retrieve run results later.\n * You are responsible for cleaning up kept threads.\n */\n onRunCompleted?: \"delete\" | \"keep\";\n /**\n * Whether the cron is enabled.\n */\n enabled?: boolean;\n}\nexport interface CronsUpdatePayload extends RunsInvokePayload {\n schedule?: string;\n endTime?: string;\n /**\n * What to do with the thread after the run completes.\n * - \"delete\" (default): Automatically deletes the thread after the run completes.\n * - \"keep\": Preserves the thread after the run completes, allowing you to retrieve run results later.\n * You are responsible for cleaning up kept threads.\n */\n onRunCompleted?: \"delete\" | \"keep\";\n enabled?: boolean;\n}\nexport interface RunsWaitPayload extends RunsStreamPayload {\n /**\n * Raise errors returned by the run. Default is `true`.\n */\n raiseError?: boolean;\n}\n"],"mappings":";;;;;KAGYK,iBAAAA;KACAC,kBAAAA;AADAD,KAEAE,oBAAAA,GAFiB,UAAA,GAAA,UAAA;AACjBD,KAEAE,cAAAA,GAFkB,QAAA,GAAA,UAAA;AAClBD,KAEAE,UAAAA,GAFAF,MAAoB,GAAA,OAAA,GAAA,MAAA;AACpBC,KAEAE,WAAAA,GAFc,QAAA,GAAA,UAAA,GAAA,OAAA,GAAA,SAAA,GAAA,QAAA,GAAA,kBAAA,GAAA,mBAAA,GAAA,mBAAA,GAAA,UAAA,GAAA,CAAA,MAAA,GAAA,CAAA,CAAA,CAAA;AACdD,UAEKE,IAAAA,CAFK;EACVD,IAAAA,EAAAA,MAAAA;EACKC,KAAAA,EAAI,OAAA,GAAA,IAAA;AAIrB;AAAwB,UAAPC,OAAAA,CAAO;;;;EAcF,MAAA,CAAA,EAVTC,MAUS,CAAA,MAAA,EAAA,OAAA,CAAA,GAAA,CAAA,MAAA,EAAA,OAAA,CAAA,EAAA,GAAA,IAAA;EAELC;;;QAQFX,CAAAA,EAAAA,OAAAA;;;;;;MAqDFa,CAAAA,EA/DFL,IA+DEK,GA/DKL,IA+DLK,EAAAA,GAAAA,MAAAA,GAAAA,MAAAA,EAAAA;;AAkBMR,UA/EFM,iBAAAA,CA+EEN;;;;EA2BFS,KAAAA,CAAAA,EAtGLJ,MAsGKI,CAAAA,MAAiB,EAAA,OAAA,CAAA,GAAA,IAAA;EAAA;;;UAIjBC,CAAAA,EAtGFf,QAsGEe;;;;EAgBAE,MAAAA,CAAAA,EAlHJlB,MAkHIkB;EAAiB;;;;SAASN,CAAAA,EAAAA,OAAAA;EAAiB;AAe5D;AAiBA;EAYiBU,YAAAA,CAAAA,EAAAA,MAAe;;;;eAjJfT,KAAKd;;;;;;;;;;;;;eAaLQ;;;;;;;;;;;;;;;;;;;sBAmBOJ;;;;WAIXW;;;;;;;iBAOMT;;;;;;;;;;;iBAWAC;;;;;;;;;;;;;YAaLI;;;;;;;;;;;;qBAYSZ;;UAENiB,sCAAsCb,aAAaA,+DAA+DU;;;;eAIlHI;;;;oBAIKC;;;;;;;;;;;;UAYLC,iBAAAA,SAA0BN;;;;eAI1BV,aAAaiB,MAAMjB;;;;;;;;;;;UAWnBkB,kBAAAA,SAA2BF;;;;;;;;;;;;;;;;;UAiB3BG,kBAAAA,SAA2BT;;;;;;;;;;;;UAY3BU,eAAAA,SAAwBP"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.stream.d.cts","names":["Message","Interrupt","Metadata","Config","ThreadTask","StreamMode","ThreadStreamMode","MessageTupleMetadata","AsSubgraph","TEvent","ValuesStreamEvent","StateType","SubgraphValuesStreamEvent","MessagesTupleStreamEvent","SubgraphMessagesTupleStreamEvent","MetadataStreamEvent","ErrorStreamEvent","SubgraphErrorStreamEvent","UpdatesStreamEvent","UpdateType","SubgraphUpdatesStreamEvent","CustomStreamEvent","T","SubgraphCustomStreamEvent","MessagesMetadataStreamEvent","MessagesCompleteStreamEvent","MessagesPartialStreamEvent","TasksStreamCreateEvent","TasksStreamResultEvent","TasksStreamErrorEvent","TasksStreamEvent","SubgraphTasksStreamEvent","CheckpointsStreamEvent","SubgraphCheckpointsStreamEvent","MessagesStreamEvent","SubgraphMessagesStreamEvent","DebugStreamEvent","SubgraphDebugStreamEvent","EventsStreamEvent","Record","SubgraphEventsStreamEvent","FeedbackStreamEvent","GetStreamModeMap","TStateType","TUpdateType","TCustomType","TStreamMode","GetSubgraphsStreamModeMap","TypedAsyncGenerator","TSubgraphs","AsyncGenerator"],"sources":["../src/types.stream.d.ts"],"sourcesContent":["import type { Message } from \"./types.messages.js\";\nimport type { Interrupt, Metadata, Config, ThreadTask } from \"./schema.js\";\n/**\nimport type { SubgraphCheckpointsStreamEvent } from \"./types.stream.subgraph.js\";\n * Stream modes\n * - \"values\": Stream only the state values.\n * - \"messages\": Stream complete messages.\n * - \"messages-tuple\": Stream (message chunk, metadata) tuples.\n * - \"updates\": Stream updates to the state.\n * - \"events\": Stream events occurring during execution.\n * - \"debug\": Stream detailed debug information.\n * - \"custom\": Stream custom events.\n */\nexport type StreamMode = \"values\" | \"messages\" | \"updates\" | \"events\" | \"debug\" | \"tasks\" | \"checkpoints\" | \"custom\" | \"messages-tuple\";\nexport type ThreadStreamMode = \"run_modes\" | \"lifecycle\" | \"state_update\";\ntype MessageTupleMetadata = {\n tags: string[];\n [key: string]: unknown;\n};\ntype AsSubgraph<TEvent extends {\n id?: string;\n event: string;\n data: unknown;\n}> = {\n id?: TEvent[\"id\"];\n event: TEvent[\"event\"] | `${TEvent[\"event\"]}|${string}`;\n data: TEvent[\"data\"];\n};\n/**\n * Stream event with values after completion of each step.\n */\nexport type ValuesStreamEvent<StateType> = {\n id?: string;\n event: \"values\";\n data: StateType;\n};\n/** @internal */\nexport type SubgraphValuesStreamEvent<StateType> = AsSubgraph<ValuesStreamEvent<StateType>>;\n/**\n * Stream event with message chunks coming from LLM invocations inside nodes.\n */\nexport type MessagesTupleStreamEvent = {\n event: \"messages\";\n data: [message: Message, config: MessageTupleMetadata];\n};\n/** @internal */\nexport type SubgraphMessagesTupleStreamEvent = AsSubgraph<MessagesTupleStreamEvent>;\n/**\n * Metadata stream event with information about the run and thread\n */\nexport type MetadataStreamEvent = {\n id?: string;\n event: \"metadata\";\n data: {\n run_id: string;\n thread_id: string;\n };\n};\n/**\n * Stream event with error information.\n */\nexport type ErrorStreamEvent = {\n id?: string;\n event: \"error\";\n data: {\n error: string;\n message: string;\n };\n};\n/** @internal */\nexport type SubgraphErrorStreamEvent = AsSubgraph<ErrorStreamEvent>;\n/**\n * Stream event with updates to the state after each step.\n * The streamed outputs include the name of the node that\n * produced the update as well as the update.\n */\nexport type UpdatesStreamEvent<UpdateType> = {\n id?: string;\n event: \"updates\";\n data: {\n [node: string]: UpdateType;\n };\n};\n/** @internal */\nexport type SubgraphUpdatesStreamEvent<UpdateType> = AsSubgraph<UpdatesStreamEvent<UpdateType>>;\n/**\n * Streaming custom data from inside the nodes.\n */\nexport type CustomStreamEvent<T> = {\n event: \"custom\";\n data: T;\n};\n/** @internal */\nexport type SubgraphCustomStreamEvent<T> = AsSubgraph<CustomStreamEvent<T>>;\ntype MessagesMetadataStreamEvent = {\n id?: string;\n event: \"messages/metadata\";\n data: {\n [messageId: string]: {\n metadata: unknown;\n };\n };\n};\ntype MessagesCompleteStreamEvent = {\n id?: string;\n event: \"messages/complete\";\n data: Message[];\n};\ntype MessagesPartialStreamEvent = {\n id?: string;\n event: \"messages/partial\";\n data: Message[];\n};\ntype TasksStreamCreateEvent<StateType> = {\n id?: string;\n event: \"tasks\";\n data: {\n id: string;\n name: string;\n interrupts: Interrupt[];\n input: StateType;\n triggers: string[];\n };\n};\ntype TasksStreamResultEvent<UpdateType> = {\n id?: string;\n event: \"tasks\";\n data: {\n id: string;\n name: string;\n interrupts: Interrupt[];\n result: [string, UpdateType][];\n };\n};\ntype TasksStreamErrorEvent = {\n id?: string;\n event: \"tasks\";\n data: {\n id: string;\n name: string;\n interrupts: Interrupt[];\n error: string;\n };\n};\nexport type TasksStreamEvent<StateType, UpdateType> = TasksStreamCreateEvent<StateType> | TasksStreamResultEvent<UpdateType> | TasksStreamErrorEvent;\ntype SubgraphTasksStreamEvent<StateType, UpdateType> = AsSubgraph<TasksStreamCreateEvent<StateType>> | AsSubgraph<TasksStreamResultEvent<UpdateType>> | AsSubgraph<TasksStreamErrorEvent>;\nexport type CheckpointsStreamEvent<StateType> = {\n id?: string;\n event: \"checkpoints\";\n data: {\n values: StateType;\n next: string[];\n config: Config;\n metadata: Metadata;\n tasks: ThreadTask[];\n };\n};\ntype SubgraphCheckpointsStreamEvent<StateType> = AsSubgraph<CheckpointsStreamEvent<StateType>>;\n/**\n * Message stream event specific to LangGraph Server.\n * @deprecated Use `streamMode: \"messages-tuple\"` instead.\n */\nexport type MessagesStreamEvent = MessagesMetadataStreamEvent | MessagesCompleteStreamEvent | MessagesPartialStreamEvent;\n/** @internal */\nexport type SubgraphMessagesStreamEvent = AsSubgraph<MessagesMetadataStreamEvent> | AsSubgraph<MessagesCompleteStreamEvent> | AsSubgraph<MessagesPartialStreamEvent>;\n/**\n * Stream event with detailed debug information.\n */\nexport type DebugStreamEvent = {\n id?: string;\n event: \"debug\";\n data: unknown;\n};\n/** @internal */\nexport type SubgraphDebugStreamEvent = AsSubgraph<DebugStreamEvent>;\n/**\n * Stream event with events occurring during execution.\n */\nexport type EventsStreamEvent = {\n id?: string;\n event: \"events\";\n data: {\n event: `on_${\"chat_model\" | \"llm\" | \"chain\" | \"tool\" | \"retriever\" | \"prompt\"}_${\"start\" | \"stream\" | \"end\"}` | (string & {});\n name: string;\n tags: string[];\n run_id: string;\n metadata: Record<string, unknown>;\n parent_ids: string[];\n data: unknown;\n };\n};\n/** @internal */\nexport type SubgraphEventsStreamEvent = AsSubgraph<EventsStreamEvent>;\n/**\n * Stream event with a feedback key to signed URL map. Set `feedbackKeys` in\n * the `RunsStreamPayload` to receive this event.\n */\nexport type FeedbackStreamEvent = {\n id?: string;\n event: \"feedback\";\n data: {\n [feedbackKey: string]: string;\n };\n};\ntype GetStreamModeMap<TStreamMode extends StreamMode | StreamMode[], TStateType = unknown, TUpdateType = TStateType, TCustomType = unknown> = {\n values: ValuesStreamEvent<TStateType>;\n updates: UpdatesStreamEvent<TUpdateType>;\n custom: CustomStreamEvent<TCustomType>;\n debug: DebugStreamEvent;\n messages: MessagesStreamEvent;\n \"messages-tuple\": MessagesTupleStreamEvent;\n tasks: TasksStreamEvent<TStateType, TUpdateType>;\n checkpoints: CheckpointsStreamEvent<TStateType>;\n events: EventsStreamEvent;\n}[TStreamMode extends StreamMode[] ? TStreamMode[number] : TStreamMode] | ErrorStreamEvent | MetadataStreamEvent | FeedbackStreamEvent;\ntype GetSubgraphsStreamModeMap<TStreamMode extends StreamMode | StreamMode[], TStateType = unknown, TUpdateType = TStateType, TCustomType = unknown> = {\n values: SubgraphValuesStreamEvent<TStateType>;\n updates: SubgraphUpdatesStreamEvent<TUpdateType>;\n custom: SubgraphCustomStreamEvent<TCustomType>;\n debug: SubgraphDebugStreamEvent;\n messages: SubgraphMessagesStreamEvent;\n \"messages-tuple\": SubgraphMessagesTupleStreamEvent;\n events: SubgraphEventsStreamEvent;\n tasks: SubgraphTasksStreamEvent<TStateType, TUpdateType>;\n checkpoints: SubgraphCheckpointsStreamEvent<TStateType>;\n}[TStreamMode extends StreamMode[] ? TStreamMode[number] : TStreamMode] | SubgraphErrorStreamEvent | MetadataStreamEvent | FeedbackStreamEvent;\nexport type TypedAsyncGenerator<TStreamMode extends StreamMode | StreamMode[] = [], TSubgraphs extends boolean = false, TStateType = unknown, TUpdateType = TStateType, TCustomType = unknown> = AsyncGenerator<TSubgraphs extends true ? GetSubgraphsStreamModeMap<TStreamMode, TStateType, TUpdateType, TCustomType> : GetStreamModeMap<TStreamMode, TStateType, TUpdateType, TCustomType>>;\nexport {};\n"],"mappings":";;;;;;;AAaA;AACA;AAA0E;AACjD;;;;;;AAWT,KAbJK,UAAAA,GAaI,QAAA,GAAA,UAAA,GAAA,SAAA,GAAA,QAAA,GAAA,OAAA,GAAA,OAAA,GAAA,aAAA,GAAA,QAAA,GAAA,gBAAA;AAKJK,KAjBAJ,gBAAAA,GAiBiB,WAGnBK,GAAS,WAAA,GAAA,cAAA;AAGnB,KAtBKJ,oBAAAA,GAsBOK;EAAyB,IAAA,EAAA,MAAA,EAAA;MAA2CD,EAAAA,MAAAA,CAAAA,EAAAA,OAAAA;;KAlB3EH,UAkB8CA,CAAAA,eAAAA;E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7SD,mBAAAA,GA6B6SC;KAAxHQ,EAAAA,MAAAA;EAAc,KAAA,EAAA,UAAA;;;;;KAtB1MR,qCAAqCrC,aAAaA,kDAAkDsC;UAC7FjC,kBAAkBiC;WACjBzB,mBAAmB0B;UACpBvB,kBAAkBwB;SACnBT;YACGF;oBACQrB;SACXiB,iBAAiBa,YAAYC;eACvBZ,uBAAuBW;UAC5BL;EACVQ,oBAAoBzC,eAAeyC,sBAAsBA,eAAe9B,mBAAmBD,sBAAsB0B;KAC9GM,8CAA8C1C,aAAaA,kDAAkDsC;UACtG/B,0BAA0B+B;WACzBvB,2BAA2BwB;UAC5BrB,0BAA0BsB;SAC3BR;YACGF;oBACQrB;UACV0B;SACDT,yBAAyBY,YAAYC;eAC/BX,+BAA+BU;EAC9CG,oBAAoBzC,eAAeyC,sBAAsBA,eAAe7B,2BAA2BF,sBAAsB0B;KAC/GO,wCAAwC3C,aAAaA,2FAA2FsC,qCAAqCO,eAAeD,0BAA0BF,0BAA0BD,aAAaH,YAAYC,aAAaC,eAAeH,iBAAiBI,aAAaH,YAAYC,aAAaC"}
|
|
1
|
+
{"version":3,"file":"types.stream.d.cts","names":["Message","Interrupt","Metadata","Config","ThreadTask","StreamMode","ThreadStreamMode","MessageTupleMetadata","AsSubgraph","TEvent","ValuesStreamEvent","StateType","SubgraphValuesStreamEvent","MessagesTupleStreamEvent","SubgraphMessagesTupleStreamEvent","MetadataStreamEvent","ErrorStreamEvent","SubgraphErrorStreamEvent","UpdatesStreamEvent","UpdateType","SubgraphUpdatesStreamEvent","CustomStreamEvent","T","SubgraphCustomStreamEvent","MessagesMetadataStreamEvent","MessagesCompleteStreamEvent","MessagesPartialStreamEvent","TasksStreamCreateEvent","TasksStreamResultEvent","TasksStreamErrorEvent","TasksStreamEvent","SubgraphTasksStreamEvent","CheckpointsStreamEvent","SubgraphCheckpointsStreamEvent","MessagesStreamEvent","SubgraphMessagesStreamEvent","DebugStreamEvent","SubgraphDebugStreamEvent","EventsStreamEvent","Record","SubgraphEventsStreamEvent","FeedbackStreamEvent","GetStreamModeMap","TStateType","TUpdateType","TCustomType","TStreamMode","GetSubgraphsStreamModeMap","TypedAsyncGenerator","TSubgraphs","AsyncGenerator"],"sources":["../src/types.stream.d.ts"],"sourcesContent":["import type { Message } from \"./types.messages.js\";\nimport type { Interrupt, Metadata, Config, ThreadTask } from \"./schema.js\";\n/**\nimport type { SubgraphCheckpointsStreamEvent } from \"./types.stream.subgraph.js\";\n * Stream modes\n * - \"values\": Stream only the state values.\n * - \"messages\": Stream complete messages.\n * - \"messages-tuple\": Stream (message chunk, metadata) tuples.\n * - \"updates\": Stream updates to the state.\n * - \"events\": Stream events occurring during execution.\n * - \"debug\": Stream detailed debug information.\n * - \"custom\": Stream custom events.\n */\nexport type StreamMode = \"values\" | \"messages\" | \"updates\" | \"events\" | \"debug\" | \"tasks\" | \"checkpoints\" | \"custom\" | \"messages-tuple\";\nexport type ThreadStreamMode = \"run_modes\" | \"lifecycle\" | \"state_update\";\ntype MessageTupleMetadata = {\n tags: string[];\n [key: string]: unknown;\n};\ntype AsSubgraph<TEvent extends {\n id?: string;\n event: string;\n data: unknown;\n}> = {\n id?: TEvent[\"id\"];\n event: TEvent[\"event\"] | `${TEvent[\"event\"]}|${string}`;\n data: TEvent[\"data\"];\n};\n/**\n * Stream event with values after completion of each step.\n */\nexport type ValuesStreamEvent<StateType> = {\n id?: string;\n event: \"values\";\n data: StateType;\n};\n/** @internal */\nexport type SubgraphValuesStreamEvent<StateType> = AsSubgraph<ValuesStreamEvent<StateType>>;\n/**\n * Stream event with message chunks coming from LLM invocations inside nodes.\n */\nexport type MessagesTupleStreamEvent = {\n event: \"messages\";\n data: [message: Message, config: MessageTupleMetadata];\n};\n/** @internal */\nexport type SubgraphMessagesTupleStreamEvent = AsSubgraph<MessagesTupleStreamEvent>;\n/**\n * Metadata stream event with information about the run and thread\n */\nexport type MetadataStreamEvent = {\n id?: string;\n event: \"metadata\";\n data: {\n run_id: string;\n thread_id: string;\n };\n};\n/**\n * Stream event with error information.\n */\nexport type ErrorStreamEvent = {\n id?: string;\n event: \"error\";\n data: {\n error: string;\n message: string;\n };\n};\n/** @internal */\nexport type SubgraphErrorStreamEvent = AsSubgraph<ErrorStreamEvent>;\n/**\n * Stream event with updates to the state after each step.\n * The streamed outputs include the name of the node that\n * produced the update as well as the update.\n */\nexport type UpdatesStreamEvent<UpdateType> = {\n id?: string;\n event: \"updates\";\n data: {\n [node: string]: UpdateType;\n };\n};\n/** @internal */\nexport type SubgraphUpdatesStreamEvent<UpdateType> = AsSubgraph<UpdatesStreamEvent<UpdateType>>;\n/**\n * Streaming custom data from inside the nodes.\n */\nexport type CustomStreamEvent<T> = {\n event: \"custom\";\n data: T;\n};\n/** @internal */\nexport type SubgraphCustomStreamEvent<T> = AsSubgraph<CustomStreamEvent<T>>;\ntype MessagesMetadataStreamEvent = {\n id?: string;\n event: \"messages/metadata\";\n data: {\n [messageId: string]: {\n metadata: unknown;\n };\n };\n};\ntype MessagesCompleteStreamEvent = {\n id?: string;\n event: \"messages/complete\";\n data: Message[];\n};\ntype MessagesPartialStreamEvent = {\n id?: string;\n event: \"messages/partial\";\n data: Message[];\n};\ntype TasksStreamCreateEvent<StateType> = {\n id?: string;\n event: \"tasks\";\n data: {\n id: string;\n name: string;\n interrupts: Interrupt[];\n input: StateType;\n triggers: string[];\n };\n};\ntype TasksStreamResultEvent<UpdateType> = {\n id?: string;\n event: \"tasks\";\n data: {\n id: string;\n name: string;\n interrupts: Interrupt[];\n result: [string, UpdateType][];\n };\n};\ntype TasksStreamErrorEvent = {\n id?: string;\n event: \"tasks\";\n data: {\n id: string;\n name: string;\n interrupts: Interrupt[];\n error: string;\n };\n};\nexport type TasksStreamEvent<StateType, UpdateType> = TasksStreamCreateEvent<StateType> | TasksStreamResultEvent<UpdateType> | TasksStreamErrorEvent;\ntype SubgraphTasksStreamEvent<StateType, UpdateType> = AsSubgraph<TasksStreamCreateEvent<StateType>> | AsSubgraph<TasksStreamResultEvent<UpdateType>> | AsSubgraph<TasksStreamErrorEvent>;\nexport type CheckpointsStreamEvent<StateType> = {\n id?: string;\n event: \"checkpoints\";\n data: {\n values: StateType;\n next: string[];\n config: Config;\n metadata: Metadata;\n tasks: ThreadTask[];\n };\n};\ntype SubgraphCheckpointsStreamEvent<StateType> = AsSubgraph<CheckpointsStreamEvent<StateType>>;\n/**\n * Message stream event specific to LangGraph Server.\n * @deprecated Use `streamMode: \"messages-tuple\"` instead.\n */\nexport type MessagesStreamEvent = MessagesMetadataStreamEvent | MessagesCompleteStreamEvent | MessagesPartialStreamEvent;\n/** @internal */\nexport type SubgraphMessagesStreamEvent = AsSubgraph<MessagesMetadataStreamEvent> | AsSubgraph<MessagesCompleteStreamEvent> | AsSubgraph<MessagesPartialStreamEvent>;\n/**\n * Stream event with detailed debug information.\n */\nexport type DebugStreamEvent = {\n id?: string;\n event: \"debug\";\n data: unknown;\n};\n/** @internal */\nexport type SubgraphDebugStreamEvent = AsSubgraph<DebugStreamEvent>;\n/**\n * Stream event with events occurring during execution.\n */\nexport type EventsStreamEvent = {\n id?: string;\n event: \"events\";\n data: {\n event: `on_${\"chat_model\" | \"llm\" | \"chain\" | \"tool\" | \"retriever\" | \"prompt\"}_${\"start\" | \"stream\" | \"end\"}` | (string & {});\n name: string;\n tags: string[];\n run_id: string;\n metadata: Record<string, unknown>;\n parent_ids: string[];\n data: unknown;\n };\n};\n/** @internal */\nexport type SubgraphEventsStreamEvent = AsSubgraph<EventsStreamEvent>;\n/**\n * Stream event with a feedback key to signed URL map. Set `feedbackKeys` in\n * the `RunsStreamPayload` to receive this event.\n */\nexport type FeedbackStreamEvent = {\n id?: string;\n event: \"feedback\";\n data: {\n [feedbackKey: string]: string;\n };\n};\ntype GetStreamModeMap<TStreamMode extends StreamMode | StreamMode[], TStateType = unknown, TUpdateType = TStateType, TCustomType = unknown> = {\n values: ValuesStreamEvent<TStateType>;\n updates: UpdatesStreamEvent<TUpdateType>;\n custom: CustomStreamEvent<TCustomType>;\n debug: DebugStreamEvent;\n messages: MessagesStreamEvent;\n \"messages-tuple\": MessagesTupleStreamEvent;\n tasks: TasksStreamEvent<TStateType, TUpdateType>;\n checkpoints: CheckpointsStreamEvent<TStateType>;\n events: EventsStreamEvent;\n}[TStreamMode extends StreamMode[] ? TStreamMode[number] : TStreamMode] | ErrorStreamEvent | MetadataStreamEvent | FeedbackStreamEvent;\ntype GetSubgraphsStreamModeMap<TStreamMode extends StreamMode | StreamMode[], TStateType = unknown, TUpdateType = TStateType, TCustomType = unknown> = {\n values: SubgraphValuesStreamEvent<TStateType>;\n updates: SubgraphUpdatesStreamEvent<TUpdateType>;\n custom: SubgraphCustomStreamEvent<TCustomType>;\n debug: SubgraphDebugStreamEvent;\n messages: SubgraphMessagesStreamEvent;\n \"messages-tuple\": SubgraphMessagesTupleStreamEvent;\n events: SubgraphEventsStreamEvent;\n tasks: SubgraphTasksStreamEvent<TStateType, TUpdateType>;\n checkpoints: SubgraphCheckpointsStreamEvent<TStateType>;\n}[TStreamMode extends StreamMode[] ? TStreamMode[number] : TStreamMode] | SubgraphErrorStreamEvent | MetadataStreamEvent | FeedbackStreamEvent;\nexport type TypedAsyncGenerator<TStreamMode extends StreamMode | StreamMode[] = [], TSubgraphs extends boolean = false, TStateType = unknown, TUpdateType = TStateType, TCustomType = unknown> = AsyncGenerator<TSubgraphs extends true ? GetSubgraphsStreamModeMap<TStreamMode, TStateType, TUpdateType, TCustomType> : GetStreamModeMap<TStreamMode, TStateType, TUpdateType, TCustomType>>;\nexport {};\n"],"mappings":";;;;;;;AAaA;AACA;AAA0E;AACjD;;;;;;AAWT,KAbJK,UAAAA,GAaI,QAAA,GAAA,UAAA,GAAA,SAAA,GAAA,QAAA,GAAA,OAAA,GAAA,OAAA,GAAA,aAAA,GAAA,QAAA,GAAA,gBAAA;AAKJK,KAjBAJ,gBAAAA,GAiBiB,WAGnBK,GAAAA,WAAS,GAAA,cAAA;AAGnB,KAtBKJ,oBAAAA,GAsBOK;EAA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AAA,OAAAA;;;;AAA1BC,KAlC9NP,yBAAAA,GAA4BhC,UAkCkMuC,CAlCvLT,iBAkCuLS,CAAAA;;;;;AAA+EL,KA7B7SD,mBAAAA,GA6B6SC;KAAxHQ,EAAAA,MAAAA;EAAc,KAAA,EAAA,UAAA;;;;;KAtB1MR,qCAAqCrC,aAAaA,kDAAkDsC;UAC7FjC,kBAAkBiC;WACjBzB,mBAAmB0B;UACpBvB,kBAAkBwB;SACnBT;YACGF;oBACQrB;SACXiB,iBAAiBa,YAAYC;eACvBZ,uBAAuBW;UAC5BL;EACVQ,oBAAoBzC,eAAeyC,sBAAsBA,eAAe9B,mBAAmBD,sBAAsB0B;KAC9GM,8CAA8C1C,aAAaA,kDAAkDsC;UACtG/B,0BAA0B+B;WACzBvB,2BAA2BwB;UAC5BrB,0BAA0BsB;SAC3BR;YACGF;oBACQrB;UACV0B;SACDT,yBAAyBY,YAAYC;eAC/BX,+BAA+BU;EAC9CG,oBAAoBzC,eAAeyC,sBAAsBA,eAAe7B,2BAA2BF,sBAAsB0B;KAC/GO,wCAAwC3C,aAAaA,2FAA2FsC,qCAAqCO,eAAeD,0BAA0BF,0BAA0BD,aAAaH,YAAYC,aAAaC,eAAeH,iBAAiBI,aAAaH,YAAYC,aAAaC"}
|
package/dist/ui/branching.cjs
CHANGED
|
@@ -22,16 +22,16 @@ function getBranchSequence(history) {
|
|
|
22
22
|
});
|
|
23
23
|
const maxId = (...ids) => ids.filter((i) => i != null).sort((a, b) => a.localeCompare(b)).at(-1);
|
|
24
24
|
const lastOrphanedNode = childrenMap.$ == null ? Object.keys(childrenMap).filter((parentId) => !nodeIds.has(parentId)).map((parentId) => {
|
|
25
|
-
const queue
|
|
25
|
+
const queue = [parentId];
|
|
26
26
|
const seen = /* @__PURE__ */ new Set();
|
|
27
27
|
let lastId = parentId;
|
|
28
|
-
while (queue
|
|
29
|
-
const current = queue
|
|
28
|
+
while (queue.length > 0) {
|
|
29
|
+
const current = queue.shift();
|
|
30
30
|
if (seen.has(current)) continue;
|
|
31
31
|
seen.add(current);
|
|
32
32
|
const children = (childrenMap[current] ?? []).flatMap((i) => i.checkpoint?.checkpoint_id ?? []);
|
|
33
33
|
lastId = maxId(lastId, ...children);
|
|
34
|
-
queue
|
|
34
|
+
queue.push(...children);
|
|
35
35
|
}
|
|
36
36
|
return {
|
|
37
37
|
parentId,
|
|
@@ -101,10 +101,10 @@ const ROOT_ID = "$";
|
|
|
101
101
|
function getBranchView(sequence, paths, branch) {
|
|
102
102
|
const path = branch.split(PATH_SEP);
|
|
103
103
|
const pathMap = {};
|
|
104
|
-
for (const path
|
|
105
|
-
const parent = path
|
|
104
|
+
for (const path of paths) {
|
|
105
|
+
const parent = path.at(-2) ?? ROOT_ID;
|
|
106
106
|
pathMap[parent] ??= [];
|
|
107
|
-
pathMap[parent].unshift(path
|
|
107
|
+
pathMap[parent].unshift(path);
|
|
108
108
|
}
|
|
109
109
|
const history = [];
|
|
110
110
|
const branchByCheckpoint = {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"branching.cjs","names":["queue","path"],"sources":["../../src/ui/branching.ts"],"sourcesContent":["import type { ThreadState } from \"../schema.js\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ninterface Node<StateType = any> {\n type: \"node\";\n value: ThreadState<StateType>;\n path: string[];\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ninterface Fork<StateType = any> {\n type: \"fork\";\n items: Array<Sequence<StateType>>;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface Sequence<StateType = any> {\n type: \"sequence\";\n items: Array<Node<StateType> | Fork<StateType>>;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ninterface ValidFork<StateType = any> {\n type: \"fork\";\n items: Array<ValidSequence<StateType>>;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ninterface ValidSequence<StateType = any> {\n type: \"sequence\";\n items: [Node<StateType>, ...(Node<StateType> | ValidFork<StateType>)[]];\n}\n\nexport function getBranchSequence<StateType extends Record<string, unknown>>(\n history: ThreadState<StateType>[]\n) {\n const nodeIds = new Set<string>();\n const childrenMap: Record<string, ThreadState<StateType>[]> = {};\n\n // Short circuit if there's only a singular one state\n if (history.length <= 1) {\n return {\n rootSequence: {\n type: \"sequence\",\n items: history.map((value) => ({ type: \"node\", value, path: [] })),\n } satisfies Sequence<StateType>,\n paths: [],\n };\n }\n\n // First pass - collect nodes for each checkpoint\n history.forEach((state) => {\n const checkpointId = state.parent_checkpoint?.checkpoint_id ?? \"$\";\n childrenMap[checkpointId] ??= [];\n childrenMap[checkpointId].push(state);\n\n if (state.checkpoint?.checkpoint_id != null) {\n nodeIds.add(state.checkpoint.checkpoint_id);\n }\n });\n\n // If dealing with partial history, take the branch\n // with the latest checkpoint and mark it as the root.\n const maxId = (...ids: (string | null)[]) =>\n ids\n .filter((i): i is string => i != null)\n .sort((a, b) => a.localeCompare(b))\n .at(-1)!;\n\n const lastOrphanedNode =\n childrenMap.$ == null\n ? Object.keys(childrenMap)\n .filter((parentId) => !nodeIds.has(parentId))\n .map((parentId) => {\n const queue: string[] = [parentId];\n const seen = new Set<string>();\n\n let lastId = parentId;\n\n while (queue.length > 0) {\n const current = queue.shift()!;\n\n if (seen.has(current)) continue;\n seen.add(current);\n\n const children = (childrenMap[current] ?? []).flatMap(\n (i) => i.checkpoint?.checkpoint_id ?? []\n );\n\n lastId = maxId(lastId, ...children);\n queue.push(...children);\n }\n\n return { parentId, lastId };\n })\n .sort((a, b) => a.lastId.localeCompare(b.lastId))\n .at(-1)?.parentId\n : undefined;\n\n if (lastOrphanedNode != null) childrenMap.$ = childrenMap[lastOrphanedNode];\n\n // Second pass - create a tree of sequences\n type Task = { id: string; sequence: Sequence; path: string[] };\n const rootSequence: Sequence = { type: \"sequence\", items: [] };\n const queue: Task[] = [{ id: \"$\", sequence: rootSequence, path: [] }];\n\n const paths: string[][] = [];\n\n const visited = new Set<string>();\n while (queue.length > 0) {\n const task = queue.shift()!;\n if (visited.has(task.id)) continue;\n visited.add(task.id);\n\n const children = childrenMap[task.id];\n if (children == null || children.length === 0) continue;\n\n // If we've encountered a fork (2+ children), push the fork\n // to the sequence and add a new sequence for each child\n let fork: Fork | undefined;\n if (children.length > 1) {\n fork = { type: \"fork\", items: [] };\n task.sequence.items.push(fork);\n }\n\n for (const value of children) {\n const id = value.checkpoint?.checkpoint_id;\n if (id == null) continue;\n\n let { sequence } = task;\n let { path } = task;\n if (fork != null) {\n sequence = { type: \"sequence\", items: [] };\n fork.items.unshift(sequence);\n\n path = path.slice();\n path.push(id);\n paths.push(path);\n }\n\n sequence.items.push({ type: \"node\", value, path });\n queue.push({ id, sequence, path });\n }\n }\n\n return { rootSequence, paths };\n}\n\nconst PATH_SEP = \">\";\nconst ROOT_ID = \"$\";\n\n// Get flat view\nexport function getBranchView<StateType extends Record<string, unknown>>(\n sequence: Sequence<StateType>,\n paths: string[][],\n branch: string\n) {\n const path = branch.split(PATH_SEP);\n const pathMap: Record<string, string[][]> = {};\n\n for (const path of paths) {\n const parent = path.at(-2) ?? ROOT_ID;\n pathMap[parent] ??= [];\n pathMap[parent].unshift(path);\n }\n\n const history: ThreadState<StateType>[] = [];\n const branchByCheckpoint: Record<\n string,\n { branch: string | undefined; branchOptions: string[] | undefined }\n > = {};\n\n const forkStack = path.slice();\n const queue: (Node<StateType> | Fork<StateType>)[] = [...sequence.items];\n\n while (queue.length > 0) {\n const item = queue.shift()!;\n\n if (item.type === \"node\") {\n history.push(item.value);\n const checkpointId = item.value.checkpoint?.checkpoint_id;\n if (checkpointId == null) continue;\n\n branchByCheckpoint[checkpointId] = {\n branch: item.path.join(PATH_SEP),\n branchOptions: (item.path.length > 0\n ? pathMap[item.path.at(-2) ?? ROOT_ID] ?? []\n : []\n ).map((p) => p.join(PATH_SEP)),\n };\n }\n if (item.type === \"fork\") {\n const forkId = forkStack.shift();\n const index =\n forkId != null\n ? item.items.findIndex((value) => {\n const firstItem = value.items.at(0);\n if (!firstItem || firstItem.type !== \"node\") return false;\n return firstItem.value.checkpoint?.checkpoint_id === forkId;\n })\n : -1;\n\n const nextItems = item.items.at(index)?.items ?? [];\n queue.push(...nextItems);\n }\n }\n\n return { history, branchByCheckpoint };\n}\n\nexport function getBranchContext<StateType extends Record<string, unknown>>(\n branch: string,\n history: ThreadState<StateType>[] | undefined\n) {\n const { rootSequence: branchTree, paths } = getBranchSequence(history ?? []);\n const { history: flatHistory, branchByCheckpoint } = getBranchView(\n branchTree,\n paths,\n branch\n );\n\n return {\n branchTree,\n flatHistory,\n branchByCheckpoint,\n threadHead: flatHistory.at(-1),\n };\n}\n"],"mappings":";;AAiCA,SAAgB,kBACd,SACA;CACA,MAAM,0BAAU,IAAI,KAAa;CACjC,MAAM,cAAwD,EAAE;AAGhE,KAAI,QAAQ,UAAU,EACpB,QAAO;EACL,cAAc;GACZ,MAAM;GACN,OAAO,QAAQ,KAAK,WAAW;IAAE,MAAM;IAAQ;IAAO,MAAM,EAAE;IAAE,EAAE;GACnE;EACD,OAAO,EAAE;EACV;AAIH,SAAQ,SAAS,UAAU;EACzB,MAAM,eAAe,MAAM,mBAAmB,iBAAiB;AAC/D,cAAY,kBAAkB,EAAE;AAChC,cAAY,cAAc,KAAK,MAAM;AAErC,MAAI,MAAM,YAAY,iBAAiB,KACrC,SAAQ,IAAI,MAAM,WAAW,cAAc;GAE7C;CAIF,MAAM,SAAS,GAAG,QAChB,IACG,QAAQ,MAAmB,KAAK,KAAK,CACrC,MAAM,GAAG,MAAM,EAAE,cAAc,EAAE,CAAC,CAClC,GAAG,GAAG;CAEX,MAAM,mBACJ,YAAY,KAAK,OACb,OAAO,KAAK,YAAY,CACrB,QAAQ,aAAa,CAAC,QAAQ,IAAI,SAAS,CAAC,CAC5C,KAAK,aAAa;EACjB,MAAMA,UAAkB,CAAC,SAAS;EAClC,MAAM,uBAAO,IAAI,KAAa;EAE9B,IAAI,SAAS;AAEb,SAAOA,QAAM,SAAS,GAAG;GACvB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GACF;GAEN,MAAM,YAAY,KAAK,MAAM,GAAG,MAAM,EAAE,SAAS,EAAE;AACnD,SAAM,KAAK,GAAG,UAAU;;;AAI5B,QAAO;EAAE;EAAS;EAAoB;;AAGxC,SAAgB,iBACd,QACA,SACA;CACA,MAAM,EAAE,cAAc,YAAY,UAAU,kBAAkB,WAAW,EAAE,CAAC;CAC5E,MAAM,EAAE,SAAS,aAAa,uBAAuB,cACnD,YACA,OACA,OACD;AAED,QAAO;EACL;EACA;EACA;EACA,YAAY,YAAY,GAAG,GAAG;EAC/B"}
|
|
1
|
+
{"version":3,"file":"branching.cjs","names":[],"sources":["../../src/ui/branching.ts"],"sourcesContent":["import type { ThreadState } from \"../schema.js\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ninterface Node<StateType = any> {\n type: \"node\";\n value: ThreadState<StateType>;\n path: string[];\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ninterface Fork<StateType = any> {\n type: \"fork\";\n items: Array<Sequence<StateType>>;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface Sequence<StateType = any> {\n type: \"sequence\";\n items: Array<Node<StateType> | Fork<StateType>>;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ninterface ValidFork<StateType = any> {\n type: \"fork\";\n items: Array<ValidSequence<StateType>>;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ninterface ValidSequence<StateType = any> {\n type: \"sequence\";\n items: [Node<StateType>, ...(Node<StateType> | ValidFork<StateType>)[]];\n}\n\nexport function getBranchSequence<StateType extends Record<string, unknown>>(\n history: ThreadState<StateType>[]\n) {\n const nodeIds = new Set<string>();\n const childrenMap: Record<string, ThreadState<StateType>[]> = {};\n\n // Short circuit if there's only a singular one state\n if (history.length <= 1) {\n return {\n rootSequence: {\n type: \"sequence\",\n items: history.map((value) => ({ type: \"node\", value, path: [] })),\n } satisfies Sequence<StateType>,\n paths: [],\n };\n }\n\n // First pass - collect nodes for each checkpoint\n history.forEach((state) => {\n const checkpointId = state.parent_checkpoint?.checkpoint_id ?? \"$\";\n childrenMap[checkpointId] ??= [];\n childrenMap[checkpointId].push(state);\n\n if (state.checkpoint?.checkpoint_id != null) {\n nodeIds.add(state.checkpoint.checkpoint_id);\n }\n });\n\n // If dealing with partial history, take the branch\n // with the latest checkpoint and mark it as the root.\n const maxId = (...ids: (string | null)[]) =>\n ids\n .filter((i): i is string => i != null)\n .sort((a, b) => a.localeCompare(b))\n .at(-1)!;\n\n const lastOrphanedNode =\n childrenMap.$ == null\n ? Object.keys(childrenMap)\n .filter((parentId) => !nodeIds.has(parentId))\n .map((parentId) => {\n const queue: string[] = [parentId];\n const seen = new Set<string>();\n\n let lastId = parentId;\n\n while (queue.length > 0) {\n const current = queue.shift()!;\n\n if (seen.has(current)) continue;\n seen.add(current);\n\n const children = (childrenMap[current] ?? []).flatMap(\n (i) => i.checkpoint?.checkpoint_id ?? []\n );\n\n lastId = maxId(lastId, ...children);\n queue.push(...children);\n }\n\n return { parentId, lastId };\n })\n .sort((a, b) => a.lastId.localeCompare(b.lastId))\n .at(-1)?.parentId\n : undefined;\n\n if (lastOrphanedNode != null) childrenMap.$ = childrenMap[lastOrphanedNode];\n\n // Second pass - create a tree of sequences\n type Task = { id: string; sequence: Sequence; path: string[] };\n const rootSequence: Sequence = { type: \"sequence\", items: [] };\n const queue: Task[] = [{ id: \"$\", sequence: rootSequence, path: [] }];\n\n const paths: string[][] = [];\n\n const visited = new Set<string>();\n while (queue.length > 0) {\n const task = queue.shift()!;\n if (visited.has(task.id)) continue;\n visited.add(task.id);\n\n const children = childrenMap[task.id];\n if (children == null || children.length === 0) continue;\n\n // If we've encountered a fork (2+ children), push the fork\n // to the sequence and add a new sequence for each child\n let fork: Fork | undefined;\n if (children.length > 1) {\n fork = { type: \"fork\", items: [] };\n task.sequence.items.push(fork);\n }\n\n for (const value of children) {\n const id = value.checkpoint?.checkpoint_id;\n if (id == null) continue;\n\n let { sequence } = task;\n let { path } = task;\n if (fork != null) {\n sequence = { type: \"sequence\", items: [] };\n fork.items.unshift(sequence);\n\n path = path.slice();\n path.push(id);\n paths.push(path);\n }\n\n sequence.items.push({ type: \"node\", value, path });\n queue.push({ id, sequence, path });\n }\n }\n\n return { rootSequence, paths };\n}\n\nconst PATH_SEP = \">\";\nconst ROOT_ID = \"$\";\n\n// Get flat view\nexport function getBranchView<StateType extends Record<string, unknown>>(\n sequence: Sequence<StateType>,\n paths: string[][],\n branch: string\n) {\n const path = branch.split(PATH_SEP);\n const pathMap: Record<string, string[][]> = {};\n\n for (const path of paths) {\n const parent = path.at(-2) ?? ROOT_ID;\n pathMap[parent] ??= [];\n pathMap[parent].unshift(path);\n }\n\n const history: ThreadState<StateType>[] = [];\n const branchByCheckpoint: Record<\n string,\n { branch: string | undefined; branchOptions: string[] | undefined }\n > = {};\n\n const forkStack = path.slice();\n const queue: (Node<StateType> | Fork<StateType>)[] = [...sequence.items];\n\n while (queue.length > 0) {\n const item = queue.shift()!;\n\n if (item.type === \"node\") {\n history.push(item.value);\n const checkpointId = item.value.checkpoint?.checkpoint_id;\n if (checkpointId == null) continue;\n\n branchByCheckpoint[checkpointId] = {\n branch: item.path.join(PATH_SEP),\n branchOptions: (item.path.length > 0\n ? pathMap[item.path.at(-2) ?? ROOT_ID] ?? []\n : []\n ).map((p) => p.join(PATH_SEP)),\n };\n }\n if (item.type === \"fork\") {\n const forkId = forkStack.shift();\n const index =\n forkId != null\n ? item.items.findIndex((value) => {\n const firstItem = value.items.at(0);\n if (!firstItem || firstItem.type !== \"node\") return false;\n return firstItem.value.checkpoint?.checkpoint_id === forkId;\n })\n : -1;\n\n const nextItems = item.items.at(index)?.items ?? [];\n queue.push(...nextItems);\n }\n }\n\n return { history, branchByCheckpoint };\n}\n\nexport function getBranchContext<StateType extends Record<string, unknown>>(\n branch: string,\n history: ThreadState<StateType>[] | undefined\n) {\n const { rootSequence: branchTree, paths } = getBranchSequence(history ?? []);\n const { history: flatHistory, branchByCheckpoint } = getBranchView(\n branchTree,\n paths,\n branch\n );\n\n return {\n branchTree,\n flatHistory,\n branchByCheckpoint,\n threadHead: flatHistory.at(-1),\n };\n}\n"],"mappings":";;AAiCA,SAAgB,kBACd,SACA;CACA,MAAM,0BAAU,IAAI,KAAa;CACjC,MAAM,cAAwD,EAAE;AAGhE,KAAI,QAAQ,UAAU,EACpB,QAAO;EACL,cAAc;GACZ,MAAM;GACN,OAAO,QAAQ,KAAK,WAAW;IAAE,MAAM;IAAQ;IAAO,MAAM,EAAE;IAAE,EAAE;GACnE;EACD,OAAO,EAAE;EACV;AAIH,SAAQ,SAAS,UAAU;EACzB,MAAM,eAAe,MAAM,mBAAmB,iBAAiB;AAC/D,cAAY,kBAAkB,EAAE;AAChC,cAAY,cAAc,KAAK,MAAM;AAErC,MAAI,MAAM,YAAY,iBAAiB,KACrC,SAAQ,IAAI,MAAM,WAAW,cAAc;GAE7C;CAIF,MAAM,SAAS,GAAG,QAChB,IACG,QAAQ,MAAmB,KAAK,KAAK,CACrC,MAAM,GAAG,MAAM,EAAE,cAAc,EAAE,CAAC,CAClC,GAAG,GAAG;CAEX,MAAM,mBACJ,YAAY,KAAK,OACb,OAAO,KAAK,YAAY,CACrB,QAAQ,aAAa,CAAC,QAAQ,IAAI,SAAS,CAAC,CAC5C,KAAK,aAAa;EACjB,MAAM,QAAkB,CAAC,SAAS;EAClC,MAAM,uBAAO,IAAI,KAAa;EAE9B,IAAI,SAAS;AAEb,SAAO,MAAM,SAAS,GAAG;GACvB,MAAM,UAAU,MAAM,OAAO;AAE7B,OAAI,KAAK,IAAI,QAAQ,CAAE;AACvB,QAAK,IAAI,QAAQ;GAEjB,MAAM,YAAY,YAAY,YAAY,EAAE,EAAE,SAC3C,MAAM,EAAE,YAAY,iBAAiB,EAAE,CACzC;AAED,YAAS,MAAM,QAAQ,GAAG,SAAS;AACnC,SAAM,KAAK,GAAG,SAAS;;AAGzB,SAAO;GAAE;GAAU;GAAQ;GAC3B,CACD,MAAM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;EACA;EACA;EACA,YAAY,YAAY,GAAG,GAAG;EAC/B"}
|
package/dist/ui/branching.js
CHANGED
|
@@ -21,16 +21,16 @@ function getBranchSequence(history) {
|
|
|
21
21
|
});
|
|
22
22
|
const maxId = (...ids) => ids.filter((i) => i != null).sort((a, b) => a.localeCompare(b)).at(-1);
|
|
23
23
|
const lastOrphanedNode = childrenMap.$ == null ? Object.keys(childrenMap).filter((parentId) => !nodeIds.has(parentId)).map((parentId) => {
|
|
24
|
-
const queue
|
|
24
|
+
const queue = [parentId];
|
|
25
25
|
const seen = /* @__PURE__ */ new Set();
|
|
26
26
|
let lastId = parentId;
|
|
27
|
-
while (queue
|
|
28
|
-
const current = queue
|
|
27
|
+
while (queue.length > 0) {
|
|
28
|
+
const current = queue.shift();
|
|
29
29
|
if (seen.has(current)) continue;
|
|
30
30
|
seen.add(current);
|
|
31
31
|
const children = (childrenMap[current] ?? []).flatMap((i) => i.checkpoint?.checkpoint_id ?? []);
|
|
32
32
|
lastId = maxId(lastId, ...children);
|
|
33
|
-
queue
|
|
33
|
+
queue.push(...children);
|
|
34
34
|
}
|
|
35
35
|
return {
|
|
36
36
|
parentId,
|
|
@@ -100,10 +100,10 @@ const ROOT_ID = "$";
|
|
|
100
100
|
function getBranchView(sequence, paths, branch) {
|
|
101
101
|
const path = branch.split(PATH_SEP);
|
|
102
102
|
const pathMap = {};
|
|
103
|
-
for (const path
|
|
104
|
-
const parent = path
|
|
103
|
+
for (const path of paths) {
|
|
104
|
+
const parent = path.at(-2) ?? ROOT_ID;
|
|
105
105
|
pathMap[parent] ??= [];
|
|
106
|
-
pathMap[parent].unshift(path
|
|
106
|
+
pathMap[parent].unshift(path);
|
|
107
107
|
}
|
|
108
108
|
const history = [];
|
|
109
109
|
const branchByCheckpoint = {};
|