pantheon-opencode 1.6.2-beta.4 → 1.6.2-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/README.md +202 -29
- package/README.pt-BR.md +9 -0
- package/bin/pantheon-init.mjs +6 -1
- package/package.json +2 -1
- package/plugin.json +1 -1
- package/pyproject.toml +1 -1
- package/scripts/decision-router-budget.mjs +7 -8
- package/scripts/decision-router-v2-budget.mjs +218 -0
- package/scripts/decision-router-v2-egress.mjs +272 -0
- package/scripts/decision-router.mjs +268 -46
- package/scripts/docs-check-changelog.mjs +5 -3
- package/scripts/install/decision-layer-preview.mjs +376 -0
- package/scripts/install/decision-router-config.mjs +162 -34
- package/scripts/mcp_resources.py +11 -9
- package/scripts/release-notes.mjs +30 -7
- package/scripts/versioning.mjs +41 -5
- package/src/mcp/eval_store.py +11 -4
- package/src/mcp/mcp_resources.py +11 -9
- package/src/mcp/memory_mcp.py +293 -150
- package/src/pantheon/jev-decision-tool.ts +336 -0
- package/src/pantheon/jev-decisions.ts +625 -0
- package/src/pantheon/local-decision-budget.ts +4 -1
- package/src/pantheon/local-decision-egress-gate.ts +16 -136
- package/src/pantheon/local-decision-prompt.ts +184 -45
- package/src/pantheon/local-decision-provider-matrix.ts +14 -62
- package/src/pantheon/local-decision-skills.ts +115 -5
- package/src/pantheon/local-decision-tool.ts +35 -1
- package/src/pantheon/local-decision-turn.ts +15 -252
- package/src/pantheon/local-decision-usage-evidence.internal.ts +80 -119
- package/src/pantheon/v2-decision-budget.ts +456 -0
- package/src/pantheon/v2-decision-contracts.ts +300 -0
- package/src/pantheon/v2-decision-egress.ts +203 -0
- package/src/pantheon/v2-decision-events.ts +180 -0
- package/src/pantheon/v2-decision-heuristic.ts +121 -0
- package/src/pantheon/v2-decision-points/p1-agent.ts +91 -0
- package/src/pantheon/v2-decision-points/p10-claims.ts +243 -0
- package/src/pantheon/v2-decision-points/p11-catalog.ts +220 -0
- package/src/pantheon/v2-decision-points/p2-skill.ts +83 -0
- package/src/pantheon/v2-decision-points/p3-complexity.ts +108 -0
- package/src/pantheon/v2-decision-points/p4-memory.ts +137 -0
- package/src/pantheon/v2-decision-points/p5-themis-verify.ts +190 -0
- package/src/pantheon/v2-decision-points/p6-council.ts +161 -0
- package/src/pantheon/v2-decision-points/p7-loop.ts +263 -0
- package/src/pantheon/v2-decision-points/p8-guardrail.ts +367 -0
- package/src/pantheon/v2-decision-points/p9-memory-compaction.ts +304 -0
- package/src/pantheon/v2-decision-points.ts +242 -0
- package/src/pantheon/v2-decision-policy.ts +166 -0
- package/src/pantheon/v2-decision-premises.ts +146 -0
- package/src/pantheon/v2-decision-prompt-surface.ts +115 -0
- package/src/pantheon/v2-decision-rank.ts +91 -0
- package/src/pantheon/v2-decision-registry.ts +391 -0
- package/src/pantheon/v2-decision-resource-ids.ts +127 -0
- package/src/pantheon/v2-decision-shadow.ts +123 -0
- package/src/pantheon/v2-decision-telemetry.ts +214 -0
- package/src/pantheon/v2-decision-verify.ts +51 -0
- package/src/pantheon/v2-native-decisions.ts +365 -0
- package/src/pantheon/v2-tools.ts +24 -2
- package/src/plugin-v2.ts +360 -14
- package/src/plugins/tui/dist/tui-v2.js +3 -3
- 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/pantheon/local-decision-provider-protocol.ts +0 -335
- package/src/pantheon/local-decision-provider.internal.ts +0 -260
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,33 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
|
10
10
|
<!-- Add new changes here. Running `node scripts/versioning.mjs apply` will
|
|
11
11
|
move this section to a versioned entry and reset the template below. -->
|
|
12
12
|
|
|
13
|
+
## [v1.6.2-beta.6] - 2026-11-01
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
|
|
17
|
+
- **routing** — Added the Zeus-only `pantheon_jev_decide` advisory tool: 1–4 typed questions (choice, score, predicate) answered by the Jev decision model through the host's native Decisions API; it registers only on hosts exposing that API and never dispatches agents, runs skills, or changes permissions.
|
|
18
|
+
- **routing** — Added native route selection from the user-level decision-router config (OpenCode Console `jev-1.13` and custom `typesafe-ai` decision models) with a frozen provider→host mapping; direct OpenAI is refused and never substituted.
|
|
19
|
+
- **routing** — Added host-reported settlement: the budget reservation reconciles from the host-reported DecisionResult cost (a reported zero releases the hold), and a failed or unreconciled call stays fail-closed.
|
|
20
|
+
- **routing** — Added catalog presets to `pantheon_jev_decide`: `mode: "skills"` stacks the locally prefiltered skill shortlist (whole-catalog fallback) and `mode: "delegation"` picks a specialist, both single typed calls with `none` always offered.
|
|
21
|
+
- **routing** — Extended the `skills` preset to decide over installed host skills (`ctx.skill.list()`) in addition to the Pantheon catalog: any Agent-Skills-format skill installed in the host becomes stackable without a Pantheon change. Installs stay manual and reviewed; Pantheon never installs or updates skills.
|
|
22
|
+
- **docs** — Documented the native gate chain, routes, and verification boundary in one reference (`docs/reference/native-decisions.md`) and indexed the decision-layer references in the docs nav; added a real-host canary assertion for the new tool's registration.
|
|
23
|
+
|
|
24
|
+
### Changed
|
|
25
|
+
|
|
26
|
+
- **security** — Removed the direct-fetch decision-provider path entirely (runner, payload protocol, fetch-path usage verifier, per-turn provider cache): Pantheon owns no transport, and the only egress is the host's native layer behind the enabled/consent/budget/permission chain. The per-turn prompt hook stays local-only.
|
|
27
|
+
- **security** — The budget ledger now treats a host-reported zero cost as a real zero (releasing the hold) while still freezing user/provider/model buckets when actual cost exceeds the reservation.
|
|
28
|
+
- **docs** — Consolidated the decision-status narrative to one source of truth per surface, corrected stale env-var rows (no decision credential is read on any production path), and removed an orphan planning note (the tracked deepwork note stays: it is the checkout fixture the resources server resolves against).
|
|
29
|
+
|
|
30
|
+
<!-- Add new changes here. Running `node scripts/versioning.mjs apply` will
|
|
31
|
+
move this section to a versioned entry and reset the template below. -->
|
|
32
|
+
## [v1.6.2-beta.5] - 2026-11-01
|
|
33
|
+
|
|
34
|
+
## 🆕 What's New
|
|
35
|
+
- **routing** — wire decision points to their declared host surfaces in shadow (#304)
|
|
36
|
+
- **routing** — add V2 decision layer with measured-shape adapters (#303)
|
|
37
|
+
|
|
38
|
+
## 🐞 Fixed
|
|
39
|
+
- **mcp** — harden memory and resource MCP reliability (#306)
|
|
13
40
|
## [v1.6.2-beta.4] - 2026-10-31
|
|
14
41
|
|
|
15
42
|
### Added
|
package/README.md
CHANGED
|
@@ -97,14 +97,16 @@ see [Quick Start](docs/QUICKSTART.md).
|
|
|
97
97
|
and documenting work.
|
|
98
98
|
- **5 local MCP servers** for project memory, persistence, resources, confined
|
|
99
99
|
script execution, and vision.
|
|
100
|
-
- **A selective, advisory decision router** with structured local results and
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
decision
|
|
106
|
-
|
|
107
|
-
|
|
100
|
+
- **A selective, advisory decision router** with structured local results and
|
|
101
|
+
deterministic per-turn skill/specialist recommendations when enabled.
|
|
102
|
+
Pantheon-owned direct-provider egress is inactive; native egress exists only
|
|
103
|
+
via the explicit, Zeus-only `pantheon_jev_decide` advisory tool, which calls
|
|
104
|
+
the host's native Decisions API (TypeSafe Jev via OpenCode Console or a
|
|
105
|
+
configured decision model) behind the user's consent and budget gates — it
|
|
106
|
+
never dispatches agents, runs skills, or changes permissions. This does not
|
|
107
|
+
change separately documented quota and Vision integrations. See the
|
|
108
|
+
[router reference](docs/reference/local-decision-router.md) and the
|
|
109
|
+
[Native Decisions (Jev)](docs/reference/native-decisions.md).
|
|
108
110
|
- **An optional TUI** with a dispatch sidebar block and a full-width
|
|
109
111
|
`/dispatch` panel. The V2 TUI also provides a quota overview in the
|
|
110
112
|
sidebar/footer and a `/quota` details panel. Quota display is enabled by
|
|
@@ -242,31 +244,186 @@ fan-in or job recovery without an exposed mechanism.
|
|
|
242
244
|
The delegation model, caller/target matrix, and approval gates are documented
|
|
243
245
|
in [Architecture](docs/ARCHITECTURE.md) and
|
|
244
246
|
[Permissions, Gates & Delegation](docs/PERMISSIONS-QUALITY-DELEGATION.md).
|
|
245
|
-
The [local decision router](docs/reference/local-decision-router.md)
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
247
|
+
The [local decision router](docs/reference/local-decision-router.md) provides a
|
|
248
|
+
default-off standalone local API (`PANTHEON_LOCAL_DECISION_ROUTER=1`), the
|
|
249
|
+
separate manual `pantheon_local_decision` advisory tool, and deterministic
|
|
250
|
+
per-turn local recommendations when the user-level `enabled` preference is on.
|
|
251
|
+
The prompt hook may add an advisory marker and narrow an existing `prompt.skills`
|
|
252
|
+
array only when identifiable skill IDs overlap the local selection; this never
|
|
253
|
+
dispatches child sessions or changes permissions or approvals. Per-turn selection
|
|
254
|
+
uses no provider egress: the formerly documented direct-provider route remains
|
|
255
|
+
historical/inactive, and legacy consent, caps, period, provider selection, or
|
|
256
|
+
credentials cannot activate it. Native child-session dispatch remains separate.
|
|
257
|
+
|
|
258
|
+
The one native egress surface is the Zeus-only `pantheon_jev_decide` tool,
|
|
259
|
+
available on hosts that expose the V2.2.5 native Decisions API; its full gate
|
|
260
|
+
chain, routes, and settlement rules are documented once in
|
|
261
|
+
[V2 native Decisions](docs/reference/native-decisions.md).
|
|
258
262
|
|
|
259
263
|
The installer may retain a legacy target-specific preference; it does not control
|
|
260
|
-
runtime routing. `npx pantheon-opencode decision-router ...` manages
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
credentials. The published CLI imports
|
|
265
|
-
|
|
266
|
-
|
|
264
|
+
runtime routing. `npx pantheon-opencode decision-router ...` manages stored
|
|
265
|
+
user-level preferences and budget state: `enabled` gates the local per-turn
|
|
266
|
+
recommendation only; provider-selection and budget/consent state do not activate
|
|
267
|
+
egress. The separate SQLite ledger has no default caps. Installation does not
|
|
268
|
+
contact a model provider or inspect credentials. The published CLI imports
|
|
269
|
+
committed ESM bundles:
|
|
270
|
+
`npm run build:decision-router` regenerates them and `npm run check:decision-router`
|
|
271
|
+
(the `prepack`/`prepublishOnly` drift gate) fails when any is stale. The
|
|
267
272
|
`pantheon-opencode/local-decision-router` subpath itself is TypeScript source, so
|
|
268
273
|
it loads only in the host runtime or under a transpiler such as `tsx`.
|
|
269
274
|
|
|
275
|
+
Decision-layer commands are separated by effect. `decision-router help`,
|
|
276
|
+
`status`, `preview` and `holds` are read-only: they never create, migrate, or
|
|
277
|
+
write the config or the SQLite ledger, and neither does `setup` without
|
|
278
|
+
`--apply`. `select` records a preference and can never enable anything — moving
|
|
279
|
+
the target also revokes consent recorded for the previous one. `setup` prints a
|
|
280
|
+
**computed diff of the target artifacts** (snapshot + SHA-256 per file, compared
|
|
281
|
+
against the exact bytes the writer would produce); `setup --apply` is the form
|
|
282
|
+
that writes, and a second run reports `0 create · 0 update`. It is deliberately
|
|
283
|
+
not the installer's "Change plan", which announced 112 creates for an apply that
|
|
284
|
+
created nothing. `setup --target <dir>` also reconciles the
|
|
285
|
+
`.pantheon/install-state.json` provider/consent record with the user-level config;
|
|
286
|
+
that record is derived from the config and never asserts consent the config lacks.
|
|
287
|
+
Neither path creates a backup: installer backup sets accumulate once per
|
|
288
|
+
application and contain credential-bearing material (API keys/tokens), so no
|
|
289
|
+
extra copy is made. Installer file-ownership tracking is partial and asymmetric —
|
|
290
|
+
`file_inventory` indexes 53 PROJECT artifacts and no GLOBAL ones (F-15); the
|
|
291
|
+
106-project / 107-global denominators are derived from the 213-artifact total and
|
|
292
|
+
are not separately indexed — so this preview compares the decision-layer
|
|
293
|
+
artifacts it owns, not "everything the installer touched".
|
|
294
|
+
|
|
295
|
+
The old OpenAI/TypeSafe per-turn provider adapters and endpoint descriptions are
|
|
296
|
+
retained as historical, inert code; no legacy consent, cap, period, provider, or
|
|
297
|
+
permission setting wires them into the production prompt hook. The captured-hook
|
|
298
|
+
boundary test supplies an isolated synthetic consent/provider config and fake
|
|
299
|
+
test-only credential, verifies a local recommendation marker, and verifies zero
|
|
300
|
+
native Decisions or global `fetch` calls. This is an offline regression check of
|
|
301
|
+
that hook, not a claim about unexercised network paths or a live-provider test.
|
|
302
|
+
Measured surface coverage is
|
|
303
|
+
reported honestly rather than implied: P7 runs behind `PANTHEON_V2_P7_LOOP` with
|
|
304
|
+
an **advisory** execution cap (never described as enforcement), P2 is
|
|
305
|
+
**advisory-only** (an empirical no-op on the default path), P9 was measured on
|
|
306
|
+
top-level **and child** sessions with `reason:"overflow"` still unmeasured, and
|
|
307
|
+
P8 is **advisory: not activatable by measurement** — its declared rules match no
|
|
308
|
+
delivered permission payload, so it narrows nothing (PROBE-F).
|
|
309
|
+
|
|
310
|
+
### The V2 decision layer is declared in full and wired in part
|
|
311
|
+
|
|
312
|
+
The V2 decision layer declares eleven integration points (P1–P11) over three
|
|
313
|
+
decision primitives — `ask`, `rank`, and `verify` — and a deterministic policy
|
|
314
|
+
that decides which point may run. **Seven of the eleven have a production call
|
|
315
|
+
site: two behind flags that are off by default, five in shadow.**
|
|
316
|
+
|
|
317
|
+
- **P7 (loop)** is wired to `session.execution.succeeded` behind
|
|
318
|
+
`PANTHEON_V2_P7_LOOP`, which is off. It writes each observation to an
|
|
319
|
+
in-memory, bounded telemetry collector that the plugin never reads back and
|
|
320
|
+
exposes only to tests, so "records" here does not mean an operator-visible log.
|
|
321
|
+
- **P8 (guardrail)** is wired to `permission.evaluate` behind
|
|
322
|
+
`PANTHEON_V2_P8_GUARDRAIL`, which is off. C8 is closed **by measurement**, and
|
|
323
|
+
the measurement is negative: PROBE-F delivered 24 real `permission.evaluate`
|
|
324
|
+
events and every declared rule matched none of them (a valid `action` token and
|
|
325
|
+
a top-level `sessionID` are always present), the host resolves an unrecognised
|
|
326
|
+
effect as `ask` and proceeds, and `permission.evaluate.egress` is unreachable
|
|
327
|
+
(a tool declaring it is never advertised to the provider). As declared, P8 does
|
|
328
|
+
not narrow. The flag stays off.
|
|
329
|
+
- **P1 and P2** are registered on `session.hook('prompt')` in **shadow**. They
|
|
330
|
+
observe the same admission payload through a projection that carries only
|
|
331
|
+
`prompt.agents` and `prompt.skills`: no text, no file bytes, no metadata, no
|
|
332
|
+
mutation, no throw. Every record says `effect: none` and goes to an in-memory,
|
|
333
|
+
bounded collector the plugin never reads back (test-visible only).
|
|
334
|
+
- **P3** is wired at its declared `tool.invoke` in **shadow**: the
|
|
335
|
+
`pantheon_local_decision` tool hands the adapter its own input, whose schema
|
|
336
|
+
requires `complexity` and `gateStatus`. It records a classification when the
|
|
337
|
+
tool is invoked — never a permanent `complexity.invalid` refusal from a payload
|
|
338
|
+
that cannot carry the vector — and applies nothing.
|
|
339
|
+
- **P9** is wired at its declared `session.hook('compaction')` in **shadow**, on
|
|
340
|
+
the carrier that was actually measured: the top-level `sessionID` and the
|
|
341
|
+
`system` part array. It records the decision key and the payload shape and
|
|
342
|
+
pushes nothing — the injected compaction context is unchanged — and a payload
|
|
343
|
+
whose only session id is a nested `session.id` (a field the 2.2.5 host never
|
|
344
|
+
sends) produces no decision at all. The same shape was measured in a **child**
|
|
345
|
+
session (PROBE-G: hook fires 3/3, child `sessionID` at top level, `system` an
|
|
346
|
+
array of 4), so no child-specific branch exists. `reason:"overflow"` was not
|
|
347
|
+
inducible and is not designed for. No measured surface carries the memory
|
|
348
|
+
candidate list it would retain or discard, so its record states that absence
|
|
349
|
+
rather than a retention or a priority.
|
|
350
|
+
- **P11** is wired inside `ctx.tool.transform` in **shadow**: it reads the draft
|
|
351
|
+
the host hands that callback and calls none of its mutators. Shadow has no
|
|
352
|
+
responder, so it records the validated `choice` question over the draft ids —
|
|
353
|
+
never a selection.
|
|
354
|
+
|
|
355
|
+
**The other four — P4, P5, P6 and P10 — are library code with no production call
|
|
356
|
+
site.** Nothing constructs or registers them outside the per-point test suites —
|
|
357
|
+
the offline harness imports no adapter module. P6 and P10 declared the prompt
|
|
358
|
+
hook, but that payload never carries council candidates or counsellor claims, so
|
|
359
|
+
they stay unwired instead of recording a refusal from a surface that cannot feed
|
|
360
|
+
them. P4 ranks a memory candidate array and the measured `context` payload
|
|
361
|
+
carries `system` text parts, not candidates; P5 verifies a declared
|
|
362
|
+
`{ requirements, responses }` pair and the `execute.after` event carries
|
|
363
|
+
neither. On a host they do not read the turn, record no telemetry and have no
|
|
364
|
+
switch to turn off, because nothing registers them.
|
|
365
|
+
|
|
366
|
+
"Shadow" therefore means no behavioural change, not a claim of effect: the five
|
|
367
|
+
shadow points read a narrow slice of their surface and decide nothing from it,
|
|
368
|
+
and the two flag-gated points are off. No activation flag is set in a default
|
|
369
|
+
install.
|
|
370
|
+
|
|
371
|
+
The CLI separates effects: `npx pantheon-opencode decision-router help`, `status`,
|
|
372
|
+
`preview` and `holds` never write, `setup` writes only under `--apply`, `preview`
|
|
373
|
+
is an alias of `setup`, and `select` records a preference without enabling
|
|
374
|
+
anything. Egress stays opt-in and off, and only the explicit `enable`, `consent`,
|
|
375
|
+
`caps` and `period` actions can change that; no read-only command can.
|
|
376
|
+
|
|
377
|
+
What the layer does **not** do today, stated as measured rather than implied:
|
|
378
|
+
|
|
379
|
+
- **P2 (skills) is advisory-only and does not filter.** It is an empirical no-op
|
|
380
|
+
on the default path, because the host sends `prompt.skills` absent. Effective
|
|
381
|
+
project-skill filtering was cancelled by measurement, not emulated, and no
|
|
382
|
+
token reduction is claimed.
|
|
383
|
+
- **P7 (loop) is behind `PANTHEON_V2_P7_LOOP`, off by default, and does not
|
|
384
|
+
enforce loop limits.** It counts executions and writes an `effect: none`
|
|
385
|
+
observation to an in-memory collector that nothing reads back. Its
|
|
386
|
+
12-execution cap is **advisory**: no measured host surface signals a new user
|
|
387
|
+
turn, so nothing is claimed to reset the streak.
|
|
388
|
+
- **P9 (compaction) is measured in top-level and child sessions.** PROBE-G fired
|
|
389
|
+
the hook in a real child 3/3 with the child's `sessionID` at top level and the
|
|
390
|
+
same payload shape. `reason: "overflow"` was **not inducible** in 6 error
|
|
391
|
+
shapes — the host retried and completed, and the one failure-recovery
|
|
392
|
+
compaction was persisted as `reason:"auto"` — so that path stays unmeasured;
|
|
393
|
+
the checkpoint reinjection inside a child was not exercised, and the `messages`
|
|
394
|
+
channel remains UNKNOWN. The memory candidate list is not available on any
|
|
395
|
+
measured surface, so the wired P9 record names that absence and claims no
|
|
396
|
+
retention or priority.
|
|
397
|
+
- **P8 (guardrail) is not activatable by measurement.** PROBE-F delivered 24 real
|
|
398
|
+
`permission.evaluate` events: the payload is
|
|
399
|
+
`["sessionID","agent","action","resources","metadata","source","effect"]` with
|
|
400
|
+
`effect` an own writable data property pre-populated by the host, and a written
|
|
401
|
+
`deny` **is** honoured. But neither declared rule can match a delivered payload
|
|
402
|
+
(valid `action` token, `sessionID` always present), the host lets an
|
|
403
|
+
unrecognised effect resolve as `ask` and execute, and
|
|
404
|
+
`permission.evaluate.egress` is unreachable — so the current rule set matches
|
|
405
|
+
nothing and does not narrow. The point is recorded as **advisory**, not as
|
|
406
|
+
awaiting review, and the inertness is the measured verdict rather than a design
|
|
407
|
+
claim. `execute.before` remains the only hard barrier.
|
|
408
|
+
- **The embeddings-versus-BM25 comparison has not been run.** The environment is
|
|
409
|
+
offline with no embedding model available, so BM25 remains the baseline and no
|
|
410
|
+
gain or loss in retrieval or tokens is claimed in either direction.
|
|
411
|
+
|
|
412
|
+
Calibration that was run: the offline harness
|
|
413
|
+
(`npx tsx tests/pantheon/v2-decision-harness.test.ts`) executed 264 synthetic
|
|
414
|
+
cases — 132 normal, 66 refusal, 66 adversarial — across the eleven points, with
|
|
415
|
+
24 cases per point and the suite asserting at least 20 cases, 5 refusals and 5
|
|
416
|
+
adversarial cases per point. All 264 cases passed on 2026-10-31. This harness is
|
|
417
|
+
the only place all eleven points are exercised in one run, but it imports no
|
|
418
|
+
adapter module: it iterates the registry and exercises the shared primitives,
|
|
419
|
+
while the adapters are covered by their per-point suites
|
|
420
|
+
(`v2-decision-p1.test.ts` … `v2-decision-p11.test.ts`). Passing it says nothing
|
|
421
|
+
about whether a point is registered in a host.
|
|
422
|
+
The harness measures contracts (admission, refusal, shadow no-op, telemetry
|
|
423
|
+
redaction, offline discipline, registry integrity), **not** token use, quality,
|
|
424
|
+
latency or any effect inside a host turn. Numbers and unmeasured surfaces are
|
|
425
|
+
recorded in the [router reference](docs/reference/local-decision-router.md).
|
|
426
|
+
|
|
270
427
|
## Documentation
|
|
271
428
|
|
|
272
429
|
| Start here | Go deeper |
|
|
@@ -277,15 +434,31 @@ it loads only in the host runtime or under a transpiler such as `tsx`.
|
|
|
277
434
|
| [Compatibility](docs/COMPATIBILITY.md) | [OpenCode V2](docs/opencode-v2.md) |
|
|
278
435
|
| [Agents & Skills](docs/agents/README.md) | [Platforms](docs/PLATFORMS.md) |
|
|
279
436
|
| [Release Process](docs/RELEASING.md) | [Branch Protection](docs/BRANCH-PROTECTION.md) |
|
|
280
|
-
| [Model Routing](docs/reference/model-routing.md) | [Local Decision Router](docs/reference/local-decision-router.md) · [Offline Evaluation Protocol](docs/reference/offline-evaluation.md) · [Env Vars](docs/reference/env-vars.md) · [Code Mode](docs/reference/code-mode.md) |
|
|
437
|
+
| [Model Routing](docs/reference/model-routing.md) | [Local Decision Router](docs/reference/local-decision-router.md) · [V2 Native Decisions](docs/reference/native-decisions.md) · [Offline Evaluation Protocol](docs/reference/offline-evaluation.md) · [Env Vars](docs/reference/env-vars.md) · [Code Mode](docs/reference/code-mode.md) |
|
|
281
438
|
| [Contributing](CONTRIBUTING.md) | [Roadmap](ROADMAP.md) · [Changelog](CHANGELOG.md) |
|
|
282
439
|
|
|
440
|
+
Memory writes through `pantheon-memory` are serialized, and failed writes are
|
|
441
|
+
reported as failures rather than as stored entries. Eval resources wait for
|
|
442
|
+
SQLite locks and close their connections; project-specific resources resolve
|
|
443
|
+
the current project root per request while preserving the trusted
|
|
444
|
+
`PANTHEON_HOME` fallback. See [Memory](docs/MEMORY.md) for store separation and
|
|
445
|
+
[MCP tools](docs/mcp-tools.md) for details.
|
|
446
|
+
|
|
283
447
|
The release install gate's tool canary loads the installed tarball's V2 plugin
|
|
284
448
|
entry under OpenCode 2.0.30 and verifies `hashline_edit` registration, Code Mode
|
|
285
449
|
visibility, and a bounded edit in an isolated project. It does not prove npm
|
|
286
450
|
publication or compatibility with untested host versions; details are in the
|
|
287
451
|
[release process](docs/RELEASING.md).
|
|
288
452
|
|
|
453
|
+
Generate beta release notes from commits since the latest prior beta tag with
|
|
454
|
+
`node scripts/versioning.mjs apply --beta --notes`. See the [release
|
|
455
|
+
procedure](docs/RELEASING.md) for details.
|
|
456
|
+
After the version bump, verify and rebuild the TUI workspace from the repository
|
|
457
|
+
root with `npm run typecheck --workspace=src/plugins/tui` and
|
|
458
|
+
`npm run build --workspace=src/plugins/tui`.
|
|
459
|
+
The maintainer-only `release` scope is excluded from public notes and their
|
|
460
|
+
Closed Issues references; see the [release-notes policy](docs/RELEASING.md#release-notes).
|
|
461
|
+
|
|
289
462
|
## Status
|
|
290
463
|
|
|
291
464
|
The manifests in this checkout express the version being prepared, not a
|
package/README.pt-BR.md
CHANGED
|
@@ -75,6 +75,15 @@ apenas — `init` → reiniciar → `/dispatch` → primeiro resultado — veja
|
|
|
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.
|
|
78
|
+
- **Um roteador de decisão seletivo e consultivo**, com resultados locais
|
|
79
|
+
estruturados e recomendações por turno quando habilitado. O egress direto
|
|
80
|
+
pertencente ao Pantheon é inativo; o egress nativo existe apenas na tool
|
|
81
|
+
explícita `pantheon_jev_decide` (só para o Zeus), que chama a API nativa de
|
|
82
|
+
Decisions do host (Jev/TypeSafe via OpenCode Console ou modelo configurado)
|
|
83
|
+
atrás do consentimento e dos limites de orçamento do usuário — ela nunca
|
|
84
|
+
despacha agentes, executa skills ou altera permissões. Veja a
|
|
85
|
+
[referência do roteador](docs/reference/local-decision-router.md) e o
|
|
86
|
+
[Decisions nativas (Jev)](docs/reference/native-decisions.md).
|
|
78
87
|
- **Uma TUI opcional**, com bloco de dispatch na sidebar e painel `/dispatch`
|
|
79
88
|
em largura total. A TUI V2 também inclui um resumo de quota na sidebar/rodapé
|
|
80
89
|
e o painel `/quota`, com abas Usage, Limits, Plugin e Settings. Usage mostra
|
package/bin/pantheon-init.mjs
CHANGED
|
@@ -84,7 +84,12 @@ function printUsage() {
|
|
|
84
84
|
' npx pantheon-opencode init --merge-dev-config <path> # Merge a dev config (off by default)',
|
|
85
85
|
)
|
|
86
86
|
console.log(' npx pantheon-opencode set-tier <name> # Set active model preset (global)')
|
|
87
|
-
console.log(
|
|
87
|
+
console.log(
|
|
88
|
+
' npx pantheon-opencode decision-router help|status|setup|preview|holds # read-only',
|
|
89
|
+
)
|
|
90
|
+
console.log(
|
|
91
|
+
' npx pantheon-opencode decision-router select|enable|consent|caps|period # explicit actions',
|
|
92
|
+
)
|
|
88
93
|
console.log(
|
|
89
94
|
' npx pantheon-opencode update [--stable] # Update package + re-run init (default: beta channel)',
|
|
90
95
|
)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pantheon-opencode",
|
|
3
|
-
"version": "1.6.2-beta.
|
|
3
|
+
"version": "1.6.2-beta.6",
|
|
4
4
|
"description": "Multi-agent orchestration for OpenCode — 14 specialized agents, TDD, Themis review gates.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"workspaces": [
|
|
@@ -120,6 +120,7 @@
|
|
|
120
120
|
"@biomejs/biome": "2.5.14",
|
|
121
121
|
"@commitlint/cli": "21.2.3",
|
|
122
122
|
"@commitlint/config-conventional": "21.2.3",
|
|
123
|
+
"@opencode/plugin": "2.2.5",
|
|
123
124
|
"ajv": "8.20.0",
|
|
124
125
|
"esbuild": "0.28.2",
|
|
125
126
|
"husky": "^9.1.7",
|
package/plugin.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pantheon",
|
|
3
3
|
"publisher": "ils15",
|
|
4
|
-
"version": "1.6.2-beta.
|
|
4
|
+
"version": "1.6.2-beta.6",
|
|
5
5
|
"displayName": "Pantheon",
|
|
6
6
|
"description": "Conductor-Delegate orchestration platform with 14 specialized agents, 20 skills, and OpenCode support.",
|
|
7
7
|
"agents": "./src/agents",
|
package/pyproject.toml
CHANGED
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.backends._legacy:_Backend"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "pantheon"
|
|
7
|
-
version = "1.6.2-beta.
|
|
7
|
+
version = "1.6.2-beta.6"
|
|
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
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
// Generated by scripts/build-decision-router.mjs
|
|
2
|
-
//
|
|
3
|
-
//
|
|
1
|
+
// Generated by scripts/build-decision-router.mjs. The published CLI cannot
|
|
2
|
+
// import TypeScript from node_modules, so it imports this prebuilt ESM bundle
|
|
3
|
+
// instead. Do not edit: run `npm run build:decision-router`.
|
|
4
4
|
|
|
5
5
|
// src/pantheon/local-decision-budget.ts
|
|
6
6
|
import { randomUUID } from "node:crypto";
|
|
@@ -11,10 +11,6 @@ import { performance } from "node:perf_hooks";
|
|
|
11
11
|
import { DatabaseSync } from "node:sqlite";
|
|
12
12
|
|
|
13
13
|
// src/pantheon/local-decision-usage-evidence.internal.ts
|
|
14
|
-
var MODEL_IDS = Object.freeze({
|
|
15
|
-
"openai-decisions": "gpt-6-luna",
|
|
16
|
-
"typesafe-jev": "jev-1.14.0"
|
|
17
|
-
});
|
|
18
14
|
var evidenceDetails = /* @__PURE__ */ new WeakMap();
|
|
19
15
|
function getVerifiedUsageEvidenceDetails(value) {
|
|
20
16
|
if (typeof value !== "object" && typeof value !== "function" || value === null) return null;
|
|
@@ -287,7 +283,10 @@ function openLocalDecisionBudgetLedger(options = {}) {
|
|
|
287
283
|
return { status: "unknown" };
|
|
288
284
|
}
|
|
289
285
|
const verified = getVerifiedUsageEvidenceDetails(evidence);
|
|
290
|
-
if (!verified || !Number.isSafeInteger(verified.actualCostMicros) ||
|
|
286
|
+
if (!verified || !Number.isSafeInteger(verified.actualCostMicros) || // Zero is a legitimate host-reported cost on the native route (the free
|
|
287
|
+
// Console variant and hosts that do not price Decisions); reconciling at
|
|
288
|
+
// zero releases the hold instead of burning the period's budget.
|
|
289
|
+
verified.actualCostMicros < 0 || !isAllowedProvider(verified.provider) || !isAllowedModel(verified.model) || !isValidPeriod(verified.period)) {
|
|
291
290
|
return { status: "unknown" };
|
|
292
291
|
}
|
|
293
292
|
return inImmediateTransaction(() => {
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
// Generated by scripts/build-decision-router.mjs. The published CLI cannot
|
|
2
|
+
// import TypeScript from node_modules, so it imports this prebuilt ESM bundle
|
|
3
|
+
// instead. Do not edit: run `npm run build:decision-router`.
|
|
4
|
+
|
|
5
|
+
// src/pantheon/v2-decision-budget.ts
|
|
6
|
+
import { lstatSync } from "node:fs";
|
|
7
|
+
import { DatabaseSync } from "node:sqlite";
|
|
8
|
+
function isPositiveCaps(value) {
|
|
9
|
+
return value !== void 0 && Number.isSafeInteger(value.monthlyCapMicros) && Number.isSafeInteger(value.perDecisionCapMicros) && value.monthlyCapMicros > 0 && value.perDecisionCapMicros > 0;
|
|
10
|
+
}
|
|
11
|
+
function evaluateCapGate(input) {
|
|
12
|
+
const { user, provider, model } = input;
|
|
13
|
+
for (const caps of [user, provider, model]) {
|
|
14
|
+
if (caps === void 0) continue;
|
|
15
|
+
if (!Number.isSafeInteger(caps.monthlyCapMicros) || !Number.isSafeInteger(caps.perDecisionCapMicros) || caps.monthlyCapMicros < 0 || caps.perDecisionCapMicros < 0) {
|
|
16
|
+
return { concern: "cap", ok: false, reason: "invalid-caps" };
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
if (!isPositiveCaps(user) || !isPositiveCaps(provider) || !isPositiveCaps(model)) {
|
|
20
|
+
return { concern: "cap", ok: false, reason: "no-cap" };
|
|
21
|
+
}
|
|
22
|
+
const reservedMicros = model.perDecisionCapMicros;
|
|
23
|
+
if (reservedMicros > user.perDecisionCapMicros || reservedMicros > provider.perDecisionCapMicros) {
|
|
24
|
+
return { concern: "cap", ok: false, reason: "per-decision-cap" };
|
|
25
|
+
}
|
|
26
|
+
return { concern: "cap", ok: true, reservedMicros };
|
|
27
|
+
}
|
|
28
|
+
var PERIOD_PATTERN = /^\d{4}-(0[1-9]|1[0-2])$/;
|
|
29
|
+
function utcPeriodOf(instantMs) {
|
|
30
|
+
if (!Number.isSafeInteger(instantMs) || instantMs < 0) return null;
|
|
31
|
+
const period = new Date(instantMs).toISOString().slice(0, 7);
|
|
32
|
+
return PERIOD_PATTERN.test(period) ? period : null;
|
|
33
|
+
}
|
|
34
|
+
function evaluatePeriodGate(input) {
|
|
35
|
+
if (input.wallPeriod === null || !PERIOD_PATTERN.test(input.wallPeriod)) {
|
|
36
|
+
return { concern: "period", ok: false, reason: "invalid-period" };
|
|
37
|
+
}
|
|
38
|
+
if (input.activePeriod === null) {
|
|
39
|
+
return { concern: "period", ok: false, reason: "period-unconfirmed" };
|
|
40
|
+
}
|
|
41
|
+
if (!PERIOD_PATTERN.test(input.activePeriod)) {
|
|
42
|
+
return { concern: "period", ok: false, reason: "invalid-period" };
|
|
43
|
+
}
|
|
44
|
+
if (input.activePeriod !== input.wallPeriod) {
|
|
45
|
+
return { concern: "period", ok: false, reason: "period-mismatch" };
|
|
46
|
+
}
|
|
47
|
+
return { concern: "period", ok: true, period: input.activePeriod };
|
|
48
|
+
}
|
|
49
|
+
function evaluateLedgerGate(input) {
|
|
50
|
+
if (!input.present) return { concern: "ledger", ok: false, reason: "ledger-missing" };
|
|
51
|
+
if (input.frozen) return { concern: "ledger", ok: false, reason: "frozen" };
|
|
52
|
+
const additional = input.reservedMicros;
|
|
53
|
+
const exceeds = (committed, cap) => committed > cap || additional > cap - committed;
|
|
54
|
+
if (exceeds(input.userCommittedMicros, input.userMonthlyCapMicros) || exceeds(input.providerCommittedMicros, input.providerMonthlyCapMicros) || exceeds(input.modelCommittedMicros, input.modelMonthlyCapMicros)) {
|
|
55
|
+
return { concern: "ledger", ok: false, reason: "monthly-cap" };
|
|
56
|
+
}
|
|
57
|
+
return { concern: "ledger", ok: true };
|
|
58
|
+
}
|
|
59
|
+
function evaluateDecisionBudgetAdmission(input) {
|
|
60
|
+
const cap = evaluateCapGate(input.caps);
|
|
61
|
+
if (!cap.ok) return { admitted: false, concern: cap.concern, reason: cap.reason };
|
|
62
|
+
const period = evaluatePeriodGate(input.period);
|
|
63
|
+
if (!period.ok) return { admitted: false, concern: period.concern, reason: period.reason };
|
|
64
|
+
const ledger = evaluateLedgerGate({
|
|
65
|
+
...input.ledger,
|
|
66
|
+
present: true,
|
|
67
|
+
reservedMicros: cap.reservedMicros
|
|
68
|
+
});
|
|
69
|
+
if (!ledger.ok) return { admitted: false, concern: ledger.concern, reason: ledger.reason };
|
|
70
|
+
return { admitted: true, period: period.period, reservedMicros: cap.reservedMicros };
|
|
71
|
+
}
|
|
72
|
+
var EXPECTED_APPLICATION_ID = 1346522161;
|
|
73
|
+
function classifyDbPath(dbPath) {
|
|
74
|
+
try {
|
|
75
|
+
const stat = lstatSync(dbPath);
|
|
76
|
+
return stat.isFile() && !stat.isSymbolicLink() ? "regular" : "unsafe";
|
|
77
|
+
} catch {
|
|
78
|
+
return "missing";
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
function readCapsRow(db, sql) {
|
|
82
|
+
const row = db.prepare(sql).get();
|
|
83
|
+
if (!row) return null;
|
|
84
|
+
return {
|
|
85
|
+
monthly: Number(row.monthly_cap_micros),
|
|
86
|
+
perDecision: Number(row.per_decision_cap_micros)
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
function readDecisionBudgetLedgerFacts(dbPath) {
|
|
90
|
+
const kind = classifyDbPath(dbPath);
|
|
91
|
+
if (kind === "missing") return { present: false };
|
|
92
|
+
if (kind === "unsafe") {
|
|
93
|
+
return { present: true, readable: false, reason: "not-a-regular-file" };
|
|
94
|
+
}
|
|
95
|
+
let db;
|
|
96
|
+
try {
|
|
97
|
+
db = new DatabaseSync(dbPath, { readOnly: true });
|
|
98
|
+
} catch {
|
|
99
|
+
return { present: true, readable: false, reason: "unsupported-schema" };
|
|
100
|
+
}
|
|
101
|
+
try {
|
|
102
|
+
const version = db.prepare("PRAGMA user_version").get().user_version;
|
|
103
|
+
const applicationId = db.prepare("PRAGMA application_id").get().application_id;
|
|
104
|
+
if (applicationId !== EXPECTED_APPLICATION_ID || version !== 3) {
|
|
105
|
+
return { present: true, readable: false, reason: "unsupported-schema" };
|
|
106
|
+
}
|
|
107
|
+
const activeRow = db.prepare("SELECT active_period_utc FROM ledger_state WHERE id = 1").get();
|
|
108
|
+
const counts = db.prepare(
|
|
109
|
+
`SELECT
|
|
110
|
+
COUNT(*) AS reservations,
|
|
111
|
+
COALESCE(SUM(CASE WHEN state IN ('pending', 'uncertain') THEN 1 ELSE 0 END), 0) AS holds
|
|
112
|
+
FROM reservations`
|
|
113
|
+
).get();
|
|
114
|
+
const freezes = db.prepare("SELECT COUNT(*) AS total FROM budget_freezes").get();
|
|
115
|
+
return {
|
|
116
|
+
present: true,
|
|
117
|
+
readable: true,
|
|
118
|
+
schemaVersion: version,
|
|
119
|
+
applicationId,
|
|
120
|
+
activePeriod: activeRow?.active_period_utc ?? null,
|
|
121
|
+
reservations: Number(counts.reservations),
|
|
122
|
+
holds: Number(counts.holds),
|
|
123
|
+
freezes: Number(freezes.total)
|
|
124
|
+
};
|
|
125
|
+
} catch {
|
|
126
|
+
return { present: true, readable: false, reason: "unsupported-schema" };
|
|
127
|
+
} finally {
|
|
128
|
+
db.close();
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
function readDecisionCapFacts(dbPath) {
|
|
132
|
+
if (classifyDbPath(dbPath) !== "regular") return null;
|
|
133
|
+
let db;
|
|
134
|
+
try {
|
|
135
|
+
db = new DatabaseSync(dbPath, { readOnly: true });
|
|
136
|
+
} catch {
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
139
|
+
try {
|
|
140
|
+
const user = readCapsRow(
|
|
141
|
+
db,
|
|
142
|
+
"SELECT monthly_cap_micros, per_decision_cap_micros FROM user_caps WHERE id = 1"
|
|
143
|
+
);
|
|
144
|
+
const providers = {};
|
|
145
|
+
for (const row of db.prepare("SELECT provider, monthly_cap_micros, per_decision_cap_micros FROM provider_caps").all()) {
|
|
146
|
+
providers[row.provider] = {
|
|
147
|
+
monthlyCapMicros: Number(row.monthly_cap_micros),
|
|
148
|
+
perDecisionCapMicros: Number(row.per_decision_cap_micros)
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
const models = {};
|
|
152
|
+
for (const row of db.prepare(
|
|
153
|
+
"SELECT provider, model, monthly_cap_micros, per_decision_cap_micros FROM model_caps"
|
|
154
|
+
).all()) {
|
|
155
|
+
models[`${row.provider}/${row.model}`] = {
|
|
156
|
+
monthlyCapMicros: Number(row.monthly_cap_micros),
|
|
157
|
+
perDecisionCapMicros: Number(row.per_decision_cap_micros)
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
return {
|
|
161
|
+
user: user === null ? null : { monthlyCapMicros: user.monthly, perDecisionCapMicros: user.perDecision },
|
|
162
|
+
providers,
|
|
163
|
+
models
|
|
164
|
+
};
|
|
165
|
+
} catch {
|
|
166
|
+
return null;
|
|
167
|
+
} finally {
|
|
168
|
+
db.close();
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
function inspectDecisionBudget(dbPath) {
|
|
172
|
+
const ledger = readDecisionBudgetLedgerFacts(dbPath);
|
|
173
|
+
const caps = readDecisionCapFacts(dbPath);
|
|
174
|
+
const activePeriod = ledger.present && ledger.readable ? ledger.activePeriod : null;
|
|
175
|
+
return { ledger, caps, period: { activePeriod } };
|
|
176
|
+
}
|
|
177
|
+
function listDecisionHoldsReadOnly(dbPath) {
|
|
178
|
+
if (classifyDbPath(dbPath) !== "regular") return null;
|
|
179
|
+
let db;
|
|
180
|
+
try {
|
|
181
|
+
db = new DatabaseSync(dbPath, { readOnly: true });
|
|
182
|
+
} catch {
|
|
183
|
+
return null;
|
|
184
|
+
}
|
|
185
|
+
try {
|
|
186
|
+
const applicationId = db.prepare("PRAGMA application_id").get().application_id;
|
|
187
|
+
const version = db.prepare("PRAGMA user_version").get().user_version;
|
|
188
|
+
if (applicationId !== EXPECTED_APPLICATION_ID || version !== 3) return null;
|
|
189
|
+
const rows = db.prepare(
|
|
190
|
+
`SELECT id, provider, model, period_utc, reserved_micros, state
|
|
191
|
+
FROM reservations WHERE state IN ('pending', 'uncertain')
|
|
192
|
+
ORDER BY created_at_ms, id`
|
|
193
|
+
).all();
|
|
194
|
+
return rows.map((row) => ({
|
|
195
|
+
reservationId: row.id,
|
|
196
|
+
provider: row.provider,
|
|
197
|
+
model: row.model,
|
|
198
|
+
period: row.period_utc,
|
|
199
|
+
reservedMicros: Number(row.reserved_micros),
|
|
200
|
+
state: row.state
|
|
201
|
+
}));
|
|
202
|
+
} catch {
|
|
203
|
+
return null;
|
|
204
|
+
} finally {
|
|
205
|
+
db.close();
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
export {
|
|
209
|
+
evaluateCapGate,
|
|
210
|
+
evaluateDecisionBudgetAdmission,
|
|
211
|
+
evaluateLedgerGate,
|
|
212
|
+
evaluatePeriodGate,
|
|
213
|
+
inspectDecisionBudget,
|
|
214
|
+
listDecisionHoldsReadOnly,
|
|
215
|
+
readDecisionBudgetLedgerFacts,
|
|
216
|
+
readDecisionCapFacts,
|
|
217
|
+
utcPeriodOf
|
|
218
|
+
};
|