pantheon-opencode 1.6.2 → 1.6.3-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.global.md +1 -1
- package/AGENTS.md +1 -1
- package/CHANGELOG.md +69 -0
- package/README.md +14 -2
- package/bin/pantheon-init.mjs +1 -1
- package/package.json +1 -1
- package/plugin.json +1 -1
- package/pyproject.toml +1 -1
- package/scripts/decision-router-budget.mjs +4 -2
- package/scripts/decision-router-v2-egress.mjs +9 -2
- package/scripts/decision-router.mjs +58 -10
- package/scripts/install/decision-router-config.mjs +94 -8
- package/scripts/install/interactive.mjs +78 -10
- package/scripts/install/opencode.mjs +20 -0
- package/scripts/install/plugin.mjs +17 -0
- package/scripts/jev-live-probe.mjs +184 -0
- package/scripts/secret-scan.mjs +1 -1
- package/scripts/sync-tui.mjs +11 -0
- package/src/agents/zeus.md +24 -0
- package/src/pantheon/j-telemetry-file.ts +96 -0
- package/src/pantheon/jev-decision-tool.ts +240 -27
- package/src/pantheon/jev-decisions.ts +78 -14
- package/src/pantheon/jev-rank-verify.ts +435 -0
- package/src/pantheon/local-decision-budget.ts +11 -3
- package/src/pantheon/local-decision-provider-matrix.ts +3 -1
- package/src/pantheon/local-decision-usage-evidence.internal.ts +2 -2
- package/src/plugin-v2.ts +12 -2
- package/src/plugins/tui/dist/tui-v2.d.ts.map +1 -1
- package/src/plugins/tui/dist/tui-v2.js +457 -4
- package/src/plugins/tui/dist/tui-v2.js.map +1 -1
- package/src/plugins/tui/dist/tui.js +1 -1
- package/src/plugins/tui/package-lock.json +2 -2
- package/src/plugins/tui/package.json +1 -1
- package/src/plugins/tui/src/index-v2.tsx +6 -0
- package/src/plugins/tui/src/whats-new-highlights.ts +263 -0
- package/src/plugins/tui/src/whats-new-open.ts +80 -0
- package/src/plugins/tui/src/whats-new-state.ts +128 -0
- package/src/plugins/tui/src/whats-new.tsx +119 -0
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,75 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
|
10
10
|
<!-- Add new changes here. Running `node scripts/versioning.mjs apply` will
|
|
11
11
|
move this section to a versioned entry and reset the template below. -->
|
|
12
12
|
|
|
13
|
+
## [v1.6.3-beta.10] - 2026-11-04
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
|
|
17
|
+
- **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).
|
|
18
|
+
|
|
19
|
+
## [v1.6.3-beta.9] - 2026-11-04
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
|
|
23
|
+
- **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.
|
|
24
|
+
- **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).
|
|
25
|
+
|
|
26
|
+
## [v1.6.3-beta.7] - 2026-11-04
|
|
27
|
+
|
|
28
|
+
### Added
|
|
29
|
+
|
|
30
|
+
- **routing** — `jev-live-probe.mjs`: the operator-run live measurement tool. `--ping` is the calibration dry-run after `setup-model` (one call, exit 0 when reachable); `--scorecard` runs the live scenarios against the configured route and writes the dated scorecard into `bench/results/`. First live run: 7/8 correct specialist picks via OpenRouter.
|
|
31
|
+
|
|
32
|
+
## [v1.6.3-beta.8] - 2026-11-04
|
|
33
|
+
|
|
34
|
+
### Added
|
|
35
|
+
|
|
36
|
+
- **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.
|
|
37
|
+
- **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.
|
|
38
|
+
|
|
39
|
+
## [v1.6.3-beta.7] - 2026-11-04
|
|
40
|
+
|
|
41
|
+
### Added
|
|
42
|
+
|
|
43
|
+
- **install** — The setup wizard gains a **decision-layer step**: the shadow gates (`PANTHEON_J1_RISK_SCORE`, `PANTHEON_J3_ESCALATION`) and the specialist-caller allowlist (`athena,themis`) become first-class setup choices, written to `~/.config/pantheon/decision-flags.env` (source it from your shell profile). All advisory/shadow; none change behavior by default. Part of the ratified setup modernization.
|
|
44
|
+
|
|
45
|
+
## [v1.6.3-beta.5] - 2026-11-04
|
|
46
|
+
|
|
47
|
+
### Fixed
|
|
48
|
+
|
|
49
|
+
- **routing** — The ledger model-key slash fix (vendor ids like `typesafe/jev-1.13`) re-landed after being silently lost in a branch reset: the shipped beta.4 refused the OpenRouter model key with `invalid-model`. Field-verified end to end on the user's host: `advisory:true`, real Jev answer via OpenRouter at $0.00003/decision.
|
|
50
|
+
- **install** — The Jev wizard shows the full live route matrix with credential-state hints (checked hint when `OPENCODE_API_KEY`/`TYPESAFE_API_KEY`/`CLOUDFLARE_API_TOKEN` is in the shell; the exact export when not).
|
|
51
|
+
|
|
52
|
+
## [v1.6.3-beta.4] - 2026-11-04
|
|
53
|
+
|
|
54
|
+
### Added
|
|
55
|
+
|
|
56
|
+
- **routing** — `decision-router setup-model cloudflare-workers-jev/clef --account-id=<id>` provisions the Cloudflare Workers AI custom provider entry (accountId + `models.clef`, type `"decision"`); the token rides `CLOUDFLARE_API_TOKEN` in the host environment. Docs record the OpenAI Decisions protocol and the what's-new TUI window as deliberately unwired candidates.
|
|
57
|
+
|
|
58
|
+
## [v1.6.3-beta.3] - 2026-11-04
|
|
59
|
+
|
|
60
|
+
### Fixed
|
|
61
|
+
|
|
62
|
+
- **routing** — The OpenRouter-hosted Jev route settles end to end: the usage-evidence validator and the budget ledger now admit the `openrouter` accounting provider and vendor-slash model ids (`typesafe/jev-1.13`). Field-verified on the user's host: Zeus → `pantheon_jev_decide` (mode skills) → real Jev answer via the stored OpenRouter credential, $0.00003 per decision, usage reconciled.
|
|
63
|
+
|
|
64
|
+
## [v1.6.3-beta.2] - 2026-11-04
|
|
65
|
+
|
|
66
|
+
### Removed
|
|
67
|
+
|
|
68
|
+
- **routing** — The Console Jev **free variant** route (`opencode-console-jev-free` / `jev-1.13-free`) is removed from the matrix, the wizard, and the ledger: the free tier is rate-limited hard enough to 429 mid-work (field-measured), which is exactly the failure mode a decision route must not have. Existing configs selecting it degrade to skip with a fix hint pointing at the Zen-credited route (`OPENCODE_API_KEY`) or the TypeSafe direct route.
|
|
69
|
+
|
|
70
|
+
## [v1.6.3-beta.1] - 2026-11-04
|
|
71
|
+
|
|
72
|
+
### Added
|
|
73
|
+
|
|
74
|
+
- **routing** — The decision-provider matrix expands to the host-embedded decision modules confirmed in the 2.2.5 binary: `openrouter-jev` (OpenRouter-hosted `typesafe/jev-1.13`), `vercel-gateway-jev` (Vercel AI Gateway `typesafe-ai/jev`), and `cloudflare-workers-jev` (Workers AI `clef`; needs a custom entry with your accountId). Route resolution stays config-only; `doctor` gains route-aware rows per provider.
|
|
75
|
+
- **routing** — Specialist caller allowlist: `PANTHEON_JEV_SPECIALIST_CALLERS` (CSV, default empty = Zeus only) lets named agents call `pantheon_jev_decide` with explicit typed questions; preset modes stay orchestrator-owned. The permission assertion and the success output carry the real caller; caps and the `decision.egress` kill-switch are enforced per call regardless of caller.
|
|
76
|
+
- **routing** — `DECISION_CALL_FAILED` surfaces the provider reason class, integer status and retry window (rate limits now self-explain); `QUESTIONS_INVALID` carries a per-cause `detail` token (ten causes, one each); the tool description states the required-fields contract on its surface.
|
|
77
|
+
|
|
78
|
+
### Fixed
|
|
79
|
+
|
|
80
|
+
- **routing** — The TypeSafe provisioner writes a **complete** custom provider entry: the `@ai-sdk/openai-compatible` adapter, the `api.typesafe.ai/v1` baseURL, and an `apiKey` env reference (`{env:TYPESAFE_API_KEY}` — the key itself never lands in the config file). Field evidence: a models-only entry is inert because models.dev has no typesafe-ai entry, so `/connect` and `opencode auth login` cannot supply it and the decisions call 404s. `doctor` now warns when the entry lacks the apiKey; the activation path is `export TYPESAFE_API_KEY=...` + restart.
|
|
81
|
+
|
|
13
82
|
## [v1.6.2] - 2026-11-03
|
|
14
83
|
|
|
15
84
|
### Added
|
package/README.md
CHANGED
|
@@ -112,7 +112,11 @@ see [Quick Start](docs/QUICKSTART.md).
|
|
|
112
112
|
preset/source, git state, and a `Context` block (tokens, a percent gauge,
|
|
113
113
|
`$<spent> spent`, and a muted `cache <n>% · <n.n> tok/s` line); the native
|
|
114
114
|
prompt footer keeps its own line, and Pantheon only appends
|
|
115
|
-
`▸<preset> · ✦<n> ativos` while delegations are running.
|
|
115
|
+
`▸<preset> · ✦<n> ativos` while delegations are running. When the Pantheon
|
|
116
|
+
version changes since the last TUI start, a one-time dismissable
|
|
117
|
+
"What's new" dialog lists that version's highlights from the shipped
|
|
118
|
+
changelog — once per version, `esc`/`q` dismisses; see
|
|
119
|
+
[What's new window](docs/reference/whats-new.md). The installer
|
|
116
120
|
selects the `plugins` component by default; in interactive setup you can
|
|
117
121
|
change the component selection. A component-scoped install includes the TUI
|
|
118
122
|
only when `plugins` is selected. The TUI ships no quota panel: for provider
|
|
@@ -232,7 +236,15 @@ asks, after a delegation completes — one typed round-trip returns an advisory
|
|
|
232
236
|
quality score against named criteria plus a needs-review flag. The result
|
|
233
237
|
content never leaves the machine (shape metrics and criteria only, hostile
|
|
234
238
|
criteria rejected outright), and the verdict is advisory telemetry plus a
|
|
235
|
-
flag: it never blocks, retries, or alters the delegated result.
|
|
239
|
+
flag: it never blocks, retries, or alters the delegated result. Two more
|
|
240
|
+
orchestrator-owned tool modes round out the surface: `mode: "rank"` picks the
|
|
241
|
+
best of 2–8 named candidates for a state in one typed round-trip (it returns
|
|
242
|
+
the winner and that candidate's fit score — the host API answers one scalar
|
|
243
|
+
per question, so no full ordering is returned), and `mode: "verify"` checks
|
|
244
|
+
1–4 named claims with one predicate question per claim, mapping each answer to
|
|
245
|
+
`PASS` / `FAIL` / `BLOCK` where every refusal, timeout or malformed answer is
|
|
246
|
+
`BLOCK` (fail-closed); claims are bounded caller-provided strings, hostile
|
|
247
|
+
shapes rejected outright, and neither mode adds a telemetry point.
|
|
236
248
|
|
|
237
249
|
The installer may retain a legacy target-specific preference; it does not control
|
|
238
250
|
runtime routing. `npx pantheon-opencode decision-router ...` manages stored
|
package/bin/pantheon-init.mjs
CHANGED
|
@@ -1036,7 +1036,7 @@ async function main() {
|
|
|
1036
1036
|
const provisioned = provisionTypesafeProvider()
|
|
1037
1037
|
console.log(
|
|
1038
1038
|
provisioned === true
|
|
1039
|
-
? ' TypeSafe provider entry merged into opencode.json (
|
|
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
1040
|
: ` TypeSafe provider entry NOT merged (${provisioned}); merge it manually — see docs/reference/native-decisions.md.`,
|
|
1041
1041
|
)
|
|
1042
1042
|
}
|
package/package.json
CHANGED
package/plugin.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pantheon",
|
|
3
3
|
"publisher": "ils15",
|
|
4
|
-
"version": "1.6.
|
|
4
|
+
"version": "1.6.3-beta.10",
|
|
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.
|
|
7
|
+
version = "1.6.3-beta.10"
|
|
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
|
|
@@ -26,10 +26,12 @@ var LOCAL_DECISION_BUDGET_PROVIDERS = Object.freeze([
|
|
|
26
26
|
"openai-decisions",
|
|
27
27
|
"typesafe-jev",
|
|
28
28
|
"opencode-console",
|
|
29
|
-
"
|
|
29
|
+
"openrouter",
|
|
30
|
+
"vercel-ai-gateway",
|
|
31
|
+
"cloudflare-workers-ai"
|
|
30
32
|
]);
|
|
31
33
|
var ALLOWED_PROVIDERS = new Set(LOCAL_DECISION_BUDGET_PROVIDERS);
|
|
32
|
-
var MODEL_KEY = /^[A-Za-z0-9][A-Za-z0-9._
|
|
34
|
+
var MODEL_KEY = /^[A-Za-z0-9][A-Za-z0-9._:/-]{0,127}$/;
|
|
33
35
|
var RESERVATION_ID = /^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/;
|
|
34
36
|
var CLOCK_ROLLBACK_TOLERANCE_MS = 6e4;
|
|
35
37
|
function resolveLocalDecisionBudgetDbPath(env = process.env) {
|
|
@@ -14,13 +14,20 @@ var DECISION_ROUTER_MODELS = Object.freeze({
|
|
|
14
14
|
"openai-decisions": Object.freeze(["gpt-6-luna"]),
|
|
15
15
|
"typesafe-jev": Object.freeze(["jev-1.14.0"]),
|
|
16
16
|
"opencode-console-jev": Object.freeze(["jev-1.13"]),
|
|
17
|
-
|
|
17
|
+
// Host-embedded decision modules confirmed in the 2.2.5 binary; the model
|
|
18
|
+
// ids are the provider-side decision models (see
|
|
19
|
+
// docs/reference/native-decisions.md for credential acquisition).
|
|
20
|
+
"openrouter-jev": Object.freeze(["typesafe/jev-1.13"]),
|
|
21
|
+
"vercel-gateway-jev": Object.freeze(["typesafe-ai/jev"]),
|
|
22
|
+
"cloudflare-workers-jev": Object.freeze(["clef"])
|
|
18
23
|
});
|
|
19
24
|
var DECISION_PROVIDER_BUDGET_MAPPING = Object.freeze({
|
|
20
25
|
"openai-decisions": "openai-decisions",
|
|
21
26
|
"typesafe-jev": "typesafe-jev",
|
|
22
27
|
"opencode-console-jev": "opencode-console",
|
|
23
|
-
"
|
|
28
|
+
"openrouter-jev": "openrouter",
|
|
29
|
+
"vercel-gateway-jev": "vercel-ai-gateway",
|
|
30
|
+
"cloudflare-workers-jev": "cloudflare-workers-ai"
|
|
24
31
|
});
|
|
25
32
|
var REMOTELY_ELIGIBLE_DECISION_PROVIDERS = Object.freeze([
|
|
26
33
|
"openai-decisions",
|
|
@@ -32,6 +32,7 @@ import {
|
|
|
32
32
|
DECISION_ROUTER_MODELS,
|
|
33
33
|
diffDecisionRouterSurfaces,
|
|
34
34
|
inspectTypesafeHostProvider,
|
|
35
|
+
provisionCloudflareHostProvider,
|
|
35
36
|
provisionTypesafeHostProvider,
|
|
36
37
|
readUserDecisionRouterConfig,
|
|
37
38
|
resolveUserDecisionRouterConfigPath,
|
|
@@ -314,7 +315,9 @@ export async function runDecisionRouterCommand(
|
|
|
314
315
|
)
|
|
315
316
|
}
|
|
316
317
|
const noConsent = flagArgs.includes('--no-consent')
|
|
317
|
-
const capArgs = flagArgs.filter(
|
|
318
|
+
const capArgs = flagArgs.filter(
|
|
319
|
+
(arg) => arg !== '--no-consent' && !arg.startsWith('--account-id='),
|
|
320
|
+
)
|
|
318
321
|
// Exactly the two caps flags with values; parseCaps validates them and
|
|
319
322
|
// leaves `rest` empty because setup-model has no positional caps targets.
|
|
320
323
|
if (capArgs.length !== 4) throw new DecisionRouterUsageError(USAGE)
|
|
@@ -337,6 +340,28 @@ export async function runDecisionRouterCommand(
|
|
|
337
340
|
noConsent ? 'Egress consent NOT recorded (--no-consent).' : 'Egress consent recorded: yes.',
|
|
338
341
|
)
|
|
339
342
|
|
|
343
|
+
// The Cloudflare route needs a custom entry with the accountId (the
|
|
344
|
+
// host's embedded cloudflare-workers-ai module reads the token from
|
|
345
|
+
// CLOUDFLARE_API_TOKEN and the account from the entry options).
|
|
346
|
+
if (provider === 'cloudflare-workers-jev') {
|
|
347
|
+
const accountId = flagArgs.find((arg) => arg.startsWith('--account-id='))
|
|
348
|
+
const provision = provisionCloudflareHostProvider({
|
|
349
|
+
accountId: accountId?.split('=')[1],
|
|
350
|
+
env,
|
|
351
|
+
})
|
|
352
|
+
if (provision.ok) {
|
|
353
|
+
stdout(
|
|
354
|
+
`Cloudflare provider entry merged into ${provision.path} (accountId + models.clef, type "decision"). ` +
|
|
355
|
+
'The token comes from CLOUDFLARE_API_TOKEN (Workers AI-scoped token) in the host environment.',
|
|
356
|
+
)
|
|
357
|
+
} else {
|
|
358
|
+
stdout(
|
|
359
|
+
`⚠ Cloudflare provider entry NOT merged: ${provision.reason}` +
|
|
360
|
+
' — pass --account-id=<32-hex Cloudflare account id>.',
|
|
361
|
+
)
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
|
|
340
365
|
// The TypeSafe route needs a host-side provider entry the decisions API
|
|
341
366
|
// can resolve; the Console routes are host-native and need none. The
|
|
342
367
|
// merge is additive and idempotent; a failure is a printed warning (the
|
|
@@ -346,8 +371,8 @@ export async function runDecisionRouterCommand(
|
|
|
346
371
|
const provision = provisionTypesafeHostProvider({ env })
|
|
347
372
|
if (provision.ok) {
|
|
348
373
|
stdout(
|
|
349
|
-
`TypeSafe provider entry merged into ${provision.path} (
|
|
350
|
-
'
|
|
374
|
+
`TypeSafe provider entry merged into ${provision.path} (adapter + baseURL + apiKey via {env:TYPESAFE_API_KEY}, type "decision"). ` +
|
|
375
|
+
'Activate: export TYPESAFE_API_KEY=<your TypeSafe key> and restart OpenCode. /connect does not carry custom providers.',
|
|
351
376
|
)
|
|
352
377
|
} else {
|
|
353
378
|
stdout(`⚠ TypeSafe provider entry NOT merged: ${provision.reason}`)
|
|
@@ -489,18 +514,41 @@ export async function runDecisionRouterCommand(
|
|
|
489
514
|
// Route-aware checks, not a catalog probe: decision models are not chat
|
|
490
515
|
// models and never appear in `opencode models` (field evidence 2.2.5:
|
|
491
516
|
// 561 entries, 0 jev, while the decisions API answers the same ref).
|
|
492
|
-
if (target.provider === '
|
|
517
|
+
if (target.provider === 'openrouter-jev' || target.provider === 'vercel-gateway-jev') {
|
|
518
|
+
const envName =
|
|
519
|
+
target.provider === 'openrouter-jev' ? 'OPENROUTER_API_KEY' : 'AI_GATEWAY_API_KEY'
|
|
520
|
+
pass(
|
|
521
|
+
'native-route',
|
|
522
|
+
`host-native ${target.provider === 'openrouter-jev' ? 'openrouter' : 'vercel-ai-gateway'} route; credential ${envName} via /connect or the environment`,
|
|
523
|
+
)
|
|
524
|
+
} else if (target.provider === 'cloudflare-workers-jev') {
|
|
525
|
+
warn(
|
|
526
|
+
'native-route',
|
|
527
|
+
'host module exists but the provider needs a custom entry with your Cloudflare accountId (models.dev does not carry it)',
|
|
528
|
+
'add providers["cloudflare-workers-ai"] with accountId + CLOUDFLARE_API_TOKEN (scoped Workers AI token); model clef',
|
|
529
|
+
)
|
|
530
|
+
} else if (target.provider === 'typesafe-jev') {
|
|
493
531
|
const hostProvider = inspectTypesafeHostProvider({ env })
|
|
494
|
-
if (hostProvider.present) {
|
|
495
|
-
|
|
532
|
+
if (!hostProvider.present) {
|
|
533
|
+
fail(
|
|
496
534
|
'native-route',
|
|
497
|
-
`typesafe-ai
|
|
535
|
+
`opencode.json has no providers.typesafe-ai entry (${hostProvider.path})`,
|
|
536
|
+
'decision-router setup-model typesafe-jev/jev-1.14.0 merges the full provider entry (adapter, baseURL, apiKey ref)',
|
|
537
|
+
)
|
|
538
|
+
} else if (!hostProvider.hasCredential) {
|
|
539
|
+
warn(
|
|
540
|
+
'native-route',
|
|
541
|
+
'provider entry has no apiKey',
|
|
542
|
+
'set the TypeSafe key: export TYPESAFE_API_KEY=... and re-run setup-model (writes {env:TYPESAFE_API_KEY}), or add options.apiKey to the entry',
|
|
498
543
|
)
|
|
499
544
|
} else {
|
|
500
|
-
|
|
545
|
+
pass(
|
|
501
546
|
'native-route',
|
|
502
|
-
`
|
|
503
|
-
|
|
547
|
+
`typesafe-ai provider entry present (${hostProvider.path}); credential ${
|
|
548
|
+
hostProvider.viaEnvRef
|
|
549
|
+
? `via env reference (${hostProvider.apiKeyRef}) — resolved by the host at call time`
|
|
550
|
+
: 'inline in the entry'
|
|
551
|
+
}`,
|
|
504
552
|
)
|
|
505
553
|
}
|
|
506
554
|
} else {
|
|
@@ -29,7 +29,12 @@ export const DECISION_ROUTER_MODELS = Object.freeze({
|
|
|
29
29
|
'openai-decisions': Object.freeze(['gpt-6-luna']),
|
|
30
30
|
'typesafe-jev': Object.freeze(['jev-1.14.0']),
|
|
31
31
|
'opencode-console-jev': Object.freeze(['jev-1.13']),
|
|
32
|
-
|
|
32
|
+
// Host-embedded decision modules confirmed in the 2.2.5 binary; the model
|
|
33
|
+
// ids are the provider-side decision models (see
|
|
34
|
+
// docs/reference/native-decisions.md for credential acquisition).
|
|
35
|
+
'openrouter-jev': Object.freeze(['typesafe/jev-1.13']),
|
|
36
|
+
'vercel-gateway-jev': Object.freeze(['typesafe-ai/jev']),
|
|
37
|
+
'cloudflare-workers-jev': Object.freeze(['clef']),
|
|
33
38
|
})
|
|
34
39
|
|
|
35
40
|
/** Single mapping from a user-level provider ID to the local budget provider. */
|
|
@@ -37,7 +42,9 @@ export const DECISION_PROVIDER_BUDGET_MAPPING = Object.freeze({
|
|
|
37
42
|
'openai-decisions': 'openai-decisions',
|
|
38
43
|
'typesafe-jev': 'typesafe-jev',
|
|
39
44
|
'opencode-console-jev': 'opencode-console',
|
|
40
|
-
'
|
|
45
|
+
'openrouter-jev': 'openrouter',
|
|
46
|
+
'vercel-gateway-jev': 'vercel-ai-gateway',
|
|
47
|
+
'cloudflare-workers-jev': 'cloudflare-workers-ai',
|
|
41
48
|
})
|
|
42
49
|
|
|
43
50
|
/** Providers whose usage and price are documented well enough to reconcile. */
|
|
@@ -591,9 +598,22 @@ export function provisionTypesafeHostProvider({ env = process.env } = {}) {
|
|
|
591
598
|
}
|
|
592
599
|
data.providers ??= {}
|
|
593
600
|
data.providers['typesafe-ai'] ??= {}
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
601
|
+
// A complete custom provider entry: without the npm adapter and the
|
|
602
|
+
// transport options (baseURL + apiKey) the host cannot resolve the
|
|
603
|
+
// provider at all (field evidence: a models-only entry 404s on the
|
|
604
|
+
// decisions API; models.dev does not carry typesafe-ai, so /connect and
|
|
605
|
+
// `opencode auth login` cannot supply it either). The credential rides
|
|
606
|
+
// the `{env:...}` reference — the key itself stays out of the config
|
|
607
|
+
// file; an entry the user already completed is preserved as-is.
|
|
608
|
+
const entry = data.providers['typesafe-ai']
|
|
609
|
+
entry.npm ??= '@ai-sdk/openai-compatible'
|
|
610
|
+
entry.name ??= 'TypeSafe AI'
|
|
611
|
+
entry.options ??= {}
|
|
612
|
+
entry.options.baseURL ??= 'https://api.typesafe.ai/v1'
|
|
613
|
+
entry.options.apiKey ??= '{env:TYPESAFE_API_KEY}'
|
|
614
|
+
entry.models ??= {}
|
|
615
|
+
if (entry.models['jev-1.14.0'] === undefined) {
|
|
616
|
+
entry.models['jev-1.14.0'] = {
|
|
597
617
|
name: 'Jev (TypeSafe direct)',
|
|
598
618
|
modelID: 'jev-latest',
|
|
599
619
|
type: 'decision',
|
|
@@ -607,6 +627,51 @@ export function provisionTypesafeHostProvider({ env = process.env } = {}) {
|
|
|
607
627
|
}
|
|
608
628
|
}
|
|
609
629
|
|
|
630
|
+
/**
|
|
631
|
+
* Additively merge the Cloudflare Workers AI decision provider entry into the
|
|
632
|
+
* user's host `opencode.json`. The host's embedded `cloudflare-workers-ai`
|
|
633
|
+
* decisions module needs the accountId in the entry options and reads the
|
|
634
|
+
* token from `CLOUDFLARE_API_TOKEN` (a Workers AI-scoped token — not the
|
|
635
|
+
* global Cloudflare key). Existing entries are preserved.
|
|
636
|
+
* @param {{ accountId: string, env?: Record<string, string | undefined> }} options
|
|
637
|
+
* @returns {{ ok: true, path: string } | { ok: false, reason: string }}
|
|
638
|
+
*/
|
|
639
|
+
export function provisionCloudflareHostProvider({ accountId, env = process.env } = {}) {
|
|
640
|
+
const trimmed = String(accountId ?? '').trim()
|
|
641
|
+
if (!/^[a-f0-9]{32}$/i.test(trimmed)) {
|
|
642
|
+
return { ok: false, reason: 'accountId must be the 32-hex Cloudflare account id' }
|
|
643
|
+
}
|
|
644
|
+
const configPath = resolveHostOpenCodeConfigPath(env)
|
|
645
|
+
if (!existsSync(configPath)) return { ok: false, reason: 'opencode.json not found' }
|
|
646
|
+
let data
|
|
647
|
+
try {
|
|
648
|
+
const parsed = JSON.parse(readFileSync(configPath, 'utf8'))
|
|
649
|
+
if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed)) {
|
|
650
|
+
return { ok: false, reason: 'opencode.json is not a JSON object' }
|
|
651
|
+
}
|
|
652
|
+
data = parsed
|
|
653
|
+
} catch {
|
|
654
|
+
return { ok: false, reason: 'opencode.json is not plain JSON (comments?)' }
|
|
655
|
+
}
|
|
656
|
+
data.providers ??= {}
|
|
657
|
+
data.providers['cloudflare-workers-ai'] ??= {}
|
|
658
|
+
data.providers['cloudflare-workers-ai'].options ??= {}
|
|
659
|
+
data.providers['cloudflare-workers-ai'].options.accountId ??= trimmed
|
|
660
|
+
data.providers['cloudflare-workers-ai'].models ??= {}
|
|
661
|
+
if (data.providers['cloudflare-workers-ai'].models['clef'] === undefined) {
|
|
662
|
+
data.providers['cloudflare-workers-ai'].models['clef'] = {
|
|
663
|
+
name: 'Clef (Cloudflare Workers AI)',
|
|
664
|
+
type: 'decision',
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
try {
|
|
668
|
+
writeFileSync(configPath, `${JSON.stringify(data, null, 2)}\n`)
|
|
669
|
+
return { ok: true, path: configPath }
|
|
670
|
+
} catch (error) {
|
|
671
|
+
return { ok: false, reason: String(error instanceof Error ? error.message : error) }
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
|
|
610
675
|
/**
|
|
611
676
|
* Read-only check that the TypeSafe provider entry exists in the host config.
|
|
612
677
|
* Never writes; an unreadable config reports present:false with the path for
|
|
@@ -618,9 +683,30 @@ export function inspectTypesafeHostProvider({ env = process.env } = {}) {
|
|
|
618
683
|
const configPath = resolveHostOpenCodeConfigPath(env)
|
|
619
684
|
try {
|
|
620
685
|
const parsed = JSON.parse(readFileSync(configPath, 'utf8'))
|
|
621
|
-
const
|
|
622
|
-
|
|
686
|
+
const entry = parsed?.providers?.['typesafe-ai']
|
|
687
|
+
const model = entry?.models?.['jev-1.14.0']
|
|
688
|
+
const present = model !== undefined && model !== null
|
|
689
|
+
const apiKey = entry?.options?.apiKey
|
|
690
|
+
// Credential states: inline key, `{env:...}` reference, or missing. The
|
|
691
|
+
// referenced env var is resolved by the HOST at call time — the doctor
|
|
692
|
+
// cannot see the host's environment, so a reference counts as present
|
|
693
|
+
// with a note instead of a verdict.
|
|
694
|
+
const hasCredential = typeof apiKey === 'string' && apiKey.length > 0
|
|
695
|
+
const viaEnvRef = hasCredential && apiKey.startsWith('{env:')
|
|
696
|
+
return {
|
|
697
|
+
present,
|
|
698
|
+
hasCredential,
|
|
699
|
+
viaEnvRef,
|
|
700
|
+
apiKeyRef: hasCredential ? apiKey : null,
|
|
701
|
+
path: configPath,
|
|
702
|
+
}
|
|
623
703
|
} catch {
|
|
624
|
-
return {
|
|
704
|
+
return {
|
|
705
|
+
present: false,
|
|
706
|
+
hasCredential: false,
|
|
707
|
+
viaEnvRef: false,
|
|
708
|
+
apiKeyRef: null,
|
|
709
|
+
path: configPath,
|
|
710
|
+
}
|
|
625
711
|
}
|
|
626
712
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
+
import { mkdirSync, writeFileSync } from 'node:fs'
|
|
4
|
+
import { join } from 'node:path'
|
|
3
5
|
import * as clack from '@clack/prompts'
|
|
4
6
|
import {
|
|
5
7
|
createDecisionRouterConfig,
|
|
@@ -146,17 +148,22 @@ export async function runInteractiveInstall({
|
|
|
146
148
|
{
|
|
147
149
|
label: 'OpenCode Console Jev (stock)',
|
|
148
150
|
value: 'opencode-console-jev/jev-1.13',
|
|
149
|
-
hint:
|
|
151
|
+
hint: consoleJevHint(process.env),
|
|
150
152
|
},
|
|
151
153
|
{
|
|
152
|
-
label: '
|
|
153
|
-
value: '
|
|
154
|
-
hint:
|
|
154
|
+
label: 'OpenRouter-hosted Jev',
|
|
155
|
+
value: 'openrouter-jev/typesafe/jev-1.13',
|
|
156
|
+
hint: openrouterJevHint(),
|
|
155
157
|
},
|
|
156
158
|
{
|
|
157
159
|
label: 'TypeSafe Jev (direct)',
|
|
158
160
|
value: 'typesafe-jev/jev-1.14.0',
|
|
159
|
-
hint:
|
|
161
|
+
hint: typesafeJevHint(process.env),
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
label: 'Cloudflare Clef',
|
|
165
|
+
value: 'cloudflare-workers-jev/clef',
|
|
166
|
+
hint: cloudflareJevHint(process.env),
|
|
160
167
|
},
|
|
161
168
|
],
|
|
162
169
|
initialValue: 'skip',
|
|
@@ -164,13 +171,51 @@ export async function runInteractiveInstall({
|
|
|
164
171
|
if (cancelPrompt(prompts, jevActivation, 'decisionRouter')) {
|
|
165
172
|
return { canceled: true, cancelPoint: 'decisionRouter' }
|
|
166
173
|
}
|
|
174
|
+
|
|
175
|
+
// Decision-layer options: the shadow gates and the specialist-caller
|
|
176
|
+
// allowlist are first-class setup choices. The installer writes a flags
|
|
177
|
+
// file the user sources (the host reads these at plugin registration from
|
|
178
|
+
// its own environment — the installer never edits shell profiles silently).
|
|
179
|
+
const jevFlags = await prompts.multiselect({
|
|
180
|
+
message: 'Decision layer extras (all advisory/shadow; none change behavior by default):',
|
|
181
|
+
options: [
|
|
182
|
+
{
|
|
183
|
+
label: 'J1 risk-score shadow gate',
|
|
184
|
+
value: 'PANTHEON_J1_RISK_SCORE=on',
|
|
185
|
+
hint: 'Records a Jev risk-score per exfil-capable tool call; observe-only',
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
label: 'J3 escalation shadow classifier',
|
|
189
|
+
value: 'PANTHEON_J3_ESCALATION=on',
|
|
190
|
+
hint: 'Records cheap-vs-main per delegate dispatch; never applies overrides in shadow',
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
label: 'Specialist callers: athena + themis (explicit questions)',
|
|
194
|
+
value: 'CALLERS=athena,themis',
|
|
195
|
+
hint: 'Allowlisted specialists may ask bounded Jev questions mid-task; presets stay Zeus-only',
|
|
196
|
+
},
|
|
197
|
+
],
|
|
198
|
+
required: false,
|
|
199
|
+
initialValues: [],
|
|
200
|
+
})
|
|
201
|
+
if (cancelPrompt(prompts, jevFlags, 'decisionFlags')) {
|
|
202
|
+
return { canceled: true, cancelPoint: 'decisionFlags' }
|
|
203
|
+
}
|
|
204
|
+
if (Array.isArray(jevFlags) && jevFlags.length > 0) {
|
|
205
|
+
const flagsDir = join(process.env.XDG_CONFIG_HOME || `${process.env.HOME}/.config`, 'pantheon')
|
|
206
|
+
mkdirSync(flagsDir, { recursive: true, mode: 0o700 })
|
|
207
|
+
const flagsPath = join(flagsDir, 'decision-flags.env')
|
|
208
|
+
const lines = jevFlags.map((flag) => `export ${flag}`).join('\n')
|
|
209
|
+
writeFileSync(
|
|
210
|
+
flagsPath,
|
|
211
|
+
`# Pantheon decision layer — source from your shell profile
|
|
212
|
+
${lines}
|
|
213
|
+
`,
|
|
214
|
+
)
|
|
215
|
+
}
|
|
167
216
|
// Only known targets activate; anything else (a stale stub, a renamed
|
|
168
217
|
// option) degrades to skip instead of configuring a wrong route.
|
|
169
|
-
const KNOWN_JEV_TARGETS = new Set([
|
|
170
|
-
'opencode-console-jev/jev-1.13',
|
|
171
|
-
'opencode-console-jev-free/jev-1.13-free',
|
|
172
|
-
'typesafe-jev/jev-1.14.0',
|
|
173
|
-
])
|
|
218
|
+
const KNOWN_JEV_TARGETS = new Set(['opencode-console-jev/jev-1.13', 'typesafe-jev/jev-1.14.0'])
|
|
174
219
|
const activationChoice =
|
|
175
220
|
typeof jevActivation === 'string' && KNOWN_JEV_TARGETS.has(jevActivation)
|
|
176
221
|
? jevActivation
|
|
@@ -209,3 +254,26 @@ export async function runInteractiveInstall({
|
|
|
209
254
|
decisionModelActivation,
|
|
210
255
|
}
|
|
211
256
|
}
|
|
257
|
+
|
|
258
|
+
/** Credential-state hints for the Jev wizard routes (set at prompt time). */
|
|
259
|
+
function consoleJevHint(env = process.env) {
|
|
260
|
+
return env.OPENCODE_API_KEY
|
|
261
|
+
? 'Zen credits via OPENCODE_API_KEY — ✓ detected in this shell'
|
|
262
|
+
: 'Zen credits via OPENCODE_API_KEY — export it first (opencode.ai/console)'
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
function openrouterJevHint() {
|
|
266
|
+
return 'Uses the host OpenRouter credential (opencode auth list); billed per decision'
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
function typesafeJevHint(env = process.env) {
|
|
270
|
+
return env.TYPESAFE_API_KEY
|
|
271
|
+
? '✓ TYPESAFE_API_KEY detected — the installer merges the provider entry'
|
|
272
|
+
: 'export TYPESAFE_API_KEY first; the installer merges the provider entry'
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
function cloudflareJevHint(env = process.env) {
|
|
276
|
+
return env.CLOUDFLARE_API_TOKEN
|
|
277
|
+
? '✓ CLOUDFLARE_API_TOKEN detected — pass --account-id at setup-model'
|
|
278
|
+
: 'Workers AI-scoped CLOUDFLARE_API_TOKEN + accountId; setup-model merges the entry'
|
|
279
|
+
}
|
|
@@ -2789,6 +2789,26 @@ async function installPass(
|
|
|
2789
2789
|
// .ts path is not a registrable entry on this host and must not be moved.
|
|
2790
2790
|
config.plugin = removePantheonPluginReferences(config.plugin)
|
|
2791
2791
|
if (!Array.isArray(config.plugins)) config.plugins = []
|
|
2792
|
+
// Preflight: a Pantheon-owned registration whose target directory is
|
|
2793
|
+
// missing means the previous install was invalidated (the npx cache
|
|
2794
|
+
// recycles `_npx/<hash>` dirs — field evidence: a registered copy
|
|
2795
|
+
// vanished and the host silently dropped the plugin, so the whole tool
|
|
2796
|
+
// surface disappeared until the next init). Name the cause loudly
|
|
2797
|
+
// before the re-registration below fixes it.
|
|
2798
|
+
for (const ref of Array.isArray(config.plugins) ? config.plugins : []) {
|
|
2799
|
+
const refPath = typeof ref === 'string' ? ref : ref?.package
|
|
2800
|
+
if (typeof refPath !== 'string' || managedPluginIdentity(refPath) === null) continue
|
|
2801
|
+
const absolute = isAbsolute(refPath) ? refPath : resolve(target, refPath)
|
|
2802
|
+
if (existsSync(absolute)) continue
|
|
2803
|
+
const staleNpx = refPath.includes('_npx/')
|
|
2804
|
+
warning(
|
|
2805
|
+
`Existing Pantheon registration points to ${refPath}, which no longer exists` +
|
|
2806
|
+
(staleNpx
|
|
2807
|
+
? ' (the npx cache recycled that copy) — re-registering to the freshly installed tree'
|
|
2808
|
+
: ' — re-registering to the freshly installed tree'),
|
|
2809
|
+
)
|
|
2810
|
+
}
|
|
2811
|
+
|
|
2792
2812
|
const migrated = []
|
|
2793
2813
|
const blocked = []
|
|
2794
2814
|
for (const plugin of config.plugin) {
|
|
@@ -215,6 +215,23 @@ export function copyPluginFiles(
|
|
|
215
215
|
else result.skipped++
|
|
216
216
|
}
|
|
217
217
|
|
|
218
|
+
// CHANGELOG.md — the copy's one-time "What's new" window reads the release
|
|
219
|
+
// highlights for the running version from its own installed root. Best
|
|
220
|
+
// effort: a missing source simply means no window (the TUI fails open).
|
|
221
|
+
// src/plugins/tui → src/plugins → src → the package root, which ships
|
|
222
|
+
// CHANGELOG.md in its npm `files` allow-list.
|
|
223
|
+
const changelogSrc = join(srcDir, '..', '..', '..', 'CHANGELOG.md')
|
|
224
|
+
if (existsSync(changelogSrc)) {
|
|
225
|
+
const changelogStatus = writeIfChanged(
|
|
226
|
+
join(dstDir, 'CHANGELOG.md'),
|
|
227
|
+
readFileSync(changelogSrc, 'utf8'),
|
|
228
|
+
dryRun,
|
|
229
|
+
{ recorder },
|
|
230
|
+
)
|
|
231
|
+
if (changelogStatus === 'created') result.created++
|
|
232
|
+
else result.skipped++
|
|
233
|
+
}
|
|
234
|
+
|
|
218
235
|
return result
|
|
219
236
|
}
|
|
220
237
|
|