@illuma-ai/agents 1.4.0-alpha.5 → 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 -117
- 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/index.mjs.map +1 -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 -24
- 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 -4
- 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 +58 -13
- 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 -5
- 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/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/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/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/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 -269
- 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 -248
- 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
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var types = require('../providers/types.cjs');
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Credential merging utility for capability providers.
|
|
7
|
-
*
|
|
8
|
-
* The host is the source of truth for credential values. It resolves them
|
|
9
|
-
* from env vars, user settings, or active OAuth sessions, then passes a
|
|
10
|
-
* flat CredentialMap to the provider.
|
|
11
|
-
*
|
|
12
|
-
* This utility helps hosts build that map from multiple sources with clear
|
|
13
|
-
* precedence rules. Providers themselves do NOT use this — they just receive
|
|
14
|
-
* the finished map.
|
|
15
|
-
*/
|
|
16
|
-
/**
|
|
17
|
-
* Source of a credential value in the merged result. Useful for logging
|
|
18
|
-
* and debugging which layer won a given authField.
|
|
19
|
-
*/
|
|
20
|
-
exports.CredentialOrigin = void 0;
|
|
21
|
-
(function (CredentialOrigin) {
|
|
22
|
-
/** From the caller's process env (typically the CLI). */
|
|
23
|
-
CredentialOrigin["ENV"] = "env";
|
|
24
|
-
/** From the agent definition's tool_credentials block. */
|
|
25
|
-
CredentialOrigin["AGENT"] = "agent";
|
|
26
|
-
/** From the user's stored credentials in the host's credential store. */
|
|
27
|
-
CredentialOrigin["USER"] = "user";
|
|
28
|
-
/** From an active OAuth session forwarded by the host. */
|
|
29
|
-
CredentialOrigin["SESSION"] = "session";
|
|
30
|
-
/** Injected by the host at runtime for another reason. */
|
|
31
|
-
CredentialOrigin["RUNTIME"] = "runtime";
|
|
32
|
-
})(exports.CredentialOrigin || (exports.CredentialOrigin = {}));
|
|
33
|
-
/**
|
|
34
|
-
* Merge credential layers with earlier layers overriding later ones.
|
|
35
|
-
*
|
|
36
|
-
* Typical host flow (in order of precedence):
|
|
37
|
-
* 1. runtime overrides (e.g., test injection) → RUNTIME
|
|
38
|
-
* 2. active OAuth session tokens → SESSION
|
|
39
|
-
* 3. agent-defined tool_credentials → AGENT
|
|
40
|
-
* 4. user's stored credentials → USER
|
|
41
|
-
* 5. process env → ENV
|
|
42
|
-
*
|
|
43
|
-
* Caller passes layers in precedence order (highest first).
|
|
44
|
-
*/
|
|
45
|
-
function mergeCredentials(...layers) {
|
|
46
|
-
const merged = {};
|
|
47
|
-
// Iterate reverse so first-declared layer wins on collision.
|
|
48
|
-
for (let i = layers.length - 1; i >= 0; i--) {
|
|
49
|
-
const layer = layers[i];
|
|
50
|
-
for (const [key, value] of Object.entries(layer.values)) {
|
|
51
|
-
if (value !== undefined && value !== null && value !== '') {
|
|
52
|
-
merged[key] = value;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return merged;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Given a set of capabilities, return the union of authField names they
|
|
60
|
-
* require. Useful for hosts that want to pre-resolve credentials before
|
|
61
|
-
* calling createRunnables.
|
|
62
|
-
*/
|
|
63
|
-
function collectRequiredAuthFields(capabilities) {
|
|
64
|
-
const fields = new Set();
|
|
65
|
-
for (const cap of capabilities) {
|
|
66
|
-
for (const entry of cap.authConfig) {
|
|
67
|
-
fields.add(entry.authField);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
return Array.from(fields);
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Filter out credentials that the provider is expected to resolve itself
|
|
74
|
-
* (source === SERVER). Hosts call this before forwarding — these values
|
|
75
|
-
* live in the provider's own environment and shouldn't be sent.
|
|
76
|
-
*
|
|
77
|
-
* Precedence: entries without `source` default to USER (must be forwarded).
|
|
78
|
-
*/
|
|
79
|
-
function filterForwardableCredentials(credentials, capabilities) {
|
|
80
|
-
const serverManagedFields = new Set();
|
|
81
|
-
for (const cap of capabilities) {
|
|
82
|
-
for (const entry of cap.authConfig) {
|
|
83
|
-
if (entry.source === types.AuthSource.SERVER) {
|
|
84
|
-
serverManagedFields.add(entry.authField);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
const forwardable = {};
|
|
89
|
-
for (const [key, value] of Object.entries(credentials)) {
|
|
90
|
-
if (!serverManagedFields.has(key)) {
|
|
91
|
-
forwardable[key] = value;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
return forwardable;
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Validate that all required credentials for a capability are present in
|
|
98
|
-
* the provided map. Returns the list of missing authFields (empty array
|
|
99
|
-
* if all satisfied). Credentials with `source === SERVER` are excluded
|
|
100
|
-
* from the check since the provider resolves them.
|
|
101
|
-
*/
|
|
102
|
-
function findMissingCredentials(capability, credentials) {
|
|
103
|
-
const missing = [];
|
|
104
|
-
for (const entry of capability.authConfig) {
|
|
105
|
-
if (entry.source === types.AuthSource.SERVER)
|
|
106
|
-
continue;
|
|
107
|
-
if (!entry.required)
|
|
108
|
-
continue;
|
|
109
|
-
if (!credentials[entry.authField]) {
|
|
110
|
-
missing.push(entry.authField);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
return missing;
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Build a CredentialLayer from process env given a list of authField names.
|
|
117
|
-
* Values that aren't set in env are omitted (not set to empty string).
|
|
118
|
-
*/
|
|
119
|
-
function credentialsFromEnv(authFields, env = process.env) {
|
|
120
|
-
const values = {};
|
|
121
|
-
for (const field of authFields) {
|
|
122
|
-
const value = env[field];
|
|
123
|
-
if (value)
|
|
124
|
-
values[field] = value;
|
|
125
|
-
}
|
|
126
|
-
return { origin: exports.CredentialOrigin.ENV, values };
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Type guard: check whether an auth config entry should be forwarded by
|
|
130
|
-
* the host (vs resolved by the provider itself).
|
|
131
|
-
*/
|
|
132
|
-
function isForwardable(entry) {
|
|
133
|
-
return entry.source !== types.AuthSource.SERVER;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
exports.collectRequiredAuthFields = collectRequiredAuthFields;
|
|
137
|
-
exports.credentialsFromEnv = credentialsFromEnv;
|
|
138
|
-
exports.filterForwardableCredentials = filterForwardableCredentials;
|
|
139
|
-
exports.findMissingCredentials = findMissingCredentials;
|
|
140
|
-
exports.isForwardable = isForwardable;
|
|
141
|
-
exports.mergeCredentials = mergeCredentials;
|
|
142
|
-
//# sourceMappingURL=credentials.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"credentials.cjs","sources":["../../../src/utils/credentials.ts"],"sourcesContent":["/**\n * Credential merging utility for capability providers.\n *\n * The host is the source of truth for credential values. It resolves them\n * from env vars, user settings, or active OAuth sessions, then passes a\n * flat CredentialMap to the provider.\n *\n * This utility helps hosts build that map from multiple sources with clear\n * precedence rules. Providers themselves do NOT use this — they just receive\n * the finished map.\n */\n\nimport type {\n AuthConfigEntry,\n Capability,\n CredentialMap,\n} from '@/providers/types';\nimport { AuthSource } from '@/providers/types';\n\n/**\n * Source of a credential value in the merged result. Useful for logging\n * and debugging which layer won a given authField.\n */\nexport enum CredentialOrigin {\n /** From the caller's process env (typically the CLI). */\n ENV = 'env',\n /** From the agent definition's tool_credentials block. */\n AGENT = 'agent',\n /** From the user's stored credentials in the host's credential store. */\n USER = 'user',\n /** From an active OAuth session forwarded by the host. */\n SESSION = 'session',\n /** Injected by the host at runtime for another reason. */\n RUNTIME = 'runtime',\n}\n\n/** One layer of credentials with its origin. */\nexport interface CredentialLayer {\n origin: CredentialOrigin;\n values: CredentialMap;\n}\n\n/**\n * Merge credential layers with earlier layers overriding later ones.\n *\n * Typical host flow (in order of precedence):\n * 1. runtime overrides (e.g., test injection) → RUNTIME\n * 2. active OAuth session tokens → SESSION\n * 3. agent-defined tool_credentials → AGENT\n * 4. user's stored credentials → USER\n * 5. process env → ENV\n *\n * Caller passes layers in precedence order (highest first).\n */\nexport function mergeCredentials(...layers: CredentialLayer[]): CredentialMap {\n const merged: CredentialMap = {};\n // Iterate reverse so first-declared layer wins on collision.\n for (let i = layers.length - 1; i >= 0; i--) {\n const layer = layers[i];\n for (const [key, value] of Object.entries(layer.values)) {\n if (value !== undefined && value !== null && value !== '') {\n merged[key] = value;\n }\n }\n }\n return merged;\n}\n\n/**\n * Given a set of capabilities, return the union of authField names they\n * require. Useful for hosts that want to pre-resolve credentials before\n * calling createRunnables.\n */\nexport function collectRequiredAuthFields(\n capabilities: Capability[]\n): string[] {\n const fields = new Set<string>();\n for (const cap of capabilities) {\n for (const entry of cap.authConfig) {\n fields.add(entry.authField);\n }\n }\n return Array.from(fields);\n}\n\n/**\n * Filter out credentials that the provider is expected to resolve itself\n * (source === SERVER). Hosts call this before forwarding — these values\n * live in the provider's own environment and shouldn't be sent.\n *\n * Precedence: entries without `source` default to USER (must be forwarded).\n */\nexport function filterForwardableCredentials(\n credentials: CredentialMap,\n capabilities: Capability[]\n): CredentialMap {\n const serverManagedFields = new Set<string>();\n for (const cap of capabilities) {\n for (const entry of cap.authConfig) {\n if (entry.source === AuthSource.SERVER) {\n serverManagedFields.add(entry.authField);\n }\n }\n }\n const forwardable: CredentialMap = {};\n for (const [key, value] of Object.entries(credentials)) {\n if (!serverManagedFields.has(key)) {\n forwardable[key] = value;\n }\n }\n return forwardable;\n}\n\n/**\n * Validate that all required credentials for a capability are present in\n * the provided map. Returns the list of missing authFields (empty array\n * if all satisfied). Credentials with `source === SERVER` are excluded\n * from the check since the provider resolves them.\n */\nexport function findMissingCredentials(\n capability: Capability,\n credentials: CredentialMap\n): string[] {\n const missing: string[] = [];\n for (const entry of capability.authConfig) {\n if (entry.source === AuthSource.SERVER) continue;\n if (!entry.required) continue;\n if (!credentials[entry.authField]) {\n missing.push(entry.authField);\n }\n }\n return missing;\n}\n\n/**\n * Build a CredentialLayer from process env given a list of authField names.\n * Values that aren't set in env are omitted (not set to empty string).\n */\nexport function credentialsFromEnv(\n authFields: readonly string[],\n env: NodeJS.ProcessEnv = process.env\n): CredentialLayer {\n const values: CredentialMap = {};\n for (const field of authFields) {\n const value = env[field];\n if (value) values[field] = value;\n }\n return { origin: CredentialOrigin.ENV, values };\n}\n\n/**\n * Type guard: check whether an auth config entry should be forwarded by\n * the host (vs resolved by the provider itself).\n */\nexport function isForwardable(entry: AuthConfigEntry): boolean {\n return entry.source !== AuthSource.SERVER;\n}\n"],"names":["CredentialOrigin","AuthSource"],"mappings":";;;;AAAA;;;;;;;;;;AAUG;AASH;;;AAGG;AACSA;AAAZ,CAAA,UAAY,gBAAgB,EAAA;;AAE1B,IAAA,gBAAA,CAAA,KAAA,CAAA,GAAA,KAAW;;AAEX,IAAA,gBAAA,CAAA,OAAA,CAAA,GAAA,OAAe;;AAEf,IAAA,gBAAA,CAAA,MAAA,CAAA,GAAA,MAAa;;AAEb,IAAA,gBAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;;AAEnB,IAAA,gBAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACrB,CAAC,EAXWA,wBAAgB,KAAhBA,wBAAgB,GAAA,EAAA,CAAA,CAAA;AAmB5B;;;;;;;;;;;AAWG;AACG,SAAU,gBAAgB,CAAC,GAAG,MAAyB,EAAA;IAC3D,MAAM,MAAM,GAAkB,EAA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'use strict';
|
|
2
|
-
|
|
3
|
-
var axios = require('axios');
|
|
4
|
-
var httpsProxyAgent = require('https-proxy-agent');
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* HTTP client utility for capability providers.
|
|
8
|
-
*
|
|
9
|
-
* Wraps axios with proxy support, default headers, and consistent retry
|
|
10
|
-
* behavior so every provider doesn't reinvent the wheel. Used by
|
|
11
|
-
* ToolsServerCapabilityProvider and (future) any HTTP-backed provider.
|
|
12
|
-
*
|
|
13
|
-
* Proxy resolution follows the existing pattern in this codebase:
|
|
14
|
-
* the PROXY env var is read and an HttpsProxyAgent is attached if present.
|
|
15
|
-
*/
|
|
16
|
-
/**
|
|
17
|
-
* Build an axios instance configured per HttpClientConfig.
|
|
18
|
-
*
|
|
19
|
-
* The returned instance should be retained (not recreated per request) so
|
|
20
|
-
* keepalive connections can be reused.
|
|
21
|
-
*/
|
|
22
|
-
function createHttpClient(config) {
|
|
23
|
-
const { baseURL, apiKey, headers = {}, timeoutMs = 30_000, proxy } = config;
|
|
24
|
-
const resolvedProxy = proxy === undefined ? process.env.PROXY : proxy;
|
|
25
|
-
const defaultHeaders = {
|
|
26
|
-
'content-type': 'application/json',
|
|
27
|
-
...headers,
|
|
28
|
-
};
|
|
29
|
-
if (apiKey) {
|
|
30
|
-
defaultHeaders['x-api-key'] = apiKey;
|
|
31
|
-
}
|
|
32
|
-
const axiosConfig = {
|
|
33
|
-
baseURL,
|
|
34
|
-
timeout: timeoutMs,
|
|
35
|
-
headers: defaultHeaders,
|
|
36
|
-
// Don't throw on non-2xx — callers handle status codes explicitly.
|
|
37
|
-
validateStatus: () => true,
|
|
38
|
-
};
|
|
39
|
-
if (resolvedProxy) {
|
|
40
|
-
// axios respects `httpsAgent` for outbound proxying
|
|
41
|
-
axiosConfig.httpsAgent = new httpsProxyAgent.HttpsProxyAgent(resolvedProxy);
|
|
42
|
-
axiosConfig.httpAgent = new httpsProxyAgent.HttpsProxyAgent(resolvedProxy);
|
|
43
|
-
// Disable axios's built-in proxy logic in favor of the agent.
|
|
44
|
-
axiosConfig.proxy = false;
|
|
45
|
-
}
|
|
46
|
-
return axios.create(axiosConfig);
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Thin wrapper around an axios response that throws with a structured error
|
|
50
|
-
* on non-2xx status codes. Providers use this to get uniform error surface.
|
|
51
|
-
*/
|
|
52
|
-
class HttpError extends Error {
|
|
53
|
-
status;
|
|
54
|
-
body;
|
|
55
|
-
url;
|
|
56
|
-
constructor(status, url, body) {
|
|
57
|
-
super(`HTTP ${status} on ${url}`);
|
|
58
|
-
this.name = 'HttpError';
|
|
59
|
-
this.status = status;
|
|
60
|
-
this.url = url;
|
|
61
|
-
this.body = body;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
/** Assert that an axios response is a 2xx; throw HttpError otherwise. */
|
|
65
|
-
function assertOk(status, url, body) {
|
|
66
|
-
if (status < 200 || status >= 300) {
|
|
67
|
-
throw new HttpError(status, url, body);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
exports.HttpError = HttpError;
|
|
72
|
-
exports.assertOk = assertOk;
|
|
73
|
-
exports.createHttpClient = createHttpClient;
|
|
74
|
-
//# sourceMappingURL=httpClient.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"httpClient.cjs","sources":["../../../src/utils/httpClient.ts"],"sourcesContent":["/**\n * HTTP client utility for capability providers.\n *\n * Wraps axios with proxy support, default headers, and consistent retry\n * behavior so every provider doesn't reinvent the wheel. Used by\n * ToolsServerCapabilityProvider and (future) any HTTP-backed provider.\n *\n * Proxy resolution follows the existing pattern in this codebase:\n * the PROXY env var is read and an HttpsProxyAgent is attached if present.\n */\n\nimport axios, { type AxiosInstance, type AxiosRequestConfig } from 'axios';\nimport { HttpsProxyAgent } from 'https-proxy-agent';\n\n/** Configuration for creating an HTTP client. */\nexport interface HttpClientConfig {\n /** Base URL prepended to all requests. */\n baseURL: string;\n /** Optional API key — if present, sent as `x-api-key` header. */\n apiKey?: string;\n /** Custom header map merged into every request. */\n headers?: Record<string, string>;\n /** Request timeout in milliseconds. Defaults to 30_000. */\n timeoutMs?: number;\n /**\n * Override for the PROXY env var. Useful for tests. If undefined,\n * falls back to process.env.PROXY.\n */\n proxy?: string | null;\n}\n\n/**\n * Build an axios instance configured per HttpClientConfig.\n *\n * The returned instance should be retained (not recreated per request) so\n * keepalive connections can be reused.\n */\nexport function createHttpClient(config: HttpClientConfig): AxiosInstance {\n const { baseURL, apiKey, headers = {}, timeoutMs = 30_000, proxy } = config;\n\n const resolvedProxy = proxy === undefined ? process.env.PROXY : proxy;\n\n const defaultHeaders: Record<string, string> = {\n 'content-type': 'application/json',\n ...headers,\n };\n if (apiKey) {\n defaultHeaders['x-api-key'] = apiKey;\n }\n\n const axiosConfig: AxiosRequestConfig = {\n baseURL,\n timeout: timeoutMs,\n headers: defaultHeaders,\n // Don't throw on non-2xx — callers handle status codes explicitly.\n validateStatus: () => true,\n };\n\n if (resolvedProxy) {\n // axios respects `httpsAgent` for outbound proxying\n axiosConfig.httpsAgent = new HttpsProxyAgent(resolvedProxy);\n axiosConfig.httpAgent = new HttpsProxyAgent(resolvedProxy);\n // Disable axios's built-in proxy logic in favor of the agent.\n axiosConfig.proxy = false;\n }\n\n return axios.create(axiosConfig);\n}\n\n/**\n * Thin wrapper around an axios response that throws with a structured error\n * on non-2xx status codes. Providers use this to get uniform error surface.\n */\nexport class HttpError extends Error {\n readonly status: number;\n readonly body: unknown;\n readonly url: string;\n constructor(status: number, url: string, body: unknown) {\n super(`HTTP ${status} on ${url}`);\n this.name = 'HttpError';\n this.status = status;\n this.url = url;\n this.body = body;\n }\n}\n\n/** Assert that an axios response is a 2xx; throw HttpError otherwise. */\nexport function assertOk(status: number, url: string, body: unknown): void {\n if (status < 200 || status >= 300) {\n throw new HttpError(status, url, body);\n }\n}\n"],"names":["HttpsProxyAgent"],"mappings":";;;;;AAAA;;;;;;;;;AAS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QAAA,IAAI,CAAC,IAAI,GAAG,IAAI;IAClB;AACD;AAED;SACgB,QAAQ,CAAC,MAAc,EAAE,GAAW,EAAE,IAAa,EAAA;IACjE,IAAI,MAAM,GAAG,GAAG,IAAI,MAAM,IAAI,GAAG,EAAE;QACjC,MAAM,IAAI,SAAS,CAAC,MAAM,EAAE,GAAG,EAAE,IAAI,CAAC;IACxC;AACF;;;;;;"}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Tool manifest cache.
|
|
5
|
-
*
|
|
6
|
-
* Providers fetch a manifest at init and potentially on refresh. This
|
|
7
|
-
* utility provides a minimal TTL cache so repeated fetchManifest() calls
|
|
8
|
-
* don't hammer the backing server.
|
|
9
|
-
*
|
|
10
|
-
* Caching is opt-in — providers that want fresh data every time (e.g.,
|
|
11
|
-
* MCP with dynamic tool lists) can skip this entirely.
|
|
12
|
-
*/
|
|
13
|
-
/**
|
|
14
|
-
* Simple in-memory TTL cache for manifests, keyed by a caller-supplied
|
|
15
|
-
* cache key (e.g., the filter hash or a fixed constant for unfiltered).
|
|
16
|
-
*
|
|
17
|
-
* Thread-safety: the cache uses a plain Map. Node's single-threaded event
|
|
18
|
-
* loop makes this safe for typical use. Not safe across workers — each
|
|
19
|
-
* worker keeps its own cache (fine, since manifests are small).
|
|
20
|
-
*/
|
|
21
|
-
class ManifestCache {
|
|
22
|
-
ttlMs;
|
|
23
|
-
store = new Map();
|
|
24
|
-
constructor(config = {}) {
|
|
25
|
-
this.ttlMs = config.ttlMs ?? 60_000;
|
|
26
|
-
}
|
|
27
|
-
/** Retrieve cached capabilities, or undefined on miss / expiry. */
|
|
28
|
-
get(key) {
|
|
29
|
-
const entry = this.store.get(key);
|
|
30
|
-
if (!entry)
|
|
31
|
-
return undefined;
|
|
32
|
-
if (entry.expiresAt < Date.now()) {
|
|
33
|
-
this.store.delete(key);
|
|
34
|
-
return undefined;
|
|
35
|
-
}
|
|
36
|
-
return entry.capabilities;
|
|
37
|
-
}
|
|
38
|
-
/** Insert or replace cached capabilities for the given key. */
|
|
39
|
-
set(key, capabilities) {
|
|
40
|
-
if (this.ttlMs <= 0)
|
|
41
|
-
return;
|
|
42
|
-
this.store.set(key, {
|
|
43
|
-
expiresAt: Date.now() + this.ttlMs,
|
|
44
|
-
capabilities,
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
/** Remove all cached entries. */
|
|
48
|
-
clear() {
|
|
49
|
-
this.store.clear();
|
|
50
|
-
}
|
|
51
|
-
/** For tests / diagnostics. */
|
|
52
|
-
get size() {
|
|
53
|
-
return this.store.size;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Build a deterministic cache key from a CapabilityFilter.
|
|
58
|
-
*
|
|
59
|
-
* Two identical filters always produce the same key. Providers use this
|
|
60
|
-
* so `fetchManifest(filter)` and `fetchManifest(sameFilter)` hit the
|
|
61
|
-
* same cache entry.
|
|
62
|
-
*/
|
|
63
|
-
function filterToCacheKey(filter) {
|
|
64
|
-
if (!filter)
|
|
65
|
-
return '__all__';
|
|
66
|
-
const parts = [];
|
|
67
|
-
if (filter.kind)
|
|
68
|
-
parts.push(`kind=${filter.kind}`);
|
|
69
|
-
if (filter.tags?.length)
|
|
70
|
-
parts.push(`tags=${[...filter.tags].sort().join(',')}`);
|
|
71
|
-
if (filter.names?.length)
|
|
72
|
-
parts.push(`names=${[...filter.names].sort().join(',')}`);
|
|
73
|
-
return parts.length ? parts.join('|') : '__all__';
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Apply a CapabilityFilter to a pre-fetched manifest. Used by providers
|
|
77
|
-
* that fetch the full manifest once and filter in memory.
|
|
78
|
-
*/
|
|
79
|
-
function applyFilter(capabilities, filter) {
|
|
80
|
-
if (!filter)
|
|
81
|
-
return capabilities;
|
|
82
|
-
return capabilities.filter((cap) => {
|
|
83
|
-
if (filter.kind && cap.kind !== filter.kind)
|
|
84
|
-
return false;
|
|
85
|
-
if (filter.names && !filter.names.includes(cap.name))
|
|
86
|
-
return false;
|
|
87
|
-
if (filter.tags?.length) {
|
|
88
|
-
const capTags = new Set(cap.metadata.tags ?? []);
|
|
89
|
-
const anyMatch = filter.tags.some((t) => capTags.has(t));
|
|
90
|
-
if (!anyMatch)
|
|
91
|
-
return false;
|
|
92
|
-
}
|
|
93
|
-
return true;
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
exports.ManifestCache = ManifestCache;
|
|
98
|
-
exports.applyFilter = applyFilter;
|
|
99
|
-
exports.filterToCacheKey = filterToCacheKey;
|
|
100
|
-
//# sourceMappingURL=toolManifest.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"toolManifest.cjs","sources":["../../../src/utils/toolManifest.ts"],"sourcesContent":["/**\n * Tool manifest cache.\n *\n * Providers fetch a manifest at init and potentially on refresh. This\n * utility provides a minimal TTL cache so repeated fetchManifest() calls\n * don't hammer the backing server.\n *\n * Caching is opt-in — providers that want fresh data every time (e.g.,\n * MCP with dynamic tool lists) can skip this entirely.\n */\n\nimport type { Capability, CapabilityFilter } from '@/providers/types';\n\n/** Entry in the manifest cache. */\ninterface CacheEntry {\n expiresAt: number;\n capabilities: Capability[];\n}\n\nexport interface ManifestCacheConfig {\n /** Time-to-live in milliseconds. 0 disables caching. Defaults to 60_000 (1 min). */\n ttlMs?: number;\n}\n\n/**\n * Simple in-memory TTL cache for manifests, keyed by a caller-supplied\n * cache key (e.g., the filter hash or a fixed constant for unfiltered).\n *\n * Thread-safety: the cache uses a plain Map. Node's single-threaded event\n * loop makes this safe for typical use. Not safe across workers — each\n * worker keeps its own cache (fine, since manifests are small).\n */\nexport class ManifestCache {\n private readonly ttlMs: number;\n private readonly store = new Map<string, CacheEntry>();\n\n constructor(config: ManifestCacheConfig = {}) {\n this.ttlMs = config.ttlMs ?? 60_000;\n }\n\n /** Retrieve cached capabilities, or undefined on miss / expiry. */\n get(key: string): Capability[] | undefined {\n const entry = this.store.get(key);\n if (!entry) return undefined;\n if (entry.expiresAt < Date.now()) {\n this.store.delete(key);\n return undefined;\n }\n return entry.capabilities;\n }\n\n /** Insert or replace cached capabilities for the given key. */\n set(key: string, capabilities: Capability[]): void {\n if (this.ttlMs <= 0) return;\n this.store.set(key, {\n expiresAt: Date.now() + this.ttlMs,\n capabilities,\n });\n }\n\n /** Remove all cached entries. */\n clear(): void {\n this.store.clear();\n }\n\n /** For tests / diagnostics. */\n get size(): number {\n return this.store.size;\n }\n}\n\n/**\n * Build a deterministic cache key from a CapabilityFilter.\n *\n * Two identical filters always produce the same key. Providers use this\n * so `fetchManifest(filter)` and `fetchManifest(sameFilter)` hit the\n * same cache entry.\n */\nexport function filterToCacheKey(filter?: CapabilityFilter): string {\n if (!filter) return '__all__';\n const parts: string[] = [];\n if (filter.kind) parts.push(`kind=${filter.kind}`);\n if (filter.tags?.length)\n parts.push(`tags=${[...filter.tags].sort().join(',')}`);\n if (filter.names?.length)\n parts.push(`names=${[...filter.names].sort().join(',')}`);\n return parts.length ? parts.join('|') : '__all__';\n}\n\n/**\n * Apply a CapabilityFilter to a pre-fetched manifest. Used by providers\n * that fetch the full manifest once and filter in memory.\n */\nexport function applyFilter(\n capabilities: Capability[],\n filter?: CapabilityFilter\n): Capability[] {\n if (!filter) return capabilities;\n return capabilities.filter((cap) => {\n if (filter.kind && cap.kind !== filter.kind) return false;\n if (filter.names && !filter.names.includes(cap.name)) return false;\n if (filter.tags?.length) {\n const capTags = new Set(cap.metadata.tags ?? []);\n const anyMatch = filter.tags.some((t) => capTags.has(t));\n if (!anyMatch) return false;\n }\n return true;\n });\n}\n"],"names":[],"mappings":";;AAAA;;;;;;;;;AASG;AAeH;;;;;;;AAOG;MACU,aAAa,CAAA;AACP,IAAA,KAAK;AACL,IAAA,KAAK,GAAG,IAAI,GAAG,EAAsB;AAEtD,IAAA,WAAA,CAAY,SAA8B,EAAE,EAAA;QAC1C,I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ath — hierarchical invocation identity for nested multi-agent orchestration.
|
|
3
|
-
*
|
|
4
|
-
* A spawnPath is a slash-separated chain of spawnKeys from the root of the current
|
|
5
|
-
* agent invocation to the current spawn. The root agent has an empty spawnPath;
|
|
6
|
-
* each handoff/transfer/sequence that spawns a new subgraph appends a new spawnKey.
|
|
7
|
-
*
|
|
8
|
-
* Examples:
|
|
9
|
-
* "" → primary agent (no spawn)
|
|
10
|
-
* "call_abc" → first-level handoff child
|
|
11
|
-
* "call_abc/call_def" → grandchild (depth 2)
|
|
12
|
-
* "call_abc/call_def/call_ghi" → depth 3
|
|
13
|
-
*
|
|
14
|
-
* These utilities are the single source of truth for path manipulation across:
|
|
15
|
-
* - @illuma-ai/agents (MultiAgentGraph, HandoffRegistry, callbacks)
|
|
16
|
-
* - host api (initialize.js, callbacks.js, ExecutionTrace writes)
|
|
17
|
-
* - host client (subagent store, sidebar rendering)
|
|
18
|
-
*
|
|
19
|
-
* See docs/multi-agent-nesting-architecture.md for the full design.
|
|
20
|
-
*/
|
|
21
|
-
/** Separator between spawnKeys in a spawnPath. Chosen so that the path looks
|
|
22
|
-
* like a filesystem/URL path, which makes it easy to read in logs and traces. */
|
|
23
|
-
const SPAWN_PATH_SEP = '/';
|
|
24
|
-
/** Hard cap on nested multi-agent invocations. Prevents runaway recursion.
|
|
25
|
-
* Can be overridden at the host api layer via MULTI_AGENT_MAX_NESTING_DEPTH. */
|
|
26
|
-
const MAX_NESTING_DEPTH = 5;
|
|
27
|
-
/**
|
|
28
|
-
* Append a spawnKey to a parent spawnPath.
|
|
29
|
-
*
|
|
30
|
-
* @param parent - Parent spawnPath (may be undefined/null/empty for root)
|
|
31
|
-
* @param key - spawnKey to append
|
|
32
|
-
* @returns New spawnPath string
|
|
33
|
-
*/
|
|
34
|
-
function buildSpawnPath(parent, key) {
|
|
35
|
-
if (!key) {
|
|
36
|
-
throw new Error('[spawnPath] buildSpawnPath called with empty key');
|
|
37
|
-
}
|
|
38
|
-
if (parent == null || parent === '')
|
|
39
|
-
return key;
|
|
40
|
-
return `${parent}${SPAWN_PATH_SEP}${key}`;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Compute the depth of a spawnPath.
|
|
44
|
-
* Root (empty) → 0; single-segment → 1; etc.
|
|
45
|
-
*/
|
|
46
|
-
function spawnPathDepth(path) {
|
|
47
|
-
if (path == null || path === '')
|
|
48
|
-
return 0;
|
|
49
|
-
return path.split(SPAWN_PATH_SEP).filter(Boolean).length;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Return the parent spawnPath, or null if the input is already root.
|
|
53
|
-
*
|
|
54
|
-
* - parentSpawnPath("a/b/c") === "a/b"
|
|
55
|
-
* - parentSpawnPath("a") === ""
|
|
56
|
-
* - parentSpawnPath("") === null
|
|
57
|
-
*/
|
|
58
|
-
function parentSpawnPath(path) {
|
|
59
|
-
if (path == null || path === '')
|
|
60
|
-
return null;
|
|
61
|
-
const parts = path.split(SPAWN_PATH_SEP).filter(Boolean);
|
|
62
|
-
if (parts.length <= 1)
|
|
63
|
-
return '';
|
|
64
|
-
return parts.slice(0, -1).join(SPAWN_PATH_SEP);
|
|
65
|
-
}
|
|
66
|
-
/** Split a spawnPath into its constituent spawnKey segments. */
|
|
67
|
-
function spawnPathParts(path) {
|
|
68
|
-
if (path == null || path === '')
|
|
69
|
-
return [];
|
|
70
|
-
return path.split(SPAWN_PATH_SEP).filter(Boolean);
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Return the last spawnKey in a spawnPath (the "current" spawn).
|
|
74
|
-
* Returns null for root.
|
|
75
|
-
*/
|
|
76
|
-
function leafSpawnKey(path) {
|
|
77
|
-
const parts = spawnPathParts(path);
|
|
78
|
-
return parts.length === 0 ? null : parts[parts.length - 1];
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* True if `ancestor` is a strict ancestor of `descendant`. Root ("") is
|
|
82
|
-
* ancestor of everything except itself.
|
|
83
|
-
*/
|
|
84
|
-
function isAncestorSpawnPath(ancestor, descendant) {
|
|
85
|
-
const a = ancestor ?? '';
|
|
86
|
-
const d = descendant ?? '';
|
|
87
|
-
if (a === d)
|
|
88
|
-
return false;
|
|
89
|
-
if (a === '')
|
|
90
|
-
return d !== '';
|
|
91
|
-
return d.startsWith(a + SPAWN_PATH_SEP);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
export { MAX_NESTING_DEPTH, SPAWN_PATH_SEP, buildSpawnPath, isAncestorSpawnPath, leafSpawnKey, parentSpawnPath, spawnPathDepth, spawnPathParts };
|
|
95
|
-
//# sourceMappingURL=spawnPath.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"spawnPath.mjs","sources":["../../../src/common/spawnPath.ts"],"sourcesContent":["/**\n * spawnPath — hierarchical invocation identity for nested multi-agent orchestration.\n *\n * A spawnPath is a slash-separated chain of spawnKeys from the root of the current\n * agent invocation to the current spawn. The root agent has an empty spawnPath;\n * each handoff/transfer/sequence that spawns a new subgraph appends a new spawnKey.\n *\n * Examples:\n * \"\" → primary agent (no spawn)\n * \"call_abc\" → first-level handoff child\n * \"call_abc/call_def\" → grandchild (depth 2)\n * \"call_abc/call_def/call_ghi\" → depth 3\n *\n * These utilities are the single source of truth for path manipulation across:\n * - @illuma-ai/agents (MultiAgentGraph, HandoffRegistry, callbacks)\n * - host api (initialize.js, callbacks.js, ExecutionTrace writes)\n * - host client (subagent store, sidebar rendering)\n *\n * See docs/multi-agent-nesting-architecture.md for the full design.\n */\n\n/** Separator between spawnKeys in a spawnPath. Chosen so that the path looks\n * like a filesystem/URL path, which makes it easy to read in logs and traces. */\nexport const SPAWN_PATH_SEP = '/';\n\n/** Hard cap on nested multi-agent invocations. Prevents runaway recursion.\n * Can be overridden at the host api layer via MULTI_AGENT_MAX_NESTING_DEPTH. */\nexport const MAX_NESTING_DEPTH = 5;\n\n/**\n * Append a spawnKey to a parent spawnPath.\n *\n * @param parent - Parent spawnPath (may be undefined/null/empty for root)\n * @param key - spawnKey to append\n * @returns New spawnPath string\n */\nexport function buildSpawnPath(\n parent: string | undefined | null,\n key: string\n): string {\n if (!key) {\n throw new Error('[spawnPath] buildSpawnPath called with empty key');\n }\n if (parent == null || parent === '') return key;\n return `${parent}${SPAWN_PATH_SEP}${key}`;\n}\n\n/**\n * Compute the depth of a spawnPath.\n * Root (empty) → 0; single-segment → 1; etc.\n */\nexport function spawnPathDepth(path: string | undefined | null): number {\n if (path == null || path === '') return 0;\n return path.split(SPAWN_PATH_SEP).filter(Boolean).length;\n}\n\n/**\n * Return the parent spawnPath, or null if the input is already root.\n *\n * - parentSpawnPath(\"a/b/c\") === \"a/b\"\n * - parentSpawnPath(\"a\") === \"\"\n * - parentSpawnPath(\"\") === null\n */\nexport function parentSpawnPath(\n path: string | undefined | null\n): string | null {\n if (path == null || path === '') return null;\n const parts = path.split(SPAWN_PATH_SEP).filter(Boolean);\n if (parts.length <= 1) return '';\n return parts.slice(0, -1).join(SPAWN_PATH_SEP);\n}\n\n/** Split a spawnPath into its constituent spawnKey segments. */\nexport function spawnPathParts(path: string | undefined | null): string[] {\n if (path == null || path === '') return [];\n return path.split(SPAWN_PATH_SEP).filter(Boolean);\n}\n\n/**\n * Return the last spawnKey in a spawnPath (the \"current\" spawn).\n * Returns null for root.\n */\nexport function leafSpawnKey(path: string | undefined | null): string | null {\n const parts = spawnPathParts(path);\n return parts.length === 0 ? null : parts[parts.length - 1];\n}\n\n/**\n * True if `ancestor` is a strict ancestor of `descendant`. Root (\"\") is\n * ancestor of everything except itself.\n */\nexport function isAncestorSpawnPath(\n ancestor: string | undefined | null,\n descendant: string | undefined | null\n): boolean {\n const a = ancestor ?? '';\n const d = descendant ?? '';\n if (a === d) return false;\n if (a === '') return d !== '';\n return d.startsWith(a + SPAWN_PATH_SEP);\n}\n"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;AAmBG;AAEH;AACiF;AAC1E,MAAM,cAAc,GAAG;AAE9B;AACgF;AACzE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AY,CAAC,IAA+B,EAAA;AAC1D,IAAA,MAAM,KAAK,GAAG,cAAc,CAAC,IAAI,CAAC;IAClC,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC,GAAG,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;AAC5D;AAEA;;;AAGG;AACG,SAAU,mBAAmB,CACjC,QAAmC,EACnC,UAAqC,EAAA;AAErC,IAAA,MAAM,CAAC,GAAG,QAAQ,IAAI,EAAE;AACxB,IAAA,MAAM,CAAC,GAAG,UAAU,IAAI,EAAE;IAC1B,IAAI,CAAC,KAAK,CAAC;AAAE,QAAA,OAAO,KAAK;IACzB,IAAI,CAAC,KAAK,EAAE;QAAE,OAAO,CAAC,KAAK,EAAE;IAC7B,OAAO,CAAC,CAAC,UAAU,CAAC,CAAC,GAAG,cAAc,CAAC;AACzC;;;;"}
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Registry for async handoff execution.
|
|
3
|
-
*
|
|
4
|
-
* Enables the autonomous orchestration pattern:
|
|
5
|
-
* 1. Orchestrator spawns children (non-blocking)
|
|
6
|
-
* 2. Orchestrator stays alive to reason, spawn more, or check status
|
|
7
|
-
* 3. Orchestrator collects results when ready
|
|
8
|
-
*
|
|
9
|
-
* Scoped per MultiAgentGraph instance — each orchestrator graph gets its own registry.
|
|
10
|
-
*/
|
|
11
|
-
class HandoffRegistry {
|
|
12
|
-
records = new Map();
|
|
13
|
-
/** Monotonically increasing counter for unique spawn IDs */
|
|
14
|
-
spawnCounter = 0;
|
|
15
|
-
/**
|
|
16
|
-
* Register a spawned handoff child.
|
|
17
|
-
* The promise runs in the background — not awaited here.
|
|
18
|
-
* Uses a unique key per spawn so the same agent can be spawned multiple times
|
|
19
|
-
* across rounds without overwriting prior records.
|
|
20
|
-
*/
|
|
21
|
-
spawn(params) {
|
|
22
|
-
// Unique internal key: agentId + counter to support multiple spawns of same agent.
|
|
23
|
-
// record.id stays as the agent identity so callers/observability can attribute
|
|
24
|
-
// results to the agent regardless of which spawn round they came from.
|
|
25
|
-
const spawnKey = `${params.id}__${this.spawnCounter++}`;
|
|
26
|
-
const record = {
|
|
27
|
-
id: params.id,
|
|
28
|
-
spawnKey,
|
|
29
|
-
name: params.name,
|
|
30
|
-
task: params.task,
|
|
31
|
-
spawnedAt: Date.now(),
|
|
32
|
-
status: 'running',
|
|
33
|
-
promise: params.promise,
|
|
34
|
-
};
|
|
35
|
-
// Wire up the promise to update the record on completion
|
|
36
|
-
params.promise
|
|
37
|
-
.then((result) => {
|
|
38
|
-
const resultText = params.extractResult(result.messages, params.id);
|
|
39
|
-
const truncated = params.truncateResult(resultText, params.maxResultChars);
|
|
40
|
-
record.status = 'completed';
|
|
41
|
-
record.resultText = truncated;
|
|
42
|
-
record.durationMs = Date.now() - record.spawnedAt;
|
|
43
|
-
record.resultMessageCount = result.messages.length;
|
|
44
|
-
params.onComplete?.(record);
|
|
45
|
-
})
|
|
46
|
-
.catch((err) => {
|
|
47
|
-
record.status = 'failed';
|
|
48
|
-
record.error = err instanceof Error ? err.message : String(err);
|
|
49
|
-
record.durationMs = Date.now() - record.spawnedAt;
|
|
50
|
-
params.onComplete?.(record);
|
|
51
|
-
});
|
|
52
|
-
this.records.set(spawnKey, record);
|
|
53
|
-
}
|
|
54
|
-
/** List all pending (running) handoffs */
|
|
55
|
-
listPending() {
|
|
56
|
-
return Array.from(this.records.values()).filter((r) => r.status === 'running');
|
|
57
|
-
}
|
|
58
|
-
/** List all completed handoffs (not yet collected) */
|
|
59
|
-
listCompleted() {
|
|
60
|
-
return Array.from(this.records.values()).filter((r) => r.status === 'completed' || r.status === 'failed');
|
|
61
|
-
}
|
|
62
|
-
/** List all handoffs regardless of status */
|
|
63
|
-
listAll() {
|
|
64
|
-
return Array.from(this.records.values());
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Get a handoff record by either its unique spawnKey or by agentId.
|
|
68
|
-
* - Exact spawnKey match wins (O(1)).
|
|
69
|
-
* - Falls back to the most recently spawned record for that agentId — matching
|
|
70
|
-
* lookups by callers that only know the agent identity, not the spawn round.
|
|
71
|
-
*/
|
|
72
|
-
get(idOrSpawnKey) {
|
|
73
|
-
const direct = this.records.get(idOrSpawnKey);
|
|
74
|
-
if (direct)
|
|
75
|
-
return direct;
|
|
76
|
-
let latest;
|
|
77
|
-
for (const record of this.records.values()) {
|
|
78
|
-
if (record.id !== idOrSpawnKey)
|
|
79
|
-
continue;
|
|
80
|
-
if (!latest || record.spawnedAt >= latest.spawnedAt)
|
|
81
|
-
latest = record;
|
|
82
|
-
}
|
|
83
|
-
return latest;
|
|
84
|
-
}
|
|
85
|
-
/** Check if any handoffs are still running */
|
|
86
|
-
hasPending() {
|
|
87
|
-
return this.listPending().length > 0;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Wait for ALL pending handoffs to complete and return all records.
|
|
91
|
-
* Records are NOT auto-cleared — caller removes collected records via remove().
|
|
92
|
-
*/
|
|
93
|
-
async waitForAll() {
|
|
94
|
-
const pending = this.listPending();
|
|
95
|
-
if (pending.length > 0) {
|
|
96
|
-
await Promise.allSettled(pending.map((r) => r.promise));
|
|
97
|
-
}
|
|
98
|
-
const results = this.listAll();
|
|
99
|
-
return results;
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Wait for ANY pending handoff to complete.
|
|
103
|
-
* Returns the newly completed record(s).
|
|
104
|
-
*/
|
|
105
|
-
async waitForAny() {
|
|
106
|
-
const pending = this.listPending();
|
|
107
|
-
if (pending.length === 0) {
|
|
108
|
-
return this.listCompleted();
|
|
109
|
-
}
|
|
110
|
-
// Race all pending promises — at least one will resolve
|
|
111
|
-
await Promise.race(pending.map((r) => r.promise.then(() => r).catch(() => r)));
|
|
112
|
-
// Small yield to let promise handlers update records
|
|
113
|
-
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
114
|
-
return this.listCompleted();
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Remove record(s) by spawnKey or agentId.
|
|
118
|
-
* - Exact spawnKey match removes only that record.
|
|
119
|
-
* - agentId match removes ALL records for that agent (covers callers that
|
|
120
|
-
* want to forget everything tied to a given agent).
|
|
121
|
-
*/
|
|
122
|
-
remove(idOrSpawnKey) {
|
|
123
|
-
if (this.records.delete(idOrSpawnKey))
|
|
124
|
-
return;
|
|
125
|
-
for (const [key, record] of this.records) {
|
|
126
|
-
if (record.id === idOrSpawnKey)
|
|
127
|
-
this.records.delete(key);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
/** Clear all records (for cleanup between graph invocations) */
|
|
131
|
-
clear() {
|
|
132
|
-
this.records.clear();
|
|
133
|
-
}
|
|
134
|
-
/** Number of total tracked handoffs */
|
|
135
|
-
get size() {
|
|
136
|
-
return this.records.size;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
export { HandoffRegistry };
|
|
141
|
-
//# sourceMappingURL=HandoffRegistry.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HandoffRegistry.mjs","sources":["../../../src/graphs/HandoffRegistry.ts"],"sourcesContent":["import type { BaseMessage } from '@langchain/core/messages';\nimport type * as t from '@/types';\n\n/**\n * Tracks the lifecycle of a spawned handoff child agent.\n */\nexport type HandoffRecord = {\n /** Agent identity (destination agentId) — stable across multiple spawns of the same agent */\n id: string;\n /** Unique internal key for this specific spawn (agentId + monotonic counter) */\n spawnKey: string;\n /** Display name of the child agent */\n name: string;\n /** Task description / instructions passed to child */\n task: string;\n /** When the handoff was spawned */\n spawnedAt: number;\n /** Current status */\n status: 'pending' | 'running' | 'completed' | 'failed';\n /** The background promise executing the child subgraph */\n promise: Promise<t.BaseGraphState>;\n /** Resolved result text (populated on completion) */\n resultText?: string;\n /** Error message (populated on failure) */\n error?: string;\n /** Duration in ms (populated on completion/failure) */\n durationMs?: number;\n /** Number of messages in child's output */\n resultMessageCount?: number;\n};\n\n/**\n * Registry for async handoff execution.\n *\n * Enables the autonomous orchestration pattern:\n * 1. Orchestrator spawns children (non-blocking)\n * 2. Orchestrator stays alive to reason, spawn more, or check status\n * 3. Orchestrator collects results when ready\n *\n * Scoped per MultiAgentGraph instance — each orchestrator graph gets its own registry.\n */\nexport class HandoffRegistry {\n private records: Map<string, HandoffRecord> = new Map();\n /** Monotonically increasing counter for unique spawn IDs */\n private spawnCounter = 0;\n\n /**\n * Register a spawned handoff child.\n * The promise runs in the background — not awaited here.\n * Uses a unique key per spawn so the same agent can be spawned multiple times\n * across rounds without overwriting prior records.\n */\n spawn(params: {\n id: string;\n name: string;\n task: string;\n promise: Promise<t.BaseGraphState>;\n extractResult: (messages: BaseMessage[], agentId: string) => string;\n truncateResult: (text: string, maxChars: number) => string;\n maxResultChars: number;\n /** Callback when child completes (for SSE events) */\n onComplete?: (record: HandoffRecord) => void;\n }): void {\n // Unique internal key: agentId + counter to support multiple spawns of same agent.\n // record.id stays as the agent identity so callers/observability can attribute\n // results to the agent regardless of which spawn round they came from.\n const spawnKey = `${params.id}__${this.spawnCounter++}`;\n const record: HandoffRecord = {\n id: params.id,\n spawnKey,\n name: params.name,\n task: params.task,\n spawnedAt: Date.now(),\n status: 'running',\n promise: params.promise,\n };\n\n // Wire up the promise to update the record on completion\n params.promise\n .then((result) => {\n const resultText = params.extractResult(result.messages, params.id);\n const truncated = params.truncateResult(\n resultText,\n params.maxResultChars\n );\n record.status = 'completed';\n record.resultText = truncated;\n record.durationMs = Date.now() - record.spawnedAt;\n record.resultMessageCount = result.messages.length;\n params.onComplete?.(record);\n })\n .catch((err) => {\n record.status = 'failed';\n record.error = err instanceof Error ? err.message : String(err);\n record.durationMs = Date.now() - record.spawnedAt;\n params.onComplete?.(record);\n });\n\n this.records.set(spawnKey, record);\n }\n\n /** List all pending (running) handoffs */\n listPending(): HandoffRecord[] {\n return Array.from(this.records.values()).filter(\n (r) => r.status === 'running'\n );\n }\n\n /** List all completed handoffs (not yet collected) */\n listCompleted(): HandoffRecord[] {\n return Array.from(this.records.values()).filter(\n (r) => r.status === 'completed' || r.status === 'failed'\n );\n }\n\n /** List all handoffs regardless of status */\n listAll(): HandoffRecord[] {\n return Array.from(this.records.values());\n }\n\n /**\n * Get a handoff record by either its unique spawnKey or by agentId.\n * - Exact spawnKey match wins (O(1)).\n * - Falls back to the most recently spawned record for that agentId — matching\n * lookups by callers that only know the agent identity, not the spawn round.\n */\n get(idOrSpawnKey: string): HandoffRecord | undefined {\n const direct = this.records.get(idOrSpawnKey);\n if (direct) return direct;\n let latest: HandoffRecord | undefined;\n for (const record of this.records.values()) {\n if (record.id !== idOrSpawnKey) continue;\n if (!latest || record.spawnedAt >= latest.spawnedAt) latest = record;\n }\n return latest;\n }\n\n /** Check if any handoffs are still running */\n hasPending(): boolean {\n return this.listPending().length > 0;\n }\n\n /**\n * Wait for ALL pending handoffs to complete and return all records.\n * Records are NOT auto-cleared — caller removes collected records via remove().\n */\n async waitForAll(): Promise<HandoffRecord[]> {\n const pending = this.listPending();\n if (pending.length > 0) {\n await Promise.allSettled(pending.map((r) => r.promise));\n }\n const results = this.listAll();\n return results;\n }\n\n /**\n * Wait for ANY pending handoff to complete.\n * Returns the newly completed record(s).\n */\n async waitForAny(): Promise<HandoffRecord[]> {\n const pending = this.listPending();\n if (pending.length === 0) {\n return this.listCompleted();\n }\n\n // Race all pending promises — at least one will resolve\n await Promise.race(\n pending.map((r) => r.promise.then(() => r).catch(() => r))\n );\n\n // Small yield to let promise handlers update records\n await new Promise((resolve) => setTimeout(resolve, 0));\n\n return this.listCompleted();\n }\n\n /**\n * Remove record(s) by spawnKey or agentId.\n * - Exact spawnKey match removes only that record.\n * - agentId match removes ALL records for that agent (covers callers that\n * want to forget everything tied to a given agent).\n */\n remove(idOrSpawnKey: string): void {\n if (this.records.delete(idOrSpawnKey)) return;\n for (const [key, record] of this.records) {\n if (record.id === idOrSpawnKey) this.records.delete(key);\n }\n }\n\n /** Clear all records (for cleanup between graph invocations) */\n clear(): void {\n this.records.clear();\n }\n\n /** Number of total tracked handoffs */\n get size(): number {\n return this.records.size;\n }\n}\n"],"names":[],"mappings":"AA+BA;;;;;;;;;AASG;MACU,eAAe,CAAA;AAClB,IAAA,OAAO,GAA+B,IAAI,GAAG,EAAE;;IAE/C,YAAY,GAAG,CAAC;AAExB;;;;;AAKG;AACH,IAAA,KAAK,CAAC,MAUL,EAAA;;;;AAIC,QAAA,MAAM,QAAQ,GAAG,CAAA,EAAG,MAAM,CAAC,EAAE,CAAA,EAAA,EAAK,IAAI,CAAC,YAAY,EAAE,CAAA,CAAE;AACvD,QAAA,MAAM,MAAM,GAAkB;YAC5B,EAAE,EAAE,MAAM,CAAC,EAAE;YACb,QAAQ;YACR,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,IAAI,EAAE,MAAM,CAAC,IAAI;AACjB,YAAA,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;AACrB,YAAA,MAAM,EAAE,SAAS;YACjB,OAAO,EAAE,MAAM,CAAC,OAAO;SACxB;;AAGD,QAAA,MAAM,CAAC;AACJ,aAAA,IAAI,CAAC,CAAC,MAAM,KAAI;AACf,YAAA,MAAM,UAAU,GAAG,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,CAAC;AACnE,YAAA,MAAM,SAAS,GAAG,MAAM,CAAC,cAAc,CACrC,UAAU,EACV,MAAM,CAAC,cAAc,CACtB;AACD,YAAA,MAAM,CAAC,MAAM,GAAG,WAAW;AAC3B,YAAA,MAAM,CAAC,UAAU,GAAG,SAAS;YAC7B,MAAM,CAAC,UAAU,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,MAAM,CAAC,SAAS;YACjD,MAAM,CAAC,kBAAkB,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM;AAClD,YAAA,MAAM,CAAC,UAAU,GAAG,MAAM,CAAC;AAC7B,QAAA,CAAC;AACA,aAAA,KAAK,CAAC,CAAC,GAAG,KAAI;AACb,Y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