pantheon-opencode 2.0.4 → 2.1.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.
- package/AGENTS.global.md +2 -2
- package/AGENTS.md +1 -1
- package/CHANGELOG.md +53 -0
- package/README.md +27 -11
- package/README.pt-BR.md +27 -11
- package/commands/pantheon-deepwork.md +11 -2
- package/package.json +2 -1
- package/plugin.json +1 -1
- package/prompts/orchestrate-with-zeus.prompt.md +2 -0
- package/pyproject.toml +1 -1
- package/scripts/cost.mjs +4 -5
- package/scripts/docs-media.mjs +1 -1
- package/skills-lock.json +1 -1
- package/src/agents/athena.md +10 -8
- package/src/agents/themis.md +1 -0
- package/src/agents/zeus.md +32 -3
- package/src/instructions/agent-return-format.instructions.md +1 -1
- package/src/mcp/pantheon_vision.py +33 -2
- package/src/pantheon/cost-command.ts +4 -1
- package/src/pantheon/deepwork/deepwork-tool.ts +370 -0
- package/src/pantheon/deepwork/plan-projection.ts +274 -0
- package/src/pantheon/deepwork/plan-schema.ts +93 -0
- package/src/pantheon/deepwork/plan-tracker.ts +336 -0
- package/src/pantheon/native-vision.ts +4 -2
- package/src/pantheon/skill-search-tool.ts +2 -2
- package/src/pantheon/tools.ts +2 -0
- package/src/plugin/index.js +922 -42
- package/src/plugin.ts +2 -2
- package/src/plugins/tui/dist/tui.js +461 -289
- package/src/plugins/tui/dist/tui.js.map +1 -1
- package/src/plugins/tui/package-lock.json +2 -2
- package/src/plugins/tui/package.json +1 -1
- package/src/plugins/tui/src/autonomy-state.ts +14 -16
- package/src/plugins/tui/src/decision-router-state.ts +22 -10
- package/src/plugins/tui/src/pantheon-settings-state.ts +119 -35
- package/src/plugins/tui/src/pantheon-settings.tsx +142 -48
- package/src/plugins/tui/src/preset-state.ts +96 -6
- package/src/plugins/tui/src/update-status.ts +62 -22
- package/src/skills/prompt-refinery/SKILL.md +6 -4
|
@@ -80,8 +80,11 @@ import {
|
|
|
80
80
|
PRESET_NONE,
|
|
81
81
|
projectActivePresetPath,
|
|
82
82
|
readActivePresetMarker,
|
|
83
|
+
readConfiguredVisionModel,
|
|
83
84
|
writeActivePreset,
|
|
85
|
+
writeConfiguredVisionModel,
|
|
84
86
|
} from './preset-state.ts'
|
|
87
|
+
import { resolveLanguage } from './settings-i18n.ts'
|
|
85
88
|
import {
|
|
86
89
|
applyTuiRow,
|
|
87
90
|
buildTuiTab,
|
|
@@ -403,6 +406,49 @@ export function SettingsWindow(props: {
|
|
|
403
406
|
boxRef?: (el: any) => void
|
|
404
407
|
onMouseDown?: () => void
|
|
405
408
|
}) {
|
|
409
|
+
const isPt = () => resolveLanguage(tuiPrefs().layout?.language) === 'pt-BR'
|
|
410
|
+
const formatValueDisplay = (val: string) => {
|
|
411
|
+
if (!isPt()) return val
|
|
412
|
+
switch (val) {
|
|
413
|
+
case 'enabled':
|
|
414
|
+
return 'ativado'
|
|
415
|
+
case 'disabled':
|
|
416
|
+
return 'desativado'
|
|
417
|
+
case 'granted':
|
|
418
|
+
return 'permitido'
|
|
419
|
+
case 'not granted':
|
|
420
|
+
return 'não permitido'
|
|
421
|
+
case 'explicit':
|
|
422
|
+
return 'explícito'
|
|
423
|
+
case 'auto':
|
|
424
|
+
return 'automático'
|
|
425
|
+
case 'local':
|
|
426
|
+
return 'local'
|
|
427
|
+
case 'autonomous':
|
|
428
|
+
return 'autônomo'
|
|
429
|
+
case 'arbitrated':
|
|
430
|
+
return 'arbitrado'
|
|
431
|
+
case 'human review':
|
|
432
|
+
return 'revisão humana'
|
|
433
|
+
case 'MISSING':
|
|
434
|
+
case 'missing':
|
|
435
|
+
return 'PENDENTE'
|
|
436
|
+
case 'auth store':
|
|
437
|
+
return 'login opencode'
|
|
438
|
+
case 'env':
|
|
439
|
+
return 'variável env'
|
|
440
|
+
case 'config':
|
|
441
|
+
return 'configuração'
|
|
442
|
+
case 'never checked':
|
|
443
|
+
return 'nunca verificado'
|
|
444
|
+
case 'up to date':
|
|
445
|
+
return 'atualizado'
|
|
446
|
+
case 'none':
|
|
447
|
+
return 'nenhum'
|
|
448
|
+
default:
|
|
449
|
+
return val
|
|
450
|
+
}
|
|
451
|
+
}
|
|
406
452
|
const tab = () => props.tabs()[props.page()] ?? props.tabs()[0] ?? EMPTY_TAB
|
|
407
453
|
return (
|
|
408
454
|
<box
|
|
@@ -501,10 +547,11 @@ export function SettingsWindow(props: {
|
|
|
501
547
|
const staged = () => props.draft()[row.id] !== undefined
|
|
502
548
|
const gutter = () => (isSelected() ? '▸ ' : ' ')
|
|
503
549
|
const valueCell = () => {
|
|
504
|
-
|
|
505
|
-
if (row.
|
|
506
|
-
if (row.
|
|
507
|
-
|
|
550
|
+
const formatted = formatValueDisplay(display())
|
|
551
|
+
if (row.cycle !== undefined) return `< ${formatted} >`
|
|
552
|
+
if (row.action !== undefined) return `[ ${formatted} ]`
|
|
553
|
+
if (row.id.startsWith('autonomy.gradient.')) return `[ref] ${formatted}`
|
|
554
|
+
return formatted
|
|
508
555
|
}
|
|
509
556
|
return (
|
|
510
557
|
<box
|
|
@@ -522,26 +569,28 @@ export function SettingsWindow(props: {
|
|
|
522
569
|
{`${gutter()}${row.name}`.padEnd(NAME_WIDTH + 2)}
|
|
523
570
|
</text>
|
|
524
571
|
</box>
|
|
525
|
-
<
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
<text
|
|
533
|
-
fg={
|
|
534
|
-
isSelected()
|
|
535
|
-
? '#ffffff'
|
|
536
|
-
: staged()
|
|
537
|
-
? (props.warn ?? props.fg)
|
|
538
|
-
: props.muted
|
|
539
|
-
}
|
|
540
|
-
{...(isSelected() || staged() ? { attributes: 1 } : {})}
|
|
572
|
+
<Show when={row.value !== '' && row.value !== undefined}>
|
|
573
|
+
<box
|
|
574
|
+
width={VALUE_WIDTH}
|
|
575
|
+
onMouseDown={() => {
|
|
576
|
+
props.onSelectRow?.(row.id)
|
|
577
|
+
props.onCycleValue?.(row.id, 1)
|
|
578
|
+
}}
|
|
541
579
|
>
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
580
|
+
<text
|
|
581
|
+
fg={
|
|
582
|
+
isSelected()
|
|
583
|
+
? '#ffffff'
|
|
584
|
+
: staged()
|
|
585
|
+
? (props.warn ?? props.fg)
|
|
586
|
+
: props.muted
|
|
587
|
+
}
|
|
588
|
+
{...(isSelected() || staged() ? { attributes: 1 } : {})}
|
|
589
|
+
>
|
|
590
|
+
{`${valueCell()}${staged() ? ' ●' : ''}`.padEnd(VALUE_WIDTH)}
|
|
591
|
+
</text>
|
|
592
|
+
</box>
|
|
593
|
+
</Show>
|
|
545
594
|
<Show when={row.note !== undefined}>
|
|
546
595
|
<box flexGrow={1} flexShrink={1}>
|
|
547
596
|
<text fg={isSelected() ? '#e5e7eb' : props.muted}>{row.note}</text>
|
|
@@ -615,7 +664,7 @@ export function SettingsWindow(props: {
|
|
|
615
664
|
</box>
|
|
616
665
|
<box flexGrow={1} minWidth={1} />
|
|
617
666
|
<text fg={props.muted} flexShrink={0}>
|
|
618
|
-
{'no staged changes'}
|
|
667
|
+
{isPt() ? 'sem alterações pendentes' : 'no staged changes'}
|
|
619
668
|
</text>
|
|
620
669
|
</box>
|
|
621
670
|
}
|
|
@@ -628,7 +677,7 @@ export function SettingsWindow(props: {
|
|
|
628
677
|
rowGap={1}
|
|
629
678
|
>
|
|
630
679
|
<box backgroundColor="#fba970" flexShrink={0} onMouseDown={() => props.onSave?.()}>
|
|
631
|
-
<text fg="#000000">{' Save '}</text>
|
|
680
|
+
<text fg="#000000">{isPt() ? ' Salvar ' : ' Save '}</text>
|
|
632
681
|
</box>
|
|
633
682
|
<text fg={props.muted} flexShrink={0}>
|
|
634
683
|
{' '}
|
|
@@ -638,7 +687,7 @@ export function SettingsWindow(props: {
|
|
|
638
687
|
flexShrink={0}
|
|
639
688
|
onMouseDown={() => props.onDiscard?.()}
|
|
640
689
|
>
|
|
641
|
-
<text fg="#ffffff">{' Discard '}</text>
|
|
690
|
+
<text fg="#ffffff">{isPt() ? ' Descartar ' : ' Discard '}</text>
|
|
642
691
|
</box>
|
|
643
692
|
<text fg={props.muted} flexShrink={0}>
|
|
644
693
|
{' '}
|
|
@@ -648,11 +697,11 @@ export function SettingsWindow(props: {
|
|
|
648
697
|
flexShrink={0}
|
|
649
698
|
onMouseDown={() => props.onResetPage?.()}
|
|
650
699
|
>
|
|
651
|
-
<text fg="#ffffff">{' Reset page '}</text>
|
|
700
|
+
<text fg="#ffffff">{isPt() ? ' Redefinir página ' : ' Reset page '}</text>
|
|
652
701
|
</box>
|
|
653
702
|
<box flexGrow={1} minWidth={1} />
|
|
654
703
|
<text fg={props.warn ?? '#f59e0b'} flexShrink={0}>
|
|
655
|
-
{'unsaved changes'}
|
|
704
|
+
{isPt() ? 'alterações não salvas' : 'unsaved changes'}
|
|
656
705
|
</text>
|
|
657
706
|
</box>
|
|
658
707
|
</Show>
|
|
@@ -660,12 +709,18 @@ export function SettingsWindow(props: {
|
|
|
660
709
|
{(() => {
|
|
661
710
|
const currentRow = findRow(tab(), props.selectedId() ?? '')
|
|
662
711
|
if (currentRow?.cycle !== undefined) {
|
|
663
|
-
return
|
|
712
|
+
return isPt()
|
|
713
|
+
? 'clique ou ›/←/→ alterar · ↑↓ selecionar · tab próxima aba · ctrl+s salvar · ctrl+r redefinir · esc fechar'
|
|
714
|
+
: 'click or ›/←/→ change · ↑↓ select · tab next tab · ctrl+s save · ctrl+r reset page · esc close'
|
|
664
715
|
}
|
|
665
716
|
if (currentRow?.action !== undefined) {
|
|
666
|
-
return
|
|
717
|
+
return isPt()
|
|
718
|
+
? 'enter ou espaço executar · ↑↓ selecionar · tab próxima aba · ctrl+s salvar · ctrl+r redefinir · esc fechar'
|
|
719
|
+
: 'enter or space run action · ↑↓ select · tab next tab · ctrl+s save · ctrl+r reset page · esc close'
|
|
667
720
|
}
|
|
668
|
-
return
|
|
721
|
+
return isPt()
|
|
722
|
+
? '[ref] política de referência (somente leitura) · ↑↓ selecionar · tab próxima aba · esc fechar'
|
|
723
|
+
: '[ref] documented reference (read-only) · ↑↓ select · tab next tab · esc close'
|
|
669
724
|
})()}
|
|
670
725
|
</text>
|
|
671
726
|
</box>
|
|
@@ -674,21 +729,25 @@ export function SettingsWindow(props: {
|
|
|
674
729
|
<box flexDirection="column">
|
|
675
730
|
<box flexDirection="row">
|
|
676
731
|
<text fg={props.warn ?? '#f59e0b'} attributes={1}>
|
|
677
|
-
{'Keep your changes? '}
|
|
732
|
+
{isPt() ? 'Deseja salvar as alterações? ' : 'Keep your changes? '}
|
|
678
733
|
</text>
|
|
679
734
|
<box backgroundColor="#fba970" onMouseDown={() => props.onSave?.()}>
|
|
680
|
-
<text fg="#000000">{' Save '}</text>
|
|
735
|
+
<text fg="#000000">{isPt() ? ' Salvar ' : ' Save '}</text>
|
|
681
736
|
</box>
|
|
682
737
|
<text fg={props.muted}>{' '}</text>
|
|
683
738
|
<box backgroundColor="#262626" onMouseDown={() => props.onDiscard?.()}>
|
|
684
|
-
<text fg="#ffffff">{' Discard '}</text>
|
|
739
|
+
<text fg="#ffffff">{isPt() ? ' Descartar ' : ' Discard '}</text>
|
|
685
740
|
</box>
|
|
686
741
|
<text fg={props.muted}>{' '}</text>
|
|
687
742
|
<box backgroundColor="#262626" onMouseDown={() => props.onCancelExit?.()}>
|
|
688
|
-
<text fg="#ffffff">{' Keep editing '}</text>
|
|
743
|
+
<text fg="#ffffff">{isPt() ? ' Continuar editando ' : ' Keep editing '}</text>
|
|
689
744
|
</box>
|
|
690
745
|
</box>
|
|
691
|
-
<text fg={props.muted}>
|
|
746
|
+
<text fg={props.muted}>
|
|
747
|
+
{isPt()
|
|
748
|
+
? 'ctrl+s salvar · d descartar alterações · esc continuar editando'
|
|
749
|
+
: 'ctrl+s save · d discard the changes · esc keep editing'}
|
|
750
|
+
</text>
|
|
692
751
|
</box>
|
|
693
752
|
</Show>
|
|
694
753
|
</box>
|
|
@@ -763,9 +822,12 @@ function createWindowController(
|
|
|
763
822
|
const items: ChangelogHighlightItem[] = []
|
|
764
823
|
for (const group of hl.groups) {
|
|
765
824
|
for (const item of group.items) {
|
|
766
|
-
const
|
|
767
|
-
const
|
|
768
|
-
|
|
825
|
+
const colon = item.indexOf(': ')
|
|
826
|
+
const emdash = item.indexOf('—')
|
|
827
|
+
const sep = colon !== -1 ? colon : emdash
|
|
828
|
+
const title = sep !== -1 ? item.slice(0, sep).trim() : item.slice(0, 26)
|
|
829
|
+
const detail = sep !== -1 ? item.slice(sep + (colon !== -1 ? 2 : 1)).trim() : item
|
|
830
|
+
items.push({ title, detail, group: group.heading ?? undefined })
|
|
769
831
|
}
|
|
770
832
|
}
|
|
771
833
|
setChangelogItems(items)
|
|
@@ -777,6 +839,7 @@ function createWindowController(
|
|
|
777
839
|
return {
|
|
778
840
|
globalName: readActivePresetMarker(globalActivePresetPath())?.name ?? null,
|
|
779
841
|
projectName: readActivePresetMarker(projectActivePresetPath())?.name ?? null,
|
|
842
|
+
visionModel: readConfiguredVisionModel(),
|
|
780
843
|
}
|
|
781
844
|
}
|
|
782
845
|
|
|
@@ -795,11 +858,12 @@ function createWindowController(
|
|
|
795
858
|
}
|
|
796
859
|
|
|
797
860
|
const tabs = (): SettingsTab[] => {
|
|
798
|
-
const
|
|
861
|
+
const rawLang = tuiPrefs().layout?.language
|
|
862
|
+
const lang = resolveLanguage(rawLang)
|
|
799
863
|
return [
|
|
800
|
-
buildGatesTab(load()),
|
|
864
|
+
buildGatesTab(load(), lang),
|
|
801
865
|
buildDecisionTab(decision(), process.env, readAuthProviders(), readConfigProviders(), lang),
|
|
802
|
-
buildPresetTab(presetInput()),
|
|
866
|
+
buildPresetTab(presetInput(), lang),
|
|
803
867
|
buildTuiTab(tuiPrefs(), lang),
|
|
804
868
|
buildAutonomyTab({
|
|
805
869
|
goalLoop: goalLoop(),
|
|
@@ -808,14 +872,21 @@ function createWindowController(
|
|
|
808
872
|
languagePref: lang,
|
|
809
873
|
}),
|
|
810
874
|
buildJ1Tab(process.env, false, lang),
|
|
811
|
-
buildUpdatesTab(updatesInput()),
|
|
812
|
-
buildChangelogTab(currentVersion, changelogItems()),
|
|
875
|
+
buildUpdatesTab({ ...updatesInput(), languagePref: lang }),
|
|
876
|
+
buildChangelogTab(currentVersion, changelogItems(), lang),
|
|
813
877
|
buildDoctorTab({
|
|
814
878
|
runningVersion: currentVersion,
|
|
815
879
|
nodeVersion: process.versions.node,
|
|
816
880
|
load: load(),
|
|
817
881
|
}),
|
|
818
|
-
buildAboutTab(currentVersion
|
|
882
|
+
buildAboutTab(currentVersion, {
|
|
883
|
+
nodeVersion: process.versions.node,
|
|
884
|
+
platform: process.platform,
|
|
885
|
+
preset: readActivePresetMarker(globalActivePresetPath())?.name ?? null,
|
|
886
|
+
decisionEnabled: decision().config.enabled,
|
|
887
|
+
j1Mode: process.env.PANTHEON_J1_RISK_SCORE ?? 'shadow',
|
|
888
|
+
languagePref: lang,
|
|
889
|
+
}),
|
|
819
890
|
]
|
|
820
891
|
}
|
|
821
892
|
|
|
@@ -965,6 +1036,18 @@ function createWindowController(
|
|
|
965
1036
|
}
|
|
966
1037
|
}
|
|
967
1038
|
}
|
|
1039
|
+
if (id === 'preset.vision_model') {
|
|
1040
|
+
try {
|
|
1041
|
+
writeConfiguredVisionModel(value)
|
|
1042
|
+
setPresetTick((tick) => tick + 1)
|
|
1043
|
+
return { ok: true }
|
|
1044
|
+
} catch (error) {
|
|
1045
|
+
return {
|
|
1046
|
+
ok: false,
|
|
1047
|
+
reason: error instanceof Error ? error.message : 'vision model config write failed',
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
968
1051
|
if (id.startsWith('autonomy.goal_loop.')) {
|
|
969
1052
|
const next = { ...goalLoop() }
|
|
970
1053
|
if (id === 'autonomy.goal_loop.enabled') {
|
|
@@ -1021,8 +1104,13 @@ function createWindowController(
|
|
|
1021
1104
|
}
|
|
1022
1105
|
|
|
1023
1106
|
const save = () => {
|
|
1107
|
+
const isPt = resolveLanguage(tuiPrefs().layout?.language) === 'pt-BR'
|
|
1024
1108
|
if (!draftDirty(draft())) {
|
|
1025
|
-
setNotice(
|
|
1109
|
+
setNotice(
|
|
1110
|
+
isPt
|
|
1111
|
+
? 'nada pendente — ←/→ altera um valor primeiro'
|
|
1112
|
+
: 'nothing staged — ←/→ stages a change first',
|
|
1113
|
+
)
|
|
1026
1114
|
return
|
|
1027
1115
|
}
|
|
1028
1116
|
const writer: DraftWriter = dispatchWrite
|
|
@@ -1034,9 +1122,15 @@ function createWindowController(
|
|
|
1034
1122
|
setPresetTick((tick) => tick + 1)
|
|
1035
1123
|
}
|
|
1036
1124
|
if (failed.length > 0) {
|
|
1037
|
-
setNotice(
|
|
1125
|
+
setNotice(
|
|
1126
|
+
`${failed.map((f) => `${f.id}: ${f.reason}`).join(' · ')} — ${isPt ? 'alterações mantidas' : 'staged changes kept'}`,
|
|
1127
|
+
)
|
|
1038
1128
|
} else {
|
|
1039
|
-
setNotice(
|
|
1129
|
+
setNotice(
|
|
1130
|
+
isPt
|
|
1131
|
+
? `salva(s) ${applied.length} alteração(ões)`
|
|
1132
|
+
: `saved ${applied.length} change${applied.length === 1 ? '' : 's'}`,
|
|
1133
|
+
)
|
|
1040
1134
|
if (confirmExit()) {
|
|
1041
1135
|
exit()
|
|
1042
1136
|
}
|
|
@@ -106,9 +106,83 @@ function backupMarker(path: string): void {
|
|
|
106
106
|
copyFileSync(path, `${path}.bak`)
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
+
export const VISION_MODEL_OPTIONS: readonly string[] = Object.freeze([
|
|
110
|
+
'auto',
|
|
111
|
+
'opencode-go/mimo-v2.6-flash',
|
|
112
|
+
'google/gemini-2.5-flash',
|
|
113
|
+
'openai/gpt-5-mini',
|
|
114
|
+
'anthropic/claude-3-5-haiku',
|
|
115
|
+
'opencode-go/mimo-v2.5',
|
|
116
|
+
])
|
|
117
|
+
|
|
118
|
+
export function visionConfigPaths(
|
|
119
|
+
cwd = process.cwd(),
|
|
120
|
+
env: Record<string, string | undefined> = process.env,
|
|
121
|
+
): string[] {
|
|
122
|
+
const home = env.HOME ?? ''
|
|
123
|
+
const xdg = env.XDG_CONFIG_HOME ?? join(home, '.config')
|
|
124
|
+
return [
|
|
125
|
+
join(cwd, '.opencode', 'opencode-vision.json'),
|
|
126
|
+
join(xdg, 'opencode', 'opencode-vision.json'),
|
|
127
|
+
]
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export function readConfiguredVisionModel(
|
|
131
|
+
cwd = process.cwd(),
|
|
132
|
+
env: Record<string, string | undefined> = process.env,
|
|
133
|
+
): string {
|
|
134
|
+
for (const path of visionConfigPaths(cwd, env)) {
|
|
135
|
+
try {
|
|
136
|
+
if (existsSync(path)) {
|
|
137
|
+
const parsed = JSON.parse(readFileSync(path, 'utf8')) as { visionModel?: unknown }
|
|
138
|
+
if (typeof parsed?.visionModel === 'string' && parsed.visionModel.trim()) {
|
|
139
|
+
return parsed.visionModel.trim()
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
} catch {
|
|
143
|
+
// ignore corrupt/missing
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return 'auto'
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export function writeConfiguredVisionModel(
|
|
150
|
+
model: string,
|
|
151
|
+
cwd = process.cwd(),
|
|
152
|
+
env: Record<string, string | undefined> = process.env,
|
|
153
|
+
): void {
|
|
154
|
+
const home = env.HOME ?? ''
|
|
155
|
+
const xdg = env.XDG_CONFIG_HOME ?? join(home, '.config')
|
|
156
|
+
const projectDir = join(cwd, '.opencode')
|
|
157
|
+
const targetPath = existsSync(projectDir)
|
|
158
|
+
? join(projectDir, 'opencode-vision.json')
|
|
159
|
+
: join(xdg, 'opencode', 'opencode-vision.json')
|
|
160
|
+
|
|
161
|
+
let current: Record<string, unknown> = {}
|
|
162
|
+
try {
|
|
163
|
+
if (existsSync(targetPath)) {
|
|
164
|
+
current = JSON.parse(readFileSync(targetPath, 'utf8')) as Record<string, unknown>
|
|
165
|
+
}
|
|
166
|
+
} catch {
|
|
167
|
+
current = {}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
if (model === 'auto' || !model.trim()) {
|
|
171
|
+
delete current.visionModel
|
|
172
|
+
} else {
|
|
173
|
+
current.visionModel = model.trim()
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
mkdirSync(dirname(targetPath), { recursive: true })
|
|
177
|
+
const temp = `${targetPath}.tui.tmp`
|
|
178
|
+
writeFileSync(temp, `${JSON.stringify(current, null, 2)}\n`, 'utf8')
|
|
179
|
+
renameSync(temp, targetPath)
|
|
180
|
+
}
|
|
181
|
+
|
|
109
182
|
export interface PresetSectionInput {
|
|
110
183
|
globalName: string | null
|
|
111
184
|
projectName: string | null
|
|
185
|
+
visionModel?: string
|
|
112
186
|
}
|
|
113
187
|
|
|
114
188
|
/** The staged value 'none' means: delete the global marker (the CLI contract). */
|
|
@@ -116,27 +190,43 @@ export const PRESET_NONE = 'none'
|
|
|
116
190
|
|
|
117
191
|
export const PRESET_CYCLE: readonly string[] = Object.freeze([PRESET_NONE, ...PRESET_NAMES])
|
|
118
192
|
|
|
119
|
-
export function buildPresetTab(input: PresetSectionInput): SettingsTab {
|
|
193
|
+
export function buildPresetTab(input: PresetSectionInput, languagePref?: string): SettingsTab {
|
|
194
|
+
const isPt = languagePref === 'pt-BR'
|
|
120
195
|
const rows: SettingsRow[] = [
|
|
121
196
|
{
|
|
122
197
|
id: 'preset',
|
|
123
|
-
name: 'Preset',
|
|
198
|
+
name: isPt ? 'Predefinição' : 'Preset',
|
|
124
199
|
value: input.globalName ?? PRESET_NONE,
|
|
125
200
|
cycle: PRESET_CYCLE,
|
|
126
|
-
note:
|
|
201
|
+
note: isPt
|
|
202
|
+
? 'marcador global · gravação atômica, backup .bak · none = padrão OpenCode'
|
|
203
|
+
: 'global marker · atomic write, .bak backup · none = opencode defaults',
|
|
127
204
|
},
|
|
128
205
|
]
|
|
129
206
|
if (input.projectName !== null) {
|
|
130
207
|
rows.push({
|
|
131
208
|
id: 'preset.project',
|
|
132
|
-
name: 'Project',
|
|
209
|
+
name: isPt ? 'Projeto' : 'Project',
|
|
133
210
|
value: input.projectName,
|
|
134
|
-
note:
|
|
211
|
+
note: isPt
|
|
212
|
+
? `${projectActivePresetPath()} tem precedência sobre o global — somente leitura aqui`
|
|
213
|
+
: `${projectActivePresetPath()} wins over the global marker — read-only here`,
|
|
214
|
+
})
|
|
215
|
+
}
|
|
216
|
+
if (input.visionModel !== undefined) {
|
|
217
|
+
rows.push({
|
|
218
|
+
id: 'preset.vision_model',
|
|
219
|
+
name: isPt ? 'Modelo de Visão' : 'Vision Model',
|
|
220
|
+
value: input.visionModel || 'auto',
|
|
221
|
+
cycle: VISION_MODEL_OPTIONS,
|
|
222
|
+
note: isPt
|
|
223
|
+
? 'modelo para inspeção de imagens (vision_describe) · salvo em opencode-vision.json'
|
|
224
|
+
: 'model for image inspection (vision_describe) · saved in opencode-vision.json',
|
|
135
225
|
})
|
|
136
226
|
}
|
|
137
227
|
return {
|
|
138
228
|
id: 'preset',
|
|
139
229
|
title: 'Preset',
|
|
140
|
-
groups: [{ title: 'Model preset', rows }],
|
|
230
|
+
groups: [{ title: isPt ? 'Predefinição de modelo' : 'Model preset', rows }],
|
|
141
231
|
}
|
|
142
232
|
}
|
|
@@ -26,11 +26,13 @@ export function registryUrlForChannel(channel: UpdateChannel): string {
|
|
|
26
26
|
return `https://registry.npmjs.org/pantheon-opencode/${registryTagForChannel(channel)}`
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
function formatAgo(ms: number): string {
|
|
30
|
-
if (ms < 60_000) return 'just now'
|
|
31
|
-
if (ms < 3_600_000)
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
function formatAgo(ms: number, isPt = false): string {
|
|
30
|
+
if (ms < 60_000) return isPt ? 'agora mesmo' : 'just now'
|
|
31
|
+
if (ms < 3_600_000)
|
|
32
|
+
return isPt ? `há ${Math.floor(ms / 60_000)}m` : `${Math.floor(ms / 60_000)}m ago`
|
|
33
|
+
if (ms < 86_400_000)
|
|
34
|
+
return isPt ? `há ${Math.floor(ms / 3_600_000)}h` : `${Math.floor(ms / 3_600_000)}h ago`
|
|
35
|
+
return isPt ? `há ${Math.floor(ms / 86_400_000)}d` : `${Math.floor(ms / 86_400_000)}d ago`
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
export interface UpdatesSectionInput {
|
|
@@ -45,9 +47,11 @@ export interface UpdatesSectionInput {
|
|
|
45
47
|
/** An update run is in flight (this window). */
|
|
46
48
|
updating?: boolean
|
|
47
49
|
nowMs?: number
|
|
50
|
+
languagePref?: string
|
|
48
51
|
}
|
|
49
52
|
|
|
50
53
|
export function buildUpdatesTab(input: UpdatesSectionInput): SettingsTab {
|
|
54
|
+
const isPt = input.languagePref === 'pt-BR'
|
|
51
55
|
const nowMs = input.nowMs ?? Date.now()
|
|
52
56
|
const channel = input.selectedChannel ?? updateChannelFor(input.currentVersion)
|
|
53
57
|
const lastCheckMs = input.state.lastCheckMs
|
|
@@ -62,50 +66,86 @@ export function buildUpdatesTab(input: UpdatesSectionInput): SettingsTab {
|
|
|
62
66
|
const rows: SettingsRow[] = [
|
|
63
67
|
{
|
|
64
68
|
id: 'update.channel',
|
|
65
|
-
name: 'Channel',
|
|
69
|
+
name: isPt ? 'Canal' : 'Channel',
|
|
66
70
|
value: channel,
|
|
67
71
|
cycle: ['stable', 'beta'] as const,
|
|
68
|
-
note:
|
|
72
|
+
note: isPt
|
|
73
|
+
? 'stable segue npm `latest`; beta segue npm `beta`'
|
|
74
|
+
: 'stable tracks npm `latest`; beta tracks npm `beta`',
|
|
69
75
|
},
|
|
70
76
|
{
|
|
71
77
|
id: 'update.check',
|
|
72
|
-
name: 'Check now',
|
|
78
|
+
name: isPt ? 'Verificar agora' : 'Check now',
|
|
73
79
|
value: input.checking
|
|
74
|
-
?
|
|
80
|
+
? isPt
|
|
81
|
+
? 'verificando…'
|
|
82
|
+
: 'checking…'
|
|
75
83
|
: lastCheckMs
|
|
76
|
-
?
|
|
77
|
-
|
|
84
|
+
? isPt
|
|
85
|
+
? `última verificação ${formatAgo(nowMs - lastCheckMs, true)}`
|
|
86
|
+
: `last check ${formatAgo(nowMs - lastCheckMs, false)}`
|
|
87
|
+
: isPt
|
|
88
|
+
? 'nunca verificado'
|
|
89
|
+
: 'never checked',
|
|
78
90
|
action: 'update-check',
|
|
79
|
-
note:
|
|
91
|
+
note: isPt
|
|
92
|
+
? 'enter consulta o registro npm para o canal ativo'
|
|
93
|
+
: 'enter probes the registry for the running channel',
|
|
80
94
|
},
|
|
81
95
|
]
|
|
82
96
|
|
|
83
97
|
if (latest) {
|
|
84
98
|
rows.push({
|
|
85
99
|
id: 'update.latest',
|
|
86
|
-
name: 'Registry',
|
|
87
|
-
value: newer
|
|
88
|
-
|
|
100
|
+
name: isPt ? 'Registro (npm)' : 'Registry',
|
|
101
|
+
value: newer
|
|
102
|
+
? `v${latest} ${isPt ? 'disponível' : 'available'}`
|
|
103
|
+
: isPt
|
|
104
|
+
? 'atualizado'
|
|
105
|
+
: 'up to date',
|
|
106
|
+
note: newer
|
|
107
|
+
? isPt
|
|
108
|
+
? 'instale com `pantheon-opencode update`'
|
|
109
|
+
: 'adopt with `pantheon-opencode update`'
|
|
110
|
+
: isPt
|
|
111
|
+
? 'nenhuma versão mais recente compatível'
|
|
112
|
+
: 'no newer compatible version',
|
|
89
113
|
})
|
|
90
114
|
rows.push({
|
|
91
115
|
id: 'update.run',
|
|
92
|
-
name: 'Update now',
|
|
93
|
-
value: input.updating
|
|
116
|
+
name: isPt ? 'Atualizar agora' : 'Update now',
|
|
117
|
+
value: input.updating
|
|
118
|
+
? isPt
|
|
119
|
+
? 'atualizando…'
|
|
120
|
+
: 'updating…'
|
|
121
|
+
: newer
|
|
122
|
+
? `${isPt ? 'instalar' : 'install'} v${latest}`
|
|
123
|
+
: isPt
|
|
124
|
+
? 'reinstalar / atualizar'
|
|
125
|
+
: 'reinstall / refresh',
|
|
94
126
|
action: 'update-run',
|
|
95
|
-
note: newer
|
|
127
|
+
note: newer
|
|
128
|
+
? isPt
|
|
129
|
+
? 'enter executa `pantheon-opencode update`'
|
|
130
|
+
: 'enter runs `pantheon-opencode update`'
|
|
131
|
+
: isPt
|
|
132
|
+
? 'enter atualiza a cópia instalada'
|
|
133
|
+
: 'enter refreshes installed copy',
|
|
96
134
|
})
|
|
97
135
|
}
|
|
98
136
|
|
|
99
137
|
rows.push({
|
|
100
138
|
id: 'update.command',
|
|
101
|
-
name: 'CLI command',
|
|
139
|
+
name: isPt ? 'Comando CLI' : 'CLI command',
|
|
102
140
|
value: channel === 'beta' ? 'pantheon-opencode update' : 'pantheon-opencode update --stable',
|
|
103
|
-
note:
|
|
141
|
+
note: isPt
|
|
142
|
+
? 'execute no terminal ou no terminal integrado do OpenCode'
|
|
143
|
+
: 'run in terminal or OpenCode Desktop terminal',
|
|
104
144
|
})
|
|
105
145
|
|
|
106
146
|
return {
|
|
107
147
|
id: 'updates',
|
|
108
|
-
title: 'Updates',
|
|
109
|
-
groups: [{ title: 'Updates & Maintenance', rows }],
|
|
148
|
+
title: isPt ? 'Atualizações' : 'Updates',
|
|
149
|
+
groups: [{ title: isPt ? 'Atualizações & Manutenção' : 'Updates & Maintenance', rows }],
|
|
110
150
|
}
|
|
111
151
|
}
|
|
@@ -59,7 +59,7 @@ Presented to user for confirmation before starting:
|
|
|
59
59
|
- [ ] Observable completion condition
|
|
60
60
|
- [ ] Test verification passes cleanly
|
|
61
61
|
- **Open Questions (with Recommended Defaults):**
|
|
62
|
-
- [Question]? *(Default: [Recommended choice] —
|
|
62
|
+
- [Question]? *(Default: [Recommended choice] — interactively confirmed via question tool)*
|
|
63
63
|
```
|
|
64
64
|
|
|
65
65
|
---
|
|
@@ -70,7 +70,9 @@ Presented to user for confirmation before starting:
|
|
|
70
70
|
2. **Tier 2 Requires `>>`:** Only explicit `>>` prefix requests trigger user-visible contract confirmation.
|
|
71
71
|
3. **Language Consistency:** Always preserve the user's language (PT-BR requests produce PT-BR briefs).
|
|
72
72
|
4. **Fail-Open:** Any error during refinement falls back to the original prompt without blocking.
|
|
73
|
-
5. **Interactive Questioning & Ambiguity Resolution:**
|
|
74
|
-
- Whenever prompt refinement
|
|
73
|
+
5. **Interactive Questioning & Ambiguity Resolution (MANDATORY `question` tool):**
|
|
74
|
+
- Whenever prompt refinement or planning surfaces Open Questions (`decisions_needed`), trade-offs, or scope choices, **NEVER leave them as inert text bullets in chat** or assume "proceed if no objections".
|
|
75
|
+
- You **MUST ALWAYS invoke the native `question` tool** with structured choices, placing the recommended choice first and marking it with `(Recomendado)`.
|
|
76
|
+
- The user selects choices with 1 click/Enter, and the selections are recorded as audited decisions.
|
|
75
77
|
- With decision router active, use `pantheon_jev_decide` (mode: `choice`) for internal candidate scoring.
|
|
76
|
-
- Non-blocking minor gaps use sensible declared defaults without stalling the flow.
|
|
78
|
+
- Non-blocking minor gaps without meaningful user trade-offs use sensible declared defaults without stalling the flow.
|