langchain 1.0.2 → 1.0.3
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 +11 -0
- package/dist/agents/ReactAgent.cjs +21 -41
- package/dist/agents/ReactAgent.cjs.map +1 -1
- package/dist/agents/ReactAgent.js +21 -41
- package/dist/agents/ReactAgent.js.map +1 -1
- package/dist/agents/annotation.cjs +1 -0
- package/dist/agents/annotation.cjs.map +1 -1
- package/dist/agents/annotation.js +1 -0
- package/dist/agents/annotation.js.map +1 -1
- package/dist/agents/middleware/callLimit.d.cts.map +1 -1
- package/dist/agents/middleware/callLimit.d.ts.map +1 -1
- package/dist/agents/middleware/contextEditing.d.cts.map +1 -1
- package/dist/agents/middleware/contextEditing.d.ts.map +1 -1
- package/dist/agents/middleware/dynamicSystemPrompt.d.cts.map +1 -1
- package/dist/agents/middleware/dynamicSystemPrompt.d.ts.map +1 -1
- package/dist/agents/middleware/hitl.cjs +7 -2
- package/dist/agents/middleware/hitl.cjs.map +1 -1
- package/dist/agents/middleware/hitl.d.cts.map +1 -1
- package/dist/agents/middleware/hitl.d.ts.map +1 -1
- package/dist/agents/middleware/hitl.js +7 -2
- package/dist/agents/middleware/hitl.js.map +1 -1
- package/dist/agents/middleware/index.cjs +2 -1
- package/dist/agents/middleware/index.d.cts +15 -0
- package/dist/agents/middleware/index.d.ts +14 -0
- package/dist/agents/middleware/index.js +2 -1
- package/dist/agents/middleware/modelCallLimit.cjs +145 -0
- package/dist/agents/middleware/modelCallLimit.cjs.map +1 -0
- package/dist/agents/middleware/modelCallLimit.d.cts +128 -0
- package/dist/agents/middleware/modelCallLimit.d.cts.map +1 -0
- package/dist/agents/middleware/modelCallLimit.d.ts +128 -0
- package/dist/agents/middleware/modelCallLimit.d.ts.map +1 -0
- package/dist/agents/middleware/modelCallLimit.js +144 -0
- package/dist/agents/middleware/modelCallLimit.js.map +1 -0
- package/dist/agents/middleware/promptCaching.d.cts.map +1 -1
- package/dist/agents/middleware/promptCaching.d.ts.map +1 -1
- package/dist/agents/middleware/summarization.cjs +4 -2
- package/dist/agents/middleware/summarization.cjs.map +1 -1
- package/dist/agents/middleware/summarization.d.cts +7 -6
- package/dist/agents/middleware/summarization.d.cts.map +1 -1
- package/dist/agents/middleware/summarization.d.ts +7 -6
- package/dist/agents/middleware/summarization.d.ts.map +1 -1
- package/dist/agents/middleware/summarization.js +4 -2
- package/dist/agents/middleware/summarization.js.map +1 -1
- package/dist/agents/middleware/todoListMiddleware.d.ts.map +1 -1
- package/dist/agents/middleware/toolCallLimit.cjs +205 -92
- package/dist/agents/middleware/toolCallLimit.cjs.map +1 -1
- package/dist/agents/middleware/toolCallLimit.d.cts +46 -37
- package/dist/agents/middleware/toolCallLimit.d.cts.map +1 -1
- package/dist/agents/middleware/toolCallLimit.d.ts +46 -37
- package/dist/agents/middleware/toolCallLimit.d.ts.map +1 -1
- package/dist/agents/middleware/toolCallLimit.js +206 -93
- package/dist/agents/middleware/toolCallLimit.js.map +1 -1
- package/dist/agents/middleware/toolRetry.cjs +224 -0
- package/dist/agents/middleware/toolRetry.cjs.map +1 -0
- package/dist/agents/middleware/toolRetry.d.cts +179 -0
- package/dist/agents/middleware/toolRetry.d.cts.map +1 -0
- package/dist/agents/middleware/toolRetry.d.ts +179 -0
- package/dist/agents/middleware/toolRetry.d.ts.map +1 -0
- package/dist/agents/middleware/toolRetry.js +223 -0
- package/dist/agents/middleware/toolRetry.js.map +1 -0
- package/dist/agents/middleware/types.d.cts +21 -19
- package/dist/agents/middleware/types.d.cts.map +1 -1
- package/dist/agents/middleware/types.d.ts +21 -19
- package/dist/agents/middleware/types.d.ts.map +1 -1
- package/dist/agents/middleware/utils.cjs +7 -0
- package/dist/agents/middleware/utils.cjs.map +1 -1
- package/dist/agents/middleware/utils.d.cts.map +1 -1
- package/dist/agents/middleware/utils.d.ts.map +1 -1
- package/dist/agents/middleware/utils.js +7 -1
- package/dist/agents/middleware/utils.js.map +1 -1
- package/dist/agents/middleware.cjs.map +1 -1
- package/dist/agents/middleware.d.cts +4 -4
- package/dist/agents/middleware.d.cts.map +1 -1
- package/dist/agents/middleware.d.ts +4 -4
- package/dist/agents/middleware.d.ts.map +1 -1
- package/dist/agents/middleware.js.map +1 -1
- package/dist/agents/nodes/AgentNode.cjs +21 -47
- package/dist/agents/nodes/AgentNode.cjs.map +1 -1
- package/dist/agents/nodes/AgentNode.js +22 -48
- package/dist/agents/nodes/AgentNode.js.map +1 -1
- package/dist/agents/nodes/ToolNode.cjs +12 -18
- package/dist/agents/nodes/ToolNode.cjs.map +1 -1
- package/dist/agents/nodes/ToolNode.js +12 -18
- package/dist/agents/nodes/ToolNode.js.map +1 -1
- package/dist/agents/nodes/middleware.cjs +9 -7
- package/dist/agents/nodes/middleware.cjs.map +1 -1
- package/dist/agents/nodes/middleware.js +10 -8
- package/dist/agents/nodes/middleware.js.map +1 -1
- package/dist/agents/nodes/types.d.cts +1 -1
- package/dist/agents/nodes/types.d.cts.map +1 -1
- package/dist/agents/nodes/types.d.ts +1 -1
- package/dist/agents/nodes/types.d.ts.map +1 -1
- package/dist/agents/nodes/utils.cjs +5 -1
- package/dist/agents/nodes/utils.cjs.map +1 -1
- package/dist/agents/nodes/utils.js +5 -1
- package/dist/agents/nodes/utils.js.map +1 -1
- package/dist/agents/runtime.d.cts +11 -27
- package/dist/agents/runtime.d.cts.map +1 -1
- package/dist/agents/runtime.d.ts +11 -27
- package/dist/agents/runtime.d.ts.map +1 -1
- package/dist/agents/state.cjs +45 -0
- package/dist/agents/state.cjs.map +1 -0
- package/dist/agents/state.js +44 -0
- package/dist/agents/state.js.map +1 -0
- package/dist/agents/types.d.cts +1 -1
- package/dist/agents/types.d.cts.map +1 -1
- package/dist/agents/types.d.ts +1 -1
- package/dist/agents/types.d.ts.map +1 -1
- package/dist/agents/utils.cjs +10 -2
- package/dist/agents/utils.cjs.map +1 -1
- package/dist/agents/utils.js +10 -2
- package/dist/agents/utils.js.map +1 -1
- package/dist/chat_models/universal.cjs +2 -2
- package/dist/chat_models/universal.cjs.map +1 -1
- package/dist/chat_models/universal.js +2 -2
- package/dist/chat_models/universal.js.map +1 -1
- package/dist/embeddings/cache_backed.cjs +140 -0
- package/dist/embeddings/cache_backed.cjs.map +1 -0
- package/dist/embeddings/cache_backed.d.cts +107 -0
- package/dist/embeddings/cache_backed.d.cts.map +1 -0
- package/dist/embeddings/cache_backed.d.ts +107 -0
- package/dist/embeddings/cache_backed.d.ts.map +1 -0
- package/dist/embeddings/cache_backed.js +134 -0
- package/dist/embeddings/cache_backed.js.map +1 -0
- package/dist/embeddings/fake.cjs +22 -0
- package/dist/embeddings/fake.cjs.map +1 -0
- package/dist/embeddings/fake.d.cts +1 -0
- package/dist/embeddings/fake.d.ts +1 -0
- package/dist/embeddings/fake.js +12 -0
- package/dist/embeddings/fake.js.map +1 -0
- package/dist/index.cjs +6 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +4 -5
- package/dist/index.js.map +1 -1
- package/dist/node_modules/.pnpm/eventemitter3@4.0.7/node_modules/eventemitter3/index.cjs +248 -0
- package/dist/node_modules/.pnpm/eventemitter3@4.0.7/node_modules/eventemitter3/index.cjs.map +1 -0
- package/dist/node_modules/.pnpm/eventemitter3@4.0.7/node_modules/eventemitter3/index.js +244 -0
- package/dist/node_modules/.pnpm/eventemitter3@4.0.7/node_modules/eventemitter3/index.js.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/client.cjs +3096 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/client.cjs.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/client.js +3095 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/client.js.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/env.cjs +12 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/env.cjs.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/env.js +12 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/env.js.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/experimental/otel/constants.cjs +71 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/experimental/otel/constants.cjs.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/experimental/otel/constants.js +38 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/experimental/otel/constants.js.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/experimental/otel/translator.cjs +221 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/experimental/otel/translator.cjs.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/experimental/otel/translator.js +221 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/experimental/otel/translator.js.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/index.cjs +11 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/index.cjs.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/index.js +11 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/index.js.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/run_trees.cjs +703 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/run_trees.cjs.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/run_trees.js +702 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/run_trees.js.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/singletons/constants.cjs +7 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/singletons/constants.cjs.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/singletons/constants.js +6 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/singletons/constants.js.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/singletons/fetch.cjs +29 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/singletons/fetch.cjs.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/singletons/fetch.js +28 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/singletons/fetch.js.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/singletons/otel.cjs +115 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/singletons/otel.cjs.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/singletons/otel.js +113 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/singletons/otel.js.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/_uuid.cjs +14 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/_uuid.cjs.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/_uuid.js +13 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/_uuid.js.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/async_caller.cjs +95 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/async_caller.cjs.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/async_caller.js +95 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/async_caller.js.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/env.cjs +136 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/env.cjs.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/env.js +131 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/env.js.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/error.cjs +102 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/error.cjs.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/error.js +99 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/error.js.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/fast-safe-stringify/index.cjs +140 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/fast-safe-stringify/index.cjs.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/fast-safe-stringify/index.js +140 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/fast-safe-stringify/index.js.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/messages.cjs +18 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/messages.cjs.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/messages.js +16 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/messages.js.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/project.cjs +10 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/project.cjs.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/project.js +10 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/project.js.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/prompts.cjs +30 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/prompts.cjs.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/prompts.js +30 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/prompts.js.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/warn.cjs +13 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/warn.cjs.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/warn.js +12 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/warn.js.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/index.cjs +6 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/index.js +6 -0
- package/dist/node_modules/.pnpm/p-finally@1.0.0/node_modules/p-finally/index.cjs +27 -0
- package/dist/node_modules/.pnpm/p-finally@1.0.0/node_modules/p-finally/index.cjs.map +1 -0
- package/dist/node_modules/.pnpm/p-finally@1.0.0/node_modules/p-finally/index.js +23 -0
- package/dist/node_modules/.pnpm/p-finally@1.0.0/node_modules/p-finally/index.js.map +1 -0
- package/dist/node_modules/.pnpm/p-queue@6.6.2/node_modules/p-queue/dist/index.cjs +267 -0
- package/dist/node_modules/.pnpm/p-queue@6.6.2/node_modules/p-queue/dist/index.cjs.map +1 -0
- package/dist/node_modules/.pnpm/p-queue@6.6.2/node_modules/p-queue/dist/index.js +263 -0
- package/dist/node_modules/.pnpm/p-queue@6.6.2/node_modules/p-queue/dist/index.js.map +1 -0
- package/dist/node_modules/.pnpm/p-queue@6.6.2/node_modules/p-queue/dist/lower-bound.cjs +32 -0
- package/dist/node_modules/.pnpm/p-queue@6.6.2/node_modules/p-queue/dist/lower-bound.cjs.map +1 -0
- package/dist/node_modules/.pnpm/p-queue@6.6.2/node_modules/p-queue/dist/lower-bound.js +28 -0
- package/dist/node_modules/.pnpm/p-queue@6.6.2/node_modules/p-queue/dist/lower-bound.js.map +1 -0
- package/dist/node_modules/.pnpm/p-queue@6.6.2/node_modules/p-queue/dist/priority-queue.cjs +49 -0
- package/dist/node_modules/.pnpm/p-queue@6.6.2/node_modules/p-queue/dist/priority-queue.cjs.map +1 -0
- package/dist/node_modules/.pnpm/p-queue@6.6.2/node_modules/p-queue/dist/priority-queue.js +45 -0
- package/dist/node_modules/.pnpm/p-queue@6.6.2/node_modules/p-queue/dist/priority-queue.js.map +1 -0
- package/dist/node_modules/.pnpm/p-retry@4.6.2/node_modules/p-retry/index.cjs +83 -0
- package/dist/node_modules/.pnpm/p-retry@4.6.2/node_modules/p-retry/index.cjs.map +1 -0
- package/dist/node_modules/.pnpm/p-retry@4.6.2/node_modules/p-retry/index.js +79 -0
- package/dist/node_modules/.pnpm/p-retry@4.6.2/node_modules/p-retry/index.js.map +1 -0
- package/dist/node_modules/.pnpm/p-timeout@3.2.0/node_modules/p-timeout/index.cjs +52 -0
- package/dist/node_modules/.pnpm/p-timeout@3.2.0/node_modules/p-timeout/index.cjs.map +1 -0
- package/dist/node_modules/.pnpm/p-timeout@3.2.0/node_modules/p-timeout/index.js +48 -0
- package/dist/node_modules/.pnpm/p-timeout@3.2.0/node_modules/p-timeout/index.js.map +1 -0
- package/dist/node_modules/.pnpm/retry@0.13.1/node_modules/retry/index.cjs +16 -0
- package/dist/node_modules/.pnpm/retry@0.13.1/node_modules/retry/index.cjs.map +1 -0
- package/dist/node_modules/.pnpm/retry@0.13.1/node_modules/retry/index.js +13 -0
- package/dist/node_modules/.pnpm/retry@0.13.1/node_modules/retry/index.js.map +1 -0
- package/dist/node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry.cjs +77 -0
- package/dist/node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry.cjs.map +1 -0
- package/dist/node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry.js +74 -0
- package/dist/node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry.js.map +1 -0
- package/dist/node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.cjs +115 -0
- package/dist/node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.cjs.map +1 -0
- package/dist/node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js +112 -0
- package/dist/node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/comparator.cjs +90 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/comparator.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/comparator.js +86 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/comparator.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/range.cjs +294 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/range.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/range.js +290 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/range.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/semver.cjs +191 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/semver.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/semver.js +187 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/semver.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/clean.cjs +24 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/clean.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/clean.js +20 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/clean.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/cmp.cjs +51 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/cmp.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/cmp.js +47 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/cmp.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/coerce.cjs +48 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/coerce.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/coerce.js +44 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/coerce.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare-build.cjs +25 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare-build.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare-build.js +21 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare-build.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare-loose.cjs +21 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare-loose.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare-loose.js +17 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare-loose.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare.cjs +21 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare.js +17 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/diff.cjs +43 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/diff.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/diff.js +39 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/diff.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/eq.cjs +21 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/eq.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/eq.js +17 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/eq.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/gt.cjs +21 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/gt.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/gt.js +17 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/gt.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/gte.cjs +21 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/gte.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/gte.js +17 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/gte.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/inc.cjs +32 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/inc.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/inc.js +28 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/inc.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/lt.cjs +21 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/lt.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/lt.js +17 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/lt.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/lte.cjs +21 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/lte.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/lte.js +17 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/lte.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/major.cjs +21 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/major.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/major.js +17 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/major.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/minor.cjs +21 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/minor.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/minor.js +17 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/minor.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/neq.cjs +21 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/neq.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/neq.js +17 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/neq.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/parse.cjs +29 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/parse.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/parse.js +25 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/parse.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/patch.cjs +21 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/patch.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/patch.js +17 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/patch.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/prerelease.cjs +24 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/prerelease.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/prerelease.js +20 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/prerelease.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/rcompare.cjs +21 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/rcompare.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/rcompare.js +17 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/rcompare.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/rsort.cjs +21 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/rsort.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/rsort.js +17 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/rsort.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/satisfies.cjs +28 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/satisfies.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/satisfies.js +24 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/satisfies.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/sort.cjs +21 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/sort.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/sort.js +17 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/sort.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/valid.cjs +24 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/valid.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/valid.js +20 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/valid.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/index.cjs +146 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/index.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/index.js +142 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/index.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/constants.cjs +41 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/constants.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/constants.js +37 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/constants.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/debug.cjs +19 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/debug.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/debug.js +15 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/debug.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/identifiers.cjs +32 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/identifiers.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/identifiers.js +28 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/identifiers.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/lrucache.cjs +47 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/lrucache.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/lrucache.js +43 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/lrucache.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/parse-options.cjs +25 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/parse-options.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/parse-options.js +21 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/parse-options.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/re.cjs +94 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/re.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/re.js +90 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/re.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/gtr.cjs +21 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/gtr.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/gtr.js +17 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/gtr.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/intersects.cjs +25 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/intersects.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/intersects.js +21 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/intersects.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/ltr.cjs +21 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/ltr.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/ltr.js +17 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/ltr.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/max-satisfying.cjs +41 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/max-satisfying.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/max-satisfying.js +37 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/max-satisfying.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/min-satisfying.cjs +41 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/min-satisfying.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/min-satisfying.js +37 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/min-satisfying.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/min-version.cjs +55 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/min-version.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/min-version.js +51 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/min-version.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/outside.cjs +74 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/outside.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/outside.js +70 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/outside.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/simplify.cjs +48 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/simplify.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/simplify.js +44 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/simplify.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/subset.cjs +112 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/subset.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/subset.js +108 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/subset.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/to-comparators.cjs +21 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/to-comparators.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/to-comparators.js +17 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/to-comparators.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/valid.cjs +27 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/valid.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/valid.js +23 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/valid.js.map +1 -0
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middleware.cjs","names":["RunnableCallable","fields: RunnableCallableArgs<TStateSchema, NodeOutput<TStateSchema>>","options: MiddlewareNodeOptions","#options","
|
|
1
|
+
{"version":3,"file":"middleware.cjs","names":["RunnableCallable","fields: RunnableCallableArgs<TStateSchema, NodeOutput<TStateSchema>>","options: MiddlewareNodeOptions","#options","invokeState: TStateSchema","config?: LangGraphRunnableConfig","relevantContext: Record<string, unknown>","state: TStateSchema","runtime: Runtime<TContextSchema>","jumpToConstraint: JumpToTarget[] | undefined","constraint: string | undefined","getHookConstraint","derivePrivateState"],"sources":["../../../src/agents/nodes/middleware.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { z } from \"zod/v3\";\nimport { LangGraphRunnableConfig, Command } from \"@langchain/langgraph\";\nimport { interopParse } from \"@langchain/core/utils/types\";\n\nimport { RunnableCallable, RunnableCallableArgs } from \"../RunnableCallable.js\";\nimport type { JumpToTarget } from \"../constants.js\";\nimport type { Runtime } from \"../runtime.js\";\nimport type { AgentMiddleware, MiddlewareResult } from \"../middleware/types.js\";\nimport { derivePrivateState } from \"./utils.js\";\nimport { getHookConstraint } from \"../middleware/utils.js\";\n\n/**\n * Named class for context objects to provide better error messages\n */\nclass AgentContext {}\nclass AgentRuntime {}\n\ntype NodeOutput<TStateSchema extends Record<string, any>> =\n | TStateSchema\n | Command<any, TStateSchema, string>;\n\nexport interface MiddlewareNodeOptions {\n getState: () => Record<string, unknown>;\n}\n\nexport abstract class MiddlewareNode<\n TStateSchema extends Record<string, any>,\n TContextSchema extends Record<string, any>\n> extends RunnableCallable<TStateSchema, NodeOutput<TStateSchema>> {\n #options: MiddlewareNodeOptions;\n\n abstract middleware: AgentMiddleware<\n z.ZodObject<z.ZodRawShape>,\n z.ZodObject<z.ZodRawShape>\n >;\n\n constructor(\n fields: RunnableCallableArgs<TStateSchema, NodeOutput<TStateSchema>>,\n options: MiddlewareNodeOptions\n ) {\n super(fields);\n this.#options = options;\n }\n\n abstract runHook(\n state: TStateSchema,\n config?: Runtime<TContextSchema>\n ): Promise<MiddlewareResult<TStateSchema>> | MiddlewareResult<TStateSchema>;\n\n async invokeMiddleware(\n invokeState: TStateSchema,\n config?: LangGraphRunnableConfig\n ): Promise<NodeOutput<TStateSchema>> {\n /**\n * Filter context based on middleware's contextSchema\n */\n let filteredContext = {} as TContextSchema;\n /**\n * Parse context using middleware's contextSchema to apply defaults and validation\n */\n if (this.middleware.contextSchema) {\n /**\n * Extract only the fields relevant to this middleware's schema\n */\n const schemaShape = this.middleware.contextSchema?.shape;\n if (schemaShape) {\n const relevantContext: Record<string, unknown> = {};\n const invokeContext = config?.context || {};\n for (const key of Object.keys(schemaShape)) {\n if (key in invokeContext) {\n relevantContext[key] = invokeContext[key];\n }\n }\n /**\n * Parse to apply defaults and validation, even if relevantContext is empty\n * This will throw if required fields are missing and no defaults exist\n */\n filteredContext = interopParse(\n this.middleware.contextSchema,\n relevantContext\n ) as TContextSchema;\n }\n }\n\n const state: TStateSchema = {\n ...this.#options.getState(),\n ...invokeState,\n /**\n * don't overwrite possible outdated messages from other middleware nodes\n */\n messages: invokeState.messages,\n };\n\n /**\n * ToDo: implement later\n */\n const runtime: Runtime<TContextSchema> = {\n context: filteredContext,\n writer: config?.writer,\n interrupt: config?.interrupt,\n signal: config?.signal,\n };\n\n const result = await this.runHook(\n state,\n /**\n * assign runtime and context values into empty named class\n * instances to create a better error message.\n */\n Object.freeze(\n Object.assign(new AgentRuntime(), {\n ...runtime,\n context: Object.freeze(\n Object.assign(new AgentContext(), filteredContext)\n ),\n })\n )\n );\n\n /**\n * If result is undefined, return current state\n */\n if (!result) {\n return { ...state, jumpTo: undefined };\n }\n\n /**\n * Verify that the jump target is allowed for the middleware\n */\n let jumpToConstraint: JumpToTarget[] | undefined;\n let constraint: string | undefined;\n\n if (this.name?.startsWith(\"BeforeAgentNode_\")) {\n jumpToConstraint = getHookConstraint(this.middleware.beforeAgent);\n constraint = \"beforeAgent.canJumpTo\";\n } else if (this.name?.startsWith(\"BeforeModelNode_\")) {\n jumpToConstraint = getHookConstraint(this.middleware.beforeModel);\n constraint = \"beforeModel.canJumpTo\";\n } else if (this.name?.startsWith(\"AfterAgentNode_\")) {\n jumpToConstraint = getHookConstraint(this.middleware.afterAgent);\n constraint = \"afterAgent.canJumpTo\";\n } else if (this.name?.startsWith(\"AfterModelNode_\")) {\n jumpToConstraint = getHookConstraint(this.middleware.afterModel);\n constraint = \"afterModel.canJumpTo\";\n }\n\n if (\n typeof result.jumpTo === \"string\" &&\n !jumpToConstraint?.includes(result.jumpTo as JumpToTarget)\n ) {\n const suggestion =\n jumpToConstraint && jumpToConstraint.length > 0\n ? `must be one of: ${jumpToConstraint?.join(\", \")}.`\n : constraint\n ? `no ${constraint} defined in middleware ${this.middleware.name}`\n : \"\";\n throw new Error(`Invalid jump target: ${result.jumpTo}, ${suggestion}.`);\n }\n\n /**\n * If result is a control action, handle it\n */\n if (typeof result === \"object\" && \"type\" in result) {\n // Handle control actions\n if (result.type === \"terminate\") {\n if (result.error) {\n throw result.error;\n }\n return {\n ...state,\n ...(result.result || {}),\n jumpTo: result.jumpTo,\n };\n }\n\n throw new Error(`Invalid control action: ${JSON.stringify(result)}`);\n }\n\n /**\n * If result is a state update, merge it with current state\n */\n return { ...state, ...result, jumpTo: result.jumpTo };\n }\n\n get nodeOptions(): {\n input: z.ZodObject<TStateSchema>;\n } {\n return {\n input: derivePrivateState(\n this.middleware.stateSchema\n ) as z.ZodObject<TStateSchema>,\n };\n }\n}\n"],"mappings":";;;;;;;;;;AAeA,IAAM,eAAN,MAAmB,CAAE;AACrB,IAAM,eAAN,MAAmB,CAAE;AAUrB,IAAsB,iBAAtB,cAGUA,0CAAyD;CACjE;CAOA,YACEC,QACAC,SACA;EACA,MAAM,OAAO;EACb,KAAKC,WAAW;CACjB;CAOD,MAAM,iBACJC,aACAC,QACmC;;;;EAInC,IAAI,kBAAkB,CAAE;;;;AAIxB,MAAI,KAAK,WAAW,eAAe;;;;GAIjC,MAAM,cAAc,KAAK,WAAW,eAAe;AACnD,OAAI,aAAa;IACf,MAAMC,kBAA2C,CAAE;IACnD,MAAM,gBAAgB,QAAQ,WAAW,CAAE;AAC3C,SAAK,MAAM,OAAO,OAAO,KAAK,YAAY,CACxC,KAAI,OAAO,eACT,gBAAgB,OAAO,cAAc;;;;;IAOzC,iEACE,KAAK,WAAW,eAChB,gBACD;GACF;EACF;EAED,MAAMC,QAAsB;GAC1B,GAAG,KAAKJ,SAAS,UAAU;GAC3B,GAAG;GAIH,UAAU,YAAY;EACvB;;;;EAKD,MAAMK,UAAmC;GACvC,SAAS;GACT,QAAQ,QAAQ;GAChB,WAAW,QAAQ;GACnB,QAAQ,QAAQ;EACjB;EAED,MAAM,SAAS,MAAM,KAAK;GACxB;;;;;GAKA,OAAO,OACL,OAAO,OAAO,IAAI,gBAAgB;IAChC,GAAG;IACH,SAAS,OAAO,OACd,OAAO,OAAO,IAAI,gBAAgB,gBAAgB,CACnD;GACF,EAAC,CACH;GACF;;;;AAKD,MAAI,CAAC,OACH,QAAO;GAAE,GAAG;GAAO,QAAQ;EAAW;;;;EAMxC,IAAIC;EACJ,IAAIC;AAEJ,MAAI,KAAK,MAAM,WAAW,mBAAmB,EAAE;GAC7C,mBAAmBC,kCAAkB,KAAK,WAAW,YAAY;GACjE,aAAa;EACd,WAAU,KAAK,MAAM,WAAW,mBAAmB,EAAE;GACpD,mBAAmBA,kCAAkB,KAAK,WAAW,YAAY;GACjE,aAAa;EACd,WAAU,KAAK,MAAM,WAAW,kBAAkB,EAAE;GACnD,mBAAmBA,kCAAkB,KAAK,WAAW,WAAW;GAChE,aAAa;EACd,WAAU,KAAK,MAAM,WAAW,kBAAkB,EAAE;GACnD,mBAAmBA,kCAAkB,KAAK,WAAW,WAAW;GAChE,aAAa;EACd;AAED,MACE,OAAO,OAAO,WAAW,YACzB,CAAC,kBAAkB,SAAS,OAAO,OAAuB,EAC1D;GACA,MAAM,aACJ,oBAAoB,iBAAiB,SAAS,IAC1C,CAAC,gBAAgB,EAAE,kBAAkB,KAAK,KAAK,CAAC,CAAC,CAAC,GAClD,aACA,CAAC,GAAG,EAAE,WAAW,uBAAuB,EAAE,KAAK,WAAW,MAAM,GAChE;AACN,SAAM,IAAI,MAAM,CAAC,qBAAqB,EAAE,OAAO,OAAO,EAAE,EAAE,WAAW,CAAC,CAAC;EACxE;;;;AAKD,MAAI,OAAO,WAAW,YAAY,UAAU,QAAQ;AAElD,OAAI,OAAO,SAAS,aAAa;AAC/B,QAAI,OAAO,MACT,OAAM,OAAO;AAEf,WAAO;KACL,GAAG;KACH,GAAI,OAAO,UAAU,CAAE;KACvB,QAAQ,OAAO;IAChB;GACF;AAED,SAAM,IAAI,MAAM,CAAC,wBAAwB,EAAE,KAAK,UAAU,OAAO,EAAE;EACpE;;;;AAKD,SAAO;GAAE,GAAG;GAAO,GAAG;GAAQ,QAAQ,OAAO;EAAQ;CACtD;CAED,IAAI,cAEF;AACA,SAAO,EACL,OAAOC,iCACL,KAAK,WAAW,YACjB,CACF;CACF;AACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RunnableCallable } from "../RunnableCallable.js";
|
|
2
|
-
import { derivePrivateState
|
|
2
|
+
import { derivePrivateState } from "./utils.js";
|
|
3
3
|
import { getHookConstraint } from "../middleware/utils.js";
|
|
4
4
|
import { interopParse } from "@langchain/core/utils/types";
|
|
5
5
|
|
|
@@ -15,7 +15,7 @@ var MiddlewareNode = class extends RunnableCallable {
|
|
|
15
15
|
super(fields);
|
|
16
16
|
this.#options = options;
|
|
17
17
|
}
|
|
18
|
-
async invokeMiddleware(
|
|
18
|
+
async invokeMiddleware(invokeState, config) {
|
|
19
19
|
/**
|
|
20
20
|
* Filter context based on middleware's contextSchema
|
|
21
21
|
*/
|
|
@@ -39,6 +39,11 @@ var MiddlewareNode = class extends RunnableCallable {
|
|
|
39
39
|
filteredContext = interopParse(this.middleware.contextSchema, relevantContext);
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
+
const state = {
|
|
43
|
+
...this.#options.getState(),
|
|
44
|
+
...invokeState,
|
|
45
|
+
messages: invokeState.messages
|
|
46
|
+
};
|
|
42
47
|
/**
|
|
43
48
|
* ToDo: implement later
|
|
44
49
|
*/
|
|
@@ -46,8 +51,7 @@ var MiddlewareNode = class extends RunnableCallable {
|
|
|
46
51
|
context: filteredContext,
|
|
47
52
|
writer: config?.writer,
|
|
48
53
|
interrupt: config?.interrupt,
|
|
49
|
-
signal: config?.signal
|
|
50
|
-
...this.#options.getPrivateState()
|
|
54
|
+
signal: config?.signal
|
|
51
55
|
};
|
|
52
56
|
const result = await this.runHook(
|
|
53
57
|
state,
|
|
@@ -60,7 +64,6 @@ var MiddlewareNode = class extends RunnableCallable {
|
|
|
60
64
|
context: Object.freeze(Object.assign(new AgentContext(), filteredContext))
|
|
61
65
|
}))
|
|
62
66
|
);
|
|
63
|
-
delete result?._privateState;
|
|
64
67
|
/**
|
|
65
68
|
* If result is undefined, return current state
|
|
66
69
|
*/
|
|
@@ -90,7 +93,6 @@ var MiddlewareNode = class extends RunnableCallable {
|
|
|
90
93
|
const suggestion = jumpToConstraint && jumpToConstraint.length > 0 ? `must be one of: ${jumpToConstraint?.join(", ")}.` : constraint ? `no ${constraint} defined in middleware ${this.middleware.name}` : "";
|
|
91
94
|
throw new Error(`Invalid jump target: ${result.jumpTo}, ${suggestion}.`);
|
|
92
95
|
}
|
|
93
|
-
const jumpTo = parseJumpToTarget(result.jumpTo);
|
|
94
96
|
/**
|
|
95
97
|
* If result is a control action, handle it
|
|
96
98
|
*/
|
|
@@ -100,7 +102,7 @@ var MiddlewareNode = class extends RunnableCallable {
|
|
|
100
102
|
return {
|
|
101
103
|
...state,
|
|
102
104
|
...result.result || {},
|
|
103
|
-
jumpTo
|
|
105
|
+
jumpTo: result.jumpTo
|
|
104
106
|
};
|
|
105
107
|
}
|
|
106
108
|
throw new Error(`Invalid control action: ${JSON.stringify(result)}`);
|
|
@@ -111,7 +113,7 @@ var MiddlewareNode = class extends RunnableCallable {
|
|
|
111
113
|
return {
|
|
112
114
|
...state,
|
|
113
115
|
...result,
|
|
114
|
-
jumpTo
|
|
116
|
+
jumpTo: result.jumpTo
|
|
115
117
|
};
|
|
116
118
|
}
|
|
117
119
|
get nodeOptions() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middleware.js","names":["fields: RunnableCallableArgs<TStateSchema, NodeOutput<TStateSchema>>","options: MiddlewareNodeOptions","#options","
|
|
1
|
+
{"version":3,"file":"middleware.js","names":["fields: RunnableCallableArgs<TStateSchema, NodeOutput<TStateSchema>>","options: MiddlewareNodeOptions","#options","invokeState: TStateSchema","config?: LangGraphRunnableConfig","relevantContext: Record<string, unknown>","state: TStateSchema","runtime: Runtime<TContextSchema>","jumpToConstraint: JumpToTarget[] | undefined","constraint: string | undefined"],"sources":["../../../src/agents/nodes/middleware.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { z } from \"zod/v3\";\nimport { LangGraphRunnableConfig, Command } from \"@langchain/langgraph\";\nimport { interopParse } from \"@langchain/core/utils/types\";\n\nimport { RunnableCallable, RunnableCallableArgs } from \"../RunnableCallable.js\";\nimport type { JumpToTarget } from \"../constants.js\";\nimport type { Runtime } from \"../runtime.js\";\nimport type { AgentMiddleware, MiddlewareResult } from \"../middleware/types.js\";\nimport { derivePrivateState } from \"./utils.js\";\nimport { getHookConstraint } from \"../middleware/utils.js\";\n\n/**\n * Named class for context objects to provide better error messages\n */\nclass AgentContext {}\nclass AgentRuntime {}\n\ntype NodeOutput<TStateSchema extends Record<string, any>> =\n | TStateSchema\n | Command<any, TStateSchema, string>;\n\nexport interface MiddlewareNodeOptions {\n getState: () => Record<string, unknown>;\n}\n\nexport abstract class MiddlewareNode<\n TStateSchema extends Record<string, any>,\n TContextSchema extends Record<string, any>\n> extends RunnableCallable<TStateSchema, NodeOutput<TStateSchema>> {\n #options: MiddlewareNodeOptions;\n\n abstract middleware: AgentMiddleware<\n z.ZodObject<z.ZodRawShape>,\n z.ZodObject<z.ZodRawShape>\n >;\n\n constructor(\n fields: RunnableCallableArgs<TStateSchema, NodeOutput<TStateSchema>>,\n options: MiddlewareNodeOptions\n ) {\n super(fields);\n this.#options = options;\n }\n\n abstract runHook(\n state: TStateSchema,\n config?: Runtime<TContextSchema>\n ): Promise<MiddlewareResult<TStateSchema>> | MiddlewareResult<TStateSchema>;\n\n async invokeMiddleware(\n invokeState: TStateSchema,\n config?: LangGraphRunnableConfig\n ): Promise<NodeOutput<TStateSchema>> {\n /**\n * Filter context based on middleware's contextSchema\n */\n let filteredContext = {} as TContextSchema;\n /**\n * Parse context using middleware's contextSchema to apply defaults and validation\n */\n if (this.middleware.contextSchema) {\n /**\n * Extract only the fields relevant to this middleware's schema\n */\n const schemaShape = this.middleware.contextSchema?.shape;\n if (schemaShape) {\n const relevantContext: Record<string, unknown> = {};\n const invokeContext = config?.context || {};\n for (const key of Object.keys(schemaShape)) {\n if (key in invokeContext) {\n relevantContext[key] = invokeContext[key];\n }\n }\n /**\n * Parse to apply defaults and validation, even if relevantContext is empty\n * This will throw if required fields are missing and no defaults exist\n */\n filteredContext = interopParse(\n this.middleware.contextSchema,\n relevantContext\n ) as TContextSchema;\n }\n }\n\n const state: TStateSchema = {\n ...this.#options.getState(),\n ...invokeState,\n /**\n * don't overwrite possible outdated messages from other middleware nodes\n */\n messages: invokeState.messages,\n };\n\n /**\n * ToDo: implement later\n */\n const runtime: Runtime<TContextSchema> = {\n context: filteredContext,\n writer: config?.writer,\n interrupt: config?.interrupt,\n signal: config?.signal,\n };\n\n const result = await this.runHook(\n state,\n /**\n * assign runtime and context values into empty named class\n * instances to create a better error message.\n */\n Object.freeze(\n Object.assign(new AgentRuntime(), {\n ...runtime,\n context: Object.freeze(\n Object.assign(new AgentContext(), filteredContext)\n ),\n })\n )\n );\n\n /**\n * If result is undefined, return current state\n */\n if (!result) {\n return { ...state, jumpTo: undefined };\n }\n\n /**\n * Verify that the jump target is allowed for the middleware\n */\n let jumpToConstraint: JumpToTarget[] | undefined;\n let constraint: string | undefined;\n\n if (this.name?.startsWith(\"BeforeAgentNode_\")) {\n jumpToConstraint = getHookConstraint(this.middleware.beforeAgent);\n constraint = \"beforeAgent.canJumpTo\";\n } else if (this.name?.startsWith(\"BeforeModelNode_\")) {\n jumpToConstraint = getHookConstraint(this.middleware.beforeModel);\n constraint = \"beforeModel.canJumpTo\";\n } else if (this.name?.startsWith(\"AfterAgentNode_\")) {\n jumpToConstraint = getHookConstraint(this.middleware.afterAgent);\n constraint = \"afterAgent.canJumpTo\";\n } else if (this.name?.startsWith(\"AfterModelNode_\")) {\n jumpToConstraint = getHookConstraint(this.middleware.afterModel);\n constraint = \"afterModel.canJumpTo\";\n }\n\n if (\n typeof result.jumpTo === \"string\" &&\n !jumpToConstraint?.includes(result.jumpTo as JumpToTarget)\n ) {\n const suggestion =\n jumpToConstraint && jumpToConstraint.length > 0\n ? `must be one of: ${jumpToConstraint?.join(\", \")}.`\n : constraint\n ? `no ${constraint} defined in middleware ${this.middleware.name}`\n : \"\";\n throw new Error(`Invalid jump target: ${result.jumpTo}, ${suggestion}.`);\n }\n\n /**\n * If result is a control action, handle it\n */\n if (typeof result === \"object\" && \"type\" in result) {\n // Handle control actions\n if (result.type === \"terminate\") {\n if (result.error) {\n throw result.error;\n }\n return {\n ...state,\n ...(result.result || {}),\n jumpTo: result.jumpTo,\n };\n }\n\n throw new Error(`Invalid control action: ${JSON.stringify(result)}`);\n }\n\n /**\n * If result is a state update, merge it with current state\n */\n return { ...state, ...result, jumpTo: result.jumpTo };\n }\n\n get nodeOptions(): {\n input: z.ZodObject<TStateSchema>;\n } {\n return {\n input: derivePrivateState(\n this.middleware.stateSchema\n ) as z.ZodObject<TStateSchema>,\n };\n }\n}\n"],"mappings":";;;;;;;;;AAeA,IAAM,eAAN,MAAmB,CAAE;AACrB,IAAM,eAAN,MAAmB,CAAE;AAUrB,IAAsB,iBAAtB,cAGU,iBAAyD;CACjE;CAOA,YACEA,QACAC,SACA;EACA,MAAM,OAAO;EACb,KAAKC,WAAW;CACjB;CAOD,MAAM,iBACJC,aACAC,QACmC;;;;EAInC,IAAI,kBAAkB,CAAE;;;;AAIxB,MAAI,KAAK,WAAW,eAAe;;;;GAIjC,MAAM,cAAc,KAAK,WAAW,eAAe;AACnD,OAAI,aAAa;IACf,MAAMC,kBAA2C,CAAE;IACnD,MAAM,gBAAgB,QAAQ,WAAW,CAAE;AAC3C,SAAK,MAAM,OAAO,OAAO,KAAK,YAAY,CACxC,KAAI,OAAO,eACT,gBAAgB,OAAO,cAAc;;;;;IAOzC,kBAAkB,aAChB,KAAK,WAAW,eAChB,gBACD;GACF;EACF;EAED,MAAMC,QAAsB;GAC1B,GAAG,KAAKJ,SAAS,UAAU;GAC3B,GAAG;GAIH,UAAU,YAAY;EACvB;;;;EAKD,MAAMK,UAAmC;GACvC,SAAS;GACT,QAAQ,QAAQ;GAChB,WAAW,QAAQ;GACnB,QAAQ,QAAQ;EACjB;EAED,MAAM,SAAS,MAAM,KAAK;GACxB;;;;;GAKA,OAAO,OACL,OAAO,OAAO,IAAI,gBAAgB;IAChC,GAAG;IACH,SAAS,OAAO,OACd,OAAO,OAAO,IAAI,gBAAgB,gBAAgB,CACnD;GACF,EAAC,CACH;GACF;;;;AAKD,MAAI,CAAC,OACH,QAAO;GAAE,GAAG;GAAO,QAAQ;EAAW;;;;EAMxC,IAAIC;EACJ,IAAIC;AAEJ,MAAI,KAAK,MAAM,WAAW,mBAAmB,EAAE;GAC7C,mBAAmB,kBAAkB,KAAK,WAAW,YAAY;GACjE,aAAa;EACd,WAAU,KAAK,MAAM,WAAW,mBAAmB,EAAE;GACpD,mBAAmB,kBAAkB,KAAK,WAAW,YAAY;GACjE,aAAa;EACd,WAAU,KAAK,MAAM,WAAW,kBAAkB,EAAE;GACnD,mBAAmB,kBAAkB,KAAK,WAAW,WAAW;GAChE,aAAa;EACd,WAAU,KAAK,MAAM,WAAW,kBAAkB,EAAE;GACnD,mBAAmB,kBAAkB,KAAK,WAAW,WAAW;GAChE,aAAa;EACd;AAED,MACE,OAAO,OAAO,WAAW,YACzB,CAAC,kBAAkB,SAAS,OAAO,OAAuB,EAC1D;GACA,MAAM,aACJ,oBAAoB,iBAAiB,SAAS,IAC1C,CAAC,gBAAgB,EAAE,kBAAkB,KAAK,KAAK,CAAC,CAAC,CAAC,GAClD,aACA,CAAC,GAAG,EAAE,WAAW,uBAAuB,EAAE,KAAK,WAAW,MAAM,GAChE;AACN,SAAM,IAAI,MAAM,CAAC,qBAAqB,EAAE,OAAO,OAAO,EAAE,EAAE,WAAW,CAAC,CAAC;EACxE;;;;AAKD,MAAI,OAAO,WAAW,YAAY,UAAU,QAAQ;AAElD,OAAI,OAAO,SAAS,aAAa;AAC/B,QAAI,OAAO,MACT,OAAM,OAAO;AAEf,WAAO;KACL,GAAG;KACH,GAAI,OAAO,UAAU,CAAE;KACvB,QAAQ,OAAO;IAChB;GACF;AAED,SAAM,IAAI,MAAM,CAAC,wBAAwB,EAAE,KAAK,UAAU,OAAO,EAAE;EACpE;;;;AAKD,SAAO;GAAE,GAAG;GAAO,GAAG;GAAQ,QAAQ,OAAO;EAAQ;CACtD;CAED,IAAI,cAEF;AACA,SAAO,EACL,OAAO,mBACL,KAAK,WAAW,YACjB,CACF;CACF;AACF"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ClientTool, ServerTool } from "../tools.cjs";
|
|
2
1
|
import { AgentBuiltInState, Runtime } from "../runtime.cjs";
|
|
3
2
|
import { LanguageModelLike } from "@langchain/core/language_models/base";
|
|
4
3
|
import { BaseMessage } from "@langchain/core/messages";
|
|
4
|
+
import { ClientTool, ServerTool } from "@langchain/core/tools";
|
|
5
5
|
|
|
6
6
|
//#region src/agents/nodes/types.d.ts
|
|
7
7
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.cts","names":["LanguageModelLike","BaseMessage","ServerTool","ClientTool","Runtime","AgentBuiltInState","ModelRequest","Record","TState","TContext"],"sources":["../../../src/agents/nodes/types.d.ts"],"sourcesContent":["import type { LanguageModelLike } from \"@langchain/core/language_models/base\";\nimport type { BaseMessage } from \"@langchain/core/messages\";\nimport type { ServerTool, ClientTool } from \"
|
|
1
|
+
{"version":3,"file":"types.d.cts","names":["LanguageModelLike","BaseMessage","ServerTool","ClientTool","Runtime","AgentBuiltInState","ModelRequest","Record","TState","TContext"],"sources":["../../../src/agents/nodes/types.d.ts"],"sourcesContent":["import type { LanguageModelLike } from \"@langchain/core/language_models/base\";\nimport type { BaseMessage } from \"@langchain/core/messages\";\nimport type { ServerTool, ClientTool } from \"@langchain/core/tools\";\nimport type { Runtime, AgentBuiltInState } from \"../runtime.js\";\n/**\n * Configuration for modifying a model call at runtime.\n * All fields are optional and only provided fields will override defaults.\n *\n * @template TState - The agent's state type, must extend Record<string, unknown>. Defaults to Record<string, unknown>.\n * @template TContext - The runtime context type for accessing metadata and control flow. Defaults to unknown.\n */\nexport interface ModelRequest<TState extends Record<string, unknown> = Record<string, unknown>, TContext = unknown> {\n /**\n * The model to use for this step.\n */\n model: LanguageModelLike;\n /**\n * The messages to send to the model.\n */\n messages: BaseMessage[];\n /**\n * The system message for this step.\n */\n systemPrompt?: string;\n /**\n * Tool choice configuration (model-specific format).\n * Can be one of:\n * - `\"auto\"`: means the model can pick between generating a message or calling one or more tools.\n * - `\"none\"`: means the model will not call any tool and instead generates a message.\n * - `\"required\"`: means the model must call one or more tools.\n * - `{ type: \"function\", function: { name: string } }`: The model will use the specified function.\n */\n toolChoice?: \"auto\" | \"none\" | \"required\" | {\n type: \"function\";\n function: {\n name: string;\n };\n };\n /**\n * The tools to make available for this step.\n */\n tools: (ServerTool | ClientTool)[];\n /**\n * The current agent state (includes both middleware state and built-in state).\n */\n state: TState & AgentBuiltInState;\n /**\n * The runtime context containing metadata, signal, writer, interrupt, etc.\n */\n runtime: Runtime<TContext>;\n /**\n * Additional settings to bind to the model when preparing it for invocation.\n * These settings are applied via `bindTools()` and can include parameters like\n * `headers`, `container`, etc. The model is re-bound on each request,\n * so these settings can vary per invocation.\n *\n * @example\n * ```ts\n * modelSettings: {\n * headers: { \"anthropic-beta\": \"code-execution-2025-08-25\" },\n * container: \"container_abc123\"\n * }\n * ```\n */\n modelSettings?: Record<string, unknown>;\n}\n"],"mappings":";;;;;;;;;AAWA;;;;;AAQcC,UARGK,YAQHL,CAAAA,eAR+BM,MAQ/BN,CAAAA,MAAAA,EAAAA,OAAAA,CAAAA,GARyDM,MAQzDN,CAAAA,MAAAA,EAAAA,OAAAA,CAAAA,EAAAA,WAAAA,OAAAA,CAAAA,CAAAA;EAAW;;;EA0BR,KAAGI,EA9BTL,iBA8BSK;EAAiB;;;EAmBX,QAAA,EA7CZJ,WA6CY,EAAA;;;;;;;;;;;;;;;;;;;;;;UAvBdC,aAAaC;;;;SAIdK,SAASH;;;;WAIPD,QAAQK;;;;;;;;;;;;;;;kBAeDF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ClientTool, ServerTool } from "../tools.js";
|
|
2
1
|
import { AgentBuiltInState, Runtime } from "../runtime.js";
|
|
3
2
|
import { BaseMessage } from "@langchain/core/messages";
|
|
3
|
+
import { ClientTool, ServerTool } from "@langchain/core/tools";
|
|
4
4
|
import { LanguageModelLike } from "@langchain/core/language_models/base";
|
|
5
5
|
|
|
6
6
|
//#region src/agents/nodes/types.d.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","names":["LanguageModelLike","BaseMessage","ServerTool","ClientTool","Runtime","AgentBuiltInState","ModelRequest","Record","TState","TContext"],"sources":["../../../src/agents/nodes/types.d.ts"],"sourcesContent":["import type { LanguageModelLike } from \"@langchain/core/language_models/base\";\nimport type { BaseMessage } from \"@langchain/core/messages\";\nimport type { ServerTool, ClientTool } from \"
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":["LanguageModelLike","BaseMessage","ServerTool","ClientTool","Runtime","AgentBuiltInState","ModelRequest","Record","TState","TContext"],"sources":["../../../src/agents/nodes/types.d.ts"],"sourcesContent":["import type { LanguageModelLike } from \"@langchain/core/language_models/base\";\nimport type { BaseMessage } from \"@langchain/core/messages\";\nimport type { ServerTool, ClientTool } from \"@langchain/core/tools\";\nimport type { Runtime, AgentBuiltInState } from \"../runtime.js\";\n/**\n * Configuration for modifying a model call at runtime.\n * All fields are optional and only provided fields will override defaults.\n *\n * @template TState - The agent's state type, must extend Record<string, unknown>. Defaults to Record<string, unknown>.\n * @template TContext - The runtime context type for accessing metadata and control flow. Defaults to unknown.\n */\nexport interface ModelRequest<TState extends Record<string, unknown> = Record<string, unknown>, TContext = unknown> {\n /**\n * The model to use for this step.\n */\n model: LanguageModelLike;\n /**\n * The messages to send to the model.\n */\n messages: BaseMessage[];\n /**\n * The system message for this step.\n */\n systemPrompt?: string;\n /**\n * Tool choice configuration (model-specific format).\n * Can be one of:\n * - `\"auto\"`: means the model can pick between generating a message or calling one or more tools.\n * - `\"none\"`: means the model will not call any tool and instead generates a message.\n * - `\"required\"`: means the model must call one or more tools.\n * - `{ type: \"function\", function: { name: string } }`: The model will use the specified function.\n */\n toolChoice?: \"auto\" | \"none\" | \"required\" | {\n type: \"function\";\n function: {\n name: string;\n };\n };\n /**\n * The tools to make available for this step.\n */\n tools: (ServerTool | ClientTool)[];\n /**\n * The current agent state (includes both middleware state and built-in state).\n */\n state: TState & AgentBuiltInState;\n /**\n * The runtime context containing metadata, signal, writer, interrupt, etc.\n */\n runtime: Runtime<TContext>;\n /**\n * Additional settings to bind to the model when preparing it for invocation.\n * These settings are applied via `bindTools()` and can include parameters like\n * `headers`, `container`, etc. The model is re-bound on each request,\n * so these settings can vary per invocation.\n *\n * @example\n * ```ts\n * modelSettings: {\n * headers: { \"anthropic-beta\": \"code-execution-2025-08-25\" },\n * container: \"container_abc123\"\n * }\n * ```\n */\n modelSettings?: Record<string, unknown>;\n}\n"],"mappings":";;;;;;;;;AAWA;;;;;AAQcC,UARGK,YAQHL,CAAAA,eAR+BM,MAQ/BN,CAAAA,MAAAA,EAAAA,OAAAA,CAAAA,GARyDM,MAQzDN,CAAAA,MAAAA,EAAAA,OAAAA,CAAAA,EAAAA,WAAAA,OAAAA,CAAAA,CAAAA;EAAW;;;EA0BR,KAAGI,EA9BTL,iBA8BSK;EAAiB;;;EAmBX,QAAA,EA7CZJ,WA6CY,EAAA;;;;;;;;;;;;;;;;;;;;;;UAvBdC,aAAaC;;;;SAIdK,SAASH;;;;WAIPD,QAAQK;;;;;;;;;;;;;;;kBAeDF"}
|
|
@@ -13,7 +13,11 @@ const __langchain_core_utils_types = require_rolldown_runtime.__toESM(require("@
|
|
|
13
13
|
*/
|
|
14
14
|
async function initializeMiddlewareStates(middlewareList, state) {
|
|
15
15
|
const middlewareStates = {};
|
|
16
|
-
for (const middleware of middlewareList)
|
|
16
|
+
for (const middleware of middlewareList) {
|
|
17
|
+
/**
|
|
18
|
+
* skip middleware if it doesn't have a state schema
|
|
19
|
+
*/
|
|
20
|
+
if (!middleware.stateSchema) continue;
|
|
17
21
|
const modifiedSchema = (0, __langchain_core_utils_types.interopZodObjectMakeFieldsOptional)(middleware.stateSchema, (key) => key.startsWith("_"));
|
|
18
22
|
const parseResult = await (0, __langchain_core_utils_types.interopSafeParseAsync)(modifiedSchema, state);
|
|
19
23
|
if (parseResult.success) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.cjs","names":["middlewareList: readonly AgentMiddleware[]","state: unknown","middlewareStates: Record<string, any>","issue: ZodIssue","stateSchema?: z.ZodObject<z.ZodRawShape>","z","privateShape: Record<string, any>","target?: string","END"],"sources":["../../../src/agents/nodes/utils.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { z } from \"zod/v3\";\nimport { type BaseMessage } from \"@langchain/core/messages\";\nimport {\n interopSafeParseAsync,\n interopZodObjectMakeFieldsOptional,\n} from \"@langchain/core/utils/types\";\nimport { type ZodIssue } from \"zod/v3\";\nimport { END } from \"@langchain/langgraph\";\n\nimport type { JumpTo } from \"../types.js\";\nimport type { AgentMiddleware } from \"../middleware/types.js\";\n\n/**\n * Helper function to initialize middleware state defaults.\n * This is used to ensure all middleware state properties are initialized.\n *\n * Private properties (starting with _) are automatically made optional since\n * users cannot provide them when invoking the agent.\n */\nexport async function initializeMiddlewareStates(\n middlewareList: readonly AgentMiddleware[],\n state: unknown\n): Promise<Record<string, any>> {\n const middlewareStates: Record<string, any> = {};\n\n for (const middleware of middlewareList) {\n if (middleware.stateSchema) {\n // Create a modified schema where private properties are optional\n
|
|
1
|
+
{"version":3,"file":"utils.cjs","names":["middlewareList: readonly AgentMiddleware[]","state: unknown","middlewareStates: Record<string, any>","issue: ZodIssue","stateSchema?: z.ZodObject<z.ZodRawShape>","z","privateShape: Record<string, any>","target?: string","END"],"sources":["../../../src/agents/nodes/utils.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { z } from \"zod/v3\";\nimport { type BaseMessage } from \"@langchain/core/messages\";\nimport {\n interopSafeParseAsync,\n interopZodObjectMakeFieldsOptional,\n} from \"@langchain/core/utils/types\";\nimport { type ZodIssue } from \"zod/v3\";\nimport { END } from \"@langchain/langgraph\";\n\nimport type { JumpTo } from \"../types.js\";\nimport type { AgentMiddleware } from \"../middleware/types.js\";\n\n/**\n * Helper function to initialize middleware state defaults.\n * This is used to ensure all middleware state properties are initialized.\n *\n * Private properties (starting with _) are automatically made optional since\n * users cannot provide them when invoking the agent.\n */\nexport async function initializeMiddlewareStates(\n middlewareList: readonly AgentMiddleware[],\n state: unknown\n): Promise<Record<string, any>> {\n const middlewareStates: Record<string, any> = {};\n\n for (const middleware of middlewareList) {\n /**\n * skip middleware if it doesn't have a state schema\n */\n if (!middleware.stateSchema) {\n continue;\n }\n\n // Create a modified schema where private properties are optional\n const modifiedSchema = interopZodObjectMakeFieldsOptional(\n middleware.stateSchema,\n (key) => key.startsWith(\"_\")\n );\n\n // Use safeParse with the modified schema\n const parseResult = await interopSafeParseAsync(modifiedSchema, state);\n if (parseResult.success) {\n Object.assign(middlewareStates, parseResult.data);\n continue;\n }\n\n /**\n * If safeParse fails, there are required public fields missing\n */\n const requiredFields = parseResult.error.issues\n .filter(\n (issue: ZodIssue) =>\n issue.code === \"invalid_type\" && issue.message === \"Required\"\n )\n .map((issue: ZodIssue) => ` - ${issue.path.join(\".\")}: ${issue.message}`)\n .join(\"\\n\");\n\n throw new Error(\n `Middleware \"${middleware.name}\" has required state fields that must be initialized:\\n` +\n `${requiredFields}\\n\\n` +\n `To fix this, either:\\n` +\n `1. Provide default values in your middleware's state schema using .default():\\n` +\n ` stateSchema: z.object({\\n` +\n ` myField: z.string().default(\"default value\")\\n` +\n ` })\\n\\n` +\n `2. Or make the fields optional using .optional():\\n` +\n ` stateSchema: z.object({\\n` +\n ` myField: z.string().optional()\\n` +\n ` })\\n\\n` +\n `3. Or ensure you pass these values when invoking the agent:\\n` +\n ` agent.invoke({\\n` +\n ` messages: [...],\\n` +\n ` ${parseResult.error.issues[0]?.path.join(\".\")}: \"value\"\\n` +\n ` })`\n );\n }\n\n return middlewareStates;\n}\n\n/**\n * Users can define private and public state for a middleware. Private state properties start with an underscore.\n * This function will return the private state properties from the state schema, making all of them optional.\n * @param stateSchema - The middleware state schema\n * @returns A new schema containing only the private properties (underscore-prefixed), all made optional\n */\nexport function derivePrivateState(\n stateSchema?: z.ZodObject<z.ZodRawShape>\n): z.ZodObject<z.ZodRawShape> {\n const builtInStateSchema = {\n messages: z.custom<BaseMessage[]>(() => []),\n // Include optional structuredResponse so after_agent hooks can access/modify it\n structuredResponse: z.any().optional(),\n };\n\n if (!stateSchema) {\n return z.object(builtInStateSchema);\n }\n\n const { shape } = stateSchema;\n const privateShape: Record<string, any> = { ...builtInStateSchema };\n\n // Filter properties that start with underscore and make them optional\n for (const [key, value] of Object.entries(shape)) {\n if (key.startsWith(\"_\")) {\n // Make the private property optional\n privateShape[key] = value.optional();\n } else {\n privateShape[key] = value;\n }\n }\n\n // Return a new schema with only private properties (all optional)\n return z.object(privateShape);\n}\n\n/**\n * Parse `jumpTo` target from user facing labels to a LangGraph node names\n */\nexport function parseJumpToTarget(target: string): JumpTo;\nexport function parseJumpToTarget(target?: string): JumpTo | undefined {\n if (!target) {\n return undefined;\n }\n\n /**\n * if target is already a valid jump target, return it\n */\n if ([\"model_request\", \"tools\", END].includes(target)) {\n return target as JumpTo;\n }\n\n if (target === \"model\") {\n return \"model_request\";\n }\n if (target === \"tools\") {\n return \"tools\";\n }\n if (target === \"end\") {\n return END;\n }\n\n throw new Error(\n `Invalid jump target: ${target}, must be \"model\", \"tools\" or \"end\".`\n );\n}\n\n/**\n * TypeScript currently doesn't support types for `AbortSignal.any`\n * @see https://github.com/microsoft/TypeScript/issues/60695\n */\ndeclare const AbortSignal: {\n any(signals: AbortSignal[]): AbortSignal;\n};\n\n/**\n * `config` always contains a signal from LangGraphs Pregel class.\n * To ensure we acknowledge the abort signal from the user, we merge it\n * with the signal from the ToolNode.\n *\n * @param signals - The signals to merge.\n * @returns The merged signal.\n */\nexport function mergeAbortSignals(\n ...signals: (AbortSignal | undefined)[]\n): AbortSignal {\n return AbortSignal.any(\n signals.filter(\n (maybeSignal): maybeSignal is AbortSignal =>\n maybeSignal !== null &&\n maybeSignal !== undefined &&\n typeof maybeSignal === \"object\" &&\n \"aborted\" in maybeSignal &&\n typeof maybeSignal.aborted === \"boolean\"\n )\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAoBA,eAAsB,2BACpBA,gBACAC,OAC8B;CAC9B,MAAMC,mBAAwC,CAAE;AAEhD,MAAK,MAAM,cAAc,gBAAgB;;;;AAIvC,MAAI,CAAC,WAAW,YACd;EAIF,MAAM,sFACJ,WAAW,aACX,CAAC,QAAQ,IAAI,WAAW,IAAI,CAC7B;EAGD,MAAM,cAAc,8DAA4B,gBAAgB,MAAM;AACtE,MAAI,YAAY,SAAS;GACvB,OAAO,OAAO,kBAAkB,YAAY,KAAK;AACjD;EACD;;;;EAKD,MAAM,iBAAiB,YAAY,MAAM,OACtC,OACC,CAACC,UACC,MAAM,SAAS,kBAAkB,MAAM,YAAY,WACtD,CACA,IAAI,CAACA,UAAoB,CAAC,IAAI,EAAE,MAAM,KAAK,KAAK,IAAI,CAAC,EAAE,EAAE,MAAM,SAAS,CAAC,CACzE,KAAK,KAAK;AAEb,QAAM,IAAI,MACR,CAAC,YAAY,EAAE,WAAW,KAAK,uDAAuD,EACjF,eAAe,0aAAI,EAad,YAAY,MAAM,OAAO,IAAI,KAAK,KAAK,IAAI,CAAC,gBAAW,CACxD;CAEZ;AAED,QAAO;AACR;;;;;;;AAQD,SAAgB,mBACdC,aAC4B;CAC5B,MAAM,qBAAqB;EACzB,UAAUC,SAAE,OAAsB,MAAM,CAAE,EAAC;EAE3C,oBAAoBA,SAAE,KAAK,CAAC,UAAU;CACvC;AAED,KAAI,CAAC,YACH,QAAOA,SAAE,OAAO,mBAAmB;CAGrC,MAAM,EAAE,OAAO,GAAG;CAClB,MAAMC,eAAoC,EAAE,GAAG,mBAAoB;AAGnE,MAAK,MAAM,CAAC,KAAK,MAAM,IAAI,OAAO,QAAQ,MAAM,CAC9C,KAAI,IAAI,WAAW,IAAI,EAErB,aAAa,OAAO,MAAM,UAAU;MAEpC,aAAa,OAAO;AAKxB,QAAOD,SAAE,OAAO,aAAa;AAC9B;AAMD,SAAgB,kBAAkBE,QAAqC;AACrE,KAAI,CAAC,OACH,QAAO;;;;AAMT,KAAI;EAAC;EAAiB;EAASC;CAAI,EAAC,SAAS,OAAO,CAClD,QAAO;AAGT,KAAI,WAAW,QACb,QAAO;AAET,KAAI,WAAW,QACb,QAAO;AAET,KAAI,WAAW,MACb,QAAOA;AAGT,OAAM,IAAI,MACR,CAAC,qBAAqB,EAAE,OAAO,oCAAoC,CAAC;AAEvE;;;;;;;;;AAkBD,SAAgB,kBACd,GAAG,SACU;AACb,QAAO,YAAY,IACjB,QAAQ,OACN,CAAC,gBACC,gBAAgB,QAChB,gBAAgB,UAChB,OAAO,gBAAgB,YACvB,aAAa,eACb,OAAO,YAAY,YAAY,UAClC,CACF;AACF"}
|
|
@@ -12,7 +12,11 @@ import { interopSafeParseAsync, interopZodObjectMakeFieldsOptional } from "@lang
|
|
|
12
12
|
*/
|
|
13
13
|
async function initializeMiddlewareStates(middlewareList, state) {
|
|
14
14
|
const middlewareStates = {};
|
|
15
|
-
for (const middleware of middlewareList)
|
|
15
|
+
for (const middleware of middlewareList) {
|
|
16
|
+
/**
|
|
17
|
+
* skip middleware if it doesn't have a state schema
|
|
18
|
+
*/
|
|
19
|
+
if (!middleware.stateSchema) continue;
|
|
16
20
|
const modifiedSchema = interopZodObjectMakeFieldsOptional(middleware.stateSchema, (key) => key.startsWith("_"));
|
|
17
21
|
const parseResult = await interopSafeParseAsync(modifiedSchema, state);
|
|
18
22
|
if (parseResult.success) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":["middlewareList: readonly AgentMiddleware[]","state: unknown","middlewareStates: Record<string, any>","issue: ZodIssue","stateSchema?: z.ZodObject<z.ZodRawShape>","privateShape: Record<string, any>","target?: string"],"sources":["../../../src/agents/nodes/utils.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { z } from \"zod/v3\";\nimport { type BaseMessage } from \"@langchain/core/messages\";\nimport {\n interopSafeParseAsync,\n interopZodObjectMakeFieldsOptional,\n} from \"@langchain/core/utils/types\";\nimport { type ZodIssue } from \"zod/v3\";\nimport { END } from \"@langchain/langgraph\";\n\nimport type { JumpTo } from \"../types.js\";\nimport type { AgentMiddleware } from \"../middleware/types.js\";\n\n/**\n * Helper function to initialize middleware state defaults.\n * This is used to ensure all middleware state properties are initialized.\n *\n * Private properties (starting with _) are automatically made optional since\n * users cannot provide them when invoking the agent.\n */\nexport async function initializeMiddlewareStates(\n middlewareList: readonly AgentMiddleware[],\n state: unknown\n): Promise<Record<string, any>> {\n const middlewareStates: Record<string, any> = {};\n\n for (const middleware of middlewareList) {\n if (middleware.stateSchema) {\n // Create a modified schema where private properties are optional\n
|
|
1
|
+
{"version":3,"file":"utils.js","names":["middlewareList: readonly AgentMiddleware[]","state: unknown","middlewareStates: Record<string, any>","issue: ZodIssue","stateSchema?: z.ZodObject<z.ZodRawShape>","privateShape: Record<string, any>","target?: string"],"sources":["../../../src/agents/nodes/utils.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { z } from \"zod/v3\";\nimport { type BaseMessage } from \"@langchain/core/messages\";\nimport {\n interopSafeParseAsync,\n interopZodObjectMakeFieldsOptional,\n} from \"@langchain/core/utils/types\";\nimport { type ZodIssue } from \"zod/v3\";\nimport { END } from \"@langchain/langgraph\";\n\nimport type { JumpTo } from \"../types.js\";\nimport type { AgentMiddleware } from \"../middleware/types.js\";\n\n/**\n * Helper function to initialize middleware state defaults.\n * This is used to ensure all middleware state properties are initialized.\n *\n * Private properties (starting with _) are automatically made optional since\n * users cannot provide them when invoking the agent.\n */\nexport async function initializeMiddlewareStates(\n middlewareList: readonly AgentMiddleware[],\n state: unknown\n): Promise<Record<string, any>> {\n const middlewareStates: Record<string, any> = {};\n\n for (const middleware of middlewareList) {\n /**\n * skip middleware if it doesn't have a state schema\n */\n if (!middleware.stateSchema) {\n continue;\n }\n\n // Create a modified schema where private properties are optional\n const modifiedSchema = interopZodObjectMakeFieldsOptional(\n middleware.stateSchema,\n (key) => key.startsWith(\"_\")\n );\n\n // Use safeParse with the modified schema\n const parseResult = await interopSafeParseAsync(modifiedSchema, state);\n if (parseResult.success) {\n Object.assign(middlewareStates, parseResult.data);\n continue;\n }\n\n /**\n * If safeParse fails, there are required public fields missing\n */\n const requiredFields = parseResult.error.issues\n .filter(\n (issue: ZodIssue) =>\n issue.code === \"invalid_type\" && issue.message === \"Required\"\n )\n .map((issue: ZodIssue) => ` - ${issue.path.join(\".\")}: ${issue.message}`)\n .join(\"\\n\");\n\n throw new Error(\n `Middleware \"${middleware.name}\" has required state fields that must be initialized:\\n` +\n `${requiredFields}\\n\\n` +\n `To fix this, either:\\n` +\n `1. Provide default values in your middleware's state schema using .default():\\n` +\n ` stateSchema: z.object({\\n` +\n ` myField: z.string().default(\"default value\")\\n` +\n ` })\\n\\n` +\n `2. Or make the fields optional using .optional():\\n` +\n ` stateSchema: z.object({\\n` +\n ` myField: z.string().optional()\\n` +\n ` })\\n\\n` +\n `3. Or ensure you pass these values when invoking the agent:\\n` +\n ` agent.invoke({\\n` +\n ` messages: [...],\\n` +\n ` ${parseResult.error.issues[0]?.path.join(\".\")}: \"value\"\\n` +\n ` })`\n );\n }\n\n return middlewareStates;\n}\n\n/**\n * Users can define private and public state for a middleware. Private state properties start with an underscore.\n * This function will return the private state properties from the state schema, making all of them optional.\n * @param stateSchema - The middleware state schema\n * @returns A new schema containing only the private properties (underscore-prefixed), all made optional\n */\nexport function derivePrivateState(\n stateSchema?: z.ZodObject<z.ZodRawShape>\n): z.ZodObject<z.ZodRawShape> {\n const builtInStateSchema = {\n messages: z.custom<BaseMessage[]>(() => []),\n // Include optional structuredResponse so after_agent hooks can access/modify it\n structuredResponse: z.any().optional(),\n };\n\n if (!stateSchema) {\n return z.object(builtInStateSchema);\n }\n\n const { shape } = stateSchema;\n const privateShape: Record<string, any> = { ...builtInStateSchema };\n\n // Filter properties that start with underscore and make them optional\n for (const [key, value] of Object.entries(shape)) {\n if (key.startsWith(\"_\")) {\n // Make the private property optional\n privateShape[key] = value.optional();\n } else {\n privateShape[key] = value;\n }\n }\n\n // Return a new schema with only private properties (all optional)\n return z.object(privateShape);\n}\n\n/**\n * Parse `jumpTo` target from user facing labels to a LangGraph node names\n */\nexport function parseJumpToTarget(target: string): JumpTo;\nexport function parseJumpToTarget(target?: string): JumpTo | undefined {\n if (!target) {\n return undefined;\n }\n\n /**\n * if target is already a valid jump target, return it\n */\n if ([\"model_request\", \"tools\", END].includes(target)) {\n return target as JumpTo;\n }\n\n if (target === \"model\") {\n return \"model_request\";\n }\n if (target === \"tools\") {\n return \"tools\";\n }\n if (target === \"end\") {\n return END;\n }\n\n throw new Error(\n `Invalid jump target: ${target}, must be \"model\", \"tools\" or \"end\".`\n );\n}\n\n/**\n * TypeScript currently doesn't support types for `AbortSignal.any`\n * @see https://github.com/microsoft/TypeScript/issues/60695\n */\ndeclare const AbortSignal: {\n any(signals: AbortSignal[]): AbortSignal;\n};\n\n/**\n * `config` always contains a signal from LangGraphs Pregel class.\n * To ensure we acknowledge the abort signal from the user, we merge it\n * with the signal from the ToolNode.\n *\n * @param signals - The signals to merge.\n * @returns The merged signal.\n */\nexport function mergeAbortSignals(\n ...signals: (AbortSignal | undefined)[]\n): AbortSignal {\n return AbortSignal.any(\n signals.filter(\n (maybeSignal): maybeSignal is AbortSignal =>\n maybeSignal !== null &&\n maybeSignal !== undefined &&\n typeof maybeSignal === \"object\" &&\n \"aborted\" in maybeSignal &&\n typeof maybeSignal.aborted === \"boolean\"\n )\n );\n}\n"],"mappings":";;;;;;;;;;;;AAoBA,eAAsB,2BACpBA,gBACAC,OAC8B;CAC9B,MAAMC,mBAAwC,CAAE;AAEhD,MAAK,MAAM,cAAc,gBAAgB;;;;AAIvC,MAAI,CAAC,WAAW,YACd;EAIF,MAAM,iBAAiB,mCACrB,WAAW,aACX,CAAC,QAAQ,IAAI,WAAW,IAAI,CAC7B;EAGD,MAAM,cAAc,MAAM,sBAAsB,gBAAgB,MAAM;AACtE,MAAI,YAAY,SAAS;GACvB,OAAO,OAAO,kBAAkB,YAAY,KAAK;AACjD;EACD;;;;EAKD,MAAM,iBAAiB,YAAY,MAAM,OACtC,OACC,CAACC,UACC,MAAM,SAAS,kBAAkB,MAAM,YAAY,WACtD,CACA,IAAI,CAACA,UAAoB,CAAC,IAAI,EAAE,MAAM,KAAK,KAAK,IAAI,CAAC,EAAE,EAAE,MAAM,SAAS,CAAC,CACzE,KAAK,KAAK;AAEb,QAAM,IAAI,MACR,CAAC,YAAY,EAAE,WAAW,KAAK,uDAAuD,EACjF,eAAe,0aAAI,EAad,YAAY,MAAM,OAAO,IAAI,KAAK,KAAK,IAAI,CAAC,gBAAW,CACxD;CAEZ;AAED,QAAO;AACR;;;;;;;AAQD,SAAgB,mBACdC,aAC4B;CAC5B,MAAM,qBAAqB;EACzB,UAAU,EAAE,OAAsB,MAAM,CAAE,EAAC;EAE3C,oBAAoB,EAAE,KAAK,CAAC,UAAU;CACvC;AAED,KAAI,CAAC,YACH,QAAO,EAAE,OAAO,mBAAmB;CAGrC,MAAM,EAAE,OAAO,GAAG;CAClB,MAAMC,eAAoC,EAAE,GAAG,mBAAoB;AAGnE,MAAK,MAAM,CAAC,KAAK,MAAM,IAAI,OAAO,QAAQ,MAAM,CAC9C,KAAI,IAAI,WAAW,IAAI,EAErB,aAAa,OAAO,MAAM,UAAU;MAEpC,aAAa,OAAO;AAKxB,QAAO,EAAE,OAAO,aAAa;AAC9B;AAMD,SAAgB,kBAAkBC,QAAqC;AACrE,KAAI,CAAC,OACH,QAAO;;;;AAMT,KAAI;EAAC;EAAiB;EAAS;CAAI,EAAC,SAAS,OAAO,CAClD,QAAO;AAGT,KAAI,WAAW,QACb,QAAO;AAET,KAAI,WAAW,QACb,QAAO;AAET,KAAI,WAAW,MACb,QAAO;AAGT,OAAM,IAAI,MACR,CAAC,qBAAqB,EAAE,OAAO,oCAAoC,CAAC;AAEvE;;;;;;;;;AAkBD,SAAgB,kBACd,GAAG,SACU;AACb,QAAO,YAAY,IACjB,QAAQ,OACN,CAAC,gBACC,gBAAgB,QAChB,gBAAgB,UAChB,OAAO,gBAAgB,YACvB,aAAa,eACb,OAAO,YAAY,YAAY,UAClC,CACF;AACF"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BaseMessage } from "@langchain/core/messages";
|
|
2
|
+
import { BaseCallbackConfig } from "@langchain/core/callbacks/manager";
|
|
2
3
|
import { InteropZodDefault, InteropZodOptional } from "@langchain/core/utils/types";
|
|
3
4
|
import { PregelOptions, Runtime } from "@langchain/langgraph";
|
|
4
5
|
|
|
@@ -52,33 +53,12 @@ type WithMaybeContext<TContext> = undefined extends TContext ? {
|
|
|
52
53
|
/**
|
|
53
54
|
* Runtime information available to middleware (readonly).
|
|
54
55
|
*/
|
|
55
|
-
type Runtime$1<TContext = unknown> = Partial<Omit<Runtime<TContext>, "context" | "configurable">> & WithMaybeContext<TContext> &
|
|
56
|
+
type Runtime$1<TContext = unknown> = Partial<Omit<Runtime<TContext>, "context" | "configurable">> & WithMaybeContext<TContext> & {
|
|
56
57
|
configurable?: {
|
|
57
58
|
thread_id?: string;
|
|
58
59
|
[key: string]: unknown;
|
|
59
60
|
};
|
|
60
61
|
};
|
|
61
|
-
interface RunLevelPrivateState {
|
|
62
|
-
/**
|
|
63
|
-
* The number of times the model has been called at the run level.
|
|
64
|
-
* This includes multiple agent invocations.
|
|
65
|
-
*/
|
|
66
|
-
runModelCallCount: number;
|
|
67
|
-
}
|
|
68
|
-
interface ThreadLevelPrivateState {
|
|
69
|
-
/**
|
|
70
|
-
* The number of times the model has been called at the thread level.
|
|
71
|
-
* This includes multiple agent invocations within different environments
|
|
72
|
-
* using the same thread.
|
|
73
|
-
*/
|
|
74
|
-
threadLevelCallCount: number;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* As private state we consider all information we want to track within
|
|
78
|
-
* the lifecycle of the agent, without exposing it to the user. These informations
|
|
79
|
-
* are propagated to the user as _readonly_ runtime properties.
|
|
80
|
-
*/
|
|
81
|
-
interface PrivateState extends ThreadLevelPrivateState, RunLevelPrivateState {}
|
|
82
62
|
/**
|
|
83
63
|
* Helper type to check if a type is optional (includes undefined)
|
|
84
64
|
*/
|
|
@@ -97,6 +77,10 @@ undefined extends T ? true : IsOptionalType<T> extends true ? true : ExtractNonU
|
|
|
97
77
|
* Pregel options that are propagated to the agent
|
|
98
78
|
*/
|
|
99
79
|
type CreateAgentPregelOptions = "configurable" | "durability" | "store" | "cache" | "signal" | "recursionLimit" | "maxConcurrency" | "timeout";
|
|
80
|
+
/**
|
|
81
|
+
* Pregel stream options that are propagated to the agent
|
|
82
|
+
*/
|
|
83
|
+
type CreateAgentPregelStreamOptions = "encoding" | "streamMode";
|
|
100
84
|
/**
|
|
101
85
|
* Decide whether provided configuration requires a context
|
|
102
86
|
*/
|
|
@@ -104,20 +88,20 @@ type InvokeConfiguration<ContextSchema extends Record<string, any>> =
|
|
|
104
88
|
/**
|
|
105
89
|
* If the context schema is a default object, `context` can be optional
|
|
106
90
|
*/
|
|
107
|
-
ContextSchema extends InteropZodDefault<any> ? Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions>> & {
|
|
91
|
+
ContextSchema extends InteropZodDefault<any> ? BaseCallbackConfig & Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions>> & {
|
|
108
92
|
context?: Partial<ContextSchema>;
|
|
109
|
-
} : IsAllOptional<ContextSchema> extends true ? Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions>> & {
|
|
93
|
+
} : IsAllOptional<ContextSchema> extends true ? BaseCallbackConfig & Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions>> & {
|
|
110
94
|
context?: Partial<ContextSchema>;
|
|
111
|
-
} : Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions>> & WithMaybeContext<ContextSchema>;
|
|
95
|
+
} : BaseCallbackConfig & Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions>> & WithMaybeContext<ContextSchema>;
|
|
112
96
|
type StreamConfiguration<ContextSchema extends Record<string, any>> =
|
|
113
97
|
/**
|
|
114
98
|
* If the context schema is a default object, `context` can be optional
|
|
115
99
|
*/
|
|
116
100
|
ContextSchema extends InteropZodDefault<any> ? Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions>> & {
|
|
117
101
|
context?: Partial<ContextSchema>;
|
|
118
|
-
} : IsAllOptional<ContextSchema> extends true ? Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions |
|
|
102
|
+
} : IsAllOptional<ContextSchema> extends true ? Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions | CreateAgentPregelStreamOptions>> & {
|
|
119
103
|
context?: Partial<ContextSchema>;
|
|
120
|
-
} : Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions |
|
|
104
|
+
} : Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions | CreateAgentPregelStreamOptions>> & WithMaybeContext<ContextSchema>;
|
|
121
105
|
//#endregion
|
|
122
106
|
export { AgentBuiltInState, InvokeConfiguration, Runtime$1 as Runtime, StreamConfiguration };
|
|
123
107
|
//# sourceMappingURL=runtime.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.cts","names":["InteropZodOptional","InteropZodDefault","Runtime","LangGraphRuntime","PregelOptions","BaseMessage","ResponseFormatUndefined","AgentBuiltInState","Record","IsOptionalZodObject","T","IsDefaultZodObject","WithMaybeContext","TContext","Omit","Partial","
|
|
1
|
+
{"version":3,"file":"runtime.d.cts","names":["InteropZodOptional","InteropZodDefault","Runtime","LangGraphRuntime","PregelOptions","BaseMessage","BaseCallbackConfig","ResponseFormatUndefined","AgentBuiltInState","Record","IsOptionalZodObject","T","IsDefaultZodObject","WithMaybeContext","TContext","Omit","Partial","InternalAgentState","StructuredResponseType","IsOptionalType","ExtractNonUndefined","IsAllOptional","CreateAgentPregelOptions","CreateAgentPregelStreamOptions","InvokeConfiguration","ContextSchema","Pick","StreamConfiguration"],"sources":["../../src/agents/runtime.d.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { InteropZodOptional } from \"@langchain/core/utils/types\";\nimport type { InteropZodDefault } from \"@langchain/core/utils/types\";\nimport type { Runtime as LangGraphRuntime, PregelOptions } from \"@langchain/langgraph\";\nimport type { BaseMessage } from \"@langchain/core/messages\";\nimport type { BaseCallbackConfig } from \"@langchain/core/callbacks/manager\";\nimport type { ResponseFormatUndefined } from \"./responses.js\";\n/**\n * Type for the agent's built-in state properties.\n */\nexport type AgentBuiltInState = {\n /**\n * Array of messages representing the conversation history.\n *\n * This includes all messages exchanged during the agent's execution:\n * - Human messages: Input from the user\n * - AI messages: Responses from the language model\n * - Tool messages: Results from tool executions\n * - System messages: System-level instructions or information\n *\n * Messages are accumulated throughout the agent's lifecycle and can be\n * accessed or modified by middleware hooks during execution.\n */\n messages: BaseMessage[];\n /**\n * Structured response data returned by the agent when a `responseFormat` is configured.\n *\n * This property is only populated when you provide a `responseFormat` schema\n * (as Zod or JSON schema) to the agent configuration. The agent will format\n * its final output to match the specified schema and store it in this property.\n *\n * Note: The type is specified as `Record<string, unknown>` because TypeScript cannot\n * infer the actual response format type in contexts like middleware, where the agent's\n * generic type parameters are not accessible. You may need to cast this to your specific\n * response type when accessing it.\n */\n structuredResponse?: Record<string, unknown>;\n};\n/**\n * Type helper to check if TContext is an optional Zod schema\n */\ntype IsOptionalZodObject<T> = T extends InteropZodOptional<any> ? true : false;\ntype IsDefaultZodObject<T> = T extends InteropZodDefault<any> ? true : false;\nexport type WithMaybeContext<TContext> = undefined extends TContext ? {\n readonly context?: TContext;\n} : IsOptionalZodObject<TContext> extends true ? {\n readonly context?: TContext;\n} : IsDefaultZodObject<TContext> extends true ? {\n readonly context?: TContext;\n} : {\n readonly context: TContext;\n};\n/**\n * Runtime information available to middleware (readonly).\n */\nexport type Runtime<TContext = unknown> = Partial<Omit<LangGraphRuntime<TContext>, \"context\" | \"configurable\">> & WithMaybeContext<TContext> & {\n configurable?: {\n thread_id?: string;\n [key: string]: unknown;\n };\n};\nexport type InternalAgentState<StructuredResponseType extends Record<string, unknown> | undefined = Record<string, unknown>> = {\n messages: BaseMessage[];\n} & (StructuredResponseType extends ResponseFormatUndefined ? Record<string, never> : {\n structuredResponse: StructuredResponseType;\n});\n/**\n * Helper type to check if a type is optional (includes undefined)\n */\ntype IsOptionalType<T> = undefined extends T ? true : false;\n/**\n * Extract non-undefined part of a union that includes undefined\n */\ntype ExtractNonUndefined<T> = T extends undefined ? never : T;\n/**\n * Helper type to check if all properties of a type are optional\n */\nexport type IsAllOptional<T> = \n// If T includes undefined, then it's optional (can be omitted entirely)\nundefined extends T ? true : IsOptionalType<T> extends true ? true : ExtractNonUndefined<T> extends Record<string, any> ? {} extends ExtractNonUndefined<T> ? true : false : IsOptionalType<T>;\n/**\n * Pregel options that are propagated to the agent\n */\ntype CreateAgentPregelOptions = \"configurable\" | \"durability\" | \"store\" | \"cache\" | \"signal\" | \"recursionLimit\" | \"maxConcurrency\" | \"timeout\";\n/**\n * Pregel stream options that are propagated to the agent\n */\ntype CreateAgentPregelStreamOptions = \"encoding\" | \"streamMode\";\n/**\n * Decide whether provided configuration requires a context\n */\nexport type InvokeConfiguration<ContextSchema extends Record<string, any>> = \n/**\n * If the context schema is a default object, `context` can be optional\n */\nContextSchema extends InteropZodDefault<any> ? BaseCallbackConfig & Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions>> & {\n context?: Partial<ContextSchema>;\n} : IsAllOptional<ContextSchema> extends true ? BaseCallbackConfig & Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions>> & {\n context?: Partial<ContextSchema>;\n} : BaseCallbackConfig & Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions>> & WithMaybeContext<ContextSchema>;\nexport type StreamConfiguration<ContextSchema extends Record<string, any>> = \n/**\n * If the context schema is a default object, `context` can be optional\n */\nContextSchema extends InteropZodDefault<any> ? Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions>> & {\n context?: Partial<ContextSchema>;\n} : IsAllOptional<ContextSchema> extends true ? Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions | CreateAgentPregelStreamOptions>> & {\n context?: Partial<ContextSchema>;\n} : Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions | CreateAgentPregelStreamOptions>> & WithMaybeContext<ContextSchema>;\nexport {};\n"],"mappings":";;;;;;;;;;AAoC+B,KA1BnBQ,iBAAAA,GA0BmB;EAK1BE;;;;AAAqD;AAAA;;;;AACF;AACxD;;EAA4B,QAA+BI,EApB7CT,WAoB6CS,EAAAA;EAAQ;;;;;;;;AAOrC;AAK9B;;;EAAgF,kBAAzBX,CAAAA,EAnB9BM,MAmB8BN,CAAAA,MAAAA,EAAAA,OAAAA,CAAAA;CAAgB;;;;AAA2D,KAd7HO,mBAc6H,CAAA,CAAA,CAAA,GAdpGC,CAcoG,SAd1FX,kBAc0F,CAAA,GAAA,CAAA,GAAA,IAAA,GAAA,KAAA;AAU/H,KAvBEY,kBA2Bc,CAAA,CAAA,CAAA,GA3BUD,CA2BV,SA3BoBV,iBA2BK,CAAA,GAAA,CAAA,GAAA,IAAA,GAAA,KAAA;AAIvCmB,KA9BOP,gBA8BY,CAAA,QAAA,CAAA,GAAA,SAAA,SA9BmCC,QA8BnC,GAAA;EAAA,SAAA,OAAA,CAAA,EA7BDA,QA6BC;CAAA,GA5BpBJ,mBA4B0BC,CA5BNG,QA4BMH,CAAAA,SAAAA,IAAAA,GAAAA;EAAC,SAA6BA,OAAAA,CAAAA,EA3BrCG,QA2BqCH;AAAC,CAAA,GA1BzDC,kBA0ByD,CA1BtCE,QA0BsC,CAAA,SAAA,IAAA,GAAA;EAIjDO,SAAAA,OAAa,CAAA,EA7BFP,QA6BE;CAAA,GAAA;EAAA,SAEPH,OAAAA,EA7BIG,QA6BJH;CAAC;;;;AAAiFF,KAxBxFP,SAwBwFO,CAAAA,WAAAA,OAAAA,CAAAA,GAxB1DO,OAwB0DP,CAxBlDM,IAwBkDN,CAxB7CN,OAwB6CM,CAxB5BK,QAwB4BL,CAAAA,EAAAA,SAAAA,GAAAA,cAAAA,CAAAA,CAAAA,GAxBcI,gBAwBdJ,CAxB+BK,QAwB/BL,CAAAA,GAAAA;EAAM,YAA+CE,CAAAA,EAAAA;IAApBS,SAAAA,CAAAA,EAAAA,MAAAA;IAAuDT,CAAAA,GAAAA,EAAAA,MAAAA,CAAAA,EAAAA,OAAAA;EAAC,CAAA;AAAF,CAAA;;;;KAVtLQ,cA0B4Ef,CAAAA,CAAAA,CAAAA,GAAAA,SAAAA,SA1BtCO,CA0BsCP,GAAAA,IAAAA,GAAAA,KAAAA;;;;KAtB5EgB,mBAuBiBK,CAAAA,CAAAA,CAAAA,GAvBQd,CAuBRc,SAAAA,SAAAA,GAAAA,KAAAA,GAvBsCd,CAuBtCc;;;;AAC0BnB,KApBpCe,aAoBoCf,CAAAA,CAAAA,CAAAA;;SAAgEgB,SAlB9FX,CAkB8FW,GAAAA,IAAAA,GAlBnFH,cAkBmFG,CAlBpEX,CAkBoEW,CAAAA,SAAAA,IAAAA,GAAAA,IAAAA,GAlB3CF,mBAkB2CE,CAlBvBX,CAkBuBW,CAAAA,SAlBZb,MAkBYa,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA,GAAAA,CAAAA,CAAAA,SAlBqBF,mBAkBrBE,CAlByCX,CAkBzCW,CAAAA,GAAAA,IAAAA,GAAAA,KAAAA,GAlB6DH,cAkB7DG,CAlB4EX,CAkB5EW,CAAAA;;;;KAd3GA,wBAAAA,GAeSN,cAAAA,GAAAA,YAAAA,GAAAA,OAAAA,GAAAA,OAAAA,GAAAA,QAAAA,GAAAA,gBAAAA,GAAAA,gBAAAA,GAAAA,SAAAA;;;;KAXTO,8BAAAA,GAY4BG,UAAAA,GAAAA,YAAAA;;;;AAAgF,KARrGF,mBAQqG,CAAA,sBAR3Df,MAQ2D,CAAA,MAAA,EAAA,GAAA,CAAA,CAAA;AACjH;;;AALAgB,aASAA,SATsBxB,iBAStBwB,CAAAA,GAAAA,CAAAA,GAT+CnB,kBAS/CmB,GAToET,OASpES,CAT4EC,IAS5ED,CATiFrB,aASjFqB,CAAAA,GAAAA,EAAAA,GAAAA,EAAAA,GAAAA,CAAAA,EAT+GH,wBAS/GG,CAAAA,CAAAA,GAAAA;EAAa,OAASxB,CAAAA,EARRe,OAQQf,CARAwB,aAQAxB,CAAAA;CAAiB,GAPnCoB,aAOwDjB,CAP1CqB,aAO0CrB,CAAAA,SAAAA,IAAAA,GAPZE,kBAOYF,GAPSY,OAOTZ,CAPiBsB,IAOjBtB,CAPsBA,aAOtBA,CAAAA,GAAAA,EAAAA,GAAAA,EAAAA,GAAAA,CAAAA,EAPoDkB,wBAOpDlB,CAAAA,CAAAA,GAAAA;EAAa,OAAiBkB,CAAAA,EAN5EN,OAM4EM,CANpEG,aAMoEH,CAAAA;CAAwB,GAL9GhB,kBAKmDoB,GAL9BV,OAK8BU,CALtBA,IAKsBA,CALjBtB,aAKiBsB,CAAAA,GAAAA,EAAAA,GAAAA,EAAAA,GAAAA,CAAAA,EALaJ,wBAKbI,CAAAA,CAAAA,GAL0Cb,gBAK1Ca,CAL2DD,aAK3DC,CAAAA;AAARV,KAJnCW,mBAImCX,CAAAA,sBAJOP,MAIPO,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA,CAAAA;;;;AAA/CS,aAEIJ,SAFkBpB,iBAElBoB,CAAAA,GAAAA,CAAAA,GAF2CL,OAE3CK,CAFmDK,IAEnDL,CAFwDjB,aAExDiB,CAAAA,GAAAA,EAAAA,GAAAA,EAAAA,GAAAA,CAAAA,EAFsFC,wBAEtFD,CAAAA,CAAAA,GAAAA;EAAa,OAA4CjB,CAAAA,EAD/CY,OAC+CZ,CADvCqB,aACuCrB,CAAAA;CAAa,GAAtEiB,aAAuFC,CAAzEG,aAAyEH,CAAAA,SAAAA,IAAAA,GAA3CN,OAA2CM,CAAnCI,IAAmCJ,CAA9BlB,aAA8BkB,CAAAA,GAAAA,EAAAA,GAAAA,EAAAA,GAAAA,CAAAA,EAAAA,wBAAAA,GAA2BC,8BAA3BD,CAAAA,CAAAA,GAAAA;EAAwB,OAAGC,CAAAA,EACxGP,OADwGO,CAChGE,aADgGF,CAAAA;CAA8B,GAEhJP,OAFoDU,CAE5CA,IAF4CA,CAEvCtB,aAFuCsB,CAAAA,GAAAA,EAAAA,GAAAA,EAAAA,GAAAA,CAAAA,EAETJ,wBAFSI,GAEkBH,8BAFlBG,CAAAA,CAAAA,GAEqDb,gBAFrDa,CAEsED,aAFtEC,CAAAA"}
|
package/dist/agents/runtime.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { BaseMessage } from "@langchain/core/messages";
|
|
2
2
|
import { PregelOptions, Runtime } from "@langchain/langgraph";
|
|
3
3
|
import { InteropZodDefault, InteropZodOptional } from "@langchain/core/utils/types";
|
|
4
|
+
import { BaseCallbackConfig } from "@langchain/core/callbacks/manager";
|
|
4
5
|
|
|
5
6
|
//#region src/agents/runtime.d.ts
|
|
6
7
|
|
|
@@ -52,33 +53,12 @@ type WithMaybeContext<TContext> = undefined extends TContext ? {
|
|
|
52
53
|
/**
|
|
53
54
|
* Runtime information available to middleware (readonly).
|
|
54
55
|
*/
|
|
55
|
-
type Runtime$1<TContext = unknown> = Partial<Omit<Runtime<TContext>, "context" | "configurable">> & WithMaybeContext<TContext> &
|
|
56
|
+
type Runtime$1<TContext = unknown> = Partial<Omit<Runtime<TContext>, "context" | "configurable">> & WithMaybeContext<TContext> & {
|
|
56
57
|
configurable?: {
|
|
57
58
|
thread_id?: string;
|
|
58
59
|
[key: string]: unknown;
|
|
59
60
|
};
|
|
60
61
|
};
|
|
61
|
-
interface RunLevelPrivateState {
|
|
62
|
-
/**
|
|
63
|
-
* The number of times the model has been called at the run level.
|
|
64
|
-
* This includes multiple agent invocations.
|
|
65
|
-
*/
|
|
66
|
-
runModelCallCount: number;
|
|
67
|
-
}
|
|
68
|
-
interface ThreadLevelPrivateState {
|
|
69
|
-
/**
|
|
70
|
-
* The number of times the model has been called at the thread level.
|
|
71
|
-
* This includes multiple agent invocations within different environments
|
|
72
|
-
* using the same thread.
|
|
73
|
-
*/
|
|
74
|
-
threadLevelCallCount: number;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* As private state we consider all information we want to track within
|
|
78
|
-
* the lifecycle of the agent, without exposing it to the user. These informations
|
|
79
|
-
* are propagated to the user as _readonly_ runtime properties.
|
|
80
|
-
*/
|
|
81
|
-
interface PrivateState extends ThreadLevelPrivateState, RunLevelPrivateState {}
|
|
82
62
|
/**
|
|
83
63
|
* Helper type to check if a type is optional (includes undefined)
|
|
84
64
|
*/
|
|
@@ -97,6 +77,10 @@ undefined extends T ? true : IsOptionalType<T> extends true ? true : ExtractNonU
|
|
|
97
77
|
* Pregel options that are propagated to the agent
|
|
98
78
|
*/
|
|
99
79
|
type CreateAgentPregelOptions = "configurable" | "durability" | "store" | "cache" | "signal" | "recursionLimit" | "maxConcurrency" | "timeout";
|
|
80
|
+
/**
|
|
81
|
+
* Pregel stream options that are propagated to the agent
|
|
82
|
+
*/
|
|
83
|
+
type CreateAgentPregelStreamOptions = "encoding" | "streamMode";
|
|
100
84
|
/**
|
|
101
85
|
* Decide whether provided configuration requires a context
|
|
102
86
|
*/
|
|
@@ -104,20 +88,20 @@ type InvokeConfiguration<ContextSchema extends Record<string, any>> =
|
|
|
104
88
|
/**
|
|
105
89
|
* If the context schema is a default object, `context` can be optional
|
|
106
90
|
*/
|
|
107
|
-
ContextSchema extends InteropZodDefault<any> ? Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions>> & {
|
|
91
|
+
ContextSchema extends InteropZodDefault<any> ? BaseCallbackConfig & Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions>> & {
|
|
108
92
|
context?: Partial<ContextSchema>;
|
|
109
|
-
} : IsAllOptional<ContextSchema> extends true ? Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions>> & {
|
|
93
|
+
} : IsAllOptional<ContextSchema> extends true ? BaseCallbackConfig & Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions>> & {
|
|
110
94
|
context?: Partial<ContextSchema>;
|
|
111
|
-
} : Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions>> & WithMaybeContext<ContextSchema>;
|
|
95
|
+
} : BaseCallbackConfig & Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions>> & WithMaybeContext<ContextSchema>;
|
|
112
96
|
type StreamConfiguration<ContextSchema extends Record<string, any>> =
|
|
113
97
|
/**
|
|
114
98
|
* If the context schema is a default object, `context` can be optional
|
|
115
99
|
*/
|
|
116
100
|
ContextSchema extends InteropZodDefault<any> ? Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions>> & {
|
|
117
101
|
context?: Partial<ContextSchema>;
|
|
118
|
-
} : IsAllOptional<ContextSchema> extends true ? Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions |
|
|
102
|
+
} : IsAllOptional<ContextSchema> extends true ? Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions | CreateAgentPregelStreamOptions>> & {
|
|
119
103
|
context?: Partial<ContextSchema>;
|
|
120
|
-
} : Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions |
|
|
104
|
+
} : Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions | CreateAgentPregelStreamOptions>> & WithMaybeContext<ContextSchema>;
|
|
121
105
|
//#endregion
|
|
122
106
|
export { AgentBuiltInState, InvokeConfiguration, Runtime$1 as Runtime, StreamConfiguration };
|
|
123
107
|
//# sourceMappingURL=runtime.d.ts.map
|