pantheon-opencode 1.6.1 → 1.6.2-beta.2
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/AGENTS.global.md +11 -11
- package/AGENTS.md +2 -2
- package/CHANGELOG.md +29 -0
- package/README.md +100 -19
- package/README.pt-BR.md +27 -11
- package/bin/pantheon-init.mjs +106 -19
- package/package.json +3 -2
- package/plugin.json +1 -1
- package/pyproject.toml +1 -1
- package/scripts/build-agents-md.mjs +1 -1
- package/scripts/doctor.mjs +213 -45
- package/scripts/install/agents-md.mjs +2 -1
- package/scripts/install/config-migration.mjs +344 -393
- package/scripts/install/config-paths.mjs +15 -0
- package/scripts/install/mcp-permissions.mjs +164 -0
- package/scripts/install/opencode-version.mjs +31 -13
- package/scripts/install/opencode-wildcard.mjs +106 -0
- package/scripts/install/opencode.mjs +240 -69
- package/scripts/install/plan-artifact.mjs +12 -1
- package/scripts/install/plugin.mjs +17 -1
- package/scripts/install/v2-capabilities.mjs +5 -6
- package/scripts/package-evidence.mjs +1 -0
- package/scripts/sandbox-env.sh +174 -0
- package/scripts/setup-v2-config.mjs +1703 -0
- package/scripts/setup.mjs +415 -0
- package/scripts/sync-tui.mjs +9 -1
- package/scripts/test-opencode-v2-sandbox.sh +438 -151
- package/scripts/update-skills-lock.mjs +30 -0
- package/skills-lock.json +10 -10
- package/src/agents/aphrodite.md +5 -2
- package/src/agents/apollo.md +5 -0
- package/src/agents/athena.md +6 -1
- package/src/agents/demeter.md +5 -1
- package/src/agents/gaia.md +4 -0
- package/src/agents/hephaestus.md +6 -1
- package/src/agents/hermes.md +6 -3
- package/src/agents/iris.md +5 -1
- package/src/agents/mnemosyne.md +20 -50
- package/src/agents/nyx.md +5 -1
- package/src/agents/prometheus.md +4 -0
- package/src/agents/talos.md +4 -0
- package/src/agents/themis.md +4 -0
- package/src/agents/zeus.md +9 -3
- package/src/instructions/agent-return-format.instructions.md +1 -1
- package/src/instructions/memory-protocol.instructions.md +3 -3
- package/src/instructions/test-economy.instructions.md +6 -6
- package/src/mcp/pantheon_vision.py +37 -36
- package/src/pantheon/cost-command.ts +30 -133
- package/src/pantheon/model-pricing.ts +1 -536
- package/src/pantheon/v2-vision.ts +34 -29
- package/src/pantheon/vision.ts +43 -10
- package/src/plugin-v2.ts +30 -53
- package/src/plugins/tui/THIRD_PARTY_NOTICES.md +24 -0
- package/src/plugins/tui/dist/cost-data-CCZUs1aJ.js +749 -0
- package/src/plugins/tui/dist/cost-data-CCZUs1aJ.js.map +1 -0
- package/src/plugins/tui/dist/quota-adapters.d.ts +89 -0
- package/src/plugins/tui/dist/quota-adapters.d.ts.map +1 -0
- package/src/plugins/tui/dist/quota-adapters.js +1142 -0
- package/src/plugins/tui/dist/quota-adapters.js.map +1 -0
- package/src/plugins/tui/dist/quota-cli.d.ts +17 -0
- package/src/plugins/tui/dist/quota-cli.d.ts.map +1 -0
- package/src/plugins/tui/dist/quota-cli.js +184 -0
- package/src/plugins/tui/dist/quota-cli.js.map +1 -0
- package/src/plugins/tui/dist/quota-rpc-DMmXBhBe.js +684 -0
- package/src/plugins/tui/dist/quota-rpc-DMmXBhBe.js.map +1 -0
- package/src/plugins/tui/dist/server-v2.d.ts +14 -0
- package/src/plugins/tui/dist/server-v2.d.ts.map +1 -0
- package/src/plugins/tui/dist/server-v2.js +796 -0
- package/src/plugins/tui/dist/server-v2.js.map +1 -0
- package/src/plugins/tui/dist/tui-v2.d.ts +375 -53
- package/src/plugins/tui/dist/tui-v2.d.ts.map +1 -1
- package/src/plugins/tui/dist/tui-v2.js +5876 -530
- package/src/plugins/tui/dist/tui-v2.js.map +1 -1
- package/src/plugins/tui/dist/tui.js +1 -1
- package/src/plugins/tui/dist/usage-history-contract-nt1rnBPE.js +118 -0
- package/src/plugins/tui/dist/usage-history-contract-nt1rnBPE.js.map +1 -0
- package/src/plugins/tui/dist/usage-history-worker.js +25 -0
- package/src/plugins/tui/dist/usage-history-worker.js.map +1 -0
- package/src/plugins/tui/index-v2.ts +3 -6
- package/src/plugins/tui/package-lock.json +17 -2
- package/src/plugins/tui/package.json +6 -3
- package/src/plugins/tui/src/context-gauge.ts +59 -0
- package/src/plugins/tui/src/cost-data.ts +607 -0
- package/src/plugins/tui/src/go-key-diagnostic-ui.ts +100 -0
- package/src/plugins/tui/src/go-key-diagnostic.ts +125 -0
- package/src/plugins/tui/src/index-v2.tsx +231 -240
- package/src/plugins/tui/src/model-pricing.ts +536 -0
- package/src/plugins/tui/src/model-usage-limits.ts +4 -0
- package/src/plugins/tui/src/quota-adapters.ts +1598 -0
- package/src/plugins/tui/src/quota-cli.ts +237 -0
- package/src/plugins/tui/src/quota-rpc.ts +373 -0
- package/src/plugins/tui/src/quota-v2-model.ts +1032 -0
- package/src/plugins/tui/src/quota-v2.tsx +1238 -0
- package/src/plugins/tui/src/server-v2.ts +985 -0
- package/src/plugins/tui/src/sidebar-width.ts +129 -0
- package/src/plugins/tui/src/usage-history-contract.ts +217 -0
- package/src/plugins/tui/src/usage-history-validation.ts +104 -0
- package/src/plugins/tui/src/usage-history-view.tsx +236 -0
- package/src/plugins/tui/src/usage-history-worker.ts +25 -0
- package/src/plugins/tui/src/usage-view-model.ts +272 -0
- package/src/plugins/tui/tsconfig.typecheck.json +6 -1
- package/src/plugins/tui/tsdown.config.ts +44 -5
- package/src/routing.yml +72 -13
- package/src/skills/README.md +4 -0
- package/src/skills/agent-coordination/SKILL.md +0 -3
- package/src/skills/artifact-management/SKILL.md +0 -3
- package/src/skills/auto-continue/SKILL.md +0 -3
- package/src/skills/code-review-checklist/SKILL.md +0 -3
- package/src/skills/context-compression/SKILL.md +0 -3
- package/src/skills/memory-bank/SKILL.md +6 -28
- package/src/skills/session-goal/SKILL.md +0 -3
- package/src/skills/simplify/SKILL.md +5 -4
- package/src/skills/tdd-with-agents/SKILL.md +0 -3
- package/src/skills/visual-review-pipeline/SKILL.md +0 -1
- package/src/pantheon/memory-context.ts +0 -1017
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server-v2.js","names":[],"sources":["../src/go-key-diagnostic.ts","../src/server-v2.ts"],"sourcesContent":["/** Deliberately excludes response bodies, provider messages, and credential data. */\nexport type GoKeyDiagnosticResult = {\n category:\n | 'not_run'\n | 'already_used'\n | 'success'\n | 'unauthorized'\n | 'redirect'\n | 'http_error'\n | 'timeout'\n | 'network_error'\n status?: number\n content_type?: 'application/json' | 'text/plain' | 'text/html' | 'other' | 'missing'\n error_structure?: 'present' | 'absent' | 'unavailable'\n}\n\n/** Parse at most 4 KiB; inspect only own top-level error presence, never its value. */\nasync function errorStructure(\n body: ReadableStream<Uint8Array> | null,\n signal: AbortSignal,\n): Promise<NonNullable<GoKeyDiagnosticResult['error_structure']>> {\n if (!body) return 'unavailable'\n let reader: ReadableStreamDefaultReader<Uint8Array> | undefined\n let abort: () => void = () => {}\n let complete = false\n try {\n reader = body.getReader()\n const aborted = new Promise<never>((_, reject) => {\n abort = () => reject(new Error('aborted'))\n signal.addEventListener('abort', abort, { once: true })\n })\n const bytes = new Uint8Array(4096)\n let length = 0\n while (true) {\n signal.throwIfAborted()\n const { done, value } = await Promise.race([reader.read(), aborted])\n if (done) {\n complete = true\n break\n }\n if (value.byteLength > bytes.length - length) return 'unavailable'\n bytes.set(value, length)\n length += value.byteLength\n }\n const parsed: unknown = JSON.parse(\n new TextDecoder('utf-8', { fatal: true }).decode(bytes.subarray(0, length)),\n )\n if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) return 'unavailable'\n return Object.hasOwn(parsed, 'error') ? 'present' : 'absent'\n } catch {\n // Untrusted parse/stream errors may contain body text; never forward or log them.\n return 'unavailable'\n } finally {\n signal.removeEventListener('abort', abort)\n if (!complete) void (reader ? reader.cancel() : body.cancel()).catch(() => {})\n reader?.releaseLock()\n }\n}\n\n/** One explicit invocation per plugin runtime, including failed/no-credential attempts. */\nexport function createGoKeyDiagnostic() {\n let attempted = false\n return async (\n resolveKey: () => Promise<string | undefined>,\n signal: AbortSignal,\n ): Promise<GoKeyDiagnosticResult> => {\n if (attempted) return { category: 'already_used' }\n // Claim synchronously, before credential resolution or any other await.\n attempted = true\n let key: string | undefined\n try {\n key = await resolveKey()\n } catch {\n return { category: 'not_run' }\n }\n if (!key || signal.aborted) return { category: 'not_run' }\n\n const timeout = AbortSignal.timeout(5_000)\n const requestSignal = AbortSignal.any([signal, timeout])\n try {\n const response = await fetch('https://opencode.ai/zen/go/v1/usage', {\n method: 'GET',\n headers: {\n Authorization: `Bearer ${key}`,\n 'x-opencode-session': 'pantheon-quota',\n 'user-agent': 'Pantheon-Quota/1.0',\n },\n redirect: 'manual',\n signal: requestSignal,\n })\n const mediaType = response.headers.get('content-type')?.split(';', 1)[0]?.trim().toLowerCase()\n const contentType = !mediaType\n ? 'missing'\n : mediaType === 'application/json' ||\n mediaType === 'text/plain' ||\n mediaType === 'text/html'\n ? mediaType\n : 'other'\n let structure: GoKeyDiagnosticResult['error_structure']\n if (response.status === 401 && contentType === 'application/json') {\n structure = await errorStructure(response.body, requestSignal)\n } else {\n // Cancel without reading and never inspect Location.\n void response.body?.cancel().catch(() => {})\n if (response.status === 401) structure = 'unavailable'\n }\n return {\n category:\n response.status === 401\n ? 'unauthorized'\n : response.status >= 300 && response.status < 400\n ? 'redirect'\n : response.ok\n ? 'success'\n : 'http_error',\n status: response.status,\n content_type: contentType,\n ...(structure ? { error_structure: structure } : {}),\n }\n } catch {\n // Fetch errors can include headers, URLs, or provider body text. Never forward/log them.\n return { category: timeout.aborted ? 'timeout' : 'network_error' }\n }\n }\n}\n","import { Worker } from 'node:worker_threads'\nimport { Plugin } from '@opencode/plugin'\nimport type { Context } from '@opencode/plugin/promise/plugin'\nimport type { RpcCallContext, RpcRegistration } from '@opencode/plugin/promise/rpc'\nimport { estimateActiveContextCost } from './cost-data'\nimport { createGoKeyDiagnostic } from './go-key-diagnostic'\nimport {\n isOpenAICodexOAuthMethod,\n isOpenCodeConsoleOAuthMethod,\n QUOTA_PROVIDER_CATALOG,\n type QuotaAdapterContext,\n type QuotaMetric,\n runQuotaAdapter,\n} from './quota-adapters'\nimport { queryAlibabaTokenPlanUsage } from './quota-cli'\nimport {\n type OpenCodeGoRouteKind,\n QUOTA_PROVIDER_IDS,\n type QuotaProviderId,\n quotaRpc,\n} from './quota-rpc'\nimport {\n isUsageHistoryPeriod,\n MAX_HISTORY_QUERY_MS,\n type UsageHistoryRpcResult,\n} from './usage-history-contract'\n\nconst CREDENTIAL_CACHE_TTL_MS = 30_000\nconst ADAPTER_CACHE_TTL_MS = 20_000\n\nfunction queryUsageHistoryInWorker(\n period: string,\n signal: AbortSignal,\n): Promise<UsageHistoryRpcResult> {\n if (!isUsageHistoryPeriod(period)) {\n return Promise.resolve({ status: 'unavailable', reason: 'invalid_period' })\n }\n return new Promise((resolve, reject) => {\n let settled = false\n let worker: Worker\n try {\n worker = new Worker(new URL('./usage-history-worker.js', import.meta.url), {\n workerData: { period },\n resourceLimits: { maxOldGenerationSizeMb: 64, stackSizeMb: 2 },\n })\n } catch {\n resolve({ status: 'unavailable', reason: 'history_unavailable' })\n return\n }\n let timer: ReturnType<typeof setTimeout>\n\n const onAbort = (): void => {\n if (settled) return\n settled = true\n clearTimeout(timer)\n signal.removeEventListener('abort', onAbort)\n void worker.terminate()\n reject(new DOMException('Usage history request aborted', 'AbortError'))\n }\n const finish = (result: UsageHistoryRpcResult): void => {\n if (settled) return\n settled = true\n clearTimeout(timer)\n signal.removeEventListener('abort', onAbort)\n void worker.terminate()\n resolve(result)\n }\n\n timer = setTimeout(() => {\n finish({ status: 'unavailable', reason: 'history_timeout' })\n }, MAX_HISTORY_QUERY_MS)\n signal.addEventListener('abort', onAbort, { once: true })\n worker.once('message', (message: unknown) => {\n if (\n typeof message === 'object' &&\n message !== null &&\n 'ok' in message &&\n message.ok === true &&\n 'result' in message &&\n typeof message.result === 'object' &&\n message.result !== null\n ) {\n finish(message.result as UsageHistoryRpcResult)\n return\n }\n finish({ status: 'unavailable', reason: 'history_unavailable' })\n })\n worker.once('error', () => finish({ status: 'unavailable', reason: 'history_unavailable' }))\n worker.once('exit', () => {\n if (!settled) finish({ status: 'unavailable', reason: 'history_unavailable' })\n })\n if (signal.aborted) onAbort()\n })\n}\n\ntype ResolvedCredential = {\n readonly method?: 'oauth' | 'key' | 'unsupported'\n readonly routeKind?: OpenCodeGoRouteKind\n /** Only adapters receive this secret; blocked sources retain only method status. */\n readonly secret?: string\n /** OpenCode Go's fixed API-key fallback after its Console OAuth request fails. */\n readonly fallbackSecret?: string\n /** A tiny, non-secret projection of OAuth metadata required by fixed adapters. */\n readonly adapterContext?: QuotaAdapterContext\n}\ntype CachedCredential = {\n readonly result: ResolvedCredential\n readonly expiresAt: number\n readonly expiryTimer: ReturnType<typeof setTimeout>\n}\ntype ProviderStatus = {\n provider: QuotaProviderId\n label: string\n scope: 'account' | 'selected_key' | 'team' | 'session'\n authentication: 'connected' | 'not_connected' | 'unavailable'\n state: 'available' | 'needs_setup' | 'unavailable'\n reason:\n | 'none'\n | 'not_connected'\n | 'unsupported'\n | 'private_endpoint'\n | 'eligibility_unverified'\n | 'runtime_accounting_unavailable'\n | 'cli_identity_unavailable'\n | 'unsupported_credential_method'\n | 'provider_error'\n | 'not_subscribed'\n | 'rate_limited'\n | 'unauthorized'\n | 'forbidden'\n | 'timeout'\n | 'network_error'\n | 'invalid_response'\n retry_after_ms?: number\n route_kind?: OpenCodeGoRouteKind\n metrics: QuotaMetric[]\n}\n\nconst PROVIDER_IDS = QUOTA_PROVIDER_IDS\n\nfunction safeMetadataValue(\n metadata: Record<string, unknown> | undefined,\n names: readonly string[],\n): string | undefined {\n if (!metadata) return undefined\n for (const name of names) {\n const value = metadata[name]\n if (typeof value === 'string' && value.length <= 128 && /^[A-Za-z0-9._:-]+$/.test(value)) {\n return value\n }\n }\n return undefined\n}\n\nfunction projectAdapterContext(\n provider: QuotaProviderId,\n metadata: unknown,\n methodID: unknown,\n): QuotaAdapterContext | undefined {\n if (provider === 'openai') {\n if (isOpenAICodexOAuthMethod(methodID)) return { methodID }\n return undefined\n }\n if (provider === 'opencode-go') {\n if (!isOpenCodeConsoleOAuthMethod(methodID)) return undefined\n if (typeof metadata !== 'object' || metadata === null || Array.isArray(metadata)) {\n return { methodID }\n }\n const record = metadata as Record<string, unknown>\n if (record.orgID === undefined || record.orgID === null) return { methodID }\n if (typeof record.orgID !== 'string' || !/^[A-Za-z0-9_-]{1,128}$/.test(record.orgID)) {\n return undefined\n }\n return { methodID, orgId: record.orgID }\n }\n if (typeof metadata !== 'object' || metadata === null || Array.isArray(metadata)) return undefined\n const record = metadata as Record<string, unknown>\n const projectId = safeMetadataValue(record, ['projectID', 'projectId', 'quotaProjectId'])\n const accountId = safeMetadataValue(record, ['accountID', 'accountId'])\n const orgId = safeMetadataValue(record, ['orgID', 'orgId'])\n if (!projectId && !accountId && !orgId) return undefined\n return {\n ...(projectId ? { projectId } : {}),\n ...(accountId ? { accountId } : {}),\n ...(orgId ? { orgId } : {}),\n }\n}\n\n/**\n * Accept only the official OpenCode Console default and its retired alias.\n * The selected Console token is never sent to a credential-supplied host.\n */\nfunction isApprovedOpenCodeConsoleServer(metadata: unknown): boolean {\n if (typeof metadata !== 'object' || metadata === null || Array.isArray(metadata)) return true\n const record = metadata as Record<string, unknown>\n if (!Object.hasOwn(record, 'server')) return true\n const server = record.server\n if (typeof server !== 'string' || server.length === 0 || server.length > 2_048) return false\n if (server.trim() !== server) return false\n\n let url: URL\n try {\n url = new URL(server)\n } catch {\n return false\n }\n if (\n url.protocol !== 'https:' ||\n url.username !== '' ||\n url.password !== '' ||\n url.port !== '' ||\n url.search !== '' ||\n url.hash !== ''\n ) {\n return false\n }\n\n const path = url.pathname.replace(/\\/$/, '')\n if (url.hostname === 'opencode.ai') return path === '/console'\n return url.hostname === 'console.opencode.ai' && (path === '' || path === '/console')\n}\n\nfunction routeKindField(\n provider: QuotaProviderId,\n credential?: ResolvedCredential,\n effectiveRouteKind?: OpenCodeGoRouteKind,\n): { route_kind?: OpenCodeGoRouteKind } {\n return provider === 'opencode-go'\n ? { route_kind: effectiveRouteKind ?? credential?.routeKind ?? 'none' }\n : {}\n}\n\n/**\n * OpenCode Go follows the upstream quota plugin's key order: process environment, the\n * effective OpenCode provider settings, then a selected OpenCode API-key connection.\n * Provider settings are read through the host API; Pantheon never parses OpenCode files.\n */\nasync function configuredOpenCodeGoApiKey(context: Context): Promise<string | undefined> {\n const environmentKey = process.env.OPENCODE_API_KEY?.trim()\n if (environmentKey) return environmentKey\n\n for (const providerID of ['opencode-go', 'opencode']) {\n let value: unknown\n try {\n value = (await context.provider.get({ providerID })).data.settings?.apiKey\n } catch {\n continue\n }\n if (typeof value !== 'string') continue\n const configured = value.trim()\n if (!configured) continue\n\n const environmentTemplate = configured.match(/^\\{env:([A-Za-z_][A-Za-z0-9_]*)\\}$/)\n if (environmentTemplate) {\n if (environmentTemplate[1] !== 'OPENCODE_API_KEY') continue\n const resolved = process.env.OPENCODE_API_KEY?.trim()\n if (resolved) return resolved\n continue\n }\n if (configured.startsWith('{env:')) continue\n return configured\n }\n return undefined\n}\n\n/**\n * Resolve only listed, selected credential connections in the closed provider\n * catalog. Only the minimum access-token/key field is retained in memory.\n */\nfunction createCredentialResolver(context: Context) {\n const cache = new Map<QuotaProviderId, CachedCredential>()\n const pending = new Map<QuotaProviderId, Promise<ResolvedCredential>>()\n let integrations: Map<string, Set<string>> | undefined\n let integrationListPending: Promise<Map<string, Set<string>>> | undefined\n let generation = 0\n let disposed = false\n\n function clearCache(): void {\n for (const cached of cache.values()) clearTimeout(cached.expiryTimer)\n cache.clear()\n integrations = undefined\n integrationListPending = undefined\n }\n\n async function listCredentialConnections(): Promise<Map<string, Set<string>>> {\n if (integrations) return integrations\n if (integrationListPending) return integrationListPending\n const startedAtGeneration = generation\n let request: Promise<Map<string, Set<string>>>\n request = context.integration\n .list()\n .then((value) => {\n const connectionsByIntegration = new Map<string, Set<string>>()\n for (const integration of value.data) {\n const connections = new Set<string>()\n if (Array.isArray(integration.connections)) {\n for (const connection of integration.connections) {\n if (connection.type === 'credential') {\n connections.add(`${connection.id}\\0${connection.method}`)\n }\n }\n }\n connectionsByIntegration.set(integration.id, connections)\n }\n if (!disposed && generation === startedAtGeneration) integrations = connectionsByIntegration\n return connectionsByIntegration\n })\n .finally(() => {\n if (integrationListPending === request) integrationListPending = undefined\n })\n integrationListPending = request\n return request\n }\n\n async function load(provider: QuotaProviderId, goKeyOnly = false): Promise<ResolvedCredential> {\n const definition = QUOTA_PROVIDER_CATALOG[provider]\n // Quota visibility is tied to a selected OpenCode credential connection;\n // local CLI identity is outside that credential context.\n if (definition.source === 'local-cli') return {}\n const configuredGoKey =\n provider === 'opencode-go' ? await configuredOpenCodeGoApiKey(context) : undefined\n if (goKeyOnly && configuredGoKey) {\n return { method: 'key', secret: configuredGoKey, routeKind: 'api_key' }\n }\n try {\n let listedConnections: Map<string, Set<string>>\n try {\n listedConnections = await listCredentialConnections()\n } catch (error) {\n // A configured OpenCode Go key can still be used if integration discovery fails.\n // Without it, retain the normal selected-connection error behavior.\n if (provider !== 'opencode-go' || !configuredGoKey) throw error\n listedConnections = new Map()\n }\n if (provider === 'opencode-go') {\n const activeListed = async (integrationID: string) => {\n const connections = listedConnections.get(integrationID)\n if (!connections || connections.size === 0) return undefined\n const active = await context.integration.connection.active(integrationID)\n if (active?.type !== 'credential' || !connections.has(`${active.id}\\0${active.method}`)) {\n return undefined\n }\n return active\n }\n\n let consoleCredential: ResolvedCredential | undefined\n let unsupportedConsoleLogin = false\n if (!goKeyOnly) {\n let activeConsole: Awaited<ReturnType<typeof activeListed>>\n try {\n activeConsole = await activeListed('opencode')\n } catch {\n // A Console lookup failure must not prevent using a selected Go API key.\n }\n if (activeConsole?.method === 'oauth' && activeConsole.status?.status !== 'needs_auth') {\n try {\n const resolved = await context.integration.connection.resolve(activeConsole)\n if (\n resolved?.type === 'oauth' &&\n resolved.access.trim().length > 0 &&\n isOpenCodeConsoleOAuthMethod(resolved.methodID) &&\n isApprovedOpenCodeConsoleServer(resolved.metadata)\n ) {\n const adapterContext = projectAdapterContext(\n provider,\n resolved.metadata,\n resolved.methodID,\n )\n if (adapterContext) {\n consoleCredential = {\n method: 'oauth',\n secret: resolved.access.trim(),\n routeKind: 'console_oauth',\n adapterContext,\n }\n } else {\n unsupportedConsoleLogin = true\n }\n } else if (resolved?.type === 'oauth') {\n unsupportedConsoleLogin = true\n }\n } catch {\n // A failed Console sign-in is allowed to fall through to a listed API key.\n }\n } else if (activeConsole?.method === 'oauth') {\n unsupportedConsoleLogin = activeConsole.status?.status !== 'needs_auth'\n }\n }\n\n let activePrimary: Awaited<ReturnType<typeof activeListed>>\n if (!configuredGoKey) {\n try {\n activePrimary = await activeListed('opencode-go')\n } catch {\n // An API-key lookup failure must not discard an already resolved Console login.\n }\n }\n const unsupportedPrimaryLogin =\n !configuredGoKey && activePrimary !== undefined && activePrimary.method !== 'key'\n let apiKey = configuredGoKey\n for (const integrationID of configuredGoKey ? [] : ['opencode-go', 'opencode']) {\n let active: Awaited<ReturnType<typeof activeListed>>\n try {\n active =\n integrationID === 'opencode-go' ? activePrimary : await activeListed(integrationID)\n } catch {\n // A failed key lookup does not invalidate another selected credential.\n continue\n }\n if (!active) continue\n if (goKeyOnly && active.method !== 'key') return {}\n if (active.method !== 'key' || active.status?.status === 'needs_auth') continue\n try {\n const resolved = await context.integration.connection.resolve(active)\n if (resolved?.type === 'key' && resolved.key.trim().length > 0) {\n apiKey = resolved.key.trim()\n break\n }\n } catch {\n // Try the next explicitly selected OpenCode API-key integration.\n }\n }\n\n if (consoleCredential) {\n return {\n ...consoleCredential,\n ...(apiKey ? { fallbackSecret: apiKey } : {}),\n }\n }\n if (apiKey) return { method: 'key', secret: apiKey, routeKind: 'api_key' }\n if (unsupportedConsoleLogin || unsupportedPrimaryLogin) {\n return { method: 'unsupported', routeKind: 'unsupported' }\n }\n return {}\n }\n\n const integrationIDs = [\n definition.integrationID,\n ...(definition.fallbackIntegrationIDs ?? []),\n ]\n for (const integrationID of integrationIDs) {\n const integrationConnections = listedConnections.get(integrationID)\n if (!integrationConnections || integrationConnections.size === 0) continue\n\n const active = await context.integration.connection.active(integrationID)\n if (active?.type !== 'credential') continue\n const isListedActiveConnection = integrationConnections.has(\n `${active.id}\\0${active.method}`,\n )\n if (!isListedActiveConnection) continue\n // The manual diagnostic must not even resolve an OAuth connection.\n if (goKeyOnly && active.method !== 'key') return {}\n if (active.status?.status === 'needs_auth') continue\n\n if (active.method !== 'oauth' && active.method !== 'key') {\n continue\n }\n if (!definition.methods.includes(active.method)) continue\n\n const resolved = await context.integration.connection.resolve(active)\n if (\n active.method === 'oauth' &&\n resolved?.type === 'oauth' &&\n resolved.access.trim().length > 0\n ) {\n const accessToken = resolved.access\n if (!accessToken) return {}\n if (provider === 'opencode-zen' && !isApprovedOpenCodeConsoleServer(resolved.metadata)) {\n return { method: 'unsupported' }\n }\n const adapterContext = projectAdapterContext(\n provider,\n resolved.metadata,\n resolved.methodID,\n )\n return {\n method: 'oauth',\n ...(definition.adapter ? { secret: accessToken } : {}),\n ...(adapterContext ? { adapterContext } : {}),\n }\n }\n if (active.method === 'key' && resolved?.type === 'key') {\n if (resolved.key.trim().length === 0) return {}\n if (!definition.adapter) return { method: 'key' }\n if (resolved.key.length > 0) return { method: 'key', secret: resolved.key }\n }\n return {}\n }\n return {}\n } catch {\n // Host errors may contain credentials, provider data, or arbitrary thrown metadata.\n console.warn('[pantheon-tui quota] credential resolution failed (exception)')\n throw new Error('Credential resolution failed')\n }\n }\n\n return {\n async resolveActiveGoKey(): Promise<string | undefined> {\n if (disposed) return undefined\n // Fresh resolution avoids a stale selected key and never falls back to Console OAuth.\n const startedAtGeneration = generation\n const credential = await load('opencode-go', true)\n if (disposed || generation !== startedAtGeneration) return undefined\n return credential.method === 'key' && credential.routeKind === 'api_key'\n ? credential.secret\n : undefined\n },\n async resolve(provider: QuotaProviderId): Promise<ResolvedCredential> {\n if (disposed) return {}\n const now = Date.now()\n const cached = cache.get(provider)\n if (cached && cached.expiresAt > now) return cached.result\n if (cached) {\n clearTimeout(cached.expiryTimer)\n cache.delete(provider)\n }\n const existing = pending.get(provider)\n if (existing) return existing\n\n const startedAtGeneration = generation\n let resolution: Promise<ResolvedCredential>\n resolution = load(provider)\n .then((result) => {\n if (disposed || generation !== startedAtGeneration) return {}\n const expiresAt = Date.now() + CREDENTIAL_CACHE_TTL_MS\n const expiryTimer = setTimeout(() => {\n if (cache.get(provider)?.expiryTimer === expiryTimer) cache.delete(provider)\n }, CREDENTIAL_CACHE_TTL_MS)\n expiryTimer.unref()\n cache.set(provider, { result, expiresAt, expiryTimer })\n return result\n })\n .finally(() => {\n if (pending.get(provider) === resolution) pending.delete(provider)\n })\n pending.set(provider, resolution)\n return resolution\n },\n currentGeneration(): number {\n return generation\n },\n isCurrent(version: number): boolean {\n return !disposed && generation === version\n },\n invalidate(): void {\n generation += 1\n clearCache()\n pending.clear()\n },\n dispose(): void {\n disposed = true\n generation += 1\n clearCache()\n pending.clear()\n },\n }\n}\n\nfunction isQuotaSourceInvalidationEvent(type: string): boolean {\n return (\n type === 'credential.updated' ||\n type === 'credential.switched' ||\n type === 'integration.updated' ||\n type === 'provider.updated'\n )\n}\n\nfunction createAdapterExecutor(\n shutdownSignal: AbortSignal,\n queryCli: typeof queryAlibabaTokenPlanUsage,\n) {\n const MAX_CONCURRENCY = 3\n type AdapterOutcome = Awaited<ReturnType<typeof runQuotaAdapter>>\n type PendingAdapter = {\n controller: AbortController\n callers: Set<symbol>\n settled: boolean\n promise: Promise<AdapterOutcome>\n }\n const cache = new Map<QuotaProviderId, { expiresAt: number; result: AdapterOutcome }>()\n const pending = new Map<QuotaProviderId, PendingAdapter>()\n const cooldown = new Map<QuotaProviderId, number>()\n let activeRequests = 0\n let generation = 0\n const waiters: Array<{\n signal: AbortSignal\n resolve: (release: (() => void) | undefined) => void\n onAbort: () => void\n }> = []\n let invalidationController = new AbortController()\n\n function releaseRequest(): () => void {\n let released = false\n return () => {\n if (released) return\n released = true\n while (waiters.length > 0) {\n const waiter = waiters.shift()\n if (!waiter) break\n waiter.signal.removeEventListener('abort', waiter.onAbort)\n if (waiter.signal.aborted) {\n waiter.resolve(undefined)\n continue\n }\n waiter.resolve(releaseRequest())\n return\n }\n activeRequests -= 1\n }\n }\n\n function acquireRequest(signal: AbortSignal): Promise<(() => void) | undefined> {\n if (signal.aborted) return Promise.resolve(undefined)\n if (activeRequests < MAX_CONCURRENCY) {\n activeRequests += 1\n return Promise.resolve(releaseRequest())\n }\n return new Promise((resolve) => {\n const waiter = {\n signal,\n resolve,\n onAbort: () => {\n const index = waiters.indexOf(waiter)\n if (index >= 0) waiters.splice(index, 1)\n resolve(undefined)\n },\n }\n waiters.push(waiter)\n signal.addEventListener('abort', waiter.onAbort, { once: true })\n })\n }\n\n function subscribe(entry: PendingAdapter, requestSignal: AbortSignal): Promise<AdapterOutcome> {\n requestSignal.throwIfAborted()\n const caller = Symbol()\n entry.callers.add(caller)\n return new Promise((resolve, reject) => {\n let detached = false\n const detach = () => {\n if (detached) return\n detached = true\n requestSignal.removeEventListener('abort', onAbort)\n entry.callers.delete(caller)\n if (!entry.settled && entry.callers.size === 0) entry.controller.abort()\n }\n const onAbort = () => {\n detach()\n reject(requestSignal.reason)\n }\n requestSignal.addEventListener('abort', onAbort, { once: true })\n if (requestSignal.aborted) {\n onAbort()\n return\n }\n entry.promise.then(\n (result) => {\n detach()\n resolve(result)\n },\n (error: unknown) => {\n detach()\n reject(error)\n },\n )\n })\n }\n\n return {\n async run(\n provider: QuotaProviderId,\n secret: string | undefined,\n requestSignal: AbortSignal,\n adapterContext?: QuotaAdapterContext,\n fallbackSecret?: string,\n ) {\n requestSignal.throwIfAborted()\n const now = Date.now()\n const until = cooldown.get(provider)\n if (until !== undefined && until > now) {\n return { reason: 'rate_limited' as const, retryAfterMs: until - now }\n }\n const cached = cache.get(provider)\n if (cached && cached.expiresAt > now) return cached.result\n const existing = pending.get(provider)\n if (existing && !existing.controller.signal.aborted) return subscribe(existing, requestSignal)\n if (existing) pending.delete(provider)\n\n const startedAtGeneration = generation\n const controller = new AbortController()\n const signal = AbortSignal.any([\n shutdownSignal,\n invalidationController.signal,\n controller.signal,\n ])\n const entry: PendingAdapter = {\n controller,\n callers: new Set(),\n settled: false,\n promise: Promise.resolve({ reason: 'provider_error' }),\n }\n pending.set(provider, entry)\n entry.promise = acquireRequest(signal)\n .then(async (release) => {\n if (!release) return { reason: 'provider_error' as const }\n try {\n return await runQuotaAdapter(\n provider,\n secret,\n signal,\n queryCli,\n adapterContext,\n fallbackSecret,\n )\n } finally {\n release()\n }\n })\n .then((result) => {\n if (generation === startedAtGeneration && !signal.aborted && 'state' in result) {\n cache.set(provider, {\n expiresAt: Date.now() + ADAPTER_CACHE_TTL_MS,\n result,\n })\n } else if (\n generation === startedAtGeneration &&\n 'reason' in result &&\n result.reason === 'rate_limited' &&\n result.retryAfterMs !== undefined\n ) {\n cooldown.set(provider, Date.now() + result.retryAfterMs)\n }\n return result\n })\n .finally(() => {\n entry.settled = true\n if (pending.get(provider) === entry) pending.delete(provider)\n })\n return subscribe(entry, requestSignal)\n },\n invalidate(): void {\n generation += 1\n invalidationController.abort()\n invalidationController = new AbortController()\n cache.clear()\n pending.clear()\n cooldown.clear()\n },\n }\n}\n\nasync function getProviderStatus(\n resolver: ReturnType<typeof createCredentialResolver>,\n adapters: ReturnType<typeof createAdapterExecutor>,\n requestSignal: AbortSignal,\n): Promise<{ providers: ProviderStatus[]; credential_resolution_failed?: true }> {\n requestSignal.throwIfAborted()\n let credentialResolutionFailed = false\n const results = await Promise.all(\n PROVIDER_IDS.map(async (provider): Promise<ProviderStatus | undefined> => {\n const definition = QUOTA_PROVIDER_CATALOG[provider]\n try {\n requestSignal.throwIfAborted()\n const credentialGeneration = resolver.currentGeneration()\n let credential: ResolvedCredential\n try {\n credential = await resolver.resolve(provider)\n } catch {\n requestSignal.throwIfAborted()\n credentialResolutionFailed = true\n return undefined\n }\n requestSignal.throwIfAborted()\n if (!credential.method) return undefined\n if (!resolver.isCurrent(credentialGeneration)) {\n return {\n provider,\n label: definition.label,\n scope: definition.scope,\n authentication: 'unavailable',\n state: 'unavailable',\n reason: 'provider_error',\n ...routeKindField(provider, credential),\n metrics: [],\n }\n }\n if (\n credential.method === 'unsupported' ||\n !definition.methods.includes(credential.method)\n ) {\n return {\n provider,\n label: definition.label,\n scope: definition.scope,\n authentication: 'connected',\n state: 'unavailable',\n reason: 'unsupported_credential_method',\n ...routeKindField(provider, credential),\n metrics: [],\n }\n }\n if (!definition.adapter) {\n return {\n provider,\n label: definition.label,\n scope: definition.scope,\n authentication: 'connected',\n state: 'unavailable',\n reason: definition.blockedReason ?? 'unsupported',\n ...routeKindField(provider, credential),\n metrics: [],\n }\n }\n if (!credential.secret) {\n return {\n provider,\n label: definition.label,\n scope: definition.scope,\n authentication: 'unavailable',\n state: 'unavailable',\n reason: 'provider_error',\n ...routeKindField(provider, credential),\n metrics: [],\n }\n }\n const result = await adapters.run(\n provider,\n credential.secret,\n requestSignal,\n credential.adapterContext,\n credential.fallbackSecret,\n )\n requestSignal.throwIfAborted()\n if (!resolver.isCurrent(credentialGeneration)) {\n return {\n provider,\n label: definition.label,\n scope: definition.scope,\n authentication: 'unavailable',\n state: 'unavailable',\n reason: 'provider_error',\n ...routeKindField(provider, credential),\n metrics: [],\n }\n }\n if ('state' in result) {\n return {\n provider,\n label: definition.label,\n scope: definition.scope,\n authentication: 'connected',\n state: 'available',\n reason: 'none',\n ...routeKindField(provider, credential, result.routeKind),\n metrics: result.metrics,\n }\n }\n return {\n provider,\n label: definition.label,\n scope: definition.scope,\n authentication: 'connected',\n state: 'unavailable',\n reason: result.reason,\n ...routeKindField(provider, credential, result.routeKind),\n ...(result.retryAfterMs === undefined\n ? {}\n : { retry_after_ms: Math.ceil(result.retryAfterMs) }),\n metrics: [],\n }\n } catch {\n requestSignal.throwIfAborted()\n return {\n provider,\n label: definition.label,\n scope: definition.scope,\n authentication: 'unavailable',\n state: 'unavailable',\n reason: 'provider_error',\n ...routeKindField(provider),\n metrics: [],\n }\n }\n }),\n )\n const providers = results.filter((provider): provider is ProviderStatus => provider !== undefined)\n return {\n providers,\n ...(credentialResolutionFailed ? { credential_resolution_failed: true as const } : {}),\n }\n}\n\nexport function createQuotaPlugin(\n queryCli: typeof queryAlibabaTokenPlanUsage = queryAlibabaTokenPlanUsage,\n) {\n const goKeyDiagnostic = createGoKeyDiagnostic()\n return Plugin.define({\n id: 'pantheon.tui.server',\n async setup(context: Context) {\n const resolver = createCredentialResolver(context)\n const shutdownController = new AbortController()\n const adapters = createAdapterExecutor(shutdownController.signal, queryCli)\n const eventController = new AbortController()\n let registration: RpcRegistration<typeof quotaRpc> | undefined\n const eventTask = (async () => {\n try {\n for await (const event of context.event.subscribe({ signal: eventController.signal })) {\n if (isQuotaSourceInvalidationEvent(event.type)) {\n resolver.invalidate()\n adapters.invalidate()\n if (registration) {\n try {\n await registration.events.emit('credentials_changed', {})\n } catch {\n console.warn(\n 'Quota credential-change notification failed; periodic refresh remains active',\n )\n }\n }\n }\n }\n } catch {\n if (!eventController.signal.aborted) {\n resolver.invalidate()\n adapters.invalidate()\n }\n }\n })()\n\n try {\n registration = await context.rpc.register(quotaRpc, {\n go_key_diagnostic: async (_input, callContext) =>\n goKeyDiagnostic(\n () => resolver.resolveActiveGoKey(),\n AbortSignal.any([callContext.signal, shutdownController.signal]),\n ),\n status: async (_input, callContext: RpcCallContext<typeof quotaRpc.methods.status>) =>\n getProviderStatus(resolver, adapters, callContext.signal),\n usage_history: async (\n input,\n callContext: RpcCallContext<typeof quotaRpc.methods.usage_history>,\n ) => {\n callContext.signal.throwIfAborted()\n const period = (input as { period: string }).period\n return queryUsageHistoryInWorker(\n period,\n AbortSignal.any([callContext.signal, shutdownController.signal]),\n )\n },\n active_context_cost: async (\n input,\n callContext: RpcCallContext<typeof quotaRpc.methods.active_context_cost>,\n ) => {\n callContext.signal.throwIfAborted()\n return estimateActiveContextCost(\n input as {\n providerID: string | null\n modelID: string | null\n contextTokens: number | null\n },\n )\n },\n })\n } catch (error) {\n console.warn('[pantheon-tui quota] quota RPC registration failed:', error)\n eventController.abort()\n shutdownController.abort()\n resolver.dispose()\n adapters.invalidate()\n await eventTask\n throw error\n }\n\n return async () => {\n eventController.abort()\n shutdownController.abort()\n resolver.dispose()\n adapters.invalidate()\n await eventTask\n await registration?.dispose()\n }\n },\n })\n}\n\nexport default createQuotaPlugin()\n"],"mappings":";;;;;;;;;AAiBA,eAAe,eACb,MACA,QACgE;CAChE,IAAI,CAAC,MAAM,OAAO;CAClB,IAAI;CACJ,IAAI,cAA0B,CAAC;CAC/B,IAAI,WAAW;CACf,IAAI;EACF,SAAS,KAAK,UAAU;EACxB,MAAM,UAAU,IAAI,SAAgB,GAAG,WAAW;GAChD,cAAc,uBAAO,IAAI,MAAM,SAAS,CAAC;GACzC,OAAO,iBAAiB,SAAS,OAAO,EAAE,MAAM,KAAK,CAAC;EACxD,CAAC;EACD,MAAM,wBAAQ,IAAI,WAAW,IAAI;EACjC,IAAI,SAAS;EACb,OAAO,MAAM;GACX,OAAO,eAAe;GACtB,MAAM,EAAE,MAAM,UAAU,MAAM,QAAQ,KAAK,CAAC,OAAO,KAAK,GAAG,OAAO,CAAC;GACnE,IAAI,MAAM;IACR,WAAW;IACX;GACF;GACA,IAAI,MAAM,aAAa,MAAM,SAAS,QAAQ,OAAO;GACrD,MAAM,IAAI,OAAO,MAAM;GACvB,UAAU,MAAM;EAClB;EACA,MAAM,SAAkB,KAAK,MAC3B,IAAI,YAAY,SAAS,EAAE,OAAO,KAAK,CAAC,CAAC,CAAC,OAAO,MAAM,SAAS,GAAG,MAAM,CAAC,CAC5E;EACA,IAAI,CAAC,UAAU,OAAO,WAAW,YAAY,MAAM,QAAQ,MAAM,GAAG,OAAO;EAC3E,OAAO,OAAO,OAAO,QAAQ,OAAO,IAAI,YAAY;CACtD,QAAQ;EAEN,OAAO;CACT,UAAU;EACR,OAAO,oBAAoB,SAAS,KAAK;EACzC,IAAI,CAAC,UA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{ Context, KeymapLayer, PanelInput } from "@opencode/plugin/tui/context";
|
|
1
|
+
import { Accessor, JSX } from "solid-js";
|
|
2
|
+
import { Context, KeymapCommand, KeymapLayer, PanelInput } from "@opencode/plugin/tui/context";
|
|
3
|
+
//#region src/context-gauge.d.ts
|
|
4
|
+
/** Shared, data-only formatting and visual helpers for compact context gauges. */
|
|
5
|
+
type ContextProgressTone = 'info' | 'success' | 'warning' | 'error';
|
|
6
|
+
export declare const CONTEXT_BAR_CELLS = 12;
|
|
7
|
+
export declare const CONTEXT_BAR_FILLED_CELL = "▰";
|
|
8
|
+
export declare const CONTEXT_BAR_EMPTY_CELL = "▱";
|
|
9
|
+
export declare function contextUsageTone(percent: number): ContextProgressTone;
|
|
10
|
+
export declare function formatTokenCount(tokens: number | null | undefined): string | null;
|
|
11
|
+
export declare function formatContextWindow(limit: number | null | undefined): string | null;
|
|
12
|
+
export declare function contextBarFilled(percent: number, cells?: number): number;
|
|
13
|
+
export declare function contextBar(percent: number | null | undefined, cells?: number): {
|
|
14
|
+
filled: string;
|
|
15
|
+
empty: string;
|
|
16
|
+
} | null;
|
|
17
|
+
export declare function formatSpent(cost: number | null | undefined): string | null;
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/quota-v2-model.d.ts
|
|
20
|
+
type QuotaDisplay = 'used' | 'remaining';
|
|
21
|
+
type QuotaPreferences = {
|
|
22
|
+
enabled: boolean;
|
|
23
|
+
display: QuotaDisplay;
|
|
24
|
+
};
|
|
25
|
+
export declare const DEFAULT_QUOTA_PREFERENCES: QuotaPreferences;
|
|
26
|
+
type QuotaMetric = {
|
|
27
|
+
kind: 'provider_quota';
|
|
28
|
+
used: number;
|
|
29
|
+
remaining: number;
|
|
30
|
+
unit: string;
|
|
31
|
+
label?: string;
|
|
32
|
+
period?: string;
|
|
33
|
+
resetsAt?: number;
|
|
34
|
+
} | {
|
|
35
|
+
kind: 'balance';
|
|
36
|
+
amount: number;
|
|
37
|
+
currency: string;
|
|
38
|
+
label?: string;
|
|
39
|
+
status?: string;
|
|
40
|
+
} | {
|
|
41
|
+
kind: 'estimate';
|
|
42
|
+
amount: number;
|
|
43
|
+
unit: string;
|
|
44
|
+
label?: string;
|
|
45
|
+
} | {
|
|
46
|
+
kind: 'key_usage';
|
|
47
|
+
amount: number;
|
|
48
|
+
currency: string;
|
|
49
|
+
label?: string;
|
|
50
|
+
period?: string;
|
|
51
|
+
} | {
|
|
52
|
+
kind: 'session_usage';
|
|
53
|
+
amount: number;
|
|
54
|
+
unit: string;
|
|
55
|
+
label?: string;
|
|
56
|
+
} | {
|
|
57
|
+
kind: 'provider_status';
|
|
58
|
+
status: 'available' | 'unavailable' | 'active' | 'inactive';
|
|
59
|
+
label: string;
|
|
60
|
+
};
|
|
61
|
+
type QuotaProviderView = {
|
|
62
|
+
id: string;
|
|
63
|
+
label: string;
|
|
64
|
+
quotaState: 'available' | 'unavailable';
|
|
65
|
+
message?: string;
|
|
66
|
+
metrics: QuotaMetric[];
|
|
67
|
+
};
|
|
68
|
+
type QuotaProviderDetail = {
|
|
69
|
+
id: string;
|
|
70
|
+
label: string;
|
|
71
|
+
authentication: 'connected' | 'not_connected' | 'unavailable';
|
|
72
|
+
state: 'available' | 'needs_setup' | 'unavailable';
|
|
73
|
+
message?: string;
|
|
74
|
+
metrics: QuotaMetric[];
|
|
75
|
+
};
|
|
76
|
+
type QuotaSnapshotStatus = 'loading' | 'ready' | 'partial' | 'connected_unavailable' | 'needs_setup' | 'unavailable' | 'stale' | 'disabled';
|
|
77
|
+
type QuotaSnapshot = {
|
|
78
|
+
status: QuotaSnapshotStatus;
|
|
79
|
+
providers: QuotaProviderView[];
|
|
80
|
+
details: QuotaProviderDetail[];
|
|
81
|
+
updatedAt: number | null;
|
|
82
|
+
/** Short diagnostic of the latest transport/RPC failure; absent after a successful refresh. */
|
|
83
|
+
error?: string | undefined;
|
|
84
|
+
};
|
|
85
|
+
export declare const QUOTA_CLOCK_INTERVAL_MS = 60000;
|
|
86
|
+
type QuotaClockOptions = {
|
|
87
|
+
now?: () => number;
|
|
88
|
+
setInterval?: typeof globalThis.setInterval;
|
|
89
|
+
clearInterval?: typeof globalThis.clearInterval;
|
|
90
|
+
};
|
|
91
|
+
type QuotaClock = {
|
|
92
|
+
subscribe: (listener: (now: number) => void) => () => void;
|
|
93
|
+
};
|
|
94
|
+
/** Create a shared local clock for countdown displays; it never refreshes quota data. */
|
|
95
|
+
export declare function createQuotaClock(options?: QuotaClockOptions): QuotaClock;
|
|
96
|
+
/** Module-local clock shared by all countdown consumers in the TUI bundle. */
|
|
97
|
+
export declare const quotaClock: QuotaClock;
|
|
98
|
+
/** Format a provider-reported reset timestamp using the caller's local clock. */
|
|
99
|
+
export declare function formatQuotaCountdown(resetsAt: number | undefined, now: number): string | null | undefined;
|
|
100
|
+
type QuotaSidebarEntry = {
|
|
101
|
+
kind: 'quota';
|
|
102
|
+
key: string;
|
|
103
|
+
providerID: string;
|
|
104
|
+
providerLabel: string;
|
|
105
|
+
metric: Extract<QuotaMetric, {
|
|
106
|
+
kind: 'provider_quota';
|
|
107
|
+
}>;
|
|
108
|
+
progress: {
|
|
109
|
+
usedPercent: number;
|
|
110
|
+
remainingPercent: number;
|
|
111
|
+
};
|
|
112
|
+
} | {
|
|
113
|
+
kind: 'status';
|
|
114
|
+
key: string;
|
|
115
|
+
providerID: string;
|
|
116
|
+
providerLabel: string;
|
|
117
|
+
message: string;
|
|
118
|
+
};
|
|
119
|
+
type ModelContextSnapshot = {
|
|
120
|
+
tokens: number;
|
|
121
|
+
percent: number;
|
|
122
|
+
limit: number;
|
|
123
|
+
};
|
|
124
|
+
type RecentModelUsageRow = {
|
|
125
|
+
providerID: string | null;
|
|
126
|
+
modelID: string | null;
|
|
127
|
+
label: string;
|
|
128
|
+
tokens: number | null;
|
|
129
|
+
cost: number | null;
|
|
130
|
+
context: ModelContextSnapshot | null;
|
|
131
|
+
active: boolean;
|
|
132
|
+
};
|
|
133
|
+
type CollectRecentModelUsageInput = {
|
|
134
|
+
activeModel: unknown;
|
|
135
|
+
activeMessages: readonly unknown[];
|
|
136
|
+
usageMessages: readonly unknown[];
|
|
137
|
+
usageSessions?: readonly {
|
|
138
|
+
messages: readonly unknown[];
|
|
139
|
+
revertMessageID?: string | null;
|
|
140
|
+
}[];
|
|
141
|
+
models: readonly unknown[];
|
|
142
|
+
revertMessageID?: string | null;
|
|
143
|
+
};
|
|
144
|
+
/** Snapshot for one exact model identity in the bounded active transcript. */
|
|
145
|
+
export declare function resolveModelContextSnapshot(messages: readonly unknown[], modelRef: unknown, models: readonly unknown[], revertMessageID?: string | null): ModelContextSnapshot | null;
|
|
146
|
+
/** Select the pinned chat model before transcript or configured-agent fallbacks. */
|
|
147
|
+
export declare function resolveActiveModelRef(sessionModel: unknown, activeMessages: readonly unknown[], fallbackModel?: unknown): unknown;
|
|
148
|
+
/** Pin the active chat first, then rank two distinct models by summed reported
|
|
149
|
+
* tokens from the already-cached, bounded session-family messages. */
|
|
150
|
+
export declare function collectRecentModelUsageRows(input: CollectRecentModelUsageInput): RecentModelUsageRow[];
|
|
151
|
+
export declare function normalizeQuotaPreferences(value: unknown): QuotaPreferences;
|
|
152
|
+
export declare function quotaSnapshotStatusLabel(status: QuotaSnapshotStatus, error?: string | undefined): string;
|
|
153
|
+
/** Map the current typed RPC status into a provider-neutral, data-only UI model. */
|
|
154
|
+
export declare function quotaSnapshotFromStatus(response: unknown, now?: number): QuotaSnapshot;
|
|
155
|
+
/** Return complementary whole percentages only when both quota values define a real range. */
|
|
156
|
+
export declare function quotaProgress(metric: Extract<QuotaMetric, {
|
|
157
|
+
kind: 'provider_quota';
|
|
158
|
+
}>): {
|
|
159
|
+
usedPercent: number;
|
|
160
|
+
remainingPercent: number;
|
|
161
|
+
} | undefined;
|
|
162
|
+
/** Connected-provider rows for the compact sidebar; only reported quota windows are shown. */
|
|
163
|
+
export declare function quotaSidebarEntries(snapshot: QuotaSnapshot): QuotaSidebarEntry[];
|
|
164
|
+
/** Render each measurement with its source/category label; no category is inferred. */
|
|
165
|
+
export declare function formatQuotaMetric(metric: QuotaMetric, display: QuotaDisplay): string | undefined;
|
|
166
|
+
/** Compact one-value summary for the footer; quota display follows the setting. */
|
|
167
|
+
export declare function compactQuotaMetric(metric: QuotaMetric, display: QuotaDisplay): string | undefined;
|
|
168
|
+
type QuotaRuntime = {
|
|
169
|
+
preferences: () => QuotaPreferences;
|
|
170
|
+
snapshot: () => QuotaSnapshot;
|
|
171
|
+
toggleEnabled: () => Promise<void>;
|
|
172
|
+
toggleDisplay: () => Promise<void>;
|
|
173
|
+
refresh: () => Promise<void>;
|
|
174
|
+
dispose: () => void;
|
|
175
|
+
};
|
|
176
|
+
/** One storage-backed source of truth for all quota TUI surfaces. */
|
|
177
|
+
export declare function createQuotaRuntime(context: Pick<Context, 'client' | 'data' | 'location' | 'storage'>): QuotaRuntime;
|
|
178
|
+
//#endregion
|
|
179
|
+
//#region src/go-key-diagnostic-ui.d.ts
|
|
180
|
+
/** Native keyboard-accessible dialogs; never invoked by quota refresh or panel mounting. */
|
|
181
|
+
export declare function quotaGoCheckCommand(context: Pick<Context, 'ui' | 'client' | 'location' | 'data'>): KeymapCommand;
|
|
182
|
+
//#endregion
|
|
183
|
+
//#region src/model-usage-limits.d.ts
|
|
184
|
+
/** Shared bounds for cached recent model-usage aggregation. */
|
|
185
|
+
export declare const MODEL_USAGE_VISIBLE_CEILING = 3;
|
|
186
|
+
export declare const MODEL_USAGE_MESSAGE_LIMIT = 400;
|
|
187
|
+
export declare const MODEL_USAGE_SESSION_LIMIT = 8;
|
|
188
|
+
//#endregion
|
|
189
|
+
//#region src/quota-v2.d.ts
|
|
190
|
+
export declare const QUOTA_PANEL_NAME = "pantheon.quota";
|
|
191
|
+
export declare const QUOTA_OPEN_COMMAND_ID = "pantheon.quota.open";
|
|
192
|
+
type QuotaIconMode = 'nerd' | 'unicode' | 'ascii';
|
|
193
|
+
type QuotaIconName = 'check' | 'close' | 'clock' | 'gauge' | 'plug' | 'refresh' | 'settings' | 'sliders' | 'warning';
|
|
194
|
+
export declare function quotaIcon(name: QuotaIconName, mode?: QuotaIconMode): string;
|
|
195
|
+
export declare const QUOTA_ICON: string;
|
|
196
|
+
type QuotaSurfaceProps = {
|
|
197
|
+
context: Context;
|
|
198
|
+
runtime: QuotaRuntime;
|
|
199
|
+
};
|
|
200
|
+
export declare function quotaUsageTone(usedPercent: number): 'success' | 'warning' | 'error';
|
|
201
|
+
type QuotaTone = 'info' | 'success' | 'warning' | 'error';
|
|
202
|
+
export declare function snapshotSummary(snapshot: QuotaSnapshot, display: 'used' | 'remaining'): string;
|
|
203
|
+
type FinanceMetric = Extract<QuotaMetric, {
|
|
204
|
+
kind: 'balance' | 'estimate' | 'key_usage';
|
|
205
|
+
}>;
|
|
206
|
+
type FinanceEntry = {
|
|
207
|
+
providerID: string;
|
|
208
|
+
metric: FinanceMetric;
|
|
209
|
+
};
|
|
210
|
+
export declare function sidebarFinanceEntries(snapshot: QuotaSnapshot): FinanceEntry[];
|
|
211
|
+
type QuotaWindowMetric = Extract<QuotaMetric, {
|
|
212
|
+
kind: 'provider_quota';
|
|
213
|
+
}>;
|
|
214
|
+
/** Wrap on grapheme boundaries, measuring terminal cells rather than code units. */
|
|
215
|
+
export declare function quotaTextLines(text: string, width: number, indent: number): string[];
|
|
216
|
+
/** Layout uses only a provider-reported reset; a local clock never refreshes data. */
|
|
217
|
+
export declare function quotaWindowLines(metric: QuotaWindowMetric, display: 'used' | 'remaining', width: number, now: number, sidebarPercent?: boolean): string[];
|
|
218
|
+
export declare function financeMetricLines(metric: FinanceMetric, width: number): string[];
|
|
219
|
+
export declare function quotaMetricLines(metric: Exclude<QuotaMetric, {
|
|
220
|
+
kind: 'provider_quota';
|
|
221
|
+
}>, width: number): string[];
|
|
222
|
+
export declare function providerState(provider: QuotaProviderDetail, mode?: QuotaIconMode): {
|
|
223
|
+
label: string;
|
|
224
|
+
tone: QuotaTone;
|
|
225
|
+
};
|
|
226
|
+
export declare function activeQuotaModelLabel(row: RecentModelUsageRow | undefined): string;
|
|
227
|
+
export declare function quotaPanelStatusMessage(snapshot: Pick<QuotaSnapshot, 'status' | 'error'>): string | undefined;
|
|
228
|
+
type QuotaPanelAction = 'toggle-enabled' | 'toggle-display' | 'refresh' | 'close';
|
|
229
|
+
export declare const QUOTA_TABS: readonly ['usage', 'limits', 'plugin', 'settings'];
|
|
230
|
+
type QuotaTab = (typeof QUOTA_TABS)[number];
|
|
231
|
+
export declare const DEFAULT_QUOTA_TAB: QuotaTab;
|
|
232
|
+
export declare function moveQuotaTab(current: QuotaTab, direction: -1 | 1): QuotaTab;
|
|
233
|
+
export declare const QUOTA_PANEL_COMMANDS: readonly {
|
|
234
|
+
action: QuotaPanelAction;
|
|
235
|
+
id: string;
|
|
236
|
+
title: string;
|
|
237
|
+
bind: string;
|
|
238
|
+
}[];
|
|
239
|
+
export declare function runQuotaPanelCommand(action: QuotaPanelAction, panel: Pick<PanelInput, 'focused' | 'close'>, runtime: QuotaRuntime): false | Promise<void> | undefined;
|
|
240
|
+
export declare function quotaPanelKeymapLayer(panel: Pick<PanelInput, 'focused' | 'close'>, runtime: QuotaRuntime, onTabChange?: (direction: -1 | 1) => void): KeymapLayer;
|
|
241
|
+
export declare function quotaOpenCommand(context: Pick<Context, 'ui'>): KeymapCommand;
|
|
242
|
+
export declare function openQuotaPanel(context: Pick<Context, 'ui'>): boolean;
|
|
243
|
+
export declare function quotaTabLabel(tab: QuotaTab, mode?: QuotaIconMode): string;
|
|
244
|
+
export declare function QuotaPanel(props: QuotaSurfaceProps & {
|
|
245
|
+
panel: PanelInput;
|
|
246
|
+
}): JSX.Element;
|
|
247
|
+
//#endregion
|
|
248
|
+
//#region src/sidebar-width.d.ts
|
|
249
|
+
/** Terminal cells `value` occupies — the unit every column in this plugin is
|
|
250
|
+
* measured in. Mirrors the host (that is how `@opentui/core` sizes a text
|
|
251
|
+
* run): emoji count as two cells, East Asian Wide/Fullwidth as two, East
|
|
252
|
+
* Asian Ambiguous as one, combining marks and variation selectors as none.
|
|
253
|
+
* Pure. */
|
|
254
|
+
export declare function cellWidth(value: string): number;
|
|
255
|
+
//#endregion
|
|
256
|
+
//#region src/usage-history-view.d.ts
|
|
257
|
+
export declare function UsageHistorySection(props: {
|
|
258
|
+
context: Context;
|
|
259
|
+
panel: PanelInput;
|
|
260
|
+
width: number;
|
|
261
|
+
}): JSX.Element;
|
|
262
|
+
//#endregion
|
|
263
|
+
//#region src/usage-history-contract.d.ts
|
|
264
|
+
type UsageHistoryRpcPeriod = '7d' | '15d' | '30d' | 'total';
|
|
265
|
+
interface UsageHistoryRpcTotals {
|
|
266
|
+
input: number;
|
|
267
|
+
output: number;
|
|
268
|
+
cacheRead: number;
|
|
269
|
+
cacheWrite: number;
|
|
270
|
+
total: number;
|
|
271
|
+
}
|
|
272
|
+
interface UsageHistoryRpcBucket extends UsageHistoryRpcTotals {
|
|
273
|
+
date: string;
|
|
274
|
+
estimatedUsd?: number;
|
|
275
|
+
pricingComplete: boolean;
|
|
276
|
+
}
|
|
277
|
+
interface UsageHistoryRpcModel {
|
|
278
|
+
providerID: string;
|
|
279
|
+
modelID: string;
|
|
280
|
+
totals: UsageHistoryRpcTotals;
|
|
281
|
+
estimatedUsd?: number;
|
|
282
|
+
pricingComplete: boolean;
|
|
283
|
+
}
|
|
284
|
+
interface UsageHistoryRpcAvailable {
|
|
285
|
+
status: 'available' | 'partial';
|
|
286
|
+
period: UsageHistoryRpcPeriod;
|
|
287
|
+
coverageStart: string | null;
|
|
288
|
+
partial: boolean;
|
|
289
|
+
truncated: boolean;
|
|
290
|
+
rows: number;
|
|
291
|
+
buckets: UsageHistoryRpcBucket[];
|
|
292
|
+
totals: UsageHistoryRpcTotals;
|
|
293
|
+
models: UsageHistoryRpcModel[];
|
|
294
|
+
pricing: {
|
|
295
|
+
status: 'empty' | 'unavailable' | 'partial' | 'complete';
|
|
296
|
+
complete: boolean;
|
|
297
|
+
billed: false;
|
|
298
|
+
estimatedUsd?: number;
|
|
299
|
+
unpricedModels: number;
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
interface UsageHistoryRpcUnavailable {
|
|
303
|
+
status: 'unavailable';
|
|
304
|
+
reason: 'invalid_period' | 'history_unavailable' | 'history_timeout';
|
|
305
|
+
}
|
|
306
|
+
type UsageHistoryRpcResult = UsageHistoryRpcAvailable | UsageHistoryRpcUnavailable;
|
|
307
|
+
//#endregion
|
|
308
|
+
//#region src/usage-view-model.d.ts
|
|
309
|
+
type ActiveContextCostResult = {
|
|
310
|
+
status: 'estimated';
|
|
311
|
+
estimatedUsd: number;
|
|
312
|
+
billed: false;
|
|
313
|
+
basis: 'pre-cache-context-tokens-times-input-price';
|
|
314
|
+
cacheDiscountApplied: false;
|
|
315
|
+
} | {
|
|
316
|
+
status: 'unavailable';
|
|
317
|
+
billed: false;
|
|
318
|
+
basis: 'pre-cache-context-tokens-times-input-price';
|
|
319
|
+
cacheDiscountApplied: false;
|
|
320
|
+
reason: 'invalid-context-token-count' | 'missing-model-identity' | 'no-pricing' | 'unknown-model' | 'ambiguous-model' | 'missing-cache-price';
|
|
321
|
+
};
|
|
322
|
+
export declare const USAGE_HISTORY_PERIOD_BINDINGS: readonly [{
|
|
323
|
+
readonly period: '7d';
|
|
324
|
+
readonly bind: '7';
|
|
325
|
+
readonly label: '7d';
|
|
326
|
+
}, {
|
|
327
|
+
readonly period: '15d';
|
|
328
|
+
readonly bind: '1';
|
|
329
|
+
readonly label: '15d';
|
|
330
|
+
}, {
|
|
331
|
+
readonly period: '30d';
|
|
332
|
+
readonly bind: '3';
|
|
333
|
+
readonly label: '30d';
|
|
334
|
+
}, {
|
|
335
|
+
readonly period: 'total';
|
|
336
|
+
readonly bind: 't';
|
|
337
|
+
readonly label: 'total';
|
|
338
|
+
}];
|
|
339
|
+
export declare function usageHistoryTextLines(value: string, width: number): string[];
|
|
340
|
+
export declare function usageHistorySelectorLabel(selected: UsageHistoryRpcPeriod): string;
|
|
341
|
+
export declare function usageHistorySelectorLines(selected: UsageHistoryRpcPeriod, width: number): string[];
|
|
342
|
+
export declare function usageHistoryPeriodForKey(key: string): UsageHistoryRpcPeriod | undefined;
|
|
343
|
+
export declare function usageHistoryControlsLines(width: number): string[];
|
|
344
|
+
export declare function usageHistoryCoverageLabel(result: UsageHistoryRpcAvailable): string;
|
|
345
|
+
export declare function usageHistoryPartialWarning(result: UsageHistoryRpcAvailable): string | null;
|
|
346
|
+
export declare function usageHistoryPricingLabel(result: UsageHistoryRpcAvailable): string;
|
|
347
|
+
export declare function usageHistoryUnavailableMessage(result: UsageHistoryRpcResult): string | null;
|
|
348
|
+
export declare function usageHistoryEmptyMessage(): string;
|
|
349
|
+
export declare function usageHistoryChartLines(result: UsageHistoryRpcAvailable, width: number): string[];
|
|
350
|
+
export declare function activeModelIdentity(model: {
|
|
351
|
+
providerID: string | null;
|
|
352
|
+
modelID: string | null;
|
|
353
|
+
label: string;
|
|
354
|
+
}): string;
|
|
355
|
+
export declare function sessionSpendLabel(cost: number): string | null;
|
|
356
|
+
export declare function activeContextEstimateLines(result: ActiveContextCostResult, width: number): string[];
|
|
357
|
+
export declare function activeContextEstimatePendingLines(width: number): string[];
|
|
358
|
+
export declare function activeContextEstimateMissingLines(width: number): string[];
|
|
359
|
+
export declare function activeContextEstimateErrorLines(width: number): string[];
|
|
360
|
+
//#endregion
|
|
3
361
|
//#region src/index-v2.d.ts
|
|
4
362
|
/** Sidebar body shown while the host has not published a session yet. */
|
|
5
363
|
export declare const SIDEBAR_WAITING_LABEL = "Aguardando sessão…";
|
|
@@ -89,13 +447,6 @@ export declare function transcriptWindow(messages: readonly any[], revertMessage
|
|
|
89
447
|
* window wins. Null when there is no limit or no such message — the caller
|
|
90
448
|
* then omits the block. */
|
|
91
449
|
export declare function computeContextUsage(messages: readonly any[], contextLimit: number | null | undefined, revertMessageID?: string | null): ContextUsage | null;
|
|
92
|
-
/** Semantic tone for a context percentage, inclusive at the top of each band:
|
|
93
|
-
* info (blue) up to 25%, success (green) up to 50%, warning (yellow) up to
|
|
94
|
-
* 90%, error (red) above it. Four explicit stages, each backed by a feedback
|
|
95
|
-
* token, so the gauge follows the active theme. Pure. */
|
|
96
|
-
export declare function contextUsageTone(percent: number): ContextProgressTone;
|
|
97
|
-
/** The gauge's four stages, one per theme feedback token. */
|
|
98
|
-
export type ContextProgressTone = 'info' | 'success' | 'warning' | 'error';
|
|
99
450
|
/** Color for one gauge stage. Filled cells and the percent value both come from
|
|
100
451
|
* this one call, so the bar and its number can never disagree. `theme` is the
|
|
101
452
|
* host's resolved theme (loosely typed at runtime); a missing token falls back
|
|
@@ -137,33 +488,6 @@ export type ContextPerformance = {
|
|
|
137
488
|
cacheHit: number | null;
|
|
138
489
|
tokensPerSecond: number | null;
|
|
139
490
|
};
|
|
140
|
-
/** Thousands-separated token total: `55320` → `55,320` (en-US, matching the
|
|
141
|
-
* native block this one replaces). Null for a missing/invalid value. Pure. */
|
|
142
|
-
export declare function formatTokenCount(tokens: number | null | undefined): string | null;
|
|
143
|
-
/** Context-window label: `1_000_000` → `1.0M`, `200_000` → `200K`,
|
|
144
|
-
* `128_000` → `128K`, `32_768` → `32K`. Sub-million limits truncate to whole K
|
|
145
|
-
* so the printed window never overstates the model's capacity. Pure. */
|
|
146
|
-
export declare function formatContextWindow(limit: number | null | undefined): string | null;
|
|
147
|
-
/** Cells in the Context gauge: always rendered in full, so the bar never
|
|
148
|
-
* changes width between refreshes. With the space, the percent and the
|
|
149
|
-
* `of <window>` tail (at most 9 columns) the line stays inside 34 columns. */
|
|
150
|
-
export declare const CONTEXT_BAR_CELLS = 12;
|
|
151
|
-
/** Filled cell (U+25B0) and empty cell (U+25B1), both single-width. */
|
|
152
|
-
export declare const CONTEXT_BAR_FILLED_CELL = "▰";
|
|
153
|
-
export declare const CONTEXT_BAR_EMPTY_CELL = "▱";
|
|
154
|
-
/** Filled cells for a percentage: rounded, clamped to `0..cells`, so 0% is an
|
|
155
|
-
* empty bar and anything at or above 100% is a full one. Pure. */
|
|
156
|
-
export declare function contextBarFilled(percent: number, cells?: number): number;
|
|
157
|
-
/** The gauge split into its toned half (filled cells) and its muted half (empty
|
|
158
|
-
* cells), so the caller colors each side. Null when the percentage is missing:
|
|
159
|
-
* the Context block then keeps its tokens + cost rows and renders no bar. Pure. */
|
|
160
|
-
export declare function contextBar(percent: number | null | undefined, cells?: number): {
|
|
161
|
-
filled: string;
|
|
162
|
-
empty: string;
|
|
163
|
-
} | null;
|
|
164
|
-
/** USD spent with two decimals (`$0.18`), the native block's format. Null for
|
|
165
|
-
* a missing/negative value. Pure. */
|
|
166
|
-
export declare function formatSpent(cost: number | null | undefined): string | null;
|
|
167
491
|
/** One rendered context row. `lead` and `tail` carry the gauge bar when the row
|
|
168
492
|
* has one (`lead` is toned with the value, `tail` is muted), so the 12 cells
|
|
169
493
|
* stay contiguous while the empty half still reads as background. */
|
|
@@ -187,12 +511,6 @@ export type ContextBlockRows = {
|
|
|
187
511
|
* unavailable (never `undefined%`). A block with neither tokens nor cost
|
|
188
512
|
* yields null. Pure. */
|
|
189
513
|
export declare function contextBlockRows(usage: ContextUsage | null, cost: number | null | undefined): ContextBlockRows | null;
|
|
190
|
-
/** Models rendered in the Context block before the aggregate `… +N` line. */
|
|
191
|
-
export declare const MODEL_USAGE_VISIBLE_CEILING = 3;
|
|
192
|
-
/** Newest messages read per session — bounds the O(n) walk on long sessions. */
|
|
193
|
-
export declare const MODEL_USAGE_MESSAGE_LIMIT = 400;
|
|
194
|
-
/** Sessions read per family (root + delegations) for the aggregate. */
|
|
195
|
-
export declare const MODEL_USAGE_SESSION_LIMIT = 8;
|
|
196
514
|
/** Column widths for one model row (labels are muted, numbers right-aligned). */
|
|
197
515
|
export declare const MODEL_USAGE_MODEL_WIDTH = 12;
|
|
198
516
|
export declare const MODEL_USAGE_TOKEN_WIDTH = 6;
|
|
@@ -238,6 +556,14 @@ export type ModelUsageRow = {
|
|
|
238
556
|
export declare function modelUsageRows(rows: readonly ModelUsage[]): ModelUsageRow[];
|
|
239
557
|
/** Exact single-line text of a model row, with numbers right-aligned. Pure. */
|
|
240
558
|
export declare function modelUsageRowText(row: ModelUsageRow): string;
|
|
559
|
+
/** Wrap sidebar text by terminal cells, preserving the complete values. */
|
|
560
|
+
export declare function sidebarTextLines(value: string): string[];
|
|
561
|
+
/** Align a monetary value when it fits, otherwise preserve it on a new line. */
|
|
562
|
+
export declare function sidebarMoneyLines(label: string, value: string): string[];
|
|
563
|
+
/** Keep the existing OpenCode periods together when possible. */
|
|
564
|
+
export declare function contextSpendLines(value: string): string[];
|
|
565
|
+
/** Keep ordinary rows aligned; give oversized values their own lines. */
|
|
566
|
+
export declare function modelUsageRowLines(row: ModelUsageRow): string[];
|
|
241
567
|
/** Muted aggregate line for the models beyond the cap (`… +2 $0.03`). Null
|
|
242
568
|
* when every model fits. Pure. */
|
|
243
569
|
export declare function hiddenModelUsageText(hidden: number, hiddenCost: number): string | null;
|
|
@@ -429,17 +755,13 @@ export declare function statsRangeMatches(range: unknown, sent: {
|
|
|
429
755
|
from: number;
|
|
430
756
|
to: number;
|
|
431
757
|
}, scale: number): boolean;
|
|
432
|
-
/** The `Context` block's last line:
|
|
433
|
-
* (`hoje $0.42 · 30d $9.80`). A window without a
|
|
434
|
-
* no usable window at all yields null so the
|
|
435
|
-
* dropped. Pure. */
|
|
758
|
+
/** The `Context` block's last line: OpenCode stats source and both spend windows
|
|
759
|
+
* on one muted row (`OpenCode · hoje $0.42 · 30d $9.80`). A window without a
|
|
760
|
+
* usable amount is omitted, and no usable window at all yields null so the
|
|
761
|
+
* line (and not the block) is dropped. Pure. */
|
|
436
762
|
export declare function contextSpendLine(totals: SpendTotals | null): string | null;
|
|
437
|
-
/**
|
|
438
|
-
*
|
|
439
|
-
* run): emoji count as two cells, East Asian Wide/Fullwidth as two, East
|
|
440
|
-
* Asian Ambiguous as one, combining marks and variation selectors as none.
|
|
441
|
-
* Pure. */
|
|
442
|
-
export declare function cellWidth(value: string): number;
|
|
763
|
+
/** Grapheme iterator: a cut never splits a surrogate pair, a combining mark
|
|
764
|
+
* from its base or a ZWJ emoji sequence, so truncation stays cell-exact. */
|
|
443
765
|
/** Clamp a free-form label to `max` terminal cells without wrapping. The width
|
|
444
766
|
* is measured in display cells, never in UTF-16 code units: a CJK or emoji
|
|
445
767
|
* label used to overflow the column it was cut for (`計画の移行` is 5 code
|
|
@@ -1032,5 +1354,5 @@ declare const plugin: {
|
|
|
1032
1354
|
setup(context: Context): (() => void) | undefined;
|
|
1033
1355
|
};
|
|
1034
1356
|
//#endregion
|
|
1035
|
-
export { plugin as default };
|
|
1357
|
+
export { type ActiveContextCostResult, type ContextProgressTone, type QuotaIconMode, type QuotaIconName, type QuotaSidebarEntry, type QuotaTab, plugin as default };
|
|
1036
1358
|
//# sourceMappingURL=tui-v2.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tui-v2.d.ts","names":[],"sources":["../src/index-v2.tsx"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"tui-v2.d.ts","names":[],"sources":["../src/context-gauge.ts","../src/quota-v2-model.ts","../src/go-key-diagnostic-ui.ts","../src/model-usage-limits.ts","../src/quota-v2.tsx","../src/sidebar-width.ts","../src/usage-history-view.tsx","../src/usage-history-contract.ts","../src/usage-view-model.ts","../src/index-v2.tsx"],"mappings":";;;;KAEY;qBAEC;qBACA;qBACA;wBAMG,iBAAiB,kBAAkB;wBAOnC,iBAAiB;wBAMjB,oBAAoB;wBAQpB,iBAAiB,iBAAiB;wBAOlC,WACd,oCACA;EACG;EAAgB;;wBAWL,YAAY;;;KClDhB;KACA;EAAqB;EAAkB,SAAS;;qBAC/C,2BAA2B;KAE5B;EAEN;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;EAAiB;EAAgB;EAAkB;EAAgB;;EACnE;EAAkB;EAAgB;EAAc;;EAChD;EAAmB;EAAgB;EAAkB;EAAgB;;EACrE;EAAuB;EAAgB;EAAc;;EAErD;EACA;EACA;;KAGM;EACV;EACA;EACA;EACA;EACA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