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
package/dist/ag-ui/serializer.js
CHANGED
|
@@ -1,114 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* serializer — one run's served agentfootprint events → AG-UI events.
|
|
4
|
-
*
|
|
5
|
-
* Pattern: a per-run state machine (`RunTranslation`), pure — no I/O, no clock,
|
|
6
|
-
* no import of `@ag-ui/*`. Frames are the framing strategy's job
|
|
7
|
-
* (`framing.ts`); reading a request is the adapter's (`adapter.ts`).
|
|
8
|
-
* Role: the Lens over a run for an AG-UI reader. It composes what that reader
|
|
9
|
-
* is served, from the RECORD only: every value it writes comes from a
|
|
10
|
-
* served event (the placeholder wherever a redaction policy selected a
|
|
11
|
-
* value), from the record's address (`meta.runtimeStageId`,
|
|
12
|
-
* `meta.subflowPath` — never selected by a policy), or from the
|
|
13
|
-
* AG-UI request's own ids. It never reads the run's live values, so
|
|
14
|
-
* nothing a policy hides can reach an AG-UI event. The record's own
|
|
15
|
-
* run id is never written: it counts every run the process made.
|
|
16
|
-
*
|
|
17
|
-
* THE MAPPING
|
|
18
|
-
* agent.turn_start (nested) → SUBAGENT_STARTED (a sub-agent's turn)
|
|
19
|
-
* agent.turn_end → SUBAGENT_FINISHED / the root answer
|
|
20
|
-
* agent.iteration_start/_end → STEP_STARTED/_FINISHED `iteration <n>`
|
|
21
|
-
* composition.enter/exit → STEP_STARTED/_FINISHED `<Kind>[:<mount>]`
|
|
22
|
-
* stream.token → TEXT_MESSAGE_START/CONTENT/END
|
|
23
|
-
* stream.llm_end (no agent around) → one whole TEXT message (an LLM call that streams nothing)
|
|
24
|
-
* stream.thinking_delta/_end → REASONING_START … REASONING_END (only with `reasoning: true`)
|
|
25
|
-
* stream.tool_start → TOOL_CALL_START + TOOL_CALL_ARGS (the view) + TOOL_CALL_END
|
|
26
|
-
* stream.tool_end → TOOL_CALL_RESULT
|
|
27
|
-
* pause.request + settle('paused') → RUN_FINISHED { outcome: interrupt }
|
|
28
|
-
* settle('paused', awaiting caller) → RUN_FINISHED { outcome: success, pendingToolCallIds }
|
|
29
|
-
* (a tool the client runs: its call is left to answer)
|
|
30
|
-
* error.fatal + settle('failed') → RUN_ERROR — the served error.fatal's words when they
|
|
31
|
-
* are a fixed sentence, else "The run failed."
|
|
32
|
-
* an allow-listed event → CUSTOM { name: <event type>, value: <its listed fields> }
|
|
33
|
-
* anything else → nothing
|
|
34
|
-
*
|
|
35
|
-
* WHAT LEAVES THE PROCESS. An AG-UI stream goes to a browser, so nothing goes
|
|
36
|
-
* out by default that a person is not meant to read. In record-only mode every value comes from a
|
|
37
|
-
* served payload; `CUSTOM` carries only the event types on an allow-list, each
|
|
38
|
-
* with the fields its projection picks ({@link AG_UI_CUSTOM_EVENTS} — the whole
|
|
39
|
-
* record, such as `context.injected`'s assembled prompt or `error.retried`'s
|
|
40
|
-
* raw error, stays off the wire unless the app lists it); the model's
|
|
41
|
-
* reasoning goes out only when the app says so; and a failure is described by
|
|
42
|
-
* the record, never by the thrown value. Identity on the meta (`principal`,
|
|
43
|
-
* `tenant`, `sessionId`) is never written.
|
|
44
|
-
*
|
|
45
|
-
* HOST DELIVERY is explicit: candidate answer text at every depth stays off
|
|
46
|
-
* the wire until the host completes. Its final output and allow-listed custom
|
|
47
|
-
* reply data are app-authorized delivery, not observations from the record.
|
|
48
|
-
* Tools, steps and progress still use served native events.
|
|
49
|
-
*
|
|
50
|
-
* WHO OWNS AN EVENT. Each agent's turn opens a SCOPE at its mount — the
|
|
51
|
-
* subflow path its `turn_start` fired at (`[]` for the root agent, `step-p/x`
|
|
52
|
-
* for an agent in a parallel branch). An event belongs to the deepest open scope
|
|
53
|
-
* whose mount prefixes its own subflow path, segment by segment, and carries
|
|
54
|
-
* that scope's `subagentRunId`. Parallel branches have different mounts, so
|
|
55
|
-
* their interleaved events can never be attributed to each other.
|
|
56
|
-
*
|
|
57
|
-
* A RUN THAT CONTINUES A PAUSE. A paused run hands back `suspension()` — the
|
|
58
|
-
* ids it gave the client (the interrupt, the open call) and every scope and
|
|
59
|
-
* step open at the pause. The run that continues it passes that as `resume`:
|
|
60
|
-
* the same sub-agents re-open (AG-UI: "a later run may continue the same
|
|
61
|
-
* invocation"), their steps re-open, and the first result in the paused call's
|
|
62
|
-
* scope answers that call under its own id — or, for a tool the client ran, is
|
|
63
|
-
* not written at all, because the client holds the result it sent.
|
|
64
|
-
*
|
|
65
|
-
* TEXT in record-only mode comes from `stream.token`, then from the rest of
|
|
66
|
-
* `turn_end.finalContent` as its own message. A marked root `turn_end` can
|
|
67
|
-
* deliver the answer even when this reader joined after the turn started.
|
|
68
|
-
* `unstreamedText` uses the same prefix rule as `toSSE({ format: 'text' })`.
|
|
69
|
-
* Refused final content and an agent's draft `llm_end.content` stay off the wire.
|
|
70
|
-
*/
|
|
71
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
72
|
-
exports.agUiSerializer = exports.
|
|
3
|
+
exports.agUiSerializer = exports.AG_UI_CUSTOM_EVENTS = exports.AG_UI_SUBAGENT_CANCELLED = exports.AG_UI_SUBAGENT_UNFINISHED = exports.AG_UI_ANSWER_WITHHELD = exports.AG_UI_RUN_FAILED = void 0;
|
|
4
|
+
const values_js_1 = require("./serializer/values.js");
|
|
5
|
+
const translate_js_1 = require("./serializer/translate.js");
|
|
6
|
+
const settle_js_1 = require("./serializer/settle.js");
|
|
7
|
+
const values_js_2 = require("./serializer/values.js");
|
|
8
|
+
var values_js_3 = require("./serializer/values.js");
|
|
9
|
+
Object.defineProperty(exports, "AG_UI_RUN_FAILED", { enumerable: true, get: function () { return values_js_3.AG_UI_RUN_FAILED; } });
|
|
10
|
+
Object.defineProperty(exports, "AG_UI_ANSWER_WITHHELD", { enumerable: true, get: function () { return values_js_3.AG_UI_ANSWER_WITHHELD; } });
|
|
11
|
+
Object.defineProperty(exports, "AG_UI_SUBAGENT_UNFINISHED", { enumerable: true, get: function () { return values_js_3.AG_UI_SUBAGENT_UNFINISHED; } });
|
|
12
|
+
Object.defineProperty(exports, "AG_UI_SUBAGENT_CANCELLED", { enumerable: true, get: function () { return values_js_3.AG_UI_SUBAGENT_CANCELLED; } });
|
|
73
13
|
const eventMeta_js_1 = require("../bridge/eventMeta.js");
|
|
74
|
-
const unstreamedText_js_1 = require("../hosting/unstreamedText.js");
|
|
75
|
-
const humanizeLLMError_js_1 = require("../lib/humanizeLLMError.js");
|
|
76
14
|
const wireJson_js_1 = require("../lib/wireJson.js");
|
|
77
15
|
const translationScope_js_1 = require("./translationScope.js");
|
|
78
16
|
const ids_js_1 = require("./ids.js");
|
|
79
|
-
const toolResultWords_js_1 = require("./toolResultWords.js");
|
|
80
17
|
const shownArgs_js_1 = require("./shownArgs.js");
|
|
81
18
|
const types_js_1 = require("./types.js");
|
|
82
19
|
const customEvents_js_1 = require("./customEvents.js");
|
|
83
20
|
var customEvents_js_2 = require("./customEvents.js");
|
|
84
21
|
Object.defineProperty(exports, "AG_UI_CUSTOM_EVENTS", { enumerable: true, get: function () { return customEvents_js_2.AG_UI_CUSTOM_EVENTS; } });
|
|
85
|
-
/** Said by `RUN_ERROR` when the run's `error.fatal` is not one of the record's fixed sentences. */
|
|
86
|
-
exports.AG_UI_RUN_FAILED = 'The run failed.';
|
|
87
|
-
/**
|
|
88
|
-
* Said by `RUN_ERROR` (with `code: 'ERR_ANSWER_VALIDATION'`) when an enforcing
|
|
89
|
-
* `.answerValidation()` withheld the answer: a refusal, not a crash.
|
|
90
|
-
*/
|
|
91
|
-
exports.AG_UI_ANSWER_WITHHELD = "The answer was withheld: it did not pass the app's answer checks.";
|
|
92
|
-
/** Is `said` one of the record's fixed failure sentences — the only `error.fatal` words a `RUN_ERROR` repeats? */
|
|
93
|
-
const isFixedFailure = (said) => Object.values(humanizeLLMError_js_1.LLM_ERROR_SENTENCES).includes(said);
|
|
94
|
-
/** Said by `SUBAGENT_ERROR` for a sub-agent whose turn ended without an answer. */
|
|
95
|
-
exports.AG_UI_SUBAGENT_UNFINISHED = "The sub-agent's turn ended without an answer.";
|
|
96
|
-
/** Said by `SUBAGENT_ERROR` for a sub-agent still running when its run was cancelled. */
|
|
97
|
-
exports.AG_UI_SUBAGENT_CANCELLED = 'The run was cancelled before this sub-agent finished.';
|
|
98
|
-
/** Does `prefix` lead `path`, segment by segment? */
|
|
99
|
-
function leads(prefix, path) {
|
|
100
|
-
if (prefix.length > path.length)
|
|
101
|
-
return false;
|
|
102
|
-
for (let i = 0; i < prefix.length; i++)
|
|
103
|
-
if (prefix[i] !== path[i])
|
|
104
|
-
return false;
|
|
105
|
-
return true;
|
|
106
|
-
}
|
|
107
|
-
const sameMount = (a, b) => a.length === b.length && leads(a, b);
|
|
108
|
-
const record = (value) => typeof value === 'object' && value !== null ? value : {};
|
|
109
|
-
const text = (value) => typeof value === 'string' ? value : undefined;
|
|
110
|
-
/** A tool result as AG-UI text: a string as it is, anything else through the wire rule. */
|
|
111
|
-
const resultText = (value) => typeof value === 'string' ? value : value === undefined ? '' : (0, wireJson_js_1.toWireJson)(value);
|
|
112
22
|
/**
|
|
113
23
|
* The AG-UI serializer for ONE run: feed it every served agentfootprint event
|
|
114
24
|
* of the run, in order, then settle it once. `RUN_STARTED` comes before the
|
|
@@ -171,43 +81,30 @@ function agUiSerializer(options) {
|
|
|
171
81
|
const scopeOf = (path) => {
|
|
172
82
|
let best = root;
|
|
173
83
|
for (const scope of scopes) {
|
|
174
|
-
if (scope.mount.length > best.mount.length && leads(scope.mount, path))
|
|
84
|
+
if (scope.mount.length > best.mount.length && (0, values_js_2.leads)(scope.mount, path))
|
|
175
85
|
best = scope;
|
|
176
86
|
}
|
|
177
87
|
return best;
|
|
178
88
|
};
|
|
179
|
-
/** The record's address of `event`, as AG-UI metadata. */
|
|
180
|
-
const addressOf = (event, extra) => ({
|
|
181
|
-
agentfootprint: {
|
|
182
|
-
runtimeStageId: event.meta.runtimeStageId,
|
|
183
|
-
subflowPath: [...event.meta.subflowPath],
|
|
184
|
-
...extra,
|
|
185
|
-
},
|
|
186
|
-
});
|
|
187
|
-
/** The fields every event of `scope` carries. */
|
|
188
|
-
const owned = (scope, event) => ({
|
|
189
|
-
...(event !== undefined && { timestamp: event.meta.wallClockMs }),
|
|
190
|
-
...(scope.subagentRunId !== undefined && { subagentRunId: scope.subagentRunId }),
|
|
191
|
-
});
|
|
192
89
|
// ── closers — each leaves its entity closed and writes the events that say so ──
|
|
193
90
|
const closeText = (scope, out) => {
|
|
194
91
|
if (scope.text === undefined)
|
|
195
92
|
return;
|
|
196
|
-
out.push({ type: 'TEXT_MESSAGE_END', messageId: scope.text.id, ...owned(scope) });
|
|
93
|
+
out.push({ type: 'TEXT_MESSAGE_END', messageId: scope.text.id, ...(0, values_js_1.owned)(scope) });
|
|
197
94
|
scope.text = undefined;
|
|
198
95
|
};
|
|
199
96
|
const closeReasoning = (scope, out) => {
|
|
200
97
|
if (scope.reasoning === undefined)
|
|
201
98
|
return;
|
|
202
99
|
const { id } = scope.reasoning;
|
|
203
|
-
out.push({ type: 'REASONING_MESSAGE_END', messageId: id, ...owned(scope) });
|
|
204
|
-
out.push({ type: 'REASONING_END', messageId: id, ...owned(scope) });
|
|
100
|
+
out.push({ type: 'REASONING_MESSAGE_END', messageId: id, ...(0, values_js_1.owned)(scope) });
|
|
101
|
+
out.push({ type: 'REASONING_END', messageId: id, ...(0, values_js_1.owned)(scope) });
|
|
205
102
|
scope.reasoning = undefined;
|
|
206
103
|
};
|
|
207
104
|
const closeSteps = (scope, out) => {
|
|
208
105
|
while (scope.steps.length > 0) {
|
|
209
106
|
const stepName = scope.steps.pop();
|
|
210
|
-
out.push({ type: 'STEP_FINISHED', stepName, ...owned(scope) });
|
|
107
|
+
out.push({ type: 'STEP_FINISHED', stepName, ...(0, values_js_1.owned)(scope) });
|
|
211
108
|
}
|
|
212
109
|
};
|
|
213
110
|
/** Close what is open INSIDE a scope — the scope itself stays. */
|
|
@@ -227,7 +124,7 @@ function agUiSerializer(options) {
|
|
|
227
124
|
};
|
|
228
125
|
/** The open nested scopes mounted strictly under `mount`, deepest first. */
|
|
229
126
|
const scopesUnder = (mount) => scopes
|
|
230
|
-
.filter((s) => s !== root && s.mount.length > mount.length && leads(mount, s.mount))
|
|
127
|
+
.filter((s) => s !== root && s.mount.length > mount.length && (0, values_js_2.leads)(mount, s.mount))
|
|
231
128
|
.reverse()
|
|
232
129
|
.sort((a, b) => b.mount.length - a.mount.length);
|
|
233
130
|
/** End a nested scope: every turn still open under it first (they never answered), then it. */
|
|
@@ -239,7 +136,7 @@ function agUiSerializer(options) {
|
|
|
239
136
|
const unfinished = (subagentRunId) => ({
|
|
240
137
|
type: 'SUBAGENT_ERROR',
|
|
241
138
|
subagentRunId,
|
|
242
|
-
message:
|
|
139
|
+
message: values_js_2.AG_UI_SUBAGENT_UNFINISHED,
|
|
243
140
|
});
|
|
244
141
|
// ── openers ──
|
|
245
142
|
const openStep = (scope, stepName, event, out) => {
|
|
@@ -247,14 +144,14 @@ function agUiSerializer(options) {
|
|
|
247
144
|
if (at >= 0) {
|
|
248
145
|
// The same name still open in this scope: the record never closed it.
|
|
249
146
|
scope.steps.splice(at, 1);
|
|
250
|
-
out.push({ type: 'STEP_FINISHED', stepName, ...owned(scope) });
|
|
147
|
+
out.push({ type: 'STEP_FINISHED', stepName, ...(0, values_js_1.owned)(scope) });
|
|
251
148
|
}
|
|
252
149
|
scope.steps.push(stepName);
|
|
253
150
|
out.push({
|
|
254
151
|
type: 'STEP_STARTED',
|
|
255
152
|
stepName,
|
|
256
|
-
...owned(scope, event),
|
|
257
|
-
metadata: addressOf(event),
|
|
153
|
+
...(0, values_js_1.owned)(scope, event),
|
|
154
|
+
metadata: (0, values_js_1.addressOf)(event),
|
|
258
155
|
});
|
|
259
156
|
};
|
|
260
157
|
const finishStep = (scope, stepName, event, out) => {
|
|
@@ -262,7 +159,7 @@ function agUiSerializer(options) {
|
|
|
262
159
|
if (at < 0)
|
|
263
160
|
return;
|
|
264
161
|
scope.steps.splice(at, 1);
|
|
265
|
-
out.push({ type: 'STEP_FINISHED', stepName, ...owned(scope, event) });
|
|
162
|
+
out.push({ type: 'STEP_FINISHED', stepName, ...(0, values_js_1.owned)(scope, event) });
|
|
266
163
|
};
|
|
267
164
|
/** A whole text message in one go — an answer the record did not stream. */
|
|
268
165
|
const wholeText = (scope, content, event, out) => {
|
|
@@ -271,315 +168,66 @@ function agUiSerializer(options) {
|
|
|
271
168
|
type: 'TEXT_MESSAGE_START',
|
|
272
169
|
messageId: id,
|
|
273
170
|
role: 'assistant',
|
|
274
|
-
...owned(scope, event),
|
|
275
|
-
metadata: addressOf(event),
|
|
171
|
+
...(0, values_js_1.owned)(scope, event),
|
|
172
|
+
metadata: (0, values_js_1.addressOf)(event),
|
|
276
173
|
});
|
|
277
174
|
out.push({
|
|
278
175
|
type: 'TEXT_MESSAGE_CONTENT',
|
|
279
176
|
messageId: id,
|
|
280
177
|
delta: content,
|
|
281
|
-
...owned(scope, event),
|
|
178
|
+
...(0, values_js_1.owned)(scope, event),
|
|
282
179
|
});
|
|
283
|
-
out.push({ type: 'TEXT_MESSAGE_END', messageId: id, ...owned(scope, event) });
|
|
180
|
+
out.push({ type: 'TEXT_MESSAGE_END', messageId: id, ...(0, values_js_1.owned)(scope, event) });
|
|
284
181
|
scope.callMessageId = id;
|
|
285
182
|
};
|
|
286
183
|
// ── the mapping ──
|
|
287
|
-
const translate = (
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
closeSteps(scope, out);
|
|
335
|
-
return;
|
|
336
|
-
}
|
|
337
|
-
endScope(scope, out, (subagentRunId) => ({
|
|
338
|
-
type: 'SUBAGENT_FINISHED',
|
|
339
|
-
subagentRunId,
|
|
340
|
-
...(!hostDelivery && answer !== undefined && { result: answer }),
|
|
341
|
-
timestamp: event.meta.wallClockMs,
|
|
342
|
-
}));
|
|
343
|
-
return;
|
|
344
|
-
}
|
|
345
|
-
case 'agentfootprint.agent.iteration_start':
|
|
346
|
-
openStep(scopeOf(path), `iteration ${String(payload.iterIndex)}`, event, out);
|
|
347
|
-
return;
|
|
348
|
-
case 'agentfootprint.agent.iteration_end':
|
|
349
|
-
finishStep(scopeOf(path), `iteration ${String(payload.iterIndex)}`, event, out);
|
|
350
|
-
return;
|
|
351
|
-
case 'agentfootprint.composition.enter':
|
|
352
|
-
openStep(scopeOf(path), compositionStep(payload.kind, path), event, out);
|
|
353
|
-
return;
|
|
354
|
-
case 'agentfootprint.composition.exit': {
|
|
355
|
-
// A turn under this composition that is still open never answered — a
|
|
356
|
-
// branch a tolerant merge let fail. Said, never left dangling.
|
|
357
|
-
for (const inner of scopesUnder(path))
|
|
358
|
-
closeScope(inner, out, unfinished);
|
|
359
|
-
finishStep(scopeOf(path), compositionStep(payload.kind, path), event, out);
|
|
360
|
-
return;
|
|
361
|
-
}
|
|
362
|
-
case 'agentfootprint.stream.llm_start': {
|
|
363
|
-
const scope = scopeOf(path);
|
|
364
|
-
closeText(scope, out);
|
|
365
|
-
closeReasoning(scope, out);
|
|
366
|
-
if (scope === root)
|
|
367
|
-
rootCallText = undefined;
|
|
368
|
-
scope.streamedText = undefined;
|
|
369
|
-
scope.callMessageId = undefined;
|
|
370
|
-
scope.llmAddress = address;
|
|
371
|
-
return;
|
|
372
|
-
}
|
|
373
|
-
case 'agentfootprint.stream.token': {
|
|
374
|
-
if (hostDelivery)
|
|
375
|
-
return;
|
|
376
|
-
const content = text(payload.content);
|
|
377
|
-
if (content === undefined)
|
|
378
|
-
return;
|
|
379
|
-
const scope = scopeOf(path);
|
|
380
|
-
const index = typeof payload.tokenIndex === 'number' ? payload.tokenIndex : Number.NaN;
|
|
381
|
-
const open = scope.text;
|
|
382
|
-
if (open === undefined || open.address !== address || !(index > open.lastTokenIndex)) {
|
|
383
|
-
// A new message: the first token of a call, another stage's tokens (an
|
|
384
|
-
// answer released after validation), or a stream that restarted.
|
|
385
|
-
closeText(scope, out);
|
|
386
|
-
const { id } = ids.next('text', address);
|
|
387
|
-
scope.text = { id, address, lastTokenIndex: Number.isNaN(index) ? -1 : index };
|
|
388
|
-
scope.callMessageId = id;
|
|
389
|
-
out.push({
|
|
390
|
-
type: 'TEXT_MESSAGE_START',
|
|
391
|
-
messageId: id,
|
|
392
|
-
role: 'assistant',
|
|
393
|
-
...owned(scope, event),
|
|
394
|
-
metadata: addressOf(event),
|
|
395
|
-
});
|
|
396
|
-
}
|
|
397
|
-
else {
|
|
398
|
-
open.lastTokenIndex = index;
|
|
399
|
-
}
|
|
400
|
-
scope.streamedText = (scope.streamedText ?? '') + content;
|
|
401
|
-
out.push({
|
|
402
|
-
type: 'TEXT_MESSAGE_CONTENT',
|
|
403
|
-
messageId: scope.text.id,
|
|
404
|
-
delta: content,
|
|
405
|
-
...owned(scope, event),
|
|
406
|
-
});
|
|
407
|
-
return;
|
|
408
|
-
}
|
|
409
|
-
case 'agentfootprint.stream.llm_end': {
|
|
410
|
-
const scope = scopeOf(path);
|
|
411
|
-
if (hostDelivery)
|
|
412
|
-
return;
|
|
413
|
-
closeText(scope, out);
|
|
414
|
-
// A scope that did not see an agent turn open can already have written
|
|
415
|
-
// the text of a complete-only call by the time its root end arrives.
|
|
416
|
-
const content = text(payload.content);
|
|
417
|
-
const quiet = scope.streamedText === undefined && payload.contentWithheld !== true;
|
|
418
|
-
if (!scope.isAgent && quiet && content) {
|
|
419
|
-
wholeText(scope, content, event, out);
|
|
420
|
-
if (scope === root)
|
|
421
|
-
rootCallText = content;
|
|
422
|
-
}
|
|
423
|
-
return;
|
|
424
|
-
}
|
|
425
|
-
case 'agentfootprint.stream.thinking_delta': {
|
|
426
|
-
const content = text(payload.content);
|
|
427
|
-
if (!reasoning || content === undefined)
|
|
428
|
-
return;
|
|
429
|
-
const scope = scopeOf(path);
|
|
430
|
-
if (scope.reasoning === undefined || scope.reasoning.iteration !== payload.iteration) {
|
|
431
|
-
closeReasoning(scope, out);
|
|
432
|
-
const { id } = ids.next('reasoning', address);
|
|
433
|
-
scope.reasoning = { id, iteration: payload.iteration };
|
|
434
|
-
out.push({
|
|
435
|
-
type: 'REASONING_START',
|
|
436
|
-
messageId: id,
|
|
437
|
-
...owned(scope, event),
|
|
438
|
-
metadata: addressOf(event),
|
|
439
|
-
});
|
|
440
|
-
out.push({
|
|
441
|
-
type: 'REASONING_MESSAGE_START',
|
|
442
|
-
messageId: id,
|
|
443
|
-
role: 'reasoning',
|
|
444
|
-
...owned(scope, event),
|
|
445
|
-
});
|
|
446
|
-
}
|
|
447
|
-
out.push({
|
|
448
|
-
type: 'REASONING_MESSAGE_CONTENT',
|
|
449
|
-
messageId: scope.reasoning.id,
|
|
450
|
-
delta: content,
|
|
451
|
-
...owned(scope, event),
|
|
452
|
-
});
|
|
453
|
-
return;
|
|
454
|
-
}
|
|
455
|
-
case 'agentfootprint.stream.thinking_end': {
|
|
456
|
-
if (!reasoning)
|
|
457
|
-
return;
|
|
458
|
-
const scope = scopeOf(path);
|
|
459
|
-
if (scope.reasoning !== undefined && scope.reasoning.iteration === payload.iteration) {
|
|
460
|
-
closeReasoning(scope, out);
|
|
461
|
-
return;
|
|
462
|
-
}
|
|
463
|
-
// Nothing streamed for this call: the blocks are the reasoning, one
|
|
464
|
-
// message each, in one span. A redacted block carries no text to show.
|
|
465
|
-
const blocks = Array.isArray(payload.blocks) ? payload.blocks : [];
|
|
466
|
-
const thoughts = blocks
|
|
467
|
-
.map((block) => record(block))
|
|
468
|
-
.filter((block) => block.type === 'thinking')
|
|
469
|
-
.map((block) => text(block.content))
|
|
470
|
-
.filter((content) => content !== undefined && content.length > 0);
|
|
471
|
-
if (thoughts.length === 0)
|
|
472
|
-
return;
|
|
473
|
-
closeReasoning(scope, out);
|
|
474
|
-
const messageIds = thoughts.map(() => ids.next('reasoning', address).id);
|
|
475
|
-
const span = messageIds[0];
|
|
476
|
-
out.push({
|
|
477
|
-
type: 'REASONING_START',
|
|
478
|
-
messageId: span,
|
|
479
|
-
...owned(scope, event),
|
|
480
|
-
metadata: addressOf(event),
|
|
481
|
-
});
|
|
482
|
-
thoughts.forEach((content, i) => {
|
|
483
|
-
const messageId = messageIds[i];
|
|
484
|
-
out.push({
|
|
485
|
-
type: 'REASONING_MESSAGE_START',
|
|
486
|
-
messageId,
|
|
487
|
-
role: 'reasoning',
|
|
488
|
-
...owned(scope, event),
|
|
489
|
-
});
|
|
490
|
-
out.push({
|
|
491
|
-
type: 'REASONING_MESSAGE_CONTENT',
|
|
492
|
-
messageId,
|
|
493
|
-
delta: content,
|
|
494
|
-
...owned(scope, event),
|
|
495
|
-
});
|
|
496
|
-
out.push({ type: 'REASONING_MESSAGE_END', messageId, ...owned(scope, event) });
|
|
497
|
-
});
|
|
498
|
-
out.push({ type: 'REASONING_END', messageId: span, ...owned(scope, event) });
|
|
499
|
-
return;
|
|
500
|
-
}
|
|
501
|
-
case 'agentfootprint.stream.tool_start': {
|
|
502
|
-
const scope = scopeOf(path);
|
|
503
|
-
// The call's arguments are complete: its text message and its reasoning are over.
|
|
504
|
-
closeText(scope, out);
|
|
505
|
-
closeReasoning(scope, out);
|
|
506
|
-
// Every call of one LLM response belongs to ONE assistant message: the
|
|
507
|
-
// call's text message when it wrote any, else a message minted at the
|
|
508
|
-
// LLM call's own address for the first call and held for the rest.
|
|
509
|
-
if (scope.callMessageId === undefined)
|
|
510
|
-
scope.callMessageId = ids.next('text', scope.llmAddress ?? address).id;
|
|
511
|
-
const { id, n } = ids.next('tool', address);
|
|
512
|
-
scope.calls.push({ id, n, address, servedId: payload.toolCallId });
|
|
513
|
-
const toolCallName = text(payload.toolName) ?? '';
|
|
514
|
-
const view = (0, shownArgs_js_1.argsShownOf)(payload, id, options.toolArguments);
|
|
515
|
-
out.push({
|
|
516
|
-
type: 'TOOL_CALL_START',
|
|
517
|
-
toolCallId: id,
|
|
518
|
-
toolCallName,
|
|
519
|
-
parentMessageId: scope.callMessageId,
|
|
520
|
-
...owned(scope, event),
|
|
521
|
-
metadata: addressOf(event, view.address),
|
|
522
|
-
});
|
|
523
|
-
out.push({
|
|
524
|
-
type: 'TOOL_CALL_ARGS',
|
|
525
|
-
toolCallId: id,
|
|
526
|
-
delta: (0, wireJson_js_1.toWireJson)(view.args),
|
|
527
|
-
...owned(scope, event),
|
|
528
|
-
});
|
|
529
|
-
out.push({ type: 'TOOL_CALL_END', toolCallId: id, ...owned(scope, event) });
|
|
530
|
-
return;
|
|
531
|
-
}
|
|
532
|
-
case 'agentfootprint.stream.tool_end': {
|
|
533
|
-
const scope = scopeOf(path);
|
|
534
|
-
const call = (0, translationScope_js_1.takeCall)(scope, address, payload.toolCallId);
|
|
535
|
-
if (call === undefined) {
|
|
536
|
-
// A result the record cannot tie to a call this run opened — never
|
|
537
|
-
// attached to a call it may not belong to (CUSTOM only if listed).
|
|
538
|
-
pushCustom(event, scope, out);
|
|
539
|
-
return;
|
|
540
|
-
}
|
|
541
|
-
// A frontend tool's result is the one the client sent: it holds it already.
|
|
542
|
-
if (call.client === true)
|
|
543
|
-
return;
|
|
544
|
-
// A FAILED call's result is the thrown text — a connection string, a
|
|
545
|
-
// stack line, a provider's body. A person reads the fixed words unless
|
|
546
|
-
// the app chose to serve the record's own.
|
|
547
|
-
// Any `error` but an explicit `false` counts — under a policy that
|
|
548
|
-
// selects the key, the flag itself is served as the placeholder.
|
|
549
|
-
const failed = payload.error !== undefined && payload.error !== false && toolErrors !== 'served';
|
|
550
|
-
out.push({
|
|
551
|
-
type: 'TOOL_CALL_RESULT',
|
|
552
|
-
messageId: call.n < 0 ? ids.next('result', address).id : ids.at('result', call.n, call.address),
|
|
553
|
-
toolCallId: call.id,
|
|
554
|
-
content: failed
|
|
555
|
-
? (0, toolResultWords_js_1.failedCallWords)(payload)
|
|
556
|
-
: resultText(options.toolResults === undefined
|
|
557
|
-
? payload.result
|
|
558
|
-
: options.toolResults(payload, {
|
|
559
|
-
toolCallId: call.id,
|
|
560
|
-
...(typeof payload.toolName === 'string' && { toolName: payload.toolName }),
|
|
561
|
-
})),
|
|
562
|
-
role: 'tool',
|
|
563
|
-
...owned(scope, event),
|
|
564
|
-
});
|
|
565
|
-
return;
|
|
566
|
-
}
|
|
567
|
-
case 'agentfootprint.pause.request':
|
|
568
|
-
pause = { event, scope: scopeOf(path) };
|
|
569
|
-
return;
|
|
570
|
-
case 'agentfootprint.error.fatal': {
|
|
571
|
-
// Only a FIXED sentence goes to a browser. The record's own fallback
|
|
572
|
-
// quotes the raw thrown message ("The AI call failed: …"), which may
|
|
573
|
-
// hold anything a provider or a tool put in it.
|
|
574
|
-
const said = text(payload.error);
|
|
575
|
-
if (said !== undefined && isFixedFailure(said))
|
|
576
|
-
fatal = said;
|
|
577
|
-
return;
|
|
578
|
-
}
|
|
579
|
-
default:
|
|
580
|
-
pushCustom(event, scopeOf(path), out);
|
|
581
|
-
}
|
|
582
|
-
};
|
|
184
|
+
const translate = (0, translate_js_1.eventTranslator)({
|
|
185
|
+
options,
|
|
186
|
+
root,
|
|
187
|
+
scopes,
|
|
188
|
+
ids,
|
|
189
|
+
hostDelivery,
|
|
190
|
+
reasoning,
|
|
191
|
+
toolErrors,
|
|
192
|
+
scopeOf,
|
|
193
|
+
addressOf: values_js_1.addressOf,
|
|
194
|
+
owned: values_js_1.owned,
|
|
195
|
+
closeText,
|
|
196
|
+
closeReasoning,
|
|
197
|
+
closeSteps,
|
|
198
|
+
closeScope,
|
|
199
|
+
scopesUnder,
|
|
200
|
+
endScope,
|
|
201
|
+
unfinished,
|
|
202
|
+
openStep,
|
|
203
|
+
finishStep,
|
|
204
|
+
wholeText,
|
|
205
|
+
pushCustom,
|
|
206
|
+
get rootCallText() {
|
|
207
|
+
return rootCallText;
|
|
208
|
+
},
|
|
209
|
+
set rootCallText(value) {
|
|
210
|
+
rootCallText = value;
|
|
211
|
+
},
|
|
212
|
+
get rootResult() {
|
|
213
|
+
return rootResult;
|
|
214
|
+
},
|
|
215
|
+
set rootResult(value) {
|
|
216
|
+
rootResult = value;
|
|
217
|
+
},
|
|
218
|
+
get pause() {
|
|
219
|
+
return pause;
|
|
220
|
+
},
|
|
221
|
+
set pause(value) {
|
|
222
|
+
pause = value;
|
|
223
|
+
},
|
|
224
|
+
get fatal() {
|
|
225
|
+
return fatal;
|
|
226
|
+
},
|
|
227
|
+
set fatal(value) {
|
|
228
|
+
fatal = value;
|
|
229
|
+
},
|
|
230
|
+
});
|
|
583
231
|
/**
|
|
584
232
|
* Re-open what the paused run left open — the scopes (same `subagentRunId`),
|
|
585
233
|
* their steps and the call it stopped in — and return the events that say so,
|
|
@@ -605,7 +253,7 @@ function agUiSerializer(options) {
|
|
|
605
253
|
}
|
|
606
254
|
for (const stepName of kept.steps) {
|
|
607
255
|
scope.steps.push(stepName);
|
|
608
|
-
events.push({ type: 'STEP_STARTED', stepName, ...owned(scope) });
|
|
256
|
+
events.push({ type: 'STEP_STARTED', stepName, ...(0, values_js_1.owned)(scope) });
|
|
609
257
|
}
|
|
610
258
|
for (const call of kept.calls) {
|
|
611
259
|
scope.calls.push({
|
|
@@ -659,13 +307,13 @@ function agUiSerializer(options) {
|
|
|
659
307
|
if (typeof project !== 'function')
|
|
660
308
|
return;
|
|
661
309
|
const call = scope.calls[scope.calls.length - 1];
|
|
662
|
-
const value = project(record(event.payload), call === undefined ? {} : { toolCallId: call.id });
|
|
310
|
+
const value = project((0, values_js_2.record)(event.payload), call === undefined ? {} : { toolCallId: call.id });
|
|
663
311
|
out.push({
|
|
664
312
|
type: 'CUSTOM',
|
|
665
313
|
name: event.type,
|
|
666
314
|
value: (0, wireJson_js_1.withWireErrors)(value ?? null),
|
|
667
|
-
...owned(scope, event),
|
|
668
|
-
metadata: addressOf(event),
|
|
315
|
+
...(0, values_js_1.owned)(scope, event),
|
|
316
|
+
metadata: (0, values_js_1.addressOf)(event),
|
|
669
317
|
});
|
|
670
318
|
}
|
|
671
319
|
/**
|
|
@@ -713,19 +361,19 @@ function agUiSerializer(options) {
|
|
|
713
361
|
if (pause === undefined)
|
|
714
362
|
return { id: ids.next('interrupt', 'run').id, reason: 'paused' };
|
|
715
363
|
const { event, scope } = pause;
|
|
716
|
-
const payload = record(event.payload);
|
|
364
|
+
const payload = (0, values_js_2.record)(event.payload);
|
|
717
365
|
// The question a person is asked, as the record serves it — and nothing
|
|
718
366
|
// else of the pause's payload (a check-in's evidence pack, a typed ask's
|
|
719
367
|
// context), which a browser has no reason to receive.
|
|
720
|
-
const message = questionOf(record(payload.questionPayload));
|
|
368
|
+
const message = (0, values_js_2.questionOf)((0, values_js_2.record)(payload.questionPayload));
|
|
721
369
|
const call = scope.calls[scope.calls.length - 1];
|
|
722
370
|
return {
|
|
723
371
|
id: ids.next('interrupt', event.meta.runtimeStageId).id,
|
|
724
|
-
reason: text(payload.reason) ?? 'paused',
|
|
372
|
+
reason: (0, values_js_2.text)(payload.reason) ?? 'paused',
|
|
725
373
|
...(message !== undefined && { message }),
|
|
726
374
|
...(call !== undefined && { toolCallId: call.id }),
|
|
727
375
|
...(scope.subagentRunId !== undefined && { subagentRunId: scope.subagentRunId }),
|
|
728
|
-
metadata: addressOf(event, (0, shownArgs_js_1.checkInHiddenNamesOf)(payload)),
|
|
376
|
+
metadata: (0, values_js_1.addressOf)(event, (0, shownArgs_js_1.checkInHiddenNamesOf)(payload)),
|
|
729
377
|
};
|
|
730
378
|
};
|
|
731
379
|
/** Close every open nested scope, deepest first, each with the terminal `end` names for it. */
|
|
@@ -778,101 +426,36 @@ function agUiSerializer(options) {
|
|
|
778
426
|
settled = true;
|
|
779
427
|
const out = [];
|
|
780
428
|
start(out);
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
endAllNested(out, () => (subagentRunId) => ({
|
|
812
|
-
type: 'SUBAGENT_FINISHED',
|
|
813
|
-
subagentRunId,
|
|
814
|
-
outcome: { type: 'suspended' },
|
|
815
|
-
}));
|
|
816
|
-
closeContents(root, out);
|
|
817
|
-
out.push({
|
|
818
|
-
type: 'RUN_FINISHED',
|
|
819
|
-
threadId,
|
|
820
|
-
runId,
|
|
821
|
-
outcome: { type: 'success', pendingToolCallIds: [clientCall] },
|
|
822
|
-
});
|
|
823
|
-
return out;
|
|
824
|
-
}
|
|
825
|
-
const interrupt = interruptOf();
|
|
826
|
-
endAllNested(out, (scope) => (subagentRunId) => ({
|
|
827
|
-
type: 'SUBAGENT_FINISHED',
|
|
828
|
-
subagentRunId,
|
|
829
|
-
outcome: {
|
|
830
|
-
type: 'suspended',
|
|
831
|
-
...(pause?.scope === scope && { interruptIds: [interrupt.id] }),
|
|
832
|
-
},
|
|
833
|
-
}));
|
|
834
|
-
closeContents(root, out);
|
|
835
|
-
out.push({
|
|
836
|
-
type: 'RUN_FINISHED',
|
|
837
|
-
threadId,
|
|
838
|
-
runId,
|
|
839
|
-
outcome: { type: 'interrupt', interrupts: [interrupt] },
|
|
840
|
-
});
|
|
841
|
-
return out;
|
|
842
|
-
}
|
|
843
|
-
case 'cancelled':
|
|
844
|
-
endAllNested(out, () => (subagentRunId) => ({
|
|
845
|
-
type: 'SUBAGENT_ERROR',
|
|
846
|
-
subagentRunId,
|
|
847
|
-
message: exports.AG_UI_SUBAGENT_CANCELLED,
|
|
848
|
-
code: 'cancelled',
|
|
849
|
-
}));
|
|
850
|
-
closeContents(root, out);
|
|
851
|
-
out.push({
|
|
852
|
-
type: 'RUN_FINISHED',
|
|
853
|
-
threadId,
|
|
854
|
-
runId,
|
|
855
|
-
outcome: { type: 'cancelled' },
|
|
856
|
-
});
|
|
857
|
-
return out;
|
|
858
|
-
case 'finished':
|
|
859
|
-
if (hostDelivery) {
|
|
860
|
-
rootResult = settlement.output;
|
|
861
|
-
if (settlement.output) {
|
|
862
|
-
const id = ids.next('text', 'host-delivery').id;
|
|
863
|
-
out.push({ type: 'TEXT_MESSAGE_START', messageId: id, role: 'assistant' }, { type: 'TEXT_MESSAGE_CONTENT', messageId: id, delta: settlement.output }, { type: 'TEXT_MESSAGE_END', messageId: id });
|
|
864
|
-
}
|
|
865
|
-
}
|
|
866
|
-
endAllNested(out, () => unfinished);
|
|
867
|
-
closeContents(root, out);
|
|
868
|
-
out.push({
|
|
869
|
-
type: 'RUN_FINISHED',
|
|
870
|
-
threadId,
|
|
871
|
-
runId,
|
|
872
|
-
...(rootResult !== undefined && { result: rootResult }),
|
|
873
|
-
});
|
|
874
|
-
return out;
|
|
875
|
-
}
|
|
429
|
+
return (0, settle_js_1.settleTranslation)(settlement, out, {
|
|
430
|
+
root,
|
|
431
|
+
threadId,
|
|
432
|
+
runId,
|
|
433
|
+
ids,
|
|
434
|
+
hostDelivery,
|
|
435
|
+
pausedRecord,
|
|
436
|
+
endAllNested,
|
|
437
|
+
closeContents,
|
|
438
|
+
interruptOf,
|
|
439
|
+
unfinished,
|
|
440
|
+
get rootResult() {
|
|
441
|
+
return rootResult;
|
|
442
|
+
},
|
|
443
|
+
set rootResult(value) {
|
|
444
|
+
rootResult = value;
|
|
445
|
+
},
|
|
446
|
+
get suspended() {
|
|
447
|
+
return suspended;
|
|
448
|
+
},
|
|
449
|
+
set suspended(value) {
|
|
450
|
+
suspended = value;
|
|
451
|
+
},
|
|
452
|
+
get fatal() {
|
|
453
|
+
return fatal;
|
|
454
|
+
},
|
|
455
|
+
get pause() {
|
|
456
|
+
return pause;
|
|
457
|
+
},
|
|
458
|
+
});
|
|
876
459
|
},
|
|
877
460
|
suspension: (awaiting) => {
|
|
878
461
|
if (settled)
|
|
@@ -882,20 +465,4 @@ function agUiSerializer(options) {
|
|
|
882
465
|
};
|
|
883
466
|
}
|
|
884
467
|
exports.agUiSerializer = agUiSerializer;
|
|
885
|
-
/**
|
|
886
|
-
* The question a pause put to a person, from whichever home its kind keeps it
|
|
887
|
-
* in: a plain ask (`askHuman` / `pauseHere` / an input request) at the top, a
|
|
888
|
-
* middleware's ask on `ask.question`, a check-in as the plain-words claim of
|
|
889
|
-
* what the tool will do (`checkIn.evidence.willDo`).
|
|
890
|
-
*/
|
|
891
|
-
function questionOf(payload) {
|
|
892
|
-
return (text(payload.question) ??
|
|
893
|
-
text(record(payload.ask).question) ??
|
|
894
|
-
text(record(record(payload.checkIn).evidence).willDo));
|
|
895
|
-
}
|
|
896
|
-
/** A composition's step name: its kind, and where it is mounted when it is not the run itself. */
|
|
897
|
-
function compositionStep(kind, path) {
|
|
898
|
-
const name = typeof kind === 'string' && kind.length > 0 ? kind : 'Composition';
|
|
899
|
-
return path.length === 0 ? name : `${name}:${path.join('/')}`;
|
|
900
|
-
}
|
|
901
468
|
//# sourceMappingURL=serializer.js.map
|