pantheon-opencode 1.6.3-beta.9 → 1.7.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.global.md +1 -1
- package/AGENTS.md +1 -1
- package/CHANGELOG.md +187 -6
- package/README.md +7 -1
- package/README.pt-BR.md +1 -1
- package/bin/pantheon-init.mjs +46 -28
- package/package.json +2 -2
- package/plugin.json +2 -2
- package/pyproject.toml +1 -1
- package/scripts/decision-router-budget.mjs +102 -2
- package/scripts/decision-router-v2-budget.mjs +2 -2
- package/scripts/decision-router.mjs +82 -25
- package/scripts/doctor.mjs +4 -1
- package/scripts/install/cli-ui.mjs +2 -1
- package/scripts/install/decision-router-config.mjs +12 -4
- package/scripts/install/interactive.mjs +45 -28
- package/scripts/install/opencode.mjs +151 -30
- package/scripts/jev-live-probe.mjs +114 -86
- package/scripts/skill-search.mjs +273 -0
- package/skills-lock.json +3 -1
- package/src/agents/aphrodite.md +34 -1
- package/src/agents/apollo.md +227 -0
- package/src/agents/athena.md +26 -0
- package/src/agents/demeter.md +33 -0
- package/src/agents/gaia.md +24 -0
- package/src/agents/hephaestus.md +24 -0
- package/src/agents/hermes.md +33 -0
- package/src/agents/iris.md +24 -0
- package/src/agents/mnemosyne.md +25 -3
- package/src/agents/nyx.md +50 -22
- package/src/agents/prometheus.md +242 -1
- package/src/agents/talos.md +24 -0
- package/src/agents/themis.md +24 -0
- package/src/agents/zeus.md +71 -20
- package/src/pantheon/j1-approvals.ts +123 -0
- package/src/pantheon/jev-decision-tool.ts +148 -17
- package/src/pantheon/jev-decisions.ts +95 -12
- package/src/pantheon/jev-escalation.ts +1 -1
- package/src/pantheon/jev-quality-score.ts +45 -10
- package/src/pantheon/jev-rank-verify.ts +244 -14
- package/src/pantheon/jev-risk-gate.ts +82 -12
- package/src/pantheon/local-decision-budget.ts +169 -2
- package/src/pantheon/local-decision-prompt.ts +2 -0
- package/src/pantheon/local-decision-router.ts +16 -0
- package/src/pantheon/local-decision-turn.ts +110 -4
- package/src/pantheon/local-decision-usage-evidence.internal.ts +2 -2
- package/src/pantheon/pantheon-decision-catalog.ts +9 -2
- package/src/pantheon/v2-decision-budget.ts +4 -2
- package/src/pantheon/v2-tools.ts +42 -0
- package/src/plugin-v2.ts +85 -5
- package/src/plugins/tui/dist/server-v2.d.ts +14 -6
- package/src/plugins/tui/dist/server-v2.d.ts.map +1 -1
- package/src/plugins/tui/dist/server-v2.js +16 -9
- package/src/plugins/tui/dist/server-v2.js.map +1 -1
- package/src/plugins/tui/dist/tui-v2.js +128 -25
- 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/server-v2.ts +14 -7
- package/src/plugins/tui/src/whats-new-highlights.ts +59 -5
- package/src/plugins/tui/src/whats-new-open.ts +41 -1
- package/src/plugins/tui/src/whats-new.tsx +61 -8
- package/src/routing.yml +2 -0
- package/src/skills/README.md +1 -1
- package/src/skills/agent-forge/SKILL.md +76 -0
- package/src/skills/auto-continue/SKILL.md +12 -163
- package/src/skills/auto-continue/references/auto-continue-details.md +175 -0
- package/src/skills/prompt-refinery/SKILL.md +60 -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-
|
|
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-
|
|
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,188 @@ 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.7.0-beta.1] - 2026-11-07
|
|
14
|
+
|
|
15
|
+
## 🆕 What's New — a linha 1.7 abre
|
|
16
|
+
- **`mode: "order"`** no Jev: ordenação real de 2-4 candidatos com score por candidato (rank escolhe vencedor; order classifica a shortlist).
|
|
17
|
+
- **J1 approval gate** com escada off/shadow/warn/enforce: chamada de risco alto exige APROVAÇÃO EXPLÍCITA do usuário (hash-pinned, TTL 15min) — nunca contorno.
|
|
18
|
+
- **`agent-forge`**: cria um agente OpenCode sob demanda — entrevista, rascunho canônico, confirmação, gravação em escopo projeto/global.
|
|
19
|
+
- **prompt-refinery em 3 níveis**: pedido claro passa intacto; ajuste mínimo interno (≤15 linhas); contrato completo só com `>>`.
|
|
20
|
+
- **Descoberta de skills com cascata de confiança**: catálogo canônico Anthropic → skills.sh → GitHub cru, ranqueado por Jev order; instalação só pelo usuário.
|
|
21
|
+
- **Correções do campo**: criteria-objeto no review, banda UNVERIFIABLE no verify com evidência (`state`), jsonc heal (o veneno que sumia com o roster), D3 PT-starvation,CRITERIA_SHAPE com remedio, verify band edges.
|
|
22
|
+
- **Jev REAL**: 275 decisões reconciliadas, $0.0068 acumulado (~$0.000025/decisão).
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
- 2026-11-07
|
|
26
|
+
|
|
27
|
+
## 🆕 What's New
|
|
28
|
+
- **skills** — the three-tier refine — minimal adjust default, full contract via >> only
|
|
29
|
+
- **skills** — the refinement tiers — internal minimal adjust, >> full contract
|
|
30
|
+
- **routing** — the pre-stable cost inventory
|
|
31
|
+
- **skills** — the enhancer references and project-convention priority
|
|
32
|
+
- **skills** — the three-tier refine — minimal adjust default, full contract via >> only
|
|
33
|
+
- **routing** — the external-ref regressions
|
|
34
|
+
- **routing** — the criteria object form and the fixture-vs-work rule
|
|
35
|
+
- **install** — the deterministic refine trigger
|
|
36
|
+
- **skills** — agent-forge on-demand agents and the order-mode discovery ladder
|
|
37
|
+
- **routing** — the J1 approval gate — explicit ask, hash-pinned pass
|
|
38
|
+
- **routing** — the J1 enforce handoff contract — risk hands off to the human
|
|
39
|
+
- **routing** — the order mode (top-K ordering) and the noul rename
|
|
40
|
+
- **routing** — the J1 escalation ladder (off/shadow/warn/enforce) and the caller-refusal remedy
|
|
41
|
+
- **skills** — the prompt-refinery contract and the nyx observability restore
|
|
42
|
+
- **install** — one coherent setup summary — inline warnings, project-only worktree box, flags hint
|
|
43
|
+
- **routing** — the beta.12 field acceptance record
|
|
44
|
+
- **tui** — the paginated What's New window with the curated summary contract
|
|
45
|
+
|
|
46
|
+
## 🐞 Fixed
|
|
47
|
+
- **install** — the jsonc heal repairs orphan commas
|
|
48
|
+
- **config** — the jsonc heal and the venv-aware test:ci
|
|
49
|
+
- **validate** — the V2 package probe
|
|
50
|
+
- **routing** — the local-router D3 PT fallback and the D4 polarity docs
|
|
51
|
+
- **install** — heal the cwd-relative agent source field — the Agent-not-found root cause
|
|
52
|
+
- **routing** — the beta.13 field report — verify evidence, popularity parser, stable plugin root
|
|
53
|
+
- **routing** — the field-report corrections — descriptions ride, envelope everywhere, rank 20, gate influence
|
|
54
|
+
## [v1.6.3-beta.28] - 2026-11-07
|
|
55
|
+
|
|
56
|
+
## 🆕 What's New
|
|
57
|
+
- auto-continue split: core 2,656→1,003 tokens, the cooldown/timeout/checkpoint details moved to references/ (read under demand). The checkpoint contract is intact — the test follows the move.
|
|
58
|
+
- prompt-refinery tiers finalized: Tier 1 is an INTERNAL minimal adjust (the user sees the work begin, no approval ceremony; generous scope when the request demands); the six-section contract is EXCLUSIVELY the >> prefix; clarifying questions ride the native question tool.
|
|
59
|
+
- Descriptions trimmed keeping triggers (mnemosyne, agent-forge, prompt-refinery); skill-creator referenced in agent-forge.
|
|
60
|
+
|
|
61
|
+
## [v1.6.3-beta.27] - 2026-11-07
|
|
62
|
+
|
|
63
|
+
## 🆕 What's New
|
|
64
|
+
- prompt-refinery em TRÊS níveis com custo controlado por limite de saída (não por tier de modelo): pedido claro passa intacto; o sinal determinístico dispara o AJUSTE MÍNIMO (≤15 linhas — PT corrigido, estrutura leve); o contrato completo de seis seções é EXCLUSIVO do prefixo `>>`. Referências incorporadas: prompt-enhancer (opt-in, cap, fail-open) e prompt-improver (nudges self-cancel-cheap, clarificação com opções). Falha = fail-open; convenções do projeto têm prioridade sobre defaults.
|
|
65
|
+
|
|
66
|
+
## [v1.6.3-beta.26] - 2026-11-07
|
|
67
|
+
|
|
68
|
+
## 🆕 What's New
|
|
69
|
+
- The installer heals the stale agent-`source` field in the sibling opencode.jsonc too — the field that kept the roster invisible outside the config dir even after the .json heal (field beta.25: sessions fell back to the default agent and pantheon_jev_decide was nowhere).
|
|
70
|
+
- `test:ci` prefers the repo venv when present, so the Python tier runs the pinned fastmcp/mcp instead of whatever the system python has.
|
|
71
|
+
|
|
72
|
+
## [v1.6.3-beta.25] - 2026-11-06
|
|
73
|
+
|
|
74
|
+
## 🆕 What's New
|
|
75
|
+
- The external-research regressions: three refiner fixtures (cited-scenario analyzes, direct-vague contracts, bounded-fix executes), skills review hardened (origin/adoption are signals, dangerous content blocks regardless of popularity), and the order score documented as an ORDINAL on the 2..10 rubric — never a probability.
|
|
76
|
+
- The beta.24 battery #10 exact PT payload is a regression test now (the CRITERIA_SHAPE fix holds under its exact shape).
|
|
77
|
+
|
|
78
|
+
## [v1.6.3-beta.24] - 2026-11-06
|
|
79
|
+
|
|
80
|
+
## 🆕 What's New
|
|
81
|
+
- Refinement is now DETERMINISTIC: the local router computes `refineRecommended` from pure text rules (multi-concern, no acceptance criteria — PT+EN; one-liners never refine; explicit criteria suppress). No Jev, no model judgment, zero cost — badly structured prompts get the refine signal before they can degrade processing, and zeus treats the signal as obligatory.
|
|
82
|
+
|
|
83
|
+
## [v1.6.3-beta.23] - 2026-11-06
|
|
84
|
+
|
|
85
|
+
## 🆕 What's New
|
|
86
|
+
- Doctor recognizes the installer's own V2 shape again (`{ package, options }` was never probed — a healthy config read as "no V2 generation registered").
|
|
87
|
+
- TUI version embed rebuilt (the footer no longer says beta.15).
|
|
88
|
+
- The prompt-refinery contract is bound to the FIRST turn: no reads, no dispatches before it (field evidence: discovery-first burned a delegation and still ended in the same questions).
|
|
89
|
+
|
|
90
|
+
## [v1.6.3-beta.22] - 2026-11-06
|
|
91
|
+
|
|
92
|
+
## 🆕 What's New
|
|
93
|
+
- `agent-forge` skill: ask for a dedicated agent ("cria um agente de reviews de PR") and Pantheon interviews you, drafts the canonical agent file (least-privilege permissions, registered-tools-only grants, the governance ladder), confirms, and writes it project- or user-scoped — the host loads it on the next session.
|
|
94
|
+
- Skill discovery now ranks with Jev `mode: "order"`: the top cascade candidates return a full descending ordering with fit scores, not a single winner. `mattpocock/skills` joins the GitHub tier as a known-good reference repo.
|
|
95
|
+
|
|
96
|
+
## [v1.6.3-beta.21] - 2026-11-06
|
|
97
|
+
|
|
98
|
+
## 🆕 What's New
|
|
99
|
+
- 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.
|
|
100
|
+
- 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.
|
|
101
|
+
|
|
102
|
+
## [v1.6.3-beta.20] - 2026-11-06
|
|
103
|
+
|
|
104
|
+
## 🆕 What's New
|
|
105
|
+
- 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).
|
|
106
|
+
|
|
107
|
+
## [v1.6.3-beta.19] - 2026-11-06
|
|
108
|
+
|
|
109
|
+
## 🆕 What's New
|
|
110
|
+
- 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).
|
|
111
|
+
- D4: the complexity dimensions' polarity is documented where it bit — higher = riskier/less contained (boundedness:2 is POORLY bounded), aggregate label = max(dimensions).
|
|
112
|
+
|
|
113
|
+
## [v1.6.3-beta.18] - 2026-11-06
|
|
114
|
+
|
|
115
|
+
## 🆕 What's New
|
|
116
|
+
- `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.
|
|
117
|
+
- 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.
|
|
118
|
+
|
|
119
|
+
## [v1.6.3-beta.17] - 2026-11-05
|
|
120
|
+
|
|
121
|
+
## 🆕 What's New
|
|
122
|
+
- 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.
|
|
123
|
+
- CALLER_NOT_ALLOWED refusals now teach the fix: allowlist the caller via PANTHEON_JEV_SPECIALIST_CALLERS or ask Zeus to route.
|
|
124
|
+
- Plan persistence contract: Athena returns the plan as her response; Zeus persists PLAN.md — no more refused write attempts on deepwork plans.
|
|
125
|
+
|
|
126
|
+
## [v1.6.3-beta.16] - 2026-11-05
|
|
127
|
+
|
|
128
|
+
## 🆕 What's New
|
|
129
|
+
- `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.
|
|
130
|
+
- 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.
|
|
131
|
+
- nyx returns to observability & cost analytics (owner intent), prometheus drops those words — the routing you expected now matches the catalog.
|
|
132
|
+
|
|
133
|
+
## [v1.6.3-beta.15] - 2026-11-05
|
|
134
|
+
|
|
135
|
+
## 🆕 What's New
|
|
136
|
+
- "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.
|
|
137
|
+
|
|
138
|
+
## [v1.6.3-beta.14] - 2026-11-05
|
|
139
|
+
|
|
140
|
+
## 🆕 What's New
|
|
141
|
+
- 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).
|
|
142
|
+
- 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.
|
|
143
|
+
- The skills-search popularity parser reads K/M counts — the most popular results no longer vanish from the skills.sh tier.
|
|
144
|
+
- 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.
|
|
145
|
+
- prometheus's description names observability/tracing — the reform's domain split is now visible to the router.
|
|
146
|
+
|
|
147
|
+
## [v1.6.3-beta.13] - 2026-11-05
|
|
148
|
+
|
|
149
|
+
## 🆕 What's New
|
|
150
|
+
- One coherent setup summary: a single closing block instead of two competing "Next steps" lists.
|
|
151
|
+
- Warnings restate their text inline — no more hunting for what scrolled past.
|
|
152
|
+
- The worktree guidance box is project-only (a global install from $HOME showed a nonsense path).
|
|
153
|
+
- The banner now prints the exact `source` line for the decision-layer flags file — the silent-off gap fixed.
|
|
154
|
+
|
|
155
|
+
## [v1.6.3-beta.12] - 2026-11-05
|
|
156
|
+
|
|
157
|
+
## 🆕 What's New
|
|
158
|
+
- 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).
|
|
159
|
+
- The input envelope is enforced on EVERY path now: presets, review, rank and verify all refuse missing/unknown keys with the exact cause.
|
|
160
|
+
- Rank accepts up to 20 candidates (typesafe_rank contract) and names the accepted range on refusal.
|
|
161
|
+
- Skills results report where the candidates came from (`candidateSource`), ending silent prefilter misses.
|
|
162
|
+
- The local router respects open gates: review/approval required → abstain (`GATE_OPEN`), never route around.
|
|
163
|
+
|
|
164
|
+
## [v1.6.3-beta.11] - 2026-11-05
|
|
165
|
+
|
|
166
|
+
### 🆕 What's New
|
|
167
|
+
- Measured MCP usage policy across the roster — governance ladder byte-identical in all 13 specialists.
|
|
168
|
+
- Skill-discovery pipeline with the trust cascade: Anthropic catalog → skills.sh → GitHub; Jev ranks, you install.
|
|
169
|
+
- Dead-route holds release (ledger schema v4) — the fix for budgets frozen by removed routes.
|
|
170
|
+
- Roster reform: nyx re-scoped to chaos & adversarial, talos aligned to hotfix, domain docs per agent.
|
|
171
|
+
- Jev validated end to end in the field: N4 dead, verify field-verified, sandbox 28/28.
|
|
172
|
+
|
|
173
|
+
### Added
|
|
174
|
+
|
|
175
|
+
- **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.
|
|
176
|
+
- **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`.
|
|
177
|
+
- **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.
|
|
178
|
+
- **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`.
|
|
179
|
+
|
|
180
|
+
- **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).
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
### Changed
|
|
184
|
+
|
|
185
|
+
- **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`.
|
|
186
|
+
|
|
187
|
+
## [v1.6.3-beta.10] - 2026-11-04
|
|
188
|
+
|
|
189
|
+
### Fixed
|
|
190
|
+
|
|
191
|
+
- **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).
|
|
192
|
+
|
|
193
|
+
<!-- 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. -->
|
|
194
|
+
|
|
13
195
|
## [v1.6.3-beta.9] - 2026-11-04
|
|
14
196
|
|
|
15
197
|
### Changed
|
|
@@ -17,20 +199,19 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
|
17
199
|
- **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.
|
|
18
200
|
- **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).
|
|
19
201
|
|
|
20
|
-
## [v1.6.3-beta.
|
|
202
|
+
## [v1.6.3-beta.8] - 2026-11-04
|
|
21
203
|
|
|
22
204
|
### Added
|
|
23
205
|
|
|
24
|
-
- **routing** —
|
|
206
|
+
- **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.
|
|
25
207
|
|
|
26
|
-
## [v1.6.3-beta.
|
|
208
|
+
## [v1.6.3-beta.7] - 2026-11-04
|
|
27
209
|
|
|
28
210
|
### Added
|
|
29
211
|
|
|
30
|
-
- **routing** —
|
|
31
|
-
- **agents** — The live scorecard runs the full 13-specialist catalog (first full run: 6/8 exact, 2 domain-adjacent); Zeus gains consolidated MCP call-timing rules.
|
|
212
|
+
- **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.
|
|
32
213
|
|
|
33
|
-
## [v1.6.3-beta.
|
|
214
|
+
## [v1.6.3-beta.6] - 2026-11-04
|
|
34
215
|
|
|
35
216
|
### Added
|
|
36
217
|
|
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
|
-
- **
|
|
96
|
+
- **22 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.
|
|
@@ -430,6 +430,12 @@ the current project root per request while preserving the trusted
|
|
|
430
430
|
`PANTHEON_HOME` fallback. See [Memory](docs/MEMORY.md) for store separation and
|
|
431
431
|
[MCP tools](docs/mcp-tools.md) for details.
|
|
432
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
|
+
|
|
433
439
|
The release install gate's tool canary loads the installed tarball's V2 plugin
|
|
434
440
|
entry under OpenCode 2.0.30 and verifies `hashline_edit` registration, Code Mode
|
|
435
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
|
-
- **
|
|
74
|
+
- **22 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.
|
package/bin/pantheon-init.mjs
CHANGED
|
@@ -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 ${
|
|
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
|
-
|
|
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.
|
|
3
|
+
"version": "1.7.0-beta.1",
|
|
4
4
|
"description": "Multi-agent orchestration for OpenCode \u2014 14 specialized agents, TDD, Themis review gates.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"workspaces": [
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"test:tool-canary": "node scripts/run-node-tests.mjs --label 'test:tool-canary' 'tests/canary/tool-canary-support.test.mjs' 'tests/canary/plugin-v2-tool-canary.test.mjs'",
|
|
60
60
|
"test:all": "npm run test:ci && npm run test:node && npm run test:ts",
|
|
61
61
|
"test": "npm run test:all",
|
|
62
|
-
"test:ci": "python3 -m pytest -q --tb=short 2>&1"
|
|
62
|
+
"test:ci": "PANTHEON_PY=${PYTHON:-python3}; if [ -x .venv/bin/python3 ]; then PANTHEON_PY=.venv/bin/python3; fi; $PANTHEON_PY -m pytest -q --tb=short 2>&1"
|
|
63
63
|
},
|
|
64
64
|
"bin": {
|
|
65
65
|
"pantheon-opencode": "bin/pantheon-init.mjs"
|
package/plugin.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pantheon",
|
|
3
3
|
"publisher": "ils15",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.7.0-beta.1",
|
|
5
5
|
"displayName": "Pantheon",
|
|
6
|
-
"description": "Conductor-Delegate orchestration platform with 14 specialized agents,
|
|
6
|
+
"description": "Conductor-Delegate orchestration platform with 14 specialized agents, 22 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.
|
|
7
|
+
version = "1.7.0-beta.1"
|
|
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 =
|
|
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",
|
|
@@ -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
|
-
|
|
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')
|