pantheon-opencode 2.0.0-rc.1 → 2.0.1

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 (73) hide show
  1. package/AGENTS.global.md +2 -2
  2. package/AGENTS.md +8 -8
  3. package/CHANGELOG.md +92 -0
  4. package/README.md +15 -2
  5. package/README.pt-BR.md +15 -2
  6. package/bin/pantheon-init.mjs +13 -0
  7. package/commands/pantheon-audit.md +1 -1
  8. package/commands/pantheon-deepwork.md +1 -1
  9. package/commands/pantheon-optimize.md +41 -63
  10. package/package.json +4 -3
  11. package/plugin.json +1 -1
  12. package/prompts/optimize-database.prompt.md +5 -5
  13. package/prompts/plan-architecture.prompt.md +6 -6
  14. package/pyproject.toml +1 -1
  15. package/scripts/build-agents-md.mjs +10 -10
  16. package/scripts/build-plugin.mjs +26 -0
  17. package/scripts/install/opencode-version.mjs +17 -5
  18. package/scripts/install/opencode.mjs +8 -1
  19. package/scripts/optimize.mjs +322 -0
  20. package/scripts/prune.mjs +105 -14
  21. package/scripts/update.mjs +20 -15
  22. package/skills-lock.json +11 -11
  23. package/src/agents/aphrodite.md +15 -14
  24. package/src/agents/apollo.md +2 -1
  25. package/src/agents/athena.md +19 -12
  26. package/src/agents/demeter.md +2 -0
  27. package/src/agents/hephaestus.md +1 -0
  28. package/src/agents/hermes.md +19 -95
  29. package/src/agents/iris.md +3 -0
  30. package/src/agents/nyx.md +1 -0
  31. package/src/agents/prometheus.md +2 -0
  32. package/src/agents/talos.md +3 -0
  33. package/src/agents/themis.md +91 -87
  34. package/src/agents/zeus.md +41 -266
  35. package/src/instructions/agent-return-format.instructions.md +1 -1
  36. package/src/instructions/memory-protocol.instructions.md +1 -1
  37. package/src/instructions/zeus-anti-stall.instructions.md +3 -3
  38. package/src/instructions/zeus-communication-rules.instructions.md +1 -1
  39. package/src/instructions/zeus-council-synthesis.instructions.md +29 -10
  40. package/src/instructions/zeus-timeout-retry.instructions.md +10 -10
  41. package/src/pantheon/model-command.ts +12 -12
  42. package/src/pantheon/tools.ts +4 -0
  43. package/src/pantheon/tui-version-check.ts +1 -1
  44. package/src/pantheon/update-notifier.ts +13 -8
  45. package/src/pantheon/vision.ts +20 -20
  46. package/src/plugin/index.js +14594 -0
  47. package/src/plugins/tui/dist/tui.d.ts +3 -3
  48. package/src/plugins/tui/dist/tui.d.ts.map +1 -1
  49. package/src/plugins/tui/dist/tui.js +1028 -393
  50. package/src/plugins/tui/dist/tui.js.map +1 -1
  51. package/src/plugins/tui/package-lock.json +2 -2
  52. package/src/plugins/tui/package.json +1 -1
  53. package/src/plugins/tui/src/autonomy-state.ts +66 -25
  54. package/src/plugins/tui/src/decision-router-state.ts +59 -24
  55. package/src/plugins/tui/src/index.tsx +44 -23
  56. package/src/plugins/tui/src/j1-gate-status.ts +26 -9
  57. package/src/plugins/tui/src/pantheon-settings.tsx +484 -124
  58. package/src/plugins/tui/src/settings-i18n.ts +203 -0
  59. package/src/plugins/tui/src/tui-prefs.ts +131 -4
  60. package/src/plugins/tui/src/update-notice.ts +9 -6
  61. package/src/plugins/tui/src/whats-new-open.ts +4 -4
  62. package/src/plugins/tui/src/whats-new.tsx +119 -17
  63. package/src/skills/agent-coordination/SKILL.md +6 -6
  64. package/src/skills/artifact-management/SKILL.md +43 -39
  65. package/src/skills/artifact-management/references/artifact-templates.md +103 -48
  66. package/src/skills/auto-continue/references/auto-continue-details.md +13 -13
  67. package/src/skills/code-review-checklist/SKILL.md +6 -6
  68. package/src/skills/incremental-implementation/SKILL.md +13 -13
  69. package/src/skills/memory-bank/references/anti-patterns.md +3 -3
  70. package/src/skills/spec-driven-development/SKILL.md +12 -14
  71. package/src/skills/tdd-with-agents/SKILL.md +6 -5
  72. package/src/skills/visual-review-pipeline/SKILL.md +1 -1
  73. package/src/skills/visual-review-pipeline/references/workflow-steps.md +1 -1
@@ -27,7 +27,7 @@ import { execFile } from 'node:child_process'
27
27
  import { mkdirSync, readFileSync, renameSync, writeFileSync } from 'node:fs'
28
28
  import { join } from 'node:path'
29
29
  import type { Context } from '@opencode/plugin/tui/context'
30
- import { createSignal, For, onCleanup, Show } from 'solid-js'
30
+ import { createEffect, createSignal, For, onCleanup, onMount, Show } from 'solid-js'
31
31
  import {
32
32
  buildAutonomyTab,
33
33
  DEFAULT_DECISION_BUDGETS,
@@ -59,6 +59,7 @@ import {
59
59
  draftDirty,
60
60
  type EffectiveOverrides,
61
61
  EMPTY_TAB,
62
+ findRow,
62
63
  type OverridesLoad,
63
64
  resetTab,
64
65
  type SettingsDraft,
@@ -81,7 +82,15 @@ import {
81
82
  readActivePresetMarker,
82
83
  writeActivePreset,
83
84
  } from './preset-state.ts'
84
- import { applyTuiRow, buildTuiTab, mutateTuiPrefs, tuiPrefs } from './tui-prefs.ts'
85
+ import {
86
+ applyTuiRow,
87
+ buildTuiTab,
88
+ clearTuiDraftPreview,
89
+ mutateTuiPrefs,
90
+ savedTuiPrefs,
91
+ setTuiDraftPreview,
92
+ tuiPrefs,
93
+ } from './tui-prefs.ts'
85
94
  import { nextCheckState, type UpdateCheckState } from './update-notice.ts'
86
95
  import {
87
96
  buildUpdatesTab,
@@ -365,8 +374,8 @@ function resolveRunningVersion(): string {
365
374
 
366
375
  // ── The window view (presentational; both surfaces render it) ──────────
367
376
 
368
- const NAME_WIDTH = 28
369
- const VALUE_WIDTH = 22
377
+ const NAME_WIDTH = 26
378
+ const VALUE_WIDTH = 24
370
379
 
371
380
  export function SettingsWindow(props: {
372
381
  version: string
@@ -379,73 +388,108 @@ export function SettingsWindow(props: {
379
388
  fg?: any
380
389
  muted?: any
381
390
  warn?: any
391
+ hasKeyboard?: () => boolean
392
+ onJumpTab?: (index: number) => void
393
+ onSelectRow?: (id: string) => void
394
+ onCycleValue?: (id: string, direction: 1 | -1) => void
395
+ onSave?: () => void
396
+ onResetPage?: () => void
397
+ onStageDefaults?: () => void
398
+ onClose?: () => void
399
+ onDiscard?: () => void
400
+ onCancelExit?: () => void
401
+ isDialog?: boolean
402
+ maxHeight?: number
403
+ height?: number
404
+ boxRef?: (el: any) => void
405
+ onMouseDown?: () => void
382
406
  }) {
383
407
  const tab = () => props.tabs()[props.page()] ?? props.tabs()[0] ?? EMPTY_TAB
384
408
  return (
385
- <box flexDirection="column" paddingLeft={1} paddingRight={1} paddingTop={1}>
386
- {/* ── Top Header bar: Title + Horizontal Tabs + ESC (matching image.png) ── */}
387
- <box flexDirection="row" alignItems="center">
388
- <text attributes={1} fg={props.fg}>
389
- {`Pantheon v${props.version}`}
409
+ <box
410
+ {...(props.boxRef !== undefined ? { ref: props.boxRef } : {})}
411
+ focusable
412
+ flexDirection="column"
413
+ {...(props.height !== undefined ? { height: props.height } : { flexGrow: 1, flexBasis: 0 })}
414
+ minHeight={0}
415
+ border={!props.isDialog}
416
+ {...(props.isDialog ? {} : { borderStyle: 'rounded' as const })}
417
+ borderColor={
418
+ props.isDialog
419
+ ? undefined
420
+ : props.hasKeyboard?.()
421
+ ? (props.warn ?? '#fba970')
422
+ : (props.muted ?? '#52525b')
423
+ }
424
+ paddingLeft={1}
425
+ paddingRight={1}
426
+ paddingTop={0}
427
+ paddingBottom={0}
428
+ {...(props.onMouseDown !== undefined ? { onMouseDown: props.onMouseDown } : {})}
429
+ >
430
+ {/* ── Top Header bar: Title + Horizontal Clickable Tabs + ESC (matching opencode-quota) ── */}
431
+ <box
432
+ flexDirection="row"
433
+ flexWrap="wrap"
434
+ alignItems="center"
435
+ flexShrink={0}
436
+ marginBottom={1}
437
+ rowGap={1}
438
+ >
439
+ <text fg={props.fg} attributes={1} wrapMode="none">
440
+ <b>{'Pantheon'}</b>
441
+ <span style={{ fg: props.muted }}>{` v${props.version}`}</span>
390
442
  </text>
391
443
  <box width={2} />
392
- <box flexDirection="row" flexGrow={1} flexShrink={1}>
444
+ <box
445
+ flexDirection="row"
446
+ flexWrap="wrap"
447
+ flexGrow={1}
448
+ flexShrink={0}
449
+ columnGap={1}
450
+ rowGap={1}
451
+ >
393
452
  <For each={props.tabs()}>
394
453
  {(t, index) => {
395
454
  const isActive = () => index() === props.page()
396
455
  return (
397
- <text
456
+ <box
457
+ onMouseDown={() => props.onJumpTab?.(index())}
458
+ paddingLeft={1}
459
+ paddingRight={1}
398
460
  flexShrink={0}
399
- fg={isActive() ? (props.warn ?? props.fg) : props.muted}
400
- {...(isActive() ? { attributes: 1 } : {})}
461
+ {...(isActive() ? { backgroundColor: '#262626' } : {})}
401
462
  >
402
- {`${t.title}${tabDirty(props.draft(), t) ? ' ●' : ''} `}
403
- </text>
463
+ <text
464
+ wrapMode="none"
465
+ fg={isActive() ? (props.warn ?? '#fba970') : props.muted}
466
+ {...(isActive() ? { attributes: 1 } : {})}
467
+ >
468
+ {`${t.title}${tabDirty(props.draft(), t) ? ' ●' : ''}`}
469
+ </text>
470
+ </box>
404
471
  )
405
472
  }}
406
473
  </For>
407
474
  </box>
408
- <text fg={props.muted}>{'esc'}</text>
409
- </box>
410
-
411
- {/* ── Thin divider under header ── */}
412
- <box flexDirection="row" height={1}>
413
- <box flexGrow={1}>
414
- <text fg={props.muted}>{'─'.repeat(78)}</text>
475
+ <box onMouseDown={() => props.onClose?.()} paddingLeft={1} flexShrink={0}>
476
+ <text fg={props.muted} wrapMode="none">
477
+ {'esc'}
478
+ </text>
415
479
  </box>
416
480
  </box>
417
481
 
418
- {/* ── Main Body: Left Rail + Content (matching image.png & image_2.png) ── */}
419
- <box flexDirection="row">
420
- {/* Left Rail: Tab list with active indicator */}
421
- <box width={18} flexDirection="column">
422
- <For each={props.tabs()}>
423
- {(t, index) => {
424
- const isActive = () => index() === props.page()
425
- return (
426
- <text
427
- fg={isActive() ? (props.warn ?? props.fg) : props.muted}
428
- {...(isActive() ? { attributes: 1 } : {})}
429
- >
430
- {`${isActive() ? '▸ ' : ' '}${t.title}${tabDirty(props.draft(), t) ? ' ●' : ''}`}
431
- </text>
432
- )
433
- }}
434
- </For>
435
- <box height={1} />
436
- <text fg={props.muted}>{'1-9: tab'}</text>
437
- <text fg={props.muted}>{'tab: next'}</text>
438
- </box>
439
-
440
- {/* Content panel */}
441
- <box flexGrow={1} flexShrink={1} flexDirection="column" paddingLeft={1}>
442
- <text attributes={1} fg={props.warn ?? props.fg}>
443
- {tab().title}
444
- </text>
445
- <text fg={props.muted}>{'─'.repeat(40)}</text>
482
+ {/* ── Main Body: Scrollable content panel ── */}
483
+ <box flexDirection="column" flexGrow={1} flexBasis={0} minHeight={0} overflow="hidden">
484
+ <scrollbox
485
+ flexGrow={1}
486
+ flexBasis={0}
487
+ minHeight={0}
488
+ {...(props.maxHeight !== undefined ? { maxHeight: props.maxHeight } : {})}
489
+ >
446
490
  <For each={tab().groups}>
447
491
  {(group) => (
448
- <box flexDirection="column">
492
+ <box flexDirection="column" marginBottom={1}>
449
493
  <Show when={group.title !== undefined}>
450
494
  <text attributes={1} fg={props.warn ?? props.fg}>
451
495
  {group.title}
@@ -456,27 +500,40 @@ export function SettingsWindow(props: {
456
500
  const isSelected = () => row.id === props.selectedId()
457
501
  const display = () => props.draft()[row.id] ?? row.value
458
502
  const staged = () => props.draft()[row.id] !== undefined
459
- const gutter = () => (isSelected() ? ' ' : ' ')
460
- const valueCell = () =>
461
- row.cycle !== undefined ? `< ${display()} >` : display()
503
+ const gutter = () => (isSelected() ? '▸ ' : ' ')
504
+ const valueCell = () => {
505
+ if (row.cycle !== undefined) return `< ${display()} >`
506
+ if (row.action !== undefined) return `[ ${display()} ]`
507
+ if (row.id.startsWith('autonomy.gradient.')) return `[ref] ${display()}`
508
+ return display()
509
+ }
462
510
  return (
463
511
  <box
464
512
  flexDirection="row"
465
- backgroundColor={isSelected() ? (props.warn ?? '#f59e0b') : undefined}
513
+ {...(isSelected() ? { backgroundColor: '#262626' } : {})}
514
+ onMouseDown={() => {
515
+ props.onSelectRow?.(row.id)
516
+ }}
466
517
  >
467
518
  <box width={NAME_WIDTH + 2}>
468
519
  <text
469
- fg={isSelected() ? '#000000' : props.fg}
520
+ fg={isSelected() ? (props.warn ?? '#fba970') : props.fg}
470
521
  {...(isSelected() ? { attributes: 1 } : {})}
471
522
  >
472
523
  {`${gutter()}${row.name}`.padEnd(NAME_WIDTH + 2)}
473
524
  </text>
474
525
  </box>
475
- <box width={VALUE_WIDTH}>
526
+ <box
527
+ width={VALUE_WIDTH}
528
+ onMouseDown={() => {
529
+ props.onSelectRow?.(row.id)
530
+ props.onCycleValue?.(row.id, 1)
531
+ }}
532
+ >
476
533
  <text
477
534
  fg={
478
535
  isSelected()
479
- ? '#000000'
536
+ ? '#ffffff'
480
537
  : staged()
481
538
  ? (props.warn ?? props.fg)
482
539
  : props.muted
@@ -488,26 +545,31 @@ export function SettingsWindow(props: {
488
545
  </box>
489
546
  <Show when={row.note !== undefined}>
490
547
  <box flexGrow={1} flexShrink={1}>
491
- <text fg={isSelected() ? '#111827' : props.muted}>{row.note}</text>
548
+ <text fg={isSelected() ? '#e5e7eb' : props.muted}>{row.note}</text>
492
549
  </box>
493
550
  </Show>
494
551
  </box>
495
552
  )
496
553
  }}
497
554
  </For>
498
- <box height={1} />
499
555
  </box>
500
556
  )}
501
557
  </For>
502
- </box>
558
+ </scrollbox>
503
559
  </box>
504
560
 
505
561
  {/* ── Footer: notice + botões (chips) + keys (matching image.png & image_2.png) ── */}
506
562
  <Show when={props.notice() !== undefined}>
507
- <text fg={props.notice()?.startsWith('✅') ? props.fg : (props.warn ?? props.muted)}>
508
- {props.notice()?.startsWith('✅') || props.notice()?.startsWith('saved')
563
+ <text
564
+ fg={
565
+ props.notice()?.startsWith('[OK]') || props.notice()?.startsWith('saved')
566
+ ? props.fg
567
+ : (props.warn ?? props.muted)
568
+ }
569
+ >
570
+ {props.notice()?.startsWith('[OK]') || props.notice()?.startsWith('saved')
509
571
  ? props.notice()
510
- : `⚠ ${props.notice()}`}
572
+ : `[WARN] ${props.notice()}`}
511
573
  </text>
512
574
  </Show>
513
575
 
@@ -518,43 +580,94 @@ export function SettingsWindow(props: {
518
580
  <Show
519
581
  when={draftDirty(props.draft())}
520
582
  fallback={
521
- <box flexDirection="row">
522
- <box backgroundColor="#262626">
583
+ <box
584
+ flexDirection="row"
585
+ flexWrap="wrap"
586
+ alignItems="center"
587
+ flexShrink={0}
588
+ rowGap={1}
589
+ >
590
+ <box
591
+ backgroundColor="#262626"
592
+ flexShrink={0}
593
+ onMouseDown={() => props.onClose?.()}
594
+ >
523
595
  <text fg="#ffffff">{' Close '}</text>
524
596
  </box>
525
- <text fg={props.muted}>{' '}</text>
526
- <box backgroundColor="#262626">
597
+ <text fg={props.muted} flexShrink={0}>
598
+ {' '}
599
+ </text>
600
+ <box
601
+ backgroundColor="#262626"
602
+ flexShrink={0}
603
+ onMouseDown={() => props.onResetPage?.()}
604
+ >
527
605
  <text fg="#ffffff">{' Reset page '}</text>
528
606
  </box>
529
- <text fg={props.muted}>{' '}</text>
530
- <box backgroundColor="#262626">
607
+ <text fg={props.muted} flexShrink={0}>
608
+ {' '}
609
+ </text>
610
+ <box
611
+ backgroundColor="#262626"
612
+ flexShrink={0}
613
+ onMouseDown={() => props.onStageDefaults?.()}
614
+ >
531
615
  <text fg="#ffffff">{' Defaults '}</text>
532
616
  </box>
533
- <box flexGrow={1} />
534
- <text fg={props.muted}>{'no staged changes'}</text>
617
+ <box flexGrow={1} minWidth={1} />
618
+ <text fg={props.muted} flexShrink={0}>
619
+ {'no staged changes'}
620
+ </text>
535
621
  </box>
536
622
  }
537
623
  >
538
- <box flexDirection="row">
539
- <box backgroundColor="#fba970">
624
+ <box
625
+ flexDirection="row"
626
+ flexWrap="wrap"
627
+ alignItems="center"
628
+ flexShrink={0}
629
+ rowGap={1}
630
+ >
631
+ <box backgroundColor="#fba970" flexShrink={0} onMouseDown={() => props.onSave?.()}>
540
632
  <text fg="#000000">{' Save '}</text>
541
633
  </box>
542
- <text fg={props.muted}>{' '}</text>
543
- <box backgroundColor="#262626">
634
+ <text fg={props.muted} flexShrink={0}>
635
+ {' '}
636
+ </text>
637
+ <box
638
+ backgroundColor="#262626"
639
+ flexShrink={0}
640
+ onMouseDown={() => props.onDiscard?.()}
641
+ >
544
642
  <text fg="#ffffff">{' Discard '}</text>
545
643
  </box>
546
- <text fg={props.muted}>{' '}</text>
547
- <box backgroundColor="#262626">
644
+ <text fg={props.muted} flexShrink={0}>
645
+ {' '}
646
+ </text>
647
+ <box
648
+ backgroundColor="#262626"
649
+ flexShrink={0}
650
+ onMouseDown={() => props.onResetPage?.()}
651
+ >
548
652
  <text fg="#ffffff">{' Reset page '}</text>
549
653
  </box>
550
- <box flexGrow={1} />
551
- <text fg={props.warn ?? '#f59e0b'}>{'unsaved changes'}</text>
654
+ <box flexGrow={1} minWidth={1} />
655
+ <text fg={props.warn ?? '#f59e0b'} flexShrink={0}>
656
+ {'unsaved changes'}
657
+ </text>
552
658
  </box>
553
659
  </Show>
554
660
  <text fg={props.muted}>
555
- {
556
- '› or ←/→ change · ↑↓ select · tab next tab · ctrl+s save · ctrl+r reset page · esc close'
557
- }
661
+ {(() => {
662
+ const currentRow = findRow(tab(), props.selectedId() ?? '')
663
+ if (currentRow?.cycle !== undefined) {
664
+ return 'click or ›/←/→ change · ↑↓ select · tab next tab · ctrl+s save · ctrl+r reset page · esc close'
665
+ }
666
+ if (currentRow?.action !== undefined) {
667
+ return 'enter or space run action · ↑↓ select · tab next tab · ctrl+s save · ctrl+r reset page · esc close'
668
+ }
669
+ return '[ref] documented reference (read-only) · ↑↓ select · tab next tab · esc close'
670
+ })()}
558
671
  </text>
559
672
  </box>
560
673
  }
@@ -564,15 +677,15 @@ export function SettingsWindow(props: {
564
677
  <text fg={props.warn ?? '#f59e0b'} attributes={1}>
565
678
  {'Keep your changes? '}
566
679
  </text>
567
- <box backgroundColor="#fba970">
680
+ <box backgroundColor="#fba970" onMouseDown={() => props.onSave?.()}>
568
681
  <text fg="#000000">{' Save '}</text>
569
682
  </box>
570
683
  <text fg={props.muted}>{' '}</text>
571
- <box backgroundColor="#262626">
684
+ <box backgroundColor="#262626" onMouseDown={() => props.onDiscard?.()}>
572
685
  <text fg="#ffffff">{' Discard '}</text>
573
686
  </box>
574
687
  <text fg={props.muted}>{' '}</text>
575
- <box backgroundColor="#262626">
688
+ <box backgroundColor="#262626" onMouseDown={() => props.onCancelExit?.()}>
576
689
  <text fg="#ffffff">{' Keep editing '}</text>
577
690
  </box>
578
691
  </box>
@@ -588,8 +701,11 @@ export function SettingsWindow(props: {
588
701
  interface PageApi {
589
702
  move: (delta: number) => void
590
703
  step: (direction: 1 | -1) => void
704
+ selectById?: (id: string) => void
705
+ cycleRowById?: (id: string, direction: 1 | -1) => void
591
706
  actuate: () => void
592
707
  nextTab: () => void
708
+ prevTab?: () => void
593
709
  jumpTab: (index: number) => void
594
710
  save: () => void
595
711
  resetPage: () => void
@@ -635,6 +751,11 @@ function createWindowController(
635
751
  const [notice, setNotice] = createSignal<string | undefined>(undefined)
636
752
  const [confirmExit, setConfirmExit] = createSignal(false)
637
753
 
754
+ // Real-time preview of staged draft preferences across open TUI views
755
+ createEffect(() => {
756
+ setTuiDraftPreview(draft())
757
+ })
758
+
638
759
  // Load changelog highlights asynchronously
639
760
  void readChangelogForBundle(import.meta.url).then((text) => {
640
761
  if (!text) return
@@ -674,26 +795,30 @@ function createWindowController(
674
795
  return input
675
796
  }
676
797
 
677
- const tabs = (): SettingsTab[] => [
678
- buildGatesTab(load()),
679
- buildDecisionTab(decision(), process.env, readAuthProviders(), readConfigProviders()),
680
- buildPresetTab(presetInput()),
681
- buildTuiTab(tuiPrefs()),
682
- buildAutonomyTab({
683
- goalLoop: goalLoop(),
684
- budgets: budgets(),
685
- goalLoopRestartPending: autonomyRestartPending(),
686
- }),
687
- buildJ1Tab(process.env, false),
688
- buildUpdatesTab(updatesInput()),
689
- buildChangelogTab(currentVersion, changelogItems()),
690
- buildDoctorTab({
691
- runningVersion: currentVersion,
692
- nodeVersion: process.versions.node,
693
- load: load(),
694
- }),
695
- buildAboutTab(currentVersion),
696
- ]
798
+ const tabs = (): SettingsTab[] => {
799
+ const lang = savedTuiPrefs().layout?.language
800
+ return [
801
+ buildGatesTab(load()),
802
+ buildDecisionTab(decision(), process.env, readAuthProviders(), readConfigProviders(), lang),
803
+ buildPresetTab(presetInput()),
804
+ buildTuiTab(savedTuiPrefs()),
805
+ buildAutonomyTab({
806
+ goalLoop: goalLoop(),
807
+ budgets: budgets(),
808
+ goalLoopRestartPending: autonomyRestartPending(),
809
+ languagePref: lang,
810
+ }),
811
+ buildJ1Tab(process.env, false, lang),
812
+ buildUpdatesTab(updatesInput()),
813
+ buildChangelogTab(currentVersion, changelogItems()),
814
+ buildDoctorTab({
815
+ runningVersion: currentVersion,
816
+ nodeVersion: process.versions.node,
817
+ load: load(),
818
+ }),
819
+ buildAboutTab(currentVersion),
820
+ ]
821
+ }
697
822
 
698
823
  const rows = () => tabRows(tabs()[page()] ?? tabs()[0] ?? EMPTY_TAB)
699
824
 
@@ -748,7 +873,7 @@ function createWindowController(
748
873
  })
749
874
  } catch {}
750
875
  } else {
751
- setNotice('✅ update complete — restart OpenCode or run `npx pantheon-opencode init`')
876
+ setNotice('[OK] update complete — restart OpenCode or run `npx pantheon-opencode init`')
752
877
  try {
753
878
  context.ui.toast?.show?.({
754
879
  variant: 'info',
@@ -948,6 +1073,7 @@ function createWindowController(
948
1073
  return
949
1074
  }
950
1075
  if (staged > 0) {
1076
+ clearTuiDraftPreview()
951
1077
  setDraft({})
952
1078
  try {
953
1079
  context.ui.toast?.show?.({
@@ -963,6 +1089,7 @@ function createWindowController(
963
1089
 
964
1090
  const discard = () => {
965
1091
  const staged = draftCount(draft())
1092
+ clearTuiDraftPreview()
966
1093
  setDraft({})
967
1094
  setConfirmExit(false)
968
1095
  if (staged > 0) {
@@ -984,9 +1111,34 @@ function createWindowController(
984
1111
 
985
1112
  const selectedId = () => rows()[selected()]?.id
986
1113
 
1114
+ const selectById = (id: string) => {
1115
+ if (confirmExit()) setConfirmExit(false)
1116
+ const list = rows()
1117
+ const index = list.findIndex((r) => r.id === id)
1118
+ if (index !== -1) setSelected(index)
1119
+ }
1120
+
1121
+ const cycleRowById = (id: string, direction: 1 | -1) => {
1122
+ if (confirmExit()) setConfirmExit(false)
1123
+ const list = rows()
1124
+ const index = list.findIndex((r) => r.id === id)
1125
+ if (index !== -1) {
1126
+ setSelected(index)
1127
+ const row = list[index]
1128
+ if (row?.action === 'update-check') checkUpdatesNow()
1129
+ else if (row?.action === 'update-run') runUpdateNow()
1130
+ else if (row) {
1131
+ setNotice(undefined)
1132
+ setDraft(stageValue(draft(), row, direction))
1133
+ }
1134
+ }
1135
+ }
1136
+
987
1137
  const api: PageApi = {
988
1138
  move,
989
1139
  step,
1140
+ selectById,
1141
+ cycleRowById,
990
1142
  actuate: () => {
991
1143
  if (confirmExit()) setConfirmExit(false)
992
1144
  const row = rows()[selected()]
@@ -995,6 +1147,14 @@ function createWindowController(
995
1147
  else step(1)
996
1148
  },
997
1149
  nextTab,
1150
+ prevTab: () => {
1151
+ if (confirmExit()) setConfirmExit(false)
1152
+ const count = tabs().length
1153
+ if (count > 0) {
1154
+ setPage((current) => (current - 1 + count) % count)
1155
+ setSelected(0)
1156
+ }
1157
+ },
998
1158
  jumpTab: (index) => {
999
1159
  if (confirmExit()) setConfirmExit(false)
1000
1160
  if (index >= 0 && index < tabs().length) {
@@ -1020,6 +1180,7 @@ function createWindowController(
1020
1180
  confirmExit: () => confirmExit(),
1021
1181
  api,
1022
1182
  cleanup: () => {
1183
+ clearTuiDraftPreview()
1023
1184
  pageApi = undefined
1024
1185
  setBlocking(false)
1025
1186
  },
@@ -1062,6 +1223,15 @@ function SettingsPage(props: { context: Context; data: Record<string, any> | und
1062
1223
  fg={theme.base}
1063
1224
  muted={theme.muted}
1064
1225
  warn={warn}
1226
+ onJumpTab={(idx) => controller.api.jumpTab(idx)}
1227
+ onSelectRow={(id) => controller.api.selectById?.(id)}
1228
+ onCycleValue={(id, dir) => controller.api.cycleRowById?.(id, dir)}
1229
+ onSave={() => controller.api.save()}
1230
+ onResetPage={() => controller.api.resetPage()}
1231
+ onStageDefaults={() => controller.api.stageDefaults()}
1232
+ onClose={() => controller.api.close()}
1233
+ onDiscard={() => controller.api.discard?.()}
1234
+ onCancelExit={() => controller.api.cancelExit?.()}
1065
1235
  />
1066
1236
  )
1067
1237
  }
@@ -1105,6 +1275,8 @@ function openSettingsDialog(context: Context): void {
1105
1275
  setBlocking(true)
1106
1276
  setDialogOpen(true)
1107
1277
  pageApi = controller.api
1278
+ const rendererHeight = () => (context as any).renderer?.height ?? 30
1279
+ const maxHeight = () => Math.min(16, Math.max(8, Math.floor(rendererHeight() * 0.55)))
1108
1280
  try {
1109
1281
  context.ui.dialog.show(
1110
1282
  () => (
@@ -1119,15 +1291,178 @@ function openSettingsDialog(context: Context): void {
1119
1291
  fg={theme.base}
1120
1292
  muted={theme.muted}
1121
1293
  warn={warn}
1294
+ isDialog={true}
1295
+ maxHeight={maxHeight()}
1296
+ onJumpTab={(idx) => controller.api.jumpTab(idx)}
1297
+ onSelectRow={(id) => controller.api.selectById?.(id)}
1298
+ onCycleValue={(id, dir) => controller.api.cycleRowById?.(id, dir)}
1299
+ onSave={() => controller.api.save()}
1300
+ onResetPage={() => controller.api.resetPage()}
1301
+ onStageDefaults={() => controller.api.stageDefaults()}
1302
+ onClose={() => controller.api.close()}
1303
+ onDiscard={() => controller.api.discard?.()}
1304
+ onCancelExit={() => controller.api.cancelExit?.()}
1122
1305
  />
1123
1306
  ),
1124
1307
  close,
1125
1308
  )
1309
+ context.ui.dialog.set({ size: 'large' })
1126
1310
  } catch {
1127
1311
  /* dialog stack unavailable — fail-open */
1128
1312
  }
1129
1313
  }
1130
1314
 
1315
+ // ── In-session docked window (session.composer.top) ─────────────────────
1316
+
1317
+ const [settingsOpen, setSettingsOpen] = createSignal(false)
1318
+ const [activeSessionId, setActiveSessionId] = createSignal<string | undefined>()
1319
+
1320
+ export function isPantheonSettingsOpen(): boolean {
1321
+ return settingsOpen()
1322
+ }
1323
+
1324
+ export function routeSessionID(context: any): string | undefined {
1325
+ try {
1326
+ const route = context?.ui?.router?.current?.()
1327
+ return route?.type === 'session' ? route?.sessionID : undefined
1328
+ } catch {
1329
+ return undefined
1330
+ }
1331
+ }
1332
+
1333
+ export function closePantheonSettings(): void {
1334
+ if (pageApi) {
1335
+ pageApi.close()
1336
+ if (pageApi.confirmExit?.()) {
1337
+ return
1338
+ }
1339
+ }
1340
+ setSettingsOpen(false)
1341
+ setBlocking(false)
1342
+ }
1343
+
1344
+ export function PantheonSettingsSlot(props: { context: Context; sessionID: string }) {
1345
+ onMount(() => {
1346
+ setActiveSessionId(props.sessionID)
1347
+ })
1348
+ onCleanup(() => {
1349
+ if (activeSessionId() === props.sessionID) {
1350
+ setActiveSessionId(undefined)
1351
+ }
1352
+ })
1353
+ return (
1354
+ <Show when={settingsOpen() && (activeSessionId() === props.sessionID || !activeSessionId())}>
1355
+ <InSessionSettingsWindow context={props.context} sessionID={props.sessionID} />
1356
+ </Show>
1357
+ )
1358
+ }
1359
+
1360
+ function InSessionSettingsWindow(props: { context: Context; sessionID: string }) {
1361
+ let windowBox: any
1362
+ const context = props.context
1363
+ const initialRoom = () => Math.max(14, ((context as any).renderer?.height ?? 30) - 10)
1364
+ const [roomHeight, setRoomHeight] = createSignal<number>(initialRoom())
1365
+ const [hasKeyboard, setHasKeyboard] = createSignal(false)
1366
+
1367
+ function measureRoom(): void {
1368
+ const box = windowBox
1369
+ if (!box || box.isDestroyed) return
1370
+ let child = box
1371
+ for (let parent = box.parent; parent; child = parent, parent = parent.parent) {
1372
+ const siblings = parent.getChildren?.() ?? []
1373
+ const messages = siblings[0]
1374
+ if (
1375
+ messages === child ||
1376
+ !messages?.getChildren?.().some((item: any) => 'scrollChildIntoView' in item)
1377
+ ) {
1378
+ continue
1379
+ }
1380
+ const otherRows = siblings
1381
+ .filter((item: any) => item !== child && item !== messages)
1382
+ .reduce((total: number, item: any) => total + (item.height ?? 0), 0)
1383
+ const room = Math.max(
1384
+ 12,
1385
+ (parent.height ?? 24) - 1 - otherRows - ((child.height ?? 0) - (box.height ?? 0)),
1386
+ )
1387
+ if (room !== roomHeight()) queueMicrotask(() => setRoomHeight(room))
1388
+ return
1389
+ }
1390
+ }
1391
+
1392
+ onMount(() => {
1393
+ try {
1394
+ ;(context as any).renderer?.root?.on?.('layout-changed', measureRoom)
1395
+ ;(context as any).renderer?.on?.('resize', measureRoom)
1396
+ onCleanup(() => {
1397
+ try {
1398
+ ;(context as any).renderer?.root?.off?.('layout-changed', measureRoom)
1399
+ ;(context as any).renderer?.off?.('resize', measureRoom)
1400
+ } catch {}
1401
+ })
1402
+ } catch {}
1403
+ measureRoom()
1404
+ setTimeout(() => {
1405
+ try {
1406
+ windowBox?.focus?.()
1407
+ } catch {}
1408
+ }, 50)
1409
+ })
1410
+
1411
+ try {
1412
+ const popMode = (context as any).keymap?.mode?.push?.(ROUTE_MODE)
1413
+ if (popMode !== undefined) onCleanup(() => popMode())
1414
+ } catch {}
1415
+
1416
+ const controller = createWindowController(context, () => {
1417
+ setSettingsOpen(false)
1418
+ setBlocking(false)
1419
+ })
1420
+
1421
+ onCleanup(controller.cleanup)
1422
+ pageApi = controller.api
1423
+
1424
+ const theme = (context as any).theme?.text ?? {}
1425
+ const warn = (theme?.feedback as any)?.warning?.base ?? '#fba970'
1426
+
1427
+ return (
1428
+ <SettingsWindow
1429
+ boxRef={(el: any) => {
1430
+ windowBox = el
1431
+ if (el) {
1432
+ el.on?.('focused', () => setHasKeyboard(true))
1433
+ el.on?.('blurred', () => setHasKeyboard(false))
1434
+ }
1435
+ }}
1436
+ height={roomHeight()}
1437
+ version={resolveRunningVersion()}
1438
+ tabs={controller.tabs}
1439
+ page={controller.page}
1440
+ selectedId={controller.selectedId}
1441
+ draft={controller.draft}
1442
+ notice={controller.notice}
1443
+ confirmExit={controller.confirmExit}
1444
+ fg={theme.base}
1445
+ muted={theme.muted}
1446
+ warn={warn}
1447
+ hasKeyboard={hasKeyboard}
1448
+ onJumpTab={(idx) => controller.api.jumpTab(idx)}
1449
+ onSelectRow={(id) => controller.api.selectById?.(id)}
1450
+ onCycleValue={(id, dir) => controller.api.cycleRowById?.(id, dir)}
1451
+ onSave={() => controller.api.save()}
1452
+ onResetPage={() => controller.api.resetPage()}
1453
+ onStageDefaults={() => controller.api.stageDefaults()}
1454
+ onClose={() => closePantheonSettings()}
1455
+ onDiscard={() => controller.api.discard?.()}
1456
+ onCancelExit={() => controller.api.cancelExit?.()}
1457
+ onMouseDown={() => {
1458
+ try {
1459
+ windowBox?.focus?.()
1460
+ } catch {}
1461
+ }}
1462
+ />
1463
+ )
1464
+ }
1465
+
1131
1466
  // ── Setup: register once, gate once, priority 1 (anti-theft) ───────────
1132
1467
 
1133
1468
  export function setupPantheonSettings(context: Context): void {
@@ -1155,25 +1490,15 @@ export function setupPantheonSettings(context: Context): void {
1155
1490
  title: 'Close settings',
1156
1491
  bind: 'escape,q',
1157
1492
  run: () => {
1158
- try {
1159
- context.ui.toast?.show?.({ variant: 'info', message: 'settings: close command fired' })
1160
- } catch {}
1161
1493
  if (pageApi === undefined) {
1162
- try {
1163
- context.ui.toast?.show?.({
1164
- variant: 'warning',
1165
- message: 'settings: no window controller bound',
1166
- })
1167
- } catch {
1168
- /* toast unavailable */
1169
- }
1494
+ closePantheonSettings()
1170
1495
  return undefined
1171
1496
  }
1172
1497
  if (pageApi.confirmExit?.()) {
1173
1498
  pageApi.cancelExit?.()
1174
1499
  return undefined
1175
1500
  }
1176
- pageApi.close()
1501
+ closePantheonSettings()
1177
1502
  return undefined
1178
1503
  },
1179
1504
  },
@@ -1243,6 +1568,15 @@ export function setupPantheonSettings(context: Context): void {
1243
1568
  return undefined
1244
1569
  },
1245
1570
  },
1571
+ {
1572
+ id: 'pantheon.settings.prev.tab',
1573
+ title: 'Previous settings tab',
1574
+ bind: 'shift+tab',
1575
+ run: () => {
1576
+ pageApi?.prevTab?.()
1577
+ return undefined
1578
+ },
1579
+ },
1246
1580
  {
1247
1581
  id: 'pantheon.settings.save',
1248
1582
  title: 'Save staged changes',
@@ -1289,7 +1623,7 @@ export function setupPantheonSettings(context: Context): void {
1289
1623
  context.keymap.layer(() => ({
1290
1624
  mode: ROUTE_MODE,
1291
1625
  priority: 1,
1292
- enabled: () => routeGated(),
1626
+ enabled: () => routeGated() || settingsOpen(),
1293
1627
  commands,
1294
1628
  }))
1295
1629
  } catch {
@@ -1300,7 +1634,7 @@ export function setupPantheonSettings(context: Context): void {
1300
1634
  context.keymap.layer(() => ({
1301
1635
  mode: 'global' as const,
1302
1636
  priority: 1,
1303
- enabled: () => dialogOpen(),
1637
+ enabled: () => dialogOpen() || settingsOpen(),
1304
1638
  commands,
1305
1639
  }))
1306
1640
  } catch {
@@ -1312,7 +1646,9 @@ export function setupPantheonSettings(context: Context): void {
1312
1646
 
1313
1647
  export async function openPantheonSettings(context: Context): Promise<void> {
1314
1648
  try {
1315
- if (routerAvailable && context.ui?.router?.navigate) {
1649
+ const prefs = tuiPrefs()
1650
+ const viewMode = prefs.layout?.settingsView ?? 'docked'
1651
+ if (viewMode === 'fullscreen' && routerAvailable && context.ui?.router?.navigate) {
1316
1652
  let returnRoute: WindowRoute | undefined
1317
1653
  try {
1318
1654
  const current = context.ui.router.current()
@@ -1331,8 +1667,32 @@ export async function openPantheonSettings(context: Context): Promise<void> {
1331
1667
  })
1332
1668
  return
1333
1669
  }
1670
+ if (viewMode === 'dialog') {
1671
+ openSettingsDialog(context)
1672
+ return
1673
+ }
1334
1674
  } catch {
1335
- /* router unusable — fall through to the dialog */
1675
+ /* preferences check failed — fall through to docked */
1336
1676
  }
1337
- openSettingsDialog(context)
1677
+
1678
+ // Primary mode: docked in session.composer.top
1679
+ const sessionID = (context as any)?.sessionID ?? routeSessionID(context) ?? activeSessionId()
1680
+ if (!sessionID) {
1681
+ try {
1682
+ context.ui?.toast?.show?.({
1683
+ variant: 'info',
1684
+ title: 'Pantheon',
1685
+ message: 'Open a session first: Pantheon settings opens above the prompt box.',
1686
+ })
1687
+ } catch {}
1688
+ return
1689
+ }
1690
+
1691
+ if (settingsOpen()) {
1692
+ closePantheonSettings()
1693
+ return
1694
+ }
1695
+
1696
+ setSettingsOpen(true)
1697
+ setBlocking(true)
1338
1698
  }