pantheon-opencode 2.0.0 → 2.0.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.
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pantheon-tui",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pantheon-tui",
9
- "version": "2.0.0",
9
+ "version": "2.0.2",
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",
4
+ "version": "2.0.2",
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": {
@@ -21,6 +21,7 @@
21
21
  * shows where the thresholds sit today.
22
22
  */
23
23
  import type { SettingsTab } from './pantheon-settings-state.ts'
24
+ import { resolveLanguage } from './settings-i18n.ts'
24
25
 
25
26
  export interface GoalLoopPrefs {
26
27
  enabled: boolean
@@ -78,81 +79,109 @@ export function parseUsd(cell: string): number | null {
78
79
  export function buildAutonomyTab(input: {
79
80
  goalLoop: GoalLoopPrefs
80
81
  budgets: DecisionBudgets
81
- goalLoopRestartPending?: boolean
82
+ goalLoopRestartPending?: boolean | undefined
83
+ languagePref?: string | undefined
82
84
  }): SettingsTab {
85
+ const lang = resolveLanguage(input.languagePref)
86
+ const isPt = lang === 'pt-BR'
87
+
83
88
  return {
84
89
  id: 'autonomy',
85
- title: 'Autonomy',
90
+ title: isPt ? 'Autonomia' : 'Autonomy',
86
91
  groups: [
87
92
  {
88
- title: 'Goal loop (multi-turn session auto-continuation)',
93
+ title: isPt
94
+ ? 'Goal loop (auto-continuação de sessões multi-turn)'
95
+ : 'Goal loop (multi-turn session auto-continuation)',
89
96
  rows: [
90
97
  {
91
98
  id: 'autonomy.goal_loop.enabled',
92
- name: 'Goal loop',
99
+ name: isPt ? 'Goal loop' : 'Goal loop',
93
100
  value: input.goalLoop.enabled ? 'enabled' : 'disabled',
94
101
  cycle: GOAL_LOOP_ENABLED_CYCLE,
95
- note:
96
- 'auto-continues multi-turn tasks when session goes idle' +
97
- (input.goalLoopRestartPending
98
- ? ' · [!] restart required to apply'
99
- : ' · applies after OpenCode restart'),
102
+ note: isPt
103
+ ? 'continua tarefas multi-turn quando a sessão fica ociosa' +
104
+ (input.goalLoopRestartPending
105
+ ? ' · [!] reinício necessário para aplicar (restart)'
106
+ : ' · aplicado após reiniciar o OpenCode')
107
+ : 'auto-continues multi-turn tasks when session goes idle' +
108
+ (input.goalLoopRestartPending
109
+ ? ' · [!] restart required to apply'
110
+ : ' · applies after OpenCode restart'),
100
111
  },
101
112
  {
102
113
  id: 'autonomy.goal_loop.maxContinuations',
103
- name: 'Max continuations',
114
+ name: isPt ? 'Limite continuações' : 'Max continuations',
104
115
  value: String(input.goalLoop.maxContinuations),
105
116
  cycle: MAX_CONTINUATIONS_CYCLE,
106
- note: '1..200 — safety ceiling to prevent runaway tasks',
117
+ note: isPt
118
+ ? '1..200 — teto de segurança contra loops infinitos'
119
+ : '1..200 — safety ceiling to prevent runaway tasks',
107
120
  },
108
121
  {
109
122
  id: 'autonomy.goal_loop.cooldownMs',
110
- name: 'Cooldown (ms)',
123
+ name: isPt ? 'Pausa entre turnos (ms)' : 'Cooldown (ms)',
111
124
  value: String(input.goalLoop.cooldownMs),
112
125
  cycle: COOLDOWN_MS_CYCLE,
113
- note: 'delay between autonomous turns (min 1000ms)',
126
+ note: isPt
127
+ ? 'intervalo entre turnos autônomos (mín 1000ms)'
128
+ : 'delay between autonomous turns (min 1000ms)',
114
129
  },
115
130
  ],
116
131
  },
117
132
  {
118
- title: 'Decision budgets (applies live per gated call)',
133
+ title: isPt
134
+ ? 'Orçamento Jev (aplicado em tempo real por decisão)'
135
+ : 'Decision budgets (applies live per gated call)',
119
136
  rows: [
120
137
  {
121
138
  id: 'autonomy.budget.monthly',
122
- name: 'Monthly cap',
139
+ name: isPt ? 'Teto mensal' : 'Monthly cap',
123
140
  value: formatUsd(input.budgets.monthlyUsd),
124
141
  cycle: MONTHLY_USD_CYCLE,
125
- note: 'monthly USD ceiling for gated arbitrator decisions',
142
+ note: isPt
143
+ ? 'teto mensal em USD para arbitragem do Jev'
144
+ : 'monthly USD ceiling for gated arbitrator decisions',
126
145
  },
127
146
  {
128
147
  id: 'autonomy.budget.perDecision',
129
- name: 'Per-decision cap',
148
+ name: isPt ? 'Teto por decisão' : 'Per-decision cap',
130
149
  value: formatUsd(input.budgets.perDecisionUsd),
131
150
  cycle: PER_DECISION_USD_CYCLE,
132
- note: 'price cap — gated decisions above this are refused',
151
+ note: isPt
152
+ ? 'teto de custo por decisão — acima disso é recusada'
153
+ : 'price cap — gated decisions above this are refused',
133
154
  },
134
155
  ],
135
156
  },
136
157
  {
137
- title: 'Decision gradient (reference policy · J1 owns the risk axis)',
158
+ title: isPt
159
+ ? 'Gradiente de decisão (política de referência · J1 governa o risco)'
160
+ : 'Decision gradient (reference policy · J1 owns the risk axis)',
138
161
  rows: [
139
162
  {
140
163
  id: 'autonomy.gradient.solo',
141
164
  name: 'Decide solo',
142
165
  value: 'autonomous',
143
- note: 'reversible & low-risk edits, routine fixes (no gate)',
166
+ note: isPt
167
+ ? 'edições reversíveis e rotineiras, sem travas (baixo risco)'
168
+ : 'reversible & low-risk edits, routine fixes (no gate)',
144
169
  },
145
170
  {
146
171
  id: 'autonomy.gradient.jev',
147
172
  name: 'Jev decides',
148
173
  value: 'arbitrated',
149
- note: 'typed ambiguity & candidate ranking (budget-capped)',
174
+ note: isPt
175
+ ? 'ambiguidade de tipos e ranqueamento de candidatos (com teto de custo)'
176
+ : 'typed ambiguity & candidate ranking (budget-capped)',
150
177
  },
151
178
  {
152
179
  id: 'autonomy.gradient.human',
153
180
  name: 'Human decides',
154
181
  value: 'human review',
155
- note: 'high-risk & destructive operations (J1 gate)',
182
+ note: isPt
183
+ ? 'operações de alto risco ou destrutivas (portão J1)'
184
+ : 'high-risk & destructive operations (J1 gate)',
156
185
  },
157
186
  ],
158
187
  },
@@ -17,6 +17,7 @@
17
17
  import { chmodSync, mkdirSync, readFileSync, renameSync, writeFileSync } from 'node:fs'
18
18
  import { dirname, join } from 'node:path'
19
19
  import type { SettingsRow, SettingsTab } from './pantheon-settings-state.ts'
20
+ import { resolveLanguage } from './settings-i18n.ts'
20
21
 
21
22
  export const DECISION_ENABLED_CYCLE: readonly string[] = Object.freeze(['enabled', 'disabled'])
22
23
 
@@ -340,64 +341,98 @@ export function buildDecisionTab(
340
341
  env: Record<string, string | undefined> = process.env,
341
342
  authProviders: ReadonlySet<string> = new Set(),
342
343
  configProviders: ReadonlySet<string> = new Set(),
344
+ languagePref?: string | undefined,
343
345
  ): SettingsTab {
346
+ const lang = resolveLanguage(languagePref, env)
347
+ const isPt = lang === 'pt-BR'
344
348
  const { config, corrupt } = read
345
349
  const rows: SettingsRow[] = [
346
350
  {
347
351
  id: 'decision.enabled',
348
- name: 'Router',
352
+ name: isPt ? 'Assistente Jev' : 'Router',
349
353
  value: config.enabled ? 'enabled' : 'disabled',
350
354
  // Corrupt config → read-only; the notice (glue) carries the remedy.
351
355
  ...(corrupt ? {} : { cycle: DECISION_ENABLED_CYCLE }),
352
356
  note: corrupt
353
- ? 'config unreadable/invalid — runtime fail-closes; repair via `decision-router setup-model`'
354
- : 'applies live — the runtime re-reads this on every gated call',
357
+ ? isPt
358
+ ? 'config inválida — runtime fail-closes; repair via `decision-router setup-model`'
359
+ : 'config unreadable/invalid — runtime fail-closes; repair via `decision-router setup-model`'
360
+ : isPt
361
+ ? 'applies live — arbitragem de decisões relida em tempo real a cada chamada'
362
+ : 'applies live — the runtime re-reads this on every gated call',
355
363
  },
356
364
  {
357
365
  id: 'decision.selection.mode',
358
- name: 'Selection mode',
366
+ name: isPt ? 'Modo de operação' : 'Selection mode',
359
367
  value: config.selection.mode,
360
368
  ...(corrupt ? {} : { cycle: DECISION_SELECTION_CYCLE }),
361
- note: 'local routes on-device; auto/explicit pick a remote decision model',
369
+ note: isPt
370
+ ? 'local = no seu PC (grátis); auto/explícito = modelo nuvem (OpenRouter)'
371
+ : 'local routes on-device; auto/explicit pick a remote decision model',
362
372
  },
363
373
  ]
364
- if (config.selection.mode === 'explicit' || config.selection.provider !== undefined) {
365
- rows.push({
366
- id: 'decision.selection.target',
367
- name: 'Explicit target',
368
- value: config.selection.provider
369
- ? `${config.selection.provider}/${config.selection.model ?? ''}`
370
- : 'none',
371
- ...(corrupt || config.selection.mode !== 'explicit' ? {} : { cycle: DECISION_TARGET_CYCLE }),
372
- note: 'provider/model — sets the candidate list',
373
- })
374
- }
375
- if (config.enabled_candidates.length > 0) {
374
+
375
+ // Model selection row: always visible so the user can choose the decision model
376
+ const explicitTarget = config.selection.provider
377
+ ? `${config.selection.provider}/${config.selection.model ?? ''}`
378
+ : (DECISION_TARGET_CYCLE[0] ?? 'openrouter-jev/typesafe/jev-1.13')
379
+ rows.push({
380
+ id: 'decision.selection.target',
381
+ name: isPt ? 'Modelo de decisão' : 'Explicit target',
382
+ value:
383
+ config.selection.mode === 'local'
384
+ ? config.selection.provider
385
+ ? `${config.selection.provider}/${config.selection.model ?? ''}`
386
+ : 'local (on-device)'
387
+ : explicitTarget,
388
+ ...(corrupt ? {} : { cycle: DECISION_TARGET_CYCLE }),
389
+ note: isPt
390
+ ? config.selection.mode === 'local'
391
+ ? 'ciclar seleciona modelo remoto e ativa modo explícito'
392
+ : 'provedor/modelo ativo — define candidato para arbitragem'
393
+ : config.selection.mode === 'local'
394
+ ? 'cycle to select a remote model and activate explicit mode'
395
+ : 'provider/model — sets the candidate list',
396
+ })
397
+
398
+ if ((config.enabled_candidates?.length ?? 0) > 0) {
376
399
  rows.push({
377
400
  id: 'decision.candidates',
378
- name: 'Candidates',
401
+ name: isPt ? 'Candidatos ativos' : 'Candidates',
379
402
  value: String(config.enabled_candidates.length),
380
403
  note: config.egress_consent
381
404
  ? config.enabled_candidates
382
405
  .map((candidate) => `${candidate.provider}/${candidate.model}`)
383
406
  .join(', ')
384
- : 'egress consent NOT granted — remote routes fail closed',
407
+ : isPt
408
+ ? 'egress consent NÃO concedido — rotas remotas bloqueadas'
409
+ : 'egress consent NOT granted — remote routes fail closed',
385
410
  })
386
411
  }
412
+
387
413
  rows.push({
388
414
  id: 'decision.consent',
389
- name: 'Egress consent',
415
+ name: isPt ? 'Acesso à nuvem (Egress)' : 'Egress consent',
390
416
  value: config.egress_consent ? 'granted' : 'not granted',
391
417
  ...(corrupt ? {} : { cycle: DECISION_CONSENT_CYCLE }),
392
- note: 'granted = remote decision routes may call their gateway (budget-capped)',
418
+ note: isPt
419
+ ? config.egress_consent
420
+ ? 'granted = rotas remotas podem consultar gateway de API (com teto de custo)'
421
+ : 'not granted = chamadas remotas bloqueadas; requer granted para nuvem'
422
+ : config.egress_consent
423
+ ? 'granted = remote decision routes may call their gateway (budget-capped)'
424
+ : 'not granted = remote routes fail closed; grant to allow cloud calls',
393
425
  })
426
+
394
427
  return {
395
428
  id: 'decision',
396
- title: 'Decision',
429
+ title: isPt ? 'Decisão' : 'Decision',
397
430
  groups: [
398
- { title: 'Decision router', rows },
431
+ { title: isPt ? 'Assistente de Decisão' : 'Decision router', rows },
399
432
  {
400
- title: 'Credentials (status only — values never enter the window)',
433
+ title: isPt
434
+ ? 'Credenciais (status apenas — valores nunca gravados na janela)'
435
+ : 'Credentials (status only — values never enter the window)',
401
436
  rows: DECISION_KNOWN_PROVIDERS.map((provider) => {
402
437
  const status = credentialStatus(provider, env, authProviders, configProviders)
403
438
  const credential = DECISION_PROVIDER_CREDENTIALS[provider] ?? { note: '' }
@@ -11,6 +11,7 @@
11
11
  * (beta.3 candidate), not a window change.
12
12
  */
13
13
  import type { SettingsTab } from './pantheon-settings-state.ts'
14
+ import { resolveLanguage } from './settings-i18n.ts'
14
15
 
15
16
  export const J1_FLAG_ENV = 'PANTHEON_J1_RISK_SCORE'
16
17
  export const J1_THRESHOLD_ENV = 'PANTHEON_J1_ENFORCE_THRESHOLD'
@@ -37,17 +38,27 @@ export function j1ThresholdFromEnv(env: Record<string, string | undefined> = pro
37
38
  return raw
38
39
  }
39
40
 
40
- const MODE_DESCRIPTION: Record<J1Mode, string> = {
41
+ const MODE_DESCRIPTION_EN: Record<J1Mode, string> = {
41
42
  off: 'nothing fires (hard zero)',
42
43
  shadow: 'observe + record; invisible in the session',
43
44
  warn: 'RESERVED — behaves as shadow in this release',
44
45
  enforce: 'high-risk scores DENY the tool call (fail-open on gate unavailability)',
45
46
  }
46
47
 
48
+ const MODE_DESCRIPTION_PT: Record<J1Mode, string> = {
49
+ off: 'desativado (hard zero)',
50
+ shadow: 'observa + registra telemetria (modo silencioso)',
51
+ warn: 'RESERVADO (RESERVED) — comporta-se como shadow nesta versão',
52
+ enforce: 'alto risco bloqueia a ferramenta (fail-open se indisponível)',
53
+ }
54
+
47
55
  export function buildJ1Tab(
48
56
  env: Record<string, string | undefined>,
49
57
  disabledByOverride: boolean,
58
+ languagePref?: string | undefined,
50
59
  ): SettingsTab {
60
+ const lang = resolveLanguage(languagePref)
61
+ const isPt = lang === 'pt-BR'
51
62
  const mode = j1ModeFromEnv(env)
52
63
  const threshold = j1ThresholdFromEnv(env)
53
64
  const gateState = disabledByOverride
@@ -55,30 +66,36 @@ export function buildJ1Tab(
55
66
  : mode === 'off'
56
67
  ? 'off (env unset)'
57
68
  : 'active'
69
+ const desc = isPt ? MODE_DESCRIPTION_PT[mode] : MODE_DESCRIPTION_EN[mode]
70
+
58
71
  return {
59
72
  id: 'j1',
60
- title: 'J1',
73
+ title: isPt ? 'Segurança J1' : 'J1',
61
74
  groups: [
62
75
  {
63
- title: 'Ladder (env-only — never written here)',
76
+ title: isPt
77
+ ? 'Nível de Segurança e Portão de Risco J1 (env-only)'
78
+ : 'Safety Level & Risk Gate (J1) (env-only — never written here)',
64
79
  rows: [
65
80
  {
66
81
  id: 'j1.mode',
67
- name: 'Mode',
82
+ name: isPt ? 'Modo de execução' : 'Mode',
68
83
  value: mode,
69
- note: `${MODE_DESCRIPTION[mode]} · restart applies`,
84
+ note: `${desc} · ${isPt ? 'reinício necessário (restart applies)' : 'restart applies'}`,
70
85
  },
71
86
  {
72
87
  id: 'j1.threshold',
73
- name: 'Enforce threshold',
88
+ name: isPt ? 'Limiar de bloqueio' : 'Enforce threshold',
74
89
  value: String(threshold),
75
- note: 'deny at or above · 0..1 · default 0.8',
90
+ note: isPt
91
+ ? 'bloqueia em ou acima · 0..1 · padrão 0.8'
92
+ : 'deny at or above · 0..1 · default 0.8',
76
93
  },
77
94
  {
78
95
  id: 'j1.gate',
79
- name: 'Gate',
96
+ name: isPt ? 'Estado do portão' : 'Gate',
80
97
  value: gateState,
81
- note: `${J1_FLAG_ENV} / ${J1_THRESHOLD_ENV} · read once at startup`,
98
+ note: `${J1_FLAG_ENV} / ${J1_THRESHOLD_ENV} · ${isPt ? 'lido na inicialização' : 'read once at startup'}`,
82
99
  },
83
100
  ],
84
101
  },
@@ -87,7 +87,6 @@ import {
87
87
  buildTuiTab,
88
88
  clearTuiDraftPreview,
89
89
  mutateTuiPrefs,
90
- savedTuiPrefs,
91
90
  setTuiDraftPreview,
92
91
  tuiPrefs,
93
92
  } from './tui-prefs.ts'
@@ -795,26 +794,30 @@ function createWindowController(
795
794
  return input
796
795
  }
797
796
 
798
- const tabs = (): SettingsTab[] => [
799
- buildGatesTab(load()),
800
- buildDecisionTab(decision(), process.env, readAuthProviders(), readConfigProviders()),
801
- buildPresetTab(presetInput()),
802
- buildTuiTab(savedTuiPrefs()),
803
- buildAutonomyTab({
804
- goalLoop: goalLoop(),
805
- budgets: budgets(),
806
- goalLoopRestartPending: autonomyRestartPending(),
807
- }),
808
- buildJ1Tab(process.env, false),
809
- buildUpdatesTab(updatesInput()),
810
- buildChangelogTab(currentVersion, changelogItems()),
811
- buildDoctorTab({
812
- runningVersion: currentVersion,
813
- nodeVersion: process.versions.node,
814
- load: load(),
815
- }),
816
- buildAboutTab(currentVersion),
817
- ]
797
+ const tabs = (): SettingsTab[] => {
798
+ const lang = tuiPrefs().layout?.language
799
+ return [
800
+ buildGatesTab(load()),
801
+ buildDecisionTab(decision(), process.env, readAuthProviders(), readConfigProviders(), lang),
802
+ buildPresetTab(presetInput()),
803
+ buildTuiTab(tuiPrefs(), lang),
804
+ buildAutonomyTab({
805
+ goalLoop: goalLoop(),
806
+ budgets: budgets(),
807
+ goalLoopRestartPending: autonomyRestartPending(),
808
+ languagePref: lang,
809
+ }),
810
+ buildJ1Tab(process.env, false, lang),
811
+ buildUpdatesTab(updatesInput()),
812
+ buildChangelogTab(currentVersion, changelogItems()),
813
+ buildDoctorTab({
814
+ runningVersion: currentVersion,
815
+ nodeVersion: process.versions.node,
816
+ load: load(),
817
+ }),
818
+ buildAboutTab(currentVersion),
819
+ ]
820
+ }
818
821
 
819
822
  const rows = () => tabRows(tabs()[page()] ?? tabs()[0] ?? EMPTY_TAB)
820
823