veryfront 0.1.516 → 0.1.518
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/esm/deno.js +3 -3
- package/esm/src/agent/ag-ui/browser-chunk-encoder.d.ts +14 -0
- package/esm/src/agent/ag-ui/browser-chunk-encoder.d.ts.map +1 -0
- package/esm/src/agent/ag-ui/browser-chunk-encoder.js +31 -0
- package/esm/src/agent/ag-ui/browser-encoder.d.ts +32 -0
- package/esm/src/agent/ag-ui/browser-encoder.d.ts.map +1 -0
- package/esm/src/agent/ag-ui/browser-encoder.js +405 -0
- package/esm/src/agent/ag-ui/browser-finalize-tracker.d.ts +12 -0
- package/esm/src/agent/ag-ui/browser-finalize-tracker.d.ts.map +1 -0
- package/esm/src/agent/ag-ui/browser-finalize-tracker.js +42 -0
- package/esm/src/agent/ag-ui/browser-response-stream.d.ts +28 -0
- package/esm/src/agent/ag-ui/browser-response-stream.d.ts.map +1 -0
- package/esm/src/agent/ag-ui/chat-ui-chunk-browser-encoder.d.ts +20 -0
- package/esm/src/agent/ag-ui/chat-ui-chunk-browser-encoder.d.ts.map +1 -0
- package/esm/src/agent/ag-ui/chat-ui-chunk-browser-encoder.js +108 -0
- package/esm/src/agent/ag-ui/chunk-encoder-bridge.d.ts +11 -0
- package/esm/src/agent/ag-ui/chunk-encoder-bridge.d.ts.map +1 -0
- package/esm/src/agent/ag-ui/chunk-encoder-bridge.js +9 -0
- package/esm/src/agent/ag-ui/detached-start.d.ts +158 -0
- package/esm/src/agent/ag-ui/detached-start.d.ts.map +1 -0
- package/esm/src/agent/ag-ui/detached-start.js +256 -0
- package/esm/src/agent/ag-ui/forwarded-context.d.ts +14 -0
- package/esm/src/agent/ag-ui/forwarded-context.d.ts.map +1 -0
- package/esm/src/agent/ag-ui/forwarded-context.js +56 -0
- package/esm/src/agent/ag-ui/handler.d.ts +14 -0
- package/esm/src/agent/ag-ui/handler.d.ts.map +1 -0
- package/esm/src/agent/ag-ui/handler.js +244 -0
- package/esm/src/agent/ag-ui/host-support.d.ts +131 -0
- package/esm/src/agent/ag-ui/host-support.d.ts.map +1 -0
- package/esm/src/agent/ag-ui/host-support.js +179 -0
- package/esm/src/agent/ag-ui/request-shared.d.ts +4 -0
- package/esm/src/agent/ag-ui/request-shared.d.ts.map +1 -0
- package/esm/src/agent/ag-ui/request-shared.js +56 -0
- package/esm/src/agent/ag-ui/run-control.d.ts +39 -0
- package/esm/src/agent/ag-ui/run-control.d.ts.map +1 -0
- package/esm/src/agent/ag-ui/run-control.js +84 -0
- package/esm/src/agent/ag-ui/runtime-browser-response.d.ts +18 -0
- package/esm/src/agent/ag-ui/runtime-browser-response.d.ts.map +1 -0
- package/esm/src/agent/ag-ui/runtime-browser-response.js +15 -0
- package/esm/src/agent/ag-ui/runtime-chat-stream-encoder.d.ts +17 -0
- package/esm/src/agent/ag-ui/runtime-chat-stream-encoder.d.ts.map +1 -0
- package/esm/src/agent/ag-ui/runtime-chat-stream-encoder.js +304 -0
- package/esm/src/agent/ag-ui/runtime-event-encoder.d.ts +11 -0
- package/esm/src/agent/ag-ui/runtime-event-encoder.d.ts.map +1 -0
- package/esm/src/agent/ag-ui/runtime-event-encoder.js +37 -0
- package/esm/src/agent/ag-ui/runtime-handler.d.ts +44 -0
- package/esm/src/agent/ag-ui/runtime-handler.d.ts.map +1 -0
- package/esm/src/agent/ag-ui/runtime-handler.js +301 -0
- package/esm/src/agent/ag-ui/runtime-support.d.ts +4 -0
- package/esm/src/agent/ag-ui/runtime-support.d.ts.map +1 -0
- package/esm/src/agent/ag-ui/sse-parser.d.ts +57 -0
- package/esm/src/agent/ag-ui/sse-parser.d.ts.map +1 -0
- package/esm/src/agent/ag-ui/sse-parser.js +227 -0
- package/esm/src/agent/ag-ui/tool-shared.d.ts +15 -0
- package/esm/src/agent/ag-ui/tool-shared.d.ts.map +1 -0
- package/esm/src/agent/ag-ui/tool-shared.js +48 -0
- package/esm/src/agent/ag-ui/tracked-browser-response.d.ts +9 -0
- package/esm/src/agent/ag-ui/tracked-browser-response.d.ts.map +1 -0
- package/esm/src/agent/ag-ui/tracked-browser-response.js +19 -0
- package/esm/src/agent/agent-runtime-message-adapter.js +1 -1
- package/esm/src/agent/chat-ui-message-stream.js +1 -1
- package/esm/src/agent/child-run/execution-cleanup.d.ts +14 -0
- package/esm/src/agent/child-run/execution-cleanup.d.ts.map +1 -0
- package/esm/src/agent/child-run/execution-snapshot.d.ts +70 -0
- package/esm/src/agent/child-run/execution-snapshot.d.ts.map +1 -0
- package/esm/src/agent/child-run/execution-support.d.ts +5 -0
- package/esm/src/agent/child-run/execution-support.d.ts.map +1 -0
- package/esm/src/agent/child-run/final-step-support.d.ts +18 -0
- package/esm/src/agent/child-run/final-step-support.d.ts.map +1 -0
- package/esm/src/agent/child-run/result-summary.d.ts +14 -0
- package/esm/src/agent/child-run/result-summary.d.ts.map +1 -0
- package/esm/src/agent/conversation/bootstrap.d.ts +94 -0
- package/esm/src/agent/conversation/bootstrap.d.ts.map +1 -0
- package/esm/src/agent/conversation/bootstrap.js +210 -0
- package/esm/src/agent/conversation/delegation-policy.d.ts +53 -0
- package/esm/src/agent/conversation/delegation-policy.d.ts.map +1 -0
- package/esm/src/agent/conversation/delegation-policy.js +192 -0
- package/esm/src/agent/conversation/hosted-lifecycle.d.ts +39 -0
- package/esm/src/agent/conversation/hosted-lifecycle.d.ts.map +1 -0
- package/esm/src/agent/conversation/hosted-lifecycle.js +138 -0
- package/esm/src/agent/conversation/hosted-terminal.d.ts +46 -0
- package/esm/src/agent/conversation/hosted-terminal.d.ts.map +1 -0
- package/esm/src/agent/conversation/hosted-terminal.js +138 -0
- package/esm/src/agent/conversation/root-run-context.d.ts +57 -0
- package/esm/src/agent/conversation/root-run-context.d.ts.map +1 -0
- package/esm/src/agent/conversation/root-run-context.js +79 -0
- package/esm/src/agent/conversation/root-run-lifecycle.d.ts +61 -0
- package/esm/src/agent/conversation/root-run-lifecycle.d.ts.map +1 -0
- package/esm/src/agent/conversation/root-run-lifecycle.js +94 -0
- package/esm/src/agent/conversation/run-chunk-mirror.d.ts +74 -0
- package/esm/src/agent/conversation/run-chunk-mirror.d.ts.map +1 -0
- package/esm/src/agent/conversation/run-chunk-mirror.js +188 -0
- package/esm/src/agent/conversation/run-context.d.ts +19 -0
- package/esm/src/agent/conversation/run-context.d.ts.map +1 -0
- package/esm/src/agent/conversation/run-event-normalization.d.ts +8 -0
- package/esm/src/agent/conversation/run-event-normalization.d.ts.map +1 -0
- package/esm/src/agent/conversation/run-event-preparation.d.ts +7 -0
- package/esm/src/agent/conversation/run-event-preparation.d.ts.map +1 -0
- package/esm/src/agent/conversation/run-event-preparation.js +48 -0
- package/esm/src/agent/conversation/run-events.d.ts +34 -0
- package/esm/src/agent/conversation/run-events.d.ts.map +1 -0
- package/esm/src/agent/conversation/run-events.js +200 -0
- package/esm/src/agent/conversation/run-mirror.d.ts +43 -0
- package/esm/src/agent/conversation/run-mirror.d.ts.map +1 -0
- package/esm/src/agent/conversation/run-mirror.js +157 -0
- package/esm/src/agent/conversation/run-stream-mirror.d.ts +21 -0
- package/esm/src/agent/conversation/run-stream-mirror.d.ts.map +1 -0
- package/esm/src/agent/conversation/run-stream-mirror.js +31 -0
- package/esm/src/agent/data-stream.d.ts +1 -1
- package/esm/src/agent/default-hosted-chat-runtime.d.ts +5 -5
- package/esm/src/agent/default-hosted-chat-runtime.d.ts.map +1 -1
- package/esm/src/agent/default-hosted-chat-runtime.js +3 -3
- package/esm/src/agent/default-hosted-invoke-agent-tool.d.ts +7 -7
- package/esm/src/agent/default-hosted-invoke-agent-tool.d.ts.map +1 -1
- package/esm/src/agent/default-hosted-invoke-agent-tool.js +13 -13
- package/esm/src/agent/default-hosted-project-steering-refresh.d.ts +4 -4
- package/esm/src/agent/default-hosted-project-steering-refresh.js +1 -1
- package/esm/src/agent/default-research-artifact-support.js +2 -2
- package/esm/src/agent/fork-runtime-stream.d.ts +1 -1
- package/esm/src/agent/fork-runtime-stream.js +1 -1
- package/esm/src/agent/hosted/ag-ui-chat-request.d.ts +56 -0
- package/esm/src/agent/hosted/ag-ui-chat-request.d.ts.map +1 -0
- package/esm/src/agent/hosted/ag-ui-chat-request.js +112 -0
- package/esm/src/agent/hosted/agent-project-steering.d.ts +33 -0
- package/esm/src/agent/hosted/agent-project-steering.d.ts.map +1 -0
- package/esm/src/agent/hosted/agent-project-steering.js +73 -0
- package/esm/src/agent/hosted/agent-run-lifecycle.d.ts +60 -0
- package/esm/src/agent/hosted/agent-run-lifecycle.d.ts.map +1 -0
- package/esm/src/agent/hosted/agent-run-lifecycle.js +72 -0
- package/esm/src/agent/hosted/chat-execution-runtime.d.ts +127 -0
- package/esm/src/agent/hosted/chat-execution-runtime.d.ts.map +1 -0
- package/esm/src/agent/hosted/chat-execution-runtime.js +400 -0
- package/esm/src/agent/hosted/chat-preparation.d.ts +105 -0
- package/esm/src/agent/hosted/chat-preparation.d.ts.map +1 -0
- package/esm/src/agent/hosted/chat-preparation.js +156 -0
- package/esm/src/agent/hosted/chat-request-parser.d.ts +53 -0
- package/esm/src/agent/hosted/chat-request-parser.d.ts.map +1 -0
- package/esm/src/agent/hosted/chat-request-parser.js +105 -0
- package/esm/src/agent/hosted/chat-request.d.ts +305 -0
- package/esm/src/agent/hosted/chat-request.d.ts.map +1 -0
- package/esm/src/agent/hosted/chat-request.js +68 -0
- package/esm/src/agent/hosted/chat-runtime-agent-adapter.d.ts +14 -0
- package/esm/src/agent/hosted/chat-runtime-agent-adapter.d.ts.map +1 -0
- package/esm/src/agent/hosted/chat-runtime-agent-adapter.js +48 -0
- package/esm/src/agent/hosted/chat-runtime-contract.d.ts +86 -0
- package/esm/src/agent/hosted/chat-runtime-contract.d.ts.map +1 -0
- package/esm/src/agent/hosted/chat-runtime-tool-assembly.d.ts +51 -0
- package/esm/src/agent/hosted/chat-runtime-tool-assembly.d.ts.map +1 -0
- package/esm/src/agent/hosted/chat-runtime-tool-assembly.js +84 -0
- package/esm/src/agent/hosted/child-artifact-support.d.ts +25 -0
- package/esm/src/agent/hosted/child-artifact-support.d.ts.map +1 -0
- package/esm/src/agent/hosted/child-artifact-support.js +121 -0
- package/esm/src/agent/hosted/child-bootstrap.d.ts +40 -0
- package/esm/src/agent/hosted/child-bootstrap.d.ts.map +1 -0
- package/esm/src/agent/hosted/child-bootstrap.js +44 -0
- package/esm/src/agent/hosted/child-execution-logging.d.ts +35 -0
- package/esm/src/agent/hosted/child-execution-logging.d.ts.map +1 -0
- package/esm/src/agent/hosted/child-execution-logging.js +69 -0
- package/esm/src/agent/hosted/child-fork-execution-runner.d.ts +101 -0
- package/esm/src/agent/hosted/child-fork-execution-runner.d.ts.map +1 -0
- package/esm/src/agent/hosted/child-fork-execution-runner.js +205 -0
- package/esm/src/agent/hosted/child-fork-instructions.d.ts +8 -0
- package/esm/src/agent/hosted/child-fork-instructions.d.ts.map +1 -0
- package/esm/src/agent/hosted/child-fork-run-context.d.ts +88 -0
- package/esm/src/agent/hosted/child-fork-run-context.d.ts.map +1 -0
- package/esm/src/agent/hosted/child-fork-run-context.js +144 -0
- package/esm/src/agent/hosted/child-fork-runtime-start.d.ts +18 -0
- package/esm/src/agent/hosted/child-fork-runtime-start.d.ts.map +1 -0
- package/esm/src/agent/hosted/child-fork-runtime-start.js +41 -0
- package/esm/src/agent/hosted/child-fork-step-message-preparation.d.ts +19 -0
- package/esm/src/agent/hosted/child-fork-step-message-preparation.d.ts.map +1 -0
- package/esm/src/agent/hosted/child-fork-step-message-preparation.js +52 -0
- package/esm/src/agent/hosted/child-fork-stream-execution.d.ts +153 -0
- package/esm/src/agent/hosted/child-fork-stream-execution.d.ts.map +1 -0
- package/esm/src/agent/hosted/child-fork-stream-execution.js +416 -0
- package/esm/src/agent/hosted/child-fork-tool-sources.d.ts +46 -0
- package/esm/src/agent/hosted/child-fork-tool-sources.d.ts.map +1 -0
- package/esm/src/agent/hosted/child-fork-tool-sources.js +132 -0
- package/esm/src/agent/hosted/child-invoke-tool.d.ts +20 -0
- package/esm/src/agent/hosted/child-invoke-tool.d.ts.map +1 -0
- package/esm/src/agent/hosted/child-invoke-tool.js +49 -0
- package/esm/src/agent/hosted/child-lifecycle.d.ts +63 -0
- package/esm/src/agent/hosted/child-lifecycle.d.ts.map +1 -0
- package/esm/src/agent/hosted/child-lifecycle.js +192 -0
- package/esm/src/agent/hosted/child-mirror.d.ts +108 -0
- package/esm/src/agent/hosted/child-mirror.d.ts.map +1 -0
- package/esm/src/agent/hosted/child-pending-tool-lifecycle.d.ts +50 -0
- package/esm/src/agent/hosted/child-pending-tool-lifecycle.d.ts.map +1 -0
- package/esm/src/agent/hosted/child-pending-tool-lifecycle.js +119 -0
- package/esm/src/agent/hosted/child-requested-tools.d.ts +109 -0
- package/esm/src/agent/hosted/child-requested-tools.d.ts.map +1 -0
- package/esm/src/agent/hosted/child-requested-tools.js +233 -0
- package/esm/src/agent/hosted/child-status.d.ts +39 -0
- package/esm/src/agent/hosted/child-status.d.ts.map +1 -0
- package/esm/src/agent/hosted/child-status.js +98 -0
- package/esm/src/agent/hosted/child-steering-tools.d.ts +20 -0
- package/esm/src/agent/hosted/child-steering-tools.d.ts.map +1 -0
- package/esm/src/agent/hosted/child-steering-tools.js +53 -0
- package/esm/src/agent/hosted/child-stream-watchdog.d.ts +27 -0
- package/esm/src/agent/hosted/child-stream-watchdog.d.ts.map +1 -0
- package/esm/src/agent/hosted/child-stream-watchdog.js +95 -0
- package/esm/src/agent/hosted/child-tool-input.d.ts +44 -0
- package/esm/src/agent/hosted/child-tool-input.d.ts.map +1 -0
- package/esm/src/agent/hosted/child-tool-input.js +44 -0
- package/esm/src/agent/hosted/durable-chat-run-start.d.ts +46 -0
- package/esm/src/agent/hosted/durable-chat-run-start.d.ts.map +1 -0
- package/esm/src/agent/hosted/durable-chat-run-start.js +148 -0
- package/esm/src/agent/hosted/durable-child-fork-execution.d.ts +159 -0
- package/esm/src/agent/hosted/durable-child-fork-execution.d.ts.map +1 -0
- package/esm/src/agent/hosted/durable-child-fork-execution.js +324 -0
- package/esm/src/agent/hosted/finalized-message.d.ts +44 -0
- package/esm/src/agent/hosted/finalized-message.d.ts.map +1 -0
- package/esm/src/agent/hosted/finalized-message.js +67 -0
- package/esm/src/agent/hosted/form-input-tool.d.ts +85 -0
- package/esm/src/agent/hosted/form-input-tool.d.ts.map +1 -0
- package/esm/src/agent/hosted/form-input-tool.js +88 -0
- package/esm/src/agent/hosted/lifecycle.d.ts +41 -0
- package/esm/src/agent/hosted/lifecycle.d.ts.map +1 -0
- package/esm/src/agent/hosted/project-remote-tool-source.d.ts +46 -0
- package/esm/src/agent/hosted/project-remote-tool-source.d.ts.map +1 -0
- package/esm/src/agent/hosted/project-remote-tool-source.js +147 -0
- package/esm/src/agent/hosted/project-steering-adapter.d.ts +34 -0
- package/esm/src/agent/hosted/project-steering-adapter.d.ts.map +1 -0
- package/esm/src/agent/hosted/project-steering-adapter.js +82 -0
- package/esm/src/agent/hosted/response-stream.d.ts +22 -0
- package/esm/src/agent/hosted/response-stream.d.ts.map +1 -0
- package/esm/src/agent/hosted/response-stream.js +52 -0
- package/esm/src/agent/hosted/runtime-request-config.d.ts +27 -0
- package/esm/src/agent/hosted/runtime-request-config.d.ts.map +1 -0
- package/esm/src/agent/hosted/runtime-request-config.js +54 -0
- package/esm/src/agent/hosted/runtime-state-resolver.d.ts +28 -0
- package/esm/src/agent/hosted/runtime-state-resolver.d.ts.map +1 -0
- package/esm/src/agent/hosted/runtime-state-resolver.js +71 -0
- package/esm/src/agent/hosted/stream-finalization.d.ts +61 -0
- package/esm/src/agent/hosted/stream-finalization.d.ts.map +1 -0
- package/esm/src/agent/hosted/stream-terminal-error.d.ts +16 -0
- package/esm/src/agent/hosted/stream-terminal-error.d.ts.map +1 -0
- package/esm/src/agent/hosted/stream-terminal-error.js +54 -0
- package/esm/src/agent/hosted/veryfront-api-tool-access.d.ts +49 -0
- package/esm/src/agent/hosted/veryfront-api-tool-access.d.ts.map +1 -0
- package/esm/src/agent/hosted/veryfront-api-tool-access.js +182 -0
- package/esm/src/agent/human-input.js +1 -1
- package/esm/src/agent/index.d.ts +108 -107
- package/esm/src/agent/index.d.ts.map +1 -1
- package/esm/src/agent/index.js +106 -105
- package/esm/src/agent/live-studio-mcp-tools.d.ts +1 -1
- package/esm/src/agent/live-studio-mcp-tools.js +1 -1
- package/esm/src/agent/prepared-hosted-chat-execution.d.ts +2 -2
- package/esm/src/agent/prepared-hosted-chat-execution.js +3 -3
- package/esm/src/agent/project-agent-runtime.d.ts +25 -0
- package/esm/src/agent/project-agent-runtime.d.ts.map +1 -0
- package/esm/src/agent/project-agent-runtime.js +84 -0
- package/esm/src/agent/runtime/ag-ui-contract.d.ts +213 -0
- package/esm/src/agent/runtime/ag-ui-contract.d.ts.map +1 -0
- package/esm/src/agent/runtime/ag-ui-contract.js +134 -0
- package/esm/src/agent/runtime/agent-definition-files.d.ts +23 -0
- package/esm/src/agent/runtime/agent-definition-files.d.ts.map +1 -0
- package/esm/src/agent/runtime/agent-definition-files.js +79 -0
- package/esm/src/agent/runtime/agent-definition.d.ts +60 -0
- package/esm/src/agent/runtime/agent-definition.d.ts.map +1 -0
- package/esm/src/agent/runtime/agent-definition.js +105 -0
- package/esm/src/agent/runtime/agent-invocation-contract.d.ts +326 -0
- package/esm/src/agent/runtime/agent-invocation-contract.d.ts.map +1 -0
- package/esm/src/agent/runtime/agent-invocation-contract.js +212 -0
- package/esm/src/agent/runtime/agent-markdown-adapter.d.ts +6 -0
- package/esm/src/agent/runtime/agent-markdown-adapter.d.ts.map +1 -0
- package/esm/src/agent/runtime/agent-markdown-adapter.js +20 -0
- package/esm/src/agent/runtime/builtin-skill-files.d.ts +18 -0
- package/esm/src/agent/runtime/builtin-skill-files.d.ts.map +1 -0
- package/esm/src/agent/runtime/builtin-skill-files.js +82 -0
- package/esm/src/agent/runtime/client-profile.d.ts +26 -0
- package/esm/src/agent/runtime/client-profile.d.ts.map +1 -0
- package/esm/src/agent/runtime/client-profile.js +82 -0
- package/esm/src/agent/runtime/load-skill-tool.d.ts +43 -0
- package/esm/src/agent/runtime/load-skill-tool.d.ts.map +1 -0
- package/esm/src/agent/runtime/load-skill-tool.js +115 -0
- package/esm/src/agent/runtime/message-file-url-refresh.d.ts +9 -0
- package/esm/src/agent/runtime/message-file-url-refresh.d.ts.map +1 -0
- package/esm/src/agent/runtime/message-preparation.d.ts +10 -0
- package/esm/src/agent/runtime/message-preparation.d.ts.map +1 -0
- package/esm/src/agent/runtime/message-preparation.js +34 -0
- package/esm/src/agent/runtime/project-files-client.d.ts +50 -0
- package/esm/src/agent/runtime/project-files-client.d.ts.map +1 -0
- package/esm/src/agent/runtime/project-files-client.js +143 -0
- package/esm/src/agent/runtime/project-skill-catalog.d.ts +26 -0
- package/esm/src/agent/runtime/project-skill-catalog.d.ts.map +1 -0
- package/esm/src/agent/runtime/project-skill-catalog.js +148 -0
- package/esm/src/agent/runtime/project-skill-loader.d.ts +28 -0
- package/esm/src/agent/runtime/project-skill-loader.d.ts.map +1 -0
- package/esm/src/agent/runtime/project-skill-loader.js +122 -0
- package/esm/src/agent/runtime/prompt-block.d.ts +7 -0
- package/esm/src/agent/runtime/prompt-block.d.ts.map +1 -0
- package/esm/src/agent/runtime/skill-metadata.d.ts +75 -0
- package/esm/src/agent/runtime/skill-metadata.d.ts.map +1 -0
- package/esm/src/agent/runtime/skill-metadata.js +159 -0
- package/esm/src/agent/runtime/skill-prompt.d.ts +5 -0
- package/esm/src/agent/runtime/skill-prompt.d.ts.map +1 -0
- package/esm/src/agent/runtime/skill-prompt.js +40 -0
- package/esm/src/agent/runtime/tool-inventory.d.ts +4 -0
- package/esm/src/agent/runtime/tool-inventory.d.ts.map +1 -0
- package/esm/src/agent/runtime/upload-url-client.d.ts +13 -0
- package/esm/src/agent/runtime/upload-url-client.d.ts.map +1 -0
- package/esm/src/agent/runtime/upload-url-client.js +54 -0
- package/esm/src/agent/service/auth.d.ts +81 -0
- package/esm/src/agent/service/auth.d.ts.map +1 -0
- package/esm/src/agent/service/bootstrap.d.ts +23 -0
- package/esm/src/agent/service/bootstrap.d.ts.map +1 -0
- package/esm/src/agent/service/bootstrap.js +38 -0
- package/esm/src/agent/service/config.d.ts +140 -0
- package/esm/src/agent/service/config.d.ts.map +1 -0
- package/esm/src/agent/service/definition.d.ts +87 -0
- package/esm/src/agent/service/definition.d.ts.map +1 -0
- package/esm/src/agent/service/env-files.d.ts +13 -0
- package/esm/src/agent/service/env-files.d.ts.map +1 -0
- package/esm/src/agent/service/env-files.js +34 -0
- package/esm/src/agent/service/mcp-server-config.d.ts +33 -0
- package/esm/src/agent/service/mcp-server-config.d.ts.map +1 -0
- package/esm/src/agent/service/mcp-server-config.js +49 -0
- package/esm/src/agent/service/node-runtime-infrastructure.d.ts +26 -0
- package/esm/src/agent/service/node-runtime-infrastructure.d.ts.map +1 -0
- package/esm/src/agent/service/node-runtime-infrastructure.js +30 -0
- package/esm/src/agent/service/node-telemetry.d.ts +44 -0
- package/esm/src/agent/service/node-telemetry.d.ts.map +1 -0
- package/esm/src/agent/service/registration.d.ts +110 -0
- package/esm/src/agent/service/registration.d.ts.map +1 -0
- package/esm/src/agent/service/registration.js +228 -0
- package/esm/src/agent/service/routes.d.ts +81 -0
- package/esm/src/agent/service/routes.d.ts.map +1 -0
- package/esm/src/agent/service/routes.js +204 -0
- package/esm/src/agent/service/runtime.d.ts +73 -0
- package/esm/src/agent/service/runtime.d.ts.map +1 -0
- package/esm/src/agent/service/runtime.js +118 -0
- package/esm/src/agent/service/server.d.ts +30 -0
- package/esm/src/agent/service/server.d.ts.map +1 -0
- package/esm/src/agent/service/server.js +47 -0
- package/esm/src/agent/veryfront-cloud-agent-service.d.ts +8 -7
- package/esm/src/agent/veryfront-cloud-agent-service.d.ts.map +1 -1
- package/esm/src/agent/veryfront-cloud-agent-service.js +17 -72
- package/esm/src/agent/veryfront-cloud-hosted-chat-execution-preparation.d.ts +3 -3
- package/esm/src/agent/veryfront-cloud-hosted-chat-execution-preparation.js +1 -1
- package/esm/src/agent/veryfront-cloud-prepared-hosted-chat-execution-runtime.d.ts +1 -1
- package/esm/src/agent/veryfront-cloud-runtime-system-messages.d.ts +3 -3
- package/esm/src/agent/veryfront-cloud-runtime-system-messages.js +2 -2
- package/esm/src/discovery/handlers/runtime-agent-markdown-handler.js +2 -2
- package/esm/src/internal-agents/ag-ui-sse.d.ts +2 -2
- package/esm/src/internal-agents/ag-ui-sse.js +1 -1
- package/esm/src/internal-agents/run-stream.js +1 -1
- package/esm/src/internal-agents/schema.d.ts +2 -2
- package/esm/src/internal-agents/schema.js +2 -2
- package/esm/src/tool/project-scoped-remote-tools.d.ts +6 -0
- package/esm/src/tool/project-scoped-remote-tools.d.ts.map +1 -1
- package/esm/src/tool/project-scoped-remote-tools.js +15 -4
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/package.json +3 -3
- package/src/deno.js +3 -3
- package/src/deps/esm.sh/@types/react-dom@19.2.3/client.d.ts +1 -1
- package/src/deps/esm.sh/@types/react@19.2.14/global.d.ts +166 -0
- package/src/deps/esm.sh/@types/react@19.2.14/index.d.ts +4370 -0
- package/src/deps/esm.sh/react-dom@19.2.4/client.d.ts +1 -1
- package/src/src/agent/ag-ui/browser-chunk-encoder.ts +58 -0
- package/src/src/agent/ag-ui/browser-encoder.ts +538 -0
- package/src/src/agent/ag-ui/browser-finalize-tracker.ts +65 -0
- package/src/src/agent/ag-ui/browser-response-stream.ts +175 -0
- package/src/src/agent/ag-ui/chat-ui-chunk-browser-encoder.ts +172 -0
- package/src/src/agent/ag-ui/chunk-encoder-bridge.ts +34 -0
- package/src/src/agent/ag-ui/detached-start.ts +425 -0
- package/src/src/agent/ag-ui/forwarded-context.ts +83 -0
- package/src/src/agent/ag-ui/handler.ts +388 -0
- package/src/src/agent/ag-ui/host-support.ts +244 -0
- package/src/src/agent/ag-ui/request-shared.ts +76 -0
- package/src/src/agent/ag-ui/run-control.ts +145 -0
- package/src/src/agent/ag-ui/runtime-browser-response.ts +41 -0
- package/src/src/agent/ag-ui/runtime-chat-stream-encoder.ts +359 -0
- package/src/src/agent/ag-ui/runtime-event-encoder.ts +71 -0
- package/src/src/agent/ag-ui/runtime-handler.ts +510 -0
- package/src/src/agent/ag-ui/runtime-support.ts +64 -0
- package/src/src/agent/ag-ui/sse-parser.ts +306 -0
- package/src/src/agent/ag-ui/tool-shared.ts +80 -0
- package/src/src/agent/ag-ui/tracked-browser-response.ts +42 -0
- package/src/src/agent/agent-runtime-message-adapter.ts +1 -1
- package/src/src/agent/chat-ui-message-stream.ts +1 -1
- package/src/src/agent/conversation/bootstrap.ts +335 -0
- package/src/src/agent/conversation/delegation-policy.ts +299 -0
- package/src/src/agent/conversation/hosted-lifecycle.ts +215 -0
- package/src/src/agent/conversation/hosted-terminal.ts +235 -0
- package/src/src/agent/conversation/root-run-context.ts +143 -0
- package/src/src/agent/conversation/root-run-lifecycle.ts +184 -0
- package/src/src/agent/conversation/run-chunk-mirror.ts +350 -0
- package/src/src/agent/conversation/run-context.ts +22 -0
- package/src/src/agent/conversation/run-event-preparation.ts +76 -0
- package/src/src/agent/conversation/run-events.ts +242 -0
- package/src/src/agent/conversation/run-mirror.ts +235 -0
- package/src/src/agent/conversation/run-stream-mirror.ts +56 -0
- package/src/src/agent/data-stream.ts +1 -1
- package/src/src/agent/default-hosted-chat-runtime.ts +6 -6
- package/src/src/agent/default-hosted-invoke-agent-tool.ts +19 -19
- package/src/src/agent/default-hosted-project-steering-refresh.ts +5 -5
- package/src/src/agent/default-research-artifact-support.ts +2 -2
- package/src/src/agent/fork-runtime-stream.ts +2 -2
- package/src/src/agent/hosted/ag-ui-chat-request.ts +197 -0
- package/src/src/agent/hosted/agent-project-steering.ts +129 -0
- package/src/src/agent/hosted/agent-run-lifecycle.ts +161 -0
- package/src/src/agent/hosted/chat-execution-runtime.ts +703 -0
- package/src/src/agent/hosted/chat-preparation.ts +357 -0
- package/src/src/agent/hosted/chat-request-parser.ts +209 -0
- package/src/src/agent/hosted/chat-request.ts +112 -0
- package/src/src/agent/hosted/chat-runtime-agent-adapter.ts +88 -0
- package/src/src/agent/hosted/chat-runtime-contract.ts +101 -0
- package/src/src/agent/hosted/chat-runtime-tool-assembly.ts +183 -0
- package/src/src/agent/hosted/child-artifact-support.ts +201 -0
- package/src/src/agent/hosted/child-bootstrap.ts +75 -0
- package/src/src/agent/hosted/child-execution-logging.ts +114 -0
- package/src/src/agent/hosted/child-fork-execution-runner.ts +396 -0
- package/src/src/agent/hosted/child-fork-run-context.ts +309 -0
- package/src/src/agent/hosted/child-fork-runtime-start.ts +84 -0
- package/src/src/agent/hosted/child-fork-step-message-preparation.ts +96 -0
- package/src/src/agent/hosted/child-fork-stream-execution.ts +626 -0
- package/src/src/agent/hosted/child-fork-tool-sources.ts +231 -0
- package/src/src/agent/hosted/child-invoke-tool.ts +90 -0
- package/src/src/agent/hosted/child-lifecycle.ts +352 -0
- package/src/src/agent/hosted/child-mirror.ts +272 -0
- package/src/src/agent/hosted/child-pending-tool-lifecycle.ts +191 -0
- package/src/src/agent/hosted/child-requested-tools.ts +411 -0
- package/src/src/agent/hosted/child-status.ts +167 -0
- package/src/src/agent/hosted/child-steering-tools.ts +92 -0
- package/src/src/agent/hosted/child-stream-watchdog.ts +146 -0
- package/src/src/agent/hosted/child-tool-input.ts +91 -0
- package/src/src/agent/hosted/durable-chat-run-start.ts +246 -0
- package/src/src/agent/hosted/durable-child-fork-execution.ts +597 -0
- package/src/src/agent/hosted/finalized-message.ts +170 -0
- package/src/src/agent/hosted/form-input-tool.ts +128 -0
- package/src/src/agent/hosted/project-remote-tool-source.ts +279 -0
- package/src/src/agent/hosted/project-steering-adapter.ts +184 -0
- package/src/src/agent/hosted/response-stream.ts +87 -0
- package/src/src/agent/hosted/runtime-request-config.ts +112 -0
- package/src/src/agent/hosted/runtime-state-resolver.ts +133 -0
- package/src/src/agent/hosted/stream-finalization.ts +188 -0
- package/src/src/agent/hosted/stream-terminal-error.ts +81 -0
- package/src/src/agent/hosted/veryfront-api-tool-access.ts +293 -0
- package/src/src/agent/human-input.ts +1 -1
- package/src/src/agent/index.ts +120 -107
- package/src/src/agent/live-studio-mcp-tools.ts +1 -1
- package/src/src/agent/prepared-hosted-chat-execution.ts +4 -4
- package/src/src/agent/project-agent-runtime.ts +139 -0
- package/src/src/agent/runtime/ag-ui-contract.ts +216 -0
- package/src/src/agent/runtime/agent-definition-files.ts +128 -0
- package/src/src/agent/runtime/agent-definition.ts +163 -0
- package/src/src/agent/runtime/agent-invocation-contract.ts +355 -0
- package/src/src/agent/runtime/agent-markdown-adapter.ts +31 -0
- package/src/src/agent/runtime/builtin-skill-files.ts +122 -0
- package/src/src/agent/runtime/client-profile.ts +123 -0
- package/src/src/agent/runtime/load-skill-tool.ts +239 -0
- package/src/src/agent/runtime/message-file-url-refresh.ts +120 -0
- package/src/src/agent/runtime/message-preparation.ts +58 -0
- package/src/src/agent/runtime/project-files-client.ts +256 -0
- package/src/src/agent/runtime/project-skill-catalog.ts +238 -0
- package/src/src/agent/runtime/project-skill-loader.ts +217 -0
- package/src/src/agent/runtime/skill-metadata.ts +260 -0
- package/src/src/agent/runtime/skill-prompt.ts +61 -0
- package/src/src/agent/runtime/tool-inventory.ts +46 -0
- package/src/src/agent/runtime/upload-url-client.ts +95 -0
- package/src/src/agent/service/bootstrap.ts +79 -0
- package/src/src/agent/service/definition.ts +386 -0
- package/src/src/agent/service/env-files.ts +60 -0
- package/src/src/agent/service/mcp-server-config.ts +112 -0
- package/src/src/agent/service/node-runtime-infrastructure.ts +71 -0
- package/src/src/agent/service/registration.ts +320 -0
- package/src/src/agent/service/routes.ts +386 -0
- package/src/src/agent/service/runtime.ts +303 -0
- package/src/src/agent/service/server.ts +98 -0
- package/src/src/agent/veryfront-cloud-agent-service.ts +37 -115
- package/src/src/agent/veryfront-cloud-hosted-chat-execution-preparation.ts +3 -3
- package/src/src/agent/veryfront-cloud-prepared-hosted-chat-execution-runtime.ts +1 -1
- package/src/src/agent/veryfront-cloud-runtime-system-messages.ts +4 -4
- package/src/src/discovery/handlers/runtime-agent-markdown-handler.ts +2 -2
- package/src/src/internal-agents/ag-ui-sse.ts +2 -2
- package/src/src/internal-agents/run-stream.ts +1 -1
- package/src/src/internal-agents/schema.ts +2 -2
- package/src/src/tool/project-scoped-remote-tools.ts +23 -4
- package/src/src/utils/version-constant.ts +1 -1
- package/esm/src/agent/ag-ui-browser-chunk-encoder.d.ts +0 -14
- package/esm/src/agent/ag-ui-browser-chunk-encoder.d.ts.map +0 -1
- package/esm/src/agent/ag-ui-browser-chunk-encoder.js +0 -31
- package/esm/src/agent/ag-ui-browser-encoder.d.ts +0 -32
- package/esm/src/agent/ag-ui-browser-encoder.d.ts.map +0 -1
- package/esm/src/agent/ag-ui-browser-encoder.js +0 -405
- package/esm/src/agent/ag-ui-browser-finalize-tracker.d.ts +0 -12
- package/esm/src/agent/ag-ui-browser-finalize-tracker.d.ts.map +0 -1
- package/esm/src/agent/ag-ui-browser-finalize-tracker.js +0 -42
- package/esm/src/agent/ag-ui-browser-response-stream.d.ts +0 -28
- package/esm/src/agent/ag-ui-browser-response-stream.d.ts.map +0 -1
- package/esm/src/agent/ag-ui-chat-ui-chunk-browser-encoder.d.ts +0 -20
- package/esm/src/agent/ag-ui-chat-ui-chunk-browser-encoder.d.ts.map +0 -1
- package/esm/src/agent/ag-ui-chat-ui-chunk-browser-encoder.js +0 -108
- package/esm/src/agent/ag-ui-chunk-encoder-bridge.d.ts +0 -11
- package/esm/src/agent/ag-ui-chunk-encoder-bridge.d.ts.map +0 -1
- package/esm/src/agent/ag-ui-chunk-encoder-bridge.js +0 -9
- package/esm/src/agent/ag-ui-detached-start.d.ts +0 -158
- package/esm/src/agent/ag-ui-detached-start.d.ts.map +0 -1
- package/esm/src/agent/ag-ui-detached-start.js +0 -256
- package/esm/src/agent/ag-ui-forwarded-context.d.ts +0 -14
- package/esm/src/agent/ag-ui-forwarded-context.d.ts.map +0 -1
- package/esm/src/agent/ag-ui-forwarded-context.js +0 -56
- package/esm/src/agent/ag-ui-handler.d.ts +0 -14
- package/esm/src/agent/ag-ui-handler.d.ts.map +0 -1
- package/esm/src/agent/ag-ui-handler.js +0 -244
- package/esm/src/agent/ag-ui-host-support.d.ts +0 -131
- package/esm/src/agent/ag-ui-host-support.d.ts.map +0 -1
- package/esm/src/agent/ag-ui-host-support.js +0 -179
- package/esm/src/agent/ag-ui-request-shared.d.ts +0 -4
- package/esm/src/agent/ag-ui-request-shared.d.ts.map +0 -1
- package/esm/src/agent/ag-ui-request-shared.js +0 -56
- package/esm/src/agent/ag-ui-run-control.d.ts +0 -39
- package/esm/src/agent/ag-ui-run-control.d.ts.map +0 -1
- package/esm/src/agent/ag-ui-run-control.js +0 -84
- package/esm/src/agent/ag-ui-runtime-browser-response.d.ts +0 -18
- package/esm/src/agent/ag-ui-runtime-browser-response.d.ts.map +0 -1
- package/esm/src/agent/ag-ui-runtime-browser-response.js +0 -15
- package/esm/src/agent/ag-ui-runtime-chat-stream-encoder.d.ts +0 -17
- package/esm/src/agent/ag-ui-runtime-chat-stream-encoder.d.ts.map +0 -1
- package/esm/src/agent/ag-ui-runtime-chat-stream-encoder.js +0 -304
- package/esm/src/agent/ag-ui-runtime-event-encoder.d.ts +0 -11
- package/esm/src/agent/ag-ui-runtime-event-encoder.d.ts.map +0 -1
- package/esm/src/agent/ag-ui-runtime-event-encoder.js +0 -37
- package/esm/src/agent/ag-ui-runtime-handler.d.ts +0 -44
- package/esm/src/agent/ag-ui-runtime-handler.d.ts.map +0 -1
- package/esm/src/agent/ag-ui-runtime-handler.js +0 -301
- package/esm/src/agent/ag-ui-runtime-support.d.ts +0 -4
- package/esm/src/agent/ag-ui-runtime-support.d.ts.map +0 -1
- package/esm/src/agent/ag-ui-sse-parser.d.ts +0 -57
- package/esm/src/agent/ag-ui-sse-parser.d.ts.map +0 -1
- package/esm/src/agent/ag-ui-sse-parser.js +0 -227
- package/esm/src/agent/ag-ui-tool-shared.d.ts +0 -15
- package/esm/src/agent/ag-ui-tool-shared.d.ts.map +0 -1
- package/esm/src/agent/ag-ui-tool-shared.js +0 -48
- package/esm/src/agent/ag-ui-tracked-browser-response.d.ts +0 -9
- package/esm/src/agent/ag-ui-tracked-browser-response.d.ts.map +0 -1
- package/esm/src/agent/ag-ui-tracked-browser-response.js +0 -19
- package/esm/src/agent/agent-service-auth.d.ts +0 -81
- package/esm/src/agent/agent-service-auth.d.ts.map +0 -1
- package/esm/src/agent/agent-service-bootstrap.d.ts +0 -23
- package/esm/src/agent/agent-service-bootstrap.d.ts.map +0 -1
- package/esm/src/agent/agent-service-bootstrap.js +0 -38
- package/esm/src/agent/agent-service-config.d.ts +0 -140
- package/esm/src/agent/agent-service-config.d.ts.map +0 -1
- package/esm/src/agent/agent-service-env-files.d.ts +0 -13
- package/esm/src/agent/agent-service-env-files.d.ts.map +0 -1
- package/esm/src/agent/agent-service-env-files.js +0 -34
- package/esm/src/agent/agent-service-mcp-server-config.d.ts +0 -33
- package/esm/src/agent/agent-service-mcp-server-config.d.ts.map +0 -1
- package/esm/src/agent/agent-service-mcp-server-config.js +0 -49
- package/esm/src/agent/agent-service-registration.d.ts +0 -110
- package/esm/src/agent/agent-service-registration.d.ts.map +0 -1
- package/esm/src/agent/agent-service-registration.js +0 -228
- package/esm/src/agent/agent-service-routes.d.ts +0 -81
- package/esm/src/agent/agent-service-routes.d.ts.map +0 -1
- package/esm/src/agent/agent-service-routes.js +0 -204
- package/esm/src/agent/agent-service-runtime.d.ts +0 -73
- package/esm/src/agent/agent-service-runtime.d.ts.map +0 -1
- package/esm/src/agent/agent-service-runtime.js +0 -118
- package/esm/src/agent/agent-service-server.d.ts +0 -30
- package/esm/src/agent/agent-service-server.d.ts.map +0 -1
- package/esm/src/agent/agent-service-server.js +0 -47
- package/esm/src/agent/agent-service.d.ts +0 -87
- package/esm/src/agent/agent-service.d.ts.map +0 -1
- package/esm/src/agent/child-run-execution-cleanup.d.ts +0 -14
- package/esm/src/agent/child-run-execution-cleanup.d.ts.map +0 -1
- package/esm/src/agent/child-run-execution-snapshot.d.ts +0 -70
- package/esm/src/agent/child-run-execution-snapshot.d.ts.map +0 -1
- package/esm/src/agent/child-run-execution-support.d.ts +0 -5
- package/esm/src/agent/child-run-execution-support.d.ts.map +0 -1
- package/esm/src/agent/child-run-final-step-support.d.ts +0 -18
- package/esm/src/agent/child-run-final-step-support.d.ts.map +0 -1
- package/esm/src/agent/child-run-result-summary.d.ts +0 -14
- package/esm/src/agent/child-run-result-summary.d.ts.map +0 -1
- package/esm/src/agent/conversation-bootstrap.d.ts +0 -94
- package/esm/src/agent/conversation-bootstrap.d.ts.map +0 -1
- package/esm/src/agent/conversation-bootstrap.js +0 -210
- package/esm/src/agent/conversation-delegation-policy.d.ts +0 -53
- package/esm/src/agent/conversation-delegation-policy.d.ts.map +0 -1
- package/esm/src/agent/conversation-delegation-policy.js +0 -192
- package/esm/src/agent/conversation-hosted-lifecycle.d.ts +0 -39
- package/esm/src/agent/conversation-hosted-lifecycle.d.ts.map +0 -1
- package/esm/src/agent/conversation-hosted-lifecycle.js +0 -138
- package/esm/src/agent/conversation-hosted-terminal.d.ts +0 -46
- package/esm/src/agent/conversation-hosted-terminal.d.ts.map +0 -1
- package/esm/src/agent/conversation-hosted-terminal.js +0 -138
- package/esm/src/agent/conversation-root-run-context.d.ts +0 -57
- package/esm/src/agent/conversation-root-run-context.d.ts.map +0 -1
- package/esm/src/agent/conversation-root-run-context.js +0 -79
- package/esm/src/agent/conversation-root-run-lifecycle.d.ts +0 -61
- package/esm/src/agent/conversation-root-run-lifecycle.d.ts.map +0 -1
- package/esm/src/agent/conversation-root-run-lifecycle.js +0 -94
- package/esm/src/agent/conversation-run-chunk-mirror.d.ts +0 -74
- package/esm/src/agent/conversation-run-chunk-mirror.d.ts.map +0 -1
- package/esm/src/agent/conversation-run-chunk-mirror.js +0 -188
- package/esm/src/agent/conversation-run-context.d.ts +0 -19
- package/esm/src/agent/conversation-run-context.d.ts.map +0 -1
- package/esm/src/agent/conversation-run-event-normalization.d.ts +0 -8
- package/esm/src/agent/conversation-run-event-normalization.d.ts.map +0 -1
- package/esm/src/agent/conversation-run-event-preparation.d.ts +0 -7
- package/esm/src/agent/conversation-run-event-preparation.d.ts.map +0 -1
- package/esm/src/agent/conversation-run-event-preparation.js +0 -48
- package/esm/src/agent/conversation-run-events.d.ts +0 -34
- package/esm/src/agent/conversation-run-events.d.ts.map +0 -1
- package/esm/src/agent/conversation-run-events.js +0 -200
- package/esm/src/agent/conversation-run-mirror.d.ts +0 -43
- package/esm/src/agent/conversation-run-mirror.d.ts.map +0 -1
- package/esm/src/agent/conversation-run-mirror.js +0 -157
- package/esm/src/agent/conversation-run-stream-mirror.d.ts +0 -21
- package/esm/src/agent/conversation-run-stream-mirror.d.ts.map +0 -1
- package/esm/src/agent/conversation-run-stream-mirror.js +0 -31
- package/esm/src/agent/hosted-ag-ui-chat-request.d.ts +0 -56
- package/esm/src/agent/hosted-ag-ui-chat-request.d.ts.map +0 -1
- package/esm/src/agent/hosted-ag-ui-chat-request.js +0 -112
- package/esm/src/agent/hosted-agent-project-steering.d.ts +0 -33
- package/esm/src/agent/hosted-agent-project-steering.d.ts.map +0 -1
- package/esm/src/agent/hosted-agent-project-steering.js +0 -73
- package/esm/src/agent/hosted-agent-run-lifecycle.d.ts +0 -60
- package/esm/src/agent/hosted-agent-run-lifecycle.d.ts.map +0 -1
- package/esm/src/agent/hosted-agent-run-lifecycle.js +0 -72
- package/esm/src/agent/hosted-chat-execution-runtime.d.ts +0 -127
- package/esm/src/agent/hosted-chat-execution-runtime.d.ts.map +0 -1
- package/esm/src/agent/hosted-chat-execution-runtime.js +0 -400
- package/esm/src/agent/hosted-chat-preparation.d.ts +0 -105
- package/esm/src/agent/hosted-chat-preparation.d.ts.map +0 -1
- package/esm/src/agent/hosted-chat-preparation.js +0 -156
- package/esm/src/agent/hosted-chat-request-parser.d.ts +0 -53
- package/esm/src/agent/hosted-chat-request-parser.d.ts.map +0 -1
- package/esm/src/agent/hosted-chat-request-parser.js +0 -105
- package/esm/src/agent/hosted-chat-request.d.ts +0 -305
- package/esm/src/agent/hosted-chat-request.d.ts.map +0 -1
- package/esm/src/agent/hosted-chat-request.js +0 -68
- package/esm/src/agent/hosted-chat-runtime-agent-adapter.d.ts +0 -14
- package/esm/src/agent/hosted-chat-runtime-agent-adapter.d.ts.map +0 -1
- package/esm/src/agent/hosted-chat-runtime-agent-adapter.js +0 -48
- package/esm/src/agent/hosted-chat-runtime-contract.d.ts +0 -86
- package/esm/src/agent/hosted-chat-runtime-contract.d.ts.map +0 -1
- package/esm/src/agent/hosted-chat-runtime-tool-assembly.d.ts +0 -51
- package/esm/src/agent/hosted-chat-runtime-tool-assembly.d.ts.map +0 -1
- package/esm/src/agent/hosted-chat-runtime-tool-assembly.js +0 -84
- package/esm/src/agent/hosted-child-artifact-support.d.ts +0 -25
- package/esm/src/agent/hosted-child-artifact-support.d.ts.map +0 -1
- package/esm/src/agent/hosted-child-artifact-support.js +0 -121
- package/esm/src/agent/hosted-child-bootstrap.d.ts +0 -40
- package/esm/src/agent/hosted-child-bootstrap.d.ts.map +0 -1
- package/esm/src/agent/hosted-child-bootstrap.js +0 -44
- package/esm/src/agent/hosted-child-execution-logging.d.ts +0 -35
- package/esm/src/agent/hosted-child-execution-logging.d.ts.map +0 -1
- package/esm/src/agent/hosted-child-execution-logging.js +0 -69
- package/esm/src/agent/hosted-child-fork-execution-runner.d.ts +0 -101
- package/esm/src/agent/hosted-child-fork-execution-runner.d.ts.map +0 -1
- package/esm/src/agent/hosted-child-fork-execution-runner.js +0 -205
- package/esm/src/agent/hosted-child-fork-instructions.d.ts +0 -8
- package/esm/src/agent/hosted-child-fork-instructions.d.ts.map +0 -1
- package/esm/src/agent/hosted-child-fork-run-context.d.ts +0 -88
- package/esm/src/agent/hosted-child-fork-run-context.d.ts.map +0 -1
- package/esm/src/agent/hosted-child-fork-run-context.js +0 -144
- package/esm/src/agent/hosted-child-fork-runtime-start.d.ts +0 -18
- package/esm/src/agent/hosted-child-fork-runtime-start.d.ts.map +0 -1
- package/esm/src/agent/hosted-child-fork-runtime-start.js +0 -41
- package/esm/src/agent/hosted-child-fork-step-message-preparation.d.ts +0 -19
- package/esm/src/agent/hosted-child-fork-step-message-preparation.d.ts.map +0 -1
- package/esm/src/agent/hosted-child-fork-step-message-preparation.js +0 -52
- package/esm/src/agent/hosted-child-fork-stream-execution.d.ts +0 -153
- package/esm/src/agent/hosted-child-fork-stream-execution.d.ts.map +0 -1
- package/esm/src/agent/hosted-child-fork-stream-execution.js +0 -416
- package/esm/src/agent/hosted-child-fork-tool-sources.d.ts +0 -46
- package/esm/src/agent/hosted-child-fork-tool-sources.d.ts.map +0 -1
- package/esm/src/agent/hosted-child-fork-tool-sources.js +0 -124
- package/esm/src/agent/hosted-child-invoke-tool.d.ts +0 -20
- package/esm/src/agent/hosted-child-invoke-tool.d.ts.map +0 -1
- package/esm/src/agent/hosted-child-invoke-tool.js +0 -49
- package/esm/src/agent/hosted-child-lifecycle.d.ts +0 -63
- package/esm/src/agent/hosted-child-lifecycle.d.ts.map +0 -1
- package/esm/src/agent/hosted-child-lifecycle.js +0 -192
- package/esm/src/agent/hosted-child-mirror.d.ts +0 -108
- package/esm/src/agent/hosted-child-mirror.d.ts.map +0 -1
- package/esm/src/agent/hosted-child-pending-tool-lifecycle.d.ts +0 -50
- package/esm/src/agent/hosted-child-pending-tool-lifecycle.d.ts.map +0 -1
- package/esm/src/agent/hosted-child-pending-tool-lifecycle.js +0 -119
- package/esm/src/agent/hosted-child-requested-tools.d.ts +0 -109
- package/esm/src/agent/hosted-child-requested-tools.d.ts.map +0 -1
- package/esm/src/agent/hosted-child-requested-tools.js +0 -233
- package/esm/src/agent/hosted-child-status.d.ts +0 -39
- package/esm/src/agent/hosted-child-status.d.ts.map +0 -1
- package/esm/src/agent/hosted-child-status.js +0 -98
- package/esm/src/agent/hosted-child-steering-tools.d.ts +0 -20
- package/esm/src/agent/hosted-child-steering-tools.d.ts.map +0 -1
- package/esm/src/agent/hosted-child-steering-tools.js +0 -53
- package/esm/src/agent/hosted-child-stream-watchdog.d.ts +0 -27
- package/esm/src/agent/hosted-child-stream-watchdog.d.ts.map +0 -1
- package/esm/src/agent/hosted-child-stream-watchdog.js +0 -95
- package/esm/src/agent/hosted-child-tool-input.d.ts +0 -44
- package/esm/src/agent/hosted-child-tool-input.d.ts.map +0 -1
- package/esm/src/agent/hosted-child-tool-input.js +0 -44
- package/esm/src/agent/hosted-durable-chat-run-start.d.ts +0 -46
- package/esm/src/agent/hosted-durable-chat-run-start.d.ts.map +0 -1
- package/esm/src/agent/hosted-durable-chat-run-start.js +0 -148
- package/esm/src/agent/hosted-durable-child-fork-execution.d.ts +0 -159
- package/esm/src/agent/hosted-durable-child-fork-execution.d.ts.map +0 -1
- package/esm/src/agent/hosted-durable-child-fork-execution.js +0 -324
- package/esm/src/agent/hosted-finalized-message.d.ts +0 -44
- package/esm/src/agent/hosted-finalized-message.d.ts.map +0 -1
- package/esm/src/agent/hosted-finalized-message.js +0 -67
- package/esm/src/agent/hosted-form-input-tool.d.ts +0 -85
- package/esm/src/agent/hosted-form-input-tool.d.ts.map +0 -1
- package/esm/src/agent/hosted-form-input-tool.js +0 -88
- package/esm/src/agent/hosted-lifecycle.d.ts +0 -41
- package/esm/src/agent/hosted-lifecycle.d.ts.map +0 -1
- package/esm/src/agent/hosted-project-remote-tool-source.d.ts +0 -45
- package/esm/src/agent/hosted-project-remote-tool-source.d.ts.map +0 -1
- package/esm/src/agent/hosted-project-remote-tool-source.js +0 -135
- package/esm/src/agent/hosted-project-steering-adapter.d.ts +0 -34
- package/esm/src/agent/hosted-project-steering-adapter.d.ts.map +0 -1
- package/esm/src/agent/hosted-project-steering-adapter.js +0 -82
- package/esm/src/agent/hosted-response-stream.d.ts +0 -22
- package/esm/src/agent/hosted-response-stream.d.ts.map +0 -1
- package/esm/src/agent/hosted-response-stream.js +0 -52
- package/esm/src/agent/hosted-runtime-request-config.d.ts +0 -27
- package/esm/src/agent/hosted-runtime-request-config.d.ts.map +0 -1
- package/esm/src/agent/hosted-runtime-request-config.js +0 -54
- package/esm/src/agent/hosted-runtime-state-resolver.d.ts +0 -28
- package/esm/src/agent/hosted-runtime-state-resolver.d.ts.map +0 -1
- package/esm/src/agent/hosted-runtime-state-resolver.js +0 -71
- package/esm/src/agent/hosted-stream-finalization.d.ts +0 -61
- package/esm/src/agent/hosted-stream-finalization.d.ts.map +0 -1
- package/esm/src/agent/hosted-stream-terminal-error.d.ts +0 -16
- package/esm/src/agent/hosted-stream-terminal-error.d.ts.map +0 -1
- package/esm/src/agent/hosted-stream-terminal-error.js +0 -54
- package/esm/src/agent/node-agent-service-runtime-infrastructure.d.ts +0 -26
- package/esm/src/agent/node-agent-service-runtime-infrastructure.d.ts.map +0 -1
- package/esm/src/agent/node-agent-service-runtime-infrastructure.js +0 -30
- package/esm/src/agent/node-agent-service-telemetry.d.ts +0 -44
- package/esm/src/agent/node-agent-service-telemetry.d.ts.map +0 -1
- package/esm/src/agent/runtime-ag-ui-contract.d.ts +0 -213
- package/esm/src/agent/runtime-ag-ui-contract.d.ts.map +0 -1
- package/esm/src/agent/runtime-ag-ui-contract.js +0 -134
- package/esm/src/agent/runtime-agent-definition-files.d.ts +0 -23
- package/esm/src/agent/runtime-agent-definition-files.d.ts.map +0 -1
- package/esm/src/agent/runtime-agent-definition-files.js +0 -79
- package/esm/src/agent/runtime-agent-definition.d.ts +0 -60
- package/esm/src/agent/runtime-agent-definition.d.ts.map +0 -1
- package/esm/src/agent/runtime-agent-definition.js +0 -105
- package/esm/src/agent/runtime-agent-invocation-contract.d.ts +0 -326
- package/esm/src/agent/runtime-agent-invocation-contract.d.ts.map +0 -1
- package/esm/src/agent/runtime-agent-invocation-contract.js +0 -212
- package/esm/src/agent/runtime-agent-markdown-adapter.d.ts +0 -6
- package/esm/src/agent/runtime-agent-markdown-adapter.d.ts.map +0 -1
- package/esm/src/agent/runtime-agent-markdown-adapter.js +0 -20
- package/esm/src/agent/runtime-builtin-skill-files.d.ts +0 -18
- package/esm/src/agent/runtime-builtin-skill-files.d.ts.map +0 -1
- package/esm/src/agent/runtime-builtin-skill-files.js +0 -82
- package/esm/src/agent/runtime-client-profile.d.ts +0 -26
- package/esm/src/agent/runtime-client-profile.d.ts.map +0 -1
- package/esm/src/agent/runtime-client-profile.js +0 -82
- package/esm/src/agent/runtime-load-skill-tool.d.ts +0 -43
- package/esm/src/agent/runtime-load-skill-tool.d.ts.map +0 -1
- package/esm/src/agent/runtime-load-skill-tool.js +0 -115
- package/esm/src/agent/runtime-message-file-url-refresh.d.ts +0 -9
- package/esm/src/agent/runtime-message-file-url-refresh.d.ts.map +0 -1
- package/esm/src/agent/runtime-message-preparation.d.ts +0 -10
- package/esm/src/agent/runtime-message-preparation.d.ts.map +0 -1
- package/esm/src/agent/runtime-message-preparation.js +0 -34
- package/esm/src/agent/runtime-project-files-client.d.ts +0 -50
- package/esm/src/agent/runtime-project-files-client.d.ts.map +0 -1
- package/esm/src/agent/runtime-project-files-client.js +0 -143
- package/esm/src/agent/runtime-project-skill-catalog.d.ts +0 -26
- package/esm/src/agent/runtime-project-skill-catalog.d.ts.map +0 -1
- package/esm/src/agent/runtime-project-skill-catalog.js +0 -148
- package/esm/src/agent/runtime-project-skill-loader.d.ts +0 -28
- package/esm/src/agent/runtime-project-skill-loader.d.ts.map +0 -1
- package/esm/src/agent/runtime-project-skill-loader.js +0 -122
- package/esm/src/agent/runtime-prompt-block.d.ts +0 -7
- package/esm/src/agent/runtime-prompt-block.d.ts.map +0 -1
- package/esm/src/agent/runtime-skill-metadata.d.ts +0 -75
- package/esm/src/agent/runtime-skill-metadata.d.ts.map +0 -1
- package/esm/src/agent/runtime-skill-metadata.js +0 -159
- package/esm/src/agent/runtime-skill-prompt.d.ts +0 -5
- package/esm/src/agent/runtime-skill-prompt.d.ts.map +0 -1
- package/esm/src/agent/runtime-skill-prompt.js +0 -40
- package/esm/src/agent/runtime-tool-inventory.d.ts +0 -4
- package/esm/src/agent/runtime-tool-inventory.d.ts.map +0 -1
- package/esm/src/agent/runtime-upload-url-client.d.ts +0 -13
- package/esm/src/agent/runtime-upload-url-client.d.ts.map +0 -1
- package/esm/src/agent/runtime-upload-url-client.js +0 -54
- package/src/deps/esm.sh/@types/react@19.2.3/global.d.ts +0 -165
- package/src/deps/esm.sh/@types/react@19.2.3/index.d.ts +0 -4301
- package/src/src/agent/ag-ui-browser-chunk-encoder.ts +0 -58
- package/src/src/agent/ag-ui-browser-encoder.ts +0 -538
- package/src/src/agent/ag-ui-browser-finalize-tracker.ts +0 -65
- package/src/src/agent/ag-ui-browser-response-stream.ts +0 -175
- package/src/src/agent/ag-ui-chat-ui-chunk-browser-encoder.ts +0 -172
- package/src/src/agent/ag-ui-chunk-encoder-bridge.ts +0 -34
- package/src/src/agent/ag-ui-detached-start.ts +0 -425
- package/src/src/agent/ag-ui-forwarded-context.ts +0 -83
- package/src/src/agent/ag-ui-handler.ts +0 -388
- package/src/src/agent/ag-ui-host-support.ts +0 -244
- package/src/src/agent/ag-ui-request-shared.ts +0 -76
- package/src/src/agent/ag-ui-run-control.ts +0 -145
- package/src/src/agent/ag-ui-runtime-browser-response.ts +0 -41
- package/src/src/agent/ag-ui-runtime-chat-stream-encoder.ts +0 -359
- package/src/src/agent/ag-ui-runtime-event-encoder.ts +0 -71
- package/src/src/agent/ag-ui-runtime-handler.ts +0 -510
- package/src/src/agent/ag-ui-runtime-support.ts +0 -64
- package/src/src/agent/ag-ui-sse-parser.ts +0 -306
- package/src/src/agent/ag-ui-tool-shared.ts +0 -80
- package/src/src/agent/ag-ui-tracked-browser-response.ts +0 -42
- package/src/src/agent/agent-service-bootstrap.ts +0 -79
- package/src/src/agent/agent-service-env-files.ts +0 -60
- package/src/src/agent/agent-service-mcp-server-config.ts +0 -112
- package/src/src/agent/agent-service-registration.ts +0 -320
- package/src/src/agent/agent-service-routes.ts +0 -389
- package/src/src/agent/agent-service-runtime.ts +0 -303
- package/src/src/agent/agent-service-server.ts +0 -98
- package/src/src/agent/agent-service.ts +0 -386
- package/src/src/agent/conversation-bootstrap.ts +0 -335
- package/src/src/agent/conversation-delegation-policy.ts +0 -299
- package/src/src/agent/conversation-hosted-lifecycle.ts +0 -215
- package/src/src/agent/conversation-hosted-terminal.ts +0 -235
- package/src/src/agent/conversation-root-run-context.ts +0 -143
- package/src/src/agent/conversation-root-run-lifecycle.ts +0 -184
- package/src/src/agent/conversation-run-chunk-mirror.ts +0 -353
- package/src/src/agent/conversation-run-context.ts +0 -22
- package/src/src/agent/conversation-run-event-preparation.ts +0 -76
- package/src/src/agent/conversation-run-events.ts +0 -242
- package/src/src/agent/conversation-run-mirror.ts +0 -235
- package/src/src/agent/conversation-run-stream-mirror.ts +0 -59
- package/src/src/agent/hosted-ag-ui-chat-request.ts +0 -197
- package/src/src/agent/hosted-agent-project-steering.ts +0 -129
- package/src/src/agent/hosted-agent-run-lifecycle.ts +0 -161
- package/src/src/agent/hosted-chat-execution-runtime.ts +0 -703
- package/src/src/agent/hosted-chat-preparation.ts +0 -357
- package/src/src/agent/hosted-chat-request-parser.ts +0 -209
- package/src/src/agent/hosted-chat-request.ts +0 -112
- package/src/src/agent/hosted-chat-runtime-agent-adapter.ts +0 -88
- package/src/src/agent/hosted-chat-runtime-contract.ts +0 -101
- package/src/src/agent/hosted-chat-runtime-tool-assembly.ts +0 -183
- package/src/src/agent/hosted-child-artifact-support.ts +0 -201
- package/src/src/agent/hosted-child-bootstrap.ts +0 -75
- package/src/src/agent/hosted-child-execution-logging.ts +0 -114
- package/src/src/agent/hosted-child-fork-execution-runner.ts +0 -393
- package/src/src/agent/hosted-child-fork-run-context.ts +0 -312
- package/src/src/agent/hosted-child-fork-runtime-start.ts +0 -84
- package/src/src/agent/hosted-child-fork-step-message-preparation.ts +0 -96
- package/src/src/agent/hosted-child-fork-stream-execution.ts +0 -626
- package/src/src/agent/hosted-child-fork-tool-sources.ts +0 -223
- package/src/src/agent/hosted-child-invoke-tool.ts +0 -90
- package/src/src/agent/hosted-child-lifecycle.ts +0 -352
- package/src/src/agent/hosted-child-mirror.ts +0 -272
- package/src/src/agent/hosted-child-pending-tool-lifecycle.ts +0 -191
- package/src/src/agent/hosted-child-requested-tools.ts +0 -411
- package/src/src/agent/hosted-child-status.ts +0 -167
- package/src/src/agent/hosted-child-steering-tools.ts +0 -92
- package/src/src/agent/hosted-child-stream-watchdog.ts +0 -146
- package/src/src/agent/hosted-child-tool-input.ts +0 -91
- package/src/src/agent/hosted-durable-chat-run-start.ts +0 -246
- package/src/src/agent/hosted-durable-child-fork-execution.ts +0 -597
- package/src/src/agent/hosted-finalized-message.ts +0 -170
- package/src/src/agent/hosted-form-input-tool.ts +0 -128
- package/src/src/agent/hosted-project-remote-tool-source.ts +0 -262
- package/src/src/agent/hosted-project-steering-adapter.ts +0 -184
- package/src/src/agent/hosted-response-stream.ts +0 -87
- package/src/src/agent/hosted-runtime-request-config.ts +0 -112
- package/src/src/agent/hosted-runtime-state-resolver.ts +0 -133
- package/src/src/agent/hosted-stream-finalization.ts +0 -188
- package/src/src/agent/hosted-stream-terminal-error.ts +0 -81
- package/src/src/agent/node-agent-service-runtime-infrastructure.ts +0 -71
- package/src/src/agent/runtime-ag-ui-contract.ts +0 -216
- package/src/src/agent/runtime-agent-definition-files.ts +0 -128
- package/src/src/agent/runtime-agent-definition.ts +0 -163
- package/src/src/agent/runtime-agent-invocation-contract.ts +0 -355
- package/src/src/agent/runtime-agent-markdown-adapter.ts +0 -31
- package/src/src/agent/runtime-builtin-skill-files.ts +0 -122
- package/src/src/agent/runtime-client-profile.ts +0 -123
- package/src/src/agent/runtime-load-skill-tool.ts +0 -239
- package/src/src/agent/runtime-message-file-url-refresh.ts +0 -120
- package/src/src/agent/runtime-message-preparation.ts +0 -58
- package/src/src/agent/runtime-project-files-client.ts +0 -256
- package/src/src/agent/runtime-project-skill-catalog.ts +0 -238
- package/src/src/agent/runtime-project-skill-loader.ts +0 -217
- package/src/src/agent/runtime-skill-metadata.ts +0 -260
- package/src/src/agent/runtime-skill-prompt.ts +0 -61
- package/src/src/agent/runtime-tool-inventory.ts +0 -46
- package/src/src/agent/runtime-upload-url-client.ts +0 -95
- /package/esm/src/agent/{ag-ui-browser-response-stream.js → ag-ui/browser-response-stream.js} +0 -0
- /package/esm/src/agent/{ag-ui-runtime-support.js → ag-ui/runtime-support.js} +0 -0
- /package/esm/src/agent/{child-run-execution-cleanup.js → child-run/execution-cleanup.js} +0 -0
- /package/esm/src/agent/{child-run-execution-snapshot.js → child-run/execution-snapshot.js} +0 -0
- /package/esm/src/agent/{child-run-execution-support.js → child-run/execution-support.js} +0 -0
- /package/esm/src/agent/{child-run-final-step-support.js → child-run/final-step-support.js} +0 -0
- /package/esm/src/agent/{child-run-result-summary.js → child-run/result-summary.js} +0 -0
- /package/esm/src/agent/{conversation-run-context.js → conversation/run-context.js} +0 -0
- /package/esm/src/agent/{conversation-run-event-normalization.js → conversation/run-event-normalization.js} +0 -0
- /package/esm/src/agent/{hosted-chat-runtime-contract.js → hosted/chat-runtime-contract.js} +0 -0
- /package/esm/src/agent/{hosted-child-fork-instructions.js → hosted/child-fork-instructions.js} +0 -0
- /package/esm/src/agent/{hosted-child-mirror.js → hosted/child-mirror.js} +0 -0
- /package/esm/src/agent/{hosted-lifecycle.js → hosted/lifecycle.js} +0 -0
- /package/esm/src/agent/{hosted-stream-finalization.js → hosted/stream-finalization.js} +0 -0
- /package/esm/src/agent/{runtime-message-file-url-refresh.js → runtime/message-file-url-refresh.js} +0 -0
- /package/esm/src/agent/{runtime-prompt-block.js → runtime/prompt-block.js} +0 -0
- /package/esm/src/agent/{runtime-tool-inventory.js → runtime/tool-inventory.js} +0 -0
- /package/esm/src/agent/{agent-service-auth.js → service/auth.js} +0 -0
- /package/esm/src/agent/{agent-service-config.js → service/config.js} +0 -0
- /package/esm/src/agent/{agent-service.js → service/definition.js} +0 -0
- /package/esm/src/agent/{node-agent-service-telemetry.js → service/node-telemetry.js} +0 -0
- /package/src/src/agent/{child-run-execution-cleanup.ts → child-run/execution-cleanup.ts} +0 -0
- /package/src/src/agent/{child-run-execution-snapshot.ts → child-run/execution-snapshot.ts} +0 -0
- /package/src/src/agent/{child-run-execution-support.ts → child-run/execution-support.ts} +0 -0
- /package/src/src/agent/{child-run-final-step-support.ts → child-run/final-step-support.ts} +0 -0
- /package/src/src/agent/{child-run-result-summary.ts → child-run/result-summary.ts} +0 -0
- /package/src/src/agent/{conversation-run-event-normalization.ts → conversation/run-event-normalization.ts} +0 -0
- /package/src/src/agent/{hosted-child-fork-instructions.ts → hosted/child-fork-instructions.ts} +0 -0
- /package/src/src/agent/{hosted-lifecycle.ts → hosted/lifecycle.ts} +0 -0
- /package/src/src/agent/{runtime-prompt-block.ts → runtime/prompt-block.ts} +0 -0
- /package/src/src/agent/{agent-service-auth.ts → service/auth.ts} +0 -0
- /package/src/src/agent/{agent-service-config.ts → service/config.ts} +0 -0
- /package/src/src/agent/{node-agent-service-telemetry.ts → service/node-telemetry.ts} +0 -0
|
@@ -0,0 +1,703 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildChatStreamChunkMessageMetadata,
|
|
3
|
+
extractChatMessageMetadata,
|
|
4
|
+
} from "../../chat/chat-ui-message-helpers.js";
|
|
5
|
+
import { getLastStreamStep } from "../../chat/final-step-fallback.js";
|
|
6
|
+
import type { ChatUiMessage, ChatUiMessageChunk, MessageMetadata } from "../../chat/types.js";
|
|
7
|
+
import type { HostedConversationRootRunContext } from "../conversation/root-run-lifecycle.js";
|
|
8
|
+
import {
|
|
9
|
+
createHostedAgentRunSpanController,
|
|
10
|
+
createHostedRootRunLifecycleRuntimeAdapter,
|
|
11
|
+
type CreateHostedRootRunLifecycleRuntimeAdapterInput,
|
|
12
|
+
type HostedAgentRunSpanController,
|
|
13
|
+
type HostedAgentRunTracer,
|
|
14
|
+
} from "./agent-run-lifecycle.js";
|
|
15
|
+
import {
|
|
16
|
+
buildDetachedFallbackChunks,
|
|
17
|
+
buildDetachedFallbackMessageState,
|
|
18
|
+
buildFinalizedMessageFallbackChunks,
|
|
19
|
+
buildFinalizedMessageState,
|
|
20
|
+
} from "./finalized-message.js";
|
|
21
|
+
import type {
|
|
22
|
+
HostedChatRuntimeAgent,
|
|
23
|
+
HostedChatRuntimeStreamInput,
|
|
24
|
+
HostedChatRuntimeStreamResult,
|
|
25
|
+
HostedChatRuntimeToUiMessageStreamOptions,
|
|
26
|
+
} from "./chat-runtime-contract.js";
|
|
27
|
+
import type { HostedLifecycleTerminalState } from "./lifecycle.js";
|
|
28
|
+
import {
|
|
29
|
+
type ConversationHostedTerminalRuntimeAdapter,
|
|
30
|
+
type ConversationHostedTerminalStateInput,
|
|
31
|
+
dispatchConversationHostedStreamErrorState,
|
|
32
|
+
dispatchConversationHostedTerminalState,
|
|
33
|
+
resolveConversationHostedTerminalState,
|
|
34
|
+
toConversationHostedTerminalState,
|
|
35
|
+
} from "../conversation/hosted-terminal.js";
|
|
36
|
+
import {
|
|
37
|
+
createHostedMirroredUiStream,
|
|
38
|
+
createMirroredToolChunkState,
|
|
39
|
+
type MirroredToolChunkState,
|
|
40
|
+
} from "../mirrored-tool-chunk-state.js";
|
|
41
|
+
import {
|
|
42
|
+
finalizeHostedDetached,
|
|
43
|
+
finalizeHostedResponse,
|
|
44
|
+
type FinalizeHostedResponseOptions,
|
|
45
|
+
type HostedDetachedFinalizationState,
|
|
46
|
+
type HostedResponseFinalizationState,
|
|
47
|
+
} from "./stream-finalization.js";
|
|
48
|
+
import {
|
|
49
|
+
getEmptyHostedFinalizedMessageTerminalError,
|
|
50
|
+
getHostedStreamErrorText,
|
|
51
|
+
shouldFailEmptyHostedFinalizedMessage,
|
|
52
|
+
} from "./stream-terminal-error.js";
|
|
53
|
+
import type { ConversationRunChunkMirror } from "../conversation/run-chunk-mirror.js";
|
|
54
|
+
import type { BuildChatStreamChunkMessageMetadataInput } from "../../chat/chat-ui-message-helpers.js";
|
|
55
|
+
import { createChatStreamWatchdog } from "../../chat/stream-watchdog.js";
|
|
56
|
+
|
|
57
|
+
const INCOMPLETE_TOOL_CALLS_PART_ERROR_TEXT = "Assistant ended before tool execution completed";
|
|
58
|
+
|
|
59
|
+
const FINALIZATION_TERMINAL_STATE_FALLBACK_MODEL_ID = "";
|
|
60
|
+
|
|
61
|
+
export interface HostedChatExecutionRuntime {
|
|
62
|
+
agentUIStream: AsyncIterable<ChatUiMessageChunk<MessageMetadata>>;
|
|
63
|
+
fail: (error: unknown) => Promise<void>;
|
|
64
|
+
waitForFinish: () => Promise<void>;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface HostedChatExecutionRuntimeLogger {
|
|
68
|
+
error: (message: string, metadata?: Record<string, unknown>) => void;
|
|
69
|
+
warn: (message: string, metadata?: Record<string, unknown>) => void;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export interface HostedChatExecutionRunContext {
|
|
73
|
+
withContext: <T>(fn: () => T) => T;
|
|
74
|
+
setMessageId?: (messageId: string) => void;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface HostedChatExecutionLifecycleAdapter
|
|
78
|
+
extends ConversationHostedTerminalRuntimeAdapter {
|
|
79
|
+
durableRootRun: {
|
|
80
|
+
runId: string;
|
|
81
|
+
messageId?: string | null;
|
|
82
|
+
} | null;
|
|
83
|
+
durableRunMirror: ConversationRunChunkMirror | null;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export type HostedChatExecutionRootStreamWatchdog = ReturnType<typeof createChatStreamWatchdog>;
|
|
87
|
+
|
|
88
|
+
export interface HostedChatExecutionRuntimeBootstrap {
|
|
89
|
+
cleanup: () => Promise<void>;
|
|
90
|
+
lifecycleAdapter: HostedChatExecutionLifecycleAdapter;
|
|
91
|
+
rootStreamWatchdog: HostedChatExecutionRootStreamWatchdog;
|
|
92
|
+
streamResult: HostedChatRuntimeStreamResult;
|
|
93
|
+
streamingMessageId: string | null;
|
|
94
|
+
capturedMessageId: string | null;
|
|
95
|
+
capturedConversationId?: string;
|
|
96
|
+
mirroredToolChunkState: MirroredToolChunkState;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface CreateHostedChatExecutionRuntimeBootstrapInput {
|
|
100
|
+
agent: HostedChatRuntimeAgent;
|
|
101
|
+
cleanup: () => Promise<void>;
|
|
102
|
+
lifecycleAdapter: HostedChatExecutionLifecycleAdapter;
|
|
103
|
+
finalMessages: HostedChatRuntimeStreamInput["messages"];
|
|
104
|
+
conversationId?: string;
|
|
105
|
+
abortSignal: AbortSignal;
|
|
106
|
+
traceStream?: <T>(operation: () => Promise<T>) => Promise<T>;
|
|
107
|
+
createRootStreamWatchdog?: () => HostedChatExecutionRootStreamWatchdog;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export interface CreateHostedChatExecutionRuntimeInput {
|
|
111
|
+
agentId: string;
|
|
112
|
+
modelId: string;
|
|
113
|
+
originalMessages: ChatUiMessage[];
|
|
114
|
+
responseMessageId?: string;
|
|
115
|
+
runContext: HostedChatExecutionRunContext;
|
|
116
|
+
abortSignal: AbortSignal;
|
|
117
|
+
bootstrap: HostedChatExecutionRuntimeBootstrap;
|
|
118
|
+
logger?: HostedChatExecutionRuntimeLogger;
|
|
119
|
+
incompleteToolCallsPartErrorText?: string;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export interface CreateBootstrappedHostedChatExecutionRuntimeInput {
|
|
123
|
+
authToken: string;
|
|
124
|
+
apiUrl: string;
|
|
125
|
+
agent: HostedChatRuntimeAgent;
|
|
126
|
+
agentId: string;
|
|
127
|
+
modelId: string;
|
|
128
|
+
cleanup: () => Promise<void>;
|
|
129
|
+
messages: ChatUiMessage[];
|
|
130
|
+
finalMessages: HostedChatRuntimeStreamInput["messages"];
|
|
131
|
+
conversationId?: string;
|
|
132
|
+
projectId: string | null;
|
|
133
|
+
userId: string;
|
|
134
|
+
rootRunContext: HostedConversationRootRunContext;
|
|
135
|
+
abortSignal: AbortSignal;
|
|
136
|
+
responseMessageId?: string;
|
|
137
|
+
upstreamParentConversationId?: string;
|
|
138
|
+
upstreamParentRunId?: string;
|
|
139
|
+
spawnedFromToolCallId?: string;
|
|
140
|
+
tracer: HostedAgentRunTracer;
|
|
141
|
+
resolveProvider: (modelId: string) => string;
|
|
142
|
+
traceStream?: CreateHostedChatExecutionRuntimeBootstrapInput["traceStream"];
|
|
143
|
+
logger?: HostedChatExecutionRuntimeLogger;
|
|
144
|
+
spanName?: string;
|
|
145
|
+
terminalErrorCode?: string;
|
|
146
|
+
incompleteToolCallsPartErrorText?: string;
|
|
147
|
+
createRootStreamWatchdog?: CreateHostedChatExecutionRuntimeBootstrapInput[
|
|
148
|
+
"createRootStreamWatchdog"
|
|
149
|
+
];
|
|
150
|
+
createTerminalAdapter?: CreateHostedRootRunLifecycleRuntimeAdapterInput[
|
|
151
|
+
"createTerminalAdapter"
|
|
152
|
+
];
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export interface BootstrappedHostedChatExecutionRuntime {
|
|
156
|
+
agentRunSpan: HostedAgentRunSpanController;
|
|
157
|
+
execution: HostedChatExecutionRuntime;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
type SharedFinalizationHooks = Pick<
|
|
161
|
+
FinalizeHostedResponseOptions<ChatUiMessage, ChatUiMessageChunk<MessageMetadata>>,
|
|
162
|
+
| "resolveEmptyTerminalError"
|
|
163
|
+
| "appendFallbackChunk"
|
|
164
|
+
| "flushMirror"
|
|
165
|
+
| "dispatchTerminalState"
|
|
166
|
+
| "resolveTerminalState"
|
|
167
|
+
| "cleanup"
|
|
168
|
+
| "streamError"
|
|
169
|
+
>;
|
|
170
|
+
|
|
171
|
+
export function toHostedChatExecutionFinalState(
|
|
172
|
+
input: ConversationHostedTerminalStateInput,
|
|
173
|
+
): HostedLifecycleTerminalState {
|
|
174
|
+
return toConversationHostedTerminalState({
|
|
175
|
+
state: input,
|
|
176
|
+
fallbackModelId: FINALIZATION_TERMINAL_STATE_FALLBACK_MODEL_ID,
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export async function cleanupAfterHostedChatExecutionFinalization(input: {
|
|
181
|
+
cleanup: () => Promise<void>;
|
|
182
|
+
logger?: HostedChatExecutionRuntimeLogger;
|
|
183
|
+
}): Promise<void> {
|
|
184
|
+
await input.cleanup().catch((cleanupError: unknown) => {
|
|
185
|
+
input.logger?.error("Runtime cleanup failed during finalization", {
|
|
186
|
+
error: cleanupError instanceof Error ? cleanupError.message : String(cleanupError),
|
|
187
|
+
});
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
function createHostedChatExecutionCleanup(cleanup: () => Promise<void>): () => Promise<void> {
|
|
192
|
+
let cleanedUp = false;
|
|
193
|
+
|
|
194
|
+
return async () => {
|
|
195
|
+
if (cleanedUp) {
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
cleanedUp = true;
|
|
200
|
+
await cleanup();
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
function createDefaultHostedChatExecutionRootStreamWatchdog(): HostedChatExecutionRootStreamWatchdog {
|
|
205
|
+
return createChatStreamWatchdog();
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
function traceHostedChatRuntimeStream<T>(
|
|
209
|
+
traceStream: CreateHostedChatExecutionRuntimeBootstrapInput["traceStream"],
|
|
210
|
+
operation: () => Promise<T>,
|
|
211
|
+
): Promise<T> {
|
|
212
|
+
if (!traceStream) {
|
|
213
|
+
return operation();
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
return traceStream(operation);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export async function createHostedChatExecutionRuntimeBootstrap(
|
|
220
|
+
input: CreateHostedChatExecutionRuntimeBootstrapInput,
|
|
221
|
+
): Promise<HostedChatExecutionRuntimeBootstrap> {
|
|
222
|
+
const cleanup = createHostedChatExecutionCleanup(input.cleanup);
|
|
223
|
+
const streamingMessageId = input.lifecycleAdapter.durableRootRun?.messageId ?? null;
|
|
224
|
+
if (input.conversationId && !streamingMessageId) {
|
|
225
|
+
throw new Error("DURABLE_CHAT_ROOT_REQUIRES_CONVERSATION");
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
const rootStreamWatchdog = input.createRootStreamWatchdog
|
|
229
|
+
? input.createRootStreamWatchdog()
|
|
230
|
+
: createDefaultHostedChatExecutionRootStreamWatchdog();
|
|
231
|
+
const streamAbortSignal = AbortSignal.any([input.abortSignal, rootStreamWatchdog.signal]);
|
|
232
|
+
|
|
233
|
+
let streamResult: HostedChatRuntimeStreamResult;
|
|
234
|
+
try {
|
|
235
|
+
streamResult = await traceHostedChatRuntimeStream(
|
|
236
|
+
input.traceStream,
|
|
237
|
+
() =>
|
|
238
|
+
input.agent.stream({
|
|
239
|
+
messages: input.finalMessages,
|
|
240
|
+
abortSignal: streamAbortSignal,
|
|
241
|
+
}),
|
|
242
|
+
);
|
|
243
|
+
} catch (error) {
|
|
244
|
+
rootStreamWatchdog.dispose();
|
|
245
|
+
throw error;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
return {
|
|
249
|
+
cleanup,
|
|
250
|
+
lifecycleAdapter: input.lifecycleAdapter,
|
|
251
|
+
rootStreamWatchdog,
|
|
252
|
+
streamResult,
|
|
253
|
+
streamingMessageId,
|
|
254
|
+
capturedMessageId: streamingMessageId,
|
|
255
|
+
...(input.conversationId ? { capturedConversationId: input.conversationId } : {}),
|
|
256
|
+
mirroredToolChunkState: createMirroredToolChunkState(),
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
async function createBootstrappedHostedChatRuntime(
|
|
261
|
+
input: CreateBootstrappedHostedChatExecutionRuntimeInput,
|
|
262
|
+
agentRunSpan: HostedAgentRunSpanController,
|
|
263
|
+
): Promise<HostedChatExecutionRuntime> {
|
|
264
|
+
const lifecycleAdapter = createHostedRootRunLifecycleRuntimeAdapter({
|
|
265
|
+
authToken: input.authToken,
|
|
266
|
+
apiUrl: input.apiUrl,
|
|
267
|
+
modelId: input.modelId,
|
|
268
|
+
durableRootRun: input.rootRunContext.durableRootRun,
|
|
269
|
+
durableRunMirror: input.rootRunContext.durableRunMirror,
|
|
270
|
+
agentRunSpan,
|
|
271
|
+
resolveProvider: input.resolveProvider,
|
|
272
|
+
...(input.createTerminalAdapter ? { createTerminalAdapter: input.createTerminalAdapter } : {}),
|
|
273
|
+
});
|
|
274
|
+
const bootstrap = await createHostedChatExecutionRuntimeBootstrap({
|
|
275
|
+
agent: input.agent,
|
|
276
|
+
cleanup: input.cleanup,
|
|
277
|
+
lifecycleAdapter,
|
|
278
|
+
finalMessages: input.finalMessages,
|
|
279
|
+
conversationId: input.conversationId,
|
|
280
|
+
abortSignal: input.abortSignal,
|
|
281
|
+
traceStream: input.traceStream,
|
|
282
|
+
...(input.createRootStreamWatchdog
|
|
283
|
+
? { createRootStreamWatchdog: input.createRootStreamWatchdog }
|
|
284
|
+
: {}),
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
return createHostedChatExecutionRuntime({
|
|
288
|
+
agentId: input.agentId,
|
|
289
|
+
modelId: input.modelId,
|
|
290
|
+
originalMessages: input.messages,
|
|
291
|
+
responseMessageId: input.responseMessageId,
|
|
292
|
+
runContext: agentRunSpan,
|
|
293
|
+
abortSignal: input.abortSignal,
|
|
294
|
+
bootstrap,
|
|
295
|
+
logger: input.logger,
|
|
296
|
+
incompleteToolCallsPartErrorText: input.incompleteToolCallsPartErrorText,
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
export async function createBootstrappedHostedChatExecutionRuntime(
|
|
301
|
+
input: CreateBootstrappedHostedChatExecutionRuntimeInput,
|
|
302
|
+
): Promise<BootstrappedHostedChatExecutionRuntime> {
|
|
303
|
+
const agentRunSpan = createHostedAgentRunSpanController({
|
|
304
|
+
tracer: input.tracer,
|
|
305
|
+
spanName: input.spanName,
|
|
306
|
+
operationName: "chat",
|
|
307
|
+
conversationId: input.conversationId,
|
|
308
|
+
projectId: input.projectId,
|
|
309
|
+
userId: input.userId,
|
|
310
|
+
agentId: input.agentId,
|
|
311
|
+
rootRun: input.rootRunContext.durableRootRun,
|
|
312
|
+
upstreamParentConversationId: input.upstreamParentConversationId,
|
|
313
|
+
upstreamParentRunId: input.upstreamParentRunId,
|
|
314
|
+
spawnedFromToolCallId: input.spawnedFromToolCallId,
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
try {
|
|
318
|
+
const execution = await agentRunSpan.withContext(() =>
|
|
319
|
+
createBootstrappedHostedChatRuntime(input, agentRunSpan)
|
|
320
|
+
);
|
|
321
|
+
return { agentRunSpan, execution };
|
|
322
|
+
} catch (error) {
|
|
323
|
+
agentRunSpan.finalize({
|
|
324
|
+
status: "failed",
|
|
325
|
+
modelId: input.modelId,
|
|
326
|
+
terminalErrorCode: input.terminalErrorCode ?? "STREAM_ERROR",
|
|
327
|
+
terminalErrorMessage: error instanceof Error ? error.message : String(error),
|
|
328
|
+
});
|
|
329
|
+
throw error;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
export function createHostedChatStreamFinalizationHooks(input: {
|
|
334
|
+
lifecycleAdapter: HostedChatExecutionLifecycleAdapter;
|
|
335
|
+
cleanup: () => Promise<void>;
|
|
336
|
+
streamError: unknown;
|
|
337
|
+
logger?: HostedChatExecutionRuntimeLogger;
|
|
338
|
+
}): SharedFinalizationHooks {
|
|
339
|
+
return {
|
|
340
|
+
resolveEmptyTerminalError: (
|
|
341
|
+
{ finalStep, streamError }: { finalStep: unknown; streamError?: unknown | null },
|
|
342
|
+
) => getEmptyHostedFinalizedMessageTerminalError({ finalStep, streamError }),
|
|
343
|
+
appendFallbackChunk: (chunk: ChatUiMessageChunk<MessageMetadata>) =>
|
|
344
|
+
input.lifecycleAdapter.durableRunMirror?.handleChunk(chunk),
|
|
345
|
+
flushMirror: () => input.lifecycleAdapter.durableRunMirror?.flush(),
|
|
346
|
+
dispatchTerminalState: async (terminalState) => {
|
|
347
|
+
await dispatchConversationHostedTerminalState(input.lifecycleAdapter, terminalState);
|
|
348
|
+
},
|
|
349
|
+
resolveTerminalState: ({ isAborted, hasIncompleteToolParts }: {
|
|
350
|
+
isAborted: boolean;
|
|
351
|
+
hasIncompleteToolParts: boolean;
|
|
352
|
+
}) =>
|
|
353
|
+
toHostedChatExecutionFinalState(
|
|
354
|
+
resolveConversationHostedTerminalState({ isAborted, hasIncompleteToolParts }),
|
|
355
|
+
),
|
|
356
|
+
cleanup: () =>
|
|
357
|
+
cleanupAfterHostedChatExecutionFinalization({
|
|
358
|
+
cleanup: input.cleanup,
|
|
359
|
+
logger: input.logger,
|
|
360
|
+
}),
|
|
361
|
+
streamError: input.streamError,
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
export function createHostedChatFinalizeResponseBuildState(input: {
|
|
366
|
+
responseMessage: ChatUiMessage;
|
|
367
|
+
isAborted: boolean;
|
|
368
|
+
lifecycleAdapter: HostedChatExecutionLifecycleAdapter;
|
|
369
|
+
mirroredToolChunkState: MirroredToolChunkState;
|
|
370
|
+
capturedMessageId: string | null;
|
|
371
|
+
incompleteToolCallsPartErrorText: string;
|
|
372
|
+
}): (
|
|
373
|
+
finalStep: unknown,
|
|
374
|
+
) => Promise<HostedResponseFinalizationState<ChatUiMessage, ChatUiMessageChunk<MessageMetadata>>> {
|
|
375
|
+
return async (finalStep) => {
|
|
376
|
+
const { persistedMessage, sanitizedFinalizedMessage, hasIncompleteFinalizedToolParts } =
|
|
377
|
+
buildFinalizedMessageState({
|
|
378
|
+
responseMessage: input.responseMessage,
|
|
379
|
+
isAborted: input.isAborted,
|
|
380
|
+
finalStep,
|
|
381
|
+
incompleteToolCallsPartErrorText: input.incompleteToolCallsPartErrorText,
|
|
382
|
+
});
|
|
383
|
+
|
|
384
|
+
return {
|
|
385
|
+
persistedMessage,
|
|
386
|
+
finalizedMessage: sanitizedFinalizedMessage,
|
|
387
|
+
fallbackChunks:
|
|
388
|
+
sanitizedFinalizedMessage.parts.length > 0 && input.lifecycleAdapter.durableRunMirror
|
|
389
|
+
? buildFinalizedMessageFallbackChunks({
|
|
390
|
+
persistedMessage,
|
|
391
|
+
sanitizedFinalizedMessage,
|
|
392
|
+
finalStep,
|
|
393
|
+
mirroredToolChunkState: input.mirroredToolChunkState,
|
|
394
|
+
capturedMessageId: input.capturedMessageId,
|
|
395
|
+
hasIncompleteFinalizedToolParts,
|
|
396
|
+
})
|
|
397
|
+
: [],
|
|
398
|
+
hasIncompleteToolParts: hasIncompleteFinalizedToolParts,
|
|
399
|
+
metadata: extractChatMessageMetadata(sanitizedFinalizedMessage.metadata),
|
|
400
|
+
};
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
export function createHostedChatFinalizeDetachedBuildState(input: {
|
|
405
|
+
capturedMessageId: string | null;
|
|
406
|
+
isAborted: boolean;
|
|
407
|
+
lifecycleAdapter: HostedChatExecutionLifecycleAdapter;
|
|
408
|
+
mirroredToolChunkState: MirroredToolChunkState;
|
|
409
|
+
mirroredDurableOutput: boolean;
|
|
410
|
+
incompleteToolCallsPartErrorText: string;
|
|
411
|
+
}): (
|
|
412
|
+
finalStep: unknown,
|
|
413
|
+
) => Promise<HostedDetachedFinalizationState<ChatUiMessageChunk<MessageMetadata>>> {
|
|
414
|
+
return async (finalStep) => {
|
|
415
|
+
const { finalizedFallbackMessage, hasIncompleteFallbackToolParts } =
|
|
416
|
+
buildDetachedFallbackMessageState({
|
|
417
|
+
capturedMessageId: input.capturedMessageId,
|
|
418
|
+
finalStep,
|
|
419
|
+
isAborted: input.isAborted,
|
|
420
|
+
incompleteToolCallsPartErrorText: input.incompleteToolCallsPartErrorText,
|
|
421
|
+
});
|
|
422
|
+
const fallbackParts = finalizedFallbackMessage.parts;
|
|
423
|
+
|
|
424
|
+
return {
|
|
425
|
+
hasContent: fallbackParts.length > 0,
|
|
426
|
+
fallbackChunks: fallbackParts.length > 0 && input.lifecycleAdapter.durableRunMirror &&
|
|
427
|
+
input.capturedMessageId
|
|
428
|
+
? buildDetachedFallbackChunks({
|
|
429
|
+
fallbackParts,
|
|
430
|
+
finalStep,
|
|
431
|
+
mirroredToolChunkState: input.mirroredToolChunkState,
|
|
432
|
+
mirroredDurableOutput: input.mirroredDurableOutput,
|
|
433
|
+
capturedMessageId: input.capturedMessageId,
|
|
434
|
+
hasIncompleteFallbackToolParts,
|
|
435
|
+
})
|
|
436
|
+
: [],
|
|
437
|
+
hasIncompleteToolParts: hasIncompleteFallbackToolParts,
|
|
438
|
+
};
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
async function finalizeExecutionFailure(input: {
|
|
443
|
+
lifecycleAdapter: HostedChatExecutionLifecycleAdapter;
|
|
444
|
+
error: unknown;
|
|
445
|
+
conversationId?: string;
|
|
446
|
+
runId?: string;
|
|
447
|
+
logMessage: string;
|
|
448
|
+
logger?: HostedChatExecutionRuntimeLogger;
|
|
449
|
+
}): Promise<void> {
|
|
450
|
+
await dispatchConversationHostedStreamErrorState(input.lifecycleAdapter, input.error).catch(
|
|
451
|
+
(finalizeError) => {
|
|
452
|
+
input.logger?.error(input.logMessage, {
|
|
453
|
+
conversationId: input.conversationId,
|
|
454
|
+
runId: input.runId,
|
|
455
|
+
error: finalizeError instanceof Error ? finalizeError.message : String(finalizeError),
|
|
456
|
+
});
|
|
457
|
+
},
|
|
458
|
+
);
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
function createStreamMessageMetadataBuilder(input: {
|
|
462
|
+
agentId: string;
|
|
463
|
+
modelId: string;
|
|
464
|
+
lifecycleAdapter: HostedChatExecutionLifecycleAdapter;
|
|
465
|
+
streamingMessageId: string | null;
|
|
466
|
+
}): HostedChatRuntimeToUiMessageStreamOptions["messageMetadata"] {
|
|
467
|
+
return ({ part }) =>
|
|
468
|
+
buildChatStreamChunkMessageMetadata(
|
|
469
|
+
{
|
|
470
|
+
agentId: input.agentId,
|
|
471
|
+
modelId: input.modelId,
|
|
472
|
+
...(input.lifecycleAdapter.durableRootRun
|
|
473
|
+
? { runId: input.lifecycleAdapter.durableRootRun.runId }
|
|
474
|
+
: {}),
|
|
475
|
+
...(input.streamingMessageId ? { streamingMessageId: input.streamingMessageId } : {}),
|
|
476
|
+
part: {
|
|
477
|
+
type: part.type,
|
|
478
|
+
...("totalUsage" in part ? { totalUsage: part.totalUsage } : {}),
|
|
479
|
+
},
|
|
480
|
+
} satisfies BuildChatStreamChunkMessageMetadataInput,
|
|
481
|
+
);
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
function logCleanupError(input: {
|
|
485
|
+
error: unknown;
|
|
486
|
+
logger?: HostedChatExecutionRuntimeLogger;
|
|
487
|
+
}): void {
|
|
488
|
+
input.logger?.error("Runtime cleanup failed", {
|
|
489
|
+
error: input.error instanceof Error ? input.error.message : String(input.error),
|
|
490
|
+
});
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
async function finalizeResponseFinish(input: {
|
|
494
|
+
responseMessage: ChatUiMessage;
|
|
495
|
+
isAborted: boolean;
|
|
496
|
+
streamResult: { steps: PromiseLike<readonly unknown[]> };
|
|
497
|
+
lastStreamError: unknown;
|
|
498
|
+
lifecycleAdapter: HostedChatExecutionLifecycleAdapter;
|
|
499
|
+
mirroredToolChunkState: MirroredToolChunkState;
|
|
500
|
+
capturedMessageId: string | null;
|
|
501
|
+
incompleteToolCallsPartErrorText: string;
|
|
502
|
+
cleanup: () => Promise<void>;
|
|
503
|
+
logger?: HostedChatExecutionRuntimeLogger;
|
|
504
|
+
}): Promise<void> {
|
|
505
|
+
const hooks = createHostedChatStreamFinalizationHooks({
|
|
506
|
+
lifecycleAdapter: input.lifecycleAdapter,
|
|
507
|
+
cleanup: input.cleanup,
|
|
508
|
+
streamError: input.lastStreamError,
|
|
509
|
+
logger: input.logger,
|
|
510
|
+
});
|
|
511
|
+
const buildState = createHostedChatFinalizeResponseBuildState({
|
|
512
|
+
responseMessage: input.responseMessage,
|
|
513
|
+
isAborted: input.isAborted,
|
|
514
|
+
lifecycleAdapter: input.lifecycleAdapter,
|
|
515
|
+
mirroredToolChunkState: input.mirroredToolChunkState,
|
|
516
|
+
capturedMessageId: input.capturedMessageId,
|
|
517
|
+
incompleteToolCallsPartErrorText: input.incompleteToolCallsPartErrorText,
|
|
518
|
+
});
|
|
519
|
+
|
|
520
|
+
await finalizeHostedResponse({
|
|
521
|
+
isAborted: input.isAborted,
|
|
522
|
+
getFinalStep: () => getLastStreamStep(input.streamResult),
|
|
523
|
+
buildState,
|
|
524
|
+
shouldFailEmptyMessage: ({ isAborted, message }) =>
|
|
525
|
+
shouldFailEmptyHostedFinalizedMessage({ isAborted, message }),
|
|
526
|
+
...hooks,
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
async function finalizeDetachedStreamEnd(input: {
|
|
531
|
+
capturedMessageId: string | null;
|
|
532
|
+
streamResult: { steps: PromiseLike<readonly unknown[]> };
|
|
533
|
+
isAborted: boolean;
|
|
534
|
+
lastStreamError: unknown;
|
|
535
|
+
lifecycleAdapter: HostedChatExecutionLifecycleAdapter;
|
|
536
|
+
mirroredToolChunkState: MirroredToolChunkState;
|
|
537
|
+
mirroredDurableOutput: boolean;
|
|
538
|
+
incompleteToolCallsPartErrorText: string;
|
|
539
|
+
cleanup: () => Promise<void>;
|
|
540
|
+
logger?: HostedChatExecutionRuntimeLogger;
|
|
541
|
+
}): Promise<void> {
|
|
542
|
+
const hooks = createHostedChatStreamFinalizationHooks({
|
|
543
|
+
lifecycleAdapter: input.lifecycleAdapter,
|
|
544
|
+
cleanup: input.cleanup,
|
|
545
|
+
streamError: input.lastStreamError,
|
|
546
|
+
logger: input.logger,
|
|
547
|
+
});
|
|
548
|
+
const buildState = createHostedChatFinalizeDetachedBuildState({
|
|
549
|
+
capturedMessageId: input.capturedMessageId,
|
|
550
|
+
isAborted: input.isAborted,
|
|
551
|
+
lifecycleAdapter: input.lifecycleAdapter,
|
|
552
|
+
mirroredToolChunkState: input.mirroredToolChunkState,
|
|
553
|
+
mirroredDurableOutput: input.mirroredDurableOutput,
|
|
554
|
+
incompleteToolCallsPartErrorText: input.incompleteToolCallsPartErrorText,
|
|
555
|
+
});
|
|
556
|
+
|
|
557
|
+
await finalizeHostedDetached({
|
|
558
|
+
isAborted: input.isAborted,
|
|
559
|
+
mirroredDurableOutput: input.mirroredDurableOutput,
|
|
560
|
+
getFinalStep: () => getLastStreamStep(input.streamResult),
|
|
561
|
+
buildState,
|
|
562
|
+
...hooks,
|
|
563
|
+
});
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
function resolveStreamingMessageId(input: {
|
|
567
|
+
conversationId?: string;
|
|
568
|
+
lifecycleAdapter: HostedChatExecutionLifecycleAdapter;
|
|
569
|
+
runContext: HostedChatExecutionRunContext;
|
|
570
|
+
}): string | null {
|
|
571
|
+
const streamingMessageId = input.lifecycleAdapter.durableRootRun?.messageId ?? null;
|
|
572
|
+
if (input.conversationId && !streamingMessageId) {
|
|
573
|
+
throw new Error("DURABLE_CHAT_ROOT_REQUIRES_CONVERSATION");
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
if (streamingMessageId) {
|
|
577
|
+
input.runContext.setMessageId?.(streamingMessageId);
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
return streamingMessageId;
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
export function createHostedChatExecutionRuntime(
|
|
584
|
+
input: CreateHostedChatExecutionRuntimeInput,
|
|
585
|
+
): HostedChatExecutionRuntime {
|
|
586
|
+
let finishPromise: Promise<void> = Promise.resolve();
|
|
587
|
+
let lastStreamError: unknown = null;
|
|
588
|
+
let finishHandlerStarted = false;
|
|
589
|
+
let mirroredDurableOutput = false;
|
|
590
|
+
const incompleteToolCallsPartErrorText = input.incompleteToolCallsPartErrorText ??
|
|
591
|
+
INCOMPLETE_TOOL_CALLS_PART_ERROR_TEXT;
|
|
592
|
+
const streamingMessageId = resolveStreamingMessageId({
|
|
593
|
+
conversationId: input.bootstrap.capturedConversationId,
|
|
594
|
+
lifecycleAdapter: input.bootstrap.lifecycleAdapter,
|
|
595
|
+
runContext: input.runContext,
|
|
596
|
+
});
|
|
597
|
+
|
|
598
|
+
const finalizeDetachedStreamEndIfNeeded = async () => {
|
|
599
|
+
if (finishHandlerStarted) {
|
|
600
|
+
return;
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
finishHandlerStarted = true;
|
|
604
|
+
await finalizeDetachedStreamEnd({
|
|
605
|
+
capturedMessageId: input.bootstrap.capturedMessageId,
|
|
606
|
+
streamResult: input.bootstrap.streamResult,
|
|
607
|
+
isAborted: input.abortSignal.aborted,
|
|
608
|
+
lastStreamError,
|
|
609
|
+
lifecycleAdapter: input.bootstrap.lifecycleAdapter,
|
|
610
|
+
mirroredToolChunkState: input.bootstrap.mirroredToolChunkState,
|
|
611
|
+
mirroredDurableOutput,
|
|
612
|
+
incompleteToolCallsPartErrorText,
|
|
613
|
+
cleanup: input.bootstrap.cleanup,
|
|
614
|
+
logger: input.logger,
|
|
615
|
+
});
|
|
616
|
+
};
|
|
617
|
+
|
|
618
|
+
const fail = async (error: unknown) => {
|
|
619
|
+
await input.runContext.withContext(async () => {
|
|
620
|
+
input.bootstrap.rootStreamWatchdog.dispose();
|
|
621
|
+
await input.bootstrap.cleanup().catch((cleanupError: unknown) => {
|
|
622
|
+
logCleanupError({ error: cleanupError, logger: input.logger });
|
|
623
|
+
});
|
|
624
|
+
await finalizeExecutionFailure({
|
|
625
|
+
lifecycleAdapter: input.bootstrap.lifecycleAdapter,
|
|
626
|
+
error,
|
|
627
|
+
conversationId: input.bootstrap.capturedConversationId,
|
|
628
|
+
runId: input.bootstrap.lifecycleAdapter.durableRootRun?.runId,
|
|
629
|
+
logMessage: "Failed to mark durable chat root run as failed",
|
|
630
|
+
logger: input.logger,
|
|
631
|
+
});
|
|
632
|
+
});
|
|
633
|
+
};
|
|
634
|
+
|
|
635
|
+
const streamOptions: HostedChatRuntimeToUiMessageStreamOptions = {
|
|
636
|
+
sendReasoning: true,
|
|
637
|
+
originalMessages: input.originalMessages,
|
|
638
|
+
onError: (error) => {
|
|
639
|
+
lastStreamError = error;
|
|
640
|
+
return input.runContext.withContext(() => getHostedStreamErrorText(error));
|
|
641
|
+
},
|
|
642
|
+
onFinish: ({ responseMessage, isAborted }) => {
|
|
643
|
+
finishHandlerStarted = true;
|
|
644
|
+
finishPromise = input.runContext.withContext(() =>
|
|
645
|
+
finalizeResponseFinish({
|
|
646
|
+
responseMessage,
|
|
647
|
+
isAborted,
|
|
648
|
+
streamResult: input.bootstrap.streamResult,
|
|
649
|
+
lastStreamError,
|
|
650
|
+
lifecycleAdapter: input.bootstrap.lifecycleAdapter,
|
|
651
|
+
mirroredToolChunkState: input.bootstrap.mirroredToolChunkState,
|
|
652
|
+
capturedMessageId: input.bootstrap.capturedMessageId,
|
|
653
|
+
incompleteToolCallsPartErrorText,
|
|
654
|
+
cleanup: input.bootstrap.cleanup,
|
|
655
|
+
logger: input.logger,
|
|
656
|
+
}).catch((error) =>
|
|
657
|
+
finalizeExecutionFailure({
|
|
658
|
+
lifecycleAdapter: input.bootstrap.lifecycleAdapter,
|
|
659
|
+
error,
|
|
660
|
+
conversationId: input.bootstrap.capturedConversationId,
|
|
661
|
+
runId: input.bootstrap.lifecycleAdapter.durableRootRun?.runId,
|
|
662
|
+
logMessage: "Failed to finalize durable chat root run",
|
|
663
|
+
logger: input.logger,
|
|
664
|
+
})
|
|
665
|
+
)
|
|
666
|
+
);
|
|
667
|
+
},
|
|
668
|
+
messageMetadata: createStreamMessageMetadataBuilder({
|
|
669
|
+
agentId: input.agentId,
|
|
670
|
+
modelId: input.modelId,
|
|
671
|
+
lifecycleAdapter: input.bootstrap.lifecycleAdapter,
|
|
672
|
+
streamingMessageId,
|
|
673
|
+
}),
|
|
674
|
+
};
|
|
675
|
+
|
|
676
|
+
if (input.responseMessageId) {
|
|
677
|
+
const responseMessageId = input.responseMessageId;
|
|
678
|
+
streamOptions.generateMessageId = () => responseMessageId;
|
|
679
|
+
}
|
|
680
|
+
const agentUIStream = input.bootstrap.streamResult.toUIMessageStream(streamOptions);
|
|
681
|
+
|
|
682
|
+
return {
|
|
683
|
+
agentUIStream: createHostedMirroredUiStream({
|
|
684
|
+
sourceStream: agentUIStream,
|
|
685
|
+
rootStreamWatchdog: input.bootstrap.rootStreamWatchdog,
|
|
686
|
+
mirroredToolChunkState: input.bootstrap.mirroredToolChunkState,
|
|
687
|
+
appendChunk: (chunk) => input.bootstrap.lifecycleAdapter.durableRunMirror?.handleChunk(chunk),
|
|
688
|
+
setMirroredOutput: (value) => {
|
|
689
|
+
mirroredDurableOutput = value;
|
|
690
|
+
},
|
|
691
|
+
logger: input.logger,
|
|
692
|
+
}),
|
|
693
|
+
fail,
|
|
694
|
+
waitForFinish: async () => {
|
|
695
|
+
try {
|
|
696
|
+
await finalizeDetachedStreamEndIfNeeded();
|
|
697
|
+
await finishPromise;
|
|
698
|
+
} finally {
|
|
699
|
+
input.bootstrap.rootStreamWatchdog.dispose();
|
|
700
|
+
}
|
|
701
|
+
},
|
|
702
|
+
};
|
|
703
|
+
}
|