@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,125 @@
|
|
|
1
|
+
// Prova di diritto offline (lato client) - porting TS di
|
|
2
|
+
// vascend-terminal/src/main/licenza.js, per il cancello d'accesso di Talos.
|
|
3
|
+
//
|
|
4
|
+
// Il backend rilascia una prova firmata Ed25519 (vascend-agent-backend
|
|
5
|
+
// app/licenza.py, GET /licenza/offline). Qui la si verifica SENZA rete, con la
|
|
6
|
+
// sola chiave PUBBLICA compilata nell'app: si puo' controllare, non si puo'
|
|
7
|
+
// fabbricare. E' la risposta alla domanda giusta: "e se uno si crea una
|
|
8
|
+
// sessione fittizia e stacca la rete?" — senza la firma del server la prova
|
|
9
|
+
// non vale, e senza rete non se ne ottiene una vera.
|
|
10
|
+
//
|
|
11
|
+
// La chiave pubblica sta nel codice e non si scarica: una chiave presa dalla
|
|
12
|
+
// rete la puo' sostituire chi controlla la rete, ed e' esattamente l'attacco
|
|
13
|
+
// da cui questa firma difende (un finto server che risponde "licenza valida").
|
|
14
|
+
//
|
|
15
|
+
// Cosa NON pretende di fare: chi possiede la macchina puo' modificare il
|
|
16
|
+
// binario e togliere il controllo. Nessuna verifica locale lo impedisce.
|
|
17
|
+
// Quello che si ottiene e' che per lavorare offline serva una prova VERA, e
|
|
18
|
+
// che staccare il wifi o spostare l'orologio non siano modi per ottenerla.
|
|
19
|
+
import { createPublicKey, verify as cryptoVerify } from "node:crypto";
|
|
20
|
+
// La chiave PUBBLICA di Vascend, compilata nell'applicazione (identica a
|
|
21
|
+
// quella di Horizon). La privata corrispondente vive solo sul server che firma.
|
|
22
|
+
export const CHIAVE_PUBBLICA = [
|
|
23
|
+
"-----BEGIN PUBLIC KEY-----",
|
|
24
|
+
"MCowBQYDK2VwAyEAX/YALFQWCp0+SwqTnJ211FgRUTkOPW7R5b+pg8KCqFk=",
|
|
25
|
+
"-----END PUBLIC KEY-----",
|
|
26
|
+
].join("\n");
|
|
27
|
+
// Emittente atteso: deve combaciare con `jwt_issuer` del backend.
|
|
28
|
+
export const EMITTENTE = "vascend";
|
|
29
|
+
// Scopo dichiarato dalla prova. Un token senza questo campo non e' una
|
|
30
|
+
// licenza: e' un token d'accesso, e accettarlo qui vorrebbe dire trattare la
|
|
31
|
+
// sessione come un diritto perpetuo.
|
|
32
|
+
export const SCOPO = "offline-entitlement";
|
|
33
|
+
function base64urlToBuffer(part) {
|
|
34
|
+
const s = String(part || "").replace(/-/g, "+").replace(/_/g, "/");
|
|
35
|
+
return Buffer.from(s + "=".repeat((4 - (s.length % 4)) % 4), "base64");
|
|
36
|
+
}
|
|
37
|
+
// La firma EdDSA di un JWT copre esattamente "header.payload" in ASCII.
|
|
38
|
+
function verificaFirma(intestazione, corpo, firma, chiavePubblicaPem) {
|
|
39
|
+
try {
|
|
40
|
+
const chiave = createPublicKey(chiavePubblicaPem);
|
|
41
|
+
if (chiave.asymmetricKeyType !== "ed25519")
|
|
42
|
+
return false;
|
|
43
|
+
return cryptoVerify(null, // Ed25519: nessun digest separato
|
|
44
|
+
Buffer.from(`${intestazione}.${corpo}`, "ascii"), chiave, base64urlToBuffer(firma));
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
// Verifica completa della prova. PURA: orario e chiave si iniettano, cosi' i
|
|
51
|
+
// test viaggiano nel tempo senza toccare l'orologio della macchina. Non lancia
|
|
52
|
+
// mai: un errore degrada in "niente licenza", non in una schermata rotta.
|
|
53
|
+
export function verificaProva(token, chiavePubblicaPem = CHIAVE_PUBBLICA, opts = {}) {
|
|
54
|
+
const emittente = opts.emittente ?? EMITTENTE;
|
|
55
|
+
const adesso = Number.isFinite(opts.adesso) ? opts.adesso : Math.floor(Date.now() / 1000);
|
|
56
|
+
const pezzi = String(token || "").split(".");
|
|
57
|
+
if (pezzi.length !== 3)
|
|
58
|
+
return { ok: false, motivo: "formato" };
|
|
59
|
+
const [intestazione, corpo, firma] = pezzi;
|
|
60
|
+
let testa;
|
|
61
|
+
let claims;
|
|
62
|
+
try {
|
|
63
|
+
testa = JSON.parse(base64urlToBuffer(intestazione).toString("utf8"));
|
|
64
|
+
claims = JSON.parse(base64urlToBuffer(corpo).toString("utf8"));
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
return { ok: false, motivo: "illeggibile" };
|
|
68
|
+
}
|
|
69
|
+
// L'algoritmo si controlla PRIMA della firma: accettare quello dichiarato
|
|
70
|
+
// dal token e' la vulnerabilita' classica dei JWT (alg=none, o il passaggio
|
|
71
|
+
// a un algoritmo simmetrico usando la nostra pubblica come segreto).
|
|
72
|
+
if (!testa || testa["alg"] !== "EdDSA")
|
|
73
|
+
return { ok: false, motivo: "algoritmo" };
|
|
74
|
+
if (!verificaFirma(intestazione, corpo, firma, chiavePubblicaPem)) {
|
|
75
|
+
return { ok: false, motivo: "firma" };
|
|
76
|
+
}
|
|
77
|
+
// Solo DOPO la firma i claims valgono qualcosa: prima sono testo di chiunque.
|
|
78
|
+
if (!claims || claims.purpose !== SCOPO)
|
|
79
|
+
return { ok: false, motivo: "scopo" };
|
|
80
|
+
if (claims.iss !== emittente)
|
|
81
|
+
return { ok: false, motivo: "emittente" };
|
|
82
|
+
if (!Number.isFinite(claims.exp) || claims.exp <= adesso)
|
|
83
|
+
return { ok: false, motivo: "scaduta" };
|
|
84
|
+
if (Number.isFinite(claims.nbf) && claims.nbf > adesso + 60)
|
|
85
|
+
return { ok: false, motivo: "futura" };
|
|
86
|
+
return { ok: true, claims };
|
|
87
|
+
}
|
|
88
|
+
// --- ancoraggio dell'orologio ----------------------------------------------
|
|
89
|
+
//
|
|
90
|
+
// Senza rete l'unico riferimento temporale e' l'orologio di sistema, che
|
|
91
|
+
// l'utente controlla: riportarlo indietro allungherebbe la finestra offline
|
|
92
|
+
// all'infinito. Si conserva quindi il momento piu' avanti mai visto, e se
|
|
93
|
+
// l'orologio torna prima di quello la prova non vale.
|
|
94
|
+
//
|
|
95
|
+
// La tolleranza esiste perche' gli orologi si correggono davvero (NTP, fuso,
|
|
96
|
+
// batteria): qualche minuto all'indietro e' vita normale, un salto di giorni no.
|
|
97
|
+
export const TOLLERANZA_INDIETRO_S = 15 * 60;
|
|
98
|
+
export function orologioAttendibile(adesso, massimoVisto, tolleranza = TOLLERANZA_INDIETRO_S) {
|
|
99
|
+
if (!Number.isFinite(massimoVisto) || massimoVisto <= 0)
|
|
100
|
+
return true; // prima volta
|
|
101
|
+
if (!Number.isFinite(adesso))
|
|
102
|
+
return false;
|
|
103
|
+
return adesso >= massimoVisto - tolleranza;
|
|
104
|
+
}
|
|
105
|
+
export function nuovoMassimo(adesso, massimoVisto) {
|
|
106
|
+
const a = Number.isFinite(adesso) ? adesso : 0;
|
|
107
|
+
const m = Number.isFinite(massimoVisto) ? massimoVisto : 0;
|
|
108
|
+
return Math.max(a, m);
|
|
109
|
+
}
|
|
110
|
+
// Decisione completa: la prova vale QUI e ORA? Mette insieme firma, scadenza e
|
|
111
|
+
// orologio, e ritorna anche il nuovo massimo da conservare.
|
|
112
|
+
export function valuta(p) {
|
|
113
|
+
const ora = Number.isFinite(p.adesso) ? p.adesso : Math.floor(Date.now() / 1000);
|
|
114
|
+
const visto = Number.isFinite(p.massimoVisto) ? p.massimoVisto : 0;
|
|
115
|
+
if (!orologioAttendibile(ora, visto)) {
|
|
116
|
+
return { ok: false, motivo: "orologio", massimoVisto: nuovoMassimo(ora, visto) };
|
|
117
|
+
}
|
|
118
|
+
const esito = verificaProva(p.token, p.chiavePubblicaPem ?? CHIAVE_PUBBLICA, {
|
|
119
|
+
adesso: ora,
|
|
120
|
+
...(p.emittente ? { emittente: p.emittente } : {}),
|
|
121
|
+
});
|
|
122
|
+
if (!esito.ok)
|
|
123
|
+
return { ok: false, motivo: esito.motivo, massimoVisto: nuovoMassimo(ora, visto) };
|
|
124
|
+
return { ok: true, claims: esito.claims, massimoVisto: nuovoMassimo(ora, visto) };
|
|
125
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// Tetto di token di OUTPUT per modello. L'API Anthropic/OpenAI richiede comunque
|
|
2
|
+
// un max_tokens: "togliere il limite" significa usare il massimo che il modello
|
|
3
|
+
// accetta, non un numero arbitrario basso che troncherebbe i file lunghi.
|
|
4
|
+
// maxTokens=0 nel config = AUTO (questo massimo).
|
|
5
|
+
import { modelCapabilities } from "../providers/models-dev.js";
|
|
6
|
+
export function maxOutputFor(model) {
|
|
7
|
+
const catalogLimit = modelCapabilities(model)?.outputLimit;
|
|
8
|
+
if (catalogLimit && catalogLimit > 0)
|
|
9
|
+
return catalogLimit;
|
|
10
|
+
const m = model.toLowerCase();
|
|
11
|
+
// Claude 5 e GPT-5.6 espongono 128k token di output. Manteniamo le regole
|
|
12
|
+
// legacy piu' conservative per gli id precedenti.
|
|
13
|
+
if (/claude-(?:fable|opus|sonnet)-5(?:\b|[-.])/.test(m))
|
|
14
|
+
return 128000;
|
|
15
|
+
if (m.includes("gpt-5.6"))
|
|
16
|
+
return 128000;
|
|
17
|
+
if (m.includes("gpt-6-astra"))
|
|
18
|
+
return 128000;
|
|
19
|
+
if (m.includes("claude-haiku-4-5"))
|
|
20
|
+
return 64000;
|
|
21
|
+
if (m.includes("haiku"))
|
|
22
|
+
return 8192;
|
|
23
|
+
if (m.includes("opus"))
|
|
24
|
+
return 32000;
|
|
25
|
+
if (m.includes("sonnet"))
|
|
26
|
+
return 64000;
|
|
27
|
+
// Famiglie OpenAI/altri ragionatori: tetto generoso ma accettato.
|
|
28
|
+
if (m.includes("gpt-5") || /\bo[134]\b/.test(m) || m.includes("codex"))
|
|
29
|
+
return 32000;
|
|
30
|
+
return 16384;
|
|
31
|
+
}
|
|
32
|
+
// Risolve il max_tokens effettivo: se l'utente ne ha fissato uno (>0) lo
|
|
33
|
+
// rispetta, altrimenti usa il massimo del modello.
|
|
34
|
+
export function resolveMaxTokens(requested, model) {
|
|
35
|
+
return requested && requested > 0 ? requested : maxOutputFor(model);
|
|
36
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export interface OutputRegion {
|
|
2
|
+
readonly id: string;
|
|
3
|
+
readonly command: string;
|
|
4
|
+
readonly start: number;
|
|
5
|
+
readonly length: number;
|
|
6
|
+
readonly open: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface OutputSnapshot {
|
|
9
|
+
readonly regions: readonly OutputRegion[];
|
|
10
|
+
}
|
|
11
|
+
export interface OutputHost {
|
|
12
|
+
length(): number;
|
|
13
|
+
removeLines(start: number, count: number): void;
|
|
14
|
+
onShift?(from: number, count: number): void;
|
|
15
|
+
}
|
|
16
|
+
export declare class OutputLifecycle {
|
|
17
|
+
private readonly host;
|
|
18
|
+
private readonly stateFile?;
|
|
19
|
+
private readonly regions;
|
|
20
|
+
private readonly listeners;
|
|
21
|
+
constructor(host: OutputHost, stateFile?: string | undefined);
|
|
22
|
+
register(opts: {
|
|
23
|
+
command: string;
|
|
24
|
+
start: number;
|
|
25
|
+
length: number;
|
|
26
|
+
summary?: string;
|
|
27
|
+
id?: string;
|
|
28
|
+
}): string;
|
|
29
|
+
grow(id: string, length: number, summary?: string): void;
|
|
30
|
+
close(id: string): boolean;
|
|
31
|
+
closeAll(): number;
|
|
32
|
+
openIds(): readonly string[];
|
|
33
|
+
snapshot(): OutputSnapshot;
|
|
34
|
+
onChange(fn: (snap: OutputSnapshot) => void): () => void;
|
|
35
|
+
private emit;
|
|
36
|
+
private persist;
|
|
37
|
+
clearPersisted(): void;
|
|
38
|
+
loadPersistedOpen(): ReadonlyArray<{
|
|
39
|
+
id: string;
|
|
40
|
+
command: string;
|
|
41
|
+
summary: string;
|
|
42
|
+
}>;
|
|
43
|
+
}
|
|
44
|
+
export declare function outputStatePath(talosDir: string): string;
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
// Lifecycle degli output di comando nella cronologia chat.
|
|
2
|
+
//
|
|
3
|
+
// Problema: i comandi con output lungo (config, sessions, tree, bg, vascend...)
|
|
4
|
+
// occupano molte righe nello scrollback. Quando l'utente CHIUDE un output
|
|
5
|
+
// collassato non vogliamo solo nasconderlo (come fa un fold): vogliamo
|
|
6
|
+
// RIMUOVERLO FISICAMENTE dalla cronologia, liberando le righe e riallineando
|
|
7
|
+
// tutto cio' che le segue. Solo gli output ANCORA APERTI vengono persistiti, in
|
|
8
|
+
// modo temporaneo, cosi' che lo stato visivo (cosa e' aperto) sopravviva a un
|
|
9
|
+
// ridisegno o a un riavvio leggero, mentre il contenuto chiuso sparisce.
|
|
10
|
+
//
|
|
11
|
+
// Modulo disaccoppiato dalla TUI: opera su un OutputHost astratto (la repl gli
|
|
12
|
+
// passa il proprio log di righe; i test passano un array). Immutabilita' per i
|
|
13
|
+
// dati esportati (snapshot), mutazione confinata allo store.
|
|
14
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync, rmSync } from "node:fs";
|
|
15
|
+
import { dirname } from "node:path";
|
|
16
|
+
let seq = 0;
|
|
17
|
+
function regionId() {
|
|
18
|
+
seq += 1;
|
|
19
|
+
return `out-${Date.now().toString(36)}-${seq.toString(36)}`;
|
|
20
|
+
}
|
|
21
|
+
// Store del lifecycle. Tiene le regioni di output e la loro posizione nel log
|
|
22
|
+
// dell'host. Alla chiusura di una regione rimuove FISICAMENTE le sue righe e
|
|
23
|
+
// riallinea gli offset delle regioni successive. Persiste, su richiesta, il
|
|
24
|
+
// solo stato aperto.
|
|
25
|
+
export class OutputLifecycle {
|
|
26
|
+
host;
|
|
27
|
+
stateFile;
|
|
28
|
+
regions = [];
|
|
29
|
+
listeners = new Set();
|
|
30
|
+
constructor(host,
|
|
31
|
+
// File opzionale per la persistenza temporanea del solo stato aperto.
|
|
32
|
+
stateFile) {
|
|
33
|
+
this.host = host;
|
|
34
|
+
this.stateFile = stateFile;
|
|
35
|
+
}
|
|
36
|
+
// Registra un nuovo output di comando come APERTO. `start` e' la prima riga
|
|
37
|
+
// che occupa nel log; `length` quante righe; `summary` la riga di sintesi
|
|
38
|
+
// (persistita per ricostruire lo stato aperto). Ritorna l'id stabile.
|
|
39
|
+
register(opts) {
|
|
40
|
+
const id = opts.id ?? regionId();
|
|
41
|
+
this.regions.push({
|
|
42
|
+
id,
|
|
43
|
+
command: opts.command,
|
|
44
|
+
start: opts.start,
|
|
45
|
+
length: Math.max(0, opts.length),
|
|
46
|
+
open: true,
|
|
47
|
+
summary: opts.summary ?? "",
|
|
48
|
+
});
|
|
49
|
+
this.emit();
|
|
50
|
+
this.persist();
|
|
51
|
+
return id;
|
|
52
|
+
}
|
|
53
|
+
// Aggiorna la lunghezza/sintesi di una regione aperta (output che cresce
|
|
54
|
+
// mentre il comando produce righe).
|
|
55
|
+
grow(id, length, summary) {
|
|
56
|
+
const r = this.regions.find((x) => x.id === id);
|
|
57
|
+
if (!r || !r.open)
|
|
58
|
+
return;
|
|
59
|
+
r.length = Math.max(0, length);
|
|
60
|
+
if (summary !== undefined)
|
|
61
|
+
r.summary = summary;
|
|
62
|
+
this.emit();
|
|
63
|
+
this.persist();
|
|
64
|
+
}
|
|
65
|
+
// CHIUDE una regione: ne rimuove FISICAMENTE le righe dal log e riallinea
|
|
66
|
+
// tutte le regioni che venivano dopo (i loro start scalano di -length).
|
|
67
|
+
// Ritorna true se ha rimosso qualcosa.
|
|
68
|
+
close(id) {
|
|
69
|
+
const idx = this.regions.findIndex((x) => x.id === id);
|
|
70
|
+
if (idx === -1)
|
|
71
|
+
return false;
|
|
72
|
+
const r = this.regions[idx];
|
|
73
|
+
if (!r.open)
|
|
74
|
+
return false;
|
|
75
|
+
const removed = r.length;
|
|
76
|
+
if (removed > 0) {
|
|
77
|
+
// Rimozione fisica dal log dell'host.
|
|
78
|
+
this.host.removeLines(r.start, removed);
|
|
79
|
+
this.host.onShift?.(r.start, removed);
|
|
80
|
+
// Riallinea le regioni che iniziavano dopo la fine di questa.
|
|
81
|
+
for (const other of this.regions) {
|
|
82
|
+
if (other.id === r.id)
|
|
83
|
+
continue;
|
|
84
|
+
if (other.start >= r.start + removed)
|
|
85
|
+
other.start -= removed;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
// La regione chiusa non occupa piu' righe: esce dallo stato.
|
|
89
|
+
this.regions.splice(idx, 1);
|
|
90
|
+
this.emit();
|
|
91
|
+
this.persist();
|
|
92
|
+
return removed > 0;
|
|
93
|
+
}
|
|
94
|
+
// Chiude TUTTE le regioni aperte (es. all'arrivo di un nuovo prompt utente).
|
|
95
|
+
// Rimuove dal log dalla piu' in basso alla piu' in alto, cosi' gli offset
|
|
96
|
+
// delle ancora-da-rimuovere restano validi. Ritorna quante righe ha tolto.
|
|
97
|
+
closeAll() {
|
|
98
|
+
const open = [...this.regions].sort((a, b) => b.start - a.start);
|
|
99
|
+
let total = 0;
|
|
100
|
+
for (const r of open) {
|
|
101
|
+
total += r.length;
|
|
102
|
+
this.close(r.id);
|
|
103
|
+
}
|
|
104
|
+
return total;
|
|
105
|
+
}
|
|
106
|
+
// Id delle regioni attualmente aperte (in ordine di posizione nel log).
|
|
107
|
+
openIds() {
|
|
108
|
+
return this.regions
|
|
109
|
+
.filter((r) => r.open)
|
|
110
|
+
.sort((a, b) => a.start - b.start)
|
|
111
|
+
.map((r) => r.id);
|
|
112
|
+
}
|
|
113
|
+
// Snapshot immutabile dello stato corrente.
|
|
114
|
+
snapshot() {
|
|
115
|
+
return {
|
|
116
|
+
regions: this.regions
|
|
117
|
+
.slice()
|
|
118
|
+
.sort((a, b) => a.start - b.start)
|
|
119
|
+
.map((r) => ({ id: r.id, command: r.command, start: r.start, length: r.length, open: r.open })),
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
// Sottoscrizione ai cambi di stato (la TUI ridisegna).
|
|
123
|
+
onChange(fn) {
|
|
124
|
+
this.listeners.add(fn);
|
|
125
|
+
return () => this.listeners.delete(fn);
|
|
126
|
+
}
|
|
127
|
+
emit() {
|
|
128
|
+
const snap = this.snapshot();
|
|
129
|
+
for (const fn of this.listeners)
|
|
130
|
+
fn(snap);
|
|
131
|
+
}
|
|
132
|
+
// Persistenza TEMPORANEA del solo stato aperto. Scrive su stateFile solo le
|
|
133
|
+
// regioni open (id, comando, sintesi). Se non ci sono regioni aperte rimuove
|
|
134
|
+
// il file: niente stato chiuso lasciato a sporcare il disco. Best-effort: un
|
|
135
|
+
// errore di IO non deve far cadere la TUI.
|
|
136
|
+
persist() {
|
|
137
|
+
if (!this.stateFile)
|
|
138
|
+
return;
|
|
139
|
+
try {
|
|
140
|
+
const open = this.regions.filter((r) => r.open);
|
|
141
|
+
if (open.length === 0) {
|
|
142
|
+
if (existsSync(this.stateFile))
|
|
143
|
+
rmSync(this.stateFile);
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
const data = {
|
|
147
|
+
version: 1,
|
|
148
|
+
open: open.map((r) => ({ id: r.id, command: r.command, summary: r.summary })),
|
|
149
|
+
ts: Date.now(),
|
|
150
|
+
};
|
|
151
|
+
mkdirSync(dirname(this.stateFile), { recursive: true });
|
|
152
|
+
writeFileSync(this.stateFile, JSON.stringify(data), "utf8");
|
|
153
|
+
}
|
|
154
|
+
catch {
|
|
155
|
+
// persistenza best-effort: ignora gli errori di IO
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
// Cancella esplicitamente lo stato persistito (es. a fine sessione/reset).
|
|
159
|
+
clearPersisted() {
|
|
160
|
+
if (!this.stateFile)
|
|
161
|
+
return;
|
|
162
|
+
try {
|
|
163
|
+
if (existsSync(this.stateFile))
|
|
164
|
+
rmSync(this.stateFile);
|
|
165
|
+
}
|
|
166
|
+
catch {
|
|
167
|
+
// ignora
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
// Legge lo stato aperto persistito (id/comando/sintesi delle regioni che
|
|
171
|
+
// erano aperte). NON ricolloca le righe (gli offset di log sono volatili):
|
|
172
|
+
// serve a sapere COSA era aperto, non DOVE. Ritorna [] se assente/corrotto.
|
|
173
|
+
loadPersistedOpen() {
|
|
174
|
+
if (!this.stateFile || !existsSync(this.stateFile))
|
|
175
|
+
return [];
|
|
176
|
+
try {
|
|
177
|
+
const parsed = JSON.parse(readFileSync(this.stateFile, "utf8"));
|
|
178
|
+
if (parsed.version !== 1 || !Array.isArray(parsed.open))
|
|
179
|
+
return [];
|
|
180
|
+
return parsed.open.map((o) => ({ id: o.id, command: o.command, summary: o.summary }));
|
|
181
|
+
}
|
|
182
|
+
catch {
|
|
183
|
+
return [];
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
// Path standard per lo stato temporaneo degli output aperti, sotto .talos.
|
|
188
|
+
export function outputStatePath(talosDir) {
|
|
189
|
+
return `${talosDir}/output-state.json`;
|
|
190
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { TalosUpdate } from "./update-check.js";
|
|
2
|
+
import { type UpdateRunner } from "./update-process.js";
|
|
3
|
+
import type { UpdateResult } from "./self-update.js";
|
|
4
|
+
export type PackageManager = "npm" | "bun" | "pnpm" | "yarn";
|
|
5
|
+
export declare function managerCommand(manager: PackageManager, env: NodeJS.ProcessEnv): {
|
|
6
|
+
command: string;
|
|
7
|
+
args: readonly string[];
|
|
8
|
+
} | null;
|
|
9
|
+
export declare function packageUpdateArgs(manager: PackageManager, version: string, prefix?: string): readonly string[];
|
|
10
|
+
export declare function installPackageUpdate(update: TalosUpdate, options: {
|
|
11
|
+
readonly root: string;
|
|
12
|
+
readonly env: NodeJS.ProcessEnv;
|
|
13
|
+
readonly run?: UpdateRunner;
|
|
14
|
+
readonly managerCommand?: typeof managerCommand;
|
|
15
|
+
}): Promise<UpdateResult>;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { existsSync, readFileSync, realpathSync } from "node:fs";
|
|
2
|
+
import { delimiter, dirname, join } from "node:path";
|
|
3
|
+
import { homeDirFromEnv } from "./env-paths.js";
|
|
4
|
+
import { runUpdateCommand } from "./update-process.js";
|
|
5
|
+
const PACKAGE = "@vascend/talos";
|
|
6
|
+
const REGISTRY = "https://registry.npmjs.org";
|
|
7
|
+
export function managerCommand(manager, env) {
|
|
8
|
+
if (process.platform !== "win32")
|
|
9
|
+
return { command: manager, args: [] };
|
|
10
|
+
const path = Object.entries(env).find(([key]) => key.toLowerCase() === "path")?.[1] ?? "";
|
|
11
|
+
const directories = path.split(delimiter).filter(Boolean).map(directory => directory.replace(/^"|"$/g, ""));
|
|
12
|
+
const node = process.versions.bun ? directories.map(directory => join(directory, "node.exe")).find(file => existsSync(file)) : process.execPath;
|
|
13
|
+
for (const directory of directories) {
|
|
14
|
+
const exe = join(directory, `${manager}.exe`);
|
|
15
|
+
if (existsSync(exe))
|
|
16
|
+
return { command: exe, args: [] };
|
|
17
|
+
// Execute package-manager JS directly: Windows .cmd wrappers require a shell.
|
|
18
|
+
const scripts = {
|
|
19
|
+
npm: ["npm/bin/npm-cli.js"],
|
|
20
|
+
pnpm: ["pnpm/bin/pnpm.cjs", "corepack/dist/pnpm.js"],
|
|
21
|
+
yarn: ["yarn/bin/yarn.js", "corepack/dist/yarn.js"],
|
|
22
|
+
};
|
|
23
|
+
if (manager !== "bun")
|
|
24
|
+
for (const script of scripts[manager]) {
|
|
25
|
+
const file = join(directory, "node_modules", script);
|
|
26
|
+
if (node && existsSync(file))
|
|
27
|
+
return { command: node, args: [file] };
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
function samePath(a, b) {
|
|
33
|
+
try {
|
|
34
|
+
const normalize = (path) => process.platform === "win32" ? path.toLowerCase() : path;
|
|
35
|
+
return normalize(realpathSync(a)) === normalize(realpathSync(b));
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
// An explicit npm prefix (including the curl installer) may differ from npm's
|
|
42
|
+
// default. Accept it only when its global CLI shim points to this installation.
|
|
43
|
+
function npmPrefix(root) {
|
|
44
|
+
const modules = dirname(dirname(root));
|
|
45
|
+
if (dirname(root).split(/[\\/]/).pop() !== "@vascend" || modules.split(/[\\/]/).pop() !== "node_modules")
|
|
46
|
+
return null;
|
|
47
|
+
const prefix = process.platform === "win32" ? dirname(modules) : dirname(dirname(modules));
|
|
48
|
+
if (process.platform !== "win32") {
|
|
49
|
+
return samePath(join(prefix, "bin", "talos"), join(root, "dist", "index.js")) ? prefix : null;
|
|
50
|
+
}
|
|
51
|
+
try {
|
|
52
|
+
return /node_modules[\\/]@vascend[\\/]talos[\\/]dist[\\/]index\.js/i.test(readFileSync(join(prefix, "talos.cmd"), "utf8"))
|
|
53
|
+
? prefix : null;
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
export function packageUpdateArgs(manager, version, prefix) {
|
|
60
|
+
const target = `${PACKAGE}@${version}`;
|
|
61
|
+
if (manager === "npm")
|
|
62
|
+
return ["install", "--global", target, `--registry=${REGISTRY}`, ...(prefix ? ["--prefix", prefix] : [])];
|
|
63
|
+
if (manager === "yarn")
|
|
64
|
+
return ["global", "add", target, `--registry=${REGISTRY}`];
|
|
65
|
+
return ["add", "--global", target, `--registry=${REGISTRY}`];
|
|
66
|
+
}
|
|
67
|
+
export async function installPackageUpdate(update, options) {
|
|
68
|
+
const { root, env } = options;
|
|
69
|
+
const run = options.run ?? runUpdateCommand;
|
|
70
|
+
try {
|
|
71
|
+
if (JSON.parse(readFileSync(join(root, "package.json"), "utf8")).name !== PACKAGE) {
|
|
72
|
+
return { ok: false, reason: "unsupported", changed: false };
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
return { ok: false, reason: "unsupported", changed: false };
|
|
77
|
+
}
|
|
78
|
+
const normalized = root.replaceAll("\\", "/").toLowerCase();
|
|
79
|
+
const preferred = normalized.includes("/.pnpm/") || normalized.includes("/pnpm/") ? "pnpm"
|
|
80
|
+
: normalized.includes("/yarn/") ? "yarn" : normalized.includes("/.bun/") ? "bun" : "npm";
|
|
81
|
+
const managers = [...new Set([preferred, "npm", "bun", "pnpm", "yarn"])];
|
|
82
|
+
for (const manager of managers) {
|
|
83
|
+
const executable = (options.managerCommand ?? managerCommand)(manager, env);
|
|
84
|
+
if (!executable)
|
|
85
|
+
continue;
|
|
86
|
+
const command = (args, inherit = false) => ({
|
|
87
|
+
...executable, args: [...executable.args, ...args], cwd: homeDirFromEnv(env), env,
|
|
88
|
+
inherit, timeoutMs: inherit ? 300_000 : 2_000,
|
|
89
|
+
});
|
|
90
|
+
let prefix;
|
|
91
|
+
let matches = false;
|
|
92
|
+
try {
|
|
93
|
+
if (manager === "bun") {
|
|
94
|
+
matches = samePath(root, join(env.BUN_INSTALL ?? join(homeDirFromEnv(env), ".bun"), "install", "global", "node_modules", PACKAGE));
|
|
95
|
+
}
|
|
96
|
+
else if (manager === "yarn") {
|
|
97
|
+
matches = samePath(root, join(await run(command(["global", "dir"])), "node_modules", PACKAGE));
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
matches = samePath(root, join(await run(command(["root", "--global"])), PACKAGE));
|
|
101
|
+
if (!matches && manager === "npm") {
|
|
102
|
+
prefix = npmPrefix(root) ?? undefined;
|
|
103
|
+
matches = Boolean(prefix);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
catch {
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
if (!matches)
|
|
111
|
+
continue;
|
|
112
|
+
try {
|
|
113
|
+
await run(command(packageUpdateArgs(manager, update.version, prefix), true));
|
|
114
|
+
return { ok: true };
|
|
115
|
+
}
|
|
116
|
+
catch {
|
|
117
|
+
return { ok: false, reason: "install", changed: true };
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return { ok: false, reason: "unsupported", changed: false };
|
|
121
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const queues = new WeakMap();
|
|
2
|
+
// Concurrent file work shares one interactive permission channel. Fast
|
|
3
|
+
// automatic approvals still resolve immediately, without overlapping prompts.
|
|
4
|
+
export async function queuedConfirmation(confirm, action, detail, signal) {
|
|
5
|
+
const previous = queues.get(confirm) ?? Promise.resolve();
|
|
6
|
+
let release;
|
|
7
|
+
const current = new Promise(resolve => { release = resolve; });
|
|
8
|
+
queues.set(confirm, current);
|
|
9
|
+
await previous;
|
|
10
|
+
try {
|
|
11
|
+
if (signal.aborted)
|
|
12
|
+
return false;
|
|
13
|
+
return await confirm(action, detail);
|
|
14
|
+
}
|
|
15
|
+
finally {
|
|
16
|
+
release();
|
|
17
|
+
if (queues.get(confirm) === current)
|
|
18
|
+
queues.delete(confirm);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ContentPart } from "./types.js";
|
|
2
|
+
export interface RefResolver {
|
|
3
|
+
resolvePath(id: string): string | undefined;
|
|
4
|
+
expand?(text: string): string;
|
|
5
|
+
}
|
|
6
|
+
export type BytesReader = (path: string) => Promise<Uint8Array>;
|
|
7
|
+
export declare function normalizeRef(raw: string): string;
|
|
8
|
+
export declare function extractRefs(text: string): string[];
|
|
9
|
+
export declare function mimeFromPath(path: string): string;
|
|
10
|
+
export interface BuiltPrompt {
|
|
11
|
+
readonly parts: readonly ContentPart[];
|
|
12
|
+
readonly attached: readonly string[];
|
|
13
|
+
readonly missing: readonly string[];
|
|
14
|
+
readonly unreadable: readonly string[];
|
|
15
|
+
}
|
|
16
|
+
export interface BuildOptions {
|
|
17
|
+
readonly maxTotalBytes?: number;
|
|
18
|
+
readonly reader?: BytesReader;
|
|
19
|
+
}
|
|
20
|
+
export declare function buildPrompt(text: string, refs: RefResolver, opts?: BuildOptions): Promise<BuiltPrompt>;
|
|
21
|
+
export declare function expandRefsInText(text: string, refs: RefResolver): string;
|