pantheon-opencode 2.2.0-beta.1 → 2.2.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/AGENTS.global.md +2 -2
  2. package/AGENTS.md +1 -1
  3. package/CHANGELOG.md +38 -11
  4. package/README.md +13 -9
  5. package/README.pt-BR.md +13 -9
  6. package/bin/pantheon-init.mjs +1 -1
  7. package/commands/pantheon-audit.md +4 -5
  8. package/commands/pantheon-model.md +1 -2
  9. package/package.json +2 -2
  10. package/plugin.json +1 -1
  11. package/prompts/dynamic/agora-generated.txt +2 -2
  12. package/prompts/dynamic/orchestrate-generated.txt +4 -4
  13. package/prompts/sketch.prompt.md +1 -1
  14. package/pyproject.toml +1 -1
  15. package/scripts/build-agents-md.mjs +73 -12
  16. package/scripts/build-plugin.mjs +2 -0
  17. package/scripts/hooks/format-multi-language.sh +30 -29
  18. package/scripts/prune.mjs +124 -2
  19. package/scripts/setup.mjs +1 -1
  20. package/scripts/themis_heuristic_scan.py +3 -5
  21. package/skills-lock.json +1 -1
  22. package/src/agents/aphrodite.md +1 -1
  23. package/src/agents/athena.md +6 -14
  24. package/src/agents/demeter.md +1 -1
  25. package/src/agents/hermes.md +3 -2
  26. package/src/agents/iris.md +4 -6
  27. package/src/agents/prometheus.md +3 -7
  28. package/src/agents/roster.json +13 -8
  29. package/src/agents/zeus.md +3 -0
  30. package/src/instructions/agent-return-format.instructions.md +1 -1
  31. package/src/instructions/zeus-anti-stall.instructions.md +11 -35
  32. package/src/instructions/zeus-council-synthesis.instructions.md +17 -49
  33. package/src/instructions/zeus-timeout-retry.instructions.md +12 -80
  34. package/src/mcp/mcp_codemap_module.py +6 -5
  35. package/src/mcp/pantheon-mcp-server.mjs +515 -148
  36. package/src/pantheon/agent-forge-tool.ts +316 -0
  37. package/src/pantheon/auto-permissions.ts +31 -1
  38. package/src/pantheon/codemap-tools.ts +525 -0
  39. package/src/pantheon/deepwork/plan-tracker.ts +63 -2
  40. package/src/pantheon/execute-after.ts +21 -0
  41. package/src/pantheon/hook-engine.ts +2 -1
  42. package/src/pantheon/native-memory-tools.ts +686 -0
  43. package/src/pantheon/presets.mjs +15 -0
  44. package/src/pantheon/step-ledger.ts +259 -0
  45. package/src/pantheon/swe-eval-harness.ts +211 -0
  46. package/src/pantheon/tools.ts +62 -7
  47. package/src/plugin/index.js +2980 -9462
  48. package/src/plugin/index.ts +2 -43
  49. package/src/plugin.ts +116 -10
  50. package/src/plugins/tui/dist/tui.js +90 -26
  51. package/src/plugins/tui/dist/tui.js.map +1 -1
  52. package/src/plugins/tui/package-lock.json +2 -2
  53. package/src/plugins/tui/package.json +1 -1
  54. package/src/plugins/tui/src/index.tsx +1 -1
  55. package/src/plugins/tui/src/pantheon-settings.tsx +25 -12
  56. package/src/plugins/tui/src/quota-state.ts +71 -9
  57. package/src/plugins/tui/src/tui-prefs.ts +8 -0
  58. package/src/routing.yml +3 -0
  59. package/src/skills/auto-continue/references/auto-continue-details.md +2 -31
  60. /package/scripts/{setup-v2-config.mjs → setup-config.mjs} +0 -0
@@ -1,49 +1,8 @@
1
1
  /**
2
- * Pantheon V2 unified plugin entry point.
3
- *
4
- * When loaded in OpenCode TUI mode (where context.ui.slot exists),
5
- * it mounts the Pantheon TUI sidebar, status and dispatch views.
6
- * When loaded in OpenCode Server mode, it registers Pantheon tools,
7
- * hooks, and permissions.
2
+ * Pantheon V2 plugin — directory entry for the OpenCode V2 loader.
8
3
  *
9
4
  * @module plugin/index
10
5
  */
