pantheon-opencode 1.6.2-beta.3 → 1.6.2-beta.4

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 (35) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/README.md +38 -1
  3. package/bin/pantheon-init.mjs +17 -0
  4. package/package.json +9 -3
  5. package/plugin.json +1 -1
  6. package/pyproject.toml +1 -1
  7. package/scripts/decision-router-budget.mjs +781 -0
  8. package/scripts/decision-router.mjs +297 -0
  9. package/scripts/install/decision-router-config.mjs +432 -0
  10. package/scripts/install/interactive.mjs +76 -5
  11. package/scripts/install/opencode.mjs +12 -0
  12. package/scripts/install/state.mjs +5 -0
  13. package/scripts/install/strings.mjs +4 -0
  14. package/src/agents/zeus.md +12 -0
  15. package/src/pantheon/local-decision-agents.ts +170 -0
  16. package/src/pantheon/local-decision-budget.ts +1043 -0
  17. package/src/pantheon/local-decision-egress-gate.ts +264 -0
  18. package/src/pantheon/local-decision-prompt.ts +123 -0
  19. package/src/pantheon/local-decision-provider-matrix.ts +92 -0
  20. package/src/pantheon/local-decision-provider-protocol.ts +335 -0
  21. package/src/pantheon/local-decision-provider.internal.ts +260 -0
  22. package/src/pantheon/local-decision-router.ts +225 -0
  23. package/src/pantheon/local-decision-skills.ts +171 -0
  24. package/src/pantheon/local-decision-tool.ts +126 -0
  25. package/src/pantheon/local-decision-turn.ts +338 -0
  26. package/src/pantheon/local-decision-usage-evidence.internal.ts +207 -0
  27. package/src/pantheon/local-orchestration.ts +322 -0
  28. package/src/pantheon/pantheon-decision-catalog.ts +101 -0
  29. package/src/pantheon/v2-tools.ts +15 -14
  30. package/src/plugin-v2.ts +52 -19
  31. package/src/plugin.ts +4 -0
  32. package/src/plugins/tui/dist/tui-v2.js +3 -3
  33. package/src/plugins/tui/dist/tui.js +1 -1
  34. package/src/plugins/tui/package-lock.json +2 -2
  35. package/src/plugins/tui/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -10,6 +10,40 @@ 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.4] - 2026-10-31
