agentfootprint 18.0.0 → 18.1.1
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/convert/bounds.js +18 -2
- package/dist/esm/time/convert/bounds.js.map +1 -1
- package/dist/esm/time/convert/exact.js +26 -1
- package/dist/esm/time/convert/exact.js.map +1 -1
- package/dist/esm/time/convert.d.ts +2 -2
- package/dist/esm/time/convert.js +2 -2
- 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/convert/bounds.js +18 -2
- package/dist/time/convert/bounds.js.map +1 -1
- package/dist/time/convert/exact.js +26 -1
- package/dist/time/convert/exact.js.map +1 -1
- package/dist/time/convert.js +2 -2
- 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/convert/bounds.d.ts.map +1 -1
- package/dist/types/time/convert/exact.d.ts.map +1 -1
- package/dist/types/time/convert.d.ts +2 -2
- package/dist/types/time-travel/servedView.d.ts +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,434 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A service that runs code in an isolated session — a managed code
|
|
3
|
+
* interpreter, a container pool, a subprocess.
|
|
4
|
+
*
|
|
5
|
+
* **The shape is Start → Execute ×N → Stop**, because that is what every real
|
|
6
|
+
* one is, and the middle is the part a framework has to make possible. Paying
|
|
7
|
+
* session start-up on every call is the honest cheap version; holding the
|
|
8
|
+
* session in a module-level map is the fast version that hands one live sandbox
|
|
9
|
+
* to whoever calls next. `ctx.onTeardown` + {@link ToolExecutionContext.runId}
|
|
10
|
+
* are what let a tool do neither.
|
|
11
|
+
*
|
|
12
|
+
* ── Why this port exists at all: "summarize prose, compute data" ────────────
|
|
13
|
+
* A tool that returns 40MB of rows does not need a bigger context window; it
|
|
14
|
+
* needs to not put the rows in one. The motivating failure is a real production
|
|
15
|
+
* request of 879,073 tokens — a tool result pasted straight into the prompt.
|
|
16
|
+
* With a code runner, the model writes the aggregation, the RUNNER holds the
|
|
17
|
+
* data, and what comes back is the answer. Prose gets summarized; data gets
|
|
18
|
+
* computed. `CodeResult.truncated` exists so the second half of that promise
|
|
19
|
+
* cannot quietly break.
|
|
20
|
+
*
|
|
21
|
+
* Implement it for your own backend; ship it to `codeRunnerTool({ runner })`.
|
|
22
|
+
*/
|
|
23
|
+
/** One screenshot a browser session took. */
|
|
24
|
+
export interface BrowserShot {
|
|
25
|
+
/** Image bytes. */
|
|
26
|
+
readonly data: Uint8Array;
|
|
27
|
+
/** Image format, lower-case (`'png'`). */
|
|
28
|
+
readonly format: string;
|
|
29
|
+
}
|
|
30
|
+
/** Who is driving a browser session right now. */
|
|
31
|
+
export type BrowserDriver = 'agent' | 'person';
|
|
32
|
+
/**
|
|
33
|
+
* A browser an agent can drive — the PORT (9.68.0).
|
|
34
|
+
*
|
|
35
|
+
* Deliberately small, and deliberately not a browser automation API. Page-level
|
|
36
|
+
* work (navigate, find an element, fill a form) is what CDP and Playwright
|
|
37
|
+
* already do far better than any interface here would; a session exposes
|
|
38
|
+
* {@link BrowserSession.automationEndpoint} so those attach directly. What this
|
|
39
|
+
* port carries is what an automation library CANNOT do on its own: open and
|
|
40
|
+
* release a managed session, reach the operating system above the page, and —
|
|
41
|
+
* the one that matters — hand the controls to a person and take them back.
|
|
42
|
+
*/
|
|
43
|
+
export interface BrowserRunner {
|
|
44
|
+
/** Stable id — reported on every tool-session event, so a row names its backend. */
|
|
45
|
+
readonly id: string;
|
|
46
|
+
/**
|
|
47
|
+
* Open a session.
|
|
48
|
+
*
|
|
49
|
+
* `key` is the ISOLATION key the caller derived. An adapter may use it to
|
|
50
|
+
* name the remote session; it must never widen it.
|
|
51
|
+
*/
|
|
52
|
+
start(req: {
|
|
53
|
+
readonly key: string;
|
|
54
|
+
readonly signal?: AbortSignal;
|
|
55
|
+
}): Promise<BrowserSession>;
|
|
56
|
+
}
|
|
57
|
+
/** One open browser session. */
|
|
58
|
+
export interface BrowserSession {
|
|
59
|
+
/** The backend's own id for this session. */
|
|
60
|
+
readonly id: string;
|
|
61
|
+
/**
|
|
62
|
+
* Where an automation client attaches — a CDP WebSocket, for Playwright and
|
|
63
|
+
* friends. Absent on a backend that offers no such channel.
|
|
64
|
+
*
|
|
65
|
+
* This library does not drive the page for you and does not depend on
|
|
66
|
+
* Playwright; it hands you the endpoint and stays out of the way.
|
|
67
|
+
*/
|
|
68
|
+
readonly automationEndpoint?: string;
|
|
69
|
+
/** Where a PERSON can watch this session, when the backend offers a view. */
|
|
70
|
+
readonly liveViewEndpoint?: string;
|
|
71
|
+
/** Click at a point, in the operating system rather than in the page. */
|
|
72
|
+
click(req: {
|
|
73
|
+
readonly x: number;
|
|
74
|
+
readonly y: number;
|
|
75
|
+
readonly button?: 'left' | 'middle' | 'right';
|
|
76
|
+
readonly clicks?: number;
|
|
77
|
+
}): Promise<void>;
|
|
78
|
+
/** Type text, as a keyboard would. */
|
|
79
|
+
type(text: string): Promise<void>;
|
|
80
|
+
/** Press a named key, optionally more than once. */
|
|
81
|
+
press(req: {
|
|
82
|
+
readonly key: string;
|
|
83
|
+
readonly times?: number;
|
|
84
|
+
}): Promise<void>;
|
|
85
|
+
/** Take a screenshot of the session as it is now. */
|
|
86
|
+
screenshot(): Promise<BrowserShot>;
|
|
87
|
+
/**
|
|
88
|
+
* Hand the controls to a person, or take them back (optional).
|
|
89
|
+
*
|
|
90
|
+
* This is the seam a human-in-the-loop browsing flow is built on: the agent
|
|
91
|
+
* stops driving, a person finishes the step that needed them — a login, a
|
|
92
|
+
* consent screen, a CAPTCHA — and the agent resumes on the page they left.
|
|
93
|
+
* Absent on a backend with no such notion; feature-detect before offering it.
|
|
94
|
+
*/
|
|
95
|
+
handControlTo?(driver: BrowserDriver): Promise<void>;
|
|
96
|
+
/**
|
|
97
|
+
* Release the session.
|
|
98
|
+
*
|
|
99
|
+
* Must tolerate a session the far side already reaped — an idle timeout is
|
|
100
|
+
* the reality on every managed backend, and a stop on a dead session is a
|
|
101
|
+
* no-op, not an error.
|
|
102
|
+
*/
|
|
103
|
+
stop(): Promise<void>;
|
|
104
|
+
}
|
|
105
|
+
export interface CodeRunner {
|
|
106
|
+
/** Stable id — reported on every `agentfootprint.tools.session_*` event so a
|
|
107
|
+
* row names its backend, not just its tool. */
|
|
108
|
+
readonly id: string;
|
|
109
|
+
/**
|
|
110
|
+
* Open a session.
|
|
111
|
+
*
|
|
112
|
+
* `key` is the ISOLATION key the caller derived (see `toolSessionKey`). An
|
|
113
|
+
* adapter may use it to name the remote session; it must never widen it.
|
|
114
|
+
*/
|
|
115
|
+
start(req: {
|
|
116
|
+
readonly key: string;
|
|
117
|
+
readonly language?: string;
|
|
118
|
+
readonly signal?: AbortSignal;
|
|
119
|
+
}): Promise<CodeSession>;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* The environment variable an executing snippet reads its staged inputs from —
|
|
123
|
+
* a JSON object mapping each input's NAME to the path it landed at.
|
|
124
|
+
*
|
|
125
|
+
* Part of {@link CodeSession.stageInputs}'s contract rather than one adapter's
|
|
126
|
+
* convention, and named here so an adapter uses the constant instead of
|
|
127
|
+
* retyping the string. It is what makes model-written code portable across
|
|
128
|
+
* backends: the code reads one variable, and every adapter that stages inputs
|
|
129
|
+
* fills it the same way.
|
|
130
|
+
*/
|
|
131
|
+
export declare const STAGED_INPUTS_ENV = "AF_STAGED_INPUTS";
|
|
132
|
+
/**
|
|
133
|
+
* One payload staged INTO a code session before code runs (9.26.0).
|
|
134
|
+
*
|
|
135
|
+
* `name` is the file name the caller wants it under — the tool derives it from
|
|
136
|
+
* the declared argument (`dataset` → `dataset.json`), so the model can be told
|
|
137
|
+
* the name in a static description. An adapter may sanitize it (a name is
|
|
138
|
+
* caller data landing in a filesystem) but must not rename it beyond
|
|
139
|
+
* recognition, because the manifest is keyed by what it was ASKED for.
|
|
140
|
+
*/
|
|
141
|
+
export interface CodeInput {
|
|
142
|
+
/**
|
|
143
|
+
* The MANIFEST KEY — what the executing code looks this input up by. The
|
|
144
|
+
* tool uses the declared argument name (`dataset`), so a static description
|
|
145
|
+
* can tell the model exactly what to look up before any session exists.
|
|
146
|
+
*/
|
|
147
|
+
readonly name: string;
|
|
148
|
+
/**
|
|
149
|
+
* The file name to write it under, when it should differ from `name` — the
|
|
150
|
+
* tool derives one from the artifact's media type (`dataset` +
|
|
151
|
+
* `application/json` → `dataset.json`) so an interpreter's own loader sees a
|
|
152
|
+
* familiar extension. Defaults to `name`.
|
|
153
|
+
*
|
|
154
|
+
* A separate field precisely so the manifest KEY and the on-disk NAME cannot
|
|
155
|
+
* drift: the code looks up what it was told to look up, whatever the file
|
|
156
|
+
* ended up being called.
|
|
157
|
+
*/
|
|
158
|
+
readonly fileName?: string;
|
|
159
|
+
/** The bytes. A string is written as UTF-8 text; a `Uint8Array` verbatim. */
|
|
160
|
+
readonly data: string | Uint8Array;
|
|
161
|
+
/** The producer's own statement about the payload, when it has one. */
|
|
162
|
+
readonly mediaType?: string;
|
|
163
|
+
}
|
|
164
|
+
/** Where one staged input actually landed. */
|
|
165
|
+
export interface StagedCodeInput {
|
|
166
|
+
/** The name it was asked for — the manifest key the code looks up. */
|
|
167
|
+
readonly name: string;
|
|
168
|
+
/** The path the executing code opens. Absolute, or relative to the session's
|
|
169
|
+
* working directory: whichever it is, it is what the manifest carries and
|
|
170
|
+
* what the code should use verbatim. */
|
|
171
|
+
readonly path: string;
|
|
172
|
+
/** How many bytes landed. */
|
|
173
|
+
readonly bytes: number;
|
|
174
|
+
}
|
|
175
|
+
/** One live session. `stop()` is idempotent and tolerates "already gone". */
|
|
176
|
+
export interface CodeSession {
|
|
177
|
+
/** The backend's own id for this session, when it has one. */
|
|
178
|
+
readonly id: string;
|
|
179
|
+
execute(req: {
|
|
180
|
+
readonly code: string;
|
|
181
|
+
readonly language?: string;
|
|
182
|
+
readonly timeoutMs?: number;
|
|
183
|
+
readonly signal?: AbortSignal;
|
|
184
|
+
}): Promise<CodeResult>;
|
|
185
|
+
/**
|
|
186
|
+
* OPTIONAL (9.26.0) — put payloads INTO the session, so code can read data
|
|
187
|
+
* that never travelled through the context window.
|
|
188
|
+
*
|
|
189
|
+
* ── Why it is a new member rather than an argument to `execute` ──────────
|
|
190
|
+
* The port's only input was the code STRING, and 9.22.0 stated the honest
|
|
191
|
+
* consequence rather than working around it: pushing a resolved artifact
|
|
192
|
+
* through that door would mean inlining megabytes into an argv, in
|
|
193
|
+
* language-specific quoting, past operating-system argument limits. This is
|
|
194
|
+
* the session file-write verb that note said it was waiting for.
|
|
195
|
+
*
|
|
196
|
+
* ── The contract, which is two promises not one ─────────────────────────
|
|
197
|
+
* 1. The payloads are written where the session's code can read them, and
|
|
198
|
+
* the returned {@link StagedCodeInput.path} is what the code opens.
|
|
199
|
+
* 2. Every later `execute` on this session exposes the manifest as the
|
|
200
|
+
* {@link STAGED_INPUTS_ENV} environment variable — a JSON object of
|
|
201
|
+
* `name → path`. That second promise is what makes the model's code
|
|
202
|
+
* portable: it reads one variable, on every backend that stages.
|
|
203
|
+
*
|
|
204
|
+
* Staged inputs live as long as the SESSION and are released by `stop()`.
|
|
205
|
+
*
|
|
206
|
+
* ── Absent, never faked ─────────────────────────────────────────────────
|
|
207
|
+
* A backend that cannot write into its own session LEAVES THIS ABSENT.
|
|
208
|
+
* Feature-detect with `canStageCodeInputs(session)`; `codeRunnerTool`
|
|
209
|
+
* refuses by name when a tool declares artifact inputs and the runner cannot
|
|
210
|
+
* carry them, because running the code without the data it declared would be
|
|
211
|
+
* the accepted-and-silently-wrong failure.
|
|
212
|
+
*/
|
|
213
|
+
stageInputs?(inputs: readonly CodeInput[]): Promise<readonly StagedCodeInput[]>;
|
|
214
|
+
/**
|
|
215
|
+
* OPTIONAL — read ONE file back out of the session, whole or not at all.
|
|
216
|
+
*
|
|
217
|
+
* `path` is relative to the session's working directory and may not leave
|
|
218
|
+
* it. An absolute path, a `..` that climbs above the working directory, a
|
|
219
|
+
* backslash, a leading `~` or a NUL is refused by name before anything is
|
|
220
|
+
* sent (`CodeSandboxError`, reason `'path-refused'`) — one rule,
|
|
221
|
+
* `sandboxPath`, shared by every adapter.
|
|
222
|
+
*
|
|
223
|
+
* The answer is the file the BACKEND returned for that path, paired to it
|
|
224
|
+
* by what the backend said it returned. A file the adapter cannot pair with
|
|
225
|
+
* the path it asked for is refused, never guessed at — a backend that
|
|
226
|
+
* answers with another file, or with two, has not answered this read.
|
|
227
|
+
*
|
|
228
|
+
* `maxBytes` is required: a read names its bound. A file over it is refused
|
|
229
|
+
* (reason `'file-too-large'`), never cut — a truncated file handed back as
|
|
230
|
+
* the file is the silent success this port refuses everywhere else.
|
|
231
|
+
*
|
|
232
|
+
* Feature-detect with `canReadCodeFiles(session)`.
|
|
233
|
+
*/
|
|
234
|
+
readFile?(path: string, options: CodeReadOptions): Promise<CodeFile>;
|
|
235
|
+
/**
|
|
236
|
+
* OPTIONAL — run ONE shell command in the session.
|
|
237
|
+
*
|
|
238
|
+
* It runs arbitrary shell, so an adapter offers it only when the runner was
|
|
239
|
+
* built with `commands: true`; otherwise the member is ABSENT. Feature-detect
|
|
240
|
+
* with `canRunCodeCommands(session)`. The command runs in the session's
|
|
241
|
+
* working directory with the environment `execute` gets, staged-input
|
|
242
|
+
* manifest included.
|
|
243
|
+
*
|
|
244
|
+
* The result says only what the backend reported. The exit status comes
|
|
245
|
+
* from the backend or not at all: when it reported none, `exitCode` is
|
|
246
|
+
* absent — unknown, never inferred from an error flag and never defaulted.
|
|
247
|
+
* stdout and stderr are bounded, and a cut is stated on `truncated`.
|
|
248
|
+
*/
|
|
249
|
+
runCommand?(command: string, options?: CodeCommandOptions): Promise<CodeCommandResult>;
|
|
250
|
+
/**
|
|
251
|
+
* Release the session.
|
|
252
|
+
*
|
|
253
|
+
* Must tolerate a session the far side already reaped — an idle timeout is
|
|
254
|
+
* the reality on every managed backend, and a `Stop` on a dead session is a
|
|
255
|
+
* no-op, not an error.
|
|
256
|
+
*/
|
|
257
|
+
stop(): Promise<void>;
|
|
258
|
+
}
|
|
259
|
+
/** Can this session accept staged inputs? The feature-detection law: read the
|
|
260
|
+
* member, never assume it from the adapter's name. */
|
|
261
|
+
export declare function canStageCodeInputs(session: CodeSession): session is CodeSession & Required<Pick<CodeSession, 'stageInputs'>>;
|
|
262
|
+
/** Can this session read files back out? Read the member, never the adapter's name. */
|
|
263
|
+
export declare function canReadCodeFiles(session: CodeSession): session is CodeSession & Required<Pick<CodeSession, 'readFile'>>;
|
|
264
|
+
/** Can this session run shell commands? Absent unless the runner was built
|
|
265
|
+
* with `commands: true`. Read the member, never the adapter's name. */
|
|
266
|
+
export declare function canRunCodeCommands(session: CodeSession): session is CodeSession & Required<Pick<CodeSession, 'runCommand'>>;
|
|
267
|
+
/** How one {@link CodeSession.readFile} is bounded. */
|
|
268
|
+
export interface CodeReadOptions {
|
|
269
|
+
/**
|
|
270
|
+
* The most bytes this read may return. Required, and a positive whole
|
|
271
|
+
* number: a file larger than this is refused, never cut.
|
|
272
|
+
*/
|
|
273
|
+
readonly maxBytes: number;
|
|
274
|
+
/** Stop waiting for the read. */
|
|
275
|
+
readonly signal?: AbortSignal;
|
|
276
|
+
}
|
|
277
|
+
/** One file read back out of a code session — exactly as the backend returned it. */
|
|
278
|
+
export interface CodeFile {
|
|
279
|
+
/** The path that was read, in the canonical form the backend was asked for
|
|
280
|
+
* (`./out//a.csv` → `out/a.csv`). */
|
|
281
|
+
readonly path: string;
|
|
282
|
+
/**
|
|
283
|
+
* The contents. A string when the backend returned TEXT, bytes when it
|
|
284
|
+
* returned BYTES — decided by which of the two the backend filled, never by
|
|
285
|
+
* the file's name or extension. A backend that draws no such line
|
|
286
|
+
* (`localCodeRunner`: a file on disk is bytes) returns bytes, and never
|
|
287
|
+
* guesses an encoding.
|
|
288
|
+
*/
|
|
289
|
+
readonly data: string | Uint8Array;
|
|
290
|
+
/** The size of `data` in bytes (a string's UTF-8 length). */
|
|
291
|
+
readonly bytes: number;
|
|
292
|
+
/** The backend's own statement of the media type, when it made one. Never guessed. */
|
|
293
|
+
readonly mediaType?: string;
|
|
294
|
+
}
|
|
295
|
+
/** How one {@link CodeSession.runCommand} is bounded. */
|
|
296
|
+
export interface CodeCommandOptions {
|
|
297
|
+
/**
|
|
298
|
+
* Stop waiting after this many milliseconds. What happens to the command
|
|
299
|
+
* depends on the backend, and the error says which: a local child process is
|
|
300
|
+
* killed; a managed sandbox may keep running it.
|
|
301
|
+
*/
|
|
302
|
+
readonly timeoutMs?: number;
|
|
303
|
+
/** Stop waiting when this fires. */
|
|
304
|
+
readonly signal?: AbortSignal;
|
|
305
|
+
/** Per-stream ceiling for this command's output, in characters. The
|
|
306
|
+
* runner's own `maxOutputChars` when absent. A cut is stated on `truncated`. */
|
|
307
|
+
readonly maxOutputChars?: number;
|
|
308
|
+
/**
|
|
309
|
+
* A line the command prints when it reaches a point you care about — for
|
|
310
|
+
* example `make && echo STEP_DONE` with `checkpoint: 'STEP_DONE'`. The
|
|
311
|
+
* result then says, on `checkpointSeen`, whether stdout held that exact line,
|
|
312
|
+
* read BEFORE any cut, so a marker printed past `maxOutputChars` is still
|
|
313
|
+
* found.
|
|
314
|
+
*
|
|
315
|
+
* It proves the command reached that line and nothing more: not that it
|
|
316
|
+
* exited cleanly, and not that anything after it ran. Its absence proves
|
|
317
|
+
* nothing about why. One line, no line breaks.
|
|
318
|
+
*/
|
|
319
|
+
readonly checkpoint?: string;
|
|
320
|
+
}
|
|
321
|
+
/** What one shell command produced — only what the backend reported. */
|
|
322
|
+
export interface CodeCommandResult {
|
|
323
|
+
readonly stdout: string;
|
|
324
|
+
readonly stderr: string;
|
|
325
|
+
/**
|
|
326
|
+
* The exit status the backend reported. ABSENT when it reported none: the
|
|
327
|
+
* outcome is unknown. Never inferred from {@link CodeCommandResult.isError},
|
|
328
|
+
* never defaulted, never derived from the output.
|
|
329
|
+
*/
|
|
330
|
+
readonly exitCode?: number;
|
|
331
|
+
/**
|
|
332
|
+
* The backend's own error flag, as it reported it (AgentCore's `isError`);
|
|
333
|
+
* absent when it reported none. It is NOT an exit status — a command can
|
|
334
|
+
* fail without it, and it can be set with no exit status at all.
|
|
335
|
+
*/
|
|
336
|
+
readonly isError?: boolean;
|
|
337
|
+
/** The signal that ended the command before it exited, when the runner knows
|
|
338
|
+
* it (`'SIGKILL'`). There is no `exitCode` then, and none is made up. */
|
|
339
|
+
readonly terminatedBy?: string;
|
|
340
|
+
/** Present IFF output was cut — see {@link CodeTruncation}. */
|
|
341
|
+
readonly truncated?: CodeTruncation;
|
|
342
|
+
/** Present IFF a `checkpoint` was asked for: whether stdout held that line. */
|
|
343
|
+
readonly checkpointSeen?: boolean;
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Present IFF output was cut, and then it says by how much.
|
|
347
|
+
*
|
|
348
|
+
* Load-bearing, not politeness. A runner exists so big data is computed
|
|
349
|
+
* outside the context window instead of pasted into it; a runner that
|
|
350
|
+
* quietly slices its own output to fit is the same bug wearing a different
|
|
351
|
+
* hat, and the model would go on to reason over a truncated table it was
|
|
352
|
+
* never told was truncated. An unstated slice is a silent success.
|
|
353
|
+
*/
|
|
354
|
+
export interface CodeTruncation {
|
|
355
|
+
readonly stdout?: boolean;
|
|
356
|
+
readonly stderr?: boolean;
|
|
357
|
+
/** The pre-truncation length, in characters, of whichever stream was cut. */
|
|
358
|
+
readonly ofChars?: number;
|
|
359
|
+
}
|
|
360
|
+
/** What one execution produced. */
|
|
361
|
+
export interface CodeResult {
|
|
362
|
+
/**
|
|
363
|
+
* Did the code run to completion without an error exit? WHAT THE RUNNER
|
|
364
|
+
* REPORTED, nothing more.
|
|
365
|
+
*
|
|
366
|
+
* `true` or `false` only when the backend said so: an exit status, or its
|
|
367
|
+
* own error verdict. ABSENT when it reported neither — the outcome is
|
|
368
|
+
* unknown, and an absent `ok` is never success. (Before this was optional,
|
|
369
|
+
* `agentCoreCodeRunner` filled `true` from silence.) A `false` is told
|
|
370
|
+
* apart by the fields below: a program that exited non-zero (`exitCode`), a
|
|
371
|
+
* backend error with no exit status (`serviceError`, where the run is
|
|
372
|
+
* unconfirmed), and a process ended before it exited (`terminatedBy`).
|
|
373
|
+
*/
|
|
374
|
+
readonly ok?: boolean;
|
|
375
|
+
readonly stdout: string;
|
|
376
|
+
readonly stderr: string;
|
|
377
|
+
/** The exit status — exactly when the runner reported one. Never inferred
|
|
378
|
+
* from an error flag, never defaulted. */
|
|
379
|
+
readonly exitCode?: number;
|
|
380
|
+
/**
|
|
381
|
+
* `true` when the backend flagged its answer as an error and reported NO
|
|
382
|
+
* exit status: whether the code ran at all is not confirmed. That is not a
|
|
383
|
+
* program that failed — a program that ran and failed has an `exitCode`.
|
|
384
|
+
* `ok` is `false` alongside it.
|
|
385
|
+
*/
|
|
386
|
+
readonly serviceError?: true;
|
|
387
|
+
/**
|
|
388
|
+
* The signal that ended the process before it exited, when the runner knows
|
|
389
|
+
* it (`'SIGKILL'`): there is no exit status then, and none is made up. A
|
|
390
|
+
* local child the operating system ended, or one the runner ended because
|
|
391
|
+
* its output passed the buffer ceiling. `ok` is `false` alongside it.
|
|
392
|
+
*/
|
|
393
|
+
readonly terminatedBy?: string;
|
|
394
|
+
/** Files the run produced, described rather than inlined — the whole point is
|
|
395
|
+
* that big data does not enter the window. All fields beyond the original
|
|
396
|
+
* `{ name, bytes, uri? }` are ADDITIVE (9.22.0) and honest about absence:
|
|
397
|
+
* a runner that only knows the file exists states exactly what it always
|
|
398
|
+
* did.
|
|
399
|
+
*
|
|
400
|
+
* **ABSENT and `[]` are different facts, and only one of them is about the
|
|
401
|
+
* code.** `[]` says this execution produced no files. ABSENT says this
|
|
402
|
+
* RUNNER does not report produced files at all — it has no declared output
|
|
403
|
+
* location to collect from, so "the code produced nothing" is a claim it is
|
|
404
|
+
* not in a position to make. `localCodeRunner` is in the second camp today
|
|
405
|
+
* (see its module header): it runs the code in a child process whose cwd is
|
|
406
|
+
* the caller's own working directory, and treating every file that appeared
|
|
407
|
+
* there as an output would be a guess about which files mattered, made on
|
|
408
|
+
* the machine least able to afford it. A runner that WANTS to produce
|
|
409
|
+
* output artifacts owes three things: a declared output location the code
|
|
410
|
+
* is told about, a bounded read-back of what landed there, and a `bytes`
|
|
411
|
+
* that is the payload's real length — then `codeRunnerTool` mints every
|
|
412
|
+
* data-carrying entry with no further wiring.
|
|
413
|
+
*
|
|
414
|
+
* `data` is the in-band payload, present ONLY when the adapter can hand
|
|
415
|
+
* the bytes back (a local runner reading its own working directory, a
|
|
416
|
+
* managed sandbox that returns file contents). When a store is attached,
|
|
417
|
+
* `codeRunnerTool` mints every data-carrying entry into the artifact
|
|
418
|
+
* store and the model's result names the ref — entries without `data`
|
|
419
|
+
* stay described-only, because minting needs bytes and inventing them is
|
|
420
|
+
* worse than stating the gap. `mediaType` is the adapter's own statement
|
|
421
|
+
* when it knows one; `ref` is stamped by whoever minted the file into an
|
|
422
|
+
* artifact store (today: `codeRunnerTool`'s mint-on-output). */
|
|
423
|
+
readonly artifacts?: readonly {
|
|
424
|
+
readonly name: string;
|
|
425
|
+
readonly bytes: number;
|
|
426
|
+
readonly uri?: string;
|
|
427
|
+
readonly mediaType?: string;
|
|
428
|
+
readonly data?: string | Uint8Array;
|
|
429
|
+
readonly ref?: string;
|
|
430
|
+
}[];
|
|
431
|
+
/** Present IFF output was cut — see {@link CodeTruncation}. An unstated
|
|
432
|
+
* slice is a silent success. */
|
|
433
|
+
readonly truncated?: CodeTruncation;
|
|
434
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// ─── Code Runner (9.7.0) ────────────────────────────────────────────
|
|
2
|
+
/**
|
|
3
|
+
* The environment variable an executing snippet reads its staged inputs from —
|
|
4
|
+
* a JSON object mapping each input's NAME to the path it landed at.
|
|
5
|
+
*
|
|
6
|
+
* Part of {@link CodeSession.stageInputs}'s contract rather than one adapter's
|
|
7
|
+
* convention, and named here so an adapter uses the constant instead of
|
|
8
|
+
* retyping the string. It is what makes model-written code portable across
|
|
9
|
+
* backends: the code reads one variable, and every adapter that stages inputs
|
|
10
|
+
* fills it the same way.
|
|
11
|
+
*/
|
|
12
|
+
export const STAGED_INPUTS_ENV = 'AF_STAGED_INPUTS';
|
|
13
|
+
/** Can this session accept staged inputs? The feature-detection law: read the
|
|
14
|
+
* member, never assume it from the adapter's name. */
|
|
15
|
+
export function canStageCodeInputs(session) {
|
|
16
|
+
return typeof session.stageInputs === 'function';
|
|
17
|
+
}
|
|
18
|
+
/** Can this session read files back out? Read the member, never the adapter's name. */
|
|
19
|
+
export function canReadCodeFiles(session) {
|
|
20
|
+
return typeof session.readFile === 'function';
|
|
21
|
+
}
|
|
22
|
+
/** Can this session run shell commands? Absent unless the runner was built
|
|
23
|
+
* with `commands: true`. Read the member, never the adapter's name. */
|
|
24
|
+
export function canRunCodeCommands(session) {
|
|
25
|
+
return typeof session.runCommand === 'function';
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=code.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code.js","sourceRoot":"","sources":["../../../../src/provider-contract/types/code.ts"],"names":[],"mappings":"AAAA,uEAAuE;AAyHvE;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,kBAAkB,CAAC;AAoIpD;uDACuD;AACvD,MAAM,UAAU,kBAAkB,CAChC,OAAoB;IAEpB,OAAO,OAAO,OAAO,CAAC,WAAW,KAAK,UAAU,CAAC;AACnD,CAAC;AAED,uFAAuF;AACvF,MAAM,UAAU,gBAAgB,CAC9B,OAAoB;IAEpB,OAAO,OAAO,OAAO,CAAC,QAAQ,KAAK,UAAU,CAAC;AAChD,CAAC;AAED;wEACwE;AACxE,MAAM,UAAU,kBAAkB,CAChC,OAAoB;IAEpB,OAAO,OAAO,OAAO,CAAC,UAAU,KAAK,UAAU,CAAC;AAClD,CAAC"}
|