pantheon-opencode 1.6.2 → 1.6.3-beta.10
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 +1 -1
- package/AGENTS.md +1 -1
- package/CHANGELOG.md +69 -0
- package/README.md +14 -2
- package/bin/pantheon-init.mjs +1 -1
- package/package.json +1 -1
- package/plugin.json +1 -1
- package/pyproject.toml +1 -1
- package/scripts/decision-router-budget.mjs +4 -2
- package/scripts/decision-router-v2-egress.mjs +9 -2
- package/scripts/decision-router.mjs +58 -10
- package/scripts/install/decision-router-config.mjs +94 -8
- package/scripts/install/interactive.mjs +78 -10
- package/scripts/install/opencode.mjs +20 -0
- package/scripts/install/plugin.mjs +17 -0
- package/scripts/jev-live-probe.mjs +184 -0
- package/scripts/secret-scan.mjs +1 -1
- package/scripts/sync-tui.mjs +11 -0
- package/src/agents/zeus.md +24 -0
- package/src/pantheon/j-telemetry-file.ts +96 -0
- package/src/pantheon/jev-decision-tool.ts +240 -27
- package/src/pantheon/jev-decisions.ts +78 -14
- package/src/pantheon/jev-rank-verify.ts +435 -0
- package/src/pantheon/local-decision-budget.ts +11 -3
- package/src/pantheon/local-decision-provider-matrix.ts +3 -1
- package/src/pantheon/local-decision-usage-evidence.internal.ts +2 -2
- package/src/plugin-v2.ts +12 -2
- package/src/plugins/tui/dist/tui-v2.d.ts.map +1 -1
- package/src/plugins/tui/dist/tui-v2.js +457 -4
- package/src/plugins/tui/dist/tui-v2.js.map +1 -1
- package/src/plugins/tui/dist/tui.js +1 -1
- package/src/plugins/tui/package-lock.json +2 -2
- package/src/plugins/tui/package.json +1 -1
- package/src/plugins/tui/src/index-v2.tsx +6 -0
- package/src/plugins/tui/src/whats-new-highlights.ts +263 -0
- package/src/plugins/tui/src/whats-new-open.ts +80 -0
- package/src/plugins/tui/src/whats-new-state.ts +128 -0
- package/src/plugins/tui/src/whats-new.tsx +119 -0
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* jev-live-probe.mjs — operator-run live measurement for the Jev decision
|
|
4
|
+
* route (calibration ping + live scorecard).
|
|
5
|
+
*
|
|
6
|
+
* Talks to the HOST's decisions API through `opencode api` (the same route
|
|
7
|
+
* the plugin uses), so no credentials cross this script and every call is
|
|
8
|
+
* billed to the user's configured route. Operator-run by design: this is the
|
|
9
|
+
* consented measurement the J2 scorecard gate requires (offline harness
|
|
10
|
+
* measures plumbing; THIS measures the live model).
|
|
11
|
+
*
|
|
12
|
+
* Usage:
|
|
13
|
+
* node scripts/jev-live-probe.mjs --ping # 1 call, exit 0 if reachable
|
|
14
|
+
* node scripts/jev-live-probe.mjs --scorecard # N scenarios, dated scorecard
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { spawnSync } from 'node:child_process'
|
|
18
|
+
import { writeFileSync } from 'node:fs'
|
|
19
|
+
import { join } from 'node:path'
|
|
20
|
+
|
|
21
|
+
const HOST_TIMEOUT_MS = 30_000
|
|
22
|
+
|
|
23
|
+
/** Live scenarios: state → the skill a correct picker would choose. */
|
|
24
|
+
const SCENARIOS = [
|
|
25
|
+
{ state: 'Investigate why the payment webhook drops events under load', expect: 'apollo' },
|
|
26
|
+
{ state: 'Plan the database migration for the new billing table', expect: 'athena' },
|
|
27
|
+
{ state: 'Review the auth flow for security gaps before the release', expect: 'themis' },
|
|
28
|
+
{ state: 'Implement the retry queue endpoint for the notifications service', expect: 'hermes' },
|
|
29
|
+
{ state: 'Set up the CI pipeline for the new monorepo layout', expect: 'prometheus' },
|
|
30
|
+
{ state: 'Audit the permissions matrix across all specialists', expect: 'themis' },
|
|
31
|
+
{ state: 'Design the caching layer for the read-heavy dashboard', expect: 'athena' },
|
|
32
|
+
{ state: 'none — greet the user and ask what they want', expect: 'none' },
|
|
33
|
+
// Zero-dispatch agents' domains (roster-reform evidence batch)
|
|
34
|
+
{ state: 'Write the SQL indexes and stored procedures for the orders schema', expect: 'demeter' },
|
|
35
|
+
{ state: 'Process the satellite imagery tiles and classify land use', expect: 'gaia' },
|
|
36
|
+
{
|
|
37
|
+
state: 'Integrate the new LLM provider SDK and wire the prompt templates',
|
|
38
|
+
expect: 'hephaestus',
|
|
39
|
+
},
|
|
40
|
+
{ state: 'Migrate the open issues to the new milestone labels via the API', expect: 'iris' },
|
|
41
|
+
{ state: 'Decide which stale session summaries are worth keeping', expect: 'mnemosyne' },
|
|
42
|
+
{ state: 'Fuzz the input parser with malformed payloads to find crashes', expect: 'nyx' },
|
|
43
|
+
{ state: 'Verify the export module against the compliance checklist', expect: 'talos' },
|
|
44
|
+
{ state: 'Polish the onboarding screen layout and micro-interactions', expect: 'aphrodite' },
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
function callDecisions(modelRef, state) {
|
|
48
|
+
const payload = JSON.stringify({
|
|
49
|
+
model: modelRef,
|
|
50
|
+
input: [{ type: 'text', text: state }],
|
|
51
|
+
questions: [
|
|
52
|
+
{
|
|
53
|
+
type: 'choice',
|
|
54
|
+
name: 'pick',
|
|
55
|
+
instructions:
|
|
56
|
+
'Pick the single best specialist for this task, or none. Required skills beat preferred ones; judge from the state alone.',
|
|
57
|
+
choices: [
|
|
58
|
+
{ value: 'apollo', description: 'read-only investigation and research' },
|
|
59
|
+
{ value: 'athena', description: 'planning and architecture' },
|
|
60
|
+
{ value: 'themis', description: 'security, review and compliance gates' },
|
|
61
|
+
{ value: 'hermes', description: 'backend implementation' },
|
|
62
|
+
{ value: 'prometheus', description: 'infrastructure, CI and pipelines' },
|
|
63
|
+
{ value: 'hephaestus', description: 'AI tooling and model integration' },
|
|
64
|
+
{ value: 'demeter', description: 'databases and data layer' },
|
|
65
|
+
{ value: 'gaia', description: 'remote sensing and geospatial' },
|
|
66
|
+
{ value: 'iris', description: 'GitHub operations and automation' },
|
|
67
|
+
{ value: 'aphrodite', description: 'UI and frontend craft' },
|
|
68
|
+
{ value: 'mnemosyne', description: 'memory curation and recall' },
|
|
69
|
+
{ value: 'nyx', description: 'chaos and adversarial testing' },
|
|
70
|
+
{ value: 'talos', description: 'validation and compliance checks' },
|
|
71
|
+
{ value: 'none', description: 'no specialist fits' },
|
|
72
|
+
],
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
})
|
|
76
|
+
const result = spawnSync(
|
|
77
|
+
'opencode',
|
|
78
|
+
['api', 'POST', '/api/experimental/generate/decisions', '-d', payload],
|
|
79
|
+
{
|
|
80
|
+
encoding: 'utf8',
|
|
81
|
+
timeout: HOST_TIMEOUT_MS,
|
|
82
|
+
},
|
|
83
|
+
)
|
|
84
|
+
if (result.status !== 0) {
|
|
85
|
+
return { ok: false, raw: (result.stderr || result.stdout || '').slice(0, 300) }
|
|
86
|
+
}
|
|
87
|
+
try {
|
|
88
|
+
return { ok: true, data: JSON.parse(result.stdout) }
|
|
89
|
+
} catch {
|
|
90
|
+
return { ok: false, raw: result.stdout.slice(0, 300) }
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function answerChoice(data) {
|
|
95
|
+
const answers = data?.data?.answers ?? data?.answers
|
|
96
|
+
if (!Array.isArray(answers)) return null
|
|
97
|
+
const pick = answers.find((a) => a.name === 'pick')
|
|
98
|
+
return pick?.choice ?? null
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const args = process.argv.slice(2)
|
|
102
|
+
|
|
103
|
+
if (args.includes('--ping')) {
|
|
104
|
+
const modelRef = { providerID: 'opencode', id: 'jev-1.13-free' }
|
|
105
|
+
const r = callDecisions(modelRef, 'Calibration ping: is the Jev decision route reachable?')
|
|
106
|
+
if (r.ok) {
|
|
107
|
+
const cost = r.data?.cost ?? r.data?.data?.cost
|
|
108
|
+
console.log(`✅ reachable — cost: ${JSON.stringify(cost)}`)
|
|
109
|
+
process.exit(0)
|
|
110
|
+
}
|
|
111
|
+
console.error(`❌ unreachable: ${r.raw}`)
|
|
112
|
+
process.exit(1)
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if (args.includes('--scorecard')) {
|
|
116
|
+
// Route from the user's decision-router config (explicit selection only).
|
|
117
|
+
const { readFileSync } = await import('node:fs')
|
|
118
|
+
const { homedir } = await import('node:os')
|
|
119
|
+
const xdg = process.env.XDG_CONFIG_HOME?.startsWith('/')
|
|
120
|
+
? process.env.XDG_CONFIG_HOME
|
|
121
|
+
: join(homedir(), '.config')
|
|
122
|
+
const cfg = JSON.parse(readFileSync(join(xdg, 'pantheon', 'decision-router.json'), 'utf8'))
|
|
123
|
+
if (!cfg.enabled || cfg.selection.mode !== 'explicit') {
|
|
124
|
+
console.error('the router must be enabled with an explicit selection for a live run')
|
|
125
|
+
process.exit(1)
|
|
126
|
+
}
|
|
127
|
+
// Same host-provider mapping the plugin route resolver uses (subset of
|
|
128
|
+
// NATIVE_JEV_HOST_PROVIDERS — keep in sync when the matrix expands).
|
|
129
|
+
const HOST_PROVIDERS = {
|
|
130
|
+
'typesafe-jev': 'typesafe-ai',
|
|
131
|
+
'opencode-console-jev': 'opencode',
|
|
132
|
+
'openrouter-jev': 'openrouter',
|
|
133
|
+
'vercel-gateway-jev': 'vercel-ai-gateway',
|
|
134
|
+
'cloudflare-workers-jev': 'cloudflare-workers-ai',
|
|
135
|
+
}
|
|
136
|
+
const hostProvider = HOST_PROVIDERS[cfg.selection.provider]
|
|
137
|
+
if (!hostProvider) {
|
|
138
|
+
console.error(`unknown selection provider: ${cfg.selection.provider}`)
|
|
139
|
+
process.exit(1)
|
|
140
|
+
}
|
|
141
|
+
const modelRef = { providerID: hostProvider, id: cfg.selection.model }
|
|
142
|
+
|
|
143
|
+
const rows = []
|
|
144
|
+
let totalCost = 0
|
|
145
|
+
for (const scenario of SCENARIOS) {
|
|
146
|
+
const r = callDecisions(modelRef, scenario.state)
|
|
147
|
+
if (!r.ok) {
|
|
148
|
+
rows.push({ state: scenario.state, expect: scenario.expect, got: `ERROR: ${r.raw}` })
|
|
149
|
+
continue
|
|
150
|
+
}
|
|
151
|
+
const cost = r.data?.cost ?? 0
|
|
152
|
+
totalCost += Number(cost) || 0
|
|
153
|
+
rows.push({ state: scenario.state, expect: scenario.expect, got: answerChoice(r.data), cost })
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
const date = new Date().toISOString().slice(0, 10)
|
|
157
|
+
const out = [
|
|
158
|
+
`# Live J2 scorecard — ${date}`,
|
|
159
|
+
'',
|
|
160
|
+
`Route: \`${modelRef.providerID}/${modelRef.id}\`. Operator-run via \`opencode api\``,
|
|
161
|
+
'(consented route, billed to the user). 12 scenarios; agreement between the',
|
|
162
|
+
'live model and the expected pick is the metric — this measures the MODEL,',
|
|
163
|
+
'unlike the offline harness that measures the plumbing.',
|
|
164
|
+
'',
|
|
165
|
+
'| state (truncated) | expect | live | cost |',
|
|
166
|
+
'| --- | --- | --- | --- |',
|
|
167
|
+
...rows.map(
|
|
168
|
+
(r) =>
|
|
169
|
+
`| ${r.state.slice(0, 48)}${r.state.length > 48 ? '…' : ''} | ${r.expect} | ${r.got ?? '—'} | ${r.cost ?? '—'} |`,
|
|
170
|
+
),
|
|
171
|
+
'',
|
|
172
|
+
`Total cost: $${totalCost.toFixed(6)}. Honest caveat: one run is a smoke`,
|
|
173
|
+
'measurement, not a calibration — a claim about model quality needs',
|
|
174
|
+
'repeated runs and a bigger scenario set.',
|
|
175
|
+
'',
|
|
176
|
+
].join('\n')
|
|
177
|
+
const outPath = `bench/results/j2-live-scorecard-${date}.md`
|
|
178
|
+
writeFileSync(outPath, out)
|
|
179
|
+
console.log(`✅ live scorecard written: ${outPath} (total $${totalCost.toFixed(6)})`)
|
|
180
|
+
process.exit(0)
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
console.error('usage: node scripts/jev-live-probe.mjs --ping | --scorecard')
|
|
184
|
+
process.exit(1)
|
package/scripts/secret-scan.mjs
CHANGED
|
@@ -34,7 +34,7 @@ const patterns = [
|
|
|
34
34
|
{
|
|
35
35
|
label: 'literal API key value',
|
|
36
36
|
regex: new RegExp(
|
|
37
|
-
`["']${escapeRegExp(apiKeyName)}["']\\s*[:=]\\s*["'](?!\\$\\{|process\\.env|os\\.getenv|env:)[^"']{12,}["']`,
|
|
37
|
+
`["']${escapeRegExp(apiKeyName)}["']\\s*[:=]\\s*["'](?!\\$\\{|process\\.env|os\\.getenv|env:|\\{env:)[^"']{12,}["']`,
|
|
38
38
|
'i',
|
|
39
39
|
),
|
|
40
40
|
},
|
package/scripts/sync-tui.mjs
CHANGED
|
@@ -106,6 +106,17 @@ export function copyPluginFiles(srcDir, dstDir, version) {
|
|
|
106
106
|
else result.skipped++
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
+
// CHANGELOG.md — the copy's one-time "What's new" window reads the release
|
|
110
|
+
// highlights for the running version from its own installed root. Best
|
|
111
|
+
// effort: a missing source simply means no window (the TUI fails open).
|
|
112
|
+
// src/plugins/tui → src/plugins → src → package root.
|
|
113
|
+
const changelogSrc = join(srcDir, '..', '..', '..', 'CHANGELOG.md')
|
|
114
|
+
if (existsSync(changelogSrc)) {
|
|
115
|
+
if (writeIfChanged(join(dstDir, 'CHANGELOG.md'), readFileSync(changelogSrc, 'utf8'))) {
|
|
116
|
+
result.created++
|
|
117
|
+
} else result.skipped++
|
|
118
|
+
}
|
|
119
|
+
|
|
109
120
|
const tuiEntry = join(srcDir, version === 'v2' ? 'tui-v2.ts' : 'tui.ts')
|
|
110
121
|
if (existsSync(tuiEntry)) {
|
|
111
122
|
if (writeIfChanged(join(dstDir, 'tui.ts'), readFileSync(tuiEntry, 'utf8'))) result.created++
|
package/src/agents/zeus.md
CHANGED
|
@@ -53,6 +53,30 @@ skills:
|
|
|
53
53
|
`docs/tui-v2-quota-providers.md` — it is not a Pantheon surface and never a
|
|
54
54
|
Pantheon egress path.
|
|
55
55
|
|
|
56
|
+
## MCP call timing (when each integration fires)
|
|
57
|
+
|
|
58
|
+
- **Memory (recall)** — only when prior project history could change the
|
|
59
|
+
outcome of the current decision, and at most one selective search per
|
|
60
|
+
turn. Never recall for context you already hold; never recall during a
|
|
61
|
+
delegation (the Brief is self-contained by design).
|
|
62
|
+
- **Memory (store)** — when YOU judge it prudent: durable, reusable facts
|
|
63
|
+
(decisions, root causes, conventions) that a future session would need.
|
|
64
|
+
Not per-turn noise; never store secrets, user content or transient state.
|
|
65
|
+
The user can always ask to store or purge — your judgment handles the
|
|
66
|
+
rest.
|
|
67
|
+
- **Persistence (checkpoint)** — when prudent: session milestones where the
|
|
68
|
+
work done so far would be expensive to lose (after a risky migration, a
|
|
69
|
+
long investigation, a structural change). Never per turn; never for
|
|
70
|
+
trivial progress.
|
|
71
|
+
- **Vision (`vision_describe`)** — only when a tool call or attachment
|
|
72
|
+
actually carries an image; a text-only turn never fires it.
|
|
73
|
+
- **Code-mode / quota** — infrastructure reads (sessions, models, worktrees)
|
|
74
|
+
are cheap and on demand; never for decisions that `pantheon_jev_decide`
|
|
75
|
+
or the local selector already answer.
|
|
76
|
+
- When in doubt: the local selector answers free, the Jev tool answers
|
|
77
|
+
cheap and typed, an MCP call is the LAST resort for state the session
|
|
78
|
+
cannot reconstruct.
|
|
79
|
+
|
|
56
80
|
## Missing capability? Find a skill before inventing one
|
|
57
81
|
|
|
58
82
|
When no installed skill covers a recurring need, search the open ecosystem before writing new instructions:
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* j-telemetry-file.ts — field-baseline mirror for the J-series shadow
|
|
3
|
+
* records (J1 risk gate, J3 escalation, J4 review).
|
|
4
|
+
*
|
|
5
|
+
* The in-memory sink (`createTelemetrySink`) is deliberately I/O-free and
|
|
6
|
+
* "the plugin never reads back" — which made the shadow records impossible
|
|
7
|
+
* to measure in the field, and the J1/J3 activation gate requires a measured
|
|
8
|
+
* baseline. This module adds the measurement channel: an opt-in JSONL mirror
|
|
9
|
+
* (`.pantheon/logs/j-telemetry.jsonl`) written ONLY when the J-series flags
|
|
10
|
+
* are on, carrying ONLY the already-sanitized record fields (point, mode,
|
|
11
|
+
* effect, reason tokens — the same bounded vocabulary the in-memory records
|
|
12
|
+
* carry; no user content exists on this path by construction).
|
|
13
|
+
*
|
|
14
|
+
* Fire-and-forget like every plugin log: a write failure is swallowed and
|
|
15
|
+
* never reaches the hook. The file is size-capped (rotate to `.1`, drop the
|
|
16
|
+
* oldest) so a long session cannot grow it unbounded.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import { appendFile, mkdir, rename, stat } from 'node:fs/promises'
|
|
20
|
+
import { dirname, join } from 'node:path'
|
|
21
|
+
|
|
22
|
+
const MAX_FILE_BYTES = 1_048_576
|
|
23
|
+
|
|
24
|
+
/** Default mirror target: the established Pantheon logs directory. */
|
|
25
|
+
export function defaultMirrorPath(cwd: string = process.cwd()): string {
|
|
26
|
+
return join(cwd, '.pantheon', 'logs', 'j-telemetry.jsonl')
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** The record fields allowed on the wire. Everything else is dropped. */
|
|
30
|
+
const ALLOWED_FIELDS = ['point', 'mode', 'effect', 'decision', 'reason'] as const
|
|
31
|
+
|
|
32
|
+
/** Extract the bounded projection a mirror line may carry. */
|
|
33
|
+
export function mirrorProjection(record: unknown): Record<string, unknown> | null {
|
|
34
|
+
if (record === null || typeof record !== 'object' || Array.isArray(record)) return null
|
|
35
|
+
const source = record as Record<string, unknown>
|
|
36
|
+
const projected: Record<string, unknown> = { ts: new Date().toISOString() }
|
|
37
|
+
for (const field of ALLOWED_FIELDS) {
|
|
38
|
+
const value = source[field]
|
|
39
|
+
if (value === undefined) continue
|
|
40
|
+
if (typeof value !== 'string') return null
|
|
41
|
+
if (value.length > 200) return null
|
|
42
|
+
projected[field] = value
|
|
43
|
+
}
|
|
44
|
+
return projected
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface JTelemetryMirror {
|
|
48
|
+
/**
|
|
49
|
+
* Append one sanitized record line; best-effort, never throws. Fire-and-
|
|
50
|
+
* forget at call sites (the promise may be ignored); it is returned so a
|
|
51
|
+
* test can await the write.
|
|
52
|
+
*/
|
|
53
|
+
record(record: unknown): Promise<void>
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Create the opt-in JSONL mirror. Returns null when `enabled` is false so
|
|
58
|
+
* callers keep the zero-overhead path branch-free.
|
|
59
|
+
* @param {{ enabled: boolean, path?: string }} options
|
|
60
|
+
*/
|
|
61
|
+
export function createJTelemetryMirror(options: {
|
|
62
|
+
enabled: boolean
|
|
63
|
+
path?: string
|
|
64
|
+
}): JTelemetryMirror | null {
|
|
65
|
+
if (!options.enabled) return null
|
|
66
|
+
const path = options.path ?? defaultMirrorPath()
|
|
67
|
+
let rotating = false
|
|
68
|
+
return {
|
|
69
|
+
record(record: unknown): Promise<void> {
|
|
70
|
+
try {
|
|
71
|
+
const projected = mirrorProjection(record)
|
|
72
|
+
if (projected === null) return Promise.resolve()
|
|
73
|
+
const line = `${JSON.stringify(projected)}\n`
|
|
74
|
+
return (async () => {
|
|
75
|
+
try {
|
|
76
|
+
if (!rotating) {
|
|
77
|
+
const current = await stat(path).catch(() => null)
|
|
78
|
+
if (current !== null && current.size > MAX_FILE_BYTES) {
|
|
79
|
+
rotating = true
|
|
80
|
+
await rename(path, `${path}.1`).catch(() => {})
|
|
81
|
+
rotating = false
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
await mkdir(dirname(path), { recursive: true })
|
|
85
|
+
await appendFile(path, line, 'utf8')
|
|
86
|
+
} catch {
|
|
87
|
+
// Best-effort mirror — never break the plugin over telemetry.
|
|
88
|
+
}
|
|
89
|
+
})()
|
|
90
|
+
} catch {
|
|
91
|
+
// Swallow: projection failures are data-shaped, never fatal.
|
|
92
|
+
return Promise.resolve()
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
}
|
|
96
|
+
}
|