agentfootprint 10.4.0 → 10.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CAPABILITIES.md +6 -1
- package/ai-instructions/clinerules +22 -11
- package/ai-instructions/copilot-instructions.md +22 -11
- package/ai-instructions/cursor/agentfootprint.md +22 -11
- package/ai-instructions/kiro/agentfootprint.md +22 -11
- package/ai-instructions/windsurfrules +22 -11
- package/dist/adapters/llm/AnthropicProvider.js +26 -8
- package/dist/adapters/llm/AnthropicProvider.js.map +1 -1
- package/dist/adapters/llm/BedrockProvider.js +23 -7
- package/dist/adapters/llm/BedrockProvider.js.map +1 -1
- package/dist/adapters/llm/BrowserAnthropicProvider.js +57 -49
- package/dist/adapters/llm/BrowserAnthropicProvider.js.map +1 -1
- package/dist/adapters/llm/BrowserOpenAIProvider.js +50 -42
- package/dist/adapters/llm/BrowserOpenAIProvider.js.map +1 -1
- package/dist/adapters/llm/FoundryLocalProvider.js +174 -212
- package/dist/adapters/llm/FoundryLocalProvider.js.map +1 -1
- package/dist/adapters/llm/GeminiProvider.js +23 -9
- package/dist/adapters/llm/GeminiProvider.js.map +1 -1
- package/dist/adapters/llm/InvokeModelGatewayProvider.js +32 -9
- package/dist/adapters/llm/InvokeModelGatewayProvider.js.map +1 -1
- package/dist/adapters/llm/MockProvider.js +11 -3
- package/dist/adapters/llm/MockProvider.js.map +1 -1
- package/dist/adapters/llm/OllamaProvider.js +129 -167
- package/dist/adapters/llm/OllamaProvider.js.map +1 -1
- package/dist/adapters/llm/OpenAIProvider.js +36 -9
- package/dist/adapters/llm/OpenAIProvider.js.map +1 -1
- package/dist/adapters/mcp/agentcoreRuntime/invoke.js +15 -8
- package/dist/adapters/mcp/agentcoreRuntime/invoke.js.map +1 -1
- package/dist/adapters/mcp/agentcoreRuntime/transport.js +21 -3
- package/dist/adapters/mcp/agentcoreRuntime/transport.js.map +1 -1
- package/dist/ag-ui/adapter.js +69 -14
- package/dist/ag-ui/adapter.js.map +1 -1
- package/dist/ag-ui/framing.js +3 -1
- package/dist/ag-ui/framing.js.map +1 -1
- package/dist/ag-ui/index.js +4 -2
- package/dist/ag-ui/index.js.map +1 -1
- package/dist/ag-ui/request.js +66 -6
- package/dist/ag-ui/request.js.map +1 -1
- package/dist/answer-validation/index.js +8 -1
- package/dist/answer-validation/index.js.map +1 -1
- package/dist/answer-validation/toolLedger.js +130 -0
- package/dist/answer-validation/toolLedger.js.map +1 -0
- package/dist/answer-validation/types.js.map +1 -1
- package/dist/answer-validation/validate.js +25 -3
- package/dist/answer-validation/validate.js.map +1 -1
- package/dist/classify/typesafe.js +31 -23
- package/dist/classify/typesafe.js.map +1 -1
- package/dist/core/Agent.js +69 -16
- package/dist/core/Agent.js.map +1 -1
- package/dist/core/LLMCall.js +16 -6
- package/dist/core/LLMCall.js.map +1 -1
- package/dist/core/RunnerBase.js +83 -11
- package/dist/core/RunnerBase.js.map +1 -1
- package/dist/core/agent/buildAgentChart.js +16 -8
- package/dist/core/agent/buildAgentChart.js.map +1 -1
- package/dist/core/agent/buildAgentMessageApiChart.js +22 -2
- package/dist/core/agent/buildAgentMessageApiChart.js.map +1 -1
- package/dist/core/agent/buildDynamicAgentChart.js +22 -7
- package/dist/core/agent/buildDynamicAgentChart.js.map +1 -1
- package/dist/core/agent/buildMessageApiChart.js +22 -2
- package/dist/core/agent/buildMessageApiChart.js.map +1 -1
- package/dist/core/agent/stages/answerValidation.js +22 -1
- package/dist/core/agent/stages/answerValidation.js.map +1 -1
- package/dist/core/agent/stages/callLLM.js +19 -3
- package/dist/core/agent/stages/callLLM.js.map +1 -1
- package/dist/core/agent/stages/routeTurn.js +14 -1
- package/dist/core/agent/stages/routeTurn.js.map +1 -1
- package/dist/core/agent/stages/seed.js +9 -0
- package/dist/core/agent/stages/seed.js.map +1 -1
- package/dist/core/agent/stages/toolCalls.js +59 -20
- package/dist/core/agent/stages/toolCalls.js.map +1 -1
- package/dist/core/agent/window/strategies/summarizeOldest.js +4 -0
- package/dist/core/agent/window/strategies/summarizeOldest.js.map +1 -1
- package/dist/core/agent/window/summarize.js +6 -3
- package/dist/core/agent/window/summarize.js.map +1 -1
- package/dist/core/memberRun.js +58 -9
- package/dist/core/memberRun.js.map +1 -1
- package/dist/core/requestOfRun.js +28 -0
- package/dist/core/requestOfRun.js.map +1 -0
- package/dist/core/slots/buildToolsSlot.js +11 -25
- package/dist/core/slots/buildToolsSlot.js.map +1 -1
- package/dist/core-flow/Conditional.js +17 -11
- package/dist/core-flow/Conditional.js.map +1 -1
- package/dist/core-flow/Graph.js +17 -11
- package/dist/core-flow/Graph.js.map +1 -1
- package/dist/core-flow/Loop.js +17 -11
- package/dist/core-flow/Loop.js.map +1 -1
- package/dist/core-flow/Parallel.js +25 -14
- package/dist/core-flow/Parallel.js.map +1 -1
- package/dist/core-flow/Sequence.js +17 -11
- package/dist/core-flow/Sequence.js.map +1 -1
- package/dist/core-flow/Workflow.js +17 -11
- package/dist/core-flow/Workflow.js.map +1 -1
- package/dist/doors/security.js +2 -1
- package/dist/doors/security.js.map +1 -1
- package/dist/esm/adapters/llm/AnthropicProvider.d.ts +9 -2
- package/dist/esm/adapters/llm/AnthropicProvider.js +26 -8
- package/dist/esm/adapters/llm/AnthropicProvider.js.map +1 -1
- package/dist/esm/adapters/llm/BedrockProvider.d.ts +6 -1
- package/dist/esm/adapters/llm/BedrockProvider.js +23 -7
- package/dist/esm/adapters/llm/BedrockProvider.js.map +1 -1
- package/dist/esm/adapters/llm/BrowserAnthropicProvider.js +57 -49
- package/dist/esm/adapters/llm/BrowserAnthropicProvider.js.map +1 -1
- package/dist/esm/adapters/llm/BrowserOpenAIProvider.js +50 -42
- package/dist/esm/adapters/llm/BrowserOpenAIProvider.js.map +1 -1
- package/dist/esm/adapters/llm/FoundryLocalProvider.js +171 -209
- package/dist/esm/adapters/llm/FoundryLocalProvider.js.map +1 -1
- package/dist/esm/adapters/llm/GeminiProvider.js +23 -9
- package/dist/esm/adapters/llm/GeminiProvider.js.map +1 -1
- package/dist/esm/adapters/llm/InvokeModelGatewayProvider.js +32 -9
- package/dist/esm/adapters/llm/InvokeModelGatewayProvider.js.map +1 -1
- package/dist/esm/adapters/llm/MockProvider.js +11 -3
- package/dist/esm/adapters/llm/MockProvider.js.map +1 -1
- package/dist/esm/adapters/llm/OllamaProvider.js +126 -164
- package/dist/esm/adapters/llm/OllamaProvider.js.map +1 -1
- package/dist/esm/adapters/llm/OpenAIProvider.d.ts +6 -1
- package/dist/esm/adapters/llm/OpenAIProvider.js +36 -9
- package/dist/esm/adapters/llm/OpenAIProvider.js.map +1 -1
- package/dist/esm/adapters/mcp/agentcoreRuntime/invoke.d.ts +1 -1
- package/dist/esm/adapters/mcp/agentcoreRuntime/invoke.js +15 -8
- package/dist/esm/adapters/mcp/agentcoreRuntime/invoke.js.map +1 -1
- package/dist/esm/adapters/mcp/agentcoreRuntime/transport.d.ts +26 -3
- package/dist/esm/adapters/mcp/agentcoreRuntime/transport.js +21 -3
- package/dist/esm/adapters/mcp/agentcoreRuntime/transport.js.map +1 -1
- package/dist/esm/ag-ui/adapter.d.ts +61 -11
- package/dist/esm/ag-ui/adapter.js +70 -15
- package/dist/esm/ag-ui/adapter.js.map +1 -1
- package/dist/esm/ag-ui/framing.d.ts +2 -1
- package/dist/esm/ag-ui/framing.js +3 -1
- package/dist/esm/ag-ui/framing.js.map +1 -1
- package/dist/esm/ag-ui/index.d.ts +6 -4
- package/dist/esm/ag-ui/index.js +6 -4
- package/dist/esm/ag-ui/index.js.map +1 -1
- package/dist/esm/ag-ui/request.d.ts +86 -7
- package/dist/esm/ag-ui/request.js +63 -5
- package/dist/esm/ag-ui/request.js.map +1 -1
- package/dist/esm/answer-validation/index.d.ts +2 -1
- package/dist/esm/answer-validation/index.js +1 -0
- package/dist/esm/answer-validation/index.js.map +1 -1
- package/dist/esm/answer-validation/toolLedger.d.ts +65 -0
- package/dist/esm/answer-validation/toolLedger.js +121 -0
- package/dist/esm/answer-validation/toolLedger.js.map +1 -0
- package/dist/esm/answer-validation/types.d.ts +48 -0
- package/dist/esm/answer-validation/types.js.map +1 -1
- package/dist/esm/answer-validation/validate.d.ts +2 -2
- package/dist/esm/answer-validation/validate.js +25 -3
- package/dist/esm/answer-validation/validate.js.map +1 -1
- package/dist/esm/classify/typesafe.js +30 -22
- package/dist/esm/classify/typesafe.js.map +1 -1
- package/dist/esm/core/Agent.d.ts +9 -1
- package/dist/esm/core/Agent.js +71 -18
- package/dist/esm/core/Agent.js.map +1 -1
- package/dist/esm/core/LLMCall.d.ts +2 -1
- package/dist/esm/core/LLMCall.js +17 -7
- package/dist/esm/core/LLMCall.js.map +1 -1
- package/dist/esm/core/RunnerBase.d.ts +39 -8
- package/dist/esm/core/RunnerBase.js +80 -9
- package/dist/esm/core/RunnerBase.js.map +1 -1
- package/dist/esm/core/agent/buildAgentChart.js +16 -8
- package/dist/esm/core/agent/buildAgentChart.js.map +1 -1
- package/dist/esm/core/agent/buildAgentMessageApiChart.d.ts +16 -0
- package/dist/esm/core/agent/buildAgentMessageApiChart.js +22 -2
- package/dist/esm/core/agent/buildAgentMessageApiChart.js.map +1 -1
- package/dist/esm/core/agent/buildDynamicAgentChart.js +22 -7
- package/dist/esm/core/agent/buildDynamicAgentChart.js.map +1 -1
- package/dist/esm/core/agent/buildMessageApiChart.d.ts +16 -0
- package/dist/esm/core/agent/buildMessageApiChart.js +22 -2
- package/dist/esm/core/agent/buildMessageApiChart.js.map +1 -1
- package/dist/esm/core/agent/stages/answerValidation.js +22 -1
- package/dist/esm/core/agent/stages/answerValidation.js.map +1 -1
- package/dist/esm/core/agent/stages/callLLM.js +19 -3
- package/dist/esm/core/agent/stages/callLLM.js.map +1 -1
- package/dist/esm/core/agent/stages/routeTurn.js +14 -1
- package/dist/esm/core/agent/stages/routeTurn.js.map +1 -1
- package/dist/esm/core/agent/stages/seed.d.ts +7 -0
- package/dist/esm/core/agent/stages/seed.js +9 -0
- package/dist/esm/core/agent/stages/seed.js.map +1 -1
- package/dist/esm/core/agent/stages/toolCalls.d.ts +21 -0
- package/dist/esm/core/agent/stages/toolCalls.js +59 -20
- package/dist/esm/core/agent/stages/toolCalls.js.map +1 -1
- package/dist/esm/core/agent/types.d.ts +10 -0
- package/dist/esm/core/agent/window/strategies/summarizeOldest.js +4 -0
- package/dist/esm/core/agent/window/strategies/summarizeOldest.js.map +1 -1
- package/dist/esm/core/agent/window/summarize.js +6 -3
- package/dist/esm/core/agent/window/summarize.js.map +1 -1
- package/dist/esm/core/memberRun.d.ts +23 -2
- package/dist/esm/core/memberRun.js +54 -8
- package/dist/esm/core/memberRun.js.map +1 -1
- package/dist/esm/core/requestOfRun.d.ts +21 -0
- package/dist/esm/core/requestOfRun.js +24 -0
- package/dist/esm/core/requestOfRun.js.map +1 -0
- package/dist/esm/core/runner.d.ts +15 -3
- package/dist/esm/core/slots/buildToolsSlot.d.ts +0 -16
- package/dist/esm/core/slots/buildToolsSlot.js +11 -25
- package/dist/esm/core/slots/buildToolsSlot.js.map +1 -1
- package/dist/esm/core-flow/Conditional.d.ts +2 -1
- package/dist/esm/core-flow/Conditional.js +18 -12
- package/dist/esm/core-flow/Conditional.js.map +1 -1
- package/dist/esm/core-flow/Graph.d.ts +2 -1
- package/dist/esm/core-flow/Graph.js +18 -12
- package/dist/esm/core-flow/Graph.js.map +1 -1
- package/dist/esm/core-flow/Loop.d.ts +2 -1
- package/dist/esm/core-flow/Loop.js +18 -12
- package/dist/esm/core-flow/Loop.js.map +1 -1
- package/dist/esm/core-flow/Parallel.d.ts +2 -1
- package/dist/esm/core-flow/Parallel.js +26 -15
- package/dist/esm/core-flow/Parallel.js.map +1 -1
- package/dist/esm/core-flow/Sequence.d.ts +2 -1
- package/dist/esm/core-flow/Sequence.js +18 -12
- package/dist/esm/core-flow/Sequence.js.map +1 -1
- package/dist/esm/core-flow/Workflow.d.ts +2 -1
- package/dist/esm/core-flow/Workflow.js +18 -12
- package/dist/esm/core-flow/Workflow.js.map +1 -1
- package/dist/esm/doors/security.d.ts +2 -1
- package/dist/esm/doors/security.js +2 -1
- package/dist/esm/doors/security.js.map +1 -1
- package/dist/esm/events/payloads.d.ts +4 -2
- package/dist/esm/hosting/index.d.ts +1 -0
- package/dist/esm/hosting/index.js.map +1 -1
- package/dist/esm/hosting/protocolAdapter.d.ts +4 -1
- package/dist/esm/hosting/refusalStatus.js +4 -0
- package/dist/esm/hosting/refusalStatus.js.map +1 -1
- package/dist/esm/hosting/requestSealing.d.ts +65 -0
- package/dist/esm/hosting/requestSealing.js +79 -0
- package/dist/esm/hosting/requestSealing.js.map +1 -0
- package/dist/esm/hosting/standingAgent.js +23 -3
- package/dist/esm/hosting/standingAgent.js.map +1 -1
- package/dist/esm/hosting/stream.d.ts +23 -2
- package/dist/esm/hosting/stream.js +5 -1
- package/dist/esm/hosting/stream.js.map +1 -1
- package/dist/esm/hosting/streamHandler.d.ts +26 -7
- package/dist/esm/hosting/streamHandler.js +36 -12
- package/dist/esm/hosting/streamHandler.js.map +1 -1
- package/dist/esm/hosting/types.d.ts +29 -0
- package/dist/esm/hosting/types.js.map +1 -1
- package/dist/esm/identity/requestContext.d.ts +96 -0
- package/dist/esm/identity/requestContext.js +131 -0
- package/dist/esm/identity/requestContext.js.map +1 -0
- package/dist/esm/identity/requestCredentials.d.ts +99 -0
- package/dist/esm/identity/requestCredentials.js +157 -0
- package/dist/esm/identity/requestCredentials.js.map +1 -0
- package/dist/esm/identity/types.d.ts +11 -0
- package/dist/esm/identity/types.js.map +1 -1
- package/dist/esm/identity.d.ts +2 -0
- package/dist/esm/identity.js +5 -0
- package/dist/esm/identity.js.map +1 -1
- package/dist/esm/index.d.ts +3 -2
- package/dist/esm/index.js +5 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/injection-engine/buildInjectionEngineSubflow.d.ts +11 -0
- package/dist/esm/injection-engine/buildInjectionEngineSubflow.js +39 -5
- package/dist/esm/injection-engine/buildInjectionEngineSubflow.js.map +1 -1
- package/dist/esm/injection-engine/constrainedEnumPick.js +4 -2
- package/dist/esm/injection-engine/constrainedEnumPick.js.map +1 -1
- package/dist/esm/injection-engine/evaluator.d.ts +6 -0
- package/dist/esm/injection-engine/evaluator.js +19 -1
- package/dist/esm/injection-engine/evaluator.js.map +1 -1
- package/dist/esm/injection-engine/skillGraph.js +26 -8
- package/dist/esm/injection-engine/skillGraph.js.map +1 -1
- package/dist/esm/injection-engine/skillIntent.d.ts +4 -2
- package/dist/esm/injection-engine/skillIntent.js +3 -0
- package/dist/esm/injection-engine/skillIntent.js.map +1 -1
- package/dist/esm/injection-engine/types.d.ts +27 -1
- package/dist/esm/injection-engine/types.js +15 -0
- package/dist/esm/injection-engine/types.js.map +1 -1
- package/dist/esm/lib/abort.d.ts +143 -0
- package/dist/esm/lib/abort.js +322 -0
- package/dist/esm/lib/abort.js.map +1 -0
- package/dist/esm/maps/engagement/parkCard.d.ts +5 -1
- package/dist/esm/maps/engagement/parkCard.js +10 -3
- package/dist/esm/maps/engagement/parkCard.js.map +1 -1
- package/dist/esm/mcp/mcpClient.js +30 -2
- package/dist/esm/mcp/mcpClient.js.map +1 -1
- package/dist/esm/mcp/mcpServe.js +5 -1
- package/dist/esm/mcp/mcpServe.js.map +1 -1
- package/dist/esm/mcp/plainData.d.ts +44 -0
- package/dist/esm/mcp/plainData.js +204 -0
- package/dist/esm/mcp/plainData.js.map +1 -0
- package/dist/esm/mcp/sdkLoadFailure.d.ts +6 -7
- package/dist/esm/mcp/sdkLoadFailure.js +4 -4
- package/dist/esm/mcp/sdkLoadFailure.js.map +1 -1
- package/dist/esm/mcp/toolResult.js +8 -50
- package/dist/esm/mcp/toolResult.js.map +1 -1
- package/dist/esm/mcp/types.d.ts +10 -6
- package/dist/esm/memory/beats/llmExtractor.js +6 -3
- package/dist/esm/memory/beats/llmExtractor.js.map +1 -1
- package/dist/esm/memory/facts/llmFactExtractor.js +6 -3
- package/dist/esm/memory/facts/llmFactExtractor.js.map +1 -1
- package/dist/esm/memory/stages/summarize.js +16 -5
- package/dist/esm/memory/stages/summarize.js.map +1 -1
- package/dist/esm/patterns/LlmRouter.js +10 -5
- package/dist/esm/patterns/LlmRouter.js.map +1 -1
- package/dist/esm/redaction/conversation.js +3 -0
- package/dist/esm/redaction/conversation.js.map +1 -1
- package/dist/esm/redaction/knownStrings.js +1 -0
- package/dist/esm/redaction/knownStrings.js.map +1 -1
- package/dist/esm/reliability/buildReliabilityGateChart.js +7 -1
- package/dist/esm/reliability/buildReliabilityGateChart.js.map +1 -1
- package/dist/esm/resilience/withCircuitBreaker.js +5 -2
- package/dist/esm/resilience/withCircuitBreaker.js.map +1 -1
- package/dist/esm/resilience/withFallback.js +6 -0
- package/dist/esm/resilience/withFallback.js.map +1 -1
- package/dist/esm/resilience/withRetry.js +5 -0
- package/dist/esm/resilience/withRetry.js.map +1 -1
- package/dist/esm/time-travel/servedView.js +1 -1
- package/dist/esm/time-travel/servedView.js.map +1 -1
- package/dist/esm/tools/hostFilled.d.ts +110 -0
- package/dist/esm/tools/hostFilled.js +509 -0
- package/dist/esm/tools/hostFilled.js.map +1 -0
- package/dist/hosting/index.js.map +1 -1
- package/dist/hosting/refusalStatus.js +4 -0
- package/dist/hosting/refusalStatus.js.map +1 -1
- package/dist/hosting/requestSealing.js +83 -0
- package/dist/hosting/requestSealing.js.map +1 -0
- package/dist/hosting/standingAgent.js +23 -3
- package/dist/hosting/standingAgent.js.map +1 -1
- package/dist/hosting/stream.js +5 -1
- package/dist/hosting/stream.js.map +1 -1
- package/dist/hosting/streamHandler.js +36 -12
- package/dist/hosting/streamHandler.js.map +1 -1
- package/dist/hosting/types.js.map +1 -1
- package/dist/identity/requestContext.js +139 -0
- package/dist/identity/requestContext.js.map +1 -0
- package/dist/identity/requestCredentials.js +165 -0
- package/dist/identity/requestCredentials.js.map +1 -0
- package/dist/identity/types.js.map +1 -1
- package/dist/identity.js +13 -1
- package/dist/identity.js.map +1 -1
- package/dist/index.js +15 -4
- package/dist/index.js.map +1 -1
- package/dist/injection-engine/buildInjectionEngineSubflow.js +38 -4
- package/dist/injection-engine/buildInjectionEngineSubflow.js.map +1 -1
- package/dist/injection-engine/constrainedEnumPick.js +4 -2
- package/dist/injection-engine/constrainedEnumPick.js.map +1 -1
- package/dist/injection-engine/evaluator.js +18 -0
- package/dist/injection-engine/evaluator.js.map +1 -1
- package/dist/injection-engine/skillGraph.js +25 -7
- package/dist/injection-engine/skillGraph.js.map +1 -1
- package/dist/injection-engine/skillIntent.js +3 -0
- package/dist/injection-engine/skillIntent.js.map +1 -1
- package/dist/injection-engine/types.js +17 -1
- package/dist/injection-engine/types.js.map +1 -1
- package/dist/lib/abort.js +336 -0
- package/dist/lib/abort.js.map +1 -0
- package/dist/maps/engagement/parkCard.js +10 -3
- package/dist/maps/engagement/parkCard.js.map +1 -1
- package/dist/mcp/mcpClient.js +30 -2
- package/dist/mcp/mcpClient.js.map +1 -1
- package/dist/mcp/mcpServe.js +5 -1
- package/dist/mcp/mcpServe.js.map +1 -1
- package/dist/mcp/plainData.js +208 -0
- package/dist/mcp/plainData.js.map +1 -0
- package/dist/mcp/sdkLoadFailure.js +4 -4
- package/dist/mcp/sdkLoadFailure.js.map +1 -1
- package/dist/mcp/toolResult.js +8 -50
- package/dist/mcp/toolResult.js.map +1 -1
- package/dist/memory/beats/llmExtractor.js +6 -3
- package/dist/memory/beats/llmExtractor.js.map +1 -1
- package/dist/memory/facts/llmFactExtractor.js +6 -3
- package/dist/memory/facts/llmFactExtractor.js.map +1 -1
- package/dist/memory/stages/summarize.js +16 -5
- package/dist/memory/stages/summarize.js.map +1 -1
- package/dist/patterns/LlmRouter.js +9 -4
- package/dist/patterns/LlmRouter.js.map +1 -1
- package/dist/redaction/conversation.js +3 -0
- package/dist/redaction/conversation.js.map +1 -1
- package/dist/redaction/knownStrings.js +1 -0
- package/dist/redaction/knownStrings.js.map +1 -1
- package/dist/reliability/buildReliabilityGateChart.js +7 -1
- package/dist/reliability/buildReliabilityGateChart.js.map +1 -1
- package/dist/resilience/withCircuitBreaker.js +5 -2
- package/dist/resilience/withCircuitBreaker.js.map +1 -1
- package/dist/resilience/withFallback.js +6 -0
- package/dist/resilience/withFallback.js.map +1 -1
- package/dist/resilience/withRetry.js +5 -0
- package/dist/resilience/withRetry.js.map +1 -1
- package/dist/time-travel/servedView.js +1 -1
- package/dist/time-travel/servedView.js.map +1 -1
- package/dist/tools/hostFilled.js +517 -0
- package/dist/tools/hostFilled.js.map +1 -0
- package/dist/types/adapters/llm/AnthropicProvider.d.ts +9 -2
- package/dist/types/adapters/llm/AnthropicProvider.d.ts.map +1 -1
- package/dist/types/adapters/llm/BedrockProvider.d.ts +6 -1
- package/dist/types/adapters/llm/BedrockProvider.d.ts.map +1 -1
- package/dist/types/adapters/llm/BrowserAnthropicProvider.d.ts.map +1 -1
- package/dist/types/adapters/llm/BrowserOpenAIProvider.d.ts.map +1 -1
- package/dist/types/adapters/llm/FoundryLocalProvider.d.ts.map +1 -1
- package/dist/types/adapters/llm/GeminiProvider.d.ts.map +1 -1
- package/dist/types/adapters/llm/InvokeModelGatewayProvider.d.ts.map +1 -1
- package/dist/types/adapters/llm/MockProvider.d.ts.map +1 -1
- package/dist/types/adapters/llm/OllamaProvider.d.ts.map +1 -1
- package/dist/types/adapters/llm/OpenAIProvider.d.ts +6 -1
- package/dist/types/adapters/llm/OpenAIProvider.d.ts.map +1 -1
- package/dist/types/adapters/mcp/agentcoreRuntime/invoke.d.ts +1 -1
- package/dist/types/adapters/mcp/agentcoreRuntime/invoke.d.ts.map +1 -1
- package/dist/types/adapters/mcp/agentcoreRuntime/transport.d.ts +26 -3
- package/dist/types/adapters/mcp/agentcoreRuntime/transport.d.ts.map +1 -1
- package/dist/types/ag-ui/adapter.d.ts +61 -11
- package/dist/types/ag-ui/adapter.d.ts.map +1 -1
- package/dist/types/ag-ui/framing.d.ts +2 -1
- package/dist/types/ag-ui/framing.d.ts.map +1 -1
- package/dist/types/ag-ui/index.d.ts +6 -4
- package/dist/types/ag-ui/index.d.ts.map +1 -1
- package/dist/types/ag-ui/request.d.ts +86 -7
- package/dist/types/ag-ui/request.d.ts.map +1 -1
- package/dist/types/answer-validation/index.d.ts +2 -1
- package/dist/types/answer-validation/index.d.ts.map +1 -1
- package/dist/types/answer-validation/toolLedger.d.ts +66 -0
- package/dist/types/answer-validation/toolLedger.d.ts.map +1 -0
- package/dist/types/answer-validation/types.d.ts +48 -0
- package/dist/types/answer-validation/types.d.ts.map +1 -1
- package/dist/types/answer-validation/validate.d.ts +2 -2
- package/dist/types/answer-validation/validate.d.ts.map +1 -1
- package/dist/types/classify/typesafe.d.ts.map +1 -1
- package/dist/types/core/Agent.d.ts +9 -1
- package/dist/types/core/Agent.d.ts.map +1 -1
- package/dist/types/core/LLMCall.d.ts +2 -1
- package/dist/types/core/LLMCall.d.ts.map +1 -1
- package/dist/types/core/RunnerBase.d.ts +39 -8
- package/dist/types/core/RunnerBase.d.ts.map +1 -1
- package/dist/types/core/agent/buildAgentChart.d.ts.map +1 -1
- package/dist/types/core/agent/buildAgentMessageApiChart.d.ts +16 -0
- package/dist/types/core/agent/buildAgentMessageApiChart.d.ts.map +1 -1
- package/dist/types/core/agent/buildDynamicAgentChart.d.ts.map +1 -1
- package/dist/types/core/agent/buildMessageApiChart.d.ts +16 -0
- package/dist/types/core/agent/buildMessageApiChart.d.ts.map +1 -1
- package/dist/types/core/agent/stages/answerValidation.d.ts.map +1 -1
- package/dist/types/core/agent/stages/callLLM.d.ts.map +1 -1
- package/dist/types/core/agent/stages/routeTurn.d.ts.map +1 -1
- package/dist/types/core/agent/stages/seed.d.ts +7 -0
- package/dist/types/core/agent/stages/seed.d.ts.map +1 -1
- package/dist/types/core/agent/stages/toolCalls.d.ts +21 -0
- package/dist/types/core/agent/stages/toolCalls.d.ts.map +1 -1
- package/dist/types/core/agent/types.d.ts +10 -0
- package/dist/types/core/agent/types.d.ts.map +1 -1
- package/dist/types/core/agent/window/strategies/summarizeOldest.d.ts.map +1 -1
- package/dist/types/core/agent/window/summarize.d.ts.map +1 -1
- package/dist/types/core/memberRun.d.ts +23 -2
- package/dist/types/core/memberRun.d.ts.map +1 -1
- package/dist/types/core/requestOfRun.d.ts +22 -0
- package/dist/types/core/requestOfRun.d.ts.map +1 -0
- package/dist/types/core/runner.d.ts +15 -3
- package/dist/types/core/runner.d.ts.map +1 -1
- package/dist/types/core/slots/buildToolsSlot.d.ts +0 -16
- package/dist/types/core/slots/buildToolsSlot.d.ts.map +1 -1
- package/dist/types/core-flow/Conditional.d.ts +2 -1
- package/dist/types/core-flow/Conditional.d.ts.map +1 -1
- package/dist/types/core-flow/Graph.d.ts +2 -1
- package/dist/types/core-flow/Graph.d.ts.map +1 -1
- package/dist/types/core-flow/Loop.d.ts +2 -1
- package/dist/types/core-flow/Loop.d.ts.map +1 -1
- package/dist/types/core-flow/Parallel.d.ts +2 -1
- package/dist/types/core-flow/Parallel.d.ts.map +1 -1
- package/dist/types/core-flow/Sequence.d.ts +2 -1
- package/dist/types/core-flow/Sequence.d.ts.map +1 -1
- package/dist/types/core-flow/Workflow.d.ts +2 -1
- package/dist/types/core-flow/Workflow.d.ts.map +1 -1
- package/dist/types/doors/security.d.ts +2 -1
- package/dist/types/doors/security.d.ts.map +1 -1
- package/dist/types/events/payloads.d.ts +4 -2
- package/dist/types/events/payloads.d.ts.map +1 -1
- package/dist/types/hosting/index.d.ts +1 -0
- package/dist/types/hosting/index.d.ts.map +1 -1
- package/dist/types/hosting/protocolAdapter.d.ts +4 -1
- package/dist/types/hosting/protocolAdapter.d.ts.map +1 -1
- package/dist/types/hosting/refusalStatus.d.ts.map +1 -1
- package/dist/types/hosting/requestSealing.d.ts +66 -0
- package/dist/types/hosting/requestSealing.d.ts.map +1 -0
- package/dist/types/hosting/standingAgent.d.ts.map +1 -1
- package/dist/types/hosting/stream.d.ts +23 -2
- package/dist/types/hosting/stream.d.ts.map +1 -1
- package/dist/types/hosting/streamHandler.d.ts +26 -7
- package/dist/types/hosting/streamHandler.d.ts.map +1 -1
- package/dist/types/hosting/types.d.ts +29 -0
- package/dist/types/hosting/types.d.ts.map +1 -1
- package/dist/types/identity/requestContext.d.ts +97 -0
- package/dist/types/identity/requestContext.d.ts.map +1 -0
- package/dist/types/identity/requestCredentials.d.ts +100 -0
- package/dist/types/identity/requestCredentials.d.ts.map +1 -0
- package/dist/types/identity/types.d.ts +11 -0
- package/dist/types/identity/types.d.ts.map +1 -1
- package/dist/types/identity.d.ts +2 -0
- package/dist/types/identity.d.ts.map +1 -1
- package/dist/types/index.d.ts +3 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/injection-engine/buildInjectionEngineSubflow.d.ts +11 -0
- package/dist/types/injection-engine/buildInjectionEngineSubflow.d.ts.map +1 -1
- package/dist/types/injection-engine/constrainedEnumPick.d.ts.map +1 -1
- package/dist/types/injection-engine/evaluator.d.ts +6 -0
- package/dist/types/injection-engine/evaluator.d.ts.map +1 -1
- package/dist/types/injection-engine/skillIntent.d.ts +4 -2
- package/dist/types/injection-engine/skillIntent.d.ts.map +1 -1
- package/dist/types/injection-engine/types.d.ts +27 -1
- package/dist/types/injection-engine/types.d.ts.map +1 -1
- package/dist/types/lib/abort.d.ts +144 -0
- package/dist/types/lib/abort.d.ts.map +1 -0
- package/dist/types/maps/engagement/parkCard.d.ts +5 -1
- package/dist/types/maps/engagement/parkCard.d.ts.map +1 -1
- package/dist/types/mcp/mcpServe.d.ts.map +1 -1
- package/dist/types/mcp/plainData.d.ts +45 -0
- package/dist/types/mcp/plainData.d.ts.map +1 -0
- package/dist/types/mcp/sdkLoadFailure.d.ts +6 -7
- package/dist/types/mcp/sdkLoadFailure.d.ts.map +1 -1
- package/dist/types/mcp/toolResult.d.ts.map +1 -1
- package/dist/types/mcp/types.d.ts +10 -6
- package/dist/types/mcp/types.d.ts.map +1 -1
- package/dist/types/memory/beats/llmExtractor.d.ts.map +1 -1
- package/dist/types/memory/facts/llmFactExtractor.d.ts.map +1 -1
- package/dist/types/memory/stages/summarize.d.ts.map +1 -1
- package/dist/types/patterns/LlmRouter.d.ts.map +1 -1
- package/dist/types/redaction/conversation.d.ts.map +1 -1
- package/dist/types/redaction/knownStrings.d.ts.map +1 -1
- package/dist/types/reliability/buildReliabilityGateChart.d.ts.map +1 -1
- package/dist/types/resilience/withCircuitBreaker.d.ts.map +1 -1
- package/dist/types/resilience/withFallback.d.ts.map +1 -1
- package/dist/types/resilience/withRetry.d.ts.map +1 -1
- package/dist/types/tools/hostFilled.d.ts +111 -0
- package/dist/types/tools/hostFilled.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* requestContext — the INCOMING REQUEST's secrets, sealed for one run.
|
|
3
|
+
*
|
|
4
|
+
* A host that receives a per-request credential (an encrypted token in a
|
|
5
|
+
* header, a session-bound key) seals it here and hands the handle to the run:
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* const request = requestContext({ secrets: { mcpToken: req.headers['x-mcp-token'] } });
|
|
9
|
+
* await agent.run({ message }, { request });
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* ── Why a sealed handle and not a plain object ──────────────────────────────
|
|
13
|
+
* The run's input, its options and its state all travel: input and state into
|
|
14
|
+
* the commit log, the recorders and every exporter; options into whatever a
|
|
15
|
+
* host logs. A plain `{ mcpToken: '…' }` would ride all of them. The handle
|
|
16
|
+
* holds NOTHING an enumeration, `JSON.stringify`, `structuredClone` or an
|
|
17
|
+
* inspector can reach — the values live in a module-private `WeakMap` keyed by
|
|
18
|
+
* the handle, and only {@link requestSecretOf} (internal, never on a door)
|
|
19
|
+
* reads them. So the handle can sit in an options bag, be logged by accident,
|
|
20
|
+
* or be copied, and nothing secret moves with it.
|
|
21
|
+
*
|
|
22
|
+
* ── Who reads it ─────────────────────────────────────────────────────────────
|
|
23
|
+
* Only a credential provider, through `CredentialRequest.request`, which the
|
|
24
|
+
* framework fills from the run the call belongs to (`bindRequest`). The model
|
|
25
|
+
* never sees it, no stage writes it to scope, and a tool reaches what it
|
|
26
|
+
* vends only as `ctx.credential`.
|
|
27
|
+
*
|
|
28
|
+
* ── One request, one run ─────────────────────────────────────────────────────
|
|
29
|
+
* The framework decides WHICH handle a call carries — the agent's own run, or
|
|
30
|
+
* the run a composition opened for its members (`core/memberRun.ts`). A call
|
|
31
|
+
* with no run that carries a request gets none: a request credential then
|
|
32
|
+
* fails closed (`requestCredentials`), and is never borrowed from another run.
|
|
33
|
+
*
|
|
34
|
+
* Pattern: sealed value object (module-private WeakMap). Role: identity, run input.
|
|
35
|
+
*/
|
|
36
|
+
import type { CredentialProvider } from './types.js';
|
|
37
|
+
/** What {@link requestContext} takes. */
|
|
38
|
+
export interface RequestContextOptions {
|
|
39
|
+
/**
|
|
40
|
+
* The request's secrets, by name — `{ mcpToken: '<from the header>' }`.
|
|
41
|
+
* Each value must be a non-empty string; names are compared exactly.
|
|
42
|
+
*/
|
|
43
|
+
readonly secrets: Readonly<Record<string, string>>;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* The incoming request's secrets, sealed. Opaque: it has no readable fields,
|
|
47
|
+
* serializes as a fixed placeholder, and is recognised by the framework only
|
|
48
|
+
* when {@link requestContext} built it.
|
|
49
|
+
*/
|
|
50
|
+
export interface RequestContext {
|
|
51
|
+
/** Type-only brand: no value carries it at run time. A value built anywhere
|
|
52
|
+
* else is refused at the door (`assertRequestContext`), never read. */
|
|
53
|
+
readonly [requestContextBrand]: never;
|
|
54
|
+
}
|
|
55
|
+
/** The brand's key — declared, never created; it exists only in the types. */
|
|
56
|
+
declare const requestContextBrand: unique symbol;
|
|
57
|
+
/**
|
|
58
|
+
* Seal an incoming request's secrets for one run. Pass the result as
|
|
59
|
+
* `run(input, { request })` (or `resume(…, { request })`); a credential
|
|
60
|
+
* provider built by `requestCredentials` reads it there.
|
|
61
|
+
*
|
|
62
|
+
* @throws TypeError when `secrets` is not a plain object of non-empty strings.
|
|
63
|
+
*/
|
|
64
|
+
export declare function requestContext(options: RequestContextOptions): RequestContext;
|
|
65
|
+
/** Whether `value` is a handle {@link requestContext} built. */
|
|
66
|
+
export declare function isRequestContext(value: unknown): value is RequestContext;
|
|
67
|
+
/**
|
|
68
|
+
* Refuse a `request` that {@link requestContext} did not build — at the door
|
|
69
|
+
* the caller used, before anything moves. A plain object would carry its
|
|
70
|
+
* values wherever the options travel.
|
|
71
|
+
*
|
|
72
|
+
* @throws TypeError naming the door.
|
|
73
|
+
*/
|
|
74
|
+
export declare function assertRequestContext(value: unknown, door: string): void;
|
|
75
|
+
/**
|
|
76
|
+
* The secret a sealed request holds under `name`, or `undefined`.
|
|
77
|
+
*
|
|
78
|
+
* @internal Never re-exported on a door. The only reader is a credential
|
|
79
|
+
* provider in this folder, which turns it into a `Credential` for one call.
|
|
80
|
+
*/
|
|
81
|
+
export declare function requestSecretOf(request: unknown, name: string): string | undefined;
|
|
82
|
+
/**
|
|
83
|
+
* The provider a call of ONE run is handed: a `getCredential` for `service` —
|
|
84
|
+
* the service the calling tool DECLARES in its `needs` — carries that run's
|
|
85
|
+
* request, and only that run's. A request the caller put on the request
|
|
86
|
+
* itself is always replaced (or removed), so a tool cannot present another
|
|
87
|
+
* run's handle through `ctx.credentials`; and a call for any OTHER service
|
|
88
|
+
* carries no request, so a tool cannot pull a request credential it never
|
|
89
|
+
* declared. `service` undefined → no call carries a request.
|
|
90
|
+
*
|
|
91
|
+
* Every other field passes through untouched; the provider's `id` is kept.
|
|
92
|
+
*
|
|
93
|
+
* @internal The framework's binding; not on a door.
|
|
94
|
+
*/
|
|
95
|
+
export declare function bindRequest(provider: CredentialProvider, request: RequestContext | undefined, service: string | undefined): CredentialProvider;
|
|
96
|
+
export {};
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* requestContext — the INCOMING REQUEST's secrets, sealed for one run.
|
|
3
|
+
*
|
|
4
|
+
* A host that receives a per-request credential (an encrypted token in a
|
|
5
|
+
* header, a session-bound key) seals it here and hands the handle to the run:
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* const request = requestContext({ secrets: { mcpToken: req.headers['x-mcp-token'] } });
|
|
9
|
+
* await agent.run({ message }, { request });
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* ── Why a sealed handle and not a plain object ──────────────────────────────
|
|
13
|
+
* The run's input, its options and its state all travel: input and state into
|
|
14
|
+
* the commit log, the recorders and every exporter; options into whatever a
|
|
15
|
+
* host logs. A plain `{ mcpToken: '…' }` would ride all of them. The handle
|
|
16
|
+
* holds NOTHING an enumeration, `JSON.stringify`, `structuredClone` or an
|
|
17
|
+
* inspector can reach — the values live in a module-private `WeakMap` keyed by
|
|
18
|
+
* the handle, and only {@link requestSecretOf} (internal, never on a door)
|
|
19
|
+
* reads them. So the handle can sit in an options bag, be logged by accident,
|
|
20
|
+
* or be copied, and nothing secret moves with it.
|
|
21
|
+
*
|
|
22
|
+
* ── Who reads it ─────────────────────────────────────────────────────────────
|
|
23
|
+
* Only a credential provider, through `CredentialRequest.request`, which the
|
|
24
|
+
* framework fills from the run the call belongs to (`bindRequest`). The model
|
|
25
|
+
* never sees it, no stage writes it to scope, and a tool reaches what it
|
|
26
|
+
* vends only as `ctx.credential`.
|
|
27
|
+
*
|
|
28
|
+
* ── One request, one run ─────────────────────────────────────────────────────
|
|
29
|
+
* The framework decides WHICH handle a call carries — the agent's own run, or
|
|
30
|
+
* the run a composition opened for its members (`core/memberRun.ts`). A call
|
|
31
|
+
* with no run that carries a request gets none: a request credential then
|
|
32
|
+
* fails closed (`requestCredentials`), and is never borrowed from another run.
|
|
33
|
+
*
|
|
34
|
+
* Pattern: sealed value object (module-private WeakMap). Role: identity, run input.
|
|
35
|
+
*/
|
|
36
|
+
/** The sealed values, keyed by handle. Module-private: nothing else can read them. */
|
|
37
|
+
const sealed = new WeakMap();
|
|
38
|
+
const PLACEHOLDER = '[request context]';
|
|
39
|
+
/**
|
|
40
|
+
* Seal an incoming request's secrets for one run. Pass the result as
|
|
41
|
+
* `run(input, { request })` (or `resume(…, { request })`); a credential
|
|
42
|
+
* provider built by `requestCredentials` reads it there.
|
|
43
|
+
*
|
|
44
|
+
* @throws TypeError when `secrets` is not a plain object of non-empty strings.
|
|
45
|
+
*/
|
|
46
|
+
export function requestContext(options) {
|
|
47
|
+
const secrets = options?.secrets;
|
|
48
|
+
if (secrets === null || typeof secrets !== 'object' || Array.isArray(secrets)) {
|
|
49
|
+
throw new TypeError('requestContext: `secrets` must be an object of name → string.');
|
|
50
|
+
}
|
|
51
|
+
const values = new Map();
|
|
52
|
+
for (const name of Object.keys(secrets)) {
|
|
53
|
+
const value = secrets[name];
|
|
54
|
+
if (name === '')
|
|
55
|
+
throw new TypeError('requestContext: a secret name must not be empty.');
|
|
56
|
+
// The NAME is safe to say; the value never is.
|
|
57
|
+
if (typeof value !== 'string' || value === '') {
|
|
58
|
+
throw new TypeError(`requestContext: secret '${name}' must be a non-empty string — an absent value is ` +
|
|
59
|
+
'left out, never passed empty.');
|
|
60
|
+
}
|
|
61
|
+
values.set(name, value);
|
|
62
|
+
}
|
|
63
|
+
const handle = Object.create(handleProto);
|
|
64
|
+
Object.freeze(handle);
|
|
65
|
+
sealed.set(handle, values);
|
|
66
|
+
return handle;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* The handle's prototype — every reader that might print or copy it gets the
|
|
70
|
+
* placeholder. No own properties, so `Object.keys`, a spread or
|
|
71
|
+
* `structuredClone` yields `{}`.
|
|
72
|
+
*/
|
|
73
|
+
const handleProto = Object.freeze({
|
|
74
|
+
toJSON: () => PLACEHOLDER,
|
|
75
|
+
toString: () => PLACEHOLDER,
|
|
76
|
+
[Symbol.toStringTag]: 'RequestContext',
|
|
77
|
+
[Symbol.for('nodejs.util.inspect.custom')]: () => PLACEHOLDER,
|
|
78
|
+
});
|
|
79
|
+
/** Whether `value` is a handle {@link requestContext} built. */
|
|
80
|
+
export function isRequestContext(value) {
|
|
81
|
+
return typeof value === 'object' && value !== null && sealed.has(value);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Refuse a `request` that {@link requestContext} did not build — at the door
|
|
85
|
+
* the caller used, before anything moves. A plain object would carry its
|
|
86
|
+
* values wherever the options travel.
|
|
87
|
+
*
|
|
88
|
+
* @throws TypeError naming the door.
|
|
89
|
+
*/
|
|
90
|
+
export function assertRequestContext(value, door) {
|
|
91
|
+
if (value === undefined || isRequestContext(value))
|
|
92
|
+
return;
|
|
93
|
+
throw new TypeError(`${door}: \`request\` must be built by requestContext({ secrets }) — a plain object is ` +
|
|
94
|
+
'refused, because its values would travel wherever these options are logged or copied.');
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* The secret a sealed request holds under `name`, or `undefined`.
|
|
98
|
+
*
|
|
99
|
+
* @internal Never re-exported on a door. The only reader is a credential
|
|
100
|
+
* provider in this folder, which turns it into a `Credential` for one call.
|
|
101
|
+
*/
|
|
102
|
+
export function requestSecretOf(request, name) {
|
|
103
|
+
if (typeof request !== 'object' || request === null)
|
|
104
|
+
return undefined;
|
|
105
|
+
return sealed.get(request)?.get(name);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* The provider a call of ONE run is handed: a `getCredential` for `service` —
|
|
109
|
+
* the service the calling tool DECLARES in its `needs` — carries that run's
|
|
110
|
+
* request, and only that run's. A request the caller put on the request
|
|
111
|
+
* itself is always replaced (or removed), so a tool cannot present another
|
|
112
|
+
* run's handle through `ctx.credentials`; and a call for any OTHER service
|
|
113
|
+
* carries no request, so a tool cannot pull a request credential it never
|
|
114
|
+
* declared. `service` undefined → no call carries a request.
|
|
115
|
+
*
|
|
116
|
+
* Every other field passes through untouched; the provider's `id` is kept.
|
|
117
|
+
*
|
|
118
|
+
* @internal The framework's binding; not on a door.
|
|
119
|
+
*/
|
|
120
|
+
export function bindRequest(provider, request, service) {
|
|
121
|
+
return {
|
|
122
|
+
id: provider.id,
|
|
123
|
+
getCredential(req) {
|
|
124
|
+
const { request: _presented, ...rest } = req;
|
|
125
|
+
void _presented;
|
|
126
|
+
const carries = request !== undefined && service !== undefined && req.service === service;
|
|
127
|
+
return provider.getCredential(carries ? { ...rest, request } : rest);
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
//# sourceMappingURL=requestContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requestContext.js","sourceRoot":"","sources":["../../../src/identity/requestContext.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAIH,sFAAsF;AACtF,MAAM,MAAM,GAAG,IAAI,OAAO,EAAuC,CAAC;AAyBlE,MAAM,WAAW,GAAG,mBAAmB,CAAC;AAExC;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,OAA8B;IAC3D,MAAM,OAAO,GAAI,OAAsD,EAAE,OAAO,CAAC;IACjF,IAAI,OAAO,KAAK,IAAI,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QAC9E,MAAM,IAAI,SAAS,CAAC,+DAA+D,CAAC,CAAC;IACvF,CAAC;IACD,MAAM,MAAM,GAAG,IAAI,GAAG,EAAkB,CAAC;IACzC,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QACxC,MAAM,KAAK,GAAI,OAAmC,CAAC,IAAI,CAAC,CAAC;QACzD,IAAI,IAAI,KAAK,EAAE;YAAE,MAAM,IAAI,SAAS,CAAC,kDAAkD,CAAC,CAAC;QACzF,+CAA+C;QAC/C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,EAAE,EAAE,CAAC;YAC9C,MAAM,IAAI,SAAS,CACjB,2BAA2B,IAAI,oDAAoD;gBACjF,+BAA+B,CAClC,CAAC;QACJ,CAAC;QACD,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IA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CACzB,QAA4B,EAC5B,OAAmC,EACnC,OAA2B;IAE3B,OAAO;QACL,EAAE,EAAE,QAAQ,CAAC,EAAE;QACf,aAAa,CAAC,GAAsB;YAClC,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,IAAI,EAAE,GAAG,GAAG,CAAC;YAC7C,KAAK,UAAU,CAAC;YAChB,MAAM,OAAO,GAAG,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,SAAS,IAAI,GAAG,CAAC,OAAO,KAAK,OAAO,CAAC;YAC1F,OAAO,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QACvE,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* requestCredentials — a {@link CredentialProvider} fed from the INCOMING
|
|
3
|
+
* REQUEST: the credential a tool uses is the one this run's caller sent.
|
|
4
|
+
*
|
|
5
|
+
* ```ts
|
|
6
|
+
* import { requestCredentials, requestContext, decodedWith } from 'agentfootprint/security';
|
|
7
|
+
*
|
|
8
|
+
* // Once, at boot — no secret in here:
|
|
9
|
+
* const credentials = requestCredentials({
|
|
10
|
+
* services: {
|
|
11
|
+
* crm: 'crmToken', // bearer, as sent
|
|
12
|
+
* billing: { secret: 'billingKey', as: asApiKey('x-api-key') },
|
|
13
|
+
* mcp: { secret: 'mcpToken', as: decodedWith((raw) => decrypt(raw)) },
|
|
14
|
+
* },
|
|
15
|
+
* });
|
|
16
|
+
* const agent = Agent.create({ provider, credentials }).tool(crmTool).build();
|
|
17
|
+
*
|
|
18
|
+
* // Per request:
|
|
19
|
+
* await agent.run({ message }, { request: requestContext({ secrets: { crmToken, mcpToken } }) });
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* A tool declares `needs: { credential: 'crm' }` and reads `ctx.credential`,
|
|
23
|
+
* exactly as with any other provider. Nothing about the tool changes.
|
|
24
|
+
*
|
|
25
|
+
* ── Interface → adapter → strategies ────────────────────────────────────────
|
|
26
|
+
* The interface is the `CredentialProvider` port. This adapter reads the
|
|
27
|
+
* secret named for the service from the request the call belongs to
|
|
28
|
+
* (`CredentialRequest.request`, filled by the framework). A strategy turns the
|
|
29
|
+
* raw value into a `Credential`: {@link asBearer} (the default),
|
|
30
|
+
* {@link asApiKey}, or {@link decodedWith} for a value that must be decrypted
|
|
31
|
+
* or exchanged first.
|
|
32
|
+
*
|
|
33
|
+
* ── Fails closed, by name ───────────────────────────────────────────────────
|
|
34
|
+
* Every refusal is a {@link RequestCredentialError} naming the SERVICE and the
|
|
35
|
+
* secret's NAME — never a value, and never a strategy's own error text (a
|
|
36
|
+
* decrypt library may quote its input). A thrown message reaches the model as
|
|
37
|
+
* the tool result and rides `agentfootprint.credential.failed`.
|
|
38
|
+
* - no request on the call (a run started without one, a mount no run
|
|
39
|
+
* reaches, a connection-level caller) → `'no-request'`;
|
|
40
|
+
* - the request does not carry the secret → `'missing'`;
|
|
41
|
+
* - a service this provider was not told about → `'unknown-service'`;
|
|
42
|
+
* - the strategy threw or returned no credential → `'undecodable'`.
|
|
43
|
+
* There is no fallback: a missing per-request credential is never served from
|
|
44
|
+
* another request, a default, or the process.
|
|
45
|
+
*
|
|
46
|
+
* Pattern: Adapter (port) + Strategy (raw value → Credential).
|
|
47
|
+
*/
|
|
48
|
+
import type { Credential, CredentialProvider } from './types.js';
|
|
49
|
+
/** Raw request value → the credential a tool applies. May be async (decrypt, exchange). */
|
|
50
|
+
export type RequestCredentialStrategy = (raw: string) => Credential | Promise<Credential>;
|
|
51
|
+
/** Where a service's credential comes from in the request, and how it is read. */
|
|
52
|
+
export interface RequestCredentialSource {
|
|
53
|
+
/** The secret's name in `requestContext({ secrets })`. */
|
|
54
|
+
readonly secret: string;
|
|
55
|
+
/** How the raw value becomes a credential. Default {@link asBearer}. */
|
|
56
|
+
readonly as?: RequestCredentialStrategy;
|
|
57
|
+
}
|
|
58
|
+
/** What {@link requestCredentials} takes. */
|
|
59
|
+
export interface RequestCredentialsOptions {
|
|
60
|
+
/** Optional id (defaults to `'request-credentials'`). */
|
|
61
|
+
readonly id?: string;
|
|
62
|
+
/**
|
|
63
|
+
* Service id (what a tool's `needs.credential` names) → its source. A string
|
|
64
|
+
* is the secret's name, read as a bearer token.
|
|
65
|
+
*/
|
|
66
|
+
readonly services: Readonly<Record<string, string | RequestCredentialSource>>;
|
|
67
|
+
}
|
|
68
|
+
/** Why a request credential was refused. */
|
|
69
|
+
export type RequestCredentialRefusal = 'no-request' | 'missing' | 'unknown-service' | 'undecodable';
|
|
70
|
+
/**
|
|
71
|
+
* A request credential that could not be served. Its message names the
|
|
72
|
+
* service and the secret's name; it never carries a value or a strategy's
|
|
73
|
+
* own error.
|
|
74
|
+
*/
|
|
75
|
+
export declare class RequestCredentialError extends Error {
|
|
76
|
+
readonly reason: RequestCredentialRefusal;
|
|
77
|
+
readonly service: string;
|
|
78
|
+
readonly code: "ERR_REQUEST_CREDENTIAL";
|
|
79
|
+
constructor(reason: RequestCredentialRefusal, service: string, message: string);
|
|
80
|
+
}
|
|
81
|
+
/** The raw value, as a bearer token (`Authorization: Bearer …`). The default. */
|
|
82
|
+
export declare function asBearer(): RequestCredentialStrategy;
|
|
83
|
+
/** The raw value, as an API key in one header (default `x-api-key`). */
|
|
84
|
+
export declare function asApiKey(headerName?: string): RequestCredentialStrategy;
|
|
85
|
+
/**
|
|
86
|
+
* Decode the raw value first — decrypt an encrypted per-request token,
|
|
87
|
+
* exchange it — then read the result with `then` (default {@link asBearer}).
|
|
88
|
+
* `decode` may return the plain value or a finished `Credential`. Whatever it
|
|
89
|
+
* throws is replaced by an `'undecodable'` refusal that quotes nothing.
|
|
90
|
+
*/
|
|
91
|
+
export declare function decodedWith(decode: (raw: string) => string | Credential | Promise<string | Credential>, then?: RequestCredentialStrategy): RequestCredentialStrategy;
|
|
92
|
+
/**
|
|
93
|
+
* Build the provider. Configuration is checked here, at boot: an empty
|
|
94
|
+
* service map, an empty secret name or a strategy that is not a function is
|
|
95
|
+
* refused by name.
|
|
96
|
+
*
|
|
97
|
+
* @throws TypeError on a malformed `services` map.
|
|
98
|
+
*/
|
|
99
|
+
export declare function requestCredentials(options: RequestCredentialsOptions): CredentialProvider;
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* requestCredentials — a {@link CredentialProvider} fed from the INCOMING
|
|
3
|
+
* REQUEST: the credential a tool uses is the one this run's caller sent.
|
|
4
|
+
*
|
|
5
|
+
* ```ts
|
|
6
|
+
* import { requestCredentials, requestContext, decodedWith } from 'agentfootprint/security';
|
|
7
|
+
*
|
|
8
|
+
* // Once, at boot — no secret in here:
|
|
9
|
+
* const credentials = requestCredentials({
|
|
10
|
+
* services: {
|
|
11
|
+
* crm: 'crmToken', // bearer, as sent
|
|
12
|
+
* billing: { secret: 'billingKey', as: asApiKey('x-api-key') },
|
|
13
|
+
* mcp: { secret: 'mcpToken', as: decodedWith((raw) => decrypt(raw)) },
|
|
14
|
+
* },
|
|
15
|
+
* });
|
|
16
|
+
* const agent = Agent.create({ provider, credentials }).tool(crmTool).build();
|
|
17
|
+
*
|
|
18
|
+
* // Per request:
|
|
19
|
+
* await agent.run({ message }, { request: requestContext({ secrets: { crmToken, mcpToken } }) });
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* A tool declares `needs: { credential: 'crm' }` and reads `ctx.credential`,
|
|
23
|
+
* exactly as with any other provider. Nothing about the tool changes.
|
|
24
|
+
*
|
|
25
|
+
* ── Interface → adapter → strategies ────────────────────────────────────────
|
|
26
|
+
* The interface is the `CredentialProvider` port. This adapter reads the
|
|
27
|
+
* secret named for the service from the request the call belongs to
|
|
28
|
+
* (`CredentialRequest.request`, filled by the framework). A strategy turns the
|
|
29
|
+
* raw value into a `Credential`: {@link asBearer} (the default),
|
|
30
|
+
* {@link asApiKey}, or {@link decodedWith} for a value that must be decrypted
|
|
31
|
+
* or exchanged first.
|
|
32
|
+
*
|
|
33
|
+
* ── Fails closed, by name ───────────────────────────────────────────────────
|
|
34
|
+
* Every refusal is a {@link RequestCredentialError} naming the SERVICE and the
|
|
35
|
+
* secret's NAME — never a value, and never a strategy's own error text (a
|
|
36
|
+
* decrypt library may quote its input). A thrown message reaches the model as
|
|
37
|
+
* the tool result and rides `agentfootprint.credential.failed`.
|
|
38
|
+
* - no request on the call (a run started without one, a mount no run
|
|
39
|
+
* reaches, a connection-level caller) → `'no-request'`;
|
|
40
|
+
* - the request does not carry the secret → `'missing'`;
|
|
41
|
+
* - a service this provider was not told about → `'unknown-service'`;
|
|
42
|
+
* - the strategy threw or returned no credential → `'undecodable'`.
|
|
43
|
+
* There is no fallback: a missing per-request credential is never served from
|
|
44
|
+
* another request, a default, or the process.
|
|
45
|
+
*
|
|
46
|
+
* Pattern: Adapter (port) + Strategy (raw value → Credential).
|
|
47
|
+
*/
|
|
48
|
+
import { apiKey, bearer } from './kinds.js';
|
|
49
|
+
import { requestSecretOf } from './requestContext.js';
|
|
50
|
+
/**
|
|
51
|
+
* A request credential that could not be served. Its message names the
|
|
52
|
+
* service and the secret's name; it never carries a value or a strategy's
|
|
53
|
+
* own error.
|
|
54
|
+
*/
|
|
55
|
+
export class RequestCredentialError extends Error {
|
|
56
|
+
reason;
|
|
57
|
+
service;
|
|
58
|
+
code = 'ERR_REQUEST_CREDENTIAL';
|
|
59
|
+
constructor(reason, service, message) {
|
|
60
|
+
super(message);
|
|
61
|
+
this.reason = reason;
|
|
62
|
+
this.service = service;
|
|
63
|
+
this.name = 'RequestCredentialError';
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/** The raw value, as a bearer token (`Authorization: Bearer …`). The default. */
|
|
67
|
+
export function asBearer() {
|
|
68
|
+
return (raw) => bearer(raw);
|
|
69
|
+
}
|
|
70
|
+
/** The raw value, as an API key in one header (default `x-api-key`). */
|
|
71
|
+
export function asApiKey(headerName) {
|
|
72
|
+
return (raw) => apiKey(raw, headerName);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Decode the raw value first — decrypt an encrypted per-request token,
|
|
76
|
+
* exchange it — then read the result with `then` (default {@link asBearer}).
|
|
77
|
+
* `decode` may return the plain value or a finished `Credential`. Whatever it
|
|
78
|
+
* throws is replaced by an `'undecodable'` refusal that quotes nothing.
|
|
79
|
+
*/
|
|
80
|
+
export function decodedWith(decode, then = asBearer()) {
|
|
81
|
+
return async (raw) => {
|
|
82
|
+
const decoded = await decode(raw);
|
|
83
|
+
return typeof decoded === 'string' ? then(decoded) : decoded;
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Build the provider. Configuration is checked here, at boot: an empty
|
|
88
|
+
* service map, an empty secret name or a strategy that is not a function is
|
|
89
|
+
* refused by name.
|
|
90
|
+
*
|
|
91
|
+
* @throws TypeError on a malformed `services` map.
|
|
92
|
+
*/
|
|
93
|
+
export function requestCredentials(options) {
|
|
94
|
+
const sources = readSources(options?.services);
|
|
95
|
+
return {
|
|
96
|
+
id: options.id ?? 'request-credentials',
|
|
97
|
+
async getCredential(req) {
|
|
98
|
+
const service = req.service;
|
|
99
|
+
const source = Object.hasOwn(sources, service) ? sources[service] : undefined;
|
|
100
|
+
if (source === undefined) {
|
|
101
|
+
throw new RequestCredentialError('unknown-service', service, `requestCredentials: no request credential is declared for service '${service}'.`);
|
|
102
|
+
}
|
|
103
|
+
if (req.request === undefined) {
|
|
104
|
+
throw new RequestCredentialError('no-request', service, `requestCredentials: service '${service}' takes its credential from the incoming ` +
|
|
105
|
+
'request, and the call carries none — pass `request: requestContext({ secrets })` ' +
|
|
106
|
+
'to the run. A credential is never borrowed from another request.');
|
|
107
|
+
}
|
|
108
|
+
const raw = requestSecretOf(req.request, source.secret);
|
|
109
|
+
if (raw === undefined) {
|
|
110
|
+
throw new RequestCredentialError('missing', service, `requestCredentials: the request carries no '${source.secret}' secret for service ` +
|
|
111
|
+
`'${service}'.`);
|
|
112
|
+
}
|
|
113
|
+
let credential;
|
|
114
|
+
try {
|
|
115
|
+
credential = await source.as(raw);
|
|
116
|
+
}
|
|
117
|
+
catch {
|
|
118
|
+
credential = undefined;
|
|
119
|
+
}
|
|
120
|
+
if (!isCredential(credential)) {
|
|
121
|
+
throw new RequestCredentialError('undecodable', service, `requestCredentials: the '${source.secret}' secret for service '${service}' could ` +
|
|
122
|
+
'not be read as a credential.');
|
|
123
|
+
}
|
|
124
|
+
return { status: 'issued', credential };
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
function readSources(services) {
|
|
129
|
+
if (services === null || typeof services !== 'object' || Array.isArray(services)) {
|
|
130
|
+
throw new TypeError('requestCredentials: `services` must be an object of service → source.');
|
|
131
|
+
}
|
|
132
|
+
const out = Object.create(null);
|
|
133
|
+
const names = Object.keys(services);
|
|
134
|
+
if (names.length === 0) {
|
|
135
|
+
throw new TypeError('requestCredentials: `services` names no service.');
|
|
136
|
+
}
|
|
137
|
+
for (const service of names) {
|
|
138
|
+
const entry = services[service];
|
|
139
|
+
const secret = typeof entry === 'string' ? entry : entry?.secret;
|
|
140
|
+
const as = typeof entry === 'string' ? undefined : entry?.as;
|
|
141
|
+
if (typeof secret !== 'string' || secret === '') {
|
|
142
|
+
throw new TypeError(`requestCredentials: service '${service}' must name its secret (a non-empty string).`);
|
|
143
|
+
}
|
|
144
|
+
if (as !== undefined && typeof as !== 'function') {
|
|
145
|
+
throw new TypeError(`requestCredentials: service '${service}': \`as\` must be a strategy function.`);
|
|
146
|
+
}
|
|
147
|
+
out[service] = { secret, as: as ?? asBearer() };
|
|
148
|
+
}
|
|
149
|
+
return out;
|
|
150
|
+
}
|
|
151
|
+
function isCredential(value) {
|
|
152
|
+
return (typeof value === 'object' &&
|
|
153
|
+
value !== null &&
|
|
154
|
+
typeof value.kind === 'string' &&
|
|
155
|
+
typeof value.toHeaders === 'function');
|
|
156
|
+
}
|
|
157
|
+
//# sourceMappingURL=requestCredentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requestCredentials.js","sourceRoot":"","sources":["../../../src/identity/requestCredentials.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAQH,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AA2BtD;;;;GAIG;AACH,MAAM,OAAO,sBAAuB,SAAQ,KAAK;IAIpC;IACA;IAJF,IAAI,GAAG,wBAAiC,CAAC;IAElD,YACW,MAAgC,EAChC,OAAe,EACxB,OAAe;QAEf,KAAK,CAAC,OAAO,CAAC,CAAC;QAJN,WAAM,GAAN,MAAM,CAA0B;QAChC,YAAO,GAAP,OAAO,CAAQ;QAIxB,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAC;IACvC,CAAC;CACF;AAED,iFAAiF;AACjF,MAAM,UAAU,QAAQ;IACtB,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AAC9B,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,QAAQ,CAAC,UAAmB;IAC1C,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;AAC1C,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CACzB,MAA2E,EAC3E,OAAkC,QAAQ,EAAE;IAE5C,OAAO,KAAK,EAAE,GAAG,EAAE,EAAE;QACnB,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,CAAC;QAClC,OAAO,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;IAC/D,CAAC,CAAC;AACJ,CAAC;AAED;;;;;;GAM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,SAAS,IAAI,OAAO,EAAE,KAAK,UAAU,EAAE,CAAC;YACjD,MAAM,IAAI,SAAS,CACjB,gCAAgC,OAAO,wCAAwC,CAChF,CAAC;QACJ,CAAC;QACD,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAG,EAA4C,IAAI,QAAQ,EAAE,EAAE,CAAC;IAC7F,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAS,YAAY,CAAC,KAAc;IAClC,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,OAAQ,KAAoB,CAAC,IAAI,KAAK,QAAQ;QAC9C,OAAQ,KAAoB,CAAC,SAAS,KAAK,UAAU,CACtD,CAAC;AACJ,CAAC"}
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
* and observability exporters, which would leak the token into the trace. Pair
|
|
24
24
|
* with `RedactionPolicy` for defence in depth.
|
|
25
25
|
*/
|
|
26
|
+
import type { RequestContext } from './requestContext.js';
|
|
26
27
|
/** What a tool/agent asks for. `service` ↔ the provider's downstream service id. */
|
|
27
28
|
export interface CredentialRequest {
|
|
28
29
|
/** Downstream service id, e.g. 'github', 'slack', 'google'. */
|
|
@@ -66,6 +67,16 @@ export interface CredentialRequest {
|
|
|
66
67
|
* `staticTokens` does exactly that.
|
|
67
68
|
*/
|
|
68
69
|
readonly userToken?: string;
|
|
70
|
+
/**
|
|
71
|
+
* The incoming request this call belongs to, sealed — set by the FRAMEWORK
|
|
72
|
+
* from the run the call is part of, never by a tool or the model.
|
|
73
|
+
*
|
|
74
|
+
* Opaque: it carries no readable field. Only `requestCredentials` reads it
|
|
75
|
+
* (see `./requestContext`); every other provider ignores it. A call made
|
|
76
|
+
* where no run carries a request has none, and a request-sourced credential
|
|
77
|
+
* then fails closed.
|
|
78
|
+
*/
|
|
79
|
+
readonly request?: RequestContext;
|
|
69
80
|
/** Force a fresh authorization, bypassing any cached/refresh token. */
|
|
70
81
|
readonly forceReauth?: boolean;
|
|
71
82
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/identity/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/identity/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAgHH,yEAAyE;AACzE,MAAM,UAAU,kBAAkB,CAAC,CAAmB;IACpD,OAAO,CAAC,CAAC,MAAM,KAAK,QAAQ,CAAC;AAC/B,CAAC;AAgBD;;;;;;GAMG;AACH,MAAM,UAAU,8BAA8B;IAC5C,OAAO;QACL,EAAE,EAAE,cAAc;QAClB,aAAa,CAAC,GAAsB;YAClC,OAAO,OAAO,CAAC,MAAM,CACnB,IAAI,KAAK,CACP,4DAA4D,GAAG,CAAC,OAAO,QAAQ;gBAC7E,wEAAwE;gBACxE,gEAAgE,CACnE,CACF,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/esm/identity.d.ts
CHANGED
|
@@ -31,6 +31,8 @@ export type { Credential, CredentialProvider, CredentialRequest, CredentialResul
|
|
|
31
31
|
export { isCredentialIssued, unconfiguredCredentialProvider } from './identity/types.js';
|
|
32
32
|
export { bearer, apiKey, basic, headers, type BearerCredential, type ApiKeyCredential, type BasicCredential, type HeadersCredential, } from './identity/kinds.js';
|
|
33
33
|
export { staticTokens, type StaticTokensOptions } from './identity/staticTokens.js';
|
|
34
|
+
export { requestContext, isRequestContext, type RequestContext, type RequestContextOptions, } from './identity/requestContext.js';
|
|
35
|
+
export { requestCredentials, asBearer, asApiKey, decodedWith, RequestCredentialError, type RequestCredentialsOptions, type RequestCredentialSource, type RequestCredentialStrategy, type RequestCredentialRefusal, } from './identity/requestCredentials.js';
|
|
34
36
|
export type { AuthorizationRequiredMode, ConsentRequest } from './identity/consent.js';
|
|
35
37
|
export { CredentialConsentRequiredError, type CredentialConsentRequiredContext, } from './identity/CredentialConsentRequiredError.js';
|
|
36
38
|
export { withCredentialRetry, type WithCredentialRetryOptions, } from './identity/withCredentialRetry.js';
|
package/dist/esm/identity.js
CHANGED
|
@@ -30,6 +30,11 @@
|
|
|
30
30
|
export { isCredentialIssued, unconfiguredCredentialProvider } from './identity/types.js';
|
|
31
31
|
export { bearer, apiKey, basic, headers, } from './identity/kinds.js';
|
|
32
32
|
export { staticTokens } from './identity/staticTokens.js';
|
|
33
|
+
// Credentials from the INCOMING REQUEST: the host seals the request's secrets
|
|
34
|
+
// per run (`requestContext`), and `requestCredentials` vends them to a tool's
|
|
35
|
+
// declared `needs` — only for the run that carries them, failing closed by name.
|
|
36
|
+
export { requestContext, isRequestContext, } from './identity/requestContext.js';
|
|
37
|
+
export { requestCredentials, asBearer, asApiKey, decodedWith, RequestCredentialError, } from './identity/requestCredentials.js';
|
|
33
38
|
export { CredentialConsentRequiredError, } from './identity/CredentialConsentRequiredError.js';
|
|
34
39
|
export { withCredentialRetry, } from './identity/withCredentialRetry.js';
|
|
35
40
|
export { agentCoreIdentity,
|
package/dist/esm/identity.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity.js","sourceRoot":"","sources":["../../src/identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAWH,OAAO,EAAE,kBAAkB,EAAE,8BAA8B,EAAE,MAAM,qBAAqB,CAAC;AACzF,OAAO,EACL,MAAM,EACN,MAAM,EACN,KAAK,EACL,OAAO,GAKR,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,YAAY,EAA4B,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"identity.js","sourceRoot":"","sources":["../../src/identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAWH,OAAO,EAAE,kBAAkB,EAAE,8BA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A0E;AAC1E,+EAA+E;AAC/E,4BAA4B;AAC5B,OAAO,EACL,YAAY,GAKb,MAAM,6BAA6B,CAAC;AAErC,sEAAsE;AACtE,+EAA+E;AAC/E,iFAAiF;AACjF,OAAO,EACL,wBAAwB,EACxB,oBAAoB,EACpB,UAAU,GAIX,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,kBAAkB,GAInB,MAAM,0CAA0C,CAAC;AAClD,qEAAqE;AACrE,6EAA6E;AAC7E,OAAO,EACL,kBAAkB,GAEnB,MAAM,qDAAqD,CAAC;AAC7D,OAAO,EACL,aAAa,EACb,kBAAkB,GAGnB,MAAM,gDAAgD,CAAC;AACxD,OAAO,EACL,aAAa,EACb,iBAAiB,GAMlB,MAAM,uCAAuC,CAAC;AAC/C,8EAA8E;AAC9E,wEAAwE;AACxE,OAAO,EACL,YAAY,EACZ,cAAc,EACd,wBAAwB,EACxB,cAAc,EACd,YAAY,GAEb,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,qBAAqB,EACrB,mBAAmB,GAEpB,MAAM,0CAA0C,CAAC"}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -56,12 +56,13 @@ export { canResume, ConversationMismatchError, RunCheckpointError, type AgentRun
|
|
|
56
56
|
export { browserSessionId, DEFAULT_SESSION_STORAGE_KEY, type BrowserSessionIdOptions, } from './hosting/browserSession.js';
|
|
57
57
|
export { ContextWindowExceededError, ERR_CONTEXT_WINDOW_EXCEEDED, isContextWindowExceeded, } from './provider-contract/contextWindow.js';
|
|
58
58
|
export { NoConversationError, type NoConversationReason, PendingQuestionError, ResumeIdentityConflictError, ResumeRedactionError, type ResumeRedactionReason, RunInFlightError, } from './core/conversation.js';
|
|
59
|
-
export { MemberIdentityError, ParentRunRefusedError } from './core/memberRun.js';
|
|
59
|
+
export { MemberIdentityError, ParentRunRefusedError, ResumeRequestConflictError, } from './core/memberRun.js';
|
|
60
60
|
export { flowchartAsTool, type FlowchartAsToolOptions, type FlowchartResultMapper, type FlowchartToolSnapshot, } from './core/flowchartAsTool.js';
|
|
61
61
|
export { absenceSignalOf, DECLINED_VERDICT, DEFAULT_MAX_ROWS, DEFAULT_RECORDING_MAX_BYTES, DEFAULT_WALK_CAP, PANEL_RENDER_NOTE, probeDispatch, projectWalk, recordingDispatch, renderVerdictTable, runbookAsTool, RunbookAbsenceSignal, VERDICT_RENDER_NOTE, verdictRowsOf, type InnerCallRecord, type ProjectedWalk, type RecordedDispatch, type RunbookAsToolOptions, type RunbookEnvelope, type RunbookPresentation, type RunbookProcedure, type RunbookRecordingOptions, type RunbookRules, type RunbookVerdictsOptions, type RunbookWalkOptions, type VerdictRow, type WalkDescriptor, type WalkRow, } from './core/runbook/index.js';
|
|
62
62
|
export type { Tool, ToolExecutionContext, ToolRegistryEntry, DefineToolOptions, ToolDispatch, ToolDispatchCallOptions, ToolResultCeiling, } from './tools/tools.js';
|
|
63
63
|
export type { AskOrAssume, ToolPeriod } from './tools/declare.js';
|
|
64
64
|
export { defineTool, assertResultCeiling, assertResultClass, assertResultKind, assertComposedOf, assertGates, } from './tools/tools.js';
|
|
65
|
+
export { hostFilled, fromCredential, fromIdentity, HostFilledArgumentError, HostFilledValueMissingError, HOST_FILLED_PLACEHOLDER, type HostFill, type HostFillFromCredential, type HostFillFromIdentity, type HostFilledIdentityField, } from './tools/hostFilled.js';
|
|
65
66
|
export { assertValidToolName, warnIfInvalidToolName } from './lib/toolName.js';
|
|
66
67
|
export { explainStatusOnlyNearMiss, readToolResultEnvelope, TOOL_RESULT_STATUSES, type InstructionDeliveryLease, type ProposedEffect, type ProposeTransitionEffect, type ReadToolResultEnvelope, type RequireInstructionEffect, type ToolResultEnvelope, type ToolResultStatus, } from './semantics/toolEffects.js';
|
|
67
68
|
export type { InstructionLease, PendingToolTransition } from './injection-engine/leases.js';
|
|
@@ -99,4 +100,4 @@ export { providerFromEnv, type ProviderKind, type CreateProviderOptions, type Pr
|
|
|
99
100
|
export * from './patterns/index.js';
|
|
100
101
|
export { defineRAG, DEFAULT_CORPUS_IDENTITY, type DefineRAGOptions, indexDocuments, type IndexDocumentsOptions, type RagDocument, } from './rag/retriever/index.js';
|
|
101
102
|
export { topK, type TopKOptions, type RetrievalStrategy, type RetrievalEvidence, type RetrievedCandidate, type RetrievalRejectReason, } from './memory/retrieval/index.js';
|
|
102
|
-
export { AnswerValidationError, type AnswerValidationOptions, type AnswerValidationReport, type AnswerCheck, type AnswerEvidenceResolver, } from './answer-validation/index.js';
|
|
103
|
+
export { AnswerValidationError, type AnswerValidationOptions, type AnswerValidationReport, type AnswerCheck, type AnswerEvidenceResolver, type AnswerToolCall, type AnswerToolCallsView, type AnswerValidationContext, } from './answer-validation/index.js';
|
package/dist/esm/index.js
CHANGED
|
@@ -270,7 +270,7 @@ export { ContextWindowExceededError, ERR_CONTEXT_WINDOW_EXCEEDED, isContextWindo
|
|
|
270
270
|
export { NoConversationError, PendingQuestionError, ResumeIdentityConflictError, ResumeRedactionError, RunInFlightError, } from './core/conversation.js';
|
|
271
271
|
// A composition member runs for the run that mounted it; one no run reached is
|
|
272
272
|
// refused by name (`core/memberRun.ts`).
|
|
273
|
-
export { MemberIdentityError, ParentRunRefusedError } from './core/memberRun.js';
|
|
273
|
+
export { MemberIdentityError, ParentRunRefusedError, ResumeRequestConflictError, } from './core/memberRun.js';
|
|
274
274
|
export { flowchartAsTool, } from './core/flowchartAsTool.js';
|
|
275
275
|
// runbookAsTool (9.76.0) — the STANDARD bridge from a footprintjs procedure
|
|
276
276
|
// to an Agent tool: every answer is the mandatory honesty spine (coverage
|
|
@@ -296,6 +296,10 @@ assertResultKind,
|
|
|
296
296
|
// procedure can raise an approval gate). Exported beside the others for
|
|
297
297
|
// consumers assembling `Tool` objects by hand.
|
|
298
298
|
assertComposedOf, assertGates, } from './tools/tools.js';
|
|
299
|
+
// Host-filled tool arguments: a field the HOST fills from the call's credential
|
|
300
|
+
// or the caller's identity — removed from the model's schema, a model-sent
|
|
301
|
+
// value refused by name, the credential scrubbed from what comes back.
|
|
302
|
+
export { hostFilled, fromCredential, fromIdentity, HostFilledArgumentError, HostFilledValueMissingError, HOST_FILLED_PLACEHOLDER, } from './tools/hostFilled.js';
|
|
299
303
|
// The tool-name law (`lib/toolName.ts`): the strict check and the dev-mode
|
|
300
304
|
// warning `defineTool` runs, for consumers assembling `Tool` objects by hand.
|
|
301
305
|
export { assertValidToolName, warnIfInvalidToolName } from './lib/toolName.js';
|