14
+
15
+ ### Added
16
+
17
+ - **install** — Added a user-level `decision-router` admin CLI for enablement, selection, consent, per-user/provider/model caps, and period confirmation; config is private and non-secret.
18
+ - **install** — Added `decision-router holds` to list unresolved reservations without reserving, reconciling, releasing, or pruning.
19
+ - **docs** — Added an offline protocol for separately evaluating agent routing and task complexity; no benchmark results or provider selection are claimed.
20
+ - **routing** — Added a default-off, local-only recommendation API for exact canonical agent roles and structured complexity dimensions; it does not dispatch agents or change gates.
21
+ - **routing** — Added a private V2 per-turn selector: allowlisted skills, at most one specialist, one call per session/message, and deterministic local fallback.
22
+ - **routing** — Added a private fixed-endpoint adapter for `gpt-6-luna` and `jev-1.14.0` with no caller-supplied transport, retry, or fan-out; Console/Free and Bifrost stay ineligible.
23
+ - **routing** — Provider contract tests run under the real `tsx` runner (`npm run test:ts`) for the exact payload, gate denials, usage reconciliation, and one call per turn; no live call was made.
24
+ - **routing** — Added a user-level `enabled` switch, canonical provider/model matrix, and a single ledger mapping; provider egress also requires the host `permission.assert` gate.
25
+ - **routing** — Added a user-scoped SQLite ledger with explicit UTC reservations and no default caps. Admission caps are local safeguards, not invoice guarantees.
26
+ - **docs** — `decision-router status`/`holds` are read paths: `status` may create the SQLite ledger, and both may migrate it, but neither reserves, reconciles, releases, or prunes.
27
+ - **docs** — The `local-decision-router` subpath is TypeScript source needing the host runtime or a transpiler; the published CLI uses the committed ESM bundle.
28
+
29
+ ### Changed
30
+
31
+ - **security** — Decision egress is fail-closed: a missing gate, cap, period, or credential means zero requests; V1 stays local-only.
32
+ - **release** — `prepack` now runs the `check:decision-router` drift gate, so a stale ledger bundle cannot be packed or published.
33
+
34
+ ### Fixed
35
+
36
+ - **install** — `decision-router caps user` without flags now reports `Both --monthly-usd and --per-decision-usd are required` as a one-line usage error instead of a stack trace.
37
+ - **routing** — `permission.assert` denial (thrown or returned, including the host's `Permission denied: decision.egress` message) means zero requests; an explicit `deny` rule is the kill-switch.
38
+ - **routing** — Egress trusts the user-level config; `permission.assert` is only the host kill-switch. A v2.2.0 canary showed an unruled assertion resolves allow and `evaluate` runs only on that path.
39
+ - **routing** — A cached provider decision re-reads the user-level config/consent gate before reuse, so revoking consent takes effect without waiting for cache expiry.
40
+ - **security** — The prompt hook reuses one decision per turn and never logs or persists the raw request; payloads stay allowlisted.
41
+ - **security** — Credential rejection now requires a token boundary and structured `sk-` prefixes, so prose such as `task-force-*` or `disk-usage-*` is no longer treated as a key.
42
+ - **routing** — Reusing a cached provider decision does not re-prompt the same permission gate; a different or missing gate is still evaluated and denies fail-closed.
43
+ - **docs** — Clarified that `decision-router holds` performs no reservation, reconciliation, release, or pruning, while opening an existing ledger may apply a forward-only schema migration.
44
+
45
+ &lt;!-- Add new changes here. Running `node scripts/versioning.mjs apply` will
46
+ move this section to a versioned entry and reset the template below. --&gt;
13
47
  ## [v1.6.2-beta.3] - 2026-10-29
14
48
 
15
49
  ### Changed
package/README.md CHANGED
@@ -97,6 +97,14 @@ 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 an
101
+ optional per-turn skill/agent recommendation. Provider egress is fail-closed: it
102
+ requires explicit enablement, consent, one cap-valid `openai-decisions` or
103
+ `typesafe-jev` candidate, a confirmed period, and the host permission gate.
104
+ Console/Free and Bifrost are never eligible. This statement applies to this
105
+ decision subsystem—not to all Pantheon egress; quota and Vision integrations
106
+ retain their separately documented external requests. See the
107
+ [router reference](docs/reference/local-decision-router.md).
100
108
  - **An optional TUI** with a dispatch sidebar block and a full-width
101
109
  `/dispatch` panel. The V2 TUI also provides a quota overview in the
102
110
  sidebar/footer and a `/quota` details panel. Quota display is enabled by
@@ -140,6 +148,11 @@ see [Quick Start](docs/QUICKSTART.md).
140
148
  the
141
149
  [quota provider coverage table](docs/tui-v2-quota-providers.md) for limits and
142
150
  troubleshooting.
151
+
152
+
153
+ Quota status requests are separate from the decision subsystem and continue to use
154
+ their documented provider APIs. Removing decision-provider transport does not
155
+ disable these quota requests.
143
156
  `/quota-go-check` is a separate manual, confirmation-gated diagnostic: one
144
157
  GET to `https://opencode.ai/zen/go/v1/usage` with the configured Go API key
145
158
  (not OAuth), at most one attempt per plugin runtime. It never refreshes quota,
@@ -229,6 +242,30 @@ fan-in or job recovery without an exposed mechanism.
229
242
  The delegation model, caller/target matrix, and approval gates are documented
230
243
  in [Architecture](docs/ARCHITECTURE.md) and
231
244
  [Permissions, Gates & Delegation](docs/PERMISSIONS-QUALITY-DELEGATION.md).
245
+ The [local decision router](docs/reference/local-decision-router.md) is
246
+ consultative: it narrows an advisory skill list and can recommend at most one
247
+ specialist, but it never intercepts native child-session dispatch or changes
248
+ permissions. The standalone API is default-off
249
+ (`PANTHEON_LOCAL_DECISION_ROUTER=1`); per-turn selection additionally requires
250
+ `enabled: true` in the user-level config. Provider egress is fail-closed and
251
+ requires every local gate plus a non-denying host `ctx.permission.assert`. The
252
+ host is not deny-by-default for `decision.egress` (an unruled assertion resolved
253
+ allow on the measured canary), so the user-level config/consent gate is the
254
+ source of truth and an explicit host `deny` rule is the kill-switch. A canary
255
+ measured the assertion contract but made no live provider call, so egress remains
256
+ unverified and off by default. Native child-session dispatch remains the final
257
+ routing action.
258
+
259
+ The installer may retain a legacy target-specific preference; it does not control
260
+ runtime routing. `npx pantheon-opencode decision-router ...` manages user-level
261
+ enablement, selection, candidates, consent, caps, and period confirmation. The
262
+ separate SQLite ledger has no default caps. Caps limit local admission but are not
263
+ invoice guarantees. Installation does not contact a model provider or inspect
264
+ credentials. The published CLI imports a committed ESM ledger bundle:
265
+ `npm run build:decision-router` regenerates it and `npm run check:decision-router`
266
+ (the `prepack`/`prepublishOnly` drift gate) fails when it is stale. The
267
+ `pantheon-opencode/local-decision-router` subpath itself is TypeScript source, so
268
+ it loads only in the host runtime or under a transpiler such as `tsx`.
232
269
 
233
270
  ## Documentation
234
271
 
@@ -240,7 +277,7 @@ in [Architecture](docs/ARCHITECTURE.md) and
240
277
  | [Compatibility](docs/COMPATIBILITY.md) | [OpenCode V2](docs/opencode-v2.md) |
241
278
  | [Agents & Skills](docs/agents/README.md) | [Platforms](docs/PLATFORMS.md) |
242
279
  | [Release Process](docs/RELEASING.md) | [Branch Protection](docs/BRANCH-PROTECTION.md) |
243
- | [Model Routing](docs/reference/model-routing.md) | [Env Vars](docs/reference/env-vars.md) · [Code Mode](docs/reference/code-mode.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) |
244
281
  | [Contributing](CONTRIBUTING.md) | [Roadmap](ROADMAP.md) · [Changelog](CHANGELOG.md) |
245
282
 
246
283
  The release install gate's tool canary loads the installed tarball's V2 plugin
@@ -84,6 +84,7 @@ 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(' npx pantheon-opencode decision-router status|select|enable|consent|caps|period')
87
88
  console.log(
88
89
  ' npx pantheon-opencode update [--stable] # Update package + re-run init (default: beta channel)',
89
90
  )
@@ -192,6 +193,22 @@ async function main() {
192
193
  process.exit(result.status ?? 1)
193
194
  }
194
195
 
196
+ if (command === 'decision-router') {
197
+ const { DecisionRouterUsageError, runDecisionRouterCommand } = await import(
198
+ '../scripts/decision-router.mjs'
199
+ )
200
+ try {
201
+ await runDecisionRouterCommand(args.slice(1))
202
+ } catch (error) {
203
+ // A malformed command line is user input, not a crash: print one line and
204
+ // skip the stack the top-level handler would otherwise dump.
205
+ if (!(error instanceof DecisionRouterUsageError)) throw error
206
+ console.error(`Error: ${error.message}`)
207
+ process.exit(1)
208
+ }
209
+ return
210
+ }
211
+
195
212
  // beta.5: one-command update — check npm dist-tag, install, re-init.
196
213
  // Default channel is `beta` (the prerelease line); `--stable` uses `latest`.
197
214
  if (command === 'update') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pantheon-opencode",
3
- "version": "1.6.2-beta.3",
3
+ "version": "1.6.2-beta.4",
4
4
  "description": "Multi-agent orchestration for OpenCode — 14 specialized agents, TDD, Themis review gates.",
5
5
  "type": "module",
6
6
  "workspaces": [
@@ -11,6 +11,7 @@
11
11
  "registry": "https://registry.npmjs.org/"
12
12
  },
13
13
  "exports": {
14
+ "./local-decision-router": "./src/pantheon/local-decision-router.ts",
14
15
  "./plugin": "./src/plugin.ts",
15
16
  "./plugin-v2": "./src/plugin-v2.ts",
16
17
  "./v2-bridge": "./src/pantheon/v2-bridge.ts"
@@ -20,6 +21,8 @@
20
21
  "prepare": "husky",
21
22
  "setup": "node scripts/setup.mjs",
22
23
  "build:agents-md": "node scripts/build-agents-md.mjs",
24
+ "build:decision-router": "node scripts/build-decision-router.mjs",
25
+ "check:decision-router": "node scripts/build-decision-router.mjs --check",
23
26
  "skills:lock": "node scripts/update-skills-lock.mjs",
24
27
  "setup:lite": "node bin/pantheon-init.mjs init --yes --clean --components agents,skills,instructions",
25
28
  "doctor": "node scripts/doctor.mjs",
@@ -27,7 +30,8 @@
27
30
  "init": "node bin/pantheon-init.mjs init --yes",
28
31
  "opencode": "OPENCODE_EXPERIMENTAL_BACKGROUND_SUBAGENTS=true opencode",
29
32
  "start": "OPENCODE_EXPERIMENTAL_BACKGROUND_SUBAGENTS=true opencode",
30
- "prepublishOnly": "node scripts/validate-routing.mjs",
33
+ "prepack": "npm run check:decision-router",
34
+ "prepublishOnly": "node scripts/validate-routing.mjs && npm run check:decision-router",
31
35
  "postpublish": "node -e \"console.log('✅ Published pantheon-opencode v' + require('./package.json').version + ' to npm')\"",
32
36
  "version:status": "node scripts/versioning.mjs status",
33
37
  "version:apply": "node scripts/versioning.mjs apply",
@@ -35,7 +39,7 @@
35
39
  "release:dry-run": "node scripts/versioning.mjs status && node scripts/release-notes.mjs && node scripts/package-evidence.mjs",
36
40
  "package:evidence": "node scripts/package-evidence.mjs",
37
41
  "engine:check": "node scripts/validate-node-engine-policy.mjs",
38
- "package:validate": "node scripts/validate-package.mjs && npm run engine:check",
42
+ "package:validate": "node scripts/validate-package.mjs && npm run check:decision-router && npm run engine:check",
39
43
  "lint": "biome ci .",
40
44
  "docs:lint": "node scripts/docs-link-check.mjs",
41
45
  "docs:media": "node scripts/docs-media.mjs",
@@ -87,6 +91,7 @@
87
91
  "src/instructions/*.instructions.md",
88
92
  "src/mcp/*.mjs",
89
93
  "scripts/*.mjs",
94
+ "!scripts/build-decision-router.mjs",
90
95
  "src/mcp/*.sh",
91
96
  "src/routing.yml",
92
97
  "src/pantheon/**",
@@ -116,6 +121,7 @@
116
121
  "@commitlint/cli": "21.2.3",
117
122
  "@commitlint/config-conventional": "21.2.3",
118
123
  "ajv": "8.20.0",
124
+ "esbuild": "0.28.2",
119
125
  "husky": "^9.1.7",
120
126
  "tsx": "4.23.15",
121
127
  "typescript": "7.0.2"
package/plugin.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pantheon",
3
3
  "publisher": "ils15",
4
- "version": "1.6.2-beta.3",
4
+ "version": "1.6.2-beta.4",
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.3"
7
+ version = "1.6.2-beta.4"
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