agentfootprint 10.4.0 → 10.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +58 -49
- package/dist/adapters/llm/BrowserAnthropicProvider.js.map +1 -1
- package/dist/adapters/llm/BrowserOpenAIProvider.js +51 -42
- package/dist/adapters/llm/BrowserOpenAIProvider.js.map +1 -1
- package/dist/adapters/llm/FoundryLocalProvider.js +177 -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 +49 -10
- 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 +134 -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 +58 -49
- package/dist/esm/adapters/llm/BrowserAnthropicProvider.js.map +1 -1
- package/dist/esm/adapters/llm/BrowserOpenAIProvider.js +51 -42
- package/dist/esm/adapters/llm/BrowserOpenAIProvider.js.map +1 -1
- package/dist/esm/adapters/llm/FoundryLocalProvider.js +174 -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.d.ts +3 -2
- package/dist/esm/adapters/llm/InvokeModelGatewayProvider.js +49 -10
- 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 +131 -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 +157 -0
- package/dist/esm/lib/abort.js +358 -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 +372 -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 +3 -2
- 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 +158 -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
package/CAPABILITIES.md
CHANGED
|
@@ -20,10 +20,14 @@ not in this table, search `src/index.ts` for the nearest noun before writing cod
|
|
|
20
20
|
|
|
21
21
|
| If you are about to build… | It is | Where | Since |
|
|
22
22
|
|---|---|---|---|
|
|
23
|
+
| giving a tool the credential that arrived WITH the incoming request (an encrypted per-request token, a session key) — sealed per run so no copy, log or state carries it, read only by the run that carried it (its composition members included, at any depth; a resume serves the resume's request), failing closed by name when absent; strategies for bearer, API-key header and decrypt-then-read; through a host, the app seals each request's credential from its headers (`sealRequest`) and the host hands it to that request's run only — a handle returned twice refused, a sealer's throw refused in fixed words | `requestContext` + `requestCredentials` + `asBearer` / `asApiKey` / `decodedWith` + `RequestCredentialError` (`agentfootprint/security`), `run(input, { request })`; `sealRequest` + `RequestSealer` on `standingAgent` / `streamHandler` (`agentfootprint/hosting`) | `src/identity/requestCredentials.ts` | 10.5.0 |
|
|
24
|
+
| hiding a credential or identity ARGUMENT of a tool (an MCP server's `token` field) from the model — removed from the schema the model sees, a model-sent value refused by name, filled from `ctx.credential` / `ctx.identity` inside `execute`, echoes of the credential scrubbed from results and errors | `hostFilled` + `fromCredential` / `fromIdentity` + `HostFilledArgumentError` | `src/tools/hostFilled.ts` | 10.5.0 |
|
|
23
25
|
| running the same composition (Sequence / Parallel / Conditional / Loop / workflow / graph, nested) for many users at once without their member agents sharing memory or identity — the caller's identity passed once to the composition and handed to every member at any depth; with none, each run is its own conversation; a mounted agent no run reaches refused by name, never run under a placeholder or its instance's last caller | `Sequence.run({ message, identity })` (and every composition's input) + `MemberIdentityError` | `src/core/memberRun.ts` | 10.4.0 |
|
|
24
26
|
| keeping a memory write out of a managed service's long-term extraction, or filing what it derives under one tenant's namespace — vendor-neutral write options on the `MemoryStore` port (`put`/`putMany`/`putIfVersion`), declared per store and REFUSED BY NAME where not honoured (never dropped), bound by `defineMemory` to every write AND search of a memory (the scope comes only from the run's identity; a per-call scope, an empty one, a search namespace that does not hold it segment for segment, or one that omits the person's actor is refused; `requireNamespaceScope` refuses unscoped access) and checked before the first turn; AgentCore maps them to `CreateEvent`'s `extractionMode: 'SKIP'` and `extractionConfig.namespaceVariables` only when its client and SDK can carry them, checks AgentCore's variable domain first, and ships a one-to-one tenant encoder into its alphabet | `MemoryWriteOptions` (`extraction: 'skip'`, `namespaceScope`) + `MemoryStore.writeOptions` + `defineMemory({ writeOptions, namespaceScope })` + `SearchOptions.namespaceScope` + `UnsupportedMemoryWriteOptionError` + `refuseUnhonouredWriteOptions` + `agentCoreNamespaceValue` (`agentfootprint/memory`) | `src/memory/store/writeOptions.ts` | 10.4.0 |
|
|
25
27
|
| calling an MCP server somebody deployed TO AWS Bedrock AgentCore Runtime (`--protocol MCP`) — through `InvokeAgentRuntime` with SigV4, or a bearer token over the documented HTTPS endpoint (the SDK has no bearer scheme); a fresh runtime session per call by default (`'per-call'` carries no session id, so one client can serve every user) or one per client (`'reuse'` keys each client's connection — its `runtimeSessionId` and the server's `Mcp-Session-Id` — by a handle the transport issues); what the MCP client reads of a failure rewritten from fixed sentences and safe ids (status, a plain error type, a JSON-RPC code), never the service's text (which can quote the signed request); a bearer token vended as a machine token only; the runtime's "Session operation in progress" refusal (JSON-RPC -32005 inside an HTTP 200, which MCP clients never retry; or the API's 409 `RetryableConflictException`) retried with bounded backoff by the SAME loop as the 429 retry, one small decision function — and nothing else re-sent: the SDK client's own retry is off, so a 5xx or a dropped connection is never replayed | `agentCoreRuntimeMcpTransport` + `agentCoreRuntimeUrl` + `AGENTCORE_RUNTIME_SESSION_HEADER` (`agentfootprint/providers`) | `src/adapters/mcp/agentcoreRuntime/` | 10.4.0 |
|
|
28
|
+
| bundling an app that speaks MCP (esbuild, webpack, a Lambda zip without `node_modules`) — the MCP and AWS SDKs load through a lazy `require` a bundler cannot follow, so the caller hands over the modules it imported statically | `mcpClient({ sdk: { Client, StreamableHTTPClientTransport } })` · `agentCoreRuntimeMcpTransport({ sdk })` (SigV4 only; `_sdk` = the older name, both-different refused, `sdk` beside `{ bearer }` refused); a missing or wrong SDK is refused when the client/transport is BUILT, in words naming `sdk`, never at the first tool call. Docs: mcp-client "Bundling (esbuild, webpack)". Fenced by `test/mcp/bundling.test.ts` | `src/mcp/` | 10.5.0 |
|
|
26
29
|
| serving agents to AG-UI frontends (CopilotKit, the AG-UI Dojo, an `@ag-ui/client` app) from any framework with no glue code — POST a `RunAgentInput`, stream AG-UI events back; the request is untrusted browser input: only the newest user message is conversation (the page's copy is never read), a system/developer message refused, an answer taken only for the pause the server keeps, frontend tools only by the app's name allow-list with its own contract (they run in the page, no server privilege), `state`/`context` only through the app's validators, no identity/credential/redaction from a request; a fresh runner per request, the thread bound to the caller the app authenticates, the conversation and paused runs kept server-side, one turn per thread, door guard, body ceiling, SSE keep-alive | `streamHandler` + `ProtocolAdapter` + `verifiedThreads` (`agentfootprint/hosting`) + `agUi` (`agentfootprint/ag-ui`) | `src/hosting/streamHandler.ts` | 10.4.0 |
|
|
30
|
+
| serving an agent behind a GATEWAY that speaks AG-UI in its own request body and its own output envelope (`{"eventType":"…Event","event":{…,"eventSequence":n}}`) — `agUi()` as three replaceable strategies: a reader (the gateway's body → the turn), the translation (AG-UI vocabulary, unchanged) and the framing (the envelope; each frame's number in its own stream handed in by the host, never a shared counter); every untrusted-input rule stays in the core whichever reader ran (shape and ids, no system/developer message, frontend tools by allow-list, state/context by validators, answers only for the kept pause; each value read once) | `agUi({ reader, translation, framing })` + `AgUiRequestReader` / `AgUiTurnRequest` / `AgUiTranslationStrategy` (`agentfootprint/ag-ui`), `SseFraming.frame(event, { sequence })` + `SseFramePosition` (`agentfootprint/observe`) | `src/ag-ui/adapter.ts` | 10.5.0 |
|
|
27
31
|
| checking forced tool choice per model without changing the existing boolean wire declaration; explicit requests refuse before transport, classifiers keep their strict parse alternative, wrappers preserve and fallback pairs intersect | `LLMProvider.supportsForcedToolChoice` + `forcedToolChoiceFor` + `UnsupportedToolChoiceError` (`agentfootprint/providers`) | `src/provider-contract/forcedToolChoice.ts` | 10.1.0 |
|
|
28
32
|
| a typed answer constrained by the PROVIDER'S OWN structured output instead of asked for in prose — the schema sent as Anthropic's `output_config.format`, the agent keeping its tools; one function builds the API-compatible wire copy (objects closed, unsupported constraints moved into the description, recursion / external `$ref` / complex enums / open values / open-keyed maps refused at build by node), the parser still judges; per-model capability with unknown ids read as the newest generation, refused by name at run start and before transport; a `'refusal'` / `'max_tokens'` stop fails the attempt by name even when it parses; `_findings` allowed on the format when the ledger is armed | `.outputSchema(parser, { strategy: 'native', jsonSchema })` + `LLMProvider.carriesNativeOutputSchema` / `supportsNativeOutputSchema` + `nativeOutputSchemaFor` + `UnsupportedNativeOutputError` (`agentfootprint/providers`) + `answerGuarantee: 'native'` + `OutputAttempt.stopReason` | `src/provider-contract/nativeOutputSchema.ts` | 10.3.0 |
|
|
29
33
|
| replaying Anthropic thinking in its original content order; refusing known unsafe active-tool replay, observing each permitted completed-turn omission before sending, and retaining that decision across checkpoints | `LLMMessage.replay` + `UnsafeThinkingReplayError` + `LLMCallHooks.onReplayPrepared` + `agentfootprint.agent.thinking_omitted` | `src/adapters/llm/anthropicThinkingReplay.ts` | 10.1.0 |
|
|
@@ -36,8 +40,9 @@ not in this table, search `src/index.ts` for the nearest noun before writing cod
|
|
|
36
40
|
| identifying which same-name tool call a permission check or credential event describes — captured at dispatch, including resume and inner pull failures; qualify with run identity, missing fields stay unknown | `ToolCallEventIdentity` + `bindToolSecurityEvents` | `src/core/agent/toolSecurityEvents.ts` | 9.137.0 |
|
|
37
41
|
| guiding an evidence repair to ask for missing context without inventing values | `recoveryInstruction` + `EvidenceRecoveryContext` | `src/core/agent/evidence/` | 9.96.0 |
|
|
38
42
|
| checking a typed final answer against scoped evidence before streaming or memory delivery — optional host-authored checks with enforce/observe modes, canonical JSON and bounded read-only artifacts | `answerValidation` + `AnswerValidationError` | `src/answer-validation/` | 9.95.0 |
|
|
43
|
+
| an output guard that sees which tools ran — fail the run when the answer presents code but no code-execution tool ran; this run's tool calls (name, call id, outcome ok/error/not-run; never arguments or results) handed to the enforce check, per run, bounded | `AnswerValidationContext.toolCalls` + `AnswerToolCallsView` + `limits.maxToolCalls` | `src/answer-validation/toolLedger.ts` | 10.5.0 |
|
|
39
44
|
| turning a written operational procedure (a runbook, a triage playbook) into ONE agent tool whose every answer is EVIDENCE — coverage folded up from the inner tools it calls, rule name+version, verdict rows with GENERATED meanings, and the recorded walk as an artifact ticket, never bytes | `runbookAsTool` — dials: `procedure` (factory, invoked per call with `ctx.tools`) + `resultKind` (`'verdict/*'` arms the rowset projection; anything else ships spine + the chart's `report`) + `rules {name, version}` (default absent ⇒ `rule_version: 'undeclared'`) + `verdicts {decider, maxRows}` (default 50; `verdict_meanings` = statically declared branches + this run's rule labels + the DEFAULT branch's label, which reaches evidence only when the chart calls `decide(s, rules, {branch, label})` — fp ≥9.16.1, the default is chosen by NO rule so nothing else can name it, and inside a generated fan-out branch the static walk is blind too; an undeclared or blank label stays ABSENT from the map, never invented from a branch id, and there is deliberately NO caller-supplied meanings map) + `presentation` (`'prose'` default = ship `table` + `VERDICT_RENDER_NOTE` "output it VERBATIM"; `'panel'` = the HOST renders the rowset, so NO `table` key at all + `PANEL_RENDER_NOTE` "the rows are already on the reader's screen — do not reproduce them"; the rowset half is byte-identical across modes, `table` stays RESERVED in both, an unknown value THROWS at definition) + `walk {cap, recording}` (cap default 500; over-cap ⇒ control-flow projection, declared · `recording: true` or `{label, maxBytes}`, default OFF — ALSO files the inner chart's own `{snapshot, events, structure}` under `recording/run` and puts its ref on the spine as `walk.recording_ref`, because the ROW projection cannot be drawn; snapshot read from the REDACTED mirror so one `redact` means the same for both; over `maxBytes` (`DEFAULT_RECORDING_MAX_BYTES` = 5,000,000) it is REFUSED not truncated; every absence — no store / over size / unserializable / store threw — is STATED in `walk.recording_note`, and the four `recording_*` fields are absent entirely when the dial is off) + `composedOf` (drift-checked at agent BUILD) + kept `recorders`/`keepRecord`/`keepRecordLimit`/`redact`; reserved state keys `verdicts`/`coverage`/`report` (the `report` bag lands BESIDE the spine, never over it — a report field spelling `af_coverage`/`af_provenance`/`rule_version`/`walk`/`report_note` or a live projection key is discarded and NAMED in `result.report_note`; precedence is explicit in `report.ts`, never spread order); inner `absent()` passes through VERBATIM unless the call said `allowAbsent`; walk kind `recording/chart-walk` + `walk_segment` discriminant | `src/core/runbook/` | 9.76.0, recording 9.79.0 |
|
|
40
|
-
| speaking MCP from a BROWSER — the SDK is browser-clean (its client + streamableHttp bundle at `platform:'browser'` with zero `node:` edges and never pull in `client/stdio.js`); the one barrier was that `lazyRequire` gets CALLED there, so the fix is to let the caller supply what the loader would have found | `mcpClient({ sdk })` (`McpSdk` = the two SDK modules you imported statically; the library STILL builds the transport, so headers/fetch/gateway vending/`retryOnThrottle`/`_meta` all keep working) · `mcpClient({ connection })` (`McpConnection` = listTools/callTool/close, deliberately NO `connect` — you already did; the only arm that reaches the SDK's `jsonSchemaValidator`, i.e. CSP) + `McpConnectionOptions`; `refuseConflictingOptions` REFUSES at construction every option a transport would have consumed, naming where it moved (a knob naming a behaviour that no longer happens is the defect class); `transportUrl` resolves a relative `url` against `globalThis.location.href` (absolute takes the identical branch, Node refuses by name); `sdkLoadFailure` classifies the seven load sites so a browser is never told to install a package it has (resolution failure ⇒
|
|
45
|
+
| speaking MCP from a BROWSER — the SDK is browser-clean (its client + streamableHttp bundle at `platform:'browser'` with zero `node:` edges and never pull in `client/stdio.js`); the one barrier was that `lazyRequire` gets CALLED there, so the fix is to let the caller supply what the loader would have found | `mcpClient({ sdk })` (`McpSdk` = the two SDK modules you imported statically; the library STILL builds the transport, so headers/fetch/gateway vending/`retryOnThrottle`/`_meta` all keep working) · `mcpClient({ connection })` (`McpConnection` = listTools/callTool/close, deliberately NO `connect` — you already did; the only arm that reaches the SDK's `jsonSchemaValidator`, i.e. CSP) + `McpConnectionOptions`; `refuseConflictingOptions` REFUSES at construction every option a transport would have consumed, naming where it moved (a knob naming a behaviour that no longer happens is the defect class); `transportUrl` resolves a relative `url` against `globalThis.location.href` (absolute takes the identical branch, Node refuses by name); `sdkLoadFailure` classifies the seven load sites so a browser is never told to install a package it has (resolution failure ⇒ the site's own absent-package message, which names the `sdk` hook); `retryingFetch` + `ThrottleFetch` promoted out of `@internal` so the connection arm keeps its 429 handling. stdio keeps `lazyRequire` FOREVER — it spawns a subprocess. ZERO packaging change: no subpath, no `browser` condition (TypeScript is blind to it), peer stays optional (no literal dynamic `import()`). Fenced by `test/mcp/browserGraph.test.ts` | `src/mcp/` | 9.81.0 |
|
|
41
46
|
| calling ANOTHER registered tool from inside a tool's `execute` — composition over the agent's own dispatch map instead of importing the module and building a second query stack | `agentToolDispatch` + `ctx.tools` (ToolDispatch has/call) — sees static and skill-carried tools, NEVER ToolProvider-delivered ones (no build-time list, the 9.72.0 caveat); inner calls get the outer facts with hasArtifacts false and a derived toolCallId, `needs` resolved fail-closed non-interactively, `checkIn` and `wants` tools refused by name, no nested dispatch; declare ingredients via `composedOf` (and `gates` for a pausing procedure) — both travel MCP `_meta` | `src/core/agent/toolDispatch.ts` | 9.76.0 |
|
|
42
47
|
| a tool returning numbers WITH the caveats that make them honest — interval/aggregation grain, is-it-a-counter, when the world was measured, which ground was NOT covered — as typed data the model reads compactly and the record keeps whole | `describedResult()` + `tools.semantics_declared` (model sees `semanticsForModel` projection; `coverage` field absorbed by the coverage()/absent() channel; the old `semantic()` declaration door was removed in 10.0.0) | `src/semantics/` | 9.53.0 |
|
|
43
48
|
| the same typed tool result declared in ONE spelling — camelCase `measuredAt`/`isCounter`/`filterNote`, respelled to the unchanged snake_case wire — with a missing source a COMPILE error; which result helper to return (rows → describedResult, a value with limits → coverage, nothing → absent); an EMPTY data list refused with the branch to write ("if nothing matched, return absent({ what, checked }) instead"), the declaration door and the gate | `describedResult()` + `DescribedResultDeclaration` (`provenance` required whenever `series`/`facts` is present; the snake_case spelling refused, naming the camelCase one) | `src/semantics/described.ts` | 9.119.0, empty-list refusal 9.125.0 |
|
|
@@ -8,18 +8,27 @@ Building Generative AI applications is mostly **context engineering** — decidi
|
|
|
8
8
|
import {
|
|
9
9
|
Agent, LLMCall, defineTool,
|
|
10
10
|
Sequence, Parallel, Conditional, Loop,
|
|
11
|
-
defineSkill, defineSteering, defineInstruction, defineFact,
|
|
12
|
-
defineMemory, MEMORY_TYPES, MEMORY_STRATEGIES, SNAPSHOT_PROJECTIONS,
|
|
13
|
-
InMemoryStore, mockEmbedder,
|
|
14
|
-
anthropic, openai, bedrock, ollama, mock,
|
|
15
11
|
askHuman, pauseHere, isPaused,
|
|
16
|
-
withRetry, withFallback, resilientProvider,
|
|
17
12
|
} from 'agentfootprint';
|
|
13
|
+
import { defineSkill, defineSteering, defineInstruction, defineFact } from 'agentfootprint/context';
|
|
14
|
+
import {
|
|
15
|
+
defineMemory, MEMORY_TYPES, MEMORY_STRATEGIES, SNAPSHOT_PROJECTIONS,
|
|
16
|
+
InMemoryStore, mockEmbedder,
|
|
17
|
+
} from 'agentfootprint/memory';
|
|
18
|
+
import { anthropic, openai, bedrock, ollama, mock, mcpClient } from 'agentfootprint/providers';
|
|
19
|
+
import { withRetry, withFallback, fallbackProvider } from 'agentfootprint/resilience';
|
|
18
20
|
```
|
|
19
21
|
|
|
20
|
-
**
|
|
21
|
-
|
|
22
|
-
`
|
|
22
|
+
**Import each name from the door that exports it.** `package.json` `exports` is
|
|
23
|
+
exhaustive: a path that is not a door does not resolve, and a name imported from
|
|
24
|
+
a door that does not export it fails to compile (and is `undefined` under
|
|
25
|
+
`require`). The core API is on `agentfootprint`. LLM providers, embedders,
|
|
26
|
+
`mcpClient` and MCP transports such as `agentCoreRuntimeMcpTransport` are on
|
|
27
|
+
`agentfootprint/providers`. Memory, its stores included, is on
|
|
28
|
+
`agentfootprint/memory`, context engineering on `agentfootprint/context`,
|
|
29
|
+
resilience on `agentfootprint/resilience`, and observability on
|
|
30
|
+
`agentfootprint/observe`. Paths such as `agentfootprint/instructions` and
|
|
31
|
+
`agentfootprint/explain` do not exist.
|
|
23
32
|
|
|
24
33
|
## The 6-layer mental model
|
|
25
34
|
|
|
@@ -57,7 +66,8 @@ Build with `mock()` provider + `InMemoryStore` + `mockEmbedder()` + inline tool
|
|
|
57
66
|
### Hello agent — mock-first
|
|
58
67
|
|
|
59
68
|
```typescript
|
|
60
|
-
import { Agent
|
|
69
|
+
import { Agent } from 'agentfootprint';
|
|
70
|
+
import { mock } from 'agentfootprint/providers';
|
|
61
71
|
|
|
62
72
|
const agent = Agent.create({ provider: mock({ reply: 'San Francisco: 72°F.' }), model: 'mock' })
|
|
63
73
|
.system('You are a helpful assistant.')
|
|
@@ -135,7 +145,8 @@ Strategies: `WINDOW` · `BUDGET` · `SUMMARIZE` · `TOP_K` · `EXTRACT` · `DECA
|
|
|
135
145
|
### MCP (Model Context Protocol — connect to external MCP servers)
|
|
136
146
|
|
|
137
147
|
```typescript
|
|
138
|
-
import { Agent
|
|
148
|
+
import { Agent } from 'agentfootprint';
|
|
149
|
+
import { mcpClient } from 'agentfootprint/providers';
|
|
139
150
|
|
|
140
151
|
const slack = await mcpClient({
|
|
141
152
|
name: 'slack',
|
|
@@ -189,7 +200,7 @@ const tot = Parallel.create()
|
|
|
189
200
|
## Anti-patterns — Don't
|
|
190
201
|
|
|
191
202
|
- ❌ `agent.run('string')` → use `agent.run({ message: '...', identity? })`
|
|
192
|
-
- ❌
|
|
203
|
+
- ❌ Paths that are not doors: `agentfootprint/instructions`, `agentfootprint/explain` (see `package.json` `exports`)
|
|
193
204
|
- ❌ `.memoryPipeline(pipeline)` (v1) → use `.memory(defineMemory({...}))`
|
|
194
205
|
- ❌ Shipping a `ReflexionAgent` class → compose `Sequence(Agent, critique-LLM, Agent)`
|
|
195
206
|
- ❌ Closures or class instances in scope (can't be cloned)
|
|
@@ -8,18 +8,27 @@ Building Generative AI applications is mostly **context engineering** — decidi
|
|
|
8
8
|
import {
|
|
9
9
|
Agent, LLMCall, defineTool,
|
|
10
10
|
Sequence, Parallel, Conditional, Loop,
|
|
11
|
-
defineSkill, defineSteering, defineInstruction, defineFact,
|
|
12
|
-
defineMemory, MEMORY_TYPES, MEMORY_STRATEGIES, SNAPSHOT_PROJECTIONS,
|
|
13
|
-
InMemoryStore, mockEmbedder,
|
|
14
|
-
anthropic, openai, bedrock, ollama, mock,
|
|
15
11
|
askHuman, pauseHere, isPaused,
|
|
16
|
-
withRetry, withFallback, resilientProvider,
|
|
17
12
|
} from 'agentfootprint';
|
|
13
|
+
import { defineSkill, defineSteering, defineInstruction, defineFact } from 'agentfootprint/context';
|
|
14
|
+
import {
|
|
15
|
+
defineMemory, MEMORY_TYPES, MEMORY_STRATEGIES, SNAPSHOT_PROJECTIONS,
|
|
16
|
+
InMemoryStore, mockEmbedder,
|
|
17
|
+
} from 'agentfootprint/memory';
|
|
18
|
+
import { anthropic, openai, bedrock, ollama, mock, mcpClient } from 'agentfootprint/providers';
|
|
19
|
+
import { withRetry, withFallback, fallbackProvider } from 'agentfootprint/resilience';
|
|
18
20
|
```
|
|
19
21
|
|
|
20
|
-
**
|
|
21
|
-
|
|
22
|
-
`
|
|
22
|
+
**Import each name from the door that exports it.** `package.json` `exports` is
|
|
23
|
+
exhaustive: a path that is not a door does not resolve, and a name imported from
|
|
24
|
+
a door that does not export it fails to compile (and is `undefined` under
|
|
25
|
+
`require`). The core API is on `agentfootprint`. LLM providers, embedders,
|
|
26
|
+
`mcpClient` and MCP transports such as `agentCoreRuntimeMcpTransport` are on
|
|
27
|
+
`agentfootprint/providers`. Memory, its stores included, is on
|
|
28
|
+
`agentfootprint/memory`, context engineering on `agentfootprint/context`,
|
|
29
|
+
resilience on `agentfootprint/resilience`, and observability on
|
|
30
|
+
`agentfootprint/observe`. Paths such as `agentfootprint/instructions` and
|
|
31
|
+
`agentfootprint/explain` do not exist.
|
|
23
32
|
|
|
24
33
|
## The 6-layer mental model
|
|
25
34
|
|
|
@@ -57,7 +66,8 @@ Build with `mock()` provider + `InMemoryStore` + `mockEmbedder()` + inline tool
|
|
|
57
66
|
### Hello agent — mock-first
|
|
58
67
|
|
|
59
68
|
```typescript
|
|
60
|
-
import { Agent
|
|
69
|
+
import { Agent } from 'agentfootprint';
|
|
70
|
+
import { mock } from 'agentfootprint/providers';
|
|
61
71
|
|
|
62
72
|
const agent = Agent.create({ provider: mock({ reply: 'San Francisco: 72°F.' }), model: 'mock' })
|
|
63
73
|
.system('You are a helpful assistant.')
|
|
@@ -135,7 +145,8 @@ Strategies: `WINDOW` · `BUDGET` · `SUMMARIZE` · `TOP_K` · `EXTRACT` · `DECA
|
|
|
135
145
|
### MCP (Model Context Protocol — connect to external MCP servers)
|
|
136
146
|
|
|
137
147
|
```typescript
|
|
138
|
-
import { Agent
|
|
148
|
+
import { Agent } from 'agentfootprint';
|
|
149
|
+
import { mcpClient } from 'agentfootprint/providers';
|
|
139
150
|
|
|
140
151
|
const slack = await mcpClient({
|
|
141
152
|
name: 'slack',
|
|
@@ -189,7 +200,7 @@ const tot = Parallel.create()
|
|
|
189
200
|
## Anti-patterns — Don't
|
|
190
201
|
|
|
191
202
|
- ❌ `agent.run('string')` → use `agent.run({ message: '...', identity? })`
|
|
192
|
-
- ❌
|
|
203
|
+
- ❌ Paths that are not doors: `agentfootprint/instructions`, `agentfootprint/explain` (see `package.json` `exports`)
|
|
193
204
|
- ❌ `.memoryPipeline(pipeline)` (v1) → use `.memory(defineMemory({...}))`
|
|
194
205
|
- ❌ Shipping a `ReflexionAgent` class → compose `Sequence(Agent, critique-LLM, Agent)`
|
|
195
206
|
- ❌ Closures or class instances in scope (can't be cloned)
|
|
@@ -8,18 +8,27 @@ Building Generative AI applications is mostly **context engineering** — decidi
|
|
|
8
8
|
import {
|
|
9
9
|
Agent, LLMCall, defineTool,
|
|
10
10
|
Sequence, Parallel, Conditional, Loop,
|
|
11
|
-
defineSkill, defineSteering, defineInstruction, defineFact,
|
|
12
|
-
defineMemory, MEMORY_TYPES, MEMORY_STRATEGIES, SNAPSHOT_PROJECTIONS,
|
|
13
|
-
InMemoryStore, mockEmbedder,
|
|
14
|
-
anthropic, openai, bedrock, ollama, mock,
|
|
15
11
|
askHuman, pauseHere, isPaused,
|
|
16
|
-
withRetry, withFallback, resilientProvider,
|
|
17
12
|
} from 'agentfootprint';
|
|
13
|
+
import { defineSkill, defineSteering, defineInstruction, defineFact } from 'agentfootprint/context';
|
|
14
|
+
import {
|
|
15
|
+
defineMemory, MEMORY_TYPES, MEMORY_STRATEGIES, SNAPSHOT_PROJECTIONS,
|
|
16
|
+
InMemoryStore, mockEmbedder,
|
|
17
|
+
} from 'agentfootprint/memory';
|
|
18
|
+
import { anthropic, openai, bedrock, ollama, mock, mcpClient } from 'agentfootprint/providers';
|
|
19
|
+
import { withRetry, withFallback, fallbackProvider } from 'agentfootprint/resilience';
|
|
18
20
|
```
|
|
19
21
|
|
|
20
|
-
**
|
|
21
|
-
|
|
22
|
-
`
|
|
22
|
+
**Import each name from the door that exports it.** `package.json` `exports` is
|
|
23
|
+
exhaustive: a path that is not a door does not resolve, and a name imported from
|
|
24
|
+
a door that does not export it fails to compile (and is `undefined` under
|
|
25
|
+
`require`). The core API is on `agentfootprint`. LLM providers, embedders,
|
|
26
|
+
`mcpClient` and MCP transports such as `agentCoreRuntimeMcpTransport` are on
|
|
27
|
+
`agentfootprint/providers`. Memory, its stores included, is on
|
|
28
|
+
`agentfootprint/memory`, context engineering on `agentfootprint/context`,
|
|
29
|
+
resilience on `agentfootprint/resilience`, and observability on
|
|
30
|
+
`agentfootprint/observe`. Paths such as `agentfootprint/instructions` and
|
|
31
|
+
`agentfootprint/explain` do not exist.
|
|
23
32
|
|
|
24
33
|
## The 6-layer mental model
|
|
25
34
|
|
|
@@ -57,7 +66,8 @@ Build with `mock()` provider + `InMemoryStore` + `mockEmbedder()` + inline tool
|
|
|
57
66
|
### Hello agent — mock-first
|
|
58
67
|
|
|
59
68
|
```typescript
|
|
60
|
-
import { Agent
|
|
69
|
+
import { Agent } from 'agentfootprint';
|
|
70
|
+
import { mock } from 'agentfootprint/providers';
|
|
61
71
|
|
|
62
72
|
const agent = Agent.create({ provider: mock({ reply: 'San Francisco: 72°F.' }), model: 'mock' })
|
|
63
73
|
.system('You are a helpful assistant.')
|
|
@@ -135,7 +145,8 @@ Strategies: `WINDOW` · `BUDGET` · `SUMMARIZE` · `TOP_K` · `EXTRACT` · `DECA
|
|
|
135
145
|
### MCP (Model Context Protocol — connect to external MCP servers)
|
|
136
146
|
|
|
137
147
|
```typescript
|
|
138
|
-
import { Agent
|
|
148
|
+
import { Agent } from 'agentfootprint';
|
|
149
|
+
import { mcpClient } from 'agentfootprint/providers';
|
|
139
150
|
|
|
140
151
|
const slack = await mcpClient({
|
|
141
152
|
name: 'slack',
|
|
@@ -189,7 +200,7 @@ const tot = Parallel.create()
|
|
|
189
200
|
## Anti-patterns — Don't
|
|
190
201
|
|
|
191
202
|
- ❌ `agent.run('string')` → use `agent.run({ message: '...', identity? })`
|
|
192
|
-
- ❌
|
|
203
|
+
- ❌ Paths that are not doors: `agentfootprint/instructions`, `agentfootprint/explain` (see `package.json` `exports`)
|
|
193
204
|
- ❌ `.memoryPipeline(pipeline)` (v1) → use `.memory(defineMemory({...}))`
|
|
194
205
|
- ❌ Shipping a `ReflexionAgent` class → compose `Sequence(Agent, critique-LLM, Agent)`
|
|
195
206
|
- ❌ Closures or class instances in scope (can't be cloned)
|
|
@@ -8,18 +8,27 @@ Building Generative AI applications is mostly **context engineering** — decidi
|
|
|
8
8
|
import {
|
|
9
9
|
Agent, LLMCall, defineTool,
|
|
10
10
|
Sequence, Parallel, Conditional, Loop,
|
|
11
|
-
defineSkill, defineSteering, defineInstruction, defineFact,
|
|
12
|
-
defineMemory, MEMORY_TYPES, MEMORY_STRATEGIES, SNAPSHOT_PROJECTIONS,
|
|
13
|
-
InMemoryStore, mockEmbedder,
|
|
14
|
-
anthropic, openai, bedrock, ollama, mock,
|
|
15
11
|
askHuman, pauseHere, isPaused,
|
|
16
|
-
withRetry, withFallback, resilientProvider,
|
|
17
12
|
} from 'agentfootprint';
|
|
13
|
+
import { defineSkill, defineSteering, defineInstruction, defineFact } from 'agentfootprint/context';
|
|
14
|
+
import {
|
|
15
|
+
defineMemory, MEMORY_TYPES, MEMORY_STRATEGIES, SNAPSHOT_PROJECTIONS,
|
|
16
|
+
InMemoryStore, mockEmbedder,
|
|
17
|
+
} from 'agentfootprint/memory';
|
|
18
|
+
import { anthropic, openai, bedrock, ollama, mock, mcpClient } from 'agentfootprint/providers';
|
|
19
|
+
import { withRetry, withFallback, fallbackProvider } from 'agentfootprint/resilience';
|
|
18
20
|
```
|
|
19
21
|
|
|
20
|
-
**
|
|
21
|
-
|
|
22
|
-
`
|
|
22
|
+
**Import each name from the door that exports it.** `package.json` `exports` is
|
|
23
|
+
exhaustive: a path that is not a door does not resolve, and a name imported from
|
|
24
|
+
a door that does not export it fails to compile (and is `undefined` under
|
|
25
|
+
`require`). The core API is on `agentfootprint`. LLM providers, embedders,
|
|
26
|
+
`mcpClient` and MCP transports such as `agentCoreRuntimeMcpTransport` are on
|
|
27
|
+
`agentfootprint/providers`. Memory, its stores included, is on
|
|
28
|
+
`agentfootprint/memory`, context engineering on `agentfootprint/context`,
|
|
29
|
+
resilience on `agentfootprint/resilience`, and observability on
|
|
30
|
+
`agentfootprint/observe`. Paths such as `agentfootprint/instructions` and
|
|
31
|
+
`agentfootprint/explain` do not exist.
|
|
23
32
|
|
|
24
33
|
## The 6-layer mental model
|
|
25
34
|
|
|
@@ -57,7 +66,8 @@ Build with `mock()` provider + `InMemoryStore` + `mockEmbedder()` + inline tool
|
|
|
57
66
|
### Hello agent — mock-first
|
|
58
67
|
|
|
59
68
|
```typescript
|
|
60
|
-
import { Agent
|
|
69
|
+
import { Agent } from 'agentfootprint';
|
|
70
|
+
import { mock } from 'agentfootprint/providers';
|
|
61
71
|
|
|
62
72
|
const agent = Agent.create({ provider: mock({ reply: 'San Francisco: 72°F.' }), model: 'mock' })
|
|
63
73
|
.system('You are a helpful assistant.')
|
|
@@ -135,7 +145,8 @@ Strategies: `WINDOW` · `BUDGET` · `SUMMARIZE` · `TOP_K` · `EXTRACT` · `DECA
|
|
|
135
145
|
### MCP (Model Context Protocol — connect to external MCP servers)
|
|
136
146
|
|
|
137
147
|
```typescript
|
|
138
|
-
import { Agent
|
|
148
|
+
import { Agent } from 'agentfootprint';
|
|
149
|
+
import { mcpClient } from 'agentfootprint/providers';
|
|
139
150
|
|
|
140
151
|
const slack = await mcpClient({
|
|
141
152
|
name: 'slack',
|
|
@@ -189,7 +200,7 @@ const tot = Parallel.create()
|
|
|
189
200
|
## Anti-patterns — Don't
|
|
190
201
|
|
|
191
202
|
- ❌ `agent.run('string')` → use `agent.run({ message: '...', identity? })`
|
|
192
|
-
- ❌
|
|
203
|
+
- ❌ Paths that are not doors: `agentfootprint/instructions`, `agentfootprint/explain` (see `package.json` `exports`)
|
|
193
204
|
- ❌ `.memoryPipeline(pipeline)` (v1) → use `.memory(defineMemory({...}))`
|
|
194
205
|
- ❌ Shipping a `ReflexionAgent` class → compose `Sequence(Agent, critique-LLM, Agent)`
|
|
195
206
|
- ❌ Closures or class instances in scope (can't be cloned)
|
|
@@ -8,18 +8,27 @@ Building Generative AI applications is mostly **context engineering** — decidi
|
|
|
8
8
|
import {
|
|
9
9
|
Agent, LLMCall, defineTool,
|
|
10
10
|
Sequence, Parallel, Conditional, Loop,
|
|
11
|
-
defineSkill, defineSteering, defineInstruction, defineFact,
|
|
12
|
-
defineMemory, MEMORY_TYPES, MEMORY_STRATEGIES, SNAPSHOT_PROJECTIONS,
|
|
13
|
-
InMemoryStore, mockEmbedder,
|
|
14
|
-
anthropic, openai, bedrock, ollama, mock,
|
|
15
11
|
askHuman, pauseHere, isPaused,
|
|
16
|
-
withRetry, withFallback, resilientProvider,
|
|
17
12
|
} from 'agentfootprint';
|
|
13
|
+
import { defineSkill, defineSteering, defineInstruction, defineFact } from 'agentfootprint/context';
|
|
14
|
+
import {
|
|
15
|
+
defineMemory, MEMORY_TYPES, MEMORY_STRATEGIES, SNAPSHOT_PROJECTIONS,
|
|
16
|
+
InMemoryStore, mockEmbedder,
|
|
17
|
+
} from 'agentfootprint/memory';
|
|
18
|
+
import { anthropic, openai, bedrock, ollama, mock, mcpClient } from 'agentfootprint/providers';
|
|
19
|
+
import { withRetry, withFallback, fallbackProvider } from 'agentfootprint/resilience';
|
|
18
20
|
```
|
|
19
21
|
|
|
20
|
-
**
|
|
21
|
-
|
|
22
|
-
`
|
|
22
|
+
**Import each name from the door that exports it.** `package.json` `exports` is
|
|
23
|
+
exhaustive: a path that is not a door does not resolve, and a name imported from
|
|
24
|
+
a door that does not export it fails to compile (and is `undefined` under
|
|
25
|
+
`require`). The core API is on `agentfootprint`. LLM providers, embedders,
|
|
26
|
+
`mcpClient` and MCP transports such as `agentCoreRuntimeMcpTransport` are on
|
|
27
|
+
`agentfootprint/providers`. Memory, its stores included, is on
|
|
28
|
+
`agentfootprint/memory`, context engineering on `agentfootprint/context`,
|
|
29
|
+
resilience on `agentfootprint/resilience`, and observability on
|
|
30
|
+
`agentfootprint/observe`. Paths such as `agentfootprint/instructions` and
|
|
31
|
+
`agentfootprint/explain` do not exist.
|
|
23
32
|
|
|
24
33
|
## The 6-layer mental model
|
|
25
34
|
|
|
@@ -57,7 +66,8 @@ Build with `mock()` provider + `InMemoryStore` + `mockEmbedder()` + inline tool
|
|
|
57
66
|
### Hello agent — mock-first
|
|
58
67
|
|
|
59
68
|
```typescript
|
|
60
|
-
import { Agent
|
|
69
|
+
import { Agent } from 'agentfootprint';
|
|
70
|
+
import { mock } from 'agentfootprint/providers';
|
|
61
71
|
|
|
62
72
|
const agent = Agent.create({ provider: mock({ reply: 'San Francisco: 72°F.' }), model: 'mock' })
|
|
63
73
|
.system('You are a helpful assistant.')
|
|
@@ -135,7 +145,8 @@ Strategies: `WINDOW` · `BUDGET` · `SUMMARIZE` · `TOP_K` · `EXTRACT` · `DECA
|
|
|
135
145
|
### MCP (Model Context Protocol — connect to external MCP servers)
|
|
136
146
|
|
|
137
147
|
```typescript
|
|
138
|
-
import { Agent
|
|
148
|
+
import { Agent } from 'agentfootprint';
|
|
149
|
+
import { mcpClient } from 'agentfootprint/providers';
|
|
139
150
|
|
|
140
151
|
const slack = await mcpClient({
|
|
141
152
|
name: 'slack',
|
|
@@ -189,7 +200,7 @@ const tot = Parallel.create()
|
|
|
189
200
|
## Anti-patterns — Don't
|
|
190
201
|
|
|
191
202
|
- ❌ `agent.run('string')` → use `agent.run({ message: '...', identity? })`
|
|
192
|
-
- ❌
|
|
203
|
+
- ❌ Paths that are not doors: `agentfootprint/instructions`, `agentfootprint/explain` (see `package.json` `exports`)
|
|
193
204
|
- ❌ `.memoryPipeline(pipeline)` (v1) → use `.memory(defineMemory({...}))`
|
|
194
205
|
- ❌ Shipping a `ReflexionAgent` class → compose `Sequence(Agent, critique-LLM, Agent)`
|
|
195
206
|
- ❌ Closures or class instances in scope (can't be cloned)
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
exports.AnthropicProvider = exports.anthropic = void 0;
|
|
22
22
|
const lazyRequire_js_1 = require("../../lib/lazyRequire.js");
|
|
23
|
+
const abort_js_1 = require("../../lib/abort.js");
|
|
23
24
|
const contextWindow_js_1 = require("../../provider-contract/contextWindow.js");
|
|
24
25
|
const retryAfter_js_1 = require("./retryAfter.js");
|
|
25
26
|
const anthropicCacheWire_js_1 = require("./anthropicCacheWire.js");
|
|
@@ -99,13 +100,19 @@ function anthropic(options = {}) {
|
|
|
99
100
|
// the same function.
|
|
100
101
|
thinkingMode: (model) => modeOf(modelOf(model)),
|
|
101
102
|
async complete(req, hooks) {
|
|
103
|
+
// A cancelled call sends nothing (lib/abort.ts, law 1).
|
|
104
|
+
(0, abort_js_1.throwIfAborted)(req.signal);
|
|
102
105
|
const preparation = (0, anthropicThinkingReplay_js_1.prepareAnthropicReplay)(req, modelOf(req.model), 'anthropic');
|
|
103
106
|
const params = buildParams(preparation.request);
|
|
104
107
|
const bindingFactory = (0, anthropicThinkingReplay_js_1.thinkingReplayBinding)(params, params.model);
|
|
105
108
|
if (preparation.omissions.length > 0)
|
|
106
109
|
hooks?.onReplayPrepared?.(preparation);
|
|
107
110
|
try {
|
|
108
|
-
|
|
111
|
+
// The signal rides the SDK's request options, so an abort cancels the
|
|
112
|
+
// HTTP request itself; the race refuses an answer that lands after it.
|
|
113
|
+
const message = await (0, abort_js_1.untilAborted)(req.signal
|
|
114
|
+
? client.messages.create(params, { signal: req.signal })
|
|
115
|
+
: client.messages.create(params), req.signal);
|
|
109
116
|
// Manifest read from the FINAL params — after tool mapping and cache
|
|
110
117
|
// markers — because the whole point is catching what the body says,
|
|
111
118
|
// not what the request intended (wireManifest.ts).
|
|
@@ -116,10 +123,11 @@ function anthropic(options = {}) {
|
|
|
116
123
|
};
|
|
117
124
|
}
|
|
118
125
|
catch (err) {
|
|
119
|
-
throw wrapError(err);
|
|
126
|
+
throw wrapError(err, req.signal);
|
|
120
127
|
}
|
|
121
128
|
},
|
|
122
129
|
async *stream(req, hooks) {
|
|
130
|
+
(0, abort_js_1.throwIfAborted)(req.signal);
|
|
123
131
|
const preparation = (0, anthropicThinkingReplay_js_1.prepareAnthropicReplay)(req, modelOf(req.model), 'anthropic');
|
|
124
132
|
const params = buildParams(preparation.request);
|
|
125
133
|
const bindingFactory = (0, anthropicThinkingReplay_js_1.thinkingReplayBinding)(params, params.model);
|
|
@@ -127,15 +135,20 @@ function anthropic(options = {}) {
|
|
|
127
135
|
hooks?.onReplayPrepared?.(preparation);
|
|
128
136
|
let stream;
|
|
129
137
|
try {
|
|
130
|
-
stream =
|
|
138
|
+
stream = req.signal
|
|
139
|
+
? client.messages.stream(params, { signal: req.signal })
|
|
140
|
+
: client.messages.stream(params);
|
|
131
141
|
}
|
|
132
142
|
catch (err) {
|
|
133
|
-
throw wrapError(err);
|
|
143
|
+
throw wrapError(err, req.signal);
|
|
134
144
|
}
|
|
145
|
+
const opened = stream;
|
|
135
146
|
let tokenIndex = 0;
|
|
136
147
|
const toolArguments = new anthropicToolArguments_js_1.AnthropicToolArguments();
|
|
137
148
|
try {
|
|
138
|
-
|
|
149
|
+
// An abort closes the SDK stream and ends this loop at once, even
|
|
150
|
+
// when a read is still pending (lib/abort.ts, laws 2–3).
|
|
151
|
+
for await (const event of (0, abort_js_1.abortableIterable)(opened, req.signal, () => opened.abort?.())) {
|
|
139
152
|
toolArguments.observe(event);
|
|
140
153
|
if (event.type === 'content_block_delta' &&
|
|
141
154
|
event.delta?.type === 'text_delta' &&
|
|
@@ -144,7 +157,7 @@ function anthropic(options = {}) {
|
|
|
144
157
|
tokenIndex++;
|
|
145
158
|
}
|
|
146
159
|
}
|
|
147
|
-
const final = await
|
|
160
|
+
const final = await (0, abort_js_1.untilAborted)(opened.finalMessage(), req.signal);
|
|
148
161
|
toolArguments.assertTerminal(final.content.some((block) => block.type === 'tool_use'));
|
|
149
162
|
const argumentFailures = new Map();
|
|
150
163
|
const checkedMessage = {
|
|
@@ -166,7 +179,7 @@ function anthropic(options = {}) {
|
|
|
166
179
|
yield { tokenIndex, content: '', done: true, response };
|
|
167
180
|
}
|
|
168
181
|
catch (err) {
|
|
169
|
-
throw wrapError(err);
|
|
182
|
+
throw wrapError(err, req.signal);
|
|
170
183
|
}
|
|
171
184
|
},
|
|
172
185
|
};
|
|
@@ -230,7 +243,12 @@ function resolveClient(options) {
|
|
|
230
243
|
...(options.maxRetries !== undefined ? { maxRetries: options.maxRetries } : {}),
|
|
231
244
|
});
|
|
232
245
|
}
|
|
233
|
-
function wrapError(err) {
|
|
246
|
+
function wrapError(err, signal) {
|
|
247
|
+
// A cancelled call fails AS the cancellation, whatever the SDK threw for it
|
|
248
|
+
// (its own `APIUserAbortError` included) — never as a provider error that a
|
|
249
|
+
// retry would re-send (lib/abort.ts).
|
|
250
|
+
if (signal?.aborted)
|
|
251
|
+
return (0, abort_js_1.abortErrorOf)(signal);
|
|
234
252
|
// See OpenAIProvider.wrapError — one shared detector, one typed error, so
|
|
235
253
|
// "prompt is too long" reads the same whichever vendor said it.
|
|
236
254
|
const tooBig = (0, contextWindow_js_1.asContextWindowExceeded)(err, { provider: 'anthropic' });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnthropicProvider.js","sourceRoot":"","sources":["../../../src/adapters/llm/AnthropicProvider.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;AAUH,6DAAuD;AACvD,+EAAmF;AACnF,mDAAwD;AACxD,mEAAmE;AACnE,yEAA8D;AAC9D,6DAG8B;AAC9B,6EAA6F;AAC7F,uDAAmD;AACnD,2EAAqE;AACrE,4FAAsF;AAEtF,qEAAqE;AACrE,yEAAyE;AACzE,6DAA6D;AAC7D,yEAKoC;
|
|
1
|
+
{"version":3,"file":"AnthropicProvider.js","sourceRoot":"","sources":["../../../src/adapters/llm/AnthropicProvider.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;AAUH,6DAAuD;AACvD,iDAAmG;AACnG,+EAAmF;AACnF,mDAAwD;AACxD,mEAAmE;AACnE,yEAA8D;AAC9D,6DAG8B;AAC9B,6EAA6F;AAC7F,uDAAmD;AACnD,2EAAqE;AACrE,4FAAsF;AAEtF,qEAAqE;AACrE,yEAAyE;AACzE,6DAA6D;AAC7D,yEAKoC;AA8GpC;;;;;;;;GAQG;AACH,MAAM,mBAAmB,GAAwB,M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B;YAC9B,KAAK,EAAE,GAAG;YACV,iEAAiE;YACjE,MAAM,EAAG,GAA2B,CAAC,MAAM;YAC3C,GAAG,CAAC,YAAY,KAAK,SAAS,IAAI,EAAE,YAAY,EAAE,CAAC;SACpD,CAAC,CAAC;IACL,CAAC;IACD,OAAO,IAAI,KAAK,CAAC,eAAe,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AACjD,CAAC"}
|
|
@@ -33,11 +33,16 @@
|
|
|
33
33
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
34
|
exports.BedrockProvider = exports.bedrock = void 0;
|
|
35
35
|
const lazyRequire_js_1 = require("../../lib/lazyRequire.js");
|
|
36
|
+
const abort_js_1 = require("../../lib/abort.js");
|
|
36
37
|
const contextWindow_js_1 = require("../../provider-contract/contextWindow.js");
|
|
37
38
|
const retryAfter_js_1 = require("./retryAfter.js");
|
|
38
39
|
const anthropicModels_js_1 = require("./anthropicModels.js");
|
|
39
40
|
const forcedToolChoice_js_1 = require("../../provider-contract/forcedToolChoice.js");
|
|
40
41
|
const errors_js_1 = require("../../thinking/errors.js");
|
|
42
|
+
/** `client.send(cmd)`, with the request's signal when it has one. */
|
|
43
|
+
function sendUnder(client, cmd, signal) {
|
|
44
|
+
return signal ? client.send(cmd, { abortSignal: signal }) : client.send(cmd);
|
|
45
|
+
}
|
|
41
46
|
/**
|
|
42
47
|
* Which roles this wire carries inside `messages`.
|
|
43
48
|
*
|
|
@@ -62,25 +67,30 @@ function bedrock(options = {}) {
|
|
|
62
67
|
supportsForcedToolChoice: (model) => (0, anthropicModels_js_1.anthropicTakesForcedToolChoice)(modelOf(model)),
|
|
63
68
|
thinkingMode: () => 'none',
|
|
64
69
|
async complete(req) {
|
|
70
|
+
// A cancelled call sends nothing (lib/abort.ts, law 1).
|
|
71
|
+
(0, abort_js_1.throwIfAborted)(req.signal);
|
|
65
72
|
const input = buildInput(req, modelOf(req.model), defaultMaxTokens);
|
|
66
73
|
try {
|
|
67
74
|
const cmd = new Commands.Converse(input);
|
|
68
|
-
|
|
75
|
+
// The signal rides the SDK's HTTP options, so an abort cancels the
|
|
76
|
+
// request itself; the race refuses an answer that lands after it.
|
|
77
|
+
const response = (await (0, abort_js_1.untilAborted)(sendUnder(client, cmd, req.signal), req.signal));
|
|
69
78
|
return fromBedrockResponse(response);
|
|
70
79
|
}
|
|
71
80
|
catch (err) {
|
|
72
|
-
throw wrapError(err);
|
|
81
|
+
throw wrapError(err, req.signal);
|
|
73
82
|
}
|
|
74
83
|
},
|
|
75
84
|
async *stream(req) {
|
|
85
|
+
(0, abort_js_1.throwIfAborted)(req.signal);
|
|
76
86
|
const input = buildInput(req, modelOf(req.model), defaultMaxTokens);
|
|
77
87
|
let response;
|
|
78
88
|
try {
|
|
79
89
|
const cmd = new Commands.ConverseStream(input);
|
|
80
|
-
response = (await
|
|
90
|
+
response = (await (0, abort_js_1.untilAborted)(sendUnder(client, cmd, req.signal), req.signal));
|
|
81
91
|
}
|
|
82
92
|
catch (err) {
|
|
83
|
-
throw wrapError(err);
|
|
93
|
+
throw wrapError(err, req.signal);
|
|
84
94
|
}
|
|
85
95
|
const stream = response.stream;
|
|
86
96
|
if (!stream) {
|
|
@@ -100,7 +110,9 @@ function bedrock(options = {}) {
|
|
|
100
110
|
const toolUseByIndex = new Map();
|
|
101
111
|
const completedToolCalls = [];
|
|
102
112
|
try {
|
|
103
|
-
|
|
113
|
+
// An abort ends this loop at once, even when a read is still pending,
|
|
114
|
+
// and closes the event stream (lib/abort.ts, laws 2–3).
|
|
115
|
+
for await (const event of (0, abort_js_1.abortableIterable)(stream, req.signal)) {
|
|
104
116
|
// ── Block start: id + name arrive here; arguments follow as
|
|
105
117
|
// JSON string fragments on deltas at the same index. ──
|
|
106
118
|
const startIndex = event.contentBlockStart?.contentBlockIndex;
|
|
@@ -166,7 +178,7 @@ function bedrock(options = {}) {
|
|
|
166
178
|
yield { tokenIndex, content: '', done: true, response: finalResponse };
|
|
167
179
|
}
|
|
168
180
|
catch (err) {
|
|
169
|
-
throw wrapError(err);
|
|
181
|
+
throw wrapError(err, req.signal);
|
|
170
182
|
}
|
|
171
183
|
},
|
|
172
184
|
};
|
|
@@ -437,7 +449,11 @@ function normalizeStopReason(raw) {
|
|
|
437
449
|
return raw;
|
|
438
450
|
}
|
|
439
451
|
}
|
|
440
|
-
function wrapError(err) {
|
|
452
|
+
function wrapError(err, signal) {
|
|
453
|
+
// A cancelled call fails AS the cancellation, whatever the SDK threw for it
|
|
454
|
+
// — never as a provider error that a retry would re-send (lib/abort.ts).
|
|
455
|
+
if (signal?.aborted)
|
|
456
|
+
return (0, abort_js_1.abortErrorOf)(signal);
|
|
441
457
|
// Already ours (the typed tool-use conditions above) — re-wrapping would
|
|
442
458
|
// drop `code` / `toolName` / `toolUseId` and double-prefix the message.
|
|
443
459
|
if (err instanceof Error && err.name === 'BedrockProviderError')
|