pantheon-opencode 1.6.3-beta.11 β†’ 1.6.3-beta.13

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,14 +10,31 @@ 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.11] - 2026-11-05
13
+ ## [v1.6.3-beta.13] - 2026-11-05
14
+
15
+ ## πŸ†• What's New
16
+ - One coherent setup summary: a single closing block instead of two competing "Next steps" lists.
17
+ - Warnings restate their text inline β€” no more hunting for what scrolled past.
18
+ - The worktree guidance box is project-only (a global install from $HOME showed a nonsense path).
19
+ - The banner now prints the exact `source` line for the decision-layer flags file β€” the silent-off gap fixed.
20
+
21
+ ## [v1.6.3-beta.12] - 2026-11-05
14
22
 
15
23
  ## πŸ†• What's New
16
- - Measured MCP usage policy across the roster: durable stores only, milestone checkpoints, one vision pass per image β€” a governance ladder byte-identical in all 13 specialists, contract-pinned.
17
- - The skill-discovery pipeline with the trust cascade: installed pool β†’ canonical Anthropic catalog β†’ skills.sh β†’ raw GitHub; Jev ranks, the user reviews and installs.
18
- - Dead-route holds release (ledger schema v4): the fix for budgets frozen forever by holds of removed routes ($1.00 freed in the field).
19
- - The roster reform measured: nyx re-scoped to chaos & adversarial, talos aligned to the real hotfix identity, domain-artifact ownership for all 14 agents.
20
- - Jev validated end to end in the field: N4 dead, verify field-verified, sandbox install 28/28 with all five MCPs live.
24
+ - Delegation answers are domain-aware again: agent descriptions ride with every choice — live probe 5/5 exact (FastAPI→hermes, WCAG→aphrodite, Alembic→demeter, security→themis, poem→none).
25
+ - The input envelope is enforced on EVERY path now: presets, review, rank and verify all refuse missing/unknown keys with the exact cause.
26
+ - Rank accepts up to 20 candidates (typesafe_rank contract) and names the accepted range on refusal.
27
+ - Skills results report where the candidates came from (`candidateSource`), ending silent prefilter misses.
28
+ - The local router respects open gates: review/approval required β†’ abstain (`GATE_OPEN`), never route around.
29
+
30
+ ## [v1.6.3-beta.11] - 2026-11-05
31
+
32
+ ### πŸ†• What's New
33
+ - Measured MCP usage policy across the roster β€” governance ladder byte-identical in all 13 specialists.
34
+ - Skill-discovery pipeline with the trust cascade: Anthropic catalog β†’ skills.sh β†’ GitHub; Jev ranks, you install.
35
+ - Dead-route holds release (ledger schema v4) β€” the fix for budgets frozen by removed routes.
36
+ - Roster reform: nyx re-scoped to chaos & adversarial, talos aligned to hotfix, domain docs per agent.
37
+ - Jev validated end to end in the field: N4 dead, verify field-verified, sandbox 28/28.
21
38
 
22
39
  ### Added
23
40
 
