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,25 @@
|
|
|
1
|
+
import { parentPort, workerData } from 'node:worker_threads'
|
|
2
|
+
import { queryUsageHistory, resolveCostDbPath } from './cost-data'
|
|
3
|
+
import { isUsageHistoryPeriod, projectUsageHistoryResult } from './usage-history-contract'
|
|
4
|
+
|
|
5
|
+
interface UsageHistoryWorkerInput {
|
|
6
|
+
period?: unknown
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const port = parentPort
|
|
10
|
+
if (port) {
|
|
11
|
+
void (async () => {
|
|
12
|
+
try {
|
|
13
|
+
const input = workerData as UsageHistoryWorkerInput
|
|
14
|
+
if (!isUsageHistoryPeriod(input.period)) {
|
|
15
|
+
port.postMessage({ ok: false })
|
|
16
|
+
return
|
|
17
|
+
}
|
|
18
|
+
const result = await queryUsageHistory(resolveCostDbPath(), input.period)
|
|
19
|
+
port.postMessage({ ok: true, result: projectUsageHistoryResult(result) })
|
|
20
|
+
} catch {
|
|
21
|
+
// Database errors may contain the local path, SQL, or private ledger data.
|
|
22
|
+
port.postMessage({ ok: false })
|
|
23
|
+
}
|
|
24
|
+
})()
|
|
25
|
+
}
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import { cellWidth } from './sidebar-width'
|
|
2
|
+
import type {
|
|
3
|
+
UsageHistoryRpcAvailable,
|
|
4
|
+
UsageHistoryRpcPeriod,
|
|
5
|
+
UsageHistoryRpcResult,
|
|
6
|
+
} from './usage-history-contract'
|
|
7
|
+
|
|
8
|
+
export type ActiveContextCostResult =
|
|
9
|
+
| {
|
|
10
|
+
status: 'estimated'
|
|
11
|
+
estimatedUsd: number
|
|
12
|
+
billed: false
|
|
13
|
+
basis: 'pre-cache-context-tokens-times-input-price'
|
|
14
|
+
cacheDiscountApplied: false
|
|
15
|
+
}
|
|
16
|
+
| {
|
|
17
|
+
status: 'unavailable'
|
|
18
|
+
billed: false
|
|
19
|
+
basis: 'pre-cache-context-tokens-times-input-price'
|
|
20
|
+
cacheDiscountApplied: false
|
|
21
|
+
reason:
|
|
22
|
+
| 'invalid-context-token-count'
|
|
23
|
+
| 'missing-model-identity'
|
|
24
|
+
| 'no-pricing'
|
|
25
|
+
| 'unknown-model'
|
|
26
|
+
| 'ambiguous-model'
|
|
27
|
+
| 'missing-cache-price'
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const HISTORY_PERIODS: readonly UsageHistoryRpcPeriod[] = ['7d', '15d', '30d', 'total']
|
|
31
|
+
export const USAGE_HISTORY_PERIOD_BINDINGS = [
|
|
32
|
+
{ period: '7d', bind: '7', label: '7d' },
|
|
33
|
+
{ period: '15d', bind: '1', label: '15d' },
|
|
34
|
+
{ period: '30d', bind: '3', label: '30d' },
|
|
35
|
+
{ period: 'total', bind: 't', label: 'total' },
|
|
36
|
+
] as const satisfies readonly {
|
|
37
|
+
period: UsageHistoryRpcPeriod
|
|
38
|
+
bind: string
|
|
39
|
+
label: string
|
|
40
|
+
}[]
|
|
41
|
+
|
|
42
|
+
function wrapText(value: string, width: number): string[] {
|
|
43
|
+
const maxWidth = Number.isFinite(width) ? Math.max(1, Math.floor(width)) : 1
|
|
44
|
+
const lines: string[] = []
|
|
45
|
+
const segmenter = new Intl.Segmenter()
|
|
46
|
+
let line = ''
|
|
47
|
+
|
|
48
|
+
for (const word of value.trim().split(/\s+/)) {
|
|
49
|
+
if (!word) continue
|
|
50
|
+
if (line && cellWidth(line) + 1 + cellWidth(word) > maxWidth) {
|
|
51
|
+
lines.push(line)
|
|
52
|
+
line = ''
|
|
53
|
+
}
|
|
54
|
+
if (line) line += ' '
|
|
55
|
+
for (const { segment } of segmenter.segment(word)) {
|
|
56
|
+
if (cellWidth(line) + cellWidth(segment) > maxWidth) {
|
|
57
|
+
if (line) lines.push(line)
|
|
58
|
+
line = ''
|
|
59
|
+
}
|
|
60
|
+
line += segment
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (line) lines.push(line)
|
|
65
|
+
return lines
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export function usageHistoryTextLines(value: string, width: number): string[] {
|
|
69
|
+
return wrapText(value, width)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function formatCount(value: number): string {
|
|
73
|
+
return Math.max(0, value).toLocaleString('en-US')
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function formatUsd(value: number): string | undefined {
|
|
77
|
+
if (!Number.isFinite(value) || value < 0) return undefined
|
|
78
|
+
return `$${new Intl.NumberFormat('en-US', {
|
|
79
|
+
minimumFractionDigits: 2,
|
|
80
|
+
maximumFractionDigits: 8,
|
|
81
|
+
}).format(value)}`
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function chartBar(value: number, maxValue: number, width: number): string {
|
|
85
|
+
const cells = Math.max(0, Math.floor(width))
|
|
86
|
+
if (cells === 0 || value <= 0 || maxValue <= 0) return ''
|
|
87
|
+
return '#'.repeat(Math.max(1, Math.min(cells, Math.round((value / maxValue) * cells))))
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function chartValueLine(value: number, maximum: number, width: number): string {
|
|
91
|
+
const count = `${formatCount(value)} tokens`
|
|
92
|
+
const barWidth = Math.max(0, width - cellWidth(count) - 3)
|
|
93
|
+
const bar = chartBar(value, maximum, Math.min(12, barWidth))
|
|
94
|
+
const line = ` ${bar ? `${bar} ` : ''}${count}`
|
|
95
|
+
return wrapText(line, width).join('\n')
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function appendWrapped(target: string[], value: string, width: number): void {
|
|
99
|
+
target.push(...wrapText(value, width))
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export function usageHistorySelectorLabel(selected: UsageHistoryRpcPeriod): string {
|
|
103
|
+
return `Período: ${HISTORY_PERIODS.map((period) => {
|
|
104
|
+
const label = period === 'total' ? 'Total' : period
|
|
105
|
+
return period === selected ? `[${label}]` : label
|
|
106
|
+
}).join(' · ')}`
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export function usageHistorySelectorLines(
|
|
110
|
+
selected: UsageHistoryRpcPeriod,
|
|
111
|
+
width: number,
|
|
112
|
+
): string[] {
|
|
113
|
+
return wrapText(usageHistorySelectorLabel(selected), width)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export function usageHistoryPeriodForKey(key: string): UsageHistoryRpcPeriod | undefined {
|
|
117
|
+
return USAGE_HISTORY_PERIOD_BINDINGS.find((binding) => binding.bind === key)?.period
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export function usageHistoryControlsLines(width: number): string[] {
|
|
121
|
+
return wrapText('7 · 7d 1 · 15d 3 · 30d T · total', width)
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export function usageHistoryCoverageLabel(result: UsageHistoryRpcAvailable): string {
|
|
125
|
+
return result.coverageStart === null
|
|
126
|
+
? 'Início da cobertura indisponível'
|
|
127
|
+
: `Cobertura desde ${result.coverageStart}`
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export function usageHistoryPartialWarning(result: UsageHistoryRpcAvailable): string | null {
|
|
131
|
+
if (result.partial && result.truncated) return 'Histórico parcial e truncado pelo limite seguro.'
|
|
132
|
+
if (result.partial) return 'Histórico parcial segundo a consulta.'
|
|
133
|
+
if (result.truncated) return 'Histórico truncado pelo limite seguro.'
|
|
134
|
+
return null
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export function usageHistoryPricingLabel(result: UsageHistoryRpcAvailable): string {
|
|
138
|
+
const amount =
|
|
139
|
+
result.pricing.estimatedUsd === undefined ? undefined : formatUsd(result.pricing.estimatedUsd)
|
|
140
|
+
const value = amount ? ` · ${amount}` : ''
|
|
141
|
+
switch (result.pricing.status) {
|
|
142
|
+
case 'complete':
|
|
143
|
+
return `Estimativa pelo catálogo${value} · não cobrada`
|
|
144
|
+
case 'partial':
|
|
145
|
+
return `Estimativa parcial pelo catálogo${value} · não cobrada · ${result.pricing.unpricedModels} modelo(s) sem preço`
|
|
146
|
+
case 'unavailable':
|
|
147
|
+
return 'Estimativa de preço indisponível · nenhum valor cobrado'
|
|
148
|
+
case 'empty':
|
|
149
|
+
return 'Sem dados de preço para estimar · nenhum valor cobrado'
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export function usageHistoryUnavailableMessage(result: UsageHistoryRpcResult): string | null {
|
|
154
|
+
if (result.status !== 'unavailable') return null
|
|
155
|
+
switch (result.reason) {
|
|
156
|
+
case 'invalid_period':
|
|
157
|
+
return 'Período de histórico inválido.'
|
|
158
|
+
case 'history_timeout':
|
|
159
|
+
return 'Consulta de histórico excedeu o tempo limite.'
|
|
160
|
+
case 'history_unavailable':
|
|
161
|
+
return 'Histórico indisponível neste momento.'
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export function usageHistoryEmptyMessage(): string {
|
|
166
|
+
return 'Sem histórico neste período.'
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export function usageHistoryChartLines(result: UsageHistoryRpcAvailable, width: number): string[] {
|
|
170
|
+
const maxWidth = Math.max(1, Math.floor(width))
|
|
171
|
+
if (result.rows === 0 && result.buckets.length === 0 && result.models.length === 0) {
|
|
172
|
+
return wrapText(usageHistoryEmptyMessage(), maxWidth)
|
|
173
|
+
}
|
|
174
|
+
const lines: string[] = []
|
|
175
|
+
appendWrapped(lines, `GERAL · ${formatCount(result.totals.total)} tokens`, maxWidth)
|
|
176
|
+
|
|
177
|
+
if (result.buckets.length > 0) {
|
|
178
|
+
lines.push('Uso diário')
|
|
179
|
+
const maxBucket = Math.max(0, ...result.buckets.map((bucket) => bucket.total))
|
|
180
|
+
for (const bucket of result.buckets) {
|
|
181
|
+
appendWrapped(lines, bucket.date, maxWidth)
|
|
182
|
+
lines.push(...chartValueLine(bucket.total, maxBucket, maxWidth).split('\n'))
|
|
183
|
+
}
|
|
184
|
+
} else {
|
|
185
|
+
lines.push('Sem buckets diários neste período.')
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
lines.push('Modelos no período')
|
|
189
|
+
if (result.models.length === 0) {
|
|
190
|
+
lines.push('Sem totais por modelo.')
|
|
191
|
+
return lines.flatMap((line) => wrapText(line, maxWidth))
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
const maxModel = Math.max(0, ...result.models.map((model) => model.totals.total))
|
|
195
|
+
for (const model of result.models) {
|
|
196
|
+
appendWrapped(lines, `${model.providerID}/${model.modelID}`, maxWidth)
|
|
197
|
+
lines.push(...chartValueLine(model.totals.total, maxModel, maxWidth).split('\n'))
|
|
198
|
+
}
|
|
199
|
+
return lines.flatMap((line) => wrapText(line, maxWidth))
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export function activeModelIdentity(model: {
|
|
203
|
+
providerID: string | null
|
|
204
|
+
modelID: string | null
|
|
205
|
+
label: string
|
|
206
|
+
}): string {
|
|
207
|
+
if (model.providerID && model.modelID) return `${model.providerID}/${model.modelID}`
|
|
208
|
+
if (model.modelID) return model.modelID
|
|
209
|
+
return model.label || 'identidade indisponível'
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export function sessionSpendLabel(cost: number): string | null {
|
|
213
|
+
if (!Number.isFinite(cost) || cost < 0) return null
|
|
214
|
+
return `Gasto da sessão (relatado) · $${cost.toFixed(2)}`
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
function unavailableContextReason(
|
|
218
|
+
reason: Extract<ActiveContextCostResult, { status: 'unavailable' }>['reason'],
|
|
219
|
+
): string {
|
|
220
|
+
switch (reason) {
|
|
221
|
+
case 'invalid-context-token-count':
|
|
222
|
+
return 'contagem de tokens de contexto inválida'
|
|
223
|
+
case 'missing-model-identity':
|
|
224
|
+
return 'identidade do modelo indisponível'
|
|
225
|
+
case 'no-pricing':
|
|
226
|
+
case 'missing-cache-price':
|
|
227
|
+
return 'preço de entrada indisponível'
|
|
228
|
+
case 'unknown-model':
|
|
229
|
+
case 'ambiguous-model':
|
|
230
|
+
return 'modelo não identificado na tabela de preços'
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
export function activeContextEstimateLines(
|
|
235
|
+
result: ActiveContextCostResult,
|
|
236
|
+
width: number,
|
|
237
|
+
): string[] {
|
|
238
|
+
const maxWidth = Math.max(1, Math.floor(width))
|
|
239
|
+
if (result.status === 'unavailable') {
|
|
240
|
+
return wrapText(
|
|
241
|
+
`Estimativa de contexto (pré-cache) indisponível · ${unavailableContextReason(result.reason)}`,
|
|
242
|
+
maxWidth,
|
|
243
|
+
)
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
const amount = formatUsd(result.estimatedUsd)
|
|
247
|
+
if (!amount) {
|
|
248
|
+
return wrapText('Estimativa de contexto (pré-cache) indisponível · valor inválido', maxWidth)
|
|
249
|
+
}
|
|
250
|
+
return [
|
|
251
|
+
...wrapText(`Estimativa de contexto (pré-cache) · ${amount}`, maxWidth),
|
|
252
|
+
...wrapText(
|
|
253
|
+
'Preço de entrada × tokens pré-cache; sem desconto de cache; não é valor cobrado.',
|
|
254
|
+
maxWidth,
|
|
255
|
+
),
|
|
256
|
+
]
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
export function activeContextEstimatePendingLines(width: number): string[] {
|
|
260
|
+
return wrapText('Estimativa de contexto (pré-cache) · calculando…', width)
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
export function activeContextEstimateMissingLines(width: number): string[] {
|
|
264
|
+
return wrapText(
|
|
265
|
+
'Estimativa de contexto (pré-cache) indisponível · contexto não reportado.',
|
|
266
|
+
width,
|
|
267
|
+
)
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
export function activeContextEstimateErrorLines(width: number): string[] {
|
|
271
|
+
return wrapText('Estimativa de contexto (pré-cache) indisponível · falha na consulta.', width)
|
|
272
|
+
}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"//": "Typecheck gate for the V2 TUI entry only. `tsc --noEmit` at the package root was a no-op: with no tsconfig in this directory tsc walked up to the repo tsconfig.json, which excludes src/plugins/tui entirely — so nothing here was checked. tsdown bundles without type-checking, which is how an invalid event name (session.updated, absent from the OpenCode V2 event union) shipped in the V2 rewrite. This config points tsc at the V2 entry plus its ambient declarations so a type error in src/index-v2.tsx fails `npm run typecheck`. The V1 entry (src/index.tsx) is intentionally NOT included: it carries pre-existing type errors out of scope for the V2 gate. Keep this file strict JSON — the repo pre-commit `check-json` hook rejects comments.",
|
|
3
3
|
"extends": "./tsconfig.build.json",
|
|
4
|
-
"include": [
|
|
4
|
+
"include": [
|
|
5
|
+
"src/index-v2.tsx",
|
|
6
|
+
"src/server-v2.ts",
|
|
7
|
+
"src/usage-history-worker.ts",
|
|
8
|
+
"src/opencode-v2.d.ts"
|
|
9
|
+
]
|
|
5
10
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { readFileSync } from 'node:fs'
|
|
2
|
-
import {
|
|
2
|
+
import { readdir, readFile, writeFile } from 'node:fs/promises'
|
|
3
3
|
import { join } from 'node:path'
|
|
4
4
|
import { fileURLToPath } from 'node:url'
|
|
5
5
|
import solid from 'rolldown-plugin-solid'
|
|
@@ -10,7 +10,7 @@ const pkg = JSON.parse(readFileSync(join(__dirname, 'package.json'), 'utf8')) as
|
|
|
10
10
|
version: string
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
async function
|
|
13
|
+
async function finalizeDistArtifacts(): Promise<void> {
|
|
14
14
|
const dist = join(__dirname, 'dist')
|
|
15
15
|
const entries = await readdir(dist, { withFileTypes: true })
|
|
16
16
|
|
|
@@ -20,13 +20,43 @@ async function ensureDistArtifactsEndWithNewline(): Promise<void> {
|
|
|
20
20
|
.map(async ({ name }) => {
|
|
21
21
|
const path = join(dist, name)
|
|
22
22
|
const contents = await readFile(path, 'utf8')
|
|
23
|
-
|
|
23
|
+
const normalized = normalizeHqtuiBundlePaths(name, contents)
|
|
24
|
+
const finalContents = normalized.endsWith('\n') ? normalized : `${normalized}\n`
|
|
25
|
+
if (contents !== finalContents) await writeFile(path, finalContents)
|
|
24
26
|
}),
|
|
25
27
|
)
|
|
26
28
|
}
|
|
27
29
|
|
|
30
|
+
/** Keep Rolldown's vendor source labels stable when a clean build uses a node_modules symlink. */
|
|
31
|
+
function normalizeHqtuiBundlePaths(name: string, contents: string): string {
|
|
32
|
+
if (name === 'tui-v2.js') {
|
|
33
|
+
return contents.replace(
|
|
34
|
+
/\/\/#region [^\n]*node_modules\/@profullstack\/hqtui\/dist\//g,
|
|
35
|
+
'//#region ../../../node_modules/@profullstack/hqtui/dist/',
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
if (name !== 'tui-v2.js.map') return contents
|
|
39
|
+
|
|
40
|
+
const map = JSON.parse(contents) as { sources?: string[]; [key: string]: unknown }
|
|
41
|
+
if (!Array.isArray(map.sources)) return contents
|
|
42
|
+
map.sources = map.sources.map((source) => {
|
|
43
|
+
const packagePath = 'node_modules/@profullstack/hqtui/'
|
|
44
|
+
const packageIndex = source.lastIndexOf(packagePath)
|
|
45
|
+
return packageIndex < 0 ? source : `../../../../${source.slice(packageIndex)}`
|
|
46
|
+
})
|
|
47
|
+
return JSON.stringify(map)
|
|
48
|
+
}
|
|
49
|
+
|
|
28
50
|
export default defineConfig({
|
|
29
|
-
entry: {
|
|
51
|
+
entry: {
|
|
52
|
+
tui: 'src/index.tsx',
|
|
53
|
+
'tui-v2': 'src/index-v2.tsx',
|
|
54
|
+
server: 'src/server.ts',
|
|
55
|
+
'server-v2': 'src/server-v2.ts',
|
|
56
|
+
'quota-cli': 'src/quota-cli.ts',
|
|
57
|
+
'quota-adapters': 'src/quota-adapters.ts',
|
|
58
|
+
'usage-history-worker': 'src/usage-history-worker.ts',
|
|
59
|
+
},
|
|
30
60
|
format: ['esm'],
|
|
31
61
|
platform: 'node',
|
|
32
62
|
outDir: 'dist',
|
|
@@ -34,6 +64,14 @@ export default defineConfig({
|
|
|
34
64
|
outExtensions: () => ({ js: '.js' }),
|
|
35
65
|
dts: {
|
|
36
66
|
tsconfig: join(__dirname, 'tsconfig.build.json'),
|
|
67
|
+
entry: [
|
|
68
|
+
'src/index.tsx',
|
|
69
|
+
'src/index-v2.tsx',
|
|
70
|
+
'src/server.ts',
|
|
71
|
+
'src/server-v2.ts',
|
|
72
|
+
'src/quota-cli.ts',
|
|
73
|
+
'src/quota-adapters.ts',
|
|
74
|
+
],
|
|
37
75
|
},
|
|
38
76
|
define: {
|
|
39
77
|
__PANTHEON_VERSION__: JSON.stringify(pkg.version),
|
|
@@ -48,6 +86,7 @@ export default defineConfig({
|
|
|
48
86
|
],
|
|
49
87
|
deps: {
|
|
50
88
|
neverBundle: [/^@opencode-ai\//, /^@opencode\//, /^@opentui\//, /^solid-js/],
|
|
89
|
+
alwaysBundle: [/^@profullstack\/hqtui$/],
|
|
51
90
|
},
|
|
52
|
-
onSuccess:
|
|
91
|
+
onSuccess: finalizeDistArtifacts,
|
|
53
92
|
})
|
package/src/routing.yml
CHANGED
|
@@ -174,11 +174,17 @@ agents:
|
|
|
174
174
|
- talos
|
|
175
175
|
skills:
|
|
176
176
|
- agent-coordination
|
|
177
|
-
- session-goal
|
|
178
177
|
- artifact-management
|
|
179
|
-
- context-compression
|
|
180
178
|
- auto-continue
|
|
179
|
+
- codemap
|
|
180
|
+
- context-compression
|
|
181
181
|
- incremental-implementation
|
|
182
|
+
- loop-engineering
|
|
183
|
+
- reflect
|
|
184
|
+
- session-goal
|
|
185
|
+
- simplify
|
|
186
|
+
- verification-planning
|
|
187
|
+
- worktrees
|
|
182
188
|
athena:
|
|
183
189
|
role: Strategic planner
|
|
184
190
|
reasoning_effort: high
|
|
@@ -196,8 +202,13 @@ agents:
|
|
|
196
202
|
- memory_recall
|
|
197
203
|
- pantheon_resources
|
|
198
204
|
skills:
|
|
199
|
-
-
|
|
205
|
+
- loop-engineering
|
|
200
206
|
- memory-bank
|
|
207
|
+
- reflect
|
|
208
|
+
- simplify
|
|
209
|
+
- spec-driven-development
|
|
210
|
+
- verification-planning
|
|
211
|
+
- worktrees
|
|
201
212
|
apollo:
|
|
202
213
|
role: Investigation scout
|
|
203
214
|
reasoning_effort: low
|
|
@@ -215,6 +226,11 @@ agents:
|
|
|
215
226
|
subagent_can_delegate_to: []
|
|
216
227
|
skills:
|
|
217
228
|
- auto-continue
|
|
229
|
+
- codemap
|
|
230
|
+
- loop-engineering
|
|
231
|
+
- reflect
|
|
232
|
+
- simplify
|
|
233
|
+
- worktrees
|
|
218
234
|
hermes:
|
|
219
235
|
role: Backend specialist
|
|
220
236
|
reasoning_effort: medium
|
|
@@ -232,11 +248,14 @@ agents:
|
|
|
232
248
|
- memory_store
|
|
233
249
|
- pantheon_code_mode
|
|
234
250
|
skills:
|
|
235
|
-
-
|
|
236
|
-
- file-prompts
|
|
237
|
-
- streaming-patterns
|
|
251
|
+
- clonedeps
|
|
238
252
|
- git-workflow-and-versioning
|
|
239
253
|
- incremental-implementation
|
|
254
|
+
- loop-engineering
|
|
255
|
+
- reflect
|
|
256
|
+
- simplify
|
|
257
|
+
- tdd-with-agents
|
|
258
|
+
- worktrees
|
|
240
259
|
aphrodite:
|
|
241
260
|
role: Frontend specialist
|
|
242
261
|
reasoning_effort: medium
|
|
@@ -254,9 +273,13 @@ agents:
|
|
|
254
273
|
- pantheon_resources_memory_bank
|
|
255
274
|
- pantheon_code_mode
|
|
256
275
|
skills:
|
|
276
|
+
- incremental-implementation
|
|
277
|
+
- loop-engineering
|
|
278
|
+
- reflect
|
|
279
|
+
- simplify
|
|
257
280
|
- tdd-with-agents
|
|
258
281
|
- visual-review-pipeline
|
|
259
|
-
-
|
|
282
|
+
- worktrees
|
|
260
283
|
demeter:
|
|
261
284
|
role: Database specialist
|
|
262
285
|
reasoning_effort: medium
|
|
@@ -274,8 +297,12 @@ agents:
|
|
|
274
297
|
- memory_recall
|
|
275
298
|
- pantheon_code_mode
|
|
276
299
|
skills:
|
|
277
|
-
- tdd-with-agents
|
|
278
300
|
- incremental-implementation
|
|
301
|
+
- loop-engineering
|
|
302
|
+
- reflect
|
|
303
|
+
- simplify
|
|
304
|
+
- tdd-with-agents
|
|
305
|
+
- worktrees
|
|
279
306
|
themis:
|
|
280
307
|
role: Quality gate
|
|
281
308
|
reasoning_effort: high
|
|
@@ -294,9 +321,12 @@ agents:
|
|
|
294
321
|
- pantheon_code_mode
|
|
295
322
|
skills:
|
|
296
323
|
- code-review-checklist
|
|
324
|
+
- loop-engineering
|
|
325
|
+
- reflect
|
|
297
326
|
- security-hardening
|
|
327
|
+
- simplify
|
|
298
328
|
- tdd-with-agents
|
|
299
|
-
-
|
|
329
|
+
- worktrees
|
|
300
330
|
prometheus:
|
|
301
331
|
role: Infrastructure specialist
|
|
302
332
|
reasoning_effort: medium
|
|
@@ -315,6 +345,10 @@ agents:
|
|
|
315
345
|
skills:
|
|
316
346
|
- git-workflow-and-versioning
|
|
317
347
|
- incremental-implementation
|
|
348
|
+
- loop-engineering
|
|
349
|
+
- reflect
|
|
350
|
+
- simplify
|
|
351
|
+
- worktrees
|
|
318
352
|
hephaestus:
|
|
319
353
|
role: AI pipelines
|
|
320
354
|
reasoning_effort: medium
|
|
@@ -331,8 +365,13 @@ agents:
|
|
|
331
365
|
- memory_search
|
|
332
366
|
- pantheon_code_mode
|
|
333
367
|
skills:
|
|
334
|
-
- tdd-with-agents
|
|
335
368
|
- auto-continue
|
|
369
|
+
- clonedeps
|
|
370
|
+
- loop-engineering
|
|
371
|
+
- reflect
|
|
372
|
+
- simplify
|
|
373
|
+
- tdd-with-agents
|
|
374
|
+
- worktrees
|
|
336
375
|
nyx:
|
|
337
376
|
role: Observability
|
|
338
377
|
reasoning_effort: low
|
|
@@ -349,8 +388,12 @@ agents:
|
|
|
349
388
|
- pantheon_resources_routing
|
|
350
389
|
- pantheon_code_mode
|
|
351
390
|
skills:
|
|
352
|
-
- security-hardening
|
|
353
391
|
- auto-continue
|
|
392
|
+
- loop-engineering
|
|
393
|
+
- reflect
|
|
394
|
+
- security-hardening
|
|
395
|
+
- simplify
|
|
396
|
+
- worktrees
|
|
354
397
|
gaia:
|
|
355
398
|
role: Remote sensing domain specialist
|
|
356
399
|
reasoning_effort: low
|
|
@@ -365,6 +408,10 @@ agents:
|
|
|
365
408
|
- ml_classification
|
|
366
409
|
skills:
|
|
367
410
|
- auto-continue
|
|
411
|
+
- loop-engineering
|
|
412
|
+
- reflect
|
|
413
|
+
- simplify
|
|
414
|
+
- worktrees
|
|
368
415
|
iris:
|
|
369
416
|
role: GitHub operations
|
|
370
417
|
reasoning_effort: low
|
|
@@ -380,8 +427,12 @@ agents:
|
|
|
380
427
|
- changelog_generation
|
|
381
428
|
- pantheon_resources
|
|
382
429
|
skills:
|
|
383
|
-
- git-workflow-and-versioning
|
|
384
430
|
- artifact-management
|
|
431
|
+
- git-workflow-and-versioning
|
|
432
|
+
- loop-engineering
|
|
433
|
+
- reflect
|
|
434
|
+
- simplify
|
|
435
|
+
- worktrees
|
|
385
436
|
mnemosyne:
|
|
386
437
|
role: Memory bank
|
|
387
438
|
reasoning_effort: low
|
|
@@ -402,9 +453,13 @@ agents:
|
|
|
402
453
|
subagent_can_delegate_to: []
|
|
403
454
|
skills:
|
|
404
455
|
- artifact-management
|
|
405
|
-
- memory-bank
|
|
406
456
|
- context-compression
|
|
457
|
+
- loop-engineering
|
|
458
|
+
- memory-bank
|
|
459
|
+
- reflect
|
|
407
460
|
- session-goal
|
|
461
|
+
- simplify
|
|
462
|
+
- worktrees
|
|
408
463
|
talos:
|
|
409
464
|
role: Hotfix agent
|
|
410
465
|
reasoning_effort: low
|
|
@@ -421,6 +476,10 @@ agents:
|
|
|
421
476
|
subagent_can_delegate_to: []
|
|
422
477
|
skills:
|
|
423
478
|
- incremental-implementation
|
|
479
|
+
- loop-engineering
|
|
480
|
+
- reflect
|
|
481
|
+
- simplify
|
|
482
|
+
- worktrees
|
|
424
483
|
auto_continue:
|
|
425
484
|
checkpoint_script: .pantheon/code-mode/checkpoint-session.sh
|
|
426
485
|
heartbeat_interval: 5
|
package/src/skills/README.md
CHANGED
|
@@ -117,6 +117,10 @@ The `SKILL.md` file contains YAML frontmatter with `name`, `description`, and pl
|
|
|
117
117
|
- **Agent frontmatter**: Agents declare which skills they use via the `skills:` field in their `.agent.md` frontmatter. The platform uses this to determine relevance.
|
|
118
118
|
- **OpenCode platform**: Skills are listed in the system prompt's `<available_skills>` block. The agent invokes `skill` with the matching name to load the full content.
|
|
119
119
|
|
|
120
|
+
When editing a skill, run `npm run skills:lock` to refresh its content digest,
|
|
121
|
+
then `node scripts/validate-routing.mjs` to verify the lock, routing catalog,
|
|
122
|
+
agent grants, and skill inventory.
|
|
123
|
+
|
|
120
124
|
## Quick Reference Table
|
|
121
125
|
|
|
122
126
|
| # | Skill Name | Domain | Used By |
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: context-compression
|
|
3
3
|
description: "Use only for an explicit request to compact or preserve context; prefer native OpenCode compaction and minimal resumable checkpoints."
|
|
4
|
-
context: fork
|
|
5
|
-
globs: ["**/01-active-context.md", "**/02-progress-log.md"]
|
|
6
|
-
alwaysApply: false
|
|
7
4
|
---
|
|
8
5
|
|
|
9
6
|
# Context and Checkpoint Guidance
|