@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,233 @@
|
|
|
1
|
+
import type { AgentDeps } from "../core/agent.js";
|
|
2
|
+
import type { Harness } from "../core/bootstrap.js";
|
|
3
|
+
import type { ContextLease, ContextReceipt } from "../vascend/context-fabric.js";
|
|
4
|
+
import type { AgentEvent, ContentPart, ModelTurn } from "../core/types.js";
|
|
5
|
+
import type { VibeModeId, VibeModeSelection, VibeModeSpec } from "../core/vibe-modes.js";
|
|
6
|
+
import type { FileCoordinationContext } from "../core/file-coordination.js";
|
|
7
|
+
import type { ExecutionTarget } from "../core/execution-target.js";
|
|
8
|
+
/** Lifecycle osservabile del facade headless. */
|
|
9
|
+
export type HorizonEngineState = "ready" | "running" | "closing" | "closed";
|
|
10
|
+
export interface HorizonEngineOptions {
|
|
11
|
+
readonly cwd?: string;
|
|
12
|
+
readonly fsRoots?: readonly string[];
|
|
13
|
+
readonly executionTarget?: ExecutionTarget;
|
|
14
|
+
/** Hub condiviso di presenza e lock file; se assente l'engine ne crea uno locale. */
|
|
15
|
+
readonly fileCoordination?: FileCoordinationContext;
|
|
16
|
+
readonly model?: string;
|
|
17
|
+
readonly sessionId?: string;
|
|
18
|
+
readonly continueLast?: boolean;
|
|
19
|
+
readonly sessionName?: string;
|
|
20
|
+
readonly env?: NodeJS.ProcessEnv;
|
|
21
|
+
/** Evidenza host non persistente applicata ai turni, salvo override locale. */
|
|
22
|
+
readonly ephemeralContext?: string;
|
|
23
|
+
/** Permission gate dell'host. In assenza, Horizon nega ogni azione. */
|
|
24
|
+
readonly confirm?: AgentDeps["confirm"];
|
|
25
|
+
/** Canale headless per le domande del modello. In assenza, non viene esposto. */
|
|
26
|
+
readonly ask?: AgentDeps["ask"];
|
|
27
|
+
/** Orchestratore opzionale per Kingdoms Mode, implementato dal processo host. */
|
|
28
|
+
readonly spawnKingdom?: AgentDeps["spawnKingdom"];
|
|
29
|
+
/**
|
|
30
|
+
* Modelli provider/modello che l'orchestratore puo' assegnare ai collaboratori.
|
|
31
|
+
* `undefined` conserva il comportamento legacy; `[]` disabilita lo spawn.
|
|
32
|
+
*/
|
|
33
|
+
readonly workerModelPool?: readonly string[];
|
|
34
|
+
readonly trustPrompt?: (resources: readonly string[]) => Promise<boolean>;
|
|
35
|
+
/**
|
|
36
|
+
* Adattatore host eseguito una volta dopo bootstrap e prima di esporre il
|
|
37
|
+
* motore. Consente a Horizon Desktop di registrare tool IDE e contesto locale
|
|
38
|
+
* senza importare Electron nel core Talos.
|
|
39
|
+
*/
|
|
40
|
+
readonly configureHarness?: (harness: Harness) => void | Promise<void>;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Opzioni della discovery modelli senza bootstrap. L'ispezione legge soltanto
|
|
44
|
+
* configurazione/credenziali globali Talos e non crea sessioni o workspace.
|
|
45
|
+
*/
|
|
46
|
+
export interface HorizonModelInspectionOptions {
|
|
47
|
+
readonly model?: string;
|
|
48
|
+
readonly env?: NodeJS.ProcessEnv;
|
|
49
|
+
}
|
|
50
|
+
export interface HorizonTurnOptions {
|
|
51
|
+
/** Override del permission gate per il solo turno. */
|
|
52
|
+
readonly confirm?: AgentDeps["confirm"];
|
|
53
|
+
/**
|
|
54
|
+
* Cartelle aggiuntive concesse ai tool filesystem per questo turno.
|
|
55
|
+
* Il riferimento non viene copiato: l'host puo' aggiungere una root dopo
|
|
56
|
+
* una conferma inline mentre il turno e' ancora in esecuzione.
|
|
57
|
+
*/
|
|
58
|
+
readonly fsRoots?: readonly string[];
|
|
59
|
+
/** Evidenza host non attendibile valida esclusivamente per questo turno. */
|
|
60
|
+
readonly ephemeralContext?: string;
|
|
61
|
+
readonly ask?: AgentDeps["ask"];
|
|
62
|
+
readonly spawnKingdom?: AgentDeps["spawnKingdom"];
|
|
63
|
+
/** Mirror opzionale: un errore del callback non interrompe il motore. */
|
|
64
|
+
readonly onEvent?: (event: AgentEvent) => void;
|
|
65
|
+
}
|
|
66
|
+
export type HorizonTurnInput = string | readonly ContentPart[];
|
|
67
|
+
export type HorizonTurnStatus = "completed" | "failed" | "aborted";
|
|
68
|
+
export interface HorizonTurnResult {
|
|
69
|
+
readonly id: string;
|
|
70
|
+
readonly sessionId: string;
|
|
71
|
+
readonly status: HorizonTurnStatus;
|
|
72
|
+
readonly error?: string;
|
|
73
|
+
/** Ultimo blocco di prosa del giro finale, dopo l'ultima tool call. */
|
|
74
|
+
readonly finalText?: string;
|
|
75
|
+
readonly stopReason?: ModelTurn["stopReason"];
|
|
76
|
+
readonly terminalEvent?: "done" | "error";
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Handle single-consumer di un turno gia' avviato.
|
|
80
|
+
* `events` termina sempre prima che `done` si risolva; `abort()` e' idempotente.
|
|
81
|
+
*/
|
|
82
|
+
export interface HorizonTurn {
|
|
83
|
+
readonly id: string;
|
|
84
|
+
readonly sessionId: string;
|
|
85
|
+
readonly events: AsyncIterable<AgentEvent>;
|
|
86
|
+
readonly done: Promise<HorizonTurnResult>;
|
|
87
|
+
abort(): boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Consegna al turno IN CORSO un messaggio scritto adesso dall'utente. Entra
|
|
90
|
+
* nel contesto al primo confine sicuro (dopo gli esiti dei tool), non a fine
|
|
91
|
+
* risposta. Ritorna l'id con cui l'evento `user_message` ne annuncera' la
|
|
92
|
+
* presa in carico, oppure null se il turno e' gia' concluso.
|
|
93
|
+
*/
|
|
94
|
+
send(input: HorizonTurnInput, id?: string): string | null;
|
|
95
|
+
/**
|
|
96
|
+
* Porta un messaggio gia' in attesa in testa alla casella. Non interrompe
|
|
97
|
+
* tool atomici: verra' letto al primo confine sicuro disponibile.
|
|
98
|
+
*/
|
|
99
|
+
prioritize(id: string): boolean;
|
|
100
|
+
}
|
|
101
|
+
export interface HorizonSessionSnapshot {
|
|
102
|
+
readonly id: string;
|
|
103
|
+
readonly name: string | null;
|
|
104
|
+
readonly headId: string | null;
|
|
105
|
+
readonly messages: number;
|
|
106
|
+
readonly model: string;
|
|
107
|
+
readonly vibeMode: VibeModeSelection;
|
|
108
|
+
}
|
|
109
|
+
export interface HorizonSessionListItem {
|
|
110
|
+
readonly id: string;
|
|
111
|
+
readonly name: string | null;
|
|
112
|
+
readonly updatedAt: number;
|
|
113
|
+
readonly messages: number;
|
|
114
|
+
readonly preview: string;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Modello effettivamente instradabile da un provider configurato nel runtime.
|
|
118
|
+
* `id` e' sempre qualificato: l'host non deve ricostruirlo da label UI.
|
|
119
|
+
*/
|
|
120
|
+
export interface HorizonModelDescriptor {
|
|
121
|
+
readonly id: string;
|
|
122
|
+
readonly modelId: string;
|
|
123
|
+
readonly providerId: string;
|
|
124
|
+
readonly providerLabel: string;
|
|
125
|
+
}
|
|
126
|
+
/** Provider attivo nel registro Talos, senza credenziali o dettagli sensibili. */
|
|
127
|
+
export interface HorizonProviderDescriptor {
|
|
128
|
+
readonly id: string;
|
|
129
|
+
readonly label: string;
|
|
130
|
+
readonly models: readonly HorizonModelDescriptor[];
|
|
131
|
+
}
|
|
132
|
+
/** Snapshot serializzabile che alimenta il selettore modelli di Horizon. */
|
|
133
|
+
export interface HorizonModelCatalog {
|
|
134
|
+
/** Valore configurato nel motore; puo' essere non risolto dopo una disconnessione. */
|
|
135
|
+
readonly currentModel: string;
|
|
136
|
+
/** Vista canonica qualificata del modello corrente, o null se non risolvibile. */
|
|
137
|
+
readonly current: HorizonModelDescriptor | null;
|
|
138
|
+
readonly providers: readonly HorizonProviderDescriptor[];
|
|
139
|
+
/** Vista piatta degli stessi modelli esposti dentro `providers`. */
|
|
140
|
+
readonly models: readonly HorizonModelDescriptor[];
|
|
141
|
+
}
|
|
142
|
+
/** Vista serializzabile del Context Fabric relativa alla sessione corrente. */
|
|
143
|
+
export interface HorizonContextStatus {
|
|
144
|
+
readonly active: boolean;
|
|
145
|
+
readonly epoch: number | null;
|
|
146
|
+
readonly turn: number;
|
|
147
|
+
readonly mode: VibeModeId | null;
|
|
148
|
+
readonly selection: VibeModeSelection;
|
|
149
|
+
readonly mission: string;
|
|
150
|
+
readonly pins: readonly string[];
|
|
151
|
+
readonly leases: readonly ContextLease[];
|
|
152
|
+
readonly receipt: ContextReceipt | null;
|
|
153
|
+
readonly summary: string;
|
|
154
|
+
}
|
|
155
|
+
export interface HorizonCapabilityDescriptor {
|
|
156
|
+
readonly protocol: "vascend.horizon-engine";
|
|
157
|
+
readonly protocolVersion: 1;
|
|
158
|
+
readonly product: {
|
|
159
|
+
readonly name: "Horizon";
|
|
160
|
+
readonly core: "Talos";
|
|
161
|
+
readonly headless: true;
|
|
162
|
+
readonly electron: false;
|
|
163
|
+
};
|
|
164
|
+
readonly lifecycle: readonly ["create", "close"];
|
|
165
|
+
readonly sessions: readonly ["current", "list", "new", "resume", "rename"];
|
|
166
|
+
readonly models: {
|
|
167
|
+
readonly identifiers: "provider/model";
|
|
168
|
+
readonly operations: readonly ["catalog", "select", "reload"];
|
|
169
|
+
readonly configuredOnly: true;
|
|
170
|
+
};
|
|
171
|
+
readonly turns: {
|
|
172
|
+
readonly stream: "async-iterable";
|
|
173
|
+
readonly concurrency: "single-flight";
|
|
174
|
+
readonly abort: true;
|
|
175
|
+
readonly inputs: readonly ["text", "content-parts"];
|
|
176
|
+
readonly ephemeralContext: true;
|
|
177
|
+
};
|
|
178
|
+
readonly mainTeam: {
|
|
179
|
+
readonly agents: readonly [1, 2];
|
|
180
|
+
readonly stableRefs: readonly ["r1", "r2"];
|
|
181
|
+
readonly supervisor: true;
|
|
182
|
+
readonly contextSharing: "explicit-exchanges-only";
|
|
183
|
+
};
|
|
184
|
+
readonly context: {
|
|
185
|
+
readonly paradigm: "epoch-lease-lens";
|
|
186
|
+
readonly operations: readonly ["status", "pin", "unpin", "reset"];
|
|
187
|
+
readonly receipts: true;
|
|
188
|
+
};
|
|
189
|
+
readonly vibe: {
|
|
190
|
+
readonly routing: readonly ["auto", "explicit"];
|
|
191
|
+
readonly modes: readonly VibeModeId[];
|
|
192
|
+
};
|
|
193
|
+
readonly permissions: {
|
|
194
|
+
readonly default: "deny";
|
|
195
|
+
readonly hostGate: true;
|
|
196
|
+
};
|
|
197
|
+
readonly fileCoordination: {
|
|
198
|
+
readonly modes: readonly ["viewing", "editing", "writing"];
|
|
199
|
+
readonly writePolicy: "exclusive";
|
|
200
|
+
readonly humanPresence: true;
|
|
201
|
+
readonly nestedAgents: true;
|
|
202
|
+
};
|
|
203
|
+
readonly mcp: {
|
|
204
|
+
readonly protocolVersion: "2026-07-28";
|
|
205
|
+
readonly toolSchema: "inputSchema";
|
|
206
|
+
readonly callToolResult: true;
|
|
207
|
+
readonly apps: {
|
|
208
|
+
readonly extension: "io.modelcontextprotocol/ui";
|
|
209
|
+
readonly mimeType: "text/html;profile=mcp-app";
|
|
210
|
+
};
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Seam avanzato per host che instrumentano il runtime Talos. Gli embedder
|
|
215
|
+
* normali non devono passarlo: Horizon usa bootstrap/runTurn ufficiali.
|
|
216
|
+
*/
|
|
217
|
+
export interface HorizonRuntime {
|
|
218
|
+
bootstrap(options: {
|
|
219
|
+
cwd?: string;
|
|
220
|
+
fsRoots?: readonly string[];
|
|
221
|
+
model?: string;
|
|
222
|
+
sessionId?: string;
|
|
223
|
+
continueLast?: boolean;
|
|
224
|
+
sessionName?: string;
|
|
225
|
+
env?: NodeJS.ProcessEnv;
|
|
226
|
+
trustPrompt?: (resources: readonly string[]) => Promise<boolean>;
|
|
227
|
+
}): Promise<Harness>;
|
|
228
|
+
runTurn(deps: AgentDeps, input: HorizonTurnInput, sink: (event: AgentEvent) => void, signal: AbortSignal): Promise<void>;
|
|
229
|
+
}
|
|
230
|
+
export interface HorizonVibeStatus {
|
|
231
|
+
readonly selected: VibeModeSelection;
|
|
232
|
+
readonly modes: readonly VibeModeSpec[];
|
|
233
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import { installCrashMonitor, writeCrashReport } from "./core/crash-report.js";
|
|
4
|
+
import { TALOS_VERSION } from "./core/version.js";
|
|
5
|
+
installCrashMonitor();
|
|
6
|
+
import { bootstrap } from "./core/bootstrap.js";
|
|
7
|
+
import { runTurn } from "./core/agent.js";
|
|
8
|
+
import { startRepl } from "./tui/repl.js";
|
|
9
|
+
import { startRpc } from "./rpc/server.js";
|
|
10
|
+
import { proxyUrl } from "./providers/registry.js";
|
|
11
|
+
import { CliArgumentError, cliHelp, parseCliArgs } from "./core/cli-args.js";
|
|
12
|
+
function readStdin() {
|
|
13
|
+
try {
|
|
14
|
+
return readFileSync(0, "utf8").trim();
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
return "";
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
// Prompt di fiducia interattivo prima di caricare risorse locali al progetto.
|
|
21
|
+
async function askTrust(resources) {
|
|
22
|
+
if (!process.stdin.isTTY)
|
|
23
|
+
return false;
|
|
24
|
+
const readline = await import("node:readline");
|
|
25
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
26
|
+
process.stdout.write(`\n Questo progetto contiene risorse locali Talos:\n` +
|
|
27
|
+
resources.map((r) => ` - ${r}\n`).join("") +
|
|
28
|
+
` Verranno caricate (estensioni eseguono codice). Ti fidi di questo progetto?\n`);
|
|
29
|
+
return new Promise((resolve) => {
|
|
30
|
+
rl.question(" [y/N] ", (ans) => {
|
|
31
|
+
rl.close();
|
|
32
|
+
resolve(/^y(es)?$/i.test(ans.trim()));
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
async function main() {
|
|
37
|
+
let args;
|
|
38
|
+
try {
|
|
39
|
+
args = parseCliArgs(process.argv.slice(2));
|
|
40
|
+
}
|
|
41
|
+
catch (err) {
|
|
42
|
+
if (err instanceof CliArgumentError) {
|
|
43
|
+
process.stderr.write(`errore: ${err.message}\nusa 'horizon --help' per l'elenco completo\n`);
|
|
44
|
+
process.exitCode = err.exitCode;
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
throw err;
|
|
48
|
+
}
|
|
49
|
+
if (args.help) {
|
|
50
|
+
process.stdout.write(cliHelp() + "\n");
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if (args.version) {
|
|
54
|
+
process.stdout.write(`Horizon ${TALOS_VERSION}\n`);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const { offerStartupUpdate } = await import("./tui/update-prompt.js");
|
|
58
|
+
const updateExitCode = await offerStartupUpdate(args, process.env);
|
|
59
|
+
if (updateExitCode !== null) {
|
|
60
|
+
process.exitCode = updateExitCode;
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
const env = { ...process.env };
|
|
64
|
+
if (args.config)
|
|
65
|
+
env.TALOS_CONFIG = args.config;
|
|
66
|
+
if (args.promptTemplates.length) {
|
|
67
|
+
env.TALOS_PROMPT_TEMPLATES = [env.TALOS_PROMPT_TEMPLATES, ...args.promptTemplates]
|
|
68
|
+
.filter(Boolean)
|
|
69
|
+
.join(",");
|
|
70
|
+
}
|
|
71
|
+
if (args.skills.length) {
|
|
72
|
+
env.TALOS_SKILLS = [env.TALOS_SKILLS, ...args.skills].filter(Boolean).join(",");
|
|
73
|
+
}
|
|
74
|
+
if (args.noSkills)
|
|
75
|
+
env.TALOS_NO_SKILLS = "1";
|
|
76
|
+
if (args.vibeMode)
|
|
77
|
+
env.TALOS_VIBE_MODE = args.vibeMode;
|
|
78
|
+
// --yolo vale anche in TUI: inizializza la modalita' permessi auto senza
|
|
79
|
+
// persisterla implicitamente nel profilo globale.
|
|
80
|
+
if (args.yolo)
|
|
81
|
+
env.TALOS_PERM_MODE = "auto";
|
|
82
|
+
if (args.excludeTools.length) {
|
|
83
|
+
env.TALOS_EXCLUDE_TOOLS = [env.TALOS_EXCLUDE_TOOLS, ...args.excludeTools].filter(Boolean).join(",");
|
|
84
|
+
}
|
|
85
|
+
// Proxy globale: propaga a HTTPS_PROXY/HTTP_PROXY cosi' fetch lo usa.
|
|
86
|
+
const proxy = proxyUrl(env);
|
|
87
|
+
if (proxy) {
|
|
88
|
+
env.HTTPS_PROXY = env.HTTPS_PROXY || proxy;
|
|
89
|
+
env.HTTP_PROXY = env.HTTP_PROXY || proxy;
|
|
90
|
+
}
|
|
91
|
+
// Trust: --approve/--no-approve forzano il default; in TUI "ask" si prompta.
|
|
92
|
+
if (args.approve)
|
|
93
|
+
env.TALOS_DEFAULT_TRUST = "trust";
|
|
94
|
+
else if (args.noApprove)
|
|
95
|
+
env.TALOS_DEFAULT_TRUST = "deny";
|
|
96
|
+
// Doctor: diagnostica locale SENZA bootstrap (niente sessioni, tool, trust).
|
|
97
|
+
if (args.mode === "doctor") {
|
|
98
|
+
const { runDoctor, renderDoctorReport, doctorExitCode } = await import("./core/doctor.js");
|
|
99
|
+
const report = runDoctor({ cwd: args.cwd, model: args.model, env });
|
|
100
|
+
process.stdout.write((args.json ? JSON.stringify(report, null, 2) : renderDoctorReport(report)) + "\n");
|
|
101
|
+
process.exitCode = doctorExitCode(report);
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
const trustPrompt = args.mode === "tui" && !args.approve && !args.noApprove
|
|
105
|
+
? (resources) => askTrust(resources)
|
|
106
|
+
: undefined;
|
|
107
|
+
const harness = await bootstrap({
|
|
108
|
+
cwd: args.cwd,
|
|
109
|
+
fsRoots: args.addDirs,
|
|
110
|
+
model: args.model,
|
|
111
|
+
env,
|
|
112
|
+
trustPrompt,
|
|
113
|
+
sessionId: args.sessionId,
|
|
114
|
+
continueLast: args.continueLast,
|
|
115
|
+
sessionName: args.name,
|
|
116
|
+
});
|
|
117
|
+
// Seconda fase del parsing: ora le estensioni del progetto sono note e i
|
|
118
|
+
// loro flag possono essere validati/eseguiti nel vero ExtensionContext.
|
|
119
|
+
for (const flag of args.extensionFlags) {
|
|
120
|
+
const result = await harness.host.runFlag(flag.name, flag.value);
|
|
121
|
+
if (!result.ok) {
|
|
122
|
+
process.stderr.write(`errore: ${result.reason ?? `flag non valido: ${flag.name}`}\n`);
|
|
123
|
+
process.exitCode = 2;
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
if (args.mode === "rpc") {
|
|
128
|
+
startRpc(harness.deps(async () => args.yolo), { autoApprove: args.yolo });
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
if (args.mode === "print") {
|
|
132
|
+
const prompt = args.prompt || readStdin();
|
|
133
|
+
if (!prompt) {
|
|
134
|
+
process.stderr.write("nessun prompt fornito\n");
|
|
135
|
+
process.exit(1);
|
|
136
|
+
}
|
|
137
|
+
const controller = new AbortController();
|
|
138
|
+
let finalText = "";
|
|
139
|
+
let failed = false;
|
|
140
|
+
const sink = (event) => {
|
|
141
|
+
if (args.json) {
|
|
142
|
+
process.stdout.write(JSON.stringify(event) + "\n");
|
|
143
|
+
}
|
|
144
|
+
else if (event.type === "text") {
|
|
145
|
+
finalText += event.delta;
|
|
146
|
+
}
|
|
147
|
+
else if (event.type === "error") {
|
|
148
|
+
process.stderr.write(`errore: ${event.message}\n`);
|
|
149
|
+
}
|
|
150
|
+
if (event.type === "error")
|
|
151
|
+
failed = true;
|
|
152
|
+
};
|
|
153
|
+
const deps = harness.deps(async () => args.yolo);
|
|
154
|
+
await runTurn(deps, prompt, sink, controller.signal);
|
|
155
|
+
if (!args.json && finalText.trim())
|
|
156
|
+
process.stdout.write(finalText.trim() + "\n");
|
|
157
|
+
if (failed)
|
|
158
|
+
process.exitCode = 1;
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
// Lavoro autonomo: il ciclo gira FUORI da qualunque conversazione. Prende
|
|
162
|
+
// un'unita' dalla coda, la fa eseguire a un agente NUOVO, la verifica con un
|
|
163
|
+
// comando esterno, e passa alla prossima. E' l'entry di un run lungo: la si
|
|
164
|
+
// richiama a intervalli (cron, servizio) e ogni giro riprende da dove la coda
|
|
165
|
+
// era rimasta, compresi i lease scaduti da recuperare.
|
|
166
|
+
if (args.mode === "work") {
|
|
167
|
+
const { WorkQueue, formatQueue } = await import("./vascend/work-queue.js");
|
|
168
|
+
const { createFreshAgentRunner } = await import("./vascend/work-agent.js");
|
|
169
|
+
const { runWorkLoop } = await import("./vascend/work-runner.js");
|
|
170
|
+
const queue = WorkQueue.open(harness.config.sessionDir, args.workScope ?? "default");
|
|
171
|
+
if (args.workList) {
|
|
172
|
+
queue.sweep();
|
|
173
|
+
process.stdout.write(formatQueue(queue.items()) + "\n");
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
const gate = args.workVerify;
|
|
177
|
+
const controller = new AbortController();
|
|
178
|
+
process.on("SIGINT", () => controller.abort());
|
|
179
|
+
const report = await runWorkLoop({
|
|
180
|
+
queue,
|
|
181
|
+
owner: `cli-${process.pid}`,
|
|
182
|
+
runItem: createFreshAgentRunner(harness.deps(async () => args.yolo), {
|
|
183
|
+
memoryScopeId: args.workScope ?? "default",
|
|
184
|
+
}),
|
|
185
|
+
...(gate ? {
|
|
186
|
+
// L'arbitro e' un comando esterno: conta il suo exit code, non cio' che
|
|
187
|
+
// l'agente pensa di aver fatto.
|
|
188
|
+
verify: async () => {
|
|
189
|
+
const { spawnSync } = await import("node:child_process");
|
|
190
|
+
const done = spawnSync(gate, { cwd: harness.config.cwd, shell: true, encoding: "utf8" });
|
|
191
|
+
const log = `${done.stdout ?? ""}${done.stderr ?? ""}`.trim();
|
|
192
|
+
return { ok: done.status === 0, log: log || `exit ${done.status}` };
|
|
193
|
+
},
|
|
194
|
+
} : {}),
|
|
195
|
+
onEvent: (event) => {
|
|
196
|
+
if (args.json) {
|
|
197
|
+
process.stdout.write(JSON.stringify(event) + "\n");
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
if (event.type === "claimed")
|
|
201
|
+
process.stdout.write(`> ${event.item.id} ${event.item.title}\n`);
|
|
202
|
+
if (event.type === "gate")
|
|
203
|
+
process.stdout.write(` verifica: ${event.gate.ok ? "verde" : "ROSSA"}\n`);
|
|
204
|
+
if (event.type === "settled")
|
|
205
|
+
process.stdout.write(` ${event.item.id} -> ${event.state}\n`);
|
|
206
|
+
},
|
|
207
|
+
}, {
|
|
208
|
+
...(args.workMax ? { maxItems: args.workMax } : {}),
|
|
209
|
+
...(args.workMinutes ? { deadline: Date.now() + args.workMinutes * 60_000 } : {}),
|
|
210
|
+
signal: controller.signal,
|
|
211
|
+
});
|
|
212
|
+
if (!args.json) {
|
|
213
|
+
process.stdout.write(`${report.why}: ${report.done} concluse, ${report.retried} da ritentare, ${report.blocked} bloccate `
|
|
214
|
+
+ `(${Math.round(report.ms / 1000)}s)\n`);
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
process.stdout.write(JSON.stringify(report) + "\n");
|
|
218
|
+
}
|
|
219
|
+
if (report.blocked > 0)
|
|
220
|
+
process.exitCode = 1;
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
// default: TUI interattiva
|
|
224
|
+
await startRepl({ harness, resumePicker: args.resumePicker,
|
|
225
|
+
recoverQueue: !args.sessionId && !args.continueLast && !args.resumePicker && !args.name });
|
|
226
|
+
}
|
|
227
|
+
main().catch((err) => {
|
|
228
|
+
const report = writeCrashReport(err, "main");
|
|
229
|
+
process.stderr.write(`fatale: ${err instanceof Error ? err.stack ?? err.message : String(err)}\n`);
|
|
230
|
+
if (report)
|
|
231
|
+
process.stderr.write(`diagnostica: ${report}\n`);
|
|
232
|
+
process.exit(1);
|
|
233
|
+
});
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
export declare const MCP_PROTOCOL_VERSION = "2026-07-28";
|
|
2
|
+
export declare const MCP_UI_EXTENSION_ID = "io.modelcontextprotocol/ui";
|
|
3
|
+
export declare const MCP_APP_MIME_TYPE = "text/html;profile=mcp-app";
|
|
4
|
+
export type JsonSchema = Readonly<Record<string, unknown>>;
|
|
5
|
+
export type McpMeta = Readonly<Record<string, unknown>>;
|
|
6
|
+
export interface McpToolAnnotations {
|
|
7
|
+
readonly title?: string;
|
|
8
|
+
readonly readOnlyHint?: boolean;
|
|
9
|
+
readonly destructiveHint?: boolean;
|
|
10
|
+
readonly idempotentHint?: boolean;
|
|
11
|
+
readonly openWorldHint?: boolean;
|
|
12
|
+
readonly [key: string]: unknown;
|
|
13
|
+
}
|
|
14
|
+
export interface McpToolDefinition {
|
|
15
|
+
readonly name: string;
|
|
16
|
+
readonly title?: string;
|
|
17
|
+
readonly description?: string;
|
|
18
|
+
readonly inputSchema: JsonSchema;
|
|
19
|
+
readonly outputSchema?: JsonSchema;
|
|
20
|
+
readonly annotations?: McpToolAnnotations;
|
|
21
|
+
readonly _meta?: McpMeta;
|
|
22
|
+
}
|
|
23
|
+
export interface McpTextContent {
|
|
24
|
+
readonly type: "text";
|
|
25
|
+
readonly text: string;
|
|
26
|
+
readonly annotations?: Readonly<Record<string, unknown>>;
|
|
27
|
+
readonly _meta?: McpMeta;
|
|
28
|
+
}
|
|
29
|
+
export interface McpImageContent {
|
|
30
|
+
readonly type: "image";
|
|
31
|
+
readonly data: string;
|
|
32
|
+
readonly mimeType: string;
|
|
33
|
+
readonly annotations?: Readonly<Record<string, unknown>>;
|
|
34
|
+
readonly _meta?: McpMeta;
|
|
35
|
+
}
|
|
36
|
+
export interface McpAudioContent {
|
|
37
|
+
readonly type: "audio";
|
|
38
|
+
readonly data: string;
|
|
39
|
+
readonly mimeType: string;
|
|
40
|
+
readonly annotations?: Readonly<Record<string, unknown>>;
|
|
41
|
+
readonly _meta?: McpMeta;
|
|
42
|
+
}
|
|
43
|
+
export interface McpResourceLinkContent {
|
|
44
|
+
readonly type: "resource_link";
|
|
45
|
+
readonly name: string;
|
|
46
|
+
readonly uri: string;
|
|
47
|
+
readonly title?: string;
|
|
48
|
+
readonly description?: string;
|
|
49
|
+
readonly mimeType?: string;
|
|
50
|
+
readonly size?: number;
|
|
51
|
+
readonly annotations?: Readonly<Record<string, unknown>>;
|
|
52
|
+
readonly _meta?: McpMeta;
|
|
53
|
+
}
|
|
54
|
+
export interface McpEmbeddedResourceContent {
|
|
55
|
+
readonly type: "resource";
|
|
56
|
+
readonly resource: Readonly<Record<string, unknown>>;
|
|
57
|
+
readonly annotations?: Readonly<Record<string, unknown>>;
|
|
58
|
+
readonly _meta?: McpMeta;
|
|
59
|
+
}
|
|
60
|
+
export type McpContentBlock = McpTextContent | McpImageContent | McpAudioContent | McpResourceLinkContent | McpEmbeddedResourceContent;
|
|
61
|
+
export interface McpCallToolResult {
|
|
62
|
+
readonly content: readonly McpContentBlock[];
|
|
63
|
+
readonly structuredContent?: Readonly<Record<string, unknown>>;
|
|
64
|
+
readonly _meta?: McpMeta;
|
|
65
|
+
readonly isError?: boolean;
|
|
66
|
+
}
|
|
67
|
+
export interface McpAppUiMeta {
|
|
68
|
+
readonly resourceUri?: string;
|
|
69
|
+
readonly visibility?: readonly ("model" | "app")[];
|
|
70
|
+
readonly [key: string]: unknown;
|
|
71
|
+
}
|
|
72
|
+
export declare function mcpAppUiMeta(meta: McpMeta | undefined): McpAppUiMeta | undefined;
|
|
73
|
+
export declare function isToolVisibleToModel(meta: McpMeta | undefined): boolean;
|
|
74
|
+
export declare function supportsMcpApps(capabilities: unknown): boolean;
|
|
75
|
+
export declare function toolInputSchema(tool: {
|
|
76
|
+
readonly inputSchema?: JsonSchema;
|
|
77
|
+
readonly schema?: JsonSchema;
|
|
78
|
+
}): JsonSchema;
|
|
79
|
+
export declare function textFromMcpToolResult(result: McpCallToolResult): string;
|
|
80
|
+
export declare function normalizeMcpToolResult(value: unknown, defaultIsError?: boolean): McpCallToolResult;
|
|
81
|
+
export declare function toolDefinitionForCapabilities<T extends McpToolDefinition>(tool: T, capabilities: unknown): T;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
// Contratto MCP condiviso dal runtime Talos e dagli host che lo incorporano.
|
|
2
|
+
// Il core resta dependency-free: queste funzioni normalizzano soltanto dati.
|
|
3
|
+
export const MCP_PROTOCOL_VERSION = "2026-07-28";
|
|
4
|
+
export const MCP_UI_EXTENSION_ID = "io.modelcontextprotocol/ui";
|
|
5
|
+
export const MCP_APP_MIME_TYPE = "text/html;profile=mcp-app";
|
|
6
|
+
function record(value) {
|
|
7
|
+
return value !== null && typeof value === "object" && !Array.isArray(value)
|
|
8
|
+
? value
|
|
9
|
+
: undefined;
|
|
10
|
+
}
|
|
11
|
+
export function mcpAppUiMeta(meta) {
|
|
12
|
+
return record(meta?.["ui"]);
|
|
13
|
+
}
|
|
14
|
+
export function isToolVisibleToModel(meta) {
|
|
15
|
+
const visibility = mcpAppUiMeta(meta)?.visibility;
|
|
16
|
+
return !visibility?.length || visibility.includes("model");
|
|
17
|
+
}
|
|
18
|
+
export function supportsMcpApps(capabilities) {
|
|
19
|
+
const caps = record(capabilities);
|
|
20
|
+
const extensions = record(caps?.["extensions"]);
|
|
21
|
+
const ui = record(extensions?.[MCP_UI_EXTENSION_ID]);
|
|
22
|
+
const mimeTypes = ui?.["mimeTypes"];
|
|
23
|
+
return Array.isArray(mimeTypes) && mimeTypes.includes(MCP_APP_MIME_TYPE);
|
|
24
|
+
}
|
|
25
|
+
export function toolInputSchema(tool) {
|
|
26
|
+
return tool.inputSchema ?? tool.schema ?? { type: "object", properties: {} };
|
|
27
|
+
}
|
|
28
|
+
export function textFromMcpToolResult(result) {
|
|
29
|
+
const text = result.content
|
|
30
|
+
.filter((part) => part.type === "text")
|
|
31
|
+
.map((part) => part.text)
|
|
32
|
+
.join("\n")
|
|
33
|
+
.trim();
|
|
34
|
+
if (text)
|
|
35
|
+
return text;
|
|
36
|
+
if (result.structuredContent) {
|
|
37
|
+
try {
|
|
38
|
+
return JSON.stringify(result.structuredContent);
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
return "Risultato strutturato prodotto dal tool.";
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (result.content.some((part) => part.type === "image"))
|
|
45
|
+
return "Immagine prodotta dal tool.";
|
|
46
|
+
if (result.content.some((part) => part.type === "audio"))
|
|
47
|
+
return "Audio prodotto dal tool.";
|
|
48
|
+
return "Tool completato senza output testuale.";
|
|
49
|
+
}
|
|
50
|
+
function normalizedContent(value) {
|
|
51
|
+
if (!Array.isArray(value))
|
|
52
|
+
return [];
|
|
53
|
+
return value.flatMap((item) => {
|
|
54
|
+
const part = record(item);
|
|
55
|
+
if (!part)
|
|
56
|
+
return [];
|
|
57
|
+
const type = String(part["type"] ?? "");
|
|
58
|
+
if (type === "text")
|
|
59
|
+
return [{ ...part, type, text: String(part["text"] ?? "") }];
|
|
60
|
+
if (type === "image" || type === "audio") {
|
|
61
|
+
const data = String(part["data"] ?? "");
|
|
62
|
+
const mimeType = String(part["mimeType"] ?? part["mime"] ?? "");
|
|
63
|
+
if (!data || !mimeType)
|
|
64
|
+
return [];
|
|
65
|
+
return [{ ...part, type, data, mimeType }];
|
|
66
|
+
}
|
|
67
|
+
if (type === "resource_link") {
|
|
68
|
+
const uri = String(part["uri"] ?? "");
|
|
69
|
+
if (!uri)
|
|
70
|
+
return [];
|
|
71
|
+
return [{ ...part, type, uri, name: String(part["name"] ?? uri) }];
|
|
72
|
+
}
|
|
73
|
+
if (type === "resource" && record(part["resource"])) {
|
|
74
|
+
return [{ ...part, type, resource: record(part["resource"]) }];
|
|
75
|
+
}
|
|
76
|
+
return [];
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
// Accetta sia CallToolResult MCP sia i due formati storici di Talos
|
|
80
|
+
// (`string` e `{output, media}`), producendo sempre la forma standard.
|
|
81
|
+
export function normalizeMcpToolResult(value, defaultIsError = false) {
|
|
82
|
+
if (typeof value === "string") {
|
|
83
|
+
return { content: [{ type: "text", text: value }], ...(defaultIsError ? { isError: true } : {}) };
|
|
84
|
+
}
|
|
85
|
+
const raw = record(value) ?? {};
|
|
86
|
+
const structuredContent = record(raw["structuredContent"]);
|
|
87
|
+
const meta = record(raw["_meta"]);
|
|
88
|
+
const explicitContent = normalizedContent(raw["content"]);
|
|
89
|
+
const output = raw["output"] === undefined ? "" : String(raw["output"]);
|
|
90
|
+
const media = Array.isArray(raw["media"])
|
|
91
|
+
? raw["media"].flatMap((item) => {
|
|
92
|
+
const image = record(item);
|
|
93
|
+
const data = String(image?.["data"] ?? "");
|
|
94
|
+
const mimeType = String(image?.["mimeType"] ?? image?.["mime"] ?? "");
|
|
95
|
+
return data && mimeType ? [{ type: "image", data, mimeType }] : [];
|
|
96
|
+
})
|
|
97
|
+
: [];
|
|
98
|
+
const fallback = output
|
|
99
|
+
? [{ type: "text", text: output }]
|
|
100
|
+
: structuredContent
|
|
101
|
+
? [{ type: "text", text: JSON.stringify(structuredContent) }]
|
|
102
|
+
: [];
|
|
103
|
+
const content = explicitContent.length ? explicitContent : [...fallback, ...media];
|
|
104
|
+
return {
|
|
105
|
+
content: content.length ? content : [{ type: "text", text: "Tool completato senza output testuale." }],
|
|
106
|
+
...(structuredContent ? { structuredContent } : {}),
|
|
107
|
+
...(meta ? { _meta: meta } : {}),
|
|
108
|
+
...((raw["isError"] === true || defaultIsError) ? { isError: true } : {}),
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
// I client senza MCP Apps ricevono comunque il tool, ma non metadata UI che
|
|
112
|
+
// non sanno negoziare. Il contenuto testuale di fallback resta utilizzabile.
|
|
113
|
+
export function toolDefinitionForCapabilities(tool, capabilities) {
|
|
114
|
+
if (supportsMcpApps(capabilities) || !mcpAppUiMeta(tool._meta))
|
|
115
|
+
return tool;
|
|
116
|
+
const { ui: _ui, ...restMeta } = tool._meta ?? {};
|
|
117
|
+
const { _meta: _meta, ...rest } = tool;
|
|
118
|
+
return {
|
|
119
|
+
...rest,
|
|
120
|
+
...(Object.keys(restMeta).length ? { _meta: restMeta } : {}),
|
|
121
|
+
};
|
|
122
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|