@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,175 @@
|
|
|
1
|
+
// Lettura dei LIMITI DI PIANO dagli header di risposta dei provider.
|
|
2
|
+
//
|
|
3
|
+
// Gli abbonamenti Claude Code (OAuth) riportano le finestre "unified"
|
|
4
|
+
// (es. 5 ore, settimanale) con utilizzazione e reset; le API key Anthropic
|
|
5
|
+
// riportano i rate limit standard requests/tokens. Modulo PURO: header -> dati,
|
|
6
|
+
// nessuna rete. I provider lo chiamano dopo il fetch e allegano l'esito al
|
|
7
|
+
// ModelTurn; il runtime lo propaga nell'evento turn_end (la UI host mostra
|
|
8
|
+
// "quanto manca del piano").
|
|
9
|
+
import { validResetAt } from "./provider-reset.js";
|
|
10
|
+
// Etichette leggibili per le finestre unified note.
|
|
11
|
+
const UNIFIED_LABEL = {
|
|
12
|
+
"5h": "Limite 5 ore",
|
|
13
|
+
"7d": "Settimanale",
|
|
14
|
+
"7d_sonnet": "Settimanale Sonnet",
|
|
15
|
+
"7d_opus": "Settimanale Opus",
|
|
16
|
+
"7d_oauth_apps": "Settimanale app OAuth",
|
|
17
|
+
};
|
|
18
|
+
function windowLabel(id) {
|
|
19
|
+
return UNIFIED_LABEL[id] ?? `Finestra ${id}`;
|
|
20
|
+
}
|
|
21
|
+
function num(value) {
|
|
22
|
+
if (value === null || value === undefined || value === "")
|
|
23
|
+
return undefined;
|
|
24
|
+
const n = Number(value);
|
|
25
|
+
return Number.isFinite(n) ? n : undefined;
|
|
26
|
+
}
|
|
27
|
+
// I reset arrivano come ISO date o come epoch secondi, a seconda dell'header.
|
|
28
|
+
function resetEpochMs(value) {
|
|
29
|
+
if (!value)
|
|
30
|
+
return undefined;
|
|
31
|
+
const asNumber = Number(value);
|
|
32
|
+
if (Number.isFinite(asNumber) && asNumber > 0) {
|
|
33
|
+
// euristica: epoch secondi (10 cifre) vs ms
|
|
34
|
+
const at = asNumber > 1e12 ? asNumber : asNumber * 1000;
|
|
35
|
+
return validResetAt(at) ? at : undefined;
|
|
36
|
+
}
|
|
37
|
+
const parsed = Date.parse(value);
|
|
38
|
+
return validResetAt(parsed) ? parsed : undefined;
|
|
39
|
+
}
|
|
40
|
+
// Estrae le finestre "unified" degli abbonamenti Claude:
|
|
41
|
+
// anthropic-ratelimit-unified-status: allowed|allowed_warning|...
|
|
42
|
+
// anthropic-ratelimit-unified-reset: epoch/ISO
|
|
43
|
+
// anthropic-ratelimit-unified-5h-utilization: 0.16 (frazione)
|
|
44
|
+
// anthropic-ratelimit-unified-5h-status / -reset
|
|
45
|
+
// Il set esatto varia: si scandiscono TUTTI gli header col prefisso.
|
|
46
|
+
function unifiedWindows(headers) {
|
|
47
|
+
const seen = new Map();
|
|
48
|
+
const record = (id) => {
|
|
49
|
+
let entry = seen.get(id);
|
|
50
|
+
if (!entry) {
|
|
51
|
+
entry = {};
|
|
52
|
+
seen.set(id, entry);
|
|
53
|
+
}
|
|
54
|
+
return entry;
|
|
55
|
+
};
|
|
56
|
+
const visit = (value, rawKey) => {
|
|
57
|
+
const key = rawKey.toLowerCase();
|
|
58
|
+
const m = /^anthropic-ratelimit-unified-(?:(.+)-)?(utilization|reset|status|remaining)$/.exec(key);
|
|
59
|
+
if (!m)
|
|
60
|
+
return;
|
|
61
|
+
const id = m[1] ?? "unified";
|
|
62
|
+
const field = m[2];
|
|
63
|
+
const entry = record(id);
|
|
64
|
+
if (field === "utilization") {
|
|
65
|
+
const n = num(value);
|
|
66
|
+
// La frazione puo' superare 1 quando la quota e' esaurita: 1.01 e' 101%.
|
|
67
|
+
if (n !== undefined)
|
|
68
|
+
entry.utilization = n;
|
|
69
|
+
}
|
|
70
|
+
else if (field === "reset") {
|
|
71
|
+
entry.resetAt = resetEpochMs(value);
|
|
72
|
+
}
|
|
73
|
+
else if (field === "status") {
|
|
74
|
+
entry.status = value;
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
if (typeof headers.forEach === "function")
|
|
78
|
+
headers.forEach(visit);
|
|
79
|
+
const out = [];
|
|
80
|
+
for (const [id, entry] of seen) {
|
|
81
|
+
if (entry.utilization === undefined && entry.resetAt === undefined && entry.status === undefined)
|
|
82
|
+
continue;
|
|
83
|
+
out.push({
|
|
84
|
+
id,
|
|
85
|
+
label: windowLabel(id),
|
|
86
|
+
...(entry.utilization !== undefined ? { utilization: Math.max(0, Math.min(1, entry.utilization)) } : {}),
|
|
87
|
+
...(entry.resetAt !== undefined ? { resetAt: entry.resetAt } : {}),
|
|
88
|
+
...(entry.status !== undefined ? { status: entry.status } : {}),
|
|
89
|
+
unit: "percent",
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
return out.sort((a, b) => a.id.localeCompare(b.id));
|
|
93
|
+
}
|
|
94
|
+
// Rate limit standard delle API key Anthropic: requests e input/output tokens.
|
|
95
|
+
function standardWindows(headers) {
|
|
96
|
+
const out = [];
|
|
97
|
+
const push = (id, label, unit) => {
|
|
98
|
+
const limit = num(headers.get(`anthropic-ratelimit-${id}-limit`));
|
|
99
|
+
const remaining = num(headers.get(`anthropic-ratelimit-${id}-remaining`));
|
|
100
|
+
const resetAt = resetEpochMs(headers.get(`anthropic-ratelimit-${id}-reset`));
|
|
101
|
+
if (limit === undefined && remaining === undefined)
|
|
102
|
+
return;
|
|
103
|
+
const utilization = limit && remaining !== undefined && limit > 0
|
|
104
|
+
? Math.max(0, Math.min(1, (limit - remaining) / limit))
|
|
105
|
+
: undefined;
|
|
106
|
+
out.push({
|
|
107
|
+
id,
|
|
108
|
+
label,
|
|
109
|
+
...(utilization !== undefined ? { utilization } : {}),
|
|
110
|
+
...(remaining !== undefined ? { remaining } : {}),
|
|
111
|
+
...(limit !== undefined ? { limit } : {}),
|
|
112
|
+
...(resetAt !== undefined ? { resetAt } : {}),
|
|
113
|
+
unit,
|
|
114
|
+
});
|
|
115
|
+
};
|
|
116
|
+
push("requests", "Richieste al minuto", "requests");
|
|
117
|
+
push("input-tokens", "Token input al minuto", "tokens");
|
|
118
|
+
push("output-tokens", "Token output al minuto", "tokens");
|
|
119
|
+
return out;
|
|
120
|
+
}
|
|
121
|
+
// Rate limit stile OpenAI (x-ratelimit-*): usati da OpenAI e da vari compat.
|
|
122
|
+
function openAiWindows(headers) {
|
|
123
|
+
const out = [];
|
|
124
|
+
const push = (id, label, unit) => {
|
|
125
|
+
const limit = num(headers.get(`x-ratelimit-limit-${id}`));
|
|
126
|
+
const remaining = num(headers.get(`x-ratelimit-remaining-${id}`));
|
|
127
|
+
if (limit === undefined && remaining === undefined)
|
|
128
|
+
return;
|
|
129
|
+
const utilization = limit && remaining !== undefined && limit > 0
|
|
130
|
+
? Math.max(0, Math.min(1, (limit - remaining) / limit))
|
|
131
|
+
: undefined;
|
|
132
|
+
out.push({
|
|
133
|
+
id,
|
|
134
|
+
label,
|
|
135
|
+
...(utilization !== undefined ? { utilization } : {}),
|
|
136
|
+
...(remaining !== undefined ? { remaining } : {}),
|
|
137
|
+
...(limit !== undefined ? { limit } : {}),
|
|
138
|
+
unit,
|
|
139
|
+
});
|
|
140
|
+
};
|
|
141
|
+
push("requests", "Richieste", "requests");
|
|
142
|
+
push("tokens", "Token", "tokens");
|
|
143
|
+
return out;
|
|
144
|
+
}
|
|
145
|
+
// Finestre di abbonamento ChatGPT, distinte dai limiti RPM/TPM delle API key.
|
|
146
|
+
function codexWindows(headers, now) {
|
|
147
|
+
const windows = [];
|
|
148
|
+
for (const id of ["primary", "secondary"]) {
|
|
149
|
+
const prefix = `x-codex-${id}`;
|
|
150
|
+
const used = num(headers.get(`${prefix}-used-percent`));
|
|
151
|
+
const minutes = num(headers.get(`${prefix}-window-minutes`));
|
|
152
|
+
const epoch = resetEpochMs(headers.get(`${prefix}-reset-at`));
|
|
153
|
+
const delay = num(headers.get(`${prefix}-reset-after-seconds`));
|
|
154
|
+
const resetAt = epoch ?? (delay !== undefined && delay >= 0 && validResetAt(now + delay * 1000) ? now + delay * 1000 : undefined);
|
|
155
|
+
if (used === undefined && resetAt === undefined)
|
|
156
|
+
continue;
|
|
157
|
+
const label = minutes === 10080 ? "Settimanale" : minutes === 300 ? "Limite 5 ore"
|
|
158
|
+
: minutes ? `${minutes % 60 === 0 ? `${minutes / 60}h` : `${minutes} min`}` : id === "primary" ? "Primaria" : "Secondaria";
|
|
159
|
+
windows.push({ id, label, unit: "percent", ...(used !== undefined ? { utilization: Math.max(0, Math.min(1, used / 100)) } : {}),
|
|
160
|
+
...(resetAt !== undefined ? { resetAt } : {}) });
|
|
161
|
+
}
|
|
162
|
+
return windows;
|
|
163
|
+
}
|
|
164
|
+
// Estrae i limiti di piano dagli header. null se il provider non ne espone.
|
|
165
|
+
export function planLimitsFromHeaders(providerId, headers, now = Date.now()) {
|
|
166
|
+
const windows = [
|
|
167
|
+
...(providerId === "chatgpt" ? codexWindows(headers, now) : []),
|
|
168
|
+
...unifiedWindows(headers),
|
|
169
|
+
...standardWindows(headers),
|
|
170
|
+
...openAiWindows(headers),
|
|
171
|
+
];
|
|
172
|
+
if (!windows.length)
|
|
173
|
+
return null;
|
|
174
|
+
return { providerId, windows, capturedAt: now };
|
|
175
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const cleanProviderText: (text: string) => string;
|
|
2
|
+
export declare const validResetAt: (value: number) => boolean;
|
|
3
|
+
export declare function providerResetAt(original: string, now?: number): number | undefined;
|
|
4
|
+
export declare function errorTimingDetail(raw: unknown): string;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { stripVTControlCharacters } from "node:util";
|
|
2
|
+
export const cleanProviderText = (text) => stripVTControlCharacters(text).replace(/[’‘]/g, "'");
|
|
3
|
+
export const validResetAt = (value) => Number.isFinite(value) && value > 0 && value <= 8.64e15;
|
|
4
|
+
function epoch(value, now) {
|
|
5
|
+
const n = Number(value);
|
|
6
|
+
const at = Number.isFinite(n) && n > 0 ? (n < 1e12 ? n * 1000 : n) : Date.parse(value);
|
|
7
|
+
return validResetAt(at) && at > now ? at : undefined;
|
|
8
|
+
}
|
|
9
|
+
// Resolve a time in the provider's timezone, including a reset after midnight.
|
|
10
|
+
// Never substitute the computer's timezone for an invalid provider timezone.
|
|
11
|
+
function nextClockTime(hour, minute, zone, now) {
|
|
12
|
+
if (hour > 23 || minute > 59)
|
|
13
|
+
return undefined;
|
|
14
|
+
try {
|
|
15
|
+
const fmt = new Intl.DateTimeFormat("en-CA", {
|
|
16
|
+
...(zone ? { timeZone: zone } : {}), year: "numeric", month: "2-digit", day: "2-digit",
|
|
17
|
+
hour: "2-digit", minute: "2-digit", second: "2-digit", hourCycle: "h23",
|
|
18
|
+
});
|
|
19
|
+
const local = (at) => {
|
|
20
|
+
const parts = Object.fromEntries(fmt.formatToParts(at).map(p => [p.type, p.value]));
|
|
21
|
+
return Date.UTC(Number(parts.year), Number(parts.month) - 1, Number(parts.day), Number(parts.hour), Number(parts.minute), Number(parts.second));
|
|
22
|
+
};
|
|
23
|
+
const today = new Date(local(now));
|
|
24
|
+
for (let day = 0; day <= 1; day++) {
|
|
25
|
+
const target = Date.UTC(today.getUTCFullYear(), today.getUTCMonth(), today.getUTCDate() + day, hour, minute);
|
|
26
|
+
let at = target;
|
|
27
|
+
for (let i = 0; i < 4; i++)
|
|
28
|
+
at += target - local(at);
|
|
29
|
+
// A nonexistent DST clock time must remain unknown.
|
|
30
|
+
if (local(at) === target && at > now)
|
|
31
|
+
return at;
|
|
32
|
+
if (local(at) !== target && target > local(now))
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
catch { /* The original reset text remains visible in the error. */ }
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
export function providerResetAt(original, now = Date.now()) {
|
|
40
|
+
const text = cleanProviderText(original);
|
|
41
|
+
const absolute = text.match(/\b(?:resets?_at|resetAt|resetsAt)["']?\s*[:=]\s*["']?([^\s,"'}]+)/i);
|
|
42
|
+
if (absolute) {
|
|
43
|
+
const at = epoch(absolute[1], now);
|
|
44
|
+
if (at !== undefined)
|
|
45
|
+
return at;
|
|
46
|
+
}
|
|
47
|
+
const retry = text.match(/\b(retry_after_ms|retryAfterMs|retry_after_seconds|retry_after|resets?_in_seconds)["']?\s*[:=]\s*["']?(\d+(?:\.\d+)?(?:e[+-]?\d+)?)/i);
|
|
48
|
+
if (retry) {
|
|
49
|
+
const delay = Number(retry[2]) * (/ms$/i.test(retry[1]) ? 1 : 1000);
|
|
50
|
+
if (delay > 0 && validResetAt(now + delay))
|
|
51
|
+
return now + delay;
|
|
52
|
+
}
|
|
53
|
+
const relative = text.match(/\b(?:resets? in|try again in|retry after)\s+((?:\d+(?:\.\d+)?\s*(?:hours?|hrs?|h|minutes?|mins?|m|seconds?|secs?|s)\s*)+)/i);
|
|
54
|
+
if (relative) {
|
|
55
|
+
let delay = 0;
|
|
56
|
+
for (const part of relative[1].matchAll(/(\d+(?:\.\d+)?)\s*(h\w*|m\w*|s\w*)/gi)) {
|
|
57
|
+
delay += Number(part[1]) * (/^h/i.test(part[2]) ? 3_600_000 : /^m/i.test(part[2]) ? 60_000 : 1000);
|
|
58
|
+
}
|
|
59
|
+
if (delay > 0 && validResetAt(now + delay))
|
|
60
|
+
return now + delay;
|
|
61
|
+
}
|
|
62
|
+
const iso = text.match(/\bresets?\s+(?:at\s+|on\s+)?(\d{4}-\d{2}-\d{2}T[\d:.]+(?:Z|[+-]\d{2}:?\d{2}))/i);
|
|
63
|
+
if (iso)
|
|
64
|
+
return epoch(iso[1], now);
|
|
65
|
+
const clock = text.match(/\bresets?\s+(?:at\s+)?(\d{1,2})(?::(\d{2}))?\s*(am|pm)?(?:\s*\(([^)]+)\))?/i);
|
|
66
|
+
if (!clock || (!clock[2] && !clock[3]))
|
|
67
|
+
return undefined;
|
|
68
|
+
let hour = Number(clock[1]);
|
|
69
|
+
if (clock[3]) {
|
|
70
|
+
if (hour < 1 || hour > 12)
|
|
71
|
+
return undefined;
|
|
72
|
+
hour = hour % 12 + (/pm/i.test(clock[3]) ? 12 : 0);
|
|
73
|
+
}
|
|
74
|
+
return nextClockTime(hour, Number(clock[2] ?? 0), clock[4]?.trim(), now);
|
|
75
|
+
}
|
|
76
|
+
// Preserve reset metadata when an SSE error is converted into a readable string.
|
|
77
|
+
export function errorTimingDetail(raw) {
|
|
78
|
+
if (!raw || typeof raw !== "object")
|
|
79
|
+
return "";
|
|
80
|
+
const allowed = ["resets_at", "reset_at", "resetAt", "retry_after", "retry_after_seconds", "retry_after_ms"];
|
|
81
|
+
const fields = Object.fromEntries(Object.entries(raw).filter(([key, value]) => allowed.includes(key) && (typeof value === "string" || typeof value === "number")));
|
|
82
|
+
return Object.keys(fields).length ? ` ${JSON.stringify(fields)}` : "";
|
|
83
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { PlanLimits, PlanLimitWindow } from "../core/types.js";
|
|
2
|
+
export declare function rejectedQuotaWindows(limits?: PlanLimits): readonly PlanLimitWindow[];
|
|
3
|
+
export declare function quotaResetAt(limits?: PlanLimits): number | undefined;
|
|
4
|
+
export declare function quotaLimitsFromError(providerId: string, original: string, limits?: PlanLimits, now?: number): PlanLimits | undefined;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { cleanProviderText, providerResetAt, validResetAt } from "./provider-reset.js";
|
|
2
|
+
export function rejectedQuotaWindows(limits) {
|
|
3
|
+
// A rejected overage allowance does not mean the included plan is exhausted.
|
|
4
|
+
return limits?.windows.filter(w => w.status === "rejected" && !w.id.startsWith("overage")) ?? [];
|
|
5
|
+
}
|
|
6
|
+
export function quotaResetAt(limits) {
|
|
7
|
+
const times = rejectedQuotaWindows(limits).map(w => w.resetAt).filter((at) => at !== undefined && validResetAt(at));
|
|
8
|
+
return times.length ? Math.max(...times) : undefined;
|
|
9
|
+
}
|
|
10
|
+
// Called only for a provider error already classified as quota exhaustion.
|
|
11
|
+
// A reset alone does not identify a 5h window; preserve an unknown window then.
|
|
12
|
+
export function quotaLimitsFromError(providerId, original, limits, now = Date.now()) {
|
|
13
|
+
const text = cleanProviderText(original);
|
|
14
|
+
const resetAt = providerResetAt(text, now);
|
|
15
|
+
const session = /\b(?:5[ -]?(?:h(?:our)?s?)|five[ -]hours?)\b/i.test(text)
|
|
16
|
+
|| (providerId === "claude-code" && /\bsession[_\s-]*limit/i.test(text));
|
|
17
|
+
const weekly = /\bweekly[_\s-]*limit/i.test(text);
|
|
18
|
+
const id = session ? "5h" : weekly ? "7d" : undefined;
|
|
19
|
+
const label = session ? "Limite 5 ore" : weekly ? "Settimanale" : "Quota provider";
|
|
20
|
+
const windows = [...(limits?.windows ?? [])];
|
|
21
|
+
const index = windows.findIndex(w => (id && (w.id === id || w.label === label))
|
|
22
|
+
|| (!id && w.status === "rejected" && !w.id.startsWith("overage")));
|
|
23
|
+
if (index >= 0) {
|
|
24
|
+
const previous = windows[index];
|
|
25
|
+
windows[index] = { ...previous, status: "rejected", ...(previous.resetAt === undefined && resetAt !== undefined ? { resetAt } : {}) };
|
|
26
|
+
}
|
|
27
|
+
else if (id || (resetAt !== undefined && !rejectedQuotaWindows(limits).length)) {
|
|
28
|
+
windows.push({ id: id ?? "quota", label, status: "rejected", unit: "percent", ...(resetAt !== undefined ? { resetAt } : {}) });
|
|
29
|
+
}
|
|
30
|
+
if (!windows.length)
|
|
31
|
+
return limits;
|
|
32
|
+
return { providerId, windows, capturedAt: limits?.capturedAt ?? now };
|
|
33
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Provider } from "../core/types.js";
|
|
2
|
+
export interface Resolved {
|
|
3
|
+
readonly provider: Provider;
|
|
4
|
+
readonly modelId: string;
|
|
5
|
+
}
|
|
6
|
+
export interface ParsedModelId {
|
|
7
|
+
readonly provider?: string;
|
|
8
|
+
readonly vendor?: string;
|
|
9
|
+
readonly model: string;
|
|
10
|
+
readonly modelId?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function parseModelId(model: string): ParsedModelId;
|
|
13
|
+
export declare class ProviderRegistry {
|
|
14
|
+
private readonly providers;
|
|
15
|
+
register(provider: Provider): void;
|
|
16
|
+
remove(id: string): boolean;
|
|
17
|
+
get(id: string): Provider | undefined;
|
|
18
|
+
list(): readonly Provider[];
|
|
19
|
+
has(): boolean;
|
|
20
|
+
resolve(model: string): Resolved | null;
|
|
21
|
+
firstAvailableModel(): string | null;
|
|
22
|
+
}
|
|
23
|
+
export declare function resolveStartupModel(registry: ProviderRegistry, desired: string): {
|
|
24
|
+
readonly model: string;
|
|
25
|
+
readonly fellBack: boolean;
|
|
26
|
+
};
|
|
27
|
+
export declare function providerEnvKeys(env: NodeJS.ProcessEnv, id: string): string[];
|
|
28
|
+
export declare function proxyUrl(env: NodeJS.ProcessEnv): string | undefined;
|
|
29
|
+
export declare function parseCustomModels(env: NodeJS.ProcessEnv): Map<string, string[]>;
|
|
30
|
+
export interface RegistryOptions {
|
|
31
|
+
readonly detectOAuth?: boolean;
|
|
32
|
+
}
|
|
33
|
+
export declare function defaultRegistry(env: NodeJS.ProcessEnv, opts?: RegistryOptions): ProviderRegistry;
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { AnthropicProvider } from "./anthropic.js";
|
|
2
|
+
import { AnthropicOAuthProvider } from "./anthropic-oauth.js";
|
|
3
|
+
import { OpenAIOAuthProvider } from "./openai-oauth.js";
|
|
4
|
+
import { OpenAICompatProvider } from "./openai-compat.js";
|
|
5
|
+
import { readClaudeCreds, readCodexCreds } from "./oauth-store.js";
|
|
6
|
+
import { readOpenRouterCreds } from "./openrouter-auth.js";
|
|
7
|
+
import { PROVIDER_CATALOG } from "./catalog.js";
|
|
8
|
+
import { retryConfigFromEnv, withRetry } from "./retry.js";
|
|
9
|
+
// Scompone un identificatore di modello a uno/due/tre (o piu') segmenti.
|
|
10
|
+
// Funzione PURA: non tocca il registro; serve per display, validazione e per
|
|
11
|
+
// la risoluzione. Segmenti vuoti (es. "a//b", slash iniziale/finale) vengono
|
|
12
|
+
// ignorati, cosi' l'input resta robusto.
|
|
13
|
+
export function parseModelId(model) {
|
|
14
|
+
const raw = typeof model === "string" ? model.trim() : "";
|
|
15
|
+
const segments = raw.split("/").map((s) => s.trim()).filter(Boolean);
|
|
16
|
+
if (segments.length <= 1) {
|
|
17
|
+
return { model: segments[0] ?? "" };
|
|
18
|
+
}
|
|
19
|
+
const provider = segments[0];
|
|
20
|
+
const lastModel = segments[segments.length - 1];
|
|
21
|
+
const modelId = segments.slice(1).join("/");
|
|
22
|
+
if (segments.length === 2) {
|
|
23
|
+
return { provider, model: lastModel, modelId };
|
|
24
|
+
}
|
|
25
|
+
// 3+ segmenti: il vendor e' il secondo, il model e' l'ultimo. Il modelId
|
|
26
|
+
// conserva l'intera coda dopo il provider (es. "z-ai/glm-5.2").
|
|
27
|
+
const vendor = segments[1];
|
|
28
|
+
return { provider, vendor, model: lastModel, modelId };
|
|
29
|
+
}
|
|
30
|
+
// Registro dei provider configurati. La selezione del modello e' LIBERA:
|
|
31
|
+
// si indica `provider/<modelId>` (es. openai/gpt-4o, anthropic/claude-opus-4-8,
|
|
32
|
+
// openrouter/google/gemini-2.5-flash, openrouter/z-ai/glm-5.2). Un modello noto
|
|
33
|
+
// puo' anche essere indicato nudo: viene cercato tra i provider.
|
|
34
|
+
export class ProviderRegistry {
|
|
35
|
+
providers = new Map();
|
|
36
|
+
register(provider) {
|
|
37
|
+
this.providers.set(provider.id, provider);
|
|
38
|
+
}
|
|
39
|
+
// Rimuove un provider (es. unregisterProvider da estensione).
|
|
40
|
+
remove(id) {
|
|
41
|
+
return this.providers.delete(id);
|
|
42
|
+
}
|
|
43
|
+
get(id) {
|
|
44
|
+
return this.providers.get(id);
|
|
45
|
+
}
|
|
46
|
+
list() {
|
|
47
|
+
return [...this.providers.values()];
|
|
48
|
+
}
|
|
49
|
+
has() {
|
|
50
|
+
return this.providers.size > 0;
|
|
51
|
+
}
|
|
52
|
+
// Risolve "provider/modelId" oppure un modello noto nudo. Il parsing usa
|
|
53
|
+
// parseModelId: il primo segmento e' il provider, tutto cio' che segue (vendor
|
|
54
|
+
// incluso) e' il modelId che il provider riceve. Cosi' "openrouter/z-ai/glm-5.2"
|
|
55
|
+
// -> provider "openrouter", modelId "z-ai/glm-5.2" (i tre segmenti non rompono
|
|
56
|
+
// i due segmenti come "openai/gpt-4o").
|
|
57
|
+
resolve(model) {
|
|
58
|
+
const parsed = parseModelId(model);
|
|
59
|
+
if (parsed.provider && parsed.modelId) {
|
|
60
|
+
const provider = this.providers.get(parsed.provider);
|
|
61
|
+
if (provider)
|
|
62
|
+
return { provider, modelId: parsed.modelId };
|
|
63
|
+
}
|
|
64
|
+
// Modello nudo: il primo provider che lo dichiara. Confrontiamo sia con
|
|
65
|
+
// l'id completo passato, sia con il nome puro (model) ricavato dal parsing.
|
|
66
|
+
for (const p of this.providers.values()) {
|
|
67
|
+
if (p.models.includes(model) || p.models.includes(parsed.model)) {
|
|
68
|
+
return { provider: p, modelId: model };
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
// Modello di ripiego SENSATO quando quello desiderato non e' servito da
|
|
74
|
+
// nessun provider configurato. Invece di insistere su un default hardcodato
|
|
75
|
+
// (es. anthropic/claude-sonnet-4-6) che puo' non avere chiave, scegliamo il
|
|
76
|
+
// PRIMO modello realmente erogabile da un provider attivo, dando priorita'
|
|
77
|
+
// agli abbonamenti/anthropic (esperienza "stile Claude Code"). Ritorna l'id
|
|
78
|
+
// COMPLETO "provider/modello" (cosi' la risoluzione resta deterministica) o
|
|
79
|
+
// null se non c'e' alcun provider configurato.
|
|
80
|
+
firstAvailableModel() {
|
|
81
|
+
const priority = ["claude-code", "anthropic", "openai", "openrouter"];
|
|
82
|
+
const ordered = [...this.providers.values()].sort((a, b) => {
|
|
83
|
+
const ia = priority.indexOf(a.id);
|
|
84
|
+
const ib = priority.indexOf(b.id);
|
|
85
|
+
return (ia < 0 ? priority.length : ia) - (ib < 0 ? priority.length : ib);
|
|
86
|
+
});
|
|
87
|
+
for (const p of ordered) {
|
|
88
|
+
const first = p.models[0];
|
|
89
|
+
if (first)
|
|
90
|
+
return `${p.id}/${first}`;
|
|
91
|
+
}
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
// Sceglie il modello con cui PARTIRE: se quello desiderato (salvato/config) e'
|
|
96
|
+
// risolvibile lo si tiene; altrimenti si ripiega sul primo modello realmente
|
|
97
|
+
// disponibile tra i provider configurati. Non tocca alcun file: il modello
|
|
98
|
+
// salvato resta la PREFERENZA dell'utente e torna valido appena il suo provider
|
|
99
|
+
// e' di nuovo configurato. Ritorna anche `fellBack` per segnalarlo all'avvio.
|
|
100
|
+
export function resolveStartupModel(registry, desired) {
|
|
101
|
+
if (desired && registry.resolve(desired))
|
|
102
|
+
return { model: desired, fellBack: false };
|
|
103
|
+
const fallback = registry.firstAvailableModel();
|
|
104
|
+
if (fallback)
|
|
105
|
+
return { model: fallback, fellBack: true };
|
|
106
|
+
// Nessun provider configurato: lasciamo il desiderato cosi' com'e' (la TUI
|
|
107
|
+
// guidera' l'utente alla configurazione / scelta del modello).
|
|
108
|
+
return { model: desired, fellBack: false };
|
|
109
|
+
}
|
|
110
|
+
function localBase(env, envName, fallback) {
|
|
111
|
+
const raw = String(env[envName] ?? "").trim();
|
|
112
|
+
if (!raw)
|
|
113
|
+
return fallback;
|
|
114
|
+
return /\/v\d+\/?$/.test(raw) ? raw.replace(/\/$/, "") : `${raw.replace(/\/$/, "")}/v1`;
|
|
115
|
+
}
|
|
116
|
+
// Override per-provider: TALOS_<ID>_BASE_URL e TALOS_<ID>_API_KEY (selective
|
|
117
|
+
// base entry points + provider-scoped API key environments).
|
|
118
|
+
function providerEnvKey(env, id) {
|
|
119
|
+
const norm = id.toUpperCase().replace(/[^A-Z0-9]/g, "_");
|
|
120
|
+
return String(env[`TALOS_${norm}_API_KEY`] ?? "").trim();
|
|
121
|
+
}
|
|
122
|
+
export function providerEnvKeys(env, id) {
|
|
123
|
+
const norm = id.toUpperCase().replace(/[^A-Z0-9]/g, "_");
|
|
124
|
+
const primary = providerEnvKey(env, id);
|
|
125
|
+
const raw = String(env[`TALOS_${norm}_API_KEYS`] ?? "").trim();
|
|
126
|
+
let values = [];
|
|
127
|
+
if (raw) {
|
|
128
|
+
try {
|
|
129
|
+
const parsed = JSON.parse(raw);
|
|
130
|
+
if (Array.isArray(parsed))
|
|
131
|
+
values = parsed.map((item) => String(item ?? "").trim()).filter(Boolean);
|
|
132
|
+
}
|
|
133
|
+
catch {
|
|
134
|
+
values = raw.split(/[\r\n,;]+/).map((item) => item.trim()).filter(Boolean);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
return [...new Set([primary, ...values].filter(Boolean))];
|
|
138
|
+
}
|
|
139
|
+
function providerEnvBaseUrl(env, id) {
|
|
140
|
+
const norm = id.toUpperCase().replace(/[^A-Z0-9]/g, "_");
|
|
141
|
+
return String(env[`TALOS_${norm}_BASE_URL`] ?? "").trim();
|
|
142
|
+
}
|
|
143
|
+
// Proxy HTTP globale: TALOS_HTTP_PROXY (o HTTPS_PROXY/HTTP_PROXY). Bun e undici
|
|
144
|
+
// onorano HTTPS_PROXY/HTTP_PROXY dall'ambiente per fetch.
|
|
145
|
+
export function proxyUrl(env) {
|
|
146
|
+
const v = String(env["TALOS_HTTP_PROXY"] ?? env["HTTPS_PROXY"] ?? env["HTTP_PROXY"] ?? "").trim();
|
|
147
|
+
return v || undefined;
|
|
148
|
+
}
|
|
149
|
+
// Modelli aggiuntivi per provider: TALOS_CUSTOM_MODELS="openai:o9,xai:grok-latest".
|
|
150
|
+
export function parseCustomModels(env) {
|
|
151
|
+
const out = new Map();
|
|
152
|
+
for (const pair of String(env["TALOS_CUSTOM_MODELS"] ?? "").split(",").map((s) => s.trim()).filter(Boolean)) {
|
|
153
|
+
const sep = pair.indexOf(":");
|
|
154
|
+
if (sep <= 0)
|
|
155
|
+
continue;
|
|
156
|
+
const provider = pair.slice(0, sep).trim();
|
|
157
|
+
const model = pair.slice(sep + 1).trim();
|
|
158
|
+
if (!model)
|
|
159
|
+
continue;
|
|
160
|
+
out.set(provider, [...(out.get(provider) ?? []), model]);
|
|
161
|
+
}
|
|
162
|
+
return out;
|
|
163
|
+
}
|
|
164
|
+
// Costruisce il registro leggendo le chiavi dall'ambiente: un provider per
|
|
165
|
+
// ogni voce del catalogo che risulta configurata (chiave presente, o locale).
|
|
166
|
+
// In piu', se presenti, registra i provider ABBONAMENTO via OAuth (token dei
|
|
167
|
+
// CLI ufficiali claude/codex): id "claude-code" e "chatgpt".
|
|
168
|
+
export function defaultRegistry(env, opts = {}) {
|
|
169
|
+
const reg = new ProviderRegistry();
|
|
170
|
+
const customModels = parseCustomModels(env);
|
|
171
|
+
const retry = retryConfigFromEnv(env);
|
|
172
|
+
const add = (p) => reg.register(withRetry(p, retry));
|
|
173
|
+
for (const spec of PROVIDER_CATALOG) {
|
|
174
|
+
const extraModels = customModels.get(spec.id) ?? [];
|
|
175
|
+
if (spec.kind === "anthropic") {
|
|
176
|
+
const key = providerEnvKey(env, spec.id) || String(env[spec.envKey] ?? "").trim();
|
|
177
|
+
if (key)
|
|
178
|
+
add(new AnthropicProvider(key));
|
|
179
|
+
continue;
|
|
180
|
+
}
|
|
181
|
+
// OpenAI-compatibile. envKey vuoto = locale (Ollama), sempre incluso.
|
|
182
|
+
const scopedKeys = providerEnvKeys(env, spec.id);
|
|
183
|
+
const scopedKey = scopedKeys[0] ?? "";
|
|
184
|
+
let key = scopedKey || (spec.envKey ? String(env[spec.envKey] ?? "").trim() : "");
|
|
185
|
+
// OpenRouter: oltre all'env, accetta le credenziali su disco (OAuth PKCE o
|
|
186
|
+
// API key manuale, in ~/.talos/openrouter.json) cosi' che il metodo di
|
|
187
|
+
// accesso resti attivo anche senza OPENROUTER_API_KEY esportata.
|
|
188
|
+
if (!key && spec.id === "openrouter" && env["TALOS_NO_GLOBAL_CONFIG"] !== "1") {
|
|
189
|
+
key = readOpenRouterCreds(env)?.apiKey ?? "";
|
|
190
|
+
}
|
|
191
|
+
if (spec.envKey && !key)
|
|
192
|
+
continue;
|
|
193
|
+
const baseUrl = providerEnvBaseUrl(env, spec.id)
|
|
194
|
+
|| (spec.baseUrlEnv ? localBase(env, spec.baseUrlEnv, spec.defaultBaseUrl ?? "") : (spec.baseUrl ?? ""));
|
|
195
|
+
// Il connettore open source e' opt-in: compare nel catalogo guidato, ma
|
|
196
|
+
// entra nel runtime solo dopo che l'utente ha indicato il server reale.
|
|
197
|
+
if (spec.optionalEndpoint && !baseUrl)
|
|
198
|
+
continue;
|
|
199
|
+
const keyInput = spec.id === "openrouter" && scopedKeys.length > 1 ? scopedKeys : key;
|
|
200
|
+
add(new OpenAICompatProvider(spec.id, spec.label, baseUrl, keyInput, [...spec.models, ...extraModels]));
|
|
201
|
+
}
|
|
202
|
+
if (opts.detectOAuth !== false) {
|
|
203
|
+
const claude = readClaudeCreds(env);
|
|
204
|
+
if (claude)
|
|
205
|
+
add(new AnthropicOAuthProvider(claude, env));
|
|
206
|
+
if (env["TALOS_DISABLE_CHATGPT_OAUTH"] !== "1") {
|
|
207
|
+
const codex = readCodexCreds(env);
|
|
208
|
+
if (codex)
|
|
209
|
+
add(new OpenAIOAuthProvider(codex, env));
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
return reg;
|
|
213
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { CompletionRequest, ModelTurn, PlanLimits, Provider } from "../core/types.js";
|
|
2
|
+
export interface RetryConfig {
|
|
3
|
+
readonly maxRetries: number;
|
|
4
|
+
readonly baseDelayMs: number;
|
|
5
|
+
readonly timeoutMs: number;
|
|
6
|
+
readonly networkMaxRetries?: number;
|
|
7
|
+
readonly networkRetryDelayMs?: number;
|
|
8
|
+
readonly overloadMaxAttempts?: number;
|
|
9
|
+
readonly overloadBaseDelayMs?: number;
|
|
10
|
+
readonly overloadMaxDelayMs?: number;
|
|
11
|
+
}
|
|
12
|
+
export declare const DEFAULT_RETRY: RetryConfig;
|
|
13
|
+
export declare function retryConfigFromEnv(env: NodeJS.ProcessEnv): RetryConfig;
|
|
14
|
+
export declare function isNetworkError(text: string): boolean;
|
|
15
|
+
export declare function isUpstreamRouterError(text: string): boolean;
|
|
16
|
+
export declare function isTransientError(text: string): boolean;
|
|
17
|
+
export declare function isOverloadError(text: string): boolean;
|
|
18
|
+
export declare function retryAfterMs(text: string): number | undefined;
|
|
19
|
+
export declare function isQuotaError(text: string): boolean;
|
|
20
|
+
export declare function quotaMessage(providerId: string, original: string, limits?: PlanLimits): string;
|
|
21
|
+
export declare class RetryProvider implements Provider {
|
|
22
|
+
private readonly inner;
|
|
23
|
+
private readonly cfg;
|
|
24
|
+
constructor(inner: Provider, cfg: RetryConfig);
|
|
25
|
+
get id(): string;
|
|
26
|
+
get label(): string | undefined;
|
|
27
|
+
get models(): readonly string[];
|
|
28
|
+
get supportsFastMode(): boolean;
|
|
29
|
+
private get netMax();
|
|
30
|
+
private get netDelay();
|
|
31
|
+
private get overloadMaxAttempts();
|
|
32
|
+
private overloadDelay;
|
|
33
|
+
private waitForOverload;
|
|
34
|
+
complete(req: CompletionRequest): Promise<ModelTurn>;
|
|
35
|
+
private backoff;
|
|
36
|
+
}
|
|
37
|
+
export declare function withRetry(provider: Provider, cfg: RetryConfig): Provider;
|