11
6
 
12
- import serverPlugin from '../plugin.ts'
13
-
14
7
  export * from '../plugin.ts'
15
-
16
- type MaybePlugin = {
17
- setup?: (context: unknown) => unknown
18
- }
19
-
20
- export async function setupUnified(context: unknown): Promise<unknown> {
21
- const ctx = context as Record<string, unknown> | undefined
22
- if (ctx?.ui && typeof (ctx.ui as { slot?: unknown }).slot === 'function') {
23
- try {
24
- const tuiMod = await import('../plugins/tui/dist/tui.js')
25
- const tui = (tuiMod.default || tuiMod) as MaybePlugin | ((c: unknown) => unknown)
26
- if (typeof tui === 'function') return tui(context)
27
- if (typeof tui?.setup === 'function') return tui.setup(context)
28
- } catch {
29
- /* TUI bundle unavailable or failed to load */
30
- }
31
- }
32
- const srv = serverPlugin as MaybePlugin | ((c: unknown) => unknown)
33
- if (typeof srv === 'function') return srv(context)
34
- if (typeof srv?.setup === 'function') {
35
- return srv.setup(context)
36
- }
37
- }
38
-
39
- export const unifiedPlugin = Object.assign(
40
- async function pantheonPlugin(context: unknown) {
41
- return setupUnified(context)
42
- },
43
- {
44
- id: 'pantheon-opencode',
45
- setup: setupUnified,
46
- },
47
- )
48
-
49
- export default unifiedPlugin
8
+ export { default } from '../plugin.ts'
package/src/plugin.ts CHANGED
@@ -170,6 +170,7 @@ import { applyDecisionRouterToPrompt } from './pantheon/local-decision-prompt.ts
170
170
  import { applyV2ModelOverrides, readV2ModelConfiguration } from './pantheon/model-overrides.ts'
171
171
  import type { NativeDecisionRequest } from './pantheon/native-decisions.ts'
172
172
  import { buildV2VisionPromptContext, type V2VisionRuntime } from './pantheon/native-vision.ts'
173
+ import { buildPrefixCachedPrompt } from './pantheon/prompt-cache-order.ts'
173
174
  import { getSharedBoard } from './pantheon/shared-board.ts'
174
175
  import { createV2ShellHooks, type V2ShellRunner } from './pantheon/shell-hooks.ts'
