@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,74 @@
|
|
|
1
|
+
import { appendFileSync, existsSync, lstatSync, mkdirSync, readFileSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { randomUUID } from "node:crypto";
|
|
4
|
+
import { validateSessionId } from "./session.js";
|
|
5
|
+
function usagePath(base, sessionId, create = false) {
|
|
6
|
+
const id = validateSessionId(sessionId);
|
|
7
|
+
const directory = join(base, "usage");
|
|
8
|
+
if (create)
|
|
9
|
+
mkdirSync(directory, { recursive: true });
|
|
10
|
+
if (existsSync(directory) && lstatSync(directory).isSymbolicLink())
|
|
11
|
+
throw new Error("Usage directory is a link");
|
|
12
|
+
const file = join(directory, `${id}.jsonl`);
|
|
13
|
+
if (existsSync(file) && lstatSync(file).isSymbolicLink())
|
|
14
|
+
throw new Error("Usage file is a link");
|
|
15
|
+
return file;
|
|
16
|
+
}
|
|
17
|
+
// Metadati separati dalla cronologia: checkout e compattazione non riducono il consumo.
|
|
18
|
+
export function saveSessionUsage(base, sessionId, record) {
|
|
19
|
+
try {
|
|
20
|
+
appendFileSync(usagePath(base, sessionId, true), JSON.stringify(record) + "\n", { encoding: "utf8", mode: 0o600 });
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export function readSessionUsage(base, sessionId) {
|
|
28
|
+
const records = new Map();
|
|
29
|
+
let incomplete = false;
|
|
30
|
+
try {
|
|
31
|
+
const file = usagePath(base, sessionId);
|
|
32
|
+
if (!existsSync(file))
|
|
33
|
+
return { records: [], incomplete: false };
|
|
34
|
+
for (const line of readFileSync(file, "utf8").split("\n")) {
|
|
35
|
+
if (!line.trim())
|
|
36
|
+
continue;
|
|
37
|
+
try {
|
|
38
|
+
const r = JSON.parse(line);
|
|
39
|
+
if (typeof r.id !== "string" || typeof r.model !== "string" || typeof r.providerId !== "string" ||
|
|
40
|
+
typeof r.sessionId !== "string" || !Number.isFinite(r.at))
|
|
41
|
+
throw new Error("Invalid usage entry");
|
|
42
|
+
if (r.usage && ![r.usage.inputTokens, r.usage.outputTokens, r.usage.cacheReadTokens ?? 0,
|
|
43
|
+
r.usage.cacheWriteTokens ?? 0].every(n => typeof n === "number" && Number.isFinite(n) && n >= 0))
|
|
44
|
+
throw new Error("Invalid token count");
|
|
45
|
+
records.set(r.id, r);
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
incomplete = true;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
incomplete = true;
|
|
54
|
+
}
|
|
55
|
+
return { records: [...records.values()], incomplete };
|
|
56
|
+
}
|
|
57
|
+
// Include anche le chiamate di compattazione effettuate con questo provider.
|
|
58
|
+
const trackedProviders = new WeakMap();
|
|
59
|
+
export function trackSessionUsage(provider, base, sessionId, sink) {
|
|
60
|
+
const scope = `${base}\n${sessionId}`;
|
|
61
|
+
if (trackedProviders.get(provider) === scope)
|
|
62
|
+
return provider;
|
|
63
|
+
const tracked = { ...provider, id: provider.id, models: provider.models, supportsFastMode: provider.supportsFastMode, complete: async (request) => {
|
|
64
|
+
const result = await provider.complete(request);
|
|
65
|
+
const record = { id: randomUUID(), sessionId, providerId: provider.id,
|
|
66
|
+
model: request.model.startsWith(`${provider.id}/`) ? request.model : `${provider.id}/${request.model}`,
|
|
67
|
+
at: Date.now(), ...(result.usage ? { usage: result.usage } : {}), ...(result.limits ? { limits: result.limits } : {}) };
|
|
68
|
+
const persisted = saveSessionUsage(base, sessionId, record);
|
|
69
|
+
sink({ type: "usage", record, persisted });
|
|
70
|
+
return result;
|
|
71
|
+
} };
|
|
72
|
+
trackedProviders.set(tracked, scope);
|
|
73
|
+
return tracked;
|
|
74
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { Message } from "./types.js";
|
|
2
|
+
export declare const SESSION_ID_MAX_LENGTH = 200;
|
|
3
|
+
export declare class SessionIdError extends Error {
|
|
4
|
+
constructor(id: string, reason: string);
|
|
5
|
+
}
|
|
6
|
+
export declare function validateSessionId(id: string): string;
|
|
7
|
+
export declare function sessionFilePath(baseDir: string, id: string): string;
|
|
8
|
+
export interface SessionSummary {
|
|
9
|
+
readonly id: string;
|
|
10
|
+
readonly name: string | null;
|
|
11
|
+
readonly updatedAt: number;
|
|
12
|
+
readonly messages: number;
|
|
13
|
+
readonly preview: string;
|
|
14
|
+
}
|
|
15
|
+
export declare function listSessions(baseDir: string): SessionSummary[];
|
|
16
|
+
export interface SessionNode {
|
|
17
|
+
readonly id: string;
|
|
18
|
+
readonly parentId: string | null;
|
|
19
|
+
readonly message: Message;
|
|
20
|
+
readonly ts: number;
|
|
21
|
+
}
|
|
22
|
+
export interface CompactionEntry {
|
|
23
|
+
readonly type: "compaction";
|
|
24
|
+
readonly summary: string;
|
|
25
|
+
readonly firstKeptId: string;
|
|
26
|
+
readonly tokensBefore: number;
|
|
27
|
+
readonly ts: number;
|
|
28
|
+
}
|
|
29
|
+
export interface MetaEntry {
|
|
30
|
+
readonly type: "meta";
|
|
31
|
+
readonly name: string;
|
|
32
|
+
readonly ts: number;
|
|
33
|
+
}
|
|
34
|
+
export type SessionEntry = SessionNode | CompactionEntry | MetaEntry;
|
|
35
|
+
export declare class Session {
|
|
36
|
+
readonly id: string;
|
|
37
|
+
private readonly file;
|
|
38
|
+
private readonly nodes;
|
|
39
|
+
private headId;
|
|
40
|
+
private compaction;
|
|
41
|
+
private nameValue;
|
|
42
|
+
private historyCache;
|
|
43
|
+
private constructor();
|
|
44
|
+
static create(baseDir: string, id?: string): Session;
|
|
45
|
+
static load(baseDir: string, id: string): Session;
|
|
46
|
+
get head(): string | null;
|
|
47
|
+
get name(): string | null;
|
|
48
|
+
setName(name: string): void;
|
|
49
|
+
append(message: Message): SessionNode;
|
|
50
|
+
checkout(id: string): boolean;
|
|
51
|
+
nodeChain(): readonly SessionNode[];
|
|
52
|
+
history(): readonly Message[];
|
|
53
|
+
compact(summary: string, firstKeptId: string, tokensBefore: number): void;
|
|
54
|
+
get lastCompaction(): CompactionEntry | null;
|
|
55
|
+
commonAncestor(aId: string, bId: string): string | null;
|
|
56
|
+
branchMessages(leafId: string, ancestorId: string | null): readonly Message[];
|
|
57
|
+
tree(): readonly SessionNode[];
|
|
58
|
+
}
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
import { appendFileSync, existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, realpathSync, } from "node:fs";
|
|
2
|
+
import { dirname, isAbsolute, relative, resolve, sep, posix, win32 } from "node:path";
|
|
3
|
+
import { sessionTitle } from "./session-title.js";
|
|
4
|
+
// Gli id Talos diventano nomi di file. La validazione e la risoluzione vivono
|
|
5
|
+
// qui, nel confine dello store, cosi' CLI, TUI, backend ed SDK non possono
|
|
6
|
+
// aggirarle chiamando Session direttamente.
|
|
7
|
+
export const SESSION_ID_MAX_LENGTH = 200;
|
|
8
|
+
export class SessionIdError extends Error {
|
|
9
|
+
constructor(id, reason) {
|
|
10
|
+
super(`ID sessione non valido ${JSON.stringify(id)}: ${reason}`);
|
|
11
|
+
this.name = "SessionIdError";
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
// Mantiene tutti gli id prodotti da Talos (s-..., kw-..., rev-..., slug con
|
|
15
|
+
// lettere/numeri/._-) e anche nomi leggibili, ma rifiuta sintassi che su POSIX
|
|
16
|
+
// o Windows puo' cambiare directory, volume o stream del file.
|
|
17
|
+
export function validateSessionId(id) {
|
|
18
|
+
if (!id.length)
|
|
19
|
+
throw new SessionIdError(id, "l'ID non puo' essere vuoto");
|
|
20
|
+
if (id.length > SESSION_ID_MAX_LENGTH) {
|
|
21
|
+
throw new SessionIdError(id, `massimo ${SESSION_ID_MAX_LENGTH} caratteri`);
|
|
22
|
+
}
|
|
23
|
+
if (id !== id.trim())
|
|
24
|
+
throw new SessionIdError(id, "niente spazi iniziali o finali");
|
|
25
|
+
if (id === "." || id === "..")
|
|
26
|
+
throw new SessionIdError(id, "'.' e '..' non sono ammessi");
|
|
27
|
+
if (id.includes("/") || id.includes("\\")) {
|
|
28
|
+
throw new SessionIdError(id, "i separatori di percorso '/' e '\\' non sono ammessi");
|
|
29
|
+
}
|
|
30
|
+
if (posix.isAbsolute(id) || win32.isAbsolute(id)) {
|
|
31
|
+
throw new SessionIdError(id, "i percorsi assoluti non sono ammessi");
|
|
32
|
+
}
|
|
33
|
+
if (/[:*?"<>|\u0000-\u001f\u007f]/u.test(id)) {
|
|
34
|
+
throw new SessionIdError(id, "contiene caratteri non validi per un nome file portabile");
|
|
35
|
+
}
|
|
36
|
+
if (/[. ]$/u.test(id)) {
|
|
37
|
+
throw new SessionIdError(id, "un ID non puo' terminare con punto o spazio");
|
|
38
|
+
}
|
|
39
|
+
// Windows interpreta questi nomi come device anche quando hanno estensioni.
|
|
40
|
+
const firstComponent = id.split(".", 1)[0].toUpperCase();
|
|
41
|
+
if (/^(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])$/u.test(firstComponent)) {
|
|
42
|
+
throw new SessionIdError(id, "nome riservato dal filesystem Windows");
|
|
43
|
+
}
|
|
44
|
+
return id;
|
|
45
|
+
}
|
|
46
|
+
function assertContained(baseDir, target, id) {
|
|
47
|
+
const rel = relative(baseDir, target);
|
|
48
|
+
if (rel === ".." || rel.startsWith(`..${sep}`) || isAbsolute(rel)) {
|
|
49
|
+
throw new SessionIdError(id, "il file risolto uscirebbe dalla directory delle sessioni");
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
// Risoluzione lessicale pubblica per chi deve conoscere il file di una
|
|
53
|
+
// sessione. Il risultato e' sempre un figlio diretto assoluto di baseDir.
|
|
54
|
+
export function sessionFilePath(baseDir, id) {
|
|
55
|
+
const sid = validateSessionId(id);
|
|
56
|
+
const base = resolve(baseDir);
|
|
57
|
+
const target = resolve(base, `${sid}.jsonl`);
|
|
58
|
+
assertContained(base, target, sid);
|
|
59
|
+
return target;
|
|
60
|
+
}
|
|
61
|
+
// Verifica anche il filesystem reale: un file sessione gia' esistente non puo'
|
|
62
|
+
// essere un symlink che reindirizza append/read fuori da sessionDir.
|
|
63
|
+
function prepareSessionFile(baseDir, id) {
|
|
64
|
+
const sid = validateSessionId(id);
|
|
65
|
+
const file = sessionFilePath(baseDir, sid);
|
|
66
|
+
mkdirSync(resolve(baseDir), { recursive: true });
|
|
67
|
+
const realBase = realpathSync(resolve(baseDir));
|
|
68
|
+
const realParent = realpathSync(dirname(file));
|
|
69
|
+
assertContained(realBase, realParent, sid);
|
|
70
|
+
if (existsSync(file)) {
|
|
71
|
+
if (lstatSync(file).isSymbolicLink()) {
|
|
72
|
+
throw new SessionIdError(sid, "il file sessione non puo' essere un collegamento simbolico");
|
|
73
|
+
}
|
|
74
|
+
assertContained(realBase, realpathSync(file), sid);
|
|
75
|
+
}
|
|
76
|
+
return { id: sid, file };
|
|
77
|
+
}
|
|
78
|
+
// Testo leggibile di un messaggio (concatena le parti testo).
|
|
79
|
+
function messageText(m) {
|
|
80
|
+
return m.content.filter((p) => p.type === "text").map((p) => p.text).join(" ").trim();
|
|
81
|
+
}
|
|
82
|
+
// Anteprima dell'obiettivo: primo messaggio utente, ripulito dai tag iniettati
|
|
83
|
+
// ([VASCEND...], [Riepilogo...]) cosi' il picker mostra il vero prompt.
|
|
84
|
+
function goalPreview(history) {
|
|
85
|
+
for (const m of history) {
|
|
86
|
+
if (m.role !== "user")
|
|
87
|
+
continue;
|
|
88
|
+
const title = sessionTitle(messageText(m));
|
|
89
|
+
if (title)
|
|
90
|
+
return title;
|
|
91
|
+
}
|
|
92
|
+
return "";
|
|
93
|
+
}
|
|
94
|
+
// Elenca le sessioni di baseDir, ordinate dalla piu' recente. Salta i file
|
|
95
|
+
// corrotti o vuoti. Usata da `/resume`, `/sessions` e dal flag `--continue`.
|
|
96
|
+
export function listSessions(baseDir) {
|
|
97
|
+
if (!existsSync(baseDir))
|
|
98
|
+
return [];
|
|
99
|
+
const out = [];
|
|
100
|
+
for (const f of readdirSync(baseDir)) {
|
|
101
|
+
if (!f.endsWith(".jsonl"))
|
|
102
|
+
continue;
|
|
103
|
+
const id = f.replace(/\.jsonl$/, "");
|
|
104
|
+
try {
|
|
105
|
+
const s = Session.load(baseDir, id);
|
|
106
|
+
const chain = s.nodeChain();
|
|
107
|
+
if (!chain.length)
|
|
108
|
+
continue;
|
|
109
|
+
out.push({
|
|
110
|
+
id,
|
|
111
|
+
name: s.name,
|
|
112
|
+
updatedAt: chain[chain.length - 1].ts,
|
|
113
|
+
messages: chain.length,
|
|
114
|
+
preview: goalPreview(chain.map(node => node.message)),
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
catch { /* file corrotto/illeggibile: salta */ }
|
|
118
|
+
}
|
|
119
|
+
return out.sort((a, b) => b.updatedAt - a.updatedAt);
|
|
120
|
+
}
|
|
121
|
+
let counter = 0;
|
|
122
|
+
function nodeId() {
|
|
123
|
+
counter += 1;
|
|
124
|
+
return `${Date.now().toString(36)}-${counter.toString(36)}`;
|
|
125
|
+
}
|
|
126
|
+
export class Session {
|
|
127
|
+
id;
|
|
128
|
+
file;
|
|
129
|
+
nodes = new Map();
|
|
130
|
+
headId = null;
|
|
131
|
+
compaction = null;
|
|
132
|
+
nameValue = null;
|
|
133
|
+
historyCache = null;
|
|
134
|
+
constructor(id, file) {
|
|
135
|
+
this.id = id;
|
|
136
|
+
this.file = file;
|
|
137
|
+
}
|
|
138
|
+
// Crea una nuova sessione persistita sotto baseDir/<id>.jsonl
|
|
139
|
+
static create(baseDir, id) {
|
|
140
|
+
const sid = id ?? `s-${Date.now().toString(36)}`;
|
|
141
|
+
const safe = prepareSessionFile(baseDir, sid);
|
|
142
|
+
return new Session(safe.id, safe.file);
|
|
143
|
+
}
|
|
144
|
+
// Carica una sessione esistente ricostruendo l'albero e l'eventuale
|
|
145
|
+
// compattazione (l'ultima entry vince).
|
|
146
|
+
static load(baseDir, id) {
|
|
147
|
+
// Garantisce la dir: con --session-id su un workspace nuovo il file non
|
|
148
|
+
// esiste ancora e il primo append fallirebbe con ENOENT.
|
|
149
|
+
const safe = prepareSessionFile(baseDir, id);
|
|
150
|
+
const s = new Session(safe.id, safe.file);
|
|
151
|
+
if (existsSync(s.file)) {
|
|
152
|
+
const raw = readFileSync(s.file, "utf8");
|
|
153
|
+
for (const line of raw.split("\n")) {
|
|
154
|
+
if (!line.trim())
|
|
155
|
+
continue;
|
|
156
|
+
const parsed = JSON.parse(line);
|
|
157
|
+
if (parsed.type === "compaction") {
|
|
158
|
+
s.compaction = parsed;
|
|
159
|
+
continue;
|
|
160
|
+
}
|
|
161
|
+
if (parsed.type === "meta") {
|
|
162
|
+
s.nameValue = parsed.name;
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
const node = parsed;
|
|
166
|
+
s.nodes.set(node.id, node);
|
|
167
|
+
s.headId = node.id;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return s;
|
|
171
|
+
}
|
|
172
|
+
get head() {
|
|
173
|
+
return this.headId;
|
|
174
|
+
}
|
|
175
|
+
get name() {
|
|
176
|
+
return this.nameValue;
|
|
177
|
+
}
|
|
178
|
+
// Nome leggibile della sessione, persistito come entry meta.
|
|
179
|
+
setName(name) {
|
|
180
|
+
const entry = { type: "meta", name, ts: Date.now() };
|
|
181
|
+
appendFileSync(this.file, JSON.stringify(entry) + "\n", "utf8");
|
|
182
|
+
this.nameValue = name;
|
|
183
|
+
}
|
|
184
|
+
// Aggiunge un messaggio come figlio della testa corrente.
|
|
185
|
+
append(message) {
|
|
186
|
+
const node = {
|
|
187
|
+
id: nodeId(),
|
|
188
|
+
parentId: this.headId,
|
|
189
|
+
message,
|
|
190
|
+
ts: Date.now(),
|
|
191
|
+
};
|
|
192
|
+
appendFileSync(this.file, JSON.stringify(node) + "\n", "utf8");
|
|
193
|
+
this.nodes.set(node.id, node);
|
|
194
|
+
this.headId = node.id;
|
|
195
|
+
this.historyCache = null;
|
|
196
|
+
return node;
|
|
197
|
+
}
|
|
198
|
+
// Sposta la testa su un nodo esistente: i prossimi append creano un branch.
|
|
199
|
+
checkout(id) {
|
|
200
|
+
if (!this.nodes.has(id))
|
|
201
|
+
return false;
|
|
202
|
+
this.headId = id;
|
|
203
|
+
this.historyCache = null;
|
|
204
|
+
return true;
|
|
205
|
+
}
|
|
206
|
+
// Catena di nodi dalla radice alla testa.
|
|
207
|
+
nodeChain() {
|
|
208
|
+
const chain = [];
|
|
209
|
+
let cur = this.headId;
|
|
210
|
+
while (cur) {
|
|
211
|
+
const node = this.nodes.get(cur);
|
|
212
|
+
if (!node)
|
|
213
|
+
break;
|
|
214
|
+
chain.push(node);
|
|
215
|
+
cur = node.parentId;
|
|
216
|
+
}
|
|
217
|
+
return chain.reverse();
|
|
218
|
+
}
|
|
219
|
+
// Ricostruisce la cronologia lineare, applicando la compattazione: il
|
|
220
|
+
// prefisso fino a firstKeptId viene sostituito dal riassunto.
|
|
221
|
+
history() {
|
|
222
|
+
if (this.historyCache)
|
|
223
|
+
return this.historyCache;
|
|
224
|
+
const messages = [];
|
|
225
|
+
let cur = this.headId;
|
|
226
|
+
while (cur) {
|
|
227
|
+
const node = this.nodes.get(cur);
|
|
228
|
+
if (!node)
|
|
229
|
+
break;
|
|
230
|
+
messages.push(node.message);
|
|
231
|
+
// Il prefisso archiviato non serve per proiettare la finestra viva.
|
|
232
|
+
// Un checkout su un altro ramo non incontra firstKeptId e resta integro.
|
|
233
|
+
if (node.id === this.compaction?.firstKeptId && node.parentId && this.nodes.has(node.parentId)) {
|
|
234
|
+
messages.push({
|
|
235
|
+
role: "user",
|
|
236
|
+
content: [{ type: "text", text: `[Riepilogo del contesto precedente]\n\n${this.compaction.summary}` }],
|
|
237
|
+
});
|
|
238
|
+
break;
|
|
239
|
+
}
|
|
240
|
+
cur = node.parentId;
|
|
241
|
+
}
|
|
242
|
+
this.historyCache = Object.freeze(messages.reverse());
|
|
243
|
+
return this.historyCache;
|
|
244
|
+
}
|
|
245
|
+
// Registra una compattazione: riassunto + primo nodo da mantenere.
|
|
246
|
+
compact(summary, firstKeptId, tokensBefore) {
|
|
247
|
+
const entry = {
|
|
248
|
+
type: "compaction",
|
|
249
|
+
summary,
|
|
250
|
+
firstKeptId,
|
|
251
|
+
tokensBefore,
|
|
252
|
+
ts: Date.now(),
|
|
253
|
+
};
|
|
254
|
+
appendFileSync(this.file, JSON.stringify(entry) + "\n", "utf8");
|
|
255
|
+
this.compaction = entry;
|
|
256
|
+
this.historyCache = null;
|
|
257
|
+
}
|
|
258
|
+
get lastCompaction() {
|
|
259
|
+
return this.compaction;
|
|
260
|
+
}
|
|
261
|
+
// Antenato comune tra due nodi: serve alla summarization di branch quando si
|
|
262
|
+
// naviga via /tree (si riassume cio' che si abbandona).
|
|
263
|
+
commonAncestor(aId, bId) {
|
|
264
|
+
const ancestors = new Set();
|
|
265
|
+
let cur = aId;
|
|
266
|
+
while (cur) {
|
|
267
|
+
ancestors.add(cur);
|
|
268
|
+
cur = this.nodes.get(cur)?.parentId ?? null;
|
|
269
|
+
}
|
|
270
|
+
cur = bId;
|
|
271
|
+
while (cur) {
|
|
272
|
+
if (ancestors.has(cur))
|
|
273
|
+
return cur;
|
|
274
|
+
cur = this.nodes.get(cur)?.parentId ?? null;
|
|
275
|
+
}
|
|
276
|
+
return null;
|
|
277
|
+
}
|
|
278
|
+
// Messaggi sul percorso da `leafId` (incluso) risalendo fino a `ancestorId`
|
|
279
|
+
// (escluso): il ramo che viene abbandonato.
|
|
280
|
+
branchMessages(leafId, ancestorId) {
|
|
281
|
+
const out = [];
|
|
282
|
+
let cur = leafId;
|
|
283
|
+
while (cur && cur !== ancestorId) {
|
|
284
|
+
const node = this.nodes.get(cur);
|
|
285
|
+
if (!node)
|
|
286
|
+
break;
|
|
287
|
+
out.push(node.message);
|
|
288
|
+
cur = node.parentId;
|
|
289
|
+
}
|
|
290
|
+
return out.reverse();
|
|
291
|
+
}
|
|
292
|
+
// Vista ad albero per il comando /tree.
|
|
293
|
+
tree() {
|
|
294
|
+
return [...this.nodes.values()].sort((a, b) => a.ts - b.ts);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface PersistableProvider {
|
|
2
|
+
readonly apiKey?: string;
|
|
3
|
+
readonly baseUrl?: string;
|
|
4
|
+
}
|
|
5
|
+
export interface PersistableSettings {
|
|
6
|
+
readonly model?: string;
|
|
7
|
+
readonly ui?: {
|
|
8
|
+
readonly theme?: string;
|
|
9
|
+
};
|
|
10
|
+
readonly effort?: string;
|
|
11
|
+
readonly fast?: boolean;
|
|
12
|
+
readonly permMode?: string;
|
|
13
|
+
readonly vibeMode?: string;
|
|
14
|
+
readonly providers?: Readonly<Record<string, PersistableProvider>>;
|
|
15
|
+
}
|
|
16
|
+
export declare function globalSettingsPath(env: NodeJS.ProcessEnv): string | null;
|
|
17
|
+
export declare function saveGlobalSettings(env: NodeJS.ProcessEnv, patch: PersistableSettings): boolean;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
3
|
+
import { talosConfigDir } from "./env-paths.js";
|
|
4
|
+
// Posizione del file globale. null se la config globale e' disattivata.
|
|
5
|
+
export function globalSettingsPath(env) {
|
|
6
|
+
if (env["TALOS_NO_GLOBAL_CONFIG"] === "1")
|
|
7
|
+
return null;
|
|
8
|
+
return join(talosConfigDir(env), "config.json");
|
|
9
|
+
}
|
|
10
|
+
function readJson(path) {
|
|
11
|
+
if (!existsSync(path))
|
|
12
|
+
return {};
|
|
13
|
+
try {
|
|
14
|
+
const raw = JSON.parse(readFileSync(path, "utf8"));
|
|
15
|
+
return raw && typeof raw === "object" && !Array.isArray(raw) ? raw : {};
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return {};
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function isRecord(value) {
|
|
22
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
23
|
+
}
|
|
24
|
+
// Fonde le credenziali provider del patch nel blocco "providers" esistente,
|
|
25
|
+
// preservando i provider non toccati e i campi non sovrascritti. Un campo a
|
|
26
|
+
// stringa vuota cancella quel campo; una credenziale senza campi viene rimossa.
|
|
27
|
+
function mergeProviders(current, patch) {
|
|
28
|
+
const base = {};
|
|
29
|
+
if (isRecord(current)) {
|
|
30
|
+
for (const [id, value] of Object.entries(current)) {
|
|
31
|
+
if (isRecord(value)) {
|
|
32
|
+
const cred = {};
|
|
33
|
+
if (typeof value["apiKey"] === "string")
|
|
34
|
+
cred.apiKey = value["apiKey"];
|
|
35
|
+
if (typeof value["baseUrl"] === "string")
|
|
36
|
+
cred.baseUrl = value["baseUrl"];
|
|
37
|
+
if (cred.apiKey !== undefined || cred.baseUrl !== undefined)
|
|
38
|
+
base[id] = cred;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
for (const [id, cred] of Object.entries(patch)) {
|
|
43
|
+
const next = { ...base[id] };
|
|
44
|
+
if (cred.apiKey !== undefined) {
|
|
45
|
+
if (cred.apiKey.trim())
|
|
46
|
+
next.apiKey = cred.apiKey.trim();
|
|
47
|
+
else
|
|
48
|
+
delete next.apiKey;
|
|
49
|
+
}
|
|
50
|
+
if (cred.baseUrl !== undefined) {
|
|
51
|
+
if (cred.baseUrl.trim())
|
|
52
|
+
next.baseUrl = cred.baseUrl.trim();
|
|
53
|
+
else
|
|
54
|
+
delete next.baseUrl;
|
|
55
|
+
}
|
|
56
|
+
if (next.apiKey === undefined && next.baseUrl === undefined)
|
|
57
|
+
delete base[id];
|
|
58
|
+
else
|
|
59
|
+
base[id] = next;
|
|
60
|
+
}
|
|
61
|
+
return base;
|
|
62
|
+
}
|
|
63
|
+
// Merge immutabile del patch sul contenuto esistente, preservando le altre
|
|
64
|
+
// chiavi (e fondendo ui.* / providers.* senza azzerare il resto).
|
|
65
|
+
function mergeSettings(current, patch) {
|
|
66
|
+
const next = { ...current };
|
|
67
|
+
if (patch.model !== undefined)
|
|
68
|
+
next["model"] = patch.model;
|
|
69
|
+
if (patch.effort !== undefined)
|
|
70
|
+
next["effort"] = patch.effort;
|
|
71
|
+
if (patch.fast !== undefined)
|
|
72
|
+
next["fast"] = patch.fast;
|
|
73
|
+
if (patch.permMode !== undefined)
|
|
74
|
+
next["permMode"] = patch.permMode;
|
|
75
|
+
if (patch.vibeMode !== undefined)
|
|
76
|
+
next["vibeMode"] = patch.vibeMode;
|
|
77
|
+
if (patch.ui) {
|
|
78
|
+
const baseUi = current["ui"] && typeof current["ui"] === "object" && !Array.isArray(current["ui"])
|
|
79
|
+
? current["ui"]
|
|
80
|
+
: {};
|
|
81
|
+
next["ui"] = { ...baseUi, ...patch.ui };
|
|
82
|
+
}
|
|
83
|
+
if (patch.providers) {
|
|
84
|
+
const merged = mergeProviders(current["providers"], patch.providers);
|
|
85
|
+
if (Object.keys(merged).length > 0)
|
|
86
|
+
next["providers"] = merged;
|
|
87
|
+
else
|
|
88
|
+
delete next["providers"];
|
|
89
|
+
}
|
|
90
|
+
return next;
|
|
91
|
+
}
|
|
92
|
+
// Legge-modifica-scrive il file globale. Best effort: un errore di scrittura
|
|
93
|
+
// (permessi, disco) non deve mai interrompere la sessione interattiva.
|
|
94
|
+
export function saveGlobalSettings(env, patch) {
|
|
95
|
+
const path = globalSettingsPath(env);
|
|
96
|
+
if (!path)
|
|
97
|
+
return false;
|
|
98
|
+
try {
|
|
99
|
+
const merged = mergeSettings(readJson(path), patch);
|
|
100
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
101
|
+
writeFileSync(path, JSON.stringify(merged, null, 2) + "\n", "utf8");
|
|
102
|
+
return true;
|
|
103
|
+
}
|
|
104
|
+
catch {
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface RetentionPolicy {
|
|
2
|
+
readonly days: number;
|
|
3
|
+
readonly maxBytes: number;
|
|
4
|
+
}
|
|
5
|
+
export interface RetentionReport {
|
|
6
|
+
readonly beforeBytes: number;
|
|
7
|
+
readonly afterBytes: number;
|
|
8
|
+
readonly removedGroups: number;
|
|
9
|
+
readonly removedFiles: number;
|
|
10
|
+
readonly protectedBytes: number;
|
|
11
|
+
readonly overBudget: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare function storageRetentionPolicy(env: NodeJS.ProcessEnv): RetentionPolicy;
|
|
14
|
+
export declare function cleanSessionStorage(env: NodeJS.ProcessEnv, options?: {
|
|
15
|
+
readonly now?: number;
|
|
16
|
+
readonly dryRun?: boolean;
|
|
17
|
+
readonly force?: boolean;
|
|
18
|
+
readonly cwd?: string;
|
|
19
|
+
}): RetentionReport | null;
|
|
20
|
+
export declare function protectSessionStorage(store: string, owners: readonly string[], env: NodeJS.ProcessEnv, cwd?: string): () => void;
|
|
21
|
+
export declare function maintainSessionStorage(env: NodeJS.ProcessEnv, cwd?: string): void;
|