@langchain/langgraph 1.0.7 → 1.0.12
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/package.json +7 -7
- package/CHANGELOG.md +0 -286
- package/dist/_virtual/rolldown_runtime.cjs +0 -25
- package/dist/channels/any_value.cjs +0 -46
- package/dist/channels/any_value.cjs.map +0 -1
- package/dist/channels/any_value.d.cts +0 -24
- package/dist/channels/any_value.d.cts.map +0 -1
- package/dist/channels/any_value.d.ts +0 -24
- package/dist/channels/any_value.d.ts.map +0 -1
- package/dist/channels/any_value.js +0 -46
- package/dist/channels/any_value.js.map +0 -1
- package/dist/channels/base.cjs +0 -102
- package/dist/channels/base.cjs.map +0 -1
- package/dist/channels/base.d.cts +0 -79
- package/dist/channels/base.d.cts.map +0 -1
- package/dist/channels/base.d.ts +0 -79
- package/dist/channels/base.d.ts.map +0 -1
- package/dist/channels/base.js +0 -97
- package/dist/channels/base.js.map +0 -1
- package/dist/channels/binop.cjs +0 -49
- package/dist/channels/binop.cjs.map +0 -1
- package/dist/channels/binop.d.cts +0 -22
- package/dist/channels/binop.d.cts.map +0 -1
- package/dist/channels/binop.d.ts +0 -22
- package/dist/channels/binop.d.ts.map +0 -1
- package/dist/channels/binop.js +0 -49
- package/dist/channels/binop.js.map +0 -1
- package/dist/channels/dynamic_barrier_value.cjs +0 -76
- package/dist/channels/dynamic_barrier_value.cjs.map +0 -1
- package/dist/channels/dynamic_barrier_value.d.cts +0 -42
- package/dist/channels/dynamic_barrier_value.d.cts.map +0 -1
- package/dist/channels/dynamic_barrier_value.d.ts +0 -42
- package/dist/channels/dynamic_barrier_value.d.ts.map +0 -1
- package/dist/channels/dynamic_barrier_value.js +0 -76
- package/dist/channels/dynamic_barrier_value.js.map +0 -1
- package/dist/channels/ephemeral_value.cjs +0 -46
- package/dist/channels/ephemeral_value.cjs.map +0 -1
- package/dist/channels/ephemeral_value.d.cts +0 -22
- package/dist/channels/ephemeral_value.d.cts.map +0 -1
- package/dist/channels/ephemeral_value.d.ts +0 -22
- package/dist/channels/ephemeral_value.d.ts.map +0 -1
- package/dist/channels/ephemeral_value.js +0 -46
- package/dist/channels/ephemeral_value.js.map +0 -1
- package/dist/channels/index.cjs +0 -21
- package/dist/channels/index.d.cts +0 -9
- package/dist/channels/index.d.ts +0 -9
- package/dist/channels/index.js +0 -10
- package/dist/channels/last_value.cjs +0 -98
- package/dist/channels/last_value.cjs.map +0 -1
- package/dist/channels/last_value.d.cts +0 -44
- package/dist/channels/last_value.d.cts.map +0 -1
- package/dist/channels/last_value.d.ts +0 -44
- package/dist/channels/last_value.d.ts.map +0 -1
- package/dist/channels/last_value.js +0 -97
- package/dist/channels/last_value.js.map +0 -1
- package/dist/channels/named_barrier_value.cjs +0 -118
- package/dist/channels/named_barrier_value.cjs.map +0 -1
- package/dist/channels/named_barrier_value.d.cts +0 -46
- package/dist/channels/named_barrier_value.d.cts.map +0 -1
- package/dist/channels/named_barrier_value.d.ts +0 -46
- package/dist/channels/named_barrier_value.d.ts.map +0 -1
- package/dist/channels/named_barrier_value.js +0 -116
- package/dist/channels/named_barrier_value.js.map +0 -1
- package/dist/channels/topic.cjs +0 -65
- package/dist/channels/topic.cjs.map +0 -1
- package/dist/channels/topic.d.cts +0 -32
- package/dist/channels/topic.d.cts.map +0 -1
- package/dist/channels/topic.d.ts +0 -32
- package/dist/channels/topic.d.ts.map +0 -1
- package/dist/channels/topic.js +0 -65
- package/dist/channels/topic.js.map +0 -1
- package/dist/constants.cjs +0 -406
- package/dist/constants.cjs.map +0 -1
- package/dist/constants.d.cts +0 -285
- package/dist/constants.d.cts.map +0 -1
- package/dist/constants.d.ts +0 -285
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js +0 -362
- package/dist/constants.js.map +0 -1
- package/dist/errors.cjs +0 -163
- package/dist/errors.cjs.map +0 -1
- package/dist/errors.d.cts +0 -81
- package/dist/errors.d.cts.map +0 -1
- package/dist/errors.d.ts +0 -81
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -146
- package/dist/errors.js.map +0 -1
- package/dist/func/index.cjs +0 -301
- package/dist/func/index.cjs.map +0 -1
- package/dist/func/index.d.cts +0 -293
- package/dist/func/index.d.cts.map +0 -1
- package/dist/func/index.d.ts +0 -293
- package/dist/func/index.d.ts.map +0 -1
- package/dist/func/index.js +0 -298
- package/dist/func/index.js.map +0 -1
- package/dist/func/types.d.cts +0 -64
- package/dist/func/types.d.cts.map +0 -1
- package/dist/func/types.d.ts +0 -64
- package/dist/func/types.d.ts.map +0 -1
- package/dist/graph/annotation.cjs +0 -101
- package/dist/graph/annotation.cjs.map +0 -1
- package/dist/graph/annotation.d.cts +0 -116
- package/dist/graph/annotation.d.cts.map +0 -1
- package/dist/graph/annotation.d.ts +0 -116
- package/dist/graph/annotation.d.ts.map +0 -1
- package/dist/graph/annotation.js +0 -99
- package/dist/graph/annotation.js.map +0 -1
- package/dist/graph/graph.cjs +0 -423
- package/dist/graph/graph.cjs.map +0 -1
- package/dist/graph/graph.d.cts +0 -132
- package/dist/graph/graph.d.cts.map +0 -1
- package/dist/graph/graph.d.ts +0 -132
- package/dist/graph/graph.d.ts.map +0 -1
- package/dist/graph/graph.js +0 -420
- package/dist/graph/graph.js.map +0 -1
- package/dist/graph/index.cjs +0 -5
- package/dist/graph/index.js +0 -7
- package/dist/graph/message.cjs +0 -99
- package/dist/graph/message.cjs.map +0 -1
- package/dist/graph/message.d.cts +0 -40
- package/dist/graph/message.d.cts.map +0 -1
- package/dist/graph/message.d.ts +0 -40
- package/dist/graph/message.d.ts.map +0 -1
- package/dist/graph/message.js +0 -95
- package/dist/graph/message.js.map +0 -1
- package/dist/graph/messages_annotation.cjs +0 -110
- package/dist/graph/messages_annotation.cjs.map +0 -1
- package/dist/graph/messages_annotation.d.cts +0 -112
- package/dist/graph/messages_annotation.d.cts.map +0 -1
- package/dist/graph/messages_annotation.d.ts +0 -112
- package/dist/graph/messages_annotation.d.ts.map +0 -1
- package/dist/graph/messages_annotation.js +0 -107
- package/dist/graph/messages_annotation.js.map +0 -1
- package/dist/graph/state.cjs +0 -501
- package/dist/graph/state.cjs.map +0 -1
- package/dist/graph/state.d.cts +0 -236
- package/dist/graph/state.d.cts.map +0 -1
- package/dist/graph/state.d.ts +0 -236
- package/dist/graph/state.d.ts.map +0 -1
- package/dist/graph/state.js +0 -499
- package/dist/graph/state.js.map +0 -1
- package/dist/graph/zod/index.cjs +0 -10
- package/dist/graph/zod/index.d.cts +0 -3
- package/dist/graph/zod/index.d.ts +0 -3
- package/dist/graph/zod/index.js +0 -5
- package/dist/graph/zod/meta.cjs +0 -145
- package/dist/graph/zod/meta.cjs.map +0 -1
- package/dist/graph/zod/meta.d.cts +0 -116
- package/dist/graph/zod/meta.d.cts.map +0 -1
- package/dist/graph/zod/meta.d.ts +0 -116
- package/dist/graph/zod/meta.d.ts.map +0 -1
- package/dist/graph/zod/meta.js +0 -141
- package/dist/graph/zod/meta.js.map +0 -1
- package/dist/graph/zod/plugin.cjs +0 -41
- package/dist/graph/zod/plugin.cjs.map +0 -1
- package/dist/graph/zod/plugin.js +0 -41
- package/dist/graph/zod/plugin.js.map +0 -1
- package/dist/graph/zod/schema.cjs +0 -99
- package/dist/graph/zod/schema.cjs.map +0 -1
- package/dist/graph/zod/schema.d.cts +0 -38
- package/dist/graph/zod/schema.d.cts.map +0 -1
- package/dist/graph/zod/schema.d.ts +0 -38
- package/dist/graph/zod/schema.d.ts.map +0 -1
- package/dist/graph/zod/schema.js +0 -94
- package/dist/graph/zod/schema.js.map +0 -1
- package/dist/graph/zod/zod-registry.cjs +0 -43
- package/dist/graph/zod/zod-registry.cjs.map +0 -1
- package/dist/graph/zod/zod-registry.d.cts +0 -51
- package/dist/graph/zod/zod-registry.d.cts.map +0 -1
- package/dist/graph/zod/zod-registry.d.ts +0 -51
- package/dist/graph/zod/zod-registry.d.ts.map +0 -1
- package/dist/graph/zod/zod-registry.js +0 -41
- package/dist/graph/zod/zod-registry.js.map +0 -1
- package/dist/hash.cjs +0 -271
- package/dist/hash.cjs.map +0 -1
- package/dist/hash.js +0 -269
- package/dist/hash.js.map +0 -1
- package/dist/index.cjs +0 -112
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -26
- package/dist/index.d.ts +0 -26
- package/dist/index.js +0 -22
- package/dist/index.js.map +0 -1
- package/dist/interrupt.cjs +0 -82
- package/dist/interrupt.cjs.map +0 -1
- package/dist/interrupt.d.cts +0 -58
- package/dist/interrupt.d.cts.map +0 -1
- package/dist/interrupt.d.ts +0 -58
- package/dist/interrupt.d.ts.map +0 -1
- package/dist/interrupt.js +0 -81
- package/dist/interrupt.js.map +0 -1
- package/dist/prebuilt/agentName.cjs +0 -153
- package/dist/prebuilt/agentName.cjs.map +0 -1
- package/dist/prebuilt/agentName.d.cts +0 -42
- package/dist/prebuilt/agentName.d.cts.map +0 -1
- package/dist/prebuilt/agentName.d.ts +0 -42
- package/dist/prebuilt/agentName.d.ts.map +0 -1
- package/dist/prebuilt/agentName.js +0 -152
- package/dist/prebuilt/agentName.js.map +0 -1
- package/dist/prebuilt/agent_executor.cjs +0 -44
- package/dist/prebuilt/agent_executor.cjs.map +0 -1
- package/dist/prebuilt/agent_executor.d.cts +0 -58
- package/dist/prebuilt/agent_executor.d.cts.map +0 -1
- package/dist/prebuilt/agent_executor.d.ts +0 -58
- package/dist/prebuilt/agent_executor.d.ts.map +0 -1
- package/dist/prebuilt/agent_executor.js +0 -44
- package/dist/prebuilt/agent_executor.js.map +0 -1
- package/dist/prebuilt/chat_agent_executor.cjs +0 -68
- package/dist/prebuilt/chat_agent_executor.cjs.map +0 -1
- package/dist/prebuilt/chat_agent_executor.d.cts +0 -23
- package/dist/prebuilt/chat_agent_executor.d.cts.map +0 -1
- package/dist/prebuilt/chat_agent_executor.d.ts +0 -23
- package/dist/prebuilt/chat_agent_executor.d.ts.map +0 -1
- package/dist/prebuilt/chat_agent_executor.js +0 -67
- package/dist/prebuilt/chat_agent_executor.js.map +0 -1
- package/dist/prebuilt/index.cjs +0 -15
- package/dist/prebuilt/index.d.cts +0 -8
- package/dist/prebuilt/index.d.ts +0 -8
- package/dist/prebuilt/index.js +0 -8
- package/dist/prebuilt/interrupt.d.cts +0 -61
- package/dist/prebuilt/interrupt.d.cts.map +0 -1
- package/dist/prebuilt/interrupt.d.ts +0 -61
- package/dist/prebuilt/interrupt.d.ts.map +0 -1
- package/dist/prebuilt/react_agent_executor.cjs +0 -344
- package/dist/prebuilt/react_agent_executor.cjs.map +0 -1
- package/dist/prebuilt/react_agent_executor.d.cts +0 -230
- package/dist/prebuilt/react_agent_executor.d.cts.map +0 -1
- package/dist/prebuilt/react_agent_executor.d.ts +0 -230
- package/dist/prebuilt/react_agent_executor.d.ts.map +0 -1
- package/dist/prebuilt/react_agent_executor.js +0 -342
- package/dist/prebuilt/react_agent_executor.js.map +0 -1
- package/dist/prebuilt/tool_executor.cjs +0 -48
- package/dist/prebuilt/tool_executor.cjs.map +0 -1
- package/dist/prebuilt/tool_executor.d.cts +0 -42
- package/dist/prebuilt/tool_executor.d.cts.map +0 -1
- package/dist/prebuilt/tool_executor.d.ts +0 -42
- package/dist/prebuilt/tool_executor.d.ts.map +0 -1
- package/dist/prebuilt/tool_executor.js +0 -47
- package/dist/prebuilt/tool_executor.js.map +0 -1
- package/dist/prebuilt/tool_node.cjs +0 -248
- package/dist/prebuilt/tool_node.cjs.map +0 -1
- package/dist/prebuilt/tool_node.d.cts +0 -182
- package/dist/prebuilt/tool_node.d.cts.map +0 -1
- package/dist/prebuilt/tool_node.d.ts +0 -182
- package/dist/prebuilt/tool_node.d.ts.map +0 -1
- package/dist/prebuilt/tool_node.js +0 -246
- package/dist/prebuilt/tool_node.js.map +0 -1
- package/dist/pregel/algo.cjs +0 -573
- package/dist/pregel/algo.cjs.map +0 -1
- package/dist/pregel/algo.d.cts +0 -13
- package/dist/pregel/algo.d.cts.map +0 -1
- package/dist/pregel/algo.d.ts +0 -13
- package/dist/pregel/algo.d.ts.map +0 -1
- package/dist/pregel/algo.js +0 -567
- package/dist/pregel/algo.js.map +0 -1
- package/dist/pregel/call.cjs +0 -53
- package/dist/pregel/call.cjs.map +0 -1
- package/dist/pregel/call.js +0 -50
- package/dist/pregel/call.js.map +0 -1
- package/dist/pregel/debug.cjs +0 -175
- package/dist/pregel/debug.cjs.map +0 -1
- package/dist/pregel/debug.js +0 -169
- package/dist/pregel/debug.js.map +0 -1
- package/dist/pregel/index.cjs +0 -1170
- package/dist/pregel/index.cjs.map +0 -1
- package/dist/pregel/index.d.cts +0 -546
- package/dist/pregel/index.d.cts.map +0 -1
- package/dist/pregel/index.d.ts +0 -546
- package/dist/pregel/index.d.ts.map +0 -1
- package/dist/pregel/index.js +0 -1168
- package/dist/pregel/index.js.map +0 -1
- package/dist/pregel/io.cjs +0 -140
- package/dist/pregel/io.cjs.map +0 -1
- package/dist/pregel/io.js +0 -135
- package/dist/pregel/io.js.map +0 -1
- package/dist/pregel/loop.cjs +0 -548
- package/dist/pregel/loop.cjs.map +0 -1
- package/dist/pregel/loop.js +0 -547
- package/dist/pregel/loop.js.map +0 -1
- package/dist/pregel/messages.cjs +0 -108
- package/dist/pregel/messages.cjs.map +0 -1
- package/dist/pregel/messages.js +0 -107
- package/dist/pregel/messages.js.map +0 -1
- package/dist/pregel/read.cjs +0 -152
- package/dist/pregel/read.cjs.map +0 -1
- package/dist/pregel/read.d.cts +0 -51
- package/dist/pregel/read.d.cts.map +0 -1
- package/dist/pregel/read.d.ts +0 -51
- package/dist/pregel/read.d.ts.map +0 -1
- package/dist/pregel/read.js +0 -150
- package/dist/pregel/read.js.map +0 -1
- package/dist/pregel/remote.cjs +0 -349
- package/dist/pregel/remote.cjs.map +0 -1
- package/dist/pregel/remote.d.cts +0 -123
- package/dist/pregel/remote.d.cts.map +0 -1
- package/dist/pregel/remote.d.ts +0 -123
- package/dist/pregel/remote.d.ts.map +0 -1
- package/dist/pregel/remote.js +0 -348
- package/dist/pregel/remote.js.map +0 -1
- package/dist/pregel/retry.cjs +0 -92
- package/dist/pregel/retry.cjs.map +0 -1
- package/dist/pregel/retry.js +0 -92
- package/dist/pregel/retry.js.map +0 -1
- package/dist/pregel/runnable_types.d.cts +0 -49
- package/dist/pregel/runnable_types.d.cts.map +0 -1
- package/dist/pregel/runnable_types.d.ts +0 -49
- package/dist/pregel/runnable_types.d.ts.map +0 -1
- package/dist/pregel/runner.cjs +0 -228
- package/dist/pregel/runner.cjs.map +0 -1
- package/dist/pregel/runner.js +0 -228
- package/dist/pregel/runner.js.map +0 -1
- package/dist/pregel/stream.cjs +0 -199
- package/dist/pregel/stream.cjs.map +0 -1
- package/dist/pregel/stream.js +0 -196
- package/dist/pregel/stream.js.map +0 -1
- package/dist/pregel/types.cjs +0 -27
- package/dist/pregel/types.cjs.map +0 -1
- package/dist/pregel/types.d.cts +0 -453
- package/dist/pregel/types.d.cts.map +0 -1
- package/dist/pregel/types.d.ts +0 -453
- package/dist/pregel/types.d.ts.map +0 -1
- package/dist/pregel/types.js +0 -25
- package/dist/pregel/types.js.map +0 -1
- package/dist/pregel/utils/config.cjs +0 -122
- package/dist/pregel/utils/config.cjs.map +0 -1
- package/dist/pregel/utils/config.d.cts +0 -36
- package/dist/pregel/utils/config.d.cts.map +0 -1
- package/dist/pregel/utils/config.d.ts +0 -36
- package/dist/pregel/utils/config.d.ts.map +0 -1
- package/dist/pregel/utils/config.js +0 -115
- package/dist/pregel/utils/config.js.map +0 -1
- package/dist/pregel/utils/index.cjs +0 -103
- package/dist/pregel/utils/index.cjs.map +0 -1
- package/dist/pregel/utils/index.d.cts +0 -51
- package/dist/pregel/utils/index.d.cts.map +0 -1
- package/dist/pregel/utils/index.d.ts +0 -51
- package/dist/pregel/utils/index.d.ts.map +0 -1
- package/dist/pregel/utils/index.js +0 -97
- package/dist/pregel/utils/index.js.map +0 -1
- package/dist/pregel/utils/subgraph.cjs +0 -19
- package/dist/pregel/utils/subgraph.cjs.map +0 -1
- package/dist/pregel/utils/subgraph.js +0 -17
- package/dist/pregel/utils/subgraph.js.map +0 -1
- package/dist/pregel/validate.cjs +0 -45
- package/dist/pregel/validate.cjs.map +0 -1
- package/dist/pregel/validate.js +0 -44
- package/dist/pregel/validate.js.map +0 -1
- package/dist/pregel/write.cjs +0 -97
- package/dist/pregel/write.cjs.map +0 -1
- package/dist/pregel/write.d.cts +0 -35
- package/dist/pregel/write.d.cts.map +0 -1
- package/dist/pregel/write.d.ts +0 -35
- package/dist/pregel/write.d.ts.map +0 -1
- package/dist/pregel/write.js +0 -95
- package/dist/pregel/write.js.map +0 -1
- package/dist/remote.cjs +0 -3
- package/dist/remote.d.cts +0 -2
- package/dist/remote.d.ts +0 -2
- package/dist/remote.js +0 -3
- package/dist/setup/async_local_storage.cjs +0 -12
- package/dist/setup/async_local_storage.cjs.map +0 -1
- package/dist/setup/async_local_storage.js +0 -11
- package/dist/setup/async_local_storage.js.map +0 -1
- package/dist/utils.cjs +0 -88
- package/dist/utils.cjs.map +0 -1
- package/dist/utils.d.cts +0 -32
- package/dist/utils.d.cts.map +0 -1
- package/dist/utils.d.ts +0 -32
- package/dist/utils.d.ts.map +0 -1
- package/dist/utils.js +0 -81
- package/dist/utils.js.map +0 -1
- package/dist/web.cjs +0 -96
- package/dist/web.d.cts +0 -23
- package/dist/web.d.ts +0 -23
- package/dist/web.js +0 -15
- package/dist/writer.cjs +0 -15
- package/dist/writer.cjs.map +0 -1
- package/dist/writer.d.cts +0 -7
- package/dist/writer.d.cts.map +0 -1
- package/dist/writer.d.ts +0 -7
- package/dist/writer.d.ts.map +0 -1
- package/dist/writer.js +0 -14
- package/dist/writer.js.map +0 -1
package/dist/constants.d.cts
DELETED
|
@@ -1,285 +0,0 @@
|
|
|
1
|
-
import { PendingWrite } from "@langchain/langgraph-checkpoint";
|
|
2
|
-
|
|
3
|
-
//#region src/constants.d.ts
|
|
4
|
-
/** Special reserved node name denoting the start of a graph. */
|
|
5
|
-
declare const START = "__start__";
|
|
6
|
-
/** Special reserved node name denoting the end of a graph. */
|
|
7
|
-
declare const END = "__end__";
|
|
8
|
-
/** Special channel reserved for graph interrupts */
|
|
9
|
-
declare const INTERRUPT = "__interrupt__";
|
|
10
|
-
/** Special channel reserved for graph resume */
|
|
11
|
-
|
|
12
|
-
/** Special channel reserved for graph previous state */
|
|
13
|
-
declare const PREVIOUS = "__previous__";
|
|
14
|
-
/** @internal */
|
|
15
|
-
declare const COMMAND_SYMBOL: unique symbol;
|
|
16
|
-
/**
|
|
17
|
-
* Instance of a {@link Command} class.
|
|
18
|
-
*
|
|
19
|
-
* This is used to avoid IntelliSense suggesting public fields
|
|
20
|
-
* of {@link Command} class when a plain object is expected.
|
|
21
|
-
*
|
|
22
|
-
* @see {@link Command}
|
|
23
|
-
* @internal
|
|
24
|
-
*/
|
|
25
|
-
declare class CommandInstance<Resume = unknown, Update extends Record<string, unknown> = Record<string, unknown>, Nodes extends string = string> {
|
|
26
|
-
[COMMAND_SYMBOL]: CommandParams<Resume, Update, Nodes>;
|
|
27
|
-
constructor(args: CommandParams<Resume, Update, Nodes>);
|
|
28
|
-
}
|
|
29
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
30
|
-
interface SendInterface<Node extends string = string, Args = any> {
|
|
31
|
-
node: Node;
|
|
32
|
-
args: Args;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
*
|
|
36
|
-
* A message or packet to send to a specific node in the graph.
|
|
37
|
-
*
|
|
38
|
-
* The `Send` class is used within a `StateGraph`'s conditional edges to
|
|
39
|
-
* dynamically invoke a node with a custom state at the next step.
|
|
40
|
-
*
|
|
41
|
-
* Importantly, the sent state can differ from the core graph's state,
|
|
42
|
-
* allowing for flexible and dynamic workflow management.
|
|
43
|
-
*
|
|
44
|
-
* One such example is a "map-reduce" workflow where your graph invokes
|
|
45
|
-
* the same node multiple times in parallel with different states,
|
|
46
|
-
* before aggregating the results back into the main graph's state.
|
|
47
|
-
*
|
|
48
|
-
* @example
|
|
49
|
-
* ```typescript
|
|
50
|
-
* import { Annotation, Send, StateGraph } from "@langchain/langgraph";
|
|
51
|
-
*
|
|
52
|
-
* const ChainState = Annotation.Root({
|
|
53
|
-
* subjects: Annotation<string[]>,
|
|
54
|
-
* jokes: Annotation<string[]>({
|
|
55
|
-
* reducer: (a, b) => a.concat(b),
|
|
56
|
-
* }),
|
|
57
|
-
* });
|
|
58
|
-
*
|
|
59
|
-
* const continueToJokes = async (state: typeof ChainState.State) => {
|
|
60
|
-
* return state.subjects.map((subject) => {
|
|
61
|
-
* return new Send("generate_joke", { subjects: [subject] });
|
|
62
|
-
* });
|
|
63
|
-
* };
|
|
64
|
-
*
|
|
65
|
-
* const graph = new StateGraph(ChainState)
|
|
66
|
-
* .addNode("generate_joke", (state) => ({
|
|
67
|
-
* jokes: [`Joke about ${state.subjects}`],
|
|
68
|
-
* }))
|
|
69
|
-
* .addConditionalEdges("__start__", continueToJokes)
|
|
70
|
-
* .addEdge("generate_joke", "__end__")
|
|
71
|
-
* .compile();
|
|
72
|
-
*
|
|
73
|
-
* const res = await graph.invoke({ subjects: ["cats", "dogs"] });
|
|
74
|
-
* console.log(res);
|
|
75
|
-
*
|
|
76
|
-
* // Invoking with two subjects results in a generated joke for each
|
|
77
|
-
* // { subjects: ["cats", "dogs"], jokes: [`Joke about cats`, `Joke about dogs`] }
|
|
78
|
-
* ```
|
|
79
|
-
*/
|
|
80
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
81
|
-
declare class Send<Node extends string = string, Args = any> implements SendInterface<Node, Args> {
|
|
82
|
-
lg_name: string;
|
|
83
|
-
node: Node;
|
|
84
|
-
args: Args;
|
|
85
|
-
constructor(node: Node, args: Args);
|
|
86
|
-
toJSON(): {
|
|
87
|
-
lg_name: string;
|
|
88
|
-
node: Node;
|
|
89
|
-
args: Args;
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
93
|
-
type Interrupt<Value = any> = {
|
|
94
|
-
id?: string;
|
|
95
|
-
value?: Value;
|
|
96
|
-
};
|
|
97
|
-
/**
|
|
98
|
-
* Checks if the given graph invoke / stream chunk contains interrupt.
|
|
99
|
-
*
|
|
100
|
-
* @example
|
|
101
|
-
* ```ts
|
|
102
|
-
* import { INTERRUPT, isInterrupted } from "@langchain/langgraph";
|
|
103
|
-
*
|
|
104
|
-
* const values = await graph.invoke({ foo: "bar" });
|
|
105
|
-
* if (isInterrupted<string>(values)) {
|
|
106
|
-
* const interrupt = values[INTERRUPT][0].value;
|
|
107
|
-
* }
|
|
108
|
-
* ```
|
|
109
|
-
*
|
|
110
|
-
* @param values - The values to check.
|
|
111
|
-
* @returns `true` if the values contain an interrupt, `false` otherwise.
|
|
112
|
-
*/
|
|
113
|
-
declare function isInterrupted<Value = unknown>(values: unknown): values is {
|
|
114
|
-
[INTERRUPT]: Interrupt<Value>[];
|
|
115
|
-
};
|
|
116
|
-
type CommandParams<Resume = unknown, Update extends Record<string, unknown> = Record<string, unknown>, Nodes extends string = string> = {
|
|
117
|
-
/**
|
|
118
|
-
* A discriminator field used to identify the type of object. Must be populated when serializing.
|
|
119
|
-
*
|
|
120
|
-
* Optional because it's not required to specify this when directly constructing a {@link Command}
|
|
121
|
-
* object.
|
|
122
|
-
*/
|
|
123
|
-
lg_name?: "Command";
|
|
124
|
-
/**
|
|
125
|
-
* Value to resume execution with. To be used together with {@link interrupt}.
|
|
126
|
-
*/
|
|
127
|
-
resume?: Resume;
|
|
128
|
-
/**
|
|
129
|
-
* Graph to send the command to. Supported values are:
|
|
130
|
-
* - None: the current graph (default)
|
|
131
|
-
* - The specific name of the graph to send the command to
|
|
132
|
-
* - {@link Command.PARENT}: closest parent graph (only supported when returned from a node in a subgraph)
|
|
133
|
-
*/
|
|
134
|
-
graph?: string;
|
|
135
|
-
/**
|
|
136
|
-
* Update to apply to the graph's state.
|
|
137
|
-
*/
|
|
138
|
-
update?: Update | [string, unknown][];
|
|
139
|
-
/**
|
|
140
|
-
* Can be one of the following:
|
|
141
|
-
* - name of the node to navigate to next (any node that belongs to the specified `graph`)
|
|
142
|
-
* - sequence of node names to navigate to next
|
|
143
|
-
* - `Send` object (to execute a node with the input provided)
|
|
144
|
-
* - sequence of `Send` objects
|
|
145
|
-
*/
|
|
146
|
-
goto?: Nodes | SendInterface<Nodes> // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
147
|
-
| (Nodes | SendInterface<Nodes>)[]; // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
148
|
-
};
|
|
149
|
-
/**
|
|
150
|
-
* One or more commands to update the graph's state and send messages to nodes.
|
|
151
|
-
* Can be used to combine routing logic with state updates in lieu of conditional edges
|
|
152
|
-
*
|
|
153
|
-
* @example
|
|
154
|
-
* ```ts
|
|
155
|
-
* import { Annotation, Command } from "@langchain/langgraph";
|
|
156
|
-
*
|
|
157
|
-
* // Define graph state
|
|
158
|
-
* const StateAnnotation = Annotation.Root({
|
|
159
|
-
* foo: Annotation<string>,
|
|
160
|
-
* });
|
|
161
|
-
*
|
|
162
|
-
* // Define the nodes
|
|
163
|
-
* const nodeA = async (_state: typeof StateAnnotation.State) => {
|
|
164
|
-
* console.log("Called A");
|
|
165
|
-
* // this is a replacement for a real conditional edge function
|
|
166
|
-
* const goto = Math.random() > .5 ? "nodeB" : "nodeC";
|
|
167
|
-
* // note how Command allows you to BOTH update the graph state AND route to the next node
|
|
168
|
-
* return new Command({
|
|
169
|
-
* // this is the state update
|
|
170
|
-
* update: {
|
|
171
|
-
* foo: "a",
|
|
172
|
-
* },
|
|
173
|
-
* // this is a replacement for an edge
|
|
174
|
-
* goto,
|
|
175
|
-
* });
|
|
176
|
-
* };
|
|
177
|
-
*
|
|
178
|
-
* // Nodes B and C are unchanged
|
|
179
|
-
* const nodeB = async (state: typeof StateAnnotation.State) => {
|
|
180
|
-
* console.log("Called B");
|
|
181
|
-
* return {
|
|
182
|
-
* foo: state.foo + "|b",
|
|
183
|
-
* };
|
|
184
|
-
* }
|
|
185
|
-
*
|
|
186
|
-
* const nodeC = async (state: typeof StateAnnotation.State) => {
|
|
187
|
-
* console.log("Called C");
|
|
188
|
-
* return {
|
|
189
|
-
* foo: state.foo + "|c",
|
|
190
|
-
* };
|
|
191
|
-
* }
|
|
192
|
-
*
|
|
193
|
-
* import { StateGraph } from "@langchain/langgraph";
|
|
194
|
-
|
|
195
|
-
* // NOTE: there are no edges between nodes A, B and C!
|
|
196
|
-
* const graph = new StateGraph(StateAnnotation)
|
|
197
|
-
* .addNode("nodeA", nodeA, {
|
|
198
|
-
* ends: ["nodeB", "nodeC"],
|
|
199
|
-
* })
|
|
200
|
-
* .addNode("nodeB", nodeB)
|
|
201
|
-
* .addNode("nodeC", nodeC)
|
|
202
|
-
* .addEdge("__start__", "nodeA")
|
|
203
|
-
* .compile();
|
|
204
|
-
*
|
|
205
|
-
* await graph.invoke({ foo: "" });
|
|
206
|
-
*
|
|
207
|
-
* // Randomly oscillates between
|
|
208
|
-
* // { foo: 'a|c' } and { foo: 'a|b' }
|
|
209
|
-
* ```
|
|
210
|
-
*/
|
|
211
|
-
declare class Command<Resume = unknown, Update extends Record<string, unknown> = Record<string, unknown>, Nodes extends string = string> extends CommandInstance<Resume, Update, Nodes> {
|
|
212
|
-
readonly lg_name: string;
|
|
213
|
-
lc_direct_tool_output: boolean;
|
|
214
|
-
/**
|
|
215
|
-
* Graph to send the command to. Supported values are:
|
|
216
|
-
* - None: the current graph (default)
|
|
217
|
-
* - The specific name of the graph to send the command to
|
|
218
|
-
* - {@link Command.PARENT}: closest parent graph (only supported when returned from a node in a subgraph)
|
|
219
|
-
*/
|
|
220
|
-
graph?: string;
|
|
221
|
-
/**
|
|
222
|
-
* Update to apply to the graph's state as a result of executing the node that is returning the command.
|
|
223
|
-
* Written to the state as if the node had simply returned this value instead of the Command object.
|
|
224
|
-
*/
|
|
225
|
-
update?: Update | [string, unknown][];
|
|
226
|
-
/**
|
|
227
|
-
* Value to resume execution with. To be used together with {@link interrupt}.
|
|
228
|
-
*/
|
|
229
|
-
resume?: Resume;
|
|
230
|
-
/**
|
|
231
|
-
* Can be one of the following:
|
|
232
|
-
* - name of the node to navigate to next (any node that belongs to the specified `graph`)
|
|
233
|
-
* - sequence of node names to navigate to next
|
|
234
|
-
* - {@link Send} object (to execute a node with the exact input provided in the {@link Send} object)
|
|
235
|
-
* - sequence of {@link Send} objects
|
|
236
|
-
*/
|
|
237
|
-
goto?: Nodes | Send<Nodes> | (Nodes | Send<Nodes>)[];
|
|
238
|
-
static PARENT: string;
|
|
239
|
-
constructor(args: Omit<CommandParams<Resume, Update, Nodes>, "lg_name">);
|
|
240
|
-
/**
|
|
241
|
-
* Convert the update field to a list of {@link PendingWrite} tuples
|
|
242
|
-
* @returns List of {@link PendingWrite} tuples of the form `[channelKey, value]`.
|
|
243
|
-
* @internal
|
|
244
|
-
*/
|
|
245
|
-
_updateAsTuples(): PendingWrite[];
|
|
246
|
-
toJSON(): {
|
|
247
|
-
lg_name: string;
|
|
248
|
-
update: Update | [string, unknown][] | undefined;
|
|
249
|
-
resume: Resume | undefined;
|
|
250
|
-
goto: Nodes | (Nodes | {
|
|
251
|
-
lg_name: string;
|
|
252
|
-
node: Nodes;
|
|
253
|
-
args: any;
|
|
254
|
-
})[] | {
|
|
255
|
-
lg_name: string;
|
|
256
|
-
node: Nodes;
|
|
257
|
-
args: any;
|
|
258
|
-
} | undefined;
|
|
259
|
-
};
|
|
260
|
-
}
|
|
261
|
-
/**
|
|
262
|
-
* A type guard to check if the given value is a {@link Command}.
|
|
263
|
-
*
|
|
264
|
-
* Useful for type narrowing when working with the {@link Command} object.
|
|
265
|
-
*
|
|
266
|
-
* @param x - The value to check.
|
|
267
|
-
* @returns `true` if the value is a {@link Command}, `false` otherwise.
|
|
268
|
-
*/
|
|
269
|
-
declare function isCommand(x: unknown): x is Command;
|
|
270
|
-
/**
|
|
271
|
-
* Reconstructs Command and Send objects from a deeply nested tree of anonymous objects
|
|
272
|
-
* matching their interfaces.
|
|
273
|
-
*
|
|
274
|
-
* This is only exported for testing purposes. It is NOT intended to be used outside of
|
|
275
|
-
* the Command and Send classes.
|
|
276
|
-
*
|
|
277
|
-
* @internal
|
|
278
|
-
*
|
|
279
|
-
* @param x - The command send tree to convert.
|
|
280
|
-
* @param seen - A map of seen objects to avoid infinite loops.
|
|
281
|
-
* @returns The converted command send tree.
|
|
282
|
-
*/
|
|
283
|
-
//#endregion
|
|
284
|
-
export { Command, CommandInstance, CommandParams, END, INTERRUPT, Interrupt, PREVIOUS, START, Send, isCommand, isInterrupted };
|
|
285
|
-
//# sourceMappingURL=constants.d.cts.map
|
package/dist/constants.d.cts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.cts","names":["PendingWrite","START","END","INPUT","COPY","ERROR","CACHE_NS_WRITES","CONFIG_KEY_SEND","CONFIG_KEY_CALL","CONFIG_KEY_READ","CONFIG_KEY_CHECKPOINTER","CONFIG_KEY_RESUMING","CONFIG_KEY_TASK_ID","CONFIG_KEY_STREAM","CONFIG_KEY_RESUME_VALUE","CONFIG_KEY_RESUME_MAP","CONFIG_KEY_SCRATCHPAD","CONFIG_KEY_PREVIOUS_STATE","CONFIG_KEY_DURABILITY","CONFIG_KEY_CHECKPOINT_ID","CONFIG_KEY_CHECKPOINT_NS","CONFIG_KEY_NODE_FINISHED","CONFIG_KEY_CHECKPOINT_MAP","CONFIG_KEY_ABORT_SIGNALS","INTERRUPT","RESUME","NO_WRITES","RETURN","PREVIOUS","RUNTIME_PLACEHOLDER","RECURSION_LIMIT_DEFAULT","TAG_HIDDEN","TAG_NOSTREAM","SELF","TASKS","PUSH","PULL","TASK_NAMESPACE","NULL_TASK_ID","RESERVED","CHECKPOINT_NAMESPACE_SEPARATOR","CHECKPOINT_NAMESPACE_END","COMMAND_SYMBOL","CommandInstance","Record","Resume","Update","Nodes","CommandParams","SendInterface","Node","Args","_isSendInterface","Send","_isSend","Interrupt","Value","isInterrupted","Command","Omit","isCommand","_deserializeCommandSendObjectGraph","Map"],"sources":["../src/constants.d.ts"],"sourcesContent":["import { PendingWrite } from \"@langchain/langgraph-checkpoint\";\n/** Special reserved node name denoting the start of a graph. */\nexport declare const START = \"__start__\";\n/** Special reserved node name denoting the end of a graph. */\nexport declare const END = \"__end__\";\nexport declare const INPUT = \"__input__\";\nexport declare const COPY = \"__copy__\";\nexport declare const ERROR = \"__error__\";\n/** Special reserved cache namespaces */\nexport declare const CACHE_NS_WRITES = \"__pregel_ns_writes\";\nexport declare const CONFIG_KEY_SEND = \"__pregel_send\";\n/** config key containing function used to call a node (push task) */\nexport declare const CONFIG_KEY_CALL = \"__pregel_call\";\nexport declare const CONFIG_KEY_READ = \"__pregel_read\";\nexport declare const CONFIG_KEY_CHECKPOINTER = \"__pregel_checkpointer\";\nexport declare const CONFIG_KEY_RESUMING = \"__pregel_resuming\";\nexport declare const CONFIG_KEY_TASK_ID = \"__pregel_task_id\";\nexport declare const CONFIG_KEY_STREAM = \"__pregel_stream\";\nexport declare const CONFIG_KEY_RESUME_VALUE = \"__pregel_resume_value\";\nexport declare const CONFIG_KEY_RESUME_MAP = \"__pregel_resume_map\";\nexport declare const CONFIG_KEY_SCRATCHPAD = \"__pregel_scratchpad\";\n/** config key containing state from previous invocation of graph for the given thread */\nexport declare const CONFIG_KEY_PREVIOUS_STATE = \"__pregel_previous\";\nexport declare const CONFIG_KEY_DURABILITY = \"__pregel_durability\";\nexport declare const CONFIG_KEY_CHECKPOINT_ID = \"checkpoint_id\";\nexport declare const CONFIG_KEY_CHECKPOINT_NS = \"checkpoint_ns\";\nexport declare const CONFIG_KEY_NODE_FINISHED = \"__pregel_node_finished\";\n// this one is part of public API\nexport declare const CONFIG_KEY_CHECKPOINT_MAP = \"checkpoint_map\";\nexport declare const CONFIG_KEY_ABORT_SIGNALS = \"__pregel_abort_signals\";\n/** Special channel reserved for graph interrupts */\nexport declare const INTERRUPT = \"__interrupt__\";\n/** Special channel reserved for graph resume */\nexport declare const RESUME = \"__resume__\";\n/** Special channel reserved for cases when a task exits without any writes */\nexport declare const NO_WRITES = \"__no_writes__\";\n/** Special channel reserved for graph return */\nexport declare const RETURN = \"__return__\";\n/** Special channel reserved for graph previous state */\nexport declare const PREVIOUS = \"__previous__\";\nexport declare const RUNTIME_PLACEHOLDER = \"__pregel_runtime_placeholder__\";\nexport declare const RECURSION_LIMIT_DEFAULT = 25;\nexport declare const TAG_HIDDEN = \"langsmith:hidden\";\nexport declare const TAG_NOSTREAM = \"langsmith:nostream\";\nexport declare const SELF = \"__self__\";\nexport declare const TASKS = \"__pregel_tasks\";\nexport declare const PUSH = \"__pregel_push\";\nexport declare const PULL = \"__pregel_pull\";\nexport declare const TASK_NAMESPACE = \"6ba7b831-9dad-11d1-80b4-00c04fd430c8\";\nexport declare const NULL_TASK_ID = \"00000000-0000-0000-0000-000000000000\";\nexport declare const RESERVED: string[];\nexport declare const CHECKPOINT_NAMESPACE_SEPARATOR = \"|\";\nexport declare const CHECKPOINT_NAMESPACE_END = \":\";\n/** @internal */\ndeclare const COMMAND_SYMBOL: unique symbol;\n/**\n * Instance of a {@link Command} class.\n *\n * This is used to avoid IntelliSense suggesting public fields\n * of {@link Command} class when a plain object is expected.\n *\n * @see {@link Command}\n * @internal\n */\nexport declare class CommandInstance<Resume = unknown, Update extends Record<string, unknown> = Record<string, unknown>, Nodes extends string = string> {\n [COMMAND_SYMBOL]: CommandParams<Resume, Update, Nodes>;\n constructor(args: CommandParams<Resume, Update, Nodes>);\n}\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface SendInterface<Node extends string = string, Args = any> {\n node: Node;\n args: Args;\n}\nexport declare function _isSendInterface(x: unknown): x is SendInterface;\n/**\n *\n * A message or packet to send to a specific node in the graph.\n *\n * The `Send` class is used within a `StateGraph`'s conditional edges to\n * dynamically invoke a node with a custom state at the next step.\n *\n * Importantly, the sent state can differ from the core graph's state,\n * allowing for flexible and dynamic workflow management.\n *\n * One such example is a \"map-reduce\" workflow where your graph invokes\n * the same node multiple times in parallel with different states,\n * before aggregating the results back into the main graph's state.\n *\n * @example\n * ```typescript\n * import { Annotation, Send, StateGraph } from \"@langchain/langgraph\";\n *\n * const ChainState = Annotation.Root({\n * subjects: Annotation<string[]>,\n * jokes: Annotation<string[]>({\n * reducer: (a, b) => a.concat(b),\n * }),\n * });\n *\n * const continueToJokes = async (state: typeof ChainState.State) => {\n * return state.subjects.map((subject) => {\n * return new Send(\"generate_joke\", { subjects: [subject] });\n * });\n * };\n *\n * const graph = new StateGraph(ChainState)\n * .addNode(\"generate_joke\", (state) => ({\n * jokes: [`Joke about ${state.subjects}`],\n * }))\n * .addConditionalEdges(\"__start__\", continueToJokes)\n * .addEdge(\"generate_joke\", \"__end__\")\n * .compile();\n *\n * const res = await graph.invoke({ subjects: [\"cats\", \"dogs\"] });\n * console.log(res);\n *\n * // Invoking with two subjects results in a generated joke for each\n * // { subjects: [\"cats\", \"dogs\"], jokes: [`Joke about cats`, `Joke about dogs`] }\n * ```\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport declare class Send<Node extends string = string, Args = any> implements SendInterface<Node, Args> {\n lg_name: string;\n node: Node;\n args: Args;\n constructor(node: Node, args: Args);\n toJSON(): {\n lg_name: string;\n node: Node;\n args: Args;\n };\n}\nexport declare function _isSend(x: unknown): x is Send;\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type Interrupt<Value = any> = {\n id?: string;\n value?: Value;\n};\n/**\n * Checks if the given graph invoke / stream chunk contains interrupt.\n *\n * @example\n * ```ts\n * import { INTERRUPT, isInterrupted } from \"@langchain/langgraph\";\n *\n * const values = await graph.invoke({ foo: \"bar\" });\n * if (isInterrupted<string>(values)) {\n * const interrupt = values[INTERRUPT][0].value;\n * }\n * ```\n *\n * @param values - The values to check.\n * @returns `true` if the values contain an interrupt, `false` otherwise.\n */\nexport declare function isInterrupted<Value = unknown>(values: unknown): values is {\n [INTERRUPT]: Interrupt<Value>[];\n};\nexport type CommandParams<Resume = unknown, Update extends Record<string, unknown> = Record<string, unknown>, Nodes extends string = string> = {\n /**\n * A discriminator field used to identify the type of object. Must be populated when serializing.\n *\n * Optional because it's not required to specify this when directly constructing a {@link Command}\n * object.\n */\n lg_name?: \"Command\";\n /**\n * Value to resume execution with. To be used together with {@link interrupt}.\n */\n resume?: Resume;\n /**\n * Graph to send the command to. Supported values are:\n * - None: the current graph (default)\n * - The specific name of the graph to send the command to\n * - {@link Command.PARENT}: closest parent graph (only supported when returned from a node in a subgraph)\n */\n graph?: string;\n /**\n * Update to apply to the graph's state.\n */\n update?: Update | [string, unknown][];\n /**\n * Can be one of the following:\n * - name of the node to navigate to next (any node that belongs to the specified `graph`)\n * - sequence of node names to navigate to next\n * - `Send` object (to execute a node with the input provided)\n * - sequence of `Send` objects\n */\n goto?: Nodes | SendInterface<Nodes> // eslint-disable-line @typescript-eslint/no-explicit-any\n | (Nodes | SendInterface<Nodes>)[]; // eslint-disable-line @typescript-eslint/no-explicit-any\n};\n/**\n * One or more commands to update the graph's state and send messages to nodes.\n * Can be used to combine routing logic with state updates in lieu of conditional edges\n *\n * @example\n * ```ts\n * import { Annotation, Command } from \"@langchain/langgraph\";\n *\n * // Define graph state\n * const StateAnnotation = Annotation.Root({\n * foo: Annotation<string>,\n * });\n *\n * // Define the nodes\n * const nodeA = async (_state: typeof StateAnnotation.State) => {\n * console.log(\"Called A\");\n * // this is a replacement for a real conditional edge function\n * const goto = Math.random() > .5 ? \"nodeB\" : \"nodeC\";\n * // note how Command allows you to BOTH update the graph state AND route to the next node\n * return new Command({\n * // this is the state update\n * update: {\n * foo: \"a\",\n * },\n * // this is a replacement for an edge\n * goto,\n * });\n * };\n *\n * // Nodes B and C are unchanged\n * const nodeB = async (state: typeof StateAnnotation.State) => {\n * console.log(\"Called B\");\n * return {\n * foo: state.foo + \"|b\",\n * };\n * }\n *\n * const nodeC = async (state: typeof StateAnnotation.State) => {\n * console.log(\"Called C\");\n * return {\n * foo: state.foo + \"|c\",\n * };\n * }\n *\n * import { StateGraph } from \"@langchain/langgraph\";\n\n * // NOTE: there are no edges between nodes A, B and C!\n * const graph = new StateGraph(StateAnnotation)\n * .addNode(\"nodeA\", nodeA, {\n * ends: [\"nodeB\", \"nodeC\"],\n * })\n * .addNode(\"nodeB\", nodeB)\n * .addNode(\"nodeC\", nodeC)\n * .addEdge(\"__start__\", \"nodeA\")\n * .compile();\n *\n * await graph.invoke({ foo: \"\" });\n *\n * // Randomly oscillates between\n * // { foo: 'a|c' } and { foo: 'a|b' }\n * ```\n */\nexport declare class Command<Resume = unknown, Update extends Record<string, unknown> = Record<string, unknown>, Nodes extends string = string> extends CommandInstance<Resume, Update, Nodes> {\n readonly lg_name: string;\n lc_direct_tool_output: boolean;\n /**\n * Graph to send the command to. Supported values are:\n * - None: the current graph (default)\n * - The specific name of the graph to send the command to\n * - {@link Command.PARENT}: closest parent graph (only supported when returned from a node in a subgraph)\n */\n graph?: string;\n /**\n * Update to apply to the graph's state as a result of executing the node that is returning the command.\n * Written to the state as if the node had simply returned this value instead of the Command object.\n */\n update?: Update | [string, unknown][];\n /**\n * Value to resume execution with. To be used together with {@link interrupt}.\n */\n resume?: Resume;\n /**\n * Can be one of the following:\n * - name of the node to navigate to next (any node that belongs to the specified `graph`)\n * - sequence of node names to navigate to next\n * - {@link Send} object (to execute a node with the exact input provided in the {@link Send} object)\n * - sequence of {@link Send} objects\n */\n goto?: Nodes | Send<Nodes> | (Nodes | Send<Nodes>)[];\n static PARENT: string;\n constructor(args: Omit<CommandParams<Resume, Update, Nodes>, \"lg_name\">);\n /**\n * Convert the update field to a list of {@link PendingWrite} tuples\n * @returns List of {@link PendingWrite} tuples of the form `[channelKey, value]`.\n * @internal\n */\n _updateAsTuples(): PendingWrite[];\n toJSON(): {\n lg_name: string;\n update: Update | [string, unknown][] | undefined;\n resume: Resume | undefined;\n goto: Nodes | (Nodes | {\n lg_name: string;\n node: Nodes;\n args: any;\n })[] | {\n lg_name: string;\n node: Nodes;\n args: any;\n } | undefined;\n };\n}\n/**\n * A type guard to check if the given value is a {@link Command}.\n *\n * Useful for type narrowing when working with the {@link Command} object.\n *\n * @param x - The value to check.\n * @returns `true` if the value is a {@link Command}, `false` otherwise.\n */\nexport declare function isCommand(x: unknown): x is Command;\n/**\n * Reconstructs Command and Send objects from a deeply nested tree of anonymous objects\n * matching their interfaces.\n *\n * This is only exported for testing purposes. It is NOT intended to be used outside of\n * the Command and Send classes.\n *\n * @internal\n *\n * @param x - The command send tree to convert.\n * @param seen - A map of seen objects to avoid infinite loops.\n * @returns The converted command send tree.\n */\nexport declare function _deserializeCommandSendObjectGraph(x: unknown, seen?: Map<object, unknown>): unknown;\nexport {};\n"],"mappings":";;;;cAEqBC,KAAAA;AAArB;AAEqBC,cAAAA,GAAAA,GAAG,SAAA;;AAuHdgD,cA5FW1B,SAAAA,GA4FX0B,eAAAA;;;;AAWEK,cA/FS3B,QAAAA,GAiGT4B,cAAAA;;cAlFEd,cAqIKO,EAAAA,OAAAA,MAAAA;;;;;AAiEnB;;;;;AAAgLH,cA5L3JH,eA4L2JG,CAAAA,SAAAA,OAAAA,EAAAA,eA5L1GF,MA4L0GE,CAAAA,MAAAA,EAAAA,OAAAA,CAAAA,GA5LhFF,MA4LgFE,CAAAA,MAAAA,EAAAA,OAAAA,CAAAA,EAAAA,cAAAA,MAAAA,GAAAA,MAAAA,CAAAA,CAAAA;GA3L3KJ,cAAAA,CA2LmLK,EA3LlKC,aA2LkKD,CA3LpJF,MA2LoJE,EA3L5ID,MA2L4IC,EA3LpIA,KA2LoIA,CAAAA;aAc3KD,CAAAA,IAAAA,EAxMSE,aAwMTF,CAxMuBD,MAwMvBC,EAxM+BA,MAwM/BA,EAxMuCC,KAwMvCD,CAAAA;;;AAYWC,UAjNPE,aAiNOF,CAAAA,aAAAA,MAAAA,GAAAA,MAAAA,EAAAA,OAAAA,GAAAA,CAAAA,CAAAA;MAALM,EAhNTH,IAgNSG;MAAeN,EA/MxBI,IA+MwBJ;;;;;;;;;;;;;;;;AAgClC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA7LqBM,0DAA0DJ,cAAcC,MAAMC;;QAEzFD;QACAC;oBACYD,YAAYC;;;UAGpBD;UACAC;;;;KAKFI;;UAEAC;;;;;;;;;;;;;;;;;;iBAkBYC;GACnBjC,SAAAA,GAAY+B,UAAUC;;KAEfR,+CAA+CJ,0BAA0BA;;;;;;;;;;;WAWxEC;;;;;;;;;;;WAWAC;;;;;;;;SAQFC,QAAQE,cAAcF;KACzBA,QAAQE,cAAcF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAgETW,yCAAyCd,0BAA0BA,gEAAgED,gBAAgBE,QAAQC,QAAQC;;;;;;;;;;;;;;WAc3KD;;;;WAIAD;;;;;;;;SAQFE,QAAQM,KAAKN,UAAUA,QAAQM,KAAKN;;oBAEzBY,KAAKX,cAAcH,QAAQC,QAAQC;;;;;;qBAMlC/C;;;YAGP8C;YACAD;UACFE,SAASA;;YAELA;;;;YAIAA;;;;;;;;;;;;;iBAaMa,SAAAA,mBAA4BF"}
|
package/dist/constants.d.ts
DELETED
|
@@ -1,285 +0,0 @@
|
|
|
1
|
-
import { PendingWrite } from "@langchain/langgraph-checkpoint";
|
|
2
|
-
|
|
3
|
-
//#region src/constants.d.ts
|
|
4
|
-
/** Special reserved node name denoting the start of a graph. */
|
|
5
|
-
declare const START = "__start__";
|
|
6
|
-
/** Special reserved node name denoting the end of a graph. */
|
|
7
|
-
declare const END = "__end__";
|
|
8
|
-
/** Special channel reserved for graph interrupts */
|
|
9
|
-
declare const INTERRUPT = "__interrupt__";
|
|
10
|
-
/** Special channel reserved for graph resume */
|
|
11
|
-
|
|
12
|
-
/** Special channel reserved for graph previous state */
|
|
13
|
-
declare const PREVIOUS = "__previous__";
|
|
14
|
-
/** @internal */
|
|
15
|
-
declare const COMMAND_SYMBOL: unique symbol;
|
|
16
|
-
/**
|
|
17
|
-
* Instance of a {@link Command} class.
|
|
18
|
-
*
|
|
19
|
-
* This is used to avoid IntelliSense suggesting public fields
|
|
20
|
-
* of {@link Command} class when a plain object is expected.
|
|
21
|
-
*
|
|
22
|
-
* @see {@link Command}
|
|
23
|
-
* @internal
|
|
24
|
-
*/
|
|
25
|
-
declare class CommandInstance<Resume = unknown, Update extends Record<string, unknown> = Record<string, unknown>, Nodes extends string = string> {
|
|
26
|
-
[COMMAND_SYMBOL]: CommandParams<Resume, Update, Nodes>;
|
|
27
|
-
constructor(args: CommandParams<Resume, Update, Nodes>);
|
|
28
|
-
}
|
|
29
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
30
|
-
interface SendInterface<Node extends string = string, Args = any> {
|
|
31
|
-
node: Node;
|
|
32
|
-
args: Args;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
*
|
|
36
|
-
* A message or packet to send to a specific node in the graph.
|
|
37
|
-
*
|
|
38
|
-
* The `Send` class is used within a `StateGraph`'s conditional edges to
|
|
39
|
-
* dynamically invoke a node with a custom state at the next step.
|
|
40
|
-
*
|
|
41
|
-
* Importantly, the sent state can differ from the core graph's state,
|
|
42
|
-
* allowing for flexible and dynamic workflow management.
|
|
43
|
-
*
|
|
44
|
-
* One such example is a "map-reduce" workflow where your graph invokes
|
|
45
|
-
* the same node multiple times in parallel with different states,
|
|
46
|
-
* before aggregating the results back into the main graph's state.
|
|
47
|
-
*
|
|
48
|
-
* @example
|
|
49
|
-
* ```typescript
|
|
50
|
-
* import { Annotation, Send, StateGraph } from "@langchain/langgraph";
|
|
51
|
-
*
|
|
52
|
-
* const ChainState = Annotation.Root({
|
|
53
|
-
* subjects: Annotation<string[]>,
|
|
54
|
-
* jokes: Annotation<string[]>({
|
|
55
|
-
* reducer: (a, b) => a.concat(b),
|
|
56
|
-
* }),
|
|
57
|
-
* });
|
|
58
|
-
*
|
|
59
|
-
* const continueToJokes = async (state: typeof ChainState.State) => {
|
|
60
|
-
* return state.subjects.map((subject) => {
|
|
61
|
-
* return new Send("generate_joke", { subjects: [subject] });
|
|
62
|
-
* });
|
|
63
|
-
* };
|
|
64
|
-
*
|
|
65
|
-
* const graph = new StateGraph(ChainState)
|
|
66
|
-
* .addNode("generate_joke", (state) => ({
|
|
67
|
-
* jokes: [`Joke about ${state.subjects}`],
|
|
68
|
-
* }))
|
|
69
|
-
* .addConditionalEdges("__start__", continueToJokes)
|
|
70
|
-
* .addEdge("generate_joke", "__end__")
|
|
71
|
-
* .compile();
|
|
72
|
-
*
|
|
73
|
-
* const res = await graph.invoke({ subjects: ["cats", "dogs"] });
|
|
74
|
-
* console.log(res);
|
|
75
|
-
*
|
|
76
|
-
* // Invoking with two subjects results in a generated joke for each
|
|
77
|
-
* // { subjects: ["cats", "dogs"], jokes: [`Joke about cats`, `Joke about dogs`] }
|
|
78
|
-
* ```
|
|
79
|
-
*/
|
|
80
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
81
|
-
declare class Send<Node extends string = string, Args = any> implements SendInterface<Node, Args> {
|
|
82
|
-
lg_name: string;
|
|
83
|
-
node: Node;
|
|
84
|
-
args: Args;
|
|
85
|
-
constructor(node: Node, args: Args);
|
|
86
|
-
toJSON(): {
|
|
87
|
-
lg_name: string;
|
|
88
|
-
node: Node;
|
|
89
|
-
args: Args;
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
93
|
-
type Interrupt<Value = any> = {
|
|
94
|
-
id?: string;
|
|
95
|
-
value?: Value;
|
|
96
|
-
};
|
|
97
|
-
/**
|
|
98
|
-
* Checks if the given graph invoke / stream chunk contains interrupt.
|
|
99
|
-
*
|
|
100
|
-
* @example
|
|
101
|
-
* ```ts
|
|
102
|
-
* import { INTERRUPT, isInterrupted } from "@langchain/langgraph";
|
|
103
|
-
*
|
|
104
|
-
* const values = await graph.invoke({ foo: "bar" });
|
|
105
|
-
* if (isInterrupted<string>(values)) {
|
|
106
|
-
* const interrupt = values[INTERRUPT][0].value;
|
|
107
|
-
* }
|
|
108
|
-
* ```
|
|
109
|
-
*
|
|
110
|
-
* @param values - The values to check.
|
|
111
|
-
* @returns `true` if the values contain an interrupt, `false` otherwise.
|
|
112
|
-
*/
|
|
113
|
-
declare function isInterrupted<Value = unknown>(values: unknown): values is {
|
|
114
|
-
[INTERRUPT]: Interrupt<Value>[];
|
|
115
|
-
};
|
|
116
|
-
type CommandParams<Resume = unknown, Update extends Record<string, unknown> = Record<string, unknown>, Nodes extends string = string> = {
|
|
117
|
-
/**
|
|
118
|
-
* A discriminator field used to identify the type of object. Must be populated when serializing.
|
|
119
|
-
*
|
|
120
|
-
* Optional because it's not required to specify this when directly constructing a {@link Command}
|
|
121
|
-
* object.
|
|
122
|
-
*/
|
|
123
|
-
lg_name?: "Command";
|
|
124
|
-
/**
|
|
125
|
-
* Value to resume execution with. To be used together with {@link interrupt}.
|
|
126
|
-
*/
|
|
127
|
-
resume?: Resume;
|
|
128
|
-
/**
|
|
129
|
-
* Graph to send the command to. Supported values are:
|
|
130
|
-
* - None: the current graph (default)
|
|
131
|
-
* - The specific name of the graph to send the command to
|
|
132
|
-
* - {@link Command.PARENT}: closest parent graph (only supported when returned from a node in a subgraph)
|
|
133
|
-
*/
|
|
134
|
-
graph?: string;
|
|
135
|
-
/**
|
|
136
|
-
* Update to apply to the graph's state.
|
|
137
|
-
*/
|
|
138
|
-
update?: Update | [string, unknown][];
|
|
139
|
-
/**
|
|
140
|
-
* Can be one of the following:
|
|
141
|
-
* - name of the node to navigate to next (any node that belongs to the specified `graph`)
|
|
142
|
-
* - sequence of node names to navigate to next
|
|
143
|
-
* - `Send` object (to execute a node with the input provided)
|
|
144
|
-
* - sequence of `Send` objects
|
|
145
|
-
*/
|
|
146
|
-
goto?: Nodes | SendInterface<Nodes> // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
147
|
-
| (Nodes | SendInterface<Nodes>)[]; // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
148
|
-
};
|
|
149
|
-
/**
|
|
150
|
-
* One or more commands to update the graph's state and send messages to nodes.
|
|
151
|
-
* Can be used to combine routing logic with state updates in lieu of conditional edges
|
|
152
|
-
*
|
|
153
|
-
* @example
|
|
154
|
-
* ```ts
|
|
155
|
-
* import { Annotation, Command } from "@langchain/langgraph";
|
|
156
|
-
*
|
|
157
|
-
* // Define graph state
|
|
158
|
-
* const StateAnnotation = Annotation.Root({
|
|
159
|
-
* foo: Annotation<string>,
|
|
160
|
-
* });
|
|
161
|
-
*
|
|
162
|
-
* // Define the nodes
|
|
163
|
-
* const nodeA = async (_state: typeof StateAnnotation.State) => {
|
|
164
|
-
* console.log("Called A");
|
|
165
|
-
* // this is a replacement for a real conditional edge function
|
|
166
|
-
* const goto = Math.random() > .5 ? "nodeB" : "nodeC";
|
|
167
|
-
* // note how Command allows you to BOTH update the graph state AND route to the next node
|
|
168
|
-
* return new Command({
|
|
169
|
-
* // this is the state update
|
|
170
|
-
* update: {
|
|
171
|
-
* foo: "a",
|
|
172
|
-
* },
|
|
173
|
-
* // this is a replacement for an edge
|
|
174
|
-
* goto,
|
|
175
|
-
* });
|
|
176
|
-
* };
|
|
177
|
-
*
|
|
178
|
-
* // Nodes B and C are unchanged
|
|
179
|
-
* const nodeB = async (state: typeof StateAnnotation.State) => {
|
|
180
|
-
* console.log("Called B");
|
|
181
|
-
* return {
|
|
182
|
-
* foo: state.foo + "|b",
|
|
183
|
-
* };
|
|
184
|
-
* }
|
|
185
|
-
*
|
|
186
|
-
* const nodeC = async (state: typeof StateAnnotation.State) => {
|
|
187
|
-
* console.log("Called C");
|
|
188
|
-
* return {
|
|
189
|
-
* foo: state.foo + "|c",
|
|
190
|
-
* };
|
|
191
|
-
* }
|
|
192
|
-
*
|
|
193
|
-
* import { StateGraph } from "@langchain/langgraph";
|
|
194
|
-
|
|
195
|
-
* // NOTE: there are no edges between nodes A, B and C!
|
|
196
|
-
* const graph = new StateGraph(StateAnnotation)
|
|
197
|
-
* .addNode("nodeA", nodeA, {
|
|
198
|
-
* ends: ["nodeB", "nodeC"],
|
|
199
|
-
* })
|
|
200
|
-
* .addNode("nodeB", nodeB)
|
|
201
|
-
* .addNode("nodeC", nodeC)
|
|
202
|
-
* .addEdge("__start__", "nodeA")
|
|
203
|
-
* .compile();
|
|
204
|
-
*
|
|
205
|
-
* await graph.invoke({ foo: "" });
|
|
206
|
-
*
|
|
207
|
-
* // Randomly oscillates between
|
|
208
|
-
* // { foo: 'a|c' } and { foo: 'a|b' }
|
|
209
|
-
* ```
|
|
210
|
-
*/
|
|
211
|
-
declare class Command<Resume = unknown, Update extends Record<string, unknown> = Record<string, unknown>, Nodes extends string = string> extends CommandInstance<Resume, Update, Nodes> {
|
|
212
|
-
readonly lg_name: string;
|
|
213
|
-
lc_direct_tool_output: boolean;
|
|
214
|
-
/**
|
|
215
|
-
* Graph to send the command to. Supported values are:
|
|
216
|
-
* - None: the current graph (default)
|
|
217
|
-
* - The specific name of the graph to send the command to
|
|
218
|
-
* - {@link Command.PARENT}: closest parent graph (only supported when returned from a node in a subgraph)
|
|
219
|
-
*/
|
|
220
|
-
graph?: string;
|
|
221
|
-
/**
|
|
222
|
-
* Update to apply to the graph's state as a result of executing the node that is returning the command.
|
|
223
|
-
* Written to the state as if the node had simply returned this value instead of the Command object.
|
|
224
|
-
*/
|
|
225
|
-
update?: Update | [string, unknown][];
|
|
226
|
-
/**
|
|
227
|
-
* Value to resume execution with. To be used together with {@link interrupt}.
|
|
228
|
-
*/
|
|
229
|
-
resume?: Resume;
|
|
230
|
-
/**
|
|
231
|
-
* Can be one of the following:
|
|
232
|
-
* - name of the node to navigate to next (any node that belongs to the specified `graph`)
|
|
233
|
-
* - sequence of node names to navigate to next
|
|
234
|
-
* - {@link Send} object (to execute a node with the exact input provided in the {@link Send} object)
|
|
235
|
-
* - sequence of {@link Send} objects
|
|
236
|
-
*/
|
|
237
|
-
goto?: Nodes | Send<Nodes> | (Nodes | Send<Nodes>)[];
|
|
238
|
-
static PARENT: string;
|
|
239
|
-
constructor(args: Omit<CommandParams<Resume, Update, Nodes>, "lg_name">);
|
|
240
|
-
/**
|
|
241
|
-
* Convert the update field to a list of {@link PendingWrite} tuples
|
|
242
|
-
* @returns List of {@link PendingWrite} tuples of the form `[channelKey, value]`.
|
|
243
|
-
* @internal
|
|
244
|
-
*/
|
|
245
|
-
_updateAsTuples(): PendingWrite[];
|
|
246
|
-
toJSON(): {
|
|
247
|
-
lg_name: string;
|
|
248
|
-
update: Update | [string, unknown][] | undefined;
|
|
249
|
-
resume: Resume | undefined;
|
|
250
|
-
goto: Nodes | (Nodes | {
|
|
251
|
-
lg_name: string;
|
|
252
|
-
node: Nodes;
|
|
253
|
-
args: any;
|
|
254
|
-
})[] | {
|
|
255
|
-
lg_name: string;
|
|
256
|
-
node: Nodes;
|
|
257
|
-
args: any;
|
|
258
|
-
} | undefined;
|
|
259
|
-
};
|
|
260
|
-
}
|
|
261
|
-
/**
|
|
262
|
-
* A type guard to check if the given value is a {@link Command}.
|
|
263
|
-
*
|
|
264
|
-
* Useful for type narrowing when working with the {@link Command} object.
|
|
265
|
-
*
|
|
266
|
-
* @param x - The value to check.
|
|
267
|
-
* @returns `true` if the value is a {@link Command}, `false` otherwise.
|
|
268
|
-
*/
|
|
269
|
-
declare function isCommand(x: unknown): x is Command;
|
|
270
|
-
/**
|
|
271
|
-
* Reconstructs Command and Send objects from a deeply nested tree of anonymous objects
|
|
272
|
-
* matching their interfaces.
|
|
273
|
-
*
|
|
274
|
-
* This is only exported for testing purposes. It is NOT intended to be used outside of
|
|
275
|
-
* the Command and Send classes.
|
|
276
|
-
*
|
|
277
|
-
* @internal
|
|
278
|
-
*
|
|
279
|
-
* @param x - The command send tree to convert.
|
|
280
|
-
* @param seen - A map of seen objects to avoid infinite loops.
|
|
281
|
-
* @returns The converted command send tree.
|
|
282
|
-
*/
|
|
283
|
-
//#endregion
|
|
284
|
-
export { Command, CommandInstance, CommandParams, END, INTERRUPT, Interrupt, PREVIOUS, START, Send, isCommand, isInterrupted };
|
|
285
|
-
//# sourceMappingURL=constants.d.ts.map
|
package/dist/constants.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","names":["PendingWrite","START","END","INPUT","COPY","ERROR","CACHE_NS_WRITES","CONFIG_KEY_SEND","CONFIG_KEY_CALL","CONFIG_KEY_READ","CONFIG_KEY_CHECKPOINTER","CONFIG_KEY_RESUMING","CONFIG_KEY_TASK_ID","CONFIG_KEY_STREAM","CONFIG_KEY_RESUME_VALUE","CONFIG_KEY_RESUME_MAP","CONFIG_KEY_SCRATCHPAD","CONFIG_KEY_PREVIOUS_STATE","CONFIG_KEY_DURABILITY","CONFIG_KEY_CHECKPOINT_ID","CONFIG_KEY_CHECKPOINT_NS","CONFIG_KEY_NODE_FINISHED","CONFIG_KEY_CHECKPOINT_MAP","CONFIG_KEY_ABORT_SIGNALS","INTERRUPT","RESUME","NO_WRITES","RETURN","PREVIOUS","RUNTIME_PLACEHOLDER","RECURSION_LIMIT_DEFAULT","TAG_HIDDEN","TAG_NOSTREAM","SELF","TASKS","PUSH","PULL","TASK_NAMESPACE","NULL_TASK_ID","RESERVED","CHECKPOINT_NAMESPACE_SEPARATOR","CHECKPOINT_NAMESPACE_END","COMMAND_SYMBOL","CommandInstance","Record","Resume","Update","Nodes","CommandParams","SendInterface","Node","Args","_isSendInterface","Send","_isSend","Interrupt","Value","isInterrupted","Command","Omit","isCommand","_deserializeCommandSendObjectGraph","Map"],"sources":["../src/constants.d.ts"],"sourcesContent":["import { PendingWrite } from \"@langchain/langgraph-checkpoint\";\n/** Special reserved node name denoting the start of a graph. */\nexport declare const START = \"__start__\";\n/** Special reserved node name denoting the end of a graph. */\nexport declare const END = \"__end__\";\nexport declare const INPUT = \"__input__\";\nexport declare const COPY = \"__copy__\";\nexport declare const ERROR = \"__error__\";\n/** Special reserved cache namespaces */\nexport declare const CACHE_NS_WRITES = \"__pregel_ns_writes\";\nexport declare const CONFIG_KEY_SEND = \"__pregel_send\";\n/** config key containing function used to call a node (push task) */\nexport declare const CONFIG_KEY_CALL = \"__pregel_call\";\nexport declare const CONFIG_KEY_READ = \"__pregel_read\";\nexport declare const CONFIG_KEY_CHECKPOINTER = \"__pregel_checkpointer\";\nexport declare const CONFIG_KEY_RESUMING = \"__pregel_resuming\";\nexport declare const CONFIG_KEY_TASK_ID = \"__pregel_task_id\";\nexport declare const CONFIG_KEY_STREAM = \"__pregel_stream\";\nexport declare const CONFIG_KEY_RESUME_VALUE = \"__pregel_resume_value\";\nexport declare const CONFIG_KEY_RESUME_MAP = \"__pregel_resume_map\";\nexport declare const CONFIG_KEY_SCRATCHPAD = \"__pregel_scratchpad\";\n/** config key containing state from previous invocation of graph for the given thread */\nexport declare const CONFIG_KEY_PREVIOUS_STATE = \"__pregel_previous\";\nexport declare const CONFIG_KEY_DURABILITY = \"__pregel_durability\";\nexport declare const CONFIG_KEY_CHECKPOINT_ID = \"checkpoint_id\";\nexport declare const CONFIG_KEY_CHECKPOINT_NS = \"checkpoint_ns\";\nexport declare const CONFIG_KEY_NODE_FINISHED = \"__pregel_node_finished\";\n// this one is part of public API\nexport declare const CONFIG_KEY_CHECKPOINT_MAP = \"checkpoint_map\";\nexport declare const CONFIG_KEY_ABORT_SIGNALS = \"__pregel_abort_signals\";\n/** Special channel reserved for graph interrupts */\nexport declare const INTERRUPT = \"__interrupt__\";\n/** Special channel reserved for graph resume */\nexport declare const RESUME = \"__resume__\";\n/** Special channel reserved for cases when a task exits without any writes */\nexport declare const NO_WRITES = \"__no_writes__\";\n/** Special channel reserved for graph return */\nexport declare const RETURN = \"__return__\";\n/** Special channel reserved for graph previous state */\nexport declare const PREVIOUS = \"__previous__\";\nexport declare const RUNTIME_PLACEHOLDER = \"__pregel_runtime_placeholder__\";\nexport declare const RECURSION_LIMIT_DEFAULT = 25;\nexport declare const TAG_HIDDEN = \"langsmith:hidden\";\nexport declare const TAG_NOSTREAM = \"langsmith:nostream\";\nexport declare const SELF = \"__self__\";\nexport declare const TASKS = \"__pregel_tasks\";\nexport declare const PUSH = \"__pregel_push\";\nexport declare const PULL = \"__pregel_pull\";\nexport declare const TASK_NAMESPACE = \"6ba7b831-9dad-11d1-80b4-00c04fd430c8\";\nexport declare const NULL_TASK_ID = \"00000000-0000-0000-0000-000000000000\";\nexport declare const RESERVED: string[];\nexport declare const CHECKPOINT_NAMESPACE_SEPARATOR = \"|\";\nexport declare const CHECKPOINT_NAMESPACE_END = \":\";\n/** @internal */\ndeclare const COMMAND_SYMBOL: unique symbol;\n/**\n * Instance of a {@link Command} class.\n *\n * This is used to avoid IntelliSense suggesting public fields\n * of {@link Command} class when a plain object is expected.\n *\n * @see {@link Command}\n * @internal\n */\nexport declare class CommandInstance<Resume = unknown, Update extends Record<string, unknown> = Record<string, unknown>, Nodes extends string = string> {\n [COMMAND_SYMBOL]: CommandParams<Resume, Update, Nodes>;\n constructor(args: CommandParams<Resume, Update, Nodes>);\n}\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface SendInterface<Node extends string = string, Args = any> {\n node: Node;\n args: Args;\n}\nexport declare function _isSendInterface(x: unknown): x is SendInterface;\n/**\n *\n * A message or packet to send to a specific node in the graph.\n *\n * The `Send` class is used within a `StateGraph`'s conditional edges to\n * dynamically invoke a node with a custom state at the next step.\n *\n * Importantly, the sent state can differ from the core graph's state,\n * allowing for flexible and dynamic workflow management.\n *\n * One such example is a \"map-reduce\" workflow where your graph invokes\n * the same node multiple times in parallel with different states,\n * before aggregating the results back into the main graph's state.\n *\n * @example\n * ```typescript\n * import { Annotation, Send, StateGraph } from \"@langchain/langgraph\";\n *\n * const ChainState = Annotation.Root({\n * subjects: Annotation<string[]>,\n * jokes: Annotation<string[]>({\n * reducer: (a, b) => a.concat(b),\n * }),\n * });\n *\n * const continueToJokes = async (state: typeof ChainState.State) => {\n * return state.subjects.map((subject) => {\n * return new Send(\"generate_joke\", { subjects: [subject] });\n * });\n * };\n *\n * const graph = new StateGraph(ChainState)\n * .addNode(\"generate_joke\", (state) => ({\n * jokes: [`Joke about ${state.subjects}`],\n * }))\n * .addConditionalEdges(\"__start__\", continueToJokes)\n * .addEdge(\"generate_joke\", \"__end__\")\n * .compile();\n *\n * const res = await graph.invoke({ subjects: [\"cats\", \"dogs\"] });\n * console.log(res);\n *\n * // Invoking with two subjects results in a generated joke for each\n * // { subjects: [\"cats\", \"dogs\"], jokes: [`Joke about cats`, `Joke about dogs`] }\n * ```\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport declare class Send<Node extends string = string, Args = any> implements SendInterface<Node, Args> {\n lg_name: string;\n node: Node;\n args: Args;\n constructor(node: Node, args: Args);\n toJSON(): {\n lg_name: string;\n node: Node;\n args: Args;\n };\n}\nexport declare function _isSend(x: unknown): x is Send;\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type Interrupt<Value = any> = {\n id?: string;\n value?: Value;\n};\n/**\n * Checks if the given graph invoke / stream chunk contains interrupt.\n *\n * @example\n * ```ts\n * import { INTERRUPT, isInterrupted } from \"@langchain/langgraph\";\n *\n * const values = await graph.invoke({ foo: \"bar\" });\n * if (isInterrupted<string>(values)) {\n * const interrupt = values[INTERRUPT][0].value;\n * }\n * ```\n *\n * @param values - The values to check.\n * @returns `true` if the values contain an interrupt, `false` otherwise.\n */\nexport declare function isInterrupted<Value = unknown>(values: unknown): values is {\n [INTERRUPT]: Interrupt<Value>[];\n};\nexport type CommandParams<Resume = unknown, Update extends Record<string, unknown> = Record<string, unknown>, Nodes extends string = string> = {\n /**\n * A discriminator field used to identify the type of object. Must be populated when serializing.\n *\n * Optional because it's not required to specify this when directly constructing a {@link Command}\n * object.\n */\n lg_name?: \"Command\";\n /**\n * Value to resume execution with. To be used together with {@link interrupt}.\n */\n resume?: Resume;\n /**\n * Graph to send the command to. Supported values are:\n * - None: the current graph (default)\n * - The specific name of the graph to send the command to\n * - {@link Command.PARENT}: closest parent graph (only supported when returned from a node in a subgraph)\n */\n graph?: string;\n /**\n * Update to apply to the graph's state.\n */\n update?: Update | [string, unknown][];\n /**\n * Can be one of the following:\n * - name of the node to navigate to next (any node that belongs to the specified `graph`)\n * - sequence of node names to navigate to next\n * - `Send` object (to execute a node with the input provided)\n * - sequence of `Send` objects\n */\n goto?: Nodes | SendInterface<Nodes> // eslint-disable-line @typescript-eslint/no-explicit-any\n | (Nodes | SendInterface<Nodes>)[]; // eslint-disable-line @typescript-eslint/no-explicit-any\n};\n/**\n * One or more commands to update the graph's state and send messages to nodes.\n * Can be used to combine routing logic with state updates in lieu of conditional edges\n *\n * @example\n * ```ts\n * import { Annotation, Command } from \"@langchain/langgraph\";\n *\n * // Define graph state\n * const StateAnnotation = Annotation.Root({\n * foo: Annotation<string>,\n * });\n *\n * // Define the nodes\n * const nodeA = async (_state: typeof StateAnnotation.State) => {\n * console.log(\"Called A\");\n * // this is a replacement for a real conditional edge function\n * const goto = Math.random() > .5 ? \"nodeB\" : \"nodeC\";\n * // note how Command allows you to BOTH update the graph state AND route to the next node\n * return new Command({\n * // this is the state update\n * update: {\n * foo: \"a\",\n * },\n * // this is a replacement for an edge\n * goto,\n * });\n * };\n *\n * // Nodes B and C are unchanged\n * const nodeB = async (state: typeof StateAnnotation.State) => {\n * console.log(\"Called B\");\n * return {\n * foo: state.foo + \"|b\",\n * };\n * }\n *\n * const nodeC = async (state: typeof StateAnnotation.State) => {\n * console.log(\"Called C\");\n * return {\n * foo: state.foo + \"|c\",\n * };\n * }\n *\n * import { StateGraph } from \"@langchain/langgraph\";\n\n * // NOTE: there are no edges between nodes A, B and C!\n * const graph = new StateGraph(StateAnnotation)\n * .addNode(\"nodeA\", nodeA, {\n * ends: [\"nodeB\", \"nodeC\"],\n * })\n * .addNode(\"nodeB\", nodeB)\n * .addNode(\"nodeC\", nodeC)\n * .addEdge(\"__start__\", \"nodeA\")\n * .compile();\n *\n * await graph.invoke({ foo: \"\" });\n *\n * // Randomly oscillates between\n * // { foo: 'a|c' } and { foo: 'a|b' }\n * ```\n */\nexport declare class Command<Resume = unknown, Update extends Record<string, unknown> = Record<string, unknown>, Nodes extends string = string> extends CommandInstance<Resume, Update, Nodes> {\n readonly lg_name: string;\n lc_direct_tool_output: boolean;\n /**\n * Graph to send the command to. Supported values are:\n * - None: the current graph (default)\n * - The specific name of the graph to send the command to\n * - {@link Command.PARENT}: closest parent graph (only supported when returned from a node in a subgraph)\n */\n graph?: string;\n /**\n * Update to apply to the graph's state as a result of executing the node that is returning the command.\n * Written to the state as if the node had simply returned this value instead of the Command object.\n */\n update?: Update | [string, unknown][];\n /**\n * Value to resume execution with. To be used together with {@link interrupt}.\n */\n resume?: Resume;\n /**\n * Can be one of the following:\n * - name of the node to navigate to next (any node that belongs to the specified `graph`)\n * - sequence of node names to navigate to next\n * - {@link Send} object (to execute a node with the exact input provided in the {@link Send} object)\n * - sequence of {@link Send} objects\n */\n goto?: Nodes | Send<Nodes> | (Nodes | Send<Nodes>)[];\n static PARENT: string;\n constructor(args: Omit<CommandParams<Resume, Update, Nodes>, \"lg_name\">);\n /**\n * Convert the update field to a list of {@link PendingWrite} tuples\n * @returns List of {@link PendingWrite} tuples of the form `[channelKey, value]`.\n * @internal\n */\n _updateAsTuples(): PendingWrite[];\n toJSON(): {\n lg_name: string;\n update: Update | [string, unknown][] | undefined;\n resume: Resume | undefined;\n goto: Nodes | (Nodes | {\n lg_name: string;\n node: Nodes;\n args: any;\n })[] | {\n lg_name: string;\n node: Nodes;\n args: any;\n } | undefined;\n };\n}\n/**\n * A type guard to check if the given value is a {@link Command}.\n *\n * Useful for type narrowing when working with the {@link Command} object.\n *\n * @param x - The value to check.\n * @returns `true` if the value is a {@link Command}, `false` otherwise.\n */\nexport declare function isCommand(x: unknown): x is Command;\n/**\n * Reconstructs Command and Send objects from a deeply nested tree of anonymous objects\n * matching their interfaces.\n *\n * This is only exported for testing purposes. It is NOT intended to be used outside of\n * the Command and Send classes.\n *\n * @internal\n *\n * @param x - The command send tree to convert.\n * @param seen - A map of seen objects to avoid infinite loops.\n * @returns The converted command send tree.\n */\nexport declare function _deserializeCommandSendObjectGraph(x: unknown, seen?: Map<object, unknown>): unknown;\nexport {};\n"],"mappings":";;;;cAEqBC,KAAAA;AAArB;AAEqBC,cAAAA,GAAAA,GAAG,SAAA;;AAuHdgD,cA5FW1B,SAAAA,GA4FX0B,eAAAA;;;;AAWEK,cA/FS3B,QAAAA,GAiGT4B,cAAAA;;cAlFEd,cAqIKO,EAAAA,OAAAA,MAAAA;;;;;AAiEnB;;;;;AAAgLH,cA5L3JH,eA4L2JG,CAAAA,SAAAA,OAAAA,EAAAA,eA5L1GF,MA4L0GE,CAAAA,MAAAA,EAAAA,OAAAA,CAAAA,GA5LhFF,MA4LgFE,CAAAA,MAAAA,EAAAA,OAAAA,CAAAA,EAAAA,cAAAA,MAAAA,GAAAA,MAAAA,CAAAA,CAAAA;GA3L3KJ,cAAAA,CA2LmLK,EA3LlKC,aA2LkKD,CA3LpJF,MA2LoJE,EA3L5ID,MA2L4IC,EA3LpIA,KA2LoIA,CAAAA;aAc3KD,CAAAA,IAAAA,EAxMSE,aAwMTF,CAxMuBD,MAwMvBC,EAxM+BA,MAwM/BA,EAxMuCC,KAwMvCD,CAAAA;;;AAYWC,UAjNPE,aAiNOF,CAAAA,aAAAA,MAAAA,GAAAA,MAAAA,EAAAA,OAAAA,GAAAA,CAAAA,CAAAA;MAALM,EAhNTH,IAgNSG;MAAeN,EA/MxBI,IA+MwBJ;;;;;;;;;;;;;;;;AAgClC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA7LqBM,0DAA0DJ,cAAcC,MAAMC;;QAEzFD;QACAC;oBACYD,YAAYC;;;UAGpBD;UACAC;;;;KAKFI;;UAEAC;;;;;;;;;;;;;;;;;;iBAkBYC;GACnBjC,SAAAA,GAAY+B,UAAUC;;KAEfR,+CAA+CJ,0BAA0BA;;;;;;;;;;;WAWxEC;;;;;;;;;;;WAWAC;;;;;;;;SAQFC,QAAQE,cAAcF;KACzBA,QAAQE,cAAcF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAgETW,yCAAyCd,0BAA0BA,gEAAgED,gBAAgBE,QAAQC,QAAQC;;;;;;;;;;;;;;WAc3KD;;;;WAIAD;;;;;;;;SAQFE,QAAQM,KAAKN,UAAUA,QAAQM,KAAKN;;oBAEzBY,KAAKX,cAAcH,QAAQC,QAAQC;;;;;;qBAMlC/C;;;YAGP8C;YACAD;UACFE,SAASA;;YAELA;;;;YAIAA;;;;;;;;;;;;;iBAaMa,SAAAA,mBAA4BF"}
|