@langchain/langgraph 1.0.12 → 1.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/channels/any_value.cjs +46 -0
- package/dist/channels/any_value.cjs.map +1 -0
- package/dist/channels/any_value.d.cts +23 -0
- package/dist/channels/any_value.d.cts.map +1 -0
- package/dist/channels/any_value.d.ts +23 -0
- package/dist/channels/any_value.d.ts.map +1 -0
- package/dist/channels/any_value.js +46 -0
- package/dist/channels/any_value.js.map +1 -0
- package/dist/channels/base.cjs +101 -0
- 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 +79 -0
- package/dist/channels/base.d.ts.map +1 -0
- package/dist/channels/base.js +97 -0
- package/dist/channels/base.js.map +1 -0
- package/dist/channels/binop.cjs +49 -0
- 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 +22 -0
- package/dist/channels/binop.d.ts.map +1 -0
- package/dist/channels/binop.js +49 -0
- package/dist/channels/binop.js.map +1 -0
- package/dist/channels/dynamic_barrier_value.cjs +75 -0
- package/dist/channels/dynamic_barrier_value.cjs.map +1 -0
- package/dist/channels/dynamic_barrier_value.d.cts +40 -0
- package/dist/channels/dynamic_barrier_value.d.cts.map +1 -0
- package/dist/channels/dynamic_barrier_value.d.ts +40 -0
- package/dist/channels/dynamic_barrier_value.d.ts.map +1 -0
- package/dist/channels/dynamic_barrier_value.js +75 -0
- package/dist/channels/dynamic_barrier_value.js.map +1 -0
- package/dist/channels/ephemeral_value.cjs +46 -0
- package/dist/channels/ephemeral_value.cjs.map +1 -0
- package/dist/channels/ephemeral_value.d.cts +21 -0
- package/dist/channels/ephemeral_value.d.cts.map +1 -0
- package/dist/channels/ephemeral_value.d.ts +21 -0
- package/dist/channels/ephemeral_value.d.ts.map +1 -0
- package/dist/channels/ephemeral_value.js +46 -0
- package/dist/channels/ephemeral_value.js.map +1 -0
- package/dist/channels/index.cjs +21 -0
- package/dist/channels/index.d.cts +9 -0
- package/dist/channels/index.d.ts +9 -0
- package/dist/channels/index.js +10 -0
- package/dist/channels/last_value.cjs +98 -0
- 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 +42 -0
- package/dist/channels/last_value.d.ts.map +1 -0
- package/dist/channels/last_value.js +97 -0
- package/dist/channels/last_value.js.map +1 -0
- package/dist/channels/named_barrier_value.cjs +116 -0
- package/dist/channels/named_barrier_value.cjs.map +1 -0
- package/dist/channels/named_barrier_value.d.cts +44 -0
- package/dist/channels/named_barrier_value.d.cts.map +1 -0
- package/dist/channels/named_barrier_value.d.ts +44 -0
- package/dist/channels/named_barrier_value.d.ts.map +1 -0
- package/dist/channels/named_barrier_value.js +114 -0
- package/dist/channels/named_barrier_value.js.map +1 -0
- package/dist/channels/topic.cjs +65 -0
- 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 +32 -0
- package/dist/channels/topic.d.ts.map +1 -0
- package/dist/channels/topic.js +65 -0
- package/dist/channels/topic.js.map +1 -0
- package/dist/constants.cjs +406 -0
- package/dist/constants.cjs.map +1 -0
- package/dist/constants.d.cts +281 -0
- package/dist/constants.d.cts.map +1 -0
- package/dist/constants.d.ts +281 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +362 -0
- package/dist/constants.js.map +1 -0
- package/dist/errors.cjs +163 -0
- package/dist/errors.cjs.map +1 -0
- package/dist/errors.d.cts +77 -0
- package/dist/errors.d.cts.map +1 -0
- package/dist/errors.d.ts +77 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +146 -0
- package/dist/errors.js.map +1 -0
- package/dist/func/index.cjs +299 -0
- package/dist/func/index.cjs.map +1 -0
- package/dist/func/index.d.cts +288 -0
- package/dist/func/index.d.cts.map +1 -0
- package/dist/func/index.d.ts +288 -0
- package/dist/func/index.d.ts.map +1 -0
- package/dist/func/index.js +297 -0
- package/dist/func/index.js.map +1 -0
- package/dist/func/types.d.cts +62 -0
- package/dist/func/types.d.cts.map +1 -0
- package/dist/func/types.d.ts +62 -0
- package/dist/func/types.d.ts.map +1 -0
- package/dist/graph/annotation.cjs +101 -0
- 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 +116 -0
- package/dist/graph/annotation.d.ts.map +1 -0
- package/dist/graph/annotation.js +99 -0
- package/dist/graph/annotation.js.map +1 -0
- package/dist/graph/graph.cjs +420 -0
- package/dist/graph/graph.cjs.map +1 -0
- package/dist/graph/graph.d.cts +108 -0
- package/dist/graph/graph.d.cts.map +1 -0
- package/dist/graph/graph.d.ts +108 -0
- package/dist/graph/graph.d.ts.map +1 -0
- package/dist/graph/graph.js +418 -0
- package/dist/graph/graph.js.map +1 -0
- package/dist/graph/index.cjs +5 -0
- package/dist/graph/index.js +7 -0
- package/dist/graph/message.cjs +97 -0
- package/dist/graph/message.cjs.map +1 -0
- package/dist/graph/message.d.cts +40 -0
- package/dist/graph/message.d.cts.map +1 -0
- package/dist/graph/message.d.ts +40 -0
- package/dist/graph/message.d.ts.map +1 -0
- package/dist/graph/message.js +94 -0
- package/dist/graph/message.js.map +1 -0
- package/dist/graph/messages_annotation.cjs +109 -0
- package/dist/graph/messages_annotation.cjs.map +1 -0
- package/dist/graph/messages_annotation.d.cts +112 -0
- package/dist/graph/messages_annotation.d.cts.map +1 -0
- package/dist/graph/messages_annotation.d.ts +112 -0
- package/dist/graph/messages_annotation.d.ts.map +1 -0
- package/dist/graph/messages_annotation.js +107 -0
- package/dist/graph/messages_annotation.js.map +1 -0
- package/dist/graph/state.cjs +494 -0
- package/dist/graph/state.cjs.map +1 -0
- package/dist/graph/state.d.cts +229 -0
- package/dist/graph/state.d.cts.map +1 -0
- package/dist/graph/state.d.ts +229 -0
- package/dist/graph/state.d.ts.map +1 -0
- package/dist/graph/state.js +493 -0
- package/dist/graph/state.js.map +1 -0
- package/dist/graph/zod/index.cjs +10 -0
- package/dist/graph/zod/index.d.cts +3 -0
- package/dist/graph/zod/index.d.ts +3 -0
- package/dist/graph/zod/index.js +5 -0
- package/dist/graph/zod/meta.cjs +144 -0
- package/dist/graph/zod/meta.cjs.map +1 -0
- package/dist/graph/zod/meta.d.cts +115 -0
- package/dist/graph/zod/meta.d.cts.map +1 -0
- package/dist/graph/zod/meta.d.ts +115 -0
- package/dist/graph/zod/meta.d.ts.map +1 -0
- package/dist/graph/zod/meta.js +141 -0
- package/dist/graph/zod/meta.js.map +1 -0
- package/dist/graph/zod/plugin.cjs +39 -0
- package/dist/graph/zod/plugin.cjs.map +1 -0
- package/dist/graph/zod/plugin.js +40 -0
- package/dist/graph/zod/plugin.js.map +1 -0
- package/dist/graph/zod/schema.cjs +98 -0
- 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 +38 -0
- package/dist/graph/zod/schema.d.ts.map +1 -0
- package/dist/graph/zod/schema.js +94 -0
- package/dist/graph/zod/schema.js.map +1 -0
- package/dist/graph/zod/zod-registry.cjs +42 -0
- package/dist/graph/zod/zod-registry.cjs.map +1 -0
- package/dist/graph/zod/zod-registry.d.cts +49 -0
- package/dist/graph/zod/zod-registry.d.cts.map +1 -0
- package/dist/graph/zod/zod-registry.d.ts +49 -0
- package/dist/graph/zod/zod-registry.d.ts.map +1 -0
- package/dist/graph/zod/zod-registry.js +41 -0
- package/dist/graph/zod/zod-registry.js.map +1 -0
- package/dist/hash.cjs +265 -0
- package/dist/hash.cjs.map +1 -0
- package/dist/hash.js +263 -0
- package/dist/hash.js.map +1 -0
- package/dist/index.cjs +111 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +26 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/dist/interrupt.cjs +79 -0
- package/dist/interrupt.cjs.map +1 -0
- package/dist/interrupt.d.cts +55 -0
- package/dist/interrupt.d.cts.map +1 -0
- package/dist/interrupt.d.ts +55 -0
- package/dist/interrupt.d.ts.map +1 -0
- package/dist/interrupt.js +79 -0
- package/dist/interrupt.js.map +1 -0
- package/dist/prebuilt/agentName.cjs +148 -0
- 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 +42 -0
- package/dist/prebuilt/agentName.d.ts.map +1 -0
- package/dist/prebuilt/agentName.js +148 -0
- package/dist/prebuilt/agentName.js.map +1 -0
- package/dist/prebuilt/agent_executor.cjs +41 -0
- package/dist/prebuilt/agent_executor.cjs.map +1 -0
- package/dist/prebuilt/agent_executor.d.cts +58 -0
- package/dist/prebuilt/agent_executor.d.cts.map +1 -0
- package/dist/prebuilt/agent_executor.d.ts +58 -0
- package/dist/prebuilt/agent_executor.d.ts.map +1 -0
- package/dist/prebuilt/agent_executor.js +41 -0
- package/dist/prebuilt/agent_executor.js.map +1 -0
- package/dist/prebuilt/chat_agent_executor.cjs +62 -0
- 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 +23 -0
- package/dist/prebuilt/chat_agent_executor.d.ts.map +1 -0
- package/dist/prebuilt/chat_agent_executor.js +62 -0
- package/dist/prebuilt/chat_agent_executor.js.map +1 -0
- package/dist/prebuilt/index.cjs +15 -0
- package/dist/prebuilt/index.d.cts +8 -0
- package/dist/prebuilt/index.d.ts +8 -0
- package/dist/prebuilt/index.js +8 -0
- package/dist/prebuilt/interrupt.d.cts +60 -0
- package/dist/prebuilt/interrupt.d.cts.map +1 -0
- package/dist/prebuilt/interrupt.d.ts +60 -0
- package/dist/prebuilt/interrupt.d.ts.map +1 -0
- package/dist/prebuilt/react_agent_executor.cjs +339 -0
- package/dist/prebuilt/react_agent_executor.cjs.map +1 -0
- package/dist/prebuilt/react_agent_executor.d.cts +211 -0
- package/dist/prebuilt/react_agent_executor.d.cts.map +1 -0
- package/dist/prebuilt/react_agent_executor.d.ts +211 -0
- package/dist/prebuilt/react_agent_executor.d.ts.map +1 -0
- package/dist/prebuilt/react_agent_executor.js +338 -0
- package/dist/prebuilt/react_agent_executor.js.map +1 -0
- package/dist/prebuilt/tool_executor.cjs +43 -0
- package/dist/prebuilt/tool_executor.cjs.map +1 -0
- package/dist/prebuilt/tool_executor.d.cts +40 -0
- package/dist/prebuilt/tool_executor.d.cts.map +1 -0
- package/dist/prebuilt/tool_executor.d.ts +40 -0
- package/dist/prebuilt/tool_executor.d.ts.map +1 -0
- package/dist/prebuilt/tool_executor.js +43 -0
- package/dist/prebuilt/tool_executor.js.map +1 -0
- package/dist/prebuilt/tool_node.cjs +247 -0
- package/dist/prebuilt/tool_node.cjs.map +1 -0
- package/dist/prebuilt/tool_node.d.cts +180 -0
- package/dist/prebuilt/tool_node.d.cts.map +1 -0
- package/dist/prebuilt/tool_node.d.ts +180 -0
- package/dist/prebuilt/tool_node.d.ts.map +1 -0
- package/dist/prebuilt/tool_node.js +246 -0
- package/dist/prebuilt/tool_node.js.map +1 -0
- package/dist/pregel/algo.cjs +565 -0
- 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 +13 -0
- package/dist/pregel/algo.d.ts.map +1 -0
- package/dist/pregel/algo.js +560 -0
- package/dist/pregel/algo.js.map +1 -0
- package/dist/pregel/call.cjs +50 -0
- package/dist/pregel/call.cjs.map +1 -0
- package/dist/pregel/call.js +48 -0
- package/dist/pregel/call.js.map +1 -0
- package/dist/pregel/debug.cjs +172 -0
- package/dist/pregel/debug.cjs.map +1 -0
- package/dist/pregel/debug.js +166 -0
- package/dist/pregel/debug.js.map +1 -0
- package/dist/pregel/index.cjs +1163 -0
- package/dist/pregel/index.cjs.map +1 -0
- package/dist/pregel/index.d.cts +498 -0
- package/dist/pregel/index.d.cts.map +1 -0
- package/dist/pregel/index.d.ts +498 -0
- package/dist/pregel/index.d.ts.map +1 -0
- package/dist/pregel/index.js +1162 -0
- package/dist/pregel/index.js.map +1 -0
- package/dist/pregel/io.cjs +140 -0
- package/dist/pregel/io.cjs.map +1 -0
- package/dist/pregel/io.js +135 -0
- package/dist/pregel/io.js.map +1 -0
- package/dist/pregel/loop.cjs +545 -0
- package/dist/pregel/loop.cjs.map +1 -0
- package/dist/pregel/loop.js +545 -0
- package/dist/pregel/loop.js.map +1 -0
- package/dist/pregel/messages.cjs +107 -0
- package/dist/pregel/messages.cjs.map +1 -0
- package/dist/pregel/messages.js +107 -0
- package/dist/pregel/messages.js.map +1 -0
- package/dist/pregel/read.cjs +151 -0
- package/dist/pregel/read.cjs.map +1 -0
- package/dist/pregel/read.d.cts +45 -0
- package/dist/pregel/read.d.cts.map +1 -0
- package/dist/pregel/read.d.ts +45 -0
- package/dist/pregel/read.d.ts.map +1 -0
- package/dist/pregel/read.js +150 -0
- package/dist/pregel/read.js.map +1 -0
- package/dist/pregel/remote.cjs +341 -0
- package/dist/pregel/remote.cjs.map +1 -0
- package/dist/pregel/remote.d.cts +118 -0
- package/dist/pregel/remote.d.cts.map +1 -0
- package/dist/pregel/remote.d.ts +118 -0
- package/dist/pregel/remote.d.ts.map +1 -0
- package/dist/pregel/remote.js +341 -0
- package/dist/pregel/remote.js.map +1 -0
- package/dist/pregel/retry.cjs +91 -0
- package/dist/pregel/retry.cjs.map +1 -0
- package/dist/pregel/retry.js +91 -0
- package/dist/pregel/retry.js.map +1 -0
- package/dist/pregel/runnable_types.d.cts +43 -0
- package/dist/pregel/runnable_types.d.cts.map +1 -0
- package/dist/pregel/runnable_types.d.ts +43 -0
- package/dist/pregel/runnable_types.d.ts.map +1 -0
- package/dist/pregel/runner.cjs +228 -0
- package/dist/pregel/runner.cjs.map +1 -0
- package/dist/pregel/runner.js +228 -0
- package/dist/pregel/runner.js.map +1 -0
- package/dist/pregel/stream.cjs +197 -0
- package/dist/pregel/stream.cjs.map +1 -0
- package/dist/pregel/stream.js +195 -0
- package/dist/pregel/stream.js.map +1 -0
- package/dist/pregel/types.cjs +27 -0
- 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 +440 -0
- package/dist/pregel/types.d.ts.map +1 -0
- package/dist/pregel/types.js +25 -0
- package/dist/pregel/types.js.map +1 -0
- package/dist/pregel/utils/config.cjs +121 -0
- 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 +36 -0
- package/dist/pregel/utils/config.d.ts.map +1 -0
- package/dist/pregel/utils/config.js +115 -0
- package/dist/pregel/utils/config.js.map +1 -0
- package/dist/pregel/utils/index.cjs +102 -0
- 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 +51 -0
- package/dist/pregel/utils/index.d.ts.map +1 -0
- package/dist/pregel/utils/index.js +96 -0
- package/dist/pregel/utils/index.js.map +1 -0
- package/dist/pregel/utils/subgraph.cjs +18 -0
- package/dist/pregel/utils/subgraph.cjs.map +1 -0
- package/dist/pregel/utils/subgraph.js +16 -0
- package/dist/pregel/utils/subgraph.js.map +1 -0
- package/dist/pregel/validate.cjs +45 -0
- package/dist/pregel/validate.cjs.map +1 -0
- package/dist/pregel/validate.js +44 -0
- package/dist/pregel/validate.js.map +1 -0
- package/dist/pregel/write.cjs +96 -0
- package/dist/pregel/write.cjs.map +1 -0
- package/dist/pregel/write.d.cts +31 -0
- package/dist/pregel/write.d.cts.map +1 -0
- package/dist/pregel/write.d.ts +31 -0
- package/dist/pregel/write.d.ts.map +1 -0
- package/dist/pregel/write.js +95 -0
- package/dist/pregel/write.js.map +1 -0
- package/dist/remote.cjs +3 -0
- package/dist/remote.d.cts +2 -0
- package/dist/remote.d.ts +2 -0
- package/dist/remote.js +3 -0
- package/dist/setup/async_local_storage.cjs +11 -0
- package/dist/setup/async_local_storage.cjs.map +1 -0
- package/dist/setup/async_local_storage.js +11 -0
- package/dist/setup/async_local_storage.js.map +1 -0
- package/dist/utils.cjs +86 -0
- package/dist/utils.cjs.map +1 -0
- package/dist/utils.d.cts +25 -0
- package/dist/utils.d.cts.map +1 -0
- package/dist/utils.d.ts +25 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +80 -0
- package/dist/utils.js.map +1 -0
- package/dist/web.cjs +95 -0
- package/dist/web.d.cts +23 -0
- package/dist/web.d.ts +23 -0
- package/dist/web.js +15 -0
- package/dist/writer.cjs +14 -0
- package/dist/writer.cjs.map +1 -0
- package/dist/writer.d.cts +6 -0
- package/dist/writer.d.cts.map +1 -0
- package/dist/writer.d.ts +6 -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 +2 -2
package/dist/hash.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hash.js","names":["n","data"],"sources":["../src/hash.ts"],"sourcesContent":["/* Converted from https://github.com/i404788/xxh3-ts\n\nBSD 2-Clause License\n\nCopyright (c) 2019, i404788\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n1. Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n\n2. Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n*/\n\nconst n = (n: number | string) => BigInt(n);\nconst view = (data: Uint8Array | DataView, offset: number = 0) =>\n new DataView(data.buffer, data.byteOffset + offset, data.byteLength - offset);\n\nconst PRIME32_1 = n(\"0x9E3779B1\"); // 0b10011110001101110111100110110001\nconst PRIME32_2 = n(\"0x85EBCA77\"); // 0b10000101111010111100101001110111\nconst PRIME32_3 = n(\"0xC2B2AE3D\"); // 0b11000010101100101010111000111101\nconst PRIME64_1 = n(\"0x9E3779B185EBCA87\"); // 0b1001111000110111011110011011000110000101111010111100101010000111\nconst PRIME64_2 = n(\"0xC2B2AE3D27D4EB4F\"); // 0b1100001010110010101011100011110100100111110101001110101101001111\nconst PRIME64_3 = n(\"0x165667B19E3779F9\"); // 0b0001011001010110011001111011000110011110001101110111100111111001\nconst PRIME64_4 = n(\"0x85EBCA77C2B2AE63\"); // 0b1000010111101011110010100111011111000010101100101010111001100011\nconst PRIME64_5 = n(\"0x27D4EB2F165667C5\"); // 0b0010011111010100111010110010111100010110010101100110011111000101\nconst PRIME_MX1 = n(\"0x165667919E3779F9\"); // 0b0001011001010110011001111001000110011110001101110111100111111001\nconst PRIME_MX2 = n(\"0x9FB21C651E98DF25\"); // 0b1001111110110010000111000110010100011110100110001101111100100101\n\nconst hexToUint8Array = (hex: string) => {\n const strLen = hex.length;\n if (strLen % 2 !== 0) {\n throw new Error(\"String should have an even number of characters\");\n }\n\n const maxLength = strLen / 2;\n const bytes = new Uint8Array(maxLength);\n\n let read = 0;\n let write = 0;\n while (write < maxLength) {\n const slice = hex.slice(read, (read += 2));\n bytes[write] = Number.parseInt(slice, 16);\n write += 1;\n }\n\n return view(bytes);\n};\n\nconst kkey = hexToUint8Array(\n \"b8fe6c3923a44bbe7c01812cf721ad1cded46de9839097db7240a4a4b7b3671fcb79e64eccc0e578825ad07dccff7221b8084674f743248ee03590e6813a264c3c2852bb91c300cb88d0658b1b532ea371644897a20df94e3819ef46a9deacd8a8fa763fe39c343ff9dcbbc7c70b4f1d8a51e04bcdb45931c89f7ec9d9787364eac5ac8334d3ebc3c581a0fffa1363eb170ddd51b7f0da49d316552629d4689e2b16be587d47a1fc8ff8b8d17ad031ce45cb3a8f95160428afd7fbcabb4b407e\"\n);\n\nconst mask128 = (n(1) << n(128)) - n(1);\nconst mask64 = (n(1) << n(64)) - n(1);\nconst mask32 = (n(1) << n(32)) - n(1);\nconst STRIPE_LEN = 64;\nconst ACC_NB = STRIPE_LEN / 8;\nconst _U64 = 8;\nconst _U32 = 4;\n\nfunction assert(a: boolean) {\n if (!a) throw new Error(\"Assert failed\");\n}\n\nfunction bswap64(a: bigint) {\n const scratchbuf = new DataView(new ArrayBuffer(8));\n scratchbuf.setBigUint64(0, a, true);\n return scratchbuf.getBigUint64(0, false);\n}\n\nfunction bswap32(input: bigint) {\n let a = input;\n a = ((a & n(0x0000ffff)) << n(16)) | ((a & n(0xffff0000)) >> n(16));\n a = ((a & n(0x00ff00ff)) << n(8)) | ((a & n(0xff00ff00)) >> n(8));\n return a; // 32-bit\n}\n\nfunction XXH_mult32to64(a: bigint, b: bigint) {\n return ((a & mask32) * (b & mask32)) & mask64;\n}\n\nfunction rotl32(a: bigint, b: bigint) {\n return ((a << b) | (a >> (n(32) - b))) & mask32;\n}\n\nfunction XXH3_accumulate_512(\n acc: BigUint64Array,\n dataView: DataView,\n keyView: DataView\n) {\n for (let i = 0; i < ACC_NB; i += 1) {\n const data_val = dataView.getBigUint64(i * 8, true);\n const data_key = data_val ^ keyView.getBigUint64(i * 8, true);\n acc[i ^ 1] += data_val;\n acc[i] += XXH_mult32to64(data_key, data_key >> n(32));\n }\n return acc;\n}\n\nfunction XXH3_accumulate(\n acc: BigUint64Array,\n dataView: DataView,\n keyView: DataView,\n nbStripes: number\n) {\n for (let n = 0; n < nbStripes; n += 1) {\n XXH3_accumulate_512(\n acc,\n view(dataView, n * STRIPE_LEN),\n view(keyView, n * 8)\n );\n }\n return acc;\n}\n\nfunction XXH3_scrambleAcc(acc: BigUint64Array, key: DataView) {\n for (let i = 0; i < ACC_NB; i += 1) {\n const key64 = key.getBigUint64(i * 8, true);\n let acc64 = acc[i];\n acc64 = xorshift64(acc64, n(47));\n acc64 ^= key64;\n acc64 *= PRIME32_1;\n acc[i] = acc64 & mask64;\n }\n return acc;\n}\n\nfunction XXH3_mix2Accs(acc: BigUint64Array, key: DataView) {\n return XXH3_mul128_fold64(\n acc[0] ^ key.getBigUint64(0, true),\n acc[1] ^ key.getBigUint64(_U64, true)\n );\n}\n\nfunction XXH3_mergeAccs(acc: BigUint64Array, key: DataView, start: bigint) {\n let result64 = start;\n\n result64 += XXH3_mix2Accs(acc.slice(0), view(key, 0 * _U32));\n result64 += XXH3_mix2Accs(acc.slice(2), view(key, 4 * _U32));\n result64 += XXH3_mix2Accs(acc.slice(4), view(key, 8 * _U32));\n result64 += XXH3_mix2Accs(acc.slice(6), view(key, 12 * _U32));\n\n return XXH3_avalanche(result64 & mask64);\n}\n\nfunction XXH3_hashLong(\n input: BigUint64Array,\n data: DataView,\n secret: DataView,\n f_acc: (acc: BigUint64Array, data: DataView, key: DataView) => BigUint64Array,\n f_scramble: (acc: BigUint64Array, key: DataView) => BigUint64Array\n) {\n let acc = input;\n const nbStripesPerBlock = Math.floor((secret.byteLength - STRIPE_LEN) / 8);\n const block_len = STRIPE_LEN * nbStripesPerBlock;\n const nb_blocks = Math.floor((data.byteLength - 1) / block_len);\n\n for (let n = 0; n < nb_blocks; n += 1) {\n acc = XXH3_accumulate(\n acc,\n view(data, n * block_len),\n secret,\n nbStripesPerBlock\n );\n acc = f_scramble(acc, view(secret, secret.byteLength - STRIPE_LEN));\n }\n\n {\n // Partial block\n const nbStripes = Math.floor(\n (data.byteLength - 1 - block_len * nb_blocks) / STRIPE_LEN\n );\n acc = XXH3_accumulate(\n acc,\n view(data, nb_blocks * block_len),\n secret,\n nbStripes\n );\n\n // Last Stripe\n acc = f_acc(\n acc,\n view(data, data.byteLength - STRIPE_LEN),\n view(secret, secret.byteLength - STRIPE_LEN - 7)\n );\n }\n return acc;\n}\n\nfunction XXH3_hashLong_128b(data: DataView, secret: DataView) {\n let acc = new BigUint64Array([\n PRIME32_3,\n PRIME64_1,\n PRIME64_2,\n PRIME64_3,\n PRIME64_4,\n PRIME32_2,\n PRIME64_5,\n PRIME32_1,\n ]);\n assert(data.byteLength > 128);\n\n acc = XXH3_hashLong(\n acc,\n data,\n secret,\n XXH3_accumulate_512,\n XXH3_scrambleAcc\n ) as BigUint64Array<ArrayBuffer>;\n\n /* converge into final hash */\n assert(acc.length * 8 === 64);\n {\n const low64 = XXH3_mergeAccs(\n acc,\n view(secret, 11),\n (n(data.byteLength) * PRIME64_1) & mask64\n );\n const high64 = XXH3_mergeAccs(\n acc,\n view(secret, secret.byteLength - STRIPE_LEN - 11),\n ~(n(data.byteLength) * PRIME64_2) & mask64\n );\n return (high64 << n(64)) | low64;\n }\n}\n\nfunction XXH3_mul128_fold64(a: bigint, b: bigint) {\n const lll = (a * b) & mask128;\n return (lll & mask64) ^ (lll >> n(64));\n}\n\nfunction XXH3_mix16B(dataView: DataView, keyView: DataView, seed: bigint) {\n return XXH3_mul128_fold64(\n (dataView.getBigUint64(0, true) ^ (keyView.getBigUint64(0, true) + seed)) &\n mask64,\n (dataView.getBigUint64(8, true) ^ (keyView.getBigUint64(8, true) - seed)) &\n mask64\n );\n}\n\nfunction XXH3_mix32B(\n acc: bigint,\n data1: DataView,\n data2: DataView,\n key: DataView,\n seed: bigint\n) {\n let accl = acc & mask64;\n let acch = (acc >> n(64)) & mask64;\n\n accl += XXH3_mix16B(data1, key, seed);\n accl ^= data2.getBigUint64(0, true) + data2.getBigUint64(8, true);\n accl &= mask64;\n acch += XXH3_mix16B(data2, view(key, 16), seed);\n acch ^= data1.getBigUint64(0, true) + data1.getBigUint64(8, true);\n acch &= mask64;\n\n return (acch << n(64)) | accl;\n}\n\nfunction XXH3_avalanche(input: bigint) {\n let h64 = input;\n h64 ^= h64 >> n(37);\n h64 *= PRIME_MX1;\n h64 &= mask64;\n h64 ^= h64 >> n(32);\n return h64;\n}\n\nfunction XXH3_avalanche64(input: bigint) {\n let h64 = input;\n h64 ^= h64 >> n(33);\n h64 *= PRIME64_2;\n h64 &= mask64; // 64-bit\n h64 ^= h64 >> n(29);\n h64 *= PRIME64_3;\n h64 &= mask64;\n h64 ^= h64 >> n(32);\n return h64;\n}\n\nfunction XXH3_len_1to3_128b(data: DataView, key32: DataView, seed: bigint) {\n const len = data.byteLength;\n assert(len > 0 && len <= 3);\n\n const combined =\n n(data.getUint8(len - 1)) |\n n(len << 8) |\n n(data.getUint8(0) << 16) |\n n(data.getUint8(len >> 1) << 24);\n\n const blow =\n (n(key32.getUint32(0, true)) ^ n(key32.getUint32(4, true))) + seed;\n const low = (combined ^ blow) & mask64;\n const bhigh =\n (n(key32.getUint32(8, true)) ^ n(key32.getUint32(12, true))) - seed;\n const high = (rotl32(bswap32(combined), n(13)) ^ bhigh) & mask64;\n\n return ((XXH3_avalanche64(high) & mask64) << n(64)) | XXH3_avalanche64(low);\n}\n\nfunction xorshift64(b: bigint, shift: bigint) {\n return b ^ (b >> shift);\n}\n\nfunction XXH3_len_4to8_128b(data: DataView, key32: DataView, seed: bigint) {\n const len = data.byteLength;\n assert(len >= 4 && len <= 8);\n\n {\n const l1 = data.getUint32(0, true);\n const l2 = data.getUint32(len - 4, true);\n const l64 = n(l1) | (n(l2) << n(32));\n const bitflip =\n ((key32.getBigUint64(16, true) ^ key32.getBigUint64(24, true)) + seed) &\n mask64;\n const keyed = l64 ^ bitflip;\n let m128 = (keyed * (PRIME64_1 + (n(len) << n(2)))) & mask128;\n m128 += (m128 & mask64) << n(65);\n m128 &= mask128;\n m128 ^= m128 >> n(67);\n\n return (\n xorshift64(\n (xorshift64(m128 & mask64, n(35)) * PRIME_MX2) & mask64,\n n(28)\n ) |\n (XXH3_avalanche(m128 >> n(64)) << n(64))\n );\n }\n}\n\nfunction XXH3_len_9to16_128b(data: DataView, key64: DataView, seed: bigint) {\n const len = data.byteLength;\n assert(len >= 9 && len <= 16);\n\n {\n const bitflipl =\n ((key64.getBigUint64(32, true) ^ key64.getBigUint64(40, true)) + seed) &\n mask64;\n const bitfliph =\n ((key64.getBigUint64(48, true) ^ key64.getBigUint64(56, true)) - seed) &\n mask64;\n const ll1 = data.getBigUint64(0, true);\n let ll2 = data.getBigUint64(len - 8, true);\n\n let m128 = (ll1 ^ ll2 ^ bitflipl) * PRIME64_1;\n\n const m128_l = (m128 & mask64) + (n(len - 1) << n(54));\n m128 = (m128 & (mask128 ^ mask64)) | m128_l; // eqv. to adding only to lower 64b\n ll2 ^= bitfliph;\n\n m128 += (ll2 + (ll2 & mask32) * (PRIME32_2 - n(1))) << n(64);\n m128 &= mask128;\n m128 ^= bswap64(m128 >> n(64));\n let h128 = (m128 & mask64) * PRIME64_2;\n h128 += ((m128 >> n(64)) * PRIME64_2) << n(64);\n h128 &= mask128;\n\n return (\n XXH3_avalanche(h128 & mask64) | (XXH3_avalanche(h128 >> n(64)) << n(64))\n );\n }\n}\n\nfunction XXH3_len_0to16_128b(data: DataView, seed: bigint) {\n const len = data.byteLength;\n assert(len <= 16);\n\n if (len > 8) return XXH3_len_9to16_128b(data, kkey, seed);\n if (len >= 4) return XXH3_len_4to8_128b(data, kkey, seed);\n if (len > 0) return XXH3_len_1to3_128b(data, kkey, seed);\n\n return (\n XXH3_avalanche64(\n seed ^ kkey.getBigUint64(64, true) ^ kkey.getBigUint64(72, true)\n ) |\n (XXH3_avalanche64(\n seed ^ kkey.getBigUint64(80, true) ^ kkey.getBigUint64(88, true)\n ) <<\n n(64))\n );\n}\n\nfunction inv64(x: bigint) {\n // NOTE: `AND` fixes signedness (but because of 2's complement we need to re-add 1)\n return (~x + n(1)) & mask64;\n}\n\nfunction XXH3_len_17to128_128b(data: DataView, secret: DataView, seed: bigint) {\n let acc = (n(data.byteLength) * PRIME64_1) & mask64;\n let i = n(data.byteLength - 1) / n(32);\n while (i >= 0) {\n const ni = Number(i);\n acc = XXH3_mix32B(\n acc,\n view(data, 16 * ni),\n view(data, data.byteLength - 16 * (ni + 1)),\n view(secret, 32 * ni),\n seed\n );\n i -= n(1);\n }\n\n let h128l = (acc + (acc >> n(64))) & mask64;\n h128l = XXH3_avalanche(h128l);\n let h128h =\n (acc & mask64) * PRIME64_1 +\n (acc >> n(64)) * PRIME64_4 +\n ((n(data.byteLength) - seed) & mask64) * PRIME64_2;\n h128h &= mask64;\n\n h128h = inv64(XXH3_avalanche(h128h));\n return h128l | (h128h << n(64));\n}\n\nfunction XXH3_len_129to240_128b(\n data: DataView,\n secret: DataView,\n seed: bigint\n) {\n let acc = (n(data.byteLength) * PRIME64_1) & mask64;\n for (let i = 32; i < 160; i += 32) {\n acc = XXH3_mix32B(\n acc,\n view(data, i - 32),\n view(data, i - 16),\n view(secret, i - 32),\n seed\n );\n }\n acc = XXH3_avalanche(acc & mask64) | (XXH3_avalanche(acc >> n(64)) << n(64));\n for (let i = 160; i <= data.byteLength; i += 32) {\n acc = XXH3_mix32B(\n acc,\n view(data, i - 32),\n view(data, i - 16),\n view(secret, 3 + i - 160),\n seed\n );\n }\n acc = XXH3_mix32B(\n acc,\n view(data, data.byteLength - 16),\n view(data, data.byteLength - 32),\n view(secret, 136 - 17 - 16),\n inv64(seed)\n );\n\n let h128l = (acc + (acc >> n(64))) & mask64;\n h128l = XXH3_avalanche(h128l);\n let h128h =\n (acc & mask64) * PRIME64_1 +\n (acc >> n(64)) * PRIME64_4 +\n ((n(data.byteLength) - seed) & mask64) * PRIME64_2;\n h128h &= mask64;\n\n h128h = inv64(XXH3_avalanche(h128h));\n return h128l | (h128h << n(64));\n}\n\n// 16 byte min input\nexport function XXH3(input: Uint8Array | string, seed: bigint = n(0)) {\n const encoder = new TextEncoder();\n const data = view(typeof input === \"string\" ? encoder.encode(input) : input);\n const len = data.byteLength;\n\n const hexDigest = (data: bigint) => data.toString(16).padStart(32, \"0\");\n if (len <= 16) return hexDigest(XXH3_len_0to16_128b(data, seed));\n if (len <= 128) return hexDigest(XXH3_len_17to128_128b(data, kkey, seed));\n if (len <= 240) return hexDigest(XXH3_len_129to240_128b(data, kkey, seed));\n return hexDigest(XXH3_hashLong_128b(data, kkey));\n}\n\nexport function isXXH3(value: string): boolean {\n // Check if the given string matches the format of XXH3 (128 bit hex digest).\n return /^[0-9a-f]{32}$/.test(value);\n}\n"],"mappings":";AA6BA,MAAM,KAAK,QAAuB,OAAOA,IAAE;AAC3C,MAAM,QAAQ,MAA6B,SAAiB,MAC1D,IAAI,SAAS,KAAK,QAAQ,KAAK,aAAa,QAAQ,KAAK,aAAa,OAAO;AAE/E,MAAM,YAAY,EAAE,aAAa;AACjC,MAAM,YAAY,EAAE,aAAa;AACjC,MAAM,YAAY,EAAE,aAAa;AACjC,MAAM,YAAY,EAAE,qBAAqB;AACzC,MAAM,YA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;AAEH,OAAM,YACJ,KACA,KAAK,MAAM,KAAK,aAAa,GAAG,EAChC,KAAK,MAAM,KAAK,aAAa,GAAG,EAChC,KAAK,QAAQ,IAAc,EAC3B,MAAM,KAAK,CACZ;CAED,IAAI,QAAS,OAAO,OAAO,EAAE,GAAG,IAAK;AACrC,SAAQ,eAAe,MAAM;CAC7B,IAAI,SACD,MAAM,UAAU,aAChB,OAAO,EAAE,GAAG,IAAI,aACf,EAAE,KAAK,WAAW,GAAG,OAAQ,UAAU;AAC3C,UAAS;AAET,SAAQ,MAAM,eAAe,MAAM,CAAC;AACpC,QAAO,QAAS,SAAS,EAAE,GAAG;;AAIhC,SAAgB,KAAK,OAA4B,OAAe,EAAE,EAAE,EAAE;CACpE,MAAM,UAAU,IAAI,aAAa;CACjC,MAAM,OAAO,KAAK,OAAO,UAAU,WAAW,QAAQ,OAAO,MAAM,GAAG,MAAM;CAC5E,MAAM,MAAM,KAAK;CAEjB,MAAM,aAAa,WAAiBC,OAAK,SAAS,GAAG,CAAC,SAAS,IAAI,IAAI;AACvE,KAAI,OAAO,GAAI,QAAO,UAAU,oBAAoB,MAAM,KAAK,CAAC;AAChE,KAAI,OAAO,IAAK,QAAO,UAAU,sBAAsB,MAAM,MAAM,KAAK,CAAC;AACzE,KAAI,OAAO,IAAK,QAAO,UAAU,uBAAuB,MAAM,MAAM,KAAK,CAAC;AAC1E,QAAO,UAAU,mBAAmB,MAAM,KAAK,CAAC;;AAGlD,SAAgB,OAAO,OAAwB;AAE7C,QAAO,iBAAiB,KAAK,MAAM"}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
const require_async_local_storage = require('./setup/async_local_storage.cjs');
|
|
2
|
+
const require_errors = require('./errors.cjs');
|
|
3
|
+
const require_base = require('./channels/base.cjs');
|
|
4
|
+
const require_binop = require('./channels/binop.cjs');
|
|
5
|
+
const require_annotation = require('./graph/annotation.cjs');
|
|
6
|
+
const require_constants = require('./constants.cjs');
|
|
7
|
+
const require_config = require('./pregel/utils/config.cjs');
|
|
8
|
+
const require_interrupt = require('./interrupt.cjs');
|
|
9
|
+
const require_graph = require('./graph/graph.cjs');
|
|
10
|
+
const require_state = require('./graph/state.cjs');
|
|
11
|
+
const require_message = require('./graph/message.cjs');
|
|
12
|
+
const require_index = require('./func/index.cjs');
|
|
13
|
+
const require_messages_annotation = require('./graph/messages_annotation.cjs');
|
|
14
|
+
require('./web.cjs');
|
|
15
|
+
const require_writer = require('./writer.cjs');
|
|
16
|
+
let _langchain_langgraph_checkpoint = require("@langchain/langgraph-checkpoint");
|
|
17
|
+
|
|
18
|
+
//#region src/index.ts
|
|
19
|
+
require_async_local_storage.initializeAsyncLocalStorageSingleton();
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
exports.Annotation = require_annotation.Annotation;
|
|
23
|
+
Object.defineProperty(exports, 'AsyncBatchedStore', {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get: function () {
|
|
26
|
+
return _langchain_langgraph_checkpoint.AsyncBatchedStore;
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
exports.BaseChannel = require_base.BaseChannel;
|
|
30
|
+
Object.defineProperty(exports, 'BaseCheckpointSaver', {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _langchain_langgraph_checkpoint.BaseCheckpointSaver;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
exports.BaseLangGraphError = require_errors.BaseLangGraphError;
|
|
37
|
+
Object.defineProperty(exports, 'BaseStore', {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
get: function () {
|
|
40
|
+
return _langchain_langgraph_checkpoint.BaseStore;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
exports.BinaryOperatorAggregate = require_binop.BinaryOperatorAggregate;
|
|
44
|
+
exports.Command = require_constants.Command;
|
|
45
|
+
exports.CompiledStateGraph = require_state.CompiledStateGraph;
|
|
46
|
+
exports.END = require_constants.END;
|
|
47
|
+
exports.EmptyChannelError = require_errors.EmptyChannelError;
|
|
48
|
+
exports.EmptyInputError = require_errors.EmptyInputError;
|
|
49
|
+
exports.Graph = require_graph.Graph;
|
|
50
|
+
exports.GraphBubbleUp = require_errors.GraphBubbleUp;
|
|
51
|
+
exports.GraphInterrupt = require_errors.GraphInterrupt;
|
|
52
|
+
exports.GraphRecursionError = require_errors.GraphRecursionError;
|
|
53
|
+
exports.GraphValueError = require_errors.GraphValueError;
|
|
54
|
+
exports.INTERRUPT = require_constants.INTERRUPT;
|
|
55
|
+
Object.defineProperty(exports, 'InMemoryStore', {
|
|
56
|
+
enumerable: true,
|
|
57
|
+
get: function () {
|
|
58
|
+
return _langchain_langgraph_checkpoint.InMemoryStore;
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
exports.InvalidUpdateError = require_errors.InvalidUpdateError;
|
|
62
|
+
Object.defineProperty(exports, 'MemorySaver', {
|
|
63
|
+
enumerable: true,
|
|
64
|
+
get: function () {
|
|
65
|
+
return _langchain_langgraph_checkpoint.MemorySaver;
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
exports.MessageGraph = require_message.MessageGraph;
|
|
69
|
+
exports.MessagesAnnotation = require_messages_annotation.MessagesAnnotation;
|
|
70
|
+
exports.MessagesZodMeta = require_messages_annotation.MessagesZodMeta;
|
|
71
|
+
exports.MessagesZodState = require_messages_annotation.MessagesZodState;
|
|
72
|
+
exports.MultipleSubgraphsError = require_errors.MultipleSubgraphsError;
|
|
73
|
+
exports.NodeInterrupt = require_errors.NodeInterrupt;
|
|
74
|
+
exports.ParentCommand = require_errors.ParentCommand;
|
|
75
|
+
exports.REMOVE_ALL_MESSAGES = require_message.REMOVE_ALL_MESSAGES;
|
|
76
|
+
exports.RemoteException = require_errors.RemoteException;
|
|
77
|
+
exports.START = require_constants.START;
|
|
78
|
+
exports.Send = require_constants.Send;
|
|
79
|
+
exports.StateGraph = require_state.StateGraph;
|
|
80
|
+
exports.UnreachableNodeError = require_errors.UnreachableNodeError;
|
|
81
|
+
exports.addMessages = require_message.messagesStateReducer;
|
|
82
|
+
Object.defineProperty(exports, 'copyCheckpoint', {
|
|
83
|
+
enumerable: true,
|
|
84
|
+
get: function () {
|
|
85
|
+
return _langchain_langgraph_checkpoint.copyCheckpoint;
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
Object.defineProperty(exports, 'emptyCheckpoint', {
|
|
89
|
+
enumerable: true,
|
|
90
|
+
get: function () {
|
|
91
|
+
return _langchain_langgraph_checkpoint.emptyCheckpoint;
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
exports.entrypoint = require_index.entrypoint;
|
|
95
|
+
exports.getConfig = require_config.getConfig;
|
|
96
|
+
exports.getCurrentTaskInput = require_config.getCurrentTaskInput;
|
|
97
|
+
exports.getPreviousState = require_index.getPreviousState;
|
|
98
|
+
exports.getStore = require_config.getStore;
|
|
99
|
+
exports.getSubgraphsSeenSet = require_errors.getSubgraphsSeenSet;
|
|
100
|
+
exports.getWriter = require_config.getWriter;
|
|
101
|
+
exports.interrupt = require_interrupt.interrupt;
|
|
102
|
+
exports.isCommand = require_constants.isCommand;
|
|
103
|
+
exports.isGraphBubbleUp = require_errors.isGraphBubbleUp;
|
|
104
|
+
exports.isGraphInterrupt = require_errors.isGraphInterrupt;
|
|
105
|
+
exports.isInterrupted = require_constants.isInterrupted;
|
|
106
|
+
exports.isParentCommand = require_errors.isParentCommand;
|
|
107
|
+
exports.messagesStateReducer = require_message.messagesStateReducer;
|
|
108
|
+
exports.pushMessage = require_message.pushMessage;
|
|
109
|
+
exports.task = require_index.task;
|
|
110
|
+
exports.writer = require_writer.writer;
|
|
111
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["initializeAsyncLocalStorageSingleton"],"sources":["../src/index.ts"],"sourcesContent":["/* __LC_ALLOW_ENTRYPOINT_SIDE_EFFECTS__ */\n\nimport { initializeAsyncLocalStorageSingleton } from \"./setup/async_local_storage.js\";\n\n// Initialize global async local storage instance for tracing\ninitializeAsyncLocalStorageSingleton();\n\nexport * from \"./web.js\";\n\nexport { interrupt } from \"./interrupt.js\";\nexport { writer } from \"./writer.js\";\nexport { pushMessage } from \"./graph/message.js\";\nexport { getStore, getWriter, getConfig } from \"./pregel/utils/config.js\";\nexport { getPreviousState } from \"./func/index.js\";\nexport { getCurrentTaskInput } from \"./pregel/utils/config.js\";\n"],"mappings":";;;;;;;;;;;;;;;;;;AAKAA,kEAAsC"}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { BaseChannel } from "./channels/base.cjs";
|
|
2
|
+
import { BinaryOperator, BinaryOperatorAggregate } from "./channels/binop.cjs";
|
|
3
|
+
import { AnyValue } from "./channels/any_value.cjs";
|
|
4
|
+
import { LastValue } from "./channels/last_value.cjs";
|
|
5
|
+
import { DynamicBarrierValue, WaitForNames } from "./channels/dynamic_barrier_value.cjs";
|
|
6
|
+
import { EphemeralValue } from "./channels/ephemeral_value.cjs";
|
|
7
|
+
import { NamedBarrierValue } from "./channels/named_barrier_value.cjs";
|
|
8
|
+
import { Topic } from "./channels/topic.cjs";
|
|
9
|
+
import { LangGraphRunnableConfig, Runtime } from "./pregel/runnable_types.cjs";
|
|
10
|
+
import { Annotation, AnnotationRoot, NodeType, SingleReducer, StateDefinition, StateType, UpdateType } from "./graph/annotation.cjs";
|
|
11
|
+
import { RetryPolicy } from "./pregel/utils/index.cjs";
|
|
12
|
+
import { PregelNode } from "./pregel/read.cjs";
|
|
13
|
+
import { Command, CommandParams, END, INTERRUPT, Interrupt, START, Send, isCommand, isInterrupted } from "./constants.cjs";
|
|
14
|
+
import { GetStateOptions, MultipleChannelSubscriptionOptions, PregelOptions, PregelParams, SingleChannelSubscriptionOptions, StateSnapshot, StreamMode, StreamOutputMap } from "./pregel/types.cjs";
|
|
15
|
+
import { Pregel } from "./pregel/index.cjs";
|
|
16
|
+
import { CompiledGraph, Graph } from "./graph/graph.cjs";
|
|
17
|
+
import { interrupt } from "./interrupt.cjs";
|
|
18
|
+
import { writer } from "./writer.cjs";
|
|
19
|
+
import { CompiledStateGraph, StateGraph, StateGraphArgs } from "./graph/state.cjs";
|
|
20
|
+
import { MessageGraph, Messages, REMOVE_ALL_MESSAGES, messagesStateReducer, pushMessage } from "./graph/message.cjs";
|
|
21
|
+
import { BaseLangGraphError, BaseLangGraphErrorFields, EmptyChannelError, EmptyInputError, GraphBubbleUp, GraphInterrupt, GraphRecursionError, GraphValueError, InvalidUpdateError, MultipleSubgraphsError, NodeInterrupt, ParentCommand, RemoteException, UnreachableNodeError, getSubgraphsSeenSet, isGraphBubbleUp, isGraphInterrupt, isParentCommand } from "./errors.cjs";
|
|
22
|
+
import { EntrypointOptions, TaskOptions, entrypoint, getPreviousState, task } from "./func/index.cjs";
|
|
23
|
+
import { MessagesAnnotation, MessagesZodMeta, MessagesZodState } from "./graph/messages_annotation.cjs";
|
|
24
|
+
import { AsyncBatchedStore, BaseCheckpointSaver, BaseStore, Checkpoint, CheckpointMetadata, CheckpointTuple, GetOperation, InMemoryStore, Item, ListNamespacesOperation, MatchCondition, MemorySaver, NameSpacePath, NamespaceMatchType, Operation, OperationResults, PutOperation, SearchOperation, copyCheckpoint, emptyCheckpoint } from "./web.cjs";
|
|
25
|
+
import { getConfig, getCurrentTaskInput, getStore, getWriter } from "./pregel/utils/config.cjs";
|
|
26
|
+
export { Annotation, AnnotationRoot, AnyValue, AsyncBatchedStore, BaseChannel, BaseCheckpointSaver, BaseLangGraphError, BaseLangGraphErrorFields, BaseStore, BinaryOperator, BinaryOperatorAggregate, Checkpoint, CheckpointMetadata, CheckpointTuple, Command, CommandParams, CompiledGraph, CompiledStateGraph, DynamicBarrierValue, END, EmptyChannelError, EmptyInputError, EntrypointOptions, EphemeralValue, GetOperation, GetStateOptions, Graph, GraphBubbleUp, GraphInterrupt, GraphRecursionError, GraphValueError, INTERRUPT, InMemoryStore, Interrupt, InvalidUpdateError, Item, LangGraphRunnableConfig, LastValue, ListNamespacesOperation, MatchCondition, MemorySaver, MessageGraph, Messages, MessagesAnnotation, MessagesZodMeta, MessagesZodState, MultipleChannelSubscriptionOptions, MultipleSubgraphsError, NameSpacePath, NamedBarrierValue, NamespaceMatchType, NodeInterrupt, NodeType, Operation, OperationResults, ParentCommand, Pregel, PregelNode, PregelOptions, PregelParams, PutOperation, REMOVE_ALL_MESSAGES, RemoteException, RetryPolicy, Runtime, START, SearchOperation, Send, SingleChannelSubscriptionOptions, SingleReducer, StateDefinition, StateGraph, StateGraphArgs, StateSnapshot, StateType, StreamMode, StreamOutputMap, TaskOptions, Topic, UnreachableNodeError, UpdateType, WaitForNames, messagesStateReducer as addMessages, copyCheckpoint, emptyCheckpoint, entrypoint, getConfig, getCurrentTaskInput, getPreviousState, getStore, getSubgraphsSeenSet, getWriter, interrupt, isCommand, isGraphBubbleUp, isGraphInterrupt, isInterrupted, isParentCommand, messagesStateReducer, pushMessage, task, writer };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { BaseChannel } from "./channels/base.js";
|
|
2
|
+
import { BinaryOperator, BinaryOperatorAggregate } from "./channels/binop.js";
|
|
3
|
+
import { AnyValue } from "./channels/any_value.js";
|
|
4
|
+
import { LastValue } from "./channels/last_value.js";
|
|
5
|
+
import { DynamicBarrierValue, WaitForNames } from "./channels/dynamic_barrier_value.js";
|
|
6
|
+
import { EphemeralValue } from "./channels/ephemeral_value.js";
|
|
7
|
+
import { NamedBarrierValue } from "./channels/named_barrier_value.js";
|
|
8
|
+
import { Topic } from "./channels/topic.js";
|
|
9
|
+
import { LangGraphRunnableConfig, Runtime } from "./pregel/runnable_types.js";
|
|
10
|
+
import { Annotation, AnnotationRoot, NodeType, SingleReducer, StateDefinition, StateType, UpdateType } from "./graph/annotation.js";
|
|
11
|
+
import { RetryPolicy } from "./pregel/utils/index.js";
|
|
12
|
+
import { PregelNode } from "./pregel/read.js";
|
|
13
|
+
import { Command, CommandParams, END, INTERRUPT, Interrupt, START, Send, isCommand, isInterrupted } from "./constants.js";
|
|
14
|
+
import { GetStateOptions, MultipleChannelSubscriptionOptions, PregelOptions, PregelParams, SingleChannelSubscriptionOptions, StateSnapshot, StreamMode, StreamOutputMap } from "./pregel/types.js";
|
|
15
|
+
import { Pregel } from "./pregel/index.js";
|
|
16
|
+
import { CompiledGraph, Graph } from "./graph/graph.js";
|
|
17
|
+
import { interrupt } from "./interrupt.js";
|
|
18
|
+
import { writer } from "./writer.js";
|
|
19
|
+
import { CompiledStateGraph, StateGraph, StateGraphArgs } from "./graph/state.js";
|
|
20
|
+
import { MessageGraph, Messages, REMOVE_ALL_MESSAGES, messagesStateReducer, pushMessage } from "./graph/message.js";
|
|
21
|
+
import { BaseLangGraphError, BaseLangGraphErrorFields, EmptyChannelError, EmptyInputError, GraphBubbleUp, GraphInterrupt, GraphRecursionError, GraphValueError, InvalidUpdateError, MultipleSubgraphsError, NodeInterrupt, ParentCommand, RemoteException, UnreachableNodeError, getSubgraphsSeenSet, isGraphBubbleUp, isGraphInterrupt, isParentCommand } from "./errors.js";
|
|
22
|
+
import { EntrypointOptions, TaskOptions, entrypoint, getPreviousState, task } from "./func/index.js";
|
|
23
|
+
import { MessagesAnnotation, MessagesZodMeta, MessagesZodState } from "./graph/messages_annotation.js";
|
|
24
|
+
import { AsyncBatchedStore, BaseCheckpointSaver, BaseStore, Checkpoint, CheckpointMetadata, CheckpointTuple, GetOperation, InMemoryStore, Item, ListNamespacesOperation, MatchCondition, MemorySaver, NameSpacePath, NamespaceMatchType, Operation, OperationResults, PutOperation, SearchOperation, copyCheckpoint, emptyCheckpoint } from "./web.js";
|
|
25
|
+
import { getConfig, getCurrentTaskInput, getStore, getWriter } from "./pregel/utils/config.js";
|
|
26
|
+
export { Annotation, AnnotationRoot, AnyValue, AsyncBatchedStore, BaseChannel, BaseCheckpointSaver, BaseLangGraphError, BaseLangGraphErrorFields, BaseStore, BinaryOperator, BinaryOperatorAggregate, Checkpoint, CheckpointMetadata, CheckpointTuple, Command, CommandParams, CompiledGraph, CompiledStateGraph, DynamicBarrierValue, END, EmptyChannelError, EmptyInputError, EntrypointOptions, EphemeralValue, GetOperation, GetStateOptions, Graph, GraphBubbleUp, GraphInterrupt, GraphRecursionError, GraphValueError, INTERRUPT, InMemoryStore, Interrupt, InvalidUpdateError, Item, LangGraphRunnableConfig, LastValue, ListNamespacesOperation, MatchCondition, MemorySaver, MessageGraph, Messages, MessagesAnnotation, MessagesZodMeta, MessagesZodState, MultipleChannelSubscriptionOptions, MultipleSubgraphsError, NameSpacePath, NamedBarrierValue, NamespaceMatchType, NodeInterrupt, NodeType, Operation, OperationResults, ParentCommand, Pregel, PregelNode, PregelOptions, PregelParams, PutOperation, REMOVE_ALL_MESSAGES, RemoteException, RetryPolicy, Runtime, START, SearchOperation, Send, SingleChannelSubscriptionOptions, SingleReducer, StateDefinition, StateGraph, StateGraphArgs, StateSnapshot, StateType, StreamMode, StreamOutputMap, TaskOptions, Topic, UnreachableNodeError, UpdateType, WaitForNames, messagesStateReducer as addMessages, copyCheckpoint, emptyCheckpoint, entrypoint, getConfig, getCurrentTaskInput, getPreviousState, getStore, getSubgraphsSeenSet, getWriter, interrupt, isCommand, isGraphBubbleUp, isGraphInterrupt, isInterrupted, isParentCommand, messagesStateReducer, pushMessage, task, writer };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { initializeAsyncLocalStorageSingleton } from "./setup/async_local_storage.js";
|
|
2
|
+
import { BaseLangGraphError, EmptyChannelError, EmptyInputError, GraphBubbleUp, GraphInterrupt, GraphRecursionError, GraphValueError, InvalidUpdateError, MultipleSubgraphsError, NodeInterrupt, ParentCommand, RemoteException, UnreachableNodeError, getSubgraphsSeenSet, isGraphBubbleUp, isGraphInterrupt, isParentCommand } from "./errors.js";
|
|
3
|
+
import { BaseChannel } from "./channels/base.js";
|
|
4
|
+
import { BinaryOperatorAggregate } from "./channels/binop.js";
|
|
5
|
+
import { Annotation } from "./graph/annotation.js";
|
|
6
|
+
import { Command, END, INTERRUPT, START, Send, isCommand, isInterrupted } from "./constants.js";
|
|
7
|
+
import { getConfig, getCurrentTaskInput, getStore, getWriter } from "./pregel/utils/config.js";
|
|
8
|
+
import { interrupt } from "./interrupt.js";
|
|
9
|
+
import { Graph } from "./graph/graph.js";
|
|
10
|
+
import { CompiledStateGraph, StateGraph } from "./graph/state.js";
|
|
11
|
+
import { MessageGraph, REMOVE_ALL_MESSAGES, messagesStateReducer, pushMessage } from "./graph/message.js";
|
|
12
|
+
import { entrypoint, getPreviousState, task } from "./func/index.js";
|
|
13
|
+
import { MessagesAnnotation, MessagesZodMeta, MessagesZodState } from "./graph/messages_annotation.js";
|
|
14
|
+
import { AsyncBatchedStore, BaseCheckpointSaver, BaseStore, InMemoryStore, MemorySaver, copyCheckpoint, emptyCheckpoint } from "./web.js";
|
|
15
|
+
import { writer } from "./writer.js";
|
|
16
|
+
|
|
17
|
+
//#region src/index.ts
|
|
18
|
+
initializeAsyncLocalStorageSingleton();
|
|
19
|
+
|
|
20
|
+
//#endregion
|
|
21
|
+
export { Annotation, AsyncBatchedStore, BaseChannel, BaseCheckpointSaver, BaseLangGraphError, BaseStore, BinaryOperatorAggregate, Command, CompiledStateGraph, END, EmptyChannelError, EmptyInputError, Graph, GraphBubbleUp, GraphInterrupt, GraphRecursionError, GraphValueError, INTERRUPT, InMemoryStore, InvalidUpdateError, MemorySaver, MessageGraph, MessagesAnnotation, MessagesZodMeta, MessagesZodState, MultipleSubgraphsError, NodeInterrupt, ParentCommand, REMOVE_ALL_MESSAGES, RemoteException, START, Send, StateGraph, UnreachableNodeError, messagesStateReducer as addMessages, copyCheckpoint, emptyCheckpoint, entrypoint, getConfig, getCurrentTaskInput, getPreviousState, getStore, getSubgraphsSeenSet, getWriter, interrupt, isCommand, isGraphBubbleUp, isGraphInterrupt, isInterrupted, isParentCommand, messagesStateReducer, pushMessage, task, writer };
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["/* __LC_ALLOW_ENTRYPOINT_SIDE_EFFECTS__ */\n\nimport { initializeAsyncLocalStorageSingleton } from \"./setup/async_local_storage.js\";\n\n// Initialize global async local storage instance for tracing\ninitializeAsyncLocalStorageSingleton();\n\nexport * from \"./web.js\";\n\nexport { interrupt } from \"./interrupt.js\";\nexport { writer } from \"./writer.js\";\nexport { pushMessage } from \"./graph/message.js\";\nexport { getStore, getWriter, getConfig } from \"./pregel/utils/config.js\";\nexport { getPreviousState } from \"./func/index.js\";\nexport { getCurrentTaskInput } from \"./pregel/utils/config.js\";\n"],"mappings":";;;;;;;;;;;;;;;;;AAKA,sCAAsC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
const require_errors = require('./errors.cjs');
|
|
2
|
+
const require_constants = require('./constants.cjs');
|
|
3
|
+
const require_hash = require('./hash.cjs');
|
|
4
|
+
let _langchain_core_singletons = require("@langchain/core/singletons");
|
|
5
|
+
|
|
6
|
+
//#region src/interrupt.ts
|
|
7
|
+
/**
|
|
8
|
+
* Interrupts the execution of a graph node.
|
|
9
|
+
* This function can be used to pause execution of a node, and return the value of the `resume`
|
|
10
|
+
* input when the graph is re-invoked using `Command`.
|
|
11
|
+
* Multiple interrupts can be called within a single node, and each will be handled sequentially.
|
|
12
|
+
*
|
|
13
|
+
* When an interrupt is called:
|
|
14
|
+
* 1. If there's a `resume` value available (from a previous `Command`), it returns that value.
|
|
15
|
+
* 2. Otherwise, it throws a `GraphInterrupt` with the provided value
|
|
16
|
+
* 3. The graph can be resumed by passing a `Command` with a `resume` value
|
|
17
|
+
*
|
|
18
|
+
* Because the `interrupt` function propagates by throwing a special `GraphInterrupt` error,
|
|
19
|
+
* you should avoid using `try/catch` blocks around the `interrupt` function,
|
|
20
|
+
* or if you do, ensure that the `GraphInterrupt` error is thrown again within your `catch` block.
|
|
21
|
+
*
|
|
22
|
+
* @param value - The value to include in the interrupt. This will be available in task.interrupts[].value
|
|
23
|
+
* @returns The `resume` value provided when the graph is re-invoked with a Command
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* // Define a node that uses multiple interrupts
|
|
28
|
+
* const nodeWithInterrupts = () => {
|
|
29
|
+
* // First interrupt - will pause execution and include {value: 1} in task values
|
|
30
|
+
* const answer1 = interrupt({ value: 1 });
|
|
31
|
+
*
|
|
32
|
+
* // Second interrupt - only called after first interrupt is resumed
|
|
33
|
+
* const answer2 = interrupt({ value: 2 });
|
|
34
|
+
*
|
|
35
|
+
* // Use the resume values
|
|
36
|
+
* return { myKey: answer1 + " " + answer2 };
|
|
37
|
+
* };
|
|
38
|
+
*
|
|
39
|
+
* // Resume the graph after first interrupt
|
|
40
|
+
* await graph.stream(new Command({ resume: "answer 1" }));
|
|
41
|
+
*
|
|
42
|
+
* // Resume the graph after second interrupt
|
|
43
|
+
* await graph.stream(new Command({ resume: "answer 2" }));
|
|
44
|
+
* // Final result: { myKey: "answer 1 answer 2" }
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* @throws {Error} If called outside the context of a graph
|
|
48
|
+
* @throws {GraphInterrupt} When no resume value is available
|
|
49
|
+
*/
|
|
50
|
+
function interrupt(value) {
|
|
51
|
+
const config = _langchain_core_singletons.AsyncLocalStorageProviderSingleton.getRunnableConfig();
|
|
52
|
+
if (!config) throw new Error("Called interrupt() outside the context of a graph.");
|
|
53
|
+
const conf = config.configurable;
|
|
54
|
+
if (!conf) throw new Error("No configurable found in config");
|
|
55
|
+
if (!conf[require_constants.CONFIG_KEY_CHECKPOINTER]) throw new require_errors.GraphValueError("No checkpointer set", { lc_error_code: "MISSING_CHECKPOINTER" });
|
|
56
|
+
const scratchpad = conf[require_constants.CONFIG_KEY_SCRATCHPAD];
|
|
57
|
+
scratchpad.interruptCounter += 1;
|
|
58
|
+
const idx = scratchpad.interruptCounter;
|
|
59
|
+
if (scratchpad.resume.length > 0 && idx < scratchpad.resume.length) {
|
|
60
|
+
conf[require_constants.CONFIG_KEY_SEND]?.([[require_constants.RESUME, scratchpad.resume]]);
|
|
61
|
+
return scratchpad.resume[idx];
|
|
62
|
+
}
|
|
63
|
+
if (scratchpad.nullResume !== void 0) {
|
|
64
|
+
if (scratchpad.resume.length !== idx) throw new Error(`Resume length mismatch: ${scratchpad.resume.length} !== ${idx}`);
|
|
65
|
+
const v = scratchpad.consumeNullResume();
|
|
66
|
+
scratchpad.resume.push(v);
|
|
67
|
+
conf[require_constants.CONFIG_KEY_SEND]?.([[require_constants.RESUME, scratchpad.resume]]);
|
|
68
|
+
return v;
|
|
69
|
+
}
|
|
70
|
+
const ns = conf[require_constants.CONFIG_KEY_CHECKPOINT_NS]?.split(require_constants.CHECKPOINT_NAMESPACE_SEPARATOR);
|
|
71
|
+
throw new require_errors.GraphInterrupt([{
|
|
72
|
+
id: ns ? require_hash.XXH3(ns.join(require_constants.CHECKPOINT_NAMESPACE_SEPARATOR)) : void 0,
|
|
73
|
+
value
|
|
74
|
+
}]);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
//#endregion
|
|
78
|
+
exports.interrupt = interrupt;
|
|
79
|
+
//# sourceMappingURL=interrupt.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interrupt.cjs","names":["AsyncLocalStorageProviderSingleton","CONFIG_KEY_CHECKPOINTER","GraphValueError","CONFIG_KEY_SCRATCHPAD","CONFIG_KEY_SEND","RESUME","CONFIG_KEY_CHECKPOINT_NS","CHECKPOINT_NAMESPACE_SEPARATOR","GraphInterrupt","XXH3"],"sources":["../src/interrupt.ts"],"sourcesContent":["import { AsyncLocalStorageProviderSingleton } from \"@langchain/core/singletons\";\nimport { RunnableConfig } from \"@langchain/core/runnables\";\nimport {\n BaseCheckpointSaver,\n type PendingWrite,\n} from \"@langchain/langgraph-checkpoint\";\nimport { GraphInterrupt, GraphValueError } from \"./errors.js\";\nimport {\n CONFIG_KEY_CHECKPOINT_NS,\n CONFIG_KEY_SCRATCHPAD,\n CONFIG_KEY_SEND,\n CONFIG_KEY_CHECKPOINTER,\n CHECKPOINT_NAMESPACE_SEPARATOR,\n RESUME,\n} from \"./constants.js\";\nimport { PregelScratchpad } from \"./pregel/types.js\";\nimport { XXH3 } from \"./hash.js\";\n\n/**\n * Interrupts the execution of a graph node.\n * This function can be used to pause execution of a node, and return the value of the `resume`\n * input when the graph is re-invoked using `Command`.\n * Multiple interrupts can be called within a single node, and each will be handled sequentially.\n *\n * When an interrupt is called:\n * 1. If there's a `resume` value available (from a previous `Command`), it returns that value.\n * 2. Otherwise, it throws a `GraphInterrupt` with the provided value\n * 3. The graph can be resumed by passing a `Command` with a `resume` value\n *\n * Because the `interrupt` function propagates by throwing a special `GraphInterrupt` error,\n * you should avoid using `try/catch` blocks around the `interrupt` function,\n * or if you do, ensure that the `GraphInterrupt` error is thrown again within your `catch` block.\n *\n * @param value - The value to include in the interrupt. This will be available in task.interrupts[].value\n * @returns The `resume` value provided when the graph is re-invoked with a Command\n *\n * @example\n * ```typescript\n * // Define a node that uses multiple interrupts\n * const nodeWithInterrupts = () => {\n * // First interrupt - will pause execution and include {value: 1} in task values\n * const answer1 = interrupt({ value: 1 });\n *\n * // Second interrupt - only called after first interrupt is resumed\n * const answer2 = interrupt({ value: 2 });\n *\n * // Use the resume values\n * return { myKey: answer1 + \" \" + answer2 };\n * };\n *\n * // Resume the graph after first interrupt\n * await graph.stream(new Command({ resume: \"answer 1\" }));\n *\n * // Resume the graph after second interrupt\n * await graph.stream(new Command({ resume: \"answer 2\" }));\n * // Final result: { myKey: \"answer 1 answer 2\" }\n * ```\n *\n * @throws {Error} If called outside the context of a graph\n * @throws {GraphInterrupt} When no resume value is available\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function interrupt<I = unknown, R = any>(value: I): R {\n const config: RunnableConfig | undefined =\n AsyncLocalStorageProviderSingleton.getRunnableConfig();\n if (!config) {\n throw new Error(\"Called interrupt() outside the context of a graph.\");\n }\n\n const conf = config.configurable;\n if (!conf) {\n throw new Error(\"No configurable found in config\");\n }\n\n const checkpointer: BaseCheckpointSaver = conf[CONFIG_KEY_CHECKPOINTER];\n if (!checkpointer) {\n throw new GraphValueError(\"No checkpointer set\", {\n lc_error_code: \"MISSING_CHECKPOINTER\",\n });\n }\n\n // Track interrupt index\n const scratchpad: PregelScratchpad = conf[CONFIG_KEY_SCRATCHPAD];\n scratchpad.interruptCounter += 1;\n const idx = scratchpad.interruptCounter;\n\n // Find previous resume values\n if (scratchpad.resume.length > 0 && idx < scratchpad.resume.length) {\n conf[CONFIG_KEY_SEND]?.([[RESUME, scratchpad.resume] as PendingWrite]);\n return scratchpad.resume[idx] as R;\n }\n\n // Find current resume value\n if (scratchpad.nullResume !== undefined) {\n if (scratchpad.resume.length !== idx) {\n throw new Error(\n `Resume length mismatch: ${scratchpad.resume.length} !== ${idx}`\n );\n }\n const v = scratchpad.consumeNullResume();\n scratchpad.resume.push(v);\n conf[CONFIG_KEY_SEND]?.([[RESUME, scratchpad.resume] as PendingWrite]);\n return v as R;\n }\n\n // No resume value found\n const ns: string[] | undefined = conf[CONFIG_KEY_CHECKPOINT_NS]?.split(\n CHECKPOINT_NAMESPACE_SEPARATOR\n );\n\n const id = ns ? XXH3(ns.join(CHECKPOINT_NAMESPACE_SEPARATOR)) : undefined;\n throw new GraphInterrupt([{ id, value }]);\n}\n\ntype FilterAny<X> = (<T>() => T extends X ? 1 : 2) extends <\n T\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n>() => T extends any ? 1 : 2\n ? never\n : X;\n\nexport type InferInterruptInputType<T> = T extends typeof interrupt<\n infer I,\n unknown\n>\n ? I\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\n T extends { [key: string]: typeof interrupt<any, any> }\n ? { [K in keyof T]: InferInterruptInputType<T[K]> }[keyof T]\n : unknown;\n\nexport type InferInterruptResumeType<\n T,\n TInner = false\n> = T extends typeof interrupt<never, infer R>\n ? TInner extends true\n ? FilterAny<R>\n : R\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\n T extends { [key: string]: typeof interrupt<any, any> }\n ? { [K in keyof T]: InferInterruptResumeType<T[K], true> }[keyof T]\n : unknown;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8DA,SAAgB,UAAgC,OAAa;CAC3D,MAAM,SACJA,8DAAmC,mBAAmB;AACxD,KAAI,CAAC,OACH,OAAM,IAAI,MAAM,qDAAqD;CAGvE,MAAM,OAAO,OAAO;AACpB,KAAI,CAAC,KACH,OAAM,IAAI,MAAM,kCAAkC;AAIpD,KAAI,CADsC,KAAKC,2CAE7C,OAAM,IAAIC,+BAAgB,uBAAuB,EAC/C,eAAe,wBAChB,CAAC;CAIJ,MAAM,aAA+B,KAAKC;AAC1C,YAAW,oBAAoB;CAC/B,MAAM,MAAM,WAAW;AAGvB,KAAI,WAAW,OAAO,SAAS,KAAK,MAAM,WAAW,OAAO,QAAQ;AAClE,OAAKC,qCAAmB,CAAC,CAACC,0BAAQ,WAAW,OAAO,CAAiB,CAAC;AACtE,SAAO,WAAW,OAAO;;AAI3B,KAAI,WAAW,eAAe,QAAW;AACvC,MAAI,WAAW,OAAO,WAAW,IAC/B,OAAM,IAAI,MACR,2BAA2B,WAAW,OAAO,OAAO,OAAO,MAC5D;EAEH,MAAM,IAAI,WAAW,mBAAmB;AACxC,aAAW,OAAO,KAAK,EAAE;AACzB,OAAKD,qCAAmB,CAAC,CAACC,0BAAQ,WAAW,OAAO,CAAiB,CAAC;AACtE,SAAO;;CAIT,MAAM,KAA2B,KAAKC,6CAA2B,MAC/DC,iDACD;AAGD,OAAM,IAAIC,8BAAe,CAAC;EAAE,IADjB,KAAKC,kBAAK,GAAG,KAAKF,iDAA+B,CAAC,GAAG;EAChC;EAAO,CAAC,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
//#region src/interrupt.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Interrupts the execution of a graph node.
|
|
4
|
+
* This function can be used to pause execution of a node, and return the value of the `resume`
|
|
5
|
+
* input when the graph is re-invoked using `Command`.
|
|
6
|
+
* Multiple interrupts can be called within a single node, and each will be handled sequentially.
|
|
7
|
+
*
|
|
8
|
+
* When an interrupt is called:
|
|
9
|
+
* 1. If there's a `resume` value available (from a previous `Command`), it returns that value.
|
|
10
|
+
* 2. Otherwise, it throws a `GraphInterrupt` with the provided value
|
|
11
|
+
* 3. The graph can be resumed by passing a `Command` with a `resume` value
|
|
12
|
+
*
|
|
13
|
+
* Because the `interrupt` function propagates by throwing a special `GraphInterrupt` error,
|
|
14
|
+
* you should avoid using `try/catch` blocks around the `interrupt` function,
|
|
15
|
+
* or if you do, ensure that the `GraphInterrupt` error is thrown again within your `catch` block.
|
|
16
|
+
*
|
|
17
|
+
* @param value - The value to include in the interrupt. This will be available in task.interrupts[].value
|
|
18
|
+
* @returns The `resume` value provided when the graph is re-invoked with a Command
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* // Define a node that uses multiple interrupts
|
|
23
|
+
* const nodeWithInterrupts = () => {
|
|
24
|
+
* // First interrupt - will pause execution and include {value: 1} in task values
|
|
25
|
+
* const answer1 = interrupt({ value: 1 });
|
|
26
|
+
*
|
|
27
|
+
* // Second interrupt - only called after first interrupt is resumed
|
|
28
|
+
* const answer2 = interrupt({ value: 2 });
|
|
29
|
+
*
|
|
30
|
+
* // Use the resume values
|
|
31
|
+
* return { myKey: answer1 + " " + answer2 };
|
|
32
|
+
* };
|
|
33
|
+
*
|
|
34
|
+
* // Resume the graph after first interrupt
|
|
35
|
+
* await graph.stream(new Command({ resume: "answer 1" }));
|
|
36
|
+
*
|
|
37
|
+
* // Resume the graph after second interrupt
|
|
38
|
+
* await graph.stream(new Command({ resume: "answer 2" }));
|
|
39
|
+
* // Final result: { myKey: "answer 1 answer 2" }
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @throws {Error} If called outside the context of a graph
|
|
43
|
+
* @throws {GraphInterrupt} When no resume value is available
|
|
44
|
+
*/
|
|
45
|
+
declare function interrupt<I = unknown, R = any>(value: I): R;
|
|
46
|
+
type FilterAny<X> = (<T>() => T extends X ? 1 : 2) extends (<T>() => (T extends any ? 1 : 2)) ? never : X;
|
|
47
|
+
type InferInterruptInputType<T> = T extends typeof interrupt<infer I, unknown> ? I : T extends {
|
|
48
|
+
[key: string]: typeof interrupt<any, any>;
|
|
49
|
+
} ? { [K in keyof T]: InferInterruptInputType<T[K]> }[keyof T] : unknown;
|
|
50
|
+
type InferInterruptResumeType<T, TInner = false> = T extends typeof interrupt<never, infer R> ? TInner extends true ? FilterAny<R> : R : T extends {
|
|
51
|
+
[key: string]: typeof interrupt<any, any>;
|
|
52
|
+
} ? { [K in keyof T]: InferInterruptResumeType<T[K], true> }[keyof T] : unknown;
|
|
53
|
+
//#endregion
|
|
54
|
+
export { InferInterruptInputType, InferInterruptResumeType, interrupt };
|
|
55
|
+
//# sourceMappingURL=interrupt.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interrupt.d.cts","names":["interrupt","I","R","FilterAny","T","X","InferInterruptInputType","K","InferInterruptResumeType","TInner"],"sources":["../src/interrupt.d.ts"],"sourcesContent":["/**\n * Interrupts the execution of a graph node.\n * This function can be used to pause execution of a node, and return the value of the `resume`\n * input when the graph is re-invoked using `Command`.\n * Multiple interrupts can be called within a single node, and each will be handled sequentially.\n *\n * When an interrupt is called:\n * 1. If there's a `resume` value available (from a previous `Command`), it returns that value.\n * 2. Otherwise, it throws a `GraphInterrupt` with the provided value\n * 3. The graph can be resumed by passing a `Command` with a `resume` value\n *\n * Because the `interrupt` function propagates by throwing a special `GraphInterrupt` error,\n * you should avoid using `try/catch` blocks around the `interrupt` function,\n * or if you do, ensure that the `GraphInterrupt` error is thrown again within your `catch` block.\n *\n * @param value - The value to include in the interrupt. This will be available in task.interrupts[].value\n * @returns The `resume` value provided when the graph is re-invoked with a Command\n *\n * @example\n * ```typescript\n * // Define a node that uses multiple interrupts\n * const nodeWithInterrupts = () => {\n * // First interrupt - will pause execution and include {value: 1} in task values\n * const answer1 = interrupt({ value: 1 });\n *\n * // Second interrupt - only called after first interrupt is resumed\n * const answer2 = interrupt({ value: 2 });\n *\n * // Use the resume values\n * return { myKey: answer1 + \" \" + answer2 };\n * };\n *\n * // Resume the graph after first interrupt\n * await graph.stream(new Command({ resume: \"answer 1\" }));\n *\n * // Resume the graph after second interrupt\n * await graph.stream(new Command({ resume: \"answer 2\" }));\n * // Final result: { myKey: \"answer 1 answer 2\" }\n * ```\n *\n * @throws {Error} If called outside the context of a graph\n * @throws {GraphInterrupt} When no resume value is available\n */\nexport declare function interrupt<I = unknown, R = any>(value: I): R;\ntype FilterAny<X> = (<T>() => T extends X ? 1 : 2) extends <T>() => (T extends any ? 1 : 2) ? never : X;\nexport type InferInterruptInputType<T> = T extends typeof interrupt<infer I, unknown> ? I : T extends {\n [key: string]: typeof interrupt<any, any>;\n} ? {\n [K in keyof T]: InferInterruptInputType<T[K]>;\n}[keyof T] : unknown;\nexport type InferInterruptResumeType<T, TInner = false> = T extends typeof interrupt<never, infer R> ? TInner extends true ? FilterAny<R> : R : T extends {\n [key: string]: typeof interrupt<any, any>;\n} ? {\n [K in keyof T]: InferInterruptResumeType<T[K], true>;\n}[keyof T] : unknown;\nexport {};\n"],"mappings":";;AA2CA;;;;;AAAqE;;;;;;;AAErE;;;;;;;;;;;;;AAKA;;;;;;;;;;;;;;;;;iBAPwBA,uCAAuCC,IAAIC;KAC9DC,yBAAyBC,UAAUC,8BAA6BD,kCAAiCC;KAC1FC,6BAA6BF,iBAAiBJ,8BAA8BC,IAAIG;wBAClEJ;kBAEVI,IAAIE,wBAAwBF,EAAEG,YACtCH;KACII,8CAA8CJ,iBAAiBJ,4BAA4BS,sBAAsBN,UAAUD,KAAKA,IAAIE;wBACtHJ;kBAEVI,IAAII,yBAAyBJ,EAAEG,kBACvCH"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
//#region src/interrupt.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Interrupts the execution of a graph node.
|
|
4
|
+
* This function can be used to pause execution of a node, and return the value of the `resume`
|
|
5
|
+
* input when the graph is re-invoked using `Command`.
|
|
6
|
+
* Multiple interrupts can be called within a single node, and each will be handled sequentially.
|
|
7
|
+
*
|
|
8
|
+
* When an interrupt is called:
|
|
9
|
+
* 1. If there's a `resume` value available (from a previous `Command`), it returns that value.
|
|
10
|
+
* 2. Otherwise, it throws a `GraphInterrupt` with the provided value
|
|
11
|
+
* 3. The graph can be resumed by passing a `Command` with a `resume` value
|
|
12
|
+
*
|
|
13
|
+
* Because the `interrupt` function propagates by throwing a special `GraphInterrupt` error,
|
|
14
|
+
* you should avoid using `try/catch` blocks around the `interrupt` function,
|
|
15
|
+
* or if you do, ensure that the `GraphInterrupt` error is thrown again within your `catch` block.
|
|
16
|
+
*
|
|
17
|
+
* @param value - The value to include in the interrupt. This will be available in task.interrupts[].value
|
|
18
|
+
* @returns The `resume` value provided when the graph is re-invoked with a Command
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* // Define a node that uses multiple interrupts
|
|
23
|
+
* const nodeWithInterrupts = () => {
|
|
24
|
+
* // First interrupt - will pause execution and include {value: 1} in task values
|
|
25
|
+
* const answer1 = interrupt({ value: 1 });
|
|
26
|
+
*
|
|
27
|
+
* // Second interrupt - only called after first interrupt is resumed
|
|
28
|
+
* const answer2 = interrupt({ value: 2 });
|
|
29
|
+
*
|
|
30
|
+
* // Use the resume values
|
|
31
|
+
* return { myKey: answer1 + " " + answer2 };
|
|
32
|
+
* };
|
|
33
|
+
*
|
|
34
|
+
* // Resume the graph after first interrupt
|
|
35
|
+
* await graph.stream(new Command({ resume: "answer 1" }));
|
|
36
|
+
*
|
|
37
|
+
* // Resume the graph after second interrupt
|
|
38
|
+
* await graph.stream(new Command({ resume: "answer 2" }));
|
|
39
|
+
* // Final result: { myKey: "answer 1 answer 2" }
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @throws {Error} If called outside the context of a graph
|
|
43
|
+
* @throws {GraphInterrupt} When no resume value is available
|
|
44
|
+
*/
|
|
45
|
+
declare function interrupt<I = unknown, R = any>(value: I): R;
|
|
46
|
+
type FilterAny<X> = (<T>() => T extends X ? 1 : 2) extends (<T>() => (T extends any ? 1 : 2)) ? never : X;
|
|
47
|
+
type InferInterruptInputType<T> = T extends typeof interrupt<infer I, unknown> ? I : T extends {
|
|
48
|
+
[key: string]: typeof interrupt<any, any>;
|
|
49
|
+
} ? { [K in keyof T]: InferInterruptInputType<T[K]> }[keyof T] : unknown;
|
|
50
|
+
type InferInterruptResumeType<T, TInner = false> = T extends typeof interrupt<never, infer R> ? TInner extends true ? FilterAny<R> : R : T extends {
|
|
51
|
+
[key: string]: typeof interrupt<any, any>;
|
|
52
|
+
} ? { [K in keyof T]: InferInterruptResumeType<T[K], true> }[keyof T] : unknown;
|
|
53
|
+
//#endregion
|
|
54
|
+
export { InferInterruptInputType, InferInterruptResumeType, interrupt };
|
|
55
|
+
//# sourceMappingURL=interrupt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interrupt.d.ts","names":["interrupt","I","R","FilterAny","T","X","InferInterruptInputType","K","InferInterruptResumeType","TInner"],"sources":["../src/interrupt.d.ts"],"sourcesContent":["/**\n * Interrupts the execution of a graph node.\n * This function can be used to pause execution of a node, and return the value of the `resume`\n * input when the graph is re-invoked using `Command`.\n * Multiple interrupts can be called within a single node, and each will be handled sequentially.\n *\n * When an interrupt is called:\n * 1. If there's a `resume` value available (from a previous `Command`), it returns that value.\n * 2. Otherwise, it throws a `GraphInterrupt` with the provided value\n * 3. The graph can be resumed by passing a `Command` with a `resume` value\n *\n * Because the `interrupt` function propagates by throwing a special `GraphInterrupt` error,\n * you should avoid using `try/catch` blocks around the `interrupt` function,\n * or if you do, ensure that the `GraphInterrupt` error is thrown again within your `catch` block.\n *\n * @param value - The value to include in the interrupt. This will be available in task.interrupts[].value\n * @returns The `resume` value provided when the graph is re-invoked with a Command\n *\n * @example\n * ```typescript\n * // Define a node that uses multiple interrupts\n * const nodeWithInterrupts = () => {\n * // First interrupt - will pause execution and include {value: 1} in task values\n * const answer1 = interrupt({ value: 1 });\n *\n * // Second interrupt - only called after first interrupt is resumed\n * const answer2 = interrupt({ value: 2 });\n *\n * // Use the resume values\n * return { myKey: answer1 + \" \" + answer2 };\n * };\n *\n * // Resume the graph after first interrupt\n * await graph.stream(new Command({ resume: \"answer 1\" }));\n *\n * // Resume the graph after second interrupt\n * await graph.stream(new Command({ resume: \"answer 2\" }));\n * // Final result: { myKey: \"answer 1 answer 2\" }\n * ```\n *\n * @throws {Error} If called outside the context of a graph\n * @throws {GraphInterrupt} When no resume value is available\n */\nexport declare function interrupt<I = unknown, R = any>(value: I): R;\ntype FilterAny<X> = (<T>() => T extends X ? 1 : 2) extends <T>() => (T extends any ? 1 : 2) ? never : X;\nexport type InferInterruptInputType<T> = T extends typeof interrupt<infer I, unknown> ? I : T extends {\n [key: string]: typeof interrupt<any, any>;\n} ? {\n [K in keyof T]: InferInterruptInputType<T[K]>;\n}[keyof T] : unknown;\nexport type InferInterruptResumeType<T, TInner = false> = T extends typeof interrupt<never, infer R> ? TInner extends true ? FilterAny<R> : R : T extends {\n [key: string]: typeof interrupt<any, any>;\n} ? {\n [K in keyof T]: InferInterruptResumeType<T[K], true>;\n}[keyof T] : unknown;\nexport {};\n"],"mappings":";;AA2CA;;;;;AAAqE;;;;;;;AAErE;;;;;;;;;;;;;AAKA;;;;;;;;;;;;;;;;;iBAPwBA,uCAAuCC,IAAIC;KAC9DC,yBAAyBC,UAAUC,8BAA6BD,kCAAiCC;KAC1FC,6BAA6BF,iBAAiBJ,8BAA8BC,IAAIG;wBAClEJ;kBAEVI,IAAIE,wBAAwBF,EAAEG,YACtCH;KACII,8CAA8CJ,iBAAiBJ,4BAA4BS,sBAAsBN,UAAUD,KAAKA,IAAIE;wBACtHJ;kBAEVI,IAAII,yBAAyBJ,EAAEG,kBACvCH"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { GraphInterrupt, GraphValueError } from "./errors.js";
|
|
2
|
+
import { CHECKPOINT_NAMESPACE_SEPARATOR, CONFIG_KEY_CHECKPOINTER, CONFIG_KEY_CHECKPOINT_NS, CONFIG_KEY_SCRATCHPAD, CONFIG_KEY_SEND, RESUME } from "./constants.js";
|
|
3
|
+
import { XXH3 } from "./hash.js";
|
|
4
|
+
import { AsyncLocalStorageProviderSingleton } from "@langchain/core/singletons";
|
|
5
|
+
|
|
6
|
+
//#region src/interrupt.ts
|
|
7
|
+
/**
|
|
8
|
+
* Interrupts the execution of a graph node.
|
|
9
|
+
* This function can be used to pause execution of a node, and return the value of the `resume`
|
|
10
|
+
* input when the graph is re-invoked using `Command`.
|
|
11
|
+
* Multiple interrupts can be called within a single node, and each will be handled sequentially.
|
|
12
|
+
*
|
|
13
|
+
* When an interrupt is called:
|
|
14
|
+
* 1. If there's a `resume` value available (from a previous `Command`), it returns that value.
|
|
15
|
+
* 2. Otherwise, it throws a `GraphInterrupt` with the provided value
|
|
16
|
+
* 3. The graph can be resumed by passing a `Command` with a `resume` value
|
|
17
|
+
*
|
|
18
|
+
* Because the `interrupt` function propagates by throwing a special `GraphInterrupt` error,
|
|
19
|
+
* you should avoid using `try/catch` blocks around the `interrupt` function,
|
|
20
|
+
* or if you do, ensure that the `GraphInterrupt` error is thrown again within your `catch` block.
|
|
21
|
+
*
|
|
22
|
+
* @param value - The value to include in the interrupt. This will be available in task.interrupts[].value
|
|
23
|
+
* @returns The `resume` value provided when the graph is re-invoked with a Command
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* // Define a node that uses multiple interrupts
|
|
28
|
+
* const nodeWithInterrupts = () => {
|
|
29
|
+
* // First interrupt - will pause execution and include {value: 1} in task values
|
|
30
|
+
* const answer1 = interrupt({ value: 1 });
|
|
31
|
+
*
|
|
32
|
+
* // Second interrupt - only called after first interrupt is resumed
|
|
33
|
+
* const answer2 = interrupt({ value: 2 });
|
|
34
|
+
*
|
|
35
|
+
* // Use the resume values
|
|
36
|
+
* return { myKey: answer1 + " " + answer2 };
|
|
37
|
+
* };
|
|
38
|
+
*
|
|
39
|
+
* // Resume the graph after first interrupt
|
|
40
|
+
* await graph.stream(new Command({ resume: "answer 1" }));
|
|
41
|
+
*
|
|
42
|
+
* // Resume the graph after second interrupt
|
|
43
|
+
* await graph.stream(new Command({ resume: "answer 2" }));
|
|
44
|
+
* // Final result: { myKey: "answer 1 answer 2" }
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* @throws {Error} If called outside the context of a graph
|
|
48
|
+
* @throws {GraphInterrupt} When no resume value is available
|
|
49
|
+
*/
|
|
50
|
+
function interrupt(value) {
|
|
51
|
+
const config = AsyncLocalStorageProviderSingleton.getRunnableConfig();
|
|
52
|
+
if (!config) throw new Error("Called interrupt() outside the context of a graph.");
|
|
53
|
+
const conf = config.configurable;
|
|
54
|
+
if (!conf) throw new Error("No configurable found in config");
|
|
55
|
+
if (!conf[CONFIG_KEY_CHECKPOINTER]) throw new GraphValueError("No checkpointer set", { lc_error_code: "MISSING_CHECKPOINTER" });
|
|
56
|
+
const scratchpad = conf[CONFIG_KEY_SCRATCHPAD];
|
|
57
|
+
scratchpad.interruptCounter += 1;
|
|
58
|
+
const idx = scratchpad.interruptCounter;
|
|
59
|
+
if (scratchpad.resume.length > 0 && idx < scratchpad.resume.length) {
|
|
60
|
+
conf[CONFIG_KEY_SEND]?.([[RESUME, scratchpad.resume]]);
|
|
61
|
+
return scratchpad.resume[idx];
|
|
62
|
+
}
|
|
63
|
+
if (scratchpad.nullResume !== void 0) {
|
|
64
|
+
if (scratchpad.resume.length !== idx) throw new Error(`Resume length mismatch: ${scratchpad.resume.length} !== ${idx}`);
|
|
65
|
+
const v = scratchpad.consumeNullResume();
|
|
66
|
+
scratchpad.resume.push(v);
|
|
67
|
+
conf[CONFIG_KEY_SEND]?.([[RESUME, scratchpad.resume]]);
|
|
68
|
+
return v;
|
|
69
|
+
}
|
|
70
|
+
const ns = conf[CONFIG_KEY_CHECKPOINT_NS]?.split(CHECKPOINT_NAMESPACE_SEPARATOR);
|
|
71
|
+
throw new GraphInterrupt([{
|
|
72
|
+
id: ns ? XXH3(ns.join(CHECKPOINT_NAMESPACE_SEPARATOR)) : void 0,
|
|
73
|
+
value
|
|
74
|
+
}]);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
//#endregion
|
|
78
|
+
export { interrupt };
|
|
79
|
+
//# sourceMappingURL=interrupt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interrupt.js","names":[],"sources":["../src/interrupt.ts"],"sourcesContent":["import { AsyncLocalStorageProviderSingleton } from \"@langchain/core/singletons\";\nimport { RunnableConfig } from \"@langchain/core/runnables\";\nimport {\n BaseCheckpointSaver,\n type PendingWrite,\n} from \"@langchain/langgraph-checkpoint\";\nimport { GraphInterrupt, GraphValueError } from \"./errors.js\";\nimport {\n CONFIG_KEY_CHECKPOINT_NS,\n CONFIG_KEY_SCRATCHPAD,\n CONFIG_KEY_SEND,\n CONFIG_KEY_CHECKPOINTER,\n CHECKPOINT_NAMESPACE_SEPARATOR,\n RESUME,\n} from \"./constants.js\";\nimport { PregelScratchpad } from \"./pregel/types.js\";\nimport { XXH3 } from \"./hash.js\";\n\n/**\n * Interrupts the execution of a graph node.\n * This function can be used to pause execution of a node, and return the value of the `resume`\n * input when the graph is re-invoked using `Command`.\n * Multiple interrupts can be called within a single node, and each will be handled sequentially.\n *\n * When an interrupt is called:\n * 1. If there's a `resume` value available (from a previous `Command`), it returns that value.\n * 2. Otherwise, it throws a `GraphInterrupt` with the provided value\n * 3. The graph can be resumed by passing a `Command` with a `resume` value\n *\n * Because the `interrupt` function propagates by throwing a special `GraphInterrupt` error,\n * you should avoid using `try/catch` blocks around the `interrupt` function,\n * or if you do, ensure that the `GraphInterrupt` error is thrown again within your `catch` block.\n *\n * @param value - The value to include in the interrupt. This will be available in task.interrupts[].value\n * @returns The `resume` value provided when the graph is re-invoked with a Command\n *\n * @example\n * ```typescript\n * // Define a node that uses multiple interrupts\n * const nodeWithInterrupts = () => {\n * // First interrupt - will pause execution and include {value: 1} in task values\n * const answer1 = interrupt({ value: 1 });\n *\n * // Second interrupt - only called after first interrupt is resumed\n * const answer2 = interrupt({ value: 2 });\n *\n * // Use the resume values\n * return { myKey: answer1 + \" \" + answer2 };\n * };\n *\n * // Resume the graph after first interrupt\n * await graph.stream(new Command({ resume: \"answer 1\" }));\n *\n * // Resume the graph after second interrupt\n * await graph.stream(new Command({ resume: \"answer 2\" }));\n * // Final result: { myKey: \"answer 1 answer 2\" }\n * ```\n *\n * @throws {Error} If called outside the context of a graph\n * @throws {GraphInterrupt} When no resume value is available\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function interrupt<I = unknown, R = any>(value: I): R {\n const config: RunnableConfig | undefined =\n AsyncLocalStorageProviderSingleton.getRunnableConfig();\n if (!config) {\n throw new Error(\"Called interrupt() outside the context of a graph.\");\n }\n\n const conf = config.configurable;\n if (!conf) {\n throw new Error(\"No configurable found in config\");\n }\n\n const checkpointer: BaseCheckpointSaver = conf[CONFIG_KEY_CHECKPOINTER];\n if (!checkpointer) {\n throw new GraphValueError(\"No checkpointer set\", {\n lc_error_code: \"MISSING_CHECKPOINTER\",\n });\n }\n\n // Track interrupt index\n const scratchpad: PregelScratchpad = conf[CONFIG_KEY_SCRATCHPAD];\n scratchpad.interruptCounter += 1;\n const idx = scratchpad.interruptCounter;\n\n // Find previous resume values\n if (scratchpad.resume.length > 0 && idx < scratchpad.resume.length) {\n conf[CONFIG_KEY_SEND]?.([[RESUME, scratchpad.resume] as PendingWrite]);\n return scratchpad.resume[idx] as R;\n }\n\n // Find current resume value\n if (scratchpad.nullResume !== undefined) {\n if (scratchpad.resume.length !== idx) {\n throw new Error(\n `Resume length mismatch: ${scratchpad.resume.length} !== ${idx}`\n );\n }\n const v = scratchpad.consumeNullResume();\n scratchpad.resume.push(v);\n conf[CONFIG_KEY_SEND]?.([[RESUME, scratchpad.resume] as PendingWrite]);\n return v as R;\n }\n\n // No resume value found\n const ns: string[] | undefined = conf[CONFIG_KEY_CHECKPOINT_NS]?.split(\n CHECKPOINT_NAMESPACE_SEPARATOR\n );\n\n const id = ns ? XXH3(ns.join(CHECKPOINT_NAMESPACE_SEPARATOR)) : undefined;\n throw new GraphInterrupt([{ id, value }]);\n}\n\ntype FilterAny<X> = (<T>() => T extends X ? 1 : 2) extends <\n T\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n>() => T extends any ? 1 : 2\n ? never\n : X;\n\nexport type InferInterruptInputType<T> = T extends typeof interrupt<\n infer I,\n unknown\n>\n ? I\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\n T extends { [key: string]: typeof interrupt<any, any> }\n ? { [K in keyof T]: InferInterruptInputType<T[K]> }[keyof T]\n : unknown;\n\nexport type InferInterruptResumeType<\n T,\n TInner = false\n> = T extends typeof interrupt<never, infer R>\n ? TInner extends true\n ? FilterAny<R>\n : R\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\n T extends { [key: string]: typeof interrupt<any, any> }\n ? { [K in keyof T]: InferInterruptResumeType<T[K], true> }[keyof T]\n : unknown;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8DA,SAAgB,UAAgC,OAAa;CAC3D,MAAM,SACJ,mCAAmC,mBAAmB;AACxD,KAAI,CAAC,OACH,OAAM,IAAI,MAAM,qDAAqD;CAGvE,MAAM,OAAO,OAAO;AACpB,KAAI,CAAC,KACH,OAAM,IAAI,MAAM,kCAAkC;AAIpD,KAAI,CADsC,KAAK,yBAE7C,OAAM,IAAI,gBAAgB,uBAAuB,EAC/C,eAAe,wBAChB,CAAC;CAIJ,MAAM,aAA+B,KAAK;AAC1C,YAAW,oBAAoB;CAC/B,MAAM,MAAM,WAAW;AAGvB,KAAI,WAAW,OAAO,SAAS,KAAK,MAAM,WAAW,OAAO,QAAQ;AAClE,OAAK,mBAAmB,CAAC,CAAC,QAAQ,WAAW,OAAO,CAAiB,CAAC;AACtE,SAAO,WAAW,OAAO;;AAI3B,KAAI,WAAW,eAAe,QAAW;AACvC,MAAI,WAAW,OAAO,WAAW,IAC/B,OAAM,IAAI,MACR,2BAA2B,WAAW,OAAO,OAAO,OAAO,MAC5D;EAEH,MAAM,IAAI,WAAW,mBAAmB;AACxC,aAAW,OAAO,KAAK,EAAE;AACzB,OAAK,mBAAmB,CAAC,CAAC,QAAQ,WAAW,OAAO,CAAiB,CAAC;AACtE,SAAO;;CAIT,MAAM,KAA2B,KAAK,2BAA2B,MAC/D,+BACD;AAGD,OAAM,IAAI,eAAe,CAAC;EAAE,IADjB,KAAK,KAAK,GAAG,KAAK,+BAA+B,CAAC,GAAG;EAChC;EAAO,CAAC,CAAC"}
|