@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,474 @@
|
|
|
1
|
+
import { readdirSync, existsSync } from "node:fs";
|
|
2
|
+
import { join, resolve, basename } from "node:path";
|
|
3
|
+
import { pathToFileURL } from "node:url";
|
|
4
|
+
import { spawn } from "node:child_process";
|
|
5
|
+
import { installCodeGraphRuntime } from "../vascend/code-graph-runtime.js";
|
|
6
|
+
import { ExtensionSettingsStore } from "./settings.js";
|
|
7
|
+
const headlessUi = {
|
|
8
|
+
confirm: async () => false,
|
|
9
|
+
select: async () => null,
|
|
10
|
+
input: async () => null,
|
|
11
|
+
notify: (message, type) => process.stderr.write(`[ext:${type ?? "info"}] ${message}\n`),
|
|
12
|
+
setStatus: () => { },
|
|
13
|
+
setWidget: () => { },
|
|
14
|
+
};
|
|
15
|
+
function messageText(content) {
|
|
16
|
+
if (typeof content === "string")
|
|
17
|
+
return content;
|
|
18
|
+
return content.filter((part) => part.type === "text").map((part) => part.text ?? "").join("\n");
|
|
19
|
+
}
|
|
20
|
+
function execForExtension(command, args, options = {}) {
|
|
21
|
+
return new Promise((done) => {
|
|
22
|
+
const child = spawn(command, [...args], {
|
|
23
|
+
cwd: options.cwd,
|
|
24
|
+
env: options.env ? { ...process.env, ...options.env } : process.env,
|
|
25
|
+
windowsHide: true,
|
|
26
|
+
signal: options.signal,
|
|
27
|
+
});
|
|
28
|
+
let stdout = "";
|
|
29
|
+
let stderr = "";
|
|
30
|
+
let settled = false;
|
|
31
|
+
const finish = (code, killed) => {
|
|
32
|
+
if (settled)
|
|
33
|
+
return;
|
|
34
|
+
settled = true;
|
|
35
|
+
done({ stdout, stderr, code, killed });
|
|
36
|
+
};
|
|
37
|
+
child.stdout?.on("data", (chunk) => { stdout += chunk.toString(); });
|
|
38
|
+
child.stderr?.on("data", (chunk) => { stderr += chunk.toString(); });
|
|
39
|
+
child.on("error", (error) => { stderr += error.message; finish(-1, child.killed); });
|
|
40
|
+
child.on("close", (code) => finish(code ?? -1, child.killed));
|
|
41
|
+
if (options.timeout && options.timeout > 0) {
|
|
42
|
+
const timer = setTimeout(() => child.kill(), options.timeout);
|
|
43
|
+
child.once("close", () => clearTimeout(timer));
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
function emptyPerExt() {
|
|
48
|
+
return {
|
|
49
|
+
tools: new Set(),
|
|
50
|
+
commands: new Set(),
|
|
51
|
+
shortcuts: new Set(),
|
|
52
|
+
flags: new Set(),
|
|
53
|
+
renderers: new Set(),
|
|
54
|
+
providers: new Set(),
|
|
55
|
+
handlers: [],
|
|
56
|
+
systemHooks: [],
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
// Raccoglie cio' che le estensioni registrano ed espone un bus eventi che il
|
|
60
|
+
// loop dell'agente interroga ai punti chiave (parita' Pi ExtensionApi).
|
|
61
|
+
export class ExtensionHost {
|
|
62
|
+
tools;
|
|
63
|
+
cwd;
|
|
64
|
+
commands = new Map();
|
|
65
|
+
shortcuts = new Map();
|
|
66
|
+
flags = new Map();
|
|
67
|
+
renderers = new Map();
|
|
68
|
+
pendingUserMessages = [];
|
|
69
|
+
pendingMessages = [];
|
|
70
|
+
systemHooks = [];
|
|
71
|
+
systemAppends = [];
|
|
72
|
+
handlers = new Map();
|
|
73
|
+
piFlagValues = new Map();
|
|
74
|
+
sharedEvents = new Map();
|
|
75
|
+
bindings = {};
|
|
76
|
+
// Inventario per-estensione: id file -> cosa ha registrato. Vuoto finche' non
|
|
77
|
+
// si carica. Riempito quando `currentExt` e' impostato (durante loadModule).
|
|
78
|
+
perExt = new Map();
|
|
79
|
+
currentExt = null;
|
|
80
|
+
// Estensioni esistenti su disco (anche quelle disabilitate, non in perExt).
|
|
81
|
+
knownFiles = [];
|
|
82
|
+
settings;
|
|
83
|
+
constructor(tools, cwd) {
|
|
84
|
+
this.tools = tools;
|
|
85
|
+
this.cwd = cwd;
|
|
86
|
+
this.settings = ExtensionSettingsStore.open(cwd);
|
|
87
|
+
// Il grafo strutturale viene alimentato dai tool reali senza aggiungere
|
|
88
|
+
// logica al loop dell'agente. Il wrapper e' best-effort e idempotente.
|
|
89
|
+
installCodeGraphRuntime(tools);
|
|
90
|
+
}
|
|
91
|
+
bind(bindings) {
|
|
92
|
+
this.bindings = { ...this.bindings, ...bindings };
|
|
93
|
+
}
|
|
94
|
+
// Registrazioni dell'estensione corrente (durante il load). Fuori dal load
|
|
95
|
+
// ritorna un contenitore usa-e-getta non tracciato.
|
|
96
|
+
slot() {
|
|
97
|
+
if (!this.currentExt)
|
|
98
|
+
return emptyPerExt();
|
|
99
|
+
let s = this.perExt.get(this.currentExt);
|
|
100
|
+
if (!s) {
|
|
101
|
+
s = emptyPerExt();
|
|
102
|
+
this.perExt.set(this.currentExt, s);
|
|
103
|
+
}
|
|
104
|
+
return s;
|
|
105
|
+
}
|
|
106
|
+
ctx() {
|
|
107
|
+
const b = this.bindings;
|
|
108
|
+
const base = b.systemPrompt?.() ?? "";
|
|
109
|
+
return {
|
|
110
|
+
cwd: this.cwd,
|
|
111
|
+
mode: b.mode ?? "sdk",
|
|
112
|
+
hasUI: Boolean(b.ui),
|
|
113
|
+
isProjectTrusted: () => b.isProjectTrusted?.() ?? false,
|
|
114
|
+
getContextUsage: () => b.contextUsage?.() ?? { tokens: 0, window: 0 },
|
|
115
|
+
getSystemPrompt: () => base,
|
|
116
|
+
getSystemPromptOptions: () => ({ base, appended: [...this.systemAppends] }),
|
|
117
|
+
ui: b.ui ?? headlessUi,
|
|
118
|
+
sessionManager: {
|
|
119
|
+
entries: () => b.sessionEntries?.() ?? [],
|
|
120
|
+
getBranch: () => b.sessionEntries?.() ?? [],
|
|
121
|
+
getLeafId: () => b.sessionLeafId?.() ?? null,
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
adaptTool(definition) {
|
|
126
|
+
if ("handler" in definition)
|
|
127
|
+
return definition;
|
|
128
|
+
return {
|
|
129
|
+
name: definition.name,
|
|
130
|
+
title: definition.label ?? definition.title,
|
|
131
|
+
description: definition.description,
|
|
132
|
+
inputSchema: definition.parameters,
|
|
133
|
+
...(definition.outputSchema ? { outputSchema: definition.outputSchema } : {}),
|
|
134
|
+
handler: async (input, toolCtx) => {
|
|
135
|
+
const result = await definition.execute(`talos-${Date.now().toString(36)}`, input, toolCtx.signal, () => { }, this.ctx());
|
|
136
|
+
if (typeof result === "string")
|
|
137
|
+
return result;
|
|
138
|
+
if (result && typeof result === "object" && "details" in result && !("structuredContent" in result)) {
|
|
139
|
+
const details = result.details;
|
|
140
|
+
const structuredContent = details && typeof details === "object" && !Array.isArray(details)
|
|
141
|
+
? details
|
|
142
|
+
: undefined;
|
|
143
|
+
const normalized = {
|
|
144
|
+
...(result.content ? { content: result.content } : {}),
|
|
145
|
+
...(structuredContent ? { structuredContent } : {}),
|
|
146
|
+
...(result.isError !== undefined ? { isError: result.isError } : {}),
|
|
147
|
+
};
|
|
148
|
+
return normalized;
|
|
149
|
+
}
|
|
150
|
+
return result;
|
|
151
|
+
},
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
api() {
|
|
155
|
+
// Durante il caricamento `currentExt` e' impostato: ogni registrazione viene
|
|
156
|
+
// annotata nell'inventario per-estensione (per reload e gestione).
|
|
157
|
+
const slot = this.slot();
|
|
158
|
+
const extId = this.currentExt;
|
|
159
|
+
return {
|
|
160
|
+
cwd: this.cwd,
|
|
161
|
+
registerTool: (definition) => {
|
|
162
|
+
const tool = this.adaptTool(definition);
|
|
163
|
+
this.tools.register(tool);
|
|
164
|
+
slot.tools.add(tool.name);
|
|
165
|
+
},
|
|
166
|
+
registerCommand: (command, options) => {
|
|
167
|
+
const cmd = typeof command === "string"
|
|
168
|
+
? {
|
|
169
|
+
name: command,
|
|
170
|
+
description: options?.description ?? "",
|
|
171
|
+
run: async (args) => {
|
|
172
|
+
const value = await options?.handler(args, this.ctx());
|
|
173
|
+
return typeof value === "string" ? value : null;
|
|
174
|
+
},
|
|
175
|
+
}
|
|
176
|
+
: command;
|
|
177
|
+
this.commands.set(cmd.name, cmd);
|
|
178
|
+
slot.commands.add(cmd.name);
|
|
179
|
+
},
|
|
180
|
+
registerShortcut: (shortcut, options) => {
|
|
181
|
+
const s = typeof shortcut === "string"
|
|
182
|
+
? {
|
|
183
|
+
key: shortcut,
|
|
184
|
+
description: options?.description ?? "",
|
|
185
|
+
run: (ctx) => options?.handler(ctx),
|
|
186
|
+
}
|
|
187
|
+
: shortcut;
|
|
188
|
+
this.shortcuts.set(s.key, s);
|
|
189
|
+
slot.shortcuts.add(s.key);
|
|
190
|
+
},
|
|
191
|
+
registerFlag: (flag, options) => {
|
|
192
|
+
const piName = typeof flag === "string" ? flag : null;
|
|
193
|
+
if (piName && options?.default !== undefined)
|
|
194
|
+
this.piFlagValues.set(piName, options.default);
|
|
195
|
+
const f = typeof flag === "string"
|
|
196
|
+
? {
|
|
197
|
+
name: flag.startsWith("--") ? flag : `--${flag}`,
|
|
198
|
+
description: options?.description ?? "",
|
|
199
|
+
hasValue: options?.type === "string",
|
|
200
|
+
run: (value) => {
|
|
201
|
+
this.piFlagValues.set(flag, options?.type === "string" ? value ?? "" : true);
|
|
202
|
+
},
|
|
203
|
+
}
|
|
204
|
+
: flag;
|
|
205
|
+
this.flags.set(f.name, f);
|
|
206
|
+
slot.flags.add(f.name);
|
|
207
|
+
},
|
|
208
|
+
getFlag: (name) => this.piFlagValues.get(name),
|
|
209
|
+
getAllTools: () => this.tools.names().flatMap((name) => {
|
|
210
|
+
const tool = this.tools.get(name);
|
|
211
|
+
return tool ? [{
|
|
212
|
+
name: tool.name,
|
|
213
|
+
description: tool.description,
|
|
214
|
+
parameters: tool.schema,
|
|
215
|
+
sourceInfo: {
|
|
216
|
+
path: slot.tools.has(name) ? `<extension:${extId ?? "runtime"}>` : `<builtin:${name}>`,
|
|
217
|
+
source: slot.tools.has(name) ? "extension" : "builtin",
|
|
218
|
+
scope: "temporary",
|
|
219
|
+
origin: "top-level",
|
|
220
|
+
},
|
|
221
|
+
}] : [];
|
|
222
|
+
}),
|
|
223
|
+
getActiveTools: () => this.tools.activeNames(),
|
|
224
|
+
setActiveTools: (names) => this.tools.setActive(names),
|
|
225
|
+
exec: (command, args, options) => execForExtension(command, args, options),
|
|
226
|
+
events: {
|
|
227
|
+
on: (name, handler) => {
|
|
228
|
+
const handlers = this.sharedEvents.get(name) ?? new Set();
|
|
229
|
+
handlers.add(handler);
|
|
230
|
+
this.sharedEvents.set(name, handlers);
|
|
231
|
+
},
|
|
232
|
+
off: (name, handler) => this.sharedEvents.get(name)?.delete(handler),
|
|
233
|
+
emit: (name, data) => {
|
|
234
|
+
for (const handler of this.sharedEvents.get(name) ?? [])
|
|
235
|
+
handler(data);
|
|
236
|
+
},
|
|
237
|
+
},
|
|
238
|
+
registerProvider: (name, config) => {
|
|
239
|
+
this.bindings.registerProvider?.(name, config);
|
|
240
|
+
slot.providers.add(name);
|
|
241
|
+
},
|
|
242
|
+
unregisterProvider: (name) => this.bindings.unregisterProvider?.(name),
|
|
243
|
+
registerMessageRenderer: (type, renderer) => {
|
|
244
|
+
this.renderers.set(type, renderer);
|
|
245
|
+
slot.renderers.add(type);
|
|
246
|
+
},
|
|
247
|
+
onSystemPrompt: (fn) => {
|
|
248
|
+
this.systemHooks.push(fn);
|
|
249
|
+
slot.systemHooks.push(fn);
|
|
250
|
+
},
|
|
251
|
+
on: (event, handler) => {
|
|
252
|
+
const list = this.handlers.get(event) ?? [];
|
|
253
|
+
list.push(handler);
|
|
254
|
+
this.handlers.set(event, list);
|
|
255
|
+
slot.handlers.push({ event, handler: handler });
|
|
256
|
+
},
|
|
257
|
+
sendMessage: (message, opts) => {
|
|
258
|
+
const content = typeof message === "string" ? message : messageText(message.content);
|
|
259
|
+
const display = typeof message === "string" ? opts?.display ?? true : message.display ?? opts?.display ?? true;
|
|
260
|
+
this.pendingMessages.push({ content, display });
|
|
261
|
+
},
|
|
262
|
+
sendUserMessage: (content) => this.pendingUserMessages.push(messageText(content)),
|
|
263
|
+
appendEntry: (type, data) => this.bindings.appendEntry?.(type, data),
|
|
264
|
+
setSessionName: (name) => this.bindings.setSessionName?.(name),
|
|
265
|
+
setLabel: (entryId, label) => this.bindings.setLabel?.(entryId, label),
|
|
266
|
+
log: (msg) => process.stderr.write(`[ext] ${msg}\n`),
|
|
267
|
+
reloadExtensions: () => this.reload(),
|
|
268
|
+
// Impostazioni dell'estensione corrente (lette dal file su disco).
|
|
269
|
+
getSettings: () => (extId ? this.settings.options(extId) : {}),
|
|
270
|
+
setSetting: (key, value) => {
|
|
271
|
+
if (extId)
|
|
272
|
+
this.settings.setOption(extId, key, value);
|
|
273
|
+
},
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
// API pubblica per i comandi slash gestiti dal repl.
|
|
277
|
+
publicApi() {
|
|
278
|
+
return this.api();
|
|
279
|
+
}
|
|
280
|
+
// Esegue un flag CLI registrato da un'estensione nel suo vero contesto.
|
|
281
|
+
// Il parser core conserva i flag sconosciuti fino al bootstrap; qui diventano
|
|
282
|
+
// operativi invece di restare una API registrata ma mai consumata.
|
|
283
|
+
async runFlag(name, value) {
|
|
284
|
+
const flag = this.flags.get(name);
|
|
285
|
+
if (!flag)
|
|
286
|
+
return { ok: false, reason: `flag sconosciuto: ${name}` };
|
|
287
|
+
if (flag.hasValue && value === undefined) {
|
|
288
|
+
return { ok: false, reason: `${name} richiede un valore nella forma ${name}=valore` };
|
|
289
|
+
}
|
|
290
|
+
if (!flag.hasValue && value !== undefined) {
|
|
291
|
+
return { ok: false, reason: `${name} non accetta un valore` };
|
|
292
|
+
}
|
|
293
|
+
await flag.run(value, this.ctx());
|
|
294
|
+
return { ok: true };
|
|
295
|
+
}
|
|
296
|
+
// Emette un evento a tutti gli handler registrati, raccogliendo gli esiti.
|
|
297
|
+
hasHandlers(event) {
|
|
298
|
+
return (this.handlers.get(event)?.length ?? 0) > 0;
|
|
299
|
+
}
|
|
300
|
+
async emit(event, payload) {
|
|
301
|
+
const list = this.handlers.get(event);
|
|
302
|
+
if (!list || !list.length)
|
|
303
|
+
return [];
|
|
304
|
+
const ctx = this.ctx();
|
|
305
|
+
const outcomes = [];
|
|
306
|
+
for (const handler of list) {
|
|
307
|
+
try {
|
|
308
|
+
const out = await handler(payload, ctx);
|
|
309
|
+
if (out)
|
|
310
|
+
outcomes.push(out);
|
|
311
|
+
}
|
|
312
|
+
catch (err) {
|
|
313
|
+
process.stderr.write(`[ext] handler ${event} errore: ${err.message}\n`);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
return outcomes;
|
|
317
|
+
}
|
|
318
|
+
// Applica gli hook delle estensioni al system prompt di base.
|
|
319
|
+
applySystem(base) {
|
|
320
|
+
const withAppends = this.systemAppends.length ? `${base}\n\n${this.systemAppends.join("\n\n")}` : base;
|
|
321
|
+
return this.systemHooks.reduce((acc, fn) => fn(acc), withAppends);
|
|
322
|
+
}
|
|
323
|
+
async loadModule(spec, cacheBust = false) {
|
|
324
|
+
let url = pathToFileURL(resolve(this.cwd, spec)).href;
|
|
325
|
+
// Cache-bust: il loader di moduli ESM tiene una cache per URL, quindi un
|
|
326
|
+
// secondo import dello stesso file ritornerebbe la versione vecchia. Una
|
|
327
|
+
// query string univoca forza la rivalutazione del file dal disco.
|
|
328
|
+
if (cacheBust)
|
|
329
|
+
url += `?t=${Date.now()}`;
|
|
330
|
+
const mod = (await import(url));
|
|
331
|
+
if (typeof mod.default === "function") {
|
|
332
|
+
await mod.default(this.api());
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
// Carica tutte le estensioni da .talos/extensions/*.{ts,js,mjs}, saltando
|
|
336
|
+
// quelle disabilitate nei settings. Popola l'inventario per-estensione.
|
|
337
|
+
async loadDir(cacheBust = false) {
|
|
338
|
+
const dir = join(this.cwd, ".talos", "extensions");
|
|
339
|
+
if (!existsSync(dir)) {
|
|
340
|
+
this.knownFiles = [];
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
const files = readdirSync(dir).filter((f) => /\.(ts|js|mjs)$/.test(f));
|
|
344
|
+
this.knownFiles = [...files].sort();
|
|
345
|
+
for (const f of files) {
|
|
346
|
+
if (!this.settings.isEnabled(f))
|
|
347
|
+
continue; // disabilitata: salta
|
|
348
|
+
this.currentExt = f;
|
|
349
|
+
try {
|
|
350
|
+
await this.loadModule(join(dir, f), cacheBust);
|
|
351
|
+
}
|
|
352
|
+
catch (err) {
|
|
353
|
+
process.stderr.write(`[ext] errore caricando ${f}: ${err.message}\n`);
|
|
354
|
+
}
|
|
355
|
+
finally {
|
|
356
|
+
this.currentExt = null;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
// Annulla le registrazioni di UNA estensione (o di tutte). Lascia intatti i
|
|
361
|
+
// tool/comandi CORE (non in perExt). Idempotente.
|
|
362
|
+
unloadOne(id) {
|
|
363
|
+
const s = this.perExt.get(id);
|
|
364
|
+
if (!s)
|
|
365
|
+
return;
|
|
366
|
+
for (const name of s.tools)
|
|
367
|
+
this.tools.remove(name);
|
|
368
|
+
for (const name of s.commands)
|
|
369
|
+
this.commands.delete(name);
|
|
370
|
+
for (const key of s.shortcuts)
|
|
371
|
+
this.shortcuts.delete(key);
|
|
372
|
+
for (const name of s.flags)
|
|
373
|
+
this.flags.delete(name);
|
|
374
|
+
for (const type of s.renderers)
|
|
375
|
+
this.renderers.delete(type);
|
|
376
|
+
for (const name of s.providers)
|
|
377
|
+
this.bindings.unregisterProvider?.(name);
|
|
378
|
+
const toDrop = new Set(s.handlers.map((h) => h.handler));
|
|
379
|
+
for (const [event, list] of this.handlers) {
|
|
380
|
+
const kept = list.filter((h) => !toDrop.has(h));
|
|
381
|
+
if (kept.length)
|
|
382
|
+
this.handlers.set(event, kept);
|
|
383
|
+
else
|
|
384
|
+
this.handlers.delete(event);
|
|
385
|
+
}
|
|
386
|
+
const dropHooks = new Set(s.systemHooks);
|
|
387
|
+
let i = this.systemHooks.length;
|
|
388
|
+
while (i--)
|
|
389
|
+
if (dropHooks.has(this.systemHooks[i]))
|
|
390
|
+
this.systemHooks.splice(i, 1);
|
|
391
|
+
this.perExt.delete(id);
|
|
392
|
+
}
|
|
393
|
+
unloadAll() {
|
|
394
|
+
for (const id of [...this.perExt.keys()])
|
|
395
|
+
this.unloadOne(id);
|
|
396
|
+
}
|
|
397
|
+
allTools() {
|
|
398
|
+
const out = new Set();
|
|
399
|
+
for (const s of this.perExt.values())
|
|
400
|
+
for (const t of s.tools)
|
|
401
|
+
out.add(t);
|
|
402
|
+
return [...out].sort();
|
|
403
|
+
}
|
|
404
|
+
// Hot reload (parita' pi.dev): scarica le estensioni correnti e ricarica la
|
|
405
|
+
// dir da disco con cache-bust. Ritorna un diff dei tool per il feedback.
|
|
406
|
+
async reload() {
|
|
407
|
+
const before = this.allTools();
|
|
408
|
+
this.unloadAll();
|
|
409
|
+
this.settings = ExtensionSettingsStore.open(this.cwd); // rilegge i settings
|
|
410
|
+
await this.loadDir(true);
|
|
411
|
+
const after = this.allTools();
|
|
412
|
+
const beforeSet = new Set(before);
|
|
413
|
+
const afterSet = new Set(after);
|
|
414
|
+
return {
|
|
415
|
+
before,
|
|
416
|
+
after,
|
|
417
|
+
added: after.filter((t) => !beforeSet.has(t)),
|
|
418
|
+
removed: before.filter((t) => !afterSet.has(t)),
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
// --- Gestione/lista estensioni (esposta a tool agente e comando TUI) ---
|
|
422
|
+
// Inventario completo: tutte le estensioni note su disco con stato e
|
|
423
|
+
// registrazioni. Le disabilitate compaiono con loaded=false.
|
|
424
|
+
inventory() {
|
|
425
|
+
const ids = new Set([...this.knownFiles, ...this.perExt.keys()]);
|
|
426
|
+
const out = [];
|
|
427
|
+
for (const id of [...ids].sort()) {
|
|
428
|
+
const s = this.perExt.get(id);
|
|
429
|
+
out.push({
|
|
430
|
+
id,
|
|
431
|
+
enabled: this.settings.isEnabled(id),
|
|
432
|
+
loaded: Boolean(s),
|
|
433
|
+
tools: s ? [...s.tools].sort() : [],
|
|
434
|
+
commands: s ? [...s.commands].sort() : [],
|
|
435
|
+
shortcuts: s ? [...s.shortcuts].sort() : [],
|
|
436
|
+
flags: s ? [...s.flags].sort() : [],
|
|
437
|
+
renderers: s ? [...s.renderers].sort() : [],
|
|
438
|
+
providers: s ? [...s.providers].sort() : [],
|
|
439
|
+
events: s ? [...new Set(s.handlers.map((h) => h.event))].sort() : [],
|
|
440
|
+
systemHooks: s ? s.systemHooks.length : 0,
|
|
441
|
+
options: this.settings.options(id),
|
|
442
|
+
});
|
|
443
|
+
}
|
|
444
|
+
return out;
|
|
445
|
+
}
|
|
446
|
+
// Abilita/disabilita un'estensione: persiste il settaggio e ricarica.
|
|
447
|
+
async setEnabled(id, enabled) {
|
|
448
|
+
if (!this.knownFiles.includes(id) && !this.perExt.has(id)) {
|
|
449
|
+
return { ok: false, reason: `estensione '${id}' non trovata` };
|
|
450
|
+
}
|
|
451
|
+
this.settings.setEnabled(id, enabled);
|
|
452
|
+
await this.reload();
|
|
453
|
+
return { ok: true };
|
|
454
|
+
}
|
|
455
|
+
// Imposta un'opzione di un'estensione (persistita). Ricarica per applicarla.
|
|
456
|
+
async setOption(id, key, value) {
|
|
457
|
+
if (!this.knownFiles.includes(id) && !this.perExt.has(id)) {
|
|
458
|
+
return { ok: false, reason: `estensione '${id}' non trovata` };
|
|
459
|
+
}
|
|
460
|
+
this.settings.setOption(id, key, value);
|
|
461
|
+
await this.reload();
|
|
462
|
+
return { ok: true };
|
|
463
|
+
}
|
|
464
|
+
// Normalizza un id passato dall'utente (accetta nome senza estensione).
|
|
465
|
+
resolveId(input) {
|
|
466
|
+
const ids = new Set([...this.knownFiles, ...this.perExt.keys()]);
|
|
467
|
+
if (ids.has(input))
|
|
468
|
+
return input;
|
|
469
|
+
for (const id of ids)
|
|
470
|
+
if (basename(id).replace(/\.(ts|js|mjs)$/, "") === input)
|
|
471
|
+
return id;
|
|
472
|
+
return null;
|
|
473
|
+
}
|
|
474
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface ExtensionSetting {
|
|
2
|
+
enabled: boolean;
|
|
3
|
+
options: Record<string, unknown>;
|
|
4
|
+
}
|
|
5
|
+
type SettingsMap = Record<string, ExtensionSetting>;
|
|
6
|
+
export declare class ExtensionSettingsStore {
|
|
7
|
+
private readonly file;
|
|
8
|
+
private cache;
|
|
9
|
+
private constructor();
|
|
10
|
+
static open(cwd: string): ExtensionSettingsStore;
|
|
11
|
+
get(id: string): ExtensionSetting;
|
|
12
|
+
isEnabled(id: string): boolean;
|
|
13
|
+
options(id: string): Record<string, unknown>;
|
|
14
|
+
all(): SettingsMap;
|
|
15
|
+
setEnabled(id: string, enabled: boolean): void;
|
|
16
|
+
setOption(id: string, key: string, value: unknown): void;
|
|
17
|
+
setOptions(id: string, options: Record<string, unknown>): void;
|
|
18
|
+
private persist;
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { readFileSync, writeFileSync, existsSync, mkdirSync } from "node:fs";
|
|
2
|
+
import { join, dirname } from "node:path";
|
|
3
|
+
// Store JSON append/overwrite su .talos/extensions-settings.json. Immutabile
|
|
4
|
+
// verso l'esterno: ogni mutazione riscrive il file e aggiorna la cache interna.
|
|
5
|
+
export class ExtensionSettingsStore {
|
|
6
|
+
file;
|
|
7
|
+
cache;
|
|
8
|
+
constructor(file, initial) {
|
|
9
|
+
this.file = file;
|
|
10
|
+
this.cache = initial;
|
|
11
|
+
}
|
|
12
|
+
static open(cwd) {
|
|
13
|
+
const file = join(cwd, ".talos", "extensions-settings.json");
|
|
14
|
+
let data = {};
|
|
15
|
+
if (existsSync(file)) {
|
|
16
|
+
try {
|
|
17
|
+
const raw = JSON.parse(readFileSync(file, "utf8"));
|
|
18
|
+
if (raw && typeof raw === "object")
|
|
19
|
+
data = normalize(raw);
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
// file corrotto: riparti da vuoto, non bloccare l'avvio.
|
|
23
|
+
data = {};
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return new ExtensionSettingsStore(file, data);
|
|
27
|
+
}
|
|
28
|
+
// Stato di un'estensione (default: abilitata, opzioni vuote).
|
|
29
|
+
get(id) {
|
|
30
|
+
return this.cache[id] ?? { enabled: true, options: {} };
|
|
31
|
+
}
|
|
32
|
+
isEnabled(id) {
|
|
33
|
+
return this.get(id).enabled;
|
|
34
|
+
}
|
|
35
|
+
options(id) {
|
|
36
|
+
return { ...this.get(id).options };
|
|
37
|
+
}
|
|
38
|
+
// Tutte le impostazioni esplicite presenti sul disco.
|
|
39
|
+
all() {
|
|
40
|
+
const out = {};
|
|
41
|
+
for (const [k, v] of Object.entries(this.cache))
|
|
42
|
+
out[k] = { enabled: v.enabled, options: { ...v.options } };
|
|
43
|
+
return out;
|
|
44
|
+
}
|
|
45
|
+
setEnabled(id, enabled) {
|
|
46
|
+
const cur = this.get(id);
|
|
47
|
+
this.cache = { ...this.cache, [id]: { ...cur, enabled } };
|
|
48
|
+
this.persist();
|
|
49
|
+
}
|
|
50
|
+
// Aggiorna una singola opzione (merge). value undefined la rimuove.
|
|
51
|
+
setOption(id, key, value) {
|
|
52
|
+
const cur = this.get(id);
|
|
53
|
+
const options = { ...cur.options };
|
|
54
|
+
if (value === undefined)
|
|
55
|
+
delete options[key];
|
|
56
|
+
else
|
|
57
|
+
options[key] = value;
|
|
58
|
+
this.cache = { ...this.cache, [id]: { ...cur, options } };
|
|
59
|
+
this.persist();
|
|
60
|
+
}
|
|
61
|
+
// Sostituisce in blocco le opzioni di un'estensione.
|
|
62
|
+
setOptions(id, options) {
|
|
63
|
+
const cur = this.get(id);
|
|
64
|
+
this.cache = { ...this.cache, [id]: { ...cur, options: { ...options } } };
|
|
65
|
+
this.persist();
|
|
66
|
+
}
|
|
67
|
+
persist() {
|
|
68
|
+
const dir = dirname(this.file);
|
|
69
|
+
if (!existsSync(dir))
|
|
70
|
+
mkdirSync(dir, { recursive: true });
|
|
71
|
+
writeFileSync(this.file, JSON.stringify(this.cache, null, 2) + "\n", "utf8");
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
function normalize(raw) {
|
|
75
|
+
const out = {};
|
|
76
|
+
for (const [id, v] of Object.entries(raw)) {
|
|
77
|
+
if (!v || typeof v !== "object")
|
|
78
|
+
continue;
|
|
79
|
+
const rec = v;
|
|
80
|
+
out[id] = {
|
|
81
|
+
enabled: rec.enabled !== false,
|
|
82
|
+
options: rec.options && typeof rec.options === "object" ? rec.options : {},
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
return out;
|
|
86
|
+
}
|