@librechat/agents 3.2.21 → 3.2.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/agents/AgentContext.cjs +3 -2
- package/dist/cjs/agents/AgentContext.cjs.map +1 -1
- package/dist/cjs/events.cjs.map +1 -1
- package/dist/cjs/graphs/Graph.cjs +200 -54
- package/dist/cjs/graphs/Graph.cjs.map +1 -1
- package/dist/cjs/graphs/MultiAgentGraph.cjs.map +1 -1
- package/dist/cjs/hooks/createWorkspacePolicyHook.cjs +13 -7
- package/dist/cjs/hooks/createWorkspacePolicyHook.cjs.map +1 -1
- package/dist/cjs/hooks/executeHooks.cjs.map +1 -1
- package/dist/cjs/hooks/types.cjs.map +1 -1
- package/dist/cjs/instrumentation.cjs +2 -2
- package/dist/cjs/instrumentation.cjs.map +1 -1
- package/dist/cjs/langfuse.cjs +17 -1
- package/dist/cjs/langfuse.cjs.map +1 -1
- package/dist/cjs/langfuseToolOutputTracing.cjs +2 -2
- package/dist/cjs/langfuseToolOutputTracing.cjs.map +1 -1
- package/dist/cjs/llm/anthropic/index.cjs +1 -1
- package/dist/cjs/llm/anthropic/index.cjs.map +1 -1
- package/dist/cjs/llm/anthropic/utils/message_inputs.cjs +38 -3
- package/dist/cjs/llm/anthropic/utils/message_inputs.cjs.map +1 -1
- package/dist/cjs/llm/anthropic/utils/message_outputs.cjs +6 -2
- package/dist/cjs/llm/anthropic/utils/message_outputs.cjs.map +1 -1
- package/dist/cjs/llm/bedrock/index.cjs +2 -2
- package/dist/cjs/llm/bedrock/index.cjs.map +1 -1
- package/dist/cjs/llm/bedrock/toolCache.cjs +8 -5
- package/dist/cjs/llm/bedrock/toolCache.cjs.map +1 -1
- package/dist/cjs/llm/fake.cjs +16 -14
- package/dist/cjs/llm/fake.cjs.map +1 -1
- package/dist/cjs/llm/google/index.cjs +22 -0
- package/dist/cjs/llm/google/index.cjs.map +1 -1
- package/dist/cjs/llm/google/utils/common.cjs +88 -27
- package/dist/cjs/llm/google/utils/common.cjs.map +1 -1
- package/dist/cjs/llm/init.cjs +2 -2
- package/dist/cjs/llm/invoke.cjs +108 -11
- package/dist/cjs/llm/invoke.cjs.map +1 -1
- package/dist/cjs/llm/openai/index.cjs +1 -1
- package/dist/cjs/llm/openai/index.cjs.map +1 -1
- package/dist/cjs/llm/openai/utils/index.cjs +1 -1
- package/dist/cjs/llm/openai/utils/index.cjs.map +1 -1
- package/dist/cjs/llm/openrouter/index.cjs.map +1 -1
- package/dist/cjs/llm/vertexai/index.cjs.map +1 -1
- package/dist/cjs/main.cjs +1 -0
- package/dist/cjs/main.cjs.map +1 -1
- package/dist/cjs/messages/cache.cjs +29 -8
- package/dist/cjs/messages/cache.cjs.map +1 -1
- package/dist/cjs/messages/content.cjs.map +1 -1
- package/dist/cjs/messages/contextPruning.cjs.map +1 -1
- package/dist/cjs/messages/format.cjs +129 -17
- package/dist/cjs/messages/format.cjs.map +1 -1
- package/dist/cjs/messages/prune.cjs.map +1 -1
- package/dist/cjs/messages/reducer.cjs +1 -1
- package/dist/cjs/messages/reducer.cjs.map +1 -1
- package/dist/cjs/messages/tools.cjs +1 -1
- package/dist/cjs/messages/tools.cjs.map +1 -1
- package/dist/cjs/openai/index.cjs.map +1 -1
- package/dist/cjs/responses/index.cjs.map +1 -1
- package/dist/cjs/run.cjs +41 -20
- package/dist/cjs/run.cjs.map +1 -1
- package/dist/cjs/session/AgentSession.cjs +4 -4
- package/dist/cjs/session/AgentSession.cjs.map +1 -1
- package/dist/cjs/session/JsonlSessionStore.cjs +2 -2
- package/dist/cjs/session/JsonlSessionStore.cjs.map +1 -1
- package/dist/cjs/session/handlers.cjs +2 -2
- package/dist/cjs/session/handlers.cjs.map +1 -1
- package/dist/cjs/stream.cjs +248 -25
- package/dist/cjs/stream.cjs.map +1 -1
- package/dist/cjs/summarization/node.cjs.map +1 -1
- package/dist/cjs/tools/BashProgrammaticToolCalling.cjs +1 -1
- package/dist/cjs/tools/BashProgrammaticToolCalling.cjs.map +1 -1
- package/dist/cjs/tools/Calculator.cjs +1 -1
- package/dist/cjs/tools/Calculator.cjs.map +1 -1
- package/dist/cjs/tools/CodeExecutor.cjs +1 -1
- package/dist/cjs/tools/CodeExecutor.cjs.map +1 -1
- package/dist/cjs/tools/SubagentTool.cjs.map +1 -1
- package/dist/cjs/tools/ToolNode.cjs +37 -18
- package/dist/cjs/tools/ToolNode.cjs.map +1 -1
- package/dist/cjs/tools/ToolSearch.cjs +1 -1
- package/dist/cjs/tools/ToolSearch.cjs.map +1 -1
- package/dist/cjs/tools/cloudflare/CloudflareSandboxExecutionEngine.cjs +7 -4
- package/dist/cjs/tools/cloudflare/CloudflareSandboxExecutionEngine.cjs.map +1 -1
- package/dist/cjs/tools/cloudflare/CloudflareSandboxTools.cjs +4 -4
- package/dist/cjs/tools/cloudflare/CloudflareSandboxTools.cjs.map +1 -1
- package/dist/cjs/tools/handlers.cjs +2 -1
- package/dist/cjs/tools/handlers.cjs.map +1 -1
- package/dist/cjs/tools/local/CompileCheckTool.cjs.map +1 -1
- package/dist/cjs/tools/local/FileCheckpointer.cjs +2 -1
- package/dist/cjs/tools/local/FileCheckpointer.cjs.map +1 -1
- package/dist/cjs/tools/local/LocalCodingTools.cjs +45 -19
- package/dist/cjs/tools/local/LocalCodingTools.cjs.map +1 -1
- package/dist/cjs/tools/local/LocalExecutionEngine.cjs +3 -3
- package/dist/cjs/tools/local/LocalExecutionEngine.cjs.map +1 -1
- package/dist/cjs/tools/local/LocalExecutionTools.cjs +2 -2
- package/dist/cjs/tools/local/LocalExecutionTools.cjs.map +1 -1
- package/dist/cjs/tools/local/LocalProgrammaticToolCalling.cjs +4 -3
- package/dist/cjs/tools/local/LocalProgrammaticToolCalling.cjs.map +1 -1
- package/dist/cjs/tools/local/attachments.cjs +0 -5
- package/dist/cjs/tools/local/attachments.cjs.map +1 -1
- package/dist/cjs/tools/local/resolveLocalExecutionTools.cjs +4 -4
- package/dist/cjs/tools/local/resolveLocalExecutionTools.cjs.map +1 -1
- package/dist/cjs/tools/search/firecrawl.cjs +1 -1
- package/dist/cjs/tools/search/firecrawl.cjs.map +1 -1
- package/dist/cjs/tools/search/rerankers.cjs +7 -3
- package/dist/cjs/tools/search/rerankers.cjs.map +1 -1
- package/dist/cjs/tools/search/tavily-search.cjs +1 -1
- package/dist/cjs/tools/search/tavily-search.cjs.map +1 -1
- package/dist/cjs/tools/search/utils.cjs +76 -8
- package/dist/cjs/tools/search/utils.cjs.map +1 -1
- package/dist/cjs/tools/subagent/SubagentExecutor.cjs +1 -1
- package/dist/cjs/tools/subagent/SubagentExecutor.cjs.map +1 -1
- package/dist/cjs/utils/handlers.cjs +1 -1
- package/dist/cjs/utils/handlers.cjs.map +1 -1
- package/dist/cjs/utils/run.cjs +1 -1
- package/dist/cjs/utils/run.cjs.map +1 -1
- package/dist/esm/agents/AgentContext.mjs +3 -2
- package/dist/esm/agents/AgentContext.mjs.map +1 -1
- package/dist/esm/events.mjs.map +1 -1
- package/dist/esm/graphs/Graph.mjs +200 -54
- package/dist/esm/graphs/Graph.mjs.map +1 -1
- package/dist/esm/graphs/MultiAgentGraph.mjs.map +1 -1
- package/dist/esm/hooks/createWorkspacePolicyHook.mjs +13 -7
- package/dist/esm/hooks/createWorkspacePolicyHook.mjs.map +1 -1
- package/dist/esm/hooks/executeHooks.mjs.map +1 -1
- package/dist/esm/hooks/types.mjs.map +1 -1
- package/dist/esm/instrumentation.mjs +2 -2
- package/dist/esm/instrumentation.mjs.map +1 -1
- package/dist/esm/langfuse.mjs +17 -2
- package/dist/esm/langfuse.mjs.map +1 -1
- package/dist/esm/langfuseToolOutputTracing.mjs +2 -2
- package/dist/esm/langfuseToolOutputTracing.mjs.map +1 -1
- package/dist/esm/llm/anthropic/index.mjs +1 -1
- package/dist/esm/llm/anthropic/index.mjs.map +1 -1
- package/dist/esm/llm/anthropic/utils/message_inputs.mjs +38 -3
- package/dist/esm/llm/anthropic/utils/message_inputs.mjs.map +1 -1
- package/dist/esm/llm/anthropic/utils/message_outputs.mjs +6 -2
- package/dist/esm/llm/anthropic/utils/message_outputs.mjs.map +1 -1
- package/dist/esm/llm/bedrock/index.mjs +2 -2
- package/dist/esm/llm/bedrock/index.mjs.map +1 -1
- package/dist/esm/llm/bedrock/toolCache.mjs +8 -5
- package/dist/esm/llm/bedrock/toolCache.mjs.map +1 -1
- package/dist/esm/llm/fake.mjs +16 -14
- package/dist/esm/llm/fake.mjs.map +1 -1
- package/dist/esm/llm/google/index.mjs +23 -1
- package/dist/esm/llm/google/index.mjs.map +1 -1
- package/dist/esm/llm/google/utils/common.mjs +88 -27
- package/dist/esm/llm/google/utils/common.mjs.map +1 -1
- package/dist/esm/llm/init.mjs +2 -2
- package/dist/esm/llm/invoke.mjs +104 -7
- package/dist/esm/llm/invoke.mjs.map +1 -1
- package/dist/esm/llm/openai/index.mjs +1 -1
- package/dist/esm/llm/openai/index.mjs.map +1 -1
- package/dist/esm/llm/openai/utils/index.mjs +1 -1
- package/dist/esm/llm/openai/utils/index.mjs.map +1 -1
- package/dist/esm/llm/openrouter/index.mjs.map +1 -1
- package/dist/esm/llm/vertexai/index.mjs.map +1 -1
- package/dist/esm/main.mjs +1 -1
- package/dist/esm/messages/cache.mjs +29 -8
- package/dist/esm/messages/cache.mjs.map +1 -1
- package/dist/esm/messages/content.mjs.map +1 -1
- package/dist/esm/messages/contextPruning.mjs.map +1 -1
- package/dist/esm/messages/format.mjs +129 -18
- package/dist/esm/messages/format.mjs.map +1 -1
- package/dist/esm/messages/prune.mjs.map +1 -1
- package/dist/esm/messages/reducer.mjs +1 -1
- package/dist/esm/messages/reducer.mjs.map +1 -1
- package/dist/esm/messages/tools.mjs +1 -1
- package/dist/esm/messages/tools.mjs.map +1 -1
- package/dist/esm/openai/index.mjs.map +1 -1
- package/dist/esm/responses/index.mjs.map +1 -1
- package/dist/esm/run.mjs +41 -20
- package/dist/esm/run.mjs.map +1 -1
- package/dist/esm/session/AgentSession.mjs +4 -4
- package/dist/esm/session/AgentSession.mjs.map +1 -1
- package/dist/esm/session/JsonlSessionStore.mjs +2 -2
- package/dist/esm/session/JsonlSessionStore.mjs.map +1 -1
- package/dist/esm/session/handlers.mjs +2 -2
- package/dist/esm/session/handlers.mjs.map +1 -1
- package/dist/esm/stream.mjs +248 -25
- package/dist/esm/stream.mjs.map +1 -1
- package/dist/esm/summarization/node.mjs.map +1 -1
- package/dist/esm/tools/BashProgrammaticToolCalling.mjs +1 -1
- package/dist/esm/tools/BashProgrammaticToolCalling.mjs.map +1 -1
- package/dist/esm/tools/Calculator.mjs +1 -1
- package/dist/esm/tools/Calculator.mjs.map +1 -1
- package/dist/esm/tools/CodeExecutor.mjs +1 -1
- package/dist/esm/tools/CodeExecutor.mjs.map +1 -1
- package/dist/esm/tools/SubagentTool.mjs.map +1 -1
- package/dist/esm/tools/ToolNode.mjs +37 -18
- package/dist/esm/tools/ToolNode.mjs.map +1 -1
- package/dist/esm/tools/ToolSearch.mjs +1 -1
- package/dist/esm/tools/ToolSearch.mjs.map +1 -1
- package/dist/esm/tools/cloudflare/CloudflareSandboxExecutionEngine.mjs +7 -4
- package/dist/esm/tools/cloudflare/CloudflareSandboxExecutionEngine.mjs.map +1 -1
- package/dist/esm/tools/cloudflare/CloudflareSandboxTools.mjs +4 -4
- package/dist/esm/tools/cloudflare/CloudflareSandboxTools.mjs.map +1 -1
- package/dist/esm/tools/handlers.mjs +2 -1
- package/dist/esm/tools/handlers.mjs.map +1 -1
- package/dist/esm/tools/local/CompileCheckTool.mjs.map +1 -1
- package/dist/esm/tools/local/FileCheckpointer.mjs +2 -1
- package/dist/esm/tools/local/FileCheckpointer.mjs.map +1 -1
- package/dist/esm/tools/local/LocalCodingTools.mjs +45 -19
- package/dist/esm/tools/local/LocalCodingTools.mjs.map +1 -1
- package/dist/esm/tools/local/LocalExecutionEngine.mjs +3 -3
- package/dist/esm/tools/local/LocalExecutionEngine.mjs.map +1 -1
- package/dist/esm/tools/local/LocalExecutionTools.mjs +2 -2
- package/dist/esm/tools/local/LocalExecutionTools.mjs.map +1 -1
- package/dist/esm/tools/local/LocalProgrammaticToolCalling.mjs +4 -3
- package/dist/esm/tools/local/LocalProgrammaticToolCalling.mjs.map +1 -1
- package/dist/esm/tools/local/attachments.mjs +0 -5
- package/dist/esm/tools/local/attachments.mjs.map +1 -1
- package/dist/esm/tools/local/resolveLocalExecutionTools.mjs +4 -4
- package/dist/esm/tools/local/resolveLocalExecutionTools.mjs.map +1 -1
- package/dist/esm/tools/search/firecrawl.mjs +1 -1
- package/dist/esm/tools/search/firecrawl.mjs.map +1 -1
- package/dist/esm/tools/search/rerankers.mjs +8 -4
- package/dist/esm/tools/search/rerankers.mjs.map +1 -1
- package/dist/esm/tools/search/tavily-search.mjs +1 -1
- package/dist/esm/tools/search/tavily-search.mjs.map +1 -1
- package/dist/esm/tools/search/utils.mjs +76 -9
- package/dist/esm/tools/search/utils.mjs.map +1 -1
- package/dist/esm/tools/subagent/SubagentExecutor.mjs +1 -1
- package/dist/esm/tools/subagent/SubagentExecutor.mjs.map +1 -1
- package/dist/esm/utils/handlers.mjs +1 -1
- package/dist/esm/utils/handlers.mjs.map +1 -1
- package/dist/esm/utils/run.mjs +1 -1
- package/dist/esm/utils/run.mjs.map +1 -1
- package/dist/types/agents/__tests__/promptCacheLiveHelpers.d.ts +1 -1
- package/dist/types/events.d.ts +1 -1
- package/dist/types/graphs/Graph.d.ts +7 -1
- package/dist/types/hooks/executeHooks.d.ts +1 -1
- package/dist/types/hooks/types.d.ts +5 -0
- package/dist/types/langfuse.d.ts +4 -0
- package/dist/types/llm/anthropic/utils/message_inputs.d.ts +1 -1
- package/dist/types/llm/anthropic/utils/message_outputs.d.ts +1 -1
- package/dist/types/llm/anthropic/utils/output_parsers.d.ts +2 -2
- package/dist/types/llm/bedrock/index.d.ts +2 -2
- package/dist/types/llm/fake.d.ts +3 -3
- package/dist/types/llm/google/index.d.ts +1 -0
- package/dist/types/llm/google/types.d.ts +1 -1
- package/dist/types/llm/google/utils/common.d.ts +2 -2
- package/dist/types/llm/google/utils/tools.d.ts +1 -1
- package/dist/types/llm/google/utils/zod_to_genai_parameters.d.ts +1 -1
- package/dist/types/llm/openai/index.d.ts +2 -2
- package/dist/types/llm/openai/utils/index.d.ts +1 -1
- package/dist/types/llm/openrouter/index.d.ts +4 -4
- package/dist/types/messages/contextPruning.d.ts +1 -1
- package/dist/types/messages/format.d.ts +14 -4
- package/dist/types/messages/prune.d.ts +1 -1
- package/dist/types/session/JsonlSessionStore.d.ts +1 -1
- package/dist/types/session/handlers.d.ts +1 -1
- package/dist/types/session/types.d.ts +1 -1
- package/dist/types/summarization/node.d.ts +1 -1
- package/dist/types/tools/SubagentTool.d.ts +2 -2
- package/dist/types/tools/ToolNode.d.ts +9 -2
- package/dist/types/tools/cloudflare/CloudflareSandboxExecutionEngine.d.ts +1 -1
- package/dist/types/tools/search/types.d.ts +1 -1
- package/dist/types/tools/search/utils.d.ts +11 -0
- package/dist/types/types/graph.d.ts +4 -4
- package/dist/types/types/llm.d.ts +4 -3
- package/dist/types/types/messages.d.ts +1 -1
- package/dist/types/types/run.d.ts +6 -6
- package/dist/types/types/stream.d.ts +2 -2
- package/dist/types/types/tools.d.ts +5 -1
- package/dist/types/utils/handlers.d.ts +2 -2
- package/dist/types/utils/run.d.ts +1 -1
- package/package.json +13 -10
- package/src/__tests__/stream.eagerEventExecution.test.ts +543 -6
- package/src/agents/AgentContext.ts +2 -2
- package/src/agents/__tests__/AgentContext.test.ts +3 -3
- package/src/agents/__tests__/promptCacheLiveHelpers.ts +1 -1
- package/src/events.ts +1 -1
- package/src/graphs/Graph.ts +329 -72
- package/src/graphs/MultiAgentGraph.ts +1 -1
- package/src/graphs/__tests__/Graph.reasoning.test.ts +919 -6
- package/src/graphs/__tests__/MultiAgentGraph.test.ts +1 -1
- package/src/graphs/__tests__/composition.smoke.test.ts +1 -1
- package/src/hooks/__tests__/HookRegistry.test.ts +1 -1
- package/src/hooks/__tests__/compactHooks.test.ts +8 -8
- package/src/hooks/__tests__/createWorkspacePolicyHook.test.ts +34 -22
- package/src/hooks/__tests__/executeHooks.test.ts +3 -3
- package/src/hooks/__tests__/integration.test.ts +3 -3
- package/src/hooks/__tests__/toolHooks.test.ts +10 -10
- package/src/hooks/createWorkspacePolicyHook.ts +17 -14
- package/src/hooks/executeHooks.ts +1 -1
- package/src/hooks/types.ts +5 -0
- package/src/instrumentation.ts +11 -11
- package/src/langfuse.ts +35 -1
- package/src/langfuseToolOutputTracing.ts +2 -2
- package/src/llm/anthropic/index.ts +1 -1
- package/src/llm/anthropic/llm.spec.ts +36 -0
- package/src/llm/anthropic/utils/message_inputs.ts +46 -4
- package/src/llm/anthropic/utils/message_outputs.ts +9 -7
- package/src/llm/anthropic/utils/output_parsers.ts +5 -5
- package/src/llm/anthropic/utils/streaming-tool-input.test.ts +186 -0
- package/src/llm/bedrock/index.ts +4 -4
- package/src/llm/bedrock/toolCache.test.ts +48 -9
- package/src/llm/bedrock/toolCache.ts +11 -6
- package/src/llm/fake.ts +30 -25
- package/src/llm/google/index.ts +43 -1
- package/src/llm/google/llm.spec.ts +173 -1
- package/src/llm/google/types.ts +1 -1
- package/src/llm/google/utils/common.ts +154 -45
- package/src/llm/google/utils/tools.ts +8 -8
- package/src/llm/google/utils/zod_to_genai_parameters.ts +4 -4
- package/src/llm/invoke.test.ts +3 -3
- package/src/llm/invoke.ts +170 -10
- package/src/llm/openai/index.ts +4 -4
- package/src/llm/openai/utils/index.ts +14 -14
- package/src/llm/openrouter/index.ts +4 -4
- package/src/llm/openrouter/reasoning.test.ts +2 -2
- package/src/llm/vertexai/fixThoughtSignatures.test.ts +1 -1
- package/src/llm/vertexai/index.ts +1 -1
- package/src/messages/cache.test.ts +144 -0
- package/src/messages/cache.ts +50 -13
- package/src/messages/content.ts +1 -1
- package/src/messages/contextPruning.ts +1 -1
- package/src/messages/format.ts +236 -43
- package/src/messages/formatAgentMessages.skills.test.ts +205 -26
- package/src/messages/formatAgentMessages.test.ts +841 -10
- package/src/messages/labelContentByAgent.test.ts +2 -2
- package/src/messages/prune.ts +1 -1
- package/src/messages/reducer.ts +1 -1
- package/src/messages/tools.ts +1 -1
- package/src/openai/__tests__/openai.test.ts +2 -2
- package/src/openai/index.ts +1 -1
- package/src/responses/__tests__/responses.test.ts +2 -2
- package/src/responses/index.ts +1 -1
- package/src/run.ts +68 -41
- package/src/session/AgentSession.ts +6 -6
- package/src/session/JsonlSessionStore.ts +3 -3
- package/src/session/__tests__/JsonlSessionStore.test.ts +5 -5
- package/src/session/__tests__/handlers.test.ts +2 -2
- package/src/session/handlers.ts +5 -5
- package/src/session/types.ts +1 -1
- package/src/specs/agent-handoffs.test.ts +1 -1
- package/src/specs/langfuse-callbacks.test.ts +2 -2
- package/src/specs/langfuse-metadata.test.ts +39 -0
- package/src/specs/langfuse-tool-output-tracing.test.ts +1 -1
- package/src/specs/multi-agent-summarization.test.ts +4 -4
- package/src/specs/subagent.test.ts +3 -3
- package/src/specs/summarization-unit.test.ts +1 -1
- package/src/specs/thinking-handoff.test.ts +1 -1
- package/src/splitStream.test.ts +48 -0
- package/src/stream.test.ts +53 -3
- package/src/stream.ts +450 -39
- package/src/summarization/__tests__/aggregator.test.ts +2 -2
- package/src/summarization/__tests__/node.test.ts +2 -2
- package/src/summarization/node.ts +1 -1
- package/src/tools/BashProgrammaticToolCalling.ts +5 -5
- package/src/tools/Calculator.ts +1 -1
- package/src/tools/CodeExecutor.ts +2 -4
- package/src/tools/SubagentTool.ts +2 -2
- package/src/tools/ToolNode.ts +37 -16
- package/src/tools/ToolSearch.ts +1 -1
- package/src/tools/__tests__/CloudflareSandboxExecution.test.ts +4 -4
- package/src/tools/__tests__/CodeApiAuthHeaders.test.ts +12 -12
- package/src/tools/__tests__/LocalExecutionTools.test.ts +125 -93
- package/src/tools/__tests__/ProgrammaticToolCalling.test.ts +29 -5
- package/src/tools/__tests__/ReadFile.test.ts +1 -1
- package/src/tools/__tests__/SkillTool.test.ts +4 -4
- package/src/tools/__tests__/SubagentExecutor.test.ts +17 -13
- package/src/tools/__tests__/SubagentTool.test.ts +2 -2
- package/src/tools/__tests__/ToolNode.eagerEventExecution.test.ts +1 -1
- package/src/tools/__tests__/ToolNode.outputReferences.test.ts +2 -5
- package/src/tools/__tests__/ToolNode.session.test.ts +1 -1
- package/src/tools/__tests__/ToolSearch.test.ts +1 -1
- package/src/tools/__tests__/annotateMessagesForLLM.test.ts +1 -1
- package/src/tools/__tests__/directToolHITLResumeScope.test.ts +35 -32
- package/src/tools/__tests__/directToolHooks.test.ts +41 -0
- package/src/tools/__tests__/handlers.test.ts +2 -2
- package/src/tools/__tests__/hitl.test.ts +11 -11
- package/src/tools/__tests__/localToolNames.test.ts +8 -6
- package/src/tools/__tests__/skillCatalog.test.ts +1 -1
- package/src/tools/__tests__/subagentHooks.test.ts +20 -10
- package/src/tools/__tests__/workspaceSeam.test.ts +20 -7
- package/src/tools/cloudflare/CloudflareSandboxExecutionEngine.ts +9 -6
- package/src/tools/cloudflare/CloudflareSandboxTools.ts +19 -19
- package/src/tools/handlers.ts +5 -5
- package/src/tools/local/CompileCheckTool.ts +4 -7
- package/src/tools/local/FileCheckpointer.ts +6 -5
- package/src/tools/local/LocalCodingTools.ts +100 -45
- package/src/tools/local/LocalExecutionEngine.ts +5 -5
- package/src/tools/local/LocalExecutionTools.ts +9 -9
- package/src/tools/local/LocalProgrammaticToolCalling.ts +5 -4
- package/src/tools/local/attachments.ts +0 -6
- package/src/tools/local/resolveLocalExecutionTools.ts +15 -15
- package/src/tools/search/firecrawl.ts +1 -1
- package/src/tools/search/jina-reranker.test.ts +148 -37
- package/src/tools/search/rerankers.ts +14 -4
- package/src/tools/search/tavily-search.ts +2 -2
- package/src/tools/search/types.ts +1 -1
- package/src/tools/search/utils.ts +99 -9
- package/src/tools/subagent/SubagentExecutor.ts +12 -6
- package/src/types/graph.ts +12 -12
- package/src/types/llm.ts +7 -6
- package/src/types/messages.ts +1 -1
- package/src/types/run.ts +7 -7
- package/src/types/stream.ts +2 -2
- package/src/types/tools.ts +5 -1
- package/src/utils/handlers.ts +2 -2
- package/src/utils/llmConfig.ts +1 -1
- package/src/utils/logging.ts +20 -10
- package/src/utils/run.ts +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.mjs","sources":["../../../src/utils/run.ts"],"sourcesContent":["import { CallbackManagerForChainRun } from '@langchain/core/callbacks/manager';\nimport {\n mergeConfigs,\n patchConfig,\n Runnable,\n
|
|
1
|
+
{"version":3,"file":"run.mjs","sources":["../../../src/utils/run.ts"],"sourcesContent":["import { CallbackManagerForChainRun } from '@langchain/core/callbacks/manager';\nimport { AsyncLocalStorageProviderSingleton } from '@langchain/core/singletons';\nimport {\n RunnableConfig,\n mergeConfigs,\n patchConfig,\n Runnable,\n} from '@langchain/core/runnables';\n\n/**\n * Delays the execution for a specified number of milliseconds.\n *\n * @param {number} ms - The number of milliseconds to delay.\n * @return {Promise<void>} A promise that resolves after the specified delay.\n */\nexport function sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface RunnableCallableArgs extends Partial<any> {\n name?: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n func: (...args: any[]) => any;\n tags?: string[];\n trace?: boolean;\n recurse?: boolean;\n}\n\nexport class RunnableCallable<I = unknown, O = unknown> extends Runnable<I, O> {\n lc_namespace: string[] = ['langgraph'];\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n func: (...args: any[]) => any;\n\n tags?: string[];\n\n config?: RunnableConfig;\n\n trace: boolean = true;\n\n recurse: boolean = true;\n\n constructor(fields: RunnableCallableArgs) {\n super();\n this.name = fields.name ?? fields.func.name;\n this.func = fields.func;\n this.config = fields.tags ? { tags: fields.tags } : undefined;\n this.trace = fields.trace ?? this.trace;\n this.recurse = fields.recurse ?? this.recurse;\n }\n\n protected async _tracedInvoke(\n input: I,\n config?: Partial<RunnableConfig>,\n runManager?: CallbackManagerForChainRun\n ): Promise<O> {\n return new Promise<O>((resolve, reject) => {\n let childConfig: Partial<RunnableConfig> | null = patchConfig(config, {\n callbacks: runManager?.getChild(),\n });\n void AsyncLocalStorageProviderSingleton.runWithConfig(\n childConfig,\n async () => {\n try {\n const output = await this.func(input, childConfig);\n childConfig = null;\n resolve(output);\n } catch (e) {\n childConfig = null;\n reject(e);\n }\n }\n );\n });\n }\n\n async invoke(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n input: any,\n options?: Partial<RunnableConfig> | undefined\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ): Promise<any> {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let returnValue: any;\n\n if (this.trace) {\n returnValue = await this._callWithConfig(\n this._tracedInvoke,\n input,\n mergeConfigs(this.config, options)\n );\n } else {\n returnValue = await this.func(input, mergeConfigs(this.config, options));\n }\n\n if (Runnable.isRunnable(returnValue) && this.recurse) {\n return await returnValue.invoke(input, options);\n }\n\n return returnValue;\n }\n}\n"],"names":[],"mappings":";;;AASA;;;;;AAKG;AACG,SAAU,KAAK,CAAC,EAAU,EAAA;AAC9B,IAAA,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,KAAK,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;AAC1D;AAYM,MAAO,gBAA2C,SAAQ,QAAc,CAAA;AAC5E,IAAA,YAAY,GAAa,CAAC,WAAW,CAAC;;AAGtC,IAAA,IAAI;AAEJ,IAAA,IAAI;AAEJ,IAAA,MAAM;IAEN,KAAK,GAAY,IAAI;IAErB,OAAO,GAAY,IAAI;AAEvB,IAAA,WAAA,CAAY,MAA4B,EAAA;AACtC,QAAA,KAAK,EAAE;AACP,QAAA,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI;AAC3C,QAAA,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI;QACvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,IAAI,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,GAAG,SAAS;QAC7D,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK;QACvC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO;IAC/C;AAEU,IAAA,MAAM,aAAa,CAC3B,KAAQ,EACR,MAAgC,EAChC,UAAuC,EAAA;QAEvC,OAAO,IAAI,OAAO,CAAI,CAAC,OAAO,EAAE,MAAM,KAAI;AACxC,YAAA,IAAI,WAAW,GAAmC,WAAW,CAAC,MAAM,EAAE;AACpE,gBAAA,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE;AAClC,aAAA,CAAC;YACF,KAAK,kCAAkC,CAAC,aAAa,CACnD,WAAW,EACX,YAAW;AACT,gBAAA,IAAI;oBACF,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,WAAW,CAAC;oBAClD,WAAW,GAAG,IAAI;oBAClB,OAAO,CAAC,MAAM,CAAC;gBACjB;gBAAE,OAAO,CAAC,EAAE;oBACV,WAAW,GAAG,IAAI;oBAClB,MAAM,CAAC,CAAC,CAAC;gBACX;AACF,YAAA,CAAC,CACF;AACH,QAAA,CAAC,CAAC;IACJ;AAEA,IAAA,MAAM,MAAM;;AAEV,IAAA,KAAU,EACV;;;;AAIA,QAAA,IAAI,WAAgB;AAEpB,QAAA,IAAI,IAAI,CAAC,KAAK,EAAE;YACd,WAAW,GAAG,MAAM,IAAI,CAAC,eAAe,CACtC,IAAI,CAAC,aAAa,EAClB,KAAK,EACL,YAAY,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CACnC;QACH;aAAO;AACL,YAAA,WAAW,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,YAAY,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC1E;QAEA,IAAI,QAAQ,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE;YACpD,OAAO,MAAM,WAAW,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC;QACjD;AAEA,QAAA,OAAO,WAAW;IACpB;AACD;;;;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { UsageMetadata } from '@langchain/core/messages';
|
|
2
2
|
import type { ClientOptions } from '@langchain/openai';
|
|
3
|
+
import type { ChatOpenRouterInput } from '@/llm/openrouter';
|
|
3
4
|
import type * as t from '@/types';
|
|
4
5
|
import { Providers } from '@/common';
|
|
5
|
-
import type { ChatOpenRouterInput } from '@/llm/openrouter';
|
|
6
6
|
type LivePromptCacheProvider = Providers.ANTHROPIC | Providers.BEDROCK | Providers.OPENROUTER;
|
|
7
7
|
type PromptCacheExpectedSystemBlock = {
|
|
8
8
|
type: 'text';
|
package/dist/types/events.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { BaseMessageFields, UsageMetadata } from '@langchain/core/messages';
|
|
2
|
-
import type { MultiAgentGraph, StandardGraph } from '@/graphs';
|
|
3
2
|
import type { Logger } from 'winston';
|
|
3
|
+
import type { MultiAgentGraph, StandardGraph } from '@/graphs';
|
|
4
4
|
import type * as t from '@/types';
|
|
5
5
|
export declare class HandlerRegistry {
|
|
6
6
|
private handlers;
|
|
@@ -2,12 +2,12 @@ import { ToolNode } from '@langchain/langgraph/prebuilt';
|
|
|
2
2
|
import { RunnableConfig } from '@langchain/core/runnables';
|
|
3
3
|
import type { UsageMetadata, BaseMessage } from '@langchain/core/messages';
|
|
4
4
|
import type { ToolCall } from '@langchain/core/messages/tool';
|
|
5
|
+
import type { HookRegistry } from '@/hooks';
|
|
5
6
|
import type * as t from '@/types';
|
|
6
7
|
import { ToolNode as CustomToolNode } from '@/tools/ToolNode';
|
|
7
8
|
import { ToolOutputReferenceRegistry } from '@/tools/toolOutputReferences';
|
|
8
9
|
import { AgentContext } from '@/agents/AgentContext';
|
|
9
10
|
import { HandlerRegistry } from '@/events';
|
|
10
|
-
import type { HookRegistry } from '@/hooks';
|
|
11
11
|
export declare abstract class Graph<T extends t.BaseGraphState = t.BaseGraphState, _TNodeName extends string = string> {
|
|
12
12
|
abstract resetValues(): void;
|
|
13
13
|
abstract initializeTools({ currentTools, currentToolMap, }: {
|
|
@@ -18,6 +18,7 @@ export declare abstract class Graph<T extends t.BaseGraphState = t.BaseGraphStat
|
|
|
18
18
|
abstract getContentParts(): t.MessageContentComplex[] | undefined;
|
|
19
19
|
abstract generateStepId(stepKey: string): [string, number];
|
|
20
20
|
abstract getKeyList(metadata: Record<string, unknown> | undefined): (string | number | undefined)[];
|
|
21
|
+
abstract getStepBaseKey(metadata: Record<string, unknown> | undefined): string;
|
|
21
22
|
abstract getStepKey(metadata: Record<string, unknown> | undefined): string;
|
|
22
23
|
abstract checkKeyList(keyList: (string | number | undefined)[]): boolean;
|
|
23
24
|
abstract getStepIdByKey(stepKey: string, index?: number): string;
|
|
@@ -27,6 +28,7 @@ export declare abstract class Graph<T extends t.BaseGraphState = t.BaseGraphStat
|
|
|
27
28
|
abstract dispatchMessageDelta(id: string, delta: t.MessageDelta, metadata?: Record<string, unknown>): Promise<void>;
|
|
28
29
|
abstract dispatchReasoningDelta(stepId: string, delta: t.ReasoningDelta, metadata?: Record<string, unknown>): Promise<void>;
|
|
29
30
|
abstract createCallModel(agentId?: string, currentModel?: t.ChatModel): (state: t.AgentSubgraphState, config?: RunnableConfig) => Promise<Partial<t.AgentSubgraphState>>;
|
|
31
|
+
messageStepHasTextDeltas: Set<string>;
|
|
30
32
|
messageStepHasToolCalls: Map<string, boolean>;
|
|
31
33
|
messageIdsByStepKey: Map<string, string>;
|
|
32
34
|
prelimMessageIdsByStepKey: Map<string, string>;
|
|
@@ -41,6 +43,7 @@ export declare abstract class Graph<T extends t.BaseGraphState = t.BaseGraphStat
|
|
|
41
43
|
* the same step are scoped to the active custom event dispatch.
|
|
42
44
|
*/
|
|
43
45
|
handlerDispatchedStepIds: Set<string>;
|
|
46
|
+
reasoningStepHasDeltas: Set<string>;
|
|
44
47
|
protected handlerDispatchedEventCounts: Map<string, number>;
|
|
45
48
|
signal?: AbortSignal;
|
|
46
49
|
/** Set of invoked tool call IDs from non-message run steps completed mid-run, if any */
|
|
@@ -181,10 +184,13 @@ export declare class StandardGraph extends Graph<t.BaseGraphState, t.GraphNode>
|
|
|
181
184
|
clearHeavyState(): void;
|
|
182
185
|
getRunStep(stepId: string): t.RunStep | undefined;
|
|
183
186
|
getAgentContext(metadata: Record<string, unknown> | undefined): AgentContext;
|
|
187
|
+
getStepBaseKey(metadata: Record<string, unknown> | undefined): string;
|
|
184
188
|
getStepKey(metadata: Record<string, unknown> | undefined): string;
|
|
185
189
|
getStepIdByKey(stepKey: string, index?: number): string;
|
|
186
190
|
generateStepId(stepKey: string): [string, number];
|
|
187
191
|
getKeyList(metadata: Record<string, unknown> | undefined): (string | number | undefined)[];
|
|
192
|
+
private getInvocationKeyList;
|
|
193
|
+
private getBaseKeyList;
|
|
188
194
|
checkKeyList(keyList: (string | number | undefined)[]): boolean;
|
|
189
195
|
getRunMessages(): BaseMessage[] | undefined;
|
|
190
196
|
getContentParts(): t.MessageContentComplex[] | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Logger } from 'winston';
|
|
2
|
-
import type { HookRegistry } from './HookRegistry';
|
|
3
2
|
import type { HookInput, AggregatedHookResult } from './types';
|
|
3
|
+
import type { HookRegistry } from './HookRegistry';
|
|
4
4
|
/** Default per-hook timeout when a matcher doesn't set its own. */
|
|
5
5
|
export declare const DEFAULT_HOOK_TIMEOUT_MS = 30000;
|
|
6
6
|
/**
|
|
@@ -19,11 +19,16 @@ export type StopDecision = 'continue' | 'block';
|
|
|
19
19
|
* - `runId` identifies the current agent run and is always present.
|
|
20
20
|
* - `threadId` identifies the conversation thread when the host has one.
|
|
21
21
|
* - `agentId` is only set when the hook fires inside a subagent scope.
|
|
22
|
+
* - `executingAgentId` identifies the agent that owns the node emitting the hook,
|
|
23
|
+
* whenever the graph knows it — including top-level agents in a multi-agent
|
|
24
|
+
* graph (where `agentId` is intentionally undefined). Use this to attribute a
|
|
25
|
+
* hook to a specific agent regardless of subagent scope.
|
|
22
26
|
*/
|
|
23
27
|
export interface BaseHookInput {
|
|
24
28
|
runId: string;
|
|
25
29
|
threadId?: string;
|
|
26
30
|
agentId?: string;
|
|
31
|
+
executingAgentId?: string;
|
|
27
32
|
}
|
|
28
33
|
export interface RunStartHookInput extends BaseHookInput {
|
|
29
34
|
hook_event_name: 'RunStart';
|
package/dist/types/langfuse.d.ts
CHANGED
|
@@ -10,6 +10,9 @@ type LangfuseHandlerParams = {
|
|
|
10
10
|
type AgentLangfuseHandlerParams = LangfuseHandlerParams & {
|
|
11
11
|
langfuse?: t.LangfuseConfig;
|
|
12
12
|
};
|
|
13
|
+
type LangfuseAttributeParams = AgentLangfuseHandlerParams & {
|
|
14
|
+
traceName?: string;
|
|
15
|
+
};
|
|
13
16
|
export declare function hasLangfuseConfigCredentials(langfuse?: t.LangfuseConfig): langfuse is t.LangfuseConfig & {
|
|
14
17
|
publicKey: string;
|
|
15
18
|
secretKey: string;
|
|
@@ -27,6 +30,7 @@ export declare function hasLangfuseEnvCredentials(): boolean;
|
|
|
27
30
|
export declare function shouldCreateLangfuseHandler(langfuse?: t.LangfuseConfig): boolean;
|
|
28
31
|
export declare function createLegacyLangfuseHandler(params: LangfuseHandlerParams): CallbackHandler;
|
|
29
32
|
export declare function createLangfuseHandler({ langfuse, userId, sessionId, traceMetadata, tags, }: AgentLangfuseHandlerParams): CallbackHandler | undefined;
|
|
33
|
+
export declare function withLangfuseAttributes<T>(params: LangfuseAttributeParams, action: () => T): T;
|
|
30
34
|
export declare function hasExplicitLangfuseConfig(contexts: Iterable<{
|
|
31
35
|
langfuse?: t.LangfuseConfig;
|
|
32
36
|
}>): boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type BaseMessage } from '@langchain/core/messages';
|
|
2
1
|
import { ToolCall } from '@langchain/core/messages/tool';
|
|
2
|
+
import { type BaseMessage } from '@langchain/core/messages';
|
|
3
3
|
import { AnthropicMessageCreateParams, AnthropicToolResponse } from '../types';
|
|
4
4
|
/**
|
|
5
5
|
* Normalize a tool-call ID to satisfy Anthropic's `^[a-zA-Z0-9_-]+$` and 64-char
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/** This util file contains functions for converting Anthropic messages to LangChain messages. */
|
|
2
2
|
import { AIMessageChunk } from '@langchain/core/messages';
|
|
3
|
-
import type Anthropic from '@anthropic-ai/sdk';
|
|
4
3
|
import type { UsageMetadata } from '@langchain/core/messages';
|
|
5
4
|
import type { ChatGeneration } from '@langchain/core/outputs';
|
|
5
|
+
import type Anthropic from '@anthropic-ai/sdk';
|
|
6
6
|
import type { AnthropicMessageResponse } from '../types';
|
|
7
7
|
interface AnthropicUsageData {
|
|
8
8
|
input_tokens?: number | null;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { BaseLLMOutputParser } from '@langchain/core/output_parsers';
|
|
2
|
-
import { JsonOutputKeyToolsParserParamsInterop } from '@langchain/core/output_parsers/openai_tools';
|
|
3
1
|
import { ChatGeneration } from '@langchain/core/outputs';
|
|
4
2
|
import { ToolCall } from '@langchain/core/messages/tool';
|
|
5
3
|
import { InteropZodType } from '@langchain/core/utils/types';
|
|
4
|
+
import { BaseLLMOutputParser } from '@langchain/core/output_parsers';
|
|
5
|
+
import { JsonOutputKeyToolsParserParamsInterop } from '@langchain/core/output_parsers/openai_tools';
|
|
6
6
|
interface AnthropicToolsOutputParserParams<T extends Record<string, any>> extends JsonOutputKeyToolsParserParamsInterop<T> {
|
|
7
7
|
}
|
|
8
8
|
export declare class AnthropicToolsOutputParser<T extends Record<string, any> = Record<string, any>> extends BaseLLMOutputParser<T> {
|
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
* the accumulated content is already an array.
|
|
22
22
|
*/
|
|
23
23
|
import { ChatBedrockConverse } from '@langchain/aws';
|
|
24
|
-
import { type GuardrailConfiguration, type GuardrailStreamConfiguration } from '@aws-sdk/client-bedrock-runtime';
|
|
25
24
|
import { ChatGenerationChunk, ChatResult } from '@langchain/core/outputs';
|
|
25
|
+
import { type GuardrailConfiguration, type GuardrailStreamConfiguration } from '@aws-sdk/client-bedrock-runtime';
|
|
26
26
|
import type { CallbackManagerForLLMRun } from '@langchain/core/callbacks/manager';
|
|
27
|
-
import type { ChatBedrockConverseInput } from '@langchain/aws';
|
|
28
27
|
import type { BaseMessage } from '@langchain/core/messages';
|
|
28
|
+
import type { ChatBedrockConverseInput } from '@langchain/aws';
|
|
29
29
|
/**
|
|
30
30
|
* Service tier type for Bedrock invocations.
|
|
31
31
|
* Requires AWS SDK >= 3.966.0 to actually work.
|
package/dist/types/llm/fake.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ChatGenerationChunk } from '@langchain/core/outputs';
|
|
2
|
-
import type { CallbackManagerForLLMRun } from '@langchain/core/callbacks/manager';
|
|
3
|
-
import type { BaseMessage } from '@langchain/core/messages';
|
|
4
2
|
import { FakeListChatModel } from '@langchain/core/utils/testing';
|
|
5
3
|
import { ToolCall, ToolCallChunk } from '@langchain/core/messages/tool';
|
|
4
|
+
import type { CallbackManagerForLLMRun } from '@langchain/core/callbacks/manager';
|
|
5
|
+
import type { BaseMessage } from '@langchain/core/messages';
|
|
6
6
|
type SplitStrategy = {
|
|
7
7
|
type: 'regex' | 'fixed';
|
|
8
8
|
value: RegExp | number;
|
|
@@ -11,7 +11,7 @@ export declare class FakeChatModel extends FakeListChatModel {
|
|
|
11
11
|
private splitStrategy;
|
|
12
12
|
private toolCalls;
|
|
13
13
|
private addedToolCalls;
|
|
14
|
-
constructor({ responses, sleep, emitCustomEvent, splitStrategy, toolCalls }: {
|
|
14
|
+
constructor({ responses, sleep, emitCustomEvent, splitStrategy, toolCalls, }: {
|
|
15
15
|
responses: string[];
|
|
16
16
|
sleep?: number;
|
|
17
17
|
emitCustomEvent?: boolean;
|
|
@@ -6,6 +6,7 @@ import type { BaseMessage } from '@langchain/core/messages';
|
|
|
6
6
|
import type { GoogleClientOptions, GoogleThinkingConfig } from '@/types';
|
|
7
7
|
export declare class CustomChatGoogleGenerativeAI extends ChatGoogleGenerativeAI {
|
|
8
8
|
thinkingConfig?: GoogleThinkingConfig;
|
|
9
|
+
includeServerSideToolInvocations?: boolean;
|
|
9
10
|
/**
|
|
10
11
|
* Override to add gemini-3 model support for multimodal and function calling thought signatures
|
|
11
12
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CodeExecutionTool, FunctionDeclarationsTool as GoogleGenerativeAIFunctionDeclarationsTool, GoogleSearchRetrievalTool } from '@google/generative-ai';
|
|
2
1
|
import { BindToolsInput } from '@langchain/core/language_models/chat_models';
|
|
2
|
+
import { CodeExecutionTool, FunctionDeclarationsTool as GoogleGenerativeAIFunctionDeclarationsTool, GoogleSearchRetrievalTool } from '@google/generative-ai';
|
|
3
3
|
/** New GoogleSearch tool for Gemini 2.0+ models */
|
|
4
4
|
export interface GoogleSearchTool {
|
|
5
5
|
googleSearch: Record<string, never>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { POSSIBLE_ROLES, type Part, type Content, type EnhancedGenerateContentResponse, type FunctionDeclarationsTool as GoogleGenerativeAIFunctionDeclarationsTool } from '@google/generative-ai';
|
|
2
|
-
import { BaseMessage, UsageMetadata } from '@langchain/core/messages';
|
|
3
1
|
import { ChatGenerationChunk } from '@langchain/core/outputs';
|
|
2
|
+
import { BaseMessage, UsageMetadata } from '@langchain/core/messages';
|
|
3
|
+
import { POSSIBLE_ROLES, type Part, type Content, type EnhancedGenerateContentResponse, type FunctionDeclarationsTool as GoogleGenerativeAIFunctionDeclarationsTool } from '@google/generative-ai';
|
|
4
4
|
import type { ChatResult } from '@langchain/core/outputs';
|
|
5
5
|
import { GoogleGenerativeAIToolType } from '../types';
|
|
6
6
|
export declare const _FUNCTION_CALL_THOUGHT_SIGNATURES_MAP_KEY = "__gemini_function_call_thought_signatures__";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Tool as GenerativeAITool, ToolConfig } from '@google/generative-ai';
|
|
2
1
|
import { ToolChoice } from '@langchain/core/language_models/chat_models';
|
|
2
|
+
import { Tool as GenerativeAITool, ToolConfig } from '@google/generative-ai';
|
|
3
3
|
import { GoogleGenerativeAIToolType } from '../types';
|
|
4
4
|
export declare function convertToolsToGenAI(tools: GoogleGenerativeAIToolType[], extra?: {
|
|
5
5
|
toolChoice?: ToolChoice;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type FunctionDeclarationSchema as GenerativeAIFunctionDeclarationSchema, type SchemaType as FunctionDeclarationSchemaType } from '@google/generative-ai';
|
|
2
1
|
import { InteropZodType } from '@langchain/core/utils/types';
|
|
3
2
|
import { type JsonSchema7Type } from '@langchain/core/utils/json_schema';
|
|
3
|
+
import { type FunctionDeclarationSchema as GenerativeAIFunctionDeclarationSchema, type SchemaType as FunctionDeclarationSchemaType } from '@google/generative-ai';
|
|
4
4
|
export interface GenerativeAIJsonSchema extends Record<string, unknown> {
|
|
5
5
|
properties?: Record<string, GenerativeAIJsonSchema>;
|
|
6
6
|
type: FunctionDeclarationSchemaType;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { AzureOpenAI as AzureOpenAIClient } from 'openai';
|
|
2
2
|
import { ChatXAI as OriginalChatXAI } from '@langchain/xai';
|
|
3
3
|
import { ChatGenerationChunk } from '@langchain/core/outputs';
|
|
4
|
-
import { AIMessageChunk } from '@langchain/core/messages';
|
|
5
4
|
import { ChatDeepSeek as OriginalChatDeepSeek } from '@langchain/deepseek';
|
|
6
5
|
import { CallbackManagerForLLMRun } from '@langchain/core/callbacks/manager';
|
|
6
|
+
import { AIMessageChunk } from '@langchain/core/messages';
|
|
7
7
|
import { OpenAIClient, ChatOpenAI as OriginalChatOpenAI, AzureChatOpenAI as OriginalAzureChatOpenAI } from '@langchain/openai';
|
|
8
|
-
import type { HeaderValue, HeadersLike } from './types';
|
|
9
8
|
import type { BaseMessage } from '@langchain/core/messages';
|
|
10
9
|
import type { BindToolsInput } from '@langchain/core/language_models/chat_models';
|
|
11
10
|
import type { ChatResult } from '@langchain/core/outputs';
|
|
12
11
|
import type { ChatXAIInput } from '@langchain/xai';
|
|
13
12
|
import type * as t from '@langchain/openai';
|
|
13
|
+
import type { HeaderValue, HeadersLike } from './types';
|
|
14
14
|
export declare function isHeaders(headers: unknown): headers is Headers;
|
|
15
15
|
export declare function normalizeHeaders(headers: HeadersLike): Record<string, HeaderValue | readonly HeaderValue[]>;
|
|
16
16
|
type OpenAICoreRequestOptions = OpenAIClient.RequestOptions;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type OpenAI as OpenAIClient } from 'openai';
|
|
2
|
-
import { type BaseMessage } from '@langchain/core/messages';
|
|
3
2
|
import { ChatGenerationChunk } from '@langchain/core/outputs';
|
|
3
|
+
import { type BaseMessage } from '@langchain/core/messages';
|
|
4
4
|
import type { OpenAICallOptions, OpenAIChatInput } from '@langchain/openai';
|
|
5
5
|
export type { OpenAICallOptions, OpenAIChatInput };
|
|
6
6
|
type ExtractAsyncIterableType<T> = T extends AsyncIterable<infer U> ? U : never;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ChatOpenAI } from '@/llm/openai';
|
|
2
|
-
import type { BaseMessage } from '@langchain/core/messages';
|
|
3
|
-
import type { ChatGenerationChunk } from '@langchain/core/outputs';
|
|
4
|
-
import type { CallbackManagerForLLMRun } from '@langchain/core/callbacks/manager';
|
|
5
1
|
import type { ChatOpenAICallOptions, OpenAIChatInput, OpenAIClient } from '@langchain/openai';
|
|
2
|
+
import type { CallbackManagerForLLMRun } from '@langchain/core/callbacks/manager';
|
|
3
|
+
import type { ChatGenerationChunk } from '@langchain/core/outputs';
|
|
4
|
+
import type { BaseMessage } from '@langchain/core/messages';
|
|
5
|
+
import { ChatOpenAI } from '@/llm/openai';
|
|
6
6
|
export type OpenRouterReasoningEffort = 'xhigh' | 'high' | 'medium' | 'low' | 'minimal' | 'none';
|
|
7
7
|
export interface OpenRouterReasoning {
|
|
8
8
|
effort?: OpenRouterReasoningEffort;
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
* messages, and messages with image content) are never pruned.
|
|
13
13
|
*/
|
|
14
14
|
import { type BaseMessage } from '@langchain/core/messages';
|
|
15
|
+
import type { ContextPruningSettings } from './contextPruningSettings';
|
|
15
16
|
import type { ContextPruningConfig } from '@/types/graph';
|
|
16
17
|
import type { TokenCounter } from '@/types/run';
|
|
17
|
-
import type { ContextPruningSettings } from './contextPruningSettings';
|
|
18
18
|
export interface ContextPruningResult {
|
|
19
19
|
/** Number of messages that were soft-trimmed. */
|
|
20
20
|
softTrimmed: number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AIMessage, ToolMessage, BaseMessage, HumanMessage, SystemMessage } from '@langchain/core/messages';
|
|
2
2
|
import type { MessageContentImageUrl } from '@langchain/core/messages';
|
|
3
|
-
import type { MessageContentComplex, TPayload } from '@/types';
|
|
4
3
|
import type { RunnableConfig } from '@langchain/core/runnables';
|
|
4
|
+
import type { MessageContentComplex, TPayload } from '@/types';
|
|
5
5
|
import { Providers } from '@/common';
|
|
6
6
|
interface MediaMessageParams {
|
|
7
7
|
message: {
|
|
@@ -45,6 +45,11 @@ interface FormatMessageParams {
|
|
|
45
45
|
endpoint?: Providers;
|
|
46
46
|
langChain?: boolean;
|
|
47
47
|
}
|
|
48
|
+
export type LangChainMessageRole = 'system' | 'user' | 'assistant' | 'tool';
|
|
49
|
+
export type RoleBearingMessage<T extends BaseMessage = BaseMessage> = T & {
|
|
50
|
+
role: LangChainMessageRole;
|
|
51
|
+
};
|
|
52
|
+
export declare function withMessageRole<T extends BaseMessage>(message: T, role: LangChainMessageRole): RoleBearingMessage<T>;
|
|
48
53
|
interface FormattedMessage {
|
|
49
54
|
role: string;
|
|
50
55
|
content: string | MessageContentComplex[];
|
|
@@ -57,7 +62,7 @@ interface FormattedMessage {
|
|
|
57
62
|
* @param params - The parameters for formatting.
|
|
58
63
|
* @returns - The formatted message.
|
|
59
64
|
*/
|
|
60
|
-
export declare const formatMessage: ({ message, userName, endpoint, assistantName, langChain, }: FormatMessageParams) => FormattedMessage | HumanMessage | AIMessage | SystemMessage
|
|
65
|
+
export declare const formatMessage: ({ message, userName, endpoint, assistantName, langChain, }: FormatMessageParams) => FormattedMessage | RoleBearingMessage<HumanMessage> | RoleBearingMessage<AIMessage> | RoleBearingMessage<SystemMessage>;
|
|
61
66
|
/**
|
|
62
67
|
* Formats an array of messages for LangChain.
|
|
63
68
|
*
|
|
@@ -65,7 +70,7 @@ export declare const formatMessage: ({ message, userName, endpoint, assistantNam
|
|
|
65
70
|
* @param formatOptions - The options for formatting each message.
|
|
66
71
|
* @returns - The array of formatted LangChain messages.
|
|
67
72
|
*/
|
|
68
|
-
export declare const formatLangChainMessages: (messages: Array<MessageInput>, formatOptions: Omit<FormatMessageParams, "message" | "langChain">) => Array<HumanMessage | AIMessage | SystemMessage
|
|
73
|
+
export declare const formatLangChainMessages: (messages: Array<MessageInput>, formatOptions: Omit<FormatMessageParams, "message" | "langChain">) => Array<RoleBearingMessage<HumanMessage> | RoleBearingMessage<AIMessage> | RoleBearingMessage<SystemMessage>>;
|
|
69
74
|
interface LangChainMessage {
|
|
70
75
|
lc_kwargs?: {
|
|
71
76
|
additional_kwargs?: Record<string, any>;
|
|
@@ -86,6 +91,10 @@ interface LangChainMessage {
|
|
|
86
91
|
export declare const formatFromLangChain: (message: LangChainMessage) => Record<string, any>;
|
|
87
92
|
interface FormatAgentMessagesOptions {
|
|
88
93
|
provider?: Providers;
|
|
94
|
+
/** Skill names already primed fresh this turn (manual/always-apply). Their
|
|
95
|
+
* historical `skill` tool_calls are not reconstructed into a HumanMessage,
|
|
96
|
+
* so the same SKILL.md body is not injected twice in one request. */
|
|
97
|
+
skipSkillBodyNames?: Set<string>;
|
|
89
98
|
}
|
|
90
99
|
/**
|
|
91
100
|
* Groups content parts by agent and formats them with agent labels
|
|
@@ -108,10 +117,11 @@ export declare const labelContentByAgent: (contentParts: MessageContentComplex[]
|
|
|
108
117
|
* @param indexTokenCountMap - Optional map of message indices to token counts.
|
|
109
118
|
* @param tools - Optional set of tool names that are allowed in the request.
|
|
110
119
|
* @param skills - Optional map of skill name to body for reconstructing skill HumanMessages.
|
|
120
|
+
* @param options - Optional formatting options (provider, skipSkillBodyNames).
|
|
111
121
|
* @returns - Object containing formatted messages and updated indexTokenCountMap if provided.
|
|
112
122
|
*/
|
|
113
123
|
export declare const formatAgentMessages: (payload: TPayload, indexTokenCountMap?: Record<number, number | undefined>, tools?: Set<string>, skills?: Map<string, string>, options?: FormatAgentMessagesOptions) => {
|
|
114
|
-
messages: Array<HumanMessage | AIMessage | SystemMessage | ToolMessage
|
|
124
|
+
messages: Array<RoleBearingMessage<HumanMessage> | RoleBearingMessage<AIMessage> | RoleBearingMessage<SystemMessage> | RoleBearingMessage<ToolMessage>>;
|
|
115
125
|
indexTokenCountMap?: Record<number, number>;
|
|
116
126
|
/** Cross-run summary extracted from the payload. Should be forwarded to the
|
|
117
127
|
* agent run so it can be included in the system message via AgentContext. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseMessage, UsageMetadata } from '@langchain/core/messages';
|
|
2
|
-
import type { TokenCounter } from '@/types/run';
|
|
3
2
|
import type { ContextPruningConfig } from '@/types/graph';
|
|
3
|
+
import type { TokenCounter } from '@/types/run';
|
|
4
4
|
import { ContentTypes, Providers } from '@/common';
|
|
5
5
|
/** Default fraction of the token budget reserved as headroom (5 %). */
|
|
6
6
|
export declare const DEFAULT_RESERVE_RATIO = 0.05;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { CreateSessionFileOptions, SessionBranchOptions, SessionEntry, SessionForkOptions, SessionHeader, SessionLabelEntry, SessionListItem, SessionMessageEntry, SessionCheckpointEntry, SessionCompactionEntry, SessionRunEventEntry, SessionSummaryEntry, SessionStateEntry, SessionTreeNode } from './types';
|
|
2
1
|
import type { BaseMessage } from '@langchain/core/messages';
|
|
2
|
+
import type { CreateSessionFileOptions, SessionBranchOptions, SessionEntry, SessionForkOptions, SessionHeader, SessionLabelEntry, SessionListItem, SessionMessageEntry, SessionCheckpointEntry, SessionCompactionEntry, SessionRunEventEntry, SessionSummaryEntry, SessionStateEntry, SessionTreeNode } from './types';
|
|
3
3
|
export declare class JsonlSessionStore {
|
|
4
4
|
readonly path: string;
|
|
5
5
|
readonly header: SessionHeader;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { RunnableConfig } from '@langchain/core/runnables';
|
|
2
|
-
import type { BaseMessage } from '@langchain/core/messages';
|
|
3
2
|
import type { BaseCheckpointSaver } from '@langchain/langgraph';
|
|
3
|
+
import type { BaseMessage } from '@langchain/core/messages';
|
|
4
4
|
import type * as t from '@/types';
|
|
5
5
|
export type JsonPrimitive = string | number | boolean | null;
|
|
6
6
|
export type JsonValue = JsonPrimitive | JsonValue[] | {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { RunnableConfig } from '@langchain/core/runnables';
|
|
2
1
|
import type { BaseMessage } from '@langchain/core/messages';
|
|
2
|
+
import type { RunnableConfig } from '@langchain/core/runnables';
|
|
3
3
|
import type { AgentContext } from '@/agents/AgentContext';
|
|
4
4
|
import type { HookRegistry } from '@/hooks';
|
|
5
5
|
import type * as t from '@/types';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Constants } from '@/common';
|
|
2
|
-
import type { SubagentConfig } from '@/types';
|
|
3
1
|
import type { JsonSchemaType, LCTool } from '@/types/tools';
|
|
2
|
+
import type { SubagentConfig } from '@/types';
|
|
3
|
+
import { Constants } from '@/common';
|
|
4
4
|
export declare const SubagentToolName = Constants.SUBAGENT;
|
|
5
5
|
export declare const SubagentToolDescription = "Delegate a task to a specialized subagent that runs in an isolated context window. The subagent executes independently and returns only its final text result \u2014 all intermediate tool calls, reasoning, and context stay isolated.\n\nWHEN TO USE:\n- The task is self-contained and can be described in a single prompt.\n- You want to offload verbose or exploratory work without bloating your own context.\n- A specialized subagent is available for the task domain.\n\nWHAT HAPPENS:\n- A fresh agent is created with the task description as its only input.\n- The subagent runs to completion using its own tools and context.\n- Only the final text response is returned to you.\n\nCONSTRAINTS:\n- subagent_type must match one of the available types listed below.\n- The subagent cannot see your conversation history.";
|
|
6
6
|
export declare const SubagentToolSchema: {
|
|
@@ -4,8 +4,8 @@ import type { RunnableConfig } from '@langchain/core/runnables';
|
|
|
4
4
|
import type { BaseMessage } from '@langchain/core/messages';
|
|
5
5
|
import type { ToolOutputResolveView, ResolvedArgsByCallId } from '@/tools/toolOutputReferences';
|
|
6
6
|
import type * as t from '@/types';
|
|
7
|
-
import { RunnableCallable } from '@/utils';
|
|
8
7
|
import { ToolOutputReferenceRegistry } from '@/tools/toolOutputReferences';
|
|
8
|
+
import { RunnableCallable } from '@/utils';
|
|
9
9
|
/**
|
|
10
10
|
* Per-call batch context for `runTool`. Bundles every optional
|
|
11
11
|
* batch-scoped value the method needs so the signature stays at
|
|
@@ -90,6 +90,13 @@ export declare class ToolNode<T = any> extends RunnableCallable<T, T> {
|
|
|
90
90
|
private eagerEventToolUsageCount?;
|
|
91
91
|
/** Agent ID for event-driven mode */
|
|
92
92
|
private agentId?;
|
|
93
|
+
/**
|
|
94
|
+
* ID of the agent that owns this tool node, whenever the graph knows it
|
|
95
|
+
* (including top-level agents in a multi-agent graph). Surfaced to hooks as
|
|
96
|
+
* `executingAgentId` so they can attribute a tool batch to a specific agent
|
|
97
|
+
* even where `agentId` (the subagent-scope marker) is undefined.
|
|
98
|
+
*/
|
|
99
|
+
private executingAgentId?;
|
|
93
100
|
/** Tool names that bypass event dispatch and execute directly (e.g., graph-managed handoff tools) */
|
|
94
101
|
private directToolNames?;
|
|
95
102
|
/**
|
|
@@ -131,7 +138,7 @@ export declare class ToolNode<T = any> extends RunnableCallable<T, T> {
|
|
|
131
138
|
* other's in-flight state.
|
|
132
139
|
*/
|
|
133
140
|
private anonBatchCounter;
|
|
134
|
-
constructor({ tools, toolMap, name, tags, trace, runLangfuse, agentLangfuse, errorHandler, toolCallStepIds, handleToolErrors, loadRuntimeTools, toolRegistry, sessions, eventDrivenMode, eagerEventToolExecution, eagerEventToolExecutions, eagerEventToolUsageCount, agentId, directToolNames, maxContextTokens, maxToolResultChars, hookRegistry, humanInTheLoop, toolOutputReferences, toolOutputRegistry, toolExecution, fileCheckpointer, }: t.ToolNodeConstructorParams);
|
|
141
|
+
constructor({ tools, toolMap, name, tags, trace, runLangfuse, agentLangfuse, errorHandler, toolCallStepIds, handleToolErrors, loadRuntimeTools, toolRegistry, sessions, eventDrivenMode, eagerEventToolExecution, eagerEventToolExecutions, eagerEventToolUsageCount, agentId, executingAgentId, directToolNames, maxContextTokens, maxToolResultChars, hookRegistry, humanInTheLoop, toolOutputReferences, toolOutputRegistry, toolExecution, fileCheckpointer, }: t.ToolNodeConstructorParams);
|
|
135
142
|
invoke(input: any, options?: Partial<RunnableConfig>): Promise<any>;
|
|
136
143
|
/**
|
|
137
144
|
* Returns the run-scoped tool output registry, or `undefined` when
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Logger as WinstonLogger } from 'winston';
|
|
2
1
|
import type { RunnableConfig } from '@langchain/core/runnables';
|
|
2
|
+
import type { Logger as WinstonLogger } from 'winston';
|
|
3
3
|
import type { BaseReranker } from './rerankers';
|
|
4
4
|
import { DATE_RANGE } from './schema';
|
|
5
5
|
export type SearchProvider = 'serper' | 'searxng' | 'tavily';
|
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
import type * as t from './types';
|
|
2
|
+
export interface SafeErrorLog {
|
|
3
|
+
message: string;
|
|
4
|
+
name?: string;
|
|
5
|
+
code?: string;
|
|
6
|
+
status?: number;
|
|
7
|
+
method?: string;
|
|
8
|
+
url?: string;
|
|
9
|
+
responseDataSummary?: string;
|
|
10
|
+
value?: string;
|
|
11
|
+
}
|
|
2
12
|
/**
|
|
3
13
|
* Creates a default logger that maps to console methods
|
|
4
14
|
* Uses a singleton pattern to avoid creating multiple instances
|
|
5
15
|
* @returns A default logger that implements the Logger interface
|
|
6
16
|
*/
|
|
7
17
|
export declare const createDefaultLogger: () => t.Logger;
|
|
18
|
+
export declare const formatErrorForLog: (error: unknown) => SafeErrorLog;
|
|
8
19
|
export declare const fileExtRegex: RegExp;
|
|
9
20
|
export declare const getDomainName: (link: string, metadata?: t.ScrapeMetadata | t.GenericScrapeMetadata, logger?: t.Logger) => string | undefined;
|
|
10
21
|
export declare function getAttribution(link: string, metadata?: t.ScrapeMetadata | t.GenericScrapeMetadata, logger?: t.Logger): string | undefined;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import type { START, StateGraph, StateGraphArgs } from '@langchain/langgraph';
|
|
2
|
-
import type { BindToolsInput } from '@langchain/core/language_models/chat_models';
|
|
3
1
|
import type { BaseMessage, AIMessageChunk, SystemMessage } from '@langchain/core/messages';
|
|
2
|
+
import type { BindToolsInput } from '@langchain/core/language_models/chat_models';
|
|
3
|
+
import type { START, StateGraph, StateGraphArgs } from '@langchain/langgraph';
|
|
4
4
|
import type { RunnableConfig, Runnable } from '@langchain/core/runnables';
|
|
5
5
|
import type { ChatGenerationChunk } from '@langchain/core/outputs';
|
|
6
6
|
import type { GoogleAIToolType } from '@langchain/google-common';
|
|
7
|
+
import type { SummarizationNodeInput, SummarizeCompleteEvent, SummarizationConfig, SummarizeStartEvent, SummarizeDeltaEvent } from '@/types/summarize';
|
|
7
8
|
import type { ToolMap, ToolEndEvent, GenericTool, LCTool, ToolExecuteBatchRequest } from '@/types/tools';
|
|
9
|
+
import type { RunStep, RunStepDeltaEvent, MessageDeltaEvent, ReasoningDeltaEvent } from '@/types/stream';
|
|
8
10
|
import type { Providers, Callback, GraphNodeKeys } from '@/common';
|
|
9
11
|
import type { StandardGraph, MultiAgentGraph } from '@/graphs';
|
|
10
12
|
import type { ClientOptions } from '@/types/llm';
|
|
11
|
-
import type { SummarizationNodeInput, SummarizeCompleteEvent, SummarizationConfig, SummarizeStartEvent, SummarizeDeltaEvent } from '@/types/summarize';
|
|
12
|
-
import type { RunStep, RunStepDeltaEvent, MessageDeltaEvent, ReasoningDeltaEvent } from '@/types/stream';
|
|
13
13
|
import type { TokenCounter } from '@/types/run';
|
|
14
14
|
/** Interface for bound model with stream and invoke methods */
|
|
15
15
|
export interface ChatModel {
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { ChatMistralAI } from '@langchain/mistralai';
|
|
2
|
-
import type { BindToolsInput, BaseChatModelParams } from '@langchain/core/language_models/chat_models';
|
|
3
2
|
import type { OpenAIChatInput, ChatOpenAIFields, AzureOpenAIInput, ClientOptions as OAIClientOptions } from '@langchain/openai';
|
|
3
|
+
import type { BindToolsInput, BaseChatModelParams } from '@langchain/core/language_models/chat_models';
|
|
4
4
|
import type { GoogleGenerativeAIChatInput } from '@langchain/google-genai';
|
|
5
5
|
import type { ChatVertexAIInput } from '@langchain/google-vertexai';
|
|
6
|
-
import type { ChatDeepSeekInput } from '@langchain/deepseek';
|
|
7
|
-
import type { ChatOpenRouterCallOptions } from '@/llm/openrouter';
|
|
8
6
|
import type { ChatBedrockConverseInput } from '@langchain/aws';
|
|
9
7
|
import type { ChatMistralAIInput } from '@langchain/mistralai';
|
|
8
|
+
import type { ChatDeepSeekInput } from '@langchain/deepseek';
|
|
10
9
|
import type { RequestOptions } from '@google/generative-ai';
|
|
11
10
|
import type { StructuredTool } from '@langchain/core/tools';
|
|
12
11
|
import type { AnthropicInput } from '@langchain/anthropic';
|
|
13
12
|
import type { Runnable } from '@langchain/core/runnables';
|
|
14
13
|
import type { OpenAI as OpenAIClient } from 'openai';
|
|
15
14
|
import type { ChatXAIInput } from '@langchain/xai';
|
|
15
|
+
import type { ChatOpenRouterCallOptions } from '@/llm/openrouter';
|
|
16
16
|
import { AzureChatOpenAI, ChatDeepSeek, ChatMoonshot, ChatOpenAI, ChatXAI } from '@/llm/openai';
|
|
17
17
|
import { CustomChatGoogleGenerativeAI } from '@/llm/google';
|
|
18
18
|
import { CustomChatBedrockConverse } from '@/llm/bedrock';
|
|
@@ -70,6 +70,7 @@ export type BedrockAnthropicClientOptions = BedrockAnthropicInput;
|
|
|
70
70
|
export type GoogleClientOptions = GoogleGenerativeAIChatInput & {
|
|
71
71
|
customHeaders?: RequestOptions['customHeaders'];
|
|
72
72
|
thinkingConfig?: GoogleThinkingConfig;
|
|
73
|
+
includeServerSideToolInvocations?: boolean;
|
|
73
74
|
};
|
|
74
75
|
export type DeepSeekClientOptions = Partial<ChatDeepSeekInput>;
|
|
75
76
|
export type XAIClientOptions = ChatXAIInput;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type Anthropic from '@anthropic-ai/sdk';
|
|
2
1
|
import type { BaseMessage } from '@langchain/core/messages';
|
|
2
|
+
import type Anthropic from '@anthropic-ai/sdk';
|
|
3
3
|
export type AnthropicMessages = Array<AnthropicMessage | BaseMessage>;
|
|
4
4
|
export type AnthropicMessage = Anthropic.MessageParam;
|
|
5
5
|
/**
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type { Callbacks } from '@langchain/core/callbacks/manager';
|
|
2
|
+
import type { RunnableConfig } from '@langchain/core/runnables';
|
|
2
3
|
import type { BaseMessage } from '@langchain/core/messages';
|
|
3
4
|
import type { StructuredTool } from '@langchain/core/tools';
|
|
4
|
-
import type
|
|
5
|
-
import type {
|
|
5
|
+
import type * as z from 'zod';
|
|
6
|
+
import type { ToolSessionMap, ToolExecutionConfig, ToolOutputReferencesConfig, EagerEventToolExecutionConfig } from '@/types/tools';
|
|
7
|
+
import type { HumanInTheLoopConfig } from '@/types/hitl';
|
|
8
|
+
import type { HookRegistry } from '@/hooks';
|
|
6
9
|
import type * as s from '@/types/stream';
|
|
7
10
|
import type * as e from '@/common/enum';
|
|
8
11
|
import type * as g from '@/types/graph';
|
|
9
12
|
import type * as l from '@/types/llm';
|
|
10
|
-
import type { ToolSessionMap, ToolExecutionConfig, ToolOutputReferencesConfig, EagerEventToolExecutionConfig } from '@/types/tools';
|
|
11
|
-
import type { HumanInTheLoopConfig } from '@/types/hitl';
|
|
12
|
-
import type { HookRegistry } from '@/hooks';
|
|
13
13
|
export type ZodObjectAny = z.ZodObject<any, any, any, any>;
|
|
14
14
|
export type BaseGraphConfig = {
|
|
15
15
|
llmConfig: l.LLMConfig;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type OpenAITypes from 'openai';
|
|
2
1
|
import type { MessageContentImageUrl, MessageContentText, ToolMessage, BaseMessage } from '@langchain/core/messages';
|
|
3
2
|
import type { ToolCall, ToolCallChunk } from '@langchain/core/messages/tool';
|
|
4
3
|
import type { LLMResult, Generation } from '@langchain/core/outputs';
|
|
5
|
-
import type { AnthropicContentBlock } from '@/llm/anthropic/types';
|
|
6
4
|
import type { Command } from '@langchain/langgraph';
|
|
5
|
+
import type OpenAITypes from 'openai';
|
|
6
|
+
import type { AnthropicContentBlock } from '@/llm/anthropic/types';
|
|
7
7
|
import type { SummarizeCompleteEvent } from '@/types/summarize';
|
|
8
8
|
import type { ToolEndEvent } from '@/types/tools';
|
|
9
9
|
import { StepTypes, ContentTypes, GraphEvents } from '@/common/enum';
|