@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,123 @@
|
|
|
1
|
+
import { formatTokenCount } from "./cost-tracker.js";
|
|
2
|
+
import { isSubscription } from "./session-usage.js";
|
|
3
|
+
import { buildStatusLine, DEFAULT_ORDER } from "./status-line.js";
|
|
4
|
+
import { fitLine, oneLine, terminalWidth } from "./terminal-text.js";
|
|
5
|
+
import { buildContextBar } from "./context-bar.js";
|
|
6
|
+
import { getLanguage, tr } from "./i18n.js";
|
|
7
|
+
export const SESSION_USAGE_EXPLANATION = "I token cumulati sono la somma delle chiamate della sessione, inclusi input ripetuti e cache: non sono il contesto di una singola richiesta. Talos seleziona informazioni rilevanti e gestisce la cronologia con recupero e compattazione secondo la configurazione. Questo non annulla i consumi registrati dal provider. ≥ indica un totale parziale: il consumo noto è almeno quello mostrato. Il contesto indicato è una stima locale, non una misura esatta del payload inviato.";
|
|
8
|
+
const shortLabel = (label) => label.replace("Limite 5 ore", "5h").replace("Settimanale", tr("7g", "7d")).replace("Finestra ", "");
|
|
9
|
+
const remainingPercent = (window) => window.status === "rejected" ? "0%"
|
|
10
|
+
: window.utilization !== undefined ? `${Math.round(Math.max(0, Math.min(1, 1 - window.utilization)) * 100)}%` : undefined;
|
|
11
|
+
function windowText(limits, now, detail) {
|
|
12
|
+
const stale = now - limits.capturedAt > 5 * 60_000;
|
|
13
|
+
return limits.windows.map(window => {
|
|
14
|
+
const expired = window.resetAt !== undefined && window.resetAt <= now;
|
|
15
|
+
const percent = remainingPercent(window);
|
|
16
|
+
const remaining = percent !== undefined ? `${percent} ${tr("disponibile", "remaining")}`
|
|
17
|
+
: window.remaining !== undefined ? `${formatTokenCount(window.remaining)} ${window.unit ?? ""} ${tr("disponibili", "remaining")}` : tr("quota non comunicata", "quota unavailable");
|
|
18
|
+
const label = window.label === "Secondaria" ? tr("Quota 2 (durata ignota)", "Quota 2 (window unknown)") : window.label === "Primaria" ? tr("Quota 1 (durata ignota)", "Quota 1 (window unknown)") : shortLabel(window.label);
|
|
19
|
+
let text = `${label} ${remaining}`;
|
|
20
|
+
if (window.status === "rejected")
|
|
21
|
+
text += tr(" · limite raggiunto", " · limit reached");
|
|
22
|
+
if (expired || stale)
|
|
23
|
+
text += tr(" (dato non recente)", " (outdated)");
|
|
24
|
+
if (detail)
|
|
25
|
+
text += ` · ${resetCountdown(window.resetAt, now)}`
|
|
26
|
+
+ (window.resetAt ? ` (${new Date(window.resetAt).toLocaleString(getLanguage())})` : "");
|
|
27
|
+
return text;
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
export function subscriptionDetails(providerId, limits, t, now = Date.now()) {
|
|
31
|
+
if (!isSubscription(providerId) && !limits)
|
|
32
|
+
return [];
|
|
33
|
+
const rows = [t.bold(`\n ${isSubscription(providerId) ? tr("Abbonamento", "Subscription") : tr("Limiti provider", "Provider limits")} · ${providerId}`)];
|
|
34
|
+
if (!limits?.windows.length)
|
|
35
|
+
rows.push(t.dim(tr(" Quota non comunicata dal provider. Si aggiorna quando arriva una risposta con i limiti.", " Quota unavailable. Updates when the provider reports limits in a response.")));
|
|
36
|
+
else {
|
|
37
|
+
rows.push(...windowText(limits, now, true).map(text => t.silver(` ${text}`)));
|
|
38
|
+
rows.push(t.dim(` ${tr("Ultimo aggiornamento", "Last update")}: ${new Date(limits.capturedAt).toLocaleString(getLanguage())}`));
|
|
39
|
+
}
|
|
40
|
+
if (isSubscription(providerId))
|
|
41
|
+
rows.push(t.dim(tr(" Quota condivisa dell'account, distinta dai token di questa sessione.", " Shared account quota, separate from this session's token usage.")));
|
|
42
|
+
return rows;
|
|
43
|
+
}
|
|
44
|
+
function resetCountdown(resetAt, now) {
|
|
45
|
+
if (resetAt === undefined)
|
|
46
|
+
return tr("reset n/d", "reset n/a");
|
|
47
|
+
if (resetAt <= now)
|
|
48
|
+
return tr("reset atteso", "reset pending");
|
|
49
|
+
const minutes = Math.ceil((resetAt - now) / 60_000);
|
|
50
|
+
if (minutes >= 1440)
|
|
51
|
+
return `reset ${Math.floor(minutes / 1440)}${tr("g", "d")} ${Math.floor(minutes % 1440 / 60)}h`;
|
|
52
|
+
if (minutes >= 60)
|
|
53
|
+
return `reset ${Math.floor(minutes / 60)}h ${minutes % 60}m`;
|
|
54
|
+
return `reset ${minutes}m`;
|
|
55
|
+
}
|
|
56
|
+
function footerWindows(limits, providerId) {
|
|
57
|
+
const session = limits?.windows.find(w => w.id === "5h" || w.label === "Limite 5 ore");
|
|
58
|
+
const weekly = limits?.windows.find(w => w.id === "7d" || w.label === "Settimanale");
|
|
59
|
+
const known = [session, weekly].filter((w) => w !== undefined);
|
|
60
|
+
// At narrow widths, keep the window that is actually blocking the account.
|
|
61
|
+
const blocked = limits?.windows.filter(w => w.status === "rejected" && !w.id.startsWith("overage")) ?? [];
|
|
62
|
+
for (const window of blocked)
|
|
63
|
+
if (!known.includes(window))
|
|
64
|
+
known.push(window);
|
|
65
|
+
known.sort((a, b) => Number(b.status === "rejected") - Number(a.status === "rejected"));
|
|
66
|
+
if (known.length)
|
|
67
|
+
return known;
|
|
68
|
+
if (isSubscription(providerId))
|
|
69
|
+
return [{ id: "5h", label: "Limite 5 ore" }, { id: "7d", label: "Settimanale" }];
|
|
70
|
+
return limits?.windows.slice(0, 1) ?? [];
|
|
71
|
+
}
|
|
72
|
+
function quotaText(window, limits, t, now, reset = false) {
|
|
73
|
+
const old = !!limits && (now - limits.capturedAt > 5 * 60_000 || (window.resetAt !== undefined && window.resetAt <= now));
|
|
74
|
+
const percent = remainingPercent(window);
|
|
75
|
+
const text = `${shortLabel(window.label)} ${old ? "~" : ""}${percent ?? tr("n/d", "n/a")}${percent ? ` ${tr("rim.", "left")}` : ""}`;
|
|
76
|
+
const paint = old || window.status === "rejected" || (window.utilization ?? 0) >= 0.9 ? t.yellow : t.muted;
|
|
77
|
+
return paint(text) + (reset ? t.dim(` · ${resetCountdown(window.resetAt, now)}`) : "");
|
|
78
|
+
}
|
|
79
|
+
export function buildUsageFooter(d, t, state, providerId, opts = {}, now = Date.now()) {
|
|
80
|
+
const width = Math.max(1, d.width - 3);
|
|
81
|
+
const known = d.contextTokens !== undefined && Number.isFinite(d.contextTokens) && d.contextTokens >= 0
|
|
82
|
+
&& d.contextWindow !== undefined && Number.isFinite(d.contextWindow) && d.contextWindow > 0;
|
|
83
|
+
const warning = state.unsaved ? t.yellow(tr(" · non salvati", " · unsaved")) : "";
|
|
84
|
+
const context = known
|
|
85
|
+
? buildContextBar(d.contextTokens, d.contextWindow, d.contextArchive ?? [], width, t, warning)
|
|
86
|
+
: t.muted(tr("Contesto~ n/d", "Context~ n/a")) + warning;
|
|
87
|
+
const limits = state.limits.get(providerId);
|
|
88
|
+
const windows = footerWindows(limits, providerId);
|
|
89
|
+
const separator = t.dim(" · ");
|
|
90
|
+
const effort = d.effort ? t.muted(oneLine(d.effort)) : "";
|
|
91
|
+
const suffix = [d.fast ? t.accent("fast") : "", effort].filter(Boolean).join(separator);
|
|
92
|
+
const model = oneLine(d.model).split("/").pop() || oneLine(d.model);
|
|
93
|
+
const quotaBudget = windows[0] && width >= 21 ? terminalWidth(quotaText(windows[0], limits, t, now)) + 2 : 0;
|
|
94
|
+
const modelBudget = Math.max(1, width - terminalWidth(suffix) - (suffix ? 3 : 0) - quotaBudget);
|
|
95
|
+
let runtime = t.silver(fitLine(model, modelBudget)) + (suffix ? separator + suffix : "");
|
|
96
|
+
// Due righe stabili: contesto sopra l'input, modello e quota sotto.
|
|
97
|
+
// I dettagli meno urgenti non aggiungono righe quando lo spazio finisce.
|
|
98
|
+
const fits = (left, right) => terminalWidth(left) + terminalWidth(right) + (right ? 2 : 0) <= width;
|
|
99
|
+
const parts = [];
|
|
100
|
+
for (const window of windows) {
|
|
101
|
+
const candidate = quotaText(window, limits, t, now);
|
|
102
|
+
if (fits(runtime, [...parts, candidate].join(separator)))
|
|
103
|
+
parts.push(candidate);
|
|
104
|
+
else
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
107
|
+
for (let i = 0; i < parts.length; i++) {
|
|
108
|
+
if (windows[i].resetAt === undefined)
|
|
109
|
+
continue;
|
|
110
|
+
const withReset = [...parts];
|
|
111
|
+
withReset[i] = quotaText(windows[i], limits, t, now, true);
|
|
112
|
+
if (fits(runtime, withReset.join(separator)))
|
|
113
|
+
parts[i] = withReset[i];
|
|
114
|
+
}
|
|
115
|
+
const right = parts.join(separator);
|
|
116
|
+
const order = [...new Set(opts.order ?? DEFAULT_ORDER)].filter(id => !["usage", "ctx", "model", "effort"].includes(id));
|
|
117
|
+
const extra = order.length || opts.render ? buildStatusLine(d, t, { ...opts, order }).trim() : "";
|
|
118
|
+
if (extra && fits(runtime + separator + extra, right))
|
|
119
|
+
runtime += separator + extra;
|
|
120
|
+
if (right)
|
|
121
|
+
runtime += " ".repeat(Math.max(2, width - terminalWidth(runtime) - terminalWidth(right))) + right;
|
|
122
|
+
return [context, runtime].map(row => fitLine(" " + row, Math.max(1, d.width - 1)));
|
|
123
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { type ValutazioneProva } from "../core/licenza.js";
|
|
2
|
+
export declare const VASCEND_AUTH_BASE = "https://api.vascend.it/api/v1/agent";
|
|
3
|
+
type FetchLike = (url: string, init?: RequestInit) => Promise<Response>;
|
|
4
|
+
export interface LoginDeps {
|
|
5
|
+
readonly fetchImpl?: FetchLike;
|
|
6
|
+
readonly base?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface EsitoRichiestaCodice {
|
|
9
|
+
readonly ok: boolean;
|
|
10
|
+
readonly nuovo?: boolean;
|
|
11
|
+
readonly attesaS?: number;
|
|
12
|
+
readonly error?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface EsitoVerifica {
|
|
15
|
+
readonly ok: boolean;
|
|
16
|
+
readonly token?: string;
|
|
17
|
+
readonly nome?: string;
|
|
18
|
+
readonly tier?: string;
|
|
19
|
+
readonly serveSecondoFattore?: boolean;
|
|
20
|
+
readonly error?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface EsitoSessione {
|
|
23
|
+
readonly language?: "it" | "en";
|
|
24
|
+
readonly stato: "valida" | "respinta" | "irraggiungibile";
|
|
25
|
+
readonly email?: string;
|
|
26
|
+
readonly nome?: string;
|
|
27
|
+
readonly tier?: string;
|
|
28
|
+
readonly error?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface DecisioneCancello {
|
|
31
|
+
readonly azione: "prosegui" | "login";
|
|
32
|
+
readonly avviso?: string;
|
|
33
|
+
readonly email?: string;
|
|
34
|
+
readonly tier?: string;
|
|
35
|
+
}
|
|
36
|
+
export declare function baseOf(deps: LoginDeps, env: NodeJS.ProcessEnv): string;
|
|
37
|
+
export declare function richiediCodice(env: NodeJS.ProcessEnv, p: {
|
|
38
|
+
email: string;
|
|
39
|
+
nome?: string;
|
|
40
|
+
cognome?: string;
|
|
41
|
+
}, deps?: LoginDeps): Promise<EsitoRichiestaCodice>;
|
|
42
|
+
export declare function verificaCodice(env: NodeJS.ProcessEnv, p: {
|
|
43
|
+
email: string;
|
|
44
|
+
codice: string;
|
|
45
|
+
totp?: string;
|
|
46
|
+
}, deps?: LoginDeps): Promise<EsitoVerifica>;
|
|
47
|
+
export declare function statoSessione(env: NodeJS.ProcessEnv, token: string, deps?: LoginDeps): Promise<EsitoSessione>;
|
|
48
|
+
export declare function revocaSessione(env: NodeJS.ProcessEnv, token: string, deps?: LoginDeps): Promise<void>;
|
|
49
|
+
export declare function decisioneCancello(token: string, sessione: EsitoSessione | null, offline?: ValutazioneProva | null): DecisioneCancello;
|
|
50
|
+
export interface EsitoProvaOffline {
|
|
51
|
+
readonly ok: boolean;
|
|
52
|
+
readonly prova?: string;
|
|
53
|
+
readonly error?: string;
|
|
54
|
+
}
|
|
55
|
+
export declare function prendiProvaOffline(env: NodeJS.ProcessEnv, token: string, deps?: LoginDeps): Promise<EsitoProvaOffline>;
|
|
56
|
+
interface LicenzaLocale {
|
|
57
|
+
readonly prova: string;
|
|
58
|
+
readonly massimoVisto: number;
|
|
59
|
+
}
|
|
60
|
+
export declare function leggiLicenzaLocale(env: NodeJS.ProcessEnv): LicenzaLocale | null;
|
|
61
|
+
export declare function salvaLicenzaLocale(env: NodeJS.ProcessEnv, dati: LicenzaLocale): boolean;
|
|
62
|
+
export declare function rimuoviLicenzaLocale(env: NodeJS.ProcessEnv): void;
|
|
63
|
+
export declare function valutaLicenzaLocale(env: NodeJS.ProcessEnv, adesso?: number): ValutazioneProva | null;
|
|
64
|
+
export declare function rinnovaProvaOffline(env: NodeJS.ProcessEnv, token: string, deps?: LoginDeps): Promise<void>;
|
|
65
|
+
export declare function tokenVascend(env: NodeJS.ProcessEnv): string;
|
|
66
|
+
export declare function salvaTokenVascend(env: NodeJS.ProcessEnv, token: string): boolean;
|
|
67
|
+
export declare function rimuoviTokenVascend(env: NodeJS.ProcessEnv): boolean;
|
|
68
|
+
export {};
|
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
// Accesso Vascend per la TUI: lo STESSO cancello di Horizon.
|
|
2
|
+
//
|
|
3
|
+
// Talos e' il CLI di Horizon: per usarlo serve l'account Vascend, con lo
|
|
4
|
+
// stesso flusso di Horizon (vascend-terminal/src/main/auth.js) e le stesse
|
|
5
|
+
// rotte del backend agentico su api.vascend.it:
|
|
6
|
+
// POST /otp/request { email, nome?, cognome? } -> { nuovo, inviato, attesa_s }
|
|
7
|
+
// POST /otp/verify { email, codice, totp? } -> { access_token, tier, ... }
|
|
8
|
+
// GET /me (Bearer) -> { email, name?, tier, ... }
|
|
9
|
+
// POST /logout (Bearer, best-effort)
|
|
10
|
+
//
|
|
11
|
+
// Nessuna password: si scrive l'email, arriva un codice monouso, si entra. Un
|
|
12
|
+
// indirizzo sconosciuto porta alla registrazione nello stesso flusso (nuovo:
|
|
13
|
+
// true -> si chiedono nome e cognome). Chi ha acceso il secondo fattore lo
|
|
14
|
+
// inserisce NELLA STESSA verifica (il backend controlla il TOTP prima di
|
|
15
|
+
// consumare la sfida: sbagliarlo non brucia il codice email).
|
|
16
|
+
//
|
|
17
|
+
// Il token (JWT) si salva nello store credenziali di talos
|
|
18
|
+
// (~/.talos/config.json, provider "vascend") e vale per gli avvii successivi.
|
|
19
|
+
// Parte PURA e testabile: fetch iniettabile, niente stato di modulo.
|
|
20
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
21
|
+
import { join } from "node:path";
|
|
22
|
+
import { deleteCredential, loadCredentials, saveCredential } from "../core/credentials.js";
|
|
23
|
+
import { talosConfigDir } from "../core/env-paths.js";
|
|
24
|
+
import { valuta } from "../core/licenza.js";
|
|
25
|
+
export const VASCEND_AUTH_BASE = "https://api.vascend.it/api/v1/agent";
|
|
26
|
+
const AUTH_TIMEOUT_MS = 12_000;
|
|
27
|
+
// Il confine col server e' territorio ostile in ENTRAMBE le direzioni: quello
|
|
28
|
+
// che spediamo deve essere gia' nei limiti del contratto (niente payload
|
|
29
|
+
// anomali costruiti tramite questo client), quello che riceviamo va trattato
|
|
30
|
+
// come testo di chiunque PRIMA di finire sul terminale — una risposta con
|
|
31
|
+
// sequenze di escape dentro `error` potrebbe altrimenti scrivere negli
|
|
32
|
+
// appunti (OSC 52), cambiare il titolo o falsificare lo schermo.
|
|
33
|
+
function pulisciTesto(valore, max = 200) {
|
|
34
|
+
return String(valore ?? "")
|
|
35
|
+
.replace(/[\u0000-\u001f\u007f-\u009f]/g, " ")
|
|
36
|
+
.replace(/\s+/g, " ")
|
|
37
|
+
.trim()
|
|
38
|
+
.slice(0, max);
|
|
39
|
+
}
|
|
40
|
+
// L'endpoint di accesso viaggia SOLO su https; http e' ammesso unicamente in
|
|
41
|
+
// locale (sviluppo). Un override malformato o in chiaro non degrada il login
|
|
42
|
+
// su un canale osservabile: si torna al default compilato.
|
|
43
|
+
function baseValida(url) {
|
|
44
|
+
try {
|
|
45
|
+
const parsed = new URL(url);
|
|
46
|
+
if (parsed.protocol === "https:")
|
|
47
|
+
return true;
|
|
48
|
+
return parsed.protocol === "http:" && (parsed.hostname === "localhost" || parsed.hostname === "127.0.0.1");
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
export function baseOf(deps, env) {
|
|
55
|
+
const override = String(env["TALOS_VASCEND_AUTH_URL"] ?? "").trim();
|
|
56
|
+
const scelta = deps.base ?? (override || VASCEND_AUTH_BASE);
|
|
57
|
+
return (baseValida(scelta) ? scelta : VASCEND_AUTH_BASE).replace(/\/+$/, "");
|
|
58
|
+
}
|
|
59
|
+
// Un token di sessione e' un JWT: charset base64url + punti, lunghezza sana.
|
|
60
|
+
// Tutto il resto (uno store manomesso, un valore incollato per sbaglio) NON
|
|
61
|
+
// diventa un header Authorization: si tratta come assenza di sessione.
|
|
62
|
+
function tokenPlausibile(token) {
|
|
63
|
+
return /^[A-Za-z0-9._-]{20,4096}$/.test(token);
|
|
64
|
+
}
|
|
65
|
+
function fetchDi(deps) {
|
|
66
|
+
const f = deps.fetchImpl ?? (typeof fetch !== "undefined" ? fetch : null);
|
|
67
|
+
if (!f)
|
|
68
|
+
throw new Error("fetch non disponibile in questo runtime");
|
|
69
|
+
return f;
|
|
70
|
+
}
|
|
71
|
+
function messaggio(err) {
|
|
72
|
+
return pulisciTesto(err?.message ?? err ?? "");
|
|
73
|
+
}
|
|
74
|
+
async function chiama(deps, env, path, init) {
|
|
75
|
+
const f = fetchDi(deps);
|
|
76
|
+
const controller = typeof AbortController !== "undefined" ? new AbortController() : null;
|
|
77
|
+
const timer = controller ? setTimeout(() => controller.abort(), AUTH_TIMEOUT_MS) : null;
|
|
78
|
+
let resp;
|
|
79
|
+
try {
|
|
80
|
+
resp = await f(baseOf(deps, env) + path, controller ? { ...init, signal: controller.signal } : init);
|
|
81
|
+
}
|
|
82
|
+
catch (err) {
|
|
83
|
+
return { ok: false, status: 0, data: {}, rete: true, error: "servizio Vascend non raggiungibile: " + messaggio(err) };
|
|
84
|
+
}
|
|
85
|
+
finally {
|
|
86
|
+
if (timer)
|
|
87
|
+
clearTimeout(timer);
|
|
88
|
+
}
|
|
89
|
+
let data = {};
|
|
90
|
+
try {
|
|
91
|
+
data = (await resp.json());
|
|
92
|
+
}
|
|
93
|
+
catch {
|
|
94
|
+
data = {};
|
|
95
|
+
}
|
|
96
|
+
if (!resp.ok) {
|
|
97
|
+
// Il testo arriva dal server (o da chi si spaccia per lui): si ripulisce
|
|
98
|
+
// QUI, una volta, prima che qualunque chiamante lo stampi.
|
|
99
|
+
const testo = typeof data["error"] === "string" && data["error"]
|
|
100
|
+
? pulisciTesto(data["error"])
|
|
101
|
+
: typeof data["message"] === "string" && data["message"] ? pulisciTesto(data["message"]) : `errore ${resp.status}`;
|
|
102
|
+
return { ok: false, status: resp.status, data, error: testo };
|
|
103
|
+
}
|
|
104
|
+
return { ok: true, status: resp.status, data };
|
|
105
|
+
}
|
|
106
|
+
// Primo passo: chiede il codice per un indirizzo. `nuovo: true` = account da
|
|
107
|
+
// registrare: si richiama con nome e cognome (stessa rotta, stesso flusso).
|
|
108
|
+
export async function richiediCodice(env, p, deps = {}) {
|
|
109
|
+
// I limiti del contratto si rispettano PRIMA di spedire: questo client
|
|
110
|
+
// non deve poter essere usato per costruire payload anomali.
|
|
111
|
+
const email = p.email.trim().toLowerCase();
|
|
112
|
+
if (!email || email.length > 254 || !email.includes("@")) {
|
|
113
|
+
return { ok: false, error: "email non valida" };
|
|
114
|
+
}
|
|
115
|
+
const corpo = { email };
|
|
116
|
+
if (p.nome)
|
|
117
|
+
corpo["nome"] = pulisciTesto(p.nome, 120);
|
|
118
|
+
if (p.cognome)
|
|
119
|
+
corpo["cognome"] = pulisciTesto(p.cognome, 120);
|
|
120
|
+
const r = await chiama(deps, env, "/otp/request", {
|
|
121
|
+
method: "POST",
|
|
122
|
+
headers: { "Content-Type": "application/json" },
|
|
123
|
+
body: JSON.stringify(corpo),
|
|
124
|
+
});
|
|
125
|
+
if (!r.ok)
|
|
126
|
+
return { ok: false, error: r.error ?? "richiesta codice fallita" };
|
|
127
|
+
const attesa = Number(r.data["attesa_s"] ?? 0);
|
|
128
|
+
return {
|
|
129
|
+
ok: true,
|
|
130
|
+
nuovo: r.data["nuovo"] === true,
|
|
131
|
+
attesaS: Number.isFinite(attesa) && attesa > 0 ? Math.min(attesa, 86_400) : 0,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
// Secondo passo: il codice conferma. Un 401 che nomina il secondo fattore NON
|
|
135
|
+
// e' un codice sbagliato: la UI deve chiedere il TOTP e riprovare con lo
|
|
136
|
+
// STESSO codice email (ricominciare farebbe partire un'email a tentativo).
|
|
137
|
+
export async function verificaCodice(env, p, deps = {}) {
|
|
138
|
+
const email = p.email.trim().toLowerCase();
|
|
139
|
+
const codice = p.codice.trim();
|
|
140
|
+
const totp = (p.totp ?? "").trim();
|
|
141
|
+
if (!email || email.length > 254)
|
|
142
|
+
return { ok: false, error: "email non valida" };
|
|
143
|
+
if (!codice || codice.length > 12)
|
|
144
|
+
return { ok: false, error: "codice non valido" };
|
|
145
|
+
if (totp.length > 32)
|
|
146
|
+
return { ok: false, error: "secondo fattore non valido" };
|
|
147
|
+
const corpo = { email, codice };
|
|
148
|
+
if (totp)
|
|
149
|
+
corpo["totp"] = totp;
|
|
150
|
+
// Talos e' un prodotto SEPARATO da Horizon: l'avviso "Da dove si e' entrati"
|
|
151
|
+
// e l'email di attivazione devono dire quello vero. Il server traduce da
|
|
152
|
+
// allowlist, qui si dichiara e basta.
|
|
153
|
+
corpo["client"] = "talos";
|
|
154
|
+
const r = await chiama(deps, env, "/otp/verify", {
|
|
155
|
+
method: "POST",
|
|
156
|
+
headers: { "Content-Type": "application/json" },
|
|
157
|
+
body: JSON.stringify(corpo),
|
|
158
|
+
});
|
|
159
|
+
if (!r.ok) {
|
|
160
|
+
if (r.status === 401 && /secondo fattore/i.test(String(r.error ?? ""))) {
|
|
161
|
+
return { ok: false, serveSecondoFattore: true, error: r.error ?? "" };
|
|
162
|
+
}
|
|
163
|
+
return { ok: false, error: r.error ?? "verifica fallita" };
|
|
164
|
+
}
|
|
165
|
+
const token = String(r.data["access_token"] ?? "").trim();
|
|
166
|
+
// Anche il token si valida: uno malformato non deve mai diventare un
|
|
167
|
+
// header Authorization ne' finire nello store.
|
|
168
|
+
if (!tokenPlausibile(token))
|
|
169
|
+
return { ok: false, error: "verifica: risposta senza token valido" };
|
|
170
|
+
const nome = pulisciTesto(r.data["name"] ?? r.data["full_name"] ?? r.data["display_name"] ?? "", 80);
|
|
171
|
+
return {
|
|
172
|
+
ok: true,
|
|
173
|
+
token,
|
|
174
|
+
...(nome ? { nome } : {}),
|
|
175
|
+
...(typeof r.data["tier"] === "string" ? { tier: pulisciTesto(r.data["tier"], 40) } : {}),
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
// Stato della sessione salvata: GET /me col Bearer.
|
|
179
|
+
export async function statoSessione(env, token, deps = {}) {
|
|
180
|
+
const r = await chiama(deps, env, "/me", {
|
|
181
|
+
method: "GET",
|
|
182
|
+
headers: { Authorization: "Bearer " + token },
|
|
183
|
+
});
|
|
184
|
+
if (r.ok) {
|
|
185
|
+
const nome = pulisciTesto(r.data["name"] ?? r.data["full_name"] ?? r.data["display_name"] ?? r.data["nome"] ?? "", 80);
|
|
186
|
+
return {
|
|
187
|
+
stato: "valida",
|
|
188
|
+
...(r.data["language"] === "en" || r.data["language"] === "it" ? { language: r.data["language"] } : {}),
|
|
189
|
+
...(typeof r.data["email"] === "string" ? { email: pulisciTesto(r.data["email"], 254) } : {}),
|
|
190
|
+
...(nome ? { nome } : {}),
|
|
191
|
+
...(typeof r.data["tier"] === "string" ? { tier: pulisciTesto(r.data["tier"], 40) } : {}),
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
if (r.rete)
|
|
195
|
+
return { stato: "irraggiungibile", ...(r.error ? { error: r.error } : {}) };
|
|
196
|
+
return { stato: "respinta", ...(r.error ? { error: r.error } : {}) };
|
|
197
|
+
}
|
|
198
|
+
// Revoca best-effort lato backend; il token locale lo rimuove il chiamante.
|
|
199
|
+
export async function revocaSessione(env, token, deps = {}) {
|
|
200
|
+
if (!token)
|
|
201
|
+
return;
|
|
202
|
+
try {
|
|
203
|
+
await fetchDi(deps)(baseOf(deps, env) + "/logout", {
|
|
204
|
+
method: "POST",
|
|
205
|
+
headers: { Authorization: "Bearer " + token },
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
catch {
|
|
209
|
+
// best-effort: il logout locale prosegue comunque
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
// Decisione del cancello d'avvio, PURA rispetto alla rete: il chiamante passa
|
|
213
|
+
// il token salvato, l'esito di /me e la VALUTAZIONE della prova offline.
|
|
214
|
+
//
|
|
215
|
+
// Senza rete NON basta avere "una sessione salvata": un token si fabbrica in
|
|
216
|
+
// un file di config, una prova firmata Ed25519 no. Quindi: rete giu' + prova
|
|
217
|
+
// firmata valida (firma, scadenza, orologio ancorato) = si lavora offline;
|
|
218
|
+
// rete giu' senza prova valida = login (che offline non riesce: per lavorare
|
|
219
|
+
// scollegati serve una prova VERA, presa da connessi). Un 401 resta
|
|
220
|
+
// fail-closed: sessione scaduta o revocata, si rientra.
|
|
221
|
+
export function decisioneCancello(token, sessione, offline = null) {
|
|
222
|
+
if (!token)
|
|
223
|
+
return { azione: "login" };
|
|
224
|
+
if (!sessione)
|
|
225
|
+
return { azione: "login" };
|
|
226
|
+
if (sessione.stato === "valida") {
|
|
227
|
+
return {
|
|
228
|
+
azione: "prosegui",
|
|
229
|
+
...(sessione.email ? { email: sessione.email } : {}),
|
|
230
|
+
...(sessione.tier ? { tier: sessione.tier } : {}),
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
if (sessione.stato === "irraggiungibile") {
|
|
234
|
+
if (offline && offline.ok) {
|
|
235
|
+
const scade = offline.claims && Number.isFinite(offline.claims.exp)
|
|
236
|
+
? new Date(offline.claims.exp * 1000).toISOString().slice(0, 10)
|
|
237
|
+
: "";
|
|
238
|
+
return {
|
|
239
|
+
azione: "prosegui",
|
|
240
|
+
avviso: "rete non raggiungibile: prova offline firmata valida" + (scade ? ` (fino al ${scade})` : ""),
|
|
241
|
+
...(offline.claims?.email ? { email: offline.claims.email } : {}),
|
|
242
|
+
...(offline.claims?.tier ? { tier: offline.claims.tier } : {}),
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
const motivo = offline ? ` (prova offline: ${offline.motivo ?? "non valida"})` : " (nessuna prova offline)";
|
|
246
|
+
return { azione: "login", avviso: "rete non raggiungibile e nessuna prova offline valida" + motivo };
|
|
247
|
+
}
|
|
248
|
+
return { azione: "login", avviso: sessione.error ?? "sessione scaduta o revocata" };
|
|
249
|
+
}
|
|
250
|
+
// GET /licenza/offline (Bearer): rilascia la prova firmata da conservare per
|
|
251
|
+
// quando la rete non ci sara'. Rinnovo a finestra scorrevole: si riprende a
|
|
252
|
+
// ogni accesso online e chi lavora connesso non se ne accorge.
|
|
253
|
+
export async function prendiProvaOffline(env, token, deps = {}) {
|
|
254
|
+
const r = await chiama(deps, env, "/licenza/offline", {
|
|
255
|
+
method: "GET",
|
|
256
|
+
headers: { Authorization: "Bearer " + token },
|
|
257
|
+
});
|
|
258
|
+
if (!r.ok)
|
|
259
|
+
return { ok: false, error: r.error ?? "prova offline non disponibile" };
|
|
260
|
+
const prova = String(r.data["prova"] ?? "").trim();
|
|
261
|
+
// Stessa igiene del token: la prova e' un JWT, tutto il resto si scarta
|
|
262
|
+
// (e non finisce mai scritto su disco).
|
|
263
|
+
if (!provaPlausibile(prova))
|
|
264
|
+
return { ok: false, error: "risposta senza prova valida" };
|
|
265
|
+
return { ok: true, prova };
|
|
266
|
+
}
|
|
267
|
+
// Una prova e' un JWT (piu' lungo di un access token: porta i claims della
|
|
268
|
+
// licenza), mai oltre gli 8KB: oltre, o fuori charset, e' spazzatura.
|
|
269
|
+
function provaPlausibile(prova) {
|
|
270
|
+
return /^[A-Za-z0-9._-]{20,8192}$/.test(prova);
|
|
271
|
+
}
|
|
272
|
+
function licenzaPath(env) {
|
|
273
|
+
if (env["TALOS_NO_GLOBAL_CONFIG"] === "1")
|
|
274
|
+
return null;
|
|
275
|
+
return join(talosConfigDir(env), "licenza.json");
|
|
276
|
+
}
|
|
277
|
+
export function leggiLicenzaLocale(env) {
|
|
278
|
+
const path = licenzaPath(env);
|
|
279
|
+
if (!path || !existsSync(path))
|
|
280
|
+
return null;
|
|
281
|
+
try {
|
|
282
|
+
const raw = JSON.parse(readFileSync(path, "utf8"));
|
|
283
|
+
const prova = String(raw["prova"] ?? "").trim();
|
|
284
|
+
if (!provaPlausibile(prova))
|
|
285
|
+
return null;
|
|
286
|
+
const visto = Number(raw["massimoVisto"] ?? 0);
|
|
287
|
+
return { prova, massimoVisto: Number.isFinite(visto) && visto > 0 ? visto : 0 };
|
|
288
|
+
}
|
|
289
|
+
catch {
|
|
290
|
+
return null;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
export function salvaLicenzaLocale(env, dati) {
|
|
294
|
+
const path = licenzaPath(env);
|
|
295
|
+
if (!path)
|
|
296
|
+
return false;
|
|
297
|
+
if (!provaPlausibile(dati.prova))
|
|
298
|
+
return false;
|
|
299
|
+
try {
|
|
300
|
+
mkdirSync(talosConfigDir(env), { recursive: true });
|
|
301
|
+
writeFileSync(path, JSON.stringify({ prova: dati.prova, massimoVisto: dati.massimoVisto }), "utf8");
|
|
302
|
+
return true;
|
|
303
|
+
}
|
|
304
|
+
catch {
|
|
305
|
+
return false;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
export function rimuoviLicenzaLocale(env) {
|
|
309
|
+
const path = licenzaPath(env);
|
|
310
|
+
if (!path || !existsSync(path))
|
|
311
|
+
return;
|
|
312
|
+
try {
|
|
313
|
+
writeFileSync(path, JSON.stringify({}), "utf8");
|
|
314
|
+
}
|
|
315
|
+
catch { /* best-effort */ }
|
|
316
|
+
}
|
|
317
|
+
// Valuta la prova offline conservata QUI e ORA (firma, scadenza, orologio
|
|
318
|
+
// ancorato) e aggiorna il massimo orario visto. null = nessuna prova locale.
|
|
319
|
+
export function valutaLicenzaLocale(env, adesso) {
|
|
320
|
+
const locale = leggiLicenzaLocale(env);
|
|
321
|
+
if (!locale)
|
|
322
|
+
return null;
|
|
323
|
+
const esito = valuta({
|
|
324
|
+
token: locale.prova,
|
|
325
|
+
...(Number.isFinite(adesso) ? { adesso: adesso } : {}),
|
|
326
|
+
massimoVisto: locale.massimoVisto,
|
|
327
|
+
});
|
|
328
|
+
salvaLicenzaLocale(env, { prova: locale.prova, massimoVisto: esito.massimoVisto });
|
|
329
|
+
return esito;
|
|
330
|
+
}
|
|
331
|
+
// Rinnovo best-effort della prova offline, da fare a ogni accesso online
|
|
332
|
+
// riuscito: chi lavora connesso non se ne accorge, chi parte ha in mano i
|
|
333
|
+
// giorni della finestra e non uno di piu'.
|
|
334
|
+
export async function rinnovaProvaOffline(env, token, deps = {}) {
|
|
335
|
+
const esito = await prendiProvaOffline(env, token, deps);
|
|
336
|
+
if (esito.ok && esito.prova) {
|
|
337
|
+
salvaLicenzaLocale(env, { prova: esito.prova, massimoVisto: Math.floor(Date.now() / 1000) });
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
// --- Persistenza del token (store credenziali di talos) --------------------
|
|
341
|
+
const PROVIDER_ID = "vascend";
|
|
342
|
+
export function tokenVascend(env) {
|
|
343
|
+
// Uno store manomesso (o un valore incollato a mano) non diventa un header:
|
|
344
|
+
// un token non plausibile equivale a nessuna sessione.
|
|
345
|
+
const token = String(loadCredentials(env)[PROVIDER_ID]?.apiKey ?? "").trim();
|
|
346
|
+
return tokenPlausibile(token) ? token : "";
|
|
347
|
+
}
|
|
348
|
+
export function salvaTokenVascend(env, token) {
|
|
349
|
+
if (!tokenPlausibile(token))
|
|
350
|
+
return false;
|
|
351
|
+
return saveCredential(env, PROVIDER_ID, { apiKey: token });
|
|
352
|
+
}
|
|
353
|
+
export function rimuoviTokenVascend(env) {
|
|
354
|
+
return deleteCredential(env, PROVIDER_ID);
|
|
355
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type LoginDeps } from "./vascend-login.js";
|
|
2
|
+
import type { Lingua } from "./onboarding.js";
|
|
3
|
+
export declare class WebLoginError extends Error {
|
|
4
|
+
readonly code: string;
|
|
5
|
+
constructor(code: string);
|
|
6
|
+
}
|
|
7
|
+
export interface WebGrant {
|
|
8
|
+
readonly deviceCode: string;
|
|
9
|
+
readonly verifier: string;
|
|
10
|
+
readonly userCode: string;
|
|
11
|
+
readonly url: string;
|
|
12
|
+
readonly expiresIn: number;
|
|
13
|
+
readonly interval: number;
|
|
14
|
+
}
|
|
15
|
+
export interface WebSession {
|
|
16
|
+
readonly token: string;
|
|
17
|
+
readonly email: string;
|
|
18
|
+
readonly language: Lingua;
|
|
19
|
+
readonly tier?: string;
|
|
20
|
+
}
|
|
21
|
+
type Deps = LoginDeps & {
|
|
22
|
+
readonly wait?: (ms: number, signal?: AbortSignal) => Promise<void>;
|
|
23
|
+
readonly now?: () => number;
|
|
24
|
+
};
|
|
25
|
+
export declare function verificationUrl(value: unknown, code: string): string;
|
|
26
|
+
export declare function startWebLogin(env: NodeJS.ProcessEnv, language: Lingua, deps?: Deps, signal?: AbortSignal): Promise<WebGrant>;
|
|
27
|
+
export declare function waitForWebLogin(env: NodeJS.ProcessEnv, grant: WebGrant, deps?: Deps, signal?: AbortSignal): Promise<WebSession>;
|
|
28
|
+
export {};
|