@illuma-ai/agents 1.4.0-alpha.6 → 1.5.1
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/graphs/phases/memoryFlushPhase.cjs +1 -1
- package/dist/cjs/graphs/phases/memoryFlushPhase.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 +1 -4
- 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/memory/citations.cjs +4 -4
- package/dist/cjs/memory/citations.cjs.map +1 -1
- package/dist/cjs/memory/constants.cjs +17 -17
- package/dist/cjs/memory/constants.cjs.map +1 -1
- package/dist/cjs/memory/mmr.cjs +1 -1
- package/dist/cjs/memory/mmr.cjs.map +1 -1
- package/dist/cjs/memory/paths.cjs +1 -1
- package/dist/cjs/memory/paths.cjs.map +1 -1
- package/dist/cjs/memory/recallTracking.cjs +3 -3
- package/dist/cjs/memory/recallTracking.cjs.map +1 -1
- package/dist/cjs/memory/temporalDecay.cjs +2 -2
- package/dist/cjs/memory/temporalDecay.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 +45 -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/memory/memoryAppendTool.cjs +1 -1
- package/dist/cjs/tools/memory/memoryAppendTool.cjs.map +1 -1
- package/dist/cjs/tools/memory/memoryGetTool.cjs +2 -2
- package/dist/cjs/tools/memory/memoryGetTool.cjs.map +1 -1
- package/dist/cjs/tools/memory/memorySearchTool.cjs +3 -3
- package/dist/cjs/tools/memory/memorySearchTool.cjs.map +1 -1
- package/dist/cjs/tools/memory/shared.cjs +1 -1
- package/dist/cjs/tools/memory/shared.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 +54 -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/graphs/phases/memoryFlushPhase.mjs +1 -1
- package/dist/esm/graphs/phases/memoryFlushPhase.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 +1 -4
- 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/memory/citations.mjs +4 -4
- package/dist/esm/memory/citations.mjs.map +1 -1
- package/dist/esm/memory/constants.mjs +17 -17
- package/dist/esm/memory/constants.mjs.map +1 -1
- package/dist/esm/memory/mmr.mjs +1 -1
- package/dist/esm/memory/mmr.mjs.map +1 -1
- package/dist/esm/memory/paths.mjs +1 -1
- package/dist/esm/memory/paths.mjs.map +1 -1
- package/dist/esm/memory/recallTracking.mjs +3 -3
- package/dist/esm/memory/recallTracking.mjs.map +1 -1
- package/dist/esm/memory/temporalDecay.mjs +2 -2
- package/dist/esm/memory/temporalDecay.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 +45 -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/memory/memoryAppendTool.mjs +1 -1
- package/dist/esm/tools/memory/memoryAppendTool.mjs.map +1 -1
- package/dist/esm/tools/memory/memoryGetTool.mjs +2 -2
- package/dist/esm/tools/memory/memoryGetTool.mjs.map +1 -1
- package/dist/esm/tools/memory/memorySearchTool.mjs +3 -3
- package/dist/esm/tools/memory/memorySearchTool.mjs.map +1 -1
- package/dist/esm/tools/memory/shared.mjs +1 -1
- package/dist/esm/tools/memory/shared.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 +52 -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/graphs/phases/memoryFlushPhase.d.ts +2 -2
- 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/llm/openai/index.d.ts +1 -1
- package/dist/types/memory/citations.d.ts +4 -4
- package/dist/types/memory/constants.d.ts +17 -17
- package/dist/types/memory/mmr.d.ts +3 -3
- package/dist/types/memory/paths.d.ts +1 -1
- package/dist/types/memory/temporalDecay.d.ts +2 -2
- package/dist/types/memory/types.d.ts +3 -3
- 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/memory/shared.d.ts +1 -1
- 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 +71 -0
- package/dist/types/types/graph.d.ts +163 -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.ts +321 -78
- package/src/agents/__tests__/AgentContext.cacheTtl.live.test.ts +259 -0
- package/src/agents/__tests__/AgentContext.crossAgentTier1.live.test.ts +266 -0
- package/src/agents/__tests__/AgentContext.crossUserCache.live.test.ts +342 -0
- package/src/agents/__tests__/AgentContext.test.ts +632 -0
- package/src/common/__tests__/enum.test.ts +7 -17
- package/src/common/enum.ts +43 -12
- package/src/common/index.ts +0 -1
- package/src/graphs/Graph.ts +222 -2
- package/src/graphs/MultiAgentGraph.ts +154 -1466
- package/src/graphs/__tests__/MultiAgentGraph.test.ts +91 -0
- package/src/graphs/gapFeatures.test.ts +1 -1
- package/src/graphs/index.ts +0 -1
- package/src/graphs/phases/__tests__/memoryFlushPhase.test.ts +1 -1
- package/src/graphs/phases/memoryFlushPhase.ts +2 -2
- 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.ts +15 -24
- 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/utils/message_inputs.ts +10 -1
- package/src/llm/anthropic/utils/server-tool-inputs.test.ts +436 -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.ts +116 -41
- package/src/llm/openai/index.ts +2 -2
- package/src/llm/openai/utils/index.ts +31 -14
- package/src/memory/citations.ts +4 -4
- package/src/memory/constants.ts +17 -17
- package/src/memory/mmr.ts +3 -3
- package/src/memory/paths.ts +1 -1
- package/src/memory/recallTracking.ts +3 -3
- package/src/memory/temporalDecay.ts +2 -2
- package/src/memory/types.ts +3 -3
- package/src/messages/__tests__/contextPruning.test.ts +228 -0
- package/src/messages/cache.test.ts +62 -24
- package/src/messages/cache.ts +112 -0
- package/src/messages/contextPruning.ts +191 -0
- package/src/messages/contextPruningSettings.ts +90 -0
- package/src/messages/ensureThinkingBlock.test.ts +1 -1
- package/src/messages/format.ts +164 -12
- package/src/messages/formatAgentMessages.skills.test.ts +413 -0
- package/src/messages/formatAgentMessages.test.ts +1 -1
- package/src/messages/index.ts +2 -0
- package/src/messages/prune.ts +661 -4
- package/src/run.ts +155 -1
- package/src/scripts/multi-agent-chain.ts +2 -2
- package/src/scripts/multi-agent-document-review-chain.ts +2 -2
- package/src/scripts/multi-agent-hybrid-flow.ts +4 -4
- package/src/scripts/multi-agent-parallel.ts +3 -3
- package/src/scripts/multi-agent-sequence.ts +3 -3
- package/src/scripts/multi-agent-subagent.ts +246 -0
- package/src/scripts/multi-agent-supervisor.ts +5 -5
- package/src/scripts/poc-multi-agent-comprehensive.ts +8 -8
- package/src/scripts/sequential-full-metadata-test.ts +2 -2
- 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.ts +3 -3
- package/src/scripts/test-handoff-input.ts +1 -1
- package/src/scripts/test-handoff-steering.ts +3 -3
- package/src/scripts/test-multi-agent-list-handoff.ts +1 -1
- package/src/scripts/test-parallel-agent-labeling.ts +3 -3
- package/src/scripts/test-parallel-handoffs.ts +2 -2
- package/src/scripts/test-thinking-handoff-bedrock.ts +1 -1
- package/src/scripts/test-thinking-handoff.ts +1 -1
- package/src/scripts/test-thinking-to-thinking-handoff-bedrock.ts +1 -1
- package/src/scripts/test-tool-before-handoff-role-order.ts +1 -1
- package/src/scripts/test-tools-before-handoff.ts +1 -1
- package/src/specs/agent-handoffs.test.ts +26 -483
- package/src/specs/anthropic.simple.test.ts +61 -0
- package/src/specs/multi-agent-summarization.test.ts +396 -0
- package/src/specs/prune.orphans.test.ts +248 -0
- package/src/specs/prune.test.ts +104 -16
- package/src/specs/thinking-handoff.test.ts +19 -19
- package/src/tools/BashExecutor.ts +281 -0
- package/src/tools/BashProgrammaticToolCalling.ts +397 -0
- package/src/tools/CodeExecutor.ts +63 -54
- package/src/tools/ProgrammaticToolCalling.ts +29 -14
- package/src/tools/ReadFile.ts +39 -0
- package/src/tools/SkillTool.ts +46 -0
- package/src/tools/SubagentTool.ts +100 -0
- package/src/tools/ToolNode.ts +548 -26
- package/src/tools/__tests__/BashExecutor.test.ts +49 -0
- package/src/tools/__tests__/CodeExecutor.test.ts +37 -36
- 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__/SubagentExecutor.test.ts +1148 -0
- package/src/tools/__tests__/SubagentTool.test.ts +149 -0
- package/src/tools/__tests__/ToolNode.outputReferences.test.ts +1438 -0
- package/src/tools/__tests__/annotateMessagesForLLM.test.ts +479 -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/memory/memoryAppendTool.ts +1 -1
- package/src/tools/memory/memoryGetTool.ts +2 -2
- package/src/tools/memory/memorySearchTool.ts +3 -3
- package/src/tools/memory/shared.ts +1 -1
- package/src/tools/search/search.ts +12 -2
- 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/tool.ts +36 -2
- package/src/tools/search/types.ts +133 -8
- 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 +74 -0
- package/src/types/graph.ts +172 -20
- package/src/types/index.ts +3 -0
- package/src/types/messages.ts +27 -0
- package/src/types/run.ts +22 -0
- package/src/types/skill.ts +11 -0
- package/src/types/tools.ts +118 -0
- package/src/utils/__tests__/truncation.test.ts +66 -0
- package/src/utils/index.ts +1 -3
- 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/tools/search/test.d.ts +0 -1
- 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/tools/search/output.md +0 -2775
- package/src/tools/search/test.html +0 -884
- package/src/tools/search/test.md +0 -643
- package/src/tools/search/test.ts +0 -159
- 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
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
import type { BaseMessage } from '@langchain/core/messages';
|
|
2
|
+
/**
|
|
3
|
+
* Closed set of hook lifecycle events supported by the hooks system.
|
|
4
|
+
*
|
|
5
|
+
* These mirror the subset of Claude Code's event surface that makes sense
|
|
6
|
+
* for a library context (no filesystem/CLI-specific events). See
|
|
7
|
+
* `docs/hooks-design-report.md` §3.2 for the mapping to existing
|
|
8
|
+
* `@illuma-ai/agents` emission points.
|
|
9
|
+
*/
|
|
10
|
+
export declare const HOOK_EVENTS: readonly ["RunStart", "UserPromptSubmit", "PreToolUse", "PostToolUse", "PostToolUseFailure", "PermissionDenied", "SubagentStart", "SubagentStop", "Stop", "StopFailure", "PreCompact", "PostCompact"];
|
|
11
|
+
export type HookEvent = (typeof HOOK_EVENTS)[number];
|
|
12
|
+
/** Tool-gating decision; executeHooks folds with `deny > ask > allow` precedence. */
|
|
13
|
+
export type ToolDecision = 'allow' | 'deny' | 'ask';
|
|
14
|
+
/** Stop-loop decision; `block` means "do not stop, run another turn". Any `block` wins. */
|
|
15
|
+
export type StopDecision = 'continue' | 'block';
|
|
16
|
+
/**
|
|
17
|
+
* Fields shared by every `HookInput`. Discriminated by `hook_event_name`.
|
|
18
|
+
*
|
|
19
|
+
* - `runId` identifies the current agent run and is always present.
|
|
20
|
+
* - `threadId` identifies the conversation thread when the host has one.
|
|
21
|
+
* - `agentId` is only set when the hook fires inside a subagent scope.
|
|
22
|
+
*/
|
|
23
|
+
export interface BaseHookInput {
|
|
24
|
+
runId: string;
|
|
25
|
+
threadId?: string;
|
|
26
|
+
agentId?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface RunStartHookInput extends BaseHookInput {
|
|
29
|
+
hook_event_name: 'RunStart';
|
|
30
|
+
messages: BaseMessage[];
|
|
31
|
+
}
|
|
32
|
+
export interface UserPromptSubmitHookInput extends BaseHookInput {
|
|
33
|
+
hook_event_name: 'UserPromptSubmit';
|
|
34
|
+
prompt: string;
|
|
35
|
+
attachments?: BaseMessage[];
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Fires before a tool is invoked. Hook may return `deny`/`ask`/`allow` and/or
|
|
39
|
+
* an `updatedInput` that replaces the tool arguments before invocation.
|
|
40
|
+
*
|
|
41
|
+
* `toolInput` is intentionally typed as `Record<string, unknown>` because the
|
|
42
|
+
* SDK is tool-agnostic — concrete tool argument shapes are only known at the
|
|
43
|
+
* call site and are narrowed by the host. This is the one escape hatch in
|
|
44
|
+
* the hook type system.
|
|
45
|
+
*/
|
|
46
|
+
export interface PreToolUseHookInput extends BaseHookInput {
|
|
47
|
+
hook_event_name: 'PreToolUse';
|
|
48
|
+
toolName: string;
|
|
49
|
+
toolInput: Record<string, unknown>;
|
|
50
|
+
toolUseId: string;
|
|
51
|
+
stepId?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Number of times this tool has been invoked in prior batches within the
|
|
54
|
+
* current run. Within a single batch of parallel calls, all calls to the
|
|
55
|
+
* same tool share the same turn value — per-call discrimination within a
|
|
56
|
+
* batch is not supported in v1.
|
|
57
|
+
*/
|
|
58
|
+
turn?: number;
|
|
59
|
+
}
|
|
60
|
+
export interface PostToolUseHookInput extends BaseHookInput {
|
|
61
|
+
hook_event_name: 'PostToolUse';
|
|
62
|
+
toolName: string;
|
|
63
|
+
toolInput: Record<string, unknown>;
|
|
64
|
+
toolOutput: unknown;
|
|
65
|
+
toolUseId: string;
|
|
66
|
+
stepId?: string;
|
|
67
|
+
turn?: number;
|
|
68
|
+
}
|
|
69
|
+
export interface PostToolUseFailureHookInput extends BaseHookInput {
|
|
70
|
+
hook_event_name: 'PostToolUseFailure';
|
|
71
|
+
toolName: string;
|
|
72
|
+
toolInput: Record<string, unknown>;
|
|
73
|
+
toolUseId: string;
|
|
74
|
+
error: string;
|
|
75
|
+
stepId?: string;
|
|
76
|
+
turn?: number;
|
|
77
|
+
}
|
|
78
|
+
export interface PermissionDeniedHookInput extends BaseHookInput {
|
|
79
|
+
hook_event_name: 'PermissionDenied';
|
|
80
|
+
toolName: string;
|
|
81
|
+
toolInput: Record<string, unknown>;
|
|
82
|
+
toolUseId: string;
|
|
83
|
+
reason: string;
|
|
84
|
+
}
|
|
85
|
+
export interface SubagentStartHookInput extends BaseHookInput {
|
|
86
|
+
hook_event_name: 'SubagentStart';
|
|
87
|
+
parentAgentId?: string;
|
|
88
|
+
agentId: string;
|
|
89
|
+
agentType: string;
|
|
90
|
+
inputs: BaseMessage[];
|
|
91
|
+
}
|
|
92
|
+
export interface SubagentStopHookInput extends BaseHookInput {
|
|
93
|
+
hook_event_name: 'SubagentStop';
|
|
94
|
+
agentId: string;
|
|
95
|
+
agentType: string;
|
|
96
|
+
messages: BaseMessage[];
|
|
97
|
+
}
|
|
98
|
+
export interface StopHookInput extends BaseHookInput {
|
|
99
|
+
hook_event_name: 'Stop';
|
|
100
|
+
messages: BaseMessage[];
|
|
101
|
+
stopReason?: string;
|
|
102
|
+
stopHookActive: boolean;
|
|
103
|
+
}
|
|
104
|
+
export interface StopFailureHookInput extends BaseHookInput {
|
|
105
|
+
hook_event_name: 'StopFailure';
|
|
106
|
+
error: string;
|
|
107
|
+
lastAssistantMessage?: BaseMessage;
|
|
108
|
+
}
|
|
109
|
+
export interface PreCompactHookInput extends BaseHookInput {
|
|
110
|
+
hook_event_name: 'PreCompact';
|
|
111
|
+
messagesBeforeCount: number;
|
|
112
|
+
/**
|
|
113
|
+
* What triggered compaction. Matches `SummarizationTrigger.type` from the
|
|
114
|
+
* agent's summarization config. `'default'` means no trigger was
|
|
115
|
+
* configured and compaction fired because messages were pruned.
|
|
116
|
+
*/
|
|
117
|
+
trigger: 'token_ratio' | 'remaining_tokens' | 'messages_to_refine' | 'default' | (string & {});
|
|
118
|
+
}
|
|
119
|
+
export interface PostCompactHookInput extends BaseHookInput {
|
|
120
|
+
hook_event_name: 'PostCompact';
|
|
121
|
+
summary: string;
|
|
122
|
+
/**
|
|
123
|
+
* Number of messages remaining after compaction. The summarize node
|
|
124
|
+
* returns a `removeAll` signal that clears all messages from state;
|
|
125
|
+
* the summary itself is injected into the system prompt, not as a
|
|
126
|
+
* message. This is `0` at the point of hook dispatch.
|
|
127
|
+
*/
|
|
128
|
+
messagesAfterCount: number;
|
|
129
|
+
}
|
|
130
|
+
/** Discriminated union of every hook input shape. */
|
|
131
|
+
export type HookInput = RunStartHookInput | UserPromptSubmitHookInput | PreToolUseHookInput | PostToolUseHookInput | PostToolUseFailureHookInput | PermissionDeniedHookInput | SubagentStartHookInput | SubagentStopHookInput | StopHookInput | StopFailureHookInput | PreCompactHookInput | PostCompactHookInput;
|
|
132
|
+
/** Compile-time map from event name to its input shape. */
|
|
133
|
+
export type HookInputByEvent = {
|
|
134
|
+
RunStart: RunStartHookInput;
|
|
135
|
+
UserPromptSubmit: UserPromptSubmitHookInput;
|
|
136
|
+
PreToolUse: PreToolUseHookInput;
|
|
137
|
+
PostToolUse: PostToolUseHookInput;
|
|
138
|
+
PostToolUseFailure: PostToolUseFailureHookInput;
|
|
139
|
+
PermissionDenied: PermissionDeniedHookInput;
|
|
140
|
+
SubagentStart: SubagentStartHookInput;
|
|
141
|
+
SubagentStop: SubagentStopHookInput;
|
|
142
|
+
Stop: StopHookInput;
|
|
143
|
+
StopFailure: StopFailureHookInput;
|
|
144
|
+
PreCompact: PreCompactHookInput;
|
|
145
|
+
PostCompact: PostCompactHookInput;
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* Fields common to every hook output. Hooks that have nothing to say simply
|
|
149
|
+
* return `{}` (or omit the fields below).
|
|
150
|
+
*/
|
|
151
|
+
export interface BaseHookOutput {
|
|
152
|
+
/** Context string to inject into the conversation. Accumulated across hooks. */
|
|
153
|
+
additionalContext?: string;
|
|
154
|
+
/** True to prevent the next model turn. Any hook can set this. */
|
|
155
|
+
preventContinuation?: boolean;
|
|
156
|
+
/** Reason reported alongside `preventContinuation`. */
|
|
157
|
+
stopReason?: string;
|
|
158
|
+
}
|
|
159
|
+
export type RunStartHookOutput = BaseHookOutput;
|
|
160
|
+
export interface UserPromptSubmitHookOutput extends BaseHookOutput {
|
|
161
|
+
decision?: ToolDecision;
|
|
162
|
+
reason?: string;
|
|
163
|
+
}
|
|
164
|
+
export interface PreToolUseHookOutput extends BaseHookOutput {
|
|
165
|
+
decision?: ToolDecision;
|
|
166
|
+
reason?: string;
|
|
167
|
+
/**
|
|
168
|
+
* Replacement tool input. Merged into the pending tool call by the host.
|
|
169
|
+
*
|
|
170
|
+
* When multiple hooks set `updatedInput` within a single `executeHooks`
|
|
171
|
+
* call, the last writer in registration order wins (outer loop: matcher
|
|
172
|
+
* registration order; inner loop: hook position within the matcher). The
|
|
173
|
+
* winner is deterministic — `Promise.all` preserves input-array order.
|
|
174
|
+
* Consumers that need a single authoritative rewrite should still scope
|
|
175
|
+
* `updatedInput` to one hook per matcher to avoid confusing precedence.
|
|
176
|
+
*/
|
|
177
|
+
updatedInput?: Record<string, unknown>;
|
|
178
|
+
}
|
|
179
|
+
export interface PostToolUseHookOutput extends BaseHookOutput {
|
|
180
|
+
/**
|
|
181
|
+
* Replacement tool output. Flows through the aggregated result so the
|
|
182
|
+
* host can substitute it before appending the tool result message.
|
|
183
|
+
* Ordering semantics match `PreToolUseHookOutput.updatedInput`:
|
|
184
|
+
* last-writer-wins in registration order.
|
|
185
|
+
*/
|
|
186
|
+
updatedOutput?: unknown;
|
|
187
|
+
}
|
|
188
|
+
export type PostToolUseFailureHookOutput = BaseHookOutput;
|
|
189
|
+
export type PermissionDeniedHookOutput = BaseHookOutput;
|
|
190
|
+
export interface SubagentStartHookOutput extends BaseHookOutput {
|
|
191
|
+
decision?: ToolDecision;
|
|
192
|
+
reason?: string;
|
|
193
|
+
}
|
|
194
|
+
export type SubagentStopHookOutput = BaseHookOutput;
|
|
195
|
+
export interface StopHookOutput extends BaseHookOutput {
|
|
196
|
+
decision?: StopDecision;
|
|
197
|
+
reason?: string;
|
|
198
|
+
}
|
|
199
|
+
export type StopFailureHookOutput = BaseHookOutput;
|
|
200
|
+
export type PreCompactHookOutput = BaseHookOutput;
|
|
201
|
+
export type PostCompactHookOutput = BaseHookOutput;
|
|
202
|
+
/** Compile-time map from event name to its output shape. */
|
|
203
|
+
export type HookOutputByEvent = {
|
|
204
|
+
RunStart: RunStartHookOutput;
|
|
205
|
+
UserPromptSubmit: UserPromptSubmitHookOutput;
|
|
206
|
+
PreToolUse: PreToolUseHookOutput;
|
|
207
|
+
PostToolUse: PostToolUseHookOutput;
|
|
208
|
+
PostToolUseFailure: PostToolUseFailureHookOutput;
|
|
209
|
+
PermissionDenied: PermissionDeniedHookOutput;
|
|
210
|
+
SubagentStart: SubagentStartHookOutput;
|
|
211
|
+
SubagentStop: SubagentStopHookOutput;
|
|
212
|
+
Stop: StopHookOutput;
|
|
213
|
+
StopFailure: StopFailureHookOutput;
|
|
214
|
+
PreCompact: PreCompactHookOutput;
|
|
215
|
+
PostCompact: PostCompactHookOutput;
|
|
216
|
+
};
|
|
217
|
+
/** Superset output shape used by the executor's fold loop. */
|
|
218
|
+
export type HookOutput = RunStartHookOutput | UserPromptSubmitHookOutput | PreToolUseHookOutput | PostToolUseHookOutput | PostToolUseFailureHookOutput | PermissionDeniedHookOutput | SubagentStartHookOutput | SubagentStopHookOutput | StopHookOutput | StopFailureHookOutput | PreCompactHookOutput | PostCompactHookOutput;
|
|
219
|
+
/**
|
|
220
|
+
* A hook callback is a plain async function registered against a specific
|
|
221
|
+
* event. The `signal` is always supplied by `executeHooks` and combines the
|
|
222
|
+
* batch's parent signal with the per-hook timeout — callbacks that perform
|
|
223
|
+
* long-running work should observe it.
|
|
224
|
+
*/
|
|
225
|
+
export type HookCallback<E extends HookEvent = HookEvent> = (input: HookInputByEvent[E], signal: AbortSignal) => HookOutputByEvent[E] | Promise<HookOutputByEvent[E]>;
|
|
226
|
+
/**
|
|
227
|
+
* A matcher groups one or more callbacks under a shared regex filter and
|
|
228
|
+
* shared timeout/once/internal flags. The generic `E` ties the callback
|
|
229
|
+
* types to the event the matcher is registered against.
|
|
230
|
+
*/
|
|
231
|
+
export interface HookMatcher<E extends HookEvent = HookEvent> {
|
|
232
|
+
/**
|
|
233
|
+
* Regex pattern matched against the event's primary query string (e.g.
|
|
234
|
+
* the tool name for `PreToolUse`, the agent type for `SubagentStart`).
|
|
235
|
+
*
|
|
236
|
+
* Omitted or empty means "always match". For events that do not supply a
|
|
237
|
+
* query string (`RunStart`, `Stop`, etc.), only wildcard matchers fire —
|
|
238
|
+
* a non-empty pattern on such events will never match.
|
|
239
|
+
*
|
|
240
|
+
* Patterns are treated as trusted input: `executeHooks` compiles them
|
|
241
|
+
* with `new RegExp(pattern)` without any sandbox, and a pathological
|
|
242
|
+
* pattern can block the event loop. Host registration code is expected
|
|
243
|
+
* to validate or length-bound patterns that originate from user input.
|
|
244
|
+
*/
|
|
245
|
+
pattern?: string;
|
|
246
|
+
/** Callbacks that fire when the matcher hits. Executed in parallel. */
|
|
247
|
+
hooks: HookCallback<E>[];
|
|
248
|
+
/** Per-matcher timeout in ms. Defaults to the executor's batch timeout. */
|
|
249
|
+
timeout?: number;
|
|
250
|
+
/**
|
|
251
|
+
* Atomically remove the matcher before its first dispatch.
|
|
252
|
+
*
|
|
253
|
+
* `executeHooks` claims `once: true` matchers synchronously — between
|
|
254
|
+
* `getMatchers` and its first `await` — so two concurrent calls cannot
|
|
255
|
+
* both dispatch the same matcher. Whichever call runs its sync prefix
|
|
256
|
+
* first wins the matcher; the other sees an empty bucket.
|
|
257
|
+
*
|
|
258
|
+
* Semantics are "at most one dispatch, ever" — if every hook in the
|
|
259
|
+
* matcher throws, the matcher is still gone. Use `once` for
|
|
260
|
+
* fire-and-forget bootstrapping (registration, telemetry, setup). Hosts
|
|
261
|
+
* that need retry semantics should register a normal matcher and
|
|
262
|
+
* self-unregister via the callback returned from `registry.register`.
|
|
263
|
+
*/
|
|
264
|
+
once?: boolean;
|
|
265
|
+
/** Internal hooks are excluded from telemetry and non-fatal error logging. */
|
|
266
|
+
internal?: boolean;
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Storage shape for matchers keyed by event. Each event's matcher list is
|
|
270
|
+
* a generic array parameterized by that event type, so lookup via
|
|
271
|
+
* `HooksByEvent[E]` preserves type-safe callback signatures.
|
|
272
|
+
*/
|
|
273
|
+
export type HooksByEvent = {
|
|
274
|
+
[E in HookEvent]?: HookMatcher<E>[];
|
|
275
|
+
};
|
|
276
|
+
/**
|
|
277
|
+
* Aggregated result of a single `executeHooks` call. Fields are populated
|
|
278
|
+
* according to the fold rules in `executeHooks.ts`.
|
|
279
|
+
*/
|
|
280
|
+
export interface AggregatedHookResult {
|
|
281
|
+
/** Folded tool-gating decision; `deny > ask > allow`. */
|
|
282
|
+
decision?: ToolDecision;
|
|
283
|
+
/** Folded stop decision; any `block` wins. */
|
|
284
|
+
stopDecision?: StopDecision;
|
|
285
|
+
/** Reason from the hook that set the winning decision. */
|
|
286
|
+
reason?: string;
|
|
287
|
+
/**
|
|
288
|
+
* Replacement tool input from a `PreToolUse` hook.
|
|
289
|
+
*
|
|
290
|
+
* Last-writer-wins in **registration order**: `executeHooks` uses
|
|
291
|
+
* `Promise.all`, which preserves input-array order, so the fold iterates
|
|
292
|
+
* outcomes in the same order they were pushed — outer loop over matchers
|
|
293
|
+
* as they sit in the registry, inner loop over each matcher's `hooks`
|
|
294
|
+
* array. The winner is therefore deterministic but may not match the
|
|
295
|
+
* order in which hooks actually completed. Consumers that want a single
|
|
296
|
+
* authoritative rewrite should still register one `updatedInput`-setting
|
|
297
|
+
* hook per matcher to avoid subtle precedence bugs.
|
|
298
|
+
*/
|
|
299
|
+
updatedInput?: Record<string, unknown>;
|
|
300
|
+
/**
|
|
301
|
+
* Replacement tool output from a `PostToolUse` hook.
|
|
302
|
+
*
|
|
303
|
+
* Same last-writer-wins-in-registration-order semantics as
|
|
304
|
+
* `updatedInput`. Present only when at least one hook set it; `undefined`
|
|
305
|
+
* means "use the original tool output".
|
|
306
|
+
*/
|
|
307
|
+
updatedOutput?: unknown;
|
|
308
|
+
/** Accumulated `additionalContext` strings from every hook, in order. */
|
|
309
|
+
additionalContexts: string[];
|
|
310
|
+
/** True if any hook returned `preventContinuation`. */
|
|
311
|
+
preventContinuation?: boolean;
|
|
312
|
+
/**
|
|
313
|
+
* Reason recorded alongside `preventContinuation`. First winner wins:
|
|
314
|
+
* once a hook sets both flags, later hooks that also set
|
|
315
|
+
* `preventContinuation` do not overwrite the reason.
|
|
316
|
+
*/
|
|
317
|
+
stopReason?: string;
|
|
318
|
+
/** Error messages from hooks that threw; always present (possibly empty). */
|
|
319
|
+
errors: string[];
|
|
320
|
+
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -7,6 +7,13 @@ export type { GuardrailTraceData, GuardrailOutcome, } from '@illuma-ai/observabi
|
|
|
7
7
|
export * from './graphs';
|
|
8
8
|
export * from './tools/Calculator';
|
|
9
9
|
export * from './tools/CodeExecutor';
|
|
10
|
+
export * from './tools/BashExecutor';
|
|
11
|
+
export * from './tools/BashProgrammaticToolCalling';
|
|
12
|
+
export * from './tools/ReadFile';
|
|
13
|
+
export * from './tools/SkillTool';
|
|
14
|
+
export * from './tools/skillCatalog';
|
|
15
|
+
export * from './tools/SubagentTool';
|
|
16
|
+
export * from './tools/subagent';
|
|
10
17
|
export * from './tools/BrowserTools';
|
|
11
18
|
export * from './tools/ProgrammaticToolCalling';
|
|
12
19
|
export * from './tools/ToolSearch';
|
|
@@ -16,15 +23,7 @@ export * from './tools/schema';
|
|
|
16
23
|
export * from './tools/handlers';
|
|
17
24
|
export * from './tools/search';
|
|
18
25
|
export * from './tools/memory';
|
|
19
|
-
export * from './
|
|
20
|
-
export * from './tools/artifacts';
|
|
21
|
-
export * from './tools/proxyTool';
|
|
22
|
-
export * from './providers';
|
|
23
|
-
export { ContentStore, CONTENT_TTL_MS } from './content/ContentStore';
|
|
24
|
-
export { ArtifactStore, sanitizeName } from './content/ArtifactStore';
|
|
25
|
-
export type { S3Strategy, FileModel, Logger as ContentLogger, } from './content/ArtifactStore';
|
|
26
|
-
export { interceptMcpResult, extractUiMarkers, buildCachedResponse, } from './content/mcpAutoCache';
|
|
27
|
-
export type { AutoCacheContext, AutoCacheResult } from './content/mcpAutoCache';
|
|
26
|
+
export * from './hooks';
|
|
28
27
|
export * from './memory';
|
|
29
28
|
export { MEMORY_FLUSH_SYSTEM_PROMPT } from './prompts/memoryFlushPrompt';
|
|
30
29
|
export { shouldFlushMemory, runMemoryFlush, } from './graphs/phases/memoryFlushPhase';
|
|
@@ -36,6 +35,7 @@ export * from './nodes';
|
|
|
36
35
|
export * from './common';
|
|
37
36
|
export * from './utils';
|
|
38
37
|
export type * from './types';
|
|
38
|
+
export * from './langchain';
|
|
39
39
|
export { CustomOpenAIClient } from './llm/openai';
|
|
40
40
|
export { ChatOpenRouter } from './llm/openrouter';
|
|
41
41
|
export type { OpenRouterReasoning, OpenRouterReasoningEffort, ChatOpenRouterCallOptions, } from './llm/openrouter';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { GoogleAIToolType } from '@langchain/google-common';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { BindToolsInput } from '@langchain/core/language_models/chat_models';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { InvalidToolCall, ToolCall, ToolCallChunk, } from '@langchain/core/messages/tool';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { AIMessage, AIMessageChunk, BaseMessage, BaseMessageChunk, HumanMessage, SystemMessage, ToolMessage, getBufferString, isAIMessage, isBaseMessage, isToolMessage, } from '@langchain/core/messages';
|
|
2
|
+
export type { BaseMessageFields, MessageContent, MessageContentText, MessageContentImageUrl, UsageMetadata, } from '@langchain/core/messages';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { AzureOpenAIInput } from '@langchain/openai';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PromptTemplate } from '@langchain/core/prompts';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getEnvironmentVariable } from '@langchain/core/utils/env';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bedrock prompt-cache model support detection.
|
|
3
|
+
* ===============================================
|
|
4
|
+
*
|
|
5
|
+
* Bedrock prompt caching (via `cachePoint` blocks) is only supported on
|
|
6
|
+
* specific model families. Other families silently reject or ignore the
|
|
7
|
+
* markers. We maintain an allowlist instead of a substring heuristic so
|
|
8
|
+
* a future model with an unfortunate name (e.g. `llama-claude-killer`)
|
|
9
|
+
* doesn't accidentally match.
|
|
10
|
+
*
|
|
11
|
+
* Consumers can extend the allowlist with `bedrockCacheModelPatterns` in
|
|
12
|
+
* `clientOptions` for proprietary or pre-release model IDs not yet in
|
|
13
|
+
* the reference library.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Default allowlist of Bedrock model ID patterns that support cachePoint.
|
|
17
|
+
* Sourced from AWS Bedrock documentation (verified against us-east-1
|
|
18
|
+
* 2026-05).
|
|
19
|
+
*
|
|
20
|
+
* Adding a new model: append a RegExp here AND add a regression test in
|
|
21
|
+
* `cacheSupport.test.ts` covering at least one full model ID for that
|
|
22
|
+
* family. Removing a model: do not remove without operator confirmation
|
|
23
|
+
* — silent removal would suddenly stop emitting cachePoint markers and
|
|
24
|
+
* regress cost savings.
|
|
25
|
+
*/
|
|
26
|
+
export declare const DEFAULT_BEDROCK_CACHE_MODEL_PATTERNS: readonly RegExp[];
|
|
27
|
+
/**
|
|
28
|
+
* Returns true when the given Bedrock model ID belongs to a family that
|
|
29
|
+
* supports cachePoint blocks. `additionalPatterns` lets consumers extend
|
|
30
|
+
* the allowlist for models the library doesn't know about yet.
|
|
31
|
+
*
|
|
32
|
+
* @param modelId Bedrock model ID (e.g. `us.anthropic.claude-sonnet-4-5-20250929-v1:0`)
|
|
33
|
+
* @param additionalPatterns Extra patterns from consumer config
|
|
34
|
+
*/
|
|
35
|
+
export declare function isBedrockCacheSupported(modelId: string | undefined, additionalPatterns?: readonly RegExp[]): boolean;
|
|
@@ -41,18 +41,65 @@ import type { ChatBedrockConverseInput } from '@langchain/aws';
|
|
|
41
41
|
* @see https://docs.aws.amazon.com/bedrock/latest/userguide/service-tiers-inference.html
|
|
42
42
|
*/
|
|
43
43
|
export type ServiceTierType = 'priority' | 'default' | 'flex' | 'reserved';
|
|
44
|
+
/**
|
|
45
|
+
* Tool cachePoint allocation strategy.
|
|
46
|
+
*
|
|
47
|
+
* - 'single': one cachePoint at the END of the tools array (whole array
|
|
48
|
+
* cached as one unit). Lightest budget use (1 cachePoint).
|
|
49
|
+
* - 'split': split tools into groups via `toolGroupSelector`. Each
|
|
50
|
+
* non-empty group gets its own cachePoint. Use when groups
|
|
51
|
+
* have different volatility (e.g. stable core tools vs
|
|
52
|
+
* volatile MCP tools). Costs more cachePoint budget.
|
|
53
|
+
* - 'none': no cachePoint on tools array. Use when tool definitions
|
|
54
|
+
* change every request anyway.
|
|
55
|
+
*/
|
|
56
|
+
export type ToolCacheStrategy = 'single' | 'split' | 'none';
|
|
57
|
+
/**
|
|
58
|
+
* Group selector for `toolCacheStrategy: 'split'`. Receives the tool name
|
|
59
|
+
* and returns a stable group key — tools with the same key are grouped
|
|
60
|
+
* together. Group order in the output array follows first-encounter order.
|
|
61
|
+
*/
|
|
62
|
+
export type ToolGroupSelector = (toolName: string) => string;
|
|
63
|
+
/**
|
|
64
|
+
* Default group selector — puts all tools in a single group named 'core'.
|
|
65
|
+
* Equivalent to 'single' strategy but explicit. Consumers override this
|
|
66
|
+
* to enable per-source grouping (e.g. by inspecting tool-name substrings
|
|
67
|
+
* to separate stable framework tools from volatile MCP-sourced tools).
|
|
68
|
+
*/
|
|
69
|
+
export declare const DEFAULT_TOOL_GROUP_SELECTOR: ToolGroupSelector;
|
|
44
70
|
/**
|
|
45
71
|
* Extended input interface with additional features:
|
|
46
72
|
* - promptCache: Enable Bedrock prompt caching for tool definitions
|
|
47
73
|
* - applicationInferenceProfile: Use an inference profile ARN instead of model ID
|
|
48
74
|
* - serviceTier: Specify service tier (Priority, Standard, Flex, Reserved)
|
|
75
|
+
* - toolCacheStrategy: How to allocate cachePoints across tools array
|
|
76
|
+
* - toolGroupSelector: Group key resolver for the 'split' strategy
|
|
49
77
|
*/
|
|
50
78
|
export interface IllumaBedrockConverseInput extends ChatBedrockConverseInput {
|
|
51
79
|
/**
|
|
52
80
|
* Enable Bedrock prompt caching for tool definitions.
|
|
53
|
-
* When true, adds cachePoint
|
|
81
|
+
* When true, adds cachePoint marker(s) to tools array per
|
|
82
|
+
* `toolCacheStrategy`. Defaults to 'single'.
|
|
54
83
|
*/
|
|
55
84
|
promptCache?: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Tool cachePoint allocation. Defaults to 'single' — one cachePoint at
|
|
87
|
+
* the end of the tools array. Set to 'split' (with `toolGroupSelector`)
|
|
88
|
+
* when different tool groups have different volatility.
|
|
89
|
+
*/
|
|
90
|
+
toolCacheStrategy?: ToolCacheStrategy;
|
|
91
|
+
/**
|
|
92
|
+
* Group selector for 'split' strategy. Receives a tool name, returns
|
|
93
|
+
* a stable group key. Defaults to a one-group selector (equivalent
|
|
94
|
+
* to 'single').
|
|
95
|
+
*/
|
|
96
|
+
toolGroupSelector?: ToolGroupSelector;
|
|
97
|
+
/**
|
|
98
|
+
* Additional model ID patterns to consider Bedrock-cache-supported.
|
|
99
|
+
* Defaults are in `src/llm/bedrock/cacheSupport.ts`. Use this when
|
|
100
|
+
* AWS adds a new model family before the next library release.
|
|
101
|
+
*/
|
|
102
|
+
bedrockCacheModelPatterns?: readonly RegExp[];
|
|
56
103
|
/**
|
|
57
104
|
* Application Inference Profile ARN to use for the model.
|
|
58
105
|
* For example, "arn:aws:bedrock:eu-west-1:123456789102:application-inference-profile/fm16bt65tzgx"
|
|
@@ -90,6 +137,12 @@ export declare class IllumaBedrockConverse extends ChatBedrockConverse {
|
|
|
90
137
|
applicationInferenceProfile?: string;
|
|
91
138
|
/** Service tier for model invocation */
|
|
92
139
|
serviceTier?: ServiceTierType;
|
|
140
|
+
/** Tool cachePoint allocation strategy. */
|
|
141
|
+
toolCacheStrategy: ToolCacheStrategy;
|
|
142
|
+
/** Group selector for 'split' strategy. */
|
|
143
|
+
toolGroupSelector: ToolGroupSelector;
|
|
144
|
+
/** Optional consumer extensions to the cache-supported model allowlist. */
|
|
145
|
+
bedrockCacheModelPatterns?: readonly RegExp[];
|
|
93
146
|
constructor(fields?: IllumaBedrockConverseInput);
|
|
94
147
|
static lc_name(): string;
|
|
95
148
|
/**
|
|
@@ -102,7 +102,7 @@ export interface XAIUsageMetadata extends OpenAIClient.Completions.CompletionUsa
|
|
|
102
102
|
num_sources_used?: number;
|
|
103
103
|
}
|
|
104
104
|
export declare class ChatMoonshot extends ChatOpenAI {
|
|
105
|
-
static lc_name(): '
|
|
105
|
+
static lc_name(): 'IllumaMoonshot';
|
|
106
106
|
protected _convertMessages(messages: BaseMessage[]): OpenAICompletionParam[];
|
|
107
107
|
_generate(messages: BaseMessage[], options: this['ParsedCallOptions'], runManager?: CallbackManagerForLLMRun): Promise<ChatResult>;
|
|
108
108
|
protected _convertResponseToMessage(choice: OpenAIClient.Chat.Completions.ChatCompletion.Choice, data: OpenAIClient.Chat.Completions.ChatCompletion): AIMessage;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Citation decoration — Phase 2.
|
|
3
3
|
*
|
|
4
|
-
* Ported from
|
|
4
|
+
* Ported from a reference implementation `extensions/memory-core/src/tools.citations.ts`.
|
|
5
5
|
* Decorates memory_search hits with `[path#L{start}-L{end}]` markers so
|
|
6
6
|
* the model can attribute claims back to specific memory files when it
|
|
7
7
|
* uses them in its answer.
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* compute line ranges from the returned content block on the fly:
|
|
11
11
|
* - `startLine` = 1 (line 1 of the file)
|
|
12
12
|
* - `endLine` = total number of lines in the block
|
|
13
|
-
* This matches
|
|
13
|
+
* This matches the standard output format exactly while keeping the pg
|
|
14
14
|
* schema chunk-free.
|
|
15
15
|
*/
|
|
16
16
|
export type MemoryCitationsMode = 'on' | 'off' | 'auto';
|
|
@@ -24,7 +24,7 @@ export interface CitationCandidate {
|
|
|
24
24
|
citation?: string;
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
|
-
* Decorate each hit with a citation marker. Mirrors
|
|
27
|
+
* Decorate each hit with a citation marker. Mirrors the standard behavior:
|
|
28
28
|
* appends `\n\nSource: <citation>` to the content and sets `citation`.
|
|
29
29
|
* When `include=false`, clears any existing citation field.
|
|
30
30
|
*/
|
|
@@ -32,7 +32,7 @@ export declare function decorateCitations<T extends CitationCandidate>(hits: T[]
|
|
|
32
32
|
/**
|
|
33
33
|
* Whether citations should be emitted for this call.
|
|
34
34
|
*
|
|
35
|
-
*
|
|
35
|
+
* The reference implementation keys `auto` off the session type (direct/group/channel). In
|
|
36
36
|
* Phase 1 we only have direct chat, so `auto` => `on`. Callers that
|
|
37
37
|
* later distinguish session types can pass `mode` explicitly.
|
|
38
38
|
*/
|
|
@@ -19,14 +19,14 @@ export declare const DEFAULT_MEMORY_SCHEMA = "public";
|
|
|
19
19
|
export declare const MEMORY_PHASE_NORMAL = "normal";
|
|
20
20
|
export declare const MEMORY_PHASE_FLUSHING = "memory_flushing";
|
|
21
21
|
/**
|
|
22
|
-
* Search defaults — aligned with
|
|
22
|
+
* Search defaults — aligned with the standard defaults.
|
|
23
23
|
*
|
|
24
24
|
* Sources:
|
|
25
|
-
* - `
|
|
26
|
-
* - `
|
|
25
|
+
* - `reference` → maxResults=6
|
|
26
|
+
* - `reference` → maxInjectedChars=4000
|
|
27
27
|
*
|
|
28
|
-
* Keeping these in lockstep with
|
|
29
|
-
* description, budget clamps, and eval corpora line up with
|
|
28
|
+
* Keeping these in lockstep with means the mandatory-recall tool
|
|
29
|
+
* description, budget clamps, and eval corpora line up with the standard
|
|
30
30
|
* tuning — we inherit their calibration instead of re-tuning from scratch.
|
|
31
31
|
*/
|
|
32
32
|
export declare const DEFAULT_MAX_SEARCH_RESULTS = 6;
|
|
@@ -36,11 +36,11 @@ export declare const DEFAULT_MAX_INJECTED_CHARS = 4000;
|
|
|
36
36
|
export declare const HYBRID_VECTOR_WEIGHT = 0.7;
|
|
37
37
|
export declare const HYBRID_TEXT_WEIGHT = 0.3;
|
|
38
38
|
/**
|
|
39
|
-
* Phase 2 rerank defaults — ported from
|
|
39
|
+
* Phase 2 rerank defaults — ported from a reference implementation.
|
|
40
40
|
*
|
|
41
41
|
* Sources:
|
|
42
|
-
* - `
|
|
43
|
-
* - `
|
|
42
|
+
* - `reference` → lambda=0.7
|
|
43
|
+
* - `reference` → halfLifeDays=30
|
|
44
44
|
*
|
|
45
45
|
* Both features are opt-in (enabled=false by default) — the Phase 2
|
|
46
46
|
* features are layered on top of hybrid search and don't change default
|
|
@@ -53,11 +53,11 @@ export declare const DEFAULT_TEMPORAL_DECAY_HALF_LIFE_DAYS = 30;
|
|
|
53
53
|
export declare const DEFAULT_RECALL_TRACKING_ENABLED = false;
|
|
54
54
|
export declare const DEFAULT_CITATIONS_MODE: "auto";
|
|
55
55
|
/**
|
|
56
|
-
* Flush trigger margins (token counts) — aligned with
|
|
56
|
+
* Flush trigger margins (token counts) — aligned with standard.
|
|
57
57
|
*
|
|
58
58
|
* Sources:
|
|
59
|
-
* - `
|
|
60
|
-
* - `
|
|
59
|
+
* - `reference` → softThreshold=4000
|
|
60
|
+
* - `reference` → reserveFloor=20000
|
|
61
61
|
*/
|
|
62
62
|
export declare const DEFAULT_FLUSH_SOFT_THRESHOLD_TOKENS = 4000;
|
|
63
63
|
export declare const DEFAULT_FLUSH_RESERVE_FLOOR_TOKENS = 20000;
|
|
@@ -67,7 +67,7 @@ export declare const DEFAULT_MAX_APPENDS_PER_FLUSH = 20;
|
|
|
67
67
|
* Hard cap on agentic loop iterations inside {@link runMemoryFlush}.
|
|
68
68
|
*
|
|
69
69
|
* Each iteration = one model.invoke() followed by execution of any
|
|
70
|
-
* `memory_append` tool_calls it emits. Mirrors
|
|
70
|
+
* `memory_append` tool_calls it emits. Mirrors the standard flush-plan
|
|
71
71
|
* loop cap; 8 is enough for ~2–3 reflections of batched notes while
|
|
72
72
|
* protecting against runaway cycles if the model refuses to stop.
|
|
73
73
|
*/
|
|
@@ -82,21 +82,21 @@ export declare const MEMORY_APPEND_TOOL_NAME = "memory_append";
|
|
|
82
82
|
* Mandatory-recall description — the single most load-bearing line in the
|
|
83
83
|
* whole memory system. Do not soften, shorten, or reword without an eval run.
|
|
84
84
|
*
|
|
85
|
-
* Ported VERBATIM from
|
|
85
|
+
* Ported VERBATIM from a reference implementation `extensions/memory-core/src/tools.ts:186`.
|
|
86
86
|
* The wiki/corpus clause is retained even though Phase 1 doesn't ship
|
|
87
|
-
* compiled-wiki supplements — keeping the string identical means
|
|
87
|
+
* compiled-wiki supplements — keeping the string identical means the standard
|
|
88
88
|
* eval corpora remain drop-in valid.
|
|
89
89
|
*/
|
|
90
90
|
export declare const MEMORY_SEARCH_DESCRIPTION: string;
|
|
91
91
|
/**
|
|
92
|
-
* Ported VERBATIM from
|
|
92
|
+
* Ported VERBATIM from a reference implementation `extensions/memory-core/src/tools.ts:322`.
|
|
93
93
|
*/
|
|
94
94
|
export declare const MEMORY_GET_DESCRIPTION: string;
|
|
95
95
|
/**
|
|
96
96
|
* `memory_append` tool description.
|
|
97
97
|
*
|
|
98
98
|
* Phase 1 historically wrote to a single date-keyed file
|
|
99
|
-
* (`memory/YYYY-MM-DD.md`), ported verbatim from
|
|
99
|
+
* (`memory/YYYY-MM-DD.md`), ported verbatim from a reference implementation. That scheme
|
|
100
100
|
* is now replaced by an 8-path canonical whitelist — see
|
|
101
101
|
* {@link ./paths.MEMORY_ALL_PATHS}. The tool description no longer
|
|
102
102
|
* names a specific file; the flush-turn prompt renders the full rubric
|
|
@@ -105,7 +105,7 @@ export declare const MEMORY_GET_DESCRIPTION: string;
|
|
|
105
105
|
export declare const MEMORY_APPEND_DESCRIPTION: string;
|
|
106
106
|
/**
|
|
107
107
|
* Reply token that signals the flush turn produced no user-visible output.
|
|
108
|
-
* Ported VERBATIM from
|
|
108
|
+
* Ported VERBATIM from a reference implementation `src/auto-reply/tokens.ts:4`.
|
|
109
109
|
*/
|
|
110
110
|
export declare const SILENT_REPLY_TOKEN = "NO_REPLY";
|
|
111
111
|
/**
|