@@ -1064,10 +1064,33 @@ async function main() {
1064
1064
  console.log(` ${S.nextVerify}`)
1065
1065
  console.log(` ${S.nextLaunch}`)
1066
1066
  console.log(` ${S.nextAgents}`)
1067
- console.log(` ${S.nextProject}`)
1067
+ if (!isProject) {
1068
+ // The project-local hint only matters when this install was not one.
1069
+ console.log(` ${S.nextProject}`)
1070
+ }
1068
1071
  if (!decisionTarget) {
1069
1072
  console.log(` ${S.nextJev}`)
1070
1073
  }
1074
+ // The decision-layer extras (J1/J3/specialist callers) write an env file;
1075
+ // without sourcing it the gates stay off silently β€” the exact gap the
1076
+ // field hit on the beta.12 setup pass.
1077
+ try {
1078
+ const { existsSync } = await import('node:fs')
1079
+ const flagsPath = path.join(
1080
+ process.env.XDG_CONFIG_HOME ?? path.join(process.env.HOME ?? '', '.config'),
1081
+ 'pantheon',
1082
+ 'decision-flags.env',
1083
+ )
1084
+ if (existsSync(flagsPath)) {
1085
+ console.log('')
1086
+ console.log(' Decision-layer flags (J1/J3/specialist callers):')
1087
+ console.log(
1088
+ ` source ${flagsPath} # add to your shell profile; applies to NEW opencode sessions`,
1089
+ )
1090
+ }
1091
+ } catch {
1092
+ // Hint is best-effort; never fail the install over it.
1093
+ }
1071
1094
  console.log('')
1072
1095
 
1073
1096
  return
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pantheon-opencode",
3
- "version": "1.6.3-beta.11",
3
+ "version": "1.6.3-beta.13",
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.11",
4
+ "version": "1.6.3-beta.13",
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.3-beta.11"
7
+ version = "1.6.3-beta.13"
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
@@ -386,8 +386,9 @@ export function printWorktreeGuidance({
386
386
  projectRoot = process.cwd(),
387
387
  interactive = false,
388
388
  dryRun = false,
389
+ enabled = true,
389
390
  } = {}) {
390
- if (!interactive || dryRun || !tty()) return
391
+ if (!interactive || dryRun || !tty() || enabled === false) return
391
392
 
392
393
  const recommendation = getWorktreeRecommendation(projectRoot)
393
394
  const rows = [
@@ -1427,6 +1427,8 @@ export function setupRuntimePhase(
1427
1427
  error(S.runtimeFailed(err.message))
1428
1428
  warning(S.runtimeSkippedMcp)
1429
1429
  stats.warnings += 1
1430
+ if (!Array.isArray(stats.warningMessages)) stats.warningMessages = []
1431
+ stats.warningMessages.push(S.runtimeSkippedMcp)
1430
1432
  stats.errors += 1
1431
1433
  return false
1432
1434
  }
@@ -2406,6 +2408,10 @@ async function installPass(
2406
2408
  // payload and the host config are already in place.
2407
2409
  warning(`Could not disable the builtin Context sidebar block: ${cause.message}`)
2408
2410
  stats.warnings++
2411
+ if (!Array.isArray(stats.warningMessages)) stats.warningMessages = []
2412
+ stats.warningMessages.push(
2413
+ `Could not disable the builtin Context sidebar block: ${cause.message}`,
2414
+ )
2409
2415
  }
2410
2416
  }
2411
2417
  if (componentSet.has('plugins')) advancePhase()
@@ -3091,6 +3097,8 @@ async function installPass(
3091
3097
  for (const message of mcp.warnings ?? []) {
3092
3098
  warning(message)
3093
3099
  stats.warnings += 1
3100
+ if (!Array.isArray(stats.warningMessages)) stats.warningMessages = []
3101
+ stats.warningMessages.push(message)
3094
3102
  }
3095
3103
  }
3096
3104
 
@@ -3421,19 +3429,27 @@ async function installPass(
3421
3429
  process.stdout.write(` [OK] ${created} component(s) installed\n`)
3422
3430
  if (skipped > 0)
3423
3431
  process.stdout.write(` ${colors.dim('\u2014')} ${skipped} already up-to-date\n`)
3424
- if (warnings > 0)
3432
+ // The warning TEXT restates here β€” the count alone sent users to doctor to
3433
+ // learn what had already scrolled past.
3434
+ for (const message of stats.warningMessages ?? []) {
3435
+ process.stdout.write(` [WARN] ${message}\n`)
3436
+ }
3437
+ if (warnings > 0 && (stats.warningMessages ?? []).length === 0) {
3438
+ process.stdout.write(` [WARN] ${warnings} warning(s)\n`)
3439
+ }
3440
+ if (warnings > 0) {
3425
3441
  process.stdout.write(
3426
- ` [WARN] ${warnings} warning(s) β€” run 'pantheon-opencode doctor' for details\n`,
3442
+ ` ${colors.dim("Run 'pantheon-opencode doctor' for the full health check")}\n`,
3427
3443
  )
3444
+ }
3428
3445
  process.stdout.write('\n')
3429
- process.stdout.write(` ${colors.bold('Next steps:')}\n`)
3430
- process.stdout.write(` ${colors.dim('\u2022')} Configure agents in opencode.json\n`)
3431
- process.stdout.write(` ${colors.dim('\u2022')} Run 'pantheon-opencode doctor' to verify\n`)
3432
- process.stdout.write(
3433
- ` ${colors.dim('\u2022')} Run 'opencode' to start using Pantheon agents\n`,
3434
- )
3435
- process.stdout.write('\n')
3436
- printWorktreeGuidance({ projectRoot: process.cwd(), interactive: true })
3446
+ // Worktree guidance is a project-install concept: a global install run
3447
+ // from $HOME derived a nonsense `<home>/.pantheon-worktrees/<user>` path.
3448
+ printWorktreeGuidance({
3449
+ projectRoot: process.cwd(),
3450
+ interactive: true,
3451
+ enabled: !(opts.global ?? isGlobalConfigDir(target)),
3452
+ })
3437
3453
  }
3438
3454
 
3439
3455
  // Beta 11 Setup phase 3: report whether this call APPLIED, so the caller can
@@ -24,8 +24,11 @@
24
24
  */
25
25
  import { readUserDecisionRouterConfig } from '../../scripts/install/decision-router-config.mjs'
26
26
  import {
27
+ checkJevEnvelope,
27
28
  consumeJevDecisionResult,
28
29
  isJevDecisionPreset,
30
+ JEV_EXPLICIT_ENVELOPE_KEYS,
31
+ JEV_PRESET_ENVELOPE_KEYS,
29
32
  type JevDecisionPreparation,
30
33
  type JevHostSkill,
31
34
  type NativeJevRouteFailure,
@@ -41,12 +44,15 @@ import {
41
44
  J4_QUALITY_SCORE_POINT,
42
45
  type QualityScoreEvaluation,
43
46
  qualityVerdict,
47
+ REVIEW_ENVELOPE_KEYS,
44
48
  } from './jev-quality-score.ts'
45
49
  import {
46
50
  buildJevRankRequest,
47
51
  buildJevVerifyRequest,
48
52
  consumeJevRankResult,
49
53
  consumeJevVerifyResult,
54
+ RANK_ENVELOPE_KEYS,
55
+ VERIFY_ENVELOPE_KEYS,
50
56
  } from './jev-rank-verify.ts'
51
57
  import { mapGateFailureToSkipReason } from './jev-risk-gate.ts'
52
58
  import {
@@ -152,8 +158,12 @@ interface JevToolContext {
152
158
  agent?: unknown
153
159
  }
154
160
 
155
- function refusal(reasonCode: JevDecisionRunFailure): string {
156
- return JSON.stringify({ advisory: false, effect: 'none', reasonCode })
161
+ function refusal(reasonCode: JevDecisionRunFailure, detail?: string): string {
162
+ return JSON.stringify(
163
+ detail === undefined
164
+ ? { advisory: false, effect: 'none', reasonCode }
165
+ : { advisory: false, effect: 'none', reasonCode, detail },
166
+ )
157
167
  }
158
168
 
159
169
  function isNonBlankString(value: unknown): value is string {
@@ -453,12 +463,46 @@ export async function runJevDecision(
453
463
  if (caller !== 'zeus' && requested.mode !== undefined) {
454
464
  return refusal('CALLER_NOT_ALLOWED')
455
465
  }
466
+ // The ONE envelope gate every path passes through before its builder:
467
+ // schemaVersion required, unknown keys rejected β€” explicit questions,
468
+ // presets, review, rank and verify alike (beta.10 claimed this contract;
469
+ // beta.12 applies it uniformly). Builders keep their semantic checks.
470
+ const envelopeKeys =
471
+ requested.mode === undefined
472
+ ? JEV_EXPLICIT_ENVELOPE_KEYS
473
+ : requested.mode === 'review'
474
+ ? REVIEW_ENVELOPE_KEYS
475
+ : requested.mode === 'rank'
476
+ ? RANK_ENVELOPE_KEYS
477
+ : requested.mode === 'verify'
478
+ ? VERIFY_ENVELOPE_KEYS
479
+ : isJevDecisionPreset(requested.mode)
480
+ ? JEV_PRESET_ENVELOPE_KEYS
481
+ : undefined
482
+ if (envelopeKeys !== undefined) {
483
+ const envelope = checkJevEnvelope(input, envelopeKeys)
484
+ if (!envelope.ok) {
485
+ const reasonCode: JevDecisionRunFailure =
486
+ requested.mode === undefined
487
+ ? 'QUESTIONS_INVALID'
488
+ : requested.mode === 'review'
489
+ ? 'REVIEW_INPUT_INVALID'
490
+ : requested.mode === 'rank'
491
+ ? 'RANK_INPUT_INVALID'
492
+ : requested.mode === 'verify'
493
+ ? 'VERIFY_INPUT_INVALID'
494
+ : 'PRESET_INVALID'
495
+ return refusal(reasonCode, envelope.detail)
496
+ }
497
+ }
498
+
456
499
  // Review mode (J4): the bounded request is built before any gate work, and
457
500
  // an invalid review input is a tool-surface refusal β€” same class as the
458
501
  // caller check, never a gate failure. The v3.1 rank and verify modes follow
459
502
  // the same prebuilt-request pattern (no gate work for a malformed input);
460
503
  // neither has a telemetry point β€” they are tool modes, not shadow gates.
461
504
  let prebuilt: Omit<NativeDecisionRequest, 'model'> | undefined
505
+ let candidateSource: JevDecisionPreparation['candidateSource'] | undefined
462
506
  if (requested.mode === 'review') {
463
507
  const prepared = buildJevReviewRequest(input ?? {})
464
508
  if (!prepared.ok) {
@@ -476,7 +520,7 @@ export async function runJevDecision(
476
520
  prebuilt = prepared.request
477
521
  } else if (requested.mode === 'rank') {
478
522
  const prepared = buildJevRankRequest(input ?? {})
479
- if (!prepared.ok) return refusal(prepared.reasonCode)
523
+ if (!prepared.ok) return refusal(prepared.reasonCode, prepared.detail)
480
524
  prebuilt = prepared.request
481
525
  } else if (requested.mode === 'verify') {
482
526
  const prepared = buildJevVerifyRequest(input ?? {})
@@ -501,12 +545,16 @@ export async function runJevDecision(
501
545
  : requested.mode === undefined
502
546
  ? prepareJevDecisionRequest(route, input ?? {})
503
547
  : isJevDecisionPreset(requested.mode)
504
- ? prepareJevPresetRequest(
505
- route,
506
- requested.mode,
507
- input ?? {},
508
- requested.mode === 'skills' ? await readHostSkills(runtime) : undefined,
509
- )
548
+ ? (async () => {
549
+ const prepared = prepareJevPresetRequest(
550
+ route,
551
+ requested.mode,
552
+ input ?? {},
553
+ requested.mode === 'skills' ? await readHostSkills(runtime) : undefined,
554
+ )
555
+ if (prepared.ok) candidateSource = prepared.candidateSource
556
+ return prepared
557
+ })()
510
558
  : { ok: false as const, reasonCode: 'PRESET_INVALID' as const },
511
559
  })
512
560
  if (!result.ok) {
@@ -639,6 +687,7 @@ export async function runJevDecision(
639
687
  billing: result.call.selection.route.billing,
640
688
  },
641
689
  ...(requested.mode === undefined ? {} : { preset: requested.mode }),
690
+ ...(candidateSource === undefined ? {} : { candidateSource }),
642
691
  answers: advice.answers,
643
692
  missing: advice.missing,
644
693
  usage: { costUsd: advice.costUsd, tokens: advice.tokens },
@@ -654,7 +703,7 @@ const TOOL_DESCRIPTION =
654
703
  'host), `mode: "delegation"` to pick ' +
655
704
  'a specialist, `mode: "review"` to score a finished delegated result against named criteria ' +
656
705
  '(advisory quality score + needs-review flag; the result content itself is never sent β€” ' +
657
- 'shape metrics and criteria only), `mode: "rank"` to pick the best of 2-8 named candidates ' +
706
+ 'shape metrics and criteria only), `mode: "rank"` to pick the best of 2-20 named candidates ' +
658
707
  '(returns the winner and its fit score; no full ordering), `mode: "verify"` to check 1-4 ' +
659
708
  'named claims (PASS/FAIL per claim; any refusal, timeout or malformed answer is BLOCK, ' +
660
709
  'fail-closed), or pass explicit typed `questions` (choice, score, ' +
@@ -784,7 +833,7 @@ const JEV_INPUT_SCHEMA: Record<string, unknown> = {
784
833
  candidates: {
785
834
  type: 'array',
786
835
  minItems: 2,
787
- maxItems: 8,
836
+ maxItems: 20,
788
837
  items: RANK_CANDIDATE_SCHEMA,
789
838
  },
790
839
  claims: {
@@ -224,14 +224,59 @@ export type JevDecisionPreparationDetail =
224
224
  | 'SCHEMA_VERSION_INVALID'
225
225
  | 'UNKNOWN_INPUT_KEYS'
226
226
 
227
+ export type JevSkillCandidateSource = 'prefilter' | 'full-catalog' | 'host-skills'
228
+
227
229
  export type JevDecisionPreparation =
228
- | { readonly ok: true; readonly request: NativeDecisionRequest }
230
+ | {
231
+ readonly ok: true
232
+ readonly request: NativeDecisionRequest
233
+ /** Skills mode only: which path produced the candidate pool. */
234
+ readonly candidateSource?: JevSkillCandidateSource
235
+ }
229
236
  | {
230
237
  readonly ok: false
231
238
  readonly reasonCode: JevDecisionPreparationFailure
232
239
  readonly detail?: JevDecisionPreparationDetail
233
240
  }
234
241
 
242
+ /**
243
+ * The ONE envelope check every tool path passes through before its builder:
244
+ * `schemaVersion` is required (and must be 1) and unknown keys are rejected β€”
245
+ * the declared contract, now enforced uniformly (beta.10 claimed it; beta.12
246
+ * applies it to presets, review, rank and verify too).
247
+ */
248
+ export type JevEnvelopeCheck = { ok: true } | { ok: false; detail: JevDecisionPreparationDetail }
249
+
250
+ export function checkJevEnvelope(
251
+ input: unknown,
252
+ allowedKeys: ReadonlySet<string>,
253
+ ): JevEnvelopeCheck {
254
+ if (
255
+ input === null ||
256
+ typeof input !== 'object' ||
257
+ Array.isArray(input) ||
258
+ (input as Record<string, unknown>).schemaVersion !== 1
259
+ ) {
260
+ return { ok: false, detail: 'SCHEMA_VERSION_INVALID' }
261
+ }
262
+ const unknown = Object.keys(input as Record<string, unknown>).filter(
263
+ (key) => !allowedKeys.has(key),
264
+ )
265
+ if (unknown.length > 0) return { ok: false, detail: 'UNKNOWN_INPUT_KEYS' }
266
+ return { ok: true }
267
+ }
268
+
269
+ export const JEV_EXPLICIT_ENVELOPE_KEYS: ReadonlySet<string> = new Set([
270
+ 'schemaVersion',
271
+ 'state',
272
+ 'questions',
273
+ ])
274
+ export const JEV_PRESET_ENVELOPE_KEYS: ReadonlySet<string> = new Set([
275
+ 'schemaVersion',
276
+ 'mode',
277
+ 'state',
278
+ ])
279
+
235
280
  function isBoundedNonBlankString(value: unknown, max: number): value is string {
236
281
  return typeof value === 'string' && value.trim().length > 0 && value.length <= max
237
282
  }
@@ -420,12 +465,21 @@ export function isJevDecisionPreset(value: unknown): value is JevDecisionPreset
420
465
  }
421
466
 
422
467
  /** Every canonical specialist except the orchestrator itself. */
423
- const SPECIALIST_CHOICES: ReadonlyArray<{ value: string }> = Object.freeze(
468
+ const SPECIALIST_CHOICES: ReadonlyArray<{ value: string; description?: string }> = Object.freeze(
424
469
  PANTHEON_AGENT_CATALOG.filter((agent) => agent.id !== 'zeus').map((agent) => ({
425
470
  value: agent.id,
471
+ description: boundedCatalogDescription(agent.description),
426
472
  })),
427
473
  )
428
474
 
475
+ /** Catalog descriptions are short; truncate defensively at the documented bound. */
476
+ function boundedCatalogDescription(value: unknown): string | undefined {
477
+ if (typeof value !== 'string' || value.trim() === '') return undefined
478
+ return value.length > JEV_DECISION_MAX_DESCRIPTION_LENGTH
479
+ ? `${value.slice(0, JEV_DECISION_MAX_DESCRIPTION_LENGTH - 1)}…`
480
+ : value
481
+ }
482
+
429
483
  const SKILL_DESCRIPTIONS = new Map(
430
484
  PANTHEON_SKILL_CATALOG.map((entry) => [entry.id, entry.description]),
431
485
  )
@@ -521,7 +575,10 @@ export function prepareJevPresetRequest(
521
575
  instructions:
522
576
  'Choose one listed specialist only when the described task clearly needs it; ' +
523
577
  'otherwise choose none. This is advisory only; nothing is dispatched.',
524
- choices: [...SPECIALIST_CHOICES, { value: 'none' }],
578
+ choices: [
579
+ ...SPECIALIST_CHOICES,
580
+ { value: 'none', description: 'No specialist fits the described task.' },
581
+ ],
525
582
  },
526
583
  ],
527
584
  } satisfies NativeDecisionRequest
@@ -529,6 +586,9 @@ export function prepareJevPresetRequest(
529
586
  }
530
587
 
531
588
  const shortlist = selectPantheonSkills(state).skillIds
589
+ const hostHasSkills = Array.isArray(hostSkills) && hostSkills.length > 0
590
+ const candidateSource: JevSkillCandidateSource =
591
+ shortlist.length > 0 ? 'prefilter' : hostHasSkills ? 'host-skills' : 'full-catalog'
532
592
  const pool = shortlist.length > 0 ? shortlist : CATALOG_SKILL_IDS
533
593
  const descriptions = new Map(PANTHEON_SKILL_CATALOG.map((entry) => [entry.id, entry.description]))
534
594
  const request = {
@@ -541,11 +601,14 @@ export function prepareJevPresetRequest(
541
601
  instructions:
542
602
  'Choose the skills worth stacking for the described task, or none when none apply. ' +
543
603
  'This is advisory only; nothing is loaded or executed by this decision.',
544
- choices: [...mergeHostSkills(pool, hostSkills, descriptions), { value: 'none' }],
604
+ choices: [
605
+ ...mergeHostSkills(pool, hostSkills, descriptions),
606
+ { value: 'none', description: 'No skill stack fits the described task.' },
607
+ ],
545
608
  },
546
609
  ],
547
610
  } satisfies NativeDecisionRequest
548
- return { ok: true, request: Object.freeze(request) }
611
+ return { ok: true, request: Object.freeze(request), candidateSource }
549
612
  }
550
613
  // ─── Response consumption ───────────────────────────────────────────────
551
614
 
@@ -356,7 +356,7 @@ export function encodeQualityScoreReason(input: {
356
356
  * ANY other key β€” `state`, `questions`, or a smuggled content field β€” refuses
357
357
  * the preparation, so no content slot exists even at the input boundary.
358
358
  */
359
- const REVIEW_ENVELOPE_KEYS: ReadonlySet<string> = new Set([
359
+ export const REVIEW_ENVELOPE_KEYS: ReadonlySet<string> = new Set([
360
360
  'schemaVersion',
361
361
  'mode',
362
362
  'delegateId',
@@ -54,8 +54,8 @@ import { NATIVE_DECISION_MAX_PROMPT_LENGTH } from './v2-native-decisions.ts'
54
54
 
55
55
  /** A ranking needs at least two candidates to choose between. */
56
56
  export const RANK_MIN_CANDIDATES = 2
57
- /** Above eight, ranking degrades to explicit questions with a real rubric. */
58
- export const RANK_MAX_CANDIDATES = 8
57
+ /** Mirrors the typesafe_rank reference contract (1-20 accepted upstream). */
58
+ export const RANK_MAX_CANDIDATES = 20
59
59
 
60
60
  /** Question name of the rank's choice question. */
61
61
  export const RANK_WINNER_QUESTION_NAME = 'winner'
@@ -164,7 +164,7 @@ function isRecord(value: unknown): value is Record<string, unknown> {
164
164
 
165
165
  // ─── Rank: request building ──────────────────────────────────────────────
166
166
 
167
- const RANK_ENVELOPE_KEYS: ReadonlySet<string> = new Set([
167
+ export const RANK_ENVELOPE_KEYS: ReadonlySet<string> = new Set([
168
168
  'schemaVersion',
169
169
  'mode',
170
170
  'state',
@@ -173,13 +173,24 @@ const RANK_ENVELOPE_KEYS: ReadonlySet<string> = new Set([
173
173
 
174
174
  export type JevRankBuildFailure = 'RANK_INPUT_INVALID' | 'CANDIDATE_INVALID' | 'STATE_INVALID'
175
175
 
176
+ /** Per-cause token attached to a rank build refusal (e.g. the accepted count range). */
177
+ export type JevRankBuildDetail = 'RANK_CANDIDATE_COUNT_RANGE'
178
+
176
179
  export type JevRankBuild =
177
180
  | { readonly ok: true; readonly request: Omit<NativeDecisionRequest, 'model'> }
178
- | { readonly ok: false; readonly reasonCode: JevRankBuildFailure }
181
+ | {
182
+ readonly ok: false
183
+ readonly reasonCode: JevRankBuildFailure
184
+ readonly detail?: JevRankBuildDetail
185
+ }
179
186
 
180
187
  export type JevRankPreparation =
181
188
  | { readonly ok: true; readonly request: NativeDecisionRequest }
182
- | { readonly ok: false; readonly reasonCode: JevRankBuildFailure }
189
+ | {
190
+ readonly ok: false
191
+ readonly reasonCode: JevRankBuildFailure
192
+ readonly detail?: JevRankBuildDetail
193
+ }
183
194
 
184
195
  /**
185
196
  * Validate the rank tool input and build the model-less request. The state is
@@ -205,7 +216,7 @@ export function buildJevRankRequest(input: unknown): JevRankBuild {
205
216
  if (rawCandidates === undefined) return { ok: false, reasonCode: 'RANK_INPUT_INVALID' }
206
217
  if (!Array.isArray(rawCandidates)) return { ok: false, reasonCode: 'CANDIDATE_INVALID' }
207
218
  if (rawCandidates.length < RANK_MIN_CANDIDATES || rawCandidates.length > RANK_MAX_CANDIDATES) {
208
- return { ok: false, reasonCode: 'CANDIDATE_INVALID' }
219
+ return { ok: false, reasonCode: 'CANDIDATE_INVALID', detail: 'RANK_CANDIDATE_COUNT_RANGE' }
209
220
  }
210
221
  const seen = new Set<string>()
211
222
  const choices: Array<{ value: string; description?: string }> = []
@@ -274,7 +285,11 @@ export function prepareJevRankRequest(
274
285
 
275
286
  // ─── Verify: request building ────────────────────────────────────────────
276
287
 
277
- const VERIFY_ENVELOPE_KEYS: ReadonlySet<string> = new Set(['schemaVersion', 'mode', 'claims'])
288
+ export const VERIFY_ENVELOPE_KEYS: ReadonlySet<string> = new Set([
289
+ 'schemaVersion',
290
+ 'mode',
291
+ 'claims',
292
+ ])
278
293
 
279
294
  export type JevVerifyBuildFailure = 'VERIFY_INPUT_INVALID' | 'CLAIM_INVALID'
280
295
 
@@ -32,6 +32,7 @@ export interface LocalDecisionInput {
32
32
 
33
33
  export type LocalDecisionRouteReasonCode =
34
34
  | 'DISABLED'
35
+ | 'GATE_OPEN'
35
36
  | 'INVALID_INPUT'
36
37
  | 'NO_DOMAIN'
37
38
  | 'AMBIGUOUS_DOMAIN'
@@ -192,6 +193,15 @@ function evaluateEnabledInput(input: unknown): LocalDecisionRecommendation {
192
193
  }
193
194
  }
194
195
 
196
+ // D1 (field report beta.11β†’12): gateStatus must influence the output. An
197
+ // open review/approval gate abstains β€” the advisory never routes around a
198
+ // gate; resolving the gate is the caller's move, then this router answers.
199
+ if (gateStatus === 'review_required' || gateStatus === 'human_approval_required') {
200
+ return {
201
+ ...createAbstention('GATE_OPEN', complexity.reasonCode, gateStatus),
202
+ complexity,
203
+ }
204
+ }
195
205
  return {
196
206
  schemaVersion: 1,
197
207
  policyVersion: LOCAL_DECISION_ROUTER_POLICY_VERSION,
@@ -53,7 +53,7 @@ export const PANTHEON_AGENT_CATALOG: readonly DecisionCatalogEntry[] = Object.fr
53
53
  { id: 'themis', description: 'Quality and security review gate.' },
54
54
  { id: 'prometheus', description: 'Infrastructure, Docker, CI, and model providers.' },
55
55
  { id: 'hephaestus', description: 'AI pipelines: LangChain, RAG, vector stores.' },
56
- { id: 'nyx', description: 'Observability, tracing, and cost analytics.' },
56
+ { id: 'nyx', description: 'Chaos and adversarial testing: fuzzing, hostile inputs, boundaries.' },
57
57
  { id: 'gaia', description: 'Remote sensing and geospatial analysis.' },
58
58
  { id: 'iris', description: 'GitHub branches, pull requests, issues, releases.' },
59
59
  { id: 'mnemosyne', description: 'Memory bank and ADR authoring on request.' },