@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,187 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { pendingText } from "../core/user-inbox.js";
|
|
3
|
+
import { groupTeamPrompts, teamPrompt } from "./queue-team.js";
|
|
4
|
+
// Un solo proprietario dei messaggi: restano modificabili fino al prelievo
|
|
5
|
+
// atomico del turno. La schermata di gestione sospende entrambi i percorsi.
|
|
6
|
+
export class PromptQueue {
|
|
7
|
+
prepare;
|
|
8
|
+
onChange;
|
|
9
|
+
persistence;
|
|
10
|
+
entries = [];
|
|
11
|
+
storageError = "";
|
|
12
|
+
storageReadable = true;
|
|
13
|
+
delivered = new Map();
|
|
14
|
+
immediateListeners = new Set();
|
|
15
|
+
pausing = false;
|
|
16
|
+
holding = false;
|
|
17
|
+
inbox;
|
|
18
|
+
constructor(prepare = text => [{ type: "text", text }], onChange = () => { }, persistence, restoreInput = entry => entry) {
|
|
19
|
+
this.prepare = prepare;
|
|
20
|
+
this.onChange = onChange;
|
|
21
|
+
this.persistence = persistence;
|
|
22
|
+
try {
|
|
23
|
+
const saved = persistence?.load();
|
|
24
|
+
if (saved) {
|
|
25
|
+
this.entries = saved.entries.map(restoreInput).map(e => ({ ...e,
|
|
26
|
+
delivery: e.text.trimStart().startsWith("/") ? "after-turn" : e.delivery === "immediate" ? "during-turn" : e.delivery,
|
|
27
|
+
teamBatchId: e.text.trimStart().startsWith("/") ? undefined : e.teamBatchId }));
|
|
28
|
+
this.pausing = this.entries.length > 0;
|
|
29
|
+
if (this.entries.length)
|
|
30
|
+
this.persist();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
this.storageReadable = false;
|
|
35
|
+
this.storageError = `Ripristino coda non riuscito: ${error instanceof Error ? error.message : String(error)}`;
|
|
36
|
+
}
|
|
37
|
+
const queue = this;
|
|
38
|
+
this.inbox = {
|
|
39
|
+
push(input, id) {
|
|
40
|
+
const parts = typeof input === "string" ? queue.prepare(input) : input;
|
|
41
|
+
return queue.add(pendingText({ id: "", parts, queuedAt: 0 }), "during-turn", parts, id).id;
|
|
42
|
+
},
|
|
43
|
+
promote: id => queue.moveFirst(id),
|
|
44
|
+
get pending() { return queue.entries.filter(e => queue.ready(e)).length; },
|
|
45
|
+
onImmediate(listener) {
|
|
46
|
+
queue.immediateListeners.add(listener);
|
|
47
|
+
if (queue.immediatePending)
|
|
48
|
+
listener();
|
|
49
|
+
return () => { queue.immediateListeners.delete(listener); };
|
|
50
|
+
},
|
|
51
|
+
drain() {
|
|
52
|
+
const ready = queue.entries.filter(e => queue.ready(e));
|
|
53
|
+
if (!ready.length)
|
|
54
|
+
return [];
|
|
55
|
+
const messages = groupTeamPrompts(ready);
|
|
56
|
+
queue.entries = queue.entries.filter(e => !queue.ready(e));
|
|
57
|
+
for (const entry of messages)
|
|
58
|
+
queue.delivered.set(entry.id, entry.text);
|
|
59
|
+
queue.changed();
|
|
60
|
+
return messages.map(entry => ({ ...entry, ...(entry.delivery === "immediate" ? { immediate: true } : {}) }));
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
get length() { return this.entries.length; }
|
|
65
|
+
get teamRequestCount() { return this.entries.filter(e => !e.text.trimStart().startsWith("/")).length; }
|
|
66
|
+
get blocked() { return this.paused || this.held; }
|
|
67
|
+
get paused() { return this.pausing; }
|
|
68
|
+
set paused(value) {
|
|
69
|
+
this.pausing = value;
|
|
70
|
+
if (value)
|
|
71
|
+
this.entries = this.entries.map(e => e.delivery === "immediate" ? { ...e, delivery: "during-turn" } : e);
|
|
72
|
+
this.changed();
|
|
73
|
+
}
|
|
74
|
+
get held() { return this.holding; }
|
|
75
|
+
set held(value) { this.holding = value; this.notifyImmediate(); }
|
|
76
|
+
get immediatePending() { return !this.held && this.entries.some(e => e.delivery === "immediate"); }
|
|
77
|
+
ready(entry) {
|
|
78
|
+
return !this.held && (entry.delivery === "immediate" || (!this.paused && entry.delivery === "during-turn"));
|
|
79
|
+
}
|
|
80
|
+
notifyImmediate() {
|
|
81
|
+
if (this.immediatePending)
|
|
82
|
+
for (const listener of this.immediateListeners)
|
|
83
|
+
listener();
|
|
84
|
+
}
|
|
85
|
+
items() { return this.entries; }
|
|
86
|
+
get(id) { return this.entries.find(e => e.id === id); }
|
|
87
|
+
persist() {
|
|
88
|
+
if (!this.storageReadable)
|
|
89
|
+
return;
|
|
90
|
+
try {
|
|
91
|
+
this.persistence?.save({ entries: this.entries, paused: this.paused });
|
|
92
|
+
this.storageError = "";
|
|
93
|
+
}
|
|
94
|
+
catch (error) {
|
|
95
|
+
this.storageError = `Coda non salvata: ${error instanceof Error ? error.message : String(error)}`;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
changed() { this.persist(); this.onChange(); }
|
|
99
|
+
add(text, delivery = "after-turn", parts = this.prepare(text), id) {
|
|
100
|
+
if (!text.trim())
|
|
101
|
+
throw new Error("Il messaggio non può essere vuoto.");
|
|
102
|
+
if (text.trimStart().startsWith("/"))
|
|
103
|
+
delivery = "after-turn";
|
|
104
|
+
const entry = { id: id ?? `queued-${randomUUID()}`, text, parts, delivery, queuedAt: Date.now() };
|
|
105
|
+
if (this.get(entry.id))
|
|
106
|
+
throw new Error("Messaggio già in coda.");
|
|
107
|
+
this.entries = [...this.entries, entry];
|
|
108
|
+
this.changed();
|
|
109
|
+
this.notifyImmediate();
|
|
110
|
+
return entry;
|
|
111
|
+
}
|
|
112
|
+
update(id, text) {
|
|
113
|
+
if (!this.get(id))
|
|
114
|
+
return false;
|
|
115
|
+
if (!text.trim())
|
|
116
|
+
throw new Error("Il messaggio non può essere vuoto. Usa Elimina per rimuoverlo.");
|
|
117
|
+
const parts = this.prepare(text);
|
|
118
|
+
this.entries = this.entries.map(e => e.id === id ? { ...e, text, parts,
|
|
119
|
+
teamBatchId: text.trimStart().startsWith("/") ? undefined : e.teamBatchId,
|
|
120
|
+
delivery: text.trimStart().startsWith("/") ? "after-turn" : e.delivery } : e);
|
|
121
|
+
this.changed();
|
|
122
|
+
return true;
|
|
123
|
+
}
|
|
124
|
+
remove(id) {
|
|
125
|
+
if (!this.get(id))
|
|
126
|
+
return false;
|
|
127
|
+
this.entries = this.entries.filter(e => e.id !== id);
|
|
128
|
+
this.changed();
|
|
129
|
+
return true;
|
|
130
|
+
}
|
|
131
|
+
move(id, offset) {
|
|
132
|
+
const from = this.entries.findIndex(e => e.id === id);
|
|
133
|
+
if (from < 0)
|
|
134
|
+
return false;
|
|
135
|
+
const to = Math.max(0, Math.min(this.entries.length - 1, from + offset));
|
|
136
|
+
const entries = [...this.entries];
|
|
137
|
+
const [entry] = entries.splice(from, 1);
|
|
138
|
+
entries.splice(to, 0, entry);
|
|
139
|
+
this.entries = entries;
|
|
140
|
+
this.changed();
|
|
141
|
+
return true;
|
|
142
|
+
}
|
|
143
|
+
moveFirst(id) { return this.move(id, -this.entries.length); }
|
|
144
|
+
setDelivery(id, delivery) {
|
|
145
|
+
const entry = this.get(id);
|
|
146
|
+
if (!entry || (delivery !== "after-turn" && entry.text.trimStart().startsWith("/")))
|
|
147
|
+
return false;
|
|
148
|
+
this.entries = this.entries.map(e => e.id === id ? { ...e, delivery, teamBatchId: undefined } : e);
|
|
149
|
+
this.changed();
|
|
150
|
+
this.notifyImmediate();
|
|
151
|
+
return true;
|
|
152
|
+
}
|
|
153
|
+
sendNow(id) {
|
|
154
|
+
if (!this.get(id) || this.get(id).text.trimStart().startsWith("/"))
|
|
155
|
+
return false;
|
|
156
|
+
this.moveFirst(id);
|
|
157
|
+
return this.setDelivery(id, "immediate");
|
|
158
|
+
}
|
|
159
|
+
sendToTeam() {
|
|
160
|
+
if (this.teamRequestCount < 3)
|
|
161
|
+
return false;
|
|
162
|
+
const teamBatchId = `team-${randomUUID()}`;
|
|
163
|
+
this.entries = this.entries.map(e => e.text.trimStart().startsWith("/") ? e
|
|
164
|
+
: { ...e, delivery: "immediate", teamBatchId });
|
|
165
|
+
this.changed();
|
|
166
|
+
this.notifyImmediate();
|
|
167
|
+
return true;
|
|
168
|
+
}
|
|
169
|
+
takeNext() {
|
|
170
|
+
if (this.held)
|
|
171
|
+
return undefined;
|
|
172
|
+
const first = this.entries.find(e => e.delivery === "immediate") ?? (!this.paused ? this.entries[0] : undefined);
|
|
173
|
+
if (!first)
|
|
174
|
+
return undefined;
|
|
175
|
+
const group = first.teamBatchId ? this.entries.filter(e => e.teamBatchId === first.teamBatchId) : [first];
|
|
176
|
+
const message = first.teamBatchId ? teamPrompt(group) : first;
|
|
177
|
+
const ids = new Set(group.map(e => e.id));
|
|
178
|
+
this.entries = this.entries.filter(e => !ids.has(e.id));
|
|
179
|
+
this.changed();
|
|
180
|
+
return message;
|
|
181
|
+
}
|
|
182
|
+
acknowledge(id) {
|
|
183
|
+
const text = this.delivered.get(id);
|
|
184
|
+
this.delivered.delete(id);
|
|
185
|
+
return text;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type ProviderSpec } from "../providers/catalog.js";
|
|
2
|
+
import type { ProviderRegistry } from "../providers/registry.js";
|
|
3
|
+
export interface ProviderRow {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
readonly label: string;
|
|
6
|
+
readonly kind: ProviderSpec["kind"];
|
|
7
|
+
readonly configured: boolean;
|
|
8
|
+
readonly active: boolean;
|
|
9
|
+
readonly needsKey: boolean;
|
|
10
|
+
readonly source: "env" | "saved" | "local" | null;
|
|
11
|
+
readonly modelCount: number;
|
|
12
|
+
readonly baseUrl: string | null;
|
|
13
|
+
readonly spec: ProviderSpec;
|
|
14
|
+
}
|
|
15
|
+
export declare function scopedEnvName(providerId: string, suffix: "API_KEY" | "BASE_URL"): string;
|
|
16
|
+
export declare function providerRows(env: NodeJS.ProcessEnv, registry: ProviderRegistry, currentModel: string): readonly ProviderRow[];
|
|
17
|
+
export declare function rowStatusLabel(row: ProviderRow): string;
|
|
18
|
+
export declare function providerKeyHint(spec: ProviderSpec): string;
|
|
19
|
+
export interface SaveOutcome {
|
|
20
|
+
readonly ok: boolean;
|
|
21
|
+
readonly error?: string;
|
|
22
|
+
}
|
|
23
|
+
export declare function saveProviderKey(env: NodeJS.ProcessEnv, providerId: string, apiKey: string): SaveOutcome;
|
|
24
|
+
export declare function saveProviderBaseUrl(env: NodeJS.ProcessEnv, providerId: string, baseUrl: string): SaveOutcome;
|
|
25
|
+
export declare function removeProvider(env: NodeJS.ProcessEnv, providerId: string): SaveOutcome;
|
|
26
|
+
export declare function isRemovable(env: NodeJS.ProcessEnv, providerId: string): boolean;
|
|
27
|
+
export type ProviderAction = "set-key" | "set-endpoint" | "oauth" | "remove" | "use-model" | "back";
|
|
28
|
+
export interface ActionOption {
|
|
29
|
+
readonly action: ProviderAction;
|
|
30
|
+
readonly label: string;
|
|
31
|
+
readonly detail: string;
|
|
32
|
+
}
|
|
33
|
+
export declare function actionsFor(env: NodeJS.ProcessEnv, row: ProviderRow): readonly ActionOption[];
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
// Logica del menu provider navigabile (/provider). Parte PURA, senza
|
|
2
|
+
// dipendenze dalla TUI: calcola lo stato dei provider e incapsula le azioni di
|
|
3
|
+
// persistenza (salva chiave, salva endpoint, rimuovi). La UI in repl.ts si
|
|
4
|
+
// occupa solo di disegnare i picker e raccogliere l'input.
|
|
5
|
+
//
|
|
6
|
+
// Obiettivo UX: un solo punto da cui (1) vedere tutti i provider e il loro
|
|
7
|
+
// stato, (2) configurarne uno con la chiave/endpoint in modo guidato, (3)
|
|
8
|
+
// aggiungere un provider non ancora attivo, (4) rimuovere una credenziale.
|
|
9
|
+
// Niente passaggi meccanici: ogni provider sa gia' che chiave vuole e dove.
|
|
10
|
+
import { PROVIDER_CATALOG } from "../providers/catalog.js";
|
|
11
|
+
import { saveCredential, deleteCredential, loadCredentials } from "../core/credentials.js";
|
|
12
|
+
// Nome della variabile d'ambiente scoped, allineato a registry.ts/credentials.ts.
|
|
13
|
+
export function scopedEnvName(providerId, suffix) {
|
|
14
|
+
const norm = providerId.toUpperCase().replace(/[^A-Z0-9]/g, "_");
|
|
15
|
+
return `TALOS_${norm}_${suffix}`;
|
|
16
|
+
}
|
|
17
|
+
function envValue(env, name) {
|
|
18
|
+
return String(env[name] ?? "").trim();
|
|
19
|
+
}
|
|
20
|
+
// Stabilisce come e' configurata la chiave di un provider, distinguendo una
|
|
21
|
+
// variabile esportata "a mano" dall'utente da una credenziale salvata da noi.
|
|
22
|
+
function keySource(env, spec, saved) {
|
|
23
|
+
if (!spec.envKey)
|
|
24
|
+
return "local"; // locale (Ollama): nessuna chiave
|
|
25
|
+
const scoped = scopedEnvName(spec.id, "API_KEY");
|
|
26
|
+
// Se la credenziale salvata e' stata applicata, compare nella scoped var: per
|
|
27
|
+
// distinguerla dalla env "vera" dell'utente guardiamo prima la envKey nuda e
|
|
28
|
+
// la scoped NON salvata.
|
|
29
|
+
const rawKey = envValue(env, spec.envKey);
|
|
30
|
+
if (rawKey)
|
|
31
|
+
return "env";
|
|
32
|
+
if (saved)
|
|
33
|
+
return "saved";
|
|
34
|
+
if (envValue(env, scoped))
|
|
35
|
+
return "env";
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
// Endpoint corrente del provider (override scoped, env dedicata, o baseUrl del
|
|
39
|
+
// catalogo). Per i locali usa l'host configurato.
|
|
40
|
+
function currentBaseUrl(env, spec) {
|
|
41
|
+
const scoped = envValue(env, scopedEnvName(spec.id, "BASE_URL"));
|
|
42
|
+
if (scoped)
|
|
43
|
+
return scoped;
|
|
44
|
+
if (spec.baseUrlEnv) {
|
|
45
|
+
const host = envValue(env, spec.baseUrlEnv);
|
|
46
|
+
if (host)
|
|
47
|
+
return /\/v\d+\/?$/.test(host) ? host.replace(/\/$/, "") : `${host.replace(/\/$/, "")}/v1`;
|
|
48
|
+
return spec.defaultBaseUrl ?? null;
|
|
49
|
+
}
|
|
50
|
+
return spec.baseUrl ?? null;
|
|
51
|
+
}
|
|
52
|
+
// Costruisce le righe di stato per TUTTI i provider del catalogo, segnando
|
|
53
|
+
// quale e' attivo per il modello corrente. L'ordine segue il catalogo, ma i
|
|
54
|
+
// provider configurati vengono portati in cima per accesso rapido.
|
|
55
|
+
export function providerRows(env, registry, currentModel) {
|
|
56
|
+
const resolved = registry.resolve(currentModel);
|
|
57
|
+
const activeId = resolved ? resolved.provider.id : null;
|
|
58
|
+
const saved = loadCredentials(env);
|
|
59
|
+
const rows = PROVIDER_CATALOG.map((spec) => {
|
|
60
|
+
const inRegistry = Boolean(registry.get(spec.id));
|
|
61
|
+
const needsKey = Boolean(spec.envKey);
|
|
62
|
+
const baseUrl = currentBaseUrl(env, spec);
|
|
63
|
+
const source = spec.optionalEndpoint && !baseUrl
|
|
64
|
+
? null
|
|
65
|
+
: keySource(env, spec, Boolean(saved[spec.id]?.apiKey));
|
|
66
|
+
return {
|
|
67
|
+
id: spec.id,
|
|
68
|
+
label: spec.label,
|
|
69
|
+
kind: spec.kind,
|
|
70
|
+
configured: inRegistry,
|
|
71
|
+
active: spec.id === activeId,
|
|
72
|
+
needsKey,
|
|
73
|
+
source,
|
|
74
|
+
modelCount: spec.models.length,
|
|
75
|
+
baseUrl,
|
|
76
|
+
spec,
|
|
77
|
+
};
|
|
78
|
+
});
|
|
79
|
+
// Configurati prima (attivo in testa), poi i non configurati.
|
|
80
|
+
return [...rows].sort((a, b) => {
|
|
81
|
+
if (a.active !== b.active)
|
|
82
|
+
return a.active ? -1 : 1;
|
|
83
|
+
if (a.configured !== b.configured)
|
|
84
|
+
return a.configured ? -1 : 1;
|
|
85
|
+
return 0;
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
// Riepilogo di stato a una riga, da mostrare nel picker accanto al nome.
|
|
89
|
+
export function rowStatusLabel(row) {
|
|
90
|
+
if (row.active)
|
|
91
|
+
return "attivo";
|
|
92
|
+
if (row.source === "local")
|
|
93
|
+
return "locale";
|
|
94
|
+
if (row.source === "env")
|
|
95
|
+
return "configurato (env)";
|
|
96
|
+
if (row.source === "saved")
|
|
97
|
+
return "configurato";
|
|
98
|
+
return "da configurare";
|
|
99
|
+
}
|
|
100
|
+
// Suggerimento d'aiuto per ottenere la chiave del provider.
|
|
101
|
+
export function providerKeyHint(spec) {
|
|
102
|
+
switch (spec.id) {
|
|
103
|
+
case "openrouter":
|
|
104
|
+
return "ottieni la chiave su https://openrouter.ai/keys (sk-or-...) o usa il login OAuth";
|
|
105
|
+
case "anthropic":
|
|
106
|
+
return "ottieni la chiave su https://console.anthropic.com/settings/keys (sk-ant-...)";
|
|
107
|
+
case "openai":
|
|
108
|
+
return "ottieni la chiave su https://platform.openai.com/api-keys (sk-...)";
|
|
109
|
+
case "ollama":
|
|
110
|
+
return "provider locale: imposta solo l'endpoint (default http://localhost:11434/v1)";
|
|
111
|
+
case "lmstudio":
|
|
112
|
+
return "provider locale: avvia il server di LM Studio (default http://127.0.0.1:1234/v1)";
|
|
113
|
+
case "opensource":
|
|
114
|
+
return "collega l'endpoint /v1 di Unsloth, vLLM, llama.cpp o qualsiasi server OpenAI-compatible";
|
|
115
|
+
case "xai":
|
|
116
|
+
return "ottieni la chiave xAI per Grok su https://console.x.ai (XAI_API_KEY)";
|
|
117
|
+
default:
|
|
118
|
+
return spec.envKey ? `imposta la API key (variabile ${spec.envKey})` : "provider locale: nessuna chiave";
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
// Salva la API key di un provider sul file globale. Validazione di forma
|
|
122
|
+
// minima; la validazione di rete (per OpenRouter) la fa il chiamante.
|
|
123
|
+
export function saveProviderKey(env, providerId, apiKey) {
|
|
124
|
+
const key = apiKey.trim();
|
|
125
|
+
if (!key)
|
|
126
|
+
return { ok: false, error: "API key vuota" };
|
|
127
|
+
const ok = saveCredential(env, providerId, { apiKey: key });
|
|
128
|
+
return ok ? { ok: true } : { ok: false, error: "impossibile salvare (config globale disattivata?)" };
|
|
129
|
+
}
|
|
130
|
+
// Salva/aggiorna l'endpoint (baseUrl) di un provider. Una stringa vuota
|
|
131
|
+
// rimuove l'override e ripristina il default del catalogo.
|
|
132
|
+
export function saveProviderBaseUrl(env, providerId, baseUrl) {
|
|
133
|
+
const ok = saveCredential(env, providerId, { baseUrl: baseUrl.trim() });
|
|
134
|
+
return ok ? { ok: true } : { ok: false, error: "impossibile salvare l'endpoint" };
|
|
135
|
+
}
|
|
136
|
+
// Rimuove la credenziale salvata di un provider. Non tocca le env esportate
|
|
137
|
+
// dall'utente (quelle hanno precedenza e restano).
|
|
138
|
+
export function removeProvider(env, providerId) {
|
|
139
|
+
const ok = deleteCredential(env, providerId);
|
|
140
|
+
return ok ? { ok: true } : { ok: false, error: "impossibile rimuovere la credenziale" };
|
|
141
|
+
}
|
|
142
|
+
// Indica se la chiave di un provider e' stata salvata da noi (rimovibile dal
|
|
143
|
+
// menu) o proviene da una env esportata dall'utente (non rimovibile dal menu).
|
|
144
|
+
export function isRemovable(env, providerId) {
|
|
145
|
+
return Boolean(loadCredentials(env)[providerId]?.apiKey || loadCredentials(env)[providerId]?.baseUrl);
|
|
146
|
+
}
|
|
147
|
+
// Calcola le azioni disponibili per un provider, in base al suo stato. Niente
|
|
148
|
+
// scelte inutili: un locale non mostra "imposta chiave", un provider senza
|
|
149
|
+
// credenziale salvata non mostra "rimuovi".
|
|
150
|
+
export function actionsFor(env, row) {
|
|
151
|
+
const out = [];
|
|
152
|
+
if (row.needsKey) {
|
|
153
|
+
out.push({
|
|
154
|
+
action: "set-key",
|
|
155
|
+
label: row.source === "saved" || row.source === "env" ? "aggiorna API key" : "imposta API key",
|
|
156
|
+
detail: providerKeyHint(row.spec),
|
|
157
|
+
});
|
|
158
|
+
if (row.id === "openrouter") {
|
|
159
|
+
out.push({ action: "oauth", label: "accedi con OAuth (browser)", detail: "autorizza su openrouter.ai senza incollare la chiave" });
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
out.push({
|
|
163
|
+
action: "set-endpoint",
|
|
164
|
+
label: "imposta endpoint (baseUrl)",
|
|
165
|
+
detail: row.baseUrl ? `attuale: ${row.baseUrl}` : "endpoint API personalizzato",
|
|
166
|
+
});
|
|
167
|
+
if (row.configured) {
|
|
168
|
+
out.push({ action: "use-model", label: "scegli un modello di questo provider", detail: "apre il picker dei modelli" });
|
|
169
|
+
}
|
|
170
|
+
if (isRemovable(env, row.id)) {
|
|
171
|
+
out.push({ action: "remove", label: "rimuovi credenziale salvata", detail: "elimina chiave/endpoint dal config" });
|
|
172
|
+
}
|
|
173
|
+
out.push({ action: "back", label: "← torna all'elenco", detail: "" });
|
|
174
|
+
return out;
|
|
175
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { TuiTheme } from "./branding.js";
|
|
2
|
+
export declare function renderQuestion(question: string, theme: TuiTheme, columns: number): string;
|
|
3
|
+
export interface QuestionChoiceOptions {
|
|
4
|
+
readonly title: string;
|
|
5
|
+
readonly options: readonly {
|
|
6
|
+
label: string;
|
|
7
|
+
detail: string;
|
|
8
|
+
}[];
|
|
9
|
+
readonly index: number;
|
|
10
|
+
readonly offset: number;
|
|
11
|
+
readonly columns: number;
|
|
12
|
+
readonly rows: number;
|
|
13
|
+
readonly theme: TuiTheme;
|
|
14
|
+
}
|
|
15
|
+
export declare function renderQuestionChoices(opts: QuestionChoiceOptions): {
|
|
16
|
+
lines: string[];
|
|
17
|
+
ranges: {
|
|
18
|
+
start: number;
|
|
19
|
+
end: number;
|
|
20
|
+
}[];
|
|
21
|
+
offset: number;
|
|
22
|
+
maxOffset: number;
|
|
23
|
+
pageSize: number;
|
|
24
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { fitLine, wrapText } from "./terminal-text.js";
|
|
2
|
+
export function renderQuestion(question, theme, columns) {
|
|
3
|
+
return "\n" + wrapText(question, Math.max(2, columns - 5), true).map((line, index) => (index === 0 ? theme.accent(" ? ") : " ") + theme.silver(line)).join("\n") + "\n";
|
|
4
|
+
}
|
|
5
|
+
// The question and choices share a scrollable body. A long title must never
|
|
6
|
+
// push the choices or navigation beyond the visible terminal area.
|
|
7
|
+
export function renderQuestionChoices(opts) {
|
|
8
|
+
const t = opts.theme;
|
|
9
|
+
const width = Math.max(4, opts.columns - 2);
|
|
10
|
+
const body = wrapText(opts.title, width - 2, true).map(line => " " + t.bold(line));
|
|
11
|
+
body.push("");
|
|
12
|
+
const ranges = opts.options.map((option, index) => {
|
|
13
|
+
const start = body.length;
|
|
14
|
+
const text = option.label + (option.detail ? ` · ${option.detail}` : "");
|
|
15
|
+
const rows = wrapText(text, width - 4, true);
|
|
16
|
+
for (const [part, line] of rows.entries()) {
|
|
17
|
+
const prefix = part ? " " : `${index === opts.index ? "›" : " "} ${index + 1} `;
|
|
18
|
+
body.push(index === opts.index ? t.selected(prefix + line) : t.silver(prefix + line));
|
|
19
|
+
}
|
|
20
|
+
return { start, end: body.length };
|
|
21
|
+
});
|
|
22
|
+
const shortcuts = width >= 58 ? "↑↓ scegli · PgUp/PgDn scorri · Invio conferma · Esc annulla"
|
|
23
|
+
: "↑↓ scegli · PgUp/PgDn scorri · Invio · Esc";
|
|
24
|
+
const footer = wrapText(shortcuts, width, true).map(t.muted);
|
|
25
|
+
const pageSize = Math.max(1, opts.rows - footer.length - 1);
|
|
26
|
+
const maxOffset = Math.max(0, body.length - pageSize);
|
|
27
|
+
const offset = Math.max(0, Math.min(opts.offset, maxOffset));
|
|
28
|
+
const heading = t.bold("Domanda") + (maxOffset ? t.dim(` · ${offset + 1}–${Math.min(body.length, offset + pageSize)}/${body.length}`) : "");
|
|
29
|
+
const lines = [heading, ...body.slice(offset, offset + pageSize), ...footer]
|
|
30
|
+
.map(line => " " + fitLine(line, width));
|
|
31
|
+
return { lines, ranges, offset, maxOffset, pageSize };
|
|
32
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { PromptQueue, type QueuedPrompt } from "./prompt-queue.js";
|
|
2
|
+
import type { ScreenKey, TerminalScreen } from "./terminal-screen.js";
|
|
3
|
+
export interface QueueStyle {
|
|
4
|
+
readonly heading: (s: string) => string;
|
|
5
|
+
readonly muted: (s: string) => string;
|
|
6
|
+
readonly selected: (s: string) => string;
|
|
7
|
+
readonly text?: (s: string) => string;
|
|
8
|
+
}
|
|
9
|
+
export declare const PLAIN_QUEUE_STYLE: QueueStyle;
|
|
10
|
+
export declare const deliveryLabel: (entry: QueuedPrompt) => string;
|
|
11
|
+
export declare function queuePreview(queue: PromptQueue, width: number, style?: QueueStyle, idle?: boolean): readonly string[];
|
|
12
|
+
export declare class QueueScreen implements TerminalScreen {
|
|
13
|
+
private readonly queue;
|
|
14
|
+
private readonly edit;
|
|
15
|
+
private readonly style;
|
|
16
|
+
private selectedId?;
|
|
17
|
+
private notice;
|
|
18
|
+
private detailOffset;
|
|
19
|
+
private detailPage;
|
|
20
|
+
constructor(queue: PromptQueue, edit: (id: string) => void, style?: QueueStyle);
|
|
21
|
+
private selected;
|
|
22
|
+
render(width: number, height: number): readonly string[];
|
|
23
|
+
key(text: string, key: ScreenKey): "close" | void;
|
|
24
|
+
scroll(delta: number): void;
|
|
25
|
+
}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { PromptQueue } from "./prompt-queue.js";
|
|
2
|
+
import { tr } from "./i18n.js";
|
|
3
|
+
import { fitLine, oneLine, terminalWidth, wrapText } from "./terminal-text.js";
|
|
4
|
+
export const PLAIN_QUEUE_STYLE = { heading: s => s, muted: s => s, selected: s => s };
|
|
5
|
+
export const deliveryLabel = (entry) => (entry.teamBatchId ? tr("al team · ", "to team · ") : "")
|
|
6
|
+
+ (entry.delivery === "immediate" ? tr("invio immediato · attendo operazione", "send now · waiting for operation")
|
|
7
|
+
: entry.delivery === "during-turn" ? tr("durante il lavoro", "during work") : tr("dopo la risposta", "after response"));
|
|
8
|
+
export function queuePreview(queue, width, style = PLAIN_QUEUE_STYLE, idle = false) {
|
|
9
|
+
if (!queue.length)
|
|
10
|
+
return queue.storageError ? [fitLine(` ${queue.storageError}`, width - 1)] : [];
|
|
11
|
+
const next = queue.items().find(entry => entry.delivery === "immediate")
|
|
12
|
+
?? (!idle && !queue.paused ? queue.items().find(entry => entry.delivery === "during-turn") : undefined)
|
|
13
|
+
?? queue.items()[0];
|
|
14
|
+
const immediate = next.delivery === "immediate";
|
|
15
|
+
const paused = queue.paused && !immediate;
|
|
16
|
+
const mode = immediate ? next.teamBatchId ? tr("in invio al team", "sending to team") : tr("in invio", "sending")
|
|
17
|
+
: paused ? tr("in pausa", "paused") : next.delivery === "during-turn" ? tr("dopo la risposta o l'operazione", "after response or operation") : tr("dopo la risposta", "after response");
|
|
18
|
+
const noun = queue.length === 1 ? tr("Messaggio", "Message") : `${queue.length} ${tr("messaggi", "messages")}`;
|
|
19
|
+
const full = `${noun} ${mode}`;
|
|
20
|
+
const shortMode = immediate ? next.teamBatchId ? tr("invio al team", "to team") : tr("invio", "sending") : paused ? tr("pausa", "paused")
|
|
21
|
+
: next.delivery === "during-turn" ? tr("dopo risposta/operazione", "after response/tool") : tr("dopo risposta", "after response");
|
|
22
|
+
const short = queue.length === 1 ? `${noun} · ${shortMode}` : `${queue.length} · ${shortMode}`;
|
|
23
|
+
const keys = [paused && idle ? tr("Invio riprende", "Enter resume") : !immediate && !next.text.trimStart().startsWith("/") ? tr("Alt+S subito", "Alt+S send now") : "",
|
|
24
|
+
"Alt+Q", queue.teamRequestCount >= 3 ? "Alt+T team" : ""].filter(Boolean);
|
|
25
|
+
const max = Math.max(0, width - 1);
|
|
26
|
+
let hint = ` (${keys.join(" · ")})`;
|
|
27
|
+
const label = terminalWidth(` • ${full}${hint}`) <= max ? full : short;
|
|
28
|
+
while (keys.length > 1 && terminalWidth(` • ${label}${hint}`) > max) {
|
|
29
|
+
keys.splice(keys.findIndex(key => key !== "Alt+Q"), 1);
|
|
30
|
+
hint = ` (${keys.join(" · ")})`;
|
|
31
|
+
}
|
|
32
|
+
const title = fitLine(` • ${label}`, max - terminalWidth(hint));
|
|
33
|
+
const rows = [(style.text ?? style.muted)(title) + style.muted(hint),
|
|
34
|
+
style.muted(fitLine(` ↳ ${oneLine(next.text)}`, max))];
|
|
35
|
+
if (queue.storageError)
|
|
36
|
+
rows.push(queue.storageError);
|
|
37
|
+
return rows.map(row => fitLine(row, width - 1));
|
|
38
|
+
}
|
|
39
|
+
export class QueueScreen {
|
|
40
|
+
queue;
|
|
41
|
+
edit;
|
|
42
|
+
style;
|
|
43
|
+
selectedId;
|
|
44
|
+
notice = "";
|
|
45
|
+
detailOffset = 0;
|
|
46
|
+
detailPage = 3;
|
|
47
|
+
constructor(queue, edit, style = PLAIN_QUEUE_STYLE) {
|
|
48
|
+
this.queue = queue;
|
|
49
|
+
this.edit = edit;
|
|
50
|
+
this.style = style;
|
|
51
|
+
}
|
|
52
|
+
selected() {
|
|
53
|
+
const entry = (this.selectedId && this.queue.get(this.selectedId)) || this.queue.items()[0];
|
|
54
|
+
this.selectedId = entry?.id;
|
|
55
|
+
return entry;
|
|
56
|
+
}
|
|
57
|
+
render(width, height) {
|
|
58
|
+
const w = Math.max(1, width - 2), h = Math.max(1, height);
|
|
59
|
+
const t = this.style;
|
|
60
|
+
const selected = this.selected();
|
|
61
|
+
const items = this.queue.items();
|
|
62
|
+
const head = [t.heading(`${tr("Messaggi in coda", "Queued messages")} · ${items.length}${this.queue.paused ? tr(" · pausa", " · paused") : ""}`),
|
|
63
|
+
t.muted(tr("La consegna resta sospesa finché questa schermata è aperta.", "Delivery is paused while this screen is open."))];
|
|
64
|
+
const help = [tr("↑↓ scegli · Invio modifica · Canc elimina · Shift+↑↓ riordina", "↑↓ select · Enter edit · Del remove · Shift+↑↓ reorder"),
|
|
65
|
+
tr("s Invia subito · t cambia momento · p pausa/riprendi · Esc chat", "s Send now · t timing · p pause/resume · Esc chat")];
|
|
66
|
+
if (this.queue.teamRequestCount >= 3)
|
|
67
|
+
help.push(tr("g / Alt+T · Invia al team le {count} richieste", "g / Alt+T · Send {count} requests to team", { count: this.queue.teamRequestCount }));
|
|
68
|
+
const body = [];
|
|
69
|
+
if (!selected)
|
|
70
|
+
body.push(tr("Nessun messaggio in attesa.", "No queued messages."));
|
|
71
|
+
else {
|
|
72
|
+
const index = items.indexOf(selected);
|
|
73
|
+
const cap = Math.max(1, Math.min(6, Math.floor((h - 9) / 2)));
|
|
74
|
+
const start = Math.max(0, Math.min(index - Math.floor(cap / 2), items.length - cap));
|
|
75
|
+
for (const [offset, entry] of items.slice(start, start + cap).entries()) {
|
|
76
|
+
const label = fitLine(`${entry.id === selected.id ? "›" : " "} ${start + offset + 1}. ${oneLine(entry.text)}`, w);
|
|
77
|
+
body.push(entry.id === selected.id ? t.selected(label) : label);
|
|
78
|
+
body.push(t.muted(` ${deliveryLabel(entry)}`));
|
|
79
|
+
}
|
|
80
|
+
const detail = wrapText(selected.text, w, true);
|
|
81
|
+
this.detailPage = Math.max(1, h - head.length - help.length - body.length - 4);
|
|
82
|
+
this.detailOffset = Math.max(0, Math.min(this.detailOffset, detail.length - this.detailPage));
|
|
83
|
+
body.push("", t.heading(`${tr("Testo", "Text")} · ${this.detailOffset + 1}–${Math.min(detail.length, this.detailOffset + this.detailPage)}/${detail.length} · ${tr("PgSu/PgGiù scorri", "PgUp/PgDn scroll")}`));
|
|
84
|
+
body.push(...detail.slice(this.detailOffset, this.detailOffset + this.detailPage));
|
|
85
|
+
}
|
|
86
|
+
const note = this.notice || this.queue.storageError || (selected?.delivery === "immediate"
|
|
87
|
+
? tr("Invia subito interrompe la risposta; un'operazione già avviata termina prima.", "Send now interrupts the response; a running operation finishes first.")
|
|
88
|
+
: selected?.delivery === "during-turn"
|
|
89
|
+
? tr("Durante il lavoro: dopo la risposta o l'operazione corrente.", "During work: after the current response or operation.")
|
|
90
|
+
: tr("Dopo la risposta: un nuovo turno, in ordine di coda.", "After response: a new turn, in queue order."));
|
|
91
|
+
const footer = [t.muted(note), ...help.map(t.muted)];
|
|
92
|
+
const room = Math.max(0, h - head.length - footer.length - 1);
|
|
93
|
+
const rows = [...head, "", ...body.slice(0, room)];
|
|
94
|
+
while (rows.length < h - footer.length)
|
|
95
|
+
rows.push("");
|
|
96
|
+
return [...rows, ...footer].slice(0, h).map(row => " " + fitLine(row, w));
|
|
97
|
+
}
|
|
98
|
+
key(text, key) {
|
|
99
|
+
if (key.name === "escape" || (key.ctrl && key.name === "c") || (key.meta && key.name === "q"))
|
|
100
|
+
return "close";
|
|
101
|
+
this.notice = "";
|
|
102
|
+
if (text === "g" || (key.meta && key.name === "t")) {
|
|
103
|
+
if (this.queue.sendToTeam())
|
|
104
|
+
return "close";
|
|
105
|
+
this.notice = tr("Invia al team richiede almeno 3 richieste in coda; i comandi sono esclusi.", "Send to team requires at least 3 queued requests, excluding commands.");
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
const entry = this.selected();
|
|
109
|
+
if (text === "p") {
|
|
110
|
+
this.queue.paused = !this.queue.paused;
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
if (!entry)
|
|
114
|
+
return;
|
|
115
|
+
if (key.name === "pageup" || key.name === "pagedown") {
|
|
116
|
+
this.detailOffset = Math.max(0, this.detailOffset + (key.name === "pageup" ? -this.detailPage : this.detailPage));
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
if (key.name === "up" || key.name === "down") {
|
|
120
|
+
const offset = key.name === "up" ? -1 : 1;
|
|
121
|
+
if (key.shift)
|
|
122
|
+
this.queue.move(entry.id, offset);
|
|
123
|
+
else
|
|
124
|
+
this.scroll(offset);
|
|
125
|
+
}
|
|
126
|
+
else if ((key.name === "return" && key.meta) || text === "s") {
|
|
127
|
+
if (this.queue.sendNow(entry.id))
|
|
128
|
+
return "close";
|
|
129
|
+
this.notice = tr("I comandi vengono eseguiti dopo la risposta.", "Commands run after the response.");
|
|
130
|
+
}
|
|
131
|
+
else if (key.name === "return" || text === "e")
|
|
132
|
+
this.edit(entry.id);
|
|
133
|
+
else if (key.name === "delete" || text === "d") {
|
|
134
|
+
const index = this.queue.items().indexOf(entry);
|
|
135
|
+
this.queue.remove(entry.id);
|
|
136
|
+
this.selectedId = this.queue.items()[Math.min(index, this.queue.length - 1)]?.id;
|
|
137
|
+
}
|
|
138
|
+
else if (text === "t") {
|
|
139
|
+
if (!this.queue.setDelivery(entry.id, entry.delivery === "after-turn" ? "during-turn" : "after-turn")) {
|
|
140
|
+
this.notice = tr("I comandi vengono eseguiti dopo la risposta.", "Commands run after the response.");
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
scroll(delta) {
|
|
145
|
+
const items = this.queue.items();
|
|
146
|
+
const selected = this.selected();
|
|
147
|
+
if (!selected)
|
|
148
|
+
return;
|
|
149
|
+
this.selectedId = items[Math.max(0, Math.min(items.length - 1, items.indexOf(selected) + delta))]?.id;
|
|
150
|
+
this.detailOffset = 0;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// Le richieste restano separate e modificabili nella coda. Il messaggio unico
|
|
2
|
+
// viene costruito soltanto alla consegna, usando testo espanso e allegati salvati.
|
|
3
|
+
export function teamPrompt(entries) {
|
|
4
|
+
const first = entries[0];
|
|
5
|
+
const heading = `Ingaggia il team e implementa tutte le ${entries.length} richieste in coda.`;
|
|
6
|
+
const parts = [{ type: "text", text: heading + "\n"
|
|
7
|
+
+ "Organizza i collaboratori con team_engage, oppure assegna questi incarichi al team già attivo con team_say. "
|
|
8
|
+
+ "Distribuisci le attività indipendenti in parallelo, includendo il testo completo e gli allegati pertinenti. "
|
|
9
|
+
+ "Rispetta l'ordine quando ci sono dipendenze e coordina le modifiche agli stessi file. "
|
|
10
|
+
+ "Porta avanti anche il lavoro già in corso. Segui ogni richiesta fino all'implementazione, "
|
|
11
|
+
+ "raccogli i risultati, integrali e verifica il risultato complessivo. "
|
|
12
|
+
+ "Nella risposta finale rendi conto di tutte le richieste e di eventuali blocchi concreti." }];
|
|
13
|
+
for (const [index, entry] of entries.entries()) {
|
|
14
|
+
parts.push({ type: "text", text: `\nRichiesta ${index + 1} di ${entries.length}` }, ...entry.parts);
|
|
15
|
+
}
|
|
16
|
+
return { ...first, parts, text: [heading, ...entries.map((entry, index) => `Richiesta ${index + 1} di ${entries.length}\n${entry.text}`)].join("\n\n") };
|
|
17
|
+
}
|
|
18
|
+
export function groupTeamPrompts(entries) {
|
|
19
|
+
const seen = new Set();
|
|
20
|
+
return entries.flatMap(entry => {
|
|
21
|
+
if (!entry.teamBatchId)
|
|
22
|
+
return [entry];
|
|
23
|
+
if (seen.has(entry.teamBatchId))
|
|
24
|
+
return [];
|
|
25
|
+
seen.add(entry.teamBatchId);
|
|
26
|
+
return [teamPrompt(entries.filter(item => item.teamBatchId === entry.teamBatchId))];
|
|
27
|
+
});
|
|
28
|
+
}
|