pantheon-opencode 1.6.3-beta.2 → 1.6.3-beta.21

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.
Files changed (69) hide show
  1. package/AGENTS.global.md +1 -1
  2. package/AGENTS.md +1 -1
  3. package/CHANGELOG.md +143 -0
  4. package/README.md +21 -3
  5. package/README.pt-BR.md +1 -1
  6. package/bin/pantheon-init.mjs +46 -28
  7. package/package.json +1 -1
  8. package/plugin.json +2 -2
  9. package/pyproject.toml +1 -1
  10. package/scripts/decision-router-budget.mjs +103 -3
  11. package/scripts/decision-router-v2-budget.mjs +2 -2
  12. package/scripts/decision-router.mjs +88 -6
  13. package/scripts/install/cli-ui.mjs +2 -1
  14. package/scripts/install/decision-router-config.mjs +53 -0
  15. package/scripts/install/interactive.mjs +103 -9
  16. package/scripts/install/opencode.mjs +101 -30
  17. package/scripts/install/plugin.mjs +17 -0
  18. package/scripts/jev-live-probe.mjs +212 -0
  19. package/scripts/skill-search.mjs +273 -0
  20. package/scripts/sync-tui.mjs +11 -0
  21. package/skills-lock.json +1 -0
  22. package/src/agents/aphrodite.md +34 -1
  23. package/src/agents/apollo.md +227 -0
  24. package/src/agents/athena.md +26 -0
  25. package/src/agents/demeter.md +33 -0
  26. package/src/agents/gaia.md +24 -0
  27. package/src/agents/hephaestus.md +24 -0
  28. package/src/agents/hermes.md +33 -0
  29. package/src/agents/iris.md +24 -0
  30. package/src/agents/mnemosyne.md +25 -3
  31. package/src/agents/nyx.md +50 -22
  32. package/src/agents/prometheus.md +242 -1
  33. package/src/agents/talos.md +24 -0
  34. package/src/agents/themis.md +24 -0
  35. package/src/agents/zeus.md +67 -6
  36. package/src/pantheon/j-telemetry-file.ts +96 -0
  37. package/src/pantheon/j1-approvals.ts +123 -0
  38. package/src/pantheon/jev-decision-tool.ts +268 -34
  39. package/src/pantheon/jev-decisions.ts +92 -8
  40. package/src/pantheon/jev-escalation.ts +1 -1
  41. package/src/pantheon/jev-quality-score.ts +7 -2
  42. package/src/pantheon/jev-rank-verify.ts +661 -0
  43. package/src/pantheon/jev-risk-gate.ts +75 -8
  44. package/src/pantheon/local-decision-budget.ts +170 -3
  45. package/src/pantheon/local-decision-router.ts +16 -0
  46. package/src/pantheon/local-decision-turn.ts +39 -4
  47. package/src/pantheon/local-decision-usage-evidence.internal.ts +2 -2
  48. package/src/pantheon/pantheon-decision-catalog.ts +9 -2
  49. package/src/pantheon/v2-decision-budget.ts +4 -2
  50. package/src/plugin-v2.ts +94 -7
  51. package/src/plugins/tui/dist/server-v2.d.ts +14 -6
  52. package/src/plugins/tui/dist/server-v2.d.ts.map +1 -1
  53. package/src/plugins/tui/dist/server-v2.js +16 -9
  54. package/src/plugins/tui/dist/server-v2.js.map +1 -1
  55. package/src/plugins/tui/dist/tui-v2.d.ts.map +1 -1
  56. package/src/plugins/tui/dist/tui-v2.js +560 -4
  57. package/src/plugins/tui/dist/tui-v2.js.map +1 -1
  58. package/src/plugins/tui/dist/tui.js +1 -1
  59. package/src/plugins/tui/package-lock.json +2 -2
  60. package/src/plugins/tui/package.json +1 -1
  61. package/src/plugins/tui/src/index-v2.tsx +6 -0
  62. package/src/plugins/tui/src/server-v2.ts +14 -7
  63. package/src/plugins/tui/src/whats-new-highlights.ts +317 -0
  64. package/src/plugins/tui/src/whats-new-open.ts +120 -0
  65. package/src/plugins/tui/src/whats-new-state.ts +128 -0
  66. package/src/plugins/tui/src/whats-new.tsx +172 -0
  67. package/src/routing.yml +1 -0
  68. package/src/skills/README.md +1 -1
  69. package/src/skills/prompt-refinery/SKILL.md +41 -0
package/AGENTS.global.md CHANGED
@@ -1,7 +1,7 @@
1
1
  <!-- pantheon:generated:begin — Pantheon-managed region; regenerated on install/upgrade, never edit inside -->
2
2
  <!-- Generated by scripts/build-agents-md.mjs — do not edit directly. -->
