@illuma-ai/agents 1.5.0 → 2.1.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 +0 -62
- package/dist/cjs/agents/AgentContext.cjs +159 -258
- package/dist/cjs/agents/AgentContext.cjs.map +1 -1
- package/dist/cjs/graphs/Graph.cjs +25 -8
- package/dist/cjs/graphs/Graph.cjs.map +1 -1
- package/dist/cjs/llm/anthropic/utils/message_inputs.cjs +1 -5
- package/dist/cjs/llm/anthropic/utils/message_inputs.cjs.map +1 -1
- package/dist/cjs/llm/bedrock/index.cjs +33 -61
- package/dist/cjs/llm/bedrock/index.cjs.map +1 -1
- package/dist/cjs/llm/openai/utils/index.cjs +10 -27
- package/dist/cjs/llm/openai/utils/index.cjs.map +1 -1
- package/dist/cjs/main.cjs +3 -84
- package/dist/cjs/main.cjs.map +1 -1
- package/dist/cjs/messages/cache.cjs +0 -89
- package/dist/cjs/messages/cache.cjs.map +1 -1
- package/dist/cjs/messages/format.cjs +10 -68
- package/dist/cjs/messages/format.cjs.map +1 -1
- package/dist/cjs/tools/BashExecutor.cjs +11 -21
- package/dist/cjs/tools/BashExecutor.cjs.map +1 -1
- package/dist/cjs/tools/CodeExecutor.cjs +10 -37
- package/dist/cjs/tools/CodeExecutor.cjs.map +1 -1
- package/dist/cjs/tools/ProgrammaticToolCalling.cjs +11 -16
- package/dist/cjs/tools/ProgrammaticToolCalling.cjs.map +1 -1
- package/dist/cjs/tools/ToolNode.cjs +73 -8
- package/dist/cjs/tools/ToolNode.cjs.map +1 -1
- package/dist/cjs/tools/search/search.cjs +3 -11
- package/dist/cjs/tools/search/search.cjs.map +1 -1
- package/dist/cjs/tools/search/tool.cjs +4 -28
- package/dist/cjs/tools/search/tool.cjs.map +1 -1
- package/dist/cjs/tools/search/utils.cjs +3 -10
- package/dist/cjs/tools/search/utils.cjs.map +1 -1
- package/dist/cjs/tools/subagent/SubagentExecutor.cjs +48 -0
- package/dist/cjs/tools/subagent/SubagentExecutor.cjs.map +1 -1
- package/dist/cjs/types/graph.cjs.map +1 -1
- package/dist/esm/agents/AgentContext.mjs +159 -258
- package/dist/esm/agents/AgentContext.mjs.map +1 -1
- package/dist/esm/graphs/Graph.mjs +25 -8
- package/dist/esm/graphs/Graph.mjs.map +1 -1
- package/dist/esm/llm/anthropic/utils/message_inputs.mjs +1 -5
- package/dist/esm/llm/anthropic/utils/message_inputs.mjs.map +1 -1
- package/dist/esm/llm/bedrock/index.mjs +34 -61
- package/dist/esm/llm/bedrock/index.mjs.map +1 -1
- package/dist/esm/llm/openai/utils/index.mjs +10 -27
- package/dist/esm/llm/openai/utils/index.mjs.map +1 -1
- package/dist/esm/main.mjs +1 -5
- package/dist/esm/main.mjs.map +1 -1
- package/dist/esm/messages/cache.mjs +0 -89
- package/dist/esm/messages/cache.mjs.map +1 -1
- package/dist/esm/messages/format.mjs +10 -68
- package/dist/esm/messages/format.mjs.map +1 -1
- package/dist/esm/tools/BashExecutor.mjs +12 -22
- package/dist/esm/tools/BashExecutor.mjs.map +1 -1
- package/dist/esm/tools/CodeExecutor.mjs +11 -37
- package/dist/esm/tools/CodeExecutor.mjs.map +1 -1
- package/dist/esm/tools/ProgrammaticToolCalling.mjs +12 -17
- package/dist/esm/tools/ProgrammaticToolCalling.mjs.map +1 -1
- package/dist/esm/tools/ToolNode.mjs +73 -8
- package/dist/esm/tools/ToolNode.mjs.map +1 -1
- package/dist/esm/tools/search/search.mjs +3 -11
- package/dist/esm/tools/search/search.mjs.map +1 -1
- package/dist/esm/tools/search/tool.mjs +4 -28
- package/dist/esm/tools/search/tool.mjs.map +1 -1
- package/dist/esm/tools/search/utils.mjs +3 -10
- package/dist/esm/tools/search/utils.mjs.map +1 -1
- package/dist/esm/tools/subagent/SubagentExecutor.mjs +48 -0
- package/dist/esm/tools/subagent/SubagentExecutor.mjs.map +1 -1
- package/dist/esm/types/graph.mjs.map +1 -1
- package/dist/types/agents/AgentContext.d.ts +25 -95
- package/dist/types/index.d.ts +0 -1
- package/dist/types/llm/bedrock/index.d.ts +1 -54
- package/dist/types/messages/format.d.ts +1 -4
- package/dist/types/tools/CodeExecutor.d.ts +0 -6
- package/dist/types/tools/search/types.d.ts +5 -99
- package/dist/types/tools/search/utils.d.ts +2 -2
- package/dist/types/tools/subagent/SubagentExecutor.d.ts +29 -0
- package/dist/types/types/graph.d.ts +24 -27
- package/dist/types/types/index.d.ts +0 -1
- package/dist/types/types/run.d.ts +0 -2
- package/dist/types/types/tools.d.ts +0 -9
- package/package.json +1 -61
- package/src/agents/AgentContext.test.ts +176 -0
- package/src/agents/AgentContext.ts +178 -304
- package/src/agents/__tests__/AgentContext.test.ts +0 -632
- package/src/graphs/Graph.ts +27 -8
- package/src/index.ts +0 -6
- package/src/llm/anthropic/utils/message_inputs.ts +1 -10
- package/src/llm/bedrock/__tests__/bedrock-caching.test.ts +18 -166
- package/src/llm/bedrock/index.ts +41 -116
- package/src/llm/openai/utils/index.ts +14 -31
- package/src/messages/cache.test.ts +24 -62
- package/src/messages/cache.ts +0 -112
- package/src/messages/format.ts +10 -89
- package/src/scripts/subagent-configurable-inheritance.ts +263 -0
- package/src/specs/anthropic.simple.test.ts +0 -61
- package/src/tools/BashExecutor.ts +13 -37
- package/src/tools/CodeExecutor.ts +11 -55
- package/src/tools/ProgrammaticToolCalling.ts +14 -29
- package/src/tools/ToolNode.ts +69 -8
- package/src/tools/__tests__/ProgrammaticToolCalling.test.ts +0 -60
- package/src/tools/__tests__/SubagentExecutor.test.ts +157 -0
- package/src/tools/search/search.ts +2 -12
- package/src/tools/search/tool.ts +2 -36
- package/src/tools/search/types.ts +8 -133
- package/src/tools/search/utils.ts +5 -13
- package/src/tools/subagent/SubagentExecutor.ts +78 -0
- package/src/types/graph.ts +21 -27
- package/src/types/index.ts +0 -1
- package/src/types/run.ts +0 -2
- package/src/types/tools.ts +0 -9
- package/dist/cjs/langchain/google-common.cjs +0 -3
- package/dist/cjs/langchain/google-common.cjs.map +0 -1
- package/dist/cjs/langchain/index.cjs +0 -86
- package/dist/cjs/langchain/index.cjs.map +0 -1
- package/dist/cjs/langchain/language_models/chat_models.cjs +0 -3
- package/dist/cjs/langchain/language_models/chat_models.cjs.map +0 -1
- package/dist/cjs/langchain/messages/tool.cjs +0 -3
- package/dist/cjs/langchain/messages/tool.cjs.map +0 -1
- package/dist/cjs/langchain/messages.cjs +0 -51
- package/dist/cjs/langchain/messages.cjs.map +0 -1
- package/dist/cjs/langchain/openai.cjs +0 -3
- package/dist/cjs/langchain/openai.cjs.map +0 -1
- package/dist/cjs/langchain/prompts.cjs +0 -11
- package/dist/cjs/langchain/prompts.cjs.map +0 -1
- package/dist/cjs/langchain/runnables.cjs +0 -19
- package/dist/cjs/langchain/runnables.cjs.map +0 -1
- package/dist/cjs/langchain/tools.cjs +0 -23
- package/dist/cjs/langchain/tools.cjs.map +0 -1
- package/dist/cjs/langchain/utils/env.cjs +0 -11
- package/dist/cjs/langchain/utils/env.cjs.map +0 -1
- package/dist/cjs/llm/bedrock/cacheSupport.cjs +0 -55
- package/dist/cjs/llm/bedrock/cacheSupport.cjs.map +0 -1
- package/dist/cjs/tools/search/tavily-scraper.cjs +0 -189
- package/dist/cjs/tools/search/tavily-scraper.cjs.map +0 -1
- package/dist/cjs/tools/search/tavily-search.cjs +0 -372
- package/dist/cjs/tools/search/tavily-search.cjs.map +0 -1
- package/dist/cjs/types/agent-cache.cjs +0 -53
- package/dist/cjs/types/agent-cache.cjs.map +0 -1
- package/dist/esm/langchain/google-common.mjs +0 -2
- package/dist/esm/langchain/google-common.mjs.map +0 -1
- package/dist/esm/langchain/index.mjs +0 -5
- package/dist/esm/langchain/index.mjs.map +0 -1
- package/dist/esm/langchain/language_models/chat_models.mjs +0 -2
- package/dist/esm/langchain/language_models/chat_models.mjs.map +0 -1
- package/dist/esm/langchain/messages/tool.mjs +0 -2
- package/dist/esm/langchain/messages/tool.mjs.map +0 -1
- package/dist/esm/langchain/messages.mjs +0 -2
- package/dist/esm/langchain/messages.mjs.map +0 -1
- package/dist/esm/langchain/openai.mjs +0 -2
- package/dist/esm/langchain/openai.mjs.map +0 -1
- package/dist/esm/langchain/prompts.mjs +0 -2
- package/dist/esm/langchain/prompts.mjs.map +0 -1
- package/dist/esm/langchain/runnables.mjs +0 -2
- package/dist/esm/langchain/runnables.mjs.map +0 -1
- package/dist/esm/langchain/tools.mjs +0 -2
- package/dist/esm/langchain/tools.mjs.map +0 -1
- package/dist/esm/langchain/utils/env.mjs +0 -2
- package/dist/esm/langchain/utils/env.mjs.map +0 -1
- package/dist/esm/llm/bedrock/cacheSupport.mjs +0 -52
- package/dist/esm/llm/bedrock/cacheSupport.mjs.map +0 -1
- package/dist/esm/tools/search/tavily-scraper.mjs +0 -186
- package/dist/esm/tools/search/tavily-scraper.mjs.map +0 -1
- package/dist/esm/tools/search/tavily-search.mjs +0 -370
- package/dist/esm/tools/search/tavily-search.mjs.map +0 -1
- package/dist/esm/types/agent-cache.mjs +0 -51
- package/dist/esm/types/agent-cache.mjs.map +0 -1
- package/dist/types/langchain/google-common.d.ts +0 -1
- package/dist/types/langchain/index.d.ts +0 -8
- package/dist/types/langchain/language_models/chat_models.d.ts +0 -1
- package/dist/types/langchain/messages/tool.d.ts +0 -1
- package/dist/types/langchain/messages.d.ts +0 -2
- package/dist/types/langchain/openai.d.ts +0 -1
- package/dist/types/langchain/prompts.d.ts +0 -1
- package/dist/types/langchain/runnables.d.ts +0 -2
- package/dist/types/langchain/tools.d.ts +0 -2
- package/dist/types/langchain/utils/env.d.ts +0 -1
- package/dist/types/llm/bedrock/cacheSupport.d.ts +0 -35
- package/dist/types/tools/search/tavily-scraper.d.ts +0 -19
- package/dist/types/tools/search/tavily-search.d.ts +0 -4
- package/dist/types/tools/subagent/types.d.ts +0 -84
- package/dist/types/types/agent-cache.d.ts +0 -70
- package/src/agents/AgentContext.js.map +0 -1
- package/src/agents/AgentContext.test.js.map +0 -1
- package/src/agents/__tests__/AgentContext.cacheTtl.live.test.ts +0 -259
- package/src/agents/__tests__/AgentContext.crossAgentTier1.live.test.ts +0 -264
- package/src/agents/__tests__/AgentContext.crossUserCache.live.test.ts +0 -342
- package/src/agents/__tests__/AgentContext.test.js.map +0 -1
- package/src/agents/__tests__/resolveStructuredOutputMode.test.js.map +0 -1
- package/src/common/enum.js.map +0 -1
- package/src/common/index.js.map +0 -1
- package/src/events.js.map +0 -1
- package/src/graphs/Graph.js.map +0 -1
- package/src/graphs/MultiAgentGraph.js.map +0 -1
- package/src/graphs/__tests__/structured-output.integration.test.js.map +0 -1
- package/src/graphs/__tests__/structured-output.test.js.map +0 -1
- package/src/graphs/contextManagement.e2e.test.js.map +0 -1
- package/src/graphs/contextManagement.test.js.map +0 -1
- package/src/graphs/handoffValidation.test.js.map +0 -1
- package/src/graphs/index.js.map +0 -1
- package/src/index.js.map +0 -1
- package/src/instrumentation.js.map +0 -1
- package/src/langchain/google-common.ts +0 -1
- package/src/langchain/index.ts +0 -8
- package/src/langchain/language_models/chat_models.ts +0 -1
- package/src/langchain/messages/tool.ts +0 -5
- package/src/langchain/messages.ts +0 -21
- package/src/langchain/openai.ts +0 -1
- package/src/langchain/prompts.ts +0 -1
- package/src/langchain/runnables.ts +0 -7
- package/src/langchain/tools.ts +0 -8
- package/src/langchain/utils/env.ts +0 -1
- package/src/llm/anthropic/index.js.map +0 -1
- package/src/llm/anthropic/types.js.map +0 -1
- package/src/llm/anthropic/utils/message_inputs.js.map +0 -1
- package/src/llm/anthropic/utils/message_outputs.js.map +0 -1
- package/src/llm/anthropic/utils/output_parsers.js.map +0 -1
- package/src/llm/anthropic/utils/server-tool-inputs.test.ts +0 -436
- package/src/llm/anthropic/utils/tools.js.map +0 -1
- package/src/llm/bedrock/__tests__/bedrock-caching.test.js.map +0 -1
- package/src/llm/bedrock/cacheSupport.test.ts +0 -99
- package/src/llm/bedrock/cacheSupport.ts +0 -53
- package/src/llm/bedrock/index.js.map +0 -1
- package/src/llm/bedrock/types.js.map +0 -1
- package/src/llm/bedrock/utils/index.js.map +0 -1
- package/src/llm/bedrock/utils/message_inputs.js.map +0 -1
- package/src/llm/bedrock/utils/message_outputs.js.map +0 -1
- package/src/llm/fake.js.map +0 -1
- package/src/llm/google/index.js.map +0 -1
- package/src/llm/google/types.js.map +0 -1
- package/src/llm/google/utils/common.js.map +0 -1
- package/src/llm/google/utils/tools.js.map +0 -1
- package/src/llm/google/utils/zod_to_genai_parameters.js.map +0 -1
- package/src/llm/openai/index.js.map +0 -1
- package/src/llm/openai/types.js.map +0 -1
- package/src/llm/openai/utils/index.js.map +0 -1
- package/src/llm/openai/utils/isReasoningModel.test.js.map +0 -1
- package/src/llm/openrouter/index.js.map +0 -1
- package/src/llm/openrouter/reasoning.test.js.map +0 -1
- package/src/llm/providers.js.map +0 -1
- package/src/llm/text.js.map +0 -1
- package/src/llm/vertexai/index.js.map +0 -1
- package/src/messages/__tests__/tools.test.js.map +0 -1
- package/src/messages/cache.js.map +0 -1
- package/src/messages/cache.test.js.map +0 -1
- package/src/messages/content.js.map +0 -1
- package/src/messages/content.test.js.map +0 -1
- package/src/messages/core.js.map +0 -1
- package/src/messages/ensureThinkingBlock.test.js.map +0 -1
- package/src/messages/format.js.map +0 -1
- package/src/messages/formatAgentMessages.test.js.map +0 -1
- package/src/messages/formatAgentMessages.tools.test.js.map +0 -1
- package/src/messages/formatMessage.test.js.map +0 -1
- package/src/messages/ids.js.map +0 -1
- package/src/messages/index.js.map +0 -1
- package/src/messages/labelContentByAgent.test.js.map +0 -1
- package/src/messages/prune.js.map +0 -1
- package/src/messages/reducer.js.map +0 -1
- package/src/messages/shiftIndexTokenCountMap.test.js.map +0 -1
- package/src/messages/summarize.js.map +0 -1
- package/src/messages/summarize.test.js.map +0 -1
- package/src/messages/tools.js.map +0 -1
- package/src/mockStream.js.map +0 -1
- package/src/prompts/collab.js.map +0 -1
- package/src/prompts/index.js.map +0 -1
- package/src/prompts/taskmanager.js.map +0 -1
- package/src/run.js.map +0 -1
- package/src/schemas/index.js.map +0 -1
- package/src/schemas/schema-preparation.test.js.map +0 -1
- package/src/schemas/validate.js.map +0 -1
- package/src/schemas/validate.test.js.map +0 -1
- package/src/scripts/abort.js.map +0 -1
- package/src/scripts/ant_web_search.js.map +0 -1
- package/src/scripts/ant_web_search_edge_case.js.map +0 -1
- package/src/scripts/ant_web_search_error_edge_case.js.map +0 -1
- package/src/scripts/args.js.map +0 -1
- package/src/scripts/bedrock-cache-debug.js.map +0 -1
- package/src/scripts/bedrock-content-aggregation-test.js.map +0 -1
- package/src/scripts/bedrock-merge-test.js.map +0 -1
- package/src/scripts/bedrock-parallel-tools-test.js.map +0 -1
- package/src/scripts/caching.js.map +0 -1
- package/src/scripts/cli.js.map +0 -1
- package/src/scripts/cli2.js.map +0 -1
- package/src/scripts/cli3.js.map +0 -1
- package/src/scripts/cli4.js.map +0 -1
- package/src/scripts/cli5.js.map +0 -1
- package/src/scripts/code_exec.js.map +0 -1
- package/src/scripts/code_exec_files.js.map +0 -1
- package/src/scripts/code_exec_multi_session.js.map +0 -1
- package/src/scripts/code_exec_ptc.js.map +0 -1
- package/src/scripts/code_exec_session.js.map +0 -1
- package/src/scripts/code_exec_simple.js.map +0 -1
- package/src/scripts/content.js.map +0 -1
- package/src/scripts/empty_input.js.map +0 -1
- package/src/scripts/handoff-test.js.map +0 -1
- package/src/scripts/image.js.map +0 -1
- package/src/scripts/memory.js.map +0 -1
- package/src/scripts/multi-agent-chain.js.map +0 -1
- package/src/scripts/multi-agent-conditional.js.map +0 -1
- package/src/scripts/multi-agent-document-review-chain.js.map +0 -1
- package/src/scripts/multi-agent-hybrid-flow.js.map +0 -1
- package/src/scripts/multi-agent-parallel-start.js.map +0 -1
- package/src/scripts/multi-agent-parallel.js.map +0 -1
- package/src/scripts/multi-agent-sequence.js.map +0 -1
- package/src/scripts/multi-agent-supervisor.js.map +0 -1
- package/src/scripts/multi-agent-test.js.map +0 -1
- package/src/scripts/parallel-asymmetric-tools-test.js.map +0 -1
- package/src/scripts/parallel-full-metadata-test.js.map +0 -1
- package/src/scripts/parallel-tools-test.js.map +0 -1
- package/src/scripts/programmatic_exec.js.map +0 -1
- package/src/scripts/programmatic_exec_agent.js.map +0 -1
- package/src/scripts/search.js.map +0 -1
- package/src/scripts/sequential-full-metadata-test.js.map +0 -1
- package/src/scripts/simple.js.map +0 -1
- package/src/scripts/single-agent-metadata-test.js.map +0 -1
- package/src/scripts/stream.js.map +0 -1
- package/src/scripts/test-custom-prompt-key.js.map +0 -1
- package/src/scripts/test-handoff-input.js.map +0 -1
- package/src/scripts/test-handoff-preamble.js.map +0 -1
- package/src/scripts/test-handoff-steering.js.map +0 -1
- package/src/scripts/test-multi-agent-list-handoff.js.map +0 -1
- package/src/scripts/test-parallel-agent-labeling.js.map +0 -1
- package/src/scripts/test-parallel-handoffs.js.map +0 -1
- package/src/scripts/test-thinking-handoff-bedrock.js.map +0 -1
- package/src/scripts/test-thinking-handoff.js.map +0 -1
- package/src/scripts/test-thinking-to-thinking-handoff-bedrock.js.map +0 -1
- package/src/scripts/test-tool-before-handoff-role-order.js.map +0 -1
- package/src/scripts/test-tools-before-handoff.js.map +0 -1
- package/src/scripts/test_code_api.js.map +0 -1
- package/src/scripts/thinking-bedrock.js.map +0 -1
- package/src/scripts/thinking-vertexai.js.map +0 -1
- package/src/scripts/thinking.js.map +0 -1
- package/src/scripts/tool_search.js.map +0 -1
- package/src/scripts/tools.js.map +0 -1
- package/src/specs/agent-handoffs-bedrock.integration.test.js.map +0 -1
- package/src/specs/agent-handoffs.test.js.map +0 -1
- package/src/specs/anthropic.simple.test.js.map +0 -1
- package/src/specs/azure.simple.test.js.map +0 -1
- package/src/specs/cache.simple.test.js.map +0 -1
- package/src/specs/custom-event-await.test.js.map +0 -1
- package/src/specs/deepseek.simple.test.js.map +0 -1
- package/src/specs/emergency-prune.test.js.map +0 -1
- package/src/specs/moonshot.simple.test.js.map +0 -1
- package/src/specs/observability.integration.test.js.map +0 -1
- package/src/specs/openai.simple.test.js.map +0 -1
- package/src/specs/openrouter.simple.test.js.map +0 -1
- package/src/specs/prune.test.js.map +0 -1
- package/src/specs/reasoning.test.js.map +0 -1
- package/src/specs/spec.utils.js.map +0 -1
- package/src/specs/thinking-handoff.test.js.map +0 -1
- package/src/specs/thinking-prune.test.js.map +0 -1
- package/src/specs/token-distribution-edge-case.test.js.map +0 -1
- package/src/specs/token-memoization.test.js.map +0 -1
- package/src/specs/tokens.test.js.map +0 -1
- package/src/specs/tool-error.test.js.map +0 -1
- package/src/splitStream.js.map +0 -1
- package/src/splitStream.test.js.map +0 -1
- package/src/stream.js.map +0 -1
- package/src/stream.test.js.map +0 -1
- package/src/test/mockTools.js.map +0 -1
- package/src/tools/BrowserTools.js.map +0 -1
- package/src/tools/Calculator.js.map +0 -1
- package/src/tools/Calculator.test.js.map +0 -1
- package/src/tools/CodeExecutor.js.map +0 -1
- package/src/tools/ProgrammaticToolCalling.js.map +0 -1
- package/src/tools/StreamingToolCallBuffer.js.map +0 -1
- package/src/tools/ToolNode.js.map +0 -1
- package/src/tools/ToolSearch.js.map +0 -1
- package/src/tools/__tests__/BrowserTools.test.js.map +0 -1
- package/src/tools/__tests__/ProgrammaticToolCalling.integration.test.js.map +0 -1
- package/src/tools/__tests__/ProgrammaticToolCalling.test.js.map +0 -1
- package/src/tools/__tests__/StreamingToolCallBuffer.test.js.map +0 -1
- package/src/tools/__tests__/ToolApproval.test.js.map +0 -1
- package/src/tools/__tests__/ToolNode.recovery.test.js.map +0 -1
- package/src/tools/__tests__/ToolNode.session.test.js.map +0 -1
- package/src/tools/__tests__/ToolSearch.integration.test.js.map +0 -1
- package/src/tools/__tests__/ToolSearch.test.js.map +0 -1
- package/src/tools/__tests__/handlers.test.js.map +0 -1
- package/src/tools/__tests__/truncation-recovery.integration.test.js.map +0 -1
- package/src/tools/handlers.js.map +0 -1
- package/src/tools/schema.js.map +0 -1
- package/src/tools/search/anthropic.js.map +0 -1
- package/src/tools/search/content.js.map +0 -1
- package/src/tools/search/content.test.js.map +0 -1
- package/src/tools/search/firecrawl.js.map +0 -1
- package/src/tools/search/format.js.map +0 -1
- package/src/tools/search/highlights.js.map +0 -1
- package/src/tools/search/index.js.map +0 -1
- package/src/tools/search/jina-reranker.test.js.map +0 -1
- package/src/tools/search/rerankers.js.map +0 -1
- package/src/tools/search/schema.js.map +0 -1
- package/src/tools/search/search.js.map +0 -1
- package/src/tools/search/serper-scraper.js.map +0 -1
- package/src/tools/search/tavily-scraper.ts +0 -235
- package/src/tools/search/tavily-search.ts +0 -424
- package/src/tools/search/tavily.test.ts +0 -965
- package/src/tools/search/test.js.map +0 -1
- package/src/tools/search/tool.js.map +0 -1
- package/src/tools/search/types.js.map +0 -1
- package/src/tools/search/utils.js.map +0 -1
- package/src/tools/subagent/types.test.ts +0 -70
- package/src/tools/subagent/types.ts +0 -115
- package/src/types/agent-cache.ts +0 -73
- package/src/types/graph.js.map +0 -1
- package/src/types/graph.test.js.map +0 -1
- package/src/types/index.js.map +0 -1
- package/src/types/llm.js.map +0 -1
- package/src/types/messages.js.map +0 -1
- package/src/types/run.js.map +0 -1
- package/src/types/stream.js.map +0 -1
- package/src/types/tools.js.map +0 -1
- package/src/utils/contextAnalytics.js.map +0 -1
- package/src/utils/contextAnalytics.test.js.map +0 -1
- package/src/utils/events.js.map +0 -1
- package/src/utils/graph.js.map +0 -1
- package/src/utils/handlers.js.map +0 -1
- package/src/utils/index.js.map +0 -1
- package/src/utils/llm.js.map +0 -1
- package/src/utils/llmConfig.js.map +0 -1
- package/src/utils/logging.js.map +0 -1
- package/src/utils/misc.js.map +0 -1
- package/src/utils/run.js.map +0 -1
- package/src/utils/schema.js.map +0 -1
- package/src/utils/title.js.map +0 -1
- package/src/utils/tokens.js.map +0 -1
- package/src/utils/toonFormat.js.map +0 -1
package/src/tools/search/tool.ts
CHANGED
|
@@ -12,7 +12,6 @@ import {
|
|
|
12
12
|
} from './schema';
|
|
13
13
|
import { createSearchAPI, createSourceProcessor } from './search';
|
|
14
14
|
import { createSerperScraper } from './serper-scraper';
|
|
15
|
-
import { createTavilyScraper } from './tavily-scraper';
|
|
16
15
|
import { createFirecrawlScraper } from './firecrawl';
|
|
17
16
|
import { expandHighlights } from './highlights';
|
|
18
17
|
import { formatResultsForLLM } from './format';
|
|
@@ -310,16 +309,12 @@ async function executeParallelSearches({
|
|
|
310
309
|
function createSearchProcessor({
|
|
311
310
|
searchAPI,
|
|
312
311
|
safeSearch,
|
|
313
|
-
supportsVideos,
|
|
314
312
|
sourceProcessor,
|
|
315
313
|
scraper,
|
|
316
314
|
onGetHighlights,
|
|
317
315
|
logger,
|
|
318
316
|
}: {
|
|
319
317
|
safeSearch: t.SearchToolConfig['safeSearch'];
|
|
320
|
-
/* Tavily search API does not return videos. Other providers (Serper)
|
|
321
|
-
* do — this flag short-circuits the videos request when unsupported. */
|
|
322
|
-
supportsVideos: boolean;
|
|
323
318
|
searchAPI: ReturnType<typeof createSearchAPI>;
|
|
324
319
|
sourceProcessor: ReturnType<typeof createSourceProcessor>;
|
|
325
320
|
scraper: t.BaseScraper;
|
|
@@ -371,7 +366,7 @@ function createSearchProcessor({
|
|
|
371
366
|
country,
|
|
372
367
|
safeSearch,
|
|
373
368
|
images,
|
|
374
|
-
videos
|
|
369
|
+
videos,
|
|
375
370
|
news,
|
|
376
371
|
logger,
|
|
377
372
|
});
|
|
@@ -554,10 +549,6 @@ export const createSearchTool = (
|
|
|
554
549
|
serperApiKey,
|
|
555
550
|
searxngInstanceUrl,
|
|
556
551
|
searxngApiKey,
|
|
557
|
-
tavilyApiKey,
|
|
558
|
-
tavilySearchUrl,
|
|
559
|
-
tavilyExtractUrl,
|
|
560
|
-
tavilySearchOptions,
|
|
561
552
|
domainBlocklist,
|
|
562
553
|
countryBlocklist,
|
|
563
554
|
rerankerType = 'cohere',
|
|
@@ -571,7 +562,6 @@ export const createSearchTool = (
|
|
|
571
562
|
firecrawlVersion,
|
|
572
563
|
firecrawlOptions,
|
|
573
564
|
serperScraperOptions,
|
|
574
|
-
tavilyScraperOptions,
|
|
575
565
|
scraperTimeout,
|
|
576
566
|
jinaApiKey,
|
|
577
567
|
jinaApiUrl,
|
|
@@ -581,15 +571,6 @@ export const createSearchTool = (
|
|
|
581
571
|
} = config;
|
|
582
572
|
|
|
583
573
|
const logger = config.logger || createDefaultLogger();
|
|
584
|
-
/* Tavily search API exposes a `safe_search` boolean derived from the
|
|
585
|
-
* tool's existing safeSearch level (0 = off, ≥1 = on). Bridge the two. */
|
|
586
|
-
const effectiveTavilySearchOptions =
|
|
587
|
-
searchProvider === 'tavily' && config.safeSearch != null
|
|
588
|
-
? {
|
|
589
|
-
...tavilySearchOptions,
|
|
590
|
-
safeSearch: config.safeSearch !== 0,
|
|
591
|
-
}
|
|
592
|
-
: tavilySearchOptions;
|
|
593
574
|
|
|
594
575
|
const schemaProperties: Record<string, unknown> = {
|
|
595
576
|
query: querySchema,
|
|
@@ -599,7 +580,7 @@ export const createSearchTool = (
|
|
|
599
580
|
news: newsSchema,
|
|
600
581
|
};
|
|
601
582
|
|
|
602
|
-
if (searchProvider === 'serper'
|
|
583
|
+
if (searchProvider === 'serper') {
|
|
603
584
|
schemaProperties.country = countrySchema;
|
|
604
585
|
}
|
|
605
586
|
|
|
@@ -614,9 +595,6 @@ export const createSearchTool = (
|
|
|
614
595
|
serperApiKey,
|
|
615
596
|
searxngInstanceUrl,
|
|
616
597
|
searxngApiKey,
|
|
617
|
-
tavilyApiKey,
|
|
618
|
-
tavilySearchUrl,
|
|
619
|
-
tavilySearchOptions: effectiveTavilySearchOptions,
|
|
620
598
|
domainBlocklist,
|
|
621
599
|
countryBlocklist,
|
|
622
600
|
});
|
|
@@ -631,17 +609,6 @@ export const createSearchTool = (
|
|
|
631
609
|
timeout: scraperTimeout ?? serperScraperOptions?.timeout,
|
|
632
610
|
logger,
|
|
633
611
|
});
|
|
634
|
-
} else if (scraperProvider === 'tavily') {
|
|
635
|
-
scraperInstance = createTavilyScraper({
|
|
636
|
-
...tavilyScraperOptions,
|
|
637
|
-
apiKey:
|
|
638
|
-
tavilyScraperOptions?.apiKey ??
|
|
639
|
-
tavilyApiKey ??
|
|
640
|
-
process.env.TAVILY_API_KEY,
|
|
641
|
-
apiUrl: tavilyScraperOptions?.apiUrl ?? tavilyExtractUrl,
|
|
642
|
-
timeout: scraperTimeout ?? tavilyScraperOptions?.timeout,
|
|
643
|
-
logger,
|
|
644
|
-
});
|
|
645
612
|
} else {
|
|
646
613
|
scraperInstance = createFirecrawlScraper({
|
|
647
614
|
...firecrawlOptions,
|
|
@@ -680,7 +647,6 @@ export const createSearchTool = (
|
|
|
680
647
|
const search = createSearchProcessor({
|
|
681
648
|
searchAPI,
|
|
682
649
|
safeSearch,
|
|
683
|
-
supportsVideos: searchProvider !== 'tavily',
|
|
684
650
|
sourceProcessor,
|
|
685
651
|
scraper: scraperInstance,
|
|
686
652
|
onGetHighlights,
|
|
@@ -3,8 +3,8 @@ import type { RunnableConfig } from '@langchain/core/runnables';
|
|
|
3
3
|
import type { BaseReranker } from './rerankers';
|
|
4
4
|
import { DATE_RANGE } from './schema';
|
|
5
5
|
|
|
6
|
-
export type SearchProvider = 'serper' | 'searxng'
|
|
7
|
-
export type ScraperProvider = 'firecrawl' | 'serper'
|
|
6
|
+
export type SearchProvider = 'serper' | 'searxng';
|
|
7
|
+
export type ScraperProvider = 'firecrawl' | 'serper';
|
|
8
8
|
export type RerankerType = 'infinity' | 'jina' | 'cohere' | 'none';
|
|
9
9
|
|
|
10
10
|
export interface Highlight {
|
|
@@ -62,59 +62,11 @@ export interface Source {
|
|
|
62
62
|
date?: string;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
export type TavilyTimeRange = 'day' | 'week' | 'month' | 'year';
|
|
66
|
-
export type TavilyTimeRangeInput =
|
|
67
|
-
| TavilyTimeRange
|
|
68
|
-
| 'h'
|
|
69
|
-
| 'd'
|
|
70
|
-
| 'w'
|
|
71
|
-
| 'm'
|
|
72
|
-
| 'y';
|
|
73
|
-
|
|
74
|
-
export interface TavilySearchOptions {
|
|
75
|
-
searchDepth?: 'basic' | 'advanced' | 'fast' | 'ultra-fast';
|
|
76
|
-
maxResults?: number;
|
|
77
|
-
includeImages?: boolean;
|
|
78
|
-
includeAnswer?: boolean | 'basic' | 'advanced';
|
|
79
|
-
includeRawContent?: boolean | 'markdown' | 'text';
|
|
80
|
-
includeDomains?: string[];
|
|
81
|
-
excludeDomains?: string[];
|
|
82
|
-
topic?: 'general' | 'news' | 'finance';
|
|
83
|
-
timeRange?: TavilyTimeRangeInput;
|
|
84
|
-
includeImageDescriptions?: boolean;
|
|
85
|
-
includeFavicon?: boolean;
|
|
86
|
-
chunksPerSource?: number;
|
|
87
|
-
safeSearch?: boolean;
|
|
88
|
-
timeout?: number;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export interface TavilySearchPayload {
|
|
92
|
-
query: string;
|
|
93
|
-
search_depth: NonNullable<TavilySearchOptions['searchDepth']>;
|
|
94
|
-
topic: NonNullable<TavilySearchOptions['topic']>;
|
|
95
|
-
max_results: number;
|
|
96
|
-
safe_search?: boolean;
|
|
97
|
-
time_range?: TavilyTimeRange;
|
|
98
|
-
country?: string;
|
|
99
|
-
include_images?: boolean;
|
|
100
|
-
include_answer?: NonNullable<TavilySearchOptions['includeAnswer']>;
|
|
101
|
-
include_raw_content?: NonNullable<TavilySearchOptions['includeRawContent']>;
|
|
102
|
-
include_domains?: string[];
|
|
103
|
-
exclude_domains?: string[];
|
|
104
|
-
include_image_descriptions?: boolean;
|
|
105
|
-
include_favicon?: boolean;
|
|
106
|
-
chunks_per_source?: number;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
65
|
export interface SearchConfig {
|
|
110
66
|
searchProvider?: SearchProvider;
|
|
111
67
|
serperApiKey?: string;
|
|
112
68
|
searxngInstanceUrl?: string;
|
|
113
69
|
searxngApiKey?: string;
|
|
114
|
-
tavilyApiKey?: string;
|
|
115
|
-
tavilySearchUrl?: string;
|
|
116
|
-
tavilyExtractUrl?: string;
|
|
117
|
-
tavilySearchOptions?: TavilySearchOptions;
|
|
118
70
|
/** Domains to exclude from search results (e.g., 'reddit.com', 'twitter.com').
|
|
119
71
|
* Appended as -site: operators to the search query. */
|
|
120
72
|
domainBlocklist?: string[];
|
|
@@ -160,17 +112,6 @@ export interface SerperScraperConfig {
|
|
|
160
112
|
includeMarkdown?: boolean;
|
|
161
113
|
}
|
|
162
114
|
|
|
163
|
-
export interface TavilyScraperConfig {
|
|
164
|
-
apiKey?: string;
|
|
165
|
-
apiUrl?: string;
|
|
166
|
-
timeout?: number;
|
|
167
|
-
logger?: Logger;
|
|
168
|
-
extractDepth?: 'basic' | 'advanced';
|
|
169
|
-
includeImages?: boolean;
|
|
170
|
-
includeFavicon?: boolean;
|
|
171
|
-
format?: 'markdown' | 'text';
|
|
172
|
-
}
|
|
173
|
-
|
|
174
115
|
export interface ScraperContentResult {
|
|
175
116
|
content: string;
|
|
176
117
|
}
|
|
@@ -219,7 +160,6 @@ export interface SearchToolConfig
|
|
|
219
160
|
extends SearchConfig,
|
|
220
161
|
ProcessSourcesConfig,
|
|
221
162
|
FirecrawlConfig {
|
|
222
|
-
tavilyScraperOptions?: TavilyScraperConfig;
|
|
223
163
|
logger?: Logger;
|
|
224
164
|
safeSearch?: SafeSearchLevel;
|
|
225
165
|
jinaApiKey?: string;
|
|
@@ -247,27 +187,20 @@ export type UsedReferences = {
|
|
|
247
187
|
reference: MediaReference;
|
|
248
188
|
}[];
|
|
249
189
|
|
|
250
|
-
export type AnyScraperResponse =
|
|
251
|
-
| FirecrawlScrapeResponse
|
|
252
|
-
| SerperScrapeResponse
|
|
253
|
-
| TavilyScrapeResponse;
|
|
254
|
-
|
|
255
190
|
/** Base Scraper Interface */
|
|
256
191
|
export interface BaseScraper {
|
|
257
192
|
scrapeUrl(
|
|
258
193
|
url: string,
|
|
259
194
|
options?: unknown
|
|
260
|
-
): Promise<[string,
|
|
261
|
-
scrapeUrls?(
|
|
262
|
-
urls: string[],
|
|
263
|
-
options?: unknown
|
|
264
|
-
): Promise<Array<[string, AnyScraperResponse]>>;
|
|
195
|
+
): Promise<[string, FirecrawlScrapeResponse | SerperScrapeResponse]>;
|
|
265
196
|
extractContent(
|
|
266
|
-
response:
|
|
197
|
+
response: FirecrawlScrapeResponse | SerperScrapeResponse
|
|
267
198
|
): [string, undefined | References];
|
|
268
199
|
extractMetadata(
|
|
269
|
-
response:
|
|
270
|
-
):
|
|
200
|
+
response: FirecrawlScrapeResponse | SerperScrapeResponse
|
|
201
|
+
):
|
|
202
|
+
| ScrapeMetadata
|
|
203
|
+
| Record<string, string | number | boolean | null | undefined>;
|
|
271
204
|
}
|
|
272
205
|
|
|
273
206
|
/** Firecrawl */
|
|
@@ -281,25 +214,6 @@ export type SerperScrapeOptions = Omit<
|
|
|
281
214
|
'apiKey' | 'apiUrl' | 'logger'
|
|
282
215
|
>;
|
|
283
216
|
|
|
284
|
-
export type TavilyScrapeOptions = Omit<
|
|
285
|
-
TavilyScraperConfig,
|
|
286
|
-
'apiKey' | 'apiUrl' | 'logger'
|
|
287
|
-
>;
|
|
288
|
-
|
|
289
|
-
export interface TavilyExtractPayload {
|
|
290
|
-
urls: string[];
|
|
291
|
-
extract_depth: NonNullable<TavilyScraperConfig['extractDepth']>;
|
|
292
|
-
include_images: boolean;
|
|
293
|
-
include_favicon?: boolean;
|
|
294
|
-
format?: NonNullable<TavilyScraperConfig['format']>;
|
|
295
|
-
timeout?: number;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
export type GenericScrapeMetadata = Record<
|
|
299
|
-
string,
|
|
300
|
-
string | number | boolean | null | undefined
|
|
301
|
-
>;
|
|
302
|
-
|
|
303
217
|
export interface ScrapeMetadata {
|
|
304
218
|
// Core source information
|
|
305
219
|
sourceURL?: string;
|
|
@@ -386,45 +300,6 @@ export interface SerperScrapeResponse {
|
|
|
386
300
|
error?: string;
|
|
387
301
|
}
|
|
388
302
|
|
|
389
|
-
export interface TavilyScrapeResponse {
|
|
390
|
-
success: boolean;
|
|
391
|
-
data?: {
|
|
392
|
-
rawContent?: string;
|
|
393
|
-
images?: string[];
|
|
394
|
-
favicon?: string;
|
|
395
|
-
};
|
|
396
|
-
error?: string;
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
export interface TavilySearchResult {
|
|
400
|
-
title?: string;
|
|
401
|
-
url?: string;
|
|
402
|
-
content?: string;
|
|
403
|
-
score?: number;
|
|
404
|
-
published_date?: string;
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
export type TavilyImageResult =
|
|
408
|
-
| string
|
|
409
|
-
| {
|
|
410
|
-
url?: string;
|
|
411
|
-
description?: string;
|
|
412
|
-
};
|
|
413
|
-
|
|
414
|
-
export interface TavilySearchResponse {
|
|
415
|
-
answer?: string;
|
|
416
|
-
images?: TavilyImageResult[];
|
|
417
|
-
results?: TavilySearchResult[];
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
export interface TavilyExtractResult {
|
|
421
|
-
url: string;
|
|
422
|
-
raw_content?: string;
|
|
423
|
-
images?: string[];
|
|
424
|
-
favicon?: string;
|
|
425
|
-
error?: string;
|
|
426
|
-
}
|
|
427
|
-
|
|
428
303
|
export interface FirecrawlScraperConfig {
|
|
429
304
|
apiKey?: string;
|
|
430
305
|
apiUrl?: string;
|
|
@@ -29,18 +29,11 @@ export const fileExtRegex =
|
|
|
29
29
|
|
|
30
30
|
export const getDomainName = (
|
|
31
31
|
link: string,
|
|
32
|
-
metadata?: t.ScrapeMetadata
|
|
32
|
+
metadata?: t.ScrapeMetadata,
|
|
33
33
|
logger?: t.Logger
|
|
34
34
|
): string | undefined => {
|
|
35
35
|
try {
|
|
36
|
-
const
|
|
37
|
-
const metadataUrl = metadata?.url;
|
|
38
|
-
const url =
|
|
39
|
-
typeof sourceUrl === 'string'
|
|
40
|
-
? sourceUrl
|
|
41
|
-
: typeof metadataUrl === 'string'
|
|
42
|
-
? metadataUrl
|
|
43
|
-
: link || '';
|
|
36
|
+
const url = metadata?.sourceURL ?? metadata?.url ?? (link || '');
|
|
44
37
|
const domain = new URL(url).hostname.replace(/^www\./, '');
|
|
45
38
|
if (domain) {
|
|
46
39
|
return domain;
|
|
@@ -59,7 +52,7 @@ export const getDomainName = (
|
|
|
59
52
|
|
|
60
53
|
export function getAttribution(
|
|
61
54
|
link: string,
|
|
62
|
-
metadata?: t.ScrapeMetadata
|
|
55
|
+
metadata?: t.ScrapeMetadata,
|
|
63
56
|
logger?: t.Logger
|
|
64
57
|
): string | undefined {
|
|
65
58
|
if (!metadata) return getDomainName(link, metadata, logger);
|
|
@@ -67,17 +60,16 @@ export function getAttribution(
|
|
|
67
60
|
const twitterSite = metadata['twitter:site'];
|
|
68
61
|
const twitterSiteFormatted =
|
|
69
62
|
typeof twitterSite === 'string' ? twitterSite.replace(/^@/, '') : undefined;
|
|
70
|
-
const title = metadata.title;
|
|
71
63
|
|
|
72
64
|
const possibleAttributions = [
|
|
73
65
|
metadata.ogSiteName,
|
|
74
66
|
metadata['og:site_name'],
|
|
75
|
-
|
|
67
|
+
metadata.title?.split('|').pop()?.trim(),
|
|
76
68
|
twitterSiteFormatted,
|
|
77
69
|
];
|
|
78
70
|
|
|
79
71
|
const attribution = possibleAttributions.find(
|
|
80
|
-
(attr)
|
|
72
|
+
(attr) => attr != null && typeof attr === 'string' && attr.trim() !== ''
|
|
81
73
|
);
|
|
82
74
|
if (attribution != null) {
|
|
83
75
|
return attribution;
|
|
@@ -40,6 +40,35 @@ export type SubagentExecuteParams = {
|
|
|
40
40
|
* without relying on event ordering heuristics.
|
|
41
41
|
*/
|
|
42
42
|
parentToolCallId?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Snapshot of the parent invocation's `config.configurable` at the
|
|
45
|
+
* spawn-tool call site. Inherited verbatim into the child workflow's
|
|
46
|
+
* `configurable` so host-set fields (`requestBody`, `user`,
|
|
47
|
+
* `userMCPAuthMap`, etc.) propagate — fixing MCP body-placeholder
|
|
48
|
+
* substitution and per-user lookups for subagent tool calls.
|
|
49
|
+
*
|
|
50
|
+
* Inheritance details (verified empirically against LangGraph):
|
|
51
|
+
* - host-set keys propagate as-is into the child's tool dispatches;
|
|
52
|
+
* - `thread_id` propagates (with `childRunId` as a fallback when
|
|
53
|
+
* parent did not supply one) — matches the "subagent is part of
|
|
54
|
+
* the same conversation" mental model and aligns with the
|
|
55
|
+
* `sessionId: this.parentRunId` convention this executor already
|
|
56
|
+
* uses for `SubagentStart` / `SubagentStop` hooks;
|
|
57
|
+
* - `parent_run_id` propagates when the host put it on parent's
|
|
58
|
+
* configurable;
|
|
59
|
+
* - `run_id` is *overwritten by the LangGraph runtime* at child
|
|
60
|
+
* invoke time regardless of what we forward — child's tool
|
|
61
|
+
* dispatches see the child graph's runtime runId in
|
|
62
|
+
* `configurable.run_id`, not the parent's. Hosts that need
|
|
63
|
+
* parent-scoped run identity for downstream consumers should
|
|
64
|
+
* plumb it via a host-defined key (e.g. `requestBody.messageId`),
|
|
65
|
+
* not `run_id`.
|
|
66
|
+
*
|
|
67
|
+
* A future revision will likely make this inheritance configurable
|
|
68
|
+
* per spawn type — background / async subagents may want isolation
|
|
69
|
+
* rather than sharing parent's host context.
|
|
70
|
+
*/
|
|
71
|
+
parentConfigurable?: Record<string, unknown>;
|
|
43
72
|
};
|
|
44
73
|
|
|
45
74
|
export type SubagentExecuteResult = {
|
|
@@ -246,6 +275,52 @@ export class SubagentExecutor {
|
|
|
246
275
|
* nested trace pollution).
|
|
247
276
|
*/
|
|
248
277
|
const callbacks: Callbacks = forwarder ? [forwarder] : [];
|
|
278
|
+
/**
|
|
279
|
+
* Inherit the parent's `configurable` verbatim — host-set fields
|
|
280
|
+
* (`requestBody`, `user`, `userMCPAuthMap`, etc.) AND the run-
|
|
281
|
+
* identity fields (`run_id`, `parent_run_id`, `thread_id`) all
|
|
282
|
+
* propagate.
|
|
283
|
+
*
|
|
284
|
+
* Run-identity propagation is intentional and matches the
|
|
285
|
+
* convention this executor itself already uses for `SubagentStart`
|
|
286
|
+
* / `SubagentStop` hooks (`sessionId: this.parentRunId`): the
|
|
287
|
+
* subagent runs under the parent's session scope, not its own.
|
|
288
|
+
* Forwarding `run_id` / `parent_run_id` / `thread_id` makes
|
|
289
|
+
* `ToolNode`'s hook lookups (`hasHookFor(eventName, runId)`),
|
|
290
|
+
* `ToolOutputReferenceRegistry` keying, and trace lineage all
|
|
291
|
+
* resolve to the parent's session for tools dispatched from the
|
|
292
|
+
* subagent — so `PreToolUse` / `PostToolUse` hooks the host
|
|
293
|
+
* registered against the parent's run fire for subagent tool
|
|
294
|
+
* calls too. "Same run" matches the user-perceptual mental model.
|
|
295
|
+
*
|
|
296
|
+
* `thread_id` falls back to `childRunId` only when the parent
|
|
297
|
+
* didn't supply one (legacy behavior preserved for hosts that
|
|
298
|
+
* never set thread_id).
|
|
299
|
+
*
|
|
300
|
+
* NOTE: a future revision will likely make this configurable per
|
|
301
|
+
* spawn type — e.g. a background / async subagent that runs after
|
|
302
|
+
* the parent's run completes wants isolation, not inheritance.
|
|
303
|
+
* For now the inheritance path matches LibreChat's primary use
|
|
304
|
+
* case (synchronous subagents within a single user turn).
|
|
305
|
+
*/
|
|
306
|
+
const inheritedConfigurable: Record<string, unknown> =
|
|
307
|
+
params.parentConfigurable ?? {};
|
|
308
|
+
/**
|
|
309
|
+
* Surface the parent's `subagent` tool_call.id to the child's run
|
|
310
|
+
* metadata so host-side artifact handlers (e.g. ranger's
|
|
311
|
+
* `resolveUiToolCallId`) can re-key child-emitted attachments to
|
|
312
|
+
* the parent's bubble. Without this, files produced by tools
|
|
313
|
+
* inside a subagent (execute_code .docx, image_gen, etc.) get
|
|
314
|
+
* attached to the child's inner tool_call_id — which the parent
|
|
315
|
+
* message has no record of — and orphan in the chat UI.
|
|
316
|
+
*/
|
|
317
|
+
const inheritedMetadata: Record<string, unknown> = {
|
|
318
|
+
...((inheritedConfigurable as { metadata?: Record<string, unknown> })
|
|
319
|
+
.metadata ?? {}),
|
|
320
|
+
parentToolCallId,
|
|
321
|
+
subagentAgentId: childAgentId,
|
|
322
|
+
subagentType,
|
|
323
|
+
};
|
|
249
324
|
result = await workflow.invoke(
|
|
250
325
|
{ messages: [new HumanMessage(description)] },
|
|
251
326
|
{
|
|
@@ -255,7 +330,10 @@ export class SubagentExecutor {
|
|
|
255
330
|
runName: `subagent:${subagentType}`,
|
|
256
331
|
configurable: {
|
|
257
332
|
thread_id: childRunId,
|
|
333
|
+
...inheritedConfigurable,
|
|
334
|
+
parentToolCallId,
|
|
258
335
|
},
|
|
336
|
+
metadata: inheritedMetadata,
|
|
259
337
|
}
|
|
260
338
|
);
|
|
261
339
|
} catch (error) {
|
package/src/types/graph.ts
CHANGED
|
@@ -36,7 +36,6 @@ import type {
|
|
|
36
36
|
ReasoningDeltaEvent,
|
|
37
37
|
} from '@/types/stream';
|
|
38
38
|
import type { TokenCounter } from '@/types/run';
|
|
39
|
-
import type { SystemCacheBlock, AgentCacheTTL } from '@/types/agent-cache';
|
|
40
39
|
|
|
41
40
|
/** Interface for bound model with stream and invoke methods */
|
|
42
41
|
export interface ChatModel {
|
|
@@ -739,36 +738,10 @@ export interface AgentInputs {
|
|
|
739
738
|
toolMap?: ToolMap;
|
|
740
739
|
tools?: GraphTools;
|
|
741
740
|
provider: Providers;
|
|
742
|
-
/**
|
|
743
|
-
* Ordered list of cacheable system content blocks emitted BEFORE
|
|
744
|
-
* `instructions` in the system message. Each block gets its own cache
|
|
745
|
-
* marker (cachePoint on Bedrock, cache_control on Anthropic) so the
|
|
746
|
-
* cache key for each block includes only the bytes up to and including
|
|
747
|
-
* its own marker. Entries are emitted in array order — earlier =
|
|
748
|
-
* stabler = wider cache key (best for cross-tenant sharing).
|
|
749
|
-
*
|
|
750
|
-
* See `src/types/agent-cache.ts` for full semantics. Capped at
|
|
751
|
-
* `MAX_SYSTEM_CACHE_BLOCKS` (2) entries to stay within Bedrock's
|
|
752
|
-
* 4-cachePoint budget after the tools array consumes 2.
|
|
753
|
-
*/
|
|
754
|
-
system_cache_blocks?: SystemCacheBlock[];
|
|
755
|
-
/**
|
|
756
|
-
* Stable/cacheable system instructions for this agent. Always emitted
|
|
757
|
-
* with its own trailing cache marker (when caching is supported by
|
|
758
|
-
* the provider/model). Use `instructions_cache_ttl` to override the
|
|
759
|
-
* default '5m' TTL.
|
|
760
|
-
*/
|
|
761
741
|
instructions?: string;
|
|
762
|
-
/** TTL for the trailing `instructions` cache marker. Defaults to '5m'. */
|
|
763
|
-
instructions_cache_ttl?: AgentCacheTTL;
|
|
764
742
|
streamBuffer?: number;
|
|
765
743
|
maxContextTokens?: number;
|
|
766
744
|
clientOptions?: ClientOptions;
|
|
767
|
-
/**
|
|
768
|
-
* Dynamic system tail appended after the cacheable instructions
|
|
769
|
-
* without any cache marker. Per-user / per-message context belongs
|
|
770
|
-
* here so it does not invalidate the cacheable prefix.
|
|
771
|
-
*/
|
|
772
745
|
additional_instructions?: string;
|
|
773
746
|
reasoningKey?: 'reasoning_content' | 'reasoning';
|
|
774
747
|
/**
|
|
@@ -858,6 +831,27 @@ export interface AgentInputs {
|
|
|
858
831
|
* @see SummarizationConfig
|
|
859
832
|
*/
|
|
860
833
|
summarizationConfig?: SummarizationConfig;
|
|
834
|
+
/**
|
|
835
|
+
* Workspace-shared system-message tiers. Each entry becomes a separate
|
|
836
|
+
* text block in the SystemMessage with its own cachePoint / cache_control
|
|
837
|
+
* marker, allowing the platform-tier bytes (e.g. shared branding, tool
|
|
838
|
+
* routing rules, code-executor instructions) to be hashed independently
|
|
839
|
+
* from the per-agent `instructions` block. Hosts that don't use tiered
|
|
840
|
+
* caching can leave this undefined; behavior falls back to the legacy
|
|
841
|
+
* single SystemMessage.
|
|
842
|
+
*
|
|
843
|
+
* Anthropic / Bedrock prompt-cache lookups are forward-prefix-hash, so
|
|
844
|
+
* blocks are emitted in array order BEFORE `instructions`. Up to 4 blocks
|
|
845
|
+
* are supported (the LLM cap on cache breakpoints).
|
|
846
|
+
*/
|
|
847
|
+
system_cache_blocks?: Array<{ text: string; ttl?: '5m' | '1h' }>;
|
|
848
|
+
/**
|
|
849
|
+
* TTL hint for the per-agent `instructions` block's cache marker.
|
|
850
|
+
* Defaults to '5m' (matching addCacheControl message-level behavior).
|
|
851
|
+
* Only consulted when `system_cache_blocks` is set; otherwise the
|
|
852
|
+
* legacy SystemMessage path is unchanged.
|
|
853
|
+
*/
|
|
854
|
+
instructions_cache_ttl?: '5m' | '1h';
|
|
861
855
|
/**
|
|
862
856
|
* Lightweight file manifest for the conversation.
|
|
863
857
|
* Contains file IDs, names, and metadata — NOT full content.
|
package/src/types/index.ts
CHANGED
package/src/types/run.ts
CHANGED
|
@@ -74,9 +74,7 @@ export interface AgentStateChannels {
|
|
|
74
74
|
messages: BaseMessage[];
|
|
75
75
|
next: string;
|
|
76
76
|
[key: string]: unknown;
|
|
77
|
-
/** Stable/cacheable system instructions for this agent. */
|
|
78
77
|
instructions?: string;
|
|
79
|
-
/** Dynamic system tail appended after stable instructions. */
|
|
80
78
|
additional_instructions?: string;
|
|
81
79
|
}
|
|
82
80
|
|
package/src/types/tools.ts
CHANGED
|
@@ -144,15 +144,6 @@ export type FileRef = {
|
|
|
144
144
|
path?: string;
|
|
145
145
|
/** Session ID this file belongs to (for multi-session file tracking) */
|
|
146
146
|
session_id?: string;
|
|
147
|
-
/**
|
|
148
|
-
* `true` when the codeapi sandbox echoed this entry as an unchanged
|
|
149
|
-
* passthrough of an input the caller already owns (skill files,
|
|
150
|
-
* downloaded inputs whose hash matched the baseline, inherited
|
|
151
|
-
* `.dirkeep` markers). The tool-result formatter renders these as
|
|
152
|
-
* "Available files" rather than "Generated files" so the LLM doesn't
|
|
153
|
-
* conflate infrastructure inputs with newly-produced outputs.
|
|
154
|
-
*/
|
|
155
|
-
inherited?: true;
|
|
156
147
|
};
|
|
157
148
|
|
|
158
149
|
export type FileRefs = FileRef[];
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"google-common.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var messages = require('@langchain/core/messages');
|
|
4
|
-
var prompts = require('@langchain/core/prompts');
|
|
5
|
-
var runnables = require('@langchain/core/runnables');
|
|
6
|
-
var tools = require('@langchain/core/tools');
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
Object.defineProperty(exports, "AIMessage", {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function () { return messages.AIMessage; }
|
|
13
|
-
});
|
|
14
|
-
Object.defineProperty(exports, "AIMessageChunk", {
|
|
15
|
-
enumerable: true,
|
|
16
|
-
get: function () { return messages.AIMessageChunk; }
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(exports, "BaseMessage", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function () { return messages.BaseMessage; }
|
|
21
|
-
});
|
|
22
|
-
Object.defineProperty(exports, "BaseMessageChunk", {
|
|
23
|
-
enumerable: true,
|
|
24
|
-
get: function () { return messages.BaseMessageChunk; }
|
|
25
|
-
});
|
|
26
|
-
Object.defineProperty(exports, "HumanMessage", {
|
|
27
|
-
enumerable: true,
|
|
28
|
-
get: function () { return messages.HumanMessage; }
|
|
29
|
-
});
|
|
30
|
-
Object.defineProperty(exports, "SystemMessage", {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
get: function () { return messages.SystemMessage; }
|
|
33
|
-
});
|
|
34
|
-
Object.defineProperty(exports, "ToolMessage", {
|
|
35
|
-
enumerable: true,
|
|
36
|
-
get: function () { return messages.ToolMessage; }
|
|
37
|
-
});
|
|
38
|
-
Object.defineProperty(exports, "getBufferString", {
|
|
39
|
-
enumerable: true,
|
|
40
|
-
get: function () { return messages.getBufferString; }
|
|
41
|
-
});
|
|
42
|
-
Object.defineProperty(exports, "isAIMessage", {
|
|
43
|
-
enumerable: true,
|
|
44
|
-
get: function () { return messages.isAIMessage; }
|
|
45
|
-
});
|
|
46
|
-
Object.defineProperty(exports, "isBaseMessage", {
|
|
47
|
-
enumerable: true,
|
|
48
|
-
get: function () { return messages.isBaseMessage; }
|
|
49
|
-
});
|
|
50
|
-
Object.defineProperty(exports, "isToolMessage", {
|
|
51
|
-
enumerable: true,
|
|
52
|
-
get: function () { return messages.isToolMessage; }
|
|
53
|
-
});
|
|
54
|
-
Object.defineProperty(exports, "PromptTemplate", {
|
|
55
|
-
enumerable: true,
|
|
56
|
-
get: function () { return prompts.PromptTemplate; }
|
|
57
|
-
});
|
|
58
|
-
Object.defineProperty(exports, "Runnable", {
|
|
59
|
-
enumerable: true,
|
|
60
|
-
get: function () { return runnables.Runnable; }
|
|
61
|
-
});
|
|
62
|
-
Object.defineProperty(exports, "RunnableLambda", {
|
|
63
|
-
enumerable: true,
|
|
64
|
-
get: function () { return runnables.RunnableLambda; }
|
|
65
|
-
});
|
|
66
|
-
Object.defineProperty(exports, "RunnableSequence", {
|
|
67
|
-
enumerable: true,
|
|
68
|
-
get: function () { return runnables.RunnableSequence; }
|
|
69
|
-
});
|
|
70
|
-
Object.defineProperty(exports, "DynamicStructuredTool", {
|
|
71
|
-
enumerable: true,
|
|
72
|
-
get: function () { return tools.DynamicStructuredTool; }
|
|
73
|
-
});
|
|
74
|
-
Object.defineProperty(exports, "StructuredTool", {
|
|
75
|
-
enumerable: true,
|
|
76
|
-
get: function () { return tools.StructuredTool; }
|
|
77
|
-
});
|
|
78
|
-
Object.defineProperty(exports, "Tool", {
|
|
79
|
-
enumerable: true,
|
|
80
|
-
get: function () { return tools.Tool; }
|
|
81
|
-
});
|
|
82
|
-
Object.defineProperty(exports, "tool", {
|
|
83
|
-
enumerable: true,
|
|
84
|
-
get: function () { return tools.tool; }
|
|
85
|
-
});
|
|
86
|
-
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chat_models.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tool.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|