@langchain/langgraph 0.4.9 → 1.0.0-alpha.1
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/CHANGELOG.md +26 -0
- package/README.md +1 -2
- package/dist/_virtual/rolldown_runtime.cjs +25 -0
- package/dist/channels/any_value.cjs +44 -63
- package/dist/channels/any_value.cjs.map +1 -0
- package/dist/channels/any_value.d.cts +24 -0
- package/dist/channels/any_value.d.cts.map +1 -0
- package/dist/channels/any_value.d.ts +16 -11
- package/dist/channels/any_value.d.ts.map +1 -0
- package/dist/channels/any_value.js +42 -57
- package/dist/channels/any_value.js.map +1 -1
- package/dist/channels/base.cjs +93 -133
- package/dist/channels/base.cjs.map +1 -0
- package/dist/channels/base.d.cts +79 -0
- package/dist/channels/base.d.cts.map +1 -0
- package/dist/channels/base.d.ts +77 -73
- package/dist/channels/base.d.ts.map +1 -0
- package/dist/channels/base.js +90 -127
- package/dist/channels/base.js.map +1 -1
- package/dist/channels/binop.cjs +47 -77
- package/dist/channels/binop.cjs.map +1 -0
- package/dist/channels/binop.d.cts +22 -0
- package/dist/channels/binop.d.cts.map +1 -0
- package/dist/channels/binop.d.ts +17 -12
- package/dist/channels/binop.d.ts.map +1 -0
- package/dist/channels/binop.js +45 -71
- package/dist/channels/binop.js.map +1 -1
- package/dist/channels/dynamic_barrier_value.cjs +72 -208
- package/dist/channels/dynamic_barrier_value.cjs.map +1 -0
- package/dist/channels/dynamic_barrier_value.d.cts +42 -0
- package/dist/channels/dynamic_barrier_value.d.cts.map +1 -0
- package/dist/channels/dynamic_barrier_value.d.ts +20 -35
- package/dist/channels/dynamic_barrier_value.d.ts.map +1 -0
- package/dist/channels/dynamic_barrier_value.js +69 -200
- package/dist/channels/dynamic_barrier_value.js.map +1 -1
- package/dist/channels/ephemeral_value.cjs +44 -70
- package/dist/channels/ephemeral_value.cjs.map +1 -0
- package/dist/channels/ephemeral_value.d.cts +22 -0
- package/dist/channels/ephemeral_value.d.cts.map +1 -0
- package/dist/channels/ephemeral_value.d.ts +18 -12
- package/dist/channels/ephemeral_value.d.ts.map +1 -0
- package/dist/channels/ephemeral_value.js +43 -65
- package/dist/channels/ephemeral_value.js.map +1 -1
- package/dist/channels/index.cjs +21 -10
- package/dist/channels/index.d.cts +9 -0
- package/dist/channels/index.d.ts +9 -7
- package/dist/channels/index.js +10 -3
- package/dist/channels/last_value.cjs +90 -140
- package/dist/channels/last_value.cjs.map +1 -0
- package/dist/channels/last_value.d.cts +42 -0
- package/dist/channels/last_value.d.cts.map +1 -0
- package/dist/channels/last_value.d.ts +27 -23
- package/dist/channels/last_value.d.ts.map +1 -0
- package/dist/channels/last_value.js +87 -133
- package/dist/channels/last_value.js.map +1 -1
- package/dist/channels/named_barrier_value.cjs +114 -170
- package/dist/channels/named_barrier_value.cjs.map +1 -0
- package/dist/channels/named_barrier_value.d.cts +46 -0
- package/dist/channels/named_barrier_value.d.cts.map +1 -0
- package/dist/channels/named_barrier_value.d.ts +32 -29
- package/dist/channels/named_barrier_value.d.ts.map +1 -0
- package/dist/channels/named_barrier_value.js +111 -163
- package/dist/channels/named_barrier_value.js.map +1 -1
- package/dist/channels/topic.cjs +63 -96
- package/dist/channels/topic.cjs.map +1 -0
- package/dist/channels/topic.d.cts +32 -0
- package/dist/channels/topic.d.cts.map +1 -0
- package/dist/channels/topic.d.ts +28 -19
- package/dist/channels/topic.d.ts.map +1 -0
- package/dist/channels/topic.js +61 -90
- package/dist/channels/topic.js.map +1 -1
- package/dist/constants.cjs +376 -452
- package/dist/constants.cjs.map +1 -0
- package/dist/constants.d.cts +285 -0
- package/dist/constants.d.cts.map +1 -0
- package/dist/constants.d.ts +113 -148
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +336 -444
- package/dist/constants.js.map +1 -1
- package/dist/errors.cjs +151 -179
- package/dist/errors.cjs.map +1 -0
- package/dist/errors.d.cts +81 -0
- package/dist/errors.d.cts.map +1 -0
- package/dist/errors.d.ts +56 -46
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +140 -165
- package/dist/errors.js.map +1 -1
- package/dist/func/index.cjs +292 -290
- package/dist/func/index.cjs.map +1 -0
- package/dist/func/index.d.cts +293 -0
- package/dist/func/index.d.cts.map +1 -0
- package/dist/func/index.d.ts +86 -72
- package/dist/func/index.d.ts.map +1 -0
- package/dist/func/index.js +288 -284
- package/dist/func/index.js.map +1 -1
- package/dist/func/types.d.cts +64 -0
- package/dist/func/types.d.cts.map +1 -0
- package/dist/func/types.d.ts +24 -19
- package/dist/func/types.d.ts.map +1 -0
- package/dist/graph/annotation.cjs +96 -120
- package/dist/graph/annotation.cjs.map +1 -0
- package/dist/graph/annotation.d.cts +116 -0
- package/dist/graph/annotation.d.cts.map +1 -0
- package/dist/graph/annotation.d.ts +33 -34
- package/dist/graph/annotation.d.ts.map +1 -0
- package/dist/graph/annotation.js +91 -112
- package/dist/graph/annotation.js.map +1 -1
- package/dist/graph/graph.cjs +419 -723
- package/dist/graph/graph.cjs.map +1 -0
- package/dist/graph/graph.d.cts +133 -0
- package/dist/graph/graph.d.cts.map +1 -0
- package/dist/graph/graph.d.ts +124 -91
- package/dist/graph/graph.d.ts.map +1 -0
- package/dist/graph/graph.js +412 -713
- package/dist/graph/graph.js.map +1 -1
- package/dist/graph/index.cjs +4 -17
- package/dist/graph/index.js +6 -5
- package/dist/graph/message.cjs +59 -104
- package/dist/graph/message.cjs.map +1 -0
- package/dist/graph/message.d.cts +19 -0
- package/dist/graph/message.d.cts.map +1 -0
- package/dist/graph/message.d.ts +11 -10
- package/dist/graph/message.d.ts.map +1 -0
- package/dist/graph/message.js +56 -98
- package/dist/graph/message.js.map +1 -1
- package/dist/graph/messages_annotation.cjs +106 -106
- package/dist/graph/messages_annotation.cjs.map +1 -0
- package/dist/graph/messages_annotation.d.cts +111 -0
- package/dist/graph/messages_annotation.d.cts.map +1 -0
- package/dist/graph/messages_annotation.d.ts +18 -9
- package/dist/graph/messages_annotation.d.ts.map +1 -0
- package/dist/graph/messages_annotation.js +100 -100
- package/dist/graph/messages_annotation.js.map +1 -1
- package/dist/graph/state.cjs +475 -779
- package/dist/graph/state.cjs.map +1 -0
- package/dist/graph/state.d.cts +231 -0
- package/dist/graph/state.d.cts.map +1 -0
- package/dist/graph/state.d.ts +148 -138
- package/dist/graph/state.d.ts.map +1 -0
- package/dist/graph/state.js +469 -769
- package/dist/graph/state.js.map +1 -1
- package/dist/graph/zod/index.cjs +10 -21
- package/dist/graph/zod/index.d.cts +3 -0
- package/dist/graph/zod/index.d.ts +3 -3
- package/dist/graph/zod/index.js +4 -4
- package/dist/graph/zod/meta.cjs +142 -177
- package/dist/graph/zod/meta.cjs.map +1 -0
- package/dist/graph/zod/meta.d.cts +116 -0
- package/dist/graph/zod/meta.d.cts.map +1 -0
- package/dist/graph/zod/meta.d.ts +99 -97
- package/dist/graph/zod/meta.d.ts.map +1 -0
- package/dist/graph/zod/meta.js +136 -170
- package/dist/graph/zod/meta.js.map +1 -1
- package/dist/graph/zod/plugin.cjs +36 -39
- package/dist/graph/zod/plugin.cjs.map +1 -0
- package/dist/graph/zod/plugin.js +34 -35
- package/dist/graph/zod/plugin.js.map +1 -1
- package/dist/graph/zod/schema.cjs +82 -110
- package/dist/graph/zod/schema.cjs.map +1 -0
- package/dist/graph/zod/schema.d.cts +38 -0
- package/dist/graph/zod/schema.d.cts.map +1 -0
- package/dist/graph/zod/schema.d.ts +12 -6
- package/dist/graph/zod/schema.d.ts.map +1 -0
- package/dist/graph/zod/schema.js +77 -103
- package/dist/graph/zod/schema.js.map +1 -1
- package/dist/graph/zod/zod-registry.cjs +41 -47
- package/dist/graph/zod/zod-registry.cjs.map +1 -0
- package/dist/graph/zod/zod-registry.d.cts +51 -0
- package/dist/graph/zod/zod-registry.d.cts.map +1 -0
- package/dist/graph/zod/zod-registry.d.ts +34 -26
- package/dist/graph/zod/zod-registry.d.ts.map +1 -0
- package/dist/graph/zod/zod-registry.js +37 -41
- package/dist/graph/zod/zod-registry.js.map +1 -1
- package/dist/hash.cjs +205 -267
- package/dist/hash.cjs.map +1 -0
- package/dist/hash.js +205 -265
- package/dist/hash.js.map +1 -1
- package/dist/index.cjs +111 -33
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +26 -0
- package/dist/index.d.ts +26 -5
- package/dist/index.js +19 -7
- package/dist/index.js.map +1 -1
- package/dist/interrupt.cjs +79 -85
- package/dist/interrupt.cjs.map +1 -0
- package/dist/interrupt.d.cts +49 -0
- package/dist/interrupt.d.cts.map +1 -0
- package/dist/interrupt.d.ts +6 -1
- package/dist/interrupt.d.ts.map +1 -0
- package/dist/interrupt.js +76 -80
- package/dist/interrupt.js.map +1 -1
- package/dist/prebuilt/agentName.cjs +139 -172
- package/dist/prebuilt/agentName.cjs.map +1 -0
- package/dist/prebuilt/agentName.d.cts +42 -0
- package/dist/prebuilt/agentName.d.cts.map +1 -0
- package/dist/prebuilt/agentName.d.ts +13 -21
- package/dist/prebuilt/agentName.d.ts.map +1 -0
- package/dist/prebuilt/agentName.js +139 -168
- package/dist/prebuilt/agentName.js.map +1 -1
- package/dist/prebuilt/agent_executor.cjs +42 -80
- package/dist/prebuilt/agent_executor.cjs.map +1 -0
- package/dist/prebuilt/agent_executor.d.cts +57 -0
- package/dist/prebuilt/agent_executor.d.cts.map +1 -0
- package/dist/prebuilt/agent_executor.d.ts +47 -38
- package/dist/prebuilt/agent_executor.d.ts.map +1 -0
- package/dist/prebuilt/agent_executor.js +40 -75
- package/dist/prebuilt/agent_executor.js.map +1 -1
- package/dist/prebuilt/chat_agent_executor.cjs +66 -128
- package/dist/prebuilt/chat_agent_executor.cjs.map +1 -0
- package/dist/prebuilt/chat_agent_executor.d.cts +23 -0
- package/dist/prebuilt/chat_agent_executor.d.cts.map +1 -0
- package/dist/prebuilt/chat_agent_executor.d.ts +18 -10
- package/dist/prebuilt/chat_agent_executor.d.ts.map +1 -0
- package/dist/prebuilt/chat_agent_executor.js +63 -123
- package/dist/prebuilt/chat_agent_executor.js.map +1 -1
- package/dist/prebuilt/index.cjs +15 -18
- package/dist/prebuilt/index.d.cts +8 -0
- package/dist/prebuilt/index.d.ts +8 -8
- package/dist/prebuilt/index.js +8 -7
- package/dist/prebuilt/interrupt.d.cts +73 -0
- package/dist/prebuilt/interrupt.d.cts.map +1 -0
- package/dist/prebuilt/interrupt.d.ts +32 -15
- package/dist/prebuilt/interrupt.d.ts.map +1 -0
- package/dist/prebuilt/react_agent_executor.cjs +317 -473
- package/dist/prebuilt/react_agent_executor.cjs.map +1 -0
- package/dist/prebuilt/react_agent_executor.d.cts +229 -0
- package/dist/prebuilt/react_agent_executor.d.cts.map +1 -0
- package/dist/prebuilt/react_agent_executor.d.ts +171 -143
- package/dist/prebuilt/react_agent_executor.d.ts.map +1 -0
- package/dist/prebuilt/react_agent_executor.js +315 -465
- package/dist/prebuilt/react_agent_executor.js.map +1 -1
- package/dist/prebuilt/tool_executor.cjs +45 -67
- package/dist/prebuilt/tool_executor.cjs.map +1 -0
- package/dist/prebuilt/tool_executor.d.cts +42 -0
- package/dist/prebuilt/tool_executor.d.cts.map +1 -0
- package/dist/prebuilt/tool_executor.d.ts +30 -24
- package/dist/prebuilt/tool_executor.d.ts.map +1 -0
- package/dist/prebuilt/tool_executor.js +44 -63
- package/dist/prebuilt/tool_executor.js.map +1 -1
- package/dist/prebuilt/tool_node.cjs +213 -275
- package/dist/prebuilt/tool_node.cjs.map +1 -0
- package/dist/prebuilt/tool_node.d.cts +151 -0
- package/dist/prebuilt/tool_node.d.cts.map +1 -0
- package/dist/prebuilt/tool_node.d.ts +30 -17
- package/dist/prebuilt/tool_node.d.ts.map +1 -0
- package/dist/prebuilt/tool_node.js +209 -268
- package/dist/prebuilt/tool_node.js.map +1 -1
- package/dist/pregel/algo.cjs +551 -692
- package/dist/pregel/algo.cjs.map +1 -0
- package/dist/pregel/algo.d.cts +13 -0
- package/dist/pregel/algo.d.cts.map +1 -0
- package/dist/pregel/algo.d.ts +8 -38
- package/dist/pregel/algo.d.ts.map +1 -0
- package/dist/pregel/algo.js +546 -683
- package/dist/pregel/algo.js.map +1 -1
- package/dist/pregel/call.cjs +46 -42
- package/dist/pregel/call.cjs.map +1 -0
- package/dist/pregel/call.js +43 -37
- package/dist/pregel/call.js.map +1 -1
- package/dist/pregel/debug.cjs +153 -223
- package/dist/pregel/debug.cjs.map +1 -0
- package/dist/pregel/debug.js +152 -215
- package/dist/pregel/debug.js.map +1 -1
- package/dist/pregel/index.cjs +1138 -1604
- package/dist/pregel/index.cjs.map +1 -0
- package/dist/pregel/index.d.cts +536 -0
- package/dist/pregel/index.d.cts.map +1 -0
- package/dist/pregel/index.d.ts +460 -422
- package/dist/pregel/index.d.ts.map +1 -0
- package/dist/pregel/index.js +1129 -1592
- package/dist/pregel/index.js.map +1 -1
- package/dist/pregel/io.cjs +127 -234
- package/dist/pregel/io.cjs.map +1 -0
- package/dist/pregel/io.js +122 -225
- package/dist/pregel/io.js.map +1 -1
- package/dist/pregel/loop.cjs +542 -954
- package/dist/pregel/loop.cjs.map +1 -0
- package/dist/pregel/loop.js +539 -948
- package/dist/pregel/loop.js.map +1 -1
- package/dist/pregel/messages.cjs +104 -196
- package/dist/pregel/messages.cjs.map +1 -0
- package/dist/pregel/messages.js +102 -191
- package/dist/pregel/messages.js.map +1 -1
- package/dist/pregel/read.cjs +150 -280
- package/dist/pregel/read.cjs.map +1 -0
- package/dist/pregel/read.d.cts +51 -0
- package/dist/pregel/read.d.cts.map +1 -0
- package/dist/pregel/read.d.ts +48 -46
- package/dist/pregel/read.d.ts.map +1 -0
- package/dist/pregel/read.js +147 -274
- package/dist/pregel/read.js.map +1 -1
- package/dist/pregel/remote.cjs +339 -458
- package/dist/pregel/remote.cjs.map +1 -0
- package/dist/pregel/remote.d.cts +121 -0
- package/dist/pregel/remote.d.cts.map +1 -0
- package/dist/pregel/remote.d.ts +79 -69
- package/dist/pregel/remote.d.ts.map +1 -0
- package/dist/pregel/remote.js +337 -453
- package/dist/pregel/remote.js.map +1 -1
- package/dist/pregel/retry.cjs +87 -138
- package/dist/pregel/retry.cjs.map +1 -0
- package/dist/pregel/retry.js +83 -130
- package/dist/pregel/retry.js.map +1 -1
- package/dist/pregel/runnable_types.d.cts +49 -0
- package/dist/pregel/runnable_types.d.cts.map +1 -0
- package/dist/pregel/runnable_types.d.ts +47 -17
- package/dist/pregel/runnable_types.d.ts.map +1 -0
- package/dist/pregel/runner.cjs +222 -315
- package/dist/pregel/runner.cjs.map +1 -0
- package/dist/pregel/runner.js +219 -308
- package/dist/pregel/runner.js.map +1 -1
- package/dist/pregel/stream.cjs +89 -130
- package/dist/pregel/stream.cjs.map +1 -0
- package/dist/pregel/stream.js +87 -125
- package/dist/pregel/stream.js.map +1 -1
- package/dist/pregel/types.cjs +25 -62
- package/dist/pregel/types.cjs.map +1 -0
- package/dist/pregel/types.d.cts +440 -0
- package/dist/pregel/types.d.cts.map +1 -0
- package/dist/pregel/types.d.ts +381 -432
- package/dist/pregel/types.d.ts.map +1 -0
- package/dist/pregel/types.js +23 -57
- package/dist/pregel/types.js.map +1 -1
- package/dist/pregel/utils/config.cjs +101 -147
- package/dist/pregel/utils/config.cjs.map +1 -0
- package/dist/pregel/utils/config.d.cts +36 -0
- package/dist/pregel/utils/config.d.cts.map +1 -0
- package/dist/pregel/utils/config.d.ts +12 -9
- package/dist/pregel/utils/config.d.ts.map +1 -0
- package/dist/pregel/utils/config.js +99 -143
- package/dist/pregel/utils/config.js.map +1 -1
- package/dist/pregel/utils/index.cjs +87 -125
- package/dist/pregel/utils/index.cjs.map +1 -0
- package/dist/pregel/utils/index.d.cts +51 -0
- package/dist/pregel/utils/index.d.cts.map +1 -0
- package/dist/pregel/utils/index.d.ts +45 -61
- package/dist/pregel/utils/index.d.ts.map +1 -0
- package/dist/pregel/utils/index.js +86 -120
- package/dist/pregel/utils/index.js.map +1 -1
- package/dist/pregel/utils/subgraph.cjs +15 -26
- package/dist/pregel/utils/subgraph.cjs.map +1 -0
- package/dist/pregel/utils/subgraph.js +12 -21
- package/dist/pregel/utils/subgraph.js.map +1 -1
- package/dist/pregel/validate.cjs +42 -92
- package/dist/pregel/validate.cjs.map +1 -0
- package/dist/pregel/validate.js +39 -84
- package/dist/pregel/validate.js.map +1 -1
- package/dist/pregel/write.cjs +87 -137
- package/dist/pregel/write.cjs.map +1 -0
- package/dist/pregel/write.d.cts +35 -0
- package/dist/pregel/write.d.cts.map +1 -0
- package/dist/pregel/write.d.ts +27 -23
- package/dist/pregel/write.d.ts.map +1 -0
- package/dist/pregel/write.js +83 -131
- package/dist/pregel/write.js.map +1 -1
- package/dist/remote.cjs +3 -6
- package/dist/remote.d.cts +2 -0
- package/dist/remote.d.ts +2 -1
- package/dist/remote.js +3 -2
- package/dist/setup/async_local_storage.cjs +10 -7
- package/dist/setup/async_local_storage.cjs.map +1 -0
- package/dist/setup/async_local_storage.js +7 -2
- package/dist/setup/async_local_storage.js.map +1 -1
- package/dist/ui/index.cjs +4 -0
- package/dist/ui/index.d.cts +5 -0
- package/dist/ui/index.d.ts +5 -0
- package/dist/ui/index.js +3 -0
- package/dist/ui/stream.cjs +145 -0
- package/dist/ui/stream.cjs.map +1 -0
- package/dist/ui/stream.d.cts +25 -0
- package/dist/ui/stream.d.cts.map +1 -0
- package/dist/ui/stream.d.ts +25 -0
- package/dist/ui/stream.d.ts.map +1 -0
- package/dist/ui/stream.js +143 -0
- package/dist/ui/stream.js.map +1 -0
- package/dist/ui/types.infer.d.cts +53 -0
- package/dist/ui/types.infer.d.cts.map +1 -0
- package/dist/ui/types.infer.d.ts +53 -0
- package/dist/ui/types.infer.d.ts.map +1 -0
- package/dist/ui/types.message.d.cts +95 -0
- package/dist/ui/types.message.d.cts.map +1 -0
- package/dist/ui/types.message.d.ts +95 -0
- package/dist/ui/types.message.d.ts.map +1 -0
- package/dist/ui/types.schema.d.cts +228 -0
- package/dist/ui/types.schema.d.cts.map +1 -0
- package/dist/ui/types.schema.d.ts +228 -0
- package/dist/ui/types.schema.d.ts.map +1 -0
- package/dist/utils.cjs +77 -147
- package/dist/utils.cjs.map +1 -0
- package/dist/utils.d.cts +32 -0
- package/dist/utils.d.cts.map +1 -0
- package/dist/utils.d.ts +29 -25
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +73 -140
- package/dist/utils.js.map +1 -1
- package/dist/web.cjs +96 -55
- package/dist/web.d.cts +23 -0
- package/dist/web.d.ts +23 -14
- package/dist/web.js +15 -8
- package/dist/writer.cjs +15 -0
- package/dist/writer.cjs.map +1 -0
- package/dist/writer.d.cts +5 -0
- package/dist/writer.d.cts.map +1 -0
- package/dist/writer.d.ts +5 -0
- package/dist/writer.d.ts.map +1 -0
- package/dist/writer.js +14 -0
- package/dist/writer.js.map +1 -0
- package/package.json +90 -83
- package/dist/channels/index.js.map +0 -1
- package/dist/func/types.cjs +0 -15
- package/dist/func/types.js +0 -12
- package/dist/func/types.js.map +0 -1
- package/dist/graph/index.d.ts +0 -4
- package/dist/graph/index.js.map +0 -1
- package/dist/graph/message.test.cjs +0 -196
- package/dist/graph/message.test.d.ts +0 -1
- package/dist/graph/message.test.js +0 -194
- package/dist/graph/message.test.js.map +0 -1
- package/dist/graph/zod/index.js.map +0 -1
- package/dist/graph/zod/plugin.d.ts +0 -28
- package/dist/hash.d.ts +0 -2
- package/dist/prebuilt/index.js.map +0 -1
- package/dist/prebuilt/interrupt.cjs +0 -3
- package/dist/prebuilt/interrupt.js +0 -2
- package/dist/prebuilt/interrupt.js.map +0 -1
- package/dist/pregel/call.d.ts +0 -16
- package/dist/pregel/debug.d.ts +0 -41
- package/dist/pregel/debug.test.cjs +0 -258
- package/dist/pregel/debug.test.d.ts +0 -1
- package/dist/pregel/debug.test.js +0 -256
- package/dist/pregel/debug.test.js.map +0 -1
- package/dist/pregel/io.d.ts +0 -30
- package/dist/pregel/io.mapCommand.test.cjs +0 -150
- package/dist/pregel/io.mapCommand.test.d.ts +0 -1
- package/dist/pregel/io.mapCommand.test.js +0 -148
- package/dist/pregel/io.mapCommand.test.js.map +0 -1
- package/dist/pregel/loop.d.ts +0 -147
- package/dist/pregel/messages.d.ts +0 -30
- package/dist/pregel/messages.test.cjs +0 -369
- package/dist/pregel/messages.test.d.ts +0 -1
- package/dist/pregel/messages.test.js +0 -367
- package/dist/pregel/messages.test.js.map +0 -1
- package/dist/pregel/read.test.cjs +0 -194
- package/dist/pregel/read.test.d.ts +0 -1
- package/dist/pregel/read.test.js +0 -192
- package/dist/pregel/read.test.js.map +0 -1
- package/dist/pregel/retry.d.ts +0 -17
- package/dist/pregel/runnable_types.cjs +0 -3
- package/dist/pregel/runnable_types.js +0 -2
- package/dist/pregel/runnable_types.js.map +0 -1
- package/dist/pregel/runner.d.ts +0 -79
- package/dist/pregel/runner.test.cjs +0 -66
- package/dist/pregel/runner.test.d.ts +0 -1
- package/dist/pregel/runner.test.js +0 -64
- package/dist/pregel/runner.test.js.map +0 -1
- package/dist/pregel/stream.d.ts +0 -40
- package/dist/pregel/utils/config.test.cjs +0 -214
- package/dist/pregel/utils/config.test.d.ts +0 -1
- package/dist/pregel/utils/config.test.js +0 -212
- package/dist/pregel/utils/config.test.js.map +0 -1
- package/dist/pregel/utils/subgraph.d.ts +0 -4
- package/dist/pregel/utils/subgraph.test.cjs +0 -83
- package/dist/pregel/utils/subgraph.test.d.ts +0 -1
- package/dist/pregel/utils/subgraph.test.js +0 -81
- package/dist/pregel/utils/subgraph.test.js.map +0 -1
- package/dist/pregel/validate.d.ts +0 -16
- package/dist/pregel/validate.test.cjs +0 -220
- package/dist/pregel/validate.test.d.ts +0 -1
- package/dist/pregel/validate.test.js +0 -218
- package/dist/pregel/validate.test.js.map +0 -1
- package/dist/pregel/write.test.cjs +0 -181
- package/dist/pregel/write.test.d.ts +0 -1
- package/dist/pregel/write.test.js +0 -179
- package/dist/pregel/write.test.js.map +0 -1
- package/dist/remote.js.map +0 -1
- package/dist/setup/async_local_storage.d.ts +0 -1
- package/dist/web.js.map +0 -1
- package/index.cjs +0 -1
- package/index.d.cts +0 -1
- package/index.d.ts +0 -1
- package/index.js +0 -1
- package/prebuilt.cjs +0 -1
- package/prebuilt.d.cts +0 -1
- package/prebuilt.d.ts +0 -1
- package/prebuilt.js +0 -1
- package/pregel.cjs +0 -1
- package/pregel.d.cts +0 -1
- package/pregel.d.ts +0 -1
- package/pregel.js +0 -1
- package/remote.cjs +0 -1
- package/remote.d.cts +0 -1
- package/remote.d.ts +0 -1
- package/remote.js +0 -1
- package/web.cjs +0 -1
- package/web.d.cts +0 -1
- package/web.d.ts +0 -1
- package/web.js +0 -1
- package/zod/schema.cjs +0 -1
- package/zod/schema.d.cts +0 -1
- package/zod/schema.d.ts +0 -1
- package/zod/schema.js +0 -1
- package/zod.cjs +0 -1
- package/zod.d.cts +0 -1
- package/zod.d.ts +0 -1
- package/zod.js +0 -1
package/dist/pregel/types.d.ts
CHANGED
|
@@ -1,106 +1,83 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { All, PendingWrite, CheckpointMetadata, BaseCheckpointSaver, BaseStore, CheckpointListOptions, BaseCache } from "@langchain/langgraph-checkpoint";
|
|
3
|
-
import { Graph as DrawableGraph } from "@langchain/core/runnables/graph";
|
|
4
|
-
import { IterableReadableStream } from "@langchain/core/utils/stream";
|
|
5
|
-
import type { BaseMessage } from "@langchain/core/messages";
|
|
6
|
-
import type { BaseChannel } from "../channels/base.js";
|
|
7
|
-
import type { PregelNode } from "./read.js";
|
|
8
|
-
import type { Interrupt } from "../constants.js";
|
|
9
|
-
import { CachePolicy, RetryPolicy } from "./utils/index.js";
|
|
1
|
+
import { BaseChannel } from "../channels/base.js";
|
|
10
2
|
import { LangGraphRunnableConfig } from "./runnable_types.js";
|
|
3
|
+
import { CachePolicy, RetryPolicy } from "./utils/index.js";
|
|
4
|
+
import { PregelNode } from "./read.js";
|
|
5
|
+
import { Interrupt } from "../constants.js";
|
|
6
|
+
import { All, BaseCache, BaseCheckpointSaver, BaseStore, CheckpointListOptions, CheckpointMetadata, PendingWrite } from "@langchain/langgraph-checkpoint";
|
|
7
|
+
import { Runnable, RunnableConfig } from "@langchain/core/runnables";
|
|
8
|
+
import { Graph } from "@langchain/core/runnables/graph";
|
|
9
|
+
import { IterableReadableStream } from "@langchain/core/utils/stream";
|
|
10
|
+
import { BaseMessage } from "@langchain/core/messages";
|
|
11
|
+
|
|
12
|
+
//#region src/pregel/types.d.ts
|
|
13
|
+
|
|
11
14
|
/**
|
|
12
15
|
* Selects the type of output you'll receive when streaming from the graph. See [Streaming](/langgraphjs/how-tos/#streaming) for more details.
|
|
13
16
|
*/
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
type StreamMode = "values" | "updates" | "debug" | "messages" | "checkpoints" | "tasks" | "custom";
|
|
18
|
+
type Durability = "exit" | "async" | "sync";
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
20
|
+
type PregelInputType = any;
|
|
21
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
22
|
+
type PregelOutputType = any;
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
18
24
|
type StreamMessageOutput = [BaseMessage, Record<string, any>];
|
|
19
|
-
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
20
26
|
type StreamDebugOutput = Record<string, any>;
|
|
21
27
|
type StreamCheckpointsOutput<StreamValues> = {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
values: StreamValues;
|
|
29
|
+
next: string[];
|
|
30
|
+
config: RunnableConfig;
|
|
31
|
+
metadata?: CheckpointMetadata;
|
|
32
|
+
parentConfig?: RunnableConfig | undefined;
|
|
33
|
+
tasks: PregelTaskDescription[];
|
|
28
34
|
};
|
|
29
35
|
interface StreamTasksOutputBase {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
36
|
+
id: string;
|
|
37
|
+
name: string;
|
|
38
|
+
interrupts: Interrupt[];
|
|
33
39
|
}
|
|
34
40
|
interface StreamTasksCreateOutput<StreamValues> extends StreamTasksOutputBase {
|
|
35
|
-
|
|
36
|
-
|
|
41
|
+
input: StreamValues;
|
|
42
|
+
triggers: string[];
|
|
37
43
|
}
|
|
38
44
|
interface StreamTasksResultOutput<Keys, StreamUpdates> extends StreamTasksOutputBase {
|
|
39
|
-
|
|
45
|
+
result: [Keys, StreamUpdates][];
|
|
40
46
|
}
|
|
41
47
|
type StreamTasksOutput<StreamUpdates, StreamValues, Nodes = string> = StreamTasksCreateOutput<StreamValues> | StreamTasksResultOutput<Nodes, StreamUpdates>;
|
|
42
48
|
type DefaultStreamMode = "updates";
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
];
|
|
52
|
-
messages: [string[], "messages", StreamMessageOutput];
|
|
53
|
-
custom: [string[], "custom", StreamCustomOutput];
|
|
54
|
-
checkpoints: [
|
|
55
|
-
string[],
|
|
56
|
-
"checkpoints",
|
|
57
|
-
StreamCheckpointsOutput<StreamValues>
|
|
58
|
-
];
|
|
59
|
-
tasks: [
|
|
60
|
-
string[],
|
|
61
|
-
"tasks",
|
|
62
|
-
StreamTasksOutput<StreamUpdates, StreamValues>
|
|
63
|
-
];
|
|
64
|
-
debug: [string[], "debug", StreamDebugOutput];
|
|
49
|
+
type StreamOutputMap<TStreamMode extends StreamMode | StreamMode[] | undefined, TStreamSubgraphs extends boolean, StreamUpdates, StreamValues, Nodes, NodeReturnType, StreamCustom> = (undefined extends TStreamMode ? [] : StreamMode | StreamMode[] extends TStreamMode ? TStreamMode extends StreamMode[] ? TStreamMode[number] : TStreamMode : TStreamMode extends StreamMode[] ? TStreamMode[number] : []) extends infer Multiple extends StreamMode ? [TStreamSubgraphs] extends [true] ? {
|
|
50
|
+
values: [string[], "values", StreamValues];
|
|
51
|
+
updates: [string[], "updates", NodeReturnType extends Record<string, unknown> ? { [K in keyof NodeReturnType]?: NodeReturnType[K] } : Record<Nodes extends string ? Nodes : string, StreamUpdates>];
|
|
52
|
+
messages: [string[], "messages", StreamMessageOutput];
|
|
53
|
+
custom: [string[], "custom", StreamCustom];
|
|
54
|
+
checkpoints: [string[], "checkpoints", StreamCheckpointsOutput<StreamValues>];
|
|
55
|
+
tasks: [string[], "tasks", StreamTasksOutput<StreamUpdates, StreamValues>];
|
|
56
|
+
debug: [string[], "debug", StreamDebugOutput];
|
|
65
57
|
}[Multiple] : {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
messages: ["messages", StreamMessageOutput];
|
|
74
|
-
custom: ["custom", StreamCustomOutput];
|
|
75
|
-
checkpoints: ["checkpoints", StreamCheckpointsOutput<StreamValues>];
|
|
76
|
-
tasks: ["tasks", StreamTasksOutput<StreamUpdates, StreamValues, Nodes>];
|
|
77
|
-
debug: ["debug", StreamDebugOutput];
|
|
58
|
+
values: ["values", StreamValues];
|
|
59
|
+
updates: ["updates", NodeReturnType extends Record<string, unknown> ? { [K in keyof NodeReturnType]?: NodeReturnType[K] } : Record<Nodes extends string ? Nodes : string, StreamUpdates>];
|
|
60
|
+
messages: ["messages", StreamMessageOutput];
|
|
61
|
+
custom: ["custom", StreamCustom];
|
|
62
|
+
checkpoints: ["checkpoints", StreamCheckpointsOutput<StreamValues>];
|
|
63
|
+
tasks: ["tasks", StreamTasksOutput<StreamUpdates, StreamValues, Nodes>];
|
|
64
|
+
debug: ["debug", StreamDebugOutput];
|
|
78
65
|
}[Multiple] : (undefined extends TStreamMode ? DefaultStreamMode : TStreamMode) extends infer Single extends StreamMode ? [TStreamSubgraphs] extends [true] ? {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
messages: [string[], StreamMessageOutput];
|
|
87
|
-
custom: [string[], StreamCustomOutput];
|
|
88
|
-
checkpoints: [string[], StreamCheckpointsOutput<StreamValues>];
|
|
89
|
-
tasks: [
|
|
90
|
-
string[],
|
|
91
|
-
StreamTasksOutput<StreamUpdates, StreamValues, Nodes>
|
|
92
|
-
];
|
|
93
|
-
debug: [string[], StreamDebugOutput];
|
|
66
|
+
values: [string[], StreamValues];
|
|
67
|
+
updates: [string[], NodeReturnType extends Record<string, unknown> ? { [K in keyof NodeReturnType]?: NodeReturnType[K] } : Record<Nodes extends string ? Nodes : string, StreamUpdates>];
|
|
68
|
+
messages: [string[], StreamMessageOutput];
|
|
69
|
+
custom: [string[], StreamCustom];
|
|
70
|
+
checkpoints: [string[], StreamCheckpointsOutput<StreamValues>];
|
|
71
|
+
tasks: [string[], StreamTasksOutput<StreamUpdates, StreamValues, Nodes>];
|
|
72
|
+
debug: [string[], StreamDebugOutput];
|
|
94
73
|
}[Single] : {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
tasks: StreamTasksOutput<StreamUpdates, StreamValues, Nodes>;
|
|
103
|
-
debug: StreamDebugOutput;
|
|
74
|
+
values: StreamValues;
|
|
75
|
+
updates: NodeReturnType extends Record<string, unknown> ? { [K in keyof NodeReturnType]?: NodeReturnType[K] } : Record<Nodes extends string ? Nodes : string, StreamUpdates>;
|
|
76
|
+
messages: StreamMessageOutput;
|
|
77
|
+
custom: StreamCustom;
|
|
78
|
+
checkpoints: StreamCheckpointsOutput<StreamValues>;
|
|
79
|
+
tasks: StreamTasksOutput<StreamUpdates, StreamValues, Nodes>;
|
|
80
|
+
debug: StreamDebugOutput;
|
|
104
81
|
}[Single] : never;
|
|
105
82
|
/**
|
|
106
83
|
* Configuration options for executing a Pregel graph.
|
|
@@ -110,382 +87,354 @@ export type StreamOutputMap<TStreamMode extends StreamMode | StreamMode[] | unde
|
|
|
110
87
|
* @typeParam Channels - Mapping of channel names to their {@link BaseChannel} implementations
|
|
111
88
|
* @typeParam ContextType - Type of context that can be passed to the graph
|
|
112
89
|
*/
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
90
|
+
interface PregelOptions<Nodes extends StrRecord<string, PregelNode>, Channels extends StrRecord<string, BaseChannel>,
|
|
91
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
92
|
+
ContextType extends Record<string, any> = Record<string, any>, TStreamMode extends StreamMode | StreamMode[] | undefined = StreamMode | StreamMode[] | undefined, TSubgraphs extends boolean = boolean> extends RunnableConfig<ContextType> {
|
|
93
|
+
/**
|
|
94
|
+
* Controls what information is streamed during graph execution.
|
|
95
|
+
* Multiple modes can be enabled simultaneously.
|
|
96
|
+
*
|
|
97
|
+
* Supported modes:
|
|
98
|
+
* - "values": Streams complete state after each step
|
|
99
|
+
* - "updates": Streams only state changes after each step
|
|
100
|
+
* - "messages": Streams messages from within nodes
|
|
101
|
+
* - "custom": Streams custom events from within nodes
|
|
102
|
+
* - "debug": Streams detailed execution events for tracing & debugging
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* ```typescript
|
|
106
|
+
* // Stream only values
|
|
107
|
+
* streamMode: "values"
|
|
108
|
+
*
|
|
109
|
+
* // Stream both values and debug info
|
|
110
|
+
* streamMode: ["values", "debug"]
|
|
111
|
+
* ```
|
|
112
|
+
*
|
|
113
|
+
* @default ["values"]
|
|
114
|
+
*/
|
|
115
|
+
streamMode?: TStreamMode;
|
|
116
|
+
/**
|
|
117
|
+
* Specifies which channel keys to retrieve from the checkpoint when resuming execution.
|
|
118
|
+
* This is an advanced option that you generally don't need to set manually.
|
|
119
|
+
* The graph will automatically determine the appropriate input keys based on its configuration.
|
|
120
|
+
*/
|
|
121
|
+
inputKeys?: keyof Channels | Array<keyof Channels>;
|
|
122
|
+
/**
|
|
123
|
+
* Specifies which channel keys to include in the output stream and final result.
|
|
124
|
+
* Use this to filter which parts of the graph state you want to observe.
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* ```typescript
|
|
128
|
+
* // Stream only the 'result' channel
|
|
129
|
+
* outputKeys: "result"
|
|
130
|
+
*
|
|
131
|
+
* // Stream multiple channels
|
|
132
|
+
* outputKeys: ["result", "intermediateState"]
|
|
133
|
+
* ```
|
|
134
|
+
*/
|
|
135
|
+
outputKeys?: keyof Channels | Array<keyof Channels>;
|
|
136
|
+
/**
|
|
137
|
+
* List of nodes where execution should be interrupted BEFORE the node runs.
|
|
138
|
+
* Can be used for debugging and advanced state manipulation use cases. For
|
|
139
|
+
* human-in-the-loop workflows, developers should prefer the
|
|
140
|
+
* @link {interrupt} function instead.
|
|
141
|
+
*
|
|
142
|
+
* When interrupted, a resume @link {Command} must be provided to continue
|
|
143
|
+
* execution.
|
|
144
|
+
*
|
|
145
|
+
* @example
|
|
146
|
+
* ```typescript
|
|
147
|
+
* // Interrupt before specific nodes
|
|
148
|
+
* interruptBefore: ["humanReview", "qualityCheck"]
|
|
149
|
+
*
|
|
150
|
+
* // Interrupt before all nodes
|
|
151
|
+
* interruptBefore: "all"
|
|
152
|
+
* ```
|
|
153
|
+
*/
|
|
154
|
+
interruptBefore?: All | Array<keyof Nodes>;
|
|
155
|
+
/**
|
|
156
|
+
* List of nodes where execution should be interrupted AFTER the node runs.
|
|
157
|
+
* Similar to interruptBefore, but interrupts after node completion.
|
|
158
|
+
* Useful when the node's output needs to be reviewed before proceeding.
|
|
159
|
+
*
|
|
160
|
+
* @example
|
|
161
|
+
* ```typescript
|
|
162
|
+
* // Interrupt after specific nodes
|
|
163
|
+
* interruptAfter: ["generateContent", "analyze"]
|
|
164
|
+
*
|
|
165
|
+
* // Interrupt after all nodes
|
|
166
|
+
* interruptAfter: "all"
|
|
167
|
+
* ```
|
|
168
|
+
*/
|
|
169
|
+
interruptAfter?: All | Array<keyof Nodes>;
|
|
170
|
+
/**
|
|
171
|
+
* Enables detailed debug logging during graph execution.
|
|
172
|
+
* When enabled, prints information about:
|
|
173
|
+
* - Task execution
|
|
174
|
+
* - Channel updates
|
|
175
|
+
* - Checkpoint writes
|
|
176
|
+
*
|
|
177
|
+
* @default false
|
|
178
|
+
*/
|
|
179
|
+
debug?: boolean;
|
|
180
|
+
/**
|
|
181
|
+
* Whether to include subgraph execution details in the stream.
|
|
182
|
+
* When true, state updates from nested graphs will also be streamed.
|
|
183
|
+
*
|
|
184
|
+
* @default false
|
|
185
|
+
*/
|
|
186
|
+
subgraphs?: TSubgraphs;
|
|
187
|
+
/**
|
|
188
|
+
* Whether to checkpoint intermediate steps, defaults to `true`.
|
|
189
|
+
* If `false`, only the final checkpoint is saved.
|
|
190
|
+
* @deprecated Use `durability` instead.
|
|
191
|
+
*/
|
|
192
|
+
checkpointDuring?: boolean;
|
|
193
|
+
/**
|
|
194
|
+
* Whether to checkpoint during the run (or only at the end/interruption).
|
|
195
|
+
* - `"async"`: Save checkpoint asynchronously while the next step executes (default).
|
|
196
|
+
* - `"sync"`: Save checkpoint synchronously before the next step starts.
|
|
197
|
+
* - `"exit"`: Save checkpoint only when the graph exits.
|
|
198
|
+
* @default "async"
|
|
199
|
+
*/
|
|
200
|
+
durability?: Durability;
|
|
201
|
+
/**
|
|
202
|
+
* A shared value store that allows you to store and retrieve state across
|
|
203
|
+
* threads. Useful for implementing long-term memory patterns.
|
|
204
|
+
*/
|
|
205
|
+
store?: BaseStore;
|
|
206
|
+
/**
|
|
207
|
+
* Optional cache for the graph, useful for caching tasks.
|
|
208
|
+
*/
|
|
209
|
+
cache?: BaseCache;
|
|
210
|
+
/**
|
|
211
|
+
* Static context for the graph run, like `userId`, `dbConnection` etc.
|
|
212
|
+
*/
|
|
213
|
+
context?: ContextType;
|
|
235
214
|
}
|
|
236
215
|
/**
|
|
237
216
|
* Construct a type with a set of properties K of type T
|
|
238
217
|
*/
|
|
239
|
-
type StrRecord<K extends string, T> = {
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
218
|
+
type StrRecord<K extends string, T> = { [P in K]: T };
|
|
219
|
+
interface PregelInterface<Nodes extends StrRecord<string, PregelNode>, Channels extends StrRecord<string, BaseChannel>,
|
|
220
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
221
|
+
ContextType extends Record<string, any> = StrRecord<string, any>> {
|
|
222
|
+
lg_is_pregel: boolean;
|
|
223
|
+
withConfig(config: RunnableConfig): PregelInterface<Nodes, Channels>;
|
|
224
|
+
getGraphAsync(config: RunnableConfig & {
|
|
225
|
+
xray?: boolean | number;
|
|
226
|
+
}): Promise<Graph>;
|
|
227
|
+
/** @deprecated Use getSubgraphsAsync instead. The async method will become the default in the next minor release. */
|
|
228
|
+
getSubgraphs(namespace?: string, recurse?: boolean
|
|
229
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
230
|
+
): Generator<[string, PregelInterface<any, any>]>;
|
|
231
|
+
getSubgraphsAsync(namespace?: string, recurse?: boolean
|
|
232
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
233
|
+
): AsyncGenerator<[string, PregelInterface<any, any>]>;
|
|
234
|
+
getState(config: RunnableConfig, options?: {
|
|
235
|
+
subgraphs?: boolean;
|
|
236
|
+
}): Promise<StateSnapshot>;
|
|
237
|
+
getStateHistory(config: RunnableConfig, options?: CheckpointListOptions): AsyncIterableIterator<StateSnapshot>;
|
|
238
|
+
updateState(inputConfig: LangGraphRunnableConfig, values: Record<string, unknown> | unknown, asNode?: keyof Nodes | string): Promise<RunnableConfig>;
|
|
239
|
+
stream(input: PregelInputType, options?: Partial<PregelOptions<Nodes, Channels, ContextType>>): Promise<IterableReadableStream<PregelOutputType>>;
|
|
240
|
+
invoke(input: PregelInputType, options?: Partial<PregelOptions<Nodes, Channels, ContextType>>): Promise<PregelOutputType>;
|
|
258
241
|
}
|
|
259
242
|
/**
|
|
260
243
|
* Parameters for creating a Pregel graph.
|
|
261
244
|
* @internal
|
|
262
245
|
*/
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
246
|
+
type PregelParams<Nodes extends StrRecord<string, PregelNode>, Channels extends StrRecord<string, BaseChannel>> = {
|
|
247
|
+
/**
|
|
248
|
+
* The name of the graph. @see {@link Runnable.name}
|
|
249
|
+
*/
|
|
250
|
+
name?: string;
|
|
251
|
+
/**
|
|
252
|
+
* The nodes in the graph.
|
|
253
|
+
*/
|
|
254
|
+
nodes: Nodes;
|
|
255
|
+
/**
|
|
256
|
+
* The channels in the graph.
|
|
257
|
+
*/
|
|
258
|
+
channels: Channels;
|
|
259
|
+
/**
|
|
260
|
+
* Whether to validate the graph.
|
|
261
|
+
*
|
|
262
|
+
* @default true
|
|
263
|
+
*/
|
|
264
|
+
autoValidate?: boolean;
|
|
265
|
+
/**
|
|
266
|
+
* The stream mode for the graph run. See [Streaming](/langgraphjs/how-tos/#streaming) for more details.
|
|
267
|
+
*
|
|
268
|
+
* @default ["values"]
|
|
269
|
+
*/
|
|
270
|
+
streamMode?: StreamMode | StreamMode[];
|
|
271
|
+
/**
|
|
272
|
+
* The input channels for the graph run.
|
|
273
|
+
*/
|
|
274
|
+
inputChannels: keyof Channels | Array<keyof Channels>;
|
|
275
|
+
/**
|
|
276
|
+
* The output channels for the graph run.
|
|
277
|
+
*/
|
|
278
|
+
outputChannels: keyof Channels | Array<keyof Channels>;
|
|
279
|
+
/**
|
|
280
|
+
* After processing one of the nodes named in this list, the graph will be interrupted and a resume {@link Command} must be provided to proceed with the execution of this thread.
|
|
281
|
+
* @default []
|
|
282
|
+
*/
|
|
283
|
+
interruptAfter?: Array<keyof Nodes> | All;
|
|
284
|
+
/**
|
|
285
|
+
* Before processing one of the nodes named in this list, the graph will be interrupted and a resume {@link Command} must be provided to proceed with the execution of this thread.
|
|
286
|
+
* @default []
|
|
287
|
+
*/
|
|
288
|
+
interruptBefore?: Array<keyof Nodes> | All;
|
|
289
|
+
/**
|
|
290
|
+
* The channels to stream from the graph run.
|
|
291
|
+
* @default []
|
|
292
|
+
*/
|
|
293
|
+
streamChannels?: keyof Channels | Array<keyof Channels>;
|
|
294
|
+
/**
|
|
295
|
+
* @default undefined
|
|
296
|
+
*/
|
|
297
|
+
stepTimeout?: number;
|
|
298
|
+
/**
|
|
299
|
+
* @default false
|
|
300
|
+
*/
|
|
301
|
+
debug?: boolean;
|
|
302
|
+
/**
|
|
303
|
+
* The {@link BaseCheckpointSaver | checkpointer} to use for the graph run.
|
|
304
|
+
*/
|
|
305
|
+
checkpointer?: BaseCheckpointSaver | boolean;
|
|
306
|
+
/**
|
|
307
|
+
* The default retry policy for this graph. For defaults, see {@link RetryPolicy}.
|
|
308
|
+
*/
|
|
309
|
+
retryPolicy?: RetryPolicy;
|
|
310
|
+
/**
|
|
311
|
+
* The configuration for the graph run.
|
|
312
|
+
*/
|
|
313
|
+
config?: LangGraphRunnableConfig;
|
|
314
|
+
/**
|
|
315
|
+
* External key-value store.
|
|
316
|
+
*/
|
|
317
|
+
store?: BaseStore;
|
|
318
|
+
/**
|
|
319
|
+
* Storage used for node caching.
|
|
320
|
+
*/
|
|
321
|
+
cache?: BaseCache;
|
|
322
|
+
/**
|
|
323
|
+
* The trigger to node mapping for the graph run.
|
|
324
|
+
* @internal
|
|
325
|
+
*/
|
|
326
|
+
triggerToNodes?: Record<string, string[]>;
|
|
339
327
|
};
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
}
|
|
349
|
-
interface CacheKey {
|
|
350
|
-
ns: string[];
|
|
351
|
-
key: string;
|
|
352
|
-
ttl?: number;
|
|
328
|
+
interface PregelTaskDescription {
|
|
329
|
+
readonly id: string;
|
|
330
|
+
readonly name: string;
|
|
331
|
+
readonly error?: unknown;
|
|
332
|
+
readonly interrupts: Interrupt[];
|
|
333
|
+
readonly state?: LangGraphRunnableConfig | StateSnapshot;
|
|
334
|
+
readonly path?: TaskPath;
|
|
335
|
+
readonly result?: unknown;
|
|
353
336
|
}
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
/**
|
|
386
|
-
* Time when the snapshot was created
|
|
387
|
-
*/
|
|
388
|
-
readonly createdAt?: string;
|
|
389
|
-
/**
|
|
390
|
-
* Config used to fetch the parent snapshot, if any
|
|
391
|
-
* @default undefined
|
|
392
|
-
*/
|
|
393
|
-
readonly parentConfig?: RunnableConfig | undefined;
|
|
394
|
-
/**
|
|
395
|
-
* Tasks to execute in this step. If already attempted, may contain an error.
|
|
396
|
-
*/
|
|
397
|
-
readonly tasks: PregelTaskDescription[];
|
|
337
|
+
interface StateSnapshot {
|
|
338
|
+
/**
|
|
339
|
+
* Current values of channels
|
|
340
|
+
*/
|
|
341
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
342
|
+
readonly values: Record<string, any> | any;
|
|
343
|
+
/**
|
|
344
|
+
* Nodes to execute in the next step, if any
|
|
345
|
+
*/
|
|
346
|
+
readonly next: Array<string>;
|
|
347
|
+
/**
|
|
348
|
+
* Config used to fetch this snapshot
|
|
349
|
+
*/
|
|
350
|
+
readonly config: RunnableConfig;
|
|
351
|
+
/**
|
|
352
|
+
* Metadata about the checkpoint
|
|
353
|
+
*/
|
|
354
|
+
readonly metadata?: CheckpointMetadata;
|
|
355
|
+
/**
|
|
356
|
+
* Time when the snapshot was created
|
|
357
|
+
*/
|
|
358
|
+
readonly createdAt?: string;
|
|
359
|
+
/**
|
|
360
|
+
* Config used to fetch the parent snapshot, if any
|
|
361
|
+
* @default undefined
|
|
362
|
+
*/
|
|
363
|
+
readonly parentConfig?: RunnableConfig | undefined;
|
|
364
|
+
/**
|
|
365
|
+
* Tasks to execute in this step. If already attempted, may contain an error.
|
|
366
|
+
*/
|
|
367
|
+
readonly tasks: PregelTaskDescription[];
|
|
398
368
|
}
|
|
399
369
|
/**
|
|
400
370
|
* Options for subscribing to multiple channels.
|
|
401
371
|
*/
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
372
|
+
type MultipleChannelSubscriptionOptions = {
|
|
373
|
+
/**
|
|
374
|
+
* Optional tags to associate with the subscription.
|
|
375
|
+
*/
|
|
376
|
+
tags?: string[];
|
|
407
377
|
};
|
|
408
378
|
/**
|
|
409
379
|
* Options for subscribing to a single channel.
|
|
410
380
|
*/
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
381
|
+
type SingleChannelSubscriptionOptions = {
|
|
382
|
+
/**
|
|
383
|
+
* When specified, the channel mapping will be an object with this key pointing
|
|
384
|
+
* to the array of channels to subscribe to. Otherwise, the channel mapping
|
|
385
|
+
* will be an array of channels.
|
|
386
|
+
*/
|
|
387
|
+
key?: string;
|
|
388
|
+
/**
|
|
389
|
+
* Optional tags to associate with the subscription.
|
|
390
|
+
*/
|
|
391
|
+
tags?: string[];
|
|
422
392
|
};
|
|
423
393
|
/**
|
|
424
394
|
* Options for getting the state of the graph.
|
|
425
395
|
*/
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
396
|
+
type GetStateOptions = {
|
|
397
|
+
/**
|
|
398
|
+
* Whether to include subgraph states.
|
|
399
|
+
* @default false
|
|
400
|
+
*/
|
|
401
|
+
subgraphs?: boolean;
|
|
432
402
|
};
|
|
433
403
|
/**
|
|
434
404
|
* Used for storing/retrieving internal execution state.
|
|
435
405
|
*
|
|
436
406
|
* @internal
|
|
437
407
|
*/
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
nullResume: Resume;
|
|
447
|
-
consumeNullResume: () => Resume | undefined;
|
|
448
|
-
/** Counter for tracking subgraph invocations */
|
|
449
|
-
subgraphCounter: number;
|
|
450
|
-
/** The input to the currently executing task */
|
|
451
|
-
currentTaskInput: unknown;
|
|
452
|
-
};
|
|
453
|
-
/**
|
|
454
|
-
* @internal
|
|
455
|
-
*/
|
|
456
|
-
export type PregelAbortSignals = {
|
|
457
|
-
/** Aborts when the user calls `stream.cancel()` or aborts the {@link AbortSignal} that they passed in via the `signal` option */
|
|
458
|
-
externalAbortSignal?: AbortSignal;
|
|
459
|
-
/**
|
|
460
|
-
* Aborts when the currently executing task throws any error other than a {@link GraphBubbleUp}
|
|
461
|
-
*/
|
|
462
|
-
timeoutAbortSignal?: AbortSignal;
|
|
463
|
-
/**
|
|
464
|
-
* A reference to the AbortSignal that is passed to the node. Aborts on step timeout, stream cancel, or when an error is thrown.
|
|
465
|
-
*/
|
|
466
|
-
composedAbortSignal?: AbortSignal;
|
|
467
|
-
};
|
|
468
|
-
export type CallOptions = {
|
|
469
|
-
func: (...args: unknown[]) => unknown | Promise<unknown>;
|
|
470
|
-
name: string;
|
|
471
|
-
input: unknown;
|
|
472
|
-
cache?: CachePolicy;
|
|
473
|
-
retry?: RetryPolicy;
|
|
474
|
-
callbacks?: unknown;
|
|
408
|
+
|
|
409
|
+
type CallOptions = {
|
|
410
|
+
func: (...args: unknown[]) => unknown | Promise<unknown>;
|
|
411
|
+
name: string;
|
|
412
|
+
input: unknown;
|
|
413
|
+
cache?: CachePolicy;
|
|
414
|
+
retry?: RetryPolicy;
|
|
415
|
+
callbacks?: unknown;
|
|
475
416
|
};
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
417
|
+
declare class Call {
|
|
418
|
+
func: (...args: unknown[]) => unknown | Promise<unknown>;
|
|
419
|
+
name: string;
|
|
420
|
+
input: unknown;
|
|
421
|
+
retry?: RetryPolicy;
|
|
422
|
+
cache?: CachePolicy;
|
|
423
|
+
callbacks?: unknown;
|
|
424
|
+
readonly __lg_type: string;
|
|
425
|
+
constructor({
|
|
426
|
+
func,
|
|
427
|
+
name,
|
|
428
|
+
input,
|
|
429
|
+
retry,
|
|
430
|
+
cache,
|
|
431
|
+
callbacks
|
|
432
|
+
}: CallOptions);
|
|
485
433
|
}
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
export {};
|
|
434
|
+
type SimpleTaskPath = [string, string | number];
|
|
435
|
+
type VariadicTaskPath = [string, ...(string | number)[], boolean];
|
|
436
|
+
type CallTaskPath = [string, ...(string | number)[], Call] | [string, TaskPath, ...(string | number)[], Call];
|
|
437
|
+
type TaskPath = SimpleTaskPath | CallTaskPath | VariadicTaskPath;
|
|
438
|
+
//#endregion
|
|
439
|
+
export { Durability, GetStateOptions, MultipleChannelSubscriptionOptions, PregelInputType, PregelInterface, PregelOptions, PregelOutputType, PregelParams, SingleChannelSubscriptionOptions, StateSnapshot, StreamMode, StreamOutputMap };
|
|
440
|
+
//# sourceMappingURL=types.d.ts.map
|