@illuma-ai/agents 1.3.2 → 1.4.0-alpha.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/dist/cjs/graphs/Graph.cjs +3 -18
- package/dist/cjs/graphs/Graph.cjs.map +1 -1
- package/dist/cjs/llm/openai/index.cjs +3 -0
- package/dist/cjs/llm/openai/index.cjs.map +1 -1
- package/dist/cjs/main.cjs +56 -0
- package/dist/cjs/main.cjs.map +1 -1
- package/dist/cjs/providers/a2a/A2ACapabilityProvider.cjs +288 -0
- package/dist/cjs/providers/a2a/A2ACapabilityProvider.cjs.map +1 -0
- package/dist/cjs/providers/a2a/client.cjs +92 -0
- package/dist/cjs/providers/a2a/client.cjs.map +1 -0
- package/dist/cjs/providers/a2a/config.cjs +38 -0
- package/dist/cjs/providers/a2a/config.cjs.map +1 -0
- package/dist/cjs/providers/capabilityNaming.cjs +43 -0
- package/dist/cjs/providers/capabilityNaming.cjs.map +1 -0
- package/dist/cjs/providers/mcp/MCPCapabilityProvider.cjs +244 -0
- package/dist/cjs/providers/mcp/MCPCapabilityProvider.cjs.map +1 -0
- package/dist/cjs/providers/mcp/config.cjs +42 -0
- package/dist/cjs/providers/mcp/config.cjs.map +1 -0
- package/dist/cjs/providers/mcp/transport.cjs +65 -0
- package/dist/cjs/providers/mcp/transport.cjs.map +1 -0
- package/dist/cjs/providers/tools-server/ToolsServerCapabilityProvider.cjs +121 -0
- package/dist/cjs/providers/tools-server/ToolsServerCapabilityProvider.cjs.map +1 -0
- package/dist/cjs/providers/types.cjs +51 -0
- package/dist/cjs/providers/types.cjs.map +1 -0
- package/dist/cjs/tools/ToolNode.cjs +3 -0
- package/dist/cjs/tools/ToolNode.cjs.map +1 -1
- package/dist/cjs/tools/proxyTool.cjs +100 -0
- package/dist/cjs/tools/proxyTool.cjs.map +1 -0
- package/dist/cjs/utils/credentials.cjs +142 -0
- package/dist/cjs/utils/credentials.cjs.map +1 -0
- package/dist/cjs/utils/httpClient.cjs +74 -0
- package/dist/cjs/utils/httpClient.cjs.map +1 -0
- package/dist/cjs/utils/toolManifest.cjs +100 -0
- package/dist/cjs/utils/toolManifest.cjs.map +1 -0
- package/dist/esm/graphs/Graph.mjs +3 -18
- package/dist/esm/graphs/Graph.mjs.map +1 -1
- package/dist/esm/llm/openai/index.mjs +3 -0
- package/dist/esm/llm/openai/index.mjs.map +1 -1
- package/dist/esm/main.mjs +13 -0
- package/dist/esm/main.mjs.map +1 -1
- package/dist/esm/providers/a2a/A2ACapabilityProvider.mjs +281 -0
- package/dist/esm/providers/a2a/A2ACapabilityProvider.mjs.map +1 -0
- package/dist/esm/providers/a2a/client.mjs +88 -0
- package/dist/esm/providers/a2a/client.mjs.map +1 -0
- package/dist/esm/providers/a2a/config.mjs +35 -0
- package/dist/esm/providers/a2a/config.mjs.map +1 -0
- package/dist/esm/providers/capabilityNaming.mjs +39 -0
- package/dist/esm/providers/capabilityNaming.mjs.map +1 -0
- package/dist/esm/providers/mcp/MCPCapabilityProvider.mjs +240 -0
- package/dist/esm/providers/mcp/MCPCapabilityProvider.mjs.map +1 -0
- package/dist/esm/providers/mcp/config.mjs +39 -0
- package/dist/esm/providers/mcp/config.mjs.map +1 -0
- package/dist/esm/providers/mcp/transport.mjs +63 -0
- package/dist/esm/providers/mcp/transport.mjs.map +1 -0
- package/dist/esm/providers/tools-server/ToolsServerCapabilityProvider.mjs +119 -0
- package/dist/esm/providers/tools-server/ToolsServerCapabilityProvider.mjs.map +1 -0
- package/dist/esm/providers/types.mjs +51 -0
- package/dist/esm/providers/types.mjs.map +1 -0
- package/dist/esm/tools/ToolNode.mjs +3 -0
- package/dist/esm/tools/ToolNode.mjs.map +1 -1
- package/dist/esm/tools/proxyTool.mjs +98 -0
- package/dist/esm/tools/proxyTool.mjs.map +1 -0
- package/dist/esm/utils/credentials.mjs +135 -0
- package/dist/esm/utils/credentials.mjs.map +1 -0
- package/dist/esm/utils/httpClient.mjs +70 -0
- package/dist/esm/utils/httpClient.mjs.map +1 -0
- package/dist/esm/utils/toolManifest.mjs +96 -0
- package/dist/esm/utils/toolManifest.mjs.map +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/providers/a2a/A2ACapabilityProvider.d.ts +89 -0
- package/dist/types/providers/a2a/client.d.ts +47 -0
- package/dist/types/providers/a2a/config.d.ts +18 -0
- package/dist/types/providers/a2a/index.d.ts +6 -0
- package/dist/types/providers/a2a/types.d.ts +173 -0
- package/dist/types/providers/capabilityNaming.d.ts +25 -0
- package/dist/types/providers/index.d.ts +12 -0
- package/dist/types/providers/mcp/MCPCapabilityProvider.d.ts +54 -0
- package/dist/types/providers/mcp/config.d.ts +20 -0
- package/dist/types/providers/mcp/index.d.ts +5 -0
- package/dist/types/providers/mcp/transport.d.ts +18 -0
- package/dist/types/providers/mcp/types.d.ts +112 -0
- package/dist/types/providers/tools-server/ToolsServerCapabilityProvider.d.ts +45 -0
- package/dist/types/providers/tools-server/index.d.ts +1 -0
- package/dist/types/providers/types.d.ts +170 -0
- package/dist/types/tools/proxyTool.d.ts +55 -0
- package/dist/types/utils/credentials.d.ts +77 -0
- package/dist/types/utils/httpClient.d.ts +46 -0
- package/dist/types/utils/index.d.ts +3 -0
- package/dist/types/utils/toolManifest.d.ts +49 -0
- package/package.json +16 -1
- package/src/graphs/Graph.ts +0 -23
- package/src/index.ts +4 -0
- package/src/providers/__tests__/ToolsServerCapabilityProvider.integration.spec.ts +79 -0
- package/src/providers/__tests__/ToolsServerCapabilityProvider.test.ts +206 -0
- package/src/providers/__tests__/types.test.ts +64 -0
- package/src/providers/a2a/A2ACapabilityProvider.ts +384 -0
- package/src/providers/a2a/__tests__/A2ACapabilityProvider.integration.spec.ts +345 -0
- package/src/providers/a2a/__tests__/A2ACapabilityProvider.test.ts +460 -0
- package/src/providers/a2a/client.ts +115 -0
- package/src/providers/a2a/config.ts +40 -0
- package/src/providers/a2a/index.ts +29 -0
- package/src/providers/a2a/types.ts +191 -0
- package/src/providers/capabilityNaming.ts +42 -0
- package/src/providers/index.ts +68 -0
- package/src/providers/mcp/MCPCapabilityProvider.ts +345 -0
- package/src/providers/mcp/__tests__/MCPCapabilityProvider.integration.spec.ts +386 -0
- package/src/providers/mcp/__tests__/MCPCapabilityProvider.test.ts +371 -0
- package/src/providers/mcp/config.ts +45 -0
- package/src/providers/mcp/index.ts +21 -0
- package/src/providers/mcp/transport.ts +76 -0
- package/src/providers/mcp/types.ts +139 -0
- package/src/providers/tools-server/ToolsServerCapabilityProvider.ts +220 -0
- package/src/providers/tools-server/index.ts +1 -0
- package/src/providers/types.ts +187 -0
- package/src/tools/proxyTool.ts +146 -0
- package/src/utils/__tests__/credentials.test.ts +130 -0
- package/src/utils/__tests__/httpClient.test.ts +75 -0
- package/src/utils/__tests__/toolManifest.test.ts +116 -0
- package/src/utils/credentials.ts +157 -0
- package/src/utils/httpClient.ts +92 -0
- package/src/utils/index.ts +3 -0
- package/src/utils/toolManifest.ts +109 -0
- package/src/agents/AgentContext.js.map +0 -1
- package/src/agents/AgentContext.test.js.map +0 -1
- 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/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/tools.js.map +0 -1
- package/src/llm/bedrock/__tests__/bedrock-caching.test.js.map +0 -1
- 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/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/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
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { AuthSource } from '../providers/types.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Credential merging utility for capability providers.
|
|
5
|
+
*
|
|
6
|
+
* The host is the source of truth for credential values. It resolves them
|
|
7
|
+
* from env vars, user settings, or active OAuth sessions, then passes a
|
|
8
|
+
* flat CredentialMap to the provider.
|
|
9
|
+
*
|
|
10
|
+
* This utility helps hosts build that map from multiple sources with clear
|
|
11
|
+
* precedence rules. Providers themselves do NOT use this — they just receive
|
|
12
|
+
* the finished map.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Source of a credential value in the merged result. Useful for logging
|
|
16
|
+
* and debugging which layer won a given authField.
|
|
17
|
+
*/
|
|
18
|
+
var CredentialOrigin;
|
|
19
|
+
(function (CredentialOrigin) {
|
|
20
|
+
/** From the caller's process env (typically the CLI). */
|
|
21
|
+
CredentialOrigin["ENV"] = "env";
|
|
22
|
+
/** From the agent definition's tool_credentials block. */
|
|
23
|
+
CredentialOrigin["AGENT"] = "agent";
|
|
24
|
+
/** From the user's stored credentials in the host's credential store. */
|
|
25
|
+
CredentialOrigin["USER"] = "user";
|
|
26
|
+
/** From an active OAuth session forwarded by the host. */
|
|
27
|
+
CredentialOrigin["SESSION"] = "session";
|
|
28
|
+
/** Injected by the host at runtime for another reason. */
|
|
29
|
+
CredentialOrigin["RUNTIME"] = "runtime";
|
|
30
|
+
})(CredentialOrigin || (CredentialOrigin = {}));
|
|
31
|
+
/**
|
|
32
|
+
* Merge credential layers with earlier layers overriding later ones.
|
|
33
|
+
*
|
|
34
|
+
* Typical host flow (in order of precedence):
|
|
35
|
+
* 1. runtime overrides (e.g., test injection) → RUNTIME
|
|
36
|
+
* 2. active OAuth session tokens → SESSION
|
|
37
|
+
* 3. agent-defined tool_credentials → AGENT
|
|
38
|
+
* 4. user's stored credentials → USER
|
|
39
|
+
* 5. process env → ENV
|
|
40
|
+
*
|
|
41
|
+
* Caller passes layers in precedence order (highest first).
|
|
42
|
+
*/
|
|
43
|
+
function mergeCredentials(...layers) {
|
|
44
|
+
const merged = {};
|
|
45
|
+
// Iterate reverse so first-declared layer wins on collision.
|
|
46
|
+
for (let i = layers.length - 1; i >= 0; i--) {
|
|
47
|
+
const layer = layers[i];
|
|
48
|
+
for (const [key, value] of Object.entries(layer.values)) {
|
|
49
|
+
if (value !== undefined && value !== null && value !== '') {
|
|
50
|
+
merged[key] = value;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return merged;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Given a set of capabilities, return the union of authField names they
|
|
58
|
+
* require. Useful for hosts that want to pre-resolve credentials before
|
|
59
|
+
* calling createRunnables.
|
|
60
|
+
*/
|
|
61
|
+
function collectRequiredAuthFields(capabilities) {
|
|
62
|
+
const fields = new Set();
|
|
63
|
+
for (const cap of capabilities) {
|
|
64
|
+
for (const entry of cap.authConfig) {
|
|
65
|
+
fields.add(entry.authField);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return Array.from(fields);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Filter out credentials that the provider is expected to resolve itself
|
|
72
|
+
* (source === SERVER). Hosts call this before forwarding — these values
|
|
73
|
+
* live in the provider's own environment and shouldn't be sent.
|
|
74
|
+
*
|
|
75
|
+
* Precedence: entries without `source` default to USER (must be forwarded).
|
|
76
|
+
*/
|
|
77
|
+
function filterForwardableCredentials(credentials, capabilities) {
|
|
78
|
+
const serverManagedFields = new Set();
|
|
79
|
+
for (const cap of capabilities) {
|
|
80
|
+
for (const entry of cap.authConfig) {
|
|
81
|
+
if (entry.source === AuthSource.SERVER) {
|
|
82
|
+
serverManagedFields.add(entry.authField);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
const forwardable = {};
|
|
87
|
+
for (const [key, value] of Object.entries(credentials)) {
|
|
88
|
+
if (!serverManagedFields.has(key)) {
|
|
89
|
+
forwardable[key] = value;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return forwardable;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Validate that all required credentials for a capability are present in
|
|
96
|
+
* the provided map. Returns the list of missing authFields (empty array
|
|
97
|
+
* if all satisfied). Credentials with `source === SERVER` are excluded
|
|
98
|
+
* from the check since the provider resolves them.
|
|
99
|
+
*/
|
|
100
|
+
function findMissingCredentials(capability, credentials) {
|
|
101
|
+
const missing = [];
|
|
102
|
+
for (const entry of capability.authConfig) {
|
|
103
|
+
if (entry.source === AuthSource.SERVER)
|
|
104
|
+
continue;
|
|
105
|
+
if (!entry.required)
|
|
106
|
+
continue;
|
|
107
|
+
if (!credentials[entry.authField]) {
|
|
108
|
+
missing.push(entry.authField);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return missing;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Build a CredentialLayer from process env given a list of authField names.
|
|
115
|
+
* Values that aren't set in env are omitted (not set to empty string).
|
|
116
|
+
*/
|
|
117
|
+
function credentialsFromEnv(authFields, env = process.env) {
|
|
118
|
+
const values = {};
|
|
119
|
+
for (const field of authFields) {
|
|
120
|
+
const value = env[field];
|
|
121
|
+
if (value)
|
|
122
|
+
values[field] = value;
|
|
123
|
+
}
|
|
124
|
+
return { origin: CredentialOrigin.ENV, values };
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Type guard: check whether an auth config entry should be forwarded by
|
|
128
|
+
* the host (vs resolved by the provider itself).
|
|
129
|
+
*/
|
|
130
|
+
function isForwardable(entry) {
|
|
131
|
+
return entry.source !== AuthSource.SERVER;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export { CredentialOrigin, collectRequiredAuthFields, credentialsFromEnv, filterForwardableCredentials, findMissingCredentials, isForwardable, mergeCredentials };
|
|
135
|
+
//# sourceMappingURL=credentials.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credentials.mjs","sources":["../../../src/utils/credentials.ts"],"sourcesContent":["/**\n * Credential merging utility for capability providers.\n *\n * The host is the source of truth for credential values. It resolves them\n * from env vars, user settings, or active OAuth sessions, then passes a\n * flat CredentialMap to the provider.\n *\n * This utility helps hosts build that map from multiple sources with clear\n * precedence rules. Providers themselves do NOT use this — they just receive\n * the finished map.\n */\n\nimport type {\n AuthConfigEntry,\n Capability,\n CredentialMap,\n} from '@/providers/types';\nimport { AuthSource } from '@/providers/types';\n\n/**\n * Source of a credential value in the merged result. Useful for logging\n * and debugging which layer won a given authField.\n */\nexport enum CredentialOrigin {\n /** From the caller's process env (typically the CLI). */\n ENV = 'env',\n /** From the agent definition's tool_credentials block. */\n AGENT = 'agent',\n /** From the user's stored credentials in the host's credential store. */\n USER = 'user',\n /** From an active OAuth session forwarded by the host. */\n SESSION = 'session',\n /** Injected by the host at runtime for another reason. */\n RUNTIME = 'runtime',\n}\n\n/** One layer of credentials with its origin. */\nexport interface CredentialLayer {\n origin: CredentialOrigin;\n values: CredentialMap;\n}\n\n/**\n * Merge credential layers with earlier layers overriding later ones.\n *\n * Typical host flow (in order of precedence):\n * 1. runtime overrides (e.g., test injection) → RUNTIME\n * 2. active OAuth session tokens → SESSION\n * 3. agent-defined tool_credentials → AGENT\n * 4. user's stored credentials → USER\n * 5. process env → ENV\n *\n * Caller passes layers in precedence order (highest first).\n */\nexport function mergeCredentials(...layers: CredentialLayer[]): CredentialMap {\n const merged: CredentialMap = {};\n // Iterate reverse so first-declared layer wins on collision.\n for (let i = layers.length - 1; i >= 0; i--) {\n const layer = layers[i];\n for (const [key, value] of Object.entries(layer.values)) {\n if (value !== undefined && value !== null && value !== '') {\n merged[key] = value;\n }\n }\n }\n return merged;\n}\n\n/**\n * Given a set of capabilities, return the union of authField names they\n * require. Useful for hosts that want to pre-resolve credentials before\n * calling createRunnables.\n */\nexport function collectRequiredAuthFields(\n capabilities: Capability[]\n): string[] {\n const fields = new Set<string>();\n for (const cap of capabilities) {\n for (const entry of cap.authConfig) {\n fields.add(entry.authField);\n }\n }\n return Array.from(fields);\n}\n\n/**\n * Filter out credentials that the provider is expected to resolve itself\n * (source === SERVER). Hosts call this before forwarding — these values\n * live in the provider's own environment and shouldn't be sent.\n *\n * Precedence: entries without `source` default to USER (must be forwarded).\n */\nexport function filterForwardableCredentials(\n credentials: CredentialMap,\n capabilities: Capability[]\n): CredentialMap {\n const serverManagedFields = new Set<string>();\n for (const cap of capabilities) {\n for (const entry of cap.authConfig) {\n if (entry.source === AuthSource.SERVER) {\n serverManagedFields.add(entry.authField);\n }\n }\n }\n const forwardable: CredentialMap = {};\n for (const [key, value] of Object.entries(credentials)) {\n if (!serverManagedFields.has(key)) {\n forwardable[key] = value;\n }\n }\n return forwardable;\n}\n\n/**\n * Validate that all required credentials for a capability are present in\n * the provided map. Returns the list of missing authFields (empty array\n * if all satisfied). Credentials with `source === SERVER` are excluded\n * from the check since the provider resolves them.\n */\nexport function findMissingCredentials(\n capability: Capability,\n credentials: CredentialMap\n): string[] {\n const missing: string[] = [];\n for (const entry of capability.authConfig) {\n if (entry.source === AuthSource.SERVER) continue;\n if (!entry.required) continue;\n if (!credentials[entry.authField]) {\n missing.push(entry.authField);\n }\n }\n return missing;\n}\n\n/**\n * Build a CredentialLayer from process env given a list of authField names.\n * Values that aren't set in env are omitted (not set to empty string).\n */\nexport function credentialsFromEnv(\n authFields: readonly string[],\n env: NodeJS.ProcessEnv = process.env\n): CredentialLayer {\n const values: CredentialMap = {};\n for (const field of authFields) {\n const value = env[field];\n if (value) values[field] = value;\n }\n return { origin: CredentialOrigin.ENV, values };\n}\n\n/**\n * Type guard: check whether an auth config entry should be forwarded by\n * the host (vs resolved by the provider itself).\n */\nexport function isForwardable(entry: AuthConfigEntry): boolean {\n return entry.source !== AuthSource.SERVER;\n}\n"],"names":[],"mappings":";;AAAA;;;;;;;;;;AAUG;AASH;;;AAGG;IACS;AAAZ,CAAA,UAAY,gBAAgB,EAAA;;AAE1B,IAAA,gBAAA,CAAA,KAAA,CAAA,GAAA,KAAW;;AAEX,IAAA,gBAAA,CAAA,OAAA,CAAA,GAAA,OAAe;;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AAA,IAAI,KAAK;AAAE,YAAA,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK;IAClC;IACA,OAAO,EAAE,MAAM,EAAE,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE;AACjD;AAEA;;;AAGG;AACG,SAAU,aAAa,CAAC,KAAsB,EAAA;AAClD,IAAA,OAAO,KAAK,CAAC,MAAM,KAAK,UAAU,CAAC,MAAM;AAC3C;;;;"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
import { HttpsProxyAgent } from 'https-proxy-agent';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* HTTP client utility for capability providers.
|
|
6
|
+
*
|
|
7
|
+
* Wraps axios with proxy support, default headers, and consistent retry
|
|
8
|
+
* behavior so every provider doesn't reinvent the wheel. Used by
|
|
9
|
+
* ToolsServerCapabilityProvider and (future) any HTTP-backed provider.
|
|
10
|
+
*
|
|
11
|
+
* Proxy resolution follows the existing pattern in this codebase:
|
|
12
|
+
* the PROXY env var is read and an HttpsProxyAgent is attached if present.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Build an axios instance configured per HttpClientConfig.
|
|
16
|
+
*
|
|
17
|
+
* The returned instance should be retained (not recreated per request) so
|
|
18
|
+
* keepalive connections can be reused.
|
|
19
|
+
*/
|
|
20
|
+
function createHttpClient(config) {
|
|
21
|
+
const { baseURL, apiKey, headers = {}, timeoutMs = 30_000, proxy } = config;
|
|
22
|
+
const resolvedProxy = proxy === undefined ? process.env.PROXY : proxy;
|
|
23
|
+
const defaultHeaders = {
|
|
24
|
+
'content-type': 'application/json',
|
|
25
|
+
...headers,
|
|
26
|
+
};
|
|
27
|
+
if (apiKey) {
|
|
28
|
+
defaultHeaders['x-api-key'] = apiKey;
|
|
29
|
+
}
|
|
30
|
+
const axiosConfig = {
|
|
31
|
+
baseURL,
|
|
32
|
+
timeout: timeoutMs,
|
|
33
|
+
headers: defaultHeaders,
|
|
34
|
+
// Don't throw on non-2xx — callers handle status codes explicitly.
|
|
35
|
+
validateStatus: () => true,
|
|
36
|
+
};
|
|
37
|
+
if (resolvedProxy) {
|
|
38
|
+
// axios respects `httpsAgent` for outbound proxying
|
|
39
|
+
axiosConfig.httpsAgent = new HttpsProxyAgent(resolvedProxy);
|
|
40
|
+
axiosConfig.httpAgent = new HttpsProxyAgent(resolvedProxy);
|
|
41
|
+
// Disable axios's built-in proxy logic in favor of the agent.
|
|
42
|
+
axiosConfig.proxy = false;
|
|
43
|
+
}
|
|
44
|
+
return axios.create(axiosConfig);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Thin wrapper around an axios response that throws with a structured error
|
|
48
|
+
* on non-2xx status codes. Providers use this to get uniform error surface.
|
|
49
|
+
*/
|
|
50
|
+
class HttpError extends Error {
|
|
51
|
+
status;
|
|
52
|
+
body;
|
|
53
|
+
url;
|
|
54
|
+
constructor(status, url, body) {
|
|
55
|
+
super(`HTTP ${status} on ${url}`);
|
|
56
|
+
this.name = 'HttpError';
|
|
57
|
+
this.status = status;
|
|
58
|
+
this.url = url;
|
|
59
|
+
this.body = body;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
/** Assert that an axios response is a 2xx; throw HttpError otherwise. */
|
|
63
|
+
function assertOk(status, url, body) {
|
|
64
|
+
if (status < 200 || status >= 300) {
|
|
65
|
+
throw new HttpError(status, url, body);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export { HttpError, assertOk, createHttpClient };
|
|
70
|
+
//# sourceMappingURL=httpClient.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpClient.mjs","sources":["../../../src/utils/httpClient.ts"],"sourcesContent":["/**\n * HTTP client utility for capability providers.\n *\n * Wraps axios with proxy support, default headers, and consistent retry\n * behavior so every provider doesn't reinvent the wheel. Used by\n * ToolsServerCapabilityProvider and (future) any HTTP-backed provider.\n *\n * Proxy resolution follows the existing pattern in this codebase:\n * the PROXY env var is read and an HttpsProxyAgent is attached if present.\n */\n\nimport axios, { type AxiosInstance, type AxiosRequestConfig } from 'axios';\nimport { HttpsProxyAgent } from 'https-proxy-agent';\n\n/** Configuration for creating an HTTP client. */\nexport interface HttpClientConfig {\n /** Base URL prepended to all requests. */\n baseURL: string;\n /** Optional API key — if present, sent as `x-api-key` header. */\n apiKey?: string;\n /** Custom header map merged into every request. */\n headers?: Record<string, string>;\n /** Request timeout in milliseconds. Defaults to 30_000. */\n timeoutMs?: number;\n /**\n * Override for the PROXY env var. Useful for tests. If undefined,\n * falls back to process.env.PROXY.\n */\n proxy?: string | null;\n}\n\n/**\n * Build an axios instance configured per HttpClientConfig.\n *\n * The returned instance should be retained (not recreated per request) so\n * keepalive connections can be reused.\n */\nexport function createHttpClient(config: HttpClientConfig): AxiosInstance {\n const { baseURL, apiKey, headers = {}, timeoutMs = 30_000, proxy } = config;\n\n const resolvedProxy = proxy === undefined ? process.env.PROXY : proxy;\n\n const defaultHeaders: Record<string, string> = {\n 'content-type': 'application/json',\n ...headers,\n };\n if (apiKey) {\n defaultHeaders['x-api-key'] = apiKey;\n }\n\n const axiosConfig: AxiosRequestConfig = {\n baseURL,\n timeout: timeoutMs,\n headers: defaultHeaders,\n // Don't throw on non-2xx — callers handle status codes explicitly.\n validateStatus: () => true,\n };\n\n if (resolvedProxy) {\n // axios respects `httpsAgent` for outbound proxying\n axiosConfig.httpsAgent = new HttpsProxyAgent(resolvedProxy);\n axiosConfig.httpAgent = new HttpsProxyAgent(resolvedProxy);\n // Disable axios's built-in proxy logic in favor of the agent.\n axiosConfig.proxy = false;\n }\n\n return axios.create(axiosConfig);\n}\n\n/**\n * Thin wrapper around an axios response that throws with a structured error\n * on non-2xx status codes. Providers use this to get uniform error surface.\n */\nexport class HttpError extends Error {\n readonly status: number;\n readonly body: unknown;\n readonly url: string;\n constructor(status: number, url: string, body: unknown) {\n super(`HTTP ${status} on ${url}`);\n this.name = 'HttpError';\n this.status = status;\n this.url = url;\n this.body = body;\n }\n}\n\n/** Assert that an axios response is a 2xx; throw HttpError otherwise. */\nexport function assertOk(status: number, url: string, body: unknown): void {\n if (status < 200 || status >= 300) {\n throw new HttpError(status, url, body);\n }\n}\n"],"names":[],"mappings":";;;AAAA;;;;;;;;;AASG;AAsBH;;;;;AAKG;AACG,SAAU,gBAAgB,CAAC,MAAwB,EAAA;AACvD,IAAA,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,GAAG,EAAE,EAAE,SAAS,GAAG,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM;AAE3E,IAAA,MAAM,aAAa,GAAG,KAAK,KAAK,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,GAAG,KAAK;AAErE,IAAA,MAAM,cAAc,GAA2B;AAC7C,QAAA,cAAc,EAAE,kBAAkB;AAClC,QAAA,GAAG,OAAO;KACX;IACD,IAAI,MAAM,EAAE;AACV,QAAA,cAAc,CAAC,WAAW,CAAC,GAAG,MAAM;IACtC;AAEA,IAAA,MAAM,WAAW,GAAuB;QACtC,OAAO;AACP,QAAA,OAAO,EAAE,SAAS;AAClB,QAAA,OAAO,EAAE,cAAc;;AAEvB,QAAA,cAAc,EAAE,MAAM,IAAI;KAC3B;IAED,IAAI,aAAa,EAAE;;QAEjB,WAAW,CAAC,UAAU,GAAG,IAAI,eAAe,CAAC,aAAa,CAAC;QAC3D,WAAW,CAAC,SAAS,GAAG,IAAI,eAAe,CAAC,aAAa,CAAC;;AAE1D,QAAA,WAAW,CAAC,KAAK,GAAG,KAAK;IAC3B;AAEA,IAAA,OAAO,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC;AAClC;AAEA;;;AAGG;AACG,MAAO,SAAU,SAAQ,KAAK,CAAA;AACzB,IAAA,MAAM;AACN,IAAA,IAAI;AACJ,IAAA,GAAG;AACZ,IAAA,WAAA,CAAY,MAAc,EAAE,GAAW,EAAE,IAAa,EAAA;AACpD,QAAA,KAAK,CAAC,CAAA,KAAA,EAAQ,MAAM,OAAO,GAAG,CAAA,CAAE,CAAC;AACjC,QAAA,IAAI,CAAC,IAAI,GAAG,WAAW;AACvB,QAAA,IAAI,CAAC,MAAM,GAAG,MAAM;AACpB,QAAA,IAAI,CAAC,GAAG,GAAG,GAAG;AACd,QAAA,IAAI,CAAC,IAAI,GAAG,IAAI;IAClB;AACD;AAED;SACgB,QAAQ,CAAC,MAAc,EAAE,GAAW,EAAE,IAAa,EAAA;IACjE,IAAI,MAAM,GAAG,GAAG,IAAI,MAAM,IAAI,GAAG,EAAE;QACjC,MAAM,IAAI,SAAS,CAAC,MAAM,EAAE,GAAG,EAAE,IAAI,CAAC;IACxC;AACF;;;;"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool manifest cache.
|
|
3
|
+
*
|
|
4
|
+
* Providers fetch a manifest at init and potentially on refresh. This
|
|
5
|
+
* utility provides a minimal TTL cache so repeated fetchManifest() calls
|
|
6
|
+
* don't hammer the backing server.
|
|
7
|
+
*
|
|
8
|
+
* Caching is opt-in — providers that want fresh data every time (e.g.,
|
|
9
|
+
* MCP with dynamic tool lists) can skip this entirely.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Simple in-memory TTL cache for manifests, keyed by a caller-supplied
|
|
13
|
+
* cache key (e.g., the filter hash or a fixed constant for unfiltered).
|
|
14
|
+
*
|
|
15
|
+
* Thread-safety: the cache uses a plain Map. Node's single-threaded event
|
|
16
|
+
* loop makes this safe for typical use. Not safe across workers — each
|
|
17
|
+
* worker keeps its own cache (fine, since manifests are small).
|
|
18
|
+
*/
|
|
19
|
+
class ManifestCache {
|
|
20
|
+
ttlMs;
|
|
21
|
+
store = new Map();
|
|
22
|
+
constructor(config = {}) {
|
|
23
|
+
this.ttlMs = config.ttlMs ?? 60_000;
|
|
24
|
+
}
|
|
25
|
+
/** Retrieve cached capabilities, or undefined on miss / expiry. */
|
|
26
|
+
get(key) {
|
|
27
|
+
const entry = this.store.get(key);
|
|
28
|
+
if (!entry)
|
|
29
|
+
return undefined;
|
|
30
|
+
if (entry.expiresAt < Date.now()) {
|
|
31
|
+
this.store.delete(key);
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
34
|
+
return entry.capabilities;
|
|
35
|
+
}
|
|
36
|
+
/** Insert or replace cached capabilities for the given key. */
|
|
37
|
+
set(key, capabilities) {
|
|
38
|
+
if (this.ttlMs <= 0)
|
|
39
|
+
return;
|
|
40
|
+
this.store.set(key, {
|
|
41
|
+
expiresAt: Date.now() + this.ttlMs,
|
|
42
|
+
capabilities,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
/** Remove all cached entries. */
|
|
46
|
+
clear() {
|
|
47
|
+
this.store.clear();
|
|
48
|
+
}
|
|
49
|
+
/** For tests / diagnostics. */
|
|
50
|
+
get size() {
|
|
51
|
+
return this.store.size;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Build a deterministic cache key from a CapabilityFilter.
|
|
56
|
+
*
|
|
57
|
+
* Two identical filters always produce the same key. Providers use this
|
|
58
|
+
* so `fetchManifest(filter)` and `fetchManifest(sameFilter)` hit the
|
|
59
|
+
* same cache entry.
|
|
60
|
+
*/
|
|
61
|
+
function filterToCacheKey(filter) {
|
|
62
|
+
if (!filter)
|
|
63
|
+
return '__all__';
|
|
64
|
+
const parts = [];
|
|
65
|
+
if (filter.kind)
|
|
66
|
+
parts.push(`kind=${filter.kind}`);
|
|
67
|
+
if (filter.tags?.length)
|
|
68
|
+
parts.push(`tags=${[...filter.tags].sort().join(',')}`);
|
|
69
|
+
if (filter.names?.length)
|
|
70
|
+
parts.push(`names=${[...filter.names].sort().join(',')}`);
|
|
71
|
+
return parts.length ? parts.join('|') : '__all__';
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Apply a CapabilityFilter to a pre-fetched manifest. Used by providers
|
|
75
|
+
* that fetch the full manifest once and filter in memory.
|
|
76
|
+
*/
|
|
77
|
+
function applyFilter(capabilities, filter) {
|
|
78
|
+
if (!filter)
|
|
79
|
+
return capabilities;
|
|
80
|
+
return capabilities.filter((cap) => {
|
|
81
|
+
if (filter.kind && cap.kind !== filter.kind)
|
|
82
|
+
return false;
|
|
83
|
+
if (filter.names && !filter.names.includes(cap.name))
|
|
84
|
+
return false;
|
|
85
|
+
if (filter.tags?.length) {
|
|
86
|
+
const capTags = new Set(cap.metadata.tags ?? []);
|
|
87
|
+
const anyMatch = filter.tags.some((t) => capTags.has(t));
|
|
88
|
+
if (!anyMatch)
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
return true;
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export { ManifestCache, applyFilter, filterToCacheKey };
|
|
96
|
+
//# sourceMappingURL=toolManifest.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolManifest.mjs","sources":["../../../src/utils/toolManifest.ts"],"sourcesContent":["/**\n * Tool manifest cache.\n *\n * Providers fetch a manifest at init and potentially on refresh. This\n * utility provides a minimal TTL cache so repeated fetchManifest() calls\n * don't hammer the backing server.\n *\n * Caching is opt-in — providers that want fresh data every time (e.g.,\n * MCP with dynamic tool lists) can skip this entirely.\n */\n\nimport type { Capability, CapabilityFilter } from '@/providers/types';\n\n/** Entry in the manifest cache. */\ninterface CacheEntry {\n expiresAt: number;\n capabilities: Capability[];\n}\n\nexport interface ManifestCacheConfig {\n /** Time-to-live in milliseconds. 0 disables caching. Defaults to 60_000 (1 min). */\n ttlMs?: number;\n}\n\n/**\n * Simple in-memory TTL cache for manifests, keyed by a caller-supplied\n * cache key (e.g., the filter hash or a fixed constant for unfiltered).\n *\n * Thread-safety: the cache uses a plain Map. Node's single-threaded event\n * loop makes this safe for typical use. Not safe across workers — each\n * worker keeps its own cache (fine, since manifests are small).\n */\nexport class ManifestCache {\n private readonly ttlMs: number;\n private readonly store = new Map<string, CacheEntry>();\n\n constructor(config: ManifestCacheConfig = {}) {\n this.ttlMs = config.ttlMs ?? 60_000;\n }\n\n /** Retrieve cached capabilities, or undefined on miss / expiry. */\n get(key: string): Capability[] | undefined {\n const entry = this.store.get(key);\n if (!entry) return undefined;\n if (entry.expiresAt < Date.now()) {\n this.store.delete(key);\n return undefined;\n }\n return entry.capabilities;\n }\n\n /** Insert or replace cached capabilities for the given key. */\n set(key: string, capabilities: Capability[]): void {\n if (this.ttlMs <= 0) return;\n this.store.set(key, {\n expiresAt: Date.now() + this.ttlMs,\n capabilities,\n });\n }\n\n /** Remove all cached entries. */\n clear(): void {\n this.store.clear();\n }\n\n /** For tests / diagnostics. */\n get size(): number {\n return this.store.size;\n }\n}\n\n/**\n * Build a deterministic cache key from a CapabilityFilter.\n *\n * Two identical filters always produce the same key. Providers use this\n * so `fetchManifest(filter)` and `fetchManifest(sameFilter)` hit the\n * same cache entry.\n */\nexport function filterToCacheKey(filter?: CapabilityFilter): string {\n if (!filter) return '__all__';\n const parts: string[] = [];\n if (filter.kind) parts.push(`kind=${filter.kind}`);\n if (filter.tags?.length)\n parts.push(`tags=${[...filter.tags].sort().join(',')}`);\n if (filter.names?.length)\n parts.push(`names=${[...filter.names].sort().join(',')}`);\n return parts.length ? parts.join('|') : '__all__';\n}\n\n/**\n * Apply a CapabilityFilter to a pre-fetched manifest. Used by providers\n * that fetch the full manifest once and filter in memory.\n */\nexport function applyFilter(\n capabilities: Capability[],\n filter?: CapabilityFilter\n): Capability[] {\n if (!filter) return capabilities;\n return capabilities.filter((cap) => {\n if (filter.kind && cap.kind !== filter.kind) return false;\n if (filter.names && !filter.names.includes(cap.name)) return false;\n if (filter.tags?.length) {\n const capTags = new Set(cap.metadata.tags ?? []);\n const anyMatch = filter.tags.some((t) => capTags.has(t));\n if (!anyMatch) return false;\n }\n return true;\n });\n}\n"],"names":[],"mappings":"AAAA;;;;;;;;;AASG;AAeH;;;;;;;AAOG;MACU,aAAa,CAAA;AACP,IAAA,KAAK;AACL,IAAA,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C,CAAC;AACJ;;;;"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -16,6 +16,8 @@ export * from './tools/schema';
|
|
|
16
16
|
export * from './tools/handlers';
|
|
17
17
|
export * from './tools/search';
|
|
18
18
|
export * from './tools/memory';
|
|
19
|
+
export * from './tools/proxyTool';
|
|
20
|
+
export * from './providers';
|
|
19
21
|
export * from './memory';
|
|
20
22
|
export { MEMORY_FLUSH_SYSTEM_PROMPT } from './prompts/memoryFlushPrompt';
|
|
21
23
|
export { shouldFlushMemory, runMemoryFlush, } from './graphs/phases/memoryFlushPhase';
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A2ACapabilityProvider — client-side adapter for consuming A2A-served
|
|
3
|
+
* remote agents as capabilities.
|
|
4
|
+
*
|
|
5
|
+
* Same pattern as `MCPCapabilityProvider`: take a unified spec map,
|
|
6
|
+
* speak the protocol (A2A JSON-RPC over HTTP), expose each skill as a
|
|
7
|
+
* `Capability` / `StructuredTool`.
|
|
8
|
+
*
|
|
9
|
+
* Design:
|
|
10
|
+
* - One `A2AClient` per remote spec, cached after first use.
|
|
11
|
+
* - `fetchManifest()`:
|
|
12
|
+
* for each remote, GET /.well-known/agent.json → emit one
|
|
13
|
+
* Capability per advertised skill (or one per remote when
|
|
14
|
+
* `flattenAsSingleTool` is set).
|
|
15
|
+
* - `createRunnables()`:
|
|
16
|
+
* each Capability becomes a StructuredTool whose invoke sends a
|
|
17
|
+
* JSON-RPC `tasks/send` to the remote and returns the final
|
|
18
|
+
* artifact's text.
|
|
19
|
+
*
|
|
20
|
+
* What the host supplies:
|
|
21
|
+
* - `remotes`: unified spec map (normalized from whatever source).
|
|
22
|
+
* - `getAuthHeaders?`: per-remote header resolver. Called at connect
|
|
23
|
+
* time. OAuth / token refresh stays in the host.
|
|
24
|
+
*/
|
|
25
|
+
import { type StructuredToolInterface } from '@langchain/core/tools';
|
|
26
|
+
import { type Capability, type CapabilityFilter, type CapabilityProvider, type CredentialMap } from '@/providers/types';
|
|
27
|
+
import { CAPABILITY_NAME_SEPARATOR, formatCapabilityName } from '@/providers/capabilityNaming';
|
|
28
|
+
import type { A2AProviderConfig, A2ASkill } from './types';
|
|
29
|
+
export declare class A2ACapabilityProvider implements CapabilityProvider {
|
|
30
|
+
readonly providerId: string;
|
|
31
|
+
private readonly config;
|
|
32
|
+
private readonly logger;
|
|
33
|
+
private readonly connections;
|
|
34
|
+
constructor(config: A2AProviderConfig);
|
|
35
|
+
fetchManifest(filter?: CapabilityFilter): Promise<Capability[]>;
|
|
36
|
+
createRunnables(capabilities: Capability[], _credentials: CredentialMap): Promise<StructuredToolInterface[]>;
|
|
37
|
+
/** Disconnect any cached clients. A2A is stateless over HTTP so this
|
|
38
|
+
* is effectively a cache clear — no sockets to close. */
|
|
39
|
+
close(): Promise<void>;
|
|
40
|
+
private ensureConnection;
|
|
41
|
+
private resolveAuthHeaders;
|
|
42
|
+
private cardToCapabilities;
|
|
43
|
+
private capabilityMatchesFilter;
|
|
44
|
+
private buildProxyTool;
|
|
45
|
+
}
|
|
46
|
+
export { CAPABILITY_NAME_SEPARATOR, formatCapabilityName };
|
|
47
|
+
/**
|
|
48
|
+
* Parse a capability name produced by this provider, returning A2A-specific
|
|
49
|
+
* field names (`remoteName` / `skillId`). Thin adapter over the shared
|
|
50
|
+
* `parseCapabilityName` — kept local so callers see the A2A vocabulary.
|
|
51
|
+
*/
|
|
52
|
+
export declare function parseCapabilityName(name: string): {
|
|
53
|
+
remoteName: string;
|
|
54
|
+
skillId?: string;
|
|
55
|
+
} | null;
|
|
56
|
+
/** Derive a Capability from a skill entry on the agent card. */
|
|
57
|
+
export declare function skillToCapability(remoteName: string, skill: A2ASkill): Capability;
|
|
58
|
+
/**
|
|
59
|
+
* Default input schema for A2A capabilities. Every invocation is a text
|
|
60
|
+
* message — we don't try to infer a per-skill input shape because the
|
|
61
|
+
* A2A spec's skill entries don't include a parameter schema.
|
|
62
|
+
*/
|
|
63
|
+
export declare const MESSAGE_INPUT_SCHEMA: {
|
|
64
|
+
readonly type: "object";
|
|
65
|
+
readonly properties: {
|
|
66
|
+
readonly message: {
|
|
67
|
+
readonly type: "string";
|
|
68
|
+
readonly description: "Instruction or question to send to the remote agent as a user message.";
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
readonly required: readonly ["message"];
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Coerce arbitrary LLM-supplied input into a valid A2A message. If the
|
|
75
|
+
* input is a string, wraps it directly. If it's `{ message: "..." }`,
|
|
76
|
+
* uses `message`. Otherwise JSON-stringifies so the agent receives
|
|
77
|
+
* something it can try to interpret.
|
|
78
|
+
*
|
|
79
|
+
* When a skill id is known, it's prepended to the message text so the
|
|
80
|
+
* remote agent can route — some A2A implementations use this, others
|
|
81
|
+
* ignore it, it's best-effort.
|
|
82
|
+
*/
|
|
83
|
+
export declare function coerceInputToA2AMessage(input: unknown, skillId?: string): {
|
|
84
|
+
role: 'user';
|
|
85
|
+
parts: Array<{
|
|
86
|
+
type: 'text';
|
|
87
|
+
text: string;
|
|
88
|
+
}>;
|
|
89
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A2A HTTP client — thin wrappers for the two operations the provider
|
|
3
|
+
* needs: fetching the agent card and sending JSON-RPC task requests.
|
|
4
|
+
*
|
|
5
|
+
* Uses axios (already in deps) via the shared httpClient utility so
|
|
6
|
+
* proxy config + headers work consistently with the tools-server provider.
|
|
7
|
+
*/
|
|
8
|
+
import type { A2AAgentCard, A2ATask, A2ATaskParams } from './types';
|
|
9
|
+
/** Options for constructing a single-remote A2A client. */
|
|
10
|
+
export interface A2AClientOptions {
|
|
11
|
+
baseUrl: string;
|
|
12
|
+
headers?: Record<string, string>;
|
|
13
|
+
timeoutMs?: number;
|
|
14
|
+
cardPath?: string;
|
|
15
|
+
rpcPath?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Lightweight single-remote A2A client. One instance per remote; the
|
|
19
|
+
* provider builds one per spec entry and caches them.
|
|
20
|
+
*/
|
|
21
|
+
export declare class A2AClient {
|
|
22
|
+
private readonly http;
|
|
23
|
+
private readonly cardPath;
|
|
24
|
+
private readonly rpcPath;
|
|
25
|
+
constructor(opts: A2AClientOptions);
|
|
26
|
+
/** GET /.well-known/agent.json (or the configured override). */
|
|
27
|
+
fetchAgentCard(): Promise<A2AAgentCard>;
|
|
28
|
+
/**
|
|
29
|
+
* POST a JSON-RPC `tasks/send` request and return the resulting Task.
|
|
30
|
+
* The caller supplies the params (id, sessionId, message); this helper
|
|
31
|
+
* wraps it in the JSON-RPC envelope, dispatches, and unwraps.
|
|
32
|
+
*/
|
|
33
|
+
sendTask(params: A2ATaskParams): Promise<A2ATask>;
|
|
34
|
+
/** Low-level JSON-RPC dispatcher — exposed for tests / advanced callers. */
|
|
35
|
+
rpc<P, R>(method: string, params: P): Promise<R>;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Generate a short opaque id for JSON-RPC requests. Not cryptographic —
|
|
39
|
+
* just unique enough to pair request/response in logs.
|
|
40
|
+
*/
|
|
41
|
+
export declare function generateRpcId(): string;
|
|
42
|
+
/**
|
|
43
|
+
* Extract the plain-text output from a completed Task's artifacts. If
|
|
44
|
+
* the task isn't `completed`, throws. If there are no text parts, returns
|
|
45
|
+
* an empty string rather than null so callers always get a string.
|
|
46
|
+
*/
|
|
47
|
+
export declare function extractTaskText(task: A2ATask): string;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Environment-driven defaults + default logger for the A2A provider.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors the MCP provider's config.ts so the two providers have the same
|
|
5
|
+
* override story for hosts.
|
|
6
|
+
*/
|
|
7
|
+
import type { A2ALogger } from './types';
|
|
8
|
+
/**
|
|
9
|
+
* Read env values with fallbacks. Evaluated lazily so tests that mutate
|
|
10
|
+
* process.env get the current value.
|
|
11
|
+
*/
|
|
12
|
+
export declare function getA2AEnvDefaults(): {
|
|
13
|
+
clientName: string;
|
|
14
|
+
clientVersion: string;
|
|
15
|
+
timeoutMs: number;
|
|
16
|
+
};
|
|
17
|
+
/** Console-routed default logger. */
|
|
18
|
+
export declare const consoleLogger: A2ALogger;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { A2ACapabilityProvider } from './A2ACapabilityProvider';
|
|
2
|
+
export { CAPABILITY_NAME_SEPARATOR, formatCapabilityName, parseCapabilityName, skillToCapability, coerceInputToA2AMessage, MESSAGE_INPUT_SCHEMA, } from './A2ACapabilityProvider';
|
|
3
|
+
export { A2AClient, extractTaskText, generateRpcId } from './client';
|
|
4
|
+
export type { A2AClientOptions } from './client';
|
|
5
|
+
export { consoleLogger as a2aConsoleLogger, getA2AEnvDefaults } from './config';
|
|
6
|
+
export type { A2AAgentCard, A2ACardCapabilities, A2ALogger, A2AMessage, A2AProviderConfig, A2ARemoteSpec, A2ASkill, A2ATask, A2ATaskParams, A2ATaskState, A2ATaskStatus, JsonRpcRequest, JsonRpcResponse, JsonRpcSuccess, JsonRpcErrorResponse, } from './types';
|