@vascend/talos 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +202 -0
- package/dist/backend/asset-events.d.ts +31 -0
- package/dist/backend/asset-events.js +149 -0
- package/dist/backend/assets.d.ts +31 -0
- package/dist/backend/assets.js +210 -0
- package/dist/backend/auth.d.ts +18 -0
- package/dist/backend/auth.js +59 -0
- package/dist/backend/config.d.ts +14 -0
- package/dist/backend/config.js +41 -0
- package/dist/backend/conversations.d.ts +21 -0
- package/dist/backend/conversations.js +141 -0
- package/dist/backend/crypto.d.ts +9 -0
- package/dist/backend/crypto.js +68 -0
- package/dist/backend/engine.d.ts +13 -0
- package/dist/backend/engine.js +78 -0
- package/dist/backend/http.d.ts +25 -0
- package/dist/backend/http.js +112 -0
- package/dist/backend/index.d.ts +1 -0
- package/dist/backend/index.js +24 -0
- package/dist/backend/routes.d.ts +14 -0
- package/dist/backend/routes.js +169 -0
- package/dist/backend/sdk.d.ts +12 -0
- package/dist/backend/sdk.js +11 -0
- package/dist/backend/server.d.ts +12 -0
- package/dist/backend/server.js +91 -0
- package/dist/backend/temp-image-store.d.ts +46 -0
- package/dist/backend/temp-image-store.js +197 -0
- package/dist/backend/types.d.ts +103 -0
- package/dist/backend/types.js +29 -0
- package/dist/backend/users.d.ts +13 -0
- package/dist/backend/users.js +76 -0
- package/dist/backend/ws-handler.d.ts +14 -0
- package/dist/backend/ws-handler.js +72 -0
- package/dist/backend/ws.d.ts +19 -0
- package/dist/backend/ws.js +146 -0
- package/dist/core/agent.d.ts +56 -0
- package/dist/core/agent.js +1783 -0
- package/dist/core/background.d.ts +45 -0
- package/dist/core/background.js +140 -0
- package/dist/core/bootstrap.d.ts +45 -0
- package/dist/core/bootstrap.js +294 -0
- package/dist/core/cli-args.d.ts +41 -0
- package/dist/core/cli-args.js +282 -0
- package/dist/core/collapsible-output.d.ts +38 -0
- package/dist/core/collapsible-output.js +143 -0
- package/dist/core/compaction-checkpoint.d.ts +9 -0
- package/dist/core/compaction-checkpoint.js +58 -0
- package/dist/core/compaction.d.ts +42 -0
- package/dist/core/compaction.js +270 -0
- package/dist/core/config.d.ts +49 -0
- package/dist/core/config.js +417 -0
- package/dist/core/context-ledger.d.ts +99 -0
- package/dist/core/context-ledger.js +222 -0
- package/dist/core/context-policy.d.ts +17 -0
- package/dist/core/context-policy.js +81 -0
- package/dist/core/continuation-review.d.ts +23 -0
- package/dist/core/continuation-review.js +64 -0
- package/dist/core/crash-report.d.ts +3 -0
- package/dist/core/crash-report.js +27 -0
- package/dist/core/credentials.d.ts +11 -0
- package/dist/core/credentials.js +183 -0
- package/dist/core/doctor.d.ts +24 -0
- package/dist/core/doctor.js +125 -0
- package/dist/core/effort.d.ts +5 -0
- package/dist/core/effort.js +42 -0
- package/dist/core/env-paths.d.ts +3 -0
- package/dist/core/env-paths.js +38 -0
- package/dist/core/execution-guidance.d.ts +9 -0
- package/dist/core/execution-guidance.js +73 -0
- package/dist/core/execution-target.d.ts +41 -0
- package/dist/core/execution-target.js +69 -0
- package/dist/core/file-coordination.d.ts +66 -0
- package/dist/core/file-coordination.js +176 -0
- package/dist/core/file-lease-store.d.ts +14 -0
- package/dist/core/file-lease-store.js +89 -0
- package/dist/core/image-limits.d.ts +26 -0
- package/dist/core/image-limits.js +205 -0
- package/dist/core/interruptible-completion.d.ts +3 -0
- package/dist/core/interruptible-completion.js +42 -0
- package/dist/core/kingdoms-mode-state.d.ts +24 -0
- package/dist/core/kingdoms-mode-state.js +139 -0
- package/dist/core/licenza.d.ts +38 -0
- package/dist/core/licenza.js +125 -0
- package/dist/core/model-limits.d.ts +2 -0
- package/dist/core/model-limits.js +36 -0
- package/dist/core/output-lifecycle.d.ts +44 -0
- package/dist/core/output-lifecycle.js +190 -0
- package/dist/core/package-update.d.ts +15 -0
- package/dist/core/package-update.js +121 -0
- package/dist/core/permission-queue.d.ts +2 -0
- package/dist/core/permission-queue.js +20 -0
- package/dist/core/prompt-attachment.d.ts +21 -0
- package/dist/core/prompt-attachment.js +123 -0
- package/dist/core/request-plan.d.ts +16 -0
- package/dist/core/request-plan.js +36 -0
- package/dist/core/run-timing.d.ts +17 -0
- package/dist/core/run-timing.js +123 -0
- package/dist/core/self-update.d.ts +17 -0
- package/dist/core/self-update.js +54 -0
- package/dist/core/session-refs.d.ts +27 -0
- package/dist/core/session-refs.js +126 -0
- package/dist/core/session-storage.d.ts +4 -0
- package/dist/core/session-storage.js +48 -0
- package/dist/core/session-title.d.ts +1 -0
- package/dist/core/session-title.js +21 -0
- package/dist/core/session-usage.d.ts +17 -0
- package/dist/core/session-usage.js +74 -0
- package/dist/core/session.d.ts +58 -0
- package/dist/core/session.js +296 -0
- package/dist/core/settings.d.ts +17 -0
- package/dist/core/settings.js +107 -0
- package/dist/core/storage-retention.d.ts +21 -0
- package/dist/core/storage-retention.js +227 -0
- package/dist/core/text-sanitize.d.ts +1 -0
- package/dist/core/text-sanitize.js +35 -0
- package/dist/core/tool-artifacts.d.ts +6 -0
- package/dist/core/tool-artifacts.js +51 -0
- package/dist/core/tool-compress.d.ts +8 -0
- package/dist/core/tool-compress.js +111 -0
- package/dist/core/tool-executor.d.ts +16 -0
- package/dist/core/tool-executor.js +97 -0
- package/dist/core/tool-result-index.d.ts +52 -0
- package/dist/core/tool-result-index.js +327 -0
- package/dist/core/tool-result-store.d.ts +38 -0
- package/dist/core/tool-result-store.js +190 -0
- package/dist/core/tool-scheduler.d.ts +16 -0
- package/dist/core/tool-scheduler.js +35 -0
- package/dist/core/trust.d.ts +21 -0
- package/dist/core/trust.js +95 -0
- package/dist/core/types.d.ts +402 -0
- package/dist/core/types.js +1 -0
- package/dist/core/update-check.d.ts +26 -0
- package/dist/core/update-check.js +89 -0
- package/dist/core/update-process.d.ts +10 -0
- package/dist/core/update-process.js +31 -0
- package/dist/core/user-inbox.d.ts +23 -0
- package/dist/core/user-inbox.js +56 -0
- package/dist/core/user-input.d.ts +10 -0
- package/dist/core/user-input.js +35 -0
- package/dist/core/version.d.ts +1 -0
- package/dist/core/version.js +10 -0
- package/dist/core/vibe-modes.d.ts +38 -0
- package/dist/core/vibe-modes.js +383 -0
- package/dist/core/workspace-roots.d.ts +13 -0
- package/dist/core/workspace-roots.js +91 -0
- package/dist/core/workspace-sessions.d.ts +51 -0
- package/dist/core/workspace-sessions.js +243 -0
- package/dist/cowork/client.d.ts +29 -0
- package/dist/cowork/client.js +49 -0
- package/dist/cowork/engine-bridge.d.ts +22 -0
- package/dist/cowork/engine-bridge.js +98 -0
- package/dist/cowork/index.d.ts +11 -0
- package/dist/cowork/index.js +16 -0
- package/dist/cowork/ipc.d.ts +97 -0
- package/dist/cowork/ipc.js +96 -0
- package/dist/cowork/manager.d.ts +66 -0
- package/dist/cowork/manager.js +325 -0
- package/dist/cowork/store.d.ts +23 -0
- package/dist/cowork/store.js +182 -0
- package/dist/cowork/sync.d.ts +20 -0
- package/dist/cowork/sync.js +164 -0
- package/dist/cowork/types.d.ts +78 -0
- package/dist/cowork/types.js +21 -0
- package/dist/extensions/ext-tools.d.ts +3 -0
- package/dist/extensions/ext-tools.js +73 -0
- package/dist/extensions/loader.d.ts +91 -0
- package/dist/extensions/loader.js +474 -0
- package/dist/extensions/settings.d.ts +20 -0
- package/dist/extensions/settings.js +86 -0
- package/dist/extensions/types.d.ts +219 -0
- package/dist/extensions/types.js +1 -0
- package/dist/horizon/async-queue.d.ts +9 -0
- package/dist/horizon/async-queue.js +46 -0
- package/dist/horizon/engine.d.ts +85 -0
- package/dist/horizon/engine.js +603 -0
- package/dist/horizon/index.d.ts +4 -0
- package/dist/horizon/index.js +2 -0
- package/dist/horizon/main-team.d.ts +163 -0
- package/dist/horizon/main-team.js +774 -0
- package/dist/horizon/types.d.ts +233 -0
- package/dist/horizon/types.js +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +233 -0
- package/dist/mcp/protocol.d.ts +81 -0
- package/dist/mcp/protocol.js +122 -0
- package/dist/package.json +1 -0
- package/dist/packages/packages.d.ts +12 -0
- package/dist/packages/packages.js +323 -0
- package/dist/prompts/templates.d.ts +13 -0
- package/dist/prompts/templates.js +139 -0
- package/dist/providers/anthropic-oauth.d.ts +13 -0
- package/dist/providers/anthropic-oauth.js +124 -0
- package/dist/providers/anthropic.d.ts +27 -0
- package/dist/providers/anthropic.js +526 -0
- package/dist/providers/catalog.d.ts +15 -0
- package/dist/providers/catalog.js +166 -0
- package/dist/providers/effort.d.ts +12 -0
- package/dist/providers/effort.js +102 -0
- package/dist/providers/model-catalog.d.ts +43 -0
- package/dist/providers/model-catalog.js +70 -0
- package/dist/providers/model-effort.d.ts +5 -0
- package/dist/providers/model-effort.js +43 -0
- package/dist/providers/model-registry.d.ts +39 -0
- package/dist/providers/model-registry.js +142 -0
- package/dist/providers/models-dev.d.ts +9 -0
- package/dist/providers/models-dev.js +97 -0
- package/dist/providers/oauth-callback-server.d.ts +28 -0
- package/dist/providers/oauth-callback-server.js +184 -0
- package/dist/providers/oauth-orchestrator.d.ts +58 -0
- package/dist/providers/oauth-orchestrator.js +159 -0
- package/dist/providers/oauth-store.d.ts +12 -0
- package/dist/providers/oauth-store.js +139 -0
- package/dist/providers/open-browser.d.ts +20 -0
- package/dist/providers/open-browser.js +92 -0
- package/dist/providers/openai-compat.d.ts +14 -0
- package/dist/providers/openai-compat.js +523 -0
- package/dist/providers/openai-oauth.d.ts +15 -0
- package/dist/providers/openai-oauth.js +382 -0
- package/dist/providers/openrouter-auth.d.ts +73 -0
- package/dist/providers/openrouter-auth.js +321 -0
- package/dist/providers/openrouter-manual-fallback.d.ts +25 -0
- package/dist/providers/openrouter-manual-fallback.js +161 -0
- package/dist/providers/openrouter.d.ts +15 -0
- package/dist/providers/openrouter.js +107 -0
- package/dist/providers/plan-limits.d.ts +6 -0
- package/dist/providers/plan-limits.js +175 -0
- package/dist/providers/provider-reset.d.ts +4 -0
- package/dist/providers/provider-reset.js +83 -0
- package/dist/providers/quota-limits.d.ts +4 -0
- package/dist/providers/quota-limits.js +33 -0
- package/dist/providers/registry.d.ts +33 -0
- package/dist/providers/registry.js +213 -0
- package/dist/providers/retry.d.ts +37 -0
- package/dist/providers/retry.js +347 -0
- package/dist/rpc/server.d.ts +23 -0
- package/dist/rpc/server.js +222 -0
- package/dist/sdk.d.ts +67 -0
- package/dist/sdk.js +64 -0
- package/dist/skills/skills.d.ts +17 -0
- package/dist/skills/skills.js +155 -0
- package/dist/text-sanitize.js +28 -0
- package/dist/tools/ask-user.d.ts +2 -0
- package/dist/tools/ask-user.js +60 -0
- package/dist/tools/builtin.d.ts +48 -0
- package/dist/tools/builtin.js +2494 -0
- package/dist/tools/capabilities.d.ts +5 -0
- package/dist/tools/capabilities.js +55 -0
- package/dist/tools/computer-capture.d.ts +2 -0
- package/dist/tools/computer-capture.js +91 -0
- package/dist/tools/computer-posix.d.ts +5 -0
- package/dist/tools/computer-posix.js +136 -0
- package/dist/tools/computer-use.d.ts +14 -0
- package/dist/tools/computer-use.js +108 -0
- package/dist/tools/discovery.d.ts +12 -0
- package/dist/tools/discovery.js +205 -0
- package/dist/tools/execute.d.ts +2 -0
- package/dist/tools/execute.js +73 -0
- package/dist/tools/normalize-input.d.ts +17 -0
- package/dist/tools/normalize-input.js +174 -0
- package/dist/tools/output-artifact.d.ts +3 -0
- package/dist/tools/output-artifact.js +80 -0
- package/dist/tools/pagination.d.ts +15 -0
- package/dist/tools/pagination.js +93 -0
- package/dist/tools/plan-status.d.ts +2 -0
- package/dist/tools/plan-status.js +109 -0
- package/dist/tools/program-input.d.ts +3 -0
- package/dist/tools/program-input.js +19 -0
- package/dist/tools/program.d.ts +3 -0
- package/dist/tools/program.js +567 -0
- package/dist/tools/protocol-catalog.d.ts +12 -0
- package/dist/tools/protocol-catalog.js +46 -0
- package/dist/tools/ramification-tools.d.ts +12 -0
- package/dist/tools/ramification-tools.js +528 -0
- package/dist/tools/regex-compat.d.ts +9 -0
- package/dist/tools/regex-compat.js +96 -0
- package/dist/tools/registry.d.ts +51 -0
- package/dist/tools/registry.js +185 -0
- package/dist/tools/resolve.d.ts +2 -0
- package/dist/tools/resolve.js +107 -0
- package/dist/tools/shell-env.d.ts +2 -0
- package/dist/tools/shell-env.js +7 -0
- package/dist/tools/team-input.d.ts +3 -0
- package/dist/tools/team-input.js +129 -0
- package/dist/tools/team-tools.d.ts +7 -0
- package/dist/tools/team-tools.js +348 -0
- package/dist/tools/workspace-sessions.d.ts +2 -0
- package/dist/tools/workspace-sessions.js +35 -0
- package/dist/tui/account-entry.d.ts +1 -0
- package/dist/tui/account-entry.js +93 -0
- package/dist/tui/attachment-highlight.d.ts +1 -0
- package/dist/tui/attachment-highlight.js +24 -0
- package/dist/tui/attachment-refs.d.ts +2 -0
- package/dist/tui/attachment-refs.js +3 -0
- package/dist/tui/bottom-input.d.ts +219 -0
- package/dist/tui/bottom-input.js +1958 -0
- package/dist/tui/branding.d.ts +107 -0
- package/dist/tui/branding.js +750 -0
- package/dist/tui/clipboard-image.d.ts +10 -0
- package/dist/tui/clipboard-image.js +163 -0
- package/dist/tui/clipboard-text.d.ts +9 -0
- package/dist/tui/clipboard-text.js +51 -0
- package/dist/tui/clipboard-windows.d.ts +8 -0
- package/dist/tui/clipboard-windows.js +84 -0
- package/dist/tui/collapsible-command.d.ts +15 -0
- package/dist/tui/collapsible-command.js +48 -0
- package/dist/tui/command-feedback.d.ts +10 -0
- package/dist/tui/command-feedback.js +46 -0
- package/dist/tui/command-output-registry.d.ts +28 -0
- package/dist/tui/command-output-registry.js +103 -0
- package/dist/tui/command-transcript.d.ts +12 -0
- package/dist/tui/command-transcript.js +90 -0
- package/dist/tui/commands.d.ts +20 -0
- package/dist/tui/commands.js +131 -0
- package/dist/tui/context-bar.d.ts +4 -0
- package/dist/tui/context-bar.js +74 -0
- package/dist/tui/context-meter.d.ts +25 -0
- package/dist/tui/context-meter.js +81 -0
- package/dist/tui/cost-binding.d.ts +8 -0
- package/dist/tui/cost-binding.js +43 -0
- package/dist/tui/cost-tracker.d.ts +49 -0
- package/dist/tui/cost-tracker.js +122 -0
- package/dist/tui/diff.d.ts +9 -0
- package/dist/tui/diff.js +119 -0
- package/dist/tui/i18n-catalog.d.ts +5 -0
- package/dist/tui/i18n-catalog.js +184 -0
- package/dist/tui/i18n.d.ts +6 -0
- package/dist/tui/i18n.js +10 -0
- package/dist/tui/image-attachments.d.ts +46 -0
- package/dist/tui/image-attachments.js +167 -0
- package/dist/tui/images.d.ts +12 -0
- package/dist/tui/images.js +87 -0
- package/dist/tui/intro.d.ts +13 -0
- package/dist/tui/intro.js +109 -0
- package/dist/tui/language-preference.d.ts +6 -0
- package/dist/tui/language-preference.js +24 -0
- package/dist/tui/live-output.d.ts +2 -0
- package/dist/tui/live-output.js +18 -0
- package/dist/tui/locales.d.ts +19 -0
- package/dist/tui/locales.js +22 -0
- package/dist/tui/login-menu.d.ts +17 -0
- package/dist/tui/login-menu.js +58 -0
- package/dist/tui/logo.d.ts +8 -0
- package/dist/tui/logo.js +305 -0
- package/dist/tui/markdown-inline.d.ts +3 -0
- package/dist/tui/markdown-inline.js +99 -0
- package/dist/tui/markdown-table.d.ts +4 -0
- package/dist/tui/markdown-table.js +63 -0
- package/dist/tui/markdown.d.ts +11 -0
- package/dist/tui/markdown.js +257 -0
- package/dist/tui/mcp-transcript.d.ts +7 -0
- package/dist/tui/mcp-transcript.js +40 -0
- package/dist/tui/model-details.d.ts +2 -0
- package/dist/tui/model-details.js +21 -0
- package/dist/tui/model-selection.d.ts +7 -0
- package/dist/tui/model-selection.js +41 -0
- package/dist/tui/native-scrollback.d.ts +27 -0
- package/dist/tui/native-scrollback.js +134 -0
- package/dist/tui/onboarding.d.ts +72 -0
- package/dist/tui/onboarding.js +207 -0
- package/dist/tui/paste-collapse.d.ts +39 -0
- package/dist/tui/paste-collapse.js +117 -0
- package/dist/tui/perm-mode.d.ts +8 -0
- package/dist/tui/perm-mode.js +41 -0
- package/dist/tui/prompt-queue-store.d.ts +26 -0
- package/dist/tui/prompt-queue-store.js +87 -0
- package/dist/tui/prompt-queue.d.ts +47 -0
- package/dist/tui/prompt-queue.js +187 -0
- package/dist/tui/provider-menu.d.ts +33 -0
- package/dist/tui/provider-menu.js +175 -0
- package/dist/tui/question.d.ts +24 -0
- package/dist/tui/question.js +32 -0
- package/dist/tui/queue-screen.d.ts +25 -0
- package/dist/tui/queue-screen.js +152 -0
- package/dist/tui/queue-team.d.ts +3 -0
- package/dist/tui/queue-team.js +28 -0
- package/dist/tui/queued-questions.d.ts +20 -0
- package/dist/tui/queued-questions.js +163 -0
- package/dist/tui/quick-help.d.ts +1 -0
- package/dist/tui/quick-help.js +53 -0
- package/dist/tui/repl.d.ts +78 -0
- package/dist/tui/repl.js +4130 -0
- package/dist/tui/restore-queued-input.d.ts +3 -0
- package/dist/tui/restore-queued-input.js +20 -0
- package/dist/tui/review-detail.d.ts +6 -0
- package/dist/tui/review-detail.js +56 -0
- package/dist/tui/review-files.d.ts +3 -0
- package/dist/tui/review-files.js +22 -0
- package/dist/tui/review-render.d.ts +22 -0
- package/dist/tui/review-render.js +98 -0
- package/dist/tui/review-screen.d.ts +38 -0
- package/dist/tui/review-screen.js +358 -0
- package/dist/tui/review-store.d.ts +60 -0
- package/dist/tui/review-store.js +270 -0
- package/dist/tui/review-team.d.ts +2 -0
- package/dist/tui/review-team.js +27 -0
- package/dist/tui/selector-mouse.d.ts +26 -0
- package/dist/tui/selector-mouse.js +65 -0
- package/dist/tui/selector.d.ts +51 -0
- package/dist/tui/selector.js +299 -0
- package/dist/tui/session-replay.d.ts +10 -0
- package/dist/tui/session-replay.js +78 -0
- package/dist/tui/session-usage.d.ts +22 -0
- package/dist/tui/session-usage.js +55 -0
- package/dist/tui/skill-transcript.d.ts +5 -0
- package/dist/tui/skill-transcript.js +31 -0
- package/dist/tui/startup.d.ts +5 -0
- package/dist/tui/startup.js +61 -0
- package/dist/tui/status-line-loader.d.ts +8 -0
- package/dist/tui/status-line-loader.js +33 -0
- package/dist/tui/status-line.d.ts +38 -0
- package/dist/tui/status-line.js +213 -0
- package/dist/tui/system-language.d.ts +8 -0
- package/dist/tui/system-language.js +41 -0
- package/dist/tui/task-labels.d.ts +2 -0
- package/dist/tui/task-labels.js +7 -0
- package/dist/tui/term-bg.d.ts +4 -0
- package/dist/tui/term-bg.js +67 -0
- package/dist/tui/terminal-screen.d.ts +12 -0
- package/dist/tui/terminal-screen.js +1 -0
- package/dist/tui/terminal-text.d.ts +7 -0
- package/dist/tui/terminal-text.js +123 -0
- package/dist/tui/theme.d.ts +25 -0
- package/dist/tui/theme.js +383 -0
- package/dist/tui/tool-style.d.ts +7 -0
- package/dist/tui/tool-style.js +119 -0
- package/dist/tui/update-prompt.d.ts +14 -0
- package/dist/tui/update-prompt.js +104 -0
- package/dist/tui/usage-footer.d.ts +9 -0
- package/dist/tui/usage-footer.js +123 -0
- package/dist/tui/vascend-login.d.ts +68 -0
- package/dist/tui/vascend-login.js +355 -0
- package/dist/tui/web-login.d.ts +28 -0
- package/dist/tui/web-login.js +115 -0
- package/dist/vascend/activity-status.d.ts +12 -0
- package/dist/vascend/activity-status.js +68 -0
- package/dist/vascend/architecture-map.d.ts +73 -0
- package/dist/vascend/architecture-map.js +424 -0
- package/dist/vascend/attention-layout.d.ts +19 -0
- package/dist/vascend/attention-layout.js +141 -0
- package/dist/vascend/budget-allocator.d.ts +31 -0
- package/dist/vascend/budget-allocator.js +79 -0
- package/dist/vascend/candidate-collector.d.ts +20 -0
- package/dist/vascend/candidate-collector.js +220 -0
- package/dist/vascend/code-events.d.ts +24 -0
- package/dist/vascend/code-events.js +304 -0
- package/dist/vascend/code-graph-memory.d.ts +38 -0
- package/dist/vascend/code-graph-memory.js +334 -0
- package/dist/vascend/code-graph-runtime.d.ts +19 -0
- package/dist/vascend/code-graph-runtime.js +190 -0
- package/dist/vascend/code-graph-types.d.ts +58 -0
- package/dist/vascend/code-graph-types.js +50 -0
- package/dist/vascend/code-parser.d.ts +4 -0
- package/dist/vascend/code-parser.js +257 -0
- package/dist/vascend/competitor-knowledge.d.ts +53 -0
- package/dist/vascend/competitor-knowledge.js +262 -0
- package/dist/vascend/completeness.d.ts +16 -0
- package/dist/vascend/completeness.js +90 -0
- package/dist/vascend/context-autotuner.d.ts +45 -0
- package/dist/vascend/context-autotuner.js +231 -0
- package/dist/vascend/context-candidate.d.ts +45 -0
- package/dist/vascend/context-candidate.js +150 -0
- package/dist/vascend/context-capsule.d.ts +51 -0
- package/dist/vascend/context-capsule.js +133 -0
- package/dist/vascend/context-fabric.d.ts +108 -0
- package/dist/vascend/context-fabric.js +480 -0
- package/dist/vascend/context-feedback-loop.d.ts +56 -0
- package/dist/vascend/context-feedback-loop.js +204 -0
- package/dist/vascend/context-learning-identity.d.ts +4 -0
- package/dist/vascend/context-learning-identity.js +8 -0
- package/dist/vascend/context-links.d.ts +14 -0
- package/dist/vascend/context-links.js +83 -0
- package/dist/vascend/context-lint.d.ts +22 -0
- package/dist/vascend/context-lint.js +91 -0
- package/dist/vascend/context-market-selection.d.ts +17 -0
- package/dist/vascend/context-market-selection.js +50 -0
- package/dist/vascend/context-metrics.d.ts +25 -0
- package/dist/vascend/context-metrics.js +57 -0
- package/dist/vascend/context-pack-render.d.ts +16 -0
- package/dist/vascend/context-pack-render.js +52 -0
- package/dist/vascend/context-pareto.d.ts +33 -0
- package/dist/vascend/context-pareto.js +165 -0
- package/dist/vascend/context-pattern-explorer.d.ts +41 -0
- package/dist/vascend/context-pattern-explorer.js +276 -0
- package/dist/vascend/context-regret.d.ts +32 -0
- package/dist/vascend/context-regret.js +93 -0
- package/dist/vascend/context-retriever.d.ts +22 -0
- package/dist/vascend/context-retriever.js +243 -0
- package/dist/vascend/context-scope-index.d.ts +5 -0
- package/dist/vascend/context-scope-index.js +96 -0
- package/dist/vascend/context-scorer.d.ts +35 -0
- package/dist/vascend/context-scorer.js +162 -0
- package/dist/vascend/context-search-index.d.ts +12 -0
- package/dist/vascend/context-search-index.js +25 -0
- package/dist/vascend/context-snapshot.d.ts +22 -0
- package/dist/vascend/context-snapshot.js +135 -0
- package/dist/vascend/context-window-compiler.d.ts +42 -0
- package/dist/vascend/context-window-compiler.js +237 -0
- package/dist/vascend/contract-memory.d.ts +61 -0
- package/dist/vascend/contract-memory.js +435 -0
- package/dist/vascend/council.d.ts +58 -0
- package/dist/vascend/council.js +337 -0
- package/dist/vascend/decision-promotion.d.ts +48 -0
- package/dist/vascend/decision-promotion.js +410 -0
- package/dist/vascend/delta-context.d.ts +12 -0
- package/dist/vascend/delta-context.js +36 -0
- package/dist/vascend/dev-context-compiler.d.ts +27 -0
- package/dist/vascend/dev-context-compiler.js +133 -0
- package/dist/vascend/dev-context-layout.d.ts +30 -0
- package/dist/vascend/dev-context-layout.js +262 -0
- package/dist/vascend/evidence-slots.d.ts +14 -0
- package/dist/vascend/evidence-slots.js +55 -0
- package/dist/vascend/expansion-levels.d.ts +15 -0
- package/dist/vascend/expansion-levels.js +178 -0
- package/dist/vascend/file-lock.d.ts +7 -0
- package/dist/vascend/file-lock.js +95 -0
- package/dist/vascend/granular-kingdom.d.ts +25 -0
- package/dist/vascend/granular-kingdom.js +259 -0
- package/dist/vascend/granular-launcher.d.ts +48 -0
- package/dist/vascend/granular-launcher.js +202 -0
- package/dist/vascend/kingdom-bus.d.ts +25 -0
- package/dist/vascend/kingdom-bus.js +54 -0
- package/dist/vascend/kingdom-channel.d.ts +22 -0
- package/dist/vascend/kingdom-channel.js +180 -0
- package/dist/vascend/kingdom-kpi.d.ts +48 -0
- package/dist/vascend/kingdom-kpi.js +172 -0
- package/dist/vascend/kingdom-live.d.ts +28 -0
- package/dist/vascend/kingdom-live.js +61 -0
- package/dist/vascend/kingdom-run.d.ts +18 -0
- package/dist/vascend/kingdom-run.js +506 -0
- package/dist/vascend/kingdom-scribe.d.ts +20 -0
- package/dist/vascend/kingdom-scribe.js +52 -0
- package/dist/vascend/kingdom.d.ts +79 -0
- package/dist/vascend/kingdom.js +870 -0
- package/dist/vascend/lexical-index.d.ts +10 -0
- package/dist/vascend/lexical-index.js +99 -0
- package/dist/vascend/lexical-search.d.ts +29 -0
- package/dist/vascend/lexical-search.js +262 -0
- package/dist/vascend/long-term-context.d.ts +51 -0
- package/dist/vascend/long-term-context.js +194 -0
- package/dist/vascend/mandate.d.ts +33 -0
- package/dist/vascend/mandate.js +107 -0
- package/dist/vascend/memory-packet.d.ts +13 -0
- package/dist/vascend/memory-packet.js +155 -0
- package/dist/vascend/memory-status.d.ts +22 -0
- package/dist/vascend/memory-status.js +73 -0
- package/dist/vascend/memory-store.d.ts +62 -0
- package/dist/vascend/memory-store.js +273 -0
- package/dist/vascend/objective-revision.d.ts +69 -0
- package/dist/vascend/objective-revision.js +319 -0
- package/dist/vascend/patch-plan-store.d.ts +33 -0
- package/dist/vascend/patch-plan-store.js +240 -0
- package/dist/vascend/patch-plan.d.ts +97 -0
- package/dist/vascend/patch-plan.js +345 -0
- package/dist/vascend/plan-progress.d.ts +11 -0
- package/dist/vascend/plan-progress.js +68 -0
- package/dist/vascend/plan-store.d.ts +64 -0
- package/dist/vascend/plan-store.js +460 -0
- package/dist/vascend/proof-chains.d.ts +19 -0
- package/dist/vascend/proof-chains.js +120 -0
- package/dist/vascend/ramification-store.d.ts +25 -0
- package/dist/vascend/ramification-store.js +94 -0
- package/dist/vascend/ramification.d.ts +193 -0
- package/dist/vascend/ramification.js +583 -0
- package/dist/vascend/recall-planner.d.ts +17 -0
- package/dist/vascend/recall-planner.js +109 -0
- package/dist/vascend/requirements.d.ts +31 -0
- package/dist/vascend/requirements.js +151 -0
- package/dist/vascend/reviewer.d.ts +9 -0
- package/dist/vascend/reviewer.js +93 -0
- package/dist/vascend/room-graph.d.ts +29 -0
- package/dist/vascend/room-graph.js +242 -0
- package/dist/vascend/room-memory.d.ts +57 -0
- package/dist/vascend/room-memory.js +631 -0
- package/dist/vascend/runtime.d.ts +84 -0
- package/dist/vascend/runtime.js +286 -0
- package/dist/vascend/self-improve.d.ts +104 -0
- package/dist/vascend/self-improve.js +396 -0
- package/dist/vascend/session-search.d.ts +52 -0
- package/dist/vascend/session-search.js +349 -0
- package/dist/vascend/supersession-graph.d.ts +14 -0
- package/dist/vascend/supersession-graph.js +70 -0
- package/dist/vascend/team-areas.d.ts +9 -0
- package/dist/vascend/team-areas.js +28 -0
- package/dist/vascend/team-handoff.d.ts +24 -0
- package/dist/vascend/team-handoff.js +37 -0
- package/dist/vascend/team-scheduler.d.ts +13 -0
- package/dist/vascend/team-scheduler.js +74 -0
- package/dist/vascend/team-session.d.ts +42 -0
- package/dist/vascend/team-session.js +142 -0
- package/dist/vascend/test-failure-memory.d.ts +76 -0
- package/dist/vascend/test-failure-memory.js +354 -0
- package/dist/vascend/token-market.d.ts +42 -0
- package/dist/vascend/token-market.js +144 -0
- package/dist/vascend/tuner-baseline-store.d.ts +52 -0
- package/dist/vascend/tuner-baseline-store.js +446 -0
- package/dist/vascend/user-profile.d.ts +44 -0
- package/dist/vascend/user-profile.js +131 -0
- package/dist/vascend/vision.d.ts +94 -0
- package/dist/vascend/vision.js +375 -0
- package/dist/vascend/work-agent.d.ts +12 -0
- package/dist/vascend/work-agent.js +83 -0
- package/dist/vascend/work-queue.d.ts +62 -0
- package/dist/vascend/work-queue.js +255 -0
- package/dist/vascend/work-runner.d.ts +64 -0
- package/dist/vascend/work-runner.js +137 -0
- package/dist/vascend/worktree.d.ts +38 -0
- package/dist/vascend/worktree.js +206 -0
- package/dist/vendor/computer-use/README.md +7 -0
- package/dist/vendor/computer-use/computer-desktop.js +211 -0
- package/dist/vendor/computer-use/computer-observe.js +315 -0
- package/dist/vendor/computer-use/computer-scripts.js +1230 -0
- package/dist/vendor/computer-use/computer-tools.js +2136 -0
- package/dist/vendor/computer-use/package.json +1 -0
- package/dist/vendor/computer-use/rac/atomic-input.js +91 -0
- package/dist/vendor/computer-use/rac/grammatica.js +101 -0
- package/dist/vendor/computer-use/rac/parser.js +185 -0
- package/dist/vendor/computer-use/rac/protocol.js +136 -0
- package/install.ps1 +30 -0
- package/install.sh +50 -0
- package/package.json +56 -0
|
@@ -0,0 +1,603 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { bootstrap } from "../core/bootstrap.js";
|
|
3
|
+
import { buildConfig } from "../core/config.js";
|
|
4
|
+
import { prepareSessionStorage } from "../core/session-storage.js";
|
|
5
|
+
import { applyStoredCredentials, credentialsPath } from "../core/credentials.js";
|
|
6
|
+
import { runTurn } from "../core/agent.js";
|
|
7
|
+
import { createUserInbox } from "../core/user-inbox.js";
|
|
8
|
+
import { runKingdomForHost } from "../vascend/kingdom-run.js";
|
|
9
|
+
import { FileCoordinationHub, fileActor } from "../core/file-coordination.js";
|
|
10
|
+
import { listSessions, sessionFilePath } from "../core/session.js";
|
|
11
|
+
import { defaultRegistry, resolveStartupModel } from "../providers/registry.js";
|
|
12
|
+
import { listVibeModes, parseVibeMode, VIBE_MODE_IDS } from "../core/vibe-modes.js";
|
|
13
|
+
import { contextProjectKey, loadContextFrame, renderContextFrame, resetContextFrame, updateContextPins, } from "../vascend/context-fabric.js";
|
|
14
|
+
import { AsyncQueue } from "./async-queue.js";
|
|
15
|
+
import { MCP_APP_MIME_TYPE, MCP_PROTOCOL_VERSION, MCP_UI_EXTENSION_ID } from "../mcp/protocol.js";
|
|
16
|
+
const DEFAULT_RUNTIME = { bootstrap, runTurn };
|
|
17
|
+
const deny = async () => false;
|
|
18
|
+
export const HORIZON_CAPABILITIES = Object.freeze({
|
|
19
|
+
protocol: "vascend.horizon-engine",
|
|
20
|
+
protocolVersion: 1,
|
|
21
|
+
product: Object.freeze({ name: "Horizon", core: "Talos", headless: true, electron: false }),
|
|
22
|
+
lifecycle: Object.freeze(["create", "close"]),
|
|
23
|
+
sessions: Object.freeze(["current", "list", "new", "resume", "rename"]),
|
|
24
|
+
models: Object.freeze({
|
|
25
|
+
identifiers: "provider/model",
|
|
26
|
+
operations: Object.freeze(["catalog", "select", "reload"]),
|
|
27
|
+
configuredOnly: true,
|
|
28
|
+
}),
|
|
29
|
+
turns: Object.freeze({
|
|
30
|
+
stream: "async-iterable",
|
|
31
|
+
concurrency: "single-flight",
|
|
32
|
+
abort: true,
|
|
33
|
+
inputs: Object.freeze(["text", "content-parts"]),
|
|
34
|
+
ephemeralContext: true,
|
|
35
|
+
// L'host puo' consegnare messaggi a turno in corso: entrano al primo
|
|
36
|
+
// confine sicuro e l'evento `user_message` ne annuncia la presa in carico.
|
|
37
|
+
midTurnInput: true,
|
|
38
|
+
}),
|
|
39
|
+
mainTeam: Object.freeze({
|
|
40
|
+
agents: Object.freeze([1, 2]),
|
|
41
|
+
stableRefs: Object.freeze(["r1", "r2"]),
|
|
42
|
+
supervisor: true,
|
|
43
|
+
contextSharing: "explicit-exchanges-only",
|
|
44
|
+
}),
|
|
45
|
+
context: Object.freeze({
|
|
46
|
+
paradigm: "epoch-lease-lens",
|
|
47
|
+
operations: Object.freeze(["status", "pin", "unpin", "reset"]),
|
|
48
|
+
receipts: true,
|
|
49
|
+
}),
|
|
50
|
+
vibe: Object.freeze({ routing: Object.freeze(["auto", "explicit"]), modes: Object.freeze([...VIBE_MODE_IDS]) }),
|
|
51
|
+
permissions: Object.freeze({ default: "deny", hostGate: true }),
|
|
52
|
+
fileCoordination: Object.freeze({
|
|
53
|
+
modes: Object.freeze(["viewing", "editing", "writing"]),
|
|
54
|
+
writePolicy: "exclusive",
|
|
55
|
+
humanPresence: true,
|
|
56
|
+
nestedAgents: true,
|
|
57
|
+
}),
|
|
58
|
+
mcp: Object.freeze({
|
|
59
|
+
protocolVersion: MCP_PROTOCOL_VERSION,
|
|
60
|
+
toolSchema: "inputSchema",
|
|
61
|
+
callToolResult: true,
|
|
62
|
+
apps: Object.freeze({ extension: MCP_UI_EXTENSION_ID, mimeType: MCP_APP_MIME_TYPE }),
|
|
63
|
+
}),
|
|
64
|
+
});
|
|
65
|
+
export class HorizonStateError extends Error {
|
|
66
|
+
code = "HORIZON_INVALID_STATE";
|
|
67
|
+
constructor(message) {
|
|
68
|
+
super(message);
|
|
69
|
+
this.name = "HorizonStateError";
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
export class HorizonSessionNotFoundError extends Error {
|
|
73
|
+
sessionId;
|
|
74
|
+
code = "HORIZON_SESSION_NOT_FOUND";
|
|
75
|
+
constructor(sessionId) {
|
|
76
|
+
super(`sessione Horizon non trovata: ${sessionId}`);
|
|
77
|
+
this.sessionId = sessionId;
|
|
78
|
+
this.name = "HorizonSessionNotFoundError";
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
export class HorizonContextUnavailableError extends Error {
|
|
82
|
+
code = "HORIZON_CONTEXT_UNAVAILABLE";
|
|
83
|
+
constructor() {
|
|
84
|
+
super("nessun epoch attivo: esegui almeno un turno prima di modificare i pin");
|
|
85
|
+
this.name = "HorizonContextUnavailableError";
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
function normalizedWorkerModelPool(value) {
|
|
89
|
+
if (value === undefined)
|
|
90
|
+
return undefined;
|
|
91
|
+
const out = [];
|
|
92
|
+
const seen = new Set();
|
|
93
|
+
for (const raw of value) {
|
|
94
|
+
const model = String(raw || "").trim();
|
|
95
|
+
if (!/^[a-z0-9][a-z0-9._+:/@-]*$/i.test(model) || seen.has(model))
|
|
96
|
+
continue;
|
|
97
|
+
seen.add(model);
|
|
98
|
+
out.push(model);
|
|
99
|
+
if (out.length >= 32)
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
return out;
|
|
103
|
+
}
|
|
104
|
+
/** Applica il pool autorizzato senza permettere override arbitrari dal modello. */
|
|
105
|
+
export function routeWorkerModels(castles, configuredPool) {
|
|
106
|
+
const pool = normalizedWorkerModelPool(configuredPool);
|
|
107
|
+
if (pool === undefined)
|
|
108
|
+
return castles;
|
|
109
|
+
if (!pool.length)
|
|
110
|
+
throw new Error("nessun modello collaboratore autorizzato dall'utente");
|
|
111
|
+
const allowed = new Set(pool);
|
|
112
|
+
return castles.map((castle, index) => {
|
|
113
|
+
const requested = String(castle.model || "").trim();
|
|
114
|
+
if (requested && !allowed.has(requested)) {
|
|
115
|
+
throw new Error(`modello collaboratore non autorizzato: ${requested}`);
|
|
116
|
+
}
|
|
117
|
+
return { ...castle, model: requested || pool[index % pool.length] };
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Facade headless ufficiale di Talos per Vascend Terminal/Horizon.
|
|
122
|
+
*
|
|
123
|
+
* Invarianti del contratto:
|
|
124
|
+
* - nessuna dipendenza Electron o TUI;
|
|
125
|
+
* - un solo turno in volo per engine/sessione;
|
|
126
|
+
* - eventi ordinati su AsyncIterable, con completamento sempre osservabile;
|
|
127
|
+
* - cambio sessione, vibe e context mutation vietati durante un turno;
|
|
128
|
+
* - permission gate deny-by-default, fornito dal processo host.
|
|
129
|
+
*/
|
|
130
|
+
export class HorizonEngine {
|
|
131
|
+
harness;
|
|
132
|
+
options;
|
|
133
|
+
runtime;
|
|
134
|
+
stateValue = "ready";
|
|
135
|
+
active = null;
|
|
136
|
+
turnSequence = 0;
|
|
137
|
+
constructor(harness, options, runtime) {
|
|
138
|
+
this.harness = harness;
|
|
139
|
+
this.options = options;
|
|
140
|
+
this.runtime = runtime;
|
|
141
|
+
}
|
|
142
|
+
static async create(options = {}, runtime = DEFAULT_RUNTIME) {
|
|
143
|
+
// Nel contratto Horizon un sessionId significa sempre RESUME. Il bootstrap
|
|
144
|
+
// core resta tollerante per la CLI storica, ma l'host grafico deve sapere
|
|
145
|
+
// se il file e' sparito: accettarlo come sessione vuota farebbe saltare il
|
|
146
|
+
// recovery della chat e perderebbe il contesto senza alcun errore.
|
|
147
|
+
if (runtime === DEFAULT_RUNTIME && options.sessionId !== undefined) {
|
|
148
|
+
const env = applyStoredCredentials(options.env ?? process.env);
|
|
149
|
+
const config = buildConfig({
|
|
150
|
+
...(options.cwd !== undefined ? { cwd: options.cwd } : {}),
|
|
151
|
+
...(options.model !== undefined ? { model: options.model } : {}),
|
|
152
|
+
env,
|
|
153
|
+
});
|
|
154
|
+
const sessionFile = sessionFilePath(config.sessionDir, options.sessionId);
|
|
155
|
+
prepareSessionStorage(config, env);
|
|
156
|
+
if (!existsSync(sessionFile)) {
|
|
157
|
+
throw new HorizonSessionNotFoundError(options.sessionId);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
const harness = await runtime.bootstrap({
|
|
161
|
+
...(options.cwd !== undefined ? { cwd: options.cwd } : {}),
|
|
162
|
+
...(options.fsRoots !== undefined ? { fsRoots: options.fsRoots } : {}),
|
|
163
|
+
...(options.executionTarget !== undefined ? { executionTarget: options.executionTarget } : {}),
|
|
164
|
+
...(options.model !== undefined ? { model: options.model } : {}),
|
|
165
|
+
...(options.sessionId !== undefined ? { sessionId: options.sessionId } : {}),
|
|
166
|
+
...(options.continueLast !== undefined ? { continueLast: options.continueLast } : {}),
|
|
167
|
+
...(options.sessionName !== undefined ? { sessionName: options.sessionName } : {}),
|
|
168
|
+
...(options.env !== undefined ? { env: options.env } : {}),
|
|
169
|
+
...(options.trustPrompt !== undefined ? { trustPrompt: options.trustPrompt } : {}),
|
|
170
|
+
});
|
|
171
|
+
const workerModelPool = normalizedWorkerModelPool(options.workerModelPool);
|
|
172
|
+
if (workerModelPool !== undefined) {
|
|
173
|
+
harness.config = { ...harness.config, workerModelPool };
|
|
174
|
+
}
|
|
175
|
+
await options.configureHarness?.(harness);
|
|
176
|
+
const fileCoordination = options.fileCoordination ?? {
|
|
177
|
+
hub: new FileCoordinationHub(harness.config.cwd, harness.executionTarget),
|
|
178
|
+
actor: fileActor(`horizon:${harness.session.id}`, "Horizon", "main"),
|
|
179
|
+
};
|
|
180
|
+
return new HorizonEngine(harness, { ...options, fileCoordination }, runtime);
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Ispeziona i modelli realmente instradabili senza avviare Talos. Usa le
|
|
184
|
+
* stesse credenziali persistite e lo stesso ProviderRegistry del bootstrap,
|
|
185
|
+
* ma non crea Harness, sessioni, tool, estensioni o stato nel workspace.
|
|
186
|
+
*/
|
|
187
|
+
static inspectModels(options = {}) {
|
|
188
|
+
const env = applyStoredCredentials(options.env ?? process.env);
|
|
189
|
+
const providers = defaultRegistry(env);
|
|
190
|
+
const requested = inspectionModelPreference(options.model, env);
|
|
191
|
+
const effective = resolveStartupModel(providers, requested).model;
|
|
192
|
+
return modelCatalog(providers, effective);
|
|
193
|
+
}
|
|
194
|
+
get state() {
|
|
195
|
+
return this.stateValue;
|
|
196
|
+
}
|
|
197
|
+
get capabilities() {
|
|
198
|
+
return HORIZON_CAPABILITIES;
|
|
199
|
+
}
|
|
200
|
+
get session() {
|
|
201
|
+
this.assertOpen();
|
|
202
|
+
return this.sessionSnapshot();
|
|
203
|
+
}
|
|
204
|
+
listSessions() {
|
|
205
|
+
this.assertOpen();
|
|
206
|
+
return listSessions(this.harness.config.sessionDir);
|
|
207
|
+
}
|
|
208
|
+
newSession(options = {}) {
|
|
209
|
+
this.assertMutable();
|
|
210
|
+
const session = this.harness.newSession();
|
|
211
|
+
if (options.name !== undefined)
|
|
212
|
+
session.setName(options.name);
|
|
213
|
+
return this.sessionSnapshot();
|
|
214
|
+
}
|
|
215
|
+
resumeSession(id) {
|
|
216
|
+
this.assertMutable();
|
|
217
|
+
if (!existsSync(sessionFilePath(this.harness.config.sessionDir, id))) {
|
|
218
|
+
throw new HorizonSessionNotFoundError(id);
|
|
219
|
+
}
|
|
220
|
+
this.harness.loadSession(id);
|
|
221
|
+
return this.sessionSnapshot();
|
|
222
|
+
}
|
|
223
|
+
renameSession(name) {
|
|
224
|
+
this.assertMutable();
|
|
225
|
+
this.harness.session.setName(name);
|
|
226
|
+
return this.sessionSnapshot();
|
|
227
|
+
}
|
|
228
|
+
setModel(model) {
|
|
229
|
+
this.assertMutable();
|
|
230
|
+
this.harness.setModel(model);
|
|
231
|
+
return this.sessionSnapshot();
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Catalogo autoritativo per il selector dell'host. Non usa il catalogo
|
|
235
|
+
* statico: legge ogni volta il ProviderRegistry corrente, quindi non espone
|
|
236
|
+
* provider privi di credenziali e riflette subito setModel/reloadProviders.
|
|
237
|
+
*/
|
|
238
|
+
modelCatalog() {
|
|
239
|
+
this.assertOpen();
|
|
240
|
+
return modelCatalog(this.harness.providers, this.harness.config.model);
|
|
241
|
+
}
|
|
242
|
+
/** Rilegge le credenziali Talos e restituisce nello stesso giro il catalogo aggiornato. */
|
|
243
|
+
reloadProviders() {
|
|
244
|
+
this.assertMutable();
|
|
245
|
+
this.harness.reloadProviders();
|
|
246
|
+
return this.modelCatalog();
|
|
247
|
+
}
|
|
248
|
+
vibe() {
|
|
249
|
+
this.assertOpen();
|
|
250
|
+
return { selected: this.harness.config.vibeMode, modes: listVibeModes() };
|
|
251
|
+
}
|
|
252
|
+
setVibeMode(value) {
|
|
253
|
+
this.assertMutable();
|
|
254
|
+
const selection = parseVibeMode(value);
|
|
255
|
+
if (!selection)
|
|
256
|
+
throw new TypeError(`modalita' vibe non valida: ${String(value)}`);
|
|
257
|
+
this.harness.config = { ...this.harness.config, vibeMode: selection };
|
|
258
|
+
return this.vibe();
|
|
259
|
+
}
|
|
260
|
+
contextStatus() {
|
|
261
|
+
this.assertOpen();
|
|
262
|
+
return this.contextSnapshot(this.currentFrame());
|
|
263
|
+
}
|
|
264
|
+
pinContext(values) {
|
|
265
|
+
this.assertMutable();
|
|
266
|
+
const current = this.currentFrame();
|
|
267
|
+
if (!current || current.reset)
|
|
268
|
+
throw new HorizonContextUnavailableError();
|
|
269
|
+
const frame = updateContextPins({
|
|
270
|
+
sessionDir: this.harness.config.sessionDir,
|
|
271
|
+
frameId: this.harness.session.id,
|
|
272
|
+
cwd: this.harness.config.cwd,
|
|
273
|
+
add: normalizeValues(values),
|
|
274
|
+
});
|
|
275
|
+
if (!frame)
|
|
276
|
+
throw new HorizonContextUnavailableError();
|
|
277
|
+
return this.contextSnapshot(frame);
|
|
278
|
+
}
|
|
279
|
+
unpinContext(values) {
|
|
280
|
+
this.assertMutable();
|
|
281
|
+
const current = this.currentFrame();
|
|
282
|
+
if (!current || current.reset)
|
|
283
|
+
throw new HorizonContextUnavailableError();
|
|
284
|
+
const frame = updateContextPins({
|
|
285
|
+
sessionDir: this.harness.config.sessionDir,
|
|
286
|
+
frameId: this.harness.session.id,
|
|
287
|
+
cwd: this.harness.config.cwd,
|
|
288
|
+
remove: normalizeValues(values),
|
|
289
|
+
});
|
|
290
|
+
if (!frame)
|
|
291
|
+
throw new HorizonContextUnavailableError();
|
|
292
|
+
return this.contextSnapshot(frame);
|
|
293
|
+
}
|
|
294
|
+
resetContext(options = {}) {
|
|
295
|
+
this.assertMutable();
|
|
296
|
+
const frame = resetContextFrame({
|
|
297
|
+
sessionDir: this.harness.config.sessionDir,
|
|
298
|
+
frameId: this.harness.session.id,
|
|
299
|
+
cwd: this.harness.config.cwd,
|
|
300
|
+
selection: this.harness.config.vibeMode,
|
|
301
|
+
...(options.preservePins !== undefined ? { preservePins: options.preservePins } : {}),
|
|
302
|
+
});
|
|
303
|
+
return this.contextSnapshot(frame);
|
|
304
|
+
}
|
|
305
|
+
startTurn(input, options = {}) {
|
|
306
|
+
this.assertMutable();
|
|
307
|
+
if (!validInput(input))
|
|
308
|
+
throw new TypeError("il turno Horizon richiede testo o almeno una content part");
|
|
309
|
+
const sessionId = this.harness.session.id;
|
|
310
|
+
const id = `${sessionId}:${Date.now().toString(36)}:${(++this.turnSequence).toString(36)}`;
|
|
311
|
+
const controller = new AbortController();
|
|
312
|
+
const queue = new AsyncQueue();
|
|
313
|
+
let resolveDone;
|
|
314
|
+
const done = new Promise((resolve) => { resolveDone = resolve; });
|
|
315
|
+
// Casella per i messaggi che l'utente scrive mentre questo turno lavora.
|
|
316
|
+
const inbox = createUserInbox();
|
|
317
|
+
const active = { id, controller, done, inbox, finished: false };
|
|
318
|
+
this.active = active;
|
|
319
|
+
this.stateValue = "running";
|
|
320
|
+
let finalText = "";
|
|
321
|
+
let sawDone = false;
|
|
322
|
+
let sawError = false;
|
|
323
|
+
let lastStopReason;
|
|
324
|
+
const emit = (event) => {
|
|
325
|
+
if (event.type === "turn_start")
|
|
326
|
+
finalText = "";
|
|
327
|
+
else if (event.type === "tool_call")
|
|
328
|
+
finalText = "";
|
|
329
|
+
else if (event.type === "text")
|
|
330
|
+
finalText += event.delta;
|
|
331
|
+
else if (event.type === "turn_end")
|
|
332
|
+
lastStopReason = event.stopReason;
|
|
333
|
+
else if (event.type === "done")
|
|
334
|
+
sawDone = true;
|
|
335
|
+
else if (event.type === "error")
|
|
336
|
+
sawError = true;
|
|
337
|
+
queue.push(event);
|
|
338
|
+
try {
|
|
339
|
+
options.onEvent?.(event);
|
|
340
|
+
}
|
|
341
|
+
catch { /* il renderer host non governa il core */ }
|
|
342
|
+
};
|
|
343
|
+
void (async () => {
|
|
344
|
+
let status = "completed";
|
|
345
|
+
let error;
|
|
346
|
+
try {
|
|
347
|
+
const confirm = options.confirm ?? this.options.confirm ?? deny;
|
|
348
|
+
const base = this.harness.deps(confirm);
|
|
349
|
+
// Kingdoms Mode NON e' piu' un privilegio della TUI: se l'host non
|
|
350
|
+
// fornisce il suo orchestratore, il motore ne mette uno che emette
|
|
351
|
+
// eventi strutturati sullo stesso sink del turno. Senza, il tool
|
|
352
|
+
// rispondeva "solo TUI" e in chat il parallelismo non esisteva.
|
|
353
|
+
const spawnKingdom = options.spawnKingdom ?? this.options.spawnKingdom
|
|
354
|
+
?? ((castles, kopts) => runKingdomForHost({
|
|
355
|
+
harness: this.harness,
|
|
356
|
+
castles: routeWorkerModels(castles, this.options.workerModelPool),
|
|
357
|
+
signal: controller.signal,
|
|
358
|
+
sink: emit,
|
|
359
|
+
confirm,
|
|
360
|
+
ask: options.ask ?? this.options.ask,
|
|
361
|
+
...(base.fileCoordination ? { fileCoordination: base.fileCoordination } : {}),
|
|
362
|
+
...(kopts?.baseBranch ? { baseBranch: kopts.baseBranch } : {}),
|
|
363
|
+
...(kopts?.detach ? { detach: true } : {}),
|
|
364
|
+
}));
|
|
365
|
+
const ephemeralContext = options.ephemeralContext !== undefined
|
|
366
|
+
? options.ephemeralContext
|
|
367
|
+
: this.options.ephemeralContext;
|
|
368
|
+
await this.runtime.runTurn({
|
|
369
|
+
...base,
|
|
370
|
+
inbox,
|
|
371
|
+
spawnKingdom,
|
|
372
|
+
...(this.options.fileCoordination ? { fileCoordination: this.options.fileCoordination } : {}),
|
|
373
|
+
...(options.fsRoots !== undefined ? { fsRoots: options.fsRoots } : {}),
|
|
374
|
+
...(ephemeralContext !== undefined ? { ephemeralContext } : {}),
|
|
375
|
+
...(options.ask ?? this.options.ask ? { ask: options.ask ?? this.options.ask } : {}),
|
|
376
|
+
}, input, (event) => {
|
|
377
|
+
if (event.type === "error") {
|
|
378
|
+
status = controller.signal.aborted ? "aborted" : "failed";
|
|
379
|
+
error = event.message;
|
|
380
|
+
}
|
|
381
|
+
emit(event);
|
|
382
|
+
}, controller.signal);
|
|
383
|
+
if (controller.signal.aborted)
|
|
384
|
+
status = "aborted";
|
|
385
|
+
if (status === "completed" && !finalText.trim()) {
|
|
386
|
+
status = "failed";
|
|
387
|
+
error = "Il runtime Talos ha terminato senza una risposta finale; il task non e' stato dichiarato completato.";
|
|
388
|
+
if (!sawError)
|
|
389
|
+
emit({ type: "error", message: error });
|
|
390
|
+
}
|
|
391
|
+
else if (status === "completed" && !sawDone && this.runtime === DEFAULT_RUNTIME) {
|
|
392
|
+
status = "failed";
|
|
393
|
+
error = "Il runtime Talos si e' chiuso senza l'evento terminale `done`; la sessione e' conservata e puo' essere ripresa.";
|
|
394
|
+
if (!sawError)
|
|
395
|
+
emit({ type: "error", message: error });
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
catch (cause) {
|
|
399
|
+
status = controller.signal.aborted ? "aborted" : "failed";
|
|
400
|
+
error = errorMessage(cause);
|
|
401
|
+
emit({ type: "error", message: error });
|
|
402
|
+
}
|
|
403
|
+
finally {
|
|
404
|
+
if (this.options.fileCoordination) {
|
|
405
|
+
this.options.fileCoordination.hub.clearActor(this.options.fileCoordination.actor.id);
|
|
406
|
+
}
|
|
407
|
+
active.finished = true;
|
|
408
|
+
queue.close();
|
|
409
|
+
if (this.active === active)
|
|
410
|
+
this.active = null;
|
|
411
|
+
if (this.stateValue === "running")
|
|
412
|
+
this.stateValue = "ready";
|
|
413
|
+
resolveDone({
|
|
414
|
+
id,
|
|
415
|
+
sessionId,
|
|
416
|
+
status,
|
|
417
|
+
...(error !== undefined ? { error } : {}),
|
|
418
|
+
...(finalText.trim() ? { finalText: finalText.trim() } : {}),
|
|
419
|
+
...(lastStopReason !== undefined ? { stopReason: lastStopReason } : {}),
|
|
420
|
+
...(sawError ? { terminalEvent: "error" } : sawDone ? { terminalEvent: "done" } : {}),
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
})();
|
|
424
|
+
return {
|
|
425
|
+
id,
|
|
426
|
+
sessionId,
|
|
427
|
+
events: queue,
|
|
428
|
+
done,
|
|
429
|
+
abort: () => {
|
|
430
|
+
if (controller.signal.aborted || this.active !== active)
|
|
431
|
+
return false;
|
|
432
|
+
controller.abort();
|
|
433
|
+
return true;
|
|
434
|
+
},
|
|
435
|
+
send: (message, messageId) => {
|
|
436
|
+
// A turno concluso la consegna fallisce invece di sparire in silenzio:
|
|
437
|
+
// l'host deve poterlo trasformare in un turno nuovo.
|
|
438
|
+
if (active.finished || controller.signal.aborted)
|
|
439
|
+
return null;
|
|
440
|
+
if (!validInput(message))
|
|
441
|
+
throw new TypeError("il messaggio Horizon richiede testo o almeno una content part");
|
|
442
|
+
return inbox.push(typeof message === "string" ? message : message, messageId);
|
|
443
|
+
},
|
|
444
|
+
prioritize: (messageId) => {
|
|
445
|
+
if (active.finished || controller.signal.aborted)
|
|
446
|
+
return false;
|
|
447
|
+
return inbox.promote(messageId);
|
|
448
|
+
},
|
|
449
|
+
};
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
452
|
+
* Consegna un messaggio al turno attualmente in corso, senza doverne
|
|
453
|
+
* conservare il riferimento. Null se in questo momento non c'e' nulla in
|
|
454
|
+
* volo: sta all'host aprire allora un turno normale.
|
|
455
|
+
*/
|
|
456
|
+
sendToActiveTurn(input, id) {
|
|
457
|
+
this.assertOpen();
|
|
458
|
+
const active = this.active;
|
|
459
|
+
if (!active || active.finished || active.controller.signal.aborted)
|
|
460
|
+
return null;
|
|
461
|
+
if (!validInput(input))
|
|
462
|
+
throw new TypeError("il messaggio Horizon richiede testo o almeno una content part");
|
|
463
|
+
return active.inbox.push(typeof input === "string" ? input : input, id);
|
|
464
|
+
}
|
|
465
|
+
abortTurn(id) {
|
|
466
|
+
this.assertOpen();
|
|
467
|
+
if (!this.active || (id !== undefined && this.active.id !== id) || this.active.controller.signal.aborted) {
|
|
468
|
+
return false;
|
|
469
|
+
}
|
|
470
|
+
this.active.controller.abort();
|
|
471
|
+
return true;
|
|
472
|
+
}
|
|
473
|
+
async close() {
|
|
474
|
+
if (this.stateValue === "closed")
|
|
475
|
+
return;
|
|
476
|
+
this.stateValue = "closing";
|
|
477
|
+
const active = this.active;
|
|
478
|
+
if (active) {
|
|
479
|
+
active.controller.abort();
|
|
480
|
+
await active.done;
|
|
481
|
+
}
|
|
482
|
+
this.harness.dispose?.();
|
|
483
|
+
this.stateValue = "closed";
|
|
484
|
+
}
|
|
485
|
+
sessionSnapshot() {
|
|
486
|
+
return {
|
|
487
|
+
id: this.harness.session.id,
|
|
488
|
+
name: this.harness.session.name,
|
|
489
|
+
headId: this.harness.session.head,
|
|
490
|
+
messages: this.harness.session.history().length,
|
|
491
|
+
model: this.harness.config.model,
|
|
492
|
+
vibeMode: this.harness.config.vibeMode,
|
|
493
|
+
};
|
|
494
|
+
}
|
|
495
|
+
currentFrame() {
|
|
496
|
+
return loadContextFrame(this.harness.config.sessionDir, this.harness.session.id, contextProjectKey(this.harness.config.cwd), false);
|
|
497
|
+
}
|
|
498
|
+
contextSnapshot(frame) {
|
|
499
|
+
const active = Boolean(frame && !frame.reset);
|
|
500
|
+
return {
|
|
501
|
+
active,
|
|
502
|
+
epoch: frame?.epoch ?? null,
|
|
503
|
+
turn: frame?.turn ?? 0,
|
|
504
|
+
mode: active ? frame?.activeMode ?? null : null,
|
|
505
|
+
selection: frame?.selection ?? this.harness.config.vibeMode,
|
|
506
|
+
mission: active ? frame?.mission ?? "" : "",
|
|
507
|
+
pins: frame?.leases.filter((lease) => lease.source === "pinned").map((lease) => lease.term) ?? [],
|
|
508
|
+
leases: frame?.leases ?? [],
|
|
509
|
+
receipt: active ? frame?.receipt ?? null : null,
|
|
510
|
+
summary: renderContextFrame(frame),
|
|
511
|
+
};
|
|
512
|
+
}
|
|
513
|
+
assertOpen() {
|
|
514
|
+
if (this.stateValue === "closed" || this.stateValue === "closing") {
|
|
515
|
+
throw new HorizonStateError(`engine Horizon ${this.stateValue}`);
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
assertMutable() {
|
|
519
|
+
this.assertOpen();
|
|
520
|
+
if (this.active)
|
|
521
|
+
throw new HorizonStateError("un turno Horizon e' gia' in corso");
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
function normalizeValues(values) {
|
|
525
|
+
const list = typeof values === "string" ? [values] : values;
|
|
526
|
+
const normalized = list.map((value) => value.trim()).filter(Boolean);
|
|
527
|
+
if (!normalized.length)
|
|
528
|
+
throw new TypeError("specifica almeno un valore di contesto non vuoto");
|
|
529
|
+
return normalized;
|
|
530
|
+
}
|
|
531
|
+
function validInput(input) {
|
|
532
|
+
return typeof input === "string" ? input.trim().length > 0 : input.length > 0;
|
|
533
|
+
}
|
|
534
|
+
function errorMessage(value) {
|
|
535
|
+
return value instanceof Error ? value.message : String(value);
|
|
536
|
+
}
|
|
537
|
+
function modelDescriptor(provider, modelId) {
|
|
538
|
+
return {
|
|
539
|
+
id: `${provider.id}/${modelId}`,
|
|
540
|
+
modelId,
|
|
541
|
+
providerId: provider.id,
|
|
542
|
+
providerLabel: provider.label ?? provider.id,
|
|
543
|
+
};
|
|
544
|
+
}
|
|
545
|
+
const DEFAULT_MODEL = "anthropic/claude-sonnet-4-6";
|
|
546
|
+
function inspectionModelPreference(explicit, env) {
|
|
547
|
+
if (explicit !== undefined)
|
|
548
|
+
return explicit.trim();
|
|
549
|
+
const fromEnv = String(env["TALOS_MODEL"] ?? "").trim();
|
|
550
|
+
if (fromEnv)
|
|
551
|
+
return fromEnv;
|
|
552
|
+
const path = credentialsPath(env);
|
|
553
|
+
if (path && existsSync(path)) {
|
|
554
|
+
try {
|
|
555
|
+
const raw = JSON.parse(readFileSync(path, "utf8"));
|
|
556
|
+
if (raw && typeof raw === "object" && !Array.isArray(raw)) {
|
|
557
|
+
const value = raw["model"];
|
|
558
|
+
if (typeof value === "string" && value.trim())
|
|
559
|
+
return value.trim();
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
catch {
|
|
563
|
+
// Come il bootstrap: una config globale illeggibile non blocca la discovery.
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
return DEFAULT_MODEL;
|
|
567
|
+
}
|
|
568
|
+
function modelCatalog(registry, configuredModel) {
|
|
569
|
+
const providers = registry.list().map((provider) => providerDescriptor(registry, provider));
|
|
570
|
+
const models = providers.flatMap((provider) => provider.models);
|
|
571
|
+
const resolved = registry.resolve(configuredModel);
|
|
572
|
+
const current = resolved ? modelDescriptor(resolved.provider, resolved.modelId) : null;
|
|
573
|
+
return {
|
|
574
|
+
// Il selector Horizon riceve sempre l'identificatore canonico quando il
|
|
575
|
+
// runtime sa risolverlo, anche se la preferenza era un model id nudo.
|
|
576
|
+
currentModel: current?.id ?? configuredModel,
|
|
577
|
+
current,
|
|
578
|
+
providers,
|
|
579
|
+
models,
|
|
580
|
+
};
|
|
581
|
+
}
|
|
582
|
+
function providerDescriptor(registry, provider) {
|
|
583
|
+
const seen = new Set();
|
|
584
|
+
const models = [];
|
|
585
|
+
for (const raw of provider.models) {
|
|
586
|
+
const modelId = raw.trim();
|
|
587
|
+
if (!modelId)
|
|
588
|
+
continue;
|
|
589
|
+
const descriptor = modelDescriptor(provider, modelId);
|
|
590
|
+
if (seen.has(descriptor.id))
|
|
591
|
+
continue;
|
|
592
|
+
const resolved = registry.resolve(descriptor.id);
|
|
593
|
+
if (!resolved || resolved.provider.id !== provider.id || resolved.modelId !== modelId)
|
|
594
|
+
continue;
|
|
595
|
+
seen.add(descriptor.id);
|
|
596
|
+
models.push(descriptor);
|
|
597
|
+
}
|
|
598
|
+
return {
|
|
599
|
+
id: provider.id,
|
|
600
|
+
label: provider.label ?? provider.id,
|
|
601
|
+
models,
|
|
602
|
+
};
|
|
603
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { HORIZON_CAPABILITIES, HorizonContextUnavailableError, HorizonEngine, HorizonSessionNotFoundError, HorizonStateError, routeWorkerModels, } from "./engine.js";
|
|
2
|
+
export { HorizonMainTeam, needsGuideArbitration } from "./main-team.js";
|
|
3
|
+
export type { HorizonCapabilityDescriptor, HorizonContextStatus, HorizonEngineOptions, HorizonEngineState, HorizonModelCatalog, HorizonModelDescriptor, HorizonModelInspectionOptions, HorizonProviderDescriptor, HorizonRuntime, HorizonSessionListItem, HorizonSessionSnapshot, HorizonTurn, HorizonTurnInput, HorizonTurnOptions, HorizonTurnResult, HorizonTurnStatus, HorizonVibeStatus, } from "./types.js";
|
|
4
|
+
export type { HorizonGuideCooperation, HorizonGuideDecision, HorizonGuideDecisionRecord, HorizonGuideDecisionRequest, HorizonGuidePlan, HorizonGuideTask, HorizonGuideVerdict, HorizonMainExchange, HorizonMainRef, HorizonMainTeamConfig, HorizonMainTeamEvent, HorizonMainTeamResult, HorizonMainTeamTurn, HorizonTeamRef, HorizonAgentPurpose, } from "./main-team.js";
|