talos-code 0.0.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +87 -0
- package/LICENSE +661 -0
- package/README.md +116 -3
- package/THIRD_PARTY_NOTICES.md +40 -0
- package/dist/archive/zip.js +73 -0
- package/dist/args.js +100 -0
- package/dist/automations/history-store.js +34 -0
- package/dist/automations/policy-store.js +43 -0
- package/dist/automations/runner.js +107 -0
- package/dist/automations/schedule.js +85 -0
- package/dist/automations/windows-task.js +53 -0
- package/dist/commands/advanced-cli.js +233 -0
- package/dist/commands/checkpoint-cli.js +45 -0
- package/dist/commands/config-cli.js +107 -0
- package/dist/commands/context.js +17 -0
- package/dist/commands/extensions-cli.js +207 -0
- package/dist/commands/project-cli.js +74 -0
- package/dist/commands/project-commands.js +143 -0
- package/dist/commands/provider-cli.js +244 -0
- package/dist/commands/services-cli.js +248 -0
- package/dist/commands/session-cli.js +171 -0
- package/dist/commands/system-cli.js +405 -0
- package/dist/config/commands.js +60 -0
- package/dist/config/load.js +382 -0
- package/dist/config/migrations.js +48 -0
- package/dist/config/types.js +11 -0
- package/dist/diagnostics/development-log.js +154 -0
- package/dist/diagnostics/doctor.js +104 -0
- package/dist/diagnostics/redact.js +80 -0
- package/dist/diagnostics/zip.js +52 -0
- package/dist/errors.js +156 -0
- package/dist/events/bridge.js +130 -0
- package/dist/extensions/installer.js +178 -0
- package/dist/extensions/package-schema.js +24 -0
- package/dist/headless/result.js +84 -0
- package/dist/headless/run.js +230 -0
- package/dist/i18n/en/approval.js +46 -0
- package/dist/i18n/en/common.js +9 -0
- package/dist/i18n/en/credentials.js +92 -0
- package/dist/i18n/en/errors.js +267 -0
- package/dist/i18n/en/firstrun.js +101 -0
- package/dist/i18n/en/providers.js +37 -0
- package/dist/i18n/en/screen.js +774 -0
- package/dist/i18n/en/tools.js +127 -0
- package/dist/i18n/en.js +14 -0
- package/dist/i18n/error-view.js +307 -0
- package/dist/i18n/index.js +19 -0
- package/dist/i18n/kernel-map.js +139 -0
- package/dist/io.js +45 -0
- package/dist/main.js +331 -0
- package/dist/paths.js +41 -0
- package/dist/protocol/v2/codec.js +9 -0
- package/dist/protocol/v2/events.js +555 -0
- package/dist/protocol/v2/index.js +4 -0
- package/dist/protocol/v2/replay.js +28 -0
- package/dist/protocol/v2/types.js +1 -0
- package/dist/provider/control-plane.js +135 -0
- package/dist/provider/environment-keys.js +275 -0
- package/dist/provider/health.js +110 -0
- package/dist/provider/missing-key.js +48 -0
- package/dist/provider/model-catalog.js +168 -0
- package/dist/provider/openrouter-login.js +172 -0
- package/dist/provider/provider-text.js +13 -0
- package/dist/provider/store.js +95 -0
- package/dist/provider/system-keyring.js +214 -0
- package/dist/runtime/active-run.js +63 -0
- package/dist/runtime/agent-tree.js +74 -0
- package/dist/runtime/attachments.js +84 -0
- package/dist/runtime/brokered-executor.js +395 -0
- package/dist/runtime/context-archive.js +69 -0
- package/dist/runtime/context-status.js +76 -0
- package/dist/runtime/create-runtime.js +111 -0
- package/dist/runtime/model-profile.js +361 -0
- package/dist/runtime/output-store.js +137 -0
- package/dist/runtime/provider-attempts.js +185 -0
- package/dist/runtime/replay-buffer.js +153 -0
- package/dist/runtime/repo.js +95 -0
- package/dist/runtime/session-facade.js +135 -0
- package/dist/runtime/session-summary.js +125 -0
- package/dist/runtime/supervisor.js +265 -0
- package/dist/runtime/talos-composition.js +1011 -0
- package/dist/runtime/types.js +5 -0
- package/dist/runtime/usage-snapshot.js +82 -0
- package/dist/security/auto-classifier.js +38 -0
- package/dist/security/credential-free-environment.js +54 -0
- package/dist/security/evaluate.js +243 -0
- package/dist/security/execution-backends.js +236 -0
- package/dist/security/execution-broker.js +102 -0
- package/dist/security/forge-scan.js +74 -0
- package/dist/security/from-approval.js +39 -0
- package/dist/security/mxc-execution-backend.js +281 -0
- package/dist/security/permission-engine.js +138 -0
- package/dist/security/permission-explanation.js +54 -0
- package/dist/security/persist.js +179 -0
- package/dist/security/plugin-guard.js +230 -0
- package/dist/security/process-tree-evidence-store.js +74 -0
- package/dist/security/process-tree-probe.js +554 -0
- package/dist/security/project-resource-inventory.js +186 -0
- package/dist/security/project-trust-gate.js +38 -0
- package/dist/security/project-trust.js +367 -0
- package/dist/security/rule-parser.js +201 -0
- package/dist/security/shell-segmentation.js +68 -0
- package/dist/security/trust-authority.js +324 -0
- package/dist/security/types.js +1 -0
- package/dist/security/workspace-identity.js +102 -0
- package/dist/services/automation-facade.js +59 -0
- package/dist/services/forge-facade.js +77 -0
- package/dist/services/hook-facade.js +240 -0
- package/dist/services/index.js +16 -0
- package/dist/services/library-facade.js +174 -0
- package/dist/services/mcp-facade.js +348 -0
- package/dist/services/memory-facade.js +126 -0
- package/dist/services/notes-facade.js +157 -0
- package/dist/services/plugin-facade.js +308 -0
- package/dist/services/research-facade.js +110 -0
- package/dist/services/task-board-facade.js +236 -0
- package/dist/services/workflow-catalog.js +246 -0
- package/dist/sessions/export-format.js +98 -0
- package/dist/sessions/metadata-store.js +160 -0
- package/dist/sessions/share.js +122 -0
- package/dist/sessions/transfer.js +16 -0
- package/dist/subcommands.js +62 -0
- package/dist/tui/agent-roster.js +36 -0
- package/dist/tui/agent-view.js +51 -0
- package/dist/tui/app.js +4098 -0
- package/dist/tui/approval.js +36 -0
- package/dist/tui/boot/boot-sequence.js +76 -0
- package/dist/tui/boot/cinematic.js +243 -0
- package/dist/tui/boot/desktop-logo.js +82 -0
- package/dist/tui/boot.js +3 -0
- package/dist/tui/busy-input.js +58 -0
- package/dist/tui/catalog-service.js +560 -0
- package/dist/tui/components/assistant-stream.js +1 -0
- package/dist/tui/components/command-menu.js +68 -0
- package/dist/tui/components/composer.js +219 -0
- package/dist/tui/components/diff.js +35 -0
- package/dist/tui/components/footer.js +48 -0
- package/dist/tui/components/header.js +6 -0
- package/dist/tui/components/markdown.js +305 -0
- package/dist/tui/components/status-indicator.js +38 -0
- package/dist/tui/components/terminal-shell.js +214 -0
- package/dist/tui/components/thinking-row.js +19 -0
- package/dist/tui/components/tool-row.js +97 -0
- package/dist/tui/components/transcript-virtualizer.js +165 -0
- package/dist/tui/components/transcript.js +43 -0
- package/dist/tui/descendant-approvals.js +104 -0
- package/dist/tui/diff-model.js +77 -0
- package/dist/tui/editor-history.js +21 -0
- package/dist/tui/editor.js +210 -0
- package/dist/tui/event-adapter.js +436 -0
- package/dist/tui/exit-output.js +58 -0
- package/dist/tui/external-editor.js +53 -0
- package/dist/tui/file-completion.js +89 -0
- package/dist/tui/focus-manager.js +5 -0
- package/dist/tui/highlight.js +30 -0
- package/dist/tui/input-router.js +18 -0
- package/dist/tui/interrupt.js +99 -0
- package/dist/tui/keybindings.js +194 -0
- package/dist/tui/keymap-resolver.js +91 -0
- package/dist/tui/launch-state.js +148 -0
- package/dist/tui/line-diff.js +57 -0
- package/dist/tui/live-activity.js +56 -0
- package/dist/tui/metrics.js +123 -0
- package/dist/tui/onboarding.js +36 -0
- package/dist/tui/overlays/agent-tree.js +43 -0
- package/dist/tui/overlays/approval-dialog.js +642 -0
- package/dist/tui/overlays/automation-center.js +51 -0
- package/dist/tui/overlays/checkpoint-picker.js +47 -0
- package/dist/tui/overlays/context-inspector.js +36 -0
- package/dist/tui/overlays/effort-line.js +110 -0
- package/dist/tui/overlays/forge-center.js +46 -0
- package/dist/tui/overlays/help-dialog.js +16 -0
- package/dist/tui/overlays/history-picker.js +37 -0
- package/dist/tui/overlays/hook-center.js +70 -0
- package/dist/tui/overlays/library-center.js +55 -0
- package/dist/tui/overlays/mcp-center.js +60 -0
- package/dist/tui/overlays/memory-center.js +63 -0
- package/dist/tui/overlays/model-picker.js +77 -0
- package/dist/tui/overlays/notes-center.js +53 -0
- package/dist/tui/overlays/overlay-host.js +8 -0
- package/dist/tui/overlays/plugin-center.js +76 -0
- package/dist/tui/overlays/provider-picker.js +171 -0
- package/dist/tui/overlays/queue-editor.js +32 -0
- package/dist/tui/overlays/research-center.js +59 -0
- package/dist/tui/overlays/scroll-window.js +234 -0
- package/dist/tui/overlays/session-picker.js +115 -0
- package/dist/tui/overlays/tasks-center.js +83 -0
- package/dist/tui/overlays/theme-picker.js +21 -0
- package/dist/tui/overlays/transcript-search.js +58 -0
- package/dist/tui/overlays/trust-center.js +29 -0
- package/dist/tui/overlays/workflow-center.js +46 -0
- package/dist/tui/project-file-index.js +214 -0
- package/dist/tui/project-references.js +85 -0
- package/dist/tui/project-trust-prompt.js +289 -0
- package/dist/tui/prompt-history-store.js +116 -0
- package/dist/tui/queue-store.js +110 -0
- package/dist/tui/regions/budget.js +59 -0
- package/dist/tui/regions/views.js +96 -0
- package/dist/tui/render-coordinator.js +148 -0
- package/dist/tui/render-scheduler.js +4 -0
- package/dist/tui/run.js +69 -0
- package/dist/tui/selection-list.js +29 -0
- package/dist/tui/session-controller.js +791 -0
- package/dist/tui/session-export.js +54 -0
- package/dist/tui/setup-wizard.js +46 -0
- package/dist/tui/shell-input.js +35 -0
- package/dist/tui/shell-layout.js +48 -0
- package/dist/tui/shell-model.js +98 -0
- package/dist/tui/slash-commands.js +82 -0
- package/dist/tui/state.js +151 -0
- package/dist/tui/status-bar.js +125 -0
- package/dist/tui/status-view.js +40 -0
- package/dist/tui/terminal-capabilities.js +9 -0
- package/dist/tui/terminal-session.js +11 -0
- package/dist/tui/text-width.js +66 -0
- package/dist/tui/theme-catalog.js +27 -0
- package/dist/tui/theme-store.js +23 -0
- package/dist/tui/theme.js +23 -0
- package/dist/tui/tool-display.js +135 -0
- package/dist/tui/tool-facts.js +1 -0
- package/dist/tui/tools/bash-renderer.js +32 -0
- package/dist/tui/tools/change.js +61 -0
- package/dist/tui/tools/edit-renderer.js +17 -0
- package/dist/tui/tools/generic-renderer.js +13 -0
- package/dist/tui/tools/list-renderer.js +14 -0
- package/dist/tui/tools/read-renderer.js +13 -0
- package/dist/tui/tools/registry.js +20 -0
- package/dist/tui/tools/row-format.js +187 -0
- package/dist/tui/tools/search-renderer.js +38 -0
- package/dist/tui/tools/shared.js +97 -0
- package/dist/tui/tools/write-renderer.js +15 -0
- package/dist/tui/transcript-model.js +441 -0
- package/dist/tui/ui-preferences.js +79 -0
- package/dist/tui/usage-view.js +77 -0
- package/dist/tui/vim-mode.js +99 -0
- package/dist/update/check.js +15 -0
- package/dist/update/npm.js +51 -0
- package/dist/update/run.js +129 -0
- package/dist/version.js +2 -0
- package/dist/workspace/checkpoint-store.js +210 -0
- package/dist/workspace/checkpoint.js +413 -0
- package/dist/workspace/restore.js +232 -0
- package/package.json +64 -5
- package/vendor/context-engine/package.json +11 -0
- package/vendor/context-engine/src/compaction-planner.mjs +57 -0
- package/vendor/context-engine/src/contracts.mjs +48 -0
- package/vendor/context-engine/src/engine.mjs +445 -0
- package/vendor/context-engine/src/node/context-export.mjs +164 -0
- package/vendor/context-engine/src/node/legacy-import.mjs +92 -0
- package/vendor/context-engine/src/node/migrations/001-context.sql +126 -0
- package/vendor/context-engine/src/node/sqlite-store.mjs +85 -0
- package/vendor/context-engine/src/node/sqlite-worker.mjs +559 -0
- package/vendor/context-engine/src/profiles.mjs +10 -0
- package/vendor/context-engine/src/retrieval.mjs +104 -0
- package/vendor/context-engine/src/summary.mjs +97 -0
- package/vendor/context-engine/src/usage.mjs +34 -0
- package/vendor/harness-ui/package.json +38 -0
- package/vendor/harness-ui/src/acp-agent.mjs +350 -0
- package/vendor/harness-ui/src/agent-service.mjs +2188 -0
- package/vendor/harness-ui/src/agui-events.mjs +452 -0
- package/vendor/harness-ui/src/ambiente-solo-server.mjs +121 -0
- package/vendor/harness-ui/src/artifact-store.mjs +39 -0
- package/vendor/harness-ui/src/assistenza.mjs +123 -0
- package/vendor/harness-ui/src/automation-scheduler.mjs +69 -0
- package/vendor/harness-ui/src/automation-store.mjs +145 -0
- package/vendor/harness-ui/src/browser-annota.mjs +639 -0
- package/vendor/harness-ui/src/browser-frame.mjs +211 -0
- package/vendor/harness-ui/src/browser-proxy-universale.mjs +519 -0
- package/vendor/harness-ui/src/browser-proxy.mjs +87 -0
- package/vendor/harness-ui/src/browser-sessione-viva.mjs +329 -0
- package/vendor/harness-ui/src/browser-stream.mjs +445 -0
- package/vendor/harness-ui/src/browser-vivo.mjs +694 -0
- package/vendor/harness-ui/src/chat-image-attachments.mjs +72 -0
- package/vendor/harness-ui/src/config.mjs +697 -0
- package/vendor/harness-ui/src/contesto-del-progetto.mjs +385 -0
- package/vendor/harness-ui/src/context-asset-adapter.mjs +72 -0
- package/vendor/harness-ui/src/context-desktop-service.mjs +253 -0
- package/vendor/harness-ui/src/context-embedding-runtime.mjs +252 -0
- package/vendor/harness-ui/src/context-inference-scheduler.mjs +81 -0
- package/vendor/harness-ui/src/context-native-compaction.mjs +75 -0
- package/vendor/harness-ui/src/context-provider-adapter.mjs +141 -0
- package/vendor/harness-ui/src/context-runtime.mjs +118 -0
- package/vendor/harness-ui/src/context-token-counters.mjs +184 -0
- package/vendor/harness-ui/src/context-tool-catalog.mjs +86 -0
- package/vendor/harness-ui/src/context-tool-output.mjs +72 -0
- package/vendor/harness-ui/src/costo-elenco.mjs +252 -0
- package/vendor/harness-ui/src/custom-task.mjs +171 -0
- package/vendor/harness-ui/src/doctor.mjs +142 -0
- package/vendor/harness-ui/src/document-filename.mjs +97 -0
- package/vendor/harness-ui/src/document-generator.mjs +493 -0
- package/vendor/harness-ui/src/document-report.mjs +331 -0
- package/vendor/harness-ui/src/duckduckgo-search.mjs +155 -0
- package/vendor/harness-ui/src/elenco-profondo.mjs +337 -0
- package/vendor/harness-ui/src/favicon-proxy.mjs +113 -0
- package/vendor/harness-ui/src/forge-contract.mjs +221 -0
- package/vendor/harness-ui/src/frequent-dirs.mjs +134 -0
- package/vendor/harness-ui/src/generated-image-store.mjs +147 -0
- package/vendor/harness-ui/src/generation-idle.mjs +332 -0
- package/vendor/harness-ui/src/gguf-header.mjs +207 -0
- package/vendor/harness-ui/src/git-service.mjs +626 -0
- package/vendor/harness-ui/src/gitignore-elenco.mjs +604 -0
- package/vendor/harness-ui/src/harness-receipt-keypair.mjs +207 -0
- package/vendor/harness-ui/src/hf-direct-transfer.mjs +170 -0
- package/vendor/harness-ui/src/hf-hub-client.mjs +106 -0
- package/vendor/harness-ui/src/hf-image-proxy.mjs +105 -0
- package/vendor/harness-ui/src/hf-model-transfer.mjs +245 -0
- package/vendor/harness-ui/src/hook-registry.mjs +186 -0
- package/vendor/harness-ui/src/http-app.mjs +6259 -0
- package/vendor/harness-ui/src/http-lifecycle.mjs +132 -0
- package/vendor/harness-ui/src/id-archivio.mjs +27 -0
- package/vendor/harness-ui/src/image-generator.mjs +143 -0
- package/vendor/harness-ui/src/istruzioni-di-progetto.mjs +234 -0
- package/vendor/harness-ui/src/kernel/dist/kernelPerIlBanco.js +518 -0
- package/vendor/harness-ui/src/kernel/talosHarness.mjs +10437 -0
- package/vendor/harness-ui/src/library-policy-store.mjs +175 -0
- package/vendor/harness-ui/src/library-store.mjs +652 -0
- package/vendor/harness-ui/src/llama-server-supervisor.mjs +629 -0
- package/vendor/harness-ui/src/local-model-store.mjs +339 -0
- package/vendor/harness-ui/src/local-runtime-contract.mjs +66 -0
- package/vendor/harness-ui/src/local-runtime-events.mjs +44 -0
- package/vendor/harness-ui/src/local-runtime-llama-server.mjs +244 -0
- package/vendor/harness-ui/src/local-runtime-probe.mjs +401 -0
- package/vendor/harness-ui/src/machine-capacity.mjs +66 -0
- package/vendor/harness-ui/src/mappa-cartelle.mjs +491 -0
- package/vendor/harness-ui/src/mcp-client.mjs +98 -0
- package/vendor/harness-ui/src/mcp-registry.mjs +157 -0
- package/vendor/harness-ui/src/mcp-session.mjs +177 -0
- package/vendor/harness-ui/src/memory-store.mjs +227 -0
- package/vendor/harness-ui/src/model-catalog-models-dev.mjs +276 -0
- package/vendor/harness-ui/src/model-catalog.mjs +129 -0
- package/vendor/harness-ui/src/model-destination.mjs +189 -0
- package/vendor/harness-ui/src/modifica-ancorata.mjs +177 -0
- package/vendor/harness-ui/src/native-provider-adapter.mjs +205 -0
- package/vendor/harness-ui/src/notes-store.mjs +250 -0
- package/vendor/harness-ui/src/openai-compatible-runtime.mjs +428 -0
- package/vendor/harness-ui/src/openrouter-oauth.mjs +339 -0
- package/vendor/harness-ui/src/path-policy.mjs +442 -0
- package/vendor/harness-ui/src/plugin-registry.mjs +780 -0
- package/vendor/harness-ui/src/plugin-session.mjs +180 -0
- package/vendor/harness-ui/src/process-policy.mjs +345 -0
- package/vendor/harness-ui/src/prompt-enhancer-provider.mjs +94 -0
- package/vendor/harness-ui/src/provider-auth-cloud.mjs +95 -0
- package/vendor/harness-ui/src/provider-credential-store.mjs +541 -0
- package/vendor/harness-ui/src/provider-probe.mjs +582 -0
- package/vendor/harness-ui/src/provider-registry.mjs +1633 -0
- package/vendor/harness-ui/src/pty-terminal.mjs +312 -0
- package/vendor/harness-ui/src/public-problem.mjs +109 -0
- package/vendor/harness-ui/src/research/card.mjs +235 -0
- package/vendor/harness-ui/src/research/citations.mjs +142 -0
- package/vendor/harness-ui/src/research/collector.mjs +275 -0
- package/vendor/harness-ui/src/research/deposito-a-pezzi.mjs +139 -0
- package/vendor/harness-ui/src/research/dossier.mjs +114 -0
- package/vendor/harness-ui/src/research/esportazioni.mjs +560 -0
- package/vendor/harness-ui/src/research/fetch-cache.mjs +465 -0
- package/vendor/harness-ui/src/research/fidelity.mjs +122 -0
- package/vendor/harness-ui/src/research/independence.mjs +159 -0
- package/vendor/harness-ui/src/research/ledger.mjs +166 -0
- package/vendor/harness-ui/src/research/markdown-server.mjs +565 -0
- package/vendor/harness-ui/src/research/narration.mjs +181 -0
- package/vendor/harness-ui/src/research/open-cards.mjs +131 -0
- package/vendor/harness-ui/src/research/opposing.mjs +305 -0
- package/vendor/harness-ui/src/research/outline.mjs +111 -0
- package/vendor/harness-ui/src/research/page-budget.mjs +209 -0
- package/vendor/harness-ui/src/research/pdf.mjs +291 -0
- package/vendor/harness-ui/src/research/plan.mjs +301 -0
- package/vendor/harness-ui/src/research/raccolta-viva.mjs +452 -0
- package/vendor/harness-ui/src/research/recheck-document.mjs +69 -0
- package/vendor/harness-ui/src/research/recheck-history.mjs +192 -0
- package/vendor/harness-ui/src/research/recheck.mjs +194 -0
- package/vendor/harness-ui/src/research/report.mjs +203 -0
- package/vendor/harness-ui/src/research/run.mjs +527 -0
- package/vendor/harness-ui/src/research/synthesis.mjs +318 -0
- package/vendor/harness-ui/src/research/verification.mjs +572 -0
- package/vendor/harness-ui/src/research-orchestrator.mjs +2679 -0
- package/vendor/harness-ui/src/research-store.mjs +1133 -0
- package/vendor/harness-ui/src/runtime-build-manifest.mjs +26 -0
- package/vendor/harness-ui/src/runtime-contract.mjs +59 -0
- package/vendor/harness-ui/src/runtime-owner-adapter.mjs +1348 -0
- package/vendor/harness-ui/src/runtime-owner-contract.mjs +32 -0
- package/vendor/harness-ui/src/scheda-di-lavoro.mjs +249 -0
- package/vendor/harness-ui/src/search-source-store.mjs +172 -0
- package/vendor/harness-ui/src/session-registry.mjs +6095 -0
- package/vendor/harness-ui/src/session-store.mjs +220 -0
- package/vendor/harness-ui/src/sessione-pronta.mjs +73 -0
- package/vendor/harness-ui/src/setup-stato.mjs +31 -0
- package/vendor/harness-ui/src/sezioni-istruzioni.mjs +204 -0
- package/vendor/harness-ui/src/skill-registry.mjs +120 -0
- package/vendor/harness-ui/src/sse-replay-coalescente.mjs +0 -0
- package/vendor/harness-ui/src/static-files.mjs +96 -0
- package/vendor/harness-ui/src/stream-partition.mjs +123 -0
- package/vendor/harness-ui/src/subagent-orchestrator.mjs +453 -0
- package/vendor/harness-ui/src/task-catalog.mjs +65 -0
- package/vendor/harness-ui/src/tasks-store.mjs +220 -0
- package/vendor/harness-ui/src/terminal-registry.mjs +312 -0
- package/vendor/harness-ui/src/terminal-ws.mjs +170 -0
- package/vendor/harness-ui/src/tool-forge-store.mjs +299 -0
- package/vendor/harness-ui/src/tool-schema-normalize.mjs +100 -0
- package/vendor/harness-ui/src/usage-cache.mjs +315 -0
- package/vendor/harness-ui/src/workspace-browser.mjs +213 -0
- package/vendor/harness-ui/src/workspace-context.mjs +124 -0
- package/vendor/harness-ui/src/workspace-disk.mjs +62 -0
- package/vendor/harness-ui/src/workspace-files.mjs +589 -0
- package/vendor/harness-ui/src/workspace-info.mjs +189 -0
- package/vendor/harness-ui/src/workspace-launch-store.mjs +150 -0
- package/vendor/harness-ui/src/workspace-tree.mjs +67 -0
- package/vendor/harness-ui/src/workspace-watcher.mjs +161 -0
- package/vendor/manifest.json +170 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
function textOrNull(...values) {
|
|
2
|
+
for (const value of values)
|
|
3
|
+
if (typeof value === 'string' && value.trim() !== '')
|
|
4
|
+
return value.trim();
|
|
5
|
+
return null;
|
|
6
|
+
}
|
|
7
|
+
function finiteOrNull(value) { return Number.isFinite(value) ? Number(value) : null; }
|
|
8
|
+
function depthOf(value) { return Number.isSafeInteger(value) && Number(value) >= 0 ? Number(value) : 0; }
|
|
9
|
+
function lifecycle(row) {
|
|
10
|
+
if (row?.interrotta === true || row?.interrupted === true)
|
|
11
|
+
return 'interrupted';
|
|
12
|
+
const concluded = row?.conclusa === true || row?.completed === true;
|
|
13
|
+
const explicitlyOpen = row?.conclusa === false || row?.completed === false;
|
|
14
|
+
const last = textOrNull(row?.ultimoEsito, row?.lastOutcome);
|
|
15
|
+
const closure = textOrNull(row?.motivoChiusura, row?.closureReason);
|
|
16
|
+
if (explicitlyOpen && (last !== null || closure !== null))
|
|
17
|
+
return 'unknown';
|
|
18
|
+
if (!concluded && !explicitlyOpen && (last !== null || closure !== null))
|
|
19
|
+
return 'unknown';
|
|
20
|
+
if (!concluded)
|
|
21
|
+
return 'running';
|
|
22
|
+
if (closure === 'fermata' || closure === 'stopped' || closure === 'cancelled')
|
|
23
|
+
return 'stopped';
|
|
24
|
+
if (closure === 'fine-lavoro' || closure === 'completed' || last === 'successo' || last === 'success')
|
|
25
|
+
return 'completed';
|
|
26
|
+
if (closure === 'giri-finiti' || closure === 'errore' || closure === 'failed' || last === 'errore' || last === 'error')
|
|
27
|
+
return 'failed';
|
|
28
|
+
return 'unknown';
|
|
29
|
+
}
|
|
30
|
+
function usageOf(raw) {
|
|
31
|
+
if (!raw || typeof raw !== 'object' || Array.isArray(raw))
|
|
32
|
+
return null;
|
|
33
|
+
const row = raw;
|
|
34
|
+
const usage = {
|
|
35
|
+
promptTokens: finiteOrNull(row.prompt_tokens ?? row.promptTokens),
|
|
36
|
+
completionTokens: finiteOrNull(row.completion_tokens ?? row.completionTokens),
|
|
37
|
+
cachedTokens: finiteOrNull(row.cached_tokens ?? row.cachedTokens),
|
|
38
|
+
turns: finiteOrNull(row.giri ?? row.turns),
|
|
39
|
+
executions: finiteOrNull(row.esecuzioni ?? row.executions),
|
|
40
|
+
};
|
|
41
|
+
return Object.values(usage).some(value => value !== null) ? usage : null;
|
|
42
|
+
}
|
|
43
|
+
function collisionOf(raw) {
|
|
44
|
+
const path = textOrNull(raw?.percorso, raw?.path);
|
|
45
|
+
if (!path)
|
|
46
|
+
return null;
|
|
47
|
+
return { path, beforeSessionId: textOrNull(raw?.primaDi, raw?.beforeSessionId), afterSessionId: textOrNull(raw?.dopoDi, raw?.afterSessionId) };
|
|
48
|
+
}
|
|
49
|
+
function delegationOutcomeOf(value) {
|
|
50
|
+
const normalized = textOrNull(value)?.toLowerCase() ?? null;
|
|
51
|
+
if (normalized === null)
|
|
52
|
+
return null;
|
|
53
|
+
if (normalized === 'concluso' || normalized === 'completed' || normalized === 'successo')
|
|
54
|
+
return 'completed';
|
|
55
|
+
if (normalized === 'fallito' || normalized === 'failed' || normalized === 'errore')
|
|
56
|
+
return 'failed';
|
|
57
|
+
if (normalized === 'rifiutato' || normalized === 'refused')
|
|
58
|
+
return 'refused';
|
|
59
|
+
return 'unknown';
|
|
60
|
+
}
|
|
61
|
+
function delegationEvidenceOf(raw) {
|
|
62
|
+
if (!raw || typeof raw !== 'object' || Array.isArray(raw))
|
|
63
|
+
return null;
|
|
64
|
+
const out = {
|
|
65
|
+
writes: finiteOrNull(raw.scritture ?? raw.writes),
|
|
66
|
+
artifacts: finiteOrNull(raw.artefatti ?? raw.artifacts),
|
|
67
|
+
toolCalls: finiteOrNull(raw.toolCalls),
|
|
68
|
+
toolCallsOk: finiteOrNull(raw.toolCallsOk),
|
|
69
|
+
toolCallsFailed: finiteOrNull(raw.toolCallsFalliti ?? raw.toolCallsFailed),
|
|
70
|
+
verifiable: typeof raw.verificabile === 'boolean' ? raw.verificabile : typeof raw.verifiable === 'boolean' ? raw.verifiable : null,
|
|
71
|
+
};
|
|
72
|
+
return Object.values(out).some(value => value !== null) ? out : null;
|
|
73
|
+
}
|
|
74
|
+
function approvalOf(row, evidence) {
|
|
75
|
+
if (row?.inAttesaApprovazione !== true && row?.approvalWaiting !== true)
|
|
76
|
+
return null;
|
|
77
|
+
return {
|
|
78
|
+
pending: true,
|
|
79
|
+
requestId: textOrNull(evidence.approval?.requestId),
|
|
80
|
+
waitingMs: finiteOrNull(evidence.approval?.waitingMs),
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
export function normalizeSessionSummary(row, evidence = {}) {
|
|
84
|
+
const id = textOrNull(row?.sessionId, row?.id) ?? '';
|
|
85
|
+
const child = evidence.child ?? null;
|
|
86
|
+
const collisions = (Array.isArray(child?.collisioni) ? child.collisioni : Array.isArray(row?.collisions) ? row.collisions : [])
|
|
87
|
+
.map(collisionOf).filter((value) => value !== null);
|
|
88
|
+
const startedAt = textOrNull(row?.avviataAlle, row?.startedAt);
|
|
89
|
+
const updatedAt = textOrNull(row?.ultimaRispostaAlle, row?.aggiornataAlle, row?.updatedAt) ?? startedAt;
|
|
90
|
+
return {
|
|
91
|
+
id, sessionId: id,
|
|
92
|
+
name: textOrNull(row?.nome, row?.name, row?.titolo, row?.title),
|
|
93
|
+
project: textOrNull(row?.progetto, row?.project),
|
|
94
|
+
path: textOrNull(row?.percorso, row?.path),
|
|
95
|
+
model: textOrNull(row?.modello, row?.model, row?.modelId),
|
|
96
|
+
parentId: textOrNull(row?.padreId, row?.parentId),
|
|
97
|
+
depth: depthOf(row?.profonditaDelega ?? row?.depth),
|
|
98
|
+
delegatedTask: textOrNull(row?.taskDelega, row?.delegatedTask, child?.taskCorto),
|
|
99
|
+
forkedFrom: textOrNull(row?.forkDa, row?.forkedFrom),
|
|
100
|
+
startedAt,
|
|
101
|
+
updatedAt,
|
|
102
|
+
endedAt: textOrNull(row?.conclusaAlle, row?.endedAt, row?.fineAlle),
|
|
103
|
+
outcome: lifecycle(row),
|
|
104
|
+
interrupted: row?.interrotta === true || row?.interrupted === true,
|
|
105
|
+
usage: usageOf(row?.usageSessione ?? row?.sessionUsage),
|
|
106
|
+
approvalWait: approvalOf(row, evidence),
|
|
107
|
+
collisions,
|
|
108
|
+
delegationOutcome: delegationOutcomeOf(child?.esitoDelega ?? row?.delegationOutcome),
|
|
109
|
+
delegationEvidence: delegationEvidenceOf(child?.evidenzaDelega ?? row?.delegationEvidence),
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
export function normalizeSessionSummaries(rows, evidenceById = new Map()) {
|
|
113
|
+
return rows.map(row => {
|
|
114
|
+
const id = textOrNull(row?.sessionId, row?.id) ?? '';
|
|
115
|
+
return normalizeSessionSummary(row, evidenceById.get(id) ?? {});
|
|
116
|
+
}).filter(row => row.id).sort((a, b) => {
|
|
117
|
+
if (a.startedAt === b.startedAt)
|
|
118
|
+
return 0;
|
|
119
|
+
if (a.startedAt === null)
|
|
120
|
+
return -1;
|
|
121
|
+
if (b.startedAt === null)
|
|
122
|
+
return 1;
|
|
123
|
+
return a.startedAt.localeCompare(b.startedAt);
|
|
124
|
+
});
|
|
125
|
+
}
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
2
|
+
import { CliRuntimeError } from "./types.js";
|
|
3
|
+
import { developmentLog, developmentLogError } from "../diagnostics/development-log.js";
|
|
4
|
+
import { forwardKeyOrigin } from "../provider/environment-keys.js";
|
|
5
|
+
import { createRuntimeReplayBuffer, createStartOperationJournal, startOperationFingerprint } from "./replay-buffer.js";
|
|
6
|
+
export const DEFAULT_RUNTIME_SUPERVISOR_POLICY = {
|
|
7
|
+
restore: { maxAttempts: 2, backoffMs: 50 },
|
|
8
|
+
start: { maxAttempts: 2, backoffMs: 50 },
|
|
9
|
+
replay: { maxAttempts: 2, backoffMs: 50 },
|
|
10
|
+
};
|
|
11
|
+
const RETRYABLE_CODES = new Set([
|
|
12
|
+
'RUNTIME_ACK_LOST', 'RUNTIME_RESTORE_TRANSIENT', 'RUNTIME_UNAVAILABLE', 'RUNTIME_START_FAILED',
|
|
13
|
+
'PROVIDER_REQUEST_ERROR', 'PROVIDER_TIMEOUT', 'PROVIDER_RATE_LIMITED', 'NETWORK_ERROR',
|
|
14
|
+
]);
|
|
15
|
+
function errorCode(error) {
|
|
16
|
+
return typeof error?.code === 'string' ? error.code : null;
|
|
17
|
+
}
|
|
18
|
+
function errorRetryable(error) {
|
|
19
|
+
if (typeof error?.retryable === 'boolean')
|
|
20
|
+
return error.retryable;
|
|
21
|
+
if (typeof error?.details?.retryable === 'boolean')
|
|
22
|
+
return error.details.retryable;
|
|
23
|
+
const code = errorCode(error);
|
|
24
|
+
return code !== null && RETRYABLE_CODES.has(code);
|
|
25
|
+
}
|
|
26
|
+
function errorDetails(error) {
|
|
27
|
+
const source = error && typeof error === 'object' ? error : {};
|
|
28
|
+
const nested = source.details && typeof source.details === 'object' && !Array.isArray(source.details) ? source.details : {};
|
|
29
|
+
const direct = Object.fromEntries(Object.entries(source).filter(([key, value]) => !['name', 'message', 'stack', 'code', 'retryable', 'details'].includes(key)
|
|
30
|
+
&& ['string', 'number', 'boolean'].includes(typeof value)));
|
|
31
|
+
return { ...nested, ...direct };
|
|
32
|
+
}
|
|
33
|
+
function nativeSequence(event) {
|
|
34
|
+
const raw = event?._sequenza;
|
|
35
|
+
return typeof raw === 'number' && Number.isSafeInteger(raw) && raw >= 0 ? raw : null;
|
|
36
|
+
}
|
|
37
|
+
export function createRuntimeSupervisor(options) {
|
|
38
|
+
const sleep = options.sleep ?? (async (ms) => { if (ms > 0)
|
|
39
|
+
await new Promise(resolve => setTimeout(resolve, ms)); });
|
|
40
|
+
const policy = {
|
|
41
|
+
restore: { ...DEFAULT_RUNTIME_SUPERVISOR_POLICY.restore, ...options.policy?.restore },
|
|
42
|
+
start: { ...DEFAULT_RUNTIME_SUPERVISOR_POLICY.start, ...options.policy?.start },
|
|
43
|
+
replay: { ...DEFAULT_RUNTIME_SUPERVISOR_POLICY.replay, ...options.policy?.replay },
|
|
44
|
+
};
|
|
45
|
+
const nextOperationId = options.operationId ?? randomUUID;
|
|
46
|
+
const journal = options.journal ?? (options.journalRoot ? createStartOperationJournal({ rootDir: options.journalRoot, operationId: nextOperationId }) : null);
|
|
47
|
+
const replay = createRuntimeReplayBuffer();
|
|
48
|
+
const evidence = [];
|
|
49
|
+
const generations = new Map();
|
|
50
|
+
const cancelInFlight = new Map();
|
|
51
|
+
let current = options.initialRuntime ?? null;
|
|
52
|
+
let defaultReasoning = null;
|
|
53
|
+
let closed = false;
|
|
54
|
+
function record(input) {
|
|
55
|
+
const row = { ...input, ts: new Date().toISOString() };
|
|
56
|
+
evidence.push(row);
|
|
57
|
+
developmentLog('runtime.supervisor', row, input.outcome === 'failed' ? 'error' : input.outcome === 'retrying' ? 'warning' : 'debug', 'runtime-supervisor');
|
|
58
|
+
if (evidence.length > 256)
|
|
59
|
+
evidence.splice(0, evidence.length - 256);
|
|
60
|
+
}
|
|
61
|
+
async function ensureRuntime() {
|
|
62
|
+
if (closed)
|
|
63
|
+
throw new CliRuntimeError('RUNTIME_SUPERVISOR_CLOSED', 'Runtime supervisor is closed.');
|
|
64
|
+
if (!current) {
|
|
65
|
+
current = await options.runtimeFactory();
|
|
66
|
+
current.setDefaultReasoningEffort(defaultReasoning);
|
|
67
|
+
}
|
|
68
|
+
return current;
|
|
69
|
+
}
|
|
70
|
+
async function replaceRuntime() {
|
|
71
|
+
const old = current;
|
|
72
|
+
current = null;
|
|
73
|
+
try {
|
|
74
|
+
await old?.close();
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
developmentLogError('runtime.replace.close_failure', error, {}, 'runtime-supervisor');
|
|
78
|
+
}
|
|
79
|
+
const next = await ensureRuntime();
|
|
80
|
+
next.setDefaultReasoningEffort(defaultReasoning);
|
|
81
|
+
return next;
|
|
82
|
+
}
|
|
83
|
+
function bump(sessionId) { const next = (generations.get(sessionId) ?? 0) + 1; generations.set(sessionId, next); return next; }
|
|
84
|
+
async function restore() {
|
|
85
|
+
for (let attempt = 1; attempt <= policy.restore.maxAttempts; attempt++) {
|
|
86
|
+
const runtime = await ensureRuntime();
|
|
87
|
+
try {
|
|
88
|
+
const result = await runtime.restore();
|
|
89
|
+
record({ operation: 'restore', attempt, outcome: 'succeeded', code: null, retryable: false, fallback: null, sessionId: null, operationId: null, details: {} });
|
|
90
|
+
return result;
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
const retryable = errorRetryable(error);
|
|
94
|
+
const code = errorCode(error);
|
|
95
|
+
if (retryable && attempt < policy.restore.maxAttempts) {
|
|
96
|
+
record({ operation: 'restore', attempt, outcome: 'retrying', code, retryable: true, fallback: 'runtime-restart', sessionId: null, operationId: null, details: errorDetails(error) });
|
|
97
|
+
await sleep(policy.restore.backoffMs);
|
|
98
|
+
await replaceRuntime();
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
record({ operation: 'restore', attempt, outcome: 'failed', code, retryable, fallback: null, sessionId: null, operationId: null, details: errorDetails(error) });
|
|
102
|
+
throw error;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
throw new CliRuntimeError('RUNTIME_RESTORE_FAILED');
|
|
106
|
+
}
|
|
107
|
+
async function start(input) {
|
|
108
|
+
const fingerprint = startOperationFingerprint(input);
|
|
109
|
+
let operationId = input.operationId ?? null;
|
|
110
|
+
let recovered = false;
|
|
111
|
+
if (!operationId && journal) {
|
|
112
|
+
const claim = await journal.claim(fingerprint);
|
|
113
|
+
operationId = claim.operationId;
|
|
114
|
+
recovered = claim.recovered;
|
|
115
|
+
}
|
|
116
|
+
if (!operationId)
|
|
117
|
+
operationId = nextOperationId();
|
|
118
|
+
if (recovered)
|
|
119
|
+
record({ operation: 'start', attempt: 0, outcome: 'recovered', code: null, retryable: false, fallback: null, sessionId: null, operationId, details: { fingerprint } });
|
|
120
|
+
for (let attempt = 1; attempt <= policy.start.maxAttempts; attempt++) {
|
|
121
|
+
const runtime = await ensureRuntime();
|
|
122
|
+
try {
|
|
123
|
+
const sessionId = await runtime.start({ ...input, operationId });
|
|
124
|
+
bump(sessionId);
|
|
125
|
+
if (recovered) {
|
|
126
|
+
const row = (await runtime.listSessions()).find(candidate => candidate.sessionId === sessionId || candidate.id === sessionId);
|
|
127
|
+
if (row?.interrupted === true || row?.outcome === 'interrupted') {
|
|
128
|
+
record({ operation: 'start', attempt, outcome: 'failed', code: 'RUNTIME_OPERATION_INTERRUPTED', retryable: false, fallback: null, sessionId, operationId, details: { recovered: true } });
|
|
129
|
+
throw new CliRuntimeError('RUNTIME_OPERATION_INTERRUPTED', 'The recovered start was interrupted by the previous process. Resume that session explicitly instead of starting it again.', { sessionId, operationId });
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
record({ operation: 'start', attempt, outcome: 'succeeded', code: null, retryable: false, fallback: null, sessionId, operationId, details: { recovered } });
|
|
133
|
+
return sessionId;
|
|
134
|
+
}
|
|
135
|
+
catch (error) {
|
|
136
|
+
if (error?.code === 'RUNTIME_OPERATION_INTERRUPTED')
|
|
137
|
+
throw error;
|
|
138
|
+
const retryable = errorRetryable(error);
|
|
139
|
+
const code = errorCode(error);
|
|
140
|
+
if (retryable && attempt < policy.start.maxAttempts) {
|
|
141
|
+
record({ operation: 'start', attempt, outcome: 'retrying', code, retryable: true, fallback: 'runtime-restart', sessionId: null, operationId, details: errorDetails(error) });
|
|
142
|
+
await sleep(policy.start.backoffMs);
|
|
143
|
+
await replaceRuntime();
|
|
144
|
+
continue;
|
|
145
|
+
}
|
|
146
|
+
record({ operation: 'start', attempt, outcome: 'failed', code, retryable, fallback: null, sessionId: null, operationId, details: errorDetails(error) });
|
|
147
|
+
throw error;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
throw new CliRuntimeError('RUNTIME_START_FAILED');
|
|
151
|
+
}
|
|
152
|
+
function subscribe(sessionId, sink, from = 0) {
|
|
153
|
+
let active = true;
|
|
154
|
+
let unsub = () => { };
|
|
155
|
+
let cursor = from;
|
|
156
|
+
const deliver = (event) => {
|
|
157
|
+
if (!active)
|
|
158
|
+
return;
|
|
159
|
+
const sequence = nativeSequence(event);
|
|
160
|
+
if (sequence !== null) {
|
|
161
|
+
/* P13 (2026-09-26): what this subscriber has seen is ITS cursor. The buffer is shared by every subscriber of the
|
|
162
|
+
session, so "already in the buffer" dropped the whole history of a second subscriber (a reopened agent view came
|
|
163
|
+
up empty); it still records the event, and a different event at a known sequence still throws a conflict. */
|
|
164
|
+
if (sequence <= cursor)
|
|
165
|
+
return;
|
|
166
|
+
replay.push(sessionId, event);
|
|
167
|
+
cursor = sequence;
|
|
168
|
+
}
|
|
169
|
+
sink(event);
|
|
170
|
+
};
|
|
171
|
+
const terminalFailure = (error) => {
|
|
172
|
+
if (!active)
|
|
173
|
+
return;
|
|
174
|
+
sink({ type: 'RunError', code: 'RUNTIME_REPLAY_FAILED', message: error instanceof Error ? error.message : String(error), retryable: false, component: 'runtime-supervisor' });
|
|
175
|
+
};
|
|
176
|
+
const attach = (runtime, attempt) => {
|
|
177
|
+
if (!active)
|
|
178
|
+
return;
|
|
179
|
+
try {
|
|
180
|
+
unsub = runtime.subscribe(sessionId, deliver, cursor);
|
|
181
|
+
if (attempt > 1)
|
|
182
|
+
record({ operation: 'replay', attempt, outcome: 'succeeded', code: null, retryable: false, fallback: null, sessionId, operationId: null, details: { from: cursor } });
|
|
183
|
+
}
|
|
184
|
+
catch (error) {
|
|
185
|
+
const retryable = errorRetryable(error);
|
|
186
|
+
const code = errorCode(error);
|
|
187
|
+
if (retryable && attempt < policy.replay.maxAttempts) {
|
|
188
|
+
record({ operation: 'replay', attempt, outcome: 'retrying', code, retryable: true, fallback: 'runtime-restart', sessionId, operationId: null, details: { ...errorDetails(error), from: cursor } });
|
|
189
|
+
void (async () => {
|
|
190
|
+
try {
|
|
191
|
+
await sleep(policy.replay.backoffMs);
|
|
192
|
+
const next = await replaceRuntime();
|
|
193
|
+
await next.restore();
|
|
194
|
+
attach(next, attempt + 1);
|
|
195
|
+
}
|
|
196
|
+
catch (recoveryError) {
|
|
197
|
+
record({ operation: 'replay', attempt: attempt + 1, outcome: 'failed', code: errorCode(recoveryError), retryable: errorRetryable(recoveryError), fallback: null, sessionId, operationId: null, details: errorDetails(recoveryError) });
|
|
198
|
+
terminalFailure(recoveryError);
|
|
199
|
+
}
|
|
200
|
+
})();
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
record({ operation: 'replay', attempt, outcome: 'failed', code, retryable, fallback: null, sessionId, operationId: null, details: errorDetails(error) });
|
|
204
|
+
terminalFailure(error);
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
if (current)
|
|
208
|
+
attach(current, 1);
|
|
209
|
+
else
|
|
210
|
+
void ensureRuntime().then(runtime => attach(runtime, 1)).catch(terminalFailure);
|
|
211
|
+
return () => { if (!active)
|
|
212
|
+
return; active = false; try {
|
|
213
|
+
unsub();
|
|
214
|
+
}
|
|
215
|
+
catch { } };
|
|
216
|
+
}
|
|
217
|
+
const supervised = {
|
|
218
|
+
restore,
|
|
219
|
+
start,
|
|
220
|
+
setDefaultReasoningEffort(effort) { defaultReasoning = effort; current?.setDefaultReasoningEffort(effort); },
|
|
221
|
+
async setReasoningEffort(sessionId, effort) { return (await ensureRuntime()).setReasoningEffort(sessionId, effort); },
|
|
222
|
+
async resume(sessionId, prompt, attachments) { const id = await (await ensureRuntime()).resume(sessionId, prompt, attachments); bump(id); return id; },
|
|
223
|
+
async fork(sessionId, prompt, attachments) { const id = await (await ensureRuntime()).fork(sessionId, prompt, attachments); bump(id); return id; },
|
|
224
|
+
async steer(sessionId, prompt, attachments) { return (await ensureRuntime()).steer(sessionId, prompt, attachments); },
|
|
225
|
+
async compact(sessionId) { return (await ensureRuntime()).compact(sessionId); },
|
|
226
|
+
async contextStatus(sessionId) { return (await ensureRuntime()).contextStatus?.(sessionId) ?? { schema: 'talos.cli.context-status.v1', sessionId, available: false, reason: 'runtime-unavailable', measurement: null, budget: null, autoCompaction: { enabled: false, triggerRatio: 0.5, triggerPercent: 50, targetRatio: null, provenance: 'runtime-supervisor' }, cache: { promptTokens: null, cachedTokens: null, percent: null, provenance: 'unavailable' }, cost: { usd: null, provenance: 'unavailable' }, sources: { activeVersionId: null, activeSourceCount: null, summaryCitationCount: null, provenance: 'unavailable' } }; },
|
|
227
|
+
async listSessions() { return (await ensureRuntime()).listSessions(); },
|
|
228
|
+
subscribe,
|
|
229
|
+
async answerApproval(sessionId, requestId, approved) { return (await ensureRuntime()).answerApproval(sessionId, requestId, approved); },
|
|
230
|
+
async cancel(sessionId) {
|
|
231
|
+
const generation = generations.get(sessionId) ?? 0;
|
|
232
|
+
const key = `${sessionId}:${generation}`;
|
|
233
|
+
const existing = cancelInFlight.get(key);
|
|
234
|
+
if (existing)
|
|
235
|
+
return existing;
|
|
236
|
+
const task = (async () => { try {
|
|
237
|
+
await (await ensureRuntime()).cancel(sessionId);
|
|
238
|
+
}
|
|
239
|
+
catch (error) {
|
|
240
|
+
cancelInFlight.delete(key);
|
|
241
|
+
throw error;
|
|
242
|
+
} })();
|
|
243
|
+
cancelInFlight.set(key, task);
|
|
244
|
+
return task;
|
|
245
|
+
},
|
|
246
|
+
async shell(sessionId, command) { return (await ensureRuntime()).shell(sessionId, command); },
|
|
247
|
+
export(sessionId) { return current?.export(sessionId) ?? null; },
|
|
248
|
+
supervisorEvidence() { return evidence.map(row => ({ ...row, details: { ...row.details } })); },
|
|
249
|
+
async close() {
|
|
250
|
+
if (closed)
|
|
251
|
+
return;
|
|
252
|
+
closed = true;
|
|
253
|
+
try {
|
|
254
|
+
await current?.close();
|
|
255
|
+
}
|
|
256
|
+
finally {
|
|
257
|
+
current = null;
|
|
258
|
+
await journal?.releaseOwned();
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
};
|
|
262
|
+
/* The entries ask the runtime they hold, this supervisor, where a run's key comes from; the composed runtime inside knows. */
|
|
263
|
+
forwardKeyOrigin(supervised, () => current);
|
|
264
|
+
return supervised;
|
|
265
|
+
}
|