pantheon-opencode 1.6.3-beta.17 → 1.6.3-beta.19

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 CHANGED
@@ -10,6 +10,18 @@ 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.19] - 2026-11-06
14
+
15
+ ## 🆕 What's New
16
+ - Local router D3 fixed: a PT-BR delegation no longer starves on skills — when the English-lexical prefilter matches nothing but the agent is known, the agent's curated delegation-relevant grants feed the turn (same domain, EN fed / PT starved was the four-report-old field bug).
17
+ - D4: the complexity dimensions' polarity is documented where it bit — higher = riskier/less contained (boundedness:2 is POORLY bounded), aggregate label = max(dimensions).
18
+
19
+ ## [v1.6.3-beta.18] - 2026-11-06
20
+
21
+ ## 🆕 What's New
22
+ - `mode: "order"`: ORDER 2-4 candidates by fit — one score question per candidate, the descending ordering with per-candidate scores comes back (nulls visible, last, never guessed). Rank picks a winner; order ranks the shortlist.
23
+ - The review questions are self-documenting now: `quality` (score) and `needs_review` (predicate) — "noul" was the decision model's internal archetype leaking into user-visible payloads.
24
+
13
25
  ## [v1.6.3-beta.17] - 2026-11-05
14
26
 
15
27
  ## 🆕 What's New
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pantheon-opencode",
3
- "version": "1.6.3-beta.17",
3
+ "version": "1.6.3-beta.19",
4
4
  "description": "Multi-agent orchestration for OpenCode \u2014 14 specialized agents, TDD, Themis review gates.",
5
5
  "type": "module",
