pantheon-opencode 1.6.2-beta.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/CHANGELOG.md +13 -0
- package/README.md +23 -14
- package/README.pt-BR.md +12 -1
- package/package.json +1 -1
- package/plugin.json +1 -1
- package/pyproject.toml +1 -1
- package/src/pantheon/cost-command.ts +30 -133
- package/src/pantheon/model-pricing.ts +1 -536
- 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.map +1 -1
- package/src/plugins/tui/dist/quota-adapters.js +1 -1
- package/src/plugins/tui/dist/{quota-rpc-UL2HuFRJ.js → quota-rpc-DMmXBhBe.js} +295 -1
- package/src/plugins/tui/dist/quota-rpc-DMmXBhBe.js.map +1 -0
- package/src/plugins/tui/dist/server-v2.d.ts.map +1 -1
- package/src/plugins/tui/dist/server-v2.js +135 -12
- package/src/plugins/tui/dist/server-v2.js.map +1 -1
- package/src/plugins/tui/dist/tui-v2.d.ts +132 -5
- package/src/plugins/tui/dist/tui-v2.d.ts.map +1 -1
- package/src/plugins/tui/dist/tui-v2.js +3720 -337
- 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/package-lock.json +17 -2
- package/src/plugins/tui/package.json +4 -2
- package/src/plugins/tui/src/cost-data.ts +607 -0
- package/src/plugins/tui/src/index-v2.tsx +32 -0
- package/src/plugins/tui/src/model-pricing.ts +536 -0
- package/src/plugins/tui/src/quota-rpc.ts +164 -0
- package/src/plugins/tui/src/quota-v2-model.ts +2 -2
- package/src/plugins/tui/src/quota-v2.tsx +338 -86
- package/src/plugins/tui/src/server-v2.ts +159 -15
- 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 +36 -4
- package/src/plugins/tui/dist/quota-rpc-UL2HuFRJ.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,19 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
|
10
10
|
<!-- Add new changes here. Running `node scripts/versioning.mjs apply` will
|
|
11
11
|
move this section to a versioned entry and reset the template below. -->
|
|
12
12
|
|
|
13
|
+
## [v1.6.2-beta.2] - 2026-10-28
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
|
|
17
|
+
- **TUI** — `/quota` adds recorded usage history for 7, 15, 30 days, and Total, with daily and per-model token summaries plus a clearly non-billable catalog estimate.
|
|
18
|
+
- **quota** — OpenCode Go usage uses the canonical endpoint and falls back to the configured API key when its Console OAuth request fails.
|
|
19
|
+
|
|
20
|
+
### Fixed
|
|
21
|
+
|
|
22
|
+
- **quota** — Future-dated usage rows are excluded from rolling windows and Total.
|
|
23
|
+
|
|
24
|
+
<!-- Add new changes here. Running `node scripts/versioning.mjs apply` will
|
|
25
|
+
move this section to a versioned entry and reset the template below. -->
|
|
13
26
|
## [v1.6.2-beta.1] - 2026-10-27
|
|
14
27
|
|
|
15
28
|
### Changed
|
package/README.md
CHANGED
|
@@ -100,11 +100,18 @@ see [Quick Start](docs/QUICKSTART.md).
|
|
|
100
100
|
default; the sidebar keeps Todo and places quota immediately after Dispatch
|
|
101
101
|
(header/version → Session → Context → Git → Todo → Dispatch → quota).
|
|
102
102
|
Status stays in the native sidebar footer. Use `E` to disable quota or `M`
|
|
103
|
-
to switch between remaining and used.
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
103
|
+
to switch between remaining and used. The `/quota` panel has **Usage, Limits,
|
|
104
|
+
Plugin, and Settings** tabs. Usage charts cover 7, 15, 30 days, or Total and
|
|
105
|
+
plot recorded daily token usage and model totals rather than filling gaps with
|
|
106
|
+
invented data. The panel identifies the active chat model; a partial-data
|
|
107
|
+
warning appears only when the quota snapshot is actually partial.
|
|
108
|
+
Session-reported spend is shown separately. The active context estimate uses
|
|
109
|
+
the active model's input price times pre-cache context tokens, applies no cache
|
|
110
|
+
discount, and is explicitly not billable.
|
|
111
|
+
Quota windows show text amounts and status, not provider progress gauges. They
|
|
112
|
+
show a local countdown and the provider-reported reset date/time in UTC when
|
|
113
|
+
valid timing is available; missing timing is not inferred. After expiry the UI
|
|
114
|
+
shows “aguardando atualização” until refreshed data arrives.
|
|
108
115
|
When a quota status request fails, the UI preserves the last valid
|
|
109
116
|
snapshot, marks it stale, and shows the failure cause as `Erro: <causa>`
|
|
110
117
|
in the sidebar and `/quota` panel (plus a `Último erro` line) instead
|
|
@@ -117,15 +124,17 @@ see [Quick Start](docs/QUICKSTART.md).
|
|
|
117
124
|
The installer selects the `plugins` component by default; in interactive setup
|
|
118
125
|
you can change the component selection. A component-scoped install includes
|
|
119
126
|
the TUI only when `plugins` is selected.
|
|
120
|
-
The V2 quota RPC shows providers
|
|
121
|
-
connection and Pantheon can locally resolve a nonblank credential.
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
127
|
+
The V2 quota RPC shows providers when OpenCode lists an active supported
|
|
128
|
+
connection and Pantheon can locally resolve a nonblank credential. OpenCode
|
|
129
|
+
Go also supports `OPENCODE_API_KEY` and effective `opencode-go`/`opencode`
|
|
130
|
+
provider settings. This is not proof that the provider accepted the
|
|
131
|
+
credential; failed requests and unsupported adapters can remain visible as
|
|
132
|
+
unavailable. OpenCode Go checks a selected Console OAuth login first when
|
|
133
|
+
available, then uses the first available API key if no Console login exists
|
|
134
|
+
or its request fails; a Console 404 or a successful response without an
|
|
135
|
+
access object reports no Go subscription and does not fall back.
|
|
136
|
+
The API-key route follows OpenCode Quota's supported Go usage endpoint. See
|
|
137
|
+
the
|
|
129
138
|
[quota provider coverage table](docs/tui-v2-quota-providers.md) for limits and
|
|
130
139
|
troubleshooting.
|
|
131
140
|
`/quota-go-check` is a separate manual, confirmation-gated diagnostic: one
|
package/README.pt-BR.md
CHANGED
|
@@ -76,7 +76,18 @@ apenas — `init` → reiniciar → `/dispatch` → primeiro resultado — veja
|
|
|
76
76
|
- **5 servidores MCP locais** para memória de projeto, persistência, recursos,
|
|
77
77
|
execução confinada de scripts e visão.
|
|
78
78
|
- **Uma TUI opcional**, com bloco de dispatch na sidebar e painel `/dispatch`
|
|
79
|
-
em largura total.
|
|
79
|
+
em largura total. A TUI V2 também inclui um resumo de quota na sidebar/rodapé
|
|
80
|
+
e o painel `/quota`, com abas Usage, Limits, Plugin e Settings. Usage mostra
|
|
81
|
+
gráficos de tokens registrados e totais por modelo em períodos de 7, 15, 30
|
|
82
|
+
dias ou Total, sem inventar dados para preencher lacunas. O painel identifica
|
|
83
|
+
o modelo ativo da conversa; o aviso de dados parciais só aparece quando a
|
|
84
|
+
resposta de quota é realmente parcial. O gasto reportado da sessão fica
|
|
85
|
+
separado da estimativa de contexto pré-cache, calculada com o preço de entrada
|
|
86
|
+
do modelo ativo, sem desconto de cache e sem representar uma cobrança. As
|
|
87
|
+
quotas aparecem como valores e status em texto, sem medidores de progresso;
|
|
88
|
+
quando há horário válido, mostram contagem regressiva local e o reset informado
|
|
89
|
+
pelo provedor em UTC. Horários ausentes não são inferidos. Use `E` para
|
|
90
|
+
desativar a quota e `M` para alternar entre restante e usado.
|
|
80
91
|
|
|
81
92
|
A memória MCP fica disponível para busca explícita: o coordenador consulta o
|
|
82
93
|
histórico uma vez quando ele pode mudar a tarefa e repassa apenas resultados
|
package/package.json
CHANGED
package/plugin.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pantheon",
|
|
3
3
|
"publisher": "ils15",
|
|
4
|
-
"version": "1.6.2-beta.
|
|
4
|
+
"version": "1.6.2-beta.2",
|
|
5
5
|
"displayName": "Pantheon",
|
|
6
6
|
"description": "Conductor-Delegate orchestration platform with 14 specialized agents, 20 skills, and OpenCode support.",
|
|
7
7
|
"agents": "./src/agents",
|
package/pyproject.toml
CHANGED
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.backends._legacy:_Backend"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "pantheon"
|
|
7
|
-
version = "1.6.2-beta.
|
|
7
|
+
version = "1.6.2-beta.2"
|
|
8
8
|
description = "Multi-agent orchestration framework"
|
|
9
9
|
requires-python = ">=3.11"
|
|
10
10
|
# Python sources under src/mcp/ import fastmcp/pydantic at runtime, but those
|
|
@@ -37,15 +37,21 @@
|
|
|
37
37
|
*/
|
|
38
38
|
import { execFile } from 'node:child_process'
|
|
39
39
|
import { accessSync, constants, existsSync, statSync } from 'node:fs'
|
|
40
|
-
import { homedir } from 'node:os'
|
|
41
40
|
import { delimiter, dirname, join } from 'node:path'
|
|
42
41
|
import { fileURLToPath } from 'node:url'
|
|
43
42
|
import { z } from 'zod'
|
|
43
|
+
import type { CostSource, SqliteDatabase, SqliteModule } from '../plugins/tui/src/cost-data.ts'
|
|
44
|
+
import {
|
|
45
|
+
ledgerLabel,
|
|
46
|
+
numberOf,
|
|
47
|
+
priceTokens,
|
|
48
|
+
requestedVersion,
|
|
49
|
+
resolveCostDbPath,
|
|
50
|
+
resolveSources,
|
|
51
|
+
} from '../plugins/tui/src/cost-data.ts'
|
|
44
52
|
import {
|
|
45
|
-
computeModelCost,
|
|
46
53
|
forceRefreshPricing,
|
|
47
54
|
loadPricing,
|
|
48
|
-
lookupModelPrice,
|
|
49
55
|
type PricingOptions,
|
|
50
56
|
type PricingSnapshot,
|
|
51
57
|
type UnpricedReason,
|
|
@@ -53,6 +59,27 @@ import {
|
|
|
53
59
|
import type { NativeTaskStatus } from './native-task-status.ts'
|
|
54
60
|
import type { ToolContextLike } from './tool-context.ts'
|
|
55
61
|
|
|
62
|
+
export type {
|
|
63
|
+
ActiveContextCostEstimate,
|
|
64
|
+
ActiveContextCostInput,
|
|
65
|
+
CostSource,
|
|
66
|
+
OpenCodeVersion,
|
|
67
|
+
SqliteModule,
|
|
68
|
+
UsageHistoryBucket,
|
|
69
|
+
UsageHistoryModel,
|
|
70
|
+
UsageHistoryOptions,
|
|
71
|
+
UsageHistoryPeriod,
|
|
72
|
+
UsageHistoryPricing,
|
|
73
|
+
UsageHistoryResult,
|
|
74
|
+
UsagePricingStatus,
|
|
75
|
+
UsageTokenTotals,
|
|
76
|
+
} from '../plugins/tui/src/cost-data.ts'
|
|
77
|
+
export {
|
|
78
|
+
estimateActiveContextCost,
|
|
79
|
+
queryUsageHistory,
|
|
80
|
+
resolveCostDbPath,
|
|
81
|
+
} from '../plugins/tui/src/cost-data.ts'
|
|
82
|
+
|
|
56
83
|
const __filename = fileURLToPath(import.meta.url)
|
|
57
84
|
const __dirname = dirname(__filename)
|
|
58
85
|
|
|
@@ -120,26 +147,6 @@ export interface CostSessionScope {
|
|
|
120
147
|
hierarchy: boolean
|
|
121
148
|
}
|
|
122
149
|
|
|
123
|
-
/**
|
|
124
|
-
* Host table families that can carry a token ledger. A migrated database
|
|
125
|
-
* carries both at once.
|
|
126
|
-
*/
|
|
127
|
-
export type CostSource = 'message' | 'session_message'
|
|
128
|
-
|
|
129
|
-
const COST_SOURCES: readonly CostSource[] = ['message', 'session_message']
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Which table family each host generation stores its ledger in.
|
|
133
|
-
*
|
|
134
|
-
* Spelled out rather than comparing the literals: `'message' === 'v1'` is
|
|
135
|
-
* false, so a filter written as `source === requested` narrows to nothing and
|
|
136
|
-
* every version-pinned read fails.
|
|
137
|
-
*/
|
|
138
|
-
const VERSION_SOURCES: Record<OpenCodeVersion, CostSource> = {
|
|
139
|
-
v1: 'message',
|
|
140
|
-
v2: 'session_message',
|
|
141
|
-
}
|
|
142
|
-
|
|
143
150
|
/** What the query actually found, so the report can describe its own coverage. */
|
|
144
151
|
export interface CostCoverage {
|
|
145
152
|
/** Table families that contributed rows. */
|
|
@@ -176,17 +183,6 @@ export interface CostCommandOptions {
|
|
|
176
183
|
pricing?: PricingOptions
|
|
177
184
|
}
|
|
178
185
|
|
|
179
|
-
export type OpenCodeVersion = 'v1' | 'v2'
|
|
180
|
-
|
|
181
|
-
interface SqliteDatabase {
|
|
182
|
-
prepare(sql: string): { get(): unknown; all(...args: unknown[]): unknown[] }
|
|
183
|
-
close(): void
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
export interface SqliteModule {
|
|
187
|
-
DatabaseSync: new (path: string, options: { readOnly: boolean }) => SqliteDatabase
|
|
188
|
-
}
|
|
189
|
-
|
|
190
186
|
/** One cost tool: description + zod args shape + execute (delegation.ts shape). */
|
|
191
187
|
export interface CostTool<Args extends z.ZodRawShape = typeof costArgs> {
|
|
192
188
|
description: string
|
|
@@ -224,41 +220,6 @@ const costArgs = {
|
|
|
224
220
|
/** Parsed arguments of the cost tool. */
|
|
225
221
|
type CostArgs = z.infer<z.ZodObject<typeof costArgs>>
|
|
226
222
|
|
|
227
|
-
/** The XDG state directory every real host installation writes its ledger to. */
|
|
228
|
-
function defaultDbPath(): string {
|
|
229
|
-
const xdg = process.env.XDG_DATA_HOME
|
|
230
|
-
const dataHome = xdg !== undefined && xdg !== '' ? xdg : join(homedir(), '.local', 'share')
|
|
231
|
-
return join(dataHome, 'opencode', 'opencode.db')
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
/** Read and validate the optional host-generation selector. */
|
|
235
|
-
function requestedVersion(): OpenCodeVersion | undefined {
|
|
236
|
-
const configured = process.env.PANTHEON_OPENCODE_VERSION
|
|
237
|
-
if (configured === undefined) return undefined
|
|
238
|
-
if (configured !== 'v1' && configured !== 'v2') {
|
|
239
|
-
throw new Error(`invalid PANTHEON_OPENCODE_VERSION "${configured}"; expected "v1" or "v2"`)
|
|
240
|
-
}
|
|
241
|
-
return configured
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
/**
|
|
245
|
-
* Resolve the database.
|
|
246
|
-
*
|
|
247
|
-
* Precedence: explicit option → PANTHEON_COST_DB → OPENCODE_DB → the XDG
|
|
248
|
-
* default `opencode.db`. An invalid PANTHEON_OPENCODE_VERSION fails fast rather
|
|
249
|
-
* than being silently ignored.
|
|
250
|
-
*
|
|
251
|
-
* There is deliberately NO per-version filename. Deriving one from the host
|
|
252
|
-
* generation pointed the V2 report at `opencode-v2.db`, which exists only
|
|
253
|
-
* because a sandbox sets OPENCODE_DB — hence OPENCODE_DB's place in this chain.
|
|
254
|
-
*/
|
|
255
|
-
export function resolveCostDbPath(options?: CostCommandOptions): string {
|
|
256
|
-
const explicit = options?.dbPath || process.env.PANTHEON_COST_DB || process.env.OPENCODE_DB
|
|
257
|
-
if (explicit) return explicit
|
|
258
|
-
requestedVersion()
|
|
259
|
-
return defaultDbPath()
|
|
260
|
-
}
|
|
261
|
-
|
|
262
223
|
/**
|
|
263
224
|
* First existing db path, or undefined. An EXPLICIT override shadows the
|
|
264
225
|
* candidate list entirely (testability: a fake path must not fall through
|
|
@@ -270,42 +231,6 @@ function findExistingDb(override?: string): string | undefined {
|
|
|
270
231
|
return existsSync(candidate) ? candidate : undefined
|
|
271
232
|
}
|
|
272
233
|
|
|
273
|
-
/**
|
|
274
|
-
* Detect the ledger families by TABLE PRESENCE.
|
|
275
|
-
*
|
|
276
|
-
* Presence is the only reliable discriminator: a migrated database carries both
|
|
277
|
-
* families, so pinning a schema-version constant would break whichever
|
|
278
|
-
* population it excluded, and no manifest declares a supported host range.
|
|
279
|
-
* PANTHEON_OPENCODE_VERSION only NARROWS an already-detected set — it never
|
|
280
|
-
* chooses a file and never invents a family that is not there.
|
|
281
|
-
*/
|
|
282
|
-
function resolveSources(db: SqliteDatabase, requested: OpenCodeVersion | undefined): CostSource[] {
|
|
283
|
-
const present = new Set(
|
|
284
|
-
(
|
|
285
|
-
db
|
|
286
|
-
.prepare(
|
|
287
|
-
"SELECT name FROM sqlite_master WHERE type = 'table' AND name IN ('message', 'session_message')",
|
|
288
|
-
)
|
|
289
|
-
.all() as Array<{ name?: unknown }>
|
|
290
|
-
).map((row) => String(row.name)),
|
|
291
|
-
)
|
|
292
|
-
const detected = COST_SOURCES.filter((source) => present.has(source))
|
|
293
|
-
if (detected.length === 0) {
|
|
294
|
-
throw new Error(
|
|
295
|
-
'incompatible opencode.db schema: neither the "message" nor the "session_message" table exists, so there is no token ledger to read',
|
|
296
|
-
)
|
|
297
|
-
}
|
|
298
|
-
if (requested === undefined) return detected
|
|
299
|
-
const wanted = VERSION_SOURCES[requested]
|
|
300
|
-
const narrowed = detected.filter((source) => source === wanted)
|
|
301
|
-
if (narrowed.length === 0) {
|
|
302
|
-
throw new Error(
|
|
303
|
-
`incompatible opencode.db schema: PANTHEON_OPENCODE_VERSION=${requested} selected no table family, but this database contains ${detected.join(' and ')}`,
|
|
304
|
-
)
|
|
305
|
-
}
|
|
306
|
-
return narrowed
|
|
307
|
-
}
|
|
308
|
-
|
|
309
234
|
/**
|
|
310
235
|
* Per-family aggregation, grouped finely enough to price and to attribute.
|
|
311
236
|
*
|
|
@@ -538,12 +463,6 @@ const DATABASE_START_SQL: Record<CostSource, string> = {
|
|
|
538
463
|
|
|
539
464
|
type Counters = { scanned?: unknown; windowStart?: unknown; assistantRows?: unknown }
|
|
540
465
|
|
|
541
|
-
function numberOf(value: unknown): number | undefined {
|
|
542
|
-
if (value === null || value === undefined) return undefined
|
|
543
|
-
const parsed = Number(value)
|
|
544
|
-
return Number.isFinite(parsed) ? parsed : undefined
|
|
545
|
-
}
|
|
546
|
-
|
|
547
466
|
function emptyCoverage(sources: CostSource[]): CostCoverage {
|
|
548
467
|
return { sources, scanned: 0, assistantRows: 0 }
|
|
549
468
|
}
|
|
@@ -588,28 +507,6 @@ interface SessionAccumulator {
|
|
|
588
507
|
reason: UnpricedReason | undefined
|
|
589
508
|
}
|
|
590
509
|
|
|
591
|
-
/** A ledger label the catalog cannot know; never an empty string. */
|
|
592
|
-
function ledgerLabel(value: unknown): string {
|
|
593
|
-
if (value === undefined || value === null) return 'unknown'
|
|
594
|
-
const text = String(value).trim()
|
|
595
|
-
return text === '' ? 'unknown' : text
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
/** Price one group, or explain why it cannot be priced. */
|
|
599
|
-
function priceTokens(
|
|
600
|
-
pricing: PricingSnapshot | undefined,
|
|
601
|
-
provider: string,
|
|
602
|
-
model: string,
|
|
603
|
-
tokens: { input: number; output: number; cacheRead: number; cacheWrite: number },
|
|
604
|
-
): { usd: number } | { reason: UnpricedReason } {
|
|
605
|
-
if (pricing === undefined) return { reason: 'no-pricing' }
|
|
606
|
-
const lookup = lookupModelPrice(pricing, provider, model)
|
|
607
|
-
if (!lookup.ok) return { reason: lookup.reason }
|
|
608
|
-
const cost = computeModelCost(lookup.price, tokens)
|
|
609
|
-
if (!cost.ok) return { reason: cost.reason }
|
|
610
|
-
return { usd: cost.usd }
|
|
611
|
-
}
|
|
612
|
-
|
|
613
510
|
/**
|
|
614
511
|
* Read the token ledger of one database, read-only.
|
|
615
512
|
*
|