@illuma-ai/agents 1.4.0-alpha.6 → 1.5.0
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/README.md +62 -0
- package/dist/cjs/agents/AgentContext.cjs +274 -67
- package/dist/cjs/agents/AgentContext.cjs.map +1 -1
- package/dist/cjs/common/enum.cjs +44 -13
- package/dist/cjs/common/enum.cjs.map +1 -1
- package/dist/cjs/graphs/Graph.cjs +182 -5
- package/dist/cjs/graphs/Graph.cjs.map +1 -1
- package/dist/cjs/graphs/MultiAgentGraph.cjs +152 -1167
- package/dist/cjs/graphs/MultiAgentGraph.cjs.map +1 -1
- package/dist/cjs/hooks/HookRegistry.cjs +162 -0
- package/dist/cjs/hooks/HookRegistry.cjs.map +1 -0
- package/dist/cjs/hooks/executeHooks.cjs +276 -0
- package/dist/cjs/hooks/executeHooks.cjs.map +1 -0
- package/dist/cjs/hooks/matchers.cjs +256 -0
- package/dist/cjs/hooks/matchers.cjs.map +1 -0
- package/dist/cjs/hooks/types.cjs +27 -0
- package/dist/cjs/hooks/types.cjs.map +1 -0
- package/dist/cjs/langchain/google-common.cjs +3 -0
- package/dist/cjs/langchain/google-common.cjs.map +1 -0
- package/dist/cjs/langchain/index.cjs +86 -0
- package/dist/cjs/langchain/index.cjs.map +1 -0
- package/dist/cjs/langchain/language_models/chat_models.cjs +3 -0
- package/dist/cjs/langchain/language_models/chat_models.cjs.map +1 -0
- package/dist/cjs/langchain/messages/tool.cjs +3 -0
- package/dist/cjs/langchain/messages/tool.cjs.map +1 -0
- package/dist/cjs/langchain/messages.cjs +51 -0
- package/dist/cjs/langchain/messages.cjs.map +1 -0
- package/dist/cjs/langchain/openai.cjs +3 -0
- package/dist/cjs/langchain/openai.cjs.map +1 -0
- package/dist/cjs/langchain/prompts.cjs +11 -0
- package/dist/cjs/langchain/prompts.cjs.map +1 -0
- package/dist/cjs/langchain/runnables.cjs +19 -0
- package/dist/cjs/langchain/runnables.cjs.map +1 -0
- package/dist/cjs/langchain/tools.cjs +23 -0
- package/dist/cjs/langchain/tools.cjs.map +1 -0
- package/dist/cjs/langchain/utils/env.cjs +11 -0
- package/dist/cjs/langchain/utils/env.cjs.map +1 -0
- package/dist/cjs/llm/anthropic/utils/message_inputs.cjs +5 -1
- package/dist/cjs/llm/anthropic/utils/message_inputs.cjs.map +1 -1
- package/dist/cjs/llm/bedrock/cacheSupport.cjs +55 -0
- package/dist/cjs/llm/bedrock/cacheSupport.cjs.map +1 -0
- package/dist/cjs/llm/bedrock/index.cjs +61 -33
- package/dist/cjs/llm/bedrock/index.cjs.map +1 -1
- package/dist/cjs/llm/openai/index.cjs +0 -3
- package/dist/cjs/llm/openai/index.cjs.map +1 -1
- package/dist/cjs/llm/openai/utils/index.cjs +27 -10
- package/dist/cjs/llm/openai/utils/index.cjs.map +1 -1
- package/dist/cjs/main.cjs +178 -127
- package/dist/cjs/main.cjs.map +1 -1
- package/dist/cjs/messages/cache.cjs +89 -0
- package/dist/cjs/messages/cache.cjs.map +1 -1
- package/dist/cjs/messages/contextPruning.cjs +156 -0
- package/dist/cjs/messages/contextPruning.cjs.map +1 -0
- package/dist/cjs/messages/contextPruningSettings.cjs +53 -0
- package/dist/cjs/messages/contextPruningSettings.cjs.map +1 -0
- package/dist/cjs/messages/format.cjs +144 -20
- package/dist/cjs/messages/format.cjs.map +1 -1
- package/dist/cjs/messages/prune.cjs +505 -4
- package/dist/cjs/messages/prune.cjs.map +1 -1
- package/dist/cjs/run.cjs +141 -1
- package/dist/cjs/run.cjs.map +1 -1
- package/dist/cjs/tools/BashExecutor.cjs +235 -0
- package/dist/cjs/tools/BashExecutor.cjs.map +1 -0
- package/dist/cjs/tools/BashProgrammaticToolCalling.cjs +297 -0
- package/dist/cjs/tools/BashProgrammaticToolCalling.cjs.map +1 -0
- package/dist/cjs/tools/CodeExecutor.cjs +44 -47
- package/dist/cjs/tools/CodeExecutor.cjs.map +1 -1
- package/dist/cjs/tools/ProgrammaticToolCalling.cjs +16 -11
- package/dist/cjs/tools/ProgrammaticToolCalling.cjs.map +1 -1
- package/dist/cjs/tools/ReadFile.cjs +44 -0
- package/dist/cjs/tools/ReadFile.cjs.map +1 -0
- package/dist/cjs/tools/SkillTool.cjs +51 -0
- package/dist/cjs/tools/SkillTool.cjs.map +1 -0
- package/dist/cjs/tools/SubagentTool.cjs +93 -0
- package/dist/cjs/tools/SubagentTool.cjs.map +1 -0
- package/dist/cjs/tools/ToolNode.cjs +450 -24
- package/dist/cjs/tools/ToolNode.cjs.map +1 -1
- package/dist/cjs/tools/search/search.cjs +11 -3
- package/dist/cjs/tools/search/search.cjs.map +1 -1
- package/dist/cjs/tools/search/tavily-scraper.cjs +189 -0
- package/dist/cjs/tools/search/tavily-scraper.cjs.map +1 -0
- package/dist/cjs/tools/search/tavily-search.cjs +372 -0
- package/dist/cjs/tools/search/tavily-search.cjs.map +1 -0
- package/dist/cjs/tools/search/tool.cjs +28 -4
- package/dist/cjs/tools/search/tool.cjs.map +1 -1
- package/dist/cjs/tools/search/utils.cjs +10 -3
- package/dist/cjs/tools/search/utils.cjs.map +1 -1
- package/dist/cjs/tools/skillCatalog.cjs +84 -0
- package/dist/cjs/tools/skillCatalog.cjs.map +1 -0
- package/dist/cjs/tools/subagent/SubagentExecutor.cjs +512 -0
- package/dist/cjs/tools/subagent/SubagentExecutor.cjs.map +1 -0
- package/dist/cjs/tools/toolOutputReferences.cjs +670 -0
- package/dist/cjs/tools/toolOutputReferences.cjs.map +1 -0
- package/dist/cjs/types/agent-cache.cjs +53 -0
- package/dist/cjs/types/agent-cache.cjs.map +1 -0
- package/dist/cjs/types/graph.cjs.map +1 -1
- package/dist/cjs/utils/truncation.cjs +135 -0
- package/dist/cjs/utils/truncation.cjs.map +1 -0
- package/dist/esm/agents/AgentContext.mjs +274 -67
- package/dist/esm/agents/AgentContext.mjs.map +1 -1
- package/dist/esm/common/enum.mjs +44 -12
- package/dist/esm/common/enum.mjs.map +1 -1
- package/dist/esm/graphs/Graph.mjs +182 -5
- package/dist/esm/graphs/Graph.mjs.map +1 -1
- package/dist/esm/graphs/MultiAgentGraph.mjs +155 -1170
- package/dist/esm/graphs/MultiAgentGraph.mjs.map +1 -1
- package/dist/esm/hooks/HookRegistry.mjs +160 -0
- package/dist/esm/hooks/HookRegistry.mjs.map +1 -0
- package/dist/esm/hooks/executeHooks.mjs +273 -0
- package/dist/esm/hooks/executeHooks.mjs.map +1 -0
- package/dist/esm/hooks/matchers.mjs +251 -0
- package/dist/esm/hooks/matchers.mjs.map +1 -0
- package/dist/esm/hooks/types.mjs +25 -0
- package/dist/esm/hooks/types.mjs.map +1 -0
- package/dist/esm/langchain/google-common.mjs +2 -0
- package/dist/esm/langchain/google-common.mjs.map +1 -0
- package/dist/esm/langchain/index.mjs +5 -0
- package/dist/esm/langchain/language_models/chat_models.mjs +2 -0
- package/dist/esm/langchain/language_models/chat_models.mjs.map +1 -0
- package/dist/esm/langchain/messages/tool.mjs +2 -0
- package/dist/esm/langchain/messages/tool.mjs.map +1 -0
- package/dist/esm/langchain/messages.mjs +2 -0
- package/dist/esm/langchain/messages.mjs.map +1 -0
- package/dist/esm/langchain/openai.mjs +2 -0
- package/dist/esm/langchain/openai.mjs.map +1 -0
- package/dist/esm/langchain/prompts.mjs +2 -0
- package/dist/esm/langchain/prompts.mjs.map +1 -0
- package/dist/esm/langchain/runnables.mjs +2 -0
- package/dist/esm/langchain/runnables.mjs.map +1 -0
- package/dist/esm/langchain/tools.mjs +2 -0
- package/dist/esm/langchain/tools.mjs.map +1 -0
- package/dist/esm/langchain/utils/env.mjs +2 -0
- package/dist/esm/langchain/utils/env.mjs.map +1 -0
- package/dist/esm/llm/anthropic/utils/message_inputs.mjs +5 -1
- package/dist/esm/llm/anthropic/utils/message_inputs.mjs.map +1 -1
- package/dist/esm/llm/bedrock/cacheSupport.mjs +52 -0
- package/dist/esm/llm/bedrock/cacheSupport.mjs.map +1 -0
- package/dist/esm/llm/bedrock/index.mjs +61 -34
- package/dist/esm/llm/bedrock/index.mjs.map +1 -1
- package/dist/esm/llm/openai/index.mjs +0 -3
- package/dist/esm/llm/openai/index.mjs.map +1 -1
- package/dist/esm/llm/openai/utils/index.mjs +27 -10
- package/dist/esm/llm/openai/utils/index.mjs.map +1 -1
- package/dist/esm/main.mjs +21 -27
- package/dist/esm/main.mjs.map +1 -1
- package/dist/esm/messages/cache.mjs +89 -0
- package/dist/esm/messages/cache.mjs.map +1 -1
- package/dist/esm/messages/contextPruning.mjs +154 -0
- package/dist/esm/messages/contextPruning.mjs.map +1 -0
- package/dist/esm/messages/contextPruningSettings.mjs +50 -0
- package/dist/esm/messages/contextPruningSettings.mjs.map +1 -0
- package/dist/esm/messages/format.mjs +136 -12
- package/dist/esm/messages/format.mjs.map +1 -1
- package/dist/esm/messages/prune.mjs +504 -7
- package/dist/esm/messages/prune.mjs.map +1 -1
- package/dist/esm/run.mjs +141 -1
- package/dist/esm/run.mjs.map +1 -1
- package/dist/esm/tools/BashExecutor.mjs +227 -0
- package/dist/esm/tools/BashExecutor.mjs.map +1 -0
- package/dist/esm/tools/BashProgrammaticToolCalling.mjs +288 -0
- package/dist/esm/tools/BashProgrammaticToolCalling.mjs.map +1 -0
- package/dist/esm/tools/CodeExecutor.mjs +44 -48
- package/dist/esm/tools/CodeExecutor.mjs.map +1 -1
- package/dist/esm/tools/ProgrammaticToolCalling.mjs +17 -12
- package/dist/esm/tools/ProgrammaticToolCalling.mjs.map +1 -1
- package/dist/esm/tools/ReadFile.mjs +39 -0
- package/dist/esm/tools/ReadFile.mjs.map +1 -0
- package/dist/esm/tools/SkillTool.mjs +46 -0
- package/dist/esm/tools/SkillTool.mjs.map +1 -0
- package/dist/esm/tools/SubagentTool.mjs +86 -0
- package/dist/esm/tools/SubagentTool.mjs.map +1 -0
- package/dist/esm/tools/ToolNode.mjs +452 -26
- package/dist/esm/tools/ToolNode.mjs.map +1 -1
- package/dist/esm/tools/search/search.mjs +11 -3
- package/dist/esm/tools/search/search.mjs.map +1 -1
- package/dist/esm/tools/search/tavily-scraper.mjs +186 -0
- package/dist/esm/tools/search/tavily-scraper.mjs.map +1 -0
- package/dist/esm/tools/search/tavily-search.mjs +370 -0
- package/dist/esm/tools/search/tavily-search.mjs.map +1 -0
- package/dist/esm/tools/search/tool.mjs +28 -4
- package/dist/esm/tools/search/tool.mjs.map +1 -1
- package/dist/esm/tools/search/utils.mjs +10 -3
- package/dist/esm/tools/search/utils.mjs.map +1 -1
- package/dist/esm/tools/skillCatalog.mjs +82 -0
- package/dist/esm/tools/skillCatalog.mjs.map +1 -0
- package/dist/esm/tools/subagent/SubagentExecutor.mjs +506 -0
- package/dist/esm/tools/subagent/SubagentExecutor.mjs.map +1 -0
- package/dist/esm/tools/toolOutputReferences.mjs +662 -0
- package/dist/esm/tools/toolOutputReferences.mjs.map +1 -0
- package/dist/esm/types/agent-cache.mjs +51 -0
- package/dist/esm/types/agent-cache.mjs.map +1 -0
- package/dist/esm/types/graph.mjs.map +1 -1
- package/dist/esm/utils/truncation.mjs +128 -0
- package/dist/esm/utils/truncation.mjs.map +1 -0
- package/dist/types/agents/AgentContext.d.ts +101 -8
- package/dist/types/common/enum.d.ts +39 -12
- package/dist/types/common/index.d.ts +0 -1
- package/dist/types/graphs/Graph.d.ts +43 -0
- package/dist/types/graphs/MultiAgentGraph.d.ts +26 -150
- package/dist/types/graphs/index.d.ts +0 -1
- package/dist/types/hooks/HookRegistry.d.ts +56 -0
- package/dist/types/hooks/executeHooks.d.ts +79 -0
- package/dist/types/hooks/index.d.ts +6 -0
- package/dist/types/hooks/matchers.d.ts +95 -0
- package/dist/types/hooks/types.d.ts +320 -0
- package/dist/types/index.d.ts +9 -9
- package/dist/types/langchain/google-common.d.ts +1 -0
- package/dist/types/langchain/index.d.ts +8 -0
- package/dist/types/langchain/language_models/chat_models.d.ts +1 -0
- package/dist/types/langchain/messages/tool.d.ts +1 -0
- package/dist/types/langchain/messages.d.ts +2 -0
- package/dist/types/langchain/openai.d.ts +1 -0
- package/dist/types/langchain/prompts.d.ts +1 -0
- package/dist/types/langchain/runnables.d.ts +2 -0
- package/dist/types/langchain/tools.d.ts +2 -0
- package/dist/types/langchain/utils/env.d.ts +1 -0
- package/dist/types/llm/bedrock/cacheSupport.d.ts +35 -0
- package/dist/types/llm/bedrock/index.d.ts +54 -1
- package/dist/types/messages/contextPruning.d.ts +42 -0
- package/dist/types/messages/contextPruningSettings.d.ts +44 -0
- package/dist/types/messages/format.d.ts +9 -1
- package/dist/types/messages/index.d.ts +2 -0
- package/dist/types/messages/prune.d.ts +91 -1
- package/dist/types/run.d.ts +2 -0
- package/dist/types/tools/BashExecutor.d.ts +76 -0
- package/dist/types/tools/BashProgrammaticToolCalling.d.ts +72 -0
- package/dist/types/tools/CodeExecutor.d.ts +8 -26
- package/dist/types/tools/ReadFile.d.ts +28 -0
- package/dist/types/tools/SkillTool.d.ts +40 -0
- package/dist/types/tools/SubagentTool.d.ts +36 -0
- package/dist/types/tools/ToolNode.d.ts +77 -5
- package/dist/types/tools/search/tavily-scraper.d.ts +19 -0
- package/dist/types/tools/search/tavily-search.d.ts +4 -0
- package/dist/types/tools/search/types.d.ts +99 -5
- package/dist/types/tools/search/utils.d.ts +2 -2
- package/dist/types/tools/skillCatalog.d.ts +19 -0
- package/dist/types/tools/subagent/SubagentExecutor.d.ts +137 -0
- package/dist/types/tools/subagent/index.d.ts +2 -0
- package/dist/types/tools/subagent/types.d.ts +84 -0
- package/dist/types/tools/toolOutputReferences.d.ts +236 -0
- package/dist/types/types/agent-cache.d.ts +70 -0
- package/dist/types/types/graph.d.ts +162 -22
- package/dist/types/types/index.d.ts +3 -0
- package/dist/types/types/messages.d.ts +26 -0
- package/dist/types/types/run.d.ts +22 -0
- package/dist/types/types/skill.d.ts +9 -0
- package/dist/types/types/tools.d.ts +111 -0
- package/dist/types/utils/index.d.ts +1 -3
- package/dist/types/utils/truncation.d.ts +70 -0
- package/package.json +57 -17
- package/src/agents/AgentContext.js.map +1 -0
- package/src/agents/AgentContext.test.js.map +1 -0
- package/src/agents/AgentContext.ts +321 -78
- package/src/agents/__tests__/AgentContext.cacheTtl.live.test.ts +259 -0
- package/src/agents/__tests__/AgentContext.crossAgentTier1.live.test.ts +264 -0
- package/src/agents/__tests__/AgentContext.crossUserCache.live.test.ts +342 -0
- package/src/agents/__tests__/AgentContext.test.js.map +1 -0
- package/src/agents/__tests__/AgentContext.test.ts +632 -0
- package/src/agents/__tests__/resolveStructuredOutputMode.test.js.map +1 -0
- package/src/common/__tests__/enum.test.ts +7 -17
- package/src/common/enum.js.map +1 -0
- package/src/common/enum.ts +43 -12
- package/src/common/index.js.map +1 -0
- package/src/common/index.ts +0 -1
- package/src/events.js.map +1 -0
- package/src/graphs/Graph.js.map +1 -0
- package/src/graphs/Graph.ts +222 -2
- package/src/graphs/MultiAgentGraph.js.map +1 -0
- package/src/graphs/MultiAgentGraph.ts +154 -1466
- package/src/graphs/__tests__/MultiAgentGraph.test.ts +91 -0
- package/src/graphs/__tests__/structured-output.integration.test.js.map +1 -0
- package/src/graphs/__tests__/structured-output.test.js.map +1 -0
- package/src/graphs/contextManagement.e2e.test.js.map +1 -0
- package/src/graphs/contextManagement.test.js.map +1 -0
- package/src/graphs/handoffValidation.test.js.map +1 -0
- package/src/graphs/index.js.map +1 -0
- package/src/graphs/index.ts +0 -1
- package/src/hooks/HookRegistry.ts +208 -0
- package/src/hooks/__tests__/HookRegistry.test.ts +190 -0
- package/src/hooks/__tests__/compactHooks.test.ts +214 -0
- package/src/hooks/__tests__/executeHooks.test.ts +1013 -0
- package/src/hooks/__tests__/integration.test.ts +337 -0
- package/src/hooks/__tests__/matchers.test.ts +238 -0
- package/src/hooks/__tests__/toolHooks.test.ts +665 -0
- package/src/hooks/executeHooks.ts +375 -0
- package/src/hooks/index.ts +57 -0
- package/src/hooks/matchers.ts +280 -0
- package/src/hooks/types.ts +404 -0
- package/src/index.js.map +1 -0
- package/src/index.ts +15 -24
- package/src/instrumentation.js.map +1 -0
- package/src/langchain/google-common.ts +1 -0
- package/src/langchain/index.ts +8 -0
- package/src/langchain/language_models/chat_models.ts +1 -0
- package/src/langchain/messages/tool.ts +5 -0
- package/src/langchain/messages.ts +21 -0
- package/src/langchain/openai.ts +1 -0
- package/src/langchain/prompts.ts +1 -0
- package/src/langchain/runnables.ts +7 -0
- package/src/langchain/tools.ts +8 -0
- package/src/langchain/utils/env.ts +1 -0
- package/src/llm/anthropic/index.js.map +1 -0
- package/src/llm/anthropic/types.js.map +1 -0
- package/src/llm/anthropic/utils/message_inputs.js.map +1 -0
- package/src/llm/anthropic/utils/message_inputs.ts +10 -1
- package/src/llm/anthropic/utils/message_outputs.js.map +1 -0
- package/src/llm/anthropic/utils/output_parsers.js.map +1 -0
- package/src/llm/anthropic/utils/server-tool-inputs.test.ts +436 -0
- package/src/llm/anthropic/utils/tools.js.map +1 -0
- package/src/llm/bedrock/__tests__/bedrock-caching.test.js.map +1 -0
- package/src/llm/bedrock/__tests__/bedrock-caching.test.ts +166 -18
- package/src/llm/bedrock/cacheSupport.test.ts +99 -0
- package/src/llm/bedrock/cacheSupport.ts +53 -0
- package/src/llm/bedrock/index.js.map +1 -0
- package/src/llm/bedrock/index.ts +116 -41
- package/src/llm/bedrock/types.js.map +1 -0
- package/src/llm/bedrock/utils/index.js.map +1 -0
- package/src/llm/bedrock/utils/message_inputs.js.map +1 -0
- package/src/llm/bedrock/utils/message_outputs.js.map +1 -0
- package/src/llm/fake.js.map +1 -0
- package/src/llm/google/index.js.map +1 -0
- package/src/llm/google/types.js.map +1 -0
- package/src/llm/google/utils/common.js.map +1 -0
- package/src/llm/google/utils/tools.js.map +1 -0
- package/src/llm/google/utils/zod_to_genai_parameters.js.map +1 -0
- package/src/llm/openai/index.js.map +1 -0
- package/src/llm/openai/types.js.map +1 -0
- package/src/llm/openai/utils/index.js.map +1 -0
- package/src/llm/openai/utils/index.ts +31 -14
- package/src/llm/openai/utils/isReasoningModel.test.js.map +1 -0
- package/src/llm/openrouter/index.js.map +1 -0
- package/src/llm/openrouter/reasoning.test.js.map +1 -0
- package/src/llm/providers.js.map +1 -0
- package/src/llm/text.js.map +1 -0
- package/src/llm/vertexai/index.js.map +1 -0
- package/src/messages/__tests__/contextPruning.test.ts +228 -0
- package/src/messages/__tests__/tools.test.js.map +1 -0
- package/src/messages/cache.js.map +1 -0
- package/src/messages/cache.test.js.map +1 -0
- package/src/messages/cache.test.ts +62 -24
- package/src/messages/cache.ts +112 -0
- package/src/messages/content.js.map +1 -0
- package/src/messages/content.test.js.map +1 -0
- package/src/messages/contextPruning.ts +191 -0
- package/src/messages/contextPruningSettings.ts +90 -0
- package/src/messages/core.js.map +1 -0
- package/src/messages/ensureThinkingBlock.test.js.map +1 -0
- package/src/messages/format.js.map +1 -0
- package/src/messages/format.ts +164 -12
- package/src/messages/formatAgentMessages.skills.test.ts +413 -0
- package/src/messages/formatAgentMessages.test.js.map +1 -0
- package/src/messages/formatAgentMessages.tools.test.js.map +1 -0
- package/src/messages/formatMessage.test.js.map +1 -0
- package/src/messages/ids.js.map +1 -0
- package/src/messages/index.js.map +1 -0
- package/src/messages/index.ts +2 -0
- package/src/messages/labelContentByAgent.test.js.map +1 -0
- package/src/messages/prune.js.map +1 -0
- package/src/messages/prune.ts +661 -4
- package/src/messages/reducer.js.map +1 -0
- package/src/messages/shiftIndexTokenCountMap.test.js.map +1 -0
- package/src/messages/summarize.js.map +1 -0
- package/src/messages/summarize.test.js.map +1 -0
- package/src/messages/tools.js.map +1 -0
- package/src/mockStream.js.map +1 -0
- package/src/prompts/collab.js.map +1 -0
- package/src/prompts/index.js.map +1 -0
- package/src/prompts/taskmanager.js.map +1 -0
- package/src/run.js.map +1 -0
- package/src/run.ts +155 -1
- package/src/schemas/index.js.map +1 -0
- package/src/schemas/schema-preparation.test.js.map +1 -0
- package/src/schemas/validate.js.map +1 -0
- package/src/schemas/validate.test.js.map +1 -0
- package/src/scripts/abort.js.map +1 -0
- package/src/scripts/ant_web_search.js.map +1 -0
- package/src/scripts/ant_web_search_edge_case.js.map +1 -0
- package/src/scripts/ant_web_search_error_edge_case.js.map +1 -0
- package/src/scripts/args.js.map +1 -0
- package/src/scripts/bedrock-cache-debug.js.map +1 -0
- package/src/scripts/bedrock-content-aggregation-test.js.map +1 -0
- package/src/scripts/bedrock-merge-test.js.map +1 -0
- package/src/scripts/bedrock-parallel-tools-test.js.map +1 -0
- package/src/scripts/caching.js.map +1 -0
- package/src/scripts/cli.js.map +1 -0
- package/src/scripts/cli2.js.map +1 -0
- package/src/scripts/cli3.js.map +1 -0
- package/src/scripts/cli4.js.map +1 -0
- package/src/scripts/cli5.js.map +1 -0
- package/src/scripts/code_exec.js.map +1 -0
- package/src/scripts/code_exec_files.js.map +1 -0
- package/src/scripts/code_exec_multi_session.js.map +1 -0
- package/src/scripts/code_exec_ptc.js.map +1 -0
- package/src/scripts/code_exec_session.js.map +1 -0
- package/src/scripts/code_exec_simple.js.map +1 -0
- package/src/scripts/content.js.map +1 -0
- package/src/scripts/empty_input.js.map +1 -0
- package/src/scripts/handoff-test.js.map +1 -0
- package/src/scripts/image.js.map +1 -0
- package/src/scripts/memory.js.map +1 -0
- package/src/scripts/multi-agent-chain.js.map +1 -0
- package/src/scripts/multi-agent-chain.ts +2 -2
- package/src/scripts/multi-agent-conditional.js.map +1 -0
- package/src/scripts/multi-agent-document-review-chain.js.map +1 -0
- package/src/scripts/multi-agent-document-review-chain.ts +2 -2
- package/src/scripts/multi-agent-hybrid-flow.js.map +1 -0
- package/src/scripts/multi-agent-hybrid-flow.ts +4 -4
- package/src/scripts/multi-agent-parallel-start.js.map +1 -0
- package/src/scripts/multi-agent-parallel.js.map +1 -0
- package/src/scripts/multi-agent-parallel.ts +3 -3
- package/src/scripts/multi-agent-sequence.js.map +1 -0
- package/src/scripts/multi-agent-sequence.ts +3 -3
- package/src/scripts/multi-agent-subagent.ts +246 -0
- package/src/scripts/multi-agent-supervisor.js.map +1 -0
- package/src/scripts/multi-agent-supervisor.ts +5 -5
- package/src/scripts/multi-agent-test.js.map +1 -0
- package/src/scripts/parallel-asymmetric-tools-test.js.map +1 -0
- package/src/scripts/parallel-full-metadata-test.js.map +1 -0
- package/src/scripts/parallel-tools-test.js.map +1 -0
- package/src/scripts/poc-multi-agent-comprehensive.ts +8 -8
- package/src/scripts/programmatic_exec.js.map +1 -0
- package/src/scripts/programmatic_exec_agent.js.map +1 -0
- package/src/scripts/search.js.map +1 -0
- package/src/scripts/sequential-full-metadata-test.js.map +1 -0
- package/src/scripts/sequential-full-metadata-test.ts +2 -2
- package/src/scripts/simple.js.map +1 -0
- package/src/scripts/single-agent-metadata-test.js.map +1 -0
- package/src/scripts/stream.js.map +1 -0
- package/src/scripts/subagent-event-driven-debug.ts +190 -0
- package/src/scripts/subagent-tools-debug.ts +160 -0
- package/src/scripts/test-custom-prompt-key.js.map +1 -0
- package/src/scripts/test-custom-prompt-key.ts +3 -3
- package/src/scripts/test-handoff-input.js.map +1 -0
- package/src/scripts/test-handoff-input.ts +1 -1
- package/src/scripts/test-handoff-preamble.js.map +1 -0
- package/src/scripts/test-handoff-steering.js.map +1 -0
- package/src/scripts/test-handoff-steering.ts +3 -3
- package/src/scripts/test-multi-agent-list-handoff.js.map +1 -0
- package/src/scripts/test-multi-agent-list-handoff.ts +1 -1
- package/src/scripts/test-parallel-agent-labeling.js.map +1 -0
- package/src/scripts/test-parallel-agent-labeling.ts +3 -3
- package/src/scripts/test-parallel-handoffs.js.map +1 -0
- package/src/scripts/test-parallel-handoffs.ts +2 -2
- package/src/scripts/test-thinking-handoff-bedrock.js.map +1 -0
- package/src/scripts/test-thinking-handoff-bedrock.ts +1 -1
- package/src/scripts/test-thinking-handoff.js.map +1 -0
- package/src/scripts/test-thinking-handoff.ts +1 -1
- package/src/scripts/test-thinking-to-thinking-handoff-bedrock.js.map +1 -0
- package/src/scripts/test-thinking-to-thinking-handoff-bedrock.ts +1 -1
- package/src/scripts/test-tool-before-handoff-role-order.js.map +1 -0
- package/src/scripts/test-tool-before-handoff-role-order.ts +1 -1
- package/src/scripts/test-tools-before-handoff.js.map +1 -0
- package/src/scripts/test-tools-before-handoff.ts +1 -1
- package/src/scripts/test_code_api.js.map +1 -0
- package/src/scripts/thinking-bedrock.js.map +1 -0
- package/src/scripts/thinking-vertexai.js.map +1 -0
- package/src/scripts/thinking.js.map +1 -0
- package/src/scripts/tool_search.js.map +1 -0
- package/src/scripts/tools.js.map +1 -0
- package/src/specs/agent-handoffs-bedrock.integration.test.js.map +1 -0
- package/src/specs/agent-handoffs.test.js.map +1 -0
- package/src/specs/agent-handoffs.test.ts +26 -483
- package/src/specs/anthropic.simple.test.js.map +1 -0
- package/src/specs/anthropic.simple.test.ts +61 -0
- package/src/specs/azure.simple.test.js.map +1 -0
- package/src/specs/cache.simple.test.js.map +1 -0
- package/src/specs/custom-event-await.test.js.map +1 -0
- package/src/specs/deepseek.simple.test.js.map +1 -0
- package/src/specs/emergency-prune.test.js.map +1 -0
- package/src/specs/moonshot.simple.test.js.map +1 -0
- package/src/specs/multi-agent-summarization.test.ts +396 -0
- package/src/specs/observability.integration.test.js.map +1 -0
- package/src/specs/openai.simple.test.js.map +1 -0
- package/src/specs/openrouter.simple.test.js.map +1 -0
- package/src/specs/prune.orphans.test.ts +248 -0
- package/src/specs/prune.test.js.map +1 -0
- package/src/specs/prune.test.ts +104 -16
- package/src/specs/reasoning.test.js.map +1 -0
- package/src/specs/spec.utils.js.map +1 -0
- package/src/specs/thinking-handoff.test.js.map +1 -0
- package/src/specs/thinking-handoff.test.ts +19 -19
- package/src/specs/thinking-prune.test.js.map +1 -0
- package/src/specs/token-distribution-edge-case.test.js.map +1 -0
- package/src/specs/token-memoization.test.js.map +1 -0
- package/src/specs/tokens.test.js.map +1 -0
- package/src/specs/tool-error.test.js.map +1 -0
- package/src/splitStream.js.map +1 -0
- package/src/splitStream.test.js.map +1 -0
- package/src/stream.js.map +1 -0
- package/src/stream.test.js.map +1 -0
- package/src/test/mockTools.js.map +1 -0
- package/src/tools/BashExecutor.ts +281 -0
- package/src/tools/BashProgrammaticToolCalling.ts +397 -0
- package/src/tools/BrowserTools.js.map +1 -0
- package/src/tools/Calculator.js.map +1 -0
- package/src/tools/Calculator.test.js.map +1 -0
- package/src/tools/CodeExecutor.js.map +1 -0
- package/src/tools/CodeExecutor.ts +62 -54
- package/src/tools/ProgrammaticToolCalling.js.map +1 -0
- package/src/tools/ProgrammaticToolCalling.ts +29 -14
- package/src/tools/ReadFile.ts +39 -0
- package/src/tools/SkillTool.ts +46 -0
- package/src/tools/StreamingToolCallBuffer.js.map +1 -0
- package/src/tools/SubagentTool.ts +100 -0
- package/src/tools/ToolNode.js.map +1 -0
- package/src/tools/ToolNode.ts +548 -26
- package/src/tools/ToolSearch.js.map +1 -0
- package/src/tools/__tests__/BashExecutor.test.ts +49 -0
- package/src/tools/__tests__/BrowserTools.test.js.map +1 -0
- package/src/tools/__tests__/CodeExecutor.test.ts +37 -36
- package/src/tools/__tests__/ProgrammaticToolCalling.integration.test.js.map +1 -0
- package/src/tools/__tests__/ProgrammaticToolCalling.test.js.map +1 -0
- package/src/tools/__tests__/ProgrammaticToolCalling.test.ts +60 -0
- package/src/tools/__tests__/ReadFile.test.ts +44 -0
- package/src/tools/__tests__/SkillTool.test.ts +442 -0
- package/src/tools/__tests__/StreamingToolCallBuffer.test.js.map +1 -0
- package/src/tools/__tests__/SubagentExecutor.test.ts +1148 -0
- package/src/tools/__tests__/SubagentTool.test.ts +149 -0
- package/src/tools/__tests__/ToolApproval.test.js.map +1 -0
- package/src/tools/__tests__/ToolNode.outputReferences.test.ts +1438 -0
- package/src/tools/__tests__/ToolNode.recovery.test.js.map +1 -0
- package/src/tools/__tests__/ToolNode.session.test.js.map +1 -0
- package/src/tools/__tests__/ToolSearch.integration.test.js.map +1 -0
- package/src/tools/__tests__/ToolSearch.test.js.map +1 -0
- package/src/tools/__tests__/annotateMessagesForLLM.test.ts +479 -0
- package/src/tools/__tests__/handlers.test.js.map +1 -0
- package/src/tools/__tests__/skillCatalog.test.ts +161 -0
- package/src/tools/__tests__/subagentHooks.test.ts +210 -0
- package/src/tools/__tests__/toolOutputReferences.test.ts +415 -0
- package/src/tools/__tests__/truncation-recovery.integration.test.js.map +1 -0
- package/src/tools/handlers.js.map +1 -0
- package/src/tools/schema.js.map +1 -0
- package/src/tools/search/anthropic.js.map +1 -0
- package/src/tools/search/content.js.map +1 -0
- package/src/tools/search/content.test.js.map +1 -0
- package/src/tools/search/firecrawl.js.map +1 -0
- package/src/tools/search/format.js.map +1 -0
- package/src/tools/search/highlights.js.map +1 -0
- package/src/tools/search/index.js.map +1 -0
- package/src/tools/search/jina-reranker.test.js.map +1 -0
- package/src/tools/search/rerankers.js.map +1 -0
- package/src/tools/search/schema.js.map +1 -0
- package/src/tools/search/search.js.map +1 -0
- package/src/tools/search/search.ts +12 -2
- package/src/tools/search/serper-scraper.js.map +1 -0
- package/src/tools/search/tavily-scraper.ts +235 -0
- package/src/tools/search/tavily-search.ts +424 -0
- package/src/tools/search/tavily.test.ts +965 -0
- package/src/tools/search/test.js.map +1 -0
- package/src/tools/search/tool.js.map +1 -0
- package/src/tools/search/tool.ts +36 -2
- package/src/tools/search/types.js.map +1 -0
- package/src/tools/search/types.ts +133 -8
- package/src/tools/search/utils.js.map +1 -0
- package/src/tools/search/utils.ts +13 -5
- package/src/tools/skillCatalog.ts +126 -0
- package/src/tools/subagent/SubagentExecutor.ts +676 -0
- package/src/tools/subagent/index.ts +13 -0
- package/src/tools/subagent/types.test.ts +70 -0
- package/src/tools/subagent/types.ts +115 -0
- package/src/tools/toolOutputReferences.ts +825 -0
- package/src/types/agent-cache.ts +73 -0
- package/src/types/graph.js.map +1 -0
- package/src/types/graph.test.js.map +1 -0
- package/src/types/graph.ts +171 -20
- package/src/types/index.js.map +1 -0
- package/src/types/index.ts +3 -0
- package/src/types/llm.js.map +1 -0
- package/src/types/messages.js.map +1 -0
- package/src/types/messages.ts +27 -0
- package/src/types/run.js.map +1 -0
- package/src/types/run.ts +22 -0
- package/src/types/skill.ts +11 -0
- package/src/types/stream.js.map +1 -0
- package/src/types/tools.js.map +1 -0
- package/src/types/tools.ts +118 -0
- package/src/utils/__tests__/truncation.test.ts +66 -0
- package/src/utils/contextAnalytics.js.map +1 -0
- package/src/utils/contextAnalytics.test.js.map +1 -0
- package/src/utils/events.js.map +1 -0
- package/src/utils/graph.js.map +1 -0
- package/src/utils/handlers.js.map +1 -0
- package/src/utils/index.js.map +1 -0
- package/src/utils/index.ts +1 -3
- package/src/utils/llm.js.map +1 -0
- package/src/utils/llmConfig.js.map +1 -0
- package/src/utils/logging.js.map +1 -0
- package/src/utils/misc.js.map +1 -0
- package/src/utils/run.js.map +1 -0
- package/src/utils/schema.js.map +1 -0
- package/src/utils/title.js.map +1 -0
- package/src/utils/tokens.js.map +1 -0
- package/src/utils/toonFormat.js.map +1 -0
- package/src/utils/truncation.ts +154 -0
- package/dist/cjs/common/spawnPath.cjs +0 -104
- package/dist/cjs/common/spawnPath.cjs.map +0 -1
- package/dist/cjs/content/ArtifactStore.cjs +0 -579
- package/dist/cjs/content/ArtifactStore.cjs.map +0 -1
- package/dist/cjs/content/ContentStore.cjs +0 -638
- package/dist/cjs/content/ContentStore.cjs.map +0 -1
- package/dist/cjs/content/contentAnalyzer.cjs +0 -91
- package/dist/cjs/content/contentAnalyzer.cjs.map +0 -1
- package/dist/cjs/content/index.cjs +0 -20
- package/dist/cjs/content/index.cjs.map +0 -1
- package/dist/cjs/content/mcpAutoCache.cjs +0 -115
- package/dist/cjs/content/mcpAutoCache.cjs.map +0 -1
- package/dist/cjs/graphs/HandoffRegistry.cjs +0 -143
- package/dist/cjs/graphs/HandoffRegistry.cjs.map +0 -1
- package/dist/cjs/providers/a2a/A2ACapabilityProvider.cjs +0 -288
- package/dist/cjs/providers/a2a/A2ACapabilityProvider.cjs.map +0 -1
- package/dist/cjs/providers/a2a/client.cjs +0 -92
- package/dist/cjs/providers/a2a/client.cjs.map +0 -1
- package/dist/cjs/providers/a2a/config.cjs +0 -38
- package/dist/cjs/providers/a2a/config.cjs.map +0 -1
- package/dist/cjs/providers/capabilityNaming.cjs +0 -43
- package/dist/cjs/providers/capabilityNaming.cjs.map +0 -1
- package/dist/cjs/providers/mcp/MCPCapabilityProvider.cjs +0 -244
- package/dist/cjs/providers/mcp/MCPCapabilityProvider.cjs.map +0 -1
- package/dist/cjs/providers/mcp/config.cjs +0 -42
- package/dist/cjs/providers/mcp/config.cjs.map +0 -1
- package/dist/cjs/providers/mcp/transport.cjs +0 -65
- package/dist/cjs/providers/mcp/transport.cjs.map +0 -1
- package/dist/cjs/providers/tools-server/ToolsServerCapabilityProvider.cjs +0 -128
- package/dist/cjs/providers/tools-server/ToolsServerCapabilityProvider.cjs.map +0 -1
- package/dist/cjs/providers/types.cjs +0 -51
- package/dist/cjs/providers/types.cjs.map +0 -1
- package/dist/cjs/tools/artifacts/schema.cjs +0 -86
- package/dist/cjs/tools/artifacts/schema.cjs.map +0 -1
- package/dist/cjs/tools/artifacts/tool.cjs +0 -219
- package/dist/cjs/tools/artifacts/tool.cjs.map +0 -1
- package/dist/cjs/tools/fileSearch/formatter.cjs +0 -93
- package/dist/cjs/tools/fileSearch/formatter.cjs.map +0 -1
- package/dist/cjs/tools/fileSearch/ragClient.cjs +0 -102
- package/dist/cjs/tools/fileSearch/ragClient.cjs.map +0 -1
- package/dist/cjs/tools/fileSearch/schema.cjs +0 -18
- package/dist/cjs/tools/fileSearch/schema.cjs.map +0 -1
- package/dist/cjs/tools/fileSearch/tool.cjs +0 -155
- package/dist/cjs/tools/fileSearch/tool.cjs.map +0 -1
- package/dist/cjs/tools/proxyTool.cjs +0 -102
- package/dist/cjs/tools/proxyTool.cjs.map +0 -1
- package/dist/cjs/utils/childAgentContext.cjs +0 -242
- package/dist/cjs/utils/childAgentContext.cjs.map +0 -1
- package/dist/cjs/utils/credentials.cjs +0 -142
- package/dist/cjs/utils/credentials.cjs.map +0 -1
- package/dist/cjs/utils/httpClient.cjs +0 -74
- package/dist/cjs/utils/httpClient.cjs.map +0 -1
- package/dist/cjs/utils/toolManifest.cjs +0 -100
- package/dist/cjs/utils/toolManifest.cjs.map +0 -1
- package/dist/esm/common/spawnPath.mjs +0 -95
- package/dist/esm/common/spawnPath.mjs.map +0 -1
- package/dist/esm/content/ArtifactStore.mjs +0 -576
- package/dist/esm/content/ArtifactStore.mjs.map +0 -1
- package/dist/esm/content/ContentStore.mjs +0 -635
- package/dist/esm/content/ContentStore.mjs.map +0 -1
- package/dist/esm/content/contentAnalyzer.mjs +0 -87
- package/dist/esm/content/contentAnalyzer.mjs.map +0 -1
- package/dist/esm/content/index.mjs +0 -5
- package/dist/esm/content/mcpAutoCache.mjs +0 -111
- package/dist/esm/content/mcpAutoCache.mjs.map +0 -1
- package/dist/esm/graphs/HandoffRegistry.mjs +0 -141
- package/dist/esm/graphs/HandoffRegistry.mjs.map +0 -1
- package/dist/esm/providers/a2a/A2ACapabilityProvider.mjs +0 -281
- package/dist/esm/providers/a2a/A2ACapabilityProvider.mjs.map +0 -1
- package/dist/esm/providers/a2a/client.mjs +0 -88
- package/dist/esm/providers/a2a/client.mjs.map +0 -1
- package/dist/esm/providers/a2a/config.mjs +0 -35
- package/dist/esm/providers/a2a/config.mjs.map +0 -1
- package/dist/esm/providers/capabilityNaming.mjs +0 -39
- package/dist/esm/providers/capabilityNaming.mjs.map +0 -1
- package/dist/esm/providers/mcp/MCPCapabilityProvider.mjs +0 -240
- package/dist/esm/providers/mcp/MCPCapabilityProvider.mjs.map +0 -1
- package/dist/esm/providers/mcp/config.mjs +0 -39
- package/dist/esm/providers/mcp/config.mjs.map +0 -1
- package/dist/esm/providers/mcp/transport.mjs +0 -63
- package/dist/esm/providers/mcp/transport.mjs.map +0 -1
- package/dist/esm/providers/tools-server/ToolsServerCapabilityProvider.mjs +0 -126
- package/dist/esm/providers/tools-server/ToolsServerCapabilityProvider.mjs.map +0 -1
- package/dist/esm/providers/types.mjs +0 -51
- package/dist/esm/providers/types.mjs.map +0 -1
- package/dist/esm/tools/artifacts/schema.mjs +0 -79
- package/dist/esm/tools/artifacts/schema.mjs.map +0 -1
- package/dist/esm/tools/artifacts/tool.mjs +0 -213
- package/dist/esm/tools/artifacts/tool.mjs.map +0 -1
- package/dist/esm/tools/fileSearch/formatter.mjs +0 -90
- package/dist/esm/tools/fileSearch/formatter.mjs.map +0 -1
- package/dist/esm/tools/fileSearch/ragClient.mjs +0 -98
- package/dist/esm/tools/fileSearch/ragClient.mjs.map +0 -1
- package/dist/esm/tools/fileSearch/schema.mjs +0 -15
- package/dist/esm/tools/fileSearch/schema.mjs.map +0 -1
- package/dist/esm/tools/fileSearch/tool.mjs +0 -152
- package/dist/esm/tools/fileSearch/tool.mjs.map +0 -1
- package/dist/esm/tools/proxyTool.mjs +0 -100
- package/dist/esm/tools/proxyTool.mjs.map +0 -1
- package/dist/esm/utils/childAgentContext.mjs +0 -237
- package/dist/esm/utils/childAgentContext.mjs.map +0 -1
- package/dist/esm/utils/credentials.mjs +0 -135
- package/dist/esm/utils/credentials.mjs.map +0 -1
- package/dist/esm/utils/httpClient.mjs +0 -70
- package/dist/esm/utils/httpClient.mjs.map +0 -1
- package/dist/esm/utils/toolManifest.mjs +0 -96
- package/dist/esm/utils/toolManifest.mjs.map +0 -1
- package/dist/types/common/spawnPath.d.ts +0 -59
- package/dist/types/content/ArtifactStore.d.ts +0 -223
- package/dist/types/content/ContentStore.d.ts +0 -140
- package/dist/types/content/contentAnalyzer.d.ts +0 -38
- package/dist/types/content/index.d.ts +0 -24
- package/dist/types/content/mcpAutoCache.d.ts +0 -89
- package/dist/types/content/types.d.ts +0 -75
- package/dist/types/graphs/HandoffRegistry.d.ts +0 -97
- package/dist/types/providers/a2a/A2ACapabilityProvider.d.ts +0 -89
- package/dist/types/providers/a2a/client.d.ts +0 -47
- package/dist/types/providers/a2a/config.d.ts +0 -18
- package/dist/types/providers/a2a/index.d.ts +0 -6
- package/dist/types/providers/a2a/types.d.ts +0 -173
- package/dist/types/providers/capabilityNaming.d.ts +0 -25
- package/dist/types/providers/index.d.ts +0 -12
- package/dist/types/providers/mcp/MCPCapabilityProvider.d.ts +0 -54
- package/dist/types/providers/mcp/config.d.ts +0 -20
- package/dist/types/providers/mcp/index.d.ts +0 -5
- package/dist/types/providers/mcp/transport.d.ts +0 -18
- package/dist/types/providers/mcp/types.d.ts +0 -112
- package/dist/types/providers/tools-server/ToolsServerCapabilityProvider.d.ts +0 -59
- package/dist/types/providers/tools-server/index.d.ts +0 -1
- package/dist/types/providers/types.d.ts +0 -184
- package/dist/types/tools/artifacts/index.d.ts +0 -3
- package/dist/types/tools/artifacts/schema.d.ts +0 -63
- package/dist/types/tools/artifacts/tool.d.ts +0 -16
- package/dist/types/tools/artifacts/types.d.ts +0 -127
- package/dist/types/tools/fileSearch/formatter.d.ts +0 -25
- package/dist/types/tools/fileSearch/index.d.ts +0 -5
- package/dist/types/tools/fileSearch/ragClient.d.ts +0 -32
- package/dist/types/tools/fileSearch/schema.d.ts +0 -13
- package/dist/types/tools/fileSearch/tool.d.ts +0 -18
- package/dist/types/tools/fileSearch/types.d.ts +0 -139
- package/dist/types/tools/proxyTool.d.ts +0 -62
- package/dist/types/utils/childAgentContext.d.ts +0 -99
- package/dist/types/utils/credentials.d.ts +0 -77
- package/dist/types/utils/httpClient.d.ts +0 -46
- package/dist/types/utils/toolManifest.d.ts +0 -49
- package/src/common/__tests__/spawnPath.test.ts +0 -110
- package/src/common/spawnPath.ts +0 -101
- package/src/content/ArtifactStore.ts +0 -782
- package/src/content/ContentStore.ts +0 -753
- package/src/content/contentAnalyzer.ts +0 -105
- package/src/content/index.ts +0 -51
- package/src/content/mcpAutoCache.ts +0 -185
- package/src/content/types.ts +0 -82
- package/src/graphs/HandoffRegistry.ts +0 -199
- package/src/graphs/__tests__/HandoffRegistry.test.ts +0 -410
- package/src/graphs/__tests__/multi-agent-delegate.test.ts +0 -458
- package/src/graphs/__tests__/multi-agent-edges.test.ts +0 -276
- package/src/graphs/__tests__/multi-agent-nested-subgraph.test.ts +0 -221
- package/src/graphs/handoffValidation.test.ts +0 -353
- package/src/providers/__tests__/ToolsServerCapabilityProvider.integration.spec.ts +0 -79
- package/src/providers/__tests__/ToolsServerCapabilityProvider.test.ts +0 -271
- package/src/providers/__tests__/types.test.ts +0 -64
- package/src/providers/a2a/A2ACapabilityProvider.ts +0 -384
- package/src/providers/a2a/__tests__/A2ACapabilityProvider.integration.spec.ts +0 -345
- package/src/providers/a2a/__tests__/A2ACapabilityProvider.test.ts +0 -460
- package/src/providers/a2a/client.ts +0 -115
- package/src/providers/a2a/config.ts +0 -40
- package/src/providers/a2a/index.ts +0 -29
- package/src/providers/a2a/types.ts +0 -191
- package/src/providers/capabilityNaming.ts +0 -42
- package/src/providers/index.ts +0 -68
- package/src/providers/mcp/MCPCapabilityProvider.ts +0 -345
- package/src/providers/mcp/__tests__/MCPCapabilityProvider.integration.spec.ts +0 -386
- package/src/providers/mcp/__tests__/MCPCapabilityProvider.test.ts +0 -371
- package/src/providers/mcp/config.ts +0 -45
- package/src/providers/mcp/index.ts +0 -21
- package/src/providers/mcp/transport.ts +0 -76
- package/src/providers/mcp/types.ts +0 -139
- package/src/providers/tools-server/ToolsServerCapabilityProvider.ts +0 -249
- package/src/providers/tools-server/index.ts +0 -1
- package/src/providers/types.ts +0 -204
- package/src/scripts/test-bedrock-handoff-autonomous.ts +0 -267
- package/src/scripts/test-handoff-preamble.ts +0 -278
- package/src/specs/agent-handoffs-bedrock.integration.test.ts +0 -415
- package/src/tools/artifacts/__tests__/tool.test.ts +0 -259
- package/src/tools/artifacts/index.ts +0 -33
- package/src/tools/artifacts/schema.ts +0 -99
- package/src/tools/artifacts/tool.ts +0 -289
- package/src/tools/artifacts/types.ts +0 -162
- package/src/tools/fileSearch/__tests__/tool.test.ts +0 -261
- package/src/tools/fileSearch/formatter.ts +0 -129
- package/src/tools/fileSearch/index.ts +0 -23
- package/src/tools/fileSearch/ragClient.ts +0 -137
- package/src/tools/fileSearch/schema.ts +0 -19
- package/src/tools/fileSearch/tool.ts +0 -207
- package/src/tools/fileSearch/types.ts +0 -149
- package/src/tools/proxyTool.ts +0 -166
- package/src/utils/__tests__/childAgentContext.test.ts +0 -217
- package/src/utils/__tests__/credentials.test.ts +0 -130
- package/src/utils/__tests__/httpClient.test.ts +0 -75
- package/src/utils/__tests__/toolManifest.test.ts +0 -116
- package/src/utils/childAgentContext.ts +0 -259
- package/src/utils/credentials.ts +0 -157
- package/src/utils/httpClient.ts +0 -92
- package/src/utils/toolManifest.ts +0 -109
- /package/dist/esm/{content → langchain}/index.mjs.map +0 -0
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var tools = require('@langchain/core/tools');
|
|
4
|
-
var schema = require('./schema.cjs');
|
|
5
|
-
var formatter = require('./formatter.cjs');
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* file_search tool factory — library-native equivalent of the CodeExecutor
|
|
9
|
-
* pattern. Runtimes supply a `RagClient`, the file list for this turn, and
|
|
10
|
-
* an optional formatter (ranger uses citation anchors; CLI/A2A use plain
|
|
11
|
-
* text).
|
|
12
|
-
*
|
|
13
|
-
* The tool itself:
|
|
14
|
-
* 1. Accepts `{ query, target_files? }` from the LLM.
|
|
15
|
-
* 2. Filters files by `target_files` substring match when provided.
|
|
16
|
-
* 3. Queries each file in bounded concurrent batches.
|
|
17
|
-
* 4. Enforces per-file timeouts (failures isolated per file).
|
|
18
|
-
* 5. Flattens chunks, deprioritizes stale-turn files, caps results.
|
|
19
|
-
* 6. Hands formatted output to the runtime's formatter for final shape.
|
|
20
|
-
*/
|
|
21
|
-
const DEFAULT_QUERY_TIMEOUT_MS = 15_000;
|
|
22
|
-
const DEFAULT_CONCURRENCY = 10;
|
|
23
|
-
const DEFAULT_TOP_K = 10;
|
|
24
|
-
/**
|
|
25
|
-
* Build the tool description. Runtimes that use citation anchors supply
|
|
26
|
-
* `fileCitations: true` (via the formatter); the description includes the
|
|
27
|
-
* citation ruleset only when that's on.
|
|
28
|
-
*/
|
|
29
|
-
function buildDescription(opts) {
|
|
30
|
-
const core = `Performs semantic search across the attached "${schema.FileSearchToolName}" documents using natural language queries. Analyzes the content of loaded files to find relevant information, quotes, and passages matching the query.
|
|
31
|
-
|
|
32
|
-
**Use target_files to narrow the search:**
|
|
33
|
-
When you know which file(s) contain the relevant information, ALWAYS pass target_files. This is faster and returns more focused results. Pass partial filenames — they match via substring.
|
|
34
|
-
|
|
35
|
-
**Multiple searches for thorough analysis:**
|
|
36
|
-
For summaries/overviews, call this tool MULTIPLE times with DIFFERENT queries targeting different aspects (intro, methodology, results, conclusions). A single search only returns chunks from one part of the document.`;
|
|
37
|
-
if (!opts.fileCitations)
|
|
38
|
-
return core;
|
|
39
|
-
return `${core}
|
|
40
|
-
|
|
41
|
-
**CITING FILE SEARCH RESULTS — MANDATORY:**
|
|
42
|
-
Cite EVERY statement derived from file content. Place the citation anchor IMMEDIATELY after each paragraph using that source. Each search result has a unique source index — use DIFFERENT indices for different claims; do not reuse the same anchor for all paragraphs. Format: \`\\ue202turn0fileN\`. With a page: include \`(p. N)\` inline. Multiple sources: \`\\ue200\\ue202turn0file0\\ue202turn0file1\\ue201\`. NEVER substitute with footnotes, brackets, or symbols.`;
|
|
43
|
-
}
|
|
44
|
-
function createFileSearchTool(config) {
|
|
45
|
-
const { ragClient, files, entity_id, scope, getAuthHeaders, formatter: formatter$1 = formatter.plainTextFormatter, queryTimeoutMs = DEFAULT_QUERY_TIMEOUT_MS, concurrencyLimit = DEFAULT_CONCURRENCY, topK = DEFAULT_TOP_K, resultCap, callbacks, logger, } = config;
|
|
46
|
-
// Monotonic call counter used by citation-style formatters to keep source
|
|
47
|
-
// indices unique across multiple invocations within a single turn.
|
|
48
|
-
let callIndex = 0;
|
|
49
|
-
// Infer whether the formatter wants citations from the artifact it emits
|
|
50
|
-
// on an empty-chunk format. This keeps the description/behavior aligned
|
|
51
|
-
// without forcing the host to declare `fileCitations` twice.
|
|
52
|
-
const fileCitations = formatter$1 !== formatter.plainTextFormatter;
|
|
53
|
-
return tools.tool(async (rawInput) => {
|
|
54
|
-
const { query, target_files } = rawInput;
|
|
55
|
-
if (files.length === 0) {
|
|
56
|
-
return [
|
|
57
|
-
'No files to search. Instruct the user to add files for the search.',
|
|
58
|
-
undefined,
|
|
59
|
-
];
|
|
60
|
-
}
|
|
61
|
-
// target_files: case-insensitive substring match, fallback to all
|
|
62
|
-
// files with a warning if the filter excludes everything.
|
|
63
|
-
let filesToQuery = files;
|
|
64
|
-
if (target_files && target_files.length > 0) {
|
|
65
|
-
const lowerTargets = target_files.map((t) => t.toLowerCase());
|
|
66
|
-
const matched = files.filter((f) => lowerTargets.some((t) => f.filename.toLowerCase().includes(t)));
|
|
67
|
-
if (matched.length === 0) {
|
|
68
|
-
logger?.warn(`[file_search] No files matched target_files ${target_files.join(', ')}; falling back to all files`);
|
|
69
|
-
filesToQuery = files;
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
logger?.info(`[file_search] Filtered to ${matched.length}/${files.length} via target_files`);
|
|
73
|
-
filesToQuery = matched;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
const authHeaders = getAuthHeaders ? await getAuthHeaders() : undefined;
|
|
77
|
-
const queryOne = async (file) => {
|
|
78
|
-
const params = {
|
|
79
|
-
file_id: file.file_id,
|
|
80
|
-
query,
|
|
81
|
-
k: topK,
|
|
82
|
-
entity_id,
|
|
83
|
-
scope,
|
|
84
|
-
authHeaders,
|
|
85
|
-
timeoutMs: queryTimeoutMs,
|
|
86
|
-
};
|
|
87
|
-
try {
|
|
88
|
-
const chunks = await ragClient.query(params);
|
|
89
|
-
callbacks?.onFileQueried?.(file, chunks.length);
|
|
90
|
-
return chunks;
|
|
91
|
-
}
|
|
92
|
-
catch (err) {
|
|
93
|
-
const e = err instanceof Error ? err : new Error(String(err));
|
|
94
|
-
logger?.error(`[file_search] Query failed for ${file.filename}: ${e.message}`);
|
|
95
|
-
callbacks?.onFileError?.(file, e);
|
|
96
|
-
return [];
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
// Bounded-concurrency batching. Server-side rerankers handle their
|
|
100
|
-
// own concurrency; this protects the HTTP connection pool when the
|
|
101
|
-
// agent has many files.
|
|
102
|
-
const allChunks = [];
|
|
103
|
-
for (let i = 0; i < filesToQuery.length; i += concurrencyLimit) {
|
|
104
|
-
const batch = filesToQuery.slice(i, i + concurrencyLimit);
|
|
105
|
-
const batchResults = await Promise.all(batch.map(queryOne));
|
|
106
|
-
for (const chunks of batchResults)
|
|
107
|
-
allChunks.push(...chunks);
|
|
108
|
-
}
|
|
109
|
-
if (allChunks.length === 0) {
|
|
110
|
-
return [
|
|
111
|
-
'No content found in the files. The files may not have been processed correctly or the query may need refinement.',
|
|
112
|
-
undefined,
|
|
113
|
-
];
|
|
114
|
-
}
|
|
115
|
-
// Build annotated results: attach filename + isCurrentMessage via
|
|
116
|
-
// a file-id lookup (metadata wins, factory list is fallback).
|
|
117
|
-
const fileById = new Map(files.map((f) => [f.file_id, f]));
|
|
118
|
-
const annotated = allChunks.map((c) => {
|
|
119
|
-
const matched = fileById.get(c.file_id);
|
|
120
|
-
const filename = (c.metadata?.source
|
|
121
|
-
? String(c.metadata.source).split(/[/\\]/).pop()
|
|
122
|
-
: undefined) ??
|
|
123
|
-
matched?.filename ??
|
|
124
|
-
'Unknown';
|
|
125
|
-
return {
|
|
126
|
-
...c,
|
|
127
|
-
filename,
|
|
128
|
-
isCurrentMessage: matched?.isCurrentMessage === true,
|
|
129
|
-
};
|
|
130
|
-
});
|
|
131
|
-
// Sort: current-turn files first, then by relevance (lower distance).
|
|
132
|
-
annotated.sort((a, b) => {
|
|
133
|
-
if (a.isCurrentMessage !== b.isCurrentMessage)
|
|
134
|
-
return a.isCurrentMessage ? -1 : 1;
|
|
135
|
-
return a.distance - b.distance;
|
|
136
|
-
});
|
|
137
|
-
const cap = resultCap ?? Math.max(10, filesToQuery.length * 3);
|
|
138
|
-
const limited = annotated.slice(0, cap);
|
|
139
|
-
const { message, artifact } = formatter$1.format(limited, {
|
|
140
|
-
callIndex,
|
|
141
|
-
files,
|
|
142
|
-
});
|
|
143
|
-
callIndex += 1;
|
|
144
|
-
return [message, artifact];
|
|
145
|
-
}, {
|
|
146
|
-
name: schema.FileSearchToolName,
|
|
147
|
-
responseFormat: 'content_and_artifact',
|
|
148
|
-
description: buildDescription({ fileCitations }),
|
|
149
|
-
schema: schema.fileSearchInputSchema,
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
exports.FileSearchToolName = schema.FileSearchToolName;
|
|
154
|
-
exports.createFileSearchTool = createFileSearchTool;
|
|
155
|
-
//# sourceMappingURL=tool.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tool.cjs","sources":["../../../../src/tools/fileSearch/tool.ts"],"sourcesContent":["/**\n * file_search tool factory — library-native equivalent of the CodeExecutor\n * pattern. Runtimes supply a `RagClient`, the file list for this turn, and\n * an optional formatter (ranger uses citation anchors; CLI/A2A use plain\n * text).\n *\n * The tool itself:\n * 1. Accepts `{ query, target_files? }` from the LLM.\n * 2. Filters files by `target_files` substring match when provided.\n * 3. Queries each file in bounded concurrent batches.\n * 4. Enforces per-file timeouts (failures isolated per file).\n * 5. Flattens chunks, deprioritizes stale-turn files, caps results.\n * 6. Hands formatted output to the runtime's formatter for final shape.\n */\n\nimport { tool, DynamicStructuredTool } from '@langchain/core/tools';\nimport {\n fileSearchInputSchema,\n type FileSearchInput,\n FileSearchToolName,\n} from './schema';\nimport type {\n FileSearchToolConfig,\n FileSearchFile,\n RagChunk,\n RagQueryParams,\n} from './types';\nimport { plainTextFormatter } from './formatter';\n\nconst DEFAULT_QUERY_TIMEOUT_MS = 15_000;\nconst DEFAULT_CONCURRENCY = 10;\nconst DEFAULT_TOP_K = 10;\n\n/**\n * Build the tool description. Runtimes that use citation anchors supply\n * `fileCitations: true` (via the formatter); the description includes the\n * citation ruleset only when that's on.\n */\nfunction buildDescription(opts: { fileCitations: boolean }): string {\n const core = `Performs semantic search across the attached \"${FileSearchToolName}\" documents using natural language queries. Analyzes the content of loaded files to find relevant information, quotes, and passages matching the query.\n\n**Use target_files to narrow the search:**\nWhen you know which file(s) contain the relevant information, ALWAYS pass target_files. This is faster and returns more focused results. Pass partial filenames — they match via substring.\n\n**Multiple searches for thorough analysis:**\nFor summaries/overviews, call this tool MULTIPLE times with DIFFERENT queries targeting different aspects (intro, methodology, results, conclusions). A single search only returns chunks from one part of the document.`;\n\n if (!opts.fileCitations) return core;\n\n return `${core}\n\n**CITING FILE SEARCH RESULTS — MANDATORY:**\nCite EVERY statement derived from file content. Place the citation anchor IMMEDIATELY after each paragraph using that source. Each search result has a unique source index — use DIFFERENT indices for different claims; do not reuse the same anchor for all paragraphs. Format: \\`\\\\ue202turn0fileN\\`. With a page: include \\`(p. N)\\` inline. Multiple sources: \\`\\\\ue200\\\\ue202turn0file0\\\\ue202turn0file1\\\\ue201\\`. NEVER substitute with footnotes, brackets, or symbols.`;\n}\n\nexport function createFileSearchTool(\n config: FileSearchToolConfig\n): DynamicStructuredTool {\n const {\n ragClient,\n files,\n entity_id,\n scope,\n getAuthHeaders,\n formatter = plainTextFormatter,\n queryTimeoutMs = DEFAULT_QUERY_TIMEOUT_MS,\n concurrencyLimit = DEFAULT_CONCURRENCY,\n topK = DEFAULT_TOP_K,\n resultCap,\n callbacks,\n logger,\n } = config;\n\n // Monotonic call counter used by citation-style formatters to keep source\n // indices unique across multiple invocations within a single turn.\n let callIndex = 0;\n\n // Infer whether the formatter wants citations from the artifact it emits\n // on an empty-chunk format. This keeps the description/behavior aligned\n // without forcing the host to declare `fileCitations` twice.\n const fileCitations = formatter !== plainTextFormatter;\n\n return tool(\n async (rawInput: FileSearchInput) => {\n const { query, target_files } = rawInput;\n\n if (files.length === 0) {\n return [\n 'No files to search. Instruct the user to add files for the search.',\n undefined,\n ];\n }\n\n // target_files: case-insensitive substring match, fallback to all\n // files with a warning if the filter excludes everything.\n let filesToQuery: FileSearchFile[] = files;\n if (target_files && target_files.length > 0) {\n const lowerTargets = target_files.map((t) => t.toLowerCase());\n const matched = files.filter((f) =>\n lowerTargets.some((t) => f.filename.toLowerCase().includes(t))\n );\n if (matched.length === 0) {\n logger?.warn(\n `[file_search] No files matched target_files ${target_files.join(', ')}; falling back to all files`\n );\n filesToQuery = files;\n } else {\n logger?.info(\n `[file_search] Filtered to ${matched.length}/${files.length} via target_files`\n );\n filesToQuery = matched;\n }\n }\n\n const authHeaders = getAuthHeaders ? await getAuthHeaders() : undefined;\n\n const queryOne = async (file: FileSearchFile): Promise<RagChunk[]> => {\n const params: RagQueryParams = {\n file_id: file.file_id,\n query,\n k: topK,\n entity_id,\n scope,\n authHeaders,\n timeoutMs: queryTimeoutMs,\n };\n try {\n const chunks = await ragClient.query(params);\n callbacks?.onFileQueried?.(file, chunks.length);\n return chunks;\n } catch (err) {\n const e = err instanceof Error ? err : new Error(String(err));\n logger?.error(\n `[file_search] Query failed for ${file.filename}: ${e.message}`\n );\n callbacks?.onFileError?.(file, e);\n return [];\n }\n };\n\n // Bounded-concurrency batching. Server-side rerankers handle their\n // own concurrency; this protects the HTTP connection pool when the\n // agent has many files.\n const allChunks: RagChunk[] = [];\n for (let i = 0; i < filesToQuery.length; i += concurrencyLimit) {\n const batch = filesToQuery.slice(i, i + concurrencyLimit);\n const batchResults = await Promise.all(batch.map(queryOne));\n for (const chunks of batchResults) allChunks.push(...chunks);\n }\n\n if (allChunks.length === 0) {\n return [\n 'No content found in the files. The files may not have been processed correctly or the query may need refinement.',\n undefined,\n ];\n }\n\n // Build annotated results: attach filename + isCurrentMessage via\n // a file-id lookup (metadata wins, factory list is fallback).\n const fileById = new Map(files.map((f) => [f.file_id, f]));\n const annotated = allChunks.map((c) => {\n const matched = fileById.get(c.file_id);\n const filename =\n (c.metadata?.source\n ? String(c.metadata.source).split(/[/\\\\]/).pop()\n : undefined) ??\n matched?.filename ??\n 'Unknown';\n return {\n ...c,\n filename,\n isCurrentMessage: matched?.isCurrentMessage === true,\n };\n });\n\n // Sort: current-turn files first, then by relevance (lower distance).\n annotated.sort((a, b) => {\n if (a.isCurrentMessage !== b.isCurrentMessage)\n return a.isCurrentMessage ? -1 : 1;\n return a.distance - b.distance;\n });\n\n const cap = resultCap ?? Math.max(10, filesToQuery.length * 3);\n const limited = annotated.slice(0, cap);\n\n const { message, artifact } = formatter.format(limited, {\n callIndex,\n files,\n });\n callIndex += 1;\n\n // Suppress unused-variable warning for fileCitations (currently only\n // used to gate description; kept in case formatters need it).\n void fileCitations;\n\n return [message, artifact];\n },\n {\n name: FileSearchToolName,\n responseFormat: 'content_and_artifact',\n description: buildDescription({ fileCitations }),\n schema: fileSearchInputSchema,\n }\n );\n}\n\nexport { FileSearchToolName } from './schema';\n"],"names":["FileSearchToolName","formatter","plainTextFormatter","tool","fileSearchInputSchema"],"mappings":";;;;;;AAAA;;;;;;;;;;;;;AAaG;AAgBH,MAAM,wBAAwB,GAAG,MAAM;AACvC,MAAM,mBAAmB,GAAG,EAAE;AAC9B,MAAM,aAAa,GAAG,EAAE;AAExB;;;;AAIG;AACH,SAAS,gBAAgB,CAAC,IAAgC,EAAA;IACxD,MAAM,IAAI,GAAG,CAAA,8CAAA,EAAiDA,yBAAkB,CAAA;;;;;;yNAMuI;IAEvN,IAAI,CAAC,IAAI,CAAC,aAAa;AAAE,QAAA,OAAO,IAAI;AAEpC,IAAA,OAAO,GAAG,IAAI;;;gdAGgc;AAChd;AAEM,SAAU,oBAAoB,CAClC,MAA4B,EAAA;AAE5B,IAAA,MAAM,EACJ,SAAS,EACT,KAAK,EACL,SAAS,EACT,KAAK,EACL,cAAc,aACdC,WAAS,GAAGC,4BAAkB,EAC9B,cAAc,GAAG,wBAAwB,EACzC,gBAAgB,GAAG,mBAAmB,EACtC,IAAI,GAAG,aAAa,EACpB,SAAS,EACT,SAAS,EACT,MAAM,GACP,GAAG,MAAM;;;IAIV,IAAI,SAAS,GAAG,CAAC;;;;AAKjB,IAAA,MAA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I,CAAC;AAMd,QAAA,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC;AAC5B,IAAA,CAAC,EACD;AACE,QAAA,IAAI,EAAED,yBAAkB;AACxB,QAAA,cAAc,EAAE,sBAAsB;AACtC,QAAA,WAAW,EAAE,gBAAgB,CAAC,EAAE,aAAa,EAAE,CAAC;AAChD,QAAA,MAAM,EAAEI,4BAAqB;AAC9B,KAAA,CACF;AACH;;;;;"}
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var tools = require('@langchain/core/tools');
|
|
4
|
-
var httpClient = require('../utils/httpClient.cjs');
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* proxyTool — wraps a Capability into a LangChain StructuredTool that
|
|
8
|
-
* dispatches execution to a remote backend (e.g., tools-server) over HTTP.
|
|
9
|
-
*
|
|
10
|
-
* The LLM sees this tool identically to a locally-implemented tool:
|
|
11
|
-
* - same name
|
|
12
|
-
* - same description
|
|
13
|
-
* - same input schema (JSON Schema)
|
|
14
|
-
* - same invoke(input) contract
|
|
15
|
-
*
|
|
16
|
-
* Under the hood, invoke() POSTs to the backend's execute endpoint with
|
|
17
|
-
* the input and a caller-supplied credential map. The backend returns
|
|
18
|
-
* { success, result, error, timing } which this wrapper unpacks.
|
|
19
|
-
*/
|
|
20
|
-
/**
|
|
21
|
-
* Build a StructuredTool that proxies to a remote backend.
|
|
22
|
-
*
|
|
23
|
-
* The credentialMap is baked into the closure — callers that need
|
|
24
|
-
* per-invocation credential rotation should rebuild the tool.
|
|
25
|
-
*/
|
|
26
|
-
function buildProxyTool(capability, credentials, options) {
|
|
27
|
-
const { client, executePath = '/execute/:name', onExecute, getAuthHeaders, } = options;
|
|
28
|
-
const url = executePath.replace(':name', encodeURIComponent(capability.name));
|
|
29
|
-
return tools.tool(async (input) => {
|
|
30
|
-
const startMs = Date.now();
|
|
31
|
-
const debugPrefix = `[proxyTool:${capability.name}]`;
|
|
32
|
-
try {
|
|
33
|
-
// DEBUG: log (remove after POC stabilizes)
|
|
34
|
-
// eslint-disable-next-line no-console
|
|
35
|
-
console.debug(`${debugPrefix} invoking — inputKeys=${input && typeof input === 'object' ? Object.keys(input).length : 0}`);
|
|
36
|
-
const extraHeaders = getAuthHeaders
|
|
37
|
-
? await getAuthHeaders()
|
|
38
|
-
: undefined;
|
|
39
|
-
const res = await client.post(url, { input, credentials }, extraHeaders && Object.keys(extraHeaders).length > 0
|
|
40
|
-
? { headers: extraHeaders }
|
|
41
|
-
: undefined);
|
|
42
|
-
const durationMs = Date.now() - startMs;
|
|
43
|
-
if (res.status < 200 || res.status >= 300) {
|
|
44
|
-
throw new httpClient.HttpError(res.status, url, res.data);
|
|
45
|
-
}
|
|
46
|
-
const body = res.data;
|
|
47
|
-
if (onExecute) {
|
|
48
|
-
try {
|
|
49
|
-
onExecute({
|
|
50
|
-
capabilityName: capability.name,
|
|
51
|
-
input,
|
|
52
|
-
response: body,
|
|
53
|
-
durationMs,
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
catch {
|
|
57
|
-
// hook errors are non-fatal
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
if (!body.success) {
|
|
61
|
-
// DEBUG
|
|
62
|
-
// eslint-disable-next-line no-console
|
|
63
|
-
console.debug(`${debugPrefix} backend reported failure — ${body.error}`);
|
|
64
|
-
throw new Error(body.error ?? 'Tool execution failed');
|
|
65
|
-
}
|
|
66
|
-
// LangChain tools typically return strings; stringify non-string results
|
|
67
|
-
if (typeof body.result === 'string') {
|
|
68
|
-
return body.result;
|
|
69
|
-
}
|
|
70
|
-
return JSON.stringify(body.result);
|
|
71
|
-
}
|
|
72
|
-
catch (err) {
|
|
73
|
-
const durationMs = Date.now() - startMs;
|
|
74
|
-
const error = err instanceof Error ? err : new Error(String(err));
|
|
75
|
-
if (onExecute) {
|
|
76
|
-
try {
|
|
77
|
-
onExecute({
|
|
78
|
-
capabilityName: capability.name,
|
|
79
|
-
input,
|
|
80
|
-
error,
|
|
81
|
-
durationMs,
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
catch {
|
|
85
|
-
// hook errors are non-fatal
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
throw error;
|
|
89
|
-
}
|
|
90
|
-
}, {
|
|
91
|
-
name: capability.name,
|
|
92
|
-
description: capability.description,
|
|
93
|
-
schema: capability.schema ?? {
|
|
94
|
-
type: 'object',
|
|
95
|
-
properties: {},
|
|
96
|
-
},
|
|
97
|
-
responseFormat: 'content',
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
exports.buildProxyTool = buildProxyTool;
|
|
102
|
-
//# sourceMappingURL=proxyTool.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"proxyTool.cjs","sources":["../../../src/tools/proxyTool.ts"],"sourcesContent":["/**\n * proxyTool — wraps a Capability into a LangChain StructuredTool that\n * dispatches execution to a remote backend (e.g., tools-server) over HTTP.\n *\n * The LLM sees this tool identically to a locally-implemented tool:\n * - same name\n * - same description\n * - same input schema (JSON Schema)\n * - same invoke(input) contract\n *\n * Under the hood, invoke() POSTs to the backend's execute endpoint with\n * the input and a caller-supplied credential map. The backend returns\n * { success, result, error, timing } which this wrapper unpacks.\n */\n\nimport type { AxiosInstance } from 'axios';\nimport { tool, type StructuredToolInterface } from '@langchain/core/tools';\nimport type { Capability, CredentialMap } from '@/providers/types';\nimport { HttpError } from '@/utils/httpClient';\n\n/** Shape of the backend's execute response. Matches tools-server. */\nexport interface ExecuteResponse {\n success: boolean;\n result?: unknown;\n error?: string;\n timing?: { durationMs: number };\n}\n\n/** Options passed to buildProxyTool. */\nexport interface ProxyToolOptions {\n /** HTTP client configured with backend base URL + auth. */\n client: AxiosInstance;\n /**\n * Path template for execution. The literal `:name` is replaced with the\n * capability's name. Defaults to `/execute/:name` (tools-server convention).\n */\n executePath?: string;\n /**\n * Optional callback invoked on every execution — used for metrics,\n * telemetry, debug logging. Errors in the hook are swallowed.\n */\n onExecute?: (ctx: ExecuteCallbackContext) => void;\n /**\n * Optional per-invocation auth header builder. Called on every tool\n * invocation before POSTing; returned headers are merged into the\n * request alongside the base client's headers. Typical use: pass a\n * freshly minted per-user JWT for admin-gated tools.\n */\n getAuthHeaders?: () =>\n | Record<string, string>\n | Promise<Record<string, string>>;\n}\n\nexport interface ExecuteCallbackContext {\n capabilityName: string;\n input: unknown;\n response?: ExecuteResponse;\n error?: Error;\n durationMs: number;\n}\n\n/**\n * Build a StructuredTool that proxies to a remote backend.\n *\n * The credentialMap is baked into the closure — callers that need\n * per-invocation credential rotation should rebuild the tool.\n */\nexport function buildProxyTool(\n capability: Capability,\n credentials: CredentialMap,\n options: ProxyToolOptions\n): StructuredToolInterface {\n const {\n client,\n executePath = '/execute/:name',\n onExecute,\n getAuthHeaders,\n } = options;\n const url = executePath.replace(':name', encodeURIComponent(capability.name));\n\n return tool(\n async (input: unknown): Promise<string> => {\n const startMs = Date.now();\n const debugPrefix = `[proxyTool:${capability.name}]`;\n\n try {\n // DEBUG: log (remove after POC stabilizes)\n // eslint-disable-next-line no-console\n console.debug(\n `${debugPrefix} invoking — inputKeys=${input && typeof input === 'object' ? Object.keys(input as object).length : 0}`\n );\n\n const extraHeaders = getAuthHeaders\n ? await getAuthHeaders()\n : undefined;\n const res = await client.post<ExecuteResponse>(\n url,\n { input, credentials },\n extraHeaders && Object.keys(extraHeaders).length > 0\n ? { headers: extraHeaders }\n : undefined\n );\n\n const durationMs = Date.now() - startMs;\n\n if (res.status < 200 || res.status >= 300) {\n throw new HttpError(res.status, url, res.data);\n }\n\n const body = res.data;\n if (onExecute) {\n try {\n onExecute({\n capabilityName: capability.name,\n input,\n response: body,\n durationMs,\n });\n } catch {\n // hook errors are non-fatal\n }\n }\n\n if (!body.success) {\n // DEBUG\n // eslint-disable-next-line no-console\n console.debug(\n `${debugPrefix} backend reported failure — ${body.error}`\n );\n throw new Error(body.error ?? 'Tool execution failed');\n }\n\n // LangChain tools typically return strings; stringify non-string results\n if (typeof body.result === 'string') {\n return body.result;\n }\n return JSON.stringify(body.result);\n } catch (err) {\n const durationMs = Date.now() - startMs;\n const error = err instanceof Error ? err : new Error(String(err));\n if (onExecute) {\n try {\n onExecute({\n capabilityName: capability.name,\n input,\n error,\n durationMs,\n });\n } catch {\n // hook errors are non-fatal\n }\n }\n throw error;\n }\n },\n {\n name: capability.name,\n description: capability.description,\n schema: (capability.schema as object) ?? {\n type: 'object',\n properties: {},\n },\n responseFormat: 'content',\n }\n );\n}\n"],"names":["tool","HttpError"],"mappings":";;;;;AAAA;;;;;;;;;;;;;AAaG;AAgDH;;;;;AAKG;SACa,cAAc,CAC5B,UAAsB,EACtB,WAA0B,EAC1B,OAAyB,EAAA;AAEzB,IAAA,MAAM,EACJ,MAAM,EACN,WAAW,GAAG,gBAAgB,EAC9B,SAAS,EACT,cAAc,GACf,GAAG,OAAO;AACX,IAAA,MAAM,GAAG,GAAG,WAAW,CAAC,OAAO,CAAC,OAAO,EAAE,kBAAkB,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;AAE7E,IAAA,OAAOA,UAAI,CACT,OAAO,KAAc,KAAqB;AACxC,QAAA,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE;AAC1B,QAAA,MAAM,WAAW,GAAG,CAAA,WAAA,EAAc,UAAU,CAAC,IAAI,GAAG;AAEpD,QAAA,IAAI;;;AAGF,YAAA,OAAO,CAAC,KAAK,CACX,CAAA,EAAG,WAAW,CAAA,sBAAA,EAAyB,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,KAAe,CAAC,CAAC,MAAM,GAAG,CAAC,CAAA,CAAE,CACtH;YAED,MAAM,YAAY,GAAG;kBACjB,MAAM,cAAc;kBACpB,SAAS;YACb,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,IAAI,CAC3B,GAAG,EACH,EAAE,KAAK,EAAE,WAAW,EAAE,EACtB,Y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ACjE,IAAI,SAAS,EAAE;AACb,gBAAA,IAAI;AACF,oBAAA,SAAS,CAAC;wBACR,cAAc,EAAE,UAAU,CAAC,IAAI;wBAC/B,KAAK;wBACL,KAAK;wBACL,UAAU;AACX,qBAAA,CAAC;gBACJ;AAAE,gBAAA,MAAM;;gBAER;YACF;AACA,YAAA,MAAM,KAAK;QACb;AACF,IAAA,CAAC,EACD;QACE,IAAI,EAAE,UAAU,CAAC,IAAI;QACrB,WAAW,EAAE,UAAU,CAAC,WAAW;AACnC,QAAA,MAAM,EAAG,UAAU,CAAC,MAAiB,IAAI;AACvC,YAAA,IAAI,EAAE,QAAQ;AACd,YAAA,UAAU,EAAE,EAAE;AACf,SAAA;AACD,QAAA,cAAc,EAAE,SAAS;AAC1B,KAAA,CACF;AACH;;;;"}
|
|
@@ -1,242 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var messages = require('@langchain/core/messages');
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Child-agent context preparation utilities.
|
|
7
|
-
*
|
|
8
|
-
* When a parent agent invokes a child agent — via handoff, sequence edge,
|
|
9
|
-
* or scoped subgraph — the child cannot just receive `state.messages`
|
|
10
|
-
* verbatim. The parent's conversation contains tool_use/tool_result blocks
|
|
11
|
-
* that are (a) often incompatible with the child's tool registry, and
|
|
12
|
-
* (b) actively harmful to the child's ability to reason cleanly about its
|
|
13
|
-
* own task (noise → schema confusion → malformed tool_use).
|
|
14
|
-
*
|
|
15
|
-
* This module provides the two canonical strategies, extracted from
|
|
16
|
-
* `MultiAgentGraph` so they can be unit-tested in isolation and reused by
|
|
17
|
-
* future sub-agent orchestrators:
|
|
18
|
-
*
|
|
19
|
-
* 1. `prepareHandoffMessages` — "cleaned parent history"
|
|
20
|
-
* Used when the child still needs the orchestrator's context (it's
|
|
21
|
-
* the handoff target). Drops orphaned tool_use, compacts paired
|
|
22
|
-
* tool_use/tool_result into text summaries, and guarantees the tail
|
|
23
|
-
* is a HumanMessage so Bedrock/VertexAI won't reject the conversation
|
|
24
|
-
* with "assistant message prefill" errors.
|
|
25
|
-
*
|
|
26
|
-
* 2. `prepareIsolatedChildMessages` — "fresh session"
|
|
27
|
-
* Used for downstream sequence-node children inside a scoped subgraph.
|
|
28
|
-
* The child sees only the original user request plus a synthetic
|
|
29
|
-
* HumanMessage summarizing the upstream agent's final text output and
|
|
30
|
-
* directing the child to act. Raw upstream tool_use/tool_result blocks
|
|
31
|
-
* are discarded.
|
|
32
|
-
*
|
|
33
|
-
* Both helpers are pure functions over message arrays — no I/O, no
|
|
34
|
-
* LangGraph coupling — so they can be exercised by unit tests with
|
|
35
|
-
* synthetic message fixtures.
|
|
36
|
-
*/
|
|
37
|
-
/* -------------------------------------------------------------------------- */
|
|
38
|
-
/* Prompt template constants (kept outside the functions for reuse/tuning) */
|
|
39
|
-
/* -------------------------------------------------------------------------- */
|
|
40
|
-
/**
|
|
41
|
-
* Prefix injected in front of a trailing AIMessage when we flip it to a
|
|
42
|
-
* HumanMessage to satisfy provider "last message must be user" rules.
|
|
43
|
-
*/
|
|
44
|
-
const HANDOFF_TAIL_CONTEXT_PREFIX = '[Context from orchestrator]: ';
|
|
45
|
-
/**
|
|
46
|
-
* Directive task-framing wrapper for downstream scoped-subgraph children.
|
|
47
|
-
*
|
|
48
|
-
* Design notes — each line is load-bearing:
|
|
49
|
-
* - "Prior step output" names the upstream role without leaking the
|
|
50
|
-
* agent's internal id.
|
|
51
|
-
* - "You MUST now perform..." replaces ambiguity with obligation.
|
|
52
|
-
* - "system instructions" references the agent's stored system prompt
|
|
53
|
-
* as the source of task definition — so operators can tune behavior
|
|
54
|
-
* via data, not code.
|
|
55
|
-
* - The tool-first clause prevents small/fast models from stalling on a
|
|
56
|
-
* text-only acknowledgement when a tool action is expected.
|
|
57
|
-
*/
|
|
58
|
-
function buildIsolatedChildPrompt(upstreamText) {
|
|
59
|
-
return ('## Prior step output\n\n' +
|
|
60
|
-
upstreamText +
|
|
61
|
-
'\n\n---\n\n' +
|
|
62
|
-
'## Your task\n\n' +
|
|
63
|
-
'The previous step in this workflow has completed. You MUST now ' +
|
|
64
|
-
'perform your own task as defined in your system instructions, ' +
|
|
65
|
-
"using the prior step's output as input where relevant.\n\n" +
|
|
66
|
-
'If your task requires calling a tool, call it directly — do not ' +
|
|
67
|
-
'ask for clarification and do not produce a text-only response when ' +
|
|
68
|
-
'a tool action is expected.');
|
|
69
|
-
}
|
|
70
|
-
/* -------------------------------------------------------------------------- */
|
|
71
|
-
/* Internal helpers */
|
|
72
|
-
/* -------------------------------------------------------------------------- */
|
|
73
|
-
/**
|
|
74
|
-
* Extract concatenated text content from an AI message's content field.
|
|
75
|
-
* Handles both the string shape (OpenAI/plain) and the array-of-blocks
|
|
76
|
-
* shape (Anthropic/Bedrock).
|
|
77
|
-
*/
|
|
78
|
-
function extractAIText(msg) {
|
|
79
|
-
const content = msg.content;
|
|
80
|
-
if (typeof content === 'string')
|
|
81
|
-
return content;
|
|
82
|
-
if (!Array.isArray(content))
|
|
83
|
-
return '';
|
|
84
|
-
return content
|
|
85
|
-
.filter((b) => b.type === 'text' && typeof b.text === 'string')
|
|
86
|
-
.map((b) => b.text ?? '')
|
|
87
|
-
.join('\n');
|
|
88
|
-
}
|
|
89
|
-
/* -------------------------------------------------------------------------- */
|
|
90
|
-
/* Strategy 1: cleaned parent history (handoff target / root subgraph) */
|
|
91
|
-
/* -------------------------------------------------------------------------- */
|
|
92
|
-
/**
|
|
93
|
-
* Prepare messages for a handoff child agent.
|
|
94
|
-
*
|
|
95
|
-
* Handles two problems that break Bedrock/Anthropic conversations:
|
|
96
|
-
*
|
|
97
|
-
* 1. **Orphaned tool_use**: The parent's AI message contains a `tool_use`
|
|
98
|
-
* block for the handoff tool itself, with no matching `tool_result`.
|
|
99
|
-
* Providers (Bedrock/Anthropic) reject this.
|
|
100
|
-
*
|
|
101
|
-
* 2. **Paired tool_use/tool_result in history**: The child may not have
|
|
102
|
-
* the same tools as the parent. Bedrock requires `toolConfig` when any
|
|
103
|
-
* tool_use/tool_result blocks exist in the history. Compacting these
|
|
104
|
-
* into text summaries avoids the requirement and reduces context bloat.
|
|
105
|
-
*
|
|
106
|
-
* Also ensures the tail is a HumanMessage — some providers reject a
|
|
107
|
-
* conversation that ends with an assistant message.
|
|
108
|
-
*
|
|
109
|
-
* @param messages - Current state messages from the parent
|
|
110
|
-
* @returns A sanitized copy, safe to pass to any provider as the child's
|
|
111
|
-
* input regardless of which tools the child has registered.
|
|
112
|
-
*/
|
|
113
|
-
function prepareHandoffMessages(messages$1) {
|
|
114
|
-
if (messages$1.length === 0)
|
|
115
|
-
return messages$1;
|
|
116
|
-
/** Collect tool_result IDs so we know which tool_use blocks are paired */
|
|
117
|
-
const pairedToolCallIds = new Set();
|
|
118
|
-
for (const msg of messages$1) {
|
|
119
|
-
if (msg.getType() === 'tool') {
|
|
120
|
-
const tm = msg;
|
|
121
|
-
if (tm.tool_call_id)
|
|
122
|
-
pairedToolCallIds.add(tm.tool_call_id);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* Pass 1: Drop all ToolMessages (paired ones are compacted in pass 2),
|
|
127
|
-
* rewrite AI messages with tool_calls into plain-text summaries, leave
|
|
128
|
-
* other messages untouched.
|
|
129
|
-
*/
|
|
130
|
-
const cleaned = [];
|
|
131
|
-
for (const msg of messages$1) {
|
|
132
|
-
if (msg.getType() === 'tool')
|
|
133
|
-
continue;
|
|
134
|
-
if (msg.getType() !== 'ai') {
|
|
135
|
-
cleaned.push(msg);
|
|
136
|
-
continue;
|
|
137
|
-
}
|
|
138
|
-
const aiMsg = msg;
|
|
139
|
-
const toolCalls = aiMsg.tool_calls ?? [];
|
|
140
|
-
if (toolCalls.length === 0) {
|
|
141
|
-
cleaned.push(msg);
|
|
142
|
-
continue;
|
|
143
|
-
}
|
|
144
|
-
const textContent = extractAIText(aiMsg);
|
|
145
|
-
const toolSummaries = [];
|
|
146
|
-
for (const tc of toolCalls) {
|
|
147
|
-
if (tc.id != null && pairedToolCallIds.has(tc.id)) {
|
|
148
|
-
const toolResult = messages$1.find((m) => m.getType() === 'tool' && m.tool_call_id === tc.id);
|
|
149
|
-
const resultContent = toolResult
|
|
150
|
-
? typeof toolResult.content === 'string'
|
|
151
|
-
? toolResult.content.slice(0, 500)
|
|
152
|
-
: '[complex result]'
|
|
153
|
-
: '[no result]';
|
|
154
|
-
toolSummaries.push(`[Tool "${tc.name}": ${resultContent}]`);
|
|
155
|
-
}
|
|
156
|
-
// Orphaned tool_use blocks (no matching result) are silently dropped.
|
|
157
|
-
}
|
|
158
|
-
const parts = [textContent, ...toolSummaries].filter(Boolean);
|
|
159
|
-
if (parts.length > 0) {
|
|
160
|
-
cleaned.push(new messages.AIMessage({ content: parts.join('\n\n'), id: aiMsg.id }));
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* Ensure messages end with a HumanMessage. After stripping tool artifacts
|
|
165
|
-
* the tail may be an AIMessage, which Bedrock/VertexAI reject. Convert it
|
|
166
|
-
* to a HumanMessage preserving whatever text content was present, or drop
|
|
167
|
-
* it entirely if empty.
|
|
168
|
-
*/
|
|
169
|
-
if (cleaned.length > 0 && cleaned[cleaned.length - 1].getType() === 'ai') {
|
|
170
|
-
const lastAI = cleaned[cleaned.length - 1];
|
|
171
|
-
const content = typeof lastAI.content === 'string' ? lastAI.content : '';
|
|
172
|
-
if (content.trim()) {
|
|
173
|
-
cleaned[cleaned.length - 1] = new messages.HumanMessage(`${HANDOFF_TAIL_CONTEXT_PREFIX}${content}`);
|
|
174
|
-
}
|
|
175
|
-
else {
|
|
176
|
-
cleaned.pop();
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
return cleaned;
|
|
180
|
-
}
|
|
181
|
-
/* -------------------------------------------------------------------------- */
|
|
182
|
-
/* Strategy 2: isolated fresh session (downstream scoped-subgraph child) */
|
|
183
|
-
/* -------------------------------------------------------------------------- */
|
|
184
|
-
/**
|
|
185
|
-
* Build an ISOLATED message context for a downstream scoped-subgraph node.
|
|
186
|
-
*
|
|
187
|
-
* Unlike `prepareHandoffMessages` (which cleans up tool_use artifacts but
|
|
188
|
-
* preserves most of the parent history), this helper produces a fresh
|
|
189
|
-
* minimal context containing only:
|
|
190
|
-
*
|
|
191
|
-
* 1. The original user request (first HumanMessage in the history)
|
|
192
|
-
* 2. A synthetic HumanMessage summarizing the upstream agent's final
|
|
193
|
-
* text output and directing the downstream agent to act on it
|
|
194
|
-
*
|
|
195
|
-
* Tool_use / tool_result blocks from the upstream agent are discarded —
|
|
196
|
-
* the downstream agent shouldn't reason about how the upstream agent did
|
|
197
|
-
* its work, only about the result.
|
|
198
|
-
*
|
|
199
|
-
* This "fresh subagent session" pattern is the primary defense against
|
|
200
|
-
* schema confusion / malformed tool_use JSON that occurs when downstream
|
|
201
|
-
* models see a noisy upstream conversation.
|
|
202
|
-
*
|
|
203
|
-
* Defensive fallback: if the messages array contains neither a user
|
|
204
|
-
* message nor a non-empty upstream AI message, return the input unchanged
|
|
205
|
-
* so the caller still has something to invoke on. This only matters for
|
|
206
|
-
* malformed state fixtures in tests.
|
|
207
|
-
*/
|
|
208
|
-
function prepareIsolatedChildMessages(messages$1) {
|
|
209
|
-
if (messages$1.length === 0)
|
|
210
|
-
return messages$1;
|
|
211
|
-
/** First HumanMessage is the original user request */
|
|
212
|
-
const originalUser = messages$1.find((m) => m.getType() === 'human');
|
|
213
|
-
/** Most recent AIMessage with non-empty text content */
|
|
214
|
-
let upstreamText = '';
|
|
215
|
-
for (let i = messages$1.length - 1; i >= 0; i--) {
|
|
216
|
-
const msg = messages$1[i];
|
|
217
|
-
if (msg.getType() !== 'ai')
|
|
218
|
-
continue;
|
|
219
|
-
const text = extractAIText(msg);
|
|
220
|
-
if (text.trim()) {
|
|
221
|
-
upstreamText = text;
|
|
222
|
-
break;
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
const result = [];
|
|
226
|
-
if (originalUser)
|
|
227
|
-
result.push(originalUser);
|
|
228
|
-
if (upstreamText.trim()) {
|
|
229
|
-
result.push(new messages.HumanMessage(buildIsolatedChildPrompt(upstreamText)));
|
|
230
|
-
}
|
|
231
|
-
else if (result.length === 0) {
|
|
232
|
-
/** Defensive: nothing to isolate — fall back to raw messages */
|
|
233
|
-
return messages$1;
|
|
234
|
-
}
|
|
235
|
-
return result;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
exports.HANDOFF_TAIL_CONTEXT_PREFIX = HANDOFF_TAIL_CONTEXT_PREFIX;
|
|
239
|
-
exports.buildIsolatedChildPrompt = buildIsolatedChildPrompt;
|
|
240
|
-
exports.prepareHandoffMessages = prepareHandoffMessages;
|
|
241
|
-
exports.prepareIsolatedChildMessages = prepareIsolatedChildMessages;
|
|
242
|
-
//# sourceMappingURL=childAgentContext.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"childAgentContext.cjs","sources":["../../../src/utils/childAgentContext.ts"],"sourcesContent":["/**\n * Child-agent context preparation utilities.\n *\n * When a parent agent invokes a child agent — via handoff, sequence edge,\n * or scoped subgraph — the child cannot just receive `state.messages`\n * verbatim. The parent's conversation contains tool_use/tool_result blocks\n * that are (a) often incompatible with the child's tool registry, and\n * (b) actively harmful to the child's ability to reason cleanly about its\n * own task (noise → schema confusion → malformed tool_use).\n *\n * This module provides the two canonical strategies, extracted from\n * `MultiAgentGraph` so they can be unit-tested in isolation and reused by\n * future sub-agent orchestrators:\n *\n * 1. `prepareHandoffMessages` — \"cleaned parent history\"\n * Used when the child still needs the orchestrator's context (it's\n * the handoff target). Drops orphaned tool_use, compacts paired\n * tool_use/tool_result into text summaries, and guarantees the tail\n * is a HumanMessage so Bedrock/VertexAI won't reject the conversation\n * with \"assistant message prefill\" errors.\n *\n * 2. `prepareIsolatedChildMessages` — \"fresh session\"\n * Used for downstream sequence-node children inside a scoped subgraph.\n * The child sees only the original user request plus a synthetic\n * HumanMessage summarizing the upstream agent's final text output and\n * directing the child to act. Raw upstream tool_use/tool_result blocks\n * are discarded.\n *\n * Both helpers are pure functions over message arrays — no I/O, no\n * LangGraph coupling — so they can be exercised by unit tests with\n * synthetic message fixtures.\n */\n\nimport { AIMessage, HumanMessage, ToolMessage } from '@langchain/core/messages';\nimport type { AIMessageChunk, BaseMessage } from '@langchain/core/messages';\n\n/* -------------------------------------------------------------------------- */\n/* Prompt template constants (kept outside the functions for reuse/tuning) */\n/* -------------------------------------------------------------------------- */\n\n/**\n * Prefix injected in front of a trailing AIMessage when we flip it to a\n * HumanMessage to satisfy provider \"last message must be user\" rules.\n */\nexport const HANDOFF_TAIL_CONTEXT_PREFIX = '[Context from orchestrator]: ';\n\n/**\n * Directive task-framing wrapper for downstream scoped-subgraph children.\n *\n * Design notes — each line is load-bearing:\n * - \"Prior step output\" names the upstream role without leaking the\n * agent's internal id.\n * - \"You MUST now perform...\" replaces ambiguity with obligation.\n * - \"system instructions\" references the agent's stored system prompt\n * as the source of task definition — so operators can tune behavior\n * via data, not code.\n * - The tool-first clause prevents small/fast models from stalling on a\n * text-only acknowledgement when a tool action is expected.\n */\nexport function buildIsolatedChildPrompt(upstreamText: string): string {\n return (\n '## Prior step output\\n\\n' +\n upstreamText +\n '\\n\\n---\\n\\n' +\n '## Your task\\n\\n' +\n 'The previous step in this workflow has completed. You MUST now ' +\n 'perform your own task as defined in your system instructions, ' +\n \"using the prior step's output as input where relevant.\\n\\n\" +\n 'If your task requires calling a tool, call it directly — do not ' +\n 'ask for clarification and do not produce a text-only response when ' +\n 'a tool action is expected.'\n );\n}\n\n/* -------------------------------------------------------------------------- */\n/* Internal helpers */\n/* -------------------------------------------------------------------------- */\n\n/**\n * Extract concatenated text content from an AI message's content field.\n * Handles both the string shape (OpenAI/plain) and the array-of-blocks\n * shape (Anthropic/Bedrock).\n */\nfunction extractAIText(msg: AIMessage | AIMessageChunk): string {\n const content = msg.content;\n if (typeof content === 'string') return content;\n if (!Array.isArray(content)) return '';\n return (content as Array<{ type?: string; text?: string }>)\n .filter((b) => b.type === 'text' && typeof b.text === 'string')\n .map((b) => b.text ?? '')\n .join('\\n');\n}\n\n/* -------------------------------------------------------------------------- */\n/* Strategy 1: cleaned parent history (handoff target / root subgraph) */\n/* -------------------------------------------------------------------------- */\n\n/**\n * Prepare messages for a handoff child agent.\n *\n * Handles two problems that break Bedrock/Anthropic conversations:\n *\n * 1. **Orphaned tool_use**: The parent's AI message contains a `tool_use`\n * block for the handoff tool itself, with no matching `tool_result`.\n * Providers (Bedrock/Anthropic) reject this.\n *\n * 2. **Paired tool_use/tool_result in history**: The child may not have\n * the same tools as the parent. Bedrock requires `toolConfig` when any\n * tool_use/tool_result blocks exist in the history. Compacting these\n * into text summaries avoids the requirement and reduces context bloat.\n *\n * Also ensures the tail is a HumanMessage — some providers reject a\n * conversation that ends with an assistant message.\n *\n * @param messages - Current state messages from the parent\n * @returns A sanitized copy, safe to pass to any provider as the child's\n * input regardless of which tools the child has registered.\n */\nexport function prepareHandoffMessages(messages: BaseMessage[]): BaseMessage[] {\n if (messages.length === 0) return messages;\n\n /** Collect tool_result IDs so we know which tool_use blocks are paired */\n const pairedToolCallIds = new Set<string>();\n for (const msg of messages) {\n if (msg.getType() === 'tool') {\n const tm = msg as ToolMessage;\n if (tm.tool_call_id) pairedToolCallIds.add(tm.tool_call_id);\n }\n }\n\n /**\n * Pass 1: Drop all ToolMessages (paired ones are compacted in pass 2),\n * rewrite AI messages with tool_calls into plain-text summaries, leave\n * other messages untouched.\n */\n const cleaned: BaseMessage[] = [];\n for (const msg of messages) {\n if (msg.getType() === 'tool') continue;\n\n if (msg.getType() !== 'ai') {\n cleaned.push(msg);\n continue;\n }\n\n const aiMsg = msg as AIMessage | AIMessageChunk;\n const toolCalls = aiMsg.tool_calls ?? [];\n if (toolCalls.length === 0) {\n cleaned.push(msg);\n continue;\n }\n\n const textContent = extractAIText(aiMsg);\n\n const toolSummaries: string[] = [];\n for (const tc of toolCalls) {\n if (tc.id != null && pairedToolCallIds.has(tc.id)) {\n const toolResult = messages.find(\n (m) =>\n m.getType() === 'tool' && (m as ToolMessage).tool_call_id === tc.id\n ) as ToolMessage | undefined;\n const resultContent = toolResult\n ? typeof toolResult.content === 'string'\n ? toolResult.content.slice(0, 500)\n : '[complex result]'\n : '[no result]';\n toolSummaries.push(`[Tool \"${tc.name}\": ${resultContent}]`);\n }\n // Orphaned tool_use blocks (no matching result) are silently dropped.\n }\n\n const parts = [textContent, ...toolSummaries].filter(Boolean);\n if (parts.length > 0) {\n cleaned.push(\n new AIMessage({ content: parts.join('\\n\\n'), id: aiMsg.id })\n );\n }\n }\n\n /**\n * Ensure messages end with a HumanMessage. After stripping tool artifacts\n * the tail may be an AIMessage, which Bedrock/VertexAI reject. Convert it\n * to a HumanMessage preserving whatever text content was present, or drop\n * it entirely if empty.\n */\n if (cleaned.length > 0 && cleaned[cleaned.length - 1].getType() === 'ai') {\n const lastAI = cleaned[cleaned.length - 1];\n const content = typeof lastAI.content === 'string' ? lastAI.content : '';\n if (content.trim()) {\n cleaned[cleaned.length - 1] = new HumanMessage(\n `${HANDOFF_TAIL_CONTEXT_PREFIX}${content}`\n );\n } else {\n cleaned.pop();\n }\n }\n\n return cleaned;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Strategy 2: isolated fresh session (downstream scoped-subgraph child) */\n/* -------------------------------------------------------------------------- */\n\n/**\n * Build an ISOLATED message context for a downstream scoped-subgraph node.\n *\n * Unlike `prepareHandoffMessages` (which cleans up tool_use artifacts but\n * preserves most of the parent history), this helper produces a fresh\n * minimal context containing only:\n *\n * 1. The original user request (first HumanMessage in the history)\n * 2. A synthetic HumanMessage summarizing the upstream agent's final\n * text output and directing the downstream agent to act on it\n *\n * Tool_use / tool_result blocks from the upstream agent are discarded —\n * the downstream agent shouldn't reason about how the upstream agent did\n * its work, only about the result.\n *\n * This \"fresh subagent session\" pattern is the primary defense against\n * schema confusion / malformed tool_use JSON that occurs when downstream\n * models see a noisy upstream conversation.\n *\n * Defensive fallback: if the messages array contains neither a user\n * message nor a non-empty upstream AI message, return the input unchanged\n * so the caller still has something to invoke on. This only matters for\n * malformed state fixtures in tests.\n */\nexport function prepareIsolatedChildMessages(\n messages: BaseMessage[]\n): BaseMessage[] {\n if (messages.length === 0) return messages;\n\n /** First HumanMessage is the original user request */\n const originalUser = messages.find((m) => m.getType() === 'human');\n\n /** Most recent AIMessage with non-empty text content */\n let upstreamText = '';\n for (let i = messages.length - 1; i >= 0; i--) {\n const msg = messages[i];\n if (msg.getType() !== 'ai') continue;\n const text = extractAIText(msg as AIMessage | AIMessageChunk);\n if (text.trim()) {\n upstreamText = text;\n break;\n }\n }\n\n const result: BaseMessage[] = [];\n if (originalUser) result.push(originalUser);\n\n if (upstreamText.trim()) {\n result.push(new HumanMessage(buildIsolatedChildPrompt(upstreamText)));\n } else if (result.length === 0) {\n /** Defensive: nothing to isolate — fall back to raw messages */\n return messages;\n }\n\n return result;\n}\n"],"names":["messages","AIMessage","HumanMessage"],"mappings":";;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BG;AAKH;AACA;AACA;AAEA;;;AAGG;AACI,MAAM,2BAA2B,GAAG;AAE3C;;;;;;;;;;;;AAYG;AACG,SAAU,wBAAwB,CAAC,YAAoB,EAAA;AAC3D,IAAA,QACE,0BAA0B;QAC1B,YAAY;QACZ,aAAa;QACb,kBAAkB;QAClB,iEAAiE;QACjE,gEAAgE;QAChE,4DAA4D;QAC5D,kEAAkE;QAClE,qEAAqE;AACrE,QAAA,4BAA4B;AAEhC;AAEA;AACA;AACA;AAEA;;;;AAIG;AACH,SAAS,aAAa,CAAC,GAA+B,EAAA;AACpD,IAAA,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO;IAC3B,IAAI,OAAO,OAAO,KAAK,QAAQ;AAAE,QAAA,OAAO,OAAO;AAC/C,IAAA,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC;AAAE,QAAA,OAAO,EAAE;AACtC,IAAA,OAAQ;A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