175
176
  import {
@@ -438,15 +439,13 @@ function loadRuntimeOverrides(): void {
438
439
  if (runtimeOverridesLoaded) return
439
440
  runtimeOverridesLoaded = true
440
441
  try {
441
- const read = (path: string): string | undefined => {
442
- const fs = require('node:fs') as typeof import('node:fs')
442
+ const read = (filePath: string): string | undefined => {
443
443
  try {
444
- return fs.readFileSync(path, 'utf8')
444
+ return readFileSync(filePath, 'utf8')
445
445
  } catch {
446
446
  return undefined
447
447
  }
448
448
  }
449
- const path = require('node:path') as typeof import('node:path')
450
449
  const globalRaw = read(path.join(resolveGlobalOverrideDir(), 'pantheon-overrides.json'))
451
450
  const projectRaw = read(path.join(process.cwd(), '.pantheon', 'overrides.json'))
452
451
  runtimeOverrides = mergeOverrides(globalRaw, projectRaw).entries
@@ -589,8 +588,10 @@ function transformAgents(draft: AgentDraft): void {
589
588
  markUnsupported('agent-transform-list')
590
589
  return
591
590
  }
591
+ let configuredOverrides: Record<string, { model: string; variant?: string }> = {}
592
592
  try {
593
593
  const modelConfiguration = readV2ModelConfiguration()
594
+ configuredOverrides = modelConfiguration.overrides
594
595
  if (modelConfiguration.warnings.length > 0) {
595
596
  // The V2 server PluginContext has no documented user-visible notification
596
597
  // or logging channel; preserve the degradation for status diagnostics.
@@ -620,8 +621,15 @@ function transformAgents(draft: AgentDraft): void {
620
621
  current.description = def.description ?? ''
621
622
  current.mode = id === 'zeus' ? 'primary' : (def.mode ?? 'subagent')
622
623
  if (def.temperature !== undefined) current.temperature = def.temperature
624
+ const override = configuredOverrides[id]
625
+ if (override?.model) {
626
+ current.model = override.model
627
+ if (override.variant !== undefined) current.variant = override.variant
628
+ }
623
629
  const body = typeof def.body === 'string' ? def.body.trim() : ''
624
- current.system = body ? `${body}\n\n${POLICY}` : POLICY
630
+ current.system = body
631
+ ? buildPrefixCachedPrompt({ identity: body, currentTurn: POLICY }).prompt
632
+ : POLICY
625
633
  })
626
634
  } catch {
627
635
  /* fail-open */
@@ -666,7 +674,63 @@ function transformAgents(draft: AgentDraft): void {
666
674
  }
667
675
  }
668
676
 
677
+ const CANONICAL_SLASH_COMMANDS: ReadonlyArray<{ name: string; description: string }> = [
678
+ {
679
+ name: 'pantheon',
680
+ description: 'Dispatch inline multi-specialist Council synthesis for architectural trade-offs',
681
+ },
682
+ {
683
+ name: 'pantheon-deepwork',
684
+ description: 'Execute multi-phase Deepwork plan with DAG checkpoints and verification gates',
685
+ },
686
+ {
687
+ name: 'pantheon-audit',
688
+ description: 'Run zero-token heuristic static scan and Themis 3-layer security review',
689
+ },
690
+ {
691
+ name: 'pantheon-focus',
692
+ description: 'Manage persistent session goals and focus boundaries across compactions',
693
+ },
694
+ {
695
+ name: 'pantheon-model',
696
+ description: 'Inspect or configure per-agent model overrides in active-preset.json',
697
+ },
698
+ {
699
+ name: 'pantheon-optimize',
700
+ description: 'Analyze and prune stale artifacts, worktrees, and context overhead',
701
+ },
702
+ {
703
+ name: 'pantheon-settings',
704
+ description: 'Open the interactive Pantheon TUI settings and Quotas & Spend window',
705
+ },
706
+ {
707
+ name: 'pantheon-vision',
708
+ description: 'Inspect or configure multimodal vision gateway and model status',
709
+ },
710
+ ]
711
+
669
712
  function transformCommands(draft: CommandDraft): void {
713
+ // OpenCode 2.2+ CommandEditor exposes `draft.add(definition)` to register
714
+ // slash commands directly from the plugin (single-command install support).
715
+ try {
716
+ const maybeAdd = (draft as unknown as { add?: (def: unknown) => void }).add
717
+ if (typeof maybeAdd === 'function') {
718
+ for (const cmd of CANONICAL_SLASH_COMMANDS) {
719
+ try {
720
+ maybeAdd.call(draft, {
721
+ name: cmd.name,
722
+ description: cmd.description,
723
+ execute: async () => {},
724
+ })
725
+ } catch {
726
+ /* ignore duplicate command registration */
727
+ }
728
+ }
729
+ }
730
+ } catch {
731
+ /* optional 2.2+ command registration */
732
+ }
733
+
670
734
  // Beta 19192 guard (issue #92): draft may not have `list`, or list()
671
735
  // may return a non-iterable. Never throw — mark unsupported and return.
672
736
  let commands: Iterable<{ name: string }>
@@ -703,9 +767,11 @@ function transformCommands(draft: CommandDraft): void {
703
767
  }
704
768
 
705
769
  function transformReferences(draft: ReferenceDraft): void {
770
+ const globalAgentsPath = fileURLToPath(new URL('../AGENTS.global.md', import.meta.url))
771
+ const fallbackAgentsPath = fileURLToPath(new URL('../AGENTS.md', import.meta.url))
706
772
  draft.add('pantheon-agents', {
707
773
  type: 'local',
708
- path: fileURLToPath(new URL('../AGENTS.md', import.meta.url)),
774
+ path: existsSync(globalAgentsPath) ? globalAgentsPath : fallbackAgentsPath,
709
775
  description: 'Pantheon agent and execution policy',
710
776
  })
711
777
  }
@@ -1095,17 +1161,24 @@ function subscribeV2Events(
1095
1161
  // `session.compacted` 0/11 (PROBE-C, F-12). The live turn-end signal
1096
1162
  // is `session.execution.succeeded`, observed above. The branches are
1097
1163
  // left untouched on purpose; removing them is a separate change.
1098
- if (event.type === 'session.idle' || event.type === 'session.deleted') {
1164
+ if (
1165
+ event.type === 'session.idle' ||
1166
+ event.type === 'session.deleted' ||
1167
+ event.type === 'session.execution.succeeded'
1168
+ ) {
1099
1169
  const properties = event.properties ?? {}
1170
+ const data = (event as { data?: Record<string, unknown> }).data ?? {}
1100
1171
  const info = properties.info
1101
1172
  const infoID =
1102
1173
  info !== null && typeof info === 'object' ? (info as { id?: unknown }).id : undefined
1103
1174
  const sessionID =
1104
1175
  typeof properties.sessionID === 'string'
1105
1176
  ? properties.sessionID
1106
- : typeof infoID === 'string'
1107
- ? infoID
1108
- : undefined
1177
+ : typeof data.sessionID === 'string'
1178
+ ? data.sessionID
1179
+ : typeof infoID === 'string'
1180
+ ? infoID
1181
+ : undefined
1109
1182
  if (sessionID) onTurnEnd?.(sessionID)
1110
1183
  }
1111
1184
  }
@@ -1128,15 +1201,19 @@ async function handleV2SessionEvent(event: V2SessionEvent): Promise<void> {
1128
1201
  await onSessionCreated(event)
1129
1202
  break
1130
1203
  case 'session.idle':
1204
+ case 'session.execution.succeeded':
1131
1205
  await onSessionIdle(event)
1132
1206
  break
1133
1207
  case 'session.deleted':
1134
1208
  await onSessionDeleted(event)
1135
1209
  break
1136
1210
  case 'session.error':
1211
+ case 'session.execution.failed':
1212
+ case 'session.step.failed':
1137
1213
  await onSessionError(event)
1138
1214
  break
1139
1215
  case 'session.compacted':
1216
+ case 'session.compaction.ended':
1140
1217
  await onSessionCompacted(event)
1141
1218
  break
1142
1219
  default:
@@ -1549,6 +1626,29 @@ async function registerV2SessionHooks(context: PluginContext): Promise<boolean>
1549
1626
  // never consults provider consent/credentials or invokes remote egress.
1550
1627
  await applyDecisionRouterToPrompt(admission, userRequest)
1551
1628
 
1629
+ // When the OpenCode 2.2+ host exposes keyed session instructions,
1630
+ // publish the Pantheon policy marker via `instructions.entry.put`
1631
+ // so it stays KV-cache friendly.
1632
+ try {
1633
+ const sid = (admission as { sessionID?: unknown } | null)?.sessionID
1634
+ const instrEntry = (
1635
+ sessionCtx as unknown as {
1636
+ instructions?: {
1637
+ entry?: { put?: (arg: { sessionID: string; key: string; text: string }) => unknown }
1638
+ }
1639
+ }
1640
+ ).instructions?.entry
1641
+ if (typeof sid === 'string' && typeof instrEntry?.put === 'function') {
1642
+ await instrEntry.put({
1643
+ sessionID: sid,
1644
+ key: 'pantheon.policy',
1645
+ text: POLICY,
1646
+ })
1647
+ }
1648
+ } catch {
1649
+ /* optional host capability */
1650
+ }
1651
+
1552
1652
  // Shadow observation only. The projection carries `prompt.agents` and
1553
1653
  // `prompt.skills` and nothing else, so no prompt text or file bytes
1554
1654
  // reach a record; observeShadow clones and freezes it, so admission is
@@ -3015,4 +3115,10 @@ export function getUnsupportedFeatures(): readonly string[] {
3015
3115
  return V2_UNSUPPORTED_FEATURES
3016
3116
  }
3017
3117
 
3118
+ export const UNSUPPORTED_FEATURES = V2_UNSUPPORTED_FEATURES
3119
+ export const disposePlugin = v2Dispose
3120
+ export const resetIdleEnforcerForTests = resetV2IdleEnforcerForTests
3121
+ export const setSecretScanRunnerForTests = setV2SecretScanRunnerForTests
3122
+ export const setShellRunnerForTests = setV2ShellRunnerForTests
3123
+
3018
3124
  export default plugin
@@ -1358,7 +1358,60 @@ function buildPresetTab(input, languagePref) {
1358
1358
  }
1359
1359
  //#endregion
1360
1360
  //#region src/quota-state.ts
1361
- function buildQuotaTab(snapshot, languagePref) {
1361
+ /**
1362
+ * quota-state.ts — the Quotas & Spend tab (inspired by opencode-quota).
1363
+ *
1364
+ * Exposes live model token spending, daily budgets, rate-limits per provider,
1365
+ * and context token telemetry in a dedicated tab in the Pantheon Settings window.
1366
+ */
1367
+ const DEFAULT_QUOTA_PREFS = {
1368
+ sessionCap: "$5.00",
1369
+ alertThreshold: "enabled",
1370
+ autoCompact: "enabled"
1371
+ };
1372
+ function resolveQuotaPrefsPath() {
1373
+ const xdg = process.env.XDG_CONFIG_HOME;
1374
+ const base = xdg?.startsWith("/") ? xdg : join(homedir(), ".config");
1375
+ return join(base, "opencode", "pantheon-quota.json");
1376
+ }
1377
+ function readQuotaPrefs(filePath = resolveQuotaPrefsPath()) {
1378
+ try {
1379
+ if (!existsSync(filePath)) return { ...DEFAULT_QUOTA_PREFS };
1380
+ const raw = JSON.parse(readFileSync(filePath, "utf8"));
1381
+ return {
1382
+ sessionCap: typeof raw.sessionCap === "string" && [
1383
+ "$1.00",
1384
+ "$2.00",
1385
+ "$5.00",
1386
+ "$10.00",
1387
+ "unlimited"
1388
+ ].includes(raw.sessionCap) ? raw.sessionCap : DEFAULT_QUOTA_PREFS.sessionCap,
1389
+ alertThreshold: raw.alertThreshold === "disabled" ? "disabled" : "enabled",
1390
+ autoCompact: raw.autoCompact === "disabled" ? "disabled" : "enabled"
1391
+ };
1392
+ } catch {
1393
+ return { ...DEFAULT_QUOTA_PREFS };
1394
+ }
1395
+ }
1396
+ function writeQuotaPrefs(prefs, filePath = resolveQuotaPrefsPath()) {
1397
+ mkdirSync(dirname(filePath), { recursive: true });
1398
+ writeFileSync(filePath, `${JSON.stringify(prefs, null, 2)}\n`, "utf8");
1399
+ }
1400
+ function applyQuotaRow(prefs, id, value) {
1401
+ const next = { ...prefs };
1402
+ if (id === "quota.budget.sessionCap") {
1403
+ if ([
1404
+ "$1.00",
1405
+ "$2.00",
1406
+ "$5.00",
1407
+ "$10.00",
1408
+ "unlimited"
1409
+ ].includes(value)) next.sessionCap = value;
1410
+ } else if (id === "quota.budget.alertThreshold") next.alertThreshold = value === "disabled" ? "disabled" : "enabled";
1411
+ else if (id === "quota.compaction.auto") next.autoCompact = value === "disabled" ? "disabled" : "enabled";
1412
+ return next;
1413
+ }
1414
+ function buildQuotaTab(snapshot, languagePref, prefs = readQuotaPrefs()) {
1362
1415
  const isPt = resolveLanguage(languagePref) === "pt-BR";
1363
1416
  return {
1364
1417
  id: "quota",
@@ -1370,31 +1423,31 @@ function buildQuotaTab(snapshot, languagePref) {
1370
1423
  {
1371
1424
  id: "quota.spend.today",
1372
1425
  name: isPt ? "Gasto hoje (00h-agora)" : "Spend today (00h-now)",
1373
- value: snapshot?.todaySpend ?? "$0.00",
1426
+ value: snapshot?.todaySpend ?? "—",
1374
1427
  note: isPt ? "Calculado a partir de opencode.db" : "Derived from opencode.db ledger"
1375
1428
  },
1376
1429
  {
1377
1430
  id: "quota.spend.month",
1378
1431
  name: isPt ? "Gasto acumulado (30d)" : "Spend last 30 days",
1379
- value: snapshot?.monthSpend ?? "$0.00",
1432
+ value: snapshot?.monthSpend ?? "—",
1380
1433
  note: isPt ? "Janela móvel de 30 dias" : "Rolling 30-day window"
1381
1434
  },
1382
1435
  {
1383
1436
  id: "quota.spend.session",
1384
1437
  name: isPt ? "Gasto na sessão ativa" : "Active session spend",
1385
- value: snapshot?.sessionSpend ?? "$0.00",
1438
+ value: snapshot?.sessionSpend ?? "—",
1386
1439
  note: isPt ? "Custo de todas as mensagens do turno" : "Sum of turn assistant messages"
1387
1440
  },
1388
1441
  {
1389
1442
  id: "quota.tokens.context",
1390
1443
  name: isPt ? "Tokens de contexto" : "Context tokens",
1391
- value: snapshot?.sessionTokens ?? "19.1k / 1.0M (2%)",
1444
+ value: snapshot?.sessionTokens ?? "—",
1392
1445
  note: isPt ? "Tokens consumidos vs janela do modelo" : "Tokens used vs model context limit"
1393
1446
  },
1394
1447
  {
1395
1448
  id: "quota.tokens.cache",
1396
1449
  name: isPt ? "Eficiência de cache" : "Prompt cache hit",
1397
- value: snapshot?.cacheHit ?? "97%",
1450
+ value: snapshot?.cacheHit ?? "—",
1398
1451
  note: isPt ? "Desconto de leitura em cache aplicado" : "Cache read discount applied"
1399
1452
  }
1400
1453
  ]
@@ -1405,7 +1458,7 @@ function buildQuotaTab(snapshot, languagePref) {
1405
1458
  {
1406
1459
  id: "quota.budget.sessionCap",
1407
1460
  name: isPt ? "Teto por sessão" : "Session budget cap",
1408
- value: "$5.00",
1461
+ value: prefs.sessionCap,
1409
1462
  cycle: [
1410
1463
  "$1.00",
1411
1464
  "$2.00",
@@ -1418,14 +1471,14 @@ function buildQuotaTab(snapshot, languagePref) {
1418
1471
  {
1419
1472
  id: "quota.budget.alertThreshold",
1420
1473
  name: isPt ? "Alerta em 80% do teto" : "Alert at 80% of cap",
1421
- value: "enabled",
1474
+ value: prefs.alertThreshold,
1422
1475
  cycle: ["enabled", "disabled"],
1423
1476
  note: isPt ? "Emite aviso visual no footer da TUI" : "Shows visual notice in TUI footer"
1424
1477
  },
1425
1478
  {
1426
1479
  id: "quota.compaction.auto",
1427
1480
  name: isPt ? "Auto-compactar em 80% do contexto" : "Auto-compact at 80% context",
1428
- value: "enabled",
1481
+ value: prefs.autoCompact,
1429
1482
  cycle: ["enabled", "disabled"],
1430
1483
  note: isPt ? "Aciona compressão automática de histórico" : "Triggers automatic context compaction"
1431
1484
  }
@@ -1515,8 +1568,10 @@ function previewTuiPrefs(base, draft) {
1515
1568
  const effective = {
1516
1569
  version: 1,
1517
1570
  layout: { ...normalized.layout },
1571
+ ...normalized.theme ? { theme: { ...normalized.theme } } : {},
1518
1572
  sidebar: {
1519
1573
  header: { ...normalized.sidebar.header },
1574
+ ...normalized.sidebar.pinnedSessions ? { pinnedSessions: [...normalized.sidebar.pinnedSessions] } : {},
1520
1575
  blocks: { ...normalized.sidebar.blocks },
1521
1576
  context: { ...normalized.sidebar.context }
1522
1577
  },
@@ -2008,6 +2063,8 @@ function tuiRowValue(prefs, id) {
2008
2063
  case "tui.sidebar.context.modelUsage": return prefs.sidebar.context.modelUsage;
2009
2064
  case "tui.sidebar.context.performance": return prefs.sidebar.context.performance;
2010
2065
  case "tui.sidebar.context.localSpend": return prefs.sidebar.context.localSpend;
2066
+ case "tui.sidebar.context.turnCost": return prefs.sidebar.context.turnCost;
2067
+ case "tui.sidebar.context.tokenAnatomy": return prefs.sidebar.context.tokenAnatomy;
2011
2068
  case "tui.footer.prompt": return prefs.footer.prompt;
2012
2069
  case "tui.footer.home": return prefs.footer.home;
2013
2070
  default: return;
@@ -2277,7 +2334,7 @@ async function readChangelogForBundle(bundleUrl) {
2277
2334
  }
2278
2335
  /** The ambient build-time version, or null outside a tsdown build. */
2279
2336
  function embeddedVersion() {
2280
- return "2.2.0-beta.1";
2337
+ return "2.2.0-beta.2";
2281
2338
  }
2282
2339
  /**
2283
2340
  * Resolve the running Pantheon version for the what's-new window: the plugin
@@ -2502,7 +2559,7 @@ function persistUpdateCheckState(previous, latest) {
2502
2559
  } catch {}
2503
2560
  }
2504
2561
  function resolveRunningVersion() {
2505
- return "2.2.0-beta.1";
2562
+ return "2.2.0-beta.2";
2506
2563
  }
2507
2564
  const VALUE_WIDTH = 24;
2508
2565
  function SettingsWindow(props) {
@@ -2987,7 +3044,7 @@ function createWindowController(context, exit) {
2987
3044
  buildGatesTab(load(), lang),
2988
3045
  buildDecisionTab(decision(), process.env, readAuthProviders(), readConfigProviders(), lang),
2989
3046
  buildPresetTab(presetInput(), lang),
2990
- buildQuotaTab(void 0, lang),
3047
+ buildQuotaTab(void 0, lang, readQuotaPrefs()),
2991
3048
  buildTuiTab(tuiPrefs(), lang),
2992
3049
  buildAutonomyTab({
2993
3050
  goalLoop: goalLoop(),
@@ -2995,7 +3052,7 @@ function createWindowController(context, exit) {
2995
3052
  goalLoopRestartPending: autonomyRestartPending(),
2996
3053
  languagePref: lang
2997
3054
  }),
2998
- buildJ1Tab(process.env, false, lang),
3055
+ buildJ1Tab(process.env, isBehaviorDisabled(mergedOverrides(load()), "gate-j1-risk-gate"), lang),
2999
3056
  buildUpdatesTab({
3000
3057
  ...updatesInput(),
3001
3058
  languagePref: lang
@@ -3237,7 +3294,15 @@ function createWindowController(context, exit) {
3237
3294
  reason: "tui prefs storage unavailable"
3238
3295
  };
3239
3296
  }
3240
- if (id.startsWith("quota.")) return { ok: true };
3297
+ if (id.startsWith("quota.")) try {
3298
+ writeQuotaPrefs(applyQuotaRow(readQuotaPrefs(), id, value));
3299
+ return { ok: true };
3300
+ } catch {
3301
+ return {
3302
+ ok: false,
3303
+ reason: "quota prefs disk write failed"
3304
+ };
3305
+ }
3241
3306
  return {
3242
3307
  ok: false,
3243
3308
  reason: "unknown staged row"
@@ -3392,7 +3457,7 @@ function SettingsPage(props) {
3392
3457
  const context = props.context;
3393
3458
  const controller = createWindowController(context, () => navigateBack(context, returnRoute !== void 0 ? { returnRoute } : {}));
3394
3459
  const theme = context.theme?.text ?? {};
3395
- const accent = () => resolveAccentColor(tuiDraftPreview()?.theme?.accent ?? tuiPrefs().theme?.accent, context.theme);
3460
+ const accent = () => resolveAccentColor(tuiPrefs().theme?.accent, context.theme);
3396
3461
  const warn = () => accent();
3397
3462
  try {
3398
3463
  const popMode = context.keymap?.mode?.push?.(ROUTE_MODE);
@@ -3485,7 +3550,7 @@ let dialogDismiss = () => {};
3485
3550
  function openSettingsDialog(context) {
3486
3551
  const controller = createWindowController(context, () => dialogDismiss());
3487
3552
  const theme = context.theme?.text ?? {};
3488
- const accent = () => resolveAccentColor(tuiDraftPreview()?.theme?.accent ?? tuiPrefs().theme?.accent, context.theme);
3553
+ const accent = () => resolveAccentColor(tuiPrefs().theme?.accent, context.theme);
3489
3554
  const warn = () => accent();
3490
3555
  controller.cleanup = () => {
3491
3556
  pageApi = void 0;
@@ -3648,7 +3713,7 @@ function InSessionSettingsWindow(props) {
3648
3713
  onCleanup(controller.cleanup);
3649
3714
  pageApi = controller.api;
3650
3715
  const theme = context.theme?.text ?? {};
3651
- const accent = () => resolveAccentColor(tuiDraftPreview()?.theme?.accent ?? tuiPrefs().theme?.accent, context.theme);
3716
+ const accent = () => resolveAccentColor(tuiPrefs().theme?.accent, context.theme);
3652
3717
  const warn = () => accent();
3653
3718
  return createComponent(SettingsWindow, {
3654
3719
  boxRef: (el) => {
@@ -3714,11 +3779,10 @@ function setupPantheonSettings(context, options) {
3714
3779
  try {
3715
3780
  context.ui.router?.register?.({
3716
3781
  name: ROUTE_NAME,
3717
- render: ({ data }) => createComponent(SettingsPage, {
3782
+ render: ({ data }) => createComponent(SettingsPage, mergeProps({
3718
3783
  context,
3719
- data,
3720
- renderSidebar: registeredSidebarRenderer
3721
- })
3784
+ data
3785
+ }, registeredSidebarRenderer ? { renderSidebar: registeredSidebarRenderer } : {}))
3722
3786
  });
3723
3787
  routerAvailable = true;
3724
3788
  } catch {
@@ -5207,7 +5271,7 @@ function resolveGateStatus(env = process.env) {
5207
5271
  if (mode === "enforce") return "✓ Gate: enforce";
5208
5272
  if (mode === "warn") return "✓ Gate: warn";
5209
5273
  if (mode === "shadow" || mode === "1" || mode === "true" || mode === "on") return "✓ Gate: active";
5210
- return "✓ Gate: tests pass";
5274
+ return "✓ Gate: shadow";
5211
5275
  }
5212
5276
  /** Column widths for one model row (labels are muted, numbers right-aligned). */
5213
5277
  const MODEL_USAGE_MODEL_WIDTH = 12;
@@ -6966,7 +7030,7 @@ async function checkForPantheonUpdate(context) {
6966
7030
  const latest = String((await response.json())?.version ?? "");
6967
7031
  if (!latest) return;
6968
7032
  const notice = pickUpdateNotice({
6969
- currentVersion: "2.2.0-beta.1",
7033
+ currentVersion: "2.2.0-beta.2",
6970
7034
  latestVersion: latest,
6971
7035
  state: readState(),
6972
7036
  nowMs: Date.now()
@@ -7794,7 +7858,7 @@ function Sidebar(props) {
7794
7858
  setProp(_el$13, "paddingLeft", 1);
7795
7859
  setProp(_el$13, "paddingRight", 1);
7796
7860
  setProp(_el$14, "attributes", 1);
7797
- insert(_el$14, `Pantheon v2.2.0-beta.1`);
7861
+ insert(_el$14, `Pantheon v2.2.0-beta.2`);
7798
7862
  insert(_el$15, () => `Erro no painel: ${err?.message ?? "desconhecido"}`);
7799
7863
  effect((_p$) => {
7800
7864
  var _v$3 = text(), _v$4 = muted();
@@ -7865,7 +7929,7 @@ function SidebarInner(props) {
7865
7929
  get children() {
7866
7930
  var _el$18 = createElement("text");
7867
7931
  setProp(_el$18, "attributes", 1);
7868
- insert(_el$18, `Pantheon v2.2.0-beta.1`);
7932
+ insert(_el$18, `Pantheon v2.2.0-beta.2`);
7869
7933
  effect((_$p) => setProp(_el$18, "fg", text(), _$p));
7870
7934
  return _el$18;
7871
7935
  }
@@ -8848,7 +8912,7 @@ function HomeStatus(props) {
8848
8912
  },
8849
8913
  get children() {
8850
8914
  var _el$120 = createElement("text");
8851
- insert(_el$120, () => `Pantheon v2.2.0-beta.1${preset().name ? ` ▸ ${preset().name}` : ""}`);
8915
+ insert(_el$120, () => `Pantheon v2.2.0-beta.2${preset().name ? ` ▸ ${preset().name}` : ""}`);
8852
8916
  effect((_$p) => setProp(_el$120, "fg", muted(), _$p));
8853
8917
  return _el$120;
8854
8918
  }