agentfootprint 10.3.1 → 10.4.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/AGENTS.md +2 -2
- package/CAPABILITIES.md +6 -0
- package/README.md +44 -0
- package/ai-instructions/claude-code/SKILL.md +2 -2
- package/dist/adapters/mcp/agentcoreRuntime/errorType.js +24 -0
- package/dist/adapters/mcp/agentcoreRuntime/errorType.js.map +1 -0
- package/dist/adapters/mcp/agentcoreRuntime/invoke.js +265 -0
- package/dist/adapters/mcp/agentcoreRuntime/invoke.js.map +1 -0
- package/dist/adapters/mcp/agentcoreRuntime/safeAnswer.js +415 -0
- package/dist/adapters/mcp/agentcoreRuntime/safeAnswer.js.map +1 -0
- package/dist/adapters/mcp/agentcoreRuntime/session.js +179 -0
- package/dist/adapters/mcp/agentcoreRuntime/session.js.map +1 -0
- package/dist/adapters/mcp/agentcoreRuntime/sessionBusy.js +117 -0
- package/dist/adapters/mcp/agentcoreRuntime/sessionBusy.js.map +1 -0
- package/dist/adapters/mcp/agentcoreRuntime/strictJson.js +220 -0
- package/dist/adapters/mcp/agentcoreRuntime/strictJson.js.map +1 -0
- package/dist/adapters/mcp/agentcoreRuntime/transport.js +204 -0
- package/dist/adapters/mcp/agentcoreRuntime/transport.js.map +1 -0
- package/dist/adapters/memory/agentcore.js +435 -20
- package/dist/adapters/memory/agentcore.js.map +1 -1
- package/dist/adapters/memory/memoryBank.js +16 -3
- package/dist/adapters/memory/memoryBank.js.map +1 -1
- package/dist/adapters/memory/pgVector.js +10 -4
- package/dist/adapters/memory/pgVector.js.map +1 -1
- package/dist/adapters/memory/redis.js +11 -3
- package/dist/adapters/memory/redis.js.map +1 -1
- package/dist/adapters/memory/s3Vectors.js +8 -3
- package/dist/adapters/memory/s3Vectors.js.map +1 -1
- package/dist/adapters/memory/sqliteVector.js +10 -4
- package/dist/adapters/memory/sqliteVector.js.map +1 -1
- package/dist/ag-ui/adapter.js +71 -0
- package/dist/ag-ui/adapter.js.map +1 -0
- package/dist/ag-ui/framing.js +66 -0
- package/dist/ag-ui/framing.js.map +1 -0
- package/dist/ag-ui/frontendTools.js +69 -0
- package/dist/ag-ui/frontendTools.js.map +1 -0
- package/dist/ag-ui/ids.js +54 -0
- package/dist/ag-ui/ids.js.map +1 -0
- package/dist/ag-ui/index.js +27 -0
- package/dist/ag-ui/index.js.map +1 -0
- package/dist/ag-ui/request.js +356 -0
- package/dist/ag-ui/request.js.map +1 -0
- package/dist/ag-ui/serializer.js +899 -0
- package/dist/ag-ui/serializer.js.map +1 -0
- package/dist/ag-ui/types.js +22 -0
- package/dist/ag-ui/types.js.map +1 -0
- package/dist/core/Agent.js +38 -5
- package/dist/core/Agent.js.map +1 -1
- package/dist/core/RunnerBase.js +16 -2
- package/dist/core/RunnerBase.js.map +1 -1
- package/dist/core/agent/buildAgentChart.js +4 -0
- package/dist/core/agent/buildAgentChart.js.map +1 -1
- package/dist/core/agent/buildDynamicAgentChart.js +4 -0
- package/dist/core/agent/buildDynamicAgentChart.js.map +1 -1
- package/dist/core/agent/callerIdentity.js +2 -1
- package/dist/core/agent/callerIdentity.js.map +1 -1
- package/dist/core/agent/stages/routeTurn.js +3 -3
- package/dist/core/agent/stages/routeTurn.js.map +1 -1
- package/dist/core/agent/stages/seed.js +49 -8
- package/dist/core/agent/stages/seed.js.map +1 -1
- package/dist/core/agent/stages/timeLayer.js +2 -2
- package/dist/core/agent/stages/timeLayer.js.map +1 -1
- package/dist/core/agent/stages/toolCalls.js +26 -5
- package/dist/core/agent/stages/toolCalls.js.map +1 -1
- package/dist/core/memberRun.js +244 -0
- package/dist/core/memberRun.js.map +1 -0
- package/dist/core/slots/buildToolsSlot.js +1 -1
- package/dist/core/slots/buildToolsSlot.js.map +1 -1
- package/dist/core-flow/Conditional.js +29 -8
- package/dist/core-flow/Conditional.js.map +1 -1
- package/dist/core-flow/Graph.js +38 -13
- package/dist/core-flow/Graph.js.map +1 -1
- package/dist/core-flow/Loop.js +29 -9
- package/dist/core-flow/Loop.js.map +1 -1
- package/dist/core-flow/Parallel.js +35 -14
- package/dist/core-flow/Parallel.js.map +1 -1
- package/dist/core-flow/Sequence.js +29 -8
- package/dist/core-flow/Sequence.js.map +1 -1
- package/dist/core-flow/Workflow.js +34 -10
- package/dist/core-flow/Workflow.js.map +1 -1
- package/dist/doors/ag-ui.js +36 -0
- package/dist/doors/ag-ui.js.map +1 -0
- package/dist/esm/adapters/mcp/agentcoreRuntime/errorType.d.ts +12 -0
- package/dist/esm/adapters/mcp/agentcoreRuntime/errorType.js +20 -0
- package/dist/esm/adapters/mcp/agentcoreRuntime/errorType.js.map +1 -0
- package/dist/esm/adapters/mcp/agentcoreRuntime/invoke.d.ts +116 -0
- package/dist/esm/adapters/mcp/agentcoreRuntime/invoke.js +260 -0
- package/dist/esm/adapters/mcp/agentcoreRuntime/invoke.js.map +1 -0
- package/dist/esm/adapters/mcp/agentcoreRuntime/safeAnswer.d.ts +49 -0
- package/dist/esm/adapters/mcp/agentcoreRuntime/safeAnswer.js +409 -0
- package/dist/esm/adapters/mcp/agentcoreRuntime/safeAnswer.js.map +1 -0
- package/dist/esm/adapters/mcp/agentcoreRuntime/session.d.ts +80 -0
- package/dist/esm/adapters/mcp/agentcoreRuntime/session.js +175 -0
- package/dist/esm/adapters/mcp/agentcoreRuntime/session.js.map +1 -0
- package/dist/esm/adapters/mcp/agentcoreRuntime/sessionBusy.d.ts +61 -0
- package/dist/esm/adapters/mcp/agentcoreRuntime/sessionBusy.js +112 -0
- package/dist/esm/adapters/mcp/agentcoreRuntime/sessionBusy.js.map +1 -0
- package/dist/esm/adapters/mcp/agentcoreRuntime/strictJson.d.ts +37 -0
- package/dist/esm/adapters/mcp/agentcoreRuntime/strictJson.js +215 -0
- package/dist/esm/adapters/mcp/agentcoreRuntime/strictJson.js.map +1 -0
- package/dist/esm/adapters/mcp/agentcoreRuntime/transport.d.ts +176 -0
- package/dist/esm/adapters/mcp/agentcoreRuntime/transport.js +199 -0
- package/dist/esm/adapters/mcp/agentcoreRuntime/transport.js.map +1 -0
- package/dist/esm/adapters/memory/agentcore.d.ts +152 -7
- package/dist/esm/adapters/memory/agentcore.js +433 -19
- package/dist/esm/adapters/memory/agentcore.js.map +1 -1
- package/dist/esm/adapters/memory/memoryBank.d.ts +3 -2
- package/dist/esm/adapters/memory/memoryBank.js +16 -3
- package/dist/esm/adapters/memory/memoryBank.js.map +1 -1
- package/dist/esm/adapters/memory/pgVector.js +10 -4
- package/dist/esm/adapters/memory/pgVector.js.map +1 -1
- package/dist/esm/adapters/memory/redis.d.ts +8 -3
- package/dist/esm/adapters/memory/redis.js +11 -3
- package/dist/esm/adapters/memory/redis.js.map +1 -1
- package/dist/esm/adapters/memory/s3Vectors.js +8 -3
- package/dist/esm/adapters/memory/s3Vectors.js.map +1 -1
- package/dist/esm/adapters/memory/sqliteVector.js +10 -4
- package/dist/esm/adapters/memory/sqliteVector.js.map +1 -1
- package/dist/esm/ag-ui/adapter.d.ts +68 -0
- package/dist/esm/ag-ui/adapter.js +67 -0
- package/dist/esm/ag-ui/adapter.js.map +1 -0
- package/dist/esm/ag-ui/framing.d.ts +51 -0
- package/dist/esm/ag-ui/framing.js +62 -0
- package/dist/esm/ag-ui/framing.js.map +1 -0
- package/dist/esm/ag-ui/frontendTools.d.ts +37 -0
- package/dist/esm/ag-ui/frontendTools.js +64 -0
- package/dist/esm/ag-ui/frontendTools.js.map +1 -0
- package/dist/esm/ag-ui/ids.d.ts +43 -0
- package/dist/esm/ag-ui/ids.js +49 -0
- package/dist/esm/ag-ui/ids.js.map +1 -0
- package/dist/esm/ag-ui/index.d.ts +17 -0
- package/dist/esm/ag-ui/index.js +17 -0
- package/dist/esm/ag-ui/index.js.map +1 -0
- package/dist/esm/ag-ui/request.d.ts +72 -0
- package/dist/esm/ag-ui/request.js +350 -0
- package/dist/esm/ag-ui/request.js.map +1 -0
- package/dist/esm/ag-ui/serializer.d.ts +173 -0
- package/dist/esm/ag-ui/serializer.js +895 -0
- package/dist/esm/ag-ui/serializer.js.map +1 -0
- package/dist/esm/ag-ui/types.d.ts +305 -0
- package/dist/esm/ag-ui/types.js +19 -0
- package/dist/esm/ag-ui/types.js.map +1 -0
- package/dist/esm/core/Agent.d.ts +2 -0
- package/dist/esm/core/Agent.js +38 -5
- package/dist/esm/core/Agent.js.map +1 -1
- package/dist/esm/core/RunnerBase.js +17 -3
- package/dist/esm/core/RunnerBase.js.map +1 -1
- package/dist/esm/core/agent/buildAgentChart.js +4 -0
- package/dist/esm/core/agent/buildAgentChart.js.map +1 -1
- package/dist/esm/core/agent/buildDynamicAgentChart.js +4 -0
- package/dist/esm/core/agent/buildDynamicAgentChart.js.map +1 -1
- package/dist/esm/core/agent/callerIdentity.js +2 -1
- package/dist/esm/core/agent/callerIdentity.js.map +1 -1
- package/dist/esm/core/agent/stages/routeTurn.d.ts +1 -1
- package/dist/esm/core/agent/stages/routeTurn.js +3 -3
- package/dist/esm/core/agent/stages/routeTurn.js.map +1 -1
- package/dist/esm/core/agent/stages/seed.d.ts +11 -1
- package/dist/esm/core/agent/stages/seed.js +49 -8
- package/dist/esm/core/agent/stages/seed.js.map +1 -1
- package/dist/esm/core/agent/stages/timeLayer.js +2 -2
- package/dist/esm/core/agent/stages/timeLayer.js.map +1 -1
- package/dist/esm/core/agent/stages/toolCalls.d.ts +11 -1
- package/dist/esm/core/agent/stages/toolCalls.js +26 -5
- package/dist/esm/core/agent/stages/toolCalls.js.map +1 -1
- package/dist/esm/core/agent/types.d.ts +16 -6
- package/dist/esm/core/memberRun.d.ts +132 -0
- package/dist/esm/core/memberRun.js +227 -0
- package/dist/esm/core/memberRun.js.map +1 -0
- package/dist/esm/core/slots/buildToolsSlot.d.ts +1 -1
- package/dist/esm/core/slots/buildToolsSlot.js +1 -1
- package/dist/esm/core/slots/buildToolsSlot.js.map +1 -1
- package/dist/esm/core-flow/Conditional.d.ts +8 -0
- package/dist/esm/core-flow/Conditional.js +29 -8
- package/dist/esm/core-flow/Conditional.js.map +1 -1
- package/dist/esm/core-flow/Graph.js +38 -13
- package/dist/esm/core-flow/Graph.js.map +1 -1
- package/dist/esm/core-flow/Loop.d.ts +8 -0
- package/dist/esm/core-flow/Loop.js +29 -9
- package/dist/esm/core-flow/Loop.js.map +1 -1
- package/dist/esm/core-flow/Parallel.d.ts +8 -0
- package/dist/esm/core-flow/Parallel.js +35 -14
- package/dist/esm/core-flow/Parallel.js.map +1 -1
- package/dist/esm/core-flow/Sequence.d.ts +8 -0
- package/dist/esm/core-flow/Sequence.js +29 -8
- package/dist/esm/core-flow/Sequence.js.map +1 -1
- package/dist/esm/core-flow/Workflow.js +34 -10
- package/dist/esm/core-flow/Workflow.js.map +1 -1
- package/dist/esm/doors/ag-ui.d.ts +19 -0
- package/dist/esm/doors/ag-ui.js +20 -0
- package/dist/esm/doors/ag-ui.js.map +1 -0
- package/dist/esm/hosting/envelope.js +5 -0
- package/dist/esm/hosting/envelope.js.map +1 -1
- package/dist/esm/hosting/httpHost.js +5 -78
- package/dist/esm/hosting/httpHost.js.map +1 -1
- package/dist/esm/hosting/index.d.ts +4 -1
- package/dist/esm/hosting/index.js +2 -0
- package/dist/esm/hosting/index.js.map +1 -1
- package/dist/esm/hosting/pendingAsk.d.ts +19 -0
- package/dist/esm/hosting/pendingAsk.js +38 -0
- package/dist/esm/hosting/pendingAsk.js.map +1 -0
- package/dist/esm/hosting/protocolAdapter.d.ts +229 -0
- package/dist/esm/hosting/protocolAdapter.js +23 -0
- package/dist/esm/hosting/protocolAdapter.js.map +1 -0
- package/dist/esm/hosting/refusalStatus.d.ts +30 -0
- package/dist/esm/hosting/refusalStatus.js +81 -0
- package/dist/esm/hosting/refusalStatus.js.map +1 -0
- package/dist/esm/hosting/standingAgent.js +1 -31
- package/dist/esm/hosting/standingAgent.js.map +1 -1
- package/dist/esm/hosting/stream.d.ts +39 -0
- package/dist/esm/hosting/stream.js +34 -2
- package/dist/esm/hosting/stream.js.map +1 -1
- package/dist/esm/hosting/streamHandler.d.ts +134 -0
- package/dist/esm/hosting/streamHandler.js +493 -0
- package/dist/esm/hosting/streamHandler.js.map +1 -0
- package/dist/esm/hosting/types.d.ts +15 -0
- package/dist/esm/hosting/types.js.map +1 -1
- package/dist/esm/hosting/verifiedThreads.d.ts +29 -0
- package/dist/esm/hosting/verifiedThreads.js +46 -0
- package/dist/esm/hosting/verifiedThreads.js.map +1 -0
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/humanizeLLMError.d.ts +15 -0
- package/dist/esm/lib/humanizeLLMError.js +22 -7
- package/dist/esm/lib/humanizeLLMError.js.map +1 -1
- package/dist/esm/mcp/throttleRetry.d.ts +51 -0
- package/dist/esm/mcp/throttleRetry.js +37 -4
- package/dist/esm/mcp/throttleRetry.js.map +1 -1
- package/dist/esm/memory/define.js +45 -1
- package/dist/esm/memory/define.js.map +1 -1
- package/dist/esm/memory/define.types.d.ts +24 -0
- package/dist/esm/memory/define.types.js.map +1 -1
- package/dist/esm/memory/stages/formatDefault.js +3 -1
- package/dist/esm/memory/stages/formatDefault.js.map +1 -1
- package/dist/esm/memory/store/InMemoryStore.d.ts +8 -3
- package/dist/esm/memory/store/InMemoryStore.js +12 -3
- package/dist/esm/memory/store/InMemoryStore.js.map +1 -1
- package/dist/esm/memory/store/index.d.ts +1 -0
- package/dist/esm/memory/store/index.js +5 -0
- package/dist/esm/memory/store/index.js.map +1 -1
- package/dist/esm/memory/store/types.d.ts +38 -4
- package/dist/esm/memory/store/writeOptions.d.ts +118 -0
- package/dist/esm/memory/store/writeOptions.js +242 -0
- package/dist/esm/memory/store/writeOptions.js.map +1 -0
- package/dist/esm/memory-providers.d.ts +1 -1
- package/dist/esm/memory-providers.js +4 -1
- package/dist/esm/memory-providers.js.map +1 -1
- package/dist/esm/patterns/MapReduce.js +8 -2
- package/dist/esm/patterns/MapReduce.js.map +1 -1
- package/dist/esm/tool-providers/index.d.ts +5 -0
- package/dist/esm/tool-providers/index.js +6 -0
- package/dist/esm/tool-providers/index.js.map +1 -1
- package/dist/esm/trace-toolpack/selfExplain.d.ts +8 -0
- package/dist/esm/trace-toolpack/selfExplain.js +25 -2
- package/dist/esm/trace-toolpack/selfExplain.js.map +1 -1
- package/dist/hosting/envelope.js +5 -0
- package/dist/hosting/envelope.js.map +1 -1
- package/dist/hosting/httpHost.js +5 -78
- package/dist/hosting/httpHost.js.map +1 -1
- package/dist/hosting/index.js +9 -3
- package/dist/hosting/index.js.map +1 -1
- package/dist/hosting/pendingAsk.js +42 -0
- package/dist/hosting/pendingAsk.js.map +1 -0
- package/dist/hosting/protocolAdapter.js +24 -0
- package/dist/hosting/protocolAdapter.js.map +1 -0
- package/dist/hosting/refusalStatus.js +84 -0
- package/dist/hosting/refusalStatus.js.map +1 -0
- package/dist/hosting/standingAgent.js +2 -32
- package/dist/hosting/standingAgent.js.map +1 -1
- package/dist/hosting/stream.js +35 -3
- package/dist/hosting/stream.js.map +1 -1
- package/dist/hosting/streamHandler.js +497 -0
- package/dist/hosting/streamHandler.js.map +1 -0
- package/dist/hosting/types.js.map +1 -1
- package/dist/hosting/verifiedThreads.js +50 -0
- package/dist/hosting/verifiedThreads.js.map +1 -0
- package/dist/index.js +9 -3
- package/dist/index.js.map +1 -1
- package/dist/lib/humanizeLLMError.js +23 -8
- package/dist/lib/humanizeLLMError.js.map +1 -1
- package/dist/mcp/throttleRetry.js +41 -6
- package/dist/mcp/throttleRetry.js.map +1 -1
- package/dist/memory/define.js +45 -1
- package/dist/memory/define.js.map +1 -1
- package/dist/memory/define.types.js.map +1 -1
- package/dist/memory/stages/formatDefault.js +3 -1
- package/dist/memory/stages/formatDefault.js.map +1 -1
- package/dist/memory/store/InMemoryStore.js +12 -3
- package/dist/memory/store/InMemoryStore.js.map +1 -1
- package/dist/memory/store/index.js +11 -1
- package/dist/memory/store/index.js.map +1 -1
- package/dist/memory/store/writeOptions.js +250 -0
- package/dist/memory/store/writeOptions.js.map +1 -0
- package/dist/memory-providers.js +4 -1
- package/dist/memory-providers.js.map +1 -1
- package/dist/patterns/MapReduce.js +8 -2
- package/dist/patterns/MapReduce.js.map +1 -1
- package/dist/tool-providers/index.js +10 -1
- package/dist/tool-providers/index.js.map +1 -1
- package/dist/trace-toolpack/selfExplain.js +25 -2
- package/dist/trace-toolpack/selfExplain.js.map +1 -1
- package/dist/types/adapters/mcp/agentcoreRuntime/errorType.d.ts +13 -0
- package/dist/types/adapters/mcp/agentcoreRuntime/errorType.d.ts.map +1 -0
- package/dist/types/adapters/mcp/agentcoreRuntime/invoke.d.ts +117 -0
- package/dist/types/adapters/mcp/agentcoreRuntime/invoke.d.ts.map +1 -0
- package/dist/types/adapters/mcp/agentcoreRuntime/safeAnswer.d.ts +50 -0
- package/dist/types/adapters/mcp/agentcoreRuntime/safeAnswer.d.ts.map +1 -0
- package/dist/types/adapters/mcp/agentcoreRuntime/session.d.ts +81 -0
- package/dist/types/adapters/mcp/agentcoreRuntime/session.d.ts.map +1 -0
- package/dist/types/adapters/mcp/agentcoreRuntime/sessionBusy.d.ts +62 -0
- package/dist/types/adapters/mcp/agentcoreRuntime/sessionBusy.d.ts.map +1 -0
- package/dist/types/adapters/mcp/agentcoreRuntime/strictJson.d.ts +38 -0
- package/dist/types/adapters/mcp/agentcoreRuntime/strictJson.d.ts.map +1 -0
- package/dist/types/adapters/mcp/agentcoreRuntime/transport.d.ts +177 -0
- package/dist/types/adapters/mcp/agentcoreRuntime/transport.d.ts.map +1 -0
- package/dist/types/adapters/memory/agentcore.d.ts +152 -7
- package/dist/types/adapters/memory/agentcore.d.ts.map +1 -1
- package/dist/types/adapters/memory/memoryBank.d.ts +3 -2
- package/dist/types/adapters/memory/memoryBank.d.ts.map +1 -1
- package/dist/types/adapters/memory/pgVector.d.ts.map +1 -1
- package/dist/types/adapters/memory/redis.d.ts +8 -3
- package/dist/types/adapters/memory/redis.d.ts.map +1 -1
- package/dist/types/adapters/memory/s3Vectors.d.ts.map +1 -1
- package/dist/types/adapters/memory/sqliteVector.d.ts.map +1 -1
- package/dist/types/ag-ui/adapter.d.ts +69 -0
- package/dist/types/ag-ui/adapter.d.ts.map +1 -0
- package/dist/types/ag-ui/framing.d.ts +52 -0
- package/dist/types/ag-ui/framing.d.ts.map +1 -0
- package/dist/types/ag-ui/frontendTools.d.ts +38 -0
- package/dist/types/ag-ui/frontendTools.d.ts.map +1 -0
- package/dist/types/ag-ui/ids.d.ts +44 -0
- package/dist/types/ag-ui/ids.d.ts.map +1 -0
- package/dist/types/ag-ui/index.d.ts +18 -0
- package/dist/types/ag-ui/index.d.ts.map +1 -0
- package/dist/types/ag-ui/request.d.ts +73 -0
- package/dist/types/ag-ui/request.d.ts.map +1 -0
- package/dist/types/ag-ui/serializer.d.ts +174 -0
- package/dist/types/ag-ui/serializer.d.ts.map +1 -0
- package/dist/types/ag-ui/types.d.ts +306 -0
- package/dist/types/ag-ui/types.d.ts.map +1 -0
- package/dist/types/core/Agent.d.ts +2 -0
- package/dist/types/core/Agent.d.ts.map +1 -1
- 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/buildDynamicAgentChart.d.ts.map +1 -1
- package/dist/types/core/agent/callerIdentity.d.ts.map +1 -1
- package/dist/types/core/agent/stages/routeTurn.d.ts +1 -1
- package/dist/types/core/agent/stages/routeTurn.d.ts.map +1 -1
- package/dist/types/core/agent/stages/seed.d.ts +11 -1
- package/dist/types/core/agent/stages/seed.d.ts.map +1 -1
- package/dist/types/core/agent/stages/toolCalls.d.ts +11 -1
- package/dist/types/core/agent/stages/toolCalls.d.ts.map +1 -1
- package/dist/types/core/agent/types.d.ts +16 -6
- package/dist/types/core/agent/types.d.ts.map +1 -1
- package/dist/types/core/memberRun.d.ts +133 -0
- package/dist/types/core/memberRun.d.ts.map +1 -0
- package/dist/types/core/slots/buildToolsSlot.d.ts +1 -1
- package/dist/types/core/slots/buildToolsSlot.d.ts.map +1 -1
- package/dist/types/core-flow/Conditional.d.ts +8 -0
- package/dist/types/core-flow/Conditional.d.ts.map +1 -1
- package/dist/types/core-flow/Graph.d.ts.map +1 -1
- package/dist/types/core-flow/Loop.d.ts +8 -0
- package/dist/types/core-flow/Loop.d.ts.map +1 -1
- package/dist/types/core-flow/Parallel.d.ts +8 -0
- package/dist/types/core-flow/Parallel.d.ts.map +1 -1
- package/dist/types/core-flow/Sequence.d.ts +8 -0
- package/dist/types/core-flow/Sequence.d.ts.map +1 -1
- package/dist/types/core-flow/Workflow.d.ts.map +1 -1
- package/dist/types/doors/ag-ui.d.ts +20 -0
- package/dist/types/doors/ag-ui.d.ts.map +1 -0
- package/dist/types/hosting/httpHost.d.ts.map +1 -1
- package/dist/types/hosting/index.d.ts +4 -1
- package/dist/types/hosting/index.d.ts.map +1 -1
- package/dist/types/hosting/pendingAsk.d.ts +20 -0
- package/dist/types/hosting/pendingAsk.d.ts.map +1 -0
- package/dist/types/hosting/protocolAdapter.d.ts +230 -0
- package/dist/types/hosting/protocolAdapter.d.ts.map +1 -0
- package/dist/types/hosting/refusalStatus.d.ts +31 -0
- package/dist/types/hosting/refusalStatus.d.ts.map +1 -0
- package/dist/types/hosting/standingAgent.d.ts.map +1 -1
- package/dist/types/hosting/stream.d.ts +39 -0
- package/dist/types/hosting/stream.d.ts.map +1 -1
- package/dist/types/hosting/streamHandler.d.ts +135 -0
- package/dist/types/hosting/streamHandler.d.ts.map +1 -0
- package/dist/types/hosting/types.d.ts +15 -0
- package/dist/types/hosting/types.d.ts.map +1 -1
- package/dist/types/hosting/verifiedThreads.d.ts +30 -0
- package/dist/types/hosting/verifiedThreads.d.ts.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/lib/humanizeLLMError.d.ts +15 -0
- package/dist/types/lib/humanizeLLMError.d.ts.map +1 -1
- package/dist/types/mcp/throttleRetry.d.ts +51 -0
- package/dist/types/mcp/throttleRetry.d.ts.map +1 -1
- package/dist/types/memory/define.d.ts.map +1 -1
- package/dist/types/memory/define.types.d.ts +24 -0
- package/dist/types/memory/define.types.d.ts.map +1 -1
- package/dist/types/memory/stages/formatDefault.d.ts.map +1 -1
- package/dist/types/memory/store/InMemoryStore.d.ts +8 -3
- package/dist/types/memory/store/InMemoryStore.d.ts.map +1 -1
- package/dist/types/memory/store/index.d.ts +1 -0
- package/dist/types/memory/store/index.d.ts.map +1 -1
- package/dist/types/memory/store/types.d.ts +38 -4
- package/dist/types/memory/store/types.d.ts.map +1 -1
- package/dist/types/memory/store/writeOptions.d.ts +119 -0
- package/dist/types/memory/store/writeOptions.d.ts.map +1 -0
- package/dist/types/memory-providers.d.ts +1 -1
- package/dist/types/memory-providers.d.ts.map +1 -1
- package/dist/types/patterns/MapReduce.d.ts.map +1 -1
- package/dist/types/tool-providers/index.d.ts +5 -0
- package/dist/types/tool-providers/index.d.ts.map +1 -1
- package/dist/types/trace-toolpack/selfExplain.d.ts +8 -0
- package/dist/types/trace-toolpack/selfExplain.d.ts.map +1 -1
- package/package.json +25 -1
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* agentCoreRuntimeMcpTransport — an MCP server hosted on AWS Bedrock
|
|
3
|
+
* **AgentCore Runtime**, reached as an ordinary MCP transport.
|
|
4
|
+
*
|
|
5
|
+
* const orders = await mcpClient({
|
|
6
|
+
* name: 'orders',
|
|
7
|
+
* transport: agentCoreRuntimeMcpTransport({
|
|
8
|
+
* agentRuntimeArn: 'arn:aws:bedrock-agentcore:us-west-2:123456789012:runtime/orders_mcp-a1b2c3',
|
|
9
|
+
* region: 'us-west-2',
|
|
10
|
+
* }),
|
|
11
|
+
* });
|
|
12
|
+
*
|
|
13
|
+
* ── Why this exists ──────────────────────────────────────────────────────────
|
|
14
|
+
* `agentCoreGatewayTransport` reaches a Gateway; `agentCoreRuntimeHost` hosts
|
|
15
|
+
* OUR agent on Runtime. Neither calls an MCP server somebody deployed TO
|
|
16
|
+
* Runtime, and that server is not reachable as a plain URL: every request goes
|
|
17
|
+
* through `InvokeAgentRuntime`, it lands in a runtime SESSION that has to be
|
|
18
|
+
* carried from call to call, and the platform answers a request that arrives
|
|
19
|
+
* while that session is still coming up with an HTTP 200 whose body says
|
|
20
|
+
* "Session operation in progress, please retry" — which no MCP client retries.
|
|
21
|
+
*
|
|
22
|
+
* ── What it is: one port, three strategies ───────────────────────────────────
|
|
23
|
+
* The port is the existing one: this returns an `http` member of
|
|
24
|
+
* `McpTransport`, so `mcpClient` builds it like any other Streamable HTTP
|
|
25
|
+
* server and knows nothing about AgentCore. Everything AgentCore-specific sits
|
|
26
|
+
* in the `fetch` it carries, composed from three choices, one file each:
|
|
27
|
+
*
|
|
28
|
+
* session (`session.ts`) 'per-call' (the default: a session per request),
|
|
29
|
+
* or 'reuse' (one session per MCP client, keyed by
|
|
30
|
+
* a handle the transport issues)
|
|
31
|
+
* retry (`sessionBusy.ts`) the session-busy refusal, retried with bounded
|
|
32
|
+
* backoff by the SAME loop `mcpClient` uses for a
|
|
33
|
+
* 429 (`mcp/throttleRetry.ts` · `retryingFetchWhen`)
|
|
34
|
+
* auth (`invoke.ts`) 'sigv4' through the AWS SDK's InvokeAgentRuntime,
|
|
35
|
+
* or a bearer token over the documented HTTPS
|
|
36
|
+
* endpoint — the SDK has no bearer scheme, and the
|
|
37
|
+
* API reference says an OAuth caller must use HTTPS
|
|
38
|
+
*
|
|
39
|
+
* in that order, outermost first: the session is applied once per request, so
|
|
40
|
+
* every attempt of it lands in the same runtime session, and every attempt is
|
|
41
|
+
* signed (or vended) afresh, the ordering `mcp/throttleRetry.ts` requires.
|
|
42
|
+
* What the MCP client reads of a failure is rewritten from the library's own
|
|
43
|
+
* fixed sentences and safe ids (`safeAnswer.ts`), never the service's text.
|
|
44
|
+
* `mcpClient`'s own 429 retry still wraps the whole thing.
|
|
45
|
+
*
|
|
46
|
+
* ── What it does NOT do ──────────────────────────────────────────────────────
|
|
47
|
+
* Deploy or manage a runtime (a control-plane job), or host one (that is
|
|
48
|
+
* `agentCoreRuntimeHost`). This is the CLIENT side of a server somebody already
|
|
49
|
+
* deployed with `--protocol MCP`.
|
|
50
|
+
*
|
|
51
|
+
* Pattern: Facade over three Strategies. Role: outer ring, vendor adapter.
|
|
52
|
+
*/
|
|
53
|
+
import { type FetchLike } from '../../../mcp/gatewayTransport.js';
|
|
54
|
+
import { type ThrottleRetryOptions } from '../../../mcp/throttleRetry.js';
|
|
55
|
+
import type { McpHttpTransport } from '../../../mcp/types.js';
|
|
56
|
+
import type { CredentialProvider } from '../../../identity/types.js';
|
|
57
|
+
import { type AgentCoreRuntimeSdkClient, type BedrockAgentCoreRuntimeSdkModule } from './invoke.js';
|
|
58
|
+
import { type AgentCoreRuntimeSession } from './session.js';
|
|
59
|
+
/**
|
|
60
|
+
* A bearer token, for a runtime whose inbound auth is OAuth (a JWT authorizer).
|
|
61
|
+
*
|
|
62
|
+
* Vended PER REQUEST by the provider — the same once-and-dropped rule as
|
|
63
|
+
* `gatewayTransport`, through the same code.
|
|
64
|
+
*/
|
|
65
|
+
export interface AgentCoreRuntimeBearerAuth {
|
|
66
|
+
/** Who vends the token. `agentCoreIdentity()` or any `CredentialProvider`. */
|
|
67
|
+
readonly bearer: CredentialProvider;
|
|
68
|
+
/** The downstream service id your provider keys on. Default `'runtime'`. */
|
|
69
|
+
readonly service?: string;
|
|
70
|
+
/** OAuth scopes, when the provider uses them. */
|
|
71
|
+
readonly scopes?: readonly string[];
|
|
72
|
+
/**
|
|
73
|
+
* `'machine'` (2-legged), the only mode. `'user'` is refused: the transport
|
|
74
|
+
* asks for its token without naming any user, so a user-delegated token
|
|
75
|
+
* would be sent for whoever calls through the client. For a token per user,
|
|
76
|
+
* build a transport per user whose provider vends that user's token.
|
|
77
|
+
*/
|
|
78
|
+
readonly mode?: 'machine';
|
|
79
|
+
/**
|
|
80
|
+
* Your own `fetch`, called UNDERNEATH the per-request vending — an HTTP
|
|
81
|
+
* agent, a proxy. It sees the final headers, the vended one included.
|
|
82
|
+
*/
|
|
83
|
+
readonly fetch?: FetchLike;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* How requests are authenticated — the runtime's inbound auth decides which.
|
|
87
|
+
*
|
|
88
|
+
* - `'sigv4'` — IAM. The AWS SDK signs `InvokeAgentRuntime` with your AWS
|
|
89
|
+
* credentials (the default chain, or the `client` you pass).
|
|
90
|
+
* - `{ bearer }` — OAuth. A plain HTTPS request with `Authorization: Bearer`,
|
|
91
|
+
* because the SDK cannot send a bearer token.
|
|
92
|
+
*/
|
|
93
|
+
export type AgentCoreRuntimeAuth = 'sigv4' | AgentCoreRuntimeBearerAuth;
|
|
94
|
+
/**
|
|
95
|
+
* The session-busy retry: the same ceilings and the same `onRetry` report as
|
|
96
|
+
* `mcpClient`'s `retryOnThrottle`, applied to AgentCore's own refusal.
|
|
97
|
+
*/
|
|
98
|
+
export type AgentCoreRuntimeRetryOptions = ThrottleRetryOptions;
|
|
99
|
+
/** Options for {@link agentCoreRuntimeMcpTransport}. */
|
|
100
|
+
export interface AgentCoreRuntimeMcpTransportOptions {
|
|
101
|
+
/**
|
|
102
|
+
* The runtime hosting the MCP server — its ARN, as `agentcore deploy` prints
|
|
103
|
+
* it, or its id together with {@link accountId}.
|
|
104
|
+
*/
|
|
105
|
+
readonly agentRuntimeArn: string;
|
|
106
|
+
/** The region it runs in, e.g. `'us-west-2'`. */
|
|
107
|
+
readonly region: string;
|
|
108
|
+
/** The endpoint (version) to invoke. The runtime's default endpoint when omitted. */
|
|
109
|
+
readonly qualifier?: string;
|
|
110
|
+
/** The owning account — required by AgentCore when `agentRuntimeArn` is an id, not an ARN. */
|
|
111
|
+
readonly accountId?: string;
|
|
112
|
+
/** How requests are authenticated. Default `'sigv4'`. */
|
|
113
|
+
readonly auth?: AgentCoreRuntimeAuth;
|
|
114
|
+
/**
|
|
115
|
+
* Which runtime session each request lands in. Default `'per-call'`.
|
|
116
|
+
*
|
|
117
|
+
* - `'per-call'` — every request in a session of its own; nothing carries
|
|
118
|
+
* over, so one client can serve every user of a process. Needs a
|
|
119
|
+
* stateless server (the runtime's recommended default).
|
|
120
|
+
* - `'reuse'` — one session per CLIENT: each `mcpClient` built on this
|
|
121
|
+
* transport keeps its own runtime session for its life. **Build one
|
|
122
|
+
* client per conversation**: a client shared by two users is one
|
|
123
|
+
* session — one microVM, one server state — for both.
|
|
124
|
+
*/
|
|
125
|
+
readonly session?: AgentCoreRuntimeSession;
|
|
126
|
+
/**
|
|
127
|
+
* Retry AgentCore's "session operation in progress" refusal — the MCP
|
|
128
|
+
* contract's HTTP 200 with JSON-RPC -32005, or the API's 409
|
|
129
|
+
* `RetryableConflictException`. On by default: up to 5 attempts, never more
|
|
130
|
+
* than 10 s of waiting in total, jittered exponential backoff. `false` lets
|
|
131
|
+
* the refusal through on the first attempt.
|
|
132
|
+
*
|
|
133
|
+
* Nothing else is retried here: a 429 goes to `mcpClient`'s own throttle
|
|
134
|
+
* retry, and a 5xx, a dropped connection or any other JSON-RPC error
|
|
135
|
+
* (throttling's -32003 included) is delivered as it is — it may be the
|
|
136
|
+
* record of work that ran.
|
|
137
|
+
*/
|
|
138
|
+
readonly retry?: boolean | AgentCoreRuntimeRetryOptions;
|
|
139
|
+
/**
|
|
140
|
+
* SigV4 only: a `BedrockAgentCoreClient` you built, so its credentials,
|
|
141
|
+
* region and retry settings are the ones used. Refused with `{ bearer }`.
|
|
142
|
+
*
|
|
143
|
+
* **Build it with `maxAttempts: 1`.** The client this transport builds has
|
|
144
|
+
* the SDK's own retry off, because the SDK's standard policy re-sends a call
|
|
145
|
+
* after a 5xx or a dropped connection — work that may already have run. Your
|
|
146
|
+
* client keeps whatever policy you gave it.
|
|
147
|
+
*/
|
|
148
|
+
readonly client?: AgentCoreRuntimeSdkClient;
|
|
149
|
+
/** @internal Test injection — the AWS SDK module. */
|
|
150
|
+
readonly _sdk?: BedrockAgentCoreRuntimeSdkModule;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* An MCP transport for a server hosted on AgentCore Runtime.
|
|
154
|
+
*
|
|
155
|
+
* @throws when the runtime or region is missing, when a strategy is unknown,
|
|
156
|
+
* when `client` is given beside `{ bearer }`, or — for `'sigv4'` — when the
|
|
157
|
+
* AWS SDK peer dependency cannot be loaded.
|
|
158
|
+
*/
|
|
159
|
+
export declare function agentCoreRuntimeMcpTransport(options: AgentCoreRuntimeMcpTransportOptions): McpHttpTransport;
|
|
160
|
+
/** Where a runtime's MCP endpoint is, as {@link agentCoreRuntimeUrl} needs it. */
|
|
161
|
+
export interface AgentCoreRuntimeUrlOptions {
|
|
162
|
+
readonly agentRuntimeArn: string;
|
|
163
|
+
readonly region: string;
|
|
164
|
+
readonly qualifier?: string;
|
|
165
|
+
readonly accountId?: string;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* The HTTPS endpoint of a runtime's MCP server:
|
|
169
|
+
* `https://bedrock-agentcore.{region}.amazonaws.com/runtimes/{url-encoded ARN}/invocations`,
|
|
170
|
+
* with `qualifier` / `accountId` as query parameters when given — the request
|
|
171
|
+
* line of `InvokeAgentRuntime`, and the URL AgentCore's own MCP examples dial.
|
|
172
|
+
*
|
|
173
|
+
* @throws when `agentRuntimeArn` or `region` is missing, or the region is not
|
|
174
|
+
* shaped like one (it becomes part of a hostname).
|
|
175
|
+
*/
|
|
176
|
+
export declare function agentCoreRuntimeUrl(options: AgentCoreRuntimeUrlOptions): string;
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* agentCoreRuntimeMcpTransport — an MCP server hosted on AWS Bedrock
|
|
3
|
+
* **AgentCore Runtime**, reached as an ordinary MCP transport.
|
|
4
|
+
*
|
|
5
|
+
* const orders = await mcpClient({
|
|
6
|
+
* name: 'orders',
|
|
7
|
+
* transport: agentCoreRuntimeMcpTransport({
|
|
8
|
+
* agentRuntimeArn: 'arn:aws:bedrock-agentcore:us-west-2:123456789012:runtime/orders_mcp-a1b2c3',
|
|
9
|
+
* region: 'us-west-2',
|
|
10
|
+
* }),
|
|
11
|
+
* });
|
|
12
|
+
*
|
|
13
|
+
* ── Why this exists ──────────────────────────────────────────────────────────
|
|
14
|
+
* `agentCoreGatewayTransport` reaches a Gateway; `agentCoreRuntimeHost` hosts
|
|
15
|
+
* OUR agent on Runtime. Neither calls an MCP server somebody deployed TO
|
|
16
|
+
* Runtime, and that server is not reachable as a plain URL: every request goes
|
|
17
|
+
* through `InvokeAgentRuntime`, it lands in a runtime SESSION that has to be
|
|
18
|
+
* carried from call to call, and the platform answers a request that arrives
|
|
19
|
+
* while that session is still coming up with an HTTP 200 whose body says
|
|
20
|
+
* "Session operation in progress, please retry" — which no MCP client retries.
|
|
21
|
+
*
|
|
22
|
+
* ── What it is: one port, three strategies ───────────────────────────────────
|
|
23
|
+
* The port is the existing one: this returns an `http` member of
|
|
24
|
+
* `McpTransport`, so `mcpClient` builds it like any other Streamable HTTP
|
|
25
|
+
* server and knows nothing about AgentCore. Everything AgentCore-specific sits
|
|
26
|
+
* in the `fetch` it carries, composed from three choices, one file each:
|
|
27
|
+
*
|
|
28
|
+
* session (`session.ts`) 'per-call' (the default: a session per request),
|
|
29
|
+
* or 'reuse' (one session per MCP client, keyed by
|
|
30
|
+
* a handle the transport issues)
|
|
31
|
+
* retry (`sessionBusy.ts`) the session-busy refusal, retried with bounded
|
|
32
|
+
* backoff by the SAME loop `mcpClient` uses for a
|
|
33
|
+
* 429 (`mcp/throttleRetry.ts` · `retryingFetchWhen`)
|
|
34
|
+
* auth (`invoke.ts`) 'sigv4' through the AWS SDK's InvokeAgentRuntime,
|
|
35
|
+
* or a bearer token over the documented HTTPS
|
|
36
|
+
* endpoint — the SDK has no bearer scheme, and the
|
|
37
|
+
* API reference says an OAuth caller must use HTTPS
|
|
38
|
+
*
|
|
39
|
+
* in that order, outermost first: the session is applied once per request, so
|
|
40
|
+
* every attempt of it lands in the same runtime session, and every attempt is
|
|
41
|
+
* signed (or vended) afresh, the ordering `mcp/throttleRetry.ts` requires.
|
|
42
|
+
* What the MCP client reads of a failure is rewritten from the library's own
|
|
43
|
+
* fixed sentences and safe ids (`safeAnswer.ts`), never the service's text.
|
|
44
|
+
* `mcpClient`'s own 429 retry still wraps the whole thing.
|
|
45
|
+
*
|
|
46
|
+
* ── What it does NOT do ──────────────────────────────────────────────────────
|
|
47
|
+
* Deploy or manage a runtime (a control-plane job), or host one (that is
|
|
48
|
+
* `agentCoreRuntimeHost`). This is the CLIENT side of a server somebody already
|
|
49
|
+
* deployed with `--protocol MCP`.
|
|
50
|
+
*
|
|
51
|
+
* Pattern: Facade over three Strategies. Role: outer ring, vendor adapter.
|
|
52
|
+
*/
|
|
53
|
+
import { createVendingFetch, gatewayTransport, } from '../../../mcp/gatewayTransport.js';
|
|
54
|
+
import { retryingFetchWhen, } from '../../../mcp/throttleRetry.js';
|
|
55
|
+
import { invokeFetch, invokeSdk, } from './invoke.js';
|
|
56
|
+
import { safeAnswer } from './safeAnswer.js';
|
|
57
|
+
import { sessionStrategy } from './session.js';
|
|
58
|
+
import { sessionBusy } from './sessionBusy.js';
|
|
59
|
+
/** The session-busy retry's own ceilings, when the caller set none. */
|
|
60
|
+
const DEFAULT_RETRY = { maxAttempts: 5, maxWaitMs: 10_000 };
|
|
61
|
+
/** What a bearer token is vended for, unless the caller names another service. */
|
|
62
|
+
const DEFAULT_BEARER_SERVICE = 'runtime';
|
|
63
|
+
/** A region is a DNS label run, nothing more — it is spliced into a hostname. */
|
|
64
|
+
const REGION_SHAPE = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
65
|
+
/**
|
|
66
|
+
* An MCP transport for a server hosted on AgentCore Runtime.
|
|
67
|
+
*
|
|
68
|
+
* @throws when the runtime or region is missing, when a strategy is unknown,
|
|
69
|
+
* when `client` is given beside `{ bearer }`, or — for `'sigv4'` — when the
|
|
70
|
+
* AWS SDK peer dependency cannot be loaded.
|
|
71
|
+
*/
|
|
72
|
+
export function agentCoreRuntimeMcpTransport(options) {
|
|
73
|
+
const url = agentCoreRuntimeUrl(options);
|
|
74
|
+
const send = authStrategy(options, url);
|
|
75
|
+
const retried = retryingFetchWhen(send, retryConfig(options.retry), sessionBusy) ?? send;
|
|
76
|
+
const session = sessionStrategy(options.session ?? 'per-call');
|
|
77
|
+
// The session is applied ONCE per request the MCP client makes, outside the
|
|
78
|
+
// retry: every attempt of one request goes to the same runtime session (a
|
|
79
|
+
// busy refusal is about THAT session coming up), and only the final answer
|
|
80
|
+
// binds anything.
|
|
81
|
+
const sessioned = async (input, init) => {
|
|
82
|
+
const headers = new Headers(init?.headers);
|
|
83
|
+
const step = session.request(headers, (init?.method ?? 'GET').toUpperCase());
|
|
84
|
+
if ('answer' in step)
|
|
85
|
+
return step.answer;
|
|
86
|
+
const response = await retried(input, { ...init, headers });
|
|
87
|
+
// What the MCP client may read of a failure is rewritten from safe parts —
|
|
88
|
+
// ONE rule for both auth paths, after the retry has read the original.
|
|
89
|
+
return step.settle(await safeAnswer(response));
|
|
90
|
+
};
|
|
91
|
+
return { transport: 'http', url, fetch: sessioned };
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* The HTTPS endpoint of a runtime's MCP server:
|
|
95
|
+
* `https://bedrock-agentcore.{region}.amazonaws.com/runtimes/{url-encoded ARN}/invocations`,
|
|
96
|
+
* with `qualifier` / `accountId` as query parameters when given — the request
|
|
97
|
+
* line of `InvokeAgentRuntime`, and the URL AgentCore's own MCP examples dial.
|
|
98
|
+
*
|
|
99
|
+
* @throws when `agentRuntimeArn` or `region` is missing, or the region is not
|
|
100
|
+
* shaped like one (it becomes part of a hostname).
|
|
101
|
+
*/
|
|
102
|
+
export function agentCoreRuntimeUrl(options) {
|
|
103
|
+
const { agentRuntimeArn, region, qualifier, accountId } = options;
|
|
104
|
+
if (!agentRuntimeArn || !region) {
|
|
105
|
+
throw new TypeError('agentCoreRuntimeUrl: both `agentRuntimeArn` and `region` are required — the runtime ' +
|
|
106
|
+
'is named by the first and reached through the second.');
|
|
107
|
+
}
|
|
108
|
+
if (!REGION_SHAPE.test(region)) {
|
|
109
|
+
throw new TypeError(`agentCoreRuntimeUrl: \`region\` ${JSON.stringify(region)} is not a region name ` +
|
|
110
|
+
"(lowercase letters, digits and '-', e.g. 'us-west-2'). It becomes part of the " +
|
|
111
|
+
'hostname, so it is refused rather than spliced in.');
|
|
112
|
+
}
|
|
113
|
+
const query = new URLSearchParams();
|
|
114
|
+
if (qualifier)
|
|
115
|
+
query.set('qualifier', qualifier);
|
|
116
|
+
if (accountId)
|
|
117
|
+
query.set('accountId', accountId);
|
|
118
|
+
const base = `https://bedrock-agentcore.${region}.amazonaws.com/runtimes/` +
|
|
119
|
+
`${encodeURIComponent(agentRuntimeArn)}/invocations`;
|
|
120
|
+
const search = query.toString();
|
|
121
|
+
return search === '' ? base : `${base}?${search}`;
|
|
122
|
+
}
|
|
123
|
+
// ── The auth strategy ─────────────────────────────────────────────────
|
|
124
|
+
/** The innermost `fetch`: the one that authenticates and sends. */
|
|
125
|
+
function authStrategy(options, url) {
|
|
126
|
+
const auth = options.auth ?? 'sigv4';
|
|
127
|
+
if (auth === 'sigv4') {
|
|
128
|
+
const { client, InvokeAgentRuntimeCommand } = invokeSdk({
|
|
129
|
+
region: options.region,
|
|
130
|
+
...(options.client !== undefined && { client: options.client }),
|
|
131
|
+
...(options._sdk !== undefined && { sdk: options._sdk }),
|
|
132
|
+
});
|
|
133
|
+
return invokeFetch({
|
|
134
|
+
agentRuntimeArn: options.agentRuntimeArn,
|
|
135
|
+
...(options.qualifier !== undefined && { qualifier: options.qualifier }),
|
|
136
|
+
...(options.accountId !== undefined && { accountId: options.accountId }),
|
|
137
|
+
}, client, InvokeAgentRuntimeCommand);
|
|
138
|
+
}
|
|
139
|
+
if (auth !== null && typeof auth === 'object' && auth.bearer !== undefined) {
|
|
140
|
+
if (typeof auth.bearer.getCredential !== 'function') {
|
|
141
|
+
throw new TypeError('agentCoreRuntimeMcpTransport: `auth.bearer` must be a CredentialProvider (an object ' +
|
|
142
|
+
'with getCredential — agentCoreIdentity(), staticTokens(), your own), not the token ' +
|
|
143
|
+
'itself: a token is vended per request so it can rotate, and is never held here.');
|
|
144
|
+
}
|
|
145
|
+
if (options.client !== undefined) {
|
|
146
|
+
throw new TypeError('agentCoreRuntimeMcpTransport: `client` is the SigV4 strategy’s AWS SDK client, and ' +
|
|
147
|
+
'`auth: { bearer }` sends no AWS SDK request — the SDK cannot carry a bearer token, ' +
|
|
148
|
+
'so this path is plain HTTPS. Remove `client`, or use `auth: "sigv4"`.');
|
|
149
|
+
}
|
|
150
|
+
if (auth.mode !== undefined && auth.mode !== 'machine') {
|
|
151
|
+
// The vending request names no user: it carries `service`, `scopes` and
|
|
152
|
+
// `mode`, never an identity or the user's own token. A user-delegated
|
|
153
|
+
// token asked for that way belongs to nobody in particular — and would be
|
|
154
|
+
// sent for whoever calls through the client.
|
|
155
|
+
throw new TypeError(`agentCoreRuntimeMcpTransport: \`auth.mode\` must be 'machine' — got ${describe(auth.mode)}. ` +
|
|
156
|
+
'This transport asks its provider for a token without naming any user, so a ' +
|
|
157
|
+
'user-delegated token would be sent for whoever calls through the client. Leave ' +
|
|
158
|
+
'`mode` unset for the client credential; for a token per user, build a transport per ' +
|
|
159
|
+
'user whose `bearer` provider vends that user’s token.');
|
|
160
|
+
}
|
|
161
|
+
// The Gateway's vending fetch, reused as is: the token is vended per
|
|
162
|
+
// request, applied to that one request, and dropped.
|
|
163
|
+
return createVendingFetch(gatewayTransport({
|
|
164
|
+
url,
|
|
165
|
+
credentials: auth.bearer,
|
|
166
|
+
service: auth.service ?? DEFAULT_BEARER_SERVICE,
|
|
167
|
+
...(auth.scopes !== undefined && { scopes: auth.scopes }),
|
|
168
|
+
...(auth.mode !== undefined && { mode: auth.mode }),
|
|
169
|
+
}), auth.fetch);
|
|
170
|
+
}
|
|
171
|
+
throw new TypeError(`agentCoreRuntimeMcpTransport: \`auth\` must be 'sigv4' or { bearer: <CredentialProvider> } ` +
|
|
172
|
+
`— got ${describe(auth)}. Which one is decided by the runtime's inbound auth: IAM is ` +
|
|
173
|
+
"'sigv4', an OAuth (JWT) authorizer is a bearer token.");
|
|
174
|
+
}
|
|
175
|
+
// ── The retry strategy's configuration ────────────────────────────────
|
|
176
|
+
function retryConfig(retry) {
|
|
177
|
+
if (retry === false)
|
|
178
|
+
return false;
|
|
179
|
+
const given = typeof retry === 'object' && retry !== null ? retry : {};
|
|
180
|
+
// An explicitly `undefined` field means "not set" — it must fall back to this
|
|
181
|
+
// transport's default, not erase it (and land on the loop's own default).
|
|
182
|
+
const set = Object.fromEntries(Object.entries(given).filter(([, v]) => v !== undefined));
|
|
183
|
+
return { ...DEFAULT_RETRY, ...set };
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* A refused value, described by SHAPE — never echoed. A mistyped `auth` can be
|
|
187
|
+
* the token itself (`auth: process.env.RUNTIME_TOKEN`), and an error message is
|
|
188
|
+
* the last place it should land.
|
|
189
|
+
*/
|
|
190
|
+
function describe(value) {
|
|
191
|
+
if (value === null)
|
|
192
|
+
return 'null';
|
|
193
|
+
if (typeof value === 'string')
|
|
194
|
+
return `a string of ${value.length} characters`;
|
|
195
|
+
if (typeof value === 'object')
|
|
196
|
+
return `an object with keys [${Object.keys(value).join(', ')}]`;
|
|
197
|
+
return typeof value;
|
|
198
|
+
}
|
|
199
|
+
//# sourceMappingURL=transport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport.js","sourceRoot":"","sources":["../../../../../src/adapters/mcp/agentcoreRuntime/transport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AAEH,OAAO,EACL,kBAAkB,EAClB,gBAAgB,GAEjB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,iBAAiB,GAIlB,MAAM,+BAA+B,CAAC;AAGvC,OAAO,EACL,WAAW,EACX,SAAS,GAGV,MAAM,aAAa,CAAC;AACrB,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AC,EAAE,EAAE,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC;IACzF,OAAO,EAAE,GAAG,aAAa,EAAE,GAAG,GAAG,EAAE,CAAC;AACtC,CAAC;AAED;;;;GAIG;AACH,SAAS,QAAQ,CAAC,KAAc;IAC9B,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,MAAM,CAAC;IAClC,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,eAAe,KAAK,CAAC,MAAM,aAAa,CAAC;IAC/E,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,wBAAwB,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;IAC/F,OAAO,OAAO,KAAK,CAAC;AACtB,CAAC"}
|
|
@@ -22,6 +22,8 @@
|
|
|
22
22
|
* "delete the whole session" call. This shapes the adapter:
|
|
23
23
|
*
|
|
24
24
|
* • `put` → `CreateEvent` (append; `actorId` + `eventTimestamp` are required). O(1)
|
|
25
|
+
* Its write options become CreateEvent's own fields: `extraction: 'skip'` →
|
|
26
|
+
* `extractionMode: 'SKIP'`, `namespaceScope` → `extractionConfig.namespaceVariables`.
|
|
25
27
|
* • `list` → `ListEvents` (paginated, `includePayloads`). ← window / episodic memory. O(page)
|
|
26
28
|
* • `get(id)` / `delete(id)` → list-then-find by the entry id stored in the blob, since
|
|
27
29
|
* AgentCore's ids are server-assigned. **O(events in session)** — fine for typical
|
|
@@ -43,6 +45,35 @@
|
|
|
43
45
|
import type { ListOptions, ListResult, MemoryStore, PutIfVersionResult, ScoredEntry, SearchOptions } from '../../memory/store/types.js';
|
|
44
46
|
import type { MemoryEntry } from '../../memory/entry/index.js';
|
|
45
47
|
import type { MemoryIdentity } from '../../memory/identity/index.js';
|
|
48
|
+
import { type MemoryWriteOptionName, type MemoryWriteOptions } from '../../memory/store/writeOptions.js';
|
|
49
|
+
/**
|
|
50
|
+
* A caller's value — a tenant id — in the alphabet AgentCore admits for a
|
|
51
|
+
* namespace variable, ONE-TO-ONE.
|
|
52
|
+
*
|
|
53
|
+
* The alphabet is narrow (`[a-z0-9][a-z0-9-_]*`, at most 64 characters), so the
|
|
54
|
+
* easy mappings fold: lowercasing merges `Acme` with `acme`, stripping merges
|
|
55
|
+
* `a.b` with `ab`, truncating merges any two long ids that share a prefix — and
|
|
56
|
+
* a fold here files two tenants' derived records under one namespace. This is
|
|
57
|
+
* the same law as the actor and session ids above, in this alphabet:
|
|
58
|
+
*
|
|
59
|
+
* - `[a-z0-9-]` passes through; every other UTF-16 code unit becomes `_`
|
|
60
|
+
* plus its four lowercase hex digits (fixed width, so it decodes);
|
|
61
|
+
* - every value starts with `v`, so one whose first character had to be
|
|
62
|
+
* escaped still starts with a letter — and no two inputs share an output;
|
|
63
|
+
* - every value ENDS with `_z`, which cannot occur inside an encoding (an
|
|
64
|
+
* `_` there is always followed by four hex digits) — so no tenant's value
|
|
65
|
+
* is the beginning of another's (`1` and `12` would otherwise be `v1` and
|
|
66
|
+
* `v12`), and a prefix match over namespaces cannot reach a neighbour;
|
|
67
|
+
* - too long is REFUSED, never truncated.
|
|
68
|
+
*
|
|
69
|
+
* `agentCoreNamespaceValue('acme')` is `'vacme_z'`; `'Acme'` is `'v_0041cme_z'`.
|
|
70
|
+
* Use the same mapping wherever the namespace is read back (`searchNamespace`).
|
|
71
|
+
*
|
|
72
|
+
* @throws {TypeError} for an empty value — an absent tenant is not a tenant
|
|
73
|
+
* @throws {RangeError} when the encoding exceeds 64 characters (the value is
|
|
74
|
+
* not quoted: it names a tenant)
|
|
75
|
+
*/
|
|
76
|
+
export declare function agentCoreNamespaceValue(raw: string): string;
|
|
46
77
|
/** One event as the adapter cares about it: AgentCore's id + the decoded entry. */
|
|
47
78
|
export interface AgentCoreEvent {
|
|
48
79
|
/** AgentCore server-assigned event id (needed to delete it). */
|
|
@@ -114,12 +145,35 @@ export declare class UnreadableMemoryEntryError extends TypeError {
|
|
|
114
145
|
* `DeleteEvent`; tests inject a mock via `_client`.
|
|
115
146
|
*/
|
|
116
147
|
export interface AgentCoreLikeClient {
|
|
148
|
+
/**
|
|
149
|
+
* `true` when {@link createEvent} forwards `extractionMode` and
|
|
150
|
+
* `extractionConfig` to `CreateEvent` unchanged. The built-in client does.
|
|
151
|
+
*
|
|
152
|
+
* Declared, not assumed: a client written before these fields existed
|
|
153
|
+
* compiles against the wider input and drops them, and a dropped
|
|
154
|
+
* `extractionMode: 'SKIP'` sends a turn the caller kept out of long-term
|
|
155
|
+
* memory INTO extraction. Without this, `AgentCoreStore` honours no write
|
|
156
|
+
* options and refuses them by name.
|
|
157
|
+
*/
|
|
158
|
+
readonly forwardsWriteOptions?: true;
|
|
117
159
|
/** Append one entry as an event (server assigns the eventId). */
|
|
118
160
|
createEvent(input: {
|
|
119
161
|
memoryId: string;
|
|
120
162
|
actorId: string;
|
|
121
163
|
sessionId: string;
|
|
122
164
|
entry: MemoryEntry;
|
|
165
|
+
/**
|
|
166
|
+
* `CreateEvent`'s own field (`ExtractionMode.SKIP`): store the event in
|
|
167
|
+
* short-term memory, exclude it from long-term extraction.
|
|
168
|
+
*/
|
|
169
|
+
extractionMode?: 'SKIP';
|
|
170
|
+
/**
|
|
171
|
+
* `CreateEvent`'s own field: `namespaceVariables` are substituted into the
|
|
172
|
+
* memory's `namespaceTemplates` during long-term extraction.
|
|
173
|
+
*/
|
|
174
|
+
extractionConfig?: {
|
|
175
|
+
readonly namespaceVariables: Readonly<Record<string, string>>;
|
|
176
|
+
};
|
|
123
177
|
}): Promise<void>;
|
|
124
178
|
/** One page of the session's events (newest-first is AgentCore's default). */
|
|
125
179
|
listEvents(input: {
|
|
@@ -164,8 +218,14 @@ export interface AgentCoreMemoryRecord {
|
|
|
164
218
|
readonly score?: number;
|
|
165
219
|
/** Which strategy produced the record (semantic, summary, user-preference, …). */
|
|
166
220
|
readonly memoryStrategyId?: string;
|
|
167
|
-
/** The namespace it was found in. */
|
|
221
|
+
/** The namespace it was found in — the first of {@link namespaces}. */
|
|
168
222
|
readonly namespace?: string;
|
|
223
|
+
/**
|
|
224
|
+
* Every namespace the record is filed under, as `RetrieveMemoryRecords`
|
|
225
|
+
* reports them (`MemoryRecordSummary.namespaces`). `search()` keeps a record
|
|
226
|
+
* only when one of these is the namespace it asked for, or lies under it.
|
|
227
|
+
*/
|
|
228
|
+
readonly namespaces?: readonly string[];
|
|
169
229
|
/** When AgentCore created it (unix ms), when reported. */
|
|
170
230
|
readonly createdAt?: number;
|
|
171
231
|
}
|
|
@@ -184,12 +244,21 @@ export interface AgentCoreStoreOptions {
|
|
|
184
244
|
* something like `/strategies/{strategyId}/actors/{actorId}`).
|
|
185
245
|
*
|
|
186
246
|
* A function, because the namespace usually contains the actor: it is handed
|
|
187
|
-
* the resolved AgentCore ids for the identity being searched
|
|
188
|
-
*
|
|
247
|
+
* the resolved AgentCore ids for the identity being searched, the identity
|
|
248
|
+
* itself, and — when the memory binds one (`writeOptions.namespaceScope`) —
|
|
249
|
+
* the SAME namespace scope its writes are filed under, resolved for this
|
|
250
|
+
* identity. Build the namespace from that scope
|
|
251
|
+
* (`({ namespaceScope }) => '/tenants/' + namespaceScope?.tenantid + '/facts'`):
|
|
252
|
+
* a search given a scope is refused unless every one of its values is a
|
|
253
|
+
* path segment of the namespace, so a read cannot leave the tenant its
|
|
254
|
+
* writes were filed under. Default: `/actors/{actorId}/sessions/{sessionId}`
|
|
255
|
+
* — the session's own records.
|
|
189
256
|
*/
|
|
190
257
|
readonly searchNamespace?: (scope: {
|
|
191
258
|
readonly actorId: string;
|
|
192
259
|
readonly sessionId: string;
|
|
260
|
+
readonly identity: MemoryIdentity;
|
|
261
|
+
readonly namespaceScope?: Readonly<Record<string, string>>;
|
|
193
262
|
}) => string;
|
|
194
263
|
/**
|
|
195
264
|
* Restrict `search()` to one extraction strategy (semantic, summary,
|
|
@@ -199,6 +268,27 @@ export interface AgentCoreStoreOptions {
|
|
|
199
268
|
* `minScore` / `k` from {@link SearchOptions} are applied to what comes back.
|
|
200
269
|
*/
|
|
201
270
|
readonly searchStrategyId?: string;
|
|
271
|
+
/**
|
|
272
|
+
* Refuse, by name, every write and search that carries no `namespaceScope`.
|
|
273
|
+
*
|
|
274
|
+
* Set it on a store whose every memory is scoped — a multi-tenant
|
|
275
|
+
* deployment. A memory, a `defineRAG` or a direct call that forgot its scope
|
|
276
|
+
* is then refused, instead of filing or reading under a namespace no tenant
|
|
277
|
+
* owns (a template with an empty variable). Default `false`.
|
|
278
|
+
*/
|
|
279
|
+
readonly requireNamespaceScope?: boolean;
|
|
280
|
+
/**
|
|
281
|
+
* Let a search read the records derived from EVERY principal of a tenant.
|
|
282
|
+
*
|
|
283
|
+
* Off by default: a search for an identity that names a principal is refused
|
|
284
|
+
* unless its namespace holds that identity's `actorId` as path segments —
|
|
285
|
+
* a namespace that stops at the tenant serves one person's extracted facts,
|
|
286
|
+
* preferences and summaries to another. Set it only when the memory's
|
|
287
|
+
* strategies file per tenant ON PURPOSE (knowledge the whole tenant shares).
|
|
288
|
+
* It applies to SCOPED searches only: a search with no scope has no tenant to
|
|
289
|
+
* stay inside, so it must always hold the actor.
|
|
290
|
+
*/
|
|
291
|
+
readonly searchAcrossPrincipals?: boolean;
|
|
202
292
|
/** @internal Test injection — skips the SDK require entirely. */
|
|
203
293
|
readonly _client?: AgentCoreLikeClient;
|
|
204
294
|
/** @internal Test injection — the AWS SDK module (to exercise the real shim with a mock SDK). */
|
|
@@ -245,11 +335,45 @@ export declare class AgentCoreStore implements MemoryStore {
|
|
|
245
335
|
* anything.
|
|
246
336
|
*/
|
|
247
337
|
readonly ranksBy: "server-text";
|
|
338
|
+
/**
|
|
339
|
+
* **Both write options, translated to `CreateEvent`'s own fields:**
|
|
340
|
+
*
|
|
341
|
+
* `extraction: 'skip'` → `extractionMode: 'SKIP'` — the event stays in
|
|
342
|
+
* short-term memory and is excluded from
|
|
343
|
+
* long-term extraction.
|
|
344
|
+
* `namespaceScope` → `extractionConfig: { namespaceVariables }` —
|
|
345
|
+
* substituted into the memory's
|
|
346
|
+
* `namespaceTemplates` during extraction, which
|
|
347
|
+
* is how one tenant's derived records stay in
|
|
348
|
+
* that tenant's namespace.
|
|
349
|
+
*
|
|
350
|
+
* Absent — and both refused by name — when they could not reach AgentCore:
|
|
351
|
+
* an injected client that does not declare `forwardsWriteOptions`, or an
|
|
352
|
+
* installed SDK too old to MODEL the two fields (its serializer would drop
|
|
353
|
+
* them without a word). The variables are checked here against AgentCore's
|
|
354
|
+
* documented domain before anything is sent (see `checkNamespaceVariables`).
|
|
355
|
+
*
|
|
356
|
+
* A getter, not a field: a wrapper built by spreading this store
|
|
357
|
+
* (`{ ...store, put }`) does not copy it — and a wrapper that does not carry
|
|
358
|
+
* the third argument must not carry the declaration either.
|
|
359
|
+
*/
|
|
360
|
+
get writeOptions(): readonly MemoryWriteOptionName[] | undefined;
|
|
248
361
|
private readonly client;
|
|
249
362
|
private readonly memoryId;
|
|
250
363
|
private readonly pageSize;
|
|
251
364
|
private readonly searchNamespace;
|
|
252
365
|
private readonly searchStrategyId;
|
|
366
|
+
private readonly requireNamespaceScope;
|
|
367
|
+
/**
|
|
368
|
+
* Set by the first write or search that carries a scope: from then on this
|
|
369
|
+
* store is a SCOPED store, and a call without one is refused — a second
|
|
370
|
+
* memory, a `defineRAG` or a direct call that forgot its scope never reads
|
|
371
|
+
* or files across the tenants the first one kept apart.
|
|
372
|
+
*/
|
|
373
|
+
private servedScoped;
|
|
374
|
+
private readonly searchAcrossPrincipals;
|
|
375
|
+
/** Why the write options cannot be honoured — `undefined` when they can. */
|
|
376
|
+
private readonly writeOptionsRefusal;
|
|
253
377
|
private closed;
|
|
254
378
|
private readonly signatures;
|
|
255
379
|
private readonly feedbackBag;
|
|
@@ -262,13 +386,28 @@ export declare class AgentCoreStore implements MemoryStore {
|
|
|
262
386
|
/** Walk every event in the session (paginated). */
|
|
263
387
|
private eachEvent;
|
|
264
388
|
get<T = unknown>(identity: MemoryIdentity, id: string): Promise<MemoryEntry<T> | null>;
|
|
265
|
-
put<T = unknown>(identity: MemoryIdentity, entry: MemoryEntry<T
|
|
266
|
-
|
|
389
|
+
put<T = unknown>(identity: MemoryIdentity, entry: MemoryEntry<T>, options?: MemoryWriteOptions): Promise<void>;
|
|
390
|
+
/** One event, with the write options already turned into fields (and checked) once. */
|
|
391
|
+
private createEvent;
|
|
392
|
+
putMany<T = unknown>(identity: MemoryIdentity, entries: readonly MemoryEntry<T>[], options?: MemoryWriteOptions): Promise<void>;
|
|
267
393
|
/**
|
|
268
394
|
* Emulated optimistic concurrency. AgentCore appends unconditionally; we read-then-write
|
|
269
395
|
* inside a JS critical section — adequate for single-writer-per-session deployments.
|
|
270
396
|
*/
|
|
271
|
-
putIfVersion<T = unknown>(identity: MemoryIdentity, entry: MemoryEntry<T>, expectedVersion: number): Promise<PutIfVersionResult>;
|
|
397
|
+
putIfVersion<T = unknown>(identity: MemoryIdentity, entry: MemoryEntry<T>, expectedVersion: number, options?: MemoryWriteOptions): Promise<PutIfVersionResult>;
|
|
398
|
+
/**
|
|
399
|
+
* The namespace one search reads — rendered by `searchNamespace` and refused
|
|
400
|
+
* by name when it could read beyond this identity: a wildcard, a namespace
|
|
401
|
+
* that does not hold the scope segment for segment, or one that stops above
|
|
402
|
+
* this identity's actor while the identity names a principal.
|
|
403
|
+
*/
|
|
404
|
+
private namespaceFor;
|
|
405
|
+
/**
|
|
406
|
+
* The write options as `CreateEvent`'s own fields — or a refusal by name for
|
|
407
|
+
* any this store's client cannot carry. The ONE place the vendor-neutral
|
|
408
|
+
* names become AWS's.
|
|
409
|
+
*/
|
|
410
|
+
private extractionFields;
|
|
272
411
|
list<T = unknown>(identity: MemoryIdentity, options?: ListOptions): Promise<ListResult<T>>;
|
|
273
412
|
delete(identity: MemoryIdentity, id: string): Promise<void>;
|
|
274
413
|
seen(identity: MemoryIdentity, signature: string): Promise<boolean>;
|
|
@@ -299,7 +438,8 @@ export declare class AgentCoreStore implements MemoryStore {
|
|
|
299
438
|
* preferences. The ids therefore belong to AgentCore, not to entries you
|
|
300
439
|
* `put()`, and `store.get(entry.id)` will not find them. They arrive as
|
|
301
440
|
* entries so ranking code needs no special case, with `metadata.source`
|
|
302
|
-
* saying plainly where they came from
|
|
441
|
+
* saying plainly where they came from, and each value is `{ content }` —
|
|
442
|
+
* the record's text where every memory formatter reads it.
|
|
303
443
|
*
|
|
304
444
|
* Filters: `searchStrategyId` and the namespace reach AgentCore's own side;
|
|
305
445
|
* `k`, `minScore` and `tiers` are applied to what comes back.
|
|
@@ -321,4 +461,9 @@ export interface BedrockAgentCoreSdkModule {
|
|
|
321
461
|
readonly ListEventsCommand?: new (input: unknown) => unknown;
|
|
322
462
|
readonly DeleteEventCommand?: new (input: unknown) => unknown;
|
|
323
463
|
readonly RetrieveMemoryRecordsCommand?: new (input: unknown) => unknown;
|
|
464
|
+
/**
|
|
465
|
+
* The SDK's own schema of `CreateEventInput` — read only to learn whether this
|
|
466
|
+
* SDK MODELS the extraction fields (see `sdkModelsExtraction`).
|
|
467
|
+
*/
|
|
468
|
+
readonly CreateEventInput$?: unknown;
|
|
324
469
|
}
|