@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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @langchain/langgraph
|
|
2
2
|
|
|
3
|
+
## 1.0.0-alpha.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- a05436d: Improve performance of scheduling tasks with large graphs
|
|
8
|
+
- d35db59: Improve graph execution performance by avoiding unnecessary cloning of checkpoints after every tick
|
|
9
|
+
- 7e01d08: Update troubleshooting link for common errors, add MISSING_CHECKPOINTER troubleshooting page
|
|
10
|
+
- a527fc7: Improve tick performance by detecting interrupts faster within a tick.
|
|
11
|
+
- 27934c0: Improve tick performance by calling `maxChannelMapVersion` only once
|
|
12
|
+
- dc2e5f2: fix(createReactAgent): update deprecation messages to contain reactAgent
|
|
13
|
+
- e8f5084: `writer`, `interrupt` and `signal` is no longer an optional property of `Runtime`
|
|
14
|
+
- 20f1d64: Channels are now part of the public API, allowing users to customise behaviour of checkpointing per channel (#976)
|
|
15
|
+
- 2311efc: Allow defining types for interrupt and custom events upfront
|
|
16
|
+
- c6f75b6: Fix performance regression due to deferred nodes
|
|
17
|
+
|
|
18
|
+
## 1.0.0-alpha.0
|
|
19
|
+
|
|
20
|
+
### Major Changes
|
|
21
|
+
|
|
22
|
+
- 445c2ae: Make Zod a peer dependency of @langchain/langgraph
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- 5f9b5a0: Deprecate createReactAgent in favour of `langchain` package.
|
|
27
|
+
- dcc117f: feat(langgraph): add `toLangGraphEventStream` method to stream events in LGP compatible format
|
|
28
|
+
|
|
3
29
|
## 0.4.9
|
|
4
30
|
|
|
5
31
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -18,9 +18,8 @@ To learn more about how to use LangGraph, check out [the docs](https://langchain
|
|
|
18
18
|
|
|
19
19
|
```ts
|
|
20
20
|
// npm install @langchain-anthropic
|
|
21
|
-
import { createReactAgent } from "
|
|
21
|
+
import { createReactAgent, tool } from "langchain";
|
|
22
22
|
import { ChatAnthropic } from "@langchain/anthropic";
|
|
23
|
-
import { tool } from "@langchain/core/tools";
|
|
24
23
|
|
|
25
24
|
import { z } from "zod";
|
|
26
25
|
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//#region rolldown:runtime
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
+
key = keys[i];
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
+
get: ((k) => from[k]).bind(null, key),
|
|
13
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
+
value: mod,
|
|
20
|
+
enumerable: true
|
|
21
|
+
}) : target, mod));
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
|
|
25
|
+
exports.__toESM = __toESM;
|
|
@@ -1,65 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const base_js_1 = require("./base.cjs");
|
|
1
|
+
const require_errors = require('../errors.cjs');
|
|
2
|
+
const require_base = require('./base.cjs');
|
|
3
|
+
|
|
4
|
+
//#region src/channels/any_value.ts
|
|
6
5
|
/**
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
return false;
|
|
47
|
-
}
|
|
48
|
-
get() {
|
|
49
|
-
if (this.value.length === 0) {
|
|
50
|
-
throw new errors_js_1.EmptyChannelError();
|
|
51
|
-
}
|
|
52
|
-
return this.value[0];
|
|
53
|
-
}
|
|
54
|
-
checkpoint() {
|
|
55
|
-
if (this.value.length === 0) {
|
|
56
|
-
throw new errors_js_1.EmptyChannelError();
|
|
57
|
-
}
|
|
58
|
-
return this.value[0];
|
|
59
|
-
}
|
|
60
|
-
isAvailable() {
|
|
61
|
-
return this.value.length !== 0;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
6
|
+
* Stores the last value received, assumes that if multiple values are received, they are all equal.
|
|
7
|
+
*
|
|
8
|
+
* Note: Unlike 'LastValue' if multiple nodes write to this channel in a single step, the values
|
|
9
|
+
* will be continuously overwritten.
|
|
10
|
+
*/
|
|
11
|
+
var AnyValue = class AnyValue extends require_base.BaseChannel {
|
|
12
|
+
lc_graph_name = "AnyValue";
|
|
13
|
+
value = [];
|
|
14
|
+
constructor() {
|
|
15
|
+
super();
|
|
16
|
+
}
|
|
17
|
+
fromCheckpoint(checkpoint) {
|
|
18
|
+
const empty = new AnyValue();
|
|
19
|
+
if (typeof checkpoint !== "undefined") empty.value = [checkpoint];
|
|
20
|
+
return empty;
|
|
21
|
+
}
|
|
22
|
+
update(values) {
|
|
23
|
+
if (values.length === 0) {
|
|
24
|
+
const updated = this.value.length > 0;
|
|
25
|
+
this.value = [];
|
|
26
|
+
return updated;
|
|
27
|
+
}
|
|
28
|
+
this.value = [values[values.length - 1]];
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
get() {
|
|
32
|
+
if (this.value.length === 0) throw new require_errors.EmptyChannelError();
|
|
33
|
+
return this.value[0];
|
|
34
|
+
}
|
|
35
|
+
checkpoint() {
|
|
36
|
+
if (this.value.length === 0) throw new require_errors.EmptyChannelError();
|
|
37
|
+
return this.value[0];
|
|
38
|
+
}
|
|
39
|
+
isAvailable() {
|
|
40
|
+
return this.value.length !== 0;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
//#endregion
|
|
64
45
|
exports.AnyValue = AnyValue;
|
|
65
|
-
//# sourceMappingURL=any_value.
|
|
46
|
+
//# sourceMappingURL=any_value.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"any_value.cjs","names":["BaseChannel","EmptyChannelError"],"sources":["../../src/channels/any_value.ts"],"sourcesContent":["import { EmptyChannelError } from \"../errors.js\";\nimport { BaseChannel } from \"./base.js\";\n\n/**\n * Stores the last value received, assumes that if multiple values are received, they are all equal.\n *\n * Note: Unlike 'LastValue' if multiple nodes write to this channel in a single step, the values\n * will be continuously overwritten.\n */\nexport class AnyValue<Value> extends BaseChannel<Value, Value, Value> {\n lc_graph_name = \"AnyValue\";\n\n // value is an array so we don't misinterpret an update to undefined as no write\n value: [Value] | [] = [];\n\n constructor() {\n super();\n }\n\n fromCheckpoint(checkpoint?: Value) {\n const empty = new AnyValue<Value>();\n if (typeof checkpoint !== \"undefined\") {\n empty.value = [checkpoint];\n }\n return empty as this;\n }\n\n update(values: Value[]): boolean {\n if (values.length === 0) {\n const updated = this.value.length > 0;\n this.value = [];\n return updated;\n }\n\n // eslint-disable-next-line prefer-destructuring\n this.value = [values[values.length - 1]];\n return false;\n }\n\n get(): Value {\n if (this.value.length === 0) {\n throw new EmptyChannelError();\n }\n return this.value[0];\n }\n\n checkpoint(): Value {\n if (this.value.length === 0) {\n throw new EmptyChannelError();\n }\n return this.value[0];\n }\n\n isAvailable(): boolean {\n return this.value.length !== 0;\n }\n}\n"],"mappings":";;;;;;;;;;AASA,IAAa,WAAb,MAAa,iBAAwBA,yBAAiC;CACpE,gBAAgB;CAGhB,QAAsB;CAEtB,cAAc;AACZ;;CAGF,eAAe,YAAoB;EACjC,MAAM,QAAQ,IAAI;AAClB,MAAI,OAAO,eAAe,YACxB,OAAM,QAAQ,CAAC;AAEjB,SAAO;;CAGT,OAAO,QAA0B;AAC/B,MAAI,OAAO,WAAW,GAAG;GACvB,MAAM,UAAU,KAAK,MAAM,SAAS;AACpC,QAAK,QAAQ;AACb,UAAO;;AAIT,OAAK,QAAQ,CAAC,OAAO,OAAO,SAAS;AACrC,SAAO;;CAGT,MAAa;AACX,MAAI,KAAK,MAAM,WAAW,EACxB,OAAM,IAAIC;AAEZ,SAAO,KAAK,MAAM;;CAGpB,aAAoB;AAClB,MAAI,KAAK,MAAM,WAAW,EACxB,OAAM,IAAIA;AAEZ,SAAO,KAAK,MAAM;;CAGpB,cAAuB;AACrB,SAAO,KAAK,MAAM,WAAW"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { BaseChannel } from "./base.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/channels/any_value.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Stores the last value received, assumes that if multiple values are received, they are all equal.
|
|
7
|
+
*
|
|
8
|
+
* Note: Unlike 'LastValue' if multiple nodes write to this channel in a single step, the values
|
|
9
|
+
* will be continuously overwritten.
|
|
10
|
+
*/
|
|
11
|
+
declare class AnyValue<Value> extends BaseChannel<Value, Value, Value> {
|
|
12
|
+
lc_graph_name: string;
|
|
13
|
+
// value is an array so we don't misinterpret an update to undefined as no write
|
|
14
|
+
value: [Value] | [];
|
|
15
|
+
constructor();
|
|
16
|
+
fromCheckpoint(checkpoint?: Value): this;
|
|
17
|
+
update(values: Value[]): boolean;
|
|
18
|
+
get(): Value;
|
|
19
|
+
checkpoint(): Value;
|
|
20
|
+
isAvailable(): boolean;
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { AnyValue };
|
|
24
|
+
//# sourceMappingURL=any_value.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"any_value.d.cts","names":["BaseChannel","AnyValue","Value"],"sources":["../../src/channels/any_value.d.ts"],"sourcesContent":["import { BaseChannel } from \"./base.js\";\n/**\n * Stores the last value received, assumes that if multiple values are received, they are all equal.\n *\n * Note: Unlike 'LastValue' if multiple nodes write to this channel in a single step, the values\n * will be continuously overwritten.\n */\nexport declare class AnyValue<Value> extends BaseChannel<Value, Value, Value> {\n lc_graph_name: string;\n // value is an array so we don't misinterpret an update to undefined as no write\n value: [Value] | [];\n constructor();\n fromCheckpoint(checkpoint?: Value): this;\n update(values: Value[]): boolean;\n get(): Value;\n checkpoint(): Value;\n isAvailable(): boolean;\n}\n"],"mappings":";;;;;;AAOA;;;;AAAuEE,cAAlDD,QAAkDC,CAAAA,KAAAA,CAAAA,SAA1BF,WAA0BE,CAAdA,KAAcA,EAAPA,KAAOA,EAAAA,KAAAA,CAAAA,CAAAA;eAG3DA,EAAAA,MAAAA;;OAGOA,EAAAA,CAHPA,KAGOA,CAAAA,GAAAA,EAAAA;aACRA,CAAAA;gBACOA,CAAAA,UAAAA,CAAAA,EAHcA,KAGdA,CAAAA,EAAAA,IAAAA;QAR2BF,CAAAA,MAAAA,EAM1BE,KAN0BF,EAAAA,CAAAA,EAAAA,OAAAA;SAOlCE;gBACOA"}
|
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
import { BaseChannel } from "./base.js";
|
|
2
|
+
|
|
3
|
+
//#region src/channels/any_value.d.ts
|
|
4
|
+
|
|
2
5
|
/**
|
|
3
6
|
* Stores the last value received, assumes that if multiple values are received, they are all equal.
|
|
4
7
|
*
|
|
5
8
|
* Note: Unlike 'LastValue' if multiple nodes write to this channel in a single step, the values
|
|
6
9
|
* will be continuously overwritten.
|
|
7
|
-
*
|
|
8
|
-
* @internal
|
|
9
10
|
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
declare class AnyValue<Value> extends BaseChannel<Value, Value, Value> {
|
|
12
|
+
lc_graph_name: string;
|
|
13
|
+
// value is an array so we don't misinterpret an update to undefined as no write
|
|
14
|
+
value: [Value] | [];
|
|
15
|
+
constructor();
|
|
16
|
+
fromCheckpoint(checkpoint?: Value): this;
|
|
17
|
+
update(values: Value[]): boolean;
|
|
18
|
+
get(): Value;
|
|
19
|
+
checkpoint(): Value;
|
|
20
|
+
isAvailable(): boolean;
|
|
19
21
|
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { AnyValue };
|
|
24
|
+
//# sourceMappingURL=any_value.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"any_value.d.ts","names":["BaseChannel","AnyValue","Value"],"sources":["../../src/channels/any_value.d.ts"],"sourcesContent":["import { BaseChannel } from \"./base.js\";\n/**\n * Stores the last value received, assumes that if multiple values are received, they are all equal.\n *\n * Note: Unlike 'LastValue' if multiple nodes write to this channel in a single step, the values\n * will be continuously overwritten.\n */\nexport declare class AnyValue<Value> extends BaseChannel<Value, Value, Value> {\n lc_graph_name: string;\n // value is an array so we don't misinterpret an update to undefined as no write\n value: [Value] | [];\n constructor();\n fromCheckpoint(checkpoint?: Value): this;\n update(values: Value[]): boolean;\n get(): Value;\n checkpoint(): Value;\n isAvailable(): boolean;\n}\n"],"mappings":";;;;;;AAOA;;;;AAAuEE,cAAlDD,QAAkDC,CAAAA,KAAAA,CAAAA,SAA1BF,WAA0BE,CAAdA,KAAcA,EAAPA,KAAOA,EAAAA,KAAAA,CAAAA,CAAAA;eAG3DA,EAAAA,MAAAA;;OAGOA,EAAAA,CAHPA,KAGOA,CAAAA,GAAAA,EAAAA;aACRA,CAAAA;gBACOA,CAAAA,UAAAA,CAAAA,EAHcA,KAGdA,CAAAA,EAAAA,IAAAA;QAR2BF,CAAAA,MAAAA,EAM1BE,KAN0BF,EAAAA,CAAAA,EAAAA,OAAAA;SAOlCE;gBACOA"}
|
|
@@ -1,61 +1,46 @@
|
|
|
1
1
|
import { EmptyChannelError } from "../errors.js";
|
|
2
2
|
import { BaseChannel } from "./base.js";
|
|
3
|
+
|
|
4
|
+
//#region src/channels/any_value.ts
|
|
3
5
|
/**
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
get() {
|
|
46
|
-
if (this.value.length === 0) {
|
|
47
|
-
throw new EmptyChannelError();
|
|
48
|
-
}
|
|
49
|
-
return this.value[0];
|
|
50
|
-
}
|
|
51
|
-
checkpoint() {
|
|
52
|
-
if (this.value.length === 0) {
|
|
53
|
-
throw new EmptyChannelError();
|
|
54
|
-
}
|
|
55
|
-
return this.value[0];
|
|
56
|
-
}
|
|
57
|
-
isAvailable() {
|
|
58
|
-
return this.value.length !== 0;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
6
|
+
* Stores the last value received, assumes that if multiple values are received, they are all equal.
|
|
7
|
+
*
|
|
8
|
+
* Note: Unlike 'LastValue' if multiple nodes write to this channel in a single step, the values
|
|
9
|
+
* will be continuously overwritten.
|
|
10
|
+
*/
|
|
11
|
+
var AnyValue = class AnyValue extends BaseChannel {
|
|
12
|
+
lc_graph_name = "AnyValue";
|
|
13
|
+
value = [];
|
|
14
|
+
constructor() {
|
|
15
|
+
super();
|
|
16
|
+
}
|
|
17
|
+
fromCheckpoint(checkpoint) {
|
|
18
|
+
const empty = new AnyValue();
|
|
19
|
+
if (typeof checkpoint !== "undefined") empty.value = [checkpoint];
|
|
20
|
+
return empty;
|
|
21
|
+
}
|
|
22
|
+
update(values) {
|
|
23
|
+
if (values.length === 0) {
|
|
24
|
+
const updated = this.value.length > 0;
|
|
25
|
+
this.value = [];
|
|
26
|
+
return updated;
|
|
27
|
+
}
|
|
28
|
+
this.value = [values[values.length - 1]];
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
get() {
|
|
32
|
+
if (this.value.length === 0) throw new EmptyChannelError();
|
|
33
|
+
return this.value[0];
|
|
34
|
+
}
|
|
35
|
+
checkpoint() {
|
|
36
|
+
if (this.value.length === 0) throw new EmptyChannelError();
|
|
37
|
+
return this.value[0];
|
|
38
|
+
}
|
|
39
|
+
isAvailable() {
|
|
40
|
+
return this.value.length !== 0;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
//#endregion
|
|
45
|
+
export { AnyValue };
|
|
61
46
|
//# sourceMappingURL=any_value.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"any_value.js","
|
|
1
|
+
{"version":3,"file":"any_value.js","names":[],"sources":["../../src/channels/any_value.ts"],"sourcesContent":["import { EmptyChannelError } from \"../errors.js\";\nimport { BaseChannel } from \"./base.js\";\n\n/**\n * Stores the last value received, assumes that if multiple values are received, they are all equal.\n *\n * Note: Unlike 'LastValue' if multiple nodes write to this channel in a single step, the values\n * will be continuously overwritten.\n */\nexport class AnyValue<Value> extends BaseChannel<Value, Value, Value> {\n lc_graph_name = \"AnyValue\";\n\n // value is an array so we don't misinterpret an update to undefined as no write\n value: [Value] | [] = [];\n\n constructor() {\n super();\n }\n\n fromCheckpoint(checkpoint?: Value) {\n const empty = new AnyValue<Value>();\n if (typeof checkpoint !== \"undefined\") {\n empty.value = [checkpoint];\n }\n return empty as this;\n }\n\n update(values: Value[]): boolean {\n if (values.length === 0) {\n const updated = this.value.length > 0;\n this.value = [];\n return updated;\n }\n\n // eslint-disable-next-line prefer-destructuring\n this.value = [values[values.length - 1]];\n return false;\n }\n\n get(): Value {\n if (this.value.length === 0) {\n throw new EmptyChannelError();\n }\n return this.value[0];\n }\n\n checkpoint(): Value {\n if (this.value.length === 0) {\n throw new EmptyChannelError();\n }\n return this.value[0];\n }\n\n isAvailable(): boolean {\n return this.value.length !== 0;\n }\n}\n"],"mappings":";;;;;;;;;;AASA,IAAa,WAAb,MAAa,iBAAwB,YAAiC;CACpE,gBAAgB;CAGhB,QAAsB;CAEtB,cAAc;AACZ;;CAGF,eAAe,YAAoB;EACjC,MAAM,QAAQ,IAAI;AAClB,MAAI,OAAO,eAAe,YACxB,OAAM,QAAQ,CAAC;AAEjB,SAAO;;CAGT,OAAO,QAA0B;AAC/B,MAAI,OAAO,WAAW,GAAG;GACvB,MAAM,UAAU,KAAK,MAAM,SAAS;AACpC,QAAK,QAAQ;AACb,UAAO;;AAIT,OAAK,QAAQ,CAAC,OAAO,OAAO,SAAS;AACrC,SAAO;;CAGT,MAAa;AACX,MAAI,KAAK,MAAM,WAAW,EACxB,OAAM,IAAI;AAEZ,SAAO,KAAK,MAAM;;CAGpB,aAAoB;AAClB,MAAI,KAAK,MAAM,WAAW,EACxB,OAAM,IAAI;AAEZ,SAAO,KAAK,MAAM;;CAGpB,cAAuB;AACrB,SAAO,KAAK,MAAM,WAAW"}
|
package/dist/channels/base.cjs
CHANGED
|
@@ -1,142 +1,102 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports.emptyChannels = emptyChannels;
|
|
7
|
-
exports.createCheckpoint = createCheckpoint;
|
|
8
|
-
const langgraph_checkpoint_1 = require("@langchain/langgraph-checkpoint");
|
|
9
|
-
const errors_js_1 = require("../errors.cjs");
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_errors = require('../errors.cjs');
|
|
3
|
+
const __langchain_langgraph_checkpoint = require_rolldown_runtime.__toESM(require("@langchain/langgraph-checkpoint"));
|
|
4
|
+
|
|
5
|
+
//#region src/channels/base.ts
|
|
10
6
|
function isBaseChannel(obj) {
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
class BaseChannel {
|
|
14
|
-
constructor() {
|
|
15
|
-
Object.defineProperty(this, "ValueType", {
|
|
16
|
-
enumerable: true,
|
|
17
|
-
configurable: true,
|
|
18
|
-
writable: true,
|
|
19
|
-
value: void 0
|
|
20
|
-
});
|
|
21
|
-
Object.defineProperty(this, "UpdateType", {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
configurable: true,
|
|
24
|
-
writable: true,
|
|
25
|
-
value: void 0
|
|
26
|
-
});
|
|
27
|
-
/** @ignore */
|
|
28
|
-
Object.defineProperty(this, "lg_is_channel", {
|
|
29
|
-
enumerable: true,
|
|
30
|
-
configurable: true,
|
|
31
|
-
writable: true,
|
|
32
|
-
value: true
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Mark the current value of the channel as consumed. By default, no-op.
|
|
37
|
-
* A channel can use this method to modify its state, preventing the value
|
|
38
|
-
* from being consumed again.
|
|
39
|
-
*
|
|
40
|
-
* Returns True if the channel was updated, False otherwise.
|
|
41
|
-
*/
|
|
42
|
-
consume() {
|
|
43
|
-
return false;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Notify the channel that the Pregel run is finishing. By default, no-op.
|
|
47
|
-
* A channel can use this method to modify its state, preventing finish.
|
|
48
|
-
*
|
|
49
|
-
* Returns True if the channel was updated, False otherwise.
|
|
50
|
-
*/
|
|
51
|
-
finish() {
|
|
52
|
-
return false;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Return True if the channel is available (not empty), False otherwise.
|
|
56
|
-
* Subclasses should override this method to provide a more efficient
|
|
57
|
-
* implementation than calling get() and catching EmptyChannelError.
|
|
58
|
-
*/
|
|
59
|
-
isAvailable() {
|
|
60
|
-
try {
|
|
61
|
-
this.get();
|
|
62
|
-
return true;
|
|
63
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
64
|
-
}
|
|
65
|
-
catch (error) {
|
|
66
|
-
if (error.name === errors_js_1.EmptyChannelError.unminifiable_name) {
|
|
67
|
-
return false;
|
|
68
|
-
}
|
|
69
|
-
throw error;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
7
|
+
return obj != null && obj.lg_is_channel === true;
|
|
72
8
|
}
|
|
73
|
-
|
|
9
|
+
/** @internal */
|
|
10
|
+
var BaseChannel = class {
|
|
11
|
+
ValueType;
|
|
12
|
+
UpdateType;
|
|
13
|
+
/** @ignore */
|
|
14
|
+
lg_is_channel = true;
|
|
15
|
+
/**
|
|
16
|
+
* Mark the current value of the channel as consumed. By default, no-op.
|
|
17
|
+
* A channel can use this method to modify its state, preventing the value
|
|
18
|
+
* from being consumed again.
|
|
19
|
+
*
|
|
20
|
+
* Returns True if the channel was updated, False otherwise.
|
|
21
|
+
*/
|
|
22
|
+
consume() {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Notify the channel that the Pregel run is finishing. By default, no-op.
|
|
27
|
+
* A channel can use this method to modify its state, preventing finish.
|
|
28
|
+
*
|
|
29
|
+
* Returns True if the channel was updated, False otherwise.
|
|
30
|
+
*/
|
|
31
|
+
finish() {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Return True if the channel is available (not empty), False otherwise.
|
|
36
|
+
* Subclasses should override this method to provide a more efficient
|
|
37
|
+
* implementation than calling get() and catching EmptyChannelError.
|
|
38
|
+
*/
|
|
39
|
+
isAvailable() {
|
|
40
|
+
try {
|
|
41
|
+
this.get();
|
|
42
|
+
return true;
|
|
43
|
+
} catch (error) {
|
|
44
|
+
if (error.name === require_errors.EmptyChannelError.unminifiable_name) return false;
|
|
45
|
+
throw error;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
};
|
|
74
49
|
const IS_ONLY_BASE_CHANNEL = Symbol.for("LG_IS_ONLY_BASE_CHANNEL");
|
|
75
50
|
function getOnlyChannels(channels) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
newChannels[k] = value;
|
|
86
|
-
}
|
|
87
|
-
Object.assign(newChannels, { [IS_ONLY_BASE_CHANNEL]: true });
|
|
88
|
-
return newChannels;
|
|
51
|
+
if (channels[IS_ONLY_BASE_CHANNEL] === true) return channels;
|
|
52
|
+
const newChannels = {};
|
|
53
|
+
for (const k in channels) {
|
|
54
|
+
if (!Object.prototype.hasOwnProperty.call(channels, k)) continue;
|
|
55
|
+
const value = channels[k];
|
|
56
|
+
if (isBaseChannel(value)) newChannels[k] = value;
|
|
57
|
+
}
|
|
58
|
+
Object.assign(newChannels, { [IS_ONLY_BASE_CHANNEL]: true });
|
|
59
|
+
return newChannels;
|
|
89
60
|
}
|
|
90
61
|
function emptyChannels(channels, checkpoint) {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
return newChannels;
|
|
62
|
+
const filteredChannels = getOnlyChannels(channels);
|
|
63
|
+
const newChannels = {};
|
|
64
|
+
for (const k in filteredChannels) {
|
|
65
|
+
if (!Object.prototype.hasOwnProperty.call(filteredChannels, k)) continue;
|
|
66
|
+
const channelValue = checkpoint.channel_values[k];
|
|
67
|
+
newChannels[k] = filteredChannels[k].fromCheckpoint(channelValue);
|
|
68
|
+
}
|
|
69
|
+
Object.assign(newChannels, { [IS_ONLY_BASE_CHANNEL]: true });
|
|
70
|
+
return newChannels;
|
|
101
71
|
}
|
|
102
72
|
function createCheckpoint(checkpoint, channels, step, options) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
const newVersionsSeen = {};
|
|
128
|
-
for (const k in checkpoint.versions_seen) {
|
|
129
|
-
if (!Object.prototype.hasOwnProperty.call(checkpoint.versions_seen, k))
|
|
130
|
-
continue;
|
|
131
|
-
newVersionsSeen[k] = { ...checkpoint.versions_seen[k] };
|
|
132
|
-
}
|
|
133
|
-
return {
|
|
134
|
-
v: 4,
|
|
135
|
-
id: options?.id ?? (0, langgraph_checkpoint_1.uuid6)(step),
|
|
136
|
-
ts: new Date().toISOString(),
|
|
137
|
-
channel_values: values,
|
|
138
|
-
channel_versions: { ...checkpoint.channel_versions },
|
|
139
|
-
versions_seen: newVersionsSeen,
|
|
140
|
-
};
|
|
73
|
+
let values;
|
|
74
|
+
if (channels === void 0) values = checkpoint.channel_values;
|
|
75
|
+
else {
|
|
76
|
+
values = {};
|
|
77
|
+
for (const k in channels) {
|
|
78
|
+
if (!Object.prototype.hasOwnProperty.call(channels, k)) continue;
|
|
79
|
+
try {
|
|
80
|
+
values[k] = channels[k].checkpoint();
|
|
81
|
+
} catch (error) {
|
|
82
|
+
if (error.name === require_errors.EmptyChannelError.unminifiable_name) {} else throw error;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
v: 4,
|
|
88
|
+
id: options?.id ?? (0, __langchain_langgraph_checkpoint.uuid6)(step),
|
|
89
|
+
ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
90
|
+
channel_values: values,
|
|
91
|
+
channel_versions: checkpoint.channel_versions,
|
|
92
|
+
versions_seen: checkpoint.versions_seen
|
|
93
|
+
};
|
|
141
94
|
}
|
|
142
|
-
|
|
95
|
+
|
|
96
|
+
//#endregion
|
|
97
|
+
exports.BaseChannel = BaseChannel;
|
|
98
|
+
exports.createCheckpoint = createCheckpoint;
|
|
99
|
+
exports.emptyChannels = emptyChannels;
|
|
100
|
+
exports.getOnlyChannels = getOnlyChannels;
|
|
101
|
+
exports.isBaseChannel = isBaseChannel;
|
|
102
|
+
//# sourceMappingURL=base.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.cjs","names":["error: any","EmptyChannelError","values: Record<string, any>"],"sources":["../../src/channels/base.ts"],"sourcesContent":["import {\n ReadonlyCheckpoint,\n uuid6,\n Checkpoint,\n} from \"@langchain/langgraph-checkpoint\";\nimport { EmptyChannelError } from \"../errors.js\";\n\nexport function isBaseChannel(obj: unknown): obj is BaseChannel {\n return obj != null && (obj as BaseChannel).lg_is_channel === true;\n}\n\n/** @internal */\nexport abstract class BaseChannel<\n ValueType = unknown,\n UpdateType = unknown,\n CheckpointType = unknown\n> {\n ValueType: ValueType;\n\n UpdateType: UpdateType;\n\n /**\n * The name of the channel.\n */\n abstract lc_graph_name: string;\n\n /** @ignore */\n lg_is_channel = true;\n\n /**\n * Return a new identical channel, optionally initialized from a checkpoint.\n * Can be thought of as a \"restoration\" from a checkpoint which is a \"snapshot\" of the channel's state.\n *\n * @param {CheckpointType | undefined} checkpoint\n * @param {CheckpointType | undefined} initialValue\n * @returns {this}\n */\n abstract fromCheckpoint(checkpoint?: CheckpointType): this;\n\n /**\n * Update the channel's value with the given sequence of updates.\n * The order of the updates in the sequence is arbitrary.\n * This method is called by Pregel for all channels at the end of each step.\n * If there are no updates, it is called with an empty sequence.\n *\n * Raises InvalidUpdateError if the sequence of updates is invalid.\n * Returns True if the channel was updated, False otherwise.\n *\n * @throws {InvalidUpdateError} if the sequence of updates is invalid.\n * @param {Array<UpdateType>} values\n * @returns {void}\n */\n abstract update(values: UpdateType[]): boolean;\n\n /**\n * Return the current value of the channel.\n *\n * @throws {EmptyChannelError} if the channel is empty (never updated yet).\n * @returns {ValueType}\n */\n abstract get(): ValueType;\n\n /**\n * Return a string representation of the channel's current state.\n *\n * @throws {EmptyChannelError} if the channel is empty (never updated yet), or doesn't support checkpoints.\n * @returns {CheckpointType | undefined}\n */\n abstract checkpoint(): CheckpointType | undefined;\n\n /**\n * Mark the current value of the channel as consumed. By default, no-op.\n * A channel can use this method to modify its state, preventing the value\n * from being consumed again.\n *\n * Returns True if the channel was updated, False otherwise.\n */\n consume(): boolean {\n return false;\n }\n\n /**\n * Notify the channel that the Pregel run is finishing. By default, no-op.\n * A channel can use this method to modify its state, preventing finish.\n *\n * Returns True if the channel was updated, False otherwise.\n */\n finish(): boolean {\n return false;\n }\n\n /**\n * Return True if the channel is available (not empty), False otherwise.\n * Subclasses should override this method to provide a more efficient\n * implementation than calling get() and catching EmptyChannelError.\n */\n isAvailable(): boolean {\n try {\n this.get();\n return true;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n if (error.name === EmptyChannelError.unminifiable_name) {\n return false;\n }\n throw error;\n }\n }\n}\n\nconst IS_ONLY_BASE_CHANNEL = Symbol.for(\"LG_IS_ONLY_BASE_CHANNEL\");\nexport function getOnlyChannels(\n channels: Record<string, BaseChannel>\n): Record<string, BaseChannel> {\n // @ts-expect-error - we know it's a record of base channels\n if (channels[IS_ONLY_BASE_CHANNEL] === true) return channels;\n\n const newChannels = {} as Record<string, BaseChannel>;\n for (const k in channels) {\n if (!Object.prototype.hasOwnProperty.call(channels, k)) continue;\n const value = channels[k];\n if (isBaseChannel(value)) newChannels[k] = value;\n }\n\n Object.assign(newChannels, { [IS_ONLY_BASE_CHANNEL]: true });\n return newChannels;\n}\n\nexport function emptyChannels<Cc extends Record<string, BaseChannel>>(\n channels: Cc,\n checkpoint: ReadonlyCheckpoint\n): Cc {\n const filteredChannels = getOnlyChannels(channels) as Cc;\n\n const newChannels = {} as Cc;\n for (const k in filteredChannels) {\n if (!Object.prototype.hasOwnProperty.call(filteredChannels, k)) continue;\n const channelValue = checkpoint.channel_values[k];\n newChannels[k] = filteredChannels[k].fromCheckpoint(channelValue);\n }\n Object.assign(newChannels, { [IS_ONLY_BASE_CHANNEL]: true });\n return newChannels;\n}\n\nexport function createCheckpoint<ValueType>(\n checkpoint: ReadonlyCheckpoint,\n channels: Record<string, BaseChannel<ValueType>> | undefined,\n step: number,\n options?: { id?: string }\n): Checkpoint {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let values: Record<string, any>;\n if (channels === undefined) {\n values = checkpoint.channel_values;\n } else {\n values = {};\n for (const k in channels) {\n if (!Object.prototype.hasOwnProperty.call(channels, k)) continue;\n try {\n values[k] = channels[k].checkpoint();\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n if (error.name === EmptyChannelError.unminifiable_name) {\n // no-op\n } else {\n throw error; // Rethrow unexpected errors\n }\n }\n }\n }\n\n return {\n v: 4,\n id: options?.id ?? uuid6(step),\n ts: new Date().toISOString(),\n channel_values: values,\n channel_versions: checkpoint.channel_versions,\n versions_seen: checkpoint.versions_seen,\n };\n}\n"],"mappings":";;;;;AAOA,SAAgB,cAAc,KAAkC;AAC9D,QAAO,OAAO,QAAS,IAAoB,kBAAkB;;;AAI/D,IAAsB,cAAtB,MAIE;CACA;CAEA;;CAQA,gBAAgB;;;;;;;;CAkDhB,UAAmB;AACjB,SAAO;;;;;;;;CAST,SAAkB;AAChB,SAAO;;;;;;;CAQT,cAAuB;AACrB,MAAI;AACF,QAAK;AACL,UAAO;WAEAA,OAAY;AACnB,OAAI,MAAM,SAASC,iCAAkB,kBACnC,QAAO;AAET,SAAM;;;;AAKZ,MAAM,uBAAuB,OAAO,IAAI;AACxC,SAAgB,gBACd,UAC6B;AAE7B,KAAI,SAAS,0BAA0B,KAAM,QAAO;CAEpD,MAAM,cAAc;AACpB,MAAK,MAAM,KAAK,UAAU;AACxB,MAAI,CAAC,OAAO,UAAU,eAAe,KAAK,UAAU,GAAI;EACxD,MAAM,QAAQ,SAAS;AACvB,MAAI,cAAc,OAAQ,aAAY,KAAK;;AAG7C,QAAO,OAAO,aAAa,GAAG,uBAAuB;AACrD,QAAO;;AAGT,SAAgB,cACd,UACA,YACI;CACJ,MAAM,mBAAmB,gBAAgB;CAEzC,MAAM,cAAc;AACpB,MAAK,MAAM,KAAK,kBAAkB;AAChC,MAAI,CAAC,OAAO,UAAU,eAAe,KAAK,kBAAkB,GAAI;EAChE,MAAM,eAAe,WAAW,eAAe;AAC/C,cAAY,KAAK,iBAAiB,GAAG,eAAe;;AAEtD,QAAO,OAAO,aAAa,GAAG,uBAAuB;AACrD,QAAO;;AAGT,SAAgB,iBACd,YACA,UACA,MACA,SACY;CAEZ,IAAIC;AACJ,KAAI,aAAa,OACf,UAAS,WAAW;MACf;AACL,WAAS;AACT,OAAK,MAAM,KAAK,UAAU;AACxB,OAAI,CAAC,OAAO,UAAU,eAAe,KAAK,UAAU,GAAI;AACxD,OAAI;AACF,WAAO,KAAK,SAAS,GAAG;YAEjBF,OAAY;AACnB,QAAI,MAAM,SAASC,iCAAkB,mBAAmB,OAGtD,OAAM;;;;AAMd,QAAO;EACL,GAAG;EACH,IAAI,SAAS,kDAAY;EACzB,qBAAI,IAAI,QAAO;EACf,gBAAgB;EAChB,kBAAkB,WAAW;EAC7B,eAAe,WAAW"}
|