agentfootprint 9.136.0 → 9.138.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 +1 -1
- package/CAPABILITIES.md +5 -0
- package/ai-instructions/claude-code/SKILL.md +1 -1
- package/dist/adapters/llm/AnthropicProvider.js +10 -2
- package/dist/adapters/llm/AnthropicProvider.js.map +1 -1
- package/dist/adapters/llm/BrowserAnthropicProvider.js +8 -0
- package/dist/adapters/llm/BrowserAnthropicProvider.js.map +1 -1
- package/dist/adapters/llm/BrowserOpenAIProvider.js +30 -0
- package/dist/adapters/llm/BrowserOpenAIProvider.js.map +1 -1
- package/dist/adapters/llm/FoundryProvider.js +2 -0
- package/dist/adapters/llm/FoundryProvider.js.map +1 -1
- package/dist/adapters/llm/InvokeModelGatewayProvider.js +16 -0
- package/dist/adapters/llm/InvokeModelGatewayProvider.js.map +1 -1
- package/dist/adapters/llm/MockProvider.js +3 -0
- package/dist/adapters/llm/MockProvider.js.map +1 -1
- package/dist/adapters/llm/OllamaProvider.js +7 -0
- package/dist/adapters/llm/OllamaProvider.js.map +1 -1
- package/dist/adapters/llm/OpenAIProvider.js +25 -0
- package/dist/adapters/llm/OpenAIProvider.js.map +1 -1
- package/dist/adapters/llm/anthropicCacheWire.js +32 -10
- package/dist/adapters/llm/anthropicCacheWire.js.map +1 -1
- package/dist/adapters/llm/anthropicMessagesWire.js +12 -11
- package/dist/adapters/llm/anthropicMessagesWire.js.map +1 -1
- package/dist/adapters/types.js.map +1 -1
- package/dist/bridge/eventMeta.js +5 -1
- package/dist/bridge/eventMeta.js.map +1 -1
- package/dist/bridge/eventSourcePosition.js +63 -0
- package/dist/bridge/eventSourcePosition.js.map +1 -0
- package/dist/cache/CacheDecisionSubflow.js +79 -21
- package/dist/cache/CacheDecisionSubflow.js.map +1 -1
- package/dist/cache/cacheStrategyFor.js +77 -0
- package/dist/cache/cacheStrategyFor.js.map +1 -0
- package/dist/cache/index.js +26 -38
- package/dist/cache/index.js.map +1 -1
- package/dist/cache/strategies/AutomaticCacheStrategy.js +47 -0
- package/dist/cache/strategies/AutomaticCacheStrategy.js.map +1 -0
- package/dist/cache/strategies/BreakpointCacheStrategy.js +60 -0
- package/dist/cache/strategies/BreakpointCacheStrategy.js.map +1 -0
- package/dist/cache/strategies/NoOpCacheStrategy.js +9 -25
- package/dist/cache/strategies/NoOpCacheStrategy.js.map +1 -1
- package/dist/cache/types.js +5 -4
- package/dist/cache/types.js.map +1 -1
- package/dist/core/Agent.js +209 -146
- package/dist/core/Agent.js.map +1 -1
- package/dist/core/LLMCall.js +14 -17
- package/dist/core/LLMCall.js.map +1 -1
- package/dist/core/RunnerBase.js +17 -1
- package/dist/core/RunnerBase.js.map +1 -1
- package/dist/core/agent/AgentBuilder.js +24 -33
- package/dist/core/agent/AgentBuilder.js.map +1 -1
- package/dist/core/agent/act.js +3 -19
- package/dist/core/agent/act.js.map +1 -1
- package/dist/core/agent/assessment/stage.js +8 -0
- package/dist/core/agent/assessment/stage.js.map +1 -1
- package/dist/core/agent/buildAgentChart.js +8 -9
- package/dist/core/agent/buildAgentChart.js.map +1 -1
- package/dist/core/agent/buildCacheSubflow.js +4 -3
- package/dist/core/agent/buildCacheSubflow.js.map +1 -1
- package/dist/core/agent/buildDynamicAgentChart.js +16 -8
- package/dist/core/agent/buildDynamicAgentChart.js.map +1 -1
- package/dist/core/agent/honesty/mounts.js.map +1 -1
- package/dist/core/agent/middleware/ledger.js +1 -1
- package/dist/core/agent/middleware/messagePhase.js +24 -0
- package/dist/core/agent/middleware/messagePhase.js.map +1 -0
- package/dist/core/agent/skillBrains.js +3 -3
- package/dist/core/agent/skillBrains.js.map +1 -1
- package/dist/core/agent/stages/answerValidation.js +6 -3
- package/dist/core/agent/stages/answerValidation.js.map +1 -1
- package/dist/core/agent/stages/breakFinal.js +30 -1
- package/dist/core/agent/stages/breakFinal.js.map +1 -1
- package/dist/core/agent/stages/callLLM.js +15 -9
- package/dist/core/agent/stages/callLLM.js.map +1 -1
- package/dist/core/agent/stages/outputAdmission.js +14 -0
- package/dist/core/agent/stages/outputAdmission.js.map +1 -0
- package/dist/core/agent/stages/prepareFinal.js +96 -27
- package/dist/core/agent/stages/prepareFinal.js.map +1 -1
- package/dist/core/agent/stages/reliabilityExecution.js +46 -7
- package/dist/core/agent/stages/reliabilityExecution.js.map +1 -1
- package/dist/core/agent/stages/seed.js +8 -10
- package/dist/core/agent/stages/seed.js.map +1 -1
- package/dist/core/agent/stages/toolCalls.js +63 -42
- package/dist/core/agent/stages/toolCalls.js.map +1 -1
- package/dist/core/agent/toolArgsValidation.js +35 -11
- package/dist/core/agent/toolArgsValidation.js.map +1 -1
- package/dist/core/agent/toolDispatch.js +8 -2
- package/dist/core/agent/toolDispatch.js.map +1 -1
- package/dist/core/agent/toolSecurityEvents.js +23 -0
- package/dist/core/agent/toolSecurityEvents.js.map +1 -0
- package/dist/core/codeRunnerTool.js +1 -0
- package/dist/core/codeRunnerTool.js.map +1 -1
- package/dist/core/conversation.js +21 -6
- package/dist/core/conversation.js.map +1 -1
- package/dist/core/slots/buildThinkingSubflow.js +2 -3
- package/dist/core/slots/buildThinkingSubflow.js.map +1 -1
- package/dist/core/terminalVerdict.js +48 -0
- package/dist/core/terminalVerdict.js.map +1 -0
- package/dist/core-flow/Conditional.js +14 -5
- package/dist/core-flow/Conditional.js.map +1 -1
- package/dist/core-flow/Graph.js +20 -3
- package/dist/core-flow/Graph.js.map +1 -1
- package/dist/core-flow/Loop.js +13 -6
- package/dist/core-flow/Loop.js.map +1 -1
- package/dist/core-flow/Parallel.js +16 -7
- package/dist/core-flow/Parallel.js.map +1 -1
- package/dist/core-flow/Sequence.js +16 -5
- package/dist/core-flow/Sequence.js.map +1 -1
- package/dist/core-flow/Workflow.js +20 -3
- package/dist/core-flow/Workflow.js.map +1 -1
- package/dist/core-flow/childOutcome.js +64 -0
- package/dist/core-flow/childOutcome.js.map +1 -0
- package/dist/esm/adapters/llm/AnthropicProvider.d.ts +3 -1
- package/dist/esm/adapters/llm/AnthropicProvider.js +11 -3
- package/dist/esm/adapters/llm/AnthropicProvider.js.map +1 -1
- package/dist/esm/adapters/llm/BrowserAnthropicProvider.d.ts +2 -0
- package/dist/esm/adapters/llm/BrowserAnthropicProvider.js +8 -0
- package/dist/esm/adapters/llm/BrowserAnthropicProvider.js.map +1 -1
- package/dist/esm/adapters/llm/BrowserOpenAIProvider.d.ts +8 -0
- package/dist/esm/adapters/llm/BrowserOpenAIProvider.js +30 -0
- package/dist/esm/adapters/llm/BrowserOpenAIProvider.js.map +1 -1
- package/dist/esm/adapters/llm/FoundryProvider.js +2 -0
- package/dist/esm/adapters/llm/FoundryProvider.js.map +1 -1
- package/dist/esm/adapters/llm/InvokeModelGatewayProvider.d.ts +1 -0
- package/dist/esm/adapters/llm/InvokeModelGatewayProvider.js +16 -0
- package/dist/esm/adapters/llm/InvokeModelGatewayProvider.js.map +1 -1
- package/dist/esm/adapters/llm/MockProvider.d.ts +2 -0
- package/dist/esm/adapters/llm/MockProvider.js +3 -0
- package/dist/esm/adapters/llm/MockProvider.js.map +1 -1
- package/dist/esm/adapters/llm/OllamaProvider.d.ts +1 -0
- package/dist/esm/adapters/llm/OllamaProvider.js +7 -0
- package/dist/esm/adapters/llm/OllamaProvider.js.map +1 -1
- package/dist/esm/adapters/llm/OpenAIProvider.d.ts +5 -0
- package/dist/esm/adapters/llm/OpenAIProvider.js +25 -0
- package/dist/esm/adapters/llm/OpenAIProvider.js.map +1 -1
- package/dist/esm/adapters/llm/anthropicCacheWire.d.ts +27 -9
- package/dist/esm/adapters/llm/anthropicCacheWire.js +31 -9
- package/dist/esm/adapters/llm/anthropicCacheWire.js.map +1 -1
- package/dist/esm/adapters/llm/anthropicMessagesWire.d.ts +1 -1
- package/dist/esm/adapters/llm/anthropicMessagesWire.js +12 -11
- package/dist/esm/adapters/llm/anthropicMessagesWire.js.map +1 -1
- package/dist/esm/adapters/types.d.ts +13 -0
- package/dist/esm/adapters/types.js.map +1 -1
- package/dist/esm/bridge/eventMeta.d.ts +5 -1
- package/dist/esm/bridge/eventMeta.js +5 -1
- package/dist/esm/bridge/eventMeta.js.map +1 -1
- package/dist/esm/bridge/eventSourcePosition.d.ts +10 -0
- package/dist/esm/bridge/eventSourcePosition.js +59 -0
- package/dist/esm/bridge/eventSourcePosition.js.map +1 -0
- package/dist/esm/cache/CacheDecisionSubflow.d.ts +44 -8
- package/dist/esm/cache/CacheDecisionSubflow.js +77 -19
- package/dist/esm/cache/CacheDecisionSubflow.js.map +1 -1
- package/dist/esm/cache/cacheStrategyFor.d.ts +42 -0
- package/dist/esm/cache/cacheStrategyFor.js +73 -0
- package/dist/esm/cache/cacheStrategyFor.js.map +1 -0
- package/dist/esm/cache/index.d.ts +20 -29
- package/dist/esm/cache/index.js +22 -31
- package/dist/esm/cache/index.js.map +1 -1
- package/dist/esm/cache/strategies/AutomaticCacheStrategy.d.ts +37 -0
- package/dist/esm/cache/strategies/AutomaticCacheStrategy.js +43 -0
- package/dist/esm/cache/strategies/AutomaticCacheStrategy.js.map +1 -0
- package/dist/esm/cache/strategies/BreakpointCacheStrategy.d.ts +40 -0
- package/dist/esm/cache/strategies/BreakpointCacheStrategy.js +56 -0
- package/dist/esm/cache/strategies/BreakpointCacheStrategy.js.map +1 -0
- package/dist/esm/cache/strategies/NoOpCacheStrategy.d.ts +8 -18
- package/dist/esm/cache/strategies/NoOpCacheStrategy.js +9 -25
- package/dist/esm/cache/strategies/NoOpCacheStrategy.js.map +1 -1
- package/dist/esm/cache/types.d.ts +79 -78
- package/dist/esm/cache/types.js +5 -4
- package/dist/esm/cache/types.js.map +1 -1
- package/dist/esm/core/Agent.d.ts +36 -10
- package/dist/esm/core/Agent.js +210 -147
- package/dist/esm/core/Agent.js.map +1 -1
- package/dist/esm/core/LLMCall.d.ts +3 -4
- package/dist/esm/core/LLMCall.js +15 -18
- package/dist/esm/core/LLMCall.js.map +1 -1
- package/dist/esm/core/RunnerBase.d.ts +11 -0
- package/dist/esm/core/RunnerBase.js +15 -0
- package/dist/esm/core/RunnerBase.js.map +1 -1
- package/dist/esm/core/agent/AgentBuilder.d.ts +24 -33
- package/dist/esm/core/agent/AgentBuilder.js +24 -33
- package/dist/esm/core/agent/AgentBuilder.js.map +1 -1
- package/dist/esm/core/agent/act.d.ts +5 -2
- package/dist/esm/core/agent/act.js +3 -19
- package/dist/esm/core/agent/act.js.map +1 -1
- package/dist/esm/core/agent/assessment/stage.d.ts +2 -0
- package/dist/esm/core/agent/assessment/stage.js +8 -0
- package/dist/esm/core/agent/assessment/stage.js.map +1 -1
- package/dist/esm/core/agent/buildAgentChart.d.ts +5 -1
- package/dist/esm/core/agent/buildAgentChart.js +9 -10
- package/dist/esm/core/agent/buildAgentChart.js.map +1 -1
- package/dist/esm/core/agent/buildCacheSubflow.d.ts +4 -2
- package/dist/esm/core/agent/buildCacheSubflow.js +5 -4
- package/dist/esm/core/agent/buildCacheSubflow.js.map +1 -1
- package/dist/esm/core/agent/buildDynamicAgentChart.js +17 -9
- package/dist/esm/core/agent/buildDynamicAgentChart.js.map +1 -1
- package/dist/esm/core/agent/honesty/mounts.d.ts +2 -0
- package/dist/esm/core/agent/honesty/mounts.js.map +1 -1
- package/dist/esm/core/agent/middleware/ledger.d.ts +1 -1
- package/dist/esm/core/agent/middleware/ledger.js +1 -1
- package/dist/esm/core/agent/middleware/messagePhase.d.ts +5 -0
- package/dist/esm/core/agent/middleware/messagePhase.js +19 -0
- package/dist/esm/core/agent/middleware/messagePhase.js.map +1 -0
- package/dist/esm/core/agent/skillBrains.d.ts +5 -3
- package/dist/esm/core/agent/skillBrains.js +3 -3
- package/dist/esm/core/agent/skillBrains.js.map +1 -1
- package/dist/esm/core/agent/stages/answerValidation.d.ts +6 -1
- package/dist/esm/core/agent/stages/answerValidation.js +6 -3
- package/dist/esm/core/agent/stages/answerValidation.js.map +1 -1
- package/dist/esm/core/agent/stages/breakFinal.d.ts +16 -0
- package/dist/esm/core/agent/stages/breakFinal.js +27 -0
- package/dist/esm/core/agent/stages/breakFinal.js.map +1 -1
- package/dist/esm/core/agent/stages/callLLM.d.ts +3 -1
- package/dist/esm/core/agent/stages/callLLM.js +15 -9
- package/dist/esm/core/agent/stages/callLLM.js.map +1 -1
- package/dist/esm/core/agent/stages/outputAdmission.d.ts +6 -0
- package/dist/esm/core/agent/stages/outputAdmission.js +10 -0
- package/dist/esm/core/agent/stages/outputAdmission.js.map +1 -0
- package/dist/esm/core/agent/stages/prepareFinal.d.ts +18 -41
- package/dist/esm/core/agent/stages/prepareFinal.js +93 -25
- package/dist/esm/core/agent/stages/prepareFinal.js.map +1 -1
- package/dist/esm/core/agent/stages/reliabilityExecution.d.ts +8 -1
- package/dist/esm/core/agent/stages/reliabilityExecution.js +46 -7
- package/dist/esm/core/agent/stages/reliabilityExecution.js.map +1 -1
- package/dist/esm/core/agent/stages/seed.js +8 -10
- package/dist/esm/core/agent/stages/seed.js.map +1 -1
- package/dist/esm/core/agent/stages/toolCalls.js +63 -42
- package/dist/esm/core/agent/stages/toolCalls.js.map +1 -1
- package/dist/esm/core/agent/toolArgsValidation.d.ts +9 -5
- package/dist/esm/core/agent/toolArgsValidation.js +35 -11
- package/dist/esm/core/agent/toolArgsValidation.js.map +1 -1
- package/dist/esm/core/agent/toolDispatch.d.ts +3 -2
- package/dist/esm/core/agent/toolDispatch.js +8 -2
- package/dist/esm/core/agent/toolDispatch.js.map +1 -1
- package/dist/esm/core/agent/toolSecurityEvents.d.ts +18 -0
- package/dist/esm/core/agent/toolSecurityEvents.js +19 -0
- package/dist/esm/core/agent/toolSecurityEvents.js.map +1 -0
- package/dist/esm/core/agent/types.d.ts +4 -4
- package/dist/esm/core/codeRunnerTool.js +1 -0
- package/dist/esm/core/codeRunnerTool.js.map +1 -1
- package/dist/esm/core/conversation.d.ts +16 -1
- package/dist/esm/core/conversation.js +20 -5
- package/dist/esm/core/conversation.js.map +1 -1
- package/dist/esm/core/slots/buildThinkingSubflow.d.ts +2 -2
- package/dist/esm/core/slots/buildThinkingSubflow.js +2 -3
- package/dist/esm/core/slots/buildThinkingSubflow.js.map +1 -1
- package/dist/esm/core/terminalVerdict.d.ts +56 -0
- package/dist/esm/core/terminalVerdict.js +43 -0
- package/dist/esm/core/terminalVerdict.js.map +1 -0
- package/dist/esm/core-flow/Conditional.js +15 -6
- package/dist/esm/core-flow/Conditional.js.map +1 -1
- package/dist/esm/core-flow/Graph.js +21 -4
- package/dist/esm/core-flow/Graph.js.map +1 -1
- package/dist/esm/core-flow/Loop.js +14 -7
- package/dist/esm/core-flow/Loop.js.map +1 -1
- package/dist/esm/core-flow/Parallel.js +17 -8
- package/dist/esm/core-flow/Parallel.js.map +1 -1
- package/dist/esm/core-flow/Sequence.js +17 -6
- package/dist/esm/core-flow/Sequence.js.map +1 -1
- package/dist/esm/core-flow/Workflow.js +21 -4
- package/dist/esm/core-flow/Workflow.js.map +1 -1
- package/dist/esm/core-flow/childOutcome.d.ts +47 -0
- package/dist/esm/core-flow/childOutcome.js +57 -0
- package/dist/esm/core-flow/childOutcome.js.map +1 -0
- package/dist/esm/events/payloads.d.ts +33 -11
- package/dist/esm/events/types.d.ts +32 -2
- package/dist/esm/index.d.ts +1 -11
- package/dist/esm/index.js +5 -10
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/injection-engine/skillToolDescriptors.js +1 -0
- package/dist/esm/lib/injection-engine/skillToolDescriptors.js.map +1 -1
- package/dist/esm/lib/mcp/mcpServe.js +11 -4
- package/dist/esm/lib/mcp/mcpServe.js.map +1 -1
- package/dist/esm/lib/time-travel/receipt.d.ts +5 -5
- package/dist/esm/lib/trace-toolpack/debugPrompt.d.ts +1 -1
- package/dist/esm/lib/trace-toolpack/debugPrompt.js +1 -0
- package/dist/esm/lib/trace-toolpack/debugPrompt.js.map +1 -1
- package/dist/esm/lib/trace-toolpack/innerDescent.d.ts +58 -0
- package/dist/esm/lib/trace-toolpack/innerDescent.js +68 -0
- package/dist/esm/lib/trace-toolpack/innerDescent.js.map +1 -0
- package/dist/esm/lib/trace-toolpack/subflowRecords.d.ts +55 -0
- package/dist/esm/lib/trace-toolpack/subflowRecords.js +124 -0
- package/dist/esm/lib/trace-toolpack/subflowRecords.js.map +1 -0
- package/dist/esm/lib/trace-toolpack/traceToolNames.d.ts +1 -1
- package/dist/esm/lib/trace-toolpack/traceToolNames.js +1 -0
- package/dist/esm/lib/trace-toolpack/traceToolNames.js.map +1 -1
- package/dist/esm/lib/trace-toolpack/traceToolpack.d.ts +1 -0
- package/dist/esm/lib/trace-toolpack/traceToolpack.js +282 -56
- package/dist/esm/lib/trace-toolpack/traceToolpack.js.map +1 -1
- package/dist/esm/lib/trust-boundaries/capture.d.ts +6 -0
- package/dist/esm/lib/trust-boundaries/capture.js +161 -0
- package/dist/esm/lib/trust-boundaries/capture.js.map +1 -0
- package/dist/esm/lib/trust-boundaries/index.d.ts +2 -0
- package/dist/esm/lib/trust-boundaries/index.js +2 -0
- package/dist/esm/lib/trust-boundaries/index.js.map +1 -0
- package/dist/esm/lib/trust-boundaries/project.d.ts +13 -0
- package/dist/esm/lib/trust-boundaries/project.js +170 -0
- package/dist/esm/lib/trust-boundaries/project.js.map +1 -0
- package/dist/esm/lib/trust-boundaries/types.d.ts +81 -0
- package/dist/esm/lib/trust-boundaries/types.js +2 -0
- package/dist/esm/lib/trust-boundaries/types.js.map +1 -0
- package/dist/esm/observe.d.ts +1 -0
- package/dist/esm/observe.js +3 -0
- package/dist/esm/observe.js.map +1 -1
- package/dist/esm/package.json +1 -1
- package/dist/esm/patterns/LlmRouter.js +6 -3
- package/dist/esm/patterns/LlmRouter.js.map +1 -1
- package/dist/esm/recorders/core/EmitBridge.js +7 -1
- package/dist/esm/recorders/core/EmitBridge.js.map +1 -1
- package/dist/esm/recorders/observability/recordRun.d.ts +29 -4
- package/dist/esm/recorders/observability/recordRun.js +144 -70
- package/dist/esm/recorders/observability/recordRun.js.map +1 -1
- package/dist/esm/recorders/observability/recordingEnvelope.js +5 -3
- package/dist/esm/recorders/observability/recordingEnvelope.js.map +1 -1
- package/dist/esm/reliability/failFastRecord.d.ts +28 -0
- package/dist/esm/reliability/failFastRecord.js +45 -0
- package/dist/esm/reliability/failFastRecord.js.map +1 -0
- package/dist/esm/resilience/withCircuitBreaker.js +3 -0
- package/dist/esm/resilience/withCircuitBreaker.js.map +1 -1
- package/dist/esm/resilience/withFallback.js +101 -11
- package/dist/esm/resilience/withFallback.js.map +1 -1
- package/dist/esm/resilience/withRetry.js +8 -0
- package/dist/esm/resilience/withRetry.js.map +1 -1
- package/dist/esm/thinking/AnthropicThinkingHandler.js +5 -5
- package/dist/esm/thinking/AnthropicThinkingHandler.js.map +1 -1
- package/dist/esm/thinking/MockThinkingHandler.js +2 -3
- package/dist/esm/thinking/MockThinkingHandler.js.map +1 -1
- package/dist/esm/thinking/OllamaThinkingHandler.js +0 -1
- package/dist/esm/thinking/OllamaThinkingHandler.js.map +1 -1
- package/dist/esm/thinking/OpenAIThinkingHandler.js +0 -1
- package/dist/esm/thinking/OpenAIThinkingHandler.js.map +1 -1
- package/dist/esm/thinking/index.d.ts +8 -7
- package/dist/esm/thinking/index.js +8 -7
- package/dist/esm/thinking/index.js.map +1 -1
- package/dist/esm/thinking/registry.d.ts +13 -23
- package/dist/esm/thinking/registry.js +13 -29
- package/dist/esm/thinking/registry.js.map +1 -1
- package/dist/esm/thinking/thinkingHandlerFor.d.ts +27 -0
- package/dist/esm/thinking/thinkingHandlerFor.js +36 -0
- package/dist/esm/thinking/thinkingHandlerFor.js.map +1 -0
- package/dist/esm/thinking/types.d.ts +7 -15
- package/dist/esm/thinking/types.js +3 -3
- package/dist/index.js +5 -10
- package/dist/index.js.map +1 -1
- package/dist/lib/injection-engine/skillToolDescriptors.js +1 -0
- package/dist/lib/injection-engine/skillToolDescriptors.js.map +1 -1
- package/dist/lib/mcp/mcpServe.js +11 -4
- package/dist/lib/mcp/mcpServe.js.map +1 -1
- package/dist/lib/trace-toolpack/debugPrompt.js +1 -0
- package/dist/lib/trace-toolpack/debugPrompt.js.map +1 -1
- package/dist/lib/trace-toolpack/innerDescent.js +74 -0
- package/dist/lib/trace-toolpack/innerDescent.js.map +1 -0
- package/dist/lib/trace-toolpack/subflowRecords.js +134 -0
- package/dist/lib/trace-toolpack/subflowRecords.js.map +1 -0
- package/dist/lib/trace-toolpack/traceToolNames.js +1 -0
- package/dist/lib/trace-toolpack/traceToolNames.js.map +1 -1
- package/dist/lib/trace-toolpack/traceToolpack.js +282 -56
- package/dist/lib/trace-toolpack/traceToolpack.js.map +1 -1
- package/dist/lib/trust-boundaries/capture.js +165 -0
- package/dist/lib/trust-boundaries/capture.js.map +1 -0
- package/dist/lib/trust-boundaries/index.js +6 -0
- package/dist/lib/trust-boundaries/index.js.map +1 -0
- package/dist/lib/trust-boundaries/project.js +174 -0
- package/dist/lib/trust-boundaries/project.js.map +1 -0
- package/dist/lib/trust-boundaries/types.js +3 -0
- package/dist/lib/trust-boundaries/types.js.map +1 -0
- package/dist/observe.js +17 -13
- package/dist/observe.js.map +1 -1
- package/dist/patterns/LlmRouter.js +5 -2
- package/dist/patterns/LlmRouter.js.map +1 -1
- package/dist/recorders/core/EmitBridge.js +7 -1
- package/dist/recorders/core/EmitBridge.js.map +1 -1
- package/dist/recorders/observability/recordRun.js +144 -70
- package/dist/recorders/observability/recordRun.js.map +1 -1
- package/dist/recorders/observability/recordingEnvelope.js +5 -3
- package/dist/recorders/observability/recordingEnvelope.js.map +1 -1
- package/dist/reliability/failFastRecord.js +50 -0
- package/dist/reliability/failFastRecord.js.map +1 -0
- package/dist/resilience/withCircuitBreaker.js +3 -0
- package/dist/resilience/withCircuitBreaker.js.map +1 -1
- package/dist/resilience/withFallback.js +101 -11
- package/dist/resilience/withFallback.js.map +1 -1
- package/dist/resilience/withRetry.js +8 -0
- package/dist/resilience/withRetry.js.map +1 -1
- package/dist/thinking/AnthropicThinkingHandler.js +5 -5
- package/dist/thinking/AnthropicThinkingHandler.js.map +1 -1
- package/dist/thinking/MockThinkingHandler.js +2 -3
- package/dist/thinking/MockThinkingHandler.js.map +1 -1
- package/dist/thinking/OllamaThinkingHandler.js +0 -1
- package/dist/thinking/OllamaThinkingHandler.js.map +1 -1
- package/dist/thinking/OpenAIThinkingHandler.js +0 -1
- package/dist/thinking/OpenAIThinkingHandler.js.map +1 -1
- package/dist/thinking/index.js +9 -8
- package/dist/thinking/index.js.map +1 -1
- package/dist/thinking/registry.js +14 -31
- package/dist/thinking/registry.js.map +1 -1
- package/dist/thinking/thinkingHandlerFor.js +40 -0
- package/dist/thinking/thinkingHandlerFor.js.map +1 -0
- package/dist/thinking/types.js +3 -3
- package/dist/types/adapters/llm/AnthropicProvider.d.ts +3 -1
- package/dist/types/adapters/llm/AnthropicProvider.d.ts.map +1 -1
- package/dist/types/adapters/llm/BrowserAnthropicProvider.d.ts +2 -0
- package/dist/types/adapters/llm/BrowserAnthropicProvider.d.ts.map +1 -1
- package/dist/types/adapters/llm/BrowserOpenAIProvider.d.ts +8 -0
- package/dist/types/adapters/llm/BrowserOpenAIProvider.d.ts.map +1 -1
- package/dist/types/adapters/llm/FoundryProvider.d.ts.map +1 -1
- package/dist/types/adapters/llm/InvokeModelGatewayProvider.d.ts +1 -0
- package/dist/types/adapters/llm/InvokeModelGatewayProvider.d.ts.map +1 -1
- package/dist/types/adapters/llm/MockProvider.d.ts +2 -0
- package/dist/types/adapters/llm/MockProvider.d.ts.map +1 -1
- package/dist/types/adapters/llm/OllamaProvider.d.ts +1 -0
- package/dist/types/adapters/llm/OllamaProvider.d.ts.map +1 -1
- package/dist/types/adapters/llm/OpenAIProvider.d.ts +5 -0
- package/dist/types/adapters/llm/OpenAIProvider.d.ts.map +1 -1
- package/dist/types/adapters/llm/anthropicCacheWire.d.ts +27 -9
- package/dist/types/adapters/llm/anthropicCacheWire.d.ts.map +1 -1
- package/dist/types/adapters/llm/anthropicMessagesWire.d.ts +1 -1
- package/dist/types/adapters/llm/anthropicMessagesWire.d.ts.map +1 -1
- package/dist/types/adapters/types.d.ts +13 -0
- package/dist/types/adapters/types.d.ts.map +1 -1
- package/dist/types/bridge/eventMeta.d.ts +5 -1
- package/dist/types/bridge/eventMeta.d.ts.map +1 -1
- package/dist/types/bridge/eventSourcePosition.d.ts +11 -0
- package/dist/types/bridge/eventSourcePosition.d.ts.map +1 -0
- package/dist/types/cache/CacheDecisionSubflow.d.ts +44 -8
- package/dist/types/cache/CacheDecisionSubflow.d.ts.map +1 -1
- package/dist/types/cache/cacheStrategyFor.d.ts +43 -0
- package/dist/types/cache/cacheStrategyFor.d.ts.map +1 -0
- package/dist/types/cache/index.d.ts +20 -29
- package/dist/types/cache/index.d.ts.map +1 -1
- package/dist/types/cache/strategies/AutomaticCacheStrategy.d.ts +38 -0
- package/dist/types/cache/strategies/AutomaticCacheStrategy.d.ts.map +1 -0
- package/dist/types/cache/strategies/BreakpointCacheStrategy.d.ts +41 -0
- package/dist/types/cache/strategies/BreakpointCacheStrategy.d.ts.map +1 -0
- package/dist/types/cache/strategies/NoOpCacheStrategy.d.ts +8 -18
- package/dist/types/cache/strategies/NoOpCacheStrategy.d.ts.map +1 -1
- package/dist/types/cache/types.d.ts +79 -78
- package/dist/types/cache/types.d.ts.map +1 -1
- package/dist/types/core/Agent.d.ts +36 -10
- package/dist/types/core/Agent.d.ts.map +1 -1
- package/dist/types/core/LLMCall.d.ts +3 -4
- package/dist/types/core/LLMCall.d.ts.map +1 -1
- package/dist/types/core/RunnerBase.d.ts +11 -0
- package/dist/types/core/RunnerBase.d.ts.map +1 -1
- package/dist/types/core/agent/AgentBuilder.d.ts +24 -33
- package/dist/types/core/agent/AgentBuilder.d.ts.map +1 -1
- package/dist/types/core/agent/act.d.ts +5 -2
- package/dist/types/core/agent/act.d.ts.map +1 -1
- package/dist/types/core/agent/assessment/stage.d.ts +2 -0
- package/dist/types/core/agent/assessment/stage.d.ts.map +1 -1
- package/dist/types/core/agent/buildAgentChart.d.ts +5 -1
- package/dist/types/core/agent/buildAgentChart.d.ts.map +1 -1
- package/dist/types/core/agent/buildCacheSubflow.d.ts +4 -2
- package/dist/types/core/agent/buildCacheSubflow.d.ts.map +1 -1
- package/dist/types/core/agent/buildDynamicAgentChart.d.ts.map +1 -1
- package/dist/types/core/agent/honesty/mounts.d.ts +2 -0
- package/dist/types/core/agent/honesty/mounts.d.ts.map +1 -1
- package/dist/types/core/agent/middleware/ledger.d.ts +1 -1
- package/dist/types/core/agent/middleware/messagePhase.d.ts +6 -0
- package/dist/types/core/agent/middleware/messagePhase.d.ts.map +1 -0
- package/dist/types/core/agent/skillBrains.d.ts +5 -3
- package/dist/types/core/agent/skillBrains.d.ts.map +1 -1
- package/dist/types/core/agent/stages/answerValidation.d.ts +6 -1
- package/dist/types/core/agent/stages/answerValidation.d.ts.map +1 -1
- package/dist/types/core/agent/stages/breakFinal.d.ts +16 -0
- package/dist/types/core/agent/stages/breakFinal.d.ts.map +1 -1
- package/dist/types/core/agent/stages/callLLM.d.ts +3 -1
- package/dist/types/core/agent/stages/callLLM.d.ts.map +1 -1
- package/dist/types/core/agent/stages/outputAdmission.d.ts +7 -0
- package/dist/types/core/agent/stages/outputAdmission.d.ts.map +1 -0
- package/dist/types/core/agent/stages/prepareFinal.d.ts +18 -41
- package/dist/types/core/agent/stages/prepareFinal.d.ts.map +1 -1
- package/dist/types/core/agent/stages/reliabilityExecution.d.ts +8 -1
- package/dist/types/core/agent/stages/reliabilityExecution.d.ts.map +1 -1
- package/dist/types/core/agent/stages/seed.d.ts.map +1 -1
- package/dist/types/core/agent/stages/toolCalls.d.ts.map +1 -1
- package/dist/types/core/agent/toolArgsValidation.d.ts +9 -5
- package/dist/types/core/agent/toolArgsValidation.d.ts.map +1 -1
- package/dist/types/core/agent/toolDispatch.d.ts +3 -2
- package/dist/types/core/agent/toolDispatch.d.ts.map +1 -1
- package/dist/types/core/agent/toolSecurityEvents.d.ts +19 -0
- package/dist/types/core/agent/toolSecurityEvents.d.ts.map +1 -0
- package/dist/types/core/agent/types.d.ts +4 -4
- package/dist/types/core/codeRunnerTool.d.ts.map +1 -1
- package/dist/types/core/conversation.d.ts +16 -1
- package/dist/types/core/conversation.d.ts.map +1 -1
- package/dist/types/core/slots/buildThinkingSubflow.d.ts +2 -2
- package/dist/types/core/slots/buildThinkingSubflow.d.ts.map +1 -1
- package/dist/types/core/terminalVerdict.d.ts +57 -0
- package/dist/types/core/terminalVerdict.d.ts.map +1 -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.map +1 -1
- package/dist/types/core-flow/Parallel.d.ts.map +1 -1
- 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/core-flow/childOutcome.d.ts +48 -0
- package/dist/types/core-flow/childOutcome.d.ts.map +1 -0
- package/dist/types/events/payloads.d.ts +33 -11
- package/dist/types/events/payloads.d.ts.map +1 -1
- package/dist/types/events/types.d.ts +32 -2
- package/dist/types/events/types.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -11
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/skillToolDescriptors.d.ts.map +1 -1
- package/dist/types/lib/mcp/mcpServe.d.ts.map +1 -1
- package/dist/types/lib/time-travel/receipt.d.ts +5 -5
- package/dist/types/lib/trace-toolpack/debugPrompt.d.ts +1 -1
- package/dist/types/lib/trace-toolpack/debugPrompt.d.ts.map +1 -1
- package/dist/types/lib/trace-toolpack/innerDescent.d.ts +59 -0
- package/dist/types/lib/trace-toolpack/innerDescent.d.ts.map +1 -0
- package/dist/types/lib/trace-toolpack/subflowRecords.d.ts +56 -0
- package/dist/types/lib/trace-toolpack/subflowRecords.d.ts.map +1 -0
- package/dist/types/lib/trace-toolpack/traceToolNames.d.ts +1 -1
- package/dist/types/lib/trace-toolpack/traceToolNames.d.ts.map +1 -1
- package/dist/types/lib/trace-toolpack/traceToolpack.d.ts +1 -0
- package/dist/types/lib/trace-toolpack/traceToolpack.d.ts.map +1 -1
- package/dist/types/lib/trust-boundaries/capture.d.ts +7 -0
- package/dist/types/lib/trust-boundaries/capture.d.ts.map +1 -0
- package/dist/types/lib/trust-boundaries/index.d.ts +3 -0
- package/dist/types/lib/trust-boundaries/index.d.ts.map +1 -0
- package/dist/types/lib/trust-boundaries/project.d.ts +14 -0
- package/dist/types/lib/trust-boundaries/project.d.ts.map +1 -0
- package/dist/types/lib/trust-boundaries/types.d.ts +82 -0
- package/dist/types/lib/trust-boundaries/types.d.ts.map +1 -0
- package/dist/types/observe.d.ts +1 -0
- package/dist/types/observe.d.ts.map +1 -1
- package/dist/types/patterns/LlmRouter.d.ts.map +1 -1
- package/dist/types/recorders/core/EmitBridge.d.ts.map +1 -1
- package/dist/types/recorders/observability/recordRun.d.ts +29 -4
- package/dist/types/recorders/observability/recordRun.d.ts.map +1 -1
- package/dist/types/recorders/observability/recordingEnvelope.d.ts.map +1 -1
- package/dist/types/reliability/failFastRecord.d.ts +29 -0
- package/dist/types/reliability/failFastRecord.d.ts.map +1 -0
- package/dist/types/resilience/withCircuitBreaker.d.ts.map +1 -1
- package/dist/types/resilience/withFallback.d.ts.map +1 -1
- package/dist/types/resilience/withRetry.d.ts.map +1 -1
- package/dist/types/thinking/AnthropicThinkingHandler.d.ts.map +1 -1
- package/dist/types/thinking/MockThinkingHandler.d.ts.map +1 -1
- package/dist/types/thinking/OllamaThinkingHandler.d.ts.map +1 -1
- package/dist/types/thinking/OpenAIThinkingHandler.d.ts.map +1 -1
- package/dist/types/thinking/index.d.ts +8 -7
- package/dist/types/thinking/index.d.ts.map +1 -1
- package/dist/types/thinking/registry.d.ts +13 -23
- package/dist/types/thinking/registry.d.ts.map +1 -1
- package/dist/types/thinking/thinkingHandlerFor.d.ts +28 -0
- package/dist/types/thinking/thinkingHandlerFor.d.ts.map +1 -0
- package/dist/types/thinking/types.d.ts +7 -15
- package/dist/types/thinking/types.d.ts.map +1 -1
- package/package.json +1 -5
- package/dist/cache/strategies/AnthropicCacheStrategy.js +0 -90
- package/dist/cache/strategies/AnthropicCacheStrategy.js.map +0 -1
- package/dist/cache/strategies/BedrockCacheStrategy.js +0 -97
- package/dist/cache/strategies/BedrockCacheStrategy.js.map +0 -1
- package/dist/cache/strategies/OpenAICacheStrategy.js +0 -76
- package/dist/cache/strategies/OpenAICacheStrategy.js.map +0 -1
- package/dist/cache/strategyRegistry.js +0 -81
- package/dist/cache/strategyRegistry.js.map +0 -1
- package/dist/esm/cache/strategies/AnthropicCacheStrategy.d.ts +0 -41
- package/dist/esm/cache/strategies/AnthropicCacheStrategy.js +0 -86
- package/dist/esm/cache/strategies/AnthropicCacheStrategy.js.map +0 -1
- package/dist/esm/cache/strategies/BedrockCacheStrategy.d.ts +0 -62
- package/dist/esm/cache/strategies/BedrockCacheStrategy.js +0 -93
- package/dist/esm/cache/strategies/BedrockCacheStrategy.js.map +0 -1
- package/dist/esm/cache/strategies/OpenAICacheStrategy.d.ts +0 -47
- package/dist/esm/cache/strategies/OpenAICacheStrategy.js +0 -72
- package/dist/esm/cache/strategies/OpenAICacheStrategy.js.map +0 -1
- package/dist/esm/cache/strategyRegistry.d.ts +0 -45
- package/dist/esm/cache/strategyRegistry.js +0 -74
- package/dist/esm/cache/strategyRegistry.js.map +0 -1
- package/dist/types/cache/strategies/AnthropicCacheStrategy.d.ts +0 -42
- package/dist/types/cache/strategies/AnthropicCacheStrategy.d.ts.map +0 -1
- package/dist/types/cache/strategies/BedrockCacheStrategy.d.ts +0 -63
- package/dist/types/cache/strategies/BedrockCacheStrategy.d.ts.map +0 -1
- package/dist/types/cache/strategies/OpenAICacheStrategy.d.ts +0 -48
- package/dist/types/cache/strategies/OpenAICacheStrategy.d.ts.map +0 -1
- package/dist/types/cache/strategyRegistry.d.ts +0 -46
- package/dist/types/cache/strategyRegistry.d.ts.map +0 -1
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AutomaticCacheStrategy — for a provider that caches repeated prefixes on
|
|
3
|
+
* its own (`promptCaching.mode: 'automatic'`; OpenAI, Azure OpenAI).
|
|
4
|
+
*
|
|
5
|
+
* Chosen by CAPABILITY (`cacheStrategyFor`), never by provider name.
|
|
6
|
+
*
|
|
7
|
+
* - **prepareRequest**: pass-through. The provider decides what to cache;
|
|
8
|
+
* a marker would mean nothing on its wire. The `cache:` policies on
|
|
9
|
+
* injections still matter — they travel with the agent and take effect
|
|
10
|
+
* the moment it runs on a breakpoint provider — but here they have no
|
|
11
|
+
* local effect, and `cache: 'never'` cannot stop the provider caching.
|
|
12
|
+
* - **extractMetrics**: the port usage when the adapter declares it
|
|
13
|
+
* reports cache tokens; `not applicable` when it declares it does not
|
|
14
|
+
* (the OpenAI adapter does not lift `prompt_tokens_details.cached_tokens`
|
|
15
|
+
* yet — named, rather than hidden behind a per-call `unknown` that would
|
|
16
|
+
* suggest the measurement was attempted).
|
|
17
|
+
*/
|
|
18
|
+
import { notApplicable } from '../../lib/claim/claim.js';
|
|
19
|
+
import { readPortCacheUsage } from '../portUsage.js';
|
|
20
|
+
export class AutomaticCacheStrategy {
|
|
21
|
+
name = 'automatic';
|
|
22
|
+
reportsUsage;
|
|
23
|
+
who;
|
|
24
|
+
/**
|
|
25
|
+
* @param declared the provider's `promptCaching` declaration
|
|
26
|
+
* @param who names the adapter in the meter's evidence sentences
|
|
27
|
+
*/
|
|
28
|
+
constructor(declared, who = 'the provider') {
|
|
29
|
+
this.reportsUsage = declared.reportsUsage;
|
|
30
|
+
this.who = who;
|
|
31
|
+
}
|
|
32
|
+
async prepareRequest(req, _candidates, _ctx) {
|
|
33
|
+
return { request: req, markersApplied: [] };
|
|
34
|
+
}
|
|
35
|
+
extractMetrics(usage) {
|
|
36
|
+
if (!this.reportsUsage) {
|
|
37
|
+
return notApplicable(`${this.who} caches automatically but declares that it does not report cache ` +
|
|
38
|
+
'token counts (promptCaching.reportsUsage: false)');
|
|
39
|
+
}
|
|
40
|
+
return readPortCacheUsage(usage, this.who);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=AutomaticCacheStrategy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AutomaticCacheStrategy.js","sourceRoot":"","sources":["../../../../src/cache/strategies/AutomaticCacheStrategy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAUH,OAAO,EAAE,aAAa,EAAc,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAGrD,MAAM,OAAO,sBAAsB;IACxB,IAAI,GAAG,WAAW,CAAC;IACX,YAAY,CAAU;IACtB,GAAG,CAAS;IAE7B;;;OAGG;IACH,YAAY,QAAuD,EAAE,GAAG,GAAG,cAAc;QACvF,IAAI,CAAC,YAAY,GAAG,QAAQ,CAAC,YAAY,CAAC;QAC1C,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;IAED,KAAK,CAAC,cAAc,CAClB,GAAe,EACf,WAAmC,EACnC,IAA0B;QAK1B,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,cAAc,EAAE,EAAE,EAAE,CAAC;IAC9C,CAAC;IAED,cAAc,CAAC,KAA6B;QAC1C,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;YACvB,OAAO,aAAa,CAClB,GAAG,IAAI,CAAC,GAAG,mEAAmE;gBAC5E,kDAAkD,CACrD,CAAC;QACJ,CAAC;QACD,OAAO,kBAAkB,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;IAC7C,CAAC;CACF"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BreakpointCacheStrategy — for a provider that caches a prefix only where
|
|
3
|
+
* the request marks it (`promptCaching.mode: 'breakpoints'`; Anthropic's
|
|
4
|
+
* `cache_control`).
|
|
5
|
+
*
|
|
6
|
+
* Chosen by CAPABILITY (`cacheStrategyFor`), never by provider name: built
|
|
7
|
+
* from the provider's own declaration, so `withRetry(anthropic())` or an
|
|
8
|
+
* application's routing wrapper caches exactly like the adapter it wraps.
|
|
9
|
+
*
|
|
10
|
+
* What it DOES:
|
|
11
|
+
* - clamp the candidate markers to the declared `maxBreakpoints`, keeping
|
|
12
|
+
* the first N in slot order (the most stable prefixes first);
|
|
13
|
+
* - put them on `LLMRequest.cacheMarkers`, where the adapter reads them;
|
|
14
|
+
* - read cache metrics off the PORT usage the adapter normalised —
|
|
15
|
+
* `not applicable` when the declaration says the adapter reports none.
|
|
16
|
+
* What it does NOT: touch the wire. The adapter owns `cache_control`
|
|
17
|
+
* (`adapters/llm/anthropicCacheWire.ts`), and content is never edited.
|
|
18
|
+
*/
|
|
19
|
+
import type { CacheMarker, CacheMetrics, CacheStrategy, CacheStrategyContext, CacheUsage, PromptCaching } from '../types.js';
|
|
20
|
+
import { type Claim } from '../../lib/claim/claim.js';
|
|
21
|
+
import type { LLMRequest } from '../../adapters/types.js';
|
|
22
|
+
export declare class BreakpointCacheStrategy implements CacheStrategy {
|
|
23
|
+
readonly name = "breakpoints";
|
|
24
|
+
private readonly maxBreakpoints;
|
|
25
|
+
private readonly reportsUsage;
|
|
26
|
+
private readonly who;
|
|
27
|
+
/**
|
|
28
|
+
* @param declared the provider's `promptCaching` declaration
|
|
29
|
+
* @param who names the adapter in the meter's evidence sentences,
|
|
30
|
+
* e.g. `"the 'anthropic' provider"`
|
|
31
|
+
*/
|
|
32
|
+
constructor(declared: Extract<PromptCaching, {
|
|
33
|
+
mode: 'breakpoints';
|
|
34
|
+
}>, who?: string);
|
|
35
|
+
prepareRequest(req: LLMRequest, candidates: readonly CacheMarker[], ctx: CacheStrategyContext): Promise<{
|
|
36
|
+
readonly request: LLMRequest;
|
|
37
|
+
readonly markersApplied: readonly CacheMarker[];
|
|
38
|
+
}>;
|
|
39
|
+
extractMetrics(usage: CacheUsage | undefined): Claim<CacheMetrics>;
|
|
40
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BreakpointCacheStrategy — for a provider that caches a prefix only where
|
|
3
|
+
* the request marks it (`promptCaching.mode: 'breakpoints'`; Anthropic's
|
|
4
|
+
* `cache_control`).
|
|
5
|
+
*
|
|
6
|
+
* Chosen by CAPABILITY (`cacheStrategyFor`), never by provider name: built
|
|
7
|
+
* from the provider's own declaration, so `withRetry(anthropic())` or an
|
|
8
|
+
* application's routing wrapper caches exactly like the adapter it wraps.
|
|
9
|
+
*
|
|
10
|
+
* What it DOES:
|
|
11
|
+
* - clamp the candidate markers to the declared `maxBreakpoints`, keeping
|
|
12
|
+
* the first N in slot order (the most stable prefixes first);
|
|
13
|
+
* - put them on `LLMRequest.cacheMarkers`, where the adapter reads them;
|
|
14
|
+
* - read cache metrics off the PORT usage the adapter normalised —
|
|
15
|
+
* `not applicable` when the declaration says the adapter reports none.
|
|
16
|
+
* What it does NOT: touch the wire. The adapter owns `cache_control`
|
|
17
|
+
* (`adapters/llm/anthropicCacheWire.ts`), and content is never edited.
|
|
18
|
+
*/
|
|
19
|
+
import { notApplicable } from '../../lib/claim/claim.js';
|
|
20
|
+
import { readPortCacheUsage } from '../portUsage.js';
|
|
21
|
+
export class BreakpointCacheStrategy {
|
|
22
|
+
name = 'breakpoints';
|
|
23
|
+
maxBreakpoints;
|
|
24
|
+
reportsUsage;
|
|
25
|
+
who;
|
|
26
|
+
/**
|
|
27
|
+
* @param declared the provider's `promptCaching` declaration
|
|
28
|
+
* @param who names the adapter in the meter's evidence sentences,
|
|
29
|
+
* e.g. `"the 'anthropic' provider"`
|
|
30
|
+
*/
|
|
31
|
+
constructor(declared, who = 'the provider') {
|
|
32
|
+
this.maxBreakpoints = declared.maxBreakpoints;
|
|
33
|
+
this.reportsUsage = declared.reportsUsage;
|
|
34
|
+
this.who = who;
|
|
35
|
+
}
|
|
36
|
+
async prepareRequest(req, candidates, ctx) {
|
|
37
|
+
// The agent-side kill switch, honoured here too: the CacheGate should
|
|
38
|
+
// already have emptied the candidates, but a buggy gate must not be able
|
|
39
|
+
// to put markers on a request whose run said caching is off.
|
|
40
|
+
if (ctx.cachingDisabled || candidates.length === 0) {
|
|
41
|
+
return { request: req, markersApplied: [] };
|
|
42
|
+
}
|
|
43
|
+
const markersApplied = candidates.length <= this.maxBreakpoints
|
|
44
|
+
? candidates
|
|
45
|
+
: candidates.slice(0, this.maxBreakpoints);
|
|
46
|
+
return { request: { ...req, cacheMarkers: markersApplied }, markersApplied };
|
|
47
|
+
}
|
|
48
|
+
extractMetrics(usage) {
|
|
49
|
+
if (!this.reportsUsage) {
|
|
50
|
+
return notApplicable(`${this.who} declares that it does not report cache token counts ` +
|
|
51
|
+
'(promptCaching.reportsUsage: false)');
|
|
52
|
+
}
|
|
53
|
+
return readPortCacheUsage(usage, this.who);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=BreakpointCacheStrategy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BreakpointCacheStrategy.js","sourceRoot":"","sources":["../../../../src/cache/strategies/BreakpointCacheStrategy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAUH,OAAO,EAAE,aAAa,EAAc,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAGrD,MAAM,OAAO,uBAAuB;IACzB,IAAI,GAAG,aAAa,CAAC;IACb,cAAc,CAAS;IACvB,YAAY,CAAU;IACtB,GAAG,CAAS;IAE7B;;;;OAIG;IACH,YAAY,QAAyD,EAAE,GAAG,GAAG,cAAc;QACzF,IAAI,CAAC,cAAc,GAAG,QAAQ,CAAC,cAAc,CAAC;QAC9C,IAAI,CAAC,YAAY,GAAG,QAAQ,CAAC,YAAY,CAAC;QAC1C,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;IAED,KAAK,CAAC,cAAc,CAClB,GAAe,EACf,UAAkC,EAClC,GAAyB;QAKzB,sEAAsE;QACtE,yEAAyE;QACzE,6DAA6D;QAC7D,IAAI,GAAG,CAAC,eAAe,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACnD,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,cAAc,EAAE,EAAE,EAAE,CAAC;QAC9C,CAAC;QACD,MAAM,cAAc,GAClB,UAAU,CAAC,MAAM,IAAI,IAAI,CAAC,cAAc;YACtC,CAAC,CAAC,UAAU;YACZ,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QAC/C,OAAO,EAAE,OAAO,EAAE,EAAE,GAAG,GAAG,EAAE,YAAY,EAAE,cAAc,EAAE,EAAE,cAAc,EAAE,CAAC;IAC/E,CAAC;IAED,cAAc,CAAC,KAA6B;QAC1C,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;YACvB,OAAO,aAAa,CAClB,GAAG,IAAI,CAAC,GAAG,uDAAuD;gBAChE,qCAAqC,CACxC,CAAC;QACJ,CAAC;QACD,OAAO,kBAAkB,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;IAC7C,CAAC;CACF"}
|
|
@@ -1,27 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* NoOpCacheStrategy —
|
|
3
|
-
*
|
|
2
|
+
* NoOpCacheStrategy — for a provider that declares no prompt caching
|
|
3
|
+
* (`LLMProvider.promptCaching` absent): Mock, Ollama, Bedrock Converse,
|
|
4
|
+
* any adapter that has not said, or an intentional opt-out.
|
|
4
5
|
*
|
|
5
|
-
* Returns the request unchanged
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* optimization), though current Phase 4+5 always emit markers and
|
|
9
|
-
* let the strategy decide what to do with them.
|
|
10
|
-
*
|
|
11
|
-
* Always-available default. Registered against the special wildcard
|
|
12
|
-
* `'*'` so any unrecognized provider name falls back to NoOp.
|
|
6
|
+
* Returns the request unchanged and reports *not applicable* — never a zero.
|
|
7
|
+
* Chosen by `cacheStrategyFor` when the declaration is absent; one shared
|
|
8
|
+
* instance serves every such provider (it holds no state).
|
|
13
9
|
*/
|
|
14
|
-
import type {
|
|
10
|
+
import type { CacheMarker, CacheMetrics, CacheStrategy, CacheStrategyContext, CacheUsage } from '../types.js';
|
|
15
11
|
import { type Claim } from '../../lib/claim/claim.js';
|
|
16
12
|
import type { LLMRequest } from '../../adapters/types.js';
|
|
17
13
|
export declare class NoOpCacheStrategy implements CacheStrategy {
|
|
18
|
-
|
|
19
|
-
* Wildcard provider name. The strategy registry treats this as the
|
|
20
|
-
* fallback for any provider that doesn't have a specific strategy
|
|
21
|
-
* registered.
|
|
22
|
-
*/
|
|
23
|
-
readonly providerName = "*";
|
|
24
|
-
readonly capabilities: CacheCapabilities;
|
|
14
|
+
readonly name = "none";
|
|
25
15
|
prepareRequest(req: LLMRequest, _candidates: readonly CacheMarker[], _ctx: CacheStrategyContext): Promise<{
|
|
26
16
|
readonly request: LLMRequest;
|
|
27
17
|
readonly markersApplied: readonly CacheMarker[];
|
|
@@ -1,37 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* NoOpCacheStrategy —
|
|
3
|
-
*
|
|
2
|
+
* NoOpCacheStrategy — for a provider that declares no prompt caching
|
|
3
|
+
* (`LLMProvider.promptCaching` absent): Mock, Ollama, Bedrock Converse,
|
|
4
|
+
* any adapter that has not said, or an intentional opt-out.
|
|
4
5
|
*
|
|
5
|
-
* Returns the request unchanged
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* optimization), though current Phase 4+5 always emit markers and
|
|
9
|
-
* let the strategy decide what to do with them.
|
|
10
|
-
*
|
|
11
|
-
* Always-available default. Registered against the special wildcard
|
|
12
|
-
* `'*'` so any unrecognized provider name falls back to NoOp.
|
|
6
|
+
* Returns the request unchanged and reports *not applicable* — never a zero.
|
|
7
|
+
* Chosen by `cacheStrategyFor` when the declaration is absent; one shared
|
|
8
|
+
* instance serves every such provider (it holds no state).
|
|
13
9
|
*/
|
|
14
10
|
import { notApplicable } from '../../lib/claim/claim.js';
|
|
15
|
-
const NOOP_CAPABILITIES = Object.freeze({
|
|
16
|
-
enabled: false,
|
|
17
|
-
maxMarkers: 0,
|
|
18
|
-
ttls: [],
|
|
19
|
-
fields: [],
|
|
20
|
-
automatic: false,
|
|
21
|
-
});
|
|
22
11
|
export class NoOpCacheStrategy {
|
|
23
|
-
|
|
24
|
-
* Wildcard provider name. The strategy registry treats this as the
|
|
25
|
-
* fallback for any provider that doesn't have a specific strategy
|
|
26
|
-
* registered.
|
|
27
|
-
*/
|
|
28
|
-
providerName = '*';
|
|
29
|
-
capabilities = NOOP_CAPABILITIES;
|
|
12
|
+
name = 'none';
|
|
30
13
|
async prepareRequest(req, _candidates, _ctx) {
|
|
31
14
|
return { request: req, markersApplied: [] };
|
|
32
15
|
}
|
|
33
16
|
extractMetrics(_usage) {
|
|
34
|
-
return notApplicable('the
|
|
17
|
+
return notApplicable('the provider declares no prompt caching (LLMProvider.promptCaching is absent), so no ' +
|
|
18
|
+
'cache traffic is driven or reported');
|
|
35
19
|
}
|
|
36
20
|
}
|
|
37
21
|
//# sourceMappingURL=NoOpCacheStrategy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NoOpCacheStrategy.js","sourceRoot":"","sources":["../../../../src/cache/strategies/NoOpCacheStrategy.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"NoOpCacheStrategy.js","sourceRoot":"","sources":["../../../../src/cache/strategies/NoOpCacheStrategy.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AASH,OAAO,EAAE,aAAa,EAAc,MAAM,0BAA0B,CAAC;AAGrE,MAAM,OAAO,iBAAiB;IACnB,IAAI,GAAG,MAAM,CAAC;IAEvB,KAAK,CAAC,cAAc,CAClB,GAAe,EACf,WAAmC,EACnC,IAA0B;QAK1B,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,cAAc,EAAE,EAAE,EAAE,CAAC;IAC9C,CAAC;IAED,cAAc,CAAC,MAA8B;QAC3C,OAAO,aAAa,CAClB,uFAAuF;YACrF,qCAAqC,CACxC,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -11,10 +11,11 @@
|
|
|
11
11
|
* `CacheDecision` subflow at runtime. Provider-independent
|
|
12
12
|
* identification of "cacheable prefix in field X up to index Y".
|
|
13
13
|
*
|
|
14
|
-
* 3.
|
|
15
|
-
* provider (
|
|
16
|
-
*
|
|
17
|
-
* cache metrics
|
|
14
|
+
* 3. STRATEGY — one `CacheStrategy` per CAPABILITY, chosen from what the
|
|
15
|
+
* provider DECLARES (`LLMProvider.promptCaching`), never from its name:
|
|
16
|
+
* explicit breakpoints, automatic prefix caching, or none. Decides
|
|
17
|
+
* which markers reach the request AND reads cache metrics off the
|
|
18
|
+
* port usage. The adapter owns the wire format.
|
|
18
19
|
*
|
|
19
20
|
* The interfaces are read-only / immutable by convention. Strategies
|
|
20
21
|
* MUST be stateless across runs; per-run state lives in the
|
|
@@ -110,14 +111,16 @@ export interface CachePolicyContext {
|
|
|
110
111
|
*
|
|
111
112
|
* The CacheDecision subflow walks `activeInjections` and emits one
|
|
112
113
|
* marker per slot whose entries from index 0..boundaryIndex form a
|
|
113
|
-
* stable, contiguous, cacheable prefix
|
|
114
|
+
* stable, contiguous, cacheable prefix — and one more on the conversation
|
|
115
|
+
* tail when everything before it is cacheable (the moving breakpoint).
|
|
114
116
|
*
|
|
115
|
-
* `field` is the request field this marker targets.
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
* - `'
|
|
119
|
-
* - `'
|
|
120
|
-
*
|
|
117
|
+
* `field` is the request field this marker targets. An adapter that declares
|
|
118
|
+
* `promptCaching.mode: 'breakpoints'` encodes it on its wire; the Anthropic
|
|
119
|
+
* one does:
|
|
120
|
+
* - `'system'` → `cache_control` on a system block
|
|
121
|
+
* - `'tools'` → `cache_control` on a tools array entry
|
|
122
|
+
* - `'messages'` → `cache_control` on the LAST content block of the
|
|
123
|
+
* message the index names (Anthropic's positional rule)
|
|
121
124
|
*/
|
|
122
125
|
export interface CacheMarker {
|
|
123
126
|
readonly field: 'system' | 'tools' | 'messages';
|
|
@@ -126,12 +129,11 @@ export interface CacheMarker {
|
|
|
126
129
|
* cached prefix. Everything from index 0..boundaryIndex (inclusive)
|
|
127
130
|
* is cacheable.
|
|
128
131
|
*
|
|
129
|
-
* **Provider note for `field: 'messages'`**:
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
* see this complexity.
|
|
132
|
+
* **Provider note for `field: 'messages'`**: the index is a position in
|
|
133
|
+
* `LLMRequest.messages`. Anthropic's `cache_control` on `messages` is
|
|
134
|
+
* positional — it takes effect on the LAST content block of a message —
|
|
135
|
+
* and the adapter translates the index into its own (coalesced) message
|
|
136
|
+
* array; consumers and the CacheDecision subflow don't see this.
|
|
135
137
|
*/
|
|
136
138
|
readonly boundaryIndex: number;
|
|
137
139
|
/**
|
|
@@ -147,31 +149,68 @@ export interface CacheMarker {
|
|
|
147
149
|
readonly reason: string;
|
|
148
150
|
}
|
|
149
151
|
/**
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
+
* How an adapter's wire caches a repeated prompt prefix — DECLARED by the
|
|
153
|
+
* adapter, read by the agent to choose its cache strategy
|
|
154
|
+
* (`agentfootprint/cache` · `cacheStrategyFor`).
|
|
152
155
|
*
|
|
153
|
-
*
|
|
154
|
-
*
|
|
156
|
+
* - `'breakpoints'` — the provider caches a prefix only where the request
|
|
157
|
+
* marks it (Anthropic's `cache_control`). The adapter reads
|
|
158
|
+
* `LLMRequest.cacheMarkers` and writes them on its wire, at most
|
|
159
|
+
* `maxBreakpoints` per request.
|
|
160
|
+
* - `'automatic'` — the provider caches repeated prefixes on its own (OpenAI).
|
|
161
|
+
* Markers are inert; nothing the request says changes what is cached.
|
|
162
|
+
*
|
|
163
|
+
* `reportsUsage` says whether the adapter lifts the provider's cache token
|
|
164
|
+
* counts onto `LLMResponse.usage.cacheRead` / `cacheWrite`. The cache meter
|
|
165
|
+
* reads it: `false` makes every call's cache claim *not applicable*, never a
|
|
166
|
+
* zero.
|
|
167
|
+
*
|
|
168
|
+
* @example
|
|
169
|
+
* ```ts
|
|
170
|
+
* // A wrapper forwards what it wraps, like every other capability:
|
|
171
|
+
* const wrapped: LLMProvider = {
|
|
172
|
+
* name: `my-app/${inner.name}`,
|
|
173
|
+
* ...(inner.promptCaching !== undefined && { promptCaching: inner.promptCaching }),
|
|
174
|
+
* complete: (req, hooks) => inner.complete(req, hooks),
|
|
175
|
+
* };
|
|
176
|
+
* ```
|
|
177
|
+
*/
|
|
178
|
+
export type PromptCaching = {
|
|
179
|
+
readonly mode: 'breakpoints';
|
|
180
|
+
/** Breakpoints the wire honours on one request (Anthropic: 4). */
|
|
181
|
+
readonly maxBreakpoints: number;
|
|
182
|
+
readonly reportsUsage: boolean;
|
|
183
|
+
} | {
|
|
184
|
+
readonly mode: 'automatic';
|
|
185
|
+
readonly reportsUsage: boolean;
|
|
186
|
+
};
|
|
187
|
+
/**
|
|
188
|
+
* The cache strategy an agent runs between request assembly and the provider.
|
|
189
|
+
*
|
|
190
|
+
* Chosen by CAPABILITY: `cacheStrategyFor(provider)` reads the provider's
|
|
191
|
+
* declared `promptCaching` and returns `BreakpointCacheStrategy`,
|
|
192
|
+
* `AutomaticCacheStrategy` or `NoOpCacheStrategy`. Pass your own as
|
|
193
|
+
* `Agent.create({ cacheStrategy })` to override it.
|
|
194
|
+
*
|
|
195
|
+
* Strategies MUST be stateless across runs; per-run state arrives in the
|
|
196
|
+
* {@link CacheStrategyContext}.
|
|
155
197
|
*/
|
|
156
198
|
export interface CacheStrategy {
|
|
157
|
-
/** Provider name match. e.g. `'anthropic'`, `'openai'`, `'bedrock'`. */
|
|
158
|
-
readonly providerName: string;
|
|
159
199
|
/**
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
*
|
|
200
|
+
* What the run's receipt records as the strategy that stood between
|
|
201
|
+
* assembly and the port (`Receipt.cache.strategy`). The built-ins name the
|
|
202
|
+
* capability they serve: `'breakpoints'`, `'automatic'`, `'none'`.
|
|
163
203
|
*/
|
|
164
|
-
readonly
|
|
204
|
+
readonly name: string;
|
|
165
205
|
/**
|
|
166
|
-
*
|
|
206
|
+
* Decide which agnostic markers reach the request.
|
|
167
207
|
*
|
|
168
|
-
* Async to support handle-based caching (Gemini
|
|
169
|
-
*
|
|
170
|
-
* the interface is async-ready for v2.7+).
|
|
208
|
+
* Async to support handle-based caching (Gemini's `createCachedContent`
|
|
209
|
+
* references handles) without another interface change.
|
|
171
210
|
*
|
|
172
|
-
* Returns the
|
|
173
|
-
*
|
|
174
|
-
*
|
|
211
|
+
* Returns the request (with `cacheMarkers` set for the adapter to encode)
|
|
212
|
+
* AND the markers actually applied, after clamping. `markersApplied` flows
|
|
213
|
+
* into the receipt and the cacheRecorder.
|
|
175
214
|
*/
|
|
176
215
|
prepareRequest(req: LLMRequest, candidates: readonly CacheMarker[], ctx: CacheStrategyContext): Promise<{
|
|
177
216
|
readonly request: LLMRequest;
|
|
@@ -191,49 +230,12 @@ export interface CacheStrategy {
|
|
|
191
230
|
* - `unknown(reason, …)` — nothing measured this call (no usage payload,
|
|
192
231
|
* or the provider reported no cache fields). The
|
|
193
232
|
* report renders this as *unmeasured*, never 0.
|
|
194
|
-
* - `notApplicable(…)` — this provider
|
|
195
|
-
*
|
|
196
|
-
*
|
|
233
|
+
* - `notApplicable(…)` — this provider cannot report cache usage at
|
|
234
|
+
* all (it declares no `promptCaching`, or
|
|
235
|
+
* declares `reportsUsage: false`).
|
|
197
236
|
*/
|
|
198
237
|
extractMetrics(usage: CacheUsage | undefined): Claim<CacheMetrics>;
|
|
199
238
|
}
|
|
200
|
-
/**
|
|
201
|
-
* Static description of a strategy's capabilities. The CacheDecision
|
|
202
|
-
* subflow reads this BEFORE calling `prepareRequest` so it can clamp
|
|
203
|
-
* candidates to a count the strategy can actually use.
|
|
204
|
-
*/
|
|
205
|
-
export interface CacheCapabilities {
|
|
206
|
-
/**
|
|
207
|
-
* `true` if this strategy actually does anything. `false` for NoOp,
|
|
208
|
-
* Mock, or providers we haven't built yet. CacheDecision subflow
|
|
209
|
-
* skips entirely when `enabled` is `false`.
|
|
210
|
-
*/
|
|
211
|
-
readonly enabled: boolean;
|
|
212
|
-
/**
|
|
213
|
-
* Maximum number of cache markers per request. Anthropic enforces 4
|
|
214
|
-
* cache breakpoints per request; OpenAI is automatic (∞); Gemini
|
|
215
|
-
* is per-handle (∞ effectively). Strategies clamp internally.
|
|
216
|
-
*/
|
|
217
|
-
readonly maxMarkers: number;
|
|
218
|
-
/**
|
|
219
|
-
* TTL values this strategy can map to. Anthropic supports both;
|
|
220
|
-
* OpenAI is fixed (~5min); some providers may only support one.
|
|
221
|
-
*/
|
|
222
|
-
readonly ttls: ReadonlyArray<'short' | 'long'>;
|
|
223
|
-
/**
|
|
224
|
-
* Which request fields this strategy can mark. Most providers support
|
|
225
|
-
* all three (system / tools / messages); some are field-restricted.
|
|
226
|
-
*/
|
|
227
|
-
readonly fields: ReadonlyArray<'system' | 'tools' | 'messages'>;
|
|
228
|
-
/**
|
|
229
|
-
* `true` if the provider auto-caches without explicit markers (OpenAI).
|
|
230
|
-
* In that case `prepareRequest` is a pass-through; only
|
|
231
|
-
* `extractMetrics` does meaningful work. Surfaced for documentation
|
|
232
|
-
* (so consumers know `cache: 'never'` may not actually disable caching
|
|
233
|
-
* on auto-caching providers).
|
|
234
|
-
*/
|
|
235
|
-
readonly automatic: boolean;
|
|
236
|
-
}
|
|
237
239
|
/**
|
|
238
240
|
* Per-run state passed into `prepareRequest`. Strategies use this to
|
|
239
241
|
* make per-iteration decisions (rate of cache invalidation, current
|
|
@@ -243,10 +245,9 @@ export interface CacheStrategyContext {
|
|
|
243
245
|
readonly iteration: number;
|
|
244
246
|
readonly iterationsRemaining: number;
|
|
245
247
|
/**
|
|
246
|
-
* Hit rate across previous iterations of this run (0..1)
|
|
247
|
-
*
|
|
248
|
-
*
|
|
249
|
-
* penalty without recoup).
|
|
248
|
+
* Hit rate across previous iterations of this run (0..1), when something
|
|
249
|
+
* supplied one. Nothing in the library writes it today, so it arrives
|
|
250
|
+
* `undefined`; the CacheGate's hit-rate rule reads the same value.
|
|
250
251
|
*/
|
|
251
252
|
readonly recentHitRate: number | undefined;
|
|
252
253
|
/**
|
package/dist/esm/cache/types.js
CHANGED
|
@@ -11,10 +11,11 @@
|
|
|
11
11
|
* `CacheDecision` subflow at runtime. Provider-independent
|
|
12
12
|
* identification of "cacheable prefix in field X up to index Y".
|
|
13
13
|
*
|
|
14
|
-
* 3.
|
|
15
|
-
* provider (
|
|
16
|
-
*
|
|
17
|
-
* cache metrics
|
|
14
|
+
* 3. STRATEGY — one `CacheStrategy` per CAPABILITY, chosen from what the
|
|
15
|
+
* provider DECLARES (`LLMProvider.promptCaching`), never from its name:
|
|
16
|
+
* explicit breakpoints, automatic prefix caching, or none. Decides
|
|
17
|
+
* which markers reach the request AND reads cache metrics off the
|
|
18
|
+
* port usage. The adapter owns the wire format.
|
|
18
19
|
*
|
|
19
20
|
* The interfaces are read-only / immutable by convention. Strategies
|
|
20
21
|
* MUST be stateless across runs; per-run state lives in the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/cache/types.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/cache/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG"}
|
package/dist/esm/core/Agent.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ import { type CheckInBuilderOptions } from './checkin.js';
|
|
|
27
27
|
import type { MemoryDefinition } from '../memory/define.types.js';
|
|
28
28
|
import type { MemoryIdentity } from '../memory/identity/types.js';
|
|
29
29
|
import type { SelfExplainBinding } from '../lib/trace-toolpack/selfExplain.js';
|
|
30
|
+
import { type ChildOutcome } from './terminalVerdict.js';
|
|
30
31
|
import type { ResolvedEvidenceGate } from './agent/evidence/types.js';
|
|
31
32
|
import type { Injection, InjectionContext } from '../lib/injection-engine/types.js';
|
|
32
33
|
import type { CursorMove, EntryScoring, TurnRoutingPlan } from '../lib/injection-engine/skillGraph.js';
|
|
@@ -137,11 +138,9 @@ export declare class Agent extends RunnerBase<AgentInput, AgentOutput> {
|
|
|
137
138
|
*/
|
|
138
139
|
private readonly cachingDisabledValue;
|
|
139
140
|
/**
|
|
140
|
-
*
|
|
141
|
-
* `
|
|
142
|
-
*
|
|
143
|
-
* Phase 7+ implementations (Anthropic, OpenAI, Bedrock) register
|
|
144
|
-
* themselves in the strategyRegistry on import.
|
|
141
|
+
* The CacheStrategy this agent runs. Chosen at build time from the
|
|
142
|
+
* provider's declared `promptCaching` (`cacheStrategyFor`) unless the
|
|
143
|
+
* consumer passes one explicitly.
|
|
145
144
|
*/
|
|
146
145
|
private readonly cacheStrategy;
|
|
147
146
|
private readonly registry;
|
|
@@ -493,6 +492,10 @@ export declare class Agent extends RunnerBase<AgentInput, AgentOutput> {
|
|
|
493
492
|
* kept here rather than read back from the recording. Undefined after a run
|
|
494
493
|
* that failed or paused. */
|
|
495
494
|
private lastRunAnswer?;
|
|
495
|
+
/** Whether any run on this instance got past input admission — so a
|
|
496
|
+
* refused FIRST turn is reported as 'never-run', never as "continue from
|
|
497
|
+
* your earlier accepted checkpoint" when there is none. */
|
|
498
|
+
private hadAdmittedRun;
|
|
496
499
|
/** The id the CONSUMER chose, or undefined when they took the default.
|
|
497
500
|
* `this.id` cannot answer that question — it is `'agent'` either way — and
|
|
498
501
|
* the stored-conversation fingerprint refuses only on ids somebody picked
|
|
@@ -550,8 +553,8 @@ export declare class Agent extends RunnerBase<AgentInput, AgentOutput> {
|
|
|
550
553
|
*/
|
|
551
554
|
private readonly reliabilityConfig?;
|
|
552
555
|
/**
|
|
553
|
-
* Resolved ThinkingHandler (v2.14+).
|
|
554
|
-
*
|
|
556
|
+
* Resolved ThinkingHandler (v2.14+). The provider's DECLARED one
|
|
557
|
+
* (`thinkingHandlerFor`) UNLESS the builder explicitly set one
|
|
555
558
|
* (or `null` to opt out). When undefined, the NormalizeThinking
|
|
556
559
|
* sub-subflow is NOT mounted at chart build time — zero overhead
|
|
557
560
|
* for non-thinking agents.
|
|
@@ -1046,7 +1049,10 @@ export declare class Agent extends RunnerBase<AgentInput, AgentOutput> {
|
|
|
1046
1049
|
* hand it back next turn, and the agent continues where it left off — across
|
|
1047
1050
|
* a restart, a deploy, or a different machine.
|
|
1048
1051
|
*
|
|
1049
|
-
* Returns `undefined` before any run has completed
|
|
1052
|
+
* Returns `undefined` before any run has completed or when the latest run
|
|
1053
|
+
* was refused by input middleware. A refused input is not an admitted
|
|
1054
|
+
* conversation. Keep an earlier accepted checkpoint to continue explicitly;
|
|
1055
|
+
* `followUp()` after input denial raises `NoConversationError`.
|
|
1050
1056
|
*
|
|
1051
1057
|
* **Read from the run's own recording, not from a second copy.** The history
|
|
1052
1058
|
* comes from `getLastSnapshot().sharedState.history` — the state the run
|
|
@@ -1076,11 +1082,16 @@ export declare class Agent extends RunnerBase<AgentInput, AgentOutput> {
|
|
|
1076
1082
|
* const conversation = agent.checkpoint(); // persist anywhere
|
|
1077
1083
|
* // …a restart later, on a fresh Agent:
|
|
1078
1084
|
* await agent.run({ message: 'Make it three.', continueFrom: conversation });
|
|
1079
|
-
* // `continueFrom`
|
|
1080
|
-
* //
|
|
1085
|
+
* // `continueFrom` admits the new turn through the 'input' middleware chain.
|
|
1086
|
+
* // `resumeOnError` rechecks originalInput but replays stored history as-is;
|
|
1087
|
+
* // it does not rewrite entries manually appended to that history.
|
|
1081
1088
|
* ```
|
|
1082
1089
|
*/
|
|
1083
1090
|
checkpoint(): AgentRunCheckpoint | undefined;
|
|
1091
|
+
/** Called as each run/resume ends: remember a run that got past input admission. */
|
|
1092
|
+
private noteAdmittedRun;
|
|
1093
|
+
/** Whether input middleware refused the last run's message — the one reading both doors ask. */
|
|
1094
|
+
private lastInputRefused;
|
|
1084
1095
|
/** Both checkpoint doors keep the repair budget separately from conversation text. */
|
|
1085
1096
|
private evidenceRecoveryOf;
|
|
1086
1097
|
/**
|
|
@@ -1664,6 +1675,21 @@ export declare class Agent extends RunnerBase<AgentInput, AgentOutput> {
|
|
|
1664
1675
|
* ```
|
|
1665
1676
|
*/
|
|
1666
1677
|
assessment(declarations?: AssessmentDeclarations): Promise<AnswerAssessment | undefined>;
|
|
1678
|
+
/**
|
|
1679
|
+
* @internal What a mount of this agent's chart handed back
|
|
1680
|
+
* (`core/terminalVerdict.ts` · `ReadsItsOwnOutcome`, read by every
|
|
1681
|
+
* composition): the ANSWER, or the terminal verdict the chart ended on. A
|
|
1682
|
+
* string, or the validated answer's `{ finalContent, answerValidationCommitted }`,
|
|
1683
|
+
* is the answer; a verdict is read ONLY from the chart's state — handed over
|
|
1684
|
+
* when the chart returned no result — with the one translation this agent's
|
|
1685
|
+
* own run boundary (`finalizeResult`) uses. The `'tell-model'` consent record
|
|
1686
|
+
* travels off tracked state, so it is raised by the run boundary only.
|
|
1687
|
+
*/
|
|
1688
|
+
outcomeOf(sfOutput: unknown): ChildOutcome;
|
|
1689
|
+
/** The records a run ends on in place of an answer, in the order the boundary raises them. */
|
|
1690
|
+
private refusalVerdictOf;
|
|
1691
|
+
/** Answer validation's verdict on a run that reached the end (7.24): blocked, or never committed. */
|
|
1692
|
+
private validationVerdictOf;
|
|
1667
1693
|
private finalizeResult;
|
|
1668
1694
|
private buildChart;
|
|
1669
1695
|
}
|