3
3
  <!-- Source of truth: src/instructions/*.instructions.md + the static sections in this script. -->
4
- <!-- pantheon:agents-md v2 artifact=global generated-at=2026-10-27T08:34:01-03:00 sha=0a6a8e2 -->
4
+ <!-- pantheon:agents-md v2 artifact=global generated-at=2026-11-04T19:23:07-03:00 sha=ad9f855 -->
5
5
 
6
6
  # Pantheon Agent System — OpenCode
7
7
 
package/AGENTS.md CHANGED
@@ -1,7 +1,7 @@
1
1
  <!-- pantheon:generated:begin — Pantheon-managed region; regenerated on install/upgrade, never edit inside -->
2
2
  <!-- Generated by scripts/build-agents-md.mjs — do not edit directly. -->
3
3
  <!-- Source of truth: project sections in scripts/build-agents-md.mjs. -->
4
- <!-- pantheon:agents-md v2 artifact=project generated-at=2026-10-27T08:34:01-03:00 sha=0a6a8e2 -->
4
+ <!-- pantheon:agents-md v2 artifact=project generated-at=2026-11-04T19:23:07-03:00 sha=ad9f855 -->
5
5
 
6
6
  # Pantheon — Repository Setup
7
7
 
package/CHANGELOG.md CHANGED
@@ -10,6 +10,149 @@ 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.3-beta.21] - 2026-11-06
14
+
15
+ ## 🆕 What's New
16
+ - The J1 enforce block is now an APPROVAL GATE: a high-risk call is denied with an ask — the agent questions the user under a `j1-approval-<hash>` marker; an affirmative answer mints a hash-pinned, TTL-bounded (15 min), session-scoped pass for that exact call, and the retry executes (and records). No observed answer, no pass — fail-closed.
17
+ - QA beta.20 fixes: verify verdict band precedence (0.35–0.65 UNVERIFIABLE inclusive; PASS strictly above), order maps scores back to the caller's candidate ids, `=shadow` no longer reads as off, scorecard count/cost honesty.
18
+
19
+ ## [v1.6.3-beta.20] - 2026-11-06
20
+
21
+ ## 🆕 What's New
22
+ - The J1 enforce block is now a HANDOFF CONTRACT: a high-risk call is denied with instructions to present it to the user for a MANUAL decision — no executing, no working around; the message names the levers (threshold, mode, rerun without the risky step).
23
+
24
+ ## [v1.6.3-beta.19] - 2026-11-06
25
+
26
+ ## 🆕 What's New
27
+ - Local router D3 fixed: a PT-BR delegation no longer starves on skills — when the English-lexical prefilter matches nothing but the agent is known, the agent's curated delegation-relevant grants feed the turn (same domain, EN fed / PT starved was the four-report-old field bug).
28
+ - D4: the complexity dimensions' polarity is documented where it bit — higher = riskier/less contained (boundedness:2 is POORLY bounded), aggregate label = max(dimensions).
29
+
30
+ ## [v1.6.3-beta.18] - 2026-11-06
31
+
32
+ ## 🆕 What's New
33
+ - `mode: "order"`: ORDER 2-4 candidates by fit — one score question per candidate, the descending ordering with per-candidate scores comes back (nulls visible, last, never guessed). Rank picks a winner; order ranks the shortlist.
34
+ - The review questions are self-documenting now: `quality` (score) and `needs_review` (predicate) — "noul" was the decision model's internal archetype leaking into user-visible payloads.
35
+
36
+ ## [v1.6.3-beta.17] - 2026-11-05
37
+
38
+ ## 🆕 What's New
39
+ - The J1 gate is now a ladder: off / shadow / warn / enforce (PANTHEON_J1_RISK_SCORE). Enforce awaits the bounded gate and DENIES a high-risk tool call in-session, with the threshold configurable (PANTHEON_J1_ENFORCE_THRESHOLD, default 0.8). Shadow stays the default-on behavior.
40
+ - CALLER_NOT_ALLOWED refusals now teach the fix: allowlist the caller via PANTHEON_JEV_SPECIALIST_CALLERS or ask Zeus to route.
41
+ - Plan persistence contract: Athena returns the plan as her response; Zeus persists PLAN.md — no more refused write attempts on deepwork plans.
42
+
43
+ ## [v1.6.3-beta.16] - 2026-11-05
44
+
45
+ ## 🆕 What's New
46
+ - `prompt-refinery` skill: a vague multi-part request is refined into a structured contract (objective, slices, acceptance criteria, open questions with defaults) shown for confirm-or-adjust BEFORE executing — one planning turn on the session model.
47
+ - Skills mode offers the full local catalog + host skills — the lexical prefilter could drop the exact skill you described (codemap → none 0.88). candidateSource still reports the pool.
48
+ - nyx returns to observability & cost analytics (owner intent), prometheus drops those words — the routing you expected now matches the catalog.
49
+
50
+ ## [v1.6.3-beta.15] - 2026-11-05
51
+
52
+ ## 🆕 What's New
53
+ - "Agent not found" fixed: the installer stops writing the cwd-relative agent `source` provenance and heals it away from existing installs — the host 2.2.5 resolved it against the session cwd and the whole roster vanished outside the config dir.
54
+
55
+ ## [v1.6.3-beta.14] - 2026-11-05
56
+
57
+ ## 🆕 What's New
58
+ - pantheon-tui loads on every boot again: the server stub now exports the definition object host 2.2.5 requires (was ~3 load failures per boot, forever).
59
+ - verify accepts optional `state` evidence and reports UNVERIFIABLE for the 0.35–0.65 band — false and "could not tell" are no longer the same verdict.
60
+ - The skills-search popularity parser reads K/M counts — the most popular results no longer vanish from the skills.sh tier.
61
+ - The installer never leaves the plugin registered into the volatile npx cache (the intermittent plugin-death root cause); the preflight also covers pure-V2 configs now.
62
+ - prometheus's description names observability/tracing — the reform's domain split is now visible to the router.
63
+
64
+ ## [v1.6.3-beta.13] - 2026-11-05
65
+
66
+ ## 🆕 What's New
67
+ - One coherent setup summary: a single closing block instead of two competing "Next steps" lists.
68
+ - Warnings restate their text inline — no more hunting for what scrolled past.
69
+ - The worktree guidance box is project-only (a global install from $HOME showed a nonsense path).
70
+ - The banner now prints the exact `source` line for the decision-layer flags file — the silent-off gap fixed.
71
+
72
+ ## [v1.6.3-beta.12] - 2026-11-05
73
+
74
+ ## 🆕 What's New
75
+ - Delegation answers are domain-aware again: agent descriptions ride with every choice — live probe 5/5 exact (FastAPI→hermes, WCAG→aphrodite, Alembic→demeter, security→themis, poem→none).
76
+ - The input envelope is enforced on EVERY path now: presets, review, rank and verify all refuse missing/unknown keys with the exact cause.
77
+ - Rank accepts up to 20 candidates (typesafe_rank contract) and names the accepted range on refusal.
78
+ - Skills results report where the candidates came from (`candidateSource`), ending silent prefilter misses.
79
+ - The local router respects open gates: review/approval required → abstain (`GATE_OPEN`), never route around.
80
+
81
+ ## [v1.6.3-beta.11] - 2026-11-05
82
+
83
+ ### 🆕 What's New
84
+ - Measured MCP usage policy across the roster — governance ladder byte-identical in all 13 specialists.
85
+ - Skill-discovery pipeline with the trust cascade: Anthropic catalog → skills.sh → GitHub; Jev ranks, you install.
86
+ - Dead-route holds release (ledger schema v4) — the fix for budgets frozen by removed routes.
87
+ - Roster reform: nyx re-scoped to chaos & adversarial, talos aligned to hotfix, domain docs per agent.
88
+ - Jev validated end to end in the field: N4 dead, verify field-verified, sandbox 28/28.
89
+
90
+ ### Added
91
+
92
+ - **agents** — The roster reform, measured: the governance ladder (session context → free local selector → one typed Jev question → MCP last resort, with the durable-store, milestone-checkpoint and one-pass-vision rules) now sits byte-identical in all 13 specialist agents, pinned by `tests/agent-mcp-policy.test.mjs`; nyx is re-scoped to its intended chaos & adversarial identity (its observability body duplicated prometheus and left fuzzing uncovered — the observability material moved to prometheus); mnemosyne's description names its memory-MCP curation ownership; the live scorecard's talos scenario now matches the real hotfix-express-lane identity. Post-reform live scorecard: 14/16 exact, 8/8 on the zero-dispatch agents.
93
+ - **skills** — The skill-discovery pipeline: installed pool first (one Jev `mode: "skills"`), then one read-only search across the trust cascade — the canonical `anthropics/skills` catalog first (so `pdf`/`docx`/`mcp-builder` outrank the clones popularity ranking surfaces), the skills.sh index with install counts, then raw GitHub `SKILL.md` code search (8,480 hits where the index offered three) — via `scripts/skill-search.mjs` emitting tier-ordered `{skill, installs, url, source}` JSON, pinned by `tests/skill-search.test.mjs`, then one typed Jev choice question ranking the candidates (only names/counts/descriptions cross — skill contents are untrusted), then the winning candidate is PROPOSED to the user with the project-scoped install command. Pantheon never installs; the review is the user's. The ladder is documented in `docs/reference/native-decisions.md` and carried in `zeus.md`.
94
+ - **routing** — `decision-router holds release --provider <dead> --reason "<why>"`: the administrative correction for holds of routes that no longer exist (they can never reconcile and froze budget forever — the mechanical story behind the mid-month Jev die-offs). Ledger schema v4 adds the immutable `released_holds` archive; live providers are refused, their holds roll off with the period. First field application: the 10 `jev-free` fossils of the removed free route released, $1.00 of reserved budget freed.
95
+ - **mcp** — `bench/mcp-usage-audit.mjs`: the measured native-MCP usage audit (transcript, memory db, persistence kv, bench lines → dated report in `bench/results/`; reports are local-only, they carry bounded session excerpts). First run measured the whole field history: 5.7k memory touches, 2.5k persistence, 84 vision — the verdicts and cost model live in `docs/mcp-tools.md`.
96
+
97
+ - **agents** — The 14-agent domain-artifact analysis (docs/agents/README.md): each specialist owns its domain's durable file — aphrodite keeps docs/ui/conventions.md current whenever the project has a graphical surface, demeter docs/data, hermes docs/api, prometheus docs/infra — read-first, propose-when-missing, update-only-what-you-changed; new exclusive per-agent tools fail the measured bar (grants already enforce the exclusivity that pays).
98
+
99
+
100
+ ### Changed
101
+
102
+ - **agents** — The zeus usage policy is measured, not decorative: `memory_store` takes durable, reusable facts only (session narration goes to a checkpoint or nowhere; per-project namespaces; update instead of duplicate), checkpoints fire at milestones only (never per turn, never re-saving an unchanged key), and vision runs one pass per image (zeus and aphrodite) — each vision call is real gateway spend. The contradictory store phrases that produced the narration excess are gone, pinned by `tests/agent-mcp-policy.test.mjs`.
103
+
104
+ ## [v1.6.3-beta.10] - 2026-11-04
105
+
106
+ ### Fixed
107
+
108
+ - **routing** — The Jev input envelope is enforced: schemaVersion is required (SCHEMA_VERSION_INVALID) and unknown keys are rejected (UNKNOWN_INPUT_KEYS) — the declared contract is now the enforced contract (field report N2/N3).
109
+
110
+ <!-- beta.7–beta.9 were landed together in 548fc6d; separate commits for these releases are absent from repository history. Per-beta attribution follows that commit’s grouped changelog snapshot. -->
111
+
112
+ ## [v1.6.3-beta.9] - 2026-11-04
113
+
114
+ ### Changed
115
+
116
+ - **agents** — The live scorecard now runs the full 13-specialist catalog (was a 5-agent sample); first full-catalog run: 6 exact hits, 2 domain-adjacent judgment calls, measured per agent.
117
+ - **agents** — Zeus gains consolidated MCP call-timing rules: when to recall, when to store, when to checkpoint, when vision fires, and the escalation order (local selector -> Jev -> MCP last resort).
118
+
119
+ ## [v1.6.3-beta.8] - 2026-11-04
120
+
121
+ ### Added
122
+
123
+ - **routing** — The v3.1 **rank** and **verify** primitives on `pantheon_jev_decide`: `mode: "rank"` picks the winner among up to 8 candidates with a fit score (the host answers one scalar per question, so full ordering is impossible — documented); `mode: "verify"` checks 1–4 claims as predicate questions with **BLOCK fail-closed**. Hostile inputs rejected. Zeus-only, same gate chain.
124
+
125
+ ## [v1.6.3-beta.7] - 2026-11-04
126
+
127
+ ### Added
128
+
129
+ - **routing** — `jev-live-probe.mjs`: the operator-run live measurement tool. `--ping` only resolves the configured route locally (exit 0 when valid; no provider call); `--scorecard` runs the 16 configured live scenarios against that route and writes the dated scorecard into `bench/results/`. First live run: 7/8 correct specialist picks via OpenRouter.
130
+
131
+ ## [v1.6.3-beta.6] - 2026-11-04
132
+
133
+ ### Added
134
+
135
+ - **install** — The setup wizard gains a **decision-layer step**: the shadow gates (`PANTHEON_J1_RISK_SCORE`, `PANTHEON_J3_ESCALATION`) and the specialist-caller allowlist (`athena,themis`) become first-class setup choices, written to `~/.config/pantheon/decision-flags.env` (source it from your shell profile). All advisory/shadow; none change behavior by default. Part of the ratified setup modernization.
136
+
137
+ ## [v1.6.3-beta.5] - 2026-11-04
138
+
139
+ ### Fixed
140
+
141
+ - **routing** — The ledger model-key slash fix (vendor ids like `typesafe/jev-1.13`) re-landed after being silently lost in a branch reset: the shipped beta.4 refused the OpenRouter model key with `invalid-model`. Field-verified end to end on the user's host: `advisory:true`, real Jev answer via OpenRouter at $0.00003/decision.
142
+ - **install** — The Jev wizard shows the full live route matrix with credential-state hints (checked hint when `OPENCODE_API_KEY`/`TYPESAFE_API_KEY`/`CLOUDFLARE_API_TOKEN` is in the shell; the exact export when not).
143
+
144
+ ## [v1.6.3-beta.4] - 2026-11-04
145
+
146
+ ### Added
147
+
148
+ - **routing** — `decision-router setup-model cloudflare-workers-jev/clef --account-id=<id>` provisions the Cloudflare Workers AI custom provider entry (accountId + `models.clef`, type `"decision"`); the token rides `CLOUDFLARE_API_TOKEN` in the host environment. Docs record the OpenAI Decisions protocol and the what's-new TUI window as deliberately unwired candidates.
149
+
150
+ ## [v1.6.3-beta.3] - 2026-11-04
151
+
152
+ ### Fixed
153
+
154
+ - **routing** — The OpenRouter-hosted Jev route settles end to end: the usage-evidence validator and the budget ledger now admit the `openrouter` accounting provider and vendor-slash model ids (`typesafe/jev-1.13`). Field-verified on the user's host: Zeus → `pantheon_jev_decide` (mode skills) → real Jev answer via the stored OpenRouter credential, $0.00003 per decision, usage reconciled.
155
+
13
156
  ## [v1.6.3-beta.2] - 2026-11-04
14
157
 
15
158
  ### Removed
package/README.md CHANGED
@@ -93,7 +93,7 @@ see [Quick Start](docs/QUICKSTART.md).
93
93
 
94
94
  - **14 specialized agents** with one orchestrator, implementation specialists,
95
95
  a quality gate, and supporting roles.
96
- - **20 skills** and reusable instructions for planning, building, reviewing,
96
+ - **21 skills** and reusable instructions for planning, building, reviewing,
97
97
  and documenting work.
98
98
  - **5 local MCP servers** for project memory, persistence, resources, confined
99
99
  script execution, and vision.
@@ -112,7 +112,11 @@ see [Quick Start](docs/QUICKSTART.md).
112
112
  preset/source, git state, and a `Context` block (tokens, a percent gauge,
113
113
  `$<spent> spent`, and a muted `cache <n>% · <n.n> tok/s` line); the native
114
114
  prompt footer keeps its own line, and Pantheon only appends
115
- `▸<preset> · ✦<n> ativos` while delegations are running. The installer
115
+ `▸<preset> · ✦<n> ativos` while delegations are running. When the Pantheon
116
+ version changes since the last TUI start, a one-time dismissable
117
+ "What's new" dialog lists that version's highlights from the shipped
118
+ changelog — once per version, `esc`/`q` dismisses; see
119
+ [What's new window](docs/reference/whats-new.md). The installer
116
120
  selects the `plugins` component by default; in interactive setup you can
117
121
  change the component selection. A component-scoped install includes the TUI
118
122
  only when `plugins` is selected. The TUI ships no quota panel: for provider
@@ -232,7 +236,15 @@ asks, after a delegation completes — one typed round-trip returns an advisory
232
236
  quality score against named criteria plus a needs-review flag. The result
233
237
  content never leaves the machine (shape metrics and criteria only, hostile
234
238
  criteria rejected outright), and the verdict is advisory telemetry plus a
235
- flag: it never blocks, retries, or alters the delegated result.
239
+ flag: it never blocks, retries, or alters the delegated result. Two more
240
+ orchestrator-owned tool modes round out the surface: `mode: "rank"` picks the
241
+ best of 2–8 named candidates for a state in one typed round-trip (it returns
242
+ the winner and that candidate's fit score — the host API answers one scalar
243
+ per question, so no full ordering is returned), and `mode: "verify"` checks
244
+ 1–4 named claims with one predicate question per claim, mapping each answer to
245
+ `PASS` / `FAIL` / `BLOCK` where every refusal, timeout or malformed answer is
246
+ `BLOCK` (fail-closed); claims are bounded caller-provided strings, hostile
247
+ shapes rejected outright, and neither mode adds a telemetry point.
236
248
 
237
249
  The installer may retain a legacy target-specific preference; it does not control
238
250
  runtime routing. `npx pantheon-opencode decision-router ...` manages stored
@@ -418,6 +430,12 @@ the current project root per request while preserving the trusted
418
430
  `PANTHEON_HOME` fallback. See [Memory](docs/MEMORY.md) for store separation and
419
431
  [MCP tools](docs/mcp-tools.md) for details.
420
432
 
433
+ Native-MCP usage is measured, not assumed: `node bench/mcp-usage-audit.mjs`
434
+ writes a dated audit of real memory/persistence/vision/code-mode/resource
435
+ usage (reports stay local — they carry bounded session excerpts), and the
436
+ agent usage policies derived from it are documented in
437
+ [MCP tools](docs/mcp-tools.md).
438
+
421
439
  The release install gate's tool canary loads the installed tarball's V2 plugin
422
440
  entry under OpenCode 2.0.30 and verifies `hashline_edit` registration, Code Mode
423
441
  visibility, and a bounded edit in an isolated project. It does not prove npm
package/README.pt-BR.md CHANGED
@@ -71,7 +71,7 @@ apenas — `init` → reiniciar → `/dispatch` → primeiro resultado — veja
71
71
 
72
72
  - **14 agentes especializados**, com um orquestrador, especialistas de
73
73
  implementação, um gate de qualidade e papéis de apoio.
74
- - **20 skills** e instruções reutilizáveis para planejar, construir, revisar e
74
+ - **21 skills** e instruções reutilizáveis para planejar, construir, revisar e
75
75
  documentar.
76
76
  - **5 servidores MCP locais** para memória de projeto, persistência, recursos,
77
77
  execução confinada de scripts e visão.
@@ -26,7 +26,6 @@ import { fileURLToPath } from 'node:url'
26
26
  import { configure as configureUi, endGaugeLine, tag } from '../scripts/install/cli-ui.mjs'
27
27
  import { resolveComponentSelection } from '../scripts/install/component-selection.mjs'
28
28
  import { resolveGlobalConfigDirectory } from '../scripts/install/config-paths.mjs'
29
- import { provisionTypesafeHostProvider } from '../scripts/install/decision-router-config.mjs'
30
29
  import { resolveInstallExitCode } from '../scripts/install/exit-codes.mjs'
31
30
  import { createInterruptHandler } from '../scripts/install/interrupt.mjs'
32
31
  import { parseOpenCodeVersion } from '../scripts/install/opencode-version.mjs'
@@ -61,23 +60,6 @@ function readVersion() {
61
60
  }
62
61
  }
63
62
 
64
- /**
65
- * Merge the TypeSafe decision-model provider entry into the user's
66
- * `opencode.json` (never replaces existing keys; a non-JSON file is reported,
67
- * never overwritten). Returns true, or a short failure reason.
68
- */
69
- /**
70
- * Merge (never overwrite) the TypeSafe decision-model entry into the user's
71
- * OpenCode config, so choosing the TypeSafe route in the wizard needs only the
72
- * user's own sign-in afterwards. Delegates to the shared installer module —
73
- * the same provisioner `decision-router setup-model typesafe-jev/...` uses.
74
- * Returns true, or a short failure reason for the installer to print.
75
- */
76
- function provisionTypesafeProvider() {
77
- const result = provisionTypesafeHostProvider({ env: process.env })
78
- return result.ok ? true : result.reason
79
- }
80
-
81
63
  /** Value of a repeatable installer flag from the raw argv, or undefined. */
82
64
  function readArgValue(name) {
83
65
  const prefix = `${name}=`
@@ -89,6 +71,11 @@ function readArgValue(name) {
89
71
  return undefined
90
72
  }
91
73
 
74
+ /** Render a cap in a repair hint without changing the validator's grammar. */
75
+ function formatUsdCapForRepair(value) {
76
+ return typeof value === 'string' && /^\.\d+$/.test(value) ? `0${value}` : value
77
+ }
78
+
92
79
  function printUsage() {
93
80
  console.log('Pantheon OpenCode — Multi-agent orchestration platform')
94
81
  console.log('')
@@ -1012,6 +999,8 @@ async function main() {
1012
999
  const monthly = readArgValue('--decision-monthly-usd') ?? wizardActivation?.monthly ?? '5'
1013
1000
  const perDecision =
1014
1001
  readArgValue('--decision-per-decision-usd') ?? wizardActivation?.perDecision ?? '0.10'
1002
+ const repairMonthly = formatUsdCapForRepair(monthly)
1003
+ const repairPerDecision = formatUsdCapForRepair(perDecision)
1015
1004
  const noConsent = process.argv.includes('--decision-no-consent')
1016
1005
  console.log('')
1017
1006
  if (isDryRun) {
@@ -1032,25 +1021,31 @@ async function main() {
1032
1021
  { stdout: (line) => console.log(` ${line}`) },
1033
1022
  )
1034
1023
  console.log(` ${S.jevConfigured(decisionTarget)}`)
1035
- if (decisionTarget.startsWith('typesafe-jev')) {
1036
- const provisioned = provisionTypesafeProvider()
1037
- console.log(
1038
- provisioned === true
1039
- ? ' TypeSafe provider entry merged into opencode.json (adapter + baseURL + apiKey via {env:TYPESAFE_API_KEY}, type "decision"). Activate: export TYPESAFE_API_KEY=<your TypeSafe key> and restart OpenCode. /connect does not carry custom providers.'
1040
- : ` TypeSafe provider entry NOT merged (${provisioned}); merge it manually — see docs/reference/native-decisions.md.`,
1041
- )
1042
- }
1043
1024
  } catch (error) {
1044
1025
  console.error(
1045
1026
  ` ${S.jevConfigureFailed(error instanceof Error ? error.message : String(error))}`,
1046
1027
  )
1047
1028
  console.error(
1048
- ` Fix later with: npx pantheon-opencode decision-router setup-model ${decisionTarget} --monthly-usd ${monthly} --per-decision-usd ${perDecision}`,
1029
+ ` Fix later with: npx pantheon-opencode decision-router setup-model ${decisionTarget} ${decisionTarget.startsWith('cloudflare-workers-jev/') ? '--account-id=<32-hex-id> ' : ''}--monthly-usd ${repairMonthly} --per-decision-usd ${repairPerDecision}`,
1049
1030
  )
1050
1031
  }
1051
1032
  }
1052
1033
  }
1053
1034
 
1035
+ const deferredJevSetup = result.decisionModelDeferredSetup ?? null
1036
+ if (deferredJevSetup?.target === 'cloudflare-workers-jev/clef') {
1037
+ console.log('')
1038
+ console.log(
1039
+ ' Cloudflare Clef was not activated: its host provider entry requires your Cloudflare account ID.',
1040
+ )
1041
+ console.log(
1042
+ ' After install, provision it with: npx pantheon-opencode decision-router setup-model cloudflare-workers-jev/clef --account-id=<32-hex-id> --monthly-usd 5 --per-decision-usd 0.10',
1043
+ )
1044
+ console.log(
1045
+ ' Also set CLOUDFLARE_API_TOKEN to a Workers AI-scoped token in the OpenCode host environment, then restart OpenCode.',
1046
+ )
1047
+ }
1048
+
1054
1049
  // Old-version residue: every `npx pantheon-opencode` invocation materializes
1055
1050
  // a full copy under the npm cache's _npx/ and nothing in npm removes old
1056
1051
  // ones. The registration points at THIS run's copy, so every other copy is
@@ -1076,10 +1071,33 @@ async function main() {
1076
1071
  console.log(` ${S.nextVerify}`)
1077
1072
  console.log(` ${S.nextLaunch}`)
1078
1073
  console.log(` ${S.nextAgents}`)
1079
- console.log(` ${S.nextProject}`)
1074
+ if (!isProject) {
1075
+ // The project-local hint only matters when this install was not one.
1076
+ console.log(` ${S.nextProject}`)
1077
+ }
1080
1078
  if (!decisionTarget) {
1081
1079
  console.log(` ${S.nextJev}`)
1082
1080
  }
1081
+ // The decision-layer extras (J1/J3/specialist callers) write an env file;
1082
+ // without sourcing it the gates stay off silently — the exact gap the
1083
+ // field hit on the beta.12 setup pass.
1084
+ try {
1085
+ const { existsSync } = await import('node:fs')
1086
+ const flagsPath = path.join(
1087
+ process.env.XDG_CONFIG_HOME ?? path.join(process.env.HOME ?? '', '.config'),
1088
+ 'pantheon',
1089
+ 'decision-flags.env',
1090
+ )
1091
+ if (existsSync(flagsPath)) {
1092
+ console.log('')
1093
+ console.log(' Decision-layer flags (J1/J3/specialist callers):')
1094
+ console.log(
1095
+ ` source ${flagsPath} # add to your shell profile; applies to NEW opencode sessions`,
1096
+ )
1097
+ }
1098
+ } catch {
1099
+ // Hint is best-effort; never fail the install over it.
1100
+ }
1083
1101
  console.log('')
1084
1102
 
1085
1103
  return
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pantheon-opencode",
3
- "version": "1.6.3-beta.2",
3
+ "version": "1.6.3-beta.21",
4
4
  "description": "Multi-agent orchestration for OpenCode \u2014 14 specialized agents, TDD, Themis review gates.",
5
5
  "type": "module",
6
6
  "workspaces": [
package/plugin.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "pantheon",
3
3
  "publisher": "ils15",
4
- "version": "1.6.3-beta.2",
4
+ "version": "1.6.3-beta.21",
5
5
  "displayName": "Pantheon",
6
- "description": "Conductor-Delegate orchestration platform with 14 specialized agents, 20 skills, and OpenCode support.",
6
+ "description": "Conductor-Delegate orchestration platform with 14 specialized agents, 21 skills, and OpenCode support.",
7
7
  "agents": "./src/agents",
8
8
  "skills": "./src/skills",
9
9
  "instructions": "./src/instructions",
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.3-beta.2"
7
+ version = "1.6.3-beta.21"
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
@@ -18,9 +18,10 @@ function getVerifiedUsageEvidenceDetails(value) {
18
18
  }
19
19
 
20
20
  // src/pantheon/local-decision-budget.ts
21
- var SCHEMA_VERSION = 3;
21
+ var SCHEMA_VERSION = 4;
22
22
  var VERSION_TWO = 2;
23
23
  var APPLICATION_ID = 1346522161;
24
+ var RELEASE_REASON_MAX_LENGTH = 200;
24
25
  var DB_FILENAME = "decision-budget.sqlite";
25
26
  var LOCAL_DECISION_BUDGET_PROVIDERS = Object.freeze([
26
27
  "openai-decisions",
@@ -31,7 +32,7 @@ var LOCAL_DECISION_BUDGET_PROVIDERS = Object.freeze([
31
32
  "cloudflare-workers-ai"
32
33
  ]);
33
34
  var ALLOWED_PROVIDERS = new Set(LOCAL_DECISION_BUDGET_PROVIDERS);
34
- var MODEL_KEY = /^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/;
35
+ var MODEL_KEY = /^[A-Za-z0-9][A-Za-z0-9._:/-]{0,127}$/;
35
36
  var RESERVATION_ID = /^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/;
36
37
  var CLOCK_ROLLBACK_TOLERANCE_MS = 6e4;
37
38
  function resolveLocalDecisionBudgetDbPath(env = process.env) {
@@ -381,6 +382,70 @@ function openLocalDecisionBudgetLedger(options = {}) {
381
382
  return safeChangeCount(result.changes);
382
383
  });
383
384
  }
385
+ function releaseHoldsForProvider(provider, reason) {
386
+ if (typeof provider !== "string" || provider.length < 1 || provider.length > 64) {
387
+ return { released: 0, freedMicros: 0 };
388
+ }
389
+ if (typeof reason !== "string" || reason.length < 1 || reason.length > RELEASE_REASON_MAX_LENGTH) {
390
+ return { released: 0, freedMicros: 0 };
391
+ }
392
+ return inImmediateTransaction(() => {
393
+ const timestamp = now();
394
+ const rows = db.prepare(
395
+ `SELECT id, provider, model, period_utc, reserved_micros, state, created_at_ms
396
+ FROM reservations WHERE provider = ? AND state IN ('pending', 'uncertain')
397
+ ORDER BY created_at_ms, id`
398
+ ).all(provider);
399
+ if (rows.length === 0) return { released: 0, freedMicros: 0 };
400
+ const archive = db.prepare(
401
+ `INSERT INTO released_holds
402
+ (reservation_id, provider, model, period_utc, reserved_micros, state_at_release,
403
+ reason, created_at_ms, released_at_ms)
404
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`
405
+ );
406
+ let freedMicros = 0;
407
+ for (const row of rows) {
408
+ archive.run(
409
+ row.id,
410
+ row.provider,
411
+ row.model,
412
+ row.period_utc,
413
+ row.reserved_micros,
414
+ row.state,
415
+ reason,
416
+ row.created_at_ms,
417
+ timestamp
418
+ );
419
+ freedMicros = safeMicrosTotal(freedMicros + row.reserved_micros);
420
+ }
421
+ const remove = db.prepare(
422
+ `DELETE FROM reservations WHERE provider = ? AND state IN ('pending', 'uncertain')`
423
+ ).run(provider);
424
+ if (safeChangeCount(remove.changes) !== rows.length) {
425
+ throw new Error("Reservation rows changed during release");
426
+ }
427
+ return { released: rows.length, freedMicros };
428
+ });
429
+ }
430
+ function listReleasedHolds(limit) {
431
+ const bound = typeof limit === "number" && Number.isInteger(limit) && limit > 0 ? Math.min(limit, 200) : 20;
432
+ const rows = db.prepare(
433
+ `SELECT reservation_id, provider, model, period_utc, reserved_micros, state_at_release,
434
+ reason, created_at_ms, released_at_ms
435
+ FROM released_holds ORDER BY released_at_ms DESC, reservation_id LIMIT ?`
436
+ ).all(bound);
437
+ return rows.map((row) => ({
438
+ reservationId: row.reservation_id,
439
+ provider: row.provider,
440
+ model: row.model,
441
+ period: row.period_utc,
442
+ reservedMicros: row.reserved_micros,
443
+ stateAtRelease: row.state_at_release === "uncertain" ? "uncertain" : "pending",
444
+ reason: row.reason,
445
+ createdAtMs: row.created_at_ms,
446
+ releasedAtMs: row.released_at_ms
447
+ }));
448
+ }
384
449
  function pruneCompletedPeriods() {
385
450
  return inImmediateTransaction(() => {
386
451
  let currentPeriod;
@@ -436,6 +501,8 @@ function openLocalDecisionBudgetLedger(options = {}) {
436
501
  reconcileVerified,
437
502
  listUncertainReservations,
438
503
  recoverPendingReservations,
504
+ releaseHoldsForProvider,
505
+ listReleasedHolds,
439
506
  pruneCompletedPeriods,
440
507
  close: () => db.close()
441
508
  };
@@ -450,12 +517,16 @@ function ensureSchema(db) {
450
517
  if (applicationId !== 0 || tables.length !== 0) {
451
518
  throw new Error("Refusing to initialize an unrecognized SQLite database");
452
519
  }
453
- createSchemaV3(db);
520
+ createSchemaV4(db);
454
521
  } else if (version === 1 && applicationId === APPLICATION_ID) {
455
522
  migrateVersionOne(db);
456
523
  migrateVersionTwoToThree(db);
524
+ migrateVersionThreeToFour(db);
457
525
  } else if (version === VERSION_TWO && applicationId === APPLICATION_ID) {
458
526
  migrateVersionTwoToThree(db);
527
+ migrateVersionThreeToFour(db);
528
+ } else if (version === 3 && applicationId === APPLICATION_ID) {
529
+ migrateVersionThreeToFour(db);
459
530
  } else if (version !== SCHEMA_VERSION || applicationId !== APPLICATION_ID) {
460
531
  throw new Error("Unsupported or incompatible local decision budget database schema");
461
532
  }
@@ -550,9 +621,38 @@ function migrateVersionTwoToThree(db) {
550
621
  INSERT INTO ledger_state (id, active_period_utc)
551
622
  SELECT id, NULL FROM ledger_state_v2;
552
623
  DROP TABLE ledger_state_v2;
624
+ PRAGMA user_version = 3;
625
+ `);
626
+ }
627
+ function migrateVersionThreeToFour(db) {
628
+ validateVersionThreeSchema(db);
629
+ db.exec(`
630
+ CREATE TABLE released_holds (
631
+ reservation_id TEXT PRIMARY KEY NOT NULL,
632
+ provider TEXT NOT NULL,
633
+ model TEXT NOT NULL,
634
+ period_utc TEXT NOT NULL CHECK (length(period_utc) = 7),
635
+ reserved_micros INTEGER NOT NULL CHECK (reserved_micros > 0),
636
+ state_at_release TEXT NOT NULL CHECK (state_at_release IN ('pending', 'uncertain')),
637
+ reason TEXT NOT NULL CHECK (length(reason) BETWEEN 1 AND ${RELEASE_REASON_MAX_LENGTH}),
638
+ created_at_ms INTEGER NOT NULL,
639
+ released_at_ms INTEGER NOT NULL
640
+ ) STRICT;
641
+ CREATE INDEX released_holds_released_idx ON released_holds (released_at_ms, reservation_id);
553
642
  PRAGMA user_version = ${SCHEMA_VERSION};
554
643
  `);
555
644
  }
645
+ function createSchemaV4(db) {
646
+ createSchemaV3(db);
647
+ migrateVersionThreeToFour(db);
648
+ }
649
+ function validateVersionThreeSchema(db) {
650
+ db.prepare(
651
+ `SELECT id, provider, model, period_utc, reserved_micros, actual_micros, state,
652
+ created_at_ms, updated_at_ms FROM reservations LIMIT 0`
653
+ );
654
+ db.prepare("SELECT id, active_period_utc FROM ledger_state LIMIT 0");
655
+ }
556
656
  function migrateVersionOne(db) {
557
657
  validateVersionOneSchema(db);
558
658
  const providers = db.prepare("SELECT DISTINCT provider FROM reservations UNION SELECT provider FROM provider_caps").all();
@@ -101,7 +101,7 @@ function readDecisionBudgetLedgerFacts(dbPath) {
101
101
  try {
102
102
  const version = db.prepare("PRAGMA user_version").get().user_version;
103
103
  const applicationId = db.prepare("PRAGMA application_id").get().application_id;
104
- if (applicationId !== EXPECTED_APPLICATION_ID || version !== 3) {
104
+ if (applicationId !== EXPECTED_APPLICATION_ID || version !== 3 && version !== 4) {
105
105
  return { present: true, readable: false, reason: "unsupported-schema" };
106
106
  }
107
107
  const activeRow = db.prepare("SELECT active_period_utc FROM ledger_state WHERE id = 1").get();
@@ -185,7 +185,7 @@ function listDecisionHoldsReadOnly(dbPath) {
185
185
  try {
186
186
  const applicationId = db.prepare("PRAGMA application_id").get().application_id;
187
187
  const version = db.prepare("PRAGMA user_version").get().user_version;
188
- if (applicationId !== EXPECTED_APPLICATION_ID || version !== 3) return null;
188
+ if (applicationId !== EXPECTED_APPLICATION_ID || version !== 3 && version !== 4) return null;
189
189
  const rows = db.prepare(
190
190
  `SELECT id, provider, model, period_utc, reserved_micros, state
191
191
  FROM reservations WHERE state IN ('pending', 'uncertain')