pantheon-opencode 1.6.1 → 1.6.2-beta.1
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 +16 -0
- package/README.md +91 -19
- package/README.pt-BR.md +14 -9
- 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/v2-vision.ts +34 -29
- package/src/pantheon/vision.ts +43 -10
- package/src/plugin-v2.ts +30 -53
- 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-UL2HuFRJ.js +390 -0
- package/src/plugins/tui/dist/quota-rpc-UL2HuFRJ.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 +673 -0
- package/src/plugins/tui/dist/server-v2.js.map +1 -0
- package/src/plugins/tui/dist/tui-v2.d.ts +247 -52
- package/src/plugins/tui/dist/tui-v2.d.ts.map +1 -1
- package/src/plugins/tui/dist/tui-v2.js +2492 -529
- package/src/plugins/tui/dist/tui-v2.js.map +1 -1
- package/src/plugins/tui/dist/tui.js +1 -1
- package/src/plugins/tui/index-v2.ts +3 -6
- package/src/plugins/tui/package-lock.json +2 -2
- package/src/plugins/tui/package.json +3 -2
- package/src/plugins/tui/src/context-gauge.ts +59 -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 +199 -240
- 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 +209 -0
- package/src/plugins/tui/src/quota-v2-model.ts +1032 -0
- package/src/plugins/tui/src/quota-v2.tsx +986 -0
- package/src/plugins/tui/src/server-v2.ts +841 -0
- package/src/plugins/tui/src/sidebar-width.ts +129 -0
- package/src/plugins/tui/tsconfig.typecheck.json +1 -1
- package/src/plugins/tui/tsdown.config.ts +8 -1
- 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 { Plugin } from '@opencode/plugin'\nimport type { Context } from '@opencode/plugin/promise/plugin'\nimport type { RpcCallContext, RpcRegistration } from '@opencode/plugin/promise/rpc'\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'\n\nconst CREDENTIAL_CACHE_TTL_MS = 30_000\nconst ADAPTER_CACHE_TTL_MS = 20_000\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 * 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 try {\n const listedConnections = await listCredentialConnections()\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 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 const unsupportedPrimaryLogin =\n activePrimary !== undefined && activePrimary.method !== 'key'\n let apiKey: string | undefined\n for (const integrationID of ['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 (error) {\n // Host errors may contain identifiers or provider data; never forward them.\n // The sanitized error alone hides the cause, so keep the original in the server log.\n console.warn('[pantheon-tui quota] credential resolution failed:', error)\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 isCredentialInvalidationEvent(type: string): boolean {\n return (\n type === 'credential.updated' ||\n type === 'credential.switched' ||\n type === 'integration.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 (isCredentialInvalidationEvent(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 })\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,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QAAQ,gBAChC,sBACQ,SAAS,mBAAmB,GAClC,YAAY,IAAI,CAAC,YAAY,QAAQ,mBAAmB,MAAM,CAAC,CACjE;KACF,QAAQ,OAAO,QAAQ,gBACrB,kBAAkB,UAAU,UAAU,YAAY,MAAM;IAC5D,CAAC;GACH,SAAS,OAAO;IACd,QAAQ,KAAK,uDAAuD,KAAK;IACzE,gBAAgB,MAAM;IACtB,mBAAmB,MAAM;IACzB,SAAS,QAAQ;IACjB,SAAS,WAAW;IACpB,MAAM;IACN,MAAM;GACR;GAEA,OAAO,YAAY;IACjB,gBAAgB,MAAM;IACtB,mBAAmB,MAAM;IACzB,SAAS,QAAQ;IACjB,SAAS,WAAW;IACpB,MAAM;IACN,MAAM,cAAc,QAAQ;GAC9B;EACF;CACF,CAAC;AACH;AAEA,IAAA,oBAAe,kBAAkB"}
|
|
@@ -1,5 +1,236 @@
|
|
|
1
1
|
import { Accessor } from "solid-js";
|
|
2
|
-
import { Context, KeymapLayer, PanelInput } from "@opencode/plugin/tui/context";
|
|
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 become gauges. */
|
|
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
|
+
export declare const QUOTA_ICON = "▥";
|
|
193
|
+
export declare function quotaUsageTone(usedPercent: number): 'success' | 'warning' | 'error';
|
|
194
|
+
export declare function snapshotSummary(snapshot: QuotaSnapshot, display: 'used' | 'remaining'): string;
|
|
195
|
+
type FinanceMetric = Extract<QuotaMetric, {
|
|
196
|
+
kind: 'balance' | 'estimate' | 'key_usage';
|
|
197
|
+
}>;
|
|
198
|
+
type FinanceEntry = {
|
|
199
|
+
providerID: string;
|
|
200
|
+
metric: FinanceMetric;
|
|
201
|
+
};
|
|
202
|
+
export declare function sidebarFinanceEntries(snapshot: QuotaSnapshot): FinanceEntry[];
|
|
203
|
+
type QuotaWindowMetric = Extract<QuotaMetric, {
|
|
204
|
+
kind: 'provider_quota';
|
|
205
|
+
}>;
|
|
206
|
+
/** Wrap on grapheme boundaries, measuring terminal cells rather than code units. */
|
|
207
|
+
export declare function quotaTextLines(text: string, width: number, indent: number): string[];
|
|
208
|
+
/** Layout uses only a provider-reported reset; a local clock never refreshes data. */
|
|
209
|
+
export declare function quotaWindowLines(metric: QuotaWindowMetric, display: 'used' | 'remaining', width: number, now: number, sidebarPercent?: boolean): string[];
|
|
210
|
+
export declare function financeMetricLines(metric: FinanceMetric, width: number): string[];
|
|
211
|
+
export declare function quotaMetricLines(metric: Exclude<QuotaMetric, {
|
|
212
|
+
kind: 'provider_quota';
|
|
213
|
+
}>, width: number): string[];
|
|
214
|
+
type QuotaPanelAction = 'toggle-enabled' | 'toggle-display' | 'refresh' | 'close';
|
|
215
|
+
export declare const QUOTA_PANEL_COMMANDS: readonly {
|
|
216
|
+
action: QuotaPanelAction;
|
|
217
|
+
id: string;
|
|
218
|
+
title: string;
|
|
219
|
+
bind: string;
|
|
220
|
+
}[];
|
|
221
|
+
export declare function runQuotaPanelCommand(action: QuotaPanelAction, panel: Pick<PanelInput, 'focused' | 'close'>, runtime: QuotaRuntime): false | Promise<void> | undefined;
|
|
222
|
+
export declare function quotaPanelKeymapLayer(panel: Pick<PanelInput, 'focused' | 'close'>, runtime: QuotaRuntime): KeymapLayer;
|
|
223
|
+
export declare function quotaOpenCommand(context: Pick<Context, 'ui'>): KeymapCommand;
|
|
224
|
+
export declare function openQuotaPanel(context: Pick<Context, 'ui'>): boolean;
|
|
225
|
+
//#endregion
|
|
226
|
+
//#region src/sidebar-width.d.ts
|
|
227
|
+
/** Terminal cells `value` occupies — the unit every column in this plugin is
|
|
228
|
+
* measured in. Mirrors the host (that is how `@opentui/core` sizes a text
|
|
229
|
+
* run): emoji count as two cells, East Asian Wide/Fullwidth as two, East
|
|
230
|
+
* Asian Ambiguous as one, combining marks and variation selectors as none.
|
|
231
|
+
* Pure. */
|
|
232
|
+
export declare function cellWidth(value: string): number;
|
|
233
|
+
//#endregion
|
|
3
234
|
//#region src/index-v2.d.ts
|
|
4
235
|
/** Sidebar body shown while the host has not published a session yet. */
|
|
5
236
|
export declare const SIDEBAR_WAITING_LABEL = "Aguardando sessão…";
|
|
@@ -89,13 +320,6 @@ export declare function transcriptWindow(messages: readonly any[], revertMessage
|
|
|
89
320
|
* window wins. Null when there is no limit or no such message — the caller
|
|
90
321
|
* then omits the block. */
|
|
91
322
|
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
323
|
/** Color for one gauge stage. Filled cells and the percent value both come from
|
|
100
324
|
* this one call, so the bar and its number can never disagree. `theme` is the
|
|
101
325
|
* host's resolved theme (loosely typed at runtime); a missing token falls back
|
|
@@ -137,33 +361,6 @@ export type ContextPerformance = {
|
|
|
137
361
|
cacheHit: number | null;
|
|
138
362
|
tokensPerSecond: number | null;
|
|
139
363
|
};
|
|
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
364
|
/** One rendered context row. `lead` and `tail` carry the gauge bar when the row
|
|
168
365
|
* has one (`lead` is toned with the value, `tail` is muted), so the 12 cells
|
|
169
366
|
* stay contiguous while the empty half still reads as background. */
|
|
@@ -187,12 +384,6 @@ export type ContextBlockRows = {
|
|
|
187
384
|
* unavailable (never `undefined%`). A block with neither tokens nor cost
|
|
188
385
|
* yields null. Pure. */
|
|
189
386
|
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
387
|
/** Column widths for one model row (labels are muted, numbers right-aligned). */
|
|
197
388
|
export declare const MODEL_USAGE_MODEL_WIDTH = 12;
|
|
198
389
|
export declare const MODEL_USAGE_TOKEN_WIDTH = 6;
|
|
@@ -238,6 +429,14 @@ export type ModelUsageRow = {
|
|
|
238
429
|
export declare function modelUsageRows(rows: readonly ModelUsage[]): ModelUsageRow[];
|
|
239
430
|
/** Exact single-line text of a model row, with numbers right-aligned. Pure. */
|
|
240
431
|
export declare function modelUsageRowText(row: ModelUsageRow): string;
|
|
432
|
+
/** Wrap sidebar text by terminal cells, preserving the complete values. */
|
|
433
|
+
export declare function sidebarTextLines(value: string): string[];
|
|
434
|
+
/** Align a monetary value when it fits, otherwise preserve it on a new line. */
|
|
435
|
+
export declare function sidebarMoneyLines(label: string, value: string): string[];
|
|
436
|
+
/** Keep the existing OpenCode periods together when possible. */
|
|
437
|
+
export declare function contextSpendLines(value: string): string[];
|
|
438
|
+
/** Keep ordinary rows aligned; give oversized values their own lines. */
|
|
439
|
+
export declare function modelUsageRowLines(row: ModelUsageRow): string[];
|
|
241
440
|
/** Muted aggregate line for the models beyond the cap (`… +2 $0.03`). Null
|
|
242
441
|
* when every model fits. Pure. */
|
|
243
442
|
export declare function hiddenModelUsageText(hidden: number, hiddenCost: number): string | null;
|
|
@@ -429,17 +628,13 @@ export declare function statsRangeMatches(range: unknown, sent: {
|
|
|
429
628
|
from: number;
|
|
430
629
|
to: number;
|
|
431
630
|
}, 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. */
|
|
631
|
+
/** The `Context` block's last line: OpenCode stats source and both spend windows
|
|
632
|
+
* on one muted row (`OpenCode · hoje $0.42 · 30d $9.80`). A window without a
|
|
633
|
+
* usable amount is omitted, and no usable window at all yields null so the
|
|
634
|
+
* line (and not the block) is dropped. Pure. */
|
|
436
635
|
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;
|
|
636
|
+
/** Grapheme iterator: a cut never splits a surrogate pair, a combining mark
|
|
637
|
+
* from its base or a ZWJ emoji sequence, so truncation stays cell-exact. */
|
|
443
638
|
/** Clamp a free-form label to `max` terminal cells without wrapping. The width
|
|
444
639
|
* is measured in display cells, never in UTF-16 code units: a CJK or emoji
|
|
445
640
|
* label used to overflow the column it was cut for (`計画の移行` is 5 code
|
|
@@ -1032,5 +1227,5 @@ declare const plugin: {
|
|
|
1032
1227
|
setup(context: Context): (() => void) | undefined;
|
|
1033
1228
|
};
|
|
1034
1229
|
//#endregion
|
|
1035
|
-
export { plugin as default };
|
|
1230
|
+
export { type ContextProgressTone, type QuotaSidebarEntry, plugin as default };
|
|
1036
1231
|
//# 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/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,SAAS;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