pantheon-opencode 2.0.0-beta.6 → 2.0.0

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 (93) hide show
  1. package/AGENTS.global.md +7 -2
  2. package/AGENTS.md +8 -8
  3. package/CHANGELOG.md +99 -0
  4. package/README.md +171 -510
  5. package/README.pt-BR.md +179 -149
  6. package/bin/pantheon-init.mjs +14 -1
  7. package/commands/pantheon-audit.md +1 -1
  8. package/commands/pantheon-deepwork.md +7 -2
  9. package/commands/pantheon-optimize.md +41 -63
  10. package/commands/pantheon.md +10 -5
  11. package/package.json +4 -3
  12. package/plugin.json +2 -2
  13. package/prompts/optimize-database.prompt.md +5 -5
  14. package/prompts/orchestrate-with-zeus.prompt.md +82 -290
  15. package/prompts/plan-architecture.prompt.md +6 -6
  16. package/prompts/subtask.prompt.md +1 -1
  17. package/pyproject.toml +1 -1
  18. package/scripts/build-agents-md.mjs +10 -10
  19. package/scripts/build-plugin.mjs +26 -0
  20. package/scripts/doctor.mjs +27 -11
  21. package/scripts/hooks/format-multi-language.sh +30 -48
  22. package/scripts/install/opencode-version.mjs +17 -5
  23. package/scripts/install/opencode.mjs +8 -1
  24. package/scripts/jev-live-probe.mjs +1 -1
  25. package/scripts/optimize.mjs +322 -0
  26. package/scripts/prune.mjs +105 -14
  27. package/scripts/release-gates.mjs +19 -5
  28. package/scripts/skill-search.mjs +27 -3
  29. package/scripts/test-opencode-sandbox.sh +44 -15
  30. package/scripts/update.mjs +29 -17
  31. package/skills-lock.json +15 -13
  32. package/src/agents/aphrodite.md +17 -14
  33. package/src/agents/apollo.md +10 -207
  34. package/src/agents/athena.md +30 -34
  35. package/src/agents/demeter.md +2 -0
  36. package/src/agents/hephaestus.md +1 -0
  37. package/src/agents/hermes.md +21 -95
  38. package/src/agents/iris.md +3 -0
  39. package/src/agents/mnemosyne.md +1 -1
  40. package/src/agents/nyx.md +2 -1
  41. package/src/agents/prometheus.md +2 -203
  42. package/src/agents/talos.md +5 -0
  43. package/src/agents/themis.md +93 -84
  44. package/src/agents/zeus.md +44 -263
  45. package/src/instructions/agent-return-format.instructions.md +1 -1
  46. package/src/instructions/memory-protocol.instructions.md +5 -1
  47. package/src/instructions/test-economy.instructions.md +1 -0
  48. package/src/instructions/zeus-anti-stall.instructions.md +3 -3
  49. package/src/instructions/zeus-communication-rules.instructions.md +1 -1
  50. package/src/instructions/zeus-council-synthesis.instructions.md +15 -3
  51. package/src/instructions/zeus-timeout-retry.instructions.md +10 -10
  52. package/src/pantheon/model-command.ts +12 -12
  53. package/src/pantheon/pantheon-decision-catalog.ts +8 -0
  54. package/src/pantheon/skill-search-tool.ts +193 -0
  55. package/src/pantheon/tools.ts +6 -0
  56. package/src/pantheon/tui-version-check.ts +1 -1
  57. package/src/pantheon/update-notifier.ts +13 -8
  58. package/src/pantheon/vision.ts +20 -20
  59. package/src/plugin/index.js +14594 -0
  60. package/src/plugins/tui/dist/tui.d.ts +15 -5
  61. package/src/plugins/tui/dist/tui.d.ts.map +1 -1
  62. package/src/plugins/tui/dist/tui.js +1761 -556
  63. package/src/plugins/tui/dist/tui.js.map +1 -1
  64. package/src/plugins/tui/package-lock.json +2 -2
  65. package/src/plugins/tui/package.json +1 -1
  66. package/src/plugins/tui/src/autonomy-state.ts +28 -16
  67. package/src/plugins/tui/src/context-gauge.ts +64 -5
  68. package/src/plugins/tui/src/decision-router-state.ts +49 -2
  69. package/src/plugins/tui/src/index.tsx +69 -26
  70. package/src/plugins/tui/src/pantheon-settings-state.ts +99 -0
  71. package/src/plugins/tui/src/pantheon-settings.tsx +771 -125
  72. package/src/plugins/tui/src/tui-prefs.ts +266 -12
  73. package/src/plugins/tui/src/update-notice.ts +9 -6
  74. package/src/plugins/tui/src/update-status.ts +27 -8
  75. package/src/plugins/tui/src/whats-new-open.ts +4 -4
  76. package/src/plugins/tui/src/whats-new.tsx +119 -17
  77. package/src/routing.yml +9 -0
  78. package/src/skills/README.md +35 -25
  79. package/src/skills/agent-coordination/SKILL.md +6 -6
  80. package/src/skills/artifact-management/SKILL.md +43 -39
  81. package/src/skills/artifact-management/references/artifact-templates.md +103 -48
  82. package/src/skills/auto-continue/references/auto-continue-details.md +13 -13
  83. package/src/skills/code-review-checklist/SKILL.md +6 -6
  84. package/src/skills/fast-path-execution/SKILL.md +54 -0
  85. package/src/skills/incremental-implementation/SKILL.md +13 -13
  86. package/src/skills/memory-bank/references/anti-patterns.md +3 -3
  87. package/src/skills/prompt-refinery/SKILL.md +51 -65
  88. package/src/skills/spec-driven-development/SKILL.md +12 -14
  89. package/src/skills/tdd-with-agents/SKILL.md +23 -10
  90. package/src/skills/test-slicing/SKILL.md +56 -0
  91. package/src/skills/verification-planning/SKILL.md +4 -3
  92. package/src/skills/visual-review-pipeline/SKILL.md +1 -1
  93. package/src/skills/visual-review-pipeline/references/workflow-steps.md +1 -1
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pantheon-tui",
3
- "version": "2.0.0-beta.6",
3
+ "version": "2.0.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pantheon-tui",
9
- "version": "2.0.0-beta.6",
9
+ "version": "2.0.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@opencode/plugin": "2.0.26",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pantheon-tui",
3
3
  "type": "module",
4
- "version": "2.0.0-beta.6",
4
+ "version": "2.0.0",
5
5
  "description": "Pantheon TUI plugin \u2014 V1 rich sidebar and usage gauges; native V2 status, session and delegation sidebar",
6
6
  "license": "MIT",
7
7
  "engines": {
@@ -20,7 +20,7 @@
20
20
  * enforced: J1 owns the risk axis, budgets own the money axis — this tab
21
21
  * shows where the thresholds sit today.
22
22
  */
23
- import type { SettingsRow, SettingsTab } from './pantheon-settings-state.ts'
23
+ import type { SettingsTab } from './pantheon-settings-state.ts'
24
24
 
25
25
  export interface GoalLoopPrefs {
26
26
  enabled: boolean
@@ -36,6 +36,16 @@ export const DEFAULT_GOAL_LOOP_PREFS: GoalLoopPrefs = {
36
36
 
37
37
  export const GOAL_LOOP_ENABLED_CYCLE: readonly string[] = Object.freeze(['enabled', 'disabled'])
38
38
 
39
+ export const MAX_CONTINUATIONS_CYCLE: readonly string[] = Object.freeze([
40
+ '10',
41
+ '25',
42
+ '50',
43
+ '100',
44
+ '200',
45
+ ])
46
+
47
+ export const COOLDOWN_MS_CYCLE: readonly string[] = Object.freeze(['1000', '2000', '5000', '10000'])
48
+
39
49
  export interface DecisionBudgets {
40
50
  monthlyUsd: number
41
51
  perDecisionUsd: number
@@ -75,7 +85,7 @@ export function buildAutonomyTab(input: {
75
85
  title: 'Autonomy',
76
86
  groups: [
77
87
  {
78
- title: 'Goal loop (persisted mission, long sessions)',
88
+ title: 'Goal loop (multi-turn session auto-continuation)',
79
89
  rows: [
80
90
  {
81
91
  id: 'autonomy.goal_loop.enabled',
@@ -83,64 +93,66 @@ export function buildAutonomyTab(input: {
83
93
  value: input.goalLoop.enabled ? 'enabled' : 'disabled',
84
94
  cycle: GOAL_LOOP_ENABLED_CYCLE,
85
95
  note:
86
- 'mission persists in .pantheon/goals; auto-continues with cooldown' +
96
+ 'auto-continues multi-turn tasks when session goes idle' +
87
97
  (input.goalLoopRestartPending
88
- ? ' · ⚠ saved value applies after OpenCode restart'
98
+ ? ' · [!] restart required to apply'
89
99
  : ' · applies after OpenCode restart'),
90
100
  },
91
101
  {
92
102
  id: 'autonomy.goal_loop.maxContinuations',
93
103
  name: 'Max continuations',
94
104
  value: String(input.goalLoop.maxContinuations),
95
- note: '1..200 — the anti-runaway cap per mission',
105
+ cycle: MAX_CONTINUATIONS_CYCLE,
106
+ note: '1..200 — safety ceiling to prevent runaway tasks',
96
107
  },
97
108
  {
98
109
  id: 'autonomy.goal_loop.cooldownMs',
99
110
  name: 'Cooldown (ms)',
100
111
  value: String(input.goalLoop.cooldownMs),
101
- note: 'min 1000ms · between continuations',
112
+ cycle: COOLDOWN_MS_CYCLE,
113
+ note: 'delay between autonomous turns (min 1000ms)',
102
114
  },
103
115
  ],
104
116
  },
105
117
  {
106
- title: 'Decision budgets (applies live)',
118
+ title: 'Decision budgets (applies live per gated call)',
107
119
  rows: [
108
120
  {
109
121
  id: 'autonomy.budget.monthly',
110
122
  name: 'Monthly cap',
111
123
  value: formatUsd(input.budgets.monthlyUsd),
112
124
  cycle: MONTHLY_USD_CYCLE,
113
- note: 'the ledger refuses gated calls past this',
125
+ note: 'monthly USD ceiling for gated arbitrator decisions',
114
126
  },
115
127
  {
116
128
  id: 'autonomy.budget.perDecision',
117
129
  name: 'Per-decision cap',
118
130
  value: formatUsd(input.budgets.perDecisionUsd),
119
131
  cycle: PER_DECISION_USD_CYCLE,
120
- note: 'each gated call above this is refused',
132
+ note: 'price cap — gated decisions above this are refused',
121
133
  },
122
134
  ],
123
135
  },
124
136
  {
125
- title: 'Decision gradient (documented — J1 owns the risk axis)',
137
+ title: 'Decision gradient (reference policy · J1 owns the risk axis)',
126
138
  rows: [
127
139
  {
128
140
  id: 'autonomy.gradient.solo',
129
141
  name: 'Decide solo',
130
- value: 'reversible + low risk',
131
- note: 'edits, routine fixes, ordering ties — no gate',
142
+ value: 'autonomous',
143
+ note: 'reversible & low-risk edits, routine fixes (no gate)',
132
144
  },
133
145
  {
134
146
  id: 'autonomy.gradient.jev',
135
147
  name: 'Jev decides',
136
- value: 'typed ambiguity',
137
- note: 'readings, ranking, verification — budget-capped',
148
+ value: 'arbitrated',
149
+ note: 'typed ambiguity & candidate ranking (budget-capped)',
138
150
  },
139
151
  {
140
152
  id: 'autonomy.gradient.human',
141
153
  name: 'Human decides',
142
- value: 'high risk (J1)',
143
- note: 'enforce ladder via PANTHEON_J1_* (J1 tab)',
154
+ value: 'human review',
155
+ note: 'high-risk & destructive operations (J1 gate)',
144
156
  },
145
157
  ],
146
158
  },
@@ -6,6 +6,29 @@ export const CONTEXT_BAR_CELLS = 12
6
6
  export const CONTEXT_BAR_FILLED_CELL = '\u25B0'
7
7
  export const CONTEXT_BAR_EMPTY_CELL = '\u25B1'
8
8
 
9
+ export type BarShape = 'block' | 'line' | 'smooth' | 'ascii' | 'dots' | 'braille'
10
+
11
+ export interface BarShapeGlyphs {
12
+ filled: string
13
+ empty: string
14
+ mark?: string
15
+ }
16
+
17
+ export const BAR_SHAPES: Record<BarShape, BarShapeGlyphs> = {
18
+ block: { filled: '\u25B0', empty: '\u25B1', mark: '│' },
19
+ line: { filled: '━', empty: '─', mark: '┼' },
20
+ smooth: { filled: '█', empty: '░', mark: '┆' },
21
+ ascii: { filled: '=', empty: '-', mark: '|' },
22
+ dots: { filled: '●', empty: '○', mark: '│' },
23
+ braille: { filled: '⣿', empty: '⣀', mark: '⡇' },
24
+ }
25
+
26
+ export interface ContextBarOptions {
27
+ cells?: number
28
+ shape?: BarShape
29
+ evenMark?: boolean
30
+ }
31
+
9
32
  function numberOrNull(value: unknown): number | null {
10
33
  return typeof value === 'number' && Number.isFinite(value) ? value : null
11
34
  }
@@ -40,15 +63,51 @@ export function contextBarFilled(percent: number, cells = CONTEXT_BAR_CELLS): nu
40
63
 
41
64
  export function contextBar(
42
65
  percent: number | null | undefined,
43
- cells = CONTEXT_BAR_CELLS,
66
+ options: number | ContextBarOptions = CONTEXT_BAR_CELLS,
44
67
  ): { filled: string; empty: string } | null {
45
68
  const value = numberOrNull(percent)
46
69
  if (value === null) return null
47
- const total = Math.max(1, Math.floor(cells))
48
- const filled = contextBarFilled(value, total)
70
+ const total = Math.max(
71
+ 1,
72
+ Math.floor(typeof options === 'number' ? options : (options?.cells ?? CONTEXT_BAR_CELLS)),
73
+ )
74
+ const shapeKey =
75
+ typeof options === 'object' && options?.shape && options.shape in BAR_SHAPES
76
+ ? options.shape
77
+ : 'block'
78
+ const glyphs = BAR_SHAPES[shapeKey] ?? BAR_SHAPES.block
79
+ const evenMark = typeof options === 'object' ? Boolean(options?.evenMark) : false
80
+
81
+ const filledCount = contextBarFilled(value, total)
82
+ const emptyCount = total - filledCount
83
+
84
+ if (!evenMark || total < 4) {
85
+ return {
86
+ filled: glyphs.filled.repeat(filledCount),
87
+ empty: glyphs.empty.repeat(emptyCount),
88
+ }
89
+ }
90
+
91
+ // Insert even-use mark at the midpoint (50%)
92
+ const mid = Math.floor(total / 2)
93
+ const mark = glyphs.mark ?? '|'
94
+
95
+ if (filledCount <= mid) {
96
+ // Mark is in the empty portion
97
+ const emptyBefore = mid - filledCount
98
+ const emptyAfter = Math.max(0, emptyCount - emptyBefore - 1)
99
+ return {
100
+ filled: glyphs.filled.repeat(filledCount),
101
+ empty: `${glyphs.empty.repeat(emptyBefore)}${mark}${glyphs.empty.repeat(emptyAfter)}`,
102
+ }
103
+ }
104
+
105
+ // Mark is in the filled portion
106
+ const filledBefore = mid
107
+ const filledAfter = Math.max(0, filledCount - filledBefore - 1)
49
108
  return {
50
- filled: CONTEXT_BAR_FILLED_CELL.repeat(filled),
51
- empty: CONTEXT_BAR_EMPTY_CELL.repeat(total - filled),
109
+ filled: `${glyphs.filled.repeat(filledBefore)}${mark}${glyphs.filled.repeat(filledAfter)}`,
110
+ empty: glyphs.empty.repeat(emptyCount),
52
111
  }
53
112
  }
54
113
 
@@ -290,9 +290,56 @@ export function applyDecisionRow(
290
290
  }
291
291
  }
292
292
 
293
+ /** The host's provider auth store (`opencode auth login` writes here). */
294
+ export function decisionAuthStorePath(env: Record<string, string | undefined> = process.env) {
295
+ const xdgData = env.XDG_DATA_HOME
296
+ const home = env.HOME ?? ''
297
+ const root = xdgData ?? join(home, '.local', 'share')
298
+ return join(root, 'opencode', 'auth.json')
299
+ }
300
+
301
+ /** Provider ids as they appear in the host auth store / config providers. */
302
+ const PROVIDER_AUTH_NAMES: Readonly<Record<string, readonly string[]>> = Object.freeze({
303
+ 'openai-decisions': Object.freeze(['openai']),
304
+ 'typesafe-jev': Object.freeze(['typesafe-ai']),
305
+ 'opencode-console-jev': Object.freeze([]),
306
+ 'openrouter-jev': Object.freeze(['openrouter']),
307
+ 'vercel-gateway-jev': Object.freeze(['vercel-ai-gateway', 'vercel']),
308
+ 'cloudflare-workers-jev': Object.freeze(['cloudflare-workers-ai']),
309
+ })
310
+
311
+ export type CredentialForm = 'env' | 'auth store' | 'config' | 'missing'
312
+
313
+ /**
314
+ * TWO recognition forms (field feedback beta.6: keys registered via
315
+ * `opencode auth login` showed MISSING because only env vars were checked):
316
+ * env var set → 'env'; provider present in the host auth store → 'auth
317
+ * store'; provider entry in opencode.json providers → 'config'. Values are
318
+ * NEVER read — existence only.
319
+ */
320
+ export function credentialStatus(
321
+ provider: string,
322
+ env: Record<string, string | undefined>,
323
+ authProviders: ReadonlySet<string>,
324
+ configProviders: ReadonlySet<string>,
325
+ ): CredentialForm {
326
+ const credential = DECISION_PROVIDER_CREDENTIALS[provider]
327
+ if (credential?.env !== undefined && env[credential.env]) return 'env'
328
+ for (const name of PROVIDER_AUTH_NAMES[provider] ?? []) {
329
+ if (authProviders.has(name)) return 'auth store'
330
+ }
331
+ for (const name of PROVIDER_AUTH_NAMES[provider] ?? []) {
332
+ if (configProviders.has(name)) return 'config'
333
+ }
334
+ if (provider === 'opencode-console-jev') return 'auth store'
335
+ return 'missing'
336
+ }
337
+
293
338
  export function buildDecisionTab(
294
339
  read: DecisionConfigRead,
295
340
  env: Record<string, string | undefined> = process.env,
341
+ authProviders: ReadonlySet<string> = new Set(),
342
+ configProviders: ReadonlySet<string> = new Set(),
296
343
  ): SettingsTab {
297
344
  const { config, corrupt } = read
298
345
  const rows: SettingsRow[] = [
@@ -352,12 +399,12 @@ export function buildDecisionTab(
352
399
  {
353
400
  title: 'Credentials (status only — values never enter the window)',
354
401
  rows: DECISION_KNOWN_PROVIDERS.map((provider) => {
402
+ const status = credentialStatus(provider, env, authProviders, configProviders)
355
403
  const credential = DECISION_PROVIDER_CREDENTIALS[provider] ?? { note: '' }
356
- const isSet = credential.env === undefined ? true : Boolean(env[credential.env])
357
404
  return {
358
405
  id: `decision.key.${provider}`,
359
406
  name: provider,
360
- value: credential.env === undefined ? 'n/a' : isSet ? 'set' : 'MISSING',
407
+ value: status === 'missing' ? 'MISSING' : status,
361
408
  note: credential.note,
362
409
  }
363
410
  }),
@@ -12,6 +12,7 @@ import type { Context, KeymapLayer, PanelInput } from '@opencode/plugin/tui/cont
12
12
  import type { Accessor, JSX } from 'solid-js'
13
13
  import { createEffect, createMemo, createSignal, For, on, onCleanup, onMount, Show } from 'solid-js'
14
14
  import {
15
+ CONTEXT_BAR_CELLS,
15
16
  type ContextProgressTone,
16
17
  contextBar,
17
18
  contextUsageTone,
@@ -26,11 +27,13 @@ import {
26
27
  } from './model-usage-limits'
27
28
  import {
28
29
  openPantheonSettings,
30
+ PantheonSettingsSlot,
29
31
  pantheonSettingsBlocking,
30
32
  setupPantheonSettings,
31
33
  } from './pantheon-settings'
34
+ import { PRESET_NONE } from './preset-state'
32
35
  import { cellWidth, GRAPHEMES, SIDEBAR_CONTENT_WIDTH } from './sidebar-width'
33
- import { initTuiPrefs, tuiPrefs } from './tui-prefs'
36
+ import { initTuiPrefs, tuiDraftPreview, tuiPrefs } from './tui-prefs'
34
37
  import { nextCheckState, pickUpdateNotice, type UpdateCheckState } from './update-notice.ts'
35
38
  import { maybeShowWhatsNewV2 } from './whats-new'
36
39
 
@@ -65,7 +68,7 @@ const SPINNER_INTERVAL_MS = 80
65
68
  /** Bounded warm-up: sync at most this many sessions at plugin load. */
66
69
  const WARMUP_SESSION_LIMIT = 24
67
70
  /** Sidebar body shown while the host has not published a session yet. */
68
- export const SIDEBAR_WAITING_LABEL = 'Aguardando sessão…'
71
+ export const SIDEBAR_WAITING_LABEL = 'Waiting for session…'
69
72
  /** Delegate-completion toast title. */
70
73
  const TOAST_TITLE = 'Pantheon'
71
74
  /** Marker before the preset label (fixed header, home status, prompt footer).
@@ -693,12 +696,13 @@ export function contextBlockRows(
693
696
  usage: ContextUsage | null,
694
697
  cost: number | null | undefined,
695
698
  gaugeStyle: 'both' | 'bar' | 'percent' | 'off' = 'both',
699
+ barOptions?: number | { shape?: any; cells?: number; evenMark?: boolean },
696
700
  ): ContextBlockRows | null {
697
701
  const spentValue = formatSpent(cost)
698
702
  const spent: ContextRow | null =
699
703
  spentValue === null
700
704
  ? null
701
- : { lead: null, value: spentValue, tail: null, suffix: ' gasto na sessão', tone: null }
705
+ : { lead: null, value: spentValue, tail: null, suffix: ' spent in session', tone: null }
702
706
  if (usage === null) return spent === null ? null : { tokens: null, percent: null, spent }
703
707
 
704
708
  const tokensValue = formatTokenCount(usage.tokens)
@@ -709,7 +713,7 @@ export function contextBlockRows(
709
713
 
710
714
  const percentValue = numberOrNull(usage.percent)
711
715
  const window = formatContextWindow(usage.limit)
712
- const bar = contextBar(percentValue)
716
+ const bar = contextBar(percentValue, barOptions ?? CONTEXT_BAR_CELLS)
713
717
  let percent: ContextRow | null = null
714
718
  if (gaugeStyle !== 'off' && bar !== null && percentValue !== null) {
715
719
  const suffix = window === null ? null : ` of ${window}`
@@ -2321,7 +2325,7 @@ export function buildDispatchBlock(
2321
2325
  export const DISPATCH_PANEL_NAME = 'pantheon.dispatch'
2322
2326
  /** Toast shown when `ui.panel.open` refuses (no session route is active). The
2323
2327
  * panel only exists inside a session, so there is no alternative route. */
2324
- export const DISPATCH_PANEL_TOAST = 'Abra uma sessão para ver o Dispatch'
2328
+ export const DISPATCH_PANEL_TOAST = 'Open a session to view Dispatch'
2325
2329
  /** Panel title marker — the same glyph the sidebar block header uses. */
2326
2330
  export const DISPATCH_PANEL_HEADER_MARKER = '\u25C8'
2327
2331
  /** Selected-row gutter marker (`▸`, one cell). */
@@ -2333,7 +2337,7 @@ export const DISPATCH_PANEL_RULE_CHAR = '\u2500'
2333
2337
  /** Em dash for any datum the host did not publish. */
2334
2338
  export const DISPATCH_PANEL_DASH = '\u2014'
2335
2339
  /** Body of an empty panel (the claim still renders, the list is just empty). */
2336
- export const DISPATCH_PANEL_EMPTY_TEXT = 'Nenhuma sessão delegada'
2340
+ export const DISPATCH_PANEL_EMPTY_TEXT = 'No delegated sessions'
2337
2341
  /** Width at or above which the list and the detail sit side by side. */
2338
2342
  export const DISPATCH_PANEL_WIDE_MIN_WIDTH = 72
2339
2343
  /** Rows the viewport holds; pageup/pagedown move by exactly this many rows. */
@@ -2641,42 +2645,42 @@ export const DISPATCH_PANEL_COMMANDS: readonly DispatchPanelCommandSpec[] = [
2641
2645
  {
2642
2646
  action: 'up',
2643
2647
  id: 'pantheon.dispatch.up',
2644
- title: 'Dispatch: selecionar anterior',
2648
+ title: 'Dispatch: select previous',
2645
2649
  bind: 'k,up',
2646
2650
  },
2647
2651
  {
2648
2652
  action: 'down',
2649
2653
  id: 'pantheon.dispatch.down',
2650
- title: 'Dispatch: selecionar próxima',
2654
+ title: 'Dispatch: select next',
2651
2655
  bind: 'j,down',
2652
2656
  },
2653
- { action: 'home', id: 'pantheon.dispatch.home', title: 'Dispatch: primeira', bind: 'home' },
2654
- { action: 'end', id: 'pantheon.dispatch.end', title: 'Dispatch: última', bind: 'end' },
2657
+ { action: 'home', id: 'pantheon.dispatch.home', title: 'Dispatch: first', bind: 'home' },
2658
+ { action: 'end', id: 'pantheon.dispatch.end', title: 'Dispatch: last', bind: 'end' },
2655
2659
  {
2656
2660
  action: 'pageup',
2657
2661
  id: 'pantheon.dispatch.pageup',
2658
- title: 'Dispatch: página acima',
2662
+ title: 'Dispatch: page up',
2659
2663
  bind: 'pageup',
2660
2664
  },
2661
2665
  {
2662
2666
  action: 'pagedown',
2663
2667
  id: 'pantheon.dispatch.pagedown',
2664
- title: 'Dispatch: página abaixo',
2668
+ title: 'Dispatch: page down',
2665
2669
  bind: 'pagedown',
2666
2670
  },
2667
2671
  {
2668
2672
  action: 'toggle',
2669
2673
  id: 'pantheon.dispatch.toggle',
2670
- title: 'Dispatch: expandir detalhe',
2674
+ title: 'Dispatch: expand detail',
2671
2675
  bind: 'enter',
2672
2676
  },
2673
2677
  {
2674
2678
  action: 'fullscreen',
2675
2679
  id: 'pantheon.dispatch.fullscreen',
2676
- title: 'Dispatch: tela cheia',
2680
+ title: 'Dispatch: fullscreen',
2677
2681
  bind: 'f',
2678
2682
  },
2679
- { action: 'close', id: 'pantheon.dispatch.close', title: 'Dispatch: fechar', bind: 'escape,q' },
2683
+ { action: 'close', id: 'pantheon.dispatch.close', title: 'Dispatch: close', bind: 'escape,q' },
2680
2684
  ]
2681
2685
 
2682
2686
  /** Run one action against the model and the host-owned panel input. Kept apart
@@ -2739,10 +2743,10 @@ export function dispatchPanelFooter(shortcutsOf: (id: string) => readonly string
2739
2743
  return text === '' ? DISPATCH_PANEL_DASH : text
2740
2744
  }
2741
2745
  return [
2742
- `${keys('pantheon.dispatch.up')} ${keys('pantheon.dispatch.down')} mover`,
2743
- `${keys('pantheon.dispatch.toggle')} detalhe`,
2746
+ `${keys('pantheon.dispatch.up')} ${keys('pantheon.dispatch.down')} move`,
2747
+ `${keys('pantheon.dispatch.toggle')} detail`,
2744
2748
  `${keys('pantheon.dispatch.fullscreen')} fullscreen`,
2745
- `${keys('pantheon.dispatch.close')} fechar`,
2749
+ `${keys('pantheon.dispatch.close')} close`,
2746
2750
  ].join(SPEND_LINE_SEPARATOR)
2747
2751
  }
2748
2752
 
@@ -3164,7 +3168,18 @@ function useActivePreset(context: any): {
3164
3168
  clearInterval(timer)
3165
3169
  })
3166
3170
  })
3167
- return { preset, overrides }
3171
+ const effectivePreset = () => {
3172
+ const preview = tuiDraftPreview()
3173
+ if (preview && 'preset' in preview) {
3174
+ const stagedName = preview.preset
3175
+ return {
3176
+ ...preset(),
3177
+ name: stagedName === PRESET_NONE ? null : stagedName,
3178
+ }
3179
+ }
3180
+ return preset()
3181
+ }
3182
+ return { preset: effectivePreset, overrides }
3168
3183
  }
3169
3184
 
3170
3185
  /** Debounce for the git file-count revalidation. `vcs.status` is an HTTP call;
@@ -3937,10 +3952,10 @@ function ContextRowView(props: { row: ContextRow; fg: string; muted: string }) {
3937
3952
  )
3938
3953
  return (
3939
3954
  <Show
3940
- when={props.row.suffix !== ' gasto na sessão'}
3955
+ when={props.row.suffix !== ' spent in session'}
3941
3956
  fallback={
3942
3957
  <box flexDirection="column">
3943
- <For each={sidebarMoneyLines('gasto na sessão', props.row.value)}>
3958
+ <For each={sidebarMoneyLines('spent in session', props.row.value)}>
3944
3959
  {(line) => <text fg={props.fg}>{line}</text>}
3945
3960
  </For>
3946
3961
  </box>
@@ -4025,7 +4040,19 @@ function Sidebar(props: SidebarProps): JSX.Element {
4025
4040
  // host store, so a flip in /pantheon-settings re-renders here instantly).
4026
4041
  const contextRows = () => {
4027
4042
  const prefs = tuiPrefs()
4028
- const rows = contextBlockRows(model.contextUsage(), model.cost(), prefs.sidebar.context.gauge)
4043
+ const barCells =
4044
+ prefs.sidebar.context.barWidth === 'compact'
4045
+ ? 8
4046
+ : prefs.sidebar.context.barWidth === 'wide'
4047
+ ? 16
4048
+ : prefs.sidebar.context.barWidth === 'full'
4049
+ ? 20
4050
+ : 12
4051
+ const rows = contextBlockRows(model.contextUsage(), model.cost(), prefs.sidebar.context.gauge, {
4052
+ shape: prefs.sidebar.context.barShape,
4053
+ cells: barCells,
4054
+ evenMark: prefs.sidebar.context.evenMark,
4055
+ })
4029
4056
  if (rows === null) return null
4030
4057
  return {
4031
4058
  tokens: prefs.sidebar.context.tokens ? rows.tokens : null,
@@ -4053,10 +4080,18 @@ function Sidebar(props: SidebarProps): JSX.Element {
4053
4080
  // session each drop independently; nothing reflows — the column just shortens.
4054
4081
  const header = () => tuiPrefs().sidebar.header
4055
4082
  return (
4056
- <box flexDirection="column" width="100%" padding={1}>
4083
+ <box
4084
+ flexDirection="column"
4085
+ width="100%"
4086
+ paddingLeft={1}
4087
+ paddingRight={1}
4088
+ paddingTop={tuiPrefs().layout.preset === 'compact' ? 0 : 1}
4089
+ paddingBottom={tuiPrefs().layout.preset === 'compact' ? 0 : 1}
4090
+ >
4057
4091
  <Show when={header().version}>
4058
4092
  <text fg={text()} attributes={1}>{`Pantheon v${__PANTHEON_VERSION__}`}</text>
4059
4093
  </Show>
4094
+
4060
4095
  {/* Preset plus the provider of the model in use — both derived from host
4061
4096
  state. The provider is dropped when nothing resolves, so the row is
4062
4097
  never a placeholder. */}
@@ -4072,7 +4107,7 @@ function Sidebar(props: SidebarProps): JSX.Element {
4072
4107
  }
4073
4108
  >
4074
4109
  {(current: any) => (
4075
- <text fg={text()}>{`Sessão: ${truncateLabel(current().title || current().id)}`}</text>
4110
+ <text fg={text()}>{`Session: ${truncateLabel(current().title || current().id)}`}</text>
4076
4111
  )}
4077
4112
  </Show>
4078
4113
 
@@ -4111,9 +4146,9 @@ function Sidebar(props: SidebarProps): JSX.Element {
4111
4146
  single accent. When no message carries cost this loop is empty
4112
4147
  and the block keeps its original token/spend rows. */}
4113
4148
  <Show when={tuiPrefs().sidebar.context.modelUsage && usageRows().length > 0}>
4114
- <text fg={muted()}>Sessão · custo reportado</text>
4149
+ <text fg={muted()}>Session · reported cost</text>
4115
4150
  <text fg={muted()}>
4116
- {'Modelo'.padEnd(MODEL_USAGE_MODEL_WIDTH) +
4151
+ {'Model'.padEnd(MODEL_USAGE_MODEL_WIDTH) +
4117
4152
  ' Tokens'.padStart(8) +
4118
4153
  ' USD'.padStart(10)}
4119
4154
  </text>
@@ -4629,6 +4664,13 @@ const plugin = Plugin.define({
4629
4664
  } catch {
4630
4665
  /* settings unavailable on this host — the command toasts/fails open */
4631
4666
  }
4667
+ // In-session settings docked above prompt (session.composer.top)
4668
+ const unregisterSettingsSlot = context.ui.slot({
4669
+ append: 'session.composer.top',
4670
+ render: ({ sessionID }: { sessionID: string }) => (
4671
+ <PantheonSettingsSlot context={context} sessionID={sessionID} />
4672
+ ),
4673
+ })
4632
4674
  // One-time "What's new" window (per Pantheon version) — fire-and-forget:
4633
4675
  // resolves the running version and the shipped CHANGELOG.md, then opens a
4634
4676
  // host dialog when the version changed since the last dismissal. Fail-open;
@@ -4640,6 +4682,7 @@ const plugin = Plugin.define({
4640
4682
  if (typeof unregisterHome === 'function') unregisterHome()
4641
4683
  if (typeof unregisterPromptFooter === 'function') unregisterPromptFooter()
4642
4684
  if (typeof unregisterPanel === 'function') unregisterPanel()
4685
+ if (typeof unregisterSettingsSlot === 'function') unregisterSettingsSlot()
4643
4686
  if (typeof unregisterCommands === 'function') unregisterCommands()
4644
4687
  if (typeof unregisterSettingsCommands === 'function') unregisterSettingsCommands()
4645
4688
  delete globalState[SINGLETON]
@@ -162,6 +162,8 @@ export interface SettingsRow {
162
162
  value: string
163
163
  /** Allowed values for ←/→; presence marks the row as editable. */
164
164
  cycle?: readonly string[]
165
+ /** The row's DEFAULT value — what the Defaults action stages. */
166
+ def?: string
165
167
  /** Right-column note (writes-where, applies-live, from-where). */
166
168
  note?: string
167
169
  /** Enter triggers this action instead of cycling (e.g. `update-check`). */
@@ -225,6 +227,45 @@ export function stageValue(
225
227
  return { ...draft, [row.id]: staged }
226
228
  }
227
229
 
230
+ /** Stage an explicit target value for one row (the Defaults action path). */
231
+ export function stageRowToValue(
232
+ draft: SettingsDraft,
233
+ row: SettingsRow,
234
+ target: string,
235
+ ): SettingsDraft {
236
+ if (!row.cycle?.includes(target)) return draft
237
+ if (target === row.value) {
238
+ if (draft[row.id] === undefined) return draft
239
+ const next = { ...draft }
240
+ delete next[row.id]
241
+ return next
242
+ }
243
+ return { ...draft, [row.id]: target }
244
+ }
245
+
246
+ /**
247
+ * Stage every cyclable row's DEFAULT value of a tab. Rows already at their
248
+ * default have their staged entry dropped; rows staged elsewhere keep it
249
+ * until the Defaults action targets them.
250
+ */
251
+ export function stageDefaults(draft: SettingsDraft, tab: SettingsTab): SettingsDraft {
252
+ let next = draft
253
+ for (const row of tabRows(tab)) {
254
+ if (row.cycle === undefined || row.def === undefined) continue
255
+ const candidate = next[row.id] ?? row.value
256
+ if (candidate === row.def) {
257
+ if (next[row.id] !== undefined) {
258
+ const copy = { ...next }
259
+ delete copy[row.id]
260
+ next = copy
261
+ }
262
+ continue
263
+ }
264
+ next = stageRowToValue(next, { ...row, value: candidate }, row.def)
265
+ }
266
+ return next
267
+ }
268
+
228
269
  /** Drop every staged entry of one tab (ctrl+r). */
229
270
  export function resetTab(draft: SettingsDraft, tab: SettingsTab): SettingsDraft {
230
271
  const ids = new Set(tabRows(tab).map((row) => row.id))
@@ -342,3 +383,61 @@ export function buildAboutTab(version: string): SettingsTab {
342
383
  ],
343
384
  }
344
385
  }
386
+
387
+ export interface ChangelogHighlightItem {
388
+ title: string
389
+ detail: string
390
+ group?: string | undefined
391
+ }
392
+
393
+ export function buildChangelogTab(
394
+ version: string,
395
+ items: ChangelogHighlightItem[] = [],
396
+ ): SettingsTab {
397
+ const rows: SettingsRow[] = []
398
+ if (items.length > 0) {
399
+ items.forEach((item, index) => {
400
+ rows.push({
401
+ id: `changelog.item.${index + 1}`,
402
+ name: item.title.slice(0, 26),
403
+ value: item.detail.length > 20 ? `${item.detail.slice(0, 19)}…` : item.detail,
404
+ note: item.detail,
405
+ })
406
+ })
407
+ } else {
408
+ rows.push({
409
+ id: 'changelog.info',
410
+ name: 'Release',
411
+ value: `v${version}`,
412
+ note: 'view full history in CHANGELOG.md or GitHub releases',
413
+ })
414
+ }
415
+
416
+ return {
417
+ id: 'changelog',
418
+ title: 'Changelog',
419
+ groups: [
420
+ {
421
+ title: `What's New in v${version}`,
422
+ rows,
423
+ },
424
+ {
425
+ title: 'Release References',
426
+ rows: [
427
+ {
428
+ id: 'changelog.docs',
429
+ name: 'Documentation',
430
+ value: 'CHANGELOG.md',
431
+ note: 'shipped at plugin root and repository root',
432
+ },
433
+ {
434
+ id: 'changelog.repo',
435
+ name: 'GitHub Repository',
436
+ value: 'ils15/pantheon-opencode',
437
+ note: 'releases, pull requests and discussion',
438
+ },
439
+ ],
440
+ },
441
+ ],
442
+ }
443
+ }