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
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { identityNamespace } from '../identity/index.js';
|
|
2
2
|
import { cosineSimilarity } from '../embedding/cosine.js';
|
|
3
|
+
import { NO_SERVER_EXTRACTION, refuseUnhonouredWriteOptions, } from './writeOptions.js';
|
|
3
4
|
const DEFAULT_LIST_LIMIT = 100;
|
|
4
5
|
const MAX_LIST_LIMIT = 1000;
|
|
5
6
|
export class InMemoryStore {
|
|
@@ -53,7 +54,12 @@ export class InMemoryStore {
|
|
|
53
54
|
slot.entries.set(id, bumped);
|
|
54
55
|
return bumped;
|
|
55
56
|
}
|
|
56
|
-
|
|
57
|
+
/**
|
|
58
|
+
* Write options: none honoured — a `Map` derives nothing from what it holds,
|
|
59
|
+
* so `extraction` and `namespaceScope` are refused by name, never ignored.
|
|
60
|
+
*/
|
|
61
|
+
async put(identity, entry, options) {
|
|
62
|
+
refuseUnhonouredWriteOptions('InMemoryStore', undefined, options, NO_SERVER_EXTRACTION);
|
|
57
63
|
const slot = this.slot(identity);
|
|
58
64
|
slot.entries.set(entry.id, entry);
|
|
59
65
|
}
|
|
@@ -62,15 +68,18 @@ export class InMemoryStore {
|
|
|
62
68
|
* same Map. Saves N-1 slot lookups vs. calling `put()` in a loop, and
|
|
63
69
|
* gives network-backed adapters a place to pipeline round-trips.
|
|
64
70
|
*/
|
|
65
|
-
async putMany(identity, entries) {
|
|
71
|
+
async putMany(identity, entries, options) {
|
|
72
|
+
// The port's empty-batch law first: an empty batch is a no-op, never a rejection.
|
|
66
73
|
if (entries.length === 0)
|
|
67
74
|
return;
|
|
75
|
+
refuseUnhonouredWriteOptions('InMemoryStore', undefined, options, NO_SERVER_EXTRACTION);
|
|
68
76
|
const slot = this.slot(identity);
|
|
69
77
|
for (const entry of entries) {
|
|
70
78
|
slot.entries.set(entry.id, entry);
|
|
71
79
|
}
|
|
72
80
|
}
|
|
73
|
-
async putIfVersion(identity, entry, expectedVersion) {
|
|
81
|
+
async putIfVersion(identity, entry, expectedVersion, options) {
|
|
82
|
+
refuseUnhonouredWriteOptions('InMemoryStore', undefined, options, NO_SERVER_EXTRACTION);
|
|
74
83
|
const slot = this.slot(identity);
|
|
75
84
|
const existing = slot.entries.get(entry.id);
|
|
76
85
|
// First-write path: expectedVersion === 0 means "I expect no prior entry".
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InMemoryStore.js","sourceRoot":"","sources":["../../../../src/memory/store/InMemoryStore.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"InMemoryStore.js","sourceRoot":"","sources":["../../../../src/memory/store/InMemoryStore.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAAE,gBAAg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E,CAAC,CAAC,CAAC;IAC5B,CAAC;CACF"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export type { MemoryStore, ListOptions, ListResult, MemoryCursor, PutIfVersionResult, SearchOptions, ScoredEntry, } from './types.js';
|
|
2
2
|
export { InMemoryStore } from './InMemoryStore.js';
|
|
3
3
|
export { assertServesVectors, resolveRankingMode } from './capability.js';
|
|
4
|
+
export { MEMORY_WRITE_OPTION_NAMES, NO_SERVER_EXTRACTION, UnsupportedMemoryWriteOptionError, refuseUnhonouredWriteOptions, requestedWriteOptions, type MemoryWriteOptionName, type MemoryNamespaceScope, type MemoryWriteOptions, type MemoryWriteOptionsConfig, } from './writeOptions.js';
|
|
4
5
|
export { staticVectorStore, assertCorpusBundle, bundleEntryToMemoryEntry, CORPUS_BUNDLE_FORMAT, type CorpusBundle, type CorpusBundleEntry, type EmbedderFingerprint, } from './staticVectorStore.js';
|
|
@@ -3,5 +3,10 @@ export { InMemoryStore } from './InMemoryStore.js';
|
|
|
3
3
|
// an adapter author can check their own two declarations agree without waiting
|
|
4
4
|
// for a corpus builder to tell them.
|
|
5
5
|
export { assertServesVectors, resolveRankingMode } from './capability.js';
|
|
6
|
+
// Write options — what a write asks a managed service to do after storing it,
|
|
7
|
+
// in names no vendor owns. A store DECLARES what it honours and refuses the rest
|
|
8
|
+
// by name; `refuseUnhonouredWriteOptions` is exported so a third-party store
|
|
9
|
+
// refuses in the same words.
|
|
10
|
+
export { MEMORY_WRITE_OPTION_NAMES, NO_SERVER_EXTRACTION, UnsupportedMemoryWriteOptionError, refuseUnhonouredWriteOptions, requestedWriteOptions, } from './writeOptions.js';
|
|
6
11
|
export { staticVectorStore, assertCorpusBundle, bundleEntryToMemoryEntry, CORPUS_BUNDLE_FORMAT, } from './staticVectorStore.js';
|
|
7
12
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/memory/store/index.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,+EAA+E;AAC/E,+EAA+E;AAC/E,qCAAqC;AACrC,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC1E,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,wBAAwB,EACxB,oBAAoB,GAIrB,MAAM,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/memory/store/index.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,+EAA+E;AAC/E,+EAA+E;AAC/E,qCAAqC;AACrC,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC1E,8EAA8E;AAC9E,iFAAiF;AACjF,6EAA6E;AAC7E,6BAA6B;AAC7B,OAAO,EACL,yBAAyB,EACzB,oBAAoB,EACpB,iCAAiC,EACjC,4BAA4B,EAC5B,qBAAqB,GAKtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,wBAAwB,EACxB,oBAAoB,GAIrB,MAAM,wBAAwB,CAAC"}
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
*/
|
|
36
36
|
import type { MemoryIdentity } from '../identity/index.js';
|
|
37
37
|
import type { MemoryEntry } from '../entry/index.js';
|
|
38
|
+
import type { MemoryWriteOptionName, MemoryWriteOptions } from './writeOptions.js';
|
|
38
39
|
/** Pagination cursor — opaque string, adapter-specific encoding. */
|
|
39
40
|
export type MemoryCursor = string;
|
|
40
41
|
/** Options for listing entries in a namespace. */
|
|
@@ -100,6 +101,19 @@ export interface SearchOptions {
|
|
|
100
101
|
* whenever you have both, and any store can serve the query.
|
|
101
102
|
*/
|
|
102
103
|
readonly text?: string;
|
|
104
|
+
/**
|
|
105
|
+
* The namespace scope this memory's WRITES are filed under
|
|
106
|
+
* (`MemoryWriteOptions.namespaceScope`), so the read stays inside it.
|
|
107
|
+
*
|
|
108
|
+
* A write option must never let a later read see another tenant's records,
|
|
109
|
+
* so reads follow the same rule as writes: `defineMemory({ writeOptions })`
|
|
110
|
+
* resolves this from the run's identity with the SAME resolver as its
|
|
111
|
+
* writes, and passes it only to a store that declares `'namespaceScope'` in
|
|
112
|
+
* `writeOptions`. A store that receives it reads only within it, or refuses
|
|
113
|
+
* by name. Stores that file nothing by a namespace never receive it — the
|
|
114
|
+
* identity is their boundary.
|
|
115
|
+
*/
|
|
116
|
+
readonly namespaceScope?: Readonly<Record<string, string>>;
|
|
103
117
|
}
|
|
104
118
|
/**
|
|
105
119
|
* A `MemoryEntry` annotated with its similarity score. Returned by
|
|
@@ -184,6 +198,19 @@ export interface MemoryStore {
|
|
|
184
198
|
* `retrieval` are refused under.
|
|
185
199
|
*/
|
|
186
200
|
readonly ranksBy?: 'vector' | 'server-text';
|
|
201
|
+
/**
|
|
202
|
+
* Which {@link MemoryWriteOptions} this store HONOURS — vendor-neutral
|
|
203
|
+
* requests about what a managed service does with a write after storing it
|
|
204
|
+
* (`'extraction'`: keep it out of long-term extraction; `'namespaceScope'`:
|
|
205
|
+
* the namespace its derived records are filed under).
|
|
206
|
+
*
|
|
207
|
+
* **Absent means none**, and every write option a store does not list is
|
|
208
|
+
* refused BY NAME at the call (`refuseUnhonouredWriteOptions`), never
|
|
209
|
+
* ignored: a dropped `namespaceScope` files one tenant's derived records
|
|
210
|
+
* where another's are read, and it looks exactly like working. `defineMemory`
|
|
211
|
+
* reads this before any turn runs.
|
|
212
|
+
*/
|
|
213
|
+
readonly writeOptions?: readonly MemoryWriteOptionName[];
|
|
187
214
|
/**
|
|
188
215
|
* Fetch one entry by id within the given identity's namespace.
|
|
189
216
|
* Returns `null` when the entry doesn't exist OR has expired (TTL).
|
|
@@ -196,8 +223,12 @@ export interface MemoryStore {
|
|
|
196
223
|
/**
|
|
197
224
|
* Unconditional write — overwrites any existing entry with the same id.
|
|
198
225
|
* Prefer `putIfVersion` in multi-writer scenarios.
|
|
226
|
+
*
|
|
227
|
+
* `options` asks a managed service what to do with the entry after storing
|
|
228
|
+
* it; an option the store does not declare in {@link writeOptions} is
|
|
229
|
+
* refused by name, before anything is written.
|
|
199
230
|
*/
|
|
200
|
-
put<T = unknown>(identity: MemoryIdentity, entry: MemoryEntry<T
|
|
231
|
+
put<T = unknown>(identity: MemoryIdentity, entry: MemoryEntry<T>, options?: MemoryWriteOptions): Promise<void>;
|
|
201
232
|
/**
|
|
202
233
|
* Batched unconditional write. Semantically equivalent to N sequential
|
|
203
234
|
* `put()` calls but gives adapters a chance to batch the round-trip.
|
|
@@ -223,17 +254,20 @@ export interface MemoryStore {
|
|
|
223
254
|
* Default implementation for adapters that don't override: sequentially
|
|
224
255
|
* calls `put()` for each entry. Adapters SHOULD override for
|
|
225
256
|
* performance-critical paths.
|
|
257
|
+
*
|
|
258
|
+
* `options` applies to every entry of the batch, under the same rule as
|
|
259
|
+
* `put` — refused by name, before anything is written, when not declared.
|
|
226
260
|
*/
|
|
227
|
-
putMany<T = unknown>(identity: MemoryIdentity, entries: readonly MemoryEntry<T>[]): Promise<void>;
|
|
261
|
+
putMany<T = unknown>(identity: MemoryIdentity, entries: readonly MemoryEntry<T>[], options?: MemoryWriteOptions): Promise<void>;
|
|
228
262
|
/**
|
|
229
263
|
* Optimistic-concurrency write. Writes only if the stored version equals
|
|
230
264
|
* `expectedVersion`, OR if no entry exists at all AND `expectedVersion`
|
|
231
265
|
* is `0` (first-write sentinel).
|
|
232
266
|
*
|
|
233
267
|
* Returns `{ applied: true }` on success, `{ applied: false, currentVersion }`
|
|
234
|
-
* when the caller's assumed version is stale.
|
|
268
|
+
* when the caller's assumed version is stale. `options` as for `put`.
|
|
235
269
|
*/
|
|
236
|
-
putIfVersion<T = unknown>(identity: MemoryIdentity, entry: MemoryEntry<T>, expectedVersion: number): Promise<PutIfVersionResult>;
|
|
270
|
+
putIfVersion<T = unknown>(identity: MemoryIdentity, entry: MemoryEntry<T>, expectedVersion: number, options?: MemoryWriteOptions): Promise<PutIfVersionResult>;
|
|
237
271
|
/**
|
|
238
272
|
* Page through entries in the identity's namespace. Ordered by adapter's
|
|
239
273
|
* choice (usually most-recently-updated first) — consumers that care
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import type { MemoryIdentity } from '../identity/index.js';
|
|
2
|
+
import type { MemoryStore } from './types.js';
|
|
3
|
+
/** What one write asks of the store, beyond keeping the entry. */
|
|
4
|
+
export interface MemoryWriteOptions {
|
|
5
|
+
/**
|
|
6
|
+
* `'skip'` — store the entry, but keep it out of long-term extraction: the
|
|
7
|
+
* service must derive nothing (no fact, summary or preference) from it. It
|
|
8
|
+
* stays readable where it was written (`get`, `list`).
|
|
9
|
+
*/
|
|
10
|
+
readonly extraction?: 'skip';
|
|
11
|
+
/**
|
|
12
|
+
* The values a store substitutes into the namespaces its DERIVED long-term
|
|
13
|
+
* records are filed under — one tenant's scope, typically
|
|
14
|
+
* `{ tenantid: 'acme' }`. Which keys exist is the store's configuration.
|
|
15
|
+
*
|
|
16
|
+
* Keep the mapping from your tenant to these values ONE-TO-ONE: a mapping
|
|
17
|
+
* that lowercases, trims or truncates a tenant id files two tenants' derived
|
|
18
|
+
* records under one namespace. An empty object asks for nothing.
|
|
19
|
+
*/
|
|
20
|
+
readonly namespaceScope?: Readonly<Record<string, string>>;
|
|
21
|
+
}
|
|
22
|
+
/** The name of one write option — what a store declares it honours. */
|
|
23
|
+
export type MemoryWriteOptionName = keyof MemoryWriteOptions;
|
|
24
|
+
/** Every write option, in the order refusals name them. */
|
|
25
|
+
export declare const MEMORY_WRITE_OPTION_NAMES: readonly MemoryWriteOptionName[];
|
|
26
|
+
/**
|
|
27
|
+
* The reason a store with NO server-side extraction gives — the shared
|
|
28
|
+
* sentence, so every such store refuses in the same words, remedy included.
|
|
29
|
+
*/
|
|
30
|
+
export declare const NO_SERVER_EXTRACTION: string;
|
|
31
|
+
/**
|
|
32
|
+
* Thrown when a write asks for an option the store does not honour.
|
|
33
|
+
*
|
|
34
|
+
* Carries the store and the option by name; never a value — a namespace scope
|
|
35
|
+
* names a tenant, and an error message is the one place a tenant id must not
|
|
36
|
+
* travel. The remedy is in the store's own reason.
|
|
37
|
+
*/
|
|
38
|
+
export declare class UnsupportedMemoryWriteOptionError extends Error {
|
|
39
|
+
readonly code: "ERR_UNSUPPORTED_MEMORY_WRITE_OPTION";
|
|
40
|
+
/** The store that refused, e.g. `'InMemoryStore'`. */
|
|
41
|
+
readonly store: string;
|
|
42
|
+
/** The option it cannot honour. */
|
|
43
|
+
readonly option: MemoryWriteOptionName;
|
|
44
|
+
constructor(store: string, option: MemoryWriteOptionName, why: string);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The options this write actually asks for, its values checked.
|
|
48
|
+
*
|
|
49
|
+
* A field that is `undefined` is not asked for; an empty `namespaceScope` asks
|
|
50
|
+
* for nothing either. A value of the wrong shape is a programming error, so it
|
|
51
|
+
* throws a `TypeError` naming the option — and never echoes the value.
|
|
52
|
+
*/
|
|
53
|
+
export declare function requestedWriteOptions(options?: MemoryWriteOptions): MemoryWriteOptionName[];
|
|
54
|
+
/**
|
|
55
|
+
* Refuse, by name, every write option `options` asks for that `honoured` does
|
|
56
|
+
* not contain. Call it first thing in `put`, `putMany` and `putIfVersion` —
|
|
57
|
+
* before anything is written.
|
|
58
|
+
*
|
|
59
|
+
* @param store the store's name, as the refusal should say it
|
|
60
|
+
* @param honoured the store's own declaration (`MemoryStore.writeOptions`)
|
|
61
|
+
* @param options what this write asked for
|
|
62
|
+
* @param why why this store cannot honour what it does not declare, and
|
|
63
|
+
* what to do instead
|
|
64
|
+
* @throws {UnsupportedMemoryWriteOptionError} for the first option not honoured
|
|
65
|
+
*/
|
|
66
|
+
export declare function refuseUnhonouredWriteOptions(store: string, honoured: readonly MemoryWriteOptionName[] | undefined, options: MemoryWriteOptions | undefined, why: string): void;
|
|
67
|
+
/** Write options for every write a memory makes (`defineMemory({ writeOptions })`). */
|
|
68
|
+
export interface MemoryWriteOptionsConfig {
|
|
69
|
+
/** `'skip'` keeps every write of this memory out of long-term extraction. */
|
|
70
|
+
readonly extraction?: 'skip';
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* A memory's namespace scope (`defineMemory({ namespaceScope })`): the scope
|
|
74
|
+
* its writes are filed under AND its reads are confined to.
|
|
75
|
+
*
|
|
76
|
+
* One computed from the run's identity — `(identity) => ({ tenantid: … })`,
|
|
77
|
+
* the multi-tenant shape — or a fixed object, which is right only for a
|
|
78
|
+
* deployment that serves ONE tenant. Keep the function one-to-one (see
|
|
79
|
+
* {@link MemoryWriteOptions.namespaceScope}); a store may ship an encoder into
|
|
80
|
+
* its own alphabet (`agentCoreNamespaceValue` for AgentCore). A scope that
|
|
81
|
+
* comes back empty or malformed refuses the write or the search, never runs it
|
|
82
|
+
* without one.
|
|
83
|
+
*/
|
|
84
|
+
export type MemoryNamespaceScope = Readonly<Record<string, string>> | ((identity: MemoryIdentity) => Readonly<Record<string, string>>);
|
|
85
|
+
/** What `defineMemory` binds to its store: the write options and the scope. */
|
|
86
|
+
export interface BoundMemoryOptions extends MemoryWriteOptionsConfig {
|
|
87
|
+
readonly namespaceScope?: MemoryNamespaceScope;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Refuse a memory's write options or scope at DEFINITION time when its store
|
|
91
|
+
* does not declare them, or when a fixed one is malformed — the first turn
|
|
92
|
+
* should not be where a configuration that can never work is discovered.
|
|
93
|
+
*
|
|
94
|
+
* @throws {UnsupportedMemoryWriteOptionError} naming the store and the option
|
|
95
|
+
* @throws {TypeError} for a malformed option
|
|
96
|
+
*/
|
|
97
|
+
export declare function assertStoreHonours(store: MemoryStore, config: BoundMemoryOptions, caller: string): void;
|
|
98
|
+
/**
|
|
99
|
+
* The store with the memory's write options applied to every write it makes —
|
|
100
|
+
* and its namespace scope applied to every read.
|
|
101
|
+
*
|
|
102
|
+
* Writes (`put`, `putMany`, `putIfVersion`) carry the options. A call's own
|
|
103
|
+
* `extraction` overrides the bound one only where it asks for something (an
|
|
104
|
+
* `undefined` field never erases it). A bound `namespaceScope` is NEVER
|
|
105
|
+
* replaced per call: it comes from the run's identity through the configured
|
|
106
|
+
* resolver and nowhere else, so a call that brings its own is refused.
|
|
107
|
+
*
|
|
108
|
+
* Reads follow the same rule as writes: `search` hands a store that declares
|
|
109
|
+
* `'namespaceScope'` the scope resolved for that identity
|
|
110
|
+
* (`SearchOptions.namespaceScope`), so a store that files derived records by it
|
|
111
|
+
* reads within it. Every other member passes straight through.
|
|
112
|
+
*
|
|
113
|
+
* @throws (as a rejected promise, at a write or a search) a `TypeError` when
|
|
114
|
+
* the scope function returns an empty or malformed scope — refused rather
|
|
115
|
+
* than sent outside every tenant's namespace — or when a call brings its
|
|
116
|
+
* own `namespaceScope` to a memory that binds one.
|
|
117
|
+
*/
|
|
118
|
+
export declare function bindWriteOptions(store: MemoryStore, config: BoundMemoryOptions): MemoryStore;
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
/** Every write option, in the order refusals name them. */
|
|
2
|
+
export const MEMORY_WRITE_OPTION_NAMES = [
|
|
3
|
+
'extraction',
|
|
4
|
+
'namespaceScope',
|
|
5
|
+
];
|
|
6
|
+
/**
|
|
7
|
+
* The reason a store with NO server-side extraction gives — the shared
|
|
8
|
+
* sentence, so every such store refuses in the same words, remedy included.
|
|
9
|
+
*/
|
|
10
|
+
export const NO_SERVER_EXTRACTION = 'it keeps exactly the entries it is given and derives no long-term records from ' +
|
|
11
|
+
'them — there is no extraction to skip and no derived namespace to scope (its ' +
|
|
12
|
+
'tenant boundary is the identity tuple). Leave the option off for this store, or ' +
|
|
13
|
+
'use a store that declares it in `writeOptions`';
|
|
14
|
+
/**
|
|
15
|
+
* Thrown when a write asks for an option the store does not honour.
|
|
16
|
+
*
|
|
17
|
+
* Carries the store and the option by name; never a value — a namespace scope
|
|
18
|
+
* names a tenant, and an error message is the one place a tenant id must not
|
|
19
|
+
* travel. The remedy is in the store's own reason.
|
|
20
|
+
*/
|
|
21
|
+
export class UnsupportedMemoryWriteOptionError extends Error {
|
|
22
|
+
code = 'ERR_UNSUPPORTED_MEMORY_WRITE_OPTION';
|
|
23
|
+
/** The store that refused, e.g. `'InMemoryStore'`. */
|
|
24
|
+
store;
|
|
25
|
+
/** The option it cannot honour. */
|
|
26
|
+
option;
|
|
27
|
+
constructor(store, option, why) {
|
|
28
|
+
super(`[memory] ${store} cannot honour the write option \`${option}\`: ${why}. It is ` +
|
|
29
|
+
'refused rather than ignored — a write that dropped it would look exactly like one ' +
|
|
30
|
+
'that honoured it.');
|
|
31
|
+
this.name = 'UnsupportedMemoryWriteOptionError';
|
|
32
|
+
this.store = store;
|
|
33
|
+
this.option = option;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The options this write actually asks for, its values checked.
|
|
38
|
+
*
|
|
39
|
+
* A field that is `undefined` is not asked for; an empty `namespaceScope` asks
|
|
40
|
+
* for nothing either. A value of the wrong shape is a programming error, so it
|
|
41
|
+
* throws a `TypeError` naming the option — and never echoes the value.
|
|
42
|
+
*/
|
|
43
|
+
export function requestedWriteOptions(options) {
|
|
44
|
+
if (options === undefined || options === null)
|
|
45
|
+
return [];
|
|
46
|
+
const asked = [];
|
|
47
|
+
if (options.extraction !== undefined) {
|
|
48
|
+
assertExtraction(options.extraction);
|
|
49
|
+
asked.push('extraction');
|
|
50
|
+
}
|
|
51
|
+
if (options.namespaceScope !== undefined) {
|
|
52
|
+
assertScopeShape(options.namespaceScope);
|
|
53
|
+
if (Object.keys(options.namespaceScope).length > 0)
|
|
54
|
+
asked.push('namespaceScope');
|
|
55
|
+
}
|
|
56
|
+
return asked;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Refuse, by name, every write option `options` asks for that `honoured` does
|
|
60
|
+
* not contain. Call it first thing in `put`, `putMany` and `putIfVersion` —
|
|
61
|
+
* before anything is written.
|
|
62
|
+
*
|
|
63
|
+
* @param store the store's name, as the refusal should say it
|
|
64
|
+
* @param honoured the store's own declaration (`MemoryStore.writeOptions`)
|
|
65
|
+
* @param options what this write asked for
|
|
66
|
+
* @param why why this store cannot honour what it does not declare, and
|
|
67
|
+
* what to do instead
|
|
68
|
+
* @throws {UnsupportedMemoryWriteOptionError} for the first option not honoured
|
|
69
|
+
*/
|
|
70
|
+
export function refuseUnhonouredWriteOptions(store, honoured, options, why) {
|
|
71
|
+
for (const option of requestedWriteOptions(options)) {
|
|
72
|
+
if (!(honoured ?? []).includes(option)) {
|
|
73
|
+
throw new UnsupportedMemoryWriteOptionError(store, option, why);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Refuse a memory's write options or scope at DEFINITION time when its store
|
|
79
|
+
* does not declare them, or when a fixed one is malformed — the first turn
|
|
80
|
+
* should not be where a configuration that can never work is discovered.
|
|
81
|
+
*
|
|
82
|
+
* @throws {UnsupportedMemoryWriteOptionError} naming the store and the option
|
|
83
|
+
* @throws {TypeError} for a malformed option
|
|
84
|
+
*/
|
|
85
|
+
export function assertStoreHonours(store, config, caller) {
|
|
86
|
+
const asked = [];
|
|
87
|
+
if (config.extraction !== undefined) {
|
|
88
|
+
assertExtraction(config.extraction);
|
|
89
|
+
asked.push('extraction');
|
|
90
|
+
}
|
|
91
|
+
if (config.namespaceScope !== undefined) {
|
|
92
|
+
if (typeof config.namespaceScope !== 'function') {
|
|
93
|
+
assertScopeShape(config.namespaceScope);
|
|
94
|
+
assertNonEmptyScope(config.namespaceScope, caller);
|
|
95
|
+
}
|
|
96
|
+
asked.push('namespaceScope');
|
|
97
|
+
}
|
|
98
|
+
for (const option of asked) {
|
|
99
|
+
if (!(store.writeOptions ?? []).includes(option)) {
|
|
100
|
+
throw new UnsupportedMemoryWriteOptionError(storeName(store), option, `it does not declare \`${option}\` in \`writeOptions\` (checked by ${caller}, before ` +
|
|
101
|
+
'any turn ran). A store that declares it can take it; otherwise leave the option off');
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* The store with the memory's write options applied to every write it makes —
|
|
107
|
+
* and its namespace scope applied to every read.
|
|
108
|
+
*
|
|
109
|
+
* Writes (`put`, `putMany`, `putIfVersion`) carry the options. A call's own
|
|
110
|
+
* `extraction` overrides the bound one only where it asks for something (an
|
|
111
|
+
* `undefined` field never erases it). A bound `namespaceScope` is NEVER
|
|
112
|
+
* replaced per call: it comes from the run's identity through the configured
|
|
113
|
+
* resolver and nowhere else, so a call that brings its own is refused.
|
|
114
|
+
*
|
|
115
|
+
* Reads follow the same rule as writes: `search` hands a store that declares
|
|
116
|
+
* `'namespaceScope'` the scope resolved for that identity
|
|
117
|
+
* (`SearchOptions.namespaceScope`), so a store that files derived records by it
|
|
118
|
+
* reads within it. Every other member passes straight through.
|
|
119
|
+
*
|
|
120
|
+
* @throws (as a rejected promise, at a write or a search) a `TypeError` when
|
|
121
|
+
* the scope function returns an empty or malformed scope — refused rather
|
|
122
|
+
* than sent outside every tenant's namespace — or when a call brings its
|
|
123
|
+
* own `namespaceScope` to a memory that binds one.
|
|
124
|
+
*/
|
|
125
|
+
export function bindWriteOptions(store, config) {
|
|
126
|
+
const scopeIsBound = config.namespaceScope !== undefined;
|
|
127
|
+
const refuseOwnScope = (own) => {
|
|
128
|
+
if (scopeIsBound && own !== undefined && Object.keys(own).length > 0) {
|
|
129
|
+
throw new TypeError('defineMemory: this memory binds `namespaceScope` to the run’s identity, and a call ' +
|
|
130
|
+
'cannot replace it — a scope chosen per ' +
|
|
131
|
+
'call could file or read one tenant’s records under another’s. Change the resolver, ' +
|
|
132
|
+
'not the call.');
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
const resolve = (identity, own) => {
|
|
136
|
+
refuseOwnScope(own?.namespaceScope);
|
|
137
|
+
const scope = boundScope(config, identity);
|
|
138
|
+
const ownScope = own?.namespaceScope;
|
|
139
|
+
return {
|
|
140
|
+
...(config.extraction !== undefined && { extraction: config.extraction }),
|
|
141
|
+
...(scope !== undefined && { namespaceScope: scope }),
|
|
142
|
+
...(own?.extraction !== undefined && { extraction: own.extraction }),
|
|
143
|
+
// Only reachable when nothing is bound: the store checks it like any write.
|
|
144
|
+
...(ownScope !== undefined &&
|
|
145
|
+
Object.keys(ownScope).length > 0 && { namespaceScope: ownScope }),
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
// Reads carry the scope only to a store that files by it — the same store
|
|
149
|
+
// `assertStoreHonours` let the scope be bound to.
|
|
150
|
+
const readsByScope = scopeIsBound && (store.writeOptions ?? []).includes('namespaceScope');
|
|
151
|
+
const readOptions = (identity, options) => {
|
|
152
|
+
refuseOwnScope(options?.namespaceScope);
|
|
153
|
+
if (!readsByScope)
|
|
154
|
+
return options;
|
|
155
|
+
const scope = boundScope(config, identity, 'this search');
|
|
156
|
+
return scope === undefined ? options : { ...options, namespaceScope: scope };
|
|
157
|
+
};
|
|
158
|
+
const bound = {
|
|
159
|
+
...(store.supportsVectorSearch !== undefined && {
|
|
160
|
+
supportsVectorSearch: store.supportsVectorSearch,
|
|
161
|
+
}),
|
|
162
|
+
...(store.ranksBy !== undefined && { ranksBy: store.ranksBy }),
|
|
163
|
+
...(store.writeOptions !== undefined && { writeOptions: store.writeOptions }),
|
|
164
|
+
get: (identity, id) => store.get(identity, id),
|
|
165
|
+
// `async`, so a refused scope is a rejected promise, as the port promises —
|
|
166
|
+
// never a synchronous throw from a method the caller awaits.
|
|
167
|
+
put: async (identity, entry, own) => store.put(identity, entry, resolve(identity, own)),
|
|
168
|
+
putMany: async (identity, entries, own) =>
|
|
169
|
+
// The port's empty-batch law: no write, so nothing to resolve or refuse.
|
|
170
|
+
entries.length === 0
|
|
171
|
+
? store.putMany(identity, entries)
|
|
172
|
+
: store.putMany(identity, entries, resolve(identity, own)),
|
|
173
|
+
putIfVersion: async (identity, entry, expectedVersion, own) => store.putIfVersion(identity, entry, expectedVersion, resolve(identity, own)),
|
|
174
|
+
list: (identity, options) => store.list(identity, options),
|
|
175
|
+
delete: (identity, id) => store.delete(identity, id),
|
|
176
|
+
seen: (identity, signature) => store.seen(identity, signature),
|
|
177
|
+
recordSignature: (identity, signature) => store.recordSignature(identity, signature),
|
|
178
|
+
feedback: (identity, id, usefulness) => store.feedback(identity, id, usefulness),
|
|
179
|
+
getFeedback: (identity, id) => store.getFeedback(identity, id),
|
|
180
|
+
forget: (identity) => store.forget(identity),
|
|
181
|
+
// Present exactly when the store's is: `if (store.search)` is how callers
|
|
182
|
+
// feature-detect it, so the bound store must not grow or lose one.
|
|
183
|
+
...(store.search !== undefined && {
|
|
184
|
+
search: async (identity, query, options) => store.search(identity, query, readOptions(identity, options)),
|
|
185
|
+
}),
|
|
186
|
+
};
|
|
187
|
+
return bound;
|
|
188
|
+
}
|
|
189
|
+
// ── Checks ─────────────────────────────────────────────────────────────
|
|
190
|
+
/** The configured scope for this identity — present, plain, non-empty, or refused. */
|
|
191
|
+
function boundScope(config, identity, what = 'this write') {
|
|
192
|
+
if (config.namespaceScope === undefined)
|
|
193
|
+
return undefined;
|
|
194
|
+
const scope = typeof config.namespaceScope === 'function'
|
|
195
|
+
? config.namespaceScope(identity)
|
|
196
|
+
: config.namespaceScope;
|
|
197
|
+
assertScopeShape(scope);
|
|
198
|
+
// Copy FIRST, then check the copy: the values checked are the values every
|
|
199
|
+
// store sees — whatever the resolver's object does afterwards, or does on a
|
|
200
|
+
// second read (a getter, a Proxy that reports one value and returns another).
|
|
201
|
+
const copy = Object.freeze({ ...scope });
|
|
202
|
+
assertScopeShape(copy);
|
|
203
|
+
assertNonEmptyScope(copy, what);
|
|
204
|
+
return copy;
|
|
205
|
+
}
|
|
206
|
+
function assertExtraction(value) {
|
|
207
|
+
if (value !== 'skip') {
|
|
208
|
+
throw new TypeError("[memory] the write option `extraction` takes one value, 'skip' — got " +
|
|
209
|
+
`${typeof value === 'string' ? JSON.stringify(value) : typeof value}.`);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
function assertScopeShape(value) {
|
|
213
|
+
if (!isStringRecord(value)) {
|
|
214
|
+
throw new TypeError('[memory] the write option `namespaceScope` must be a plain object of string values ' +
|
|
215
|
+
'(variable name → value). The value given is not quoted here: it names a tenant.');
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
function assertNonEmptyScope(scope, where) {
|
|
219
|
+
if (Object.keys(scope).length === 0) {
|
|
220
|
+
throw new TypeError(`[memory] the memory's \`namespaceScope\` came back EMPTY for ${where}. It is refused ` +
|
|
221
|
+
'rather than run without one: a write with no scope files its derived records outside ' +
|
|
222
|
+
'every tenant’s namespace, and a search with none is confined to no tenant. Return the ' +
|
|
223
|
+
'scope for every identity, or refuse the identity yourself.');
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
/** The store's own name for a refusal — its class, or what the caller holds. */
|
|
227
|
+
function storeName(store) {
|
|
228
|
+
const ctor = store.constructor?.name;
|
|
229
|
+
return ctor !== undefined && ctor !== 'Object' && ctor !== '' ? ctor : 'the store you passed';
|
|
230
|
+
}
|
|
231
|
+
/** A PLAIN object (no class, no Map, no Promise) whose own values are all strings. */
|
|
232
|
+
function isStringRecord(value) {
|
|
233
|
+
if (value === null || typeof value !== 'object' || Array.isArray(value))
|
|
234
|
+
return false;
|
|
235
|
+
const proto = Object.getPrototypeOf(value);
|
|
236
|
+
if (proto !== Object.prototype && proto !== null)
|
|
237
|
+
return false;
|
|
238
|
+
// Data properties only: a getter could answer the check one value and the
|
|
239
|
+
// store another.
|
|
240
|
+
return Object.values(Object.getOwnPropertyDescriptors(value)).every((d) => 'value' in d && typeof d.value === 'string');
|
|
241
|
+
}
|
|
242
|
+
//# sourceMappingURL=writeOptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writeOptions.js","sourceRoot":"","sources":["../../../../src/memory/store/writeOptions.ts"],"names":[],"mappings":"AAgEA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,KAAK,QAAQ,CACnD,CAAC;AACJ,CAAC"}
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* symbols, one door. Import from the door.
|
|
22
22
|
*/
|
|
23
23
|
export { RedisStore, type RedisStoreOptions, type RedisLikeClient, type RedisLikePipeline, } from './adapters/memory/redis.js';
|
|
24
|
-
export { AgentCoreStore, UnreadableMemoryEntryError, type AgentCoreStoreOptions, type AgentCoreLikeClient, type AgentCoreEvent, type AgentCoreMemoryRecord, } from './adapters/memory/agentcore.js';
|
|
24
|
+
export { AgentCoreStore, UnreadableMemoryEntryError, agentCoreNamespaceValue, type AgentCoreStoreOptions, type AgentCoreLikeClient, type AgentCoreEvent, type AgentCoreMemoryRecord, } from './adapters/memory/agentcore.js';
|
|
25
25
|
export { memoryBankStore, MemoryBankStore, MAX_PAGE_SIZE, MAX_CARRIED_JSON, scoreFromDistance, type MemoryBankStoreOptions, type MemoryScope, } from './adapters/memory/memoryBank.js';
|
|
26
26
|
export { sqliteVectorStore, UnreadableIndexFileError, type SqliteVectorStore, type SqliteVectorStoreOptions, type SqliteVectorDatabaseLike, type SqliteVectorStatementLike, type SqliteVectorModuleLike, } from './adapters/memory/sqliteVector.js';
|
|
27
27
|
export { SqliteUnavailableError } from './lib/sqliteUnavailable.js';
|
|
@@ -24,7 +24,10 @@
|
|
|
24
24
|
// `require()` to constructor time; importing this barrel doesn't load
|
|
25
25
|
// `ioredis` or `@aws-sdk/client-bedrock-agent-runtime`.
|
|
26
26
|
export { RedisStore, } from './adapters/memory/redis.js';
|
|
27
|
-
export { AgentCoreStore, UnreadableMemoryEntryError,
|
|
27
|
+
export { AgentCoreStore, UnreadableMemoryEntryError,
|
|
28
|
+
// A tenant id in the alphabet AgentCore admits for a namespace variable,
|
|
29
|
+
// one-to-one — what `defineMemory({ namespaceScope })` and `searchNamespace` map with.
|
|
30
|
+
agentCoreNamespaceValue, } from './adapters/memory/agentcore.js';
|
|
28
31
|
// Vertex AI Memory Bank — a NATURAL-LANGUAGE memory service, not a vector
|
|
29
32
|
// store: it declares `supportsVectorSearch: false` and `ranksBy: 'server-text'`
|
|
30
33
|
// so the corpus builders refuse it by name, and it converts the service's
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory-providers.js","sourceRoot":"","sources":["../../src/memory-providers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,sEAAsE;AACtE,sEAAsE;AACtE,wDAAwD;AACxD,OAAO,EACL,UAAU,GAIX,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,cAAc,EACd,0BAA0B,
|
|
1
|
+
{"version":3,"file":"memory-providers.js","sourceRoot":"","sources":["../../src/memory-providers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,sEAAsE;AACtE,sEAAsE;AACtE,wDAAwD;AACxD,OAAO,EACL,UAAU,GAIX,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,cAAc,EACd,0BAA0B;AAC1B,yEAAyE;AACzE,uFAAuF;AACvF,uBAAuB,GAKxB,MAAM,gCAAgC,CAAC;AAExC,0EAA0E;AAC1E,gFAAgF;AAChF,0EAA0E;AAC1E,yEAAyE;AACzE,gFAAgF;AAChF,wEAAwE;AACxE,+EAA+E;AAC/E,4DAA4D;AAC5D,OAAO,EACL,eAAe,EACf,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,iBAAiB,GAGlB,MAAM,iCAAiC,CAAC;AAEzC,gFAAgF;AAChF,gFAAgF;AAChF,8EAA8E;AAC9E,mDAAmD;AACnD,OAAO,EACL,iBAAiB,EACjB,wBAAwB,GAMzB,MAAM,mCAAmC,CAAC;AAE3C,6EAA6E;AAC7E,8EAA8E;AAC9E,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAEpE,6EAA6E;AAC7E,2EAA2E;AAC3E,+EAA+E;AAC/E,2EAA2E;AAC3E,sDAAsD;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAElE,gFAAgF;AAChF,+EAA+E;AAC/E,+DAA+D;AAC/D,OAAO,EACL,aAAa,EACb,mBAAmB,GAOpB,MAAM,+BAA+B,CAAC;AAEvC,gFAAgF;AAChF,gEAAgE;AAChE,iDAAiD;AACjD,OAAO,EACL,cAAc,GAKf,MAAM,gCAAgC,CAAC;AAExC,8EAA8E;AAC9E,yEAAyE;AACzE,OAAO,EACL,kBAAkB,GAInB,MAAM,yCAAyC,CAAC"}
|
|
@@ -23,6 +23,7 @@ import { RunnerBase } from '../core/RunnerBase.js';
|
|
|
23
23
|
import { Parallel } from '../core-flow/Parallel.js';
|
|
24
24
|
import { Sequence } from '../core-flow/Sequence.js';
|
|
25
25
|
import { adoptMemberRedaction, redactionDeclaredBy } from '../redaction/declared.js';
|
|
26
|
+
import { adoptParentRun, parentRunIn, readsParentRun, withParentRun } from '../core/memberRun.js';
|
|
26
27
|
const SHARD_DELIMITER = '\u001F'; // ASCII Unit Separator — unlikely in real text.
|
|
27
28
|
/**
|
|
28
29
|
* Build a MapReduce Runner. At run time:
|
|
@@ -130,21 +131,26 @@ class ShardBranchRunner extends RunnerBase {
|
|
|
130
131
|
// The wrapped runner's redaction policy travels with the shard, so the
|
|
131
132
|
// `Parallel` that fans the shards out covers it (`src/redaction/declared.ts`).
|
|
132
133
|
adoptMemberRedaction(this, [inner]);
|
|
134
|
+
// It hands the run it serves on to the wrapped runner (`core/memberRun.ts`).
|
|
135
|
+
readsParentRun(this);
|
|
133
136
|
}
|
|
134
137
|
getSpec() {
|
|
135
138
|
// Build a wrapper chart that unpacks the shard and invokes the
|
|
136
139
|
// inner chart. The inner LLMCall's chart runs as a subflow whose
|
|
137
140
|
// input is the extracted shard.
|
|
138
141
|
const shardIndex = this.shardIndex;
|
|
139
|
-
const
|
|
142
|
+
const inner = this.inner;
|
|
143
|
+
const innerChart = inner.getSpec();
|
|
140
144
|
return flowChart('Unpack', (scope) => {
|
|
141
145
|
const args = scope.$getArgs();
|
|
142
146
|
const parts = (args.message ?? '').split(SHARD_DELIMITER);
|
|
143
147
|
scope.shard = parts[shardIndex] ?? '';
|
|
144
148
|
scope.result = '';
|
|
149
|
+
// The run the shard serves, handed on to the wrapped runner (`core/memberRun.ts`).
|
|
150
|
+
adoptParentRun(scope, args, 'mapReduce shard');
|
|
145
151
|
}, 'unpack')
|
|
146
152
|
.addSubFlowChartNext('inner', innerChart, 'InnerCall', {
|
|
147
|
-
inputMapper: (parent) => ({ message: parent.shard ?? '' }),
|
|
153
|
+
inputMapper: (parent) => withParentRun({ message: parent.shard ?? '' }, parentRunIn(parent), inner),
|
|
148
154
|
outputMapper: (sfOutput) => ({
|
|
149
155
|
result: typeof sfOutput === 'string' ? sfOutput : '',
|
|
150
156
|
}),
|