agentfootprint 18.0.0 → 18.1.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/CAPABILITIES.md +2 -1
- package/dist/adapters/llm/BedrockProvider/client.js +93 -0
- package/dist/adapters/llm/BedrockProvider/client.js.map +1 -0
- package/dist/adapters/llm/BedrockProvider/guardedStream.js +150 -0
- package/dist/adapters/llm/BedrockProvider/guardedStream.js.map +1 -0
- package/dist/adapters/llm/BedrockProvider/guardedStreamBuffer.js +109 -0
- package/dist/adapters/llm/BedrockProvider/guardedStreamBuffer.js.map +1 -0
- package/dist/adapters/llm/BedrockProvider/guardrailClassify.js +189 -0
- package/dist/adapters/llm/BedrockProvider/guardrailClassify.js.map +1 -0
- package/dist/adapters/llm/BedrockProvider/guardrailConfig.js +79 -0
- package/dist/adapters/llm/BedrockProvider/guardrailConfig.js.map +1 -0
- package/dist/adapters/llm/BedrockProvider/guardrailRead.js +101 -0
- package/dist/adapters/llm/BedrockProvider/guardrailRead.js.map +1 -0
- package/dist/adapters/llm/BedrockProvider/guardrailResponse.js +81 -0
- package/dist/adapters/llm/BedrockProvider/guardrailResponse.js.map +1 -0
- package/dist/adapters/llm/BedrockProvider/guardrailSchemas.js +95 -0
- package/dist/adapters/llm/BedrockProvider/guardrailSchemas.js.map +1 -0
- package/dist/adapters/llm/BedrockProvider/request.js +119 -0
- package/dist/adapters/llm/BedrockProvider/request.js.map +1 -0
- package/dist/adapters/llm/BedrockProvider/response.js +107 -0
- package/dist/adapters/llm/BedrockProvider/response.js.map +1 -0
- package/dist/adapters/llm/BedrockProvider/stream.js +109 -0
- package/dist/adapters/llm/BedrockProvider/stream.js.map +1 -0
- package/dist/adapters/llm/BedrockProvider/types.js +3 -0
- package/dist/adapters/llm/BedrockProvider/types.js.map +1 -0
- package/dist/adapters/llm/BedrockProvider.js +48 -381
- package/dist/adapters/llm/BedrockProvider.js.map +1 -1
- package/dist/adapters/llm/MockProvider.js +1 -0
- package/dist/adapters/llm/MockProvider.js.map +1 -1
- package/dist/ag-ui/serializer/settle.js +110 -0
- package/dist/ag-ui/serializer/settle.js.map +1 -0
- package/dist/ag-ui/serializer/translate.js +310 -0
- package/dist/ag-ui/serializer/translate.js.map +1 -0
- package/dist/ag-ui/serializer/types.js +3 -0
- package/dist/ag-ui/serializer/types.js.map +1 -0
- package/dist/ag-ui/serializer/values.js +72 -0
- package/dist/ag-ui/serializer/values.js.map +1 -0
- package/dist/ag-ui/serializer.js +110 -543
- package/dist/ag-ui/serializer.js.map +1 -1
- package/dist/core/LLMCall/chart.js +294 -0
- package/dist/core/LLMCall/chart.js.map +1 -0
- package/dist/core/LLMCall.js +30 -314
- package/dist/core/LLMCall.js.map +1 -1
- package/dist/core/agent/buildAgentMessageApiChart.js +10 -5
- package/dist/core/agent/buildAgentMessageApiChart.js.map +1 -1
- package/dist/core/agent/buildDynamicAgentChart/boundary.js +148 -0
- package/dist/core/agent/buildDynamicAgentChart/boundary.js.map +1 -0
- package/dist/core/agent/buildDynamicAgentChart/engineBoundary.js +122 -0
- package/dist/core/agent/buildDynamicAgentChart/engineBoundary.js.map +1 -0
- package/dist/core/agent/buildDynamicAgentChart/finalBranch.js +26 -0
- package/dist/core/agent/buildDynamicAgentChart/finalBranch.js.map +1 -0
- package/dist/core/agent/buildDynamicAgentChart.js +14 -263
- package/dist/core/agent/buildDynamicAgentChart.js.map +1 -1
- package/dist/core/agent/buildMessageApiChart.js +11 -6
- package/dist/core/agent/buildMessageApiChart.js.map +1 -1
- package/dist/core/agent/composeRequest.js +1 -1
- package/dist/core/agent/dynamicTurnSeed.js +2 -0
- package/dist/core/agent/dynamicTurnSeed.js.map +1 -1
- package/dist/core/agent/findings/answerText.js +1 -1
- package/dist/core/agent/receipt/receipt.js +2 -2
- package/dist/core/agent/runtime/admission/owner.js +1 -1
- package/dist/core/agent/runtime/admission/owner.js.map +1 -1
- package/dist/core/agent/runtime/terminal/verdicts.js +4 -0
- package/dist/core/agent/runtime/terminal/verdicts.js.map +1 -1
- package/dist/core/agent/stagedRefs.js +1 -1
- package/dist/core/agent/stagedRefs.js.map +1 -1
- package/dist/core/agent/stages/callLLM/acceptResponse.js +226 -0
- package/dist/core/agent/stages/callLLM/acceptResponse.js.map +1 -0
- package/dist/core/agent/stages/callLLM/executeCall.js +254 -0
- package/dist/core/agent/stages/callLLM/executeCall.js.map +1 -0
- package/dist/core/agent/stages/callLLM/prepareCall.js +467 -0
- package/dist/core/agent/stages/callLLM/prepareCall.js.map +1 -0
- package/dist/core/agent/stages/callLLM/responseAccounting.js +34 -0
- package/dist/core/agent/stages/callLLM/responseAccounting.js.map +1 -0
- package/dist/core/agent/stages/callLLM.js +34 -852
- package/dist/core/agent/stages/callLLM.js.map +1 -1
- package/dist/core/agent/stages/reliabilityExecution/contracts.js +28 -0
- package/dist/core/agent/stages/reliabilityExecution/contracts.js.map +1 -0
- package/dist/core/agent/stages/reliabilityExecution/feedback.js +40 -0
- package/dist/core/agent/stages/reliabilityExecution/feedback.js.map +1 -0
- package/dist/core/agent/stages/reliabilityExecution/stuckLoop.js +48 -0
- package/dist/core/agent/stages/reliabilityExecution/stuckLoop.js.map +1 -0
- package/dist/core/agent/stages/reliabilityExecution.js +18 -156
- package/dist/core/agent/stages/reliabilityExecution.js.map +1 -1
- package/dist/core/agent/toolChoice/record.js +1 -1
- package/dist/core/agent/window/toolNames.js +1 -1
- package/dist/core/providerIntervention.js +115 -0
- package/dist/core/providerIntervention.js.map +1 -0
- package/dist/core/slots/buildMessagesSlot.js +1 -1
- package/dist/core/terminalVerdict.js +3 -0
- package/dist/core/terminalVerdict.js.map +1 -1
- package/dist/core-flow/Graph.js +1 -1
- package/dist/core-flow/Parallel/builder.js +101 -0
- package/dist/core-flow/Parallel/builder.js.map +1 -0
- package/dist/core-flow/Parallel/chart.js +221 -0
- package/dist/core-flow/Parallel/chart.js.map +1 -0
- package/dist/core-flow/Parallel/mapper.js +41 -0
- package/dist/core-flow/Parallel/mapper.js.map +1 -0
- package/dist/core-flow/Parallel/merge.js +63 -0
- package/dist/core-flow/Parallel/merge.js.map +1 -0
- package/dist/core-flow/Parallel/types.js +3 -0
- package/dist/core-flow/Parallel/types.js.map +1 -0
- package/dist/core-flow/Parallel.js +19 -395
- package/dist/core-flow/Parallel.js.map +1 -1
- package/dist/esm/adapters/llm/BedrockProvider/client.d.ts +11 -0
- package/dist/esm/adapters/llm/BedrockProvider/client.js +87 -0
- package/dist/esm/adapters/llm/BedrockProvider/client.js.map +1 -0
- package/dist/esm/adapters/llm/BedrockProvider/guardedStream.d.ts +7 -0
- package/dist/esm/adapters/llm/BedrockProvider/guardedStream.js +145 -0
- package/dist/esm/adapters/llm/BedrockProvider/guardedStream.js.map +1 -0
- package/dist/esm/adapters/llm/BedrockProvider/guardedStreamBuffer.d.ts +21 -0
- package/dist/esm/adapters/llm/BedrockProvider/guardedStreamBuffer.js +105 -0
- package/dist/esm/adapters/llm/BedrockProvider/guardedStreamBuffer.js.map +1 -0
- package/dist/esm/adapters/llm/BedrockProvider/guardrailClassify.d.ts +8 -0
- package/dist/esm/adapters/llm/BedrockProvider/guardrailClassify.js +183 -0
- package/dist/esm/adapters/llm/BedrockProvider/guardrailClassify.js.map +1 -0
- package/dist/esm/adapters/llm/BedrockProvider/guardrailConfig.d.ts +30 -0
- package/dist/esm/adapters/llm/BedrockProvider/guardrailConfig.js +74 -0
- package/dist/esm/adapters/llm/BedrockProvider/guardrailConfig.js.map +1 -0
- package/dist/esm/adapters/llm/BedrockProvider/guardrailRead.d.ts +19 -0
- package/dist/esm/adapters/llm/BedrockProvider/guardrailRead.js +96 -0
- package/dist/esm/adapters/llm/BedrockProvider/guardrailRead.js.map +1 -0
- package/dist/esm/adapters/llm/BedrockProvider/guardrailResponse.d.ts +13 -0
- package/dist/esm/adapters/llm/BedrockProvider/guardrailResponse.js +74 -0
- package/dist/esm/adapters/llm/BedrockProvider/guardrailResponse.js.map +1 -0
- package/dist/esm/adapters/llm/BedrockProvider/guardrailSchemas.d.ts +13 -0
- package/dist/esm/adapters/llm/BedrockProvider/guardrailSchemas.js +92 -0
- package/dist/esm/adapters/llm/BedrockProvider/guardrailSchemas.js.map +1 -0
- package/dist/esm/adapters/llm/BedrockProvider/request.d.ts +4 -0
- package/dist/esm/adapters/llm/BedrockProvider/request.js +115 -0
- package/dist/esm/adapters/llm/BedrockProvider/request.js.map +1 -0
- package/dist/esm/adapters/llm/BedrockProvider/response.d.ts +32 -0
- package/dist/esm/adapters/llm/BedrockProvider/response.js +100 -0
- package/dist/esm/adapters/llm/BedrockProvider/response.js.map +1 -0
- package/dist/esm/adapters/llm/BedrockProvider/stream.d.ts +4 -0
- package/dist/esm/adapters/llm/BedrockProvider/stream.js +105 -0
- package/dist/esm/adapters/llm/BedrockProvider/stream.js.map +1 -0
- package/dist/esm/adapters/llm/BedrockProvider/types.d.ts +174 -0
- package/dist/esm/adapters/llm/BedrockProvider/types.js +2 -0
- package/dist/esm/adapters/llm/BedrockProvider/types.js.map +1 -0
- package/dist/esm/adapters/llm/BedrockProvider.d.ts +5 -148
- package/dist/esm/adapters/llm/BedrockProvider.js +44 -377
- package/dist/esm/adapters/llm/BedrockProvider.js.map +1 -1
- package/dist/esm/adapters/llm/MockProvider.js +1 -0
- package/dist/esm/adapters/llm/MockProvider.js.map +1 -1
- package/dist/esm/ag-ui/serializer/settle.d.ts +28 -0
- package/dist/esm/ag-ui/serializer/settle.js +106 -0
- package/dist/esm/ag-ui/serializer/settle.js.map +1 -0
- package/dist/esm/ag-ui/serializer/translate.d.ts +39 -0
- package/dist/esm/ag-ui/serializer/translate.js +306 -0
- package/dist/esm/ag-ui/serializer/translate.js.map +1 -0
- package/dist/esm/ag-ui/serializer/types.d.ts +66 -0
- package/dist/esm/ag-ui/serializer/types.js +2 -0
- package/dist/esm/ag-ui/serializer/types.js.map +1 -0
- package/dist/esm/ag-ui/serializer/values.d.ts +39 -0
- package/dist/esm/ag-ui/serializer/values.js +59 -0
- package/dist/esm/ag-ui/serializer/values.js.map +1 -0
- package/dist/esm/ag-ui/serializer.d.ts +3 -146
- package/dist/esm/ag-ui/serializer.js +85 -522
- package/dist/esm/ag-ui/serializer.js.map +1 -1
- package/dist/esm/core/LLMCall/chart.d.ts +21 -0
- package/dist/esm/core/LLMCall/chart.js +290 -0
- package/dist/esm/core/LLMCall/chart.js.map +1 -0
- package/dist/esm/core/LLMCall.d.ts +3 -0
- package/dist/esm/core/LLMCall.js +31 -315
- package/dist/esm/core/LLMCall.js.map +1 -1
- package/dist/esm/core/agent/buildAgentMessageApiChart.js +10 -5
- package/dist/esm/core/agent/buildAgentMessageApiChart.js.map +1 -1
- package/dist/esm/core/agent/buildDynamicAgentChart/boundary.d.ts +100 -0
- package/dist/esm/core/agent/buildDynamicAgentChart/boundary.js +144 -0
- package/dist/esm/core/agent/buildDynamicAgentChart/boundary.js.map +1 -0
- package/dist/esm/core/agent/buildDynamicAgentChart/engineBoundary.d.ts +51 -0
- package/dist/esm/core/agent/buildDynamicAgentChart/engineBoundary.js +118 -0
- package/dist/esm/core/agent/buildDynamicAgentChart/engineBoundary.js.map +1 -0
- package/dist/esm/core/agent/buildDynamicAgentChart/finalBranch.d.ts +3 -0
- package/dist/esm/core/agent/buildDynamicAgentChart/finalBranch.js +22 -0
- package/dist/esm/core/agent/buildDynamicAgentChart/finalBranch.js.map +1 -0
- package/dist/esm/core/agent/buildDynamicAgentChart.d.ts +0 -50
- package/dist/esm/core/agent/buildDynamicAgentChart.js +14 -263
- package/dist/esm/core/agent/buildDynamicAgentChart.js.map +1 -1
- package/dist/esm/core/agent/buildMessageApiChart.js +11 -6
- package/dist/esm/core/agent/buildMessageApiChart.js.map +1 -1
- package/dist/esm/core/agent/composeRequest.d.ts +1 -1
- package/dist/esm/core/agent/composeRequest.js +1 -1
- package/dist/esm/core/agent/dynamicTurnSeed.js +2 -0
- package/dist/esm/core/agent/dynamicTurnSeed.js.map +1 -1
- package/dist/esm/core/agent/findings/answerText.d.ts +1 -1
- package/dist/esm/core/agent/findings/answerText.js +1 -1
- package/dist/esm/core/agent/receipt/receipt.d.ts +2 -2
- package/dist/esm/core/agent/receipt/receipt.js +2 -2
- package/dist/esm/core/agent/runtime/admission/owner.js +1 -1
- package/dist/esm/core/agent/runtime/admission/owner.js.map +1 -1
- package/dist/esm/core/agent/runtime/terminal/verdicts.js +4 -0
- package/dist/esm/core/agent/runtime/terminal/verdicts.js.map +1 -1
- package/dist/esm/core/agent/stagedRefs.js +1 -1
- package/dist/esm/core/agent/stagedRefs.js.map +1 -1
- package/dist/esm/core/agent/stages/callLLM/acceptResponse.d.ts +6 -0
- package/dist/esm/core/agent/stages/callLLM/acceptResponse.js +199 -0
- package/dist/esm/core/agent/stages/callLLM/acceptResponse.js.map +1 -0
- package/dist/esm/core/agent/stages/callLLM/executeCall.d.ts +26 -0
- package/dist/esm/core/agent/stages/callLLM/executeCall.js +250 -0
- package/dist/esm/core/agent/stages/callLLM/executeCall.js.map +1 -0
- package/dist/esm/core/agent/stages/callLLM/prepareCall.d.ts +88 -0
- package/dist/esm/core/agent/stages/callLLM/prepareCall.js +440 -0
- package/dist/esm/core/agent/stages/callLLM/prepareCall.js.map +1 -0
- package/dist/esm/core/agent/stages/callLLM/responseAccounting.d.ts +10 -0
- package/dist/esm/core/agent/stages/callLLM/responseAccounting.js +29 -0
- package/dist/esm/core/agent/stages/callLLM/responseAccounting.js.map +1 -0
- package/dist/esm/core/agent/stages/callLLM.d.ts +1 -1
- package/dist/esm/core/agent/stages/callLLM.js +34 -829
- package/dist/esm/core/agent/stages/callLLM.js.map +1 -1
- package/dist/esm/core/agent/stages/reliabilityExecution/contracts.d.ts +53 -0
- package/dist/esm/core/agent/stages/reliabilityExecution/contracts.js +24 -0
- package/dist/esm/core/agent/stages/reliabilityExecution/contracts.js.map +1 -0
- package/dist/esm/core/agent/stages/reliabilityExecution/feedback.d.ts +19 -0
- package/dist/esm/core/agent/stages/reliabilityExecution/feedback.js +36 -0
- package/dist/esm/core/agent/stages/reliabilityExecution/feedback.js.map +1 -0
- package/dist/esm/core/agent/stages/reliabilityExecution/stuckLoop.d.ts +29 -0
- package/dist/esm/core/agent/stages/reliabilityExecution/stuckLoop.js +44 -0
- package/dist/esm/core/agent/stages/reliabilityExecution/stuckLoop.js.map +1 -0
- package/dist/esm/core/agent/stages/reliabilityExecution.d.ts +4 -81
- package/dist/esm/core/agent/stages/reliabilityExecution.js +7 -147
- package/dist/esm/core/agent/stages/reliabilityExecution.js.map +1 -1
- package/dist/esm/core/agent/toolChoice/record.d.ts +1 -1
- package/dist/esm/core/agent/toolChoice/record.js +1 -1
- package/dist/esm/core/agent/window/toolNames.d.ts +1 -1
- package/dist/esm/core/agent/window/toolNames.js +1 -1
- package/dist/esm/core/providerIntervention.d.ts +25 -0
- package/dist/esm/core/providerIntervention.js +106 -0
- package/dist/esm/core/providerIntervention.js.map +1 -0
- package/dist/esm/core/slots/buildMessagesSlot.d.ts +1 -1
- package/dist/esm/core/slots/buildMessagesSlot.js +1 -1
- package/dist/esm/core/terminalVerdict.d.ts +4 -0
- package/dist/esm/core/terminalVerdict.js +3 -0
- package/dist/esm/core/terminalVerdict.js.map +1 -1
- package/dist/esm/core-flow/Graph.d.ts +1 -1
- package/dist/esm/core-flow/Graph.js +1 -1
- package/dist/esm/core-flow/Parallel/builder.d.ts +39 -0
- package/dist/esm/core-flow/Parallel/builder.js +97 -0
- package/dist/esm/core-flow/Parallel/builder.js.map +1 -0
- package/dist/esm/core-flow/Parallel/chart.d.ts +15 -0
- package/dist/esm/core-flow/Parallel/chart.js +217 -0
- package/dist/esm/core-flow/Parallel/chart.js.map +1 -0
- package/dist/esm/core-flow/Parallel/mapper.d.ts +21 -0
- package/dist/esm/core-flow/Parallel/mapper.js +37 -0
- package/dist/esm/core-flow/Parallel/mapper.js.map +1 -0
- package/dist/esm/core-flow/Parallel/merge.d.ts +4 -0
- package/dist/esm/core-flow/Parallel/merge.js +58 -0
- package/dist/esm/core-flow/Parallel/merge.js.map +1 -0
- package/dist/esm/core-flow/Parallel/types.d.ts +179 -0
- package/dist/esm/core-flow/Parallel/types.js +2 -0
- package/dist/esm/core-flow/Parallel/types.js.map +1 -0
- package/dist/esm/core-flow/Parallel.d.ts +7 -233
- package/dist/esm/core-flow/Parallel.js +18 -394
- package/dist/esm/core-flow/Parallel.js.map +1 -1
- package/dist/esm/hosting/failedSettlement.d.ts +9 -0
- package/dist/esm/hosting/failedSettlement.js +15 -0
- package/dist/esm/hosting/failedSettlement.js.map +1 -0
- package/dist/esm/hosting/headers.d.ts +8 -0
- package/dist/esm/hosting/headers.js +18 -0
- package/dist/esm/hosting/headers.js.map +1 -1
- package/dist/esm/hosting/httpHost.js +5 -20
- package/dist/esm/hosting/httpHost.js.map +1 -1
- package/dist/esm/hosting/httpStreaming.d.ts +5 -2
- package/dist/esm/hosting/protocolRoute.js +9 -2
- package/dist/esm/hosting/protocolRoute.js.map +1 -1
- package/dist/esm/hosting/refusalStatus.d.ts +3 -0
- package/dist/esm/hosting/refusalStatus.js +5 -0
- package/dist/esm/hosting/refusalStatus.js.map +1 -1
- package/dist/esm/hosting/streamHandler/conversation.d.ts +17 -0
- package/dist/esm/hosting/streamHandler/conversation.js +32 -0
- package/dist/esm/hosting/streamHandler/conversation.js.map +1 -0
- package/dist/esm/hosting/streamHandler/request.d.ts +12 -0
- package/dist/esm/hosting/streamHandler/request.js +84 -0
- package/dist/esm/hosting/streamHandler/request.js.map +1 -0
- package/dist/esm/hosting/streamHandler/types.d.ts +106 -0
- package/dist/esm/hosting/streamHandler/types.js +5 -0
- package/dist/esm/hosting/streamHandler/types.js.map +1 -0
- package/dist/esm/hosting/streamHandler.d.ts +3 -133
- package/dist/esm/hosting/streamHandler.js +10 -119
- package/dist/esm/hosting/streamHandler.js.map +1 -1
- package/dist/esm/hosting/unstreamedText.d.ts +1 -1
- package/dist/esm/hosting/unstreamedText.js +1 -1
- package/dist/esm/lib/iterationBudget.js +1 -1
- package/dist/esm/lib/iterationBudget.js.map +1 -1
- package/dist/esm/lib/toolBytes.d.ts +1 -1
- package/dist/esm/lib/toolBytes.js +2 -2
- package/dist/esm/lib/toolBytes.js.map +1 -1
- package/dist/esm/ontology/serve.d.ts +2 -2
- package/dist/esm/ontology/serve.js +2 -2
- package/dist/esm/provider-contract/intervention.d.ts +56 -0
- package/dist/esm/provider-contract/intervention.js +112 -0
- package/dist/esm/provider-contract/intervention.js.map +1 -0
- package/dist/esm/provider-contract/replaySafety.d.ts +4 -0
- package/dist/esm/provider-contract/replaySafety.js +25 -0
- package/dist/esm/provider-contract/replaySafety.js.map +1 -0
- package/dist/esm/provider-contract/requestRefusal.js +3 -1
- package/dist/esm/provider-contract/requestRefusal.js.map +1 -1
- package/dist/esm/provider-contract/responseAdmission.d.ts +10 -0
- package/dist/esm/provider-contract/responseAdmission.js +91 -0
- package/dist/esm/provider-contract/responseAdmission.js.map +1 -0
- package/dist/esm/provider-contract/types/code.d.ts +434 -0
- package/dist/esm/provider-contract/types/code.js +27 -0
- package/dist/esm/provider-contract/types/code.js.map +1 -0
- package/dist/esm/provider-contract/types/message.d.ts +226 -0
- package/dist/esm/provider-contract/types/message.js +2 -0
- package/dist/esm/provider-contract/types/message.js.map +1 -0
- package/dist/esm/provider-contract/types/provider.d.ts +261 -0
- package/dist/esm/provider-contract/types/provider.js +2 -0
- package/dist/esm/provider-contract/types/provider.js.map +1 -0
- package/dist/esm/provider-contract/types/request.d.ts +93 -0
- package/dist/esm/provider-contract/types/request.js +2 -0
- package/dist/esm/provider-contract/types/request.js.map +1 -0
- package/dist/esm/provider-contract/types/response.d.ts +142 -0
- package/dist/esm/provider-contract/types/response.js +2 -0
- package/dist/esm/provider-contract/types/response.js.map +1 -0
- package/dist/esm/provider-contract/types.d.ts +7 -1149
- package/dist/esm/provider-contract/types.js +1 -25
- package/dist/esm/provider-contract/types.js.map +1 -1
- package/dist/esm/providers.d.ts +2 -1
- package/dist/esm/providers.js +1 -0
- package/dist/esm/providers.js.map +1 -1
- package/dist/esm/recorders/core/ErrorBridge.d.ts +3 -1
- package/dist/esm/recorders/core/ErrorBridge.js +14 -0
- package/dist/esm/recorders/core/ErrorBridge.js.map +1 -1
- package/dist/esm/recorders/core/ResilienceRecorder.d.ts +4 -4
- package/dist/esm/recorders/core/ResilienceRecorder.js +4 -4
- package/dist/esm/reliability/buildReliabilityGateChart.d.ts +1 -1
- package/dist/esm/reliability/buildReliabilityGateChart.js +2 -2
- package/dist/esm/reliability/buildReliabilityGateChart.js.map +1 -1
- package/dist/esm/resilience/replayAttempt.d.ts +1 -1
- package/dist/esm/resilience/replayAttempt.js +18 -6
- package/dist/esm/resilience/replayAttempt.js.map +1 -1
- package/dist/esm/resilience/withCircuitBreaker.js +29 -13
- package/dist/esm/resilience/withCircuitBreaker.js.map +1 -1
- package/dist/esm/resilience/withFallback.js +22 -7
- package/dist/esm/resilience/withFallback.js.map +1 -1
- package/dist/esm/resilience/withRetry.js +35 -11
- package/dist/esm/resilience/withRetry.js.map +1 -1
- package/dist/esm/time-travel/servedView/findings.js +2 -2
- package/dist/esm/time-travel/servedView/findings.js.map +1 -1
- package/dist/esm/time-travel/servedView/gaps.js +1 -1
- package/dist/esm/time-travel/servedView/gaps.js.map +1 -1
- package/dist/esm/time-travel/servedView/ontology.js +1 -1
- package/dist/esm/time-travel/servedView.d.ts +2 -2
- package/dist/esm/time-travel/servedView.js +2 -2
- package/dist/hosting/failedSettlement.js +19 -0
- package/dist/hosting/failedSettlement.js.map +1 -0
- package/dist/hosting/headers.js +20 -1
- package/dist/hosting/headers.js.map +1 -1
- package/dist/hosting/httpHost.js +5 -20
- package/dist/hosting/httpHost.js.map +1 -1
- package/dist/hosting/protocolRoute.js +9 -2
- package/dist/hosting/protocolRoute.js.map +1 -1
- package/dist/hosting/refusalStatus.js +5 -0
- package/dist/hosting/refusalStatus.js.map +1 -1
- package/dist/hosting/streamHandler/conversation.js +37 -0
- package/dist/hosting/streamHandler/conversation.js.map +1 -0
- package/dist/hosting/streamHandler/request.js +93 -0
- package/dist/hosting/streamHandler/request.js.map +1 -0
- package/dist/hosting/streamHandler/types.js +8 -0
- package/dist/hosting/streamHandler/types.js.map +1 -0
- package/dist/hosting/streamHandler.js +25 -132
- package/dist/hosting/streamHandler.js.map +1 -1
- package/dist/hosting/unstreamedText.js +1 -1
- package/dist/lib/iterationBudget.js +1 -1
- package/dist/lib/iterationBudget.js.map +1 -1
- package/dist/lib/toolBytes.js +2 -2
- package/dist/lib/toolBytes.js.map +1 -1
- package/dist/ontology/serve.js +2 -2
- package/dist/provider-contract/intervention.js +122 -0
- package/dist/provider-contract/intervention.js.map +1 -0
- package/dist/provider-contract/replaySafety.js +30 -0
- package/dist/provider-contract/replaySafety.js.map +1 -0
- package/dist/provider-contract/requestRefusal.js +3 -1
- package/dist/provider-contract/requestRefusal.js.map +1 -1
- package/dist/provider-contract/responseAdmission.js +96 -0
- package/dist/provider-contract/responseAdmission.js.map +1 -0
- package/dist/provider-contract/types/code.js +33 -0
- package/dist/provider-contract/types/code.js.map +1 -0
- package/dist/provider-contract/types/message.js +3 -0
- package/dist/provider-contract/types/message.js.map +1 -0
- package/dist/provider-contract/types/provider.js +3 -0
- package/dist/provider-contract/types/provider.js.map +1 -0
- package/dist/provider-contract/types/request.js +3 -0
- package/dist/provider-contract/types/request.js.map +1 -0
- package/dist/provider-contract/types/response.js +3 -0
- package/dist/provider-contract/types/response.js.map +1 -0
- package/dist/provider-contract/types.js +6 -29
- package/dist/provider-contract/types.js.map +1 -1
- package/dist/providers.js +5 -1
- package/dist/providers.js.map +1 -1
- package/dist/recorders/core/ErrorBridge.js +14 -0
- package/dist/recorders/core/ErrorBridge.js.map +1 -1
- package/dist/recorders/core/ResilienceRecorder.js +4 -4
- package/dist/reliability/buildReliabilityGateChart.js +2 -2
- package/dist/reliability/buildReliabilityGateChart.js.map +1 -1
- package/dist/resilience/replayAttempt.js +18 -6
- package/dist/resilience/replayAttempt.js.map +1 -1
- package/dist/resilience/withCircuitBreaker.js +29 -13
- package/dist/resilience/withCircuitBreaker.js.map +1 -1
- package/dist/resilience/withFallback.js +22 -7
- package/dist/resilience/withFallback.js.map +1 -1
- package/dist/resilience/withRetry.js +35 -11
- package/dist/resilience/withRetry.js.map +1 -1
- package/dist/time-travel/servedView/findings.js +2 -2
- package/dist/time-travel/servedView/findings.js.map +1 -1
- package/dist/time-travel/servedView/gaps.js +1 -1
- package/dist/time-travel/servedView/gaps.js.map +1 -1
- package/dist/time-travel/servedView/ontology.js +1 -1
- package/dist/time-travel/servedView.js +2 -2
- package/dist/types/adapters/llm/BedrockProvider/client.d.ts +12 -0
- package/dist/types/adapters/llm/BedrockProvider/client.d.ts.map +1 -0
- package/dist/types/adapters/llm/BedrockProvider/guardedStream.d.ts +8 -0
- package/dist/types/adapters/llm/BedrockProvider/guardedStream.d.ts.map +1 -0
- package/dist/types/adapters/llm/BedrockProvider/guardedStreamBuffer.d.ts +22 -0
- package/dist/types/adapters/llm/BedrockProvider/guardedStreamBuffer.d.ts.map +1 -0
- package/dist/types/adapters/llm/BedrockProvider/guardrailClassify.d.ts +9 -0
- package/dist/types/adapters/llm/BedrockProvider/guardrailClassify.d.ts.map +1 -0
- package/dist/types/adapters/llm/BedrockProvider/guardrailConfig.d.ts +31 -0
- package/dist/types/adapters/llm/BedrockProvider/guardrailConfig.d.ts.map +1 -0
- package/dist/types/adapters/llm/BedrockProvider/guardrailRead.d.ts +20 -0
- package/dist/types/adapters/llm/BedrockProvider/guardrailRead.d.ts.map +1 -0
- package/dist/types/adapters/llm/BedrockProvider/guardrailResponse.d.ts +14 -0
- package/dist/types/adapters/llm/BedrockProvider/guardrailResponse.d.ts.map +1 -0
- package/dist/types/adapters/llm/BedrockProvider/guardrailSchemas.d.ts +14 -0
- package/dist/types/adapters/llm/BedrockProvider/guardrailSchemas.d.ts.map +1 -0
- package/dist/types/adapters/llm/BedrockProvider/request.d.ts +5 -0
- package/dist/types/adapters/llm/BedrockProvider/request.d.ts.map +1 -0
- package/dist/types/adapters/llm/BedrockProvider/response.d.ts +33 -0
- package/dist/types/adapters/llm/BedrockProvider/response.d.ts.map +1 -0
- package/dist/types/adapters/llm/BedrockProvider/stream.d.ts +5 -0
- package/dist/types/adapters/llm/BedrockProvider/stream.d.ts.map +1 -0
- package/dist/types/adapters/llm/BedrockProvider/types.d.ts +175 -0
- package/dist/types/adapters/llm/BedrockProvider/types.d.ts.map +1 -0
- package/dist/types/adapters/llm/BedrockProvider.d.ts +5 -148
- package/dist/types/adapters/llm/BedrockProvider.d.ts.map +1 -1
- package/dist/types/adapters/llm/MockProvider.d.ts.map +1 -1
- package/dist/types/ag-ui/serializer/settle.d.ts +29 -0
- package/dist/types/ag-ui/serializer/settle.d.ts.map +1 -0
- package/dist/types/ag-ui/serializer/translate.d.ts +40 -0
- package/dist/types/ag-ui/serializer/translate.d.ts.map +1 -0
- package/dist/types/ag-ui/serializer/types.d.ts +67 -0
- package/dist/types/ag-ui/serializer/types.d.ts.map +1 -0
- package/dist/types/ag-ui/serializer/values.d.ts +40 -0
- package/dist/types/ag-ui/serializer/values.d.ts.map +1 -0
- package/dist/types/ag-ui/serializer.d.ts +3 -146
- package/dist/types/ag-ui/serializer.d.ts.map +1 -1
- package/dist/types/core/LLMCall/chart.d.ts +22 -0
- package/dist/types/core/LLMCall/chart.d.ts.map +1 -0
- package/dist/types/core/LLMCall.d.ts +3 -0
- package/dist/types/core/LLMCall.d.ts.map +1 -1
- package/dist/types/core/agent/buildAgentMessageApiChart.d.ts.map +1 -1
- package/dist/types/core/agent/buildDynamicAgentChart/boundary.d.ts +101 -0
- package/dist/types/core/agent/buildDynamicAgentChart/boundary.d.ts.map +1 -0
- package/dist/types/core/agent/buildDynamicAgentChart/engineBoundary.d.ts +52 -0
- package/dist/types/core/agent/buildDynamicAgentChart/engineBoundary.d.ts.map +1 -0
- package/dist/types/core/agent/buildDynamicAgentChart/finalBranch.d.ts +4 -0
- package/dist/types/core/agent/buildDynamicAgentChart/finalBranch.d.ts.map +1 -0
- package/dist/types/core/agent/buildDynamicAgentChart.d.ts +0 -50
- package/dist/types/core/agent/buildDynamicAgentChart.d.ts.map +1 -1
- package/dist/types/core/agent/buildMessageApiChart.d.ts.map +1 -1
- package/dist/types/core/agent/composeRequest.d.ts +1 -1
- package/dist/types/core/agent/dynamicTurnSeed.d.ts.map +1 -1
- package/dist/types/core/agent/findings/answerText.d.ts +1 -1
- package/dist/types/core/agent/receipt/receipt.d.ts +2 -2
- package/dist/types/core/agent/runtime/terminal/verdicts.d.ts.map +1 -1
- package/dist/types/core/agent/stages/callLLM/acceptResponse.d.ts +7 -0
- package/dist/types/core/agent/stages/callLLM/acceptResponse.d.ts.map +1 -0
- package/dist/types/core/agent/stages/callLLM/executeCall.d.ts +27 -0
- package/dist/types/core/agent/stages/callLLM/executeCall.d.ts.map +1 -0
- package/dist/types/core/agent/stages/callLLM/prepareCall.d.ts +89 -0
- package/dist/types/core/agent/stages/callLLM/prepareCall.d.ts.map +1 -0
- package/dist/types/core/agent/stages/callLLM/responseAccounting.d.ts +11 -0
- package/dist/types/core/agent/stages/callLLM/responseAccounting.d.ts.map +1 -0
- package/dist/types/core/agent/stages/callLLM.d.ts +1 -1
- package/dist/types/core/agent/stages/callLLM.d.ts.map +1 -1
- package/dist/types/core/agent/stages/reliabilityExecution/contracts.d.ts +54 -0
- package/dist/types/core/agent/stages/reliabilityExecution/contracts.d.ts.map +1 -0
- package/dist/types/core/agent/stages/reliabilityExecution/feedback.d.ts +20 -0
- package/dist/types/core/agent/stages/reliabilityExecution/feedback.d.ts.map +1 -0
- package/dist/types/core/agent/stages/reliabilityExecution/stuckLoop.d.ts +30 -0
- package/dist/types/core/agent/stages/reliabilityExecution/stuckLoop.d.ts.map +1 -0
- package/dist/types/core/agent/stages/reliabilityExecution.d.ts +4 -81
- package/dist/types/core/agent/stages/reliabilityExecution.d.ts.map +1 -1
- package/dist/types/core/agent/toolChoice/record.d.ts +1 -1
- package/dist/types/core/agent/window/toolNames.d.ts +1 -1
- package/dist/types/core/providerIntervention.d.ts +26 -0
- package/dist/types/core/providerIntervention.d.ts.map +1 -0
- package/dist/types/core/slots/buildMessagesSlot.d.ts +1 -1
- package/dist/types/core/terminalVerdict.d.ts +4 -0
- package/dist/types/core/terminalVerdict.d.ts.map +1 -1
- package/dist/types/core-flow/Graph.d.ts +1 -1
- package/dist/types/core-flow/Parallel/builder.d.ts +40 -0
- package/dist/types/core-flow/Parallel/builder.d.ts.map +1 -0
- package/dist/types/core-flow/Parallel/chart.d.ts +16 -0
- package/dist/types/core-flow/Parallel/chart.d.ts.map +1 -0
- package/dist/types/core-flow/Parallel/mapper.d.ts +22 -0
- package/dist/types/core-flow/Parallel/mapper.d.ts.map +1 -0
- package/dist/types/core-flow/Parallel/merge.d.ts +5 -0
- package/dist/types/core-flow/Parallel/merge.d.ts.map +1 -0
- package/dist/types/core-flow/Parallel/types.d.ts +180 -0
- package/dist/types/core-flow/Parallel/types.d.ts.map +1 -0
- package/dist/types/core-flow/Parallel.d.ts +7 -233
- package/dist/types/core-flow/Parallel.d.ts.map +1 -1
- package/dist/types/hosting/failedSettlement.d.ts +10 -0
- package/dist/types/hosting/failedSettlement.d.ts.map +1 -0
- package/dist/types/hosting/headers.d.ts +8 -0
- package/dist/types/hosting/headers.d.ts.map +1 -1
- package/dist/types/hosting/httpHost.d.ts.map +1 -1
- package/dist/types/hosting/httpStreaming.d.ts +5 -2
- package/dist/types/hosting/httpStreaming.d.ts.map +1 -1
- package/dist/types/hosting/protocolRoute.d.ts.map +1 -1
- package/dist/types/hosting/refusalStatus.d.ts +3 -0
- package/dist/types/hosting/refusalStatus.d.ts.map +1 -1
- package/dist/types/hosting/streamHandler/conversation.d.ts +18 -0
- package/dist/types/hosting/streamHandler/conversation.d.ts.map +1 -0
- package/dist/types/hosting/streamHandler/request.d.ts +13 -0
- package/dist/types/hosting/streamHandler/request.d.ts.map +1 -0
- package/dist/types/hosting/streamHandler/types.d.ts +107 -0
- package/dist/types/hosting/streamHandler/types.d.ts.map +1 -0
- package/dist/types/hosting/streamHandler.d.ts +3 -133
- package/dist/types/hosting/streamHandler.d.ts.map +1 -1
- package/dist/types/hosting/unstreamedText.d.ts +1 -1
- package/dist/types/lib/toolBytes.d.ts +1 -1
- package/dist/types/ontology/serve.d.ts +2 -2
- package/dist/types/provider-contract/intervention.d.ts +57 -0
- package/dist/types/provider-contract/intervention.d.ts.map +1 -0
- package/dist/types/provider-contract/replaySafety.d.ts +5 -0
- package/dist/types/provider-contract/replaySafety.d.ts.map +1 -0
- package/dist/types/provider-contract/requestRefusal.d.ts.map +1 -1
- package/dist/types/provider-contract/responseAdmission.d.ts +11 -0
- package/dist/types/provider-contract/responseAdmission.d.ts.map +1 -0
- package/dist/types/provider-contract/types/code.d.ts +435 -0
- package/dist/types/provider-contract/types/code.d.ts.map +1 -0
- package/dist/types/provider-contract/types/message.d.ts +227 -0
- package/dist/types/provider-contract/types/message.d.ts.map +1 -0
- package/dist/types/provider-contract/types/provider.d.ts +262 -0
- package/dist/types/provider-contract/types/provider.d.ts.map +1 -0
- package/dist/types/provider-contract/types/request.d.ts +94 -0
- package/dist/types/provider-contract/types/request.d.ts.map +1 -0
- package/dist/types/provider-contract/types/response.d.ts +143 -0
- package/dist/types/provider-contract/types/response.d.ts.map +1 -0
- package/dist/types/provider-contract/types.d.ts +7 -1149
- package/dist/types/provider-contract/types.d.ts.map +1 -1
- package/dist/types/providers.d.ts +2 -1
- package/dist/types/providers.d.ts.map +1 -1
- package/dist/types/recorders/core/ErrorBridge.d.ts +3 -1
- package/dist/types/recorders/core/ErrorBridge.d.ts.map +1 -1
- package/dist/types/recorders/core/ResilienceRecorder.d.ts +4 -4
- package/dist/types/reliability/buildReliabilityGateChart.d.ts +1 -1
- package/dist/types/resilience/replayAttempt.d.ts +1 -1
- package/dist/types/resilience/replayAttempt.d.ts.map +1 -1
- package/dist/types/resilience/withCircuitBreaker.d.ts.map +1 -1
- package/dist/types/resilience/withFallback.d.ts.map +1 -1
- package/dist/types/resilience/withRetry.d.ts.map +1 -1
- package/dist/types/time-travel/servedView.d.ts +2 -2
- package/package.json +1 -1
|
@@ -8,730 +8,22 @@
|
|
|
8
8
|
* Concrete adapters (AnthropicProvider, PineconeStore, PermissionPolicy, ...) implement
|
|
9
9
|
* these contracts. `core/` and `core-flow/` depend only on them, never on an adapter.
|
|
10
10
|
*/
|
|
11
|
-
import type { ContextRole, ContextSource, ToolCallEventIdentity } from '../events/types.js';
|
|
12
|
-
import type { ReportedToolStatus } from '../semantics/toolOutcome.js';
|
|
13
|
-
import type { ThinkingBlock, ThinkingDeltaKind } from '../thinking/types.js';
|
|
14
11
|
import type { ToolCallEntry } from './innerCalls.js';
|
|
15
|
-
import type {
|
|
16
|
-
import type { WireRole } from './wireRole.js';
|
|
12
|
+
import type { LLMMessage } from './types/message.js';
|
|
17
13
|
export type { ToolCallEntry } from './innerCalls.js';
|
|
18
14
|
export type { TypedAnswerMark } from './typedAnswerMark.js';
|
|
19
|
-
export type { ThinkingDeltaKind };
|
|
15
|
+
export type { ThinkingDeltaKind } from '../thinking/types.js';
|
|
20
16
|
export { DEFAULT_CARRIES_IN_MESSAGES, type WireRole } from './wireRole.js';
|
|
21
|
-
export
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
/** Recording-only address of a library-observed tool call. Omitted from provider requests. */
|
|
27
|
-
readonly callOccurrenceKey?: NonNullable<ToolCallEventIdentity['callOccurrenceKey']>;
|
|
28
|
-
/** For `role: 'tool'` — the tool name this result corresponds to. */
|
|
29
|
-
readonly toolName?: string;
|
|
30
|
-
/**
|
|
31
|
-
* For a refused `role: 'tool'` result only: the same finite argument failure
|
|
32
|
-
* carried by its attempted call. Anthropic projects this pair as recovery
|
|
33
|
-
* text, never as a successful parse of substituted empty input.
|
|
34
|
-
*/
|
|
35
|
-
readonly toolArgumentsFailure?: LLMResponse['toolCalls'][number]['argumentsFailure'];
|
|
36
|
-
/**
|
|
37
|
-
* `role: 'tool'` only: the call did not complete, as the dispatch recorded it (`callOutcomeOf`). `'refused'`: stopped before it ran, or it ran and declared `'denied'`.
|
|
38
|
-
* `'failed'`: it threw, its result was withheld, or it declared `'failure'` / `'invalid'`. Absent: it completed.
|
|
39
|
-
* Not whether `execute` was entered. Never derived from `content`; read by `checkin.ts` · `buildTrail`; never sent to a provider.
|
|
40
|
-
*/
|
|
41
|
-
readonly outcome?: 'refused' | 'failed';
|
|
42
|
-
/** Tool-only status of an admitted return. Never derived from `content` or sent to a provider. */
|
|
43
|
-
readonly reportedStatus?: ReportedToolStatus;
|
|
44
|
-
/**
|
|
45
|
-
* For `role: 'assistant'` only — the tool calls the LLM requested in this
|
|
46
|
-
* turn. Required for providers (Anthropic, OpenAI) that need to round-trip
|
|
47
|
-
* tool_use blocks across iterations: when the next `complete()` includes
|
|
48
|
-
* a `role: 'tool'` message, the provider reconstructs the matching
|
|
49
|
-
* `tool_use` block on the previous assistant turn from this field.
|
|
50
|
-
* Empty array on text-only turns; undefined for non-assistant roles.
|
|
51
|
-
*
|
|
52
|
-
* `providerMeta` (9.29.0) rides back UNCHANGED — it is the same bag the
|
|
53
|
-
* response put there, and for Gemini it holds the `thoughtSignature` without
|
|
54
|
-
* which the model refuses the turn after a tool call. See
|
|
55
|
-
* {@link LLMResponse}'s `toolCalls[].providerMeta`, sent unchanged. The recording
|
|
56
|
-
* address survives native pause and resume and is stripped before transport.
|
|
57
|
-
*/
|
|
58
|
-
readonly toolCalls?: readonly (Omit<LLMResponse['toolCalls'][number], 'argumentsFailure'> & Pick<LLMMessage, 'callOccurrenceKey'> & {
|
|
59
|
-
readonly argumentsFailure?: LLMResponse['toolCalls'][number]['argumentsFailure'];
|
|
60
|
-
})[];
|
|
61
|
-
/**
|
|
62
|
-
* v2.14 — Thinking blocks emitted by the LLM on assistant turns.
|
|
63
|
-
*
|
|
64
|
-
* Required for Anthropic extended-thinking + tool-use flows: signed
|
|
65
|
-
* blocks MUST be echoed BYTE-EXACT in subsequent assistant turns or
|
|
66
|
-
* Anthropic's API rejects with 400. The framework persists blocks
|
|
67
|
-
* here so the AnthropicProvider's serializer (Phase 4b) can restore
|
|
68
|
-
* them on the next request.
|
|
69
|
-
*
|
|
70
|
-
* **Persistence model — DIFFERENT from `ephemeral`:**
|
|
71
|
-
* - `ephemeral` messages: NOT persisted to scope.history
|
|
72
|
-
* - `thinkingBlocks`: PERSISTED (required for signature round-trip)
|
|
73
|
-
*
|
|
74
|
-
* Visible to recorders + audit by default. Use
|
|
75
|
-
* `RedactionPolicy.thinkingPatterns` (Phase 3) to scrub sensitive
|
|
76
|
-
* reasoning content before audit-log adapters fire.
|
|
77
|
-
*
|
|
78
|
-
* Empty array OR undefined when no thinking is present (most calls).
|
|
79
|
-
*/
|
|
80
|
-
readonly thinkingBlocks?: readonly ThinkingBlock[];
|
|
81
|
-
/** Replay layout and local consistency evidence (including known loss); JSON/checkpoint safe. */
|
|
82
|
-
readonly replay?: import('../thinking/replay.js').MessageReplay;
|
|
83
|
-
/**
|
|
84
|
-
* v2.13 — PERSISTENCE flag (NOT a visibility flag). When `true`:
|
|
85
|
-
* • The message IS sent to the LLM as part of the next request
|
|
86
|
-
* (visible to the model, counts toward its context window).
|
|
87
|
-
* • The message is OBSERVABLE via narrative/recorders/audit log
|
|
88
|
-
* (visible to humans for debugging + forensics).
|
|
89
|
-
* • The message is NOT persisted to `scope.history` after the gate
|
|
90
|
-
* loop that produced it completes — long-term memory writes,
|
|
91
|
-
* `getNarrative()` snapshots, and downstream consumers see only
|
|
92
|
-
* non-ephemeral messages.
|
|
93
|
-
*
|
|
94
|
-
* Use case: Instructor-style schema retry. The reliability gate
|
|
95
|
-
* appends `{ role: 'user', content: feedbackForLLM, ephemeral: true }`
|
|
96
|
-
* before retry — the LLM sees the validation feedback for the next
|
|
97
|
-
* call, but the conversation history (and any memory persistence
|
|
98
|
-
* downstream) sees only the final accepted exchange.
|
|
99
|
-
*
|
|
100
|
-
* Audit-trail safety: ephemeral DOES NOT mean invisible to security
|
|
101
|
-
* review. `getNarrative()`, recorders, and the typed-event stream all
|
|
102
|
-
* see ephemeral messages; only the persistent conversation log filters
|
|
103
|
-
* them out. An attacker cannot use the ephemeral marker to construct
|
|
104
|
-
* audit-invisible prompts.
|
|
105
|
-
*/
|
|
106
|
-
readonly ephemeral?: boolean;
|
|
107
|
-
/**
|
|
108
|
-
* v7.21 — WHO let this message into the window.
|
|
109
|
-
*
|
|
110
|
-
* Stamped by the agent's `Deliver` stage on a message that came from a
|
|
111
|
-
* `slot: 'messages'` Injection rather than from the conversation. It is the
|
|
112
|
-
* stable marker the messages slot reads to attribute the message to its
|
|
113
|
-
* injection (source / sourceId / reason) instead of inferring a baseline
|
|
114
|
-
* source from the role — so one wire message produces exactly one
|
|
115
|
-
* `context.injected` record, naming whoever put it there.
|
|
116
|
-
*
|
|
117
|
-
* **Never reaches a provider.** `callLLM` strips this field from every
|
|
118
|
-
* message before the request is handed to `provider.complete()` / `stream()`,
|
|
119
|
-
* so no adapter — first-party or consumer-authored — can leak framework
|
|
120
|
-
* metadata onto a wire, even one that serializes a message wholesale.
|
|
121
|
-
* Stripping removes a field, never a message, so wire indices are unchanged
|
|
122
|
-
* (which is what lets a `CacheMarker{field:'messages'}` name a real position).
|
|
123
|
-
*
|
|
124
|
-
* Absent on every message that came from the conversation itself.
|
|
125
|
-
*/
|
|
126
|
-
readonly injectedBy?: {
|
|
127
|
-
/** The `Injection.id` that produced this message. */
|
|
128
|
-
readonly injectionId: string;
|
|
129
|
-
/** The injection's flavor — the `source` the slot records. */
|
|
130
|
-
readonly flavor: ContextSource;
|
|
131
|
-
/** The injection's description, when it had one. */
|
|
132
|
-
readonly reason?: string;
|
|
133
|
-
/** The ReAct iteration whose boundary delivered it. */
|
|
134
|
-
readonly iteration: number;
|
|
135
|
-
};
|
|
136
|
-
/**
|
|
137
|
-
* 9.113.0 — this `role: 'tool'` message answers a call that was NEVER
|
|
138
|
-
* DISPATCHED. The library wrote it; no gate judged the call and no tool ran.
|
|
139
|
-
*
|
|
140
|
-
* Stamped by the batch settlement (`core/agent/stages/toolCalls/batch/settlementOperations.ts` ·
|
|
141
|
-
* `settleBatch`, which takes each copy from `notDispatchedMarker`). The
|
|
142
|
-
* model proposed several calls in one turn, one of them paused the run, and
|
|
143
|
-
* the resume answered each call after it with a fixed sentence
|
|
144
|
-
* (`notDispatchedResult`) instead of running it. The sentence is what the
|
|
145
|
-
* MODEL reads. This field is the same fact as data, for the readers that ask
|
|
146
|
-
* "did this call run?" or "is this message a tool's result?":
|
|
147
|
-
* `security/extractSequence.ts` · `extractSequence`, which builds the
|
|
148
|
-
* `sequence` a permission policy judges (pairing each marker with the ONE
|
|
149
|
-
* proposal it answers, by position — a provider may reuse an id); the
|
|
150
|
-
* empty-lookup check's producer corpus (`toolCalls/evidence/producerCorpus.ts` ·
|
|
151
|
-
* `producerCorpusOf`); the check-in evidence trail
|
|
152
|
-
* (`core/checkin.ts` · `CheckInTrail` — its `toolCalls` are the calls
|
|
153
|
-
* already completed); the window's result naming
|
|
154
|
-
* (`core/agent/window/toolNames.ts` · `toolNameOfMessage` — the
|
|
155
|
-
* last-tool-result pin, the drop notice, the dangling-reference check); and
|
|
156
|
-
* the trace toolpack's `inspect_tool_call`
|
|
157
|
-
* (`trace-toolpack/traceToolpack/toolCallJournal.ts` · `notDispatchedOf`); and, under
|
|
158
|
-
* `.findings()`, the offer, the identity source, the findings DATA's `undeclaredResultIds`
|
|
159
|
-
* (and the replay-only piece's `undeclared:` line), the collapse, the window's
|
|
160
|
-
* `droppedStandings` and a turn's standing (`core/agent/findings/offer.ts`,
|
|
161
|
-
* `findings/context.ts` · `findingsContext`, `findings/serve.ts` · `collapseJudged`,
|
|
162
|
-
* `stages/window.ts`, `core/agent/window/ledgerFactPins.ts` · `turnStandingOf` — the
|
|
163
|
-
* `'ledger-fact'` pin and `WindowStrategyInput.standingOf`) — a settled message is not a
|
|
164
|
-
* result to judge. None of them parses the sentence.
|
|
165
|
-
*
|
|
166
|
-
* **One definition, two carriers.** The settled call's two brackets on the
|
|
167
|
-
* event stream carry the same fact under the same name, typed off THIS field
|
|
168
|
-
* (`events/payloads/stream.ts` · `ToolStartPayload.notDispatched`,
|
|
169
|
-
* `ToolEndPayload.notDispatched`), so a reader of the stream alone never has
|
|
170
|
-
* to guess from a `durationMs: 0` bracket whether the call ran.
|
|
171
|
-
*
|
|
172
|
-
* **Never reaches a provider.** `core/agent/composeRequest.ts` ·
|
|
173
|
-
* `stripFrameworkFields` removes it with `injectedBy` before a request
|
|
174
|
-
* exists, so the wire carries the sentence and nothing else.
|
|
175
|
-
*
|
|
176
|
-
* Absent on every other message.
|
|
177
|
-
*/
|
|
178
|
-
readonly notDispatched?: {
|
|
179
|
-
/** The call in the same batch the run paused on — the one the sentence names. */
|
|
180
|
-
readonly pausedCall: {
|
|
181
|
-
readonly toolCallId: string;
|
|
182
|
-
readonly toolName: string;
|
|
183
|
-
};
|
|
184
|
-
};
|
|
185
|
-
/**
|
|
186
|
-
* THE TOOL-BYTES BOUNDARY (honesty layer 2) — on a `role: 'tool'` message
|
|
187
|
-
* whose `content` the library annotated with a note that carries a VALUE
|
|
188
|
-
* (the inputs layer's "the call ran with "2h", the value the tool's rule
|
|
189
|
-
* assumes"), the length of the tool's OWN delivered text: `content` up to
|
|
190
|
-
* this index is the tool's; everything after it is the library's.
|
|
191
|
-
*
|
|
192
|
-
* Every reader that treats a result's content as the TOOL's words reads
|
|
193
|
-
* through the cut, and through ONE owner of it (`lib/toolBytes.ts` ·
|
|
194
|
-
* `toolBytesOf`): the evidence index (`core/agent/evidence/evidenceIndex.ts`
|
|
195
|
-
* · `evidenceFromHistory`), so a value that sits only in the note grounds no
|
|
196
|
-
* answer — without it, the next call could cite this result as the source of
|
|
197
|
-
* "2h" and an assumption would become an observed value; the answer's
|
|
198
|
-
* standing (`core/agent/assessment/assess.ts` · `assessAnswer`) and the
|
|
199
|
-
* answer account's in-view results (`answer-account/facts/inView.ts`),
|
|
200
|
-
* so the note never breaks the one emptiness reader's parse and hides an
|
|
201
|
-
* empty or absent result; the unsupported-argument seam's grounded corpus
|
|
202
|
-
* (`core/agent/stages/callLLM.ts`, cut on the committed twin — the wire copy
|
|
203
|
-
* has lost this field) and the empty-lookup seam's producer corpus
|
|
204
|
-
* (`core/agent/stages/toolCalls/evidence/producerCorpus.ts` · `producerCorpusOf`), so the note never
|
|
205
|
-
* vouches for an argument. The model still reads the whole `content`: it
|
|
206
|
-
* needs the value to reason about what ran.
|
|
207
|
-
*
|
|
208
|
-
* **Never reaches a provider.** `core/agent/composeRequest.ts` ·
|
|
209
|
-
* `stripFrameworkFields` removes it with `injectedBy` and `notDispatched`.
|
|
210
|
-
* Present only on a message the layer annotated, so every other run indexes
|
|
211
|
-
* exactly what it always did.
|
|
212
|
-
*/
|
|
213
|
-
readonly toolChars?: number;
|
|
214
|
-
/**
|
|
215
|
-
* THE EXEMPTION LINEAGE OF A FOLD — on a compaction summary frame
|
|
216
|
-
* (`core/agent/window/summarize.ts` · `buildSummaryMessage`), the lookup
|
|
217
|
-
* forms the EXEMPT corpus held for the messages this summary folded away:
|
|
218
|
-
* the person's and the app's user/system turns (and the lineage of any
|
|
219
|
-
* earlier summary inside the span), taken from those ORIGINAL messages at
|
|
220
|
-
* fold time by `core/agent/evidence/evidenceIndex.ts` · `exemptLineageOf`.
|
|
221
|
-
*
|
|
222
|
-
* The summary's own TEXT is a model's claim, so it exempts nothing
|
|
223
|
-
* (`evidenceIndex.ts` · `exemptFromRun` skips the frame's content and reads
|
|
224
|
-
* this field instead). Without the field a value the person gave in a
|
|
225
|
-
* folded turn would lose its exemption; without skipping the text, a value
|
|
226
|
-
* the summarizer invented would gain one.
|
|
227
|
-
*
|
|
228
|
-
* Rides the summary wherever the history goes (the conversation checkpoint
|
|
229
|
-
* included), so a restored summary keeps the lineage it was folded with; a
|
|
230
|
-
* summary frame WITHOUT it (hand-built, or folded before this field
|
|
231
|
-
* existed) exempts nothing. Absent when the fold carried no exempt value.
|
|
232
|
-
*
|
|
233
|
-
* **Never reaches a provider.** `core/agent/composeRequest.ts` ·
|
|
234
|
-
* `stripFrameworkFields` removes it with the other framework fields.
|
|
235
|
-
*/
|
|
236
|
-
readonly foldedExempt?: readonly string[];
|
|
237
|
-
/** The library's mark on a person's typed answer: see {@link TypedAnswerMark}. */
|
|
238
|
-
readonly answersAsk?: import('./typedAnswerMark.js').TypedAnswerMark;
|
|
239
|
-
/** On a `role: 'tool'` message: the calls its tool made through `ctx.tools` that ran (`./innerCalls.ts`); never sent. */
|
|
240
|
-
readonly calls?: readonly import('./innerCalls.js').InnerCallRan[];
|
|
241
|
-
}
|
|
17
|
+
export type { LLMMessage } from './types/message.js';
|
|
18
|
+
export type { LLMRequest } from './types/request.js';
|
|
19
|
+
export type { LLMResponse, WireToolManifest, LLMChunk } from './types/response.js';
|
|
20
|
+
export type { ResilienceReport, LLMCallHooks, LLMProvider } from './types/provider.js';
|
|
21
|
+
export { STAGED_INPUTS_ENV, canStageCodeInputs, canReadCodeFiles, canRunCodeCommands, type BrowserShot, type BrowserDriver, type BrowserRunner, type BrowserSession, type CodeRunner, type CodeInput, type StagedCodeInput, type CodeSession, type CodeReadOptions, type CodeFile, type CodeCommandOptions, type CodeCommandResult, type CodeTruncation, type CodeResult, } from './types/code.js';
|
|
242
22
|
export interface LLMToolSchema {
|
|
243
23
|
readonly name: string;
|
|
244
24
|
readonly description: string;
|
|
245
25
|
readonly inputSchema: Readonly<Record<string, unknown>>;
|
|
246
26
|
}
|
|
247
|
-
export interface LLMRequest {
|
|
248
|
-
readonly systemPrompt?: string;
|
|
249
|
-
readonly messages: readonly LLMMessage[];
|
|
250
|
-
readonly tools?: readonly LLMToolSchema[];
|
|
251
|
-
readonly model: string;
|
|
252
|
-
readonly temperature?: number;
|
|
253
|
-
readonly maxTokens?: number;
|
|
254
|
-
readonly stop?: readonly string[];
|
|
255
|
-
readonly signal?: AbortSignal;
|
|
256
|
-
/**
|
|
257
|
-
* Cache markers (v2.6+) — provider-agnostic prefix-cache hints
|
|
258
|
-
* populated by `CacheStrategy.prepareRequest` after the agent's
|
|
259
|
-
* CacheGate decider routes to `apply-markers`. Each marker
|
|
260
|
-
* identifies a cacheable prefix in `system` / `tools` / `messages`.
|
|
261
|
-
*
|
|
262
|
-
* Providers that support caching (Anthropic, Bedrock-Claude) read
|
|
263
|
-
* this field and translate to their wire format. Providers without
|
|
264
|
-
* cache support (OpenAI auto-cache, Mock, NoOp) ignore it.
|
|
265
|
-
*/
|
|
266
|
-
readonly cacheMarkers?: readonly import('../cache/types.js').CacheMarker[];
|
|
267
|
-
/**
|
|
268
|
-
* v2.14 — request the LLM emit reasoning/thinking content on this call.
|
|
269
|
-
*
|
|
270
|
-
* Activation: presence of this field tells the provider to ASK for
|
|
271
|
-
* thinking. It is the INTENT, never a wire shape: each adapter maps it to
|
|
272
|
-
* what the model takes. The Anthropic adapters ask their declared
|
|
273
|
-
* `thinkingMode(model)` — a `'budget'` model gets `thinking: { type:
|
|
274
|
-
* 'enabled', budget_tokens: budget }`, an `'adaptive'` model (Claude 4.7
|
|
275
|
-
* and later) gets `thinking: { type: 'adaptive', display: 'summarized' }`
|
|
276
|
-
* with no budget, and a `'none'` model is refused with an
|
|
277
|
-
* `UnsupportedThinkingError` before anything is sent. OpenAI ignores it
|
|
278
|
-
* (o1/o3 thinking is selected at the model id level, not per-request).
|
|
279
|
-
*
|
|
280
|
-
* `budget` is the maximum reasoning tokens the model may spend where the
|
|
281
|
-
* model takes a budget (Anthropic: a whole number of at least 1024). On
|
|
282
|
-
* an adaptive model it is not sent; it only raises `max_tokens` to at
|
|
283
|
-
* least `budget + 1024`, so a long think has room to finish.
|
|
284
|
-
*
|
|
285
|
-
* Independent from `LLMMessage.thinkingBlocks` (the response side):
|
|
286
|
-
* - `request.thinking` = activation (consumer ASKS for thinking)
|
|
287
|
-
* - `message.thinkingBlocks` = round-trip (consumer ECHOES prior
|
|
288
|
-
* assistant turn's signed blocks back to the model)
|
|
289
|
-
*
|
|
290
|
-
* Set via `AgentBuilder.thinking({ budget })` — applied to every
|
|
291
|
-
* LLM call the agent makes. Leave undefined to call without thinking
|
|
292
|
-
* (the v2.13 default).
|
|
293
|
-
*/
|
|
294
|
-
readonly thinking?: {
|
|
295
|
-
readonly budget: number;
|
|
296
|
-
};
|
|
297
|
-
/**
|
|
298
|
-
* v7.26 — force the model to answer through one named tool.
|
|
299
|
-
*
|
|
300
|
-
* One arm, because one arm is what the library needs and can keep a
|
|
301
|
-
* promise about: `.outputSchema(parser, { strategy: 'tool-forced' })`
|
|
302
|
-
* presents the schema as a synthetic tool and forces the choice, so the
|
|
303
|
-
* shape is constrained at generation instead of requested in prose.
|
|
304
|
-
* Anthropic spells it `{type:'tool',name}`, OpenAI
|
|
305
|
-
* `{type:'function',function:{name}}`, Bedrock Converse
|
|
306
|
-
* `toolConfig.toolChoice.tool.name` — the field is the one word all three
|
|
307
|
-
* agree on, and each adapter writes its own dialect.
|
|
308
|
-
*
|
|
309
|
-
* If `forcedToolChoiceFor(provider, model)` answers false, the agent never
|
|
310
|
-
* sends this field: it refuses at
|
|
311
|
-
* run start instead, naming the provider and the model. Silently sending it
|
|
312
|
-
* to a wire that ignores it would turn a guarantee into a suggestion with
|
|
313
|
-
* nothing in the recording to say so — and a model that rejects it (Claude
|
|
314
|
-
* Opus 5.5, Sonnet 5.5, Fable 5.1, Mythos 5.1) is refused by the Anthropic
|
|
315
|
-
* adapters before sending, with an `UnsupportedToolChoiceError`.
|
|
316
|
-
*/
|
|
317
|
-
readonly toolChoice?: {
|
|
318
|
-
readonly type: 'tool';
|
|
319
|
-
readonly name: string;
|
|
320
|
-
};
|
|
321
|
-
/**
|
|
322
|
-
* Constrain the model's TEXT answer to a JSON Schema with the provider's
|
|
323
|
-
* own structured output — `.outputSchema(parser, { strategy: 'native' })`.
|
|
324
|
-
* The Anthropic adapters write it as `output_config: { format }`
|
|
325
|
-
* (https://platform.claude.com/docs/en/build-with-claude/structured-outputs).
|
|
326
|
-
*
|
|
327
|
-
* Same rule as {@link toolChoice}: when `nativeOutputSchemaFor(provider,
|
|
328
|
-
* model)` answers false the agent refuses at run start, naming both, and an
|
|
329
|
-
* adapter that cannot put it on its wire refuses with an
|
|
330
|
-
* `UnsupportedNativeOutputError` before anything is sent — never drops it.
|
|
331
|
-
* The schema is the wire copy `nativeOutputFormat` built; send it as-is.
|
|
332
|
-
*/
|
|
333
|
-
readonly outputFormat?: {
|
|
334
|
-
readonly type: 'json_schema';
|
|
335
|
-
readonly schema: Readonly<Record<string, unknown>>;
|
|
336
|
-
};
|
|
337
|
-
}
|
|
338
|
-
export interface LLMResponse {
|
|
339
|
-
/** Ordered replay evidence, retained with the assistant message. */
|
|
340
|
-
readonly replay?: import('../thinking/replay.js').MessageReplay;
|
|
341
|
-
/** Leaf-side omissions, also available to standalone callers without hooks. */
|
|
342
|
-
readonly replayOmissions?: readonly import('../thinking/replay.js').ThinkingReplayOmission[];
|
|
343
|
-
readonly content: string;
|
|
344
|
-
readonly toolCalls: readonly {
|
|
345
|
-
readonly id: string;
|
|
346
|
-
readonly name: string;
|
|
347
|
-
readonly args: Readonly<Record<string, unknown>>;
|
|
348
|
-
/**
|
|
349
|
-
* The provider observed malformed or unfinished streamed tool arguments.
|
|
350
|
-
* The call must not execute, even with schema validation disabled. `args`
|
|
351
|
-
* is only a placeholder on this branch, not evidence of valid empty input.
|
|
352
|
-
* Raw argument fragments are deliberately not retained here.
|
|
353
|
-
*/
|
|
354
|
-
readonly argumentsFailure?: {
|
|
355
|
-
readonly reason: 'invalid-json' | 'invalid-argument-shape' | 'incomplete-stream';
|
|
356
|
-
};
|
|
357
|
-
/**
|
|
358
|
-
* 9.29.0 — what the PROVIDER needs back with this call, opaque to
|
|
359
|
-
* everything in between.
|
|
360
|
-
*
|
|
361
|
-
* Same escape-hatch shape and the same rules as
|
|
362
|
-
* `ThinkingBlock.providerMeta`: plain data only, nothing
|
|
363
|
-
* identity-bearing beyond what the wire itself demands, and no framework
|
|
364
|
-
* behaviour keys on it. The framework's whole job is to keep it attached
|
|
365
|
-
* to its call — through `scope.llmLatestToolCalls`, into the assistant
|
|
366
|
-
* turn in `history`, across a checkpoint — and hand it back to the same
|
|
367
|
-
* adapter on the next request.
|
|
368
|
-
*
|
|
369
|
-
* Why it exists: Gemini signs the reasoning behind a function call and
|
|
370
|
-
* REFUSES the following turn when the signature does not come back
|
|
371
|
-
* (`thought_signature`, HTTP 400 — measured in the field, after the tool
|
|
372
|
-
* had already run). The signature belongs to the tool call, not to the
|
|
373
|
-
* message and not to a thinking block, so it needed a home on the call.
|
|
374
|
-
* Providers that sign nothing leave this undefined and cost nothing.
|
|
375
|
-
*/
|
|
376
|
-
readonly providerMeta?: Readonly<Record<string, unknown>>;
|
|
377
|
-
}[];
|
|
378
|
-
readonly usage: {
|
|
379
|
-
readonly input: number;
|
|
380
|
-
readonly output: number;
|
|
381
|
-
readonly cacheRead?: number;
|
|
382
|
-
readonly cacheWrite?: number;
|
|
383
|
-
/**
|
|
384
|
-
* v2.14 — count of reasoning/thinking tokens used by the model.
|
|
385
|
-
* Distinct from `output` (which is visible-content tokens).
|
|
386
|
-
*
|
|
387
|
-
* Semantics:
|
|
388
|
-
* - `undefined` — provider doesn't expose / no thinking enabled
|
|
389
|
-
* on this call / call without extended thinking
|
|
390
|
-
* - `0` — thinking enabled but model produced no
|
|
391
|
-
* thinking tokens this call
|
|
392
|
-
* - `>0` — actual reasoning token count (billing-relevant
|
|
393
|
-
* for both Anthropic extended thinking and
|
|
394
|
-
* OpenAI o1/o3 reasoning_tokens)
|
|
395
|
-
*
|
|
396
|
-
* Cost dashboards reading `cost.tick` events should track this
|
|
397
|
-
* separately from `output` — pricing differs (Anthropic charges
|
|
398
|
-
* extended thinking at output rates; OpenAI o1/o3 reasoning tokens
|
|
399
|
-
* are billed as a separate line item).
|
|
400
|
-
*/
|
|
401
|
-
readonly thinking?: number;
|
|
402
|
-
};
|
|
403
|
-
readonly stopReason: string;
|
|
404
|
-
readonly providerRef?: string;
|
|
405
|
-
/**
|
|
406
|
-
* v2.14 — Provider-specific raw thinking data, opaque to the
|
|
407
|
-
* framework. Providers that support extended thinking populate this
|
|
408
|
-
* with their native shape (Anthropic: array of `{type, thinking,
|
|
409
|
-
* signature}` blocks; OpenAI: `reasoning_summary` value; custom:
|
|
410
|
-
* whatever the provider emits). The framework hands this to a
|
|
411
|
-
* configured `ThinkingHandler.normalize(rawThinking)` to produce
|
|
412
|
-
* the normalized `ThinkingBlock[]` that lands on
|
|
413
|
-
* `LLMMessage.thinkingBlocks`.
|
|
414
|
-
*
|
|
415
|
-
* Undefined when the provider has no thinking content for this call
|
|
416
|
-
* — most calls (gpt-4o, claude without extended thinking enabled,
|
|
417
|
-
* etc.). The thinking subflow's stage early-returns in this case.
|
|
418
|
-
*/
|
|
419
|
-
readonly rawThinking?: unknown;
|
|
420
|
-
/**
|
|
421
|
-
* 9.60.0 — what this request ACTUALLY carried, read back from the
|
|
422
|
-
* serialized body after every transform (see adapters/llm/wireManifest.ts,
|
|
423
|
-
* which builds it; the SHAPE lives here because it is part of the provider
|
|
424
|
-
* port, and the skill-graph fence rightly refuses this file reaching
|
|
425
|
-
* anything past the port).
|
|
426
|
-
*
|
|
427
|
-
* The wire seam's evidence: the recorded defect was an adapter still
|
|
428
|
-
* serializing four tool schemas after the internal frame said they were
|
|
429
|
-
* removed — invisible to any check that reads only the pre-serialization
|
|
430
|
-
* IR. Absent when the adapter states no manifest, and the wire check then
|
|
431
|
-
* treats the request as INCOMPARABLE (never as "nothing crossed"); an
|
|
432
|
-
* empty `toolNames` is the opposite — a stated zero.
|
|
433
|
-
*/
|
|
434
|
-
readonly wireManifest?: WireToolManifest;
|
|
435
|
-
}
|
|
436
|
-
/** The structural record of what one request actually carried on the wire. */
|
|
437
|
-
export interface WireToolManifest {
|
|
438
|
-
/** Tool names as they appear in the serialized body, in wire order. */
|
|
439
|
-
readonly toolNames: readonly string[];
|
|
440
|
-
/**
|
|
441
|
-
* Present only when the serialized body carried a structured-output format
|
|
442
|
-
* (Anthropic's `output_config.format`) — its `type`, read back from the
|
|
443
|
-
* body. Absent means none crossed. A `strategy: 'native'` agent refuses a
|
|
444
|
-
* stated manifest without it: the provider declared the capability and the
|
|
445
|
-
* request went out unconstrained.
|
|
446
|
-
*/
|
|
447
|
-
readonly outputFormat?: 'json_schema';
|
|
448
|
-
}
|
|
449
|
-
export interface LLMChunk {
|
|
450
|
-
readonly tokenIndex: number;
|
|
451
|
-
/** Token text. Empty for the terminal chunk (`done: true`). */
|
|
452
|
-
readonly content: string;
|
|
453
|
-
/** True only for the final chunk in a stream. */
|
|
454
|
-
readonly done: boolean;
|
|
455
|
-
/**
|
|
456
|
-
* Authoritative response payload, populated ONLY on the final chunk
|
|
457
|
-
* (`done: true`). Carries `toolCalls`, `usage`, `stopReason` — the
|
|
458
|
-
* fields that drive the ReAct loop. The `content` mirrors the
|
|
459
|
-
* concatenation of all non-terminal chunks; consumers can use
|
|
460
|
-
* either source.
|
|
461
|
-
*
|
|
462
|
-
* Streaming providers SHOULD populate this. Older providers that
|
|
463
|
-
* yield only text and end with `done: true` (no `response`) are
|
|
464
|
-
* still supported — Agent falls back to `complete()` for the
|
|
465
|
-
* authoritative payload in that case.
|
|
466
|
-
*/
|
|
467
|
-
readonly response?: LLMResponse;
|
|
468
|
-
/**
|
|
469
|
-
* Live thinking text. Nonempty fragments on nonterminal chunks drive
|
|
470
|
-
* `agentfootprint.stream.thinking_delta` events under the run's redaction policy.
|
|
471
|
-
* Adapters keep signatures, redacted blocks and private data out of this field.
|
|
472
|
-
*/
|
|
473
|
-
readonly thinkingDelta?: string;
|
|
474
|
-
/** Classification from the provider request. Omit it when neither classification can be confirmed. */
|
|
475
|
-
readonly thinkingKind?: ThinkingDeltaKind;
|
|
476
|
-
}
|
|
477
|
-
/**
|
|
478
|
-
* v7.8 — what a resilience decorator DID during one provider call.
|
|
479
|
-
*
|
|
480
|
-
* Plain data only (strings + numbers), so a report drops straight into a
|
|
481
|
-
* typed event payload and survives `structuredClone`. Field names are
|
|
482
|
-
* deliberately 1:1 with the declared event payloads
|
|
483
|
-
* (`FallbackTriggeredPayload`, `ErrorRetriedPayload`,
|
|
484
|
-
* `ErrorRecoveredPayload`) so the in-run call site maps a report to an
|
|
485
|
-
* event without renaming or synthesizing anything.
|
|
486
|
-
*
|
|
487
|
-
* Produced by exactly one decorator per `kind`:
|
|
488
|
-
* • `'fell-back'` ← `withFallback`
|
|
489
|
-
* • `'retried'` / `'recovered'` ← `withRetry`
|
|
490
|
-
* • `'circuit-changed'` ← `withCircuitBreaker` (9.32.0)
|
|
491
|
-
*/
|
|
492
|
-
export type ResilienceReport = {
|
|
493
|
-
readonly kind: 'fell-back';
|
|
494
|
-
/** Provider tried first, which failed. */
|
|
495
|
-
readonly primary: string;
|
|
496
|
-
/** Provider called instead — the one that actually served. */
|
|
497
|
-
readonly fallback: string;
|
|
498
|
-
/** Message of the error that triggered the fallback. */
|
|
499
|
-
readonly reason: string;
|
|
500
|
-
} | {
|
|
501
|
-
readonly kind: 'retried';
|
|
502
|
-
/** 1-based number of the attempt ABOUT TO START (2 = first retry). */
|
|
503
|
-
readonly attempt: number;
|
|
504
|
-
readonly maxAttempts: number;
|
|
505
|
-
/** Message of the error that caused this retry. */
|
|
506
|
-
readonly lastError: string;
|
|
507
|
-
/** How long the decorator waits before the attempt — the stated wait when one won. */
|
|
508
|
-
readonly backoffMs: number;
|
|
509
|
-
/**
|
|
510
|
-
* The wait the failure itself STATED (a `Retry-After` header, a
|
|
511
|
-
* gateway's "try again in N seconds"), in ms, as the adapter declared
|
|
512
|
-
* it on `retryAfterMs`. Absent when it stated none. `backoffMs` is
|
|
513
|
-
* max(the schedule, this), capped by the policy's `maxDelayMs` — so a
|
|
514
|
-
* reader sees both what was asked and what was done.
|
|
515
|
-
*/
|
|
516
|
-
readonly statedWaitMs?: number;
|
|
517
|
-
/**
|
|
518
|
-
* Classification OF THE ERROR — **not** of the predicate's
|
|
519
|
-
* reasoning. `shouldRetry` returns a bare boolean, so when a custom
|
|
520
|
-
* predicate is in force the decorator cannot know *why* it said yes;
|
|
521
|
-
* this field reports what the error looked like instead, derived
|
|
522
|
-
* from the same `status`/`statusCode` fields `defaultShouldRetry`
|
|
523
|
-
* inspects. One of: `'http-429'` | `'http-5xx'` | `'http-4xx'` |
|
|
524
|
-
* `` `http-${code}` `` | `'no-status'`.
|
|
525
|
-
*/
|
|
526
|
-
readonly reason: string;
|
|
527
|
-
} | {
|
|
528
|
-
readonly kind: 'recovered';
|
|
529
|
-
/** 1-based attempt that finally succeeded. Always >= 2. */
|
|
530
|
-
readonly attempt: number;
|
|
531
|
-
readonly totalDurationMs: number;
|
|
532
|
-
} | {
|
|
533
|
-
/**
|
|
534
|
-
* v9.32 — the breaker moved between `closed` / `open` / `half-open`.
|
|
535
|
-
*
|
|
536
|
-
* Until this arm existed `withCircuitBreaker` reported NOTHING through
|
|
537
|
-
* the in-run channel: `onStateChange` was the only way to see a trip,
|
|
538
|
-
* and that hook fires at consumer level where the run ids are
|
|
539
|
-
* synthetic. An independent reviewer (2026-08-13, on a local harness of
|
|
540
|
-
* scripted failures) watched a breaker open after two failures, serve
|
|
541
|
-
* from fallback, half-open after cooldown and close after two probes —
|
|
542
|
-
* all correct, and all invisible
|
|
543
|
-
* to the typed stream. So the same trip is now on the record with the
|
|
544
|
-
* run's real correlation ids, because every transition happens INSIDE a
|
|
545
|
-
* call and there is nothing to synthesize.
|
|
546
|
-
*
|
|
547
|
-
* `onStateChange` is unchanged and still fires beside this: it is the
|
|
548
|
-
* consumer's own hook, and a Redis-backed counter built on it must not
|
|
549
|
-
* start depending on whether a run happened to be in flight.
|
|
550
|
-
*/
|
|
551
|
-
readonly kind: 'circuit-changed';
|
|
552
|
-
/** The state entered. Transitions only — a no-op re-entry never reports. */
|
|
553
|
-
readonly state: 'closed' | 'open' | 'half-open';
|
|
554
|
-
/** WHY, in the breaker's own words (`'3 consecutive failures'`,
|
|
555
|
-
* `'cooldown elapsed'`, `'half-open probe failed'`). Never an error's
|
|
556
|
-
* message — the failure that tripped it is reported by whoever threw. */
|
|
557
|
-
readonly reason: string;
|
|
558
|
-
/** WHICH provider this breaker wraps. A stack of breakers under one
|
|
559
|
-
* fallback produces one stream, and this is what tells them apart. */
|
|
560
|
-
readonly providerName: string;
|
|
561
|
-
};
|
|
562
|
-
/**
|
|
563
|
-
* v7.8 — optional per-call hooks the CALLER hands a provider.
|
|
564
|
-
*
|
|
565
|
-
* Lets a resilience decorator report what it did to whoever invoked it,
|
|
566
|
-
* without the decorator knowing anything about runs, scopes, or events.
|
|
567
|
-
* The channel rides the CALL (not the factory) because decorators are
|
|
568
|
-
* constructed by the consumer before any run exists.
|
|
569
|
-
*
|
|
570
|
-
* Passed by agentfootprint's in-run LLM call sites, which translate each
|
|
571
|
-
* report into an already-declared typed event with real correlation ids.
|
|
572
|
-
* Outside a run nothing passes hooks, so `hooks` is `undefined` and every
|
|
573
|
-
* report site short-circuits — standalone decorator behaviour is
|
|
574
|
-
* unchanged.
|
|
575
|
-
*
|
|
576
|
-
* ⚠ **IF YOU WRITE A PROVIDER WRAPPER, FORWARD THIS PARAMETER.** It is the
|
|
577
|
-
* one silent-failure trap in the design. A wrapper that declares
|
|
578
|
-
* `complete(req)` and calls `inner.complete(req)` still type-checks
|
|
579
|
-
* perfectly — `hooks` is optional, and TypeScript has never rejected an
|
|
580
|
-
* implementation for taking FEWER parameters than its signature — so
|
|
581
|
-
* dropping it produces no compile error, no runtime error, and no test
|
|
582
|
-
* failure. What it produces is a decorated provider that goes DARK the
|
|
583
|
-
* moment it is placed underneath: the reports still happen, and nothing
|
|
584
|
-
* receives them. Every wrapper shipped in this library forwards (the three
|
|
585
|
-
* `src/resilience/` decorators, and EVERY class-form / Azure-shaped wrapper
|
|
586
|
-
* in `src/adapters/llm/` — `foundry()` and `foundryLocal()` included; the
|
|
587
|
-
* count is deliberately not written down, because a stale count reads as an
|
|
588
|
-
* unaudited wrapper), so the trap can only be sprung by a
|
|
589
|
-
* consumer-authored wrapper — `myWrapper(withRetry(p))`. There is no way to
|
|
590
|
-
* police it from here; the only defence is this note and the one in the
|
|
591
|
-
* resilience guide's "honest limits".
|
|
592
|
-
*/
|
|
593
|
-
export interface LLMCallHooks {
|
|
594
|
-
/**
|
|
595
|
-
* The actual leaf provider omitted eligible completed-turn thinking before
|
|
596
|
-
* transport. Wrappers forward this channel unchanged, like onResilience.
|
|
597
|
-
* The run records metadata and keeps the permitted omission in its history.
|
|
598
|
-
*/
|
|
599
|
-
readonly onReplayPrepared?: (preparation: import('../thinking/replay.js').ReplayPreparation) => void;
|
|
600
|
-
/**
|
|
601
|
-
* Called once per resilience decision (a fallback, a retry, a
|
|
602
|
-
* recovery). Decorators forward this hook inward unchanged, so a
|
|
603
|
-
* stack of decorators produces one concatenated report stream with no
|
|
604
|
-
* duplication.
|
|
605
|
-
*/
|
|
606
|
-
readonly onResilience?: (report: ResilienceReport) => void;
|
|
607
|
-
}
|
|
608
|
-
export interface LLMProvider {
|
|
609
|
-
readonly name: string;
|
|
610
|
-
/**
|
|
611
|
-
* How this provider's wire caches a repeated prompt prefix (`PromptCaching`,
|
|
612
|
-
* from `agentfootprint/cache`). The agent picks its cache strategy from
|
|
613
|
-
* this, never from `name`. Absent = no caching the agent drives or meters.
|
|
614
|
-
* A wrapper must forward it, like `carriesInMessages`.
|
|
615
|
-
* A model-aware declaration returns undefined for an unknown/unsupported
|
|
616
|
-
* model. `cacheStrategyFor(provider, model)` resolves either form; adapters
|
|
617
|
-
* must consult the same rule before putting cache markers on the wire.
|
|
618
|
-
*/
|
|
619
|
-
readonly promptCaching?: import('../cache/types.js').PromptCaching | ((model: string) => import('../cache/types.js').PromptCaching | undefined);
|
|
620
|
-
/**
|
|
621
|
-
* The handler that normalizes this wire's thinking (`rawThinking`). The
|
|
622
|
-
* agent uses it unless `.thinkingHandler()` overrides it; absent = no
|
|
623
|
-
* thinking stage. Never chosen by `name` — a wrapper must forward it.
|
|
624
|
-
*/
|
|
625
|
-
readonly thinkingHandler?: import('../thinking/types.js').ThinkingHandler;
|
|
626
|
-
/**
|
|
627
|
-
* Which thinking request each model takes on this wire — `'budget'`,
|
|
628
|
-
* `'adaptive'` or `'none'` (`ThinkingMode`, from `agentfootprint/providers`),
|
|
629
|
-
* asked with the model id a request names (the adapter resolves its own
|
|
630
|
-
* shorthand, e.g. `'anthropic'`). The adapter maps `LLMRequest.thinking` to
|
|
631
|
-
* the right wire shape for that model; the agent reads this at build to
|
|
632
|
-
* refuse `.thinking()` for a model that cannot think and to say, in dev
|
|
633
|
-
* mode, when `'adaptive'` will not send the budget.
|
|
634
|
-
*
|
|
635
|
-
* Absent = no per-model claim: requests carry `thinking: { budget }` and the
|
|
636
|
-
* adapter decides. A plain function of the model id — it must not use
|
|
637
|
-
* `this`, because a wrapper forwards it as a value, like `carriesInMessages`;
|
|
638
|
-
* `withFallback` answers for its pair.
|
|
639
|
-
*/
|
|
640
|
-
readonly thinkingMode?: (model: string) => import('../thinking/types.js').ThinkingMode;
|
|
641
|
-
/**
|
|
642
|
-
* v7.21 — which roles this provider carries INSIDE the `messages` array.
|
|
643
|
-
*
|
|
644
|
-
* The wires disagree, and the disagreement is invisible from the outside:
|
|
645
|
-
* the Anthropic-family adapters (Anthropic, Bedrock, Browser Anthropic) DROP
|
|
646
|
-
* a `role: 'system'` message inside `messages` because system rides a
|
|
647
|
-
* separate top-level field, while the OpenAI-family adapters carry it. So a
|
|
648
|
-
* `slot: 'messages'` injection with `role: 'system'` would arrive on one
|
|
649
|
-
* provider and vanish on another — and nothing in the recording would tell
|
|
650
|
-
* the two apart. Declaring the capability is what lets the engine refuse at
|
|
651
|
-
* run start instead, naming the provider and the roles it does carry.
|
|
652
|
-
*
|
|
653
|
-
* Consulted at DELIVERY time by the agent's `Deliver` stage. A role that is
|
|
654
|
-
* not listed is REFUSED, never silently re-roled: changing who appears to
|
|
655
|
-
* speak is a meaning change the app must make, not the library.
|
|
656
|
-
*
|
|
657
|
-
* **Optional, and absence is not "carries everything"** — a provider that
|
|
658
|
-
* omits it is treated as `['user', 'assistant']`
|
|
659
|
-
* ({@link DEFAULT_CARRIES_IN_MESSAGES}), the floor every known wire
|
|
660
|
-
* supports. Declare it if your adapter carries more.
|
|
661
|
-
*
|
|
662
|
-
* A WRAPPER must forward it (the three `src/resilience/` decorators do);
|
|
663
|
-
* `withFallback` publishes the INTERSECTION of the two providers it holds,
|
|
664
|
-
* because a role only one of them carries is a role the call might drop.
|
|
665
|
-
*/
|
|
666
|
-
readonly carriesInMessages?: readonly WireRole[];
|
|
667
|
-
/**
|
|
668
|
-
* v7.26 — whether this adapter puts {@link LLMRequest.toolChoice} on its
|
|
669
|
-
* wire as a forced choice of one named tool.
|
|
670
|
-
*
|
|
671
|
-
* **Absence means NO, not "probably".** That is the opposite of
|
|
672
|
-
* `carriesInMessages`, whose absence means the floor every wire supports,
|
|
673
|
-
* and the difference is what the two capabilities are for. A role that
|
|
674
|
-
* quietly vanishes costs a message; a tool choice that quietly vanishes
|
|
675
|
-
* costs the guarantee the consumer selected the strategy FOR — the model
|
|
676
|
-
* would answer in whatever shape it liked while the config said the shape
|
|
677
|
-
* was constrained. So an agent using `strategy: 'tool-forced'` on a
|
|
678
|
-
* provider that has not declared this refuses at run start, by name.
|
|
679
|
-
*
|
|
680
|
-
* Declare it only where it is true of the endpoint, not of the SDK: the
|
|
681
|
-
* OpenAI adapter declares it for real OpenAI and Azure and NOT behind a
|
|
682
|
-
* custom `baseURL` (Ollama, vLLM, Together, …), because what an
|
|
683
|
-
* OpenAI-compatible server does with `tool_choice` is that server's
|
|
684
|
-
* business and this library does not get to promise it.
|
|
685
|
-
*
|
|
686
|
-
* A WRAPPER must forward it; `withFallback` publishes the AND of the two
|
|
687
|
-
* providers it holds. Model-specific restrictions are declared separately
|
|
688
|
-
* by `supportsForcedToolChoice`; this existing wire flag remains boolean.
|
|
689
|
-
*/
|
|
690
|
-
readonly carriesForcedToolChoice?: boolean;
|
|
691
|
-
/**
|
|
692
|
-
* Optional model-specific restriction on the forced-choice wire capability.
|
|
693
|
-
* Read with `forcedToolChoiceFor(provider, model)`: the wire flag must be
|
|
694
|
-
* true AND this predicate (when present) must answer true. Absence preserves
|
|
695
|
-
* the wire flag's existing behaviour. The adapter resolves its shorthand.
|
|
696
|
-
*
|
|
697
|
-
* Like `thinkingMode`, this function must not depend on `this`; wrappers
|
|
698
|
-
* forward it as a value. `withFallback` intersects both sides per model.
|
|
699
|
-
*/
|
|
700
|
-
readonly supportsForcedToolChoice?: (model: string) => boolean;
|
|
701
|
-
/**
|
|
702
|
-
* Whether this adapter puts {@link LLMRequest.outputFormat} on its wire —
|
|
703
|
-
* the provider's own structured output, `strategy: 'native'`. **Absence
|
|
704
|
-
* means NO**, for the reason `carriesForcedToolChoice` gives: a format that
|
|
705
|
-
* quietly vanishes costs the guarantee the strategy was chosen for. Declared
|
|
706
|
-
* by `anthropic()`, `browserAnthropic()` and the mock; read with
|
|
707
|
-
* `nativeOutputSchemaFor(provider, model)`. A WRAPPER must forward it;
|
|
708
|
-
* `withFallback` publishes the AND of its pair.
|
|
709
|
-
*/
|
|
710
|
-
readonly carriesNativeOutputSchema?: boolean;
|
|
711
|
-
/**
|
|
712
|
-
* Optional per-model restriction on {@link carriesNativeOutputSchema}, the
|
|
713
|
-
* `supportsForcedToolChoice` twin: both must answer true. A plain function
|
|
714
|
-
* of the model id (no `this`); the adapter resolves its own shorthand.
|
|
715
|
-
*/
|
|
716
|
-
readonly supportsNativeOutputSchema?: (model: string) => boolean;
|
|
717
|
-
/**
|
|
718
|
-
* Positive model knowledge for automatic native output. Unlike explicit
|
|
719
|
-
* native support, this must return false for unknown or opaque aliases.
|
|
720
|
-
* Auto requires both native wire support and this predicate to return true;
|
|
721
|
-
* absence keeps instruction-based generation. It must not depend on `this`.
|
|
722
|
-
* Wrappers forward it; fallback pairs require both sides to know the model.
|
|
723
|
-
*/
|
|
724
|
-
readonly supportsAutoNativeOutputSchema?: (model: string) => boolean;
|
|
725
|
-
/**
|
|
726
|
-
* `hooks` (v7.8) is optional and additive — implementations may declare
|
|
727
|
-
* `complete(req)` with no second parameter and stay assignable. A LEAF
|
|
728
|
-
* provider (one that talks to a vendor) may ignore it. A WRAPPER must
|
|
729
|
-
* forward it, or everything it wraps goes silently dark — see the
|
|
730
|
-
* `LLMCallHooks` docs above.
|
|
731
|
-
*/
|
|
732
|
-
complete(req: LLMRequest, hooks?: LLMCallHooks): Promise<LLMResponse>;
|
|
733
|
-
stream?(req: LLMRequest, hooks?: LLMCallHooks): AsyncIterable<LLMChunk>;
|
|
734
|
-
}
|
|
735
27
|
/**
|
|
736
28
|
* What a tool DECLARES it touches (9.11.0).
|
|
737
29
|
*
|
|
@@ -903,438 +195,4 @@ export interface PricingTable {
|
|
|
903
195
|
/** USD per ONE token for the given model+kind. */
|
|
904
196
|
pricePerToken(model: string, kind: TokenKind): number;
|
|
905
197
|
}
|
|
906
|
-
/**
|
|
907
|
-
* A service that runs code in an isolated session — a managed code
|
|
908
|
-
* interpreter, a container pool, a subprocess.
|
|
909
|
-
*
|
|
910
|
-
* **The shape is Start → Execute ×N → Stop**, because that is what every real
|
|
911
|
-
* one is, and the middle is the part a framework has to make possible. Paying
|
|
912
|
-
* session start-up on every call is the honest cheap version; holding the
|
|
913
|
-
* session in a module-level map is the fast version that hands one live sandbox
|
|
914
|
-
* to whoever calls next. `ctx.onTeardown` + {@link ToolExecutionContext.runId}
|
|
915
|
-
* are what let a tool do neither.
|
|
916
|
-
*
|
|
917
|
-
* ── Why this port exists at all: "summarize prose, compute data" ────────────
|
|
918
|
-
* A tool that returns 40MB of rows does not need a bigger context window; it
|
|
919
|
-
* needs to not put the rows in one. The motivating failure is a real production
|
|
920
|
-
* request of 879,073 tokens — a tool result pasted straight into the prompt.
|
|
921
|
-
* With a code runner, the model writes the aggregation, the RUNNER holds the
|
|
922
|
-
* data, and what comes back is the answer. Prose gets summarized; data gets
|
|
923
|
-
* computed. `CodeResult.truncated` exists so the second half of that promise
|
|
924
|
-
* cannot quietly break.
|
|
925
|
-
*
|
|
926
|
-
* Implement it for your own backend; ship it to `codeRunnerTool({ runner })`.
|
|
927
|
-
*/
|
|
928
|
-
/** One screenshot a browser session took. */
|
|
929
|
-
export interface BrowserShot {
|
|
930
|
-
/** Image bytes. */
|
|
931
|
-
readonly data: Uint8Array;
|
|
932
|
-
/** Image format, lower-case (`'png'`). */
|
|
933
|
-
readonly format: string;
|
|
934
|
-
}
|
|
935
|
-
/** Who is driving a browser session right now. */
|
|
936
|
-
export type BrowserDriver = 'agent' | 'person';
|
|
937
|
-
/**
|
|
938
|
-
* A browser an agent can drive — the PORT (9.68.0).
|
|
939
|
-
*
|
|
940
|
-
* Deliberately small, and deliberately not a browser automation API. Page-level
|
|
941
|
-
* work (navigate, find an element, fill a form) is what CDP and Playwright
|
|
942
|
-
* already do far better than any interface here would; a session exposes
|
|
943
|
-
* {@link BrowserSession.automationEndpoint} so those attach directly. What this
|
|
944
|
-
* port carries is what an automation library CANNOT do on its own: open and
|
|
945
|
-
* release a managed session, reach the operating system above the page, and —
|
|
946
|
-
* the one that matters — hand the controls to a person and take them back.
|
|
947
|
-
*/
|
|
948
|
-
export interface BrowserRunner {
|
|
949
|
-
/** Stable id — reported on every tool-session event, so a row names its backend. */
|
|
950
|
-
readonly id: string;
|
|
951
|
-
/**
|
|
952
|
-
* Open a session.
|
|
953
|
-
*
|
|
954
|
-
* `key` is the ISOLATION key the caller derived. An adapter may use it to
|
|
955
|
-
* name the remote session; it must never widen it.
|
|
956
|
-
*/
|
|
957
|
-
start(req: {
|
|
958
|
-
readonly key: string;
|
|
959
|
-
readonly signal?: AbortSignal;
|
|
960
|
-
}): Promise<BrowserSession>;
|
|
961
|
-
}
|
|
962
|
-
/** One open browser session. */
|
|
963
|
-
export interface BrowserSession {
|
|
964
|
-
/** The backend's own id for this session. */
|
|
965
|
-
readonly id: string;
|
|
966
|
-
/**
|
|
967
|
-
* Where an automation client attaches — a CDP WebSocket, for Playwright and
|
|
968
|
-
* friends. Absent on a backend that offers no such channel.
|
|
969
|
-
*
|
|
970
|
-
* This library does not drive the page for you and does not depend on
|
|
971
|
-
* Playwright; it hands you the endpoint and stays out of the way.
|
|
972
|
-
*/
|
|
973
|
-
readonly automationEndpoint?: string;
|
|
974
|
-
/** Where a PERSON can watch this session, when the backend offers a view. */
|
|
975
|
-
readonly liveViewEndpoint?: string;
|
|
976
|
-
/** Click at a point, in the operating system rather than in the page. */
|
|
977
|
-
click(req: {
|
|
978
|
-
readonly x: number;
|
|
979
|
-
readonly y: number;
|
|
980
|
-
readonly button?: 'left' | 'middle' | 'right';
|
|
981
|
-
readonly clicks?: number;
|
|
982
|
-
}): Promise<void>;
|
|
983
|
-
/** Type text, as a keyboard would. */
|
|
984
|
-
type(text: string): Promise<void>;
|
|
985
|
-
/** Press a named key, optionally more than once. */
|
|
986
|
-
press(req: {
|
|
987
|
-
readonly key: string;
|
|
988
|
-
readonly times?: number;
|
|
989
|
-
}): Promise<void>;
|
|
990
|
-
/** Take a screenshot of the session as it is now. */
|
|
991
|
-
screenshot(): Promise<BrowserShot>;
|
|
992
|
-
/**
|
|
993
|
-
* Hand the controls to a person, or take them back (optional).
|
|
994
|
-
*
|
|
995
|
-
* This is the seam a human-in-the-loop browsing flow is built on: the agent
|
|
996
|
-
* stops driving, a person finishes the step that needed them — a login, a
|
|
997
|
-
* consent screen, a CAPTCHA — and the agent resumes on the page they left.
|
|
998
|
-
* Absent on a backend with no such notion; feature-detect before offering it.
|
|
999
|
-
*/
|
|
1000
|
-
handControlTo?(driver: BrowserDriver): Promise<void>;
|
|
1001
|
-
/**
|
|
1002
|
-
* Release the session.
|
|
1003
|
-
*
|
|
1004
|
-
* Must tolerate a session the far side already reaped — an idle timeout is
|
|
1005
|
-
* the reality on every managed backend, and a stop on a dead session is a
|
|
1006
|
-
* no-op, not an error.
|
|
1007
|
-
*/
|
|
1008
|
-
stop(): Promise<void>;
|
|
1009
|
-
}
|
|
1010
|
-
export interface CodeRunner {
|
|
1011
|
-
/** Stable id — reported on every `agentfootprint.tools.session_*` event so a
|
|
1012
|
-
* row names its backend, not just its tool. */
|
|
1013
|
-
readonly id: string;
|
|
1014
|
-
/**
|
|
1015
|
-
* Open a session.
|
|
1016
|
-
*
|
|
1017
|
-
* `key` is the ISOLATION key the caller derived (see `toolSessionKey`). An
|
|
1018
|
-
* adapter may use it to name the remote session; it must never widen it.
|
|
1019
|
-
*/
|
|
1020
|
-
start(req: {
|
|
1021
|
-
readonly key: string;
|
|
1022
|
-
readonly language?: string;
|
|
1023
|
-
readonly signal?: AbortSignal;
|
|
1024
|
-
}): Promise<CodeSession>;
|
|
1025
|
-
}
|
|
1026
|
-
/**
|
|
1027
|
-
* The environment variable an executing snippet reads its staged inputs from —
|
|
1028
|
-
* a JSON object mapping each input's NAME to the path it landed at.
|
|
1029
|
-
*
|
|
1030
|
-
* Part of {@link CodeSession.stageInputs}'s contract rather than one adapter's
|
|
1031
|
-
* convention, and named here so an adapter uses the constant instead of
|
|
1032
|
-
* retyping the string. It is what makes model-written code portable across
|
|
1033
|
-
* backends: the code reads one variable, and every adapter that stages inputs
|
|
1034
|
-
* fills it the same way.
|
|
1035
|
-
*/
|
|
1036
|
-
export declare const STAGED_INPUTS_ENV = "AF_STAGED_INPUTS";
|
|
1037
|
-
/**
|
|
1038
|
-
* One payload staged INTO a code session before code runs (9.26.0).
|
|
1039
|
-
*
|
|
1040
|
-
* `name` is the file name the caller wants it under — the tool derives it from
|
|
1041
|
-
* the declared argument (`dataset` → `dataset.json`), so the model can be told
|
|
1042
|
-
* the name in a static description. An adapter may sanitize it (a name is
|
|
1043
|
-
* caller data landing in a filesystem) but must not rename it beyond
|
|
1044
|
-
* recognition, because the manifest is keyed by what it was ASKED for.
|
|
1045
|
-
*/
|
|
1046
|
-
export interface CodeInput {
|
|
1047
|
-
/**
|
|
1048
|
-
* The MANIFEST KEY — what the executing code looks this input up by. The
|
|
1049
|
-
* tool uses the declared argument name (`dataset`), so a static description
|
|
1050
|
-
* can tell the model exactly what to look up before any session exists.
|
|
1051
|
-
*/
|
|
1052
|
-
readonly name: string;
|
|
1053
|
-
/**
|
|
1054
|
-
* The file name to write it under, when it should differ from `name` — the
|
|
1055
|
-
* tool derives one from the artifact's media type (`dataset` +
|
|
1056
|
-
* `application/json` → `dataset.json`) so an interpreter's own loader sees a
|
|
1057
|
-
* familiar extension. Defaults to `name`.
|
|
1058
|
-
*
|
|
1059
|
-
* A separate field precisely so the manifest KEY and the on-disk NAME cannot
|
|
1060
|
-
* drift: the code looks up what it was told to look up, whatever the file
|
|
1061
|
-
* ended up being called.
|
|
1062
|
-
*/
|
|
1063
|
-
readonly fileName?: string;
|
|
1064
|
-
/** The bytes. A string is written as UTF-8 text; a `Uint8Array` verbatim. */
|
|
1065
|
-
readonly data: string | Uint8Array;
|
|
1066
|
-
/** The producer's own statement about the payload, when it has one. */
|
|
1067
|
-
readonly mediaType?: string;
|
|
1068
|
-
}
|
|
1069
|
-
/** Where one staged input actually landed. */
|
|
1070
|
-
export interface StagedCodeInput {
|
|
1071
|
-
/** The name it was asked for — the manifest key the code looks up. */
|
|
1072
|
-
readonly name: string;
|
|
1073
|
-
/** The path the executing code opens. Absolute, or relative to the session's
|
|
1074
|
-
* working directory: whichever it is, it is what the manifest carries and
|
|
1075
|
-
* what the code should use verbatim. */
|
|
1076
|
-
readonly path: string;
|
|
1077
|
-
/** How many bytes landed. */
|
|
1078
|
-
readonly bytes: number;
|
|
1079
|
-
}
|
|
1080
|
-
/** One live session. `stop()` is idempotent and tolerates "already gone". */
|
|
1081
|
-
export interface CodeSession {
|
|
1082
|
-
/** The backend's own id for this session, when it has one. */
|
|
1083
|
-
readonly id: string;
|
|
1084
|
-
execute(req: {
|
|
1085
|
-
readonly code: string;
|
|
1086
|
-
readonly language?: string;
|
|
1087
|
-
readonly timeoutMs?: number;
|
|
1088
|
-
readonly signal?: AbortSignal;
|
|
1089
|
-
}): Promise<CodeResult>;
|
|
1090
|
-
/**
|
|
1091
|
-
* OPTIONAL (9.26.0) — put payloads INTO the session, so code can read data
|
|
1092
|
-
* that never travelled through the context window.
|
|
1093
|
-
*
|
|
1094
|
-
* ── Why it is a new member rather than an argument to `execute` ──────────
|
|
1095
|
-
* The port's only input was the code STRING, and 9.22.0 stated the honest
|
|
1096
|
-
* consequence rather than working around it: pushing a resolved artifact
|
|
1097
|
-
* through that door would mean inlining megabytes into an argv, in
|
|
1098
|
-
* language-specific quoting, past operating-system argument limits. This is
|
|
1099
|
-
* the session file-write verb that note said it was waiting for.
|
|
1100
|
-
*
|
|
1101
|
-
* ── The contract, which is two promises not one ─────────────────────────
|
|
1102
|
-
* 1. The payloads are written where the session's code can read them, and
|
|
1103
|
-
* the returned {@link StagedCodeInput.path} is what the code opens.
|
|
1104
|
-
* 2. Every later `execute` on this session exposes the manifest as the
|
|
1105
|
-
* {@link STAGED_INPUTS_ENV} environment variable — a JSON object of
|
|
1106
|
-
* `name → path`. That second promise is what makes the model's code
|
|
1107
|
-
* portable: it reads one variable, on every backend that stages.
|
|
1108
|
-
*
|
|
1109
|
-
* Staged inputs live as long as the SESSION and are released by `stop()`.
|
|
1110
|
-
*
|
|
1111
|
-
* ── Absent, never faked ─────────────────────────────────────────────────
|
|
1112
|
-
* A backend that cannot write into its own session LEAVES THIS ABSENT.
|
|
1113
|
-
* Feature-detect with `canStageCodeInputs(session)`; `codeRunnerTool`
|
|
1114
|
-
* refuses by name when a tool declares artifact inputs and the runner cannot
|
|
1115
|
-
* carry them, because running the code without the data it declared would be
|
|
1116
|
-
* the accepted-and-silently-wrong failure.
|
|
1117
|
-
*/
|
|
1118
|
-
stageInputs?(inputs: readonly CodeInput[]): Promise<readonly StagedCodeInput[]>;
|
|
1119
|
-
/**
|
|
1120
|
-
* OPTIONAL — read ONE file back out of the session, whole or not at all.
|
|
1121
|
-
*
|
|
1122
|
-
* `path` is relative to the session's working directory and may not leave
|
|
1123
|
-
* it. An absolute path, a `..` that climbs above the working directory, a
|
|
1124
|
-
* backslash, a leading `~` or a NUL is refused by name before anything is
|
|
1125
|
-
* sent (`CodeSandboxError`, reason `'path-refused'`) — one rule,
|
|
1126
|
-
* `sandboxPath`, shared by every adapter.
|
|
1127
|
-
*
|
|
1128
|
-
* The answer is the file the BACKEND returned for that path, paired to it
|
|
1129
|
-
* by what the backend said it returned. A file the adapter cannot pair with
|
|
1130
|
-
* the path it asked for is refused, never guessed at — a backend that
|
|
1131
|
-
* answers with another file, or with two, has not answered this read.
|
|
1132
|
-
*
|
|
1133
|
-
* `maxBytes` is required: a read names its bound. A file over it is refused
|
|
1134
|
-
* (reason `'file-too-large'`), never cut — a truncated file handed back as
|
|
1135
|
-
* the file is the silent success this port refuses everywhere else.
|
|
1136
|
-
*
|
|
1137
|
-
* Feature-detect with `canReadCodeFiles(session)`.
|
|
1138
|
-
*/
|
|
1139
|
-
readFile?(path: string, options: CodeReadOptions): Promise<CodeFile>;
|
|
1140
|
-
/**
|
|
1141
|
-
* OPTIONAL — run ONE shell command in the session.
|
|
1142
|
-
*
|
|
1143
|
-
* It runs arbitrary shell, so an adapter offers it only when the runner was
|
|
1144
|
-
* built with `commands: true`; otherwise the member is ABSENT. Feature-detect
|
|
1145
|
-
* with `canRunCodeCommands(session)`. The command runs in the session's
|
|
1146
|
-
* working directory with the environment `execute` gets, staged-input
|
|
1147
|
-
* manifest included.
|
|
1148
|
-
*
|
|
1149
|
-
* The result says only what the backend reported. The exit status comes
|
|
1150
|
-
* from the backend or not at all: when it reported none, `exitCode` is
|
|
1151
|
-
* absent — unknown, never inferred from an error flag and never defaulted.
|
|
1152
|
-
* stdout and stderr are bounded, and a cut is stated on `truncated`.
|
|
1153
|
-
*/
|
|
1154
|
-
runCommand?(command: string, options?: CodeCommandOptions): Promise<CodeCommandResult>;
|
|
1155
|
-
/**
|
|
1156
|
-
* Release the session.
|
|
1157
|
-
*
|
|
1158
|
-
* Must tolerate a session the far side already reaped — an idle timeout is
|
|
1159
|
-
* the reality on every managed backend, and a `Stop` on a dead session is a
|
|
1160
|
-
* no-op, not an error.
|
|
1161
|
-
*/
|
|
1162
|
-
stop(): Promise<void>;
|
|
1163
|
-
}
|
|
1164
|
-
/** Can this session accept staged inputs? The feature-detection law: read the
|
|
1165
|
-
* member, never assume it from the adapter's name. */
|
|
1166
|
-
export declare function canStageCodeInputs(session: CodeSession): session is CodeSession & Required<Pick<CodeSession, 'stageInputs'>>;
|
|
1167
|
-
/** Can this session read files back out? Read the member, never the adapter's name. */
|
|
1168
|
-
export declare function canReadCodeFiles(session: CodeSession): session is CodeSession & Required<Pick<CodeSession, 'readFile'>>;
|
|
1169
|
-
/** Can this session run shell commands? Absent unless the runner was built
|
|
1170
|
-
* with `commands: true`. Read the member, never the adapter's name. */
|
|
1171
|
-
export declare function canRunCodeCommands(session: CodeSession): session is CodeSession & Required<Pick<CodeSession, 'runCommand'>>;
|
|
1172
|
-
/** How one {@link CodeSession.readFile} is bounded. */
|
|
1173
|
-
export interface CodeReadOptions {
|
|
1174
|
-
/**
|
|
1175
|
-
* The most bytes this read may return. Required, and a positive whole
|
|
1176
|
-
* number: a file larger than this is refused, never cut.
|
|
1177
|
-
*/
|
|
1178
|
-
readonly maxBytes: number;
|
|
1179
|
-
/** Stop waiting for the read. */
|
|
1180
|
-
readonly signal?: AbortSignal;
|
|
1181
|
-
}
|
|
1182
|
-
/** One file read back out of a code session — exactly as the backend returned it. */
|
|
1183
|
-
export interface CodeFile {
|
|
1184
|
-
/** The path that was read, in the canonical form the backend was asked for
|
|
1185
|
-
* (`./out//a.csv` → `out/a.csv`). */
|
|
1186
|
-
readonly path: string;
|
|
1187
|
-
/**
|
|
1188
|
-
* The contents. A string when the backend returned TEXT, bytes when it
|
|
1189
|
-
* returned BYTES — decided by which of the two the backend filled, never by
|
|
1190
|
-
* the file's name or extension. A backend that draws no such line
|
|
1191
|
-
* (`localCodeRunner`: a file on disk is bytes) returns bytes, and never
|
|
1192
|
-
* guesses an encoding.
|
|
1193
|
-
*/
|
|
1194
|
-
readonly data: string | Uint8Array;
|
|
1195
|
-
/** The size of `data` in bytes (a string's UTF-8 length). */
|
|
1196
|
-
readonly bytes: number;
|
|
1197
|
-
/** The backend's own statement of the media type, when it made one. Never guessed. */
|
|
1198
|
-
readonly mediaType?: string;
|
|
1199
|
-
}
|
|
1200
|
-
/** How one {@link CodeSession.runCommand} is bounded. */
|
|
1201
|
-
export interface CodeCommandOptions {
|
|
1202
|
-
/**
|
|
1203
|
-
* Stop waiting after this many milliseconds. What happens to the command
|
|
1204
|
-
* depends on the backend, and the error says which: a local child process is
|
|
1205
|
-
* killed; a managed sandbox may keep running it.
|
|
1206
|
-
*/
|
|
1207
|
-
readonly timeoutMs?: number;
|
|
1208
|
-
/** Stop waiting when this fires. */
|
|
1209
|
-
readonly signal?: AbortSignal;
|
|
1210
|
-
/** Per-stream ceiling for this command's output, in characters. The
|
|
1211
|
-
* runner's own `maxOutputChars` when absent. A cut is stated on `truncated`. */
|
|
1212
|
-
readonly maxOutputChars?: number;
|
|
1213
|
-
/**
|
|
1214
|
-
* A line the command prints when it reaches a point you care about — for
|
|
1215
|
-
* example `make && echo STEP_DONE` with `checkpoint: 'STEP_DONE'`. The
|
|
1216
|
-
* result then says, on `checkpointSeen`, whether stdout held that exact line,
|
|
1217
|
-
* read BEFORE any cut, so a marker printed past `maxOutputChars` is still
|
|
1218
|
-
* found.
|
|
1219
|
-
*
|
|
1220
|
-
* It proves the command reached that line and nothing more: not that it
|
|
1221
|
-
* exited cleanly, and not that anything after it ran. Its absence proves
|
|
1222
|
-
* nothing about why. One line, no line breaks.
|
|
1223
|
-
*/
|
|
1224
|
-
readonly checkpoint?: string;
|
|
1225
|
-
}
|
|
1226
|
-
/** What one shell command produced — only what the backend reported. */
|
|
1227
|
-
export interface CodeCommandResult {
|
|
1228
|
-
readonly stdout: string;
|
|
1229
|
-
readonly stderr: string;
|
|
1230
|
-
/**
|
|
1231
|
-
* The exit status the backend reported. ABSENT when it reported none: the
|
|
1232
|
-
* outcome is unknown. Never inferred from {@link CodeCommandResult.isError},
|
|
1233
|
-
* never defaulted, never derived from the output.
|
|
1234
|
-
*/
|
|
1235
|
-
readonly exitCode?: number;
|
|
1236
|
-
/**
|
|
1237
|
-
* The backend's own error flag, as it reported it (AgentCore's `isError`);
|
|
1238
|
-
* absent when it reported none. It is NOT an exit status — a command can
|
|
1239
|
-
* fail without it, and it can be set with no exit status at all.
|
|
1240
|
-
*/
|
|
1241
|
-
readonly isError?: boolean;
|
|
1242
|
-
/** The signal that ended the command before it exited, when the runner knows
|
|
1243
|
-
* it (`'SIGKILL'`). There is no `exitCode` then, and none is made up. */
|
|
1244
|
-
readonly terminatedBy?: string;
|
|
1245
|
-
/** Present IFF output was cut — see {@link CodeTruncation}. */
|
|
1246
|
-
readonly truncated?: CodeTruncation;
|
|
1247
|
-
/** Present IFF a `checkpoint` was asked for: whether stdout held that line. */
|
|
1248
|
-
readonly checkpointSeen?: boolean;
|
|
1249
|
-
}
|
|
1250
|
-
/**
|
|
1251
|
-
* Present IFF output was cut, and then it says by how much.
|
|
1252
|
-
*
|
|
1253
|
-
* Load-bearing, not politeness. A runner exists so big data is computed
|
|
1254
|
-
* outside the context window instead of pasted into it; a runner that
|
|
1255
|
-
* quietly slices its own output to fit is the same bug wearing a different
|
|
1256
|
-
* hat, and the model would go on to reason over a truncated table it was
|
|
1257
|
-
* never told was truncated. An unstated slice is a silent success.
|
|
1258
|
-
*/
|
|
1259
|
-
export interface CodeTruncation {
|
|
1260
|
-
readonly stdout?: boolean;
|
|
1261
|
-
readonly stderr?: boolean;
|
|
1262
|
-
/** The pre-truncation length, in characters, of whichever stream was cut. */
|
|
1263
|
-
readonly ofChars?: number;
|
|
1264
|
-
}
|
|
1265
|
-
/** What one execution produced. */
|
|
1266
|
-
export interface CodeResult {
|
|
1267
|
-
/**
|
|
1268
|
-
* Did the code run to completion without an error exit? WHAT THE RUNNER
|
|
1269
|
-
* REPORTED, nothing more.
|
|
1270
|
-
*
|
|
1271
|
-
* `true` or `false` only when the backend said so: an exit status, or its
|
|
1272
|
-
* own error verdict. ABSENT when it reported neither — the outcome is
|
|
1273
|
-
* unknown, and an absent `ok` is never success. (Before this was optional,
|
|
1274
|
-
* `agentCoreCodeRunner` filled `true` from silence.) A `false` is told
|
|
1275
|
-
* apart by the fields below: a program that exited non-zero (`exitCode`), a
|
|
1276
|
-
* backend error with no exit status (`serviceError`, where the run is
|
|
1277
|
-
* unconfirmed), and a process ended before it exited (`terminatedBy`).
|
|
1278
|
-
*/
|
|
1279
|
-
readonly ok?: boolean;
|
|
1280
|
-
readonly stdout: string;
|
|
1281
|
-
readonly stderr: string;
|
|
1282
|
-
/** The exit status — exactly when the runner reported one. Never inferred
|
|
1283
|
-
* from an error flag, never defaulted. */
|
|
1284
|
-
readonly exitCode?: number;
|
|
1285
|
-
/**
|
|
1286
|
-
* `true` when the backend flagged its answer as an error and reported NO
|
|
1287
|
-
* exit status: whether the code ran at all is not confirmed. That is not a
|
|
1288
|
-
* program that failed — a program that ran and failed has an `exitCode`.
|
|
1289
|
-
* `ok` is `false` alongside it.
|
|
1290
|
-
*/
|
|
1291
|
-
readonly serviceError?: true;
|
|
1292
|
-
/**
|
|
1293
|
-
* The signal that ended the process before it exited, when the runner knows
|
|
1294
|
-
* it (`'SIGKILL'`): there is no exit status then, and none is made up. A
|
|
1295
|
-
* local child the operating system ended, or one the runner ended because
|
|
1296
|
-
* its output passed the buffer ceiling. `ok` is `false` alongside it.
|
|
1297
|
-
*/
|
|
1298
|
-
readonly terminatedBy?: string;
|
|
1299
|
-
/** Files the run produced, described rather than inlined — the whole point is
|
|
1300
|
-
* that big data does not enter the window. All fields beyond the original
|
|
1301
|
-
* `{ name, bytes, uri? }` are ADDITIVE (9.22.0) and honest about absence:
|
|
1302
|
-
* a runner that only knows the file exists states exactly what it always
|
|
1303
|
-
* did.
|
|
1304
|
-
*
|
|
1305
|
-
* **ABSENT and `[]` are different facts, and only one of them is about the
|
|
1306
|
-
* code.** `[]` says this execution produced no files. ABSENT says this
|
|
1307
|
-
* RUNNER does not report produced files at all — it has no declared output
|
|
1308
|
-
* location to collect from, so "the code produced nothing" is a claim it is
|
|
1309
|
-
* not in a position to make. `localCodeRunner` is in the second camp today
|
|
1310
|
-
* (see its module header): it runs the code in a child process whose cwd is
|
|
1311
|
-
* the caller's own working directory, and treating every file that appeared
|
|
1312
|
-
* there as an output would be a guess about which files mattered, made on
|
|
1313
|
-
* the machine least able to afford it. A runner that WANTS to produce
|
|
1314
|
-
* output artifacts owes three things: a declared output location the code
|
|
1315
|
-
* is told about, a bounded read-back of what landed there, and a `bytes`
|
|
1316
|
-
* that is the payload's real length — then `codeRunnerTool` mints every
|
|
1317
|
-
* data-carrying entry with no further wiring.
|
|
1318
|
-
*
|
|
1319
|
-
* `data` is the in-band payload, present ONLY when the adapter can hand
|
|
1320
|
-
* the bytes back (a local runner reading its own working directory, a
|
|
1321
|
-
* managed sandbox that returns file contents). When a store is attached,
|
|
1322
|
-
* `codeRunnerTool` mints every data-carrying entry into the artifact
|
|
1323
|
-
* store and the model's result names the ref — entries without `data`
|
|
1324
|
-
* stay described-only, because minting needs bytes and inventing them is
|
|
1325
|
-
* worse than stating the gap. `mediaType` is the adapter's own statement
|
|
1326
|
-
* when it knows one; `ref` is stamped by whoever minted the file into an
|
|
1327
|
-
* artifact store (today: `codeRunnerTool`'s mint-on-output). */
|
|
1328
|
-
readonly artifacts?: readonly {
|
|
1329
|
-
readonly name: string;
|
|
1330
|
-
readonly bytes: number;
|
|
1331
|
-
readonly uri?: string;
|
|
1332
|
-
readonly mediaType?: string;
|
|
1333
|
-
readonly data?: string | Uint8Array;
|
|
1334
|
-
readonly ref?: string;
|
|
1335
|
-
}[];
|
|
1336
|
-
/** Present IFF output was cut — see {@link CodeTruncation}. An unstated
|
|
1337
|
-
* slice is a silent success. */
|
|
1338
|
-
readonly truncated?: CodeTruncation;
|
|
1339
|
-
}
|
|
1340
198
|
//# sourceMappingURL=types.d.ts.map
|