pantheon-opencode 2.1.6 → 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 (63) hide show
  1. package/AGENTS.global.md +2 -2
  2. package/AGENTS.md +1 -1
  3. package/CHANGELOG.md +64 -0
  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 +8 -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 +3 -1
  17. package/scripts/hooks/format-multi-language.sh +30 -29
  18. package/scripts/install-mcp.mjs +55 -27
  19. package/scripts/prune.mjs +124 -2
  20. package/scripts/setup.mjs +1 -1
  21. package/scripts/themis_heuristic_scan.py +3 -5
  22. package/skills-lock.json +1 -1
  23. package/src/agents/aphrodite.md +1 -1
  24. package/src/agents/athena.md +6 -14
  25. package/src/agents/demeter.md +1 -1
  26. package/src/agents/hermes.md +3 -2
  27. package/src/agents/iris.md +4 -6
  28. package/src/agents/prometheus.md +3 -7
  29. package/src/agents/roster.json +567 -0
  30. package/src/agents/zeus.md +3 -0
  31. package/src/instructions/agent-return-format.instructions.md +1 -1
  32. package/src/instructions/zeus-anti-stall.instructions.md +11 -35
  33. package/src/instructions/zeus-council-synthesis.instructions.md +17 -49
  34. package/src/instructions/zeus-timeout-retry.instructions.md +12 -80
  35. package/src/mcp/mcp_codemap_module.py +6 -5
  36. package/src/mcp/pantheon-mcp-server.mjs +875 -0
  37. package/src/pantheon/agent-forge-tool.ts +316 -0
  38. package/src/pantheon/auto-permissions.ts +31 -1
  39. package/src/pantheon/codemap-tools.ts +525 -0
  40. package/src/pantheon/deepwork/plan-tracker.ts +63 -2
  41. package/src/pantheon/execute-after.ts +21 -0
  42. package/src/pantheon/hook-engine.ts +2 -1
  43. package/src/pantheon/native-memory-tools.ts +686 -0
  44. package/src/pantheon/presets.mjs +15 -0
  45. package/src/pantheon/step-ledger.ts +259 -0
  46. package/src/pantheon/swe-eval-harness.ts +211 -0
  47. package/src/pantheon/tools.ts +62 -7
  48. package/src/plugin/index.js +2091 -136
  49. package/src/plugin/index.ts +1 -14
  50. package/src/plugin.ts +167 -10
  51. package/src/plugins/tui/dist/tui.d.ts +66 -0
  52. package/src/plugins/tui/dist/tui.d.ts.map +1 -1
  53. package/src/plugins/tui/dist/tui.js +1259 -367
  54. package/src/plugins/tui/dist/tui.js.map +1 -1
  55. package/src/plugins/tui/package-lock.json +2 -2
  56. package/src/plugins/tui/package.json +1 -1
  57. package/src/plugins/tui/src/index.tsx +632 -71
  58. package/src/plugins/tui/src/pantheon-settings.tsx +78 -14
  59. package/src/plugins/tui/src/quota-state.ts +190 -0
  60. package/src/plugins/tui/src/tui-prefs.ts +169 -12
  61. package/src/routing.yml +3 -0
  62. package/src/skills/auto-continue/references/auto-continue-details.md +2 -31
  63. /package/scripts/{setup-v2-config.mjs → setup-config.mjs} +0 -0
@@ -69,12 +69,24 @@ export function initTuiPrefs(context: Context): void {
69
69
  | undefined
70
70
  if (handle !== undefined) {
71
71
  ;(globalThis as unknown as Record<PropertyKey, unknown>)[PREFS_SYMBOL] = handle
72
- // Self-heal: if store was persisted before layout existed, backfill missing top-level defaults
73
- if (!handle[0]?.layout) {
72
+ // Self-heal: if store was persisted before layout existed or lacks new fields, backfill defaults
73
+ if (
74
+ !handle[0]?.layout ||
75
+ typeof handle[0]?.sidebar?.context?.turnCost !== 'boolean' ||
76
+ typeof handle[0]?.sidebar?.context?.tokenAnatomy !== 'boolean'
77
+ ) {
74
78
  handle[1]((draft: any) => {
75
79
  if (!draft.layout) {
76
80
  draft.layout = { ...DEFAULT_TUI_PREFS.layout }
77
81
  }
82
+ if (draft.sidebar?.context) {
83
+ if (typeof draft.sidebar.context.turnCost !== 'boolean') {
84
+ draft.sidebar.context.turnCost = true
85
+ }
86
+ if (typeof draft.sidebar.context.tokenAnatomy !== 'boolean') {
87
+ draft.sidebar.context.tokenAnatomy = true
88
+ }
89
+ }
78
90
  }).catch(() => {})
79
91
  }
80
92
  }
@@ -99,8 +111,12 @@ export function previewTuiPrefs(base: TuiPrefs, draft?: SettingsDraft): TuiPrefs
99
111
  const effective: TuiPrefs = {
100
112
  version: 1,
101
113
  layout: { ...normalized.layout },
114
+ ...(normalized.theme ? { theme: { ...normalized.theme } } : {}),
102
115
  sidebar: {
103
116
  header: { ...normalized.sidebar.header },
117
+ ...(normalized.sidebar.pinnedSessions
118
+ ? { pinnedSessions: [...normalized.sidebar.pinnedSessions] }
119
+ : {}),
104
120
  blocks: { ...normalized.sidebar.blocks },
105
121
  context: { ...normalized.sidebar.context },
106
122
  },
@@ -119,13 +135,7 @@ export function previewTuiPrefs(base: TuiPrefs, draft?: SettingsDraft): TuiPrefs
119
135
  export function savedTuiPrefs(): TuiPrefs {
120
136
  const s = stash()?.[0]
121
137
  if (!s) return DEFAULT_TUI_PREFS
122
- if (!s.layout) {
123
- return {
124
- ...s,
125
- layout: DEFAULT_TUI_PREFS.layout,
126
- }
127
- }
128
- return s
138
+ return normalizeTuiPrefs(s)
129
139
  }
130
140
 
131
141
  /** The live reactive prefs (read properties inside memos/JSX — tracked).
@@ -149,9 +159,9 @@ export const GAUGE_STYLES: readonly string[] = Object.freeze(['both', 'bar', 'pe
149
159
  export const ENABLED_CYCLE: readonly string[] = Object.freeze(['enabled', 'disabled'])
150
160
 
151
161
  export const BAR_SHAPES_CYCLE: readonly string[] = Object.freeze([
162
+ 'smooth',
152
163
  'line',
153
164
  'block',
154
- 'smooth',
155
165
  'ascii',
156
166
  'dots',
157
167
  'braille',
@@ -185,6 +195,40 @@ export type LanguagePref = 'auto' | 'pt-BR' | 'en'
185
195
 
186
196
  export const LANGUAGE_CYCLE: readonly string[] = Object.freeze(['auto', 'pt-BR', 'en'])
187
197
 
198
+ export type ThemeModePref = 'auto' | 'dark' | 'light'
199
+ export const THEME_MODES_CYCLE: readonly string[] = Object.freeze(['auto', 'dark', 'light'])
200
+
201
+ export type AccentColorPref = 'host' | 'pantheon' | 'emerald' | 'cyan' | 'amber' | 'purple' | 'rose'
202
+ export const ACCENT_COLORS_CYCLE: readonly string[] = Object.freeze([
203
+ 'host',
204
+ 'pantheon',
205
+ 'emerald',
206
+ 'cyan',
207
+ 'amber',
208
+ 'purple',
209
+ 'rose',
210
+ ])
211
+
212
+ export const ACCENT_PALETTE: Record<
213
+ AccentColorPref,
214
+ { primary: string; hover: string; muted: string }
215
+ > = {
216
+ host: { primary: '#fba970', hover: '#fdba74', muted: '#a1a1aa' },
217
+ pantheon: { primary: '#fba970', hover: '#fdba74', muted: '#a1a1aa' },
218
+ emerald: { primary: '#10b981', hover: '#34d399', muted: '#059669' },
219
+ cyan: { primary: '#06b6d4', hover: '#22d3ee', muted: '#0891b2' },
220
+ amber: { primary: '#f59e0b', hover: '#fbbf24', muted: '#d97706' },
221
+ purple: { primary: '#a855f7', hover: '#c084fc', muted: '#9333ea' },
222
+ rose: { primary: '#f43f5e', hover: '#fb7185', muted: '#e11d48' },
223
+ }
224
+
225
+ export function resolveAccentColor(accent: AccentColorPref | undefined, contextTheme: any): string {
226
+ if (!accent || accent === 'host') {
227
+ return contextTheme?.text?.feedback?.warning?.base ?? contextTheme?.text?.base ?? '#fba970'
228
+ }
229
+ return ACCENT_PALETTE[accent]?.primary ?? '#fba970'
230
+ }
231
+
188
232
  export interface TuiPrefs {
189
233
  version: 1
190
234
  layout: {
@@ -193,8 +237,13 @@ export interface TuiPrefs {
193
237
  settingsView?: SettingsViewModePref
194
238
  language?: LanguagePref
195
239
  }
240
+ theme?: {
241
+ mode?: ThemeModePref
242
+ accent?: AccentColorPref
243
+ }
196
244
  sidebar: {
197
245
  header: { version: boolean; preset: boolean; session: boolean }
246
+ pinnedSessions?: string[]
198
247
  blocks: { context: boolean; git: boolean; todo?: boolean; dispatch: boolean }
199
248
  context: {
200
249
  gauge: GaugeStyle
@@ -206,6 +255,8 @@ export interface TuiPrefs {
206
255
  modelUsage: boolean
207
256
  performance: boolean
208
257
  localSpend: boolean
258
+ turnCost: boolean
259
+ tokenAnatomy: boolean
209
260
  }
210
261
  }
211
262
  footer: { prompt: boolean; home: boolean }
@@ -216,15 +267,20 @@ export const DEFAULT_TUI_PREFS: TuiPrefs = {
216
267
  layout: {
217
268
  preset: 'comfortable',
218
269
  separator: 'spaces',
219
- settingsView: 'fullscreen',
270
+ settingsView: 'docked',
220
271
  language: 'auto',
221
272
  },
273
+ theme: {
274
+ mode: 'auto',
275
+ accent: 'host',
276
+ },
222
277
  sidebar: {
223
278
  header: { version: true, preset: true, session: true },
279
+ pinnedSessions: [],
224
280
  blocks: { context: true, git: true, todo: false, dispatch: true },
225
281
  context: {
226
282
  gauge: 'both',
227
- barShape: 'line',
283
+ barShape: 'smooth',
228
284
  barWidth: 'standard',
229
285
  evenMark: false,
230
286
  tokens: true,
@@ -232,6 +288,8 @@ export const DEFAULT_TUI_PREFS: TuiPrefs = {
232
288
  modelUsage: true,
233
289
  performance: true,
234
290
  localSpend: true,
291
+ turnCost: true,
292
+ tokenAnatomy: true,
235
293
  },
236
294
  },
237
295
  footer: { prompt: true, home: true },
@@ -262,6 +320,15 @@ export function normalizeTuiPrefs(raw: unknown): TuiPrefs {
262
320
  const footer = (
263
321
  typeof stored.footer === 'object' && stored.footer !== null ? stored.footer : {}
264
322
  ) as Record<string, any>
323
+ const rawTheme = (
324
+ typeof stored.theme === 'object' && stored.theme !== null ? stored.theme : {}
325
+ ) as Record<string, any>
326
+ const themeMode = THEME_MODES_CYCLE.includes(rawTheme.mode as string)
327
+ ? (rawTheme.mode as ThemeModePref)
328
+ : (DEFAULT_TUI_PREFS.theme?.mode ?? 'auto')
329
+ const themeAccent = ACCENT_COLORS_CYCLE.includes(rawTheme.accent as string)
330
+ ? (rawTheme.accent as AccentColorPref)
331
+ : (DEFAULT_TUI_PREFS.theme?.accent ?? 'host')
265
332
  const preset = LAYOUT_PRESETS_CYCLE.includes(layout.preset as string)
266
333
  ? (layout.preset as LayoutPresetPref)
267
334
  : DEFAULT_TUI_PREFS.layout.preset
@@ -297,12 +364,19 @@ export function normalizeTuiPrefs(raw: unknown): TuiPrefs {
297
364
  settingsView,
298
365
  language,
299
366
  },
367
+ theme: {
368
+ mode: themeMode,
369
+ accent: themeAccent,
370
+ },
300
371
  sidebar: {
301
372
  header: {
302
373
  version: asBool(header.version, true),
303
374
  preset: asBool(header.preset, true),
304
375
  session: asBool(header.session, true),
305
376
  },
377
+ pinnedSessions: Array.isArray(sidebar.pinnedSessions)
378
+ ? sidebar.pinnedSessions.filter((s: unknown) => typeof s === 'string')
379
+ : [],
306
380
  blocks: {
307
381
  context: asBool(blocks.context, true),
308
382
  git: asBool(blocks.git, true),
@@ -319,6 +393,8 @@ export function normalizeTuiPrefs(raw: unknown): TuiPrefs {
319
393
  modelUsage: asBool(context.modelUsage, true),
320
394
  performance: asBool(context.performance, true),
321
395
  localSpend: asBool(context.localSpend, true),
396
+ turnCost: asBool(context.turnCost, true),
397
+ tokenAnatomy: asBool(context.tokenAnatomy, true),
322
398
  },
323
399
  },
324
400
  footer: {
@@ -386,6 +462,29 @@ export function buildTuiTab(prefs: TuiPrefs, languagePref?: string): SettingsTab
386
462
  },
387
463
  ],
388
464
  },
465
+ {
466
+ title: isPt ? 'Cores & Tema' : 'Colors & Theme',
467
+ rows: [
468
+ {
469
+ id: 'tui.theme.mode',
470
+ name: isPt ? 'Modo do tema' : 'Theme mode',
471
+ value: tuiRowValue(prefs, 'tui.theme.mode') ?? 'auto',
472
+ cycle: THEME_MODES_CYCLE,
473
+ note: isPt
474
+ ? 'auto (segue o OpenCode) | dark | light'
475
+ : 'auto (follow OpenCode theme) | dark | light',
476
+ },
477
+ {
478
+ id: 'tui.theme.accent',
479
+ name: isPt ? 'Cor de destaque' : 'Accent color',
480
+ value: tuiRowValue(prefs, 'tui.theme.accent') ?? 'host',
481
+ cycle: ACCENT_COLORS_CYCLE,
482
+ note: isPt
483
+ ? 'host (segue tema) | pantheon | emerald | cyan | amber | purple | rose'
484
+ : 'host (follow theme) | pantheon | emerald | cyan | amber | purple | rose',
485
+ },
486
+ ],
487
+ },
389
488
  {
390
489
  title: isPt ? 'Barras & Medidores' : 'Bars & Gauges',
391
490
  rows: [
@@ -495,6 +594,18 @@ export function buildTuiTab(prefs: TuiPrefs, languagePref?: string): SettingsTab
495
594
  prefs.sidebar.context.performance,
496
595
  isPt ? 'tokens/segundo e latência' : 'cache % + tok/s',
497
596
  ),
597
+ row(
598
+ 'tui.sidebar.context.turnCost',
599
+ isPt ? 'Custo do turno' : 'Turn cost',
600
+ prefs.sidebar.context.turnCost,
601
+ isPt ? 'linha `Turn: $… (prev: $…)`' : 'the `Turn: $… (prev: $…)` line',
602
+ ),
603
+ row(
604
+ 'tui.sidebar.context.tokenAnatomy',
605
+ isPt ? 'Anatomia de tokens' : 'Token anatomy',
606
+ prefs.sidebar.context.tokenAnatomy,
607
+ isPt ? 'linha `↑in ↓out ✦think`' : 'the `↑in ↓out ✦think` line',
608
+ ),
498
609
  row(
499
610
  'tui.sidebar.context.localSpend',
500
611
  isPt ? 'Linha de custo local' : 'Local spend row',
@@ -559,6 +670,18 @@ export function applyTuiRow(draft: TuiPrefs, id: string, value: string): void {
559
670
  draft.layout.language = value as LanguagePref
560
671
  }
561
672
  return
673
+ case 'tui.theme.mode':
674
+ if (THEME_MODES_CYCLE.includes(value)) {
675
+ if (!draft.theme) draft.theme = { ...DEFAULT_TUI_PREFS.theme }
676
+ draft.theme.mode = value as ThemeModePref
677
+ }
678
+ return
679
+ case 'tui.theme.accent':
680
+ if (ACCENT_COLORS_CYCLE.includes(value)) {
681
+ if (!draft.theme) draft.theme = { ...DEFAULT_TUI_PREFS.theme }
682
+ draft.theme.accent = value as AccentColorPref
683
+ }
684
+ return
562
685
  case 'tui.sidebar.context.barShape':
563
686
  if (BAR_SHAPES_CYCLE.includes(value)) draft.sidebar.context.barShape = value as BarShapePref
564
687
  return
@@ -607,6 +730,12 @@ export function applyTuiRow(draft: TuiPrefs, id: string, value: string): void {
607
730
  case 'tui.sidebar.context.localSpend':
608
731
  draft.sidebar.context.localSpend = enabled
609
732
  return
733
+ case 'tui.sidebar.context.turnCost':
734
+ draft.sidebar.context.turnCost = enabled
735
+ return
736
+ case 'tui.sidebar.context.tokenAnatomy':
737
+ draft.sidebar.context.tokenAnatomy = enabled
738
+ return
610
739
  case 'tui.footer.prompt':
611
740
  draft.footer.prompt = enabled
612
741
  return
@@ -626,6 +755,9 @@ export function tuiRowValue(prefs: TuiPrefs, id: string): string | undefined {
626
755
  if (id === 'tui.layout.settingsView')
627
756
  return prefs.layout?.settingsView ?? DEFAULT_TUI_PREFS.layout.settingsView ?? 'docked'
628
757
  if (id === 'tui.layout.language') return prefs.layout?.language ?? 'auto'
758
+ if (id === 'tui.theme.mode') return prefs.theme?.mode ?? DEFAULT_TUI_PREFS.theme?.mode ?? 'auto'
759
+ if (id === 'tui.theme.accent')
760
+ return prefs.theme?.accent ?? DEFAULT_TUI_PREFS.theme?.accent ?? 'host'
629
761
  if (id === 'tui.sidebar.context.barShape') return prefs.sidebar.context.barShape
630
762
  if (id === 'tui.sidebar.context.barWidth') return prefs.sidebar.context.barWidth
631
763
  if (id === 'tui.sidebar.context.gauge') return prefs.sidebar.context.gauge
@@ -657,6 +789,10 @@ export function tuiRowValue(prefs: TuiPrefs, id: string): string | undefined {
657
789
  return prefs.sidebar.context.performance
658
790
  case 'tui.sidebar.context.localSpend':
659
791
  return prefs.sidebar.context.localSpend
792
+ case 'tui.sidebar.context.turnCost':
793
+ return prefs.sidebar.context.turnCost
794
+ case 'tui.sidebar.context.tokenAnatomy':
795
+ return prefs.sidebar.context.tokenAnatomy
660
796
  case 'tui.footer.prompt':
661
797
  return prefs.footer.prompt
662
798
  case 'tui.footer.home':
@@ -667,3 +803,24 @@ export function tuiRowValue(prefs: TuiPrefs, id: string): string | undefined {
667
803
  })()
668
804
  return enabled === undefined ? undefined : enabled ? 'enabled' : 'disabled'
669
805
  }
806
+
807
+ export function isSessionPinned(sessionID: string | undefined): boolean {
808
+ if (!sessionID) return false
809
+ const list = tuiPrefs().sidebar.pinnedSessions
810
+ return Array.isArray(list) && list.includes(sessionID)
811
+ }
812
+
813
+ export function togglePinSession(sessionID: string | undefined): Promise<void> {
814
+ if (!sessionID) return Promise.resolve()
815
+ return mutateTuiPrefs((draft) => {
816
+ if (!Array.isArray(draft.sidebar.pinnedSessions)) {
817
+ draft.sidebar.pinnedSessions = []
818
+ }
819
+ const idx = draft.sidebar.pinnedSessions.indexOf(sessionID)
820
+ if (idx >= 0) {
821
+ draft.sidebar.pinnedSessions.splice(idx, 1)
822
+ } else {
823
+ draft.sidebar.pinnedSessions.push(sessionID)
824
+ }
825
+ })
826
+ }
package/src/routing.yml CHANGED
@@ -207,6 +207,7 @@ agents:
207
207
  - memory_recall
208
208
  - pantheon_resources
209
209
  skills:
210
+ - artifact-management
210
211
  - loop-engineering
211
212
  - memory-bank
212
213
  - reflect
@@ -254,6 +255,7 @@ agents:
254
255
  - pantheon_code_mode
255
256
  skills:
256
257
  - clonedeps
258
+ - code-review-checklist
257
259
  - fast-path-execution
258
260
  - git-workflow-and-versioning
259
261
  - incremental-implementation
@@ -357,6 +359,7 @@ agents:
357
359
  - incremental-implementation
358
360
  - loop-engineering
359
361
  - reflect
362
+ - security-hardening
360
363
  - simplify
361
364
  - worktrees
362
365
  hephaestus:
@@ -128,43 +128,14 @@ ID so the `latest` pointer survives compaction. `state` must be an object — ne
128
128
 
129
129
  ---
130
130
 
131
- ## Safety Policy Configuration
132
-
133
- Configurable gates for different platforms and risk levels:
131
+ ## Safety Policy Summary
134
132
 
135
133
  | Gate | Default | Auto-Approval Condition |
136
- |------|---------|------------------------|
134
+ |---|---|---|
137
135
  | Council | Only when explicitly invoked | Never auto-start a council for ordinary implementation |
138
136
  | Plan approval | Only for requested or risk-required plans | Skip for bounded, clear work |
139
137
  | Themis review | Required for sensitive/material changes | May omit for trivial isolated edits; never auto-bypass required findings |
140
138
  | Git / external actions | Never Auto | Commit, push, merge, deploy, destructive/global changes require explicit approval |
141
- | Deploy | Always Ask | N/A — always requires human |
142
- | Destructive DB Ops | Always Ask | N/A — always requires human |
143
-
144
- ### Configuration Format (for agents/PLAN.md)
145
-
146
- ```yaml
147
- auto-continue:
148
- checkpoint_interval: 5 # turns between checkpoints
149
- idle_warning: 60 # seconds before warning
150
- idle_stall: 120 # seconds before stall detection
151
- idle_pause: 300 # seconds before auto-pause
152
- gates:
153
- plan_approval: when_required_by_scope_or_risk
154
- themis_review: required_for_sensitive_or_material_changes
155
- git_commit: never_auto
156
- deploy: always_ask
157
- destructive_ops: always_ask
158
- ```
159
-
160
- ### Idle Detection
161
-
162
- | Condition | Action |
163
- |-----------|--------|
164
- | No tool call for 60s | Log warning heartbeat (status: warning) |
165
- | No tool call for 120s | Trigger anti-stall protocol |
166
- | No tool call for 300s | Auto-save checkpoint and pause session |
167
- | Resume | User must acknowledge and restart |
168
139
 
169
140
  ---
170
141