@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,567 @@
|
|
|
1
|
+
// run_program: Programmatic Tool Calling su kernel JS persistente per sessione.
|
|
2
|
+
//
|
|
3
|
+
// Perche' esiste: una catena di N azioni strumentali costa N giri di modello, e
|
|
4
|
+
// ogni risultato intermedio entra nel contesto anche quando serve solo come
|
|
5
|
+
// input del passo successivo (caso documentato: 72 tool call senza completare
|
|
6
|
+
// il task). Qui il modello scrive UN programma che chiama i tool come funzioni
|
|
7
|
+
// (`await tools.read_file({...})`, `Promise.all` per il fan-out): i risultati
|
|
8
|
+
// intermedi vivono nel kernel — contesto come variabile, non come cronologia —
|
|
9
|
+
// e nel contesto entra solo cio' che il programma stampa o ritorna.
|
|
10
|
+
//
|
|
11
|
+
// Il kernel e' un processo figlio (bun/node/Electron-as-node) che sopravvive
|
|
12
|
+
// alla singola chiamata: `state` e le assegnazioni globali persistono tra
|
|
13
|
+
// esecuzioni della stessa sessione, come un REPL. Le tool call del programma
|
|
14
|
+
// rientrano nel parent via protocollo JSON-line e passano dallo STESSO
|
|
15
|
+
// ToolContext del turno corrente: il choke point dei permessi (confirm dei
|
|
16
|
+
// singoli tool) resta intatto. Il programma in se' e' codice arbitrario con il
|
|
17
|
+
// livello di fiducia di `bash`, quindi come bash e' dietro ctx.confirm.
|
|
18
|
+
import { spawn } from "node:child_process";
|
|
19
|
+
import { existsSync, mkdirSync, realpathSync, writeFileSync } from "node:fs";
|
|
20
|
+
import { createHash } from "node:crypto";
|
|
21
|
+
import { tmpdir } from "node:os";
|
|
22
|
+
import { join } from "node:path";
|
|
23
|
+
import { invokeToolCall } from "../core/tool-executor.js";
|
|
24
|
+
import { executionPathKey, executionTargetKey, localExecutionTarget } from "../core/execution-target.js";
|
|
25
|
+
import { textFromMcpToolResult } from "../mcp/protocol.js";
|
|
26
|
+
import { DISCOVERY_TOOL_NAMES } from "./discovery.js";
|
|
27
|
+
import { normalizeToolInput } from "./normalize-input.js";
|
|
28
|
+
import { programSyntaxError } from "./program-input.js";
|
|
29
|
+
const DEFAULT_TIMEOUT_S = 120;
|
|
30
|
+
const MAX_TIMEOUT_S = 600;
|
|
31
|
+
// Tetto ai log e al valore di ritorno consegnati al modello: il resto e' gia'
|
|
32
|
+
// nel kernel e si recupera con un programma successivo (state/paginazione).
|
|
33
|
+
const MAX_LOG_CHARS = 20_000;
|
|
34
|
+
const MAX_VALUE_CHARS = 20_000;
|
|
35
|
+
// Kernel inattivo da troppo: si spegne da solo (lo stato si perde, il modello
|
|
36
|
+
// viene avvisato alla prossima esecuzione dal fatto che state e' vuoto).
|
|
37
|
+
const KERNEL_IDLE_MS = 10 * 60 * 1000;
|
|
38
|
+
// Piu' sessioni vive (kingdoms): tetto ai processi kernel, il piu' vecchio muore.
|
|
39
|
+
const MAX_KERNELS = 8;
|
|
40
|
+
// Tetto all'output delle chiamate interne DENTRO GLI EVENTI verso l'host: il
|
|
41
|
+
// kernel riceve sempre l'output integrale (e' il suo scopo), ma l'evento serve
|
|
42
|
+
// alla chat, non al modello, e non deve gonfiare l'IPC.
|
|
43
|
+
const NESTED_EVENT_OUTPUT_MAX = 16_000;
|
|
44
|
+
// Id univoci per le chiamate annidate in tutto il processo: il seq del kernel
|
|
45
|
+
// riparte a ogni reset e produrrebbe collisioni nella stessa chat.
|
|
46
|
+
let nestedCallCounter = 0;
|
|
47
|
+
// Tool non chiamabili dal programma: i meta-tool della discovery non servono
|
|
48
|
+
// (dal kernel OGNI tool del registro e' gia' chiamabile per nome, anche quelli
|
|
49
|
+
// on-demand) e run_program dentro run_program creerebbe solo ricorsione.
|
|
50
|
+
const BRIDGE_DENYLIST = new Set([
|
|
51
|
+
...DISCOVERY_TOOL_NAMES,
|
|
52
|
+
"run_program",
|
|
53
|
+
"execute",
|
|
54
|
+
// Questi due tool dipendono dai delta nativi della function call del
|
|
55
|
+
// provider. Invocarli dal kernel renderebbe atomico l'intero programma e
|
|
56
|
+
// falserebbe sia la partial commit sia la telemetria RAC.
|
|
57
|
+
"computer_control",
|
|
58
|
+
"computer_batch",
|
|
59
|
+
]);
|
|
60
|
+
// ---------------------------------------------------------------------------
|
|
61
|
+
// Kernel script (processo figlio). Sorgente incorporato e scritto in un file
|
|
62
|
+
// temporaneo content-addressed: niente asset da impacchettare in dist, stesso
|
|
63
|
+
// comportamento sotto bun, node ed Electron main.
|
|
64
|
+
// ---------------------------------------------------------------------------
|
|
65
|
+
const KERNEL_SOURCE = `"use strict";
|
|
66
|
+
const util = require("node:util");
|
|
67
|
+
let buf = "";
|
|
68
|
+
let seq = 0;
|
|
69
|
+
const pending = new Map();
|
|
70
|
+
const state = {};
|
|
71
|
+
let inputData = {};
|
|
72
|
+
|
|
73
|
+
function send(msg) { process.stdout.write(JSON.stringify(msg) + "\\n"); }
|
|
74
|
+
|
|
75
|
+
function render(value) {
|
|
76
|
+
if (value === undefined) return "";
|
|
77
|
+
if (typeof value === "string") return value;
|
|
78
|
+
try { return util.inspect(value, { depth: 5, maxArrayLength: 200, maxStringLength: 8000 }); }
|
|
79
|
+
catch { return String(value); }
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function callTool(name, args, structured = false) {
|
|
83
|
+
return new Promise((resolve, reject) => {
|
|
84
|
+
seq += 1;
|
|
85
|
+
pending.set(seq, { resolve, reject, structured });
|
|
86
|
+
send({ t: "call", seq, name, args: args === undefined ? {} : args });
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// Qualsiasi proprieta' e' una funzione-tool: tools.read_file({...}),
|
|
91
|
+
// tools["nome-con-trattini"]({...}). "then" escluso per non sembrare thenable.
|
|
92
|
+
const tools = new Proxy({}, {
|
|
93
|
+
get(_t, prop) {
|
|
94
|
+
if (typeof prop !== "string" || prop === "then" || prop === "toJSON") return undefined;
|
|
95
|
+
if (prop === "$data") return inputData;
|
|
96
|
+
if (prop === "$result") return (name, args) => callTool(name, args, true);
|
|
97
|
+
return (args) => callTool(prop, args);
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
const fakeConsole = {};
|
|
102
|
+
for (const level of ["log", "info", "warn", "error", "debug", "trace"]) {
|
|
103
|
+
fakeConsole[level] = (...parts) => send({
|
|
104
|
+
t: "log",
|
|
105
|
+
line: parts.map((p) => (typeof p === "string" ? p : render(p))).join(" "),
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
async function execute(msg) {
|
|
110
|
+
inputData = msg.data ?? {};
|
|
111
|
+
const AsyncFunction = (async () => {}).constructor;
|
|
112
|
+
try {
|
|
113
|
+
// require/process oscurati: e' un invito a passare dai tool (che portano i
|
|
114
|
+
// permessi), non un confine di sicurezza — il confine e' la conferma utente.
|
|
115
|
+
const fn = new AsyncFunction("tools", "state", "console", "require", "process", msg.code);
|
|
116
|
+
const value = await fn(tools, state, fakeConsole, undefined, undefined);
|
|
117
|
+
send({ t: "done", id: msg.id, value: render(value) });
|
|
118
|
+
} catch (err) {
|
|
119
|
+
send({ t: "done", id: msg.id, error: err instanceof Error ? (err.stack || err.message) : String(err) });
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
process.stdin.setEncoding("utf8");
|
|
124
|
+
process.stdin.on("data", (chunk) => {
|
|
125
|
+
buf += chunk;
|
|
126
|
+
let idx;
|
|
127
|
+
while ((idx = buf.indexOf("\\n")) >= 0) {
|
|
128
|
+
const line = buf.slice(0, idx);
|
|
129
|
+
buf = buf.slice(idx + 1);
|
|
130
|
+
if (!line.trim()) continue;
|
|
131
|
+
let msg;
|
|
132
|
+
try { msg = JSON.parse(line); } catch { continue; }
|
|
133
|
+
if (msg.t === "exec") void execute(msg);
|
|
134
|
+
else if (msg.t === "call_result") {
|
|
135
|
+
const p = pending.get(msg.seq);
|
|
136
|
+
if (!p) continue;
|
|
137
|
+
pending.delete(msg.seq);
|
|
138
|
+
if (p.structured) p.resolve(msg.result);
|
|
139
|
+
else if (msg.isError) p.reject(new Error(String(msg.output ?? "errore tool")));
|
|
140
|
+
else p.resolve(String(msg.output ?? ""));
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
// Il parent muore -> stdin si chiude -> il kernel esce: nessun orfano.
|
|
145
|
+
process.stdin.on("end", () => process.exit(0));
|
|
146
|
+
process.stdin.resume();
|
|
147
|
+
`;
|
|
148
|
+
function unrefStream(stream) {
|
|
149
|
+
stream?.unref?.();
|
|
150
|
+
}
|
|
151
|
+
function ensureKernelScript() {
|
|
152
|
+
const hash = createHash("sha256").update(KERNEL_SOURCE).digest("hex").slice(0, 12);
|
|
153
|
+
const dir = join(tmpdir(), "talos-program-kernel");
|
|
154
|
+
const path = join(dir, `kernel-${hash}.cjs`);
|
|
155
|
+
if (!existsSync(path)) {
|
|
156
|
+
mkdirSync(dir, { recursive: true });
|
|
157
|
+
writeFileSync(path, KERNEL_SOURCE, "utf8");
|
|
158
|
+
}
|
|
159
|
+
return path;
|
|
160
|
+
}
|
|
161
|
+
class ProgramKernel {
|
|
162
|
+
key;
|
|
163
|
+
child = null;
|
|
164
|
+
stdoutBuf = "";
|
|
165
|
+
stderrTail = "";
|
|
166
|
+
nextExecId = 1;
|
|
167
|
+
current = null;
|
|
168
|
+
chain = Promise.resolve();
|
|
169
|
+
idleTimer = null;
|
|
170
|
+
constructor(key) {
|
|
171
|
+
this.key = key;
|
|
172
|
+
}
|
|
173
|
+
get alive() {
|
|
174
|
+
return this.child !== null && this.child.exitCode === null && !this.child.killed;
|
|
175
|
+
}
|
|
176
|
+
// Serializza le esecuzioni: il kernel e' uno solo e lo stato e' condiviso.
|
|
177
|
+
exec(code, ctx, timeoutMs, data) {
|
|
178
|
+
const run = this.chain.then(() => this.execNow(code, ctx, timeoutMs, data));
|
|
179
|
+
this.chain = run.catch(() => undefined);
|
|
180
|
+
return run;
|
|
181
|
+
}
|
|
182
|
+
kill() {
|
|
183
|
+
if (this.idleTimer) {
|
|
184
|
+
clearTimeout(this.idleTimer);
|
|
185
|
+
this.idleTimer = null;
|
|
186
|
+
}
|
|
187
|
+
const child = this.child;
|
|
188
|
+
this.child = null;
|
|
189
|
+
if (child && child.exitCode === null) {
|
|
190
|
+
try {
|
|
191
|
+
child.kill();
|
|
192
|
+
}
|
|
193
|
+
catch { /* gia' morto */ }
|
|
194
|
+
}
|
|
195
|
+
if (this.current) {
|
|
196
|
+
this.current.settle({ error: "kernel terminato", kernelLost: true });
|
|
197
|
+
this.current = null;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
ensureChild(cwd) {
|
|
201
|
+
if (this.child && this.alive)
|
|
202
|
+
return this.child;
|
|
203
|
+
const script = ensureKernelScript();
|
|
204
|
+
const env = { ...process.env };
|
|
205
|
+
// Sotto Electron process.execPath e' l'app: la fuse runAsNode (attiva per
|
|
206
|
+
// requisito di build) la fa partire come Node puro.
|
|
207
|
+
if (process.versions["electron"])
|
|
208
|
+
env["ELECTRON_RUN_AS_NODE"] = "1";
|
|
209
|
+
const child = spawn(process.execPath, [script], { cwd, windowsHide: true, env, stdio: ["pipe", "pipe", "pipe"] });
|
|
210
|
+
child.stdout?.setEncoding("utf8");
|
|
211
|
+
child.stderr?.setEncoding("utf8");
|
|
212
|
+
child.stdout?.on("data", (chunk) => { if (this.child === child)
|
|
213
|
+
this.onStdout(chunk); });
|
|
214
|
+
child.stderr?.on("data", (chunk) => {
|
|
215
|
+
this.stderrTail = (this.stderrTail + chunk).slice(-2000);
|
|
216
|
+
});
|
|
217
|
+
// Un EPIPE su stdin (kernel appena morto) non deve abbattere talos.
|
|
218
|
+
child.stdin?.on("error", () => { });
|
|
219
|
+
const fail = (reason) => {
|
|
220
|
+
if (this.child !== child)
|
|
221
|
+
return;
|
|
222
|
+
this.child = null;
|
|
223
|
+
if (this.current) {
|
|
224
|
+
this.current.settle({ error: reason, kernelLost: true });
|
|
225
|
+
this.current = null;
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
child.on("exit", () => {
|
|
229
|
+
const detail = this.stderrTail.trim();
|
|
230
|
+
fail(`il kernel e' uscito in modo inatteso${detail ? `: ${detail}` : ""}`);
|
|
231
|
+
});
|
|
232
|
+
child.on("error", (err) => fail(`kernel non avviabile: ${err.message}`));
|
|
233
|
+
this.child = child;
|
|
234
|
+
this.stdoutBuf = "";
|
|
235
|
+
this.stderrTail = "";
|
|
236
|
+
return child;
|
|
237
|
+
}
|
|
238
|
+
onStdout(chunk) {
|
|
239
|
+
this.stdoutBuf += chunk;
|
|
240
|
+
let idx;
|
|
241
|
+
while ((idx = this.stdoutBuf.indexOf("\n")) >= 0) {
|
|
242
|
+
const line = this.stdoutBuf.slice(0, idx);
|
|
243
|
+
this.stdoutBuf = this.stdoutBuf.slice(idx + 1);
|
|
244
|
+
if (!line.trim())
|
|
245
|
+
continue;
|
|
246
|
+
let msg;
|
|
247
|
+
try {
|
|
248
|
+
msg = JSON.parse(line);
|
|
249
|
+
}
|
|
250
|
+
catch {
|
|
251
|
+
continue;
|
|
252
|
+
}
|
|
253
|
+
void this.onMessage(msg);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
async onMessage(msg) {
|
|
257
|
+
const cur = this.current;
|
|
258
|
+
if (!cur)
|
|
259
|
+
return;
|
|
260
|
+
if (msg["t"] === "log") {
|
|
261
|
+
this.appendLog(cur, String(msg["line"] ?? ""));
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
if (msg["t"] === "call") {
|
|
265
|
+
const seq = Number(msg["seq"]);
|
|
266
|
+
const name = String(msg["name"] ?? "");
|
|
267
|
+
const args = msg["args"];
|
|
268
|
+
const result = await this.dispatchTool(cur, name, args);
|
|
269
|
+
if (this.current !== cur)
|
|
270
|
+
return;
|
|
271
|
+
this.send({ t: "call_result", seq, output: result.output, isError: result.isError, result });
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
if (msg["t"] === "done" && Number(msg["id"]) === cur.id) {
|
|
275
|
+
const error = msg["error"] === undefined ? undefined : String(msg["error"]);
|
|
276
|
+
cur.settle(error !== undefined ? { error } : { value: String(msg["value"] ?? "") });
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
// Esegue il tool richiesto dal programma con il ToolContext del turno: i
|
|
280
|
+
// permessi (confirm di write_file, bash, ...) valgono identici al dispatch
|
|
281
|
+
// diretto. Un errore diventa un'eccezione NEL programma, catturabile.
|
|
282
|
+
//
|
|
283
|
+
// Ogni chiamata interna viene anche EMESSA all'host come coppia annidata
|
|
284
|
+
// tool_call/tool_result (via ctx.emitToolEvent): la chat mostra cosa sta
|
|
285
|
+
// facendo il programma e i trigger che ascoltano gli eventi tool (pannello
|
|
286
|
+
// revisione, badge sui file, schede) scattano come per una call diretta.
|
|
287
|
+
async dispatchTool(cur, name, rawArgs) {
|
|
288
|
+
const id = "prog-" + (++nestedCallCounter);
|
|
289
|
+
const failure = (output) => ({ type: "tool_result", callId: id, output, isError: true });
|
|
290
|
+
if (cur.ctx.signal.aborted)
|
|
291
|
+
return failure("programma interrotto");
|
|
292
|
+
if (BRIDGE_DENYLIST.has(name))
|
|
293
|
+
return failure("il tool " + name + " non e' chiamabile da un programma");
|
|
294
|
+
const tool = cur.ctx.tools?.get(name);
|
|
295
|
+
if (tool?.requiresNativeCall)
|
|
296
|
+
return failure("il tool " + name + " richiede una chiamata nativa");
|
|
297
|
+
if (!tool)
|
|
298
|
+
return failure("strumento sconosciuto: " + name);
|
|
299
|
+
cur.callCounts.set(name, (cur.callCounts.get(name) ?? 0) + 1);
|
|
300
|
+
const call = { type: "tool_call", id, name, input: normalizeToolInput(rawArgs, tool.inputSchema) };
|
|
301
|
+
const result = await invokeToolCall(call, cur.ctx);
|
|
302
|
+
// Programs compute on the canonical result; only the model/UI view is compressed.
|
|
303
|
+
return result.content ? { ...result, output: textFromMcpToolResult({ content: result.content }) } : result;
|
|
304
|
+
}
|
|
305
|
+
appendLog(cur, line) {
|
|
306
|
+
if (cur.logChars >= MAX_LOG_CHARS) {
|
|
307
|
+
cur.logsTruncatedLines += 1;
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
cur.logs.push(line);
|
|
311
|
+
cur.logChars += line.length + 1;
|
|
312
|
+
}
|
|
313
|
+
send(msg) {
|
|
314
|
+
try {
|
|
315
|
+
this.child?.stdin?.write(`${JSON.stringify(msg)}\n`);
|
|
316
|
+
}
|
|
317
|
+
catch { /* kernel morto tra dispatch e risposta: l'exit ha gia' chiuso il giro */ }
|
|
318
|
+
}
|
|
319
|
+
touchIdle() {
|
|
320
|
+
if (this.idleTimer)
|
|
321
|
+
clearTimeout(this.idleTimer);
|
|
322
|
+
this.idleTimer = setTimeout(() => kernels.dispose(this.key), KERNEL_IDLE_MS);
|
|
323
|
+
// I timer e il figlio non devono tenere in vita il processo talos a fine
|
|
324
|
+
// sessione: il kernel muore comunque alla chiusura di stdin.
|
|
325
|
+
this.idleTimer.unref?.();
|
|
326
|
+
this.child?.unref();
|
|
327
|
+
// Le pipe stdio sono Socket a runtime, ma tipizzate Writable/Readable:
|
|
328
|
+
// unref esiste e va chiamato, altrimenti tengono vivo l'event loop.
|
|
329
|
+
unrefStream(this.child?.stdin);
|
|
330
|
+
unrefStream(this.child?.stdout);
|
|
331
|
+
unrefStream(this.child?.stderr);
|
|
332
|
+
}
|
|
333
|
+
execNow(code, ctx, timeoutMs, data) {
|
|
334
|
+
return new Promise((resolve) => {
|
|
335
|
+
if (ctx.signal.aborted) {
|
|
336
|
+
resolve({ logs: "", logsTruncatedLines: 0, value: "", error: "programma interrotto", callCounts: new Map() });
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
let child;
|
|
340
|
+
try {
|
|
341
|
+
child = this.ensureChild(ctx.cwd);
|
|
342
|
+
}
|
|
343
|
+
catch (err) {
|
|
344
|
+
resolve({
|
|
345
|
+
logs: "", logsTruncatedLines: 0, value: "",
|
|
346
|
+
error: `impossibile avviare il kernel: ${err.message}`,
|
|
347
|
+
kernelLost: true, callCounts: new Map(),
|
|
348
|
+
});
|
|
349
|
+
return;
|
|
350
|
+
}
|
|
351
|
+
if (this.idleTimer) {
|
|
352
|
+
clearTimeout(this.idleTimer);
|
|
353
|
+
this.idleTimer = null;
|
|
354
|
+
}
|
|
355
|
+
const id = this.nextExecId;
|
|
356
|
+
this.nextExecId += 1;
|
|
357
|
+
let settled = false;
|
|
358
|
+
let timer = null;
|
|
359
|
+
const execution = new AbortController();
|
|
360
|
+
const cur = {
|
|
361
|
+
id, ctx: { ...ctx, signal: execution.signal },
|
|
362
|
+
logs: [], logChars: 0, logsTruncatedLines: 0,
|
|
363
|
+
callCounts: new Map(),
|
|
364
|
+
settle: (outcome) => {
|
|
365
|
+
if (settled)
|
|
366
|
+
return;
|
|
367
|
+
settled = true;
|
|
368
|
+
if (timer)
|
|
369
|
+
clearTimeout(timer);
|
|
370
|
+
ctx.signal.removeEventListener("abort", onAbort);
|
|
371
|
+
if (this.current === cur)
|
|
372
|
+
this.current = null;
|
|
373
|
+
// Il timeout/kill del kernel deve fermare anche i tool nel parent.
|
|
374
|
+
// A fine programma non possono sopravvivere chiamate non attese.
|
|
375
|
+
execution.abort();
|
|
376
|
+
if (!outcome.kernelLost)
|
|
377
|
+
this.touchIdle();
|
|
378
|
+
resolve({
|
|
379
|
+
logs: cur.logs.join("\n"),
|
|
380
|
+
logsTruncatedLines: cur.logsTruncatedLines,
|
|
381
|
+
value: outcome.value ?? "",
|
|
382
|
+
...(outcome.error !== undefined ? { error: outcome.error } : {}),
|
|
383
|
+
...(outcome.kernelLost ? { kernelLost: true } : {}),
|
|
384
|
+
callCounts: cur.callCounts,
|
|
385
|
+
});
|
|
386
|
+
},
|
|
387
|
+
};
|
|
388
|
+
const onAbort = () => {
|
|
389
|
+
// Non c'e' interruzione pulita di un AsyncFunction in corsa: si uccide
|
|
390
|
+
// il processo. Meglio uno stato perso che un kernel zombie che continua
|
|
391
|
+
// a chiamare tool dopo lo stop dell'utente.
|
|
392
|
+
cur.settle({ error: "programma interrotto", kernelLost: true });
|
|
393
|
+
this.kill();
|
|
394
|
+
};
|
|
395
|
+
timer = setTimeout(() => {
|
|
396
|
+
cur.settle({
|
|
397
|
+
error: `timeout dopo ${Math.round(timeoutMs / 1000)}s: il kernel e' stato terminato e lo stato e' perso. `
|
|
398
|
+
+ "Spezza il lavoro in programmi piu' brevi o alza timeout_s.",
|
|
399
|
+
kernelLost: true,
|
|
400
|
+
});
|
|
401
|
+
this.kill();
|
|
402
|
+
}, timeoutMs);
|
|
403
|
+
ctx.signal.addEventListener("abort", onAbort, { once: true });
|
|
404
|
+
this.current = cur;
|
|
405
|
+
try {
|
|
406
|
+
// write=false e' solo backpressure (payload piccoli); un throw invece
|
|
407
|
+
// significa stdin gia' distrutto e va chiuso subito.
|
|
408
|
+
child.stdin?.write(`${JSON.stringify({ t: "exec", id, code, data })}\n`);
|
|
409
|
+
}
|
|
410
|
+
catch (err) {
|
|
411
|
+
cur.settle({ error: `kernel non raggiungibile: ${err.message}`, kernelLost: true });
|
|
412
|
+
this.kill();
|
|
413
|
+
}
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
class KernelStore {
|
|
418
|
+
byKey = new Map();
|
|
419
|
+
acquire(key) {
|
|
420
|
+
const existing = this.byKey.get(key);
|
|
421
|
+
if (existing) {
|
|
422
|
+
// Riordina per LRU: l'ultimo usato e' l'ultimo a morire.
|
|
423
|
+
this.byKey.delete(key);
|
|
424
|
+
this.byKey.set(key, existing);
|
|
425
|
+
return existing;
|
|
426
|
+
}
|
|
427
|
+
while (this.byKey.size >= MAX_KERNELS) {
|
|
428
|
+
const oldest = this.byKey.keys().next().value;
|
|
429
|
+
if (oldest === undefined)
|
|
430
|
+
break;
|
|
431
|
+
this.dispose(oldest);
|
|
432
|
+
}
|
|
433
|
+
const kernel = new ProgramKernel(key);
|
|
434
|
+
this.byKey.set(key, kernel);
|
|
435
|
+
return kernel;
|
|
436
|
+
}
|
|
437
|
+
dispose(key) {
|
|
438
|
+
const kernel = this.byKey.get(key);
|
|
439
|
+
if (!kernel)
|
|
440
|
+
return;
|
|
441
|
+
this.byKey.delete(key);
|
|
442
|
+
kernel.kill();
|
|
443
|
+
}
|
|
444
|
+
disposeAll() {
|
|
445
|
+
for (const key of [...this.byKey.keys()])
|
|
446
|
+
this.dispose(key);
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
const kernels = new KernelStore();
|
|
450
|
+
// Esposto per i test e per gli host che vogliono spegnere i kernel (es. chiusura app).
|
|
451
|
+
export function disposeProgramKernels() {
|
|
452
|
+
kernels.disposeAll();
|
|
453
|
+
}
|
|
454
|
+
function kernelKey(ctx) {
|
|
455
|
+
const target = ctx.executionTarget ?? localExecutionTarget();
|
|
456
|
+
// Il figlio usa cwd locale: realpath unifica alias e symlink, non workspace diversi.
|
|
457
|
+
const workspace = executionPathKey(target, realpathSync(ctx.cwd));
|
|
458
|
+
return JSON.stringify([executionTargetKey(target), workspace, ctx.sessionId ?? null]);
|
|
459
|
+
}
|
|
460
|
+
function clampTimeoutMs(raw) {
|
|
461
|
+
const s = typeof raw === "number" && Number.isFinite(raw) ? raw : DEFAULT_TIMEOUT_S;
|
|
462
|
+
return Math.min(Math.max(Math.floor(s), 1), MAX_TIMEOUT_S) * 1000;
|
|
463
|
+
}
|
|
464
|
+
function truncateValue(value) {
|
|
465
|
+
if (value.length <= MAX_VALUE_CHARS)
|
|
466
|
+
return value;
|
|
467
|
+
return `${value.slice(0, MAX_VALUE_CHARS)}\n[valore troncato a ${MAX_VALUE_CHARS} caratteri: `
|
|
468
|
+
+ "salva il resto in state e leggilo a pezzi con un programma successivo]";
|
|
469
|
+
}
|
|
470
|
+
function callSummary(counts) {
|
|
471
|
+
if (!counts.size)
|
|
472
|
+
return "";
|
|
473
|
+
const parts = [...counts.entries()].map(([name, n]) => (n > 1 ? `${name}×${n}` : name));
|
|
474
|
+
return `(tool usati: ${parts.join(", ")})`;
|
|
475
|
+
}
|
|
476
|
+
function composeOutput(outcome) {
|
|
477
|
+
const sections = [];
|
|
478
|
+
if (outcome.logs)
|
|
479
|
+
sections.push(outcome.logs);
|
|
480
|
+
if (outcome.logsTruncatedLines > 0) {
|
|
481
|
+
sections.push(`[log troncati: ${outcome.logsTruncatedLines} righe omesse]`);
|
|
482
|
+
}
|
|
483
|
+
if (outcome.error !== undefined) {
|
|
484
|
+
sections.push(`errore programma: ${outcome.error}`);
|
|
485
|
+
sections.push(outcome.kernelLost
|
|
486
|
+
? "(kernel terminato: `state` e le variabili globali sono persi)"
|
|
487
|
+
: "(il kernel e' vivo: `state` e le variabili globali sono conservati, correggi e riesegui)");
|
|
488
|
+
const summary = callSummary(outcome.callCounts);
|
|
489
|
+
if (summary)
|
|
490
|
+
sections.push(summary);
|
|
491
|
+
return { output: sections.join("\n"), isError: true };
|
|
492
|
+
}
|
|
493
|
+
sections.push(outcome.value ? `→ ${truncateValue(outcome.value)}` : "→ (nessun valore di ritorno)");
|
|
494
|
+
const summary = callSummary(outcome.callCounts);
|
|
495
|
+
if (summary)
|
|
496
|
+
sections.push(summary);
|
|
497
|
+
return { output: sections.join("\n"), isError: false };
|
|
498
|
+
}
|
|
499
|
+
export const runProgramTool = {
|
|
500
|
+
name: "run_program",
|
|
501
|
+
description: "Esegue un programma JavaScript in un kernel persistente della sessione, con i tool come funzioni async: "
|
|
502
|
+
+ "`const src = await tools.read_file({path:\"src/a.ts\"})`. Tutti i tool del catalogo sono chiamabili per "
|
|
503
|
+
+ "nome, anche quelli on-demand, senza tool_search. Usalo quando servono piu' azioni collegate "
|
|
504
|
+
+ "(leggi-filtra-scrivi, fan-out con Promise.all, cicli su molti file): un programma sostituisce molte tool "
|
|
505
|
+
+ "call e i risultati intermedi restano nel kernel, fuori dal contesto. `state` conserva valori tra "
|
|
506
|
+
+ "esecuzioni; le assegnazioni senza const/let persistono; `return` produce il risultato; console.log per il "
|
|
507
|
+
+ "progresso; un tool fallito lancia un'eccezione (try/catch). "
|
|
508
|
+
+ "`await tools.$result(nome, argomenti)` restituisce output, structuredContent, content e isError senza perdere i dati. "
|
|
509
|
+
+ "Passa script e testi multilinea nel parametro JSON data e leggili con tools.$data, senza annidarli nel codice. "
|
|
510
|
+
+ "Richiede conferma dell'utente, come bash. "
|
|
511
|
+
+ "Per una singola azione chiama il tool direttamente.",
|
|
512
|
+
schema: {
|
|
513
|
+
type: "object",
|
|
514
|
+
properties: {
|
|
515
|
+
code: {
|
|
516
|
+
type: "string",
|
|
517
|
+
description: "programma JavaScript (corpo di funzione async: await disponibile, return per il risultato)",
|
|
518
|
+
},
|
|
519
|
+
timeout_s: {
|
|
520
|
+
type: "number",
|
|
521
|
+
description: `tetto in secondi (default ${DEFAULT_TIMEOUT_S}, max ${MAX_TIMEOUT_S})`,
|
|
522
|
+
},
|
|
523
|
+
data: { type: "object", description: "Dati JSON del programma, accessibili con tools.$data; script e testi passano senza escaping JavaScript" },
|
|
524
|
+
reset: {
|
|
525
|
+
type: "boolean",
|
|
526
|
+
description: "riavvia il kernel della sessione prima di eseguire (state e globali persi)",
|
|
527
|
+
},
|
|
528
|
+
},
|
|
529
|
+
required: ["code"],
|
|
530
|
+
},
|
|
531
|
+
handler: async (input, ctx) => {
|
|
532
|
+
if (ctx.signal.aborted)
|
|
533
|
+
return { output: "programma interrotto", isError: true };
|
|
534
|
+
const code = String(input["code"] ?? "").trim();
|
|
535
|
+
if (!code) {
|
|
536
|
+
return { output: "indica `code`: il programma JavaScript da eseguire "
|
|
537
|
+
+ '(es. {"code":"const out = await tools.grep({pattern:\\"TODO\\"}); return out"})', isError: true };
|
|
538
|
+
}
|
|
539
|
+
const syntax = programSyntaxError(code);
|
|
540
|
+
if (syntax)
|
|
541
|
+
return syntax;
|
|
542
|
+
const supplied = input["data"];
|
|
543
|
+
if (supplied !== undefined && (!supplied || typeof supplied !== "object" || Array.isArray(supplied))) {
|
|
544
|
+
return { output: "data deve essere un oggetto JSON", isError: true };
|
|
545
|
+
}
|
|
546
|
+
let data;
|
|
547
|
+
try {
|
|
548
|
+
data = JSON.parse(JSON.stringify(supplied ?? {}));
|
|
549
|
+
}
|
|
550
|
+
catch {
|
|
551
|
+
return { output: "data deve essere serializzabile in JSON", isError: true };
|
|
552
|
+
}
|
|
553
|
+
const ok = await ctx.confirm("run_program", code + (supplied === undefined ? "" : "\n\n[data]\n" + JSON.stringify(data, null, 2)));
|
|
554
|
+
if (ctx.signal.aborted)
|
|
555
|
+
return { output: "programma interrotto", isError: true };
|
|
556
|
+
if (!ok)
|
|
557
|
+
return { output: "programma rifiutato dall'utente", isError: true };
|
|
558
|
+
const key = kernelKey(ctx);
|
|
559
|
+
if (input["reset"] === true)
|
|
560
|
+
kernels.dispose(key);
|
|
561
|
+
const kernel = kernels.acquire(key);
|
|
562
|
+
const outcome = await kernel.exec(code, ctx, clampTimeoutMs(input["timeout_s"]), data);
|
|
563
|
+
if (outcome.kernelLost)
|
|
564
|
+
kernels.dispose(key);
|
|
565
|
+
return composeOutput(outcome);
|
|
566
|
+
},
|
|
567
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { RegisteredTool, ToolContext, ToolDef, ToolHandlerOutput } from "../core/types.js";
|
|
2
|
+
export type ProtocolRegistry = NonNullable<ToolContext["tools"]>;
|
|
3
|
+
export interface ProtocolCatalog {
|
|
4
|
+
readonly revision: string;
|
|
5
|
+
readonly tools: ReadonlyMap<string, ToolDef>;
|
|
6
|
+
readonly capabilities: ReadonlyMap<string, readonly string[]>;
|
|
7
|
+
}
|
|
8
|
+
export declare function catalogRevision(registry: ProtocolRegistry): string;
|
|
9
|
+
export declare function protocolCatalog(registry: ProtocolRegistry): ProtocolCatalog;
|
|
10
|
+
export declare function nativeCall(tool: RegisteredTool): boolean;
|
|
11
|
+
export declare function protocolResult(data: Record<string, unknown>, isError?: boolean): ToolHandlerOutput;
|
|
12
|
+
export declare function protocolError(status: string, detail: string, fields?: Record<string, unknown>): ToolHandlerOutput;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { toolInventory } from "./discovery.js";
|
|
3
|
+
import { NATIVE_CALL_TOOLS } from "./capabilities.js";
|
|
4
|
+
const cache = new WeakMap();
|
|
5
|
+
const identities = new WeakMap();
|
|
6
|
+
let nextIdentity = 0;
|
|
7
|
+
export function catalogRevision(registry) {
|
|
8
|
+
if (registry.revision)
|
|
9
|
+
return registry.revision;
|
|
10
|
+
// Older SDK hosts: include handler registration identity, not only schema text.
|
|
11
|
+
const rows = toolInventory(registry).map(def => {
|
|
12
|
+
const tool = registry.get(def.name);
|
|
13
|
+
if (tool && !identities.has(tool))
|
|
14
|
+
identities.set(tool, ++nextIdentity);
|
|
15
|
+
return [def.name, def.description, def.inputSchema, def.outputSchema, tool && identities.get(tool)];
|
|
16
|
+
}).sort((a, b) => String(a[0]).localeCompare(String(b[0])));
|
|
17
|
+
return createHash("sha256").update(JSON.stringify(rows)).digest("hex").slice(0, 20);
|
|
18
|
+
}
|
|
19
|
+
export function protocolCatalog(registry) {
|
|
20
|
+
const revision = catalogRevision(registry);
|
|
21
|
+
const previous = cache.get(registry);
|
|
22
|
+
if (previous?.revision === revision)
|
|
23
|
+
return previous;
|
|
24
|
+
const tools = new Map([...toolInventory(registry)].sort((a, b) => a.name.localeCompare(b.name))
|
|
25
|
+
.map(tool => [tool.name, tool]));
|
|
26
|
+
const capabilities = new Map();
|
|
27
|
+
for (const [name] of tools) {
|
|
28
|
+
for (const capability of registry.get(name)?.capabilities ?? []) {
|
|
29
|
+
if (!/^[a-z][a-z0-9_-]*(?:\.[a-z][a-z0-9_-]*)+$/.test(capability))
|
|
30
|
+
continue;
|
|
31
|
+
capabilities.set(capability, [...(capabilities.get(capability) ?? []), name]);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
const catalog = { revision, tools, capabilities };
|
|
35
|
+
cache.set(registry, catalog);
|
|
36
|
+
return catalog;
|
|
37
|
+
}
|
|
38
|
+
export function nativeCall(tool) {
|
|
39
|
+
return tool.requiresNativeCall === true || NATIVE_CALL_TOOLS.has(tool.name);
|
|
40
|
+
}
|
|
41
|
+
export function protocolResult(data, isError = false) {
|
|
42
|
+
return { output: JSON.stringify(data), structuredContent: data, isError };
|
|
43
|
+
}
|
|
44
|
+
export function protocolError(status, detail, fields = {}) {
|
|
45
|
+
return protocolResult({ status, detail, ...fields }, true);
|
|
46
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Tool } from "../core/types.js";
|
|
2
|
+
export declare const ramPlanTool: Tool;
|
|
3
|
+
export declare const ramStatusTool: Tool;
|
|
4
|
+
export declare const ramTakeTool: Tool;
|
|
5
|
+
export declare const ramSubmitTool: Tool;
|
|
6
|
+
export declare const ramAskTool: Tool;
|
|
7
|
+
export declare const ramJudgeTool: Tool;
|
|
8
|
+
export declare const ramProposeTool: Tool;
|
|
9
|
+
export declare const ramDecideTool: Tool;
|
|
10
|
+
export declare const ramTellTool: Tool;
|
|
11
|
+
export declare const ramHearTool: Tool;
|
|
12
|
+
export declare const ramificationTools: readonly Tool[];
|