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
package/dist/esm/core/Agent.js
CHANGED
|
@@ -18,7 +18,7 @@ import { ReliabilityFailFastError } from '../reliability/types.js';
|
|
|
18
18
|
import { extractSequence } from '../security/extractSequence.js';
|
|
19
19
|
import { PolicyHaltError } from '../security/PolicyHaltError.js';
|
|
20
20
|
import { updateSkillHistory as updateSkillHistoryStage } from '../cache/CacheGateDecider.js';
|
|
21
|
-
import {
|
|
21
|
+
import { cacheStrategyFor } from '../cache/cacheStrategyFor.js';
|
|
22
22
|
import { buildBrainFor, describeServingBrain } from './agent/skillBrains.js';
|
|
23
23
|
import { SUBFLOW_IDS } from '../conventions.js';
|
|
24
24
|
import { DecisionRequiredError, assertDecisionIsNotStale, isPaused, pauseDemandsDecision, } from './pause.js';
|
|
@@ -114,6 +114,9 @@ import { buildStepNudgeStage } from './agent/stages/stepNudge.js';
|
|
|
114
114
|
import { buildEvidenceRecheckStage } from './agent/stages/evidenceRecheck.js';
|
|
115
115
|
import { toolWantsOf } from './agent/stagedRefs.js';
|
|
116
116
|
import { wrapUpStage } from './agent/stages/wrapUp.js';
|
|
117
|
+
import { failFastRecordOf } from '../reliability/failFastRecord.js';
|
|
118
|
+
import { terminalErrorOf } from './terminalVerdict.js';
|
|
119
|
+
import { isValidatedDelivery } from './agent/stages/breakFinal.js';
|
|
117
120
|
import { evidenceRefusalSentence } from './agent/evidence/gate.js';
|
|
118
121
|
import { UnsupportedValuesError } from './agent/evidence/errors.js';
|
|
119
122
|
import { checkerGoverns } from '../adapters/types.js';
|
|
@@ -130,14 +133,14 @@ import { InvalidRunInputError, normalizeRunInput } from './runInput.js';
|
|
|
130
133
|
import { clockOf } from './time/rows.js';
|
|
131
134
|
import { draftClock, readRunTime, readTimeOptions, } from './time/clock.js';
|
|
132
135
|
import { buildOutputRetryStage } from './agent/stages/outputRetry.js';
|
|
133
|
-
import { RunnerBase, makeRunId } from './RunnerBase.js';
|
|
136
|
+
import { RunnerBase, makeRunId, withRunSignalInEnv } from './RunnerBase.js';
|
|
134
137
|
import { clampIterations, validateMemoryIdUniqueness, validateToolNameUniqueness, } from './agent/validators.js';
|
|
135
138
|
import { buildRouteDeciderStage } from './agent/stages/route.js';
|
|
136
139
|
import { withAnswerValidation } from './agent/stages/answerValidation.js';
|
|
140
|
+
import { hasOutputMiddleware } from './agent/middleware/messagePhase.js';
|
|
137
141
|
import { withAnswerCoverage } from './agent/stages/answerCoverage.js';
|
|
138
142
|
import { AnswerValidationError, } from '../answer-validation/index.js';
|
|
139
143
|
import { buildSeedStage } from './agent/stages/seed.js';
|
|
140
|
-
import { MessageDeniedError } from './agent/middleware/errors.js';
|
|
141
144
|
import { buildCallLLMStage } from './agent/stages/callLLM.js';
|
|
142
145
|
import { buildToolCallsHandler, notServedResult } from './agent/stages/toolCalls.js';
|
|
143
146
|
import { buildToolResolver } from './agent/stages/toolResolver.js';
|
|
@@ -153,7 +156,7 @@ import { buildDynamicAgentChart } from './agent/buildDynamicAgentChart.js';
|
|
|
153
156
|
import { buildToolRegistry } from './agent/buildToolRegistry.js';
|
|
154
157
|
import { AgentBuilder } from './agent/AgentBuilder.js';
|
|
155
158
|
import { buildThinkingSubflow } from './slots/buildThinkingSubflow.js';
|
|
156
|
-
import {
|
|
159
|
+
import { thinkingHandlerFor } from '../thinking/thinkingHandlerFor.js';
|
|
157
160
|
export { AgentBuilder };
|
|
158
161
|
// Public types (AgentOptions, AgentInput, AgentOutput) extracted to
|
|
159
162
|
// ./agent/types.ts and re-exported above (v2.11.1).
|
|
@@ -211,11 +214,9 @@ export class Agent extends RunnerBase {
|
|
|
211
214
|
*/
|
|
212
215
|
cachingDisabledValue;
|
|
213
216
|
/**
|
|
214
|
-
*
|
|
215
|
-
* `
|
|
216
|
-
*
|
|
217
|
-
* Phase 7+ implementations (Anthropic, OpenAI, Bedrock) register
|
|
218
|
-
* themselves in the strategyRegistry on import.
|
|
217
|
+
* The CacheStrategy this agent runs. Chosen at build time from the
|
|
218
|
+
* provider's declared `promptCaching` (`cacheStrategyFor`) unless the
|
|
219
|
+
* consumer passes one explicitly.
|
|
219
220
|
*/
|
|
220
221
|
cacheStrategy;
|
|
221
222
|
registry;
|
|
@@ -583,6 +584,10 @@ export class Agent extends RunnerBase {
|
|
|
583
584
|
* kept here rather than read back from the recording. Undefined after a run
|
|
584
585
|
* that failed or paused. */
|
|
585
586
|
lastRunAnswer;
|
|
587
|
+
/** Whether any run on this instance got past input admission — so a
|
|
588
|
+
* refused FIRST turn is reported as 'never-run', never as "continue from
|
|
589
|
+
* your earlier accepted checkpoint" when there is none. */
|
|
590
|
+
hadAdmittedRun = false;
|
|
586
591
|
/** The id the CONSUMER chose, or undefined when they took the default.
|
|
587
592
|
* `this.id` cannot answer that question — it is `'agent'` either way — and
|
|
588
593
|
* the stored-conversation fingerprint refuses only on ids somebody picked
|
|
@@ -640,8 +645,8 @@ export class Agent extends RunnerBase {
|
|
|
640
645
|
*/
|
|
641
646
|
reliabilityConfig;
|
|
642
647
|
/**
|
|
643
|
-
* Resolved ThinkingHandler (v2.14+).
|
|
644
|
-
*
|
|
648
|
+
* Resolved ThinkingHandler (v2.14+). The provider's DECLARED one
|
|
649
|
+
* (`thinkingHandlerFor`) UNLESS the builder explicitly set one
|
|
645
650
|
* (or `null` to opt out). When undefined, the NormalizeThinking
|
|
646
651
|
* sub-subflow is NOT mounted at chart build time — zero overhead
|
|
647
652
|
* for non-thinking agents.
|
|
@@ -717,9 +722,11 @@ export class Agent extends RunnerBase {
|
|
|
717
722
|
this.systemPromptValue = systemPromptValue;
|
|
718
723
|
this.systemPromptCachePolicy = systemPromptCachePolicy;
|
|
719
724
|
this.cachingDisabledValue = cachingDisabled;
|
|
720
|
-
//
|
|
721
|
-
//
|
|
722
|
-
|
|
725
|
+
// The strategy the provider's DECLARED prompt caching selects, unless the
|
|
726
|
+
// caller overrides it — never one looked up by `provider.name`, which a
|
|
727
|
+
// renaming decorator (`withRetry`, an app's own wrapper) rewrites. A
|
|
728
|
+
// provider that declares nothing gets the no-op strategy.
|
|
729
|
+
this.cacheStrategy = cacheStrategy ?? cacheStrategyFor(opts.provider);
|
|
723
730
|
this.registry = registry;
|
|
724
731
|
this.injections = injections;
|
|
725
732
|
this.skillGraphNextSkill = skillGraphNextSkill;
|
|
@@ -1050,12 +1057,12 @@ export class Agent extends RunnerBase {
|
|
|
1050
1057
|
if (reliabilityConfig !== undefined)
|
|
1051
1058
|
this.reliabilityConfig = reliabilityConfig;
|
|
1052
1059
|
// v2.14 — Resolve thinking handler. Three states:
|
|
1053
|
-
// - thinkingHandlerValue === undefined →
|
|
1060
|
+
// - thinkingHandlerValue === undefined → the provider's DECLARED handler
|
|
1054
1061
|
// - thinkingHandlerValue === null → opt out (no handler)
|
|
1055
1062
|
// - thinkingHandlerValue: ThinkingHandler → explicit override
|
|
1056
|
-
//
|
|
1057
|
-
//
|
|
1058
|
-
//
|
|
1063
|
+
// A provider that declares none gets no subflow at chart build time.
|
|
1064
|
+
// Never chosen by `provider.name`: a renaming wrapper that forwards the
|
|
1065
|
+
// declaration keeps it.
|
|
1059
1066
|
if (thinkingHandlerValue === null) {
|
|
1060
1067
|
// explicit opt-out
|
|
1061
1068
|
}
|
|
@@ -1063,9 +1070,9 @@ export class Agent extends RunnerBase {
|
|
|
1063
1070
|
this.thinkingHandler = thinkingHandlerValue;
|
|
1064
1071
|
}
|
|
1065
1072
|
else {
|
|
1066
|
-
const
|
|
1067
|
-
if (
|
|
1068
|
-
this.thinkingHandler =
|
|
1073
|
+
const declared = thinkingHandlerFor(opts.provider);
|
|
1074
|
+
if (declared)
|
|
1075
|
+
this.thinkingHandler = declared;
|
|
1069
1076
|
}
|
|
1070
1077
|
if (thinkingBudgetValue !== undefined)
|
|
1071
1078
|
this.thinkingBudget = thinkingBudgetValue;
|
|
@@ -1499,7 +1506,7 @@ export class Agent extends RunnerBase {
|
|
|
1499
1506
|
// starts — a run with no zone anywhere runs with its zone UNKNOWN (G15),
|
|
1500
1507
|
// never on the server's zone.
|
|
1501
1508
|
const clockDraft = this.clockDraftFor(runInput.time ?? options?.time, 'Agent.run');
|
|
1502
|
-
const engineOptions = withoutTime(options);
|
|
1509
|
+
const engineOptions = withRunSignalInEnv(withoutTime(options));
|
|
1503
1510
|
// Timing next, and before the executor exists: both of these refuse a call
|
|
1504
1511
|
// that would have SUCCEEDED into corrupted per-instance state or an
|
|
1505
1512
|
// orphaned human question. See ./conversation.ts for why they are throws.
|
|
@@ -1683,6 +1690,7 @@ export class Agent extends RunnerBase {
|
|
|
1683
1690
|
this.fileIntegrityDisposition();
|
|
1684
1691
|
// Always released: a recording left subscribed would keep listening
|
|
1685
1692
|
// through the next run and grow a tail nobody reads.
|
|
1693
|
+
this.noteAdmittedRun();
|
|
1686
1694
|
recording?.stop();
|
|
1687
1695
|
stopTracking();
|
|
1688
1696
|
this.inFlightRunId = undefined;
|
|
@@ -1733,12 +1741,12 @@ export class Agent extends RunnerBase {
|
|
|
1733
1741
|
// Refuse BEFORE the timing guards, so "there is nothing to follow up on"
|
|
1734
1742
|
// is never reported as "a run is in flight" for an agent that has simply
|
|
1735
1743
|
// not run yet.
|
|
1736
|
-
if (this.getLastSnapshot() === undefined) {
|
|
1744
|
+
if (this.getLastSnapshot() === undefined || (this.lastInputRefused() && !this.hadAdmittedRun)) {
|
|
1737
1745
|
throw new NoConversationError('Agent.followUp', 'never-run');
|
|
1738
1746
|
}
|
|
1739
1747
|
const conversation = this.checkpoint();
|
|
1740
1748
|
if (conversation === undefined || conversation.history.length === 0) {
|
|
1741
|
-
throw new NoConversationError('Agent.followUp', 'last-run-unfinished');
|
|
1749
|
+
throw new NoConversationError('Agent.followUp', this.lastInputRefused() ? 'last-input-refused' : 'last-run-unfinished');
|
|
1742
1750
|
}
|
|
1743
1751
|
return this.run({ message, continueFrom: conversation }, options);
|
|
1744
1752
|
}
|
|
@@ -2014,7 +2022,7 @@ export class Agent extends RunnerBase {
|
|
|
2014
2022
|
// moves; it is never applied — the paused turn's clock is kept, and a
|
|
2015
2023
|
// differing value is recorded by the ToolCalls resume door.
|
|
2016
2024
|
const passedTime = this.passedTimeFor(options?.time, 'Agent.resume');
|
|
2017
|
-
options = withoutTime(options);
|
|
2025
|
+
options = withRunSignalInEnv(withoutTime(options));
|
|
2018
2026
|
const gate = pauseDemandsDecision(checkpoint.pauseData);
|
|
2019
2027
|
if (gate && !isCheckInDecision(input))
|
|
2020
2028
|
throw new DecisionRequiredError(gate, input);
|
|
@@ -2153,6 +2161,7 @@ export class Agent extends RunnerBase {
|
|
|
2153
2161
|
// Same terms as the fresh-run path: rows on every exit, before the
|
|
2154
2162
|
// recording stops (9.60.0).
|
|
2155
2163
|
this.fileIntegrityDisposition();
|
|
2164
|
+
this.noteAdmittedRun();
|
|
2156
2165
|
recording?.stop();
|
|
2157
2166
|
this.inFlightRunId = undefined;
|
|
2158
2167
|
}
|
|
@@ -2197,7 +2206,10 @@ export class Agent extends RunnerBase {
|
|
|
2197
2206
|
* hand it back next turn, and the agent continues where it left off — across
|
|
2198
2207
|
* a restart, a deploy, or a different machine.
|
|
2199
2208
|
*
|
|
2200
|
-
* Returns `undefined` before any run has completed
|
|
2209
|
+
* Returns `undefined` before any run has completed or when the latest run
|
|
2210
|
+
* was refused by input middleware. A refused input is not an admitted
|
|
2211
|
+
* conversation. Keep an earlier accepted checkpoint to continue explicitly;
|
|
2212
|
+
* `followUp()` after input denial raises `NoConversationError`.
|
|
2201
2213
|
*
|
|
2202
2214
|
* **Read from the run's own recording, not from a second copy.** The history
|
|
2203
2215
|
* comes from `getLastSnapshot().sharedState.history` — the state the run
|
|
@@ -2227,8 +2239,9 @@ export class Agent extends RunnerBase {
|
|
|
2227
2239
|
* const conversation = agent.checkpoint(); // persist anywhere
|
|
2228
2240
|
* // …a restart later, on a fresh Agent:
|
|
2229
2241
|
* await agent.run({ message: 'Make it three.', continueFrom: conversation });
|
|
2230
|
-
* // `continueFrom`
|
|
2231
|
-
* //
|
|
2242
|
+
* // `continueFrom` admits the new turn through the 'input' middleware chain.
|
|
2243
|
+
* // `resumeOnError` rechecks originalInput but replays stored history as-is;
|
|
2244
|
+
* // it does not rewrite entries manually appended to that history.
|
|
2232
2245
|
* ```
|
|
2233
2246
|
*/
|
|
2234
2247
|
checkpoint() {
|
|
@@ -2236,6 +2249,10 @@ export class Agent extends RunnerBase {
|
|
|
2236
2249
|
if (!snapshot)
|
|
2237
2250
|
return undefined;
|
|
2238
2251
|
const state = snapshot.sharedState;
|
|
2252
|
+
// Admission is decided by seed, before any conversation state is written.
|
|
2253
|
+
// Do not manufacture a blank replay carrier for an unadmitted attempt.
|
|
2254
|
+
if (this.lastInputRefused())
|
|
2255
|
+
return undefined;
|
|
2239
2256
|
const recorded = (state?.history ?? []);
|
|
2240
2257
|
const history = structuredClone(recorded);
|
|
2241
2258
|
if (this.lastRunAnswer !== undefined && this.lastRunAnswer.length > 0) {
|
|
@@ -2274,6 +2291,17 @@ export class Agent extends RunnerBase {
|
|
|
2274
2291
|
...(turnNumber !== undefined && { turnNumber }),
|
|
2275
2292
|
};
|
|
2276
2293
|
}
|
|
2294
|
+
/** Called as each run/resume ends: remember a run that got past input admission. */
|
|
2295
|
+
noteAdmittedRun() {
|
|
2296
|
+
if (this.getLastSnapshot() !== undefined && !this.lastInputRefused()) {
|
|
2297
|
+
this.hadAdmittedRun = true;
|
|
2298
|
+
}
|
|
2299
|
+
}
|
|
2300
|
+
/** Whether input middleware refused the last run's message — the one reading both doors ask. */
|
|
2301
|
+
lastInputRefused() {
|
|
2302
|
+
const state = this.getLastSnapshot()?.sharedState;
|
|
2303
|
+
return state?.messageDeniedPhase === 'input';
|
|
2304
|
+
}
|
|
2277
2305
|
/** Both checkpoint doors keep the repair budget separately from conversation text. */
|
|
2278
2306
|
evidenceRecoveryOf(state) {
|
|
2279
2307
|
if (state?.evidenceRevisionSpent !== true)
|
|
@@ -3544,110 +3572,158 @@ export class Agent extends RunnerBase {
|
|
|
3544
3572
|
const { assessAnswer } = await import('./agent/assessment/assess.js');
|
|
3545
3573
|
return assessAnswer({ snapshot }, declarations);
|
|
3546
3574
|
}
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3575
|
+
/**
|
|
3576
|
+
* @internal What a mount of this agent's chart handed back
|
|
3577
|
+
* (`core/terminalVerdict.ts` · `ReadsItsOwnOutcome`, read by every
|
|
3578
|
+
* composition): the ANSWER, or the terminal verdict the chart ended on. A
|
|
3579
|
+
* string, or the validated answer's `{ finalContent, answerValidationCommitted }`,
|
|
3580
|
+
* is the answer; a verdict is read ONLY from the chart's state — handed over
|
|
3581
|
+
* when the chart returned no result — with the one translation this agent's
|
|
3582
|
+
* own run boundary (`finalizeResult`) uses. The `'tell-model'` consent record
|
|
3583
|
+
* travels off tracked state, so it is raised by the run boundary only.
|
|
3584
|
+
*/
|
|
3585
|
+
outcomeOf(sfOutput) {
|
|
3586
|
+
if (typeof sfOutput === 'string')
|
|
3587
|
+
return { answer: sfOutput };
|
|
3588
|
+
if (isValidatedDelivery(sfOutput))
|
|
3589
|
+
return { answer: sfOutput.finalContent };
|
|
3590
|
+
if (typeof sfOutput === 'object' && sfOutput !== null) {
|
|
3591
|
+
const state = sfOutput;
|
|
3592
|
+
const verdict = this.refusalVerdictOf(state) ?? this.validationVerdictOf(state);
|
|
3593
|
+
if (verdict !== undefined)
|
|
3594
|
+
return { verdict };
|
|
3595
|
+
}
|
|
3596
|
+
return { answer: sfOutput };
|
|
3597
|
+
}
|
|
3598
|
+
/** The records a run ends on in place of an answer, in the order the boundary raises them. */
|
|
3599
|
+
refusalVerdictOf(state) {
|
|
3600
|
+
// Reliability fail-fast (v2.11.5+) — the loop in callLLM writes the record
|
|
3601
|
+
// and calls $break (`reliability/failFastRecord.ts`).
|
|
3558
3602
|
if (this.reliabilityConfig !== undefined) {
|
|
3559
|
-
const
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
const state = snap.sharedState;
|
|
3563
|
-
if (state.reliabilityFailKind !== undefined) {
|
|
3564
|
-
// Reconstruct the cause Error from the captured message+name —
|
|
3565
|
-
// see the matching note in reliabilityExecution.failFast about
|
|
3566
|
-
// why we don't keep the original Error in scope.
|
|
3567
|
-
let cause;
|
|
3568
|
-
if (state.reliabilityFailCauseMessage !== undefined) {
|
|
3569
|
-
cause = new Error(state.reliabilityFailCauseMessage);
|
|
3570
|
-
if (state.reliabilityFailCauseName !== undefined) {
|
|
3571
|
-
cause.name = state.reliabilityFailCauseName;
|
|
3572
|
-
}
|
|
3573
|
-
}
|
|
3574
|
-
throw new ReliabilityFailFastError({
|
|
3575
|
-
kind: state.reliabilityFailKind,
|
|
3576
|
-
reason: state.reliabilityFailReason ?? state.reliabilityFailKind,
|
|
3577
|
-
...(cause !== undefined && { cause }),
|
|
3578
|
-
...(state.reliabilityFailPayload !== undefined && {
|
|
3579
|
-
payload: state.reliabilityFailPayload,
|
|
3580
|
-
}),
|
|
3581
|
-
snapshot: snap,
|
|
3582
|
-
});
|
|
3583
|
-
}
|
|
3603
|
+
const record = failFastRecordOf(state);
|
|
3604
|
+
if (record !== undefined)
|
|
3605
|
+
return { kind: 'reliability-fail-fast', record };
|
|
3584
3606
|
}
|
|
3585
|
-
// Policy
|
|
3586
|
-
//
|
|
3587
|
-
//
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
throw new PolicyHaltError({
|
|
3604
|
-
reason: state.policyHaltReason,
|
|
3605
|
-
...(state.policyHaltTellLLM !== undefined && { tellLLM: state.policyHaltTellLLM }),
|
|
3607
|
+
// Policy halt (v2.12+) — a `PermissionChecker` returned `halt`; the
|
|
3608
|
+
// toolCalls handler wrote a synthetic tool_result and the policyHalt*
|
|
3609
|
+
// fields, and called $break.
|
|
3610
|
+
const halt = state;
|
|
3611
|
+
if (halt.policyHaltReason !== undefined && halt.policyHaltTarget !== undefined) {
|
|
3612
|
+
const history = halt.history ?? [];
|
|
3613
|
+
const iteration = halt.policyHaltIteration ?? 1;
|
|
3614
|
+
// Sequence at halt time — derived from history. Includes the
|
|
3615
|
+
// proposed call (which DID land in history as the synthetic
|
|
3616
|
+
// tool_result for protocol compliance, but the policy denied
|
|
3617
|
+
// execution). Filter it out so callers see only dispatched
|
|
3618
|
+
// calls, then append the proposed entry as a hint.
|
|
3619
|
+
const sequenceWithoutProposed = extractSequence(history.slice(0, -1), iteration);
|
|
3620
|
+
return {
|
|
3621
|
+
kind: 'policy-halt',
|
|
3622
|
+
halt: {
|
|
3623
|
+
reason: halt.policyHaltReason,
|
|
3624
|
+
...(halt.policyHaltTellLLM !== undefined && { tellLLM: halt.policyHaltTellLLM }),
|
|
3606
3625
|
sequence: [
|
|
3607
3626
|
...sequenceWithoutProposed,
|
|
3608
|
-
{ name:
|
|
3627
|
+
{ name: halt.policyHaltTarget, args: halt.policyHaltArgs, iteration },
|
|
3609
3628
|
],
|
|
3610
3629
|
iteration,
|
|
3611
3630
|
history,
|
|
3612
|
-
proposed: { name:
|
|
3613
|
-
...(
|
|
3614
|
-
}
|
|
3615
|
-
}
|
|
3631
|
+
proposed: { name: halt.policyHaltTarget, args: halt.policyHaltArgs ?? {} },
|
|
3632
|
+
...(halt.policyHaltCheckerId !== undefined && { checkerId: halt.policyHaltCheckerId }),
|
|
3633
|
+
},
|
|
3634
|
+
};
|
|
3616
3635
|
}
|
|
3617
3636
|
// Message-boundary refusal (7.18+) — a `messageMiddleware` returned
|
|
3618
|
-
// `deny
|
|
3619
|
-
//
|
|
3620
|
-
// because a refusal must never be mistaken for an answer: at 'input' no
|
|
3621
|
-
// model was ever asked, and at 'output' the middleware has just declined
|
|
3622
|
-
// to release what the model said.
|
|
3637
|
+
// `deny`; a refusal must never be mistaken for an answer: at 'input' no
|
|
3638
|
+
// model was asked, and at 'output' the middleware declined to release it.
|
|
3623
3639
|
if (this.messageMiddleware.length > 0) {
|
|
3624
|
-
const
|
|
3625
|
-
if (
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3640
|
+
const denied = state;
|
|
3641
|
+
if (denied.messageDeniedReason !== undefined) {
|
|
3642
|
+
return {
|
|
3643
|
+
kind: 'message-denied',
|
|
3644
|
+
denial: {
|
|
3645
|
+
reason: denied.messageDeniedReason,
|
|
3646
|
+
phase: denied.messageDeniedPhase ?? 'output',
|
|
3647
|
+
middleware: denied.messageDeniedBy ?? 'middleware',
|
|
3648
|
+
},
|
|
3649
|
+
};
|
|
3631
3650
|
}
|
|
3632
3651
|
}
|
|
3633
|
-
// Evidence
|
|
3634
|
-
//
|
|
3635
|
-
//
|
|
3636
|
-
// for the same reason: `rails` was chosen precisely so an answer carrying
|
|
3637
|
-
// invented identifiers cannot reach the caller as a string they are free
|
|
3638
|
-
// to ignore. `'assist'` and `'guard'` never reach here — their verdict is
|
|
3639
|
-
// committed state and an event, and `run()` returns the answer.
|
|
3652
|
+
// Evidence rails (9.35.0) — the answer still states values no tool result
|
|
3653
|
+
// carried, after the one revision the posture allows. `'assist'` and
|
|
3654
|
+
// `'guard'` never end here: their verdict is committed state and an event.
|
|
3640
3655
|
if (this.evidenceGate?.posture === 'rails') {
|
|
3641
|
-
const state = executor.getSnapshot().sharedState;
|
|
3642
3656
|
const verdict = state.unsupportedValues;
|
|
3643
3657
|
if (verdict !== undefined && verdict.refused) {
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3658
|
+
return {
|
|
3659
|
+
kind: 'unsupported-values',
|
|
3660
|
+
refusal: {
|
|
3661
|
+
values: verdict.values,
|
|
3662
|
+
candidates: verdict.candidates,
|
|
3663
|
+
revised: verdict.revised,
|
|
3664
|
+
message: evidenceRefusalSentence(verdict.values, 'rails', verdict.revised),
|
|
3665
|
+
},
|
|
3666
|
+
};
|
|
3667
|
+
}
|
|
3668
|
+
}
|
|
3669
|
+
return undefined;
|
|
3670
|
+
}
|
|
3671
|
+
/** Answer validation's verdict on a run that reached the end (7.24): blocked, or never committed. */
|
|
3672
|
+
validationVerdictOf(state) {
|
|
3673
|
+
const config = this.answerValidationConfig;
|
|
3674
|
+
if (config === undefined)
|
|
3675
|
+
return undefined;
|
|
3676
|
+
const s = state;
|
|
3677
|
+
if (s.answerValidationBlocked === true && s.answerValidation !== undefined) {
|
|
3678
|
+
return { kind: 'answer-validation', report: s.answerValidation };
|
|
3679
|
+
}
|
|
3680
|
+
if (s.answerValidation === undefined ||
|
|
3681
|
+
s.answerValidationCommitted !== true ||
|
|
3682
|
+
typeof s.finalContent !== 'string') {
|
|
3683
|
+
return {
|
|
3684
|
+
kind: 'answer-validation',
|
|
3685
|
+
report: {
|
|
3686
|
+
validatorId: config.id,
|
|
3687
|
+
validatorVersion: config.version,
|
|
3688
|
+
mode: config.mode,
|
|
3689
|
+
status: 'unverified',
|
|
3690
|
+
checked: 0,
|
|
3691
|
+
failed: 0,
|
|
3692
|
+
unreachable: 0,
|
|
3693
|
+
notApplicable: 0,
|
|
3694
|
+
checks: [],
|
|
3695
|
+
resolvedRefs: [],
|
|
3696
|
+
schemaAccepted: false,
|
|
3697
|
+
reason: 'delivery-incomplete',
|
|
3698
|
+
},
|
|
3699
|
+
};
|
|
3700
|
+
}
|
|
3701
|
+
return undefined;
|
|
3702
|
+
}
|
|
3703
|
+
finalizeResult(executor, result) {
|
|
3704
|
+
const paused = this.detectPause(executor, result);
|
|
3705
|
+
if (paused)
|
|
3706
|
+
return paused;
|
|
3707
|
+
const snap = executor.getSnapshot();
|
|
3708
|
+
const state = snap.sharedState;
|
|
3709
|
+
const refusal = this.refusalVerdictOf(state);
|
|
3710
|
+
if (refusal !== undefined) {
|
|
3711
|
+
if (refusal.kind === 'message-denied' && refusal.denial.phase === 'output') {
|
|
3712
|
+
// The chart stopped cleanly, so ErrorBridge's onRunFailed cannot
|
|
3713
|
+
// close public streams. This API boundary owns the refusal on both
|
|
3714
|
+
// run and resume. Name it as a virtual stage, not a fabricated
|
|
3715
|
+
// engine failure, and never echo policy text into a public stream.
|
|
3716
|
+
this.dispatcher.dispatch({
|
|
3717
|
+
type: 'agentfootprint.error.fatal',
|
|
3718
|
+
payload: {
|
|
3719
|
+
error: 'The output policy withheld this answer.',
|
|
3720
|
+
stage: '__output_admission__',
|
|
3721
|
+
scope: 'run',
|
|
3722
|
+
},
|
|
3723
|
+
meta: buildEventMeta({ runtimeStageId: '__output_admission__' }, this.currentRunContext),
|
|
3649
3724
|
});
|
|
3650
3725
|
}
|
|
3726
|
+
throw terminalErrorOf(refusal, snap);
|
|
3651
3727
|
}
|
|
3652
3728
|
// Credential-consent translation (8.6.0, `'tell-model'` only) — a tool
|
|
3653
3729
|
// DECLARED a credential, the provider answered `authorization-required`,
|
|
@@ -3671,38 +3747,18 @@ export class Agent extends RunnerBase {
|
|
|
3671
3747
|
}
|
|
3672
3748
|
if (result instanceof Error)
|
|
3673
3749
|
throw result;
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
}
|
|
3679
|
-
if (state.answerValidation === undefined ||
|
|
3680
|
-
state.answerValidationCommitted !== true ||
|
|
3681
|
-
typeof state.finalContent !== 'string') {
|
|
3682
|
-
const config = this.answerValidationConfig;
|
|
3683
|
-
throw new AnswerValidationError({
|
|
3684
|
-
validatorId: config.id,
|
|
3685
|
-
validatorVersion: config.version,
|
|
3686
|
-
mode: config.mode,
|
|
3687
|
-
status: 'unverified',
|
|
3688
|
-
checked: 0,
|
|
3689
|
-
failed: 0,
|
|
3690
|
-
unreachable: 0,
|
|
3691
|
-
notApplicable: 0,
|
|
3692
|
-
checks: [],
|
|
3693
|
-
resolvedRefs: [],
|
|
3694
|
-
schemaAccepted: false,
|
|
3695
|
-
reason: 'delivery-incomplete',
|
|
3696
|
-
});
|
|
3697
|
-
}
|
|
3750
|
+
const invalid = this.validationVerdictOf(state);
|
|
3751
|
+
if (invalid !== undefined)
|
|
3752
|
+
throw terminalErrorOf(invalid);
|
|
3753
|
+
if (this.answerValidationConfig !== undefined)
|
|
3698
3754
|
return state.finalContent;
|
|
3699
|
-
}
|
|
3700
3755
|
if (typeof result === 'string')
|
|
3701
3756
|
return result;
|
|
3702
3757
|
throw new Error('Agent: unexpected result shape — expected final-answer string');
|
|
3703
3758
|
}
|
|
3704
3759
|
// ─── Chart assembly ────────────────────────────────────────────
|
|
3705
3760
|
buildChart() {
|
|
3761
|
+
const governsOutput = hasOutputMiddleware(this.messageMiddleware);
|
|
3706
3762
|
const provider = this.provider;
|
|
3707
3763
|
const model = this.model;
|
|
3708
3764
|
const temperature = this.temperature;
|
|
@@ -4332,7 +4388,10 @@ export class Agent extends RunnerBase {
|
|
|
4332
4388
|
// seam peels `_findings` where the served schema carries it (ruled
|
|
4333
4389
|
// tools only) — value-conditional, the same grammar.
|
|
4334
4390
|
...(argumentSources && { argumentSources: true }),
|
|
4335
|
-
...(this.answerValidationConfig !== undefined && {
|
|
4391
|
+
...((this.answerValidationConfig !== undefined || governsOutput) && {
|
|
4392
|
+
suppressDraftTokens: true,
|
|
4393
|
+
}),
|
|
4394
|
+
...(governsOutput && { withholdDraftContent: true }),
|
|
4336
4395
|
// Tool choice by classifier (9.105.0): the outcome row after the reply.
|
|
4337
4396
|
...(this.toolChoiceOptions !== undefined && { toolChoice: true }),
|
|
4338
4397
|
// The declared ontology (9.106.0): the piece served from the run
|
|
@@ -4402,14 +4461,15 @@ export class Agent extends RunnerBase {
|
|
|
4402
4461
|
// brain or an escalation exists, so every other agent's stage reads no
|
|
4403
4462
|
// new scope key and resolves on the exact line it always did. The
|
|
4404
4463
|
// per-brain cache strategies resolve HERE, once, where the agent's own
|
|
4405
|
-
// strategy (override included) is known:
|
|
4406
|
-
//
|
|
4407
|
-
// provider-aware — the one
|
|
4464
|
+
// strategy (override included) is known: a brain on the agent's own
|
|
4465
|
+
// provider keeps it, any other provider gets the strategy its declared
|
|
4466
|
+
// `promptCaching` selects (markers are provider-aware — the one
|
|
4467
|
+
// genuinely risky seam, resolved statically).
|
|
4408
4468
|
...(this.skillBrains !== undefined &&
|
|
4409
4469
|
(this.skillBrains.bySkill.size > 0 || this.skillBrains.escalation !== undefined) && {
|
|
4410
4470
|
brainFor: buildBrainFor({
|
|
4411
4471
|
brains: this.skillBrains,
|
|
4412
|
-
|
|
4472
|
+
agentProvider: provider,
|
|
4413
4473
|
agentCacheStrategy: cacheStrategy,
|
|
4414
4474
|
}),
|
|
4415
4475
|
}),
|
|
@@ -4733,12 +4793,12 @@ export class Agent extends RunnerBase {
|
|
|
4733
4793
|
},
|
|
4734
4794
|
});
|
|
4735
4795
|
// v2.14 — Build the NormalizeThinking sub-subflow only when a
|
|
4736
|
-
// ThinkingHandler resolved (
|
|
4796
|
+
// ThinkingHandler resolved (declared by the provider OR
|
|
4737
4797
|
// explicitly set via .thinkingHandler()). Conditional mount ensures
|
|
4738
4798
|
// zero overhead for non-thinking agents — the chart has zero extra
|
|
4739
4799
|
// stages when undefined.
|
|
4740
4800
|
const thinkingSubflow = this.thinkingHandler
|
|
4741
|
-
? buildThinkingSubflow(this.thinkingHandler)
|
|
4801
|
+
? buildThinkingSubflow(this.thinkingHandler, this.provider.name)
|
|
4742
4802
|
: undefined;
|
|
4743
4803
|
// Chart composition extracted to ./agent/buildAgentChart.ts (v2.11.2).
|
|
4744
4804
|
// The deps object is identical for both chart shapes — only the
|
|
@@ -4859,6 +4919,7 @@ export class Agent extends RunnerBase {
|
|
|
4859
4919
|
toolMiddleware: this.toolMiddleware.length > 0,
|
|
4860
4920
|
}),
|
|
4861
4921
|
...(this.answerLayerOption.standingLine === true && { standingLine: true }),
|
|
4922
|
+
...(this.answerValidationConfig !== undefined && { validated: true }),
|
|
4862
4923
|
},
|
|
4863
4924
|
}),
|
|
4864
4925
|
// Tool choice by classifier (9.105.0): the mount args on the Tools
|
|
@@ -4883,6 +4944,8 @@ export class Agent extends RunnerBase {
|
|
|
4883
4944
|
...(this.timeOptions !== undefined && { timeWindows: true }),
|
|
4884
4945
|
...(inputsArmed && this.timeOptions !== undefined && { timeLimits: true }),
|
|
4885
4946
|
...(this.answerValidationConfig !== undefined && { hasAnswerValidation: true }),
|
|
4947
|
+
...(governsOutput && { releaseOutputTokens: true }),
|
|
4948
|
+
...(this.evidenceGate?.posture === 'rails' && { evidenceRails: true }),
|
|
4886
4949
|
// The out-of-budget wrap-up branch (9.56.0) — the conditional-mount law
|
|
4887
4950
|
// above, decided once beside the Route decider that routes to it so the
|
|
4888
4951
|
// two can never disagree about whether the branch exists.
|