6
6
  "workspaces": [
package/plugin.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pantheon",
3
3
  "publisher": "ils15",
4
- "version": "1.6.3-beta.17",
4
+ "version": "1.6.3-beta.19",
5
5
  "displayName": "Pantheon",
6
6
  "description": "Conductor-Delegate orchestration platform with 14 specialized agents, 21 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.3-beta.17"
7
+ version = "1.6.3-beta.19"
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
@@ -47,10 +47,13 @@ import {
47
47
  REVIEW_ENVELOPE_KEYS,
48
48
  } from './jev-quality-score.ts'
49
49
  import {
50
+ buildJevOrderRequest,
50
51
  buildJevRankRequest,
51
52
  buildJevVerifyRequest,
53
+ consumeJevOrderResult,
52
54
  consumeJevRankResult,
53
55
  consumeJevVerifyResult,
56
+ ORDER_ENVELOPE_KEYS,
54
57
  RANK_ENVELOPE_KEYS,
55
58
  VERIFY_ENVELOPE_KEYS,
56
59
  } from './jev-rank-verify.ts'
@@ -134,6 +137,8 @@ export type JevDecisionRunFailure =
134
137
  | 'CRITERIA_INVALID'
135
138
  | 'RANK_INPUT_INVALID'
136
139
  | 'CANDIDATE_INVALID'
140
+ | 'ORDER_INPUT_INVALID'
141
+ | 'ORDER_CANDIDATE_INVALID'
137
142
  | 'VERIFY_INPUT_INVALID'
138
143
  | 'CLAIM_INVALID'
139
144
  | 'CONTEXT_UNAVAILABLE'
@@ -480,9 +485,11 @@ export async function runJevDecision(
480
485
  ? RANK_ENVELOPE_KEYS
481
486
  : requested.mode === 'verify'
482
487
  ? VERIFY_ENVELOPE_KEYS
483
- : isJevDecisionPreset(requested.mode)
484
- ? JEV_PRESET_ENVELOPE_KEYS
485
- : undefined
488
+ : requested.mode === 'order'
489
+ ? ORDER_ENVELOPE_KEYS
490
+ : isJevDecisionPreset(requested.mode)
491
+ ? JEV_PRESET_ENVELOPE_KEYS
492
+ : undefined
486
493
  if (envelopeKeys !== undefined) {
487
494
  const envelope = checkJevEnvelope(input, envelopeKeys)
488
495
  if (!envelope.ok) {
@@ -495,7 +502,9 @@ export async function runJevDecision(
495
502
  ? 'RANK_INPUT_INVALID'
496
503
  : requested.mode === 'verify'
497
504
  ? 'VERIFY_INPUT_INVALID'
498
- : 'PRESET_INVALID'
505
+ : requested.mode === 'order'
506
+ ? 'ORDER_INPUT_INVALID'
507
+ : 'PRESET_INVALID'
499
508
  return refusal(reasonCode, envelope.detail)
500
509
  }
501
510
  }
@@ -530,6 +539,10 @@ export async function runJevDecision(
530
539
  const prepared = buildJevVerifyRequest(input ?? {})
531
540
  if (!prepared.ok) return refusal(prepared.reasonCode)
532
541
  prebuilt = prepared.request
542
+ } else if (requested.mode === 'order') {
543
+ const prepared = buildJevOrderRequest(input ?? {})
544
+ if (!prepared.ok) return refusal(prepared.reasonCode, prepared.detail)
545
+ prebuilt = prepared.request
533
546
  }
534
547
  const result = await runGatedNativeJevCall({
535
548
  sessionID: context?.sessionID,
@@ -657,6 +670,29 @@ export async function runJevDecision(
657
670
  frozen: result.call.frozen,
658
671
  })
659
672
  }
673
+ if (requested.mode === 'order') {
674
+ // v3.1 ordering: one fit question per candidate (2-4), sorted descending.
675
+ // Null score = the host answered nothing usable for that candidate —
676
+ // visible, placed last, never guessed.
677
+ const ordering = consumeJevOrderResult(result.call.response, result.call.request)
678
+ return JSON.stringify({
679
+ advisory: true,
680
+ effect: 'none',
681
+ reason: 'JEV_DECISION',
682
+ caller,
683
+ route: {
684
+ providerID: result.call.selection.route.model.providerID,
685
+ id: result.call.selection.route.model.id,
686
+ billing: result.call.selection.route.billing,
687
+ },
688
+ mode: 'order',
689
+ ordering,
690
+ answers: advice.answers,
691
+ missing: advice.missing,
692
+ usage: { costUsd: advice.costUsd, tokens: advice.tokens },
693
+ frozen: result.call.frozen,
694
+ })
695
+ }
660
696
  if (requested.mode === 'verify') {
661
697
  // v3.1 verify: one PASS/FAIL/BLOCK verdict per claim, fail-closed. The
662
698
  // tool never acts on the verdicts; a caller that requires a verdict
@@ -708,6 +744,8 @@ const TOOL_DESCRIPTION =
708
744
  'a specialist, `mode: "review"` to score a finished delegated result against named criteria ' +
709
745
  '(advisory quality score + needs-review flag; the result content itself is never sent — ' +
710
746
  'shape metrics and criteria only), `mode: "rank"` to pick the best of 2-20 named candidates ' +
747
+ '(winner + fit; no full ordering), `mode: "order"` to ORDER 2-4 candidates by fit (one ' +
748
+ 'score question per candidate; returns the descending ordering with per-candidate scores), ' +
711
749
  '(returns the winner and its fit score; no full ordering), `mode: "verify"` to check 1-4 ' +
712
750
  'named claims, with optional `state` evidence the claims are judged against ' +
713
751
  '(verdicts PASS, FAIL, or UNVERIFIABLE for the 0.35-0.65 band; any refusal, timeout or ' +
@@ -819,7 +857,7 @@ const JEV_INPUT_SCHEMA: Record<string, unknown> = {
819
857
  properties: {
820
858
  schemaVersion: { type: 'integer', const: 1 },
821
859
  state: { type: 'string', minLength: 1, maxLength: 12_000 },
822
- mode: { type: 'string', enum: ['skills', 'delegation', 'review', 'rank', 'verify'] },
860
+ mode: { type: 'string', enum: ['skills', 'delegation', 'review', 'rank', 'verify', 'order'] },
823
861
  questions: { type: 'array', minItems: 1, maxItems: 4, items: questionSchema },
824
862
  delegateId: {
825
863
  type: 'string',
@@ -63,7 +63,12 @@ export const J4_QUALITY_SCORE_POINT = 'J4'
63
63
 
64
64
  /** Question names of the two prepared questions, matched on consumption. */
65
65
  export const QUALITY_QUESTION_NAME = 'quality'
66
- export const REVIEW_QUESTION_NAME = 'noul'
66
+ /**
67
+ * Field report (beta.13→16): the review question was literally named 'noul'
68
+ * — the decision model's internal archetype leaked into a user-visible
69
+ * payload. The name is ours to choose; `quality` says what it measures.
70
+ */
71
+ export const REVIEW_QUESTION_NAME = 'needs_review'
67
72
 
68
73
  /** DSH hard-cap mirror: at most 4 criteria per review request. */
69
74
  export const J4_MAX_CRITERIA = 4
@@ -46,7 +46,7 @@
46
46
  * @module jev-rank-verify
47
47
  */
48
48
 
49
- import { consumeJevDecisionResult } from './jev-decisions.ts'
49
+ import { consumeJevDecisionResult, JEV_DECISION_MAX_QUESTIONS } from './jev-decisions.ts'
50
50
  import type { NativeDecisionRequest, ResolvedNativeDecisionRoute } from './v2-native-decisions.ts'
51
51
  import { NATIVE_DECISION_MAX_PROMPT_LENGTH } from './v2-native-decisions.ts'
52
52
 
@@ -283,6 +283,166 @@ export function prepareJevRankRequest(
283
283
  }
284
284
  }
285
285
 
286
+ // ─── Order: top-K ordering (2-4 candidates, one fit question each) ───────
287
+
288
+ export const ORDER_ENVELOPE_KEYS: ReadonlySet<string> = new Set([
289
+ 'schemaVersion',
290
+ 'mode',
291
+ 'state',
292
+ 'candidates',
293
+ ])
294
+
295
+ export type JevOrderBuildFailure =
296
+ | 'ORDER_INPUT_INVALID'
297
+ | 'ORDER_CANDIDATE_INVALID'
298
+ | 'STATE_INVALID'
299
+
300
+ export type JevOrderBuildDetail = 'ORDER_CANDIDATE_COUNT_RANGE'
301
+
302
+ export type JevOrderBuild =
303
+ | { readonly ok: true; readonly request: Omit<NativeDecisionRequest, 'model'> }
304
+ | {
305
+ readonly ok: false
306
+ readonly reasonCode: JevOrderBuildFailure
307
+ readonly detail?: JevOrderBuildDetail
308
+ }
309
+
310
+ export type JevOrderPreparation =
311
+ | { readonly ok: true; readonly request: NativeDecisionRequest }
312
+ | {
313
+ readonly ok: false
314
+ readonly reasonCode: JevOrderBuildFailure
315
+ readonly detail?: JevOrderBuildDetail
316
+ }
317
+
318
+ const ORDER_MAX_CANDIDATES = JEV_DECISION_MAX_QUESTIONS // one score question per candidate
319
+
320
+ const ORDER_STATE_TEMPLATE =
321
+ 'Advisory ordering. The caller supplied a task and 2-4 candidates; ' +
322
+ 'each question scores ONE candidate for fit against the stated task. ' +
323
+ 'Score each candidate on its own terms. Nothing is enforced.'
324
+
325
+ /**
326
+ * Build the order request: one SCORE question per candidate (the host answers
327
+ * one scalar per question, so 2-4 candidates is the honest ceiling). Ids ride
328
+ * the candidate validation reused from rank; question names are positional
329
+ * (`fit_1`..) so no id pattern can collide with the question-name grammar.
330
+ */
331
+ export function buildJevOrderRequest(input: unknown): JevOrderBuild {
332
+ if (!isRecord(input)) return { ok: false, reasonCode: 'ORDER_INPUT_INVALID' }
333
+ for (const key of Object.keys(input)) {
334
+ if (!ORDER_ENVELOPE_KEYS.has(key)) return { ok: false, reasonCode: 'ORDER_INPUT_INVALID' }
335
+ }
336
+ const state = input.state
337
+ if (!isBoundedNonBlankString(state, NATIVE_DECISION_MAX_PROMPT_LENGTH) || isHostileProse(state)) {
338
+ return { ok: false, reasonCode: 'STATE_INVALID' }
339
+ }
340
+ const rawCandidates = input.candidates
341
+ if (rawCandidates === undefined) return { ok: false, reasonCode: 'ORDER_INPUT_INVALID' }
342
+ if (!Array.isArray(rawCandidates)) return { ok: false, reasonCode: 'ORDER_CANDIDATE_INVALID' }
343
+ if (rawCandidates.length < 2 || rawCandidates.length > ORDER_MAX_CANDIDATES) {
344
+ return {
345
+ ok: false,
346
+ reasonCode: 'ORDER_CANDIDATE_INVALID',
347
+ detail: 'ORDER_CANDIDATE_COUNT_RANGE',
348
+ }
349
+ }
350
+ const seen = new Set<string>()
351
+ const candidates: Array<{ id: string; description?: string }> = []
352
+ for (const raw of rawCandidates) {
353
+ if (!isRecord(raw)) return { ok: false, reasonCode: 'ORDER_CANDIDATE_INVALID' }
354
+ const extraKeys = Object.keys(raw).filter((key) => key !== 'id' && key !== 'description')
355
+ if (extraKeys.length > 0) return { ok: false, reasonCode: 'ORDER_CANDIDATE_INVALID' }
356
+ const id = raw.id
357
+ if (typeof id !== 'string' || id.length < 1 || id.length > 64) {
358
+ return { ok: false, reasonCode: 'ORDER_CANDIDATE_INVALID' }
359
+ }
360
+ if (seen.has(id)) return { ok: false, reasonCode: 'ORDER_CANDIDATE_INVALID' }
361
+ seen.add(id)
362
+ const description = raw.description
363
+ if (description !== undefined) {
364
+ if (!isBoundedNonBlankString(description, 500) || isHostileProse(description)) {
365
+ return { ok: false, reasonCode: 'ORDER_CANDIDATE_INVALID' }
366
+ }
367
+ candidates.push({ id, description })
368
+ } else {
369
+ candidates.push({ id })
370
+ }
371
+ }
372
+ const levels = Array.from({ length: 9 }, (_, index) => ({
373
+ label: String(index + 2),
374
+ }))
375
+ const questions = candidates.map((candidate, index) => ({
376
+ type: 'score' as const,
377
+ name: `fit_${index + 1}`,
378
+ instructions:
379
+ `Score how well candidate "${candidate.id}"` +
380
+ (candidate.description ? ` (${candidate.description})` : '') +
381
+ ` fits the task. 2 = poor fit, 10 = exact fit.`,
382
+ levels,
383
+ }))
384
+ const request = {
385
+ input: Object.freeze([
386
+ Object.freeze({ type: 'text' as const, text: `${ORDER_STATE_TEMPLATE} Task: ${state}` }),
387
+ ]),
388
+ questions: Object.freeze(questions.map((question) => Object.freeze(question))),
389
+ } satisfies Omit<NativeDecisionRequest, 'model'>
390
+ return { ok: true, request: Object.freeze(request) }
391
+ }
392
+
393
+ export function prepareJevOrderRequest(
394
+ route: ResolvedNativeDecisionRoute,
395
+ input: unknown,
396
+ ): JevOrderPreparation {
397
+ const built = buildJevOrderRequest(input)
398
+ if (!built.ok) return built
399
+ return {
400
+ ok: true,
401
+ request: {
402
+ model: route.model,
403
+ input: built.request.input,
404
+ questions: built.request.questions,
405
+ },
406
+ }
407
+ }
408
+
409
+ /** One ordered entry: the candidate id and its fit score (null when the host answered nothing usable). */
410
+ export interface JevOrderEntry {
411
+ readonly id: string
412
+ readonly score: number | null
413
+ }
414
+
415
+ /**
416
+ * Consume the order result: map each positional score answer back to its
417
+ * candidate, sort by score descending (nulls last, stable), and return the
418
+ * ordering. A missing/invalid score stays visible as null — never guessed.
419
+ */
420
+ export function consumeJevOrderResult(
421
+ response: unknown,
422
+ request: NativeDecisionRequest,
423
+ ): ReadonlyArray<JevOrderEntry> {
424
+ const advice = consumeJevDecisionResult(response, request)
425
+ const entries: Array<{ id: string; score: number | null; order: number }> = []
426
+ request.questions.forEach((question, index) => {
427
+ const answer = advice.answers.find((candidate) => candidate.name === question.name)
428
+ const score =
429
+ answer !== undefined && answer.type === 'score' && typeof answer.score === 'number'
430
+ ? answer.score
431
+ : null
432
+ entries.push({ id: `c${index + 1}`, score, order: index })
433
+ })
434
+ return Object.freeze(
435
+ entries
436
+ .sort((left, right) => {
437
+ if (left.score === null && right.score === null) return left.order - right.order
438
+ if (left.score === null) return 1
439
+ if (right.score === null) return -1
440
+ return right.score - left.score || left.order - right.order
441
+ })
442
+ .map(({ id, score }) => ({ id, score })),
443
+ )
444
+ }
445
+
286
446
  // ─── Verify: request building ────────────────────────────────────────────
287
447
 
288
448
  export const VERIFY_ENVELOPE_KEYS: ReadonlySet<string> = new Set([
@@ -4,6 +4,12 @@ import { PANTHEON_AGENTS } from './v2-delegation-enforce.ts'
4
4
  export const LOCAL_DECISION_ROUTER_ENV = 'PANTHEON_LOCAL_DECISION_ROUTER'
5
5
  export const LOCAL_DECISION_ROUTER_POLICY_VERSION = 'local-decision-router/v1'
6
6
 
7
+ /**
8
+ * Complexity dimensions, each 0..2 where HIGHER MEANS RISKIER/LESS CONTAINED
9
+ * (field report D4, three rounds unread): `boundedness: 2` reads like "very
10
+ * bounded" but means POORLY bounded (scope escapes). The label aggregate is
11
+ * max(dimensions) — one hot dimension is enough to label the task high.
12
+ */
7
13
  export const LOCAL_DECISION_COMPLEXITY_DIMENSIONS = [
8
14
  'boundedness',
9
15
  'reversibility',
@@ -55,20 +55,55 @@ function readConfig(): UserDecisionRouterConfig | undefined {
55
55
  }
56
56
  }
57
57
 
58
- function localDecision(
58
+ /**
59
+ * Delegation-relevant skills per specialist (D3 fix, field reports beta.13-16:
60
+ * a PT-Brasil delegation matched the agent lexically but starved on skills —
61
+ * the English-lexical prefilter returned [] for the same domain). When the
62
+ * prefilter matches nothing but an agent was selected, these curated subsets
63
+ * of the agent's own grants keep the delegation fed. Pinned against the
64
+ * canonical frontmatter by tests/pantheon/local-decision-turn.test.ts.
65
+ */
66
+ const AGENT_SKILL_FALLBACK: Readonly<Record<string, readonly string[]>> = Object.freeze({
67
+ athena: ['spec-driven-development', 'verification-planning'],
68
+ apollo: ['codemap'],
69
+ themis: ['code-review-checklist', 'security-hardening'],
70
+ hermes: ['incremental-implementation', 'tdd-with-agents'],
71
+ aphrodite: ['incremental-implementation', 'visual-review-pipeline'],
72
+ demeter: ['incremental-implementation', 'tdd-with-agents'],
73
+ prometheus: ['git-workflow-and-versioning'],
74
+ hephaestus: ['tdd-with-agents'],
75
+ nyx: ['auto-continue'],
76
+ gaia: ['auto-continue'],
77
+ iris: ['artifact-management', 'git-workflow-and-versioning'],
78
+ mnemosyne: ['memory-bank', 'context-compression'],
79
+ talos: ['incremental-implementation'],
80
+ })
81
+
82
+ /** Pure decision core exposed for offline tests (D3 contract).
83
+ * @internal
84
+ */
85
+ export function localDecisionForTest(
59
86
  request: string,
60
87
  policy: LocalDecisionPolicy | undefined,
61
88
  reasonCode: string,
62
89
  ): TurnDecision {
63
- const skills = selectPantheonSkills(request)
90
+ const selection = selectPantheonSkills(request)
64
91
  const agent = hasDelegationSignal(request)
65
92
  ? recommendLocalDecisionAgent(request, policy).agent
66
93
  : null
94
+ // D3: the prefilter is English-lexical; a PT state for the SAME domain
95
+ // starved. When it matches nothing but the agent is known, fall back to the
96
+ // agent's own curated grants — never an empty recommendation for a routed
97
+ // specialist.
98
+ const skillIds =
99
+ selection.skillIds.length > 0 || agent === null || !(agent in AGENT_SKILL_FALLBACK)
100
+ ? selection.skillIds
101
+ : AGENT_SKILL_FALLBACK[agent]
67
102
  return {
68
103
  schemaVersion: 1,
69
104
  active: true,
70
105
  source: 'local',
71
- skillIds: skills.skillIds,
106
+ skillIds,
72
107
  agent,
73
108
  reasonCode,
74
109
  }
@@ -97,5 +132,5 @@ export async function decideLocalForTurn(input: TurnDecisionInput): Promise<Turn
97
132
  if (config === undefined || !isUserDecisionRouterEnabled(config)) return inactive('DISABLED')
98
133
 
99
134
  const policy = await loadLocalDecisionPolicy().catch(() => undefined)
100
- return localDecision(request, policy, 'LOCAL_SELECTION')
135
+ return localDecisionForTest(request, policy, 'LOCAL_SELECTION')
101
136
  }
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pantheon-tui",
3
- "version": "1.6.3-beta.17",
3
+ "version": "1.6.3-beta.19",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pantheon-tui",
9
- "version": "1.6.3-beta.17",
9
+ "version": "1.6.3-beta.19",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@opencode-ai/plugin": "1.18.33",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pantheon-tui",
3
3
  "type": "module",
4
- "version": "1.6.3-beta.17",
4
+ "version": "1.6.3-beta.19",
5
5
  "description": "Pantheon TUI plugin — V1 rich sidebar and usage gauges; native V2 status, session and delegation sidebar",
6
6
  "license": "MIT",
7
7
  "engines": {