pantheon-opencode 1.6.2-beta.16 → 1.6.2-beta.17
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 +8 -0
- package/README.md +15 -1
- package/package.json +1 -1
- package/plugin.json +1 -1
- package/pyproject.toml +1 -1
- package/src/pantheon/jev-decision-tool.ts +179 -21
- package/src/pantheon/jev-escalation.ts +639 -0
- package/src/pantheon/jev-quality-score.ts +432 -0
- package/src/pantheon/v2-decision-telemetry.ts +5 -4
- package/src/plugin-v2.ts +90 -0
- package/src/plugins/tui/dist/tui-v2.js +2 -2
- 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/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,14 @@ 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.17] - 2026-11-03
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
|
|
17
|
+
- **routing** — J2 skill-selection scorecard harness: an offline, rerunnable, dated scorecard (29 synthetic scenarios including adversarial injection and refusal shapes, every Jev reply faked — zero network) measuring the P2 prefilter and the skills preset against expected picks, with honest negatives recorded in `bench/results/`. Activation gate: two consecutive scorecards, separately reviewed.
|
|
18
|
+
- **hooks** — J3 turn-complexity escalation policy (shadow): when `PANTHEON_J3_ESCALATION` is on, delegate dispatches get one Jev complexity classification resolved cheap-vs-main through a pure policy with independent local rails (risk-word states never downgrade, user-pinned models always win, oversize context never downgrades, uncertainty resolves to main). Structurally shadow-only — the wiring cannot reach the override mechanism (contract-test enforced); the mechanism itself is proven by direct tests for the separately reviewed activation. Default off.
|
|
19
|
+
- **routing** — J4 output quality scoring: a new `mode: "review"` on `pantheon_jev_decide` scores a delegated result against caller-named criteria (one round-trip: quality score + needs-human-review predicate). The request carries no result content — only delegate id, result kind, shape metrics, and bounded criteria. Advisory flag only; nothing blocks. On demand (Zeus-only, same consent/caps/permission chain).
|
|
20
|
+
|
|
13
21
|
## [v1.6.2-beta.16] - 2026-11-03
|
|
14
22
|
|
|
15
23
|
### Added
|
package/README.md
CHANGED
|
@@ -218,7 +218,21 @@ native decision per write/execute tool call behind `PANTHEON_J1_RISK_SCORE`
|
|
|
218
218
|
(off by default, zero overhead when off): the request carries no user content
|
|
219
219
|
(tool name token, scope class, input sha256 only), every failure mode skips
|
|
220
220
|
silently with a reason token, and the shadow record is the whole effect — it
|
|
221
|
-
never blocks, asks, or narrows a permission.
|
|
221
|
+
never blocks, asks, or narrows a permission. A third opt-in consumer, the J3
|
|
222
|
+
turn-complexity escalation, runs in shadow behind `PANTHEON_J3_ESCALATION`
|
|
223
|
+
(off by default): it classifies each delegate dispatch with one bounded score
|
|
224
|
+
question (Brief sha256, length and a risk-word flag only — the Brief text
|
|
225
|
+
never leaves the machine), local rails (risk words, user-pinned models, large
|
|
226
|
+
context) and every unsure answer always favor the main model, and the recorded
|
|
227
|
+
verdict never changes the dispatched model — the per-agent override mechanism
|
|
228
|
+
is proved by test and reserved for a separately reviewed activation with its
|
|
229
|
+
own measured baseline. A fourth consumer needs no flag at all: the tool's
|
|
230
|
+
`mode: "review"` (J4 output-quality scoring) runs only when Zeus explicitly
|
|
231
|
+
asks, after a delegation completes — one typed round-trip returns an advisory
|
|
232
|
+
quality score against named criteria plus a needs-review flag. The result
|
|
233
|
+
content never leaves the machine (shape metrics and criteria only, hostile
|
|
234
|
+
criteria rejected outright), and the verdict is advisory telemetry plus a
|
|
235
|
+
flag: it never blocks, retries, or alters the delegated result.
|
|
222
236
|
|
|
223
237
|
The installer may retain a legacy target-specific preference; it does not control
|
|
224
238
|
runtime routing. `npx pantheon-opencode decision-router ...` manages stored
|
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.2-beta.
|
|
4
|
+
"version": "1.6.2-beta.17",
|
|
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.17"
|
|
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
|
|
@@ -34,6 +34,15 @@ import {
|
|
|
34
34
|
prepareJevPresetRequest,
|
|
35
35
|
resolveNativeJevRoute,
|
|
36
36
|
} from './jev-decisions.ts'
|
|
37
|
+
import {
|
|
38
|
+
buildJevReviewRequest,
|
|
39
|
+
encodeQualityScoreReason,
|
|
40
|
+
evaluateQualityScoreDecision,
|
|
41
|
+
J4_QUALITY_SCORE_POINT,
|
|
42
|
+
type QualityScoreEvaluation,
|
|
43
|
+
qualityVerdict,
|
|
44
|
+
} from './jev-quality-score.ts'
|
|
45
|
+
import { mapGateFailureToSkipReason } from './jev-risk-gate.ts'
|
|
37
46
|
import {
|
|
38
47
|
openLocalDecisionBudgetLedger,
|
|
39
48
|
type ReservationResult,
|
|
@@ -44,6 +53,7 @@ import {
|
|
|
44
53
|
buildDecisionEgressRequest,
|
|
45
54
|
} from './local-decision-egress-gate.ts'
|
|
46
55
|
import { verifyNativeUsageForReservation } from './local-decision-usage-evidence.internal.ts'
|
|
56
|
+
import { observeShadow, type ShadowSink } from './v2-decision-shadow.ts'
|
|
47
57
|
import type { NativeDecisionRequest, ResolvedNativeDecisionRoute } from './v2-native-decisions.ts'
|
|
48
58
|
import type { V2ToolDef } from './v2-tools.ts'
|
|
49
59
|
|
|
@@ -64,6 +74,13 @@ export interface V2JevDecisionRuntime {
|
|
|
64
74
|
readonly listSkills?: () => Promise<unknown>
|
|
65
75
|
/** Host permission kill-switch (`ctx.permission.assert`), when present. */
|
|
66
76
|
readonly permissionAssert?: (input: Record<string, unknown>) => Promise<unknown>
|
|
77
|
+
/**
|
|
78
|
+
* Shadow-record sink for the J4 output-quality review telemetry
|
|
79
|
+
* (`jev-quality-score.ts`); optional. The plugin wires the in-memory,
|
|
80
|
+
* bounded telemetry collector here; absent sink → no J4 records, nothing
|
|
81
|
+
* else changes.
|
|
82
|
+
*/
|
|
83
|
+
readonly shadowSink?: ShadowSink
|
|
67
84
|
}
|
|
68
85
|
|
|
69
86
|
/** Logical permission resource: no endpoint URL exists on the native route. */
|
|
@@ -73,6 +90,8 @@ export function nativeJevPermissionResource(providerID: string, id: string): str
|
|
|
73
90
|
|
|
74
91
|
export type JevDecisionRunFailure =
|
|
75
92
|
| 'CALLER_NOT_ZEUS'
|
|
93
|
+
| 'REVIEW_INPUT_INVALID'
|
|
94
|
+
| 'CRITERIA_INVALID'
|
|
76
95
|
| 'CONTEXT_UNAVAILABLE'
|
|
77
96
|
| 'CONFIG_UNAVAILABLE'
|
|
78
97
|
| 'DISABLED'
|
|
@@ -102,15 +121,28 @@ function isNonBlankString(value: unknown): value is string {
|
|
|
102
121
|
return typeof value === 'string' && value.trim().length > 0
|
|
103
122
|
}
|
|
104
123
|
|
|
124
|
+
/** Map a review-mode refusal to its telemetry skip token. */
|
|
125
|
+
function reviewRefusalSkipReason(reasonCode: JevDecisionRunFailure): string {
|
|
126
|
+
if (reasonCode === 'REVIEW_INPUT_INVALID') return 'skip-review-input-invalid'
|
|
127
|
+
if (reasonCode === 'CRITERIA_INVALID') return 'skip-criteria-invalid'
|
|
128
|
+
return mapGateFailureToSkipReason(reasonCode)
|
|
129
|
+
}
|
|
130
|
+
|
|
105
131
|
// ─── Shared gate chain ───────────────────────────────────────────────────
|
|
106
132
|
|
|
107
133
|
/**
|
|
108
134
|
* Every gate-chain failure the shared runner can produce. It is
|
|
109
|
-
* {@link JevDecisionRunFailure} minus
|
|
110
|
-
*
|
|
111
|
-
*
|
|
135
|
+
* {@link JevDecisionRunFailure} minus the tool-surface properties:
|
|
136
|
+
* `CALLER_NOT_ZEUS` (the caller check) and the review mode's input
|
|
137
|
+
* validation (`REVIEW_INPUT_INVALID` / `CRITERIA_INVALID`) — all three are
|
|
138
|
+
* properties of the explicit tool surface, whose input the caller supplies
|
|
139
|
+
* directly, not of the gate chain; the J1/J3 shadow observers run the same
|
|
140
|
+
* chain for any agent and can never produce them.
|
|
112
141
|
*/
|
|
113
|
-
export type GatedNativeJevFailure = Exclude<
|
|
142
|
+
export type GatedNativeJevFailure = Exclude<
|
|
143
|
+
JevDecisionRunFailure,
|
|
144
|
+
'CALLER_NOT_ZEUS' | 'REVIEW_INPUT_INVALID' | 'CRITERIA_INVALID'
|
|
145
|
+
>
|
|
114
146
|
|
|
115
147
|
/** The minimal runtime slice the gate chain needs. */
|
|
116
148
|
export type GatedNativeJevRuntime = Pick<V2JevDecisionRuntime, 'decide'> & {
|
|
@@ -294,6 +326,14 @@ async function readHostSkills(runtime: V2JevDecisionRuntime): Promise<JevHostSki
|
|
|
294
326
|
* Run one explicit, gate-checked native Jev decision. Every failure path
|
|
295
327
|
* returns a bounded refusal JSON; the only caller-visible success output is
|
|
296
328
|
* the validated advice with `effect: 'none'`.
|
|
329
|
+
*
|
|
330
|
+
* The `mode: "review"` branch (J4 output-quality scoring, advisory only)
|
|
331
|
+
* validates and builds its bounded request BEFORE the gate chain — the same
|
|
332
|
+
* prebuilt-request pattern the J1/J3 observers use — so a malformed review
|
|
333
|
+
* never spends gate work, and its failure codes stay tool-surface properties.
|
|
334
|
+
* It records ONE J4 telemetry record per run (q-token on an answered review,
|
|
335
|
+
* skip tokens on every refusal path) and returns the evaluation plus the
|
|
336
|
+
* verdict flag; the verdict never blocks, retries, or alters anything.
|
|
297
337
|
*/
|
|
298
338
|
export async function runJevDecision(
|
|
299
339
|
input: unknown,
|
|
@@ -307,24 +347,66 @@ export async function runJevDecision(
|
|
|
307
347
|
if (context?.agent !== 'zeus') return refusal('CALLER_NOT_ZEUS')
|
|
308
348
|
|
|
309
349
|
const requested = (input ?? {}) as { mode?: unknown; questions?: unknown }
|
|
350
|
+
// Review mode (J4): the bounded request is built before any gate work, and
|
|
351
|
+
// an invalid review input is a tool-surface refusal — same class as the
|
|
352
|
+
// caller check, never a gate failure.
|
|
353
|
+
let reviewRequest: Omit<NativeDecisionRequest, 'model'> | undefined
|
|
354
|
+
if (requested.mode === 'review') {
|
|
355
|
+
const prepared = buildJevReviewRequest(input ?? {})
|
|
356
|
+
if (!prepared.ok) {
|
|
357
|
+
observeShadow(
|
|
358
|
+
J4_QUALITY_SCORE_POINT,
|
|
359
|
+
prepared.reasonCode,
|
|
360
|
+
() => ({
|
|
361
|
+
decision: 'unavailable',
|
|
362
|
+
reason: reviewRefusalSkipReason(prepared.reasonCode),
|
|
363
|
+
}),
|
|
364
|
+
runtime.shadowSink,
|
|
365
|
+
)
|
|
366
|
+
return refusal(prepared.reasonCode)
|
|
367
|
+
}
|
|
368
|
+
reviewRequest = prepared.request
|
|
369
|
+
}
|
|
310
370
|
const result = await runGatedNativeJevCall({
|
|
311
371
|
sessionID: context?.sessionID,
|
|
312
372
|
messageID: context?.messageID,
|
|
313
373
|
agent: 'zeus',
|
|
314
374
|
runtime,
|
|
315
375
|
prepare: async (route) =>
|
|
316
|
-
|
|
317
|
-
?
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
route,
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
376
|
+
reviewRequest !== undefined
|
|
377
|
+
? {
|
|
378
|
+
ok: true as const,
|
|
379
|
+
request: {
|
|
380
|
+
model: route.model,
|
|
381
|
+
input: reviewRequest.input,
|
|
382
|
+
questions: reviewRequest.questions,
|
|
383
|
+
},
|
|
384
|
+
}
|
|
385
|
+
: requested.mode === undefined
|
|
386
|
+
? prepareJevDecisionRequest(route, input ?? {})
|
|
387
|
+
: isJevDecisionPreset(requested.mode)
|
|
388
|
+
? prepareJevPresetRequest(
|
|
389
|
+
route,
|
|
390
|
+
requested.mode,
|
|
391
|
+
input ?? {},
|
|
392
|
+
requested.mode === 'skills' ? await readHostSkills(runtime) : undefined,
|
|
393
|
+
)
|
|
394
|
+
: { ok: false as const, reasonCode: 'PRESET_INVALID' as const },
|
|
326
395
|
})
|
|
327
396
|
if (!result.ok) {
|
|
397
|
+
if (requested.mode === 'review') {
|
|
398
|
+
// The review observed a gate refusal: one skip record, the refusal
|
|
399
|
+
// itself is unchanged.
|
|
400
|
+
observeShadow(
|
|
401
|
+
J4_QUALITY_SCORE_POINT,
|
|
402
|
+
result.reasonCode,
|
|
403
|
+
() => ({
|
|
404
|
+
decision: 'unavailable',
|
|
405
|
+
reason: reviewRefusalSkipReason(result.reasonCode),
|
|
406
|
+
}),
|
|
407
|
+
runtime.shadowSink,
|
|
408
|
+
)
|
|
409
|
+
}
|
|
328
410
|
if (result.detail === undefined) return refusal(result.reasonCode)
|
|
329
411
|
// Refusal with the error CLASS only (`TypeError`, `RangeError`, …): the
|
|
330
412
|
// message can carry paths, config or provider detail and never crosses
|
|
@@ -338,6 +420,44 @@ export async function runJevDecision(
|
|
|
338
420
|
}
|
|
339
421
|
|
|
340
422
|
const advice = consumeJevDecisionResult(result.call.response, result.call.request)
|
|
423
|
+
if (requested.mode === 'review') {
|
|
424
|
+
// J4 advisory evaluation: strict validation, the verdict is telemetry
|
|
425
|
+
// plus a returned flag — it never blocks, retries, or alters the result.
|
|
426
|
+
const evaluation: QualityScoreEvaluation = evaluateQualityScoreDecision(
|
|
427
|
+
result.call.response,
|
|
428
|
+
result.call.request,
|
|
429
|
+
)
|
|
430
|
+
observeShadow(
|
|
431
|
+
J4_QUALITY_SCORE_POINT,
|
|
432
|
+
evaluation,
|
|
433
|
+
(isolated) => {
|
|
434
|
+
const scored = isolated as QualityScoreEvaluation
|
|
435
|
+
return {
|
|
436
|
+
decision: qualityVerdict(scored),
|
|
437
|
+
reason: encodeQualityScoreReason(scored),
|
|
438
|
+
}
|
|
439
|
+
},
|
|
440
|
+
runtime.shadowSink,
|
|
441
|
+
)
|
|
442
|
+
return JSON.stringify({
|
|
443
|
+
advisory: true,
|
|
444
|
+
effect: 'none',
|
|
445
|
+
reason: 'JEV_DECISION',
|
|
446
|
+
route: {
|
|
447
|
+
providerID: result.call.selection.route.model.providerID,
|
|
448
|
+
id: result.call.selection.route.model.id,
|
|
449
|
+
billing: result.call.selection.route.billing,
|
|
450
|
+
},
|
|
451
|
+
mode: 'review',
|
|
452
|
+
quality: evaluation.quality,
|
|
453
|
+
needsReview: evaluation.needsReview,
|
|
454
|
+
verdict: qualityVerdict(evaluation),
|
|
455
|
+
answers: advice.answers,
|
|
456
|
+
missing: advice.missing,
|
|
457
|
+
usage: { costUsd: advice.costUsd, tokens: advice.tokens },
|
|
458
|
+
frozen: result.call.frozen,
|
|
459
|
+
})
|
|
460
|
+
}
|
|
341
461
|
return JSON.stringify({
|
|
342
462
|
advisory: true,
|
|
343
463
|
effect: 'none',
|
|
@@ -357,13 +477,15 @@ export async function runJevDecision(
|
|
|
357
477
|
|
|
358
478
|
const TOOL_DESCRIPTION =
|
|
359
479
|
'Zeus-only advisory typed decisions via the host native Jev route (OpenCode Console or a ' +
|
|
360
|
-
'configured decision model).
|
|
480
|
+
'configured decision model). Ways to ask: pass `mode: "skills"` to stack skills for the ' +
|
|
361
481
|
'state text (local prefilter shortlist, catalog fallback, plus every skill installed in the ' +
|
|
362
482
|
'host), `mode: "delegation"` to pick ' +
|
|
363
|
-
'a specialist,
|
|
364
|
-
'
|
|
365
|
-
'
|
|
366
|
-
'
|
|
483
|
+
'a specialist, `mode: "review"` to score a finished delegated result against named criteria ' +
|
|
484
|
+
'(advisory quality score + needs-review flag; the result content itself is never sent — ' +
|
|
485
|
+
'shape metrics and criteria only), or pass explicit typed `questions` (choice, score, ' +
|
|
486
|
+
'predicate). Returns probabilistic answers with confidence. Requires decision-router egress ' +
|
|
487
|
+
'consent and budget caps; asks host permission first. It never dispatches agents, runs ' +
|
|
488
|
+
'skills, executes tools, blocks, retries, or alters permissions — results are advisory only.'
|
|
367
489
|
|
|
368
490
|
const questionSchema = {
|
|
369
491
|
type: 'object',
|
|
@@ -404,15 +526,51 @@ const questionSchema = {
|
|
|
404
526
|
},
|
|
405
527
|
}
|
|
406
528
|
|
|
529
|
+
const REVIEW_METRICS_SCHEMA = {
|
|
530
|
+
type: 'object',
|
|
531
|
+
additionalProperties: false,
|
|
532
|
+
required: ['outputChars', 'taskDurationMs'],
|
|
533
|
+
properties: {
|
|
534
|
+
outputChars: { type: 'integer', minimum: 0, maximum: 100_000_000 },
|
|
535
|
+
taskDurationMs: { type: ['integer', 'null'], minimum: 0, maximum: 100_000_000 },
|
|
536
|
+
},
|
|
537
|
+
} as const
|
|
538
|
+
|
|
539
|
+
/**
|
|
540
|
+
* One schema, two disjoint payloads: the state branch (presets and explicit
|
|
541
|
+
* questions carry the state text) and the review branch (J4 takes structural
|
|
542
|
+
* shape metrics, a delegate id and named criteria — never a state text, never
|
|
543
|
+
* result content; the criteria are the only free text, bounded at the DSH
|
|
544
|
+
* caps: at most 4, each 1–120 chars). The preparers are the authority; the
|
|
545
|
+
* schema is the model-facing contract.
|
|
546
|
+
*/
|
|
407
547
|
const JEV_INPUT_SCHEMA: Record<string, unknown> = {
|
|
408
548
|
type: 'object',
|
|
409
549
|
additionalProperties: false,
|
|
410
|
-
required: ['schemaVersion'
|
|
550
|
+
required: ['schemaVersion'],
|
|
551
|
+
anyOf: [
|
|
552
|
+
{ required: ['state'] },
|
|
553
|
+
{ required: ['delegateId', 'resultSummaryKind', 'resultMetrics', 'criteria'] },
|
|
554
|
+
],
|
|
411
555
|
properties: {
|
|
412
556
|
schemaVersion: { type: 'integer', const: 1 },
|
|
413
557
|
state: { type: 'string', minLength: 1, maxLength: 12_000 },
|
|
414
|
-
mode: { type: 'string', enum: ['skills', 'delegation'] },
|
|
558
|
+
mode: { type: 'string', enum: ['skills', 'delegation', 'review'] },
|
|
415
559
|
questions: { type: 'array', minItems: 1, maxItems: 4, items: questionSchema },
|
|
560
|
+
delegateId: {
|
|
561
|
+
type: 'string',
|
|
562
|
+
minLength: 1,
|
|
563
|
+
maxLength: 64,
|
|
564
|
+
pattern: '^[A-Za-z0-9][A-Za-z0-9._:-]{0,63}$',
|
|
565
|
+
},
|
|
566
|
+
resultSummaryKind: { type: 'string', enum: ['ok', 'empty', 'error'] },
|
|
567
|
+
resultMetrics: REVIEW_METRICS_SCHEMA,
|
|
568
|
+
criteria: {
|
|
569
|
+
type: 'array',
|
|
570
|
+
minItems: 1,
|
|
571
|
+
maxItems: 4,
|
|
572
|
+
items: { type: 'string', minLength: 1, maxLength: 120 },
|
|
573
|
+
},
|
|
416
574
|
},
|
|
417
575
|
}
|
|
418
576
|
|