pantheon-opencode 2.0.1 → 2.0.3

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.1",
3
+ "version": "2.0.3",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pantheon-tui",
9
- "version": "2.0.1",
9
+ "version": "2.0.3",
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.1",
4
+ "version": "2.0.3",
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": {
@@ -91,12 +91,12 @@ export function buildAutonomyTab(input: {
91
91
  groups: [
92
92
  {
93
93
  title: isPt
94
- ? 'Goal loop (auto-continuação de sessões multi-turn)'
95
- : 'Goal loop (multi-turn session auto-continuation)',
94
+ ? 'Loop Contínuo (auto-continuação de sessões multi-turn)'
95
+ : 'Auto-Continue Loop (multi-turn session auto-continuation)',
96
96
  rows: [
97
97
  {
98
98
  id: 'autonomy.goal_loop.enabled',
99
- name: isPt ? 'Goal loop' : 'Goal loop',
99
+ name: isPt ? 'Loop Contínuo' : 'Auto-Continue Loop',
100
100
  value: input.goalLoop.enabled ? 'enabled' : 'disabled',
101
101
  cycle: GOAL_LOOP_ENABLED_CYCLE,
102
102
  note: isPt
@@ -130,13 +130,11 @@ export function buildAutonomyTab(input: {
130
130
  ],
131
131
  },
132
132
  {
133
- title: isPt
134
- ? 'Orçamento Jev (aplicado em tempo real por decisão)'
135
- : 'Decision budgets (applies live per gated call)',
133
+ title: isPt ? 'Orçamentos de Decisão (Jev)' : 'Decision Budgets (Jev)',
136
134
  rows: [
137
135
  {
138
136
  id: 'autonomy.budget.monthly',
139
- name: isPt ? 'Teto mensal' : 'Monthly cap',
137
+ name: isPt ? 'Teto Mensal (USD)' : 'Monthly Budget Cap',
140
138
  value: formatUsd(input.budgets.monthlyUsd),
141
139
  cycle: MONTHLY_USD_CYCLE,
142
140
  note: isPt
@@ -145,7 +143,7 @@ export function buildAutonomyTab(input: {
145
143
  },
146
144
  {
147
145
  id: 'autonomy.budget.perDecision',
148
- name: isPt ? 'Teto por decisão' : 'Per-decision cap',
146
+ name: isPt ? 'Teto por Consulta' : 'Per-Decision Cap',
149
147
  value: formatUsd(input.budgets.perDecisionUsd),
150
148
  cycle: PER_DECISION_USD_CYCLE,
151
149
  note: isPt
@@ -349,7 +349,7 @@ export function buildDecisionTab(
349
349
  const rows: SettingsRow[] = [
350
350
  {
351
351
  id: 'decision.enabled',
352
- name: isPt ? 'Assistente Jev' : 'Router',
352
+ name: isPt ? 'Assistente Jev' : 'Jev Assistant',
353
353
  value: config.enabled ? 'enabled' : 'disabled',
354
354
  // Corrupt config → read-only; the notice (glue) carries the remedy.
355
355
  ...(corrupt ? {} : { cycle: DECISION_ENABLED_CYCLE }),
@@ -363,7 +363,7 @@ export function buildDecisionTab(
363
363
  },
364
364
  {
365
365
  id: 'decision.selection.mode',
366
- name: isPt ? 'Modo de operação' : 'Selection mode',
366
+ name: isPt ? 'Modo de Operação' : 'Operation Mode',
367
367
  value: config.selection.mode,
368
368
  ...(corrupt ? {} : { cycle: DECISION_SELECTION_CYCLE }),
369
369
  note: isPt
@@ -378,7 +378,7 @@ export function buildDecisionTab(
378
378
  : (DECISION_TARGET_CYCLE[0] ?? 'openrouter-jev/typesafe/jev-1.13')
379
379
  rows.push({
380
380
  id: 'decision.selection.target',
381
- name: isPt ? 'Modelo de decisão' : 'Explicit target',
381
+ name: isPt ? 'Modelo de Decisão' : 'Decision Model',
382
382
  value:
383
383
  config.selection.mode === 'local'
384
384
  ? config.selection.provider
@@ -412,7 +412,7 @@ export function buildDecisionTab(
412
412
 
413
413
  rows.push({
414
414
  id: 'decision.consent',
415
- name: isPt ? 'Acesso à nuvem (Egress)' : 'Egress consent',
415
+ name: isPt ? 'Acesso à Nuvem' : 'Cloud API Access',
416
416
  value: config.egress_consent ? 'granted' : 'not granted',
417
417
  ...(corrupt ? {} : { cycle: DECISION_CONSENT_CYCLE }),
418
418
  note: isPt
@@ -428,7 +428,7 @@ export function buildDecisionTab(
428
428
  id: 'decision',
429
429
  title: isPt ? 'Decisão' : 'Decision',
430
430
  groups: [
431
- { title: isPt ? 'Assistente de Decisão' : 'Decision router', rows },
431
+ { title: isPt ? 'Assistente de Decisão (Jev)' : 'Decision Assistant (Jev)', rows },
432
432
  {
433
433
  title: isPt
434
434
  ? 'Credenciais (status apenas — valores nunca gravados na janela)'
@@ -70,16 +70,14 @@ export function buildJ1Tab(
70
70
 
71
71
  return {
72
72
  id: 'j1',
73
- title: isPt ? 'Segurança J1' : 'J1',
73
+ title: isPt ? 'Segurança J1' : 'J1 Safety',
74
74
  groups: [
75
75
  {
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)',
76
+ title: isPt ? 'Portão de Segurança (J1)' : 'Safety Risk Gate (J1)',
79
77
  rows: [
80
78
  {
81
79
  id: 'j1.mode',
82
- name: isPt ? 'Modo de execução' : 'Mode',
80
+ name: isPt ? 'Modo de Operação' : 'Operation Mode',
83
81
  value: mode,
84
82
  note: `${desc} · ${isPt ? 'reinício necessário (restart applies)' : 'restart applies'}`,
85
83
  },
@@ -93,7 +91,7 @@ export function buildJ1Tab(
93
91
  },
94
92
  {
95
93
  id: 'j1.gate',
96
- name: isPt ? 'Estado do portão' : 'Gate',
94
+ name: isPt ? 'Portão de Segurança' : 'Safety Risk Gate',
97
95
  value: gateState,
98
96
  note: `${J1_FLAG_ENV} / ${J1_THRESHOLD_ENV} · ${isPt ? 'lido na inicialização' : 'read once at startup'}`,
99
97
  },
@@ -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'
@@ -796,12 +795,12 @@ function createWindowController(
796
795
  }
797
796
 
798
797
  const tabs = (): SettingsTab[] => {
799
- const lang = savedTuiPrefs().layout?.language
798
+ const lang = tuiPrefs().layout?.language
800
799
  return [
801
800
  buildGatesTab(load()),
802
801
  buildDecisionTab(decision(), process.env, readAuthProviders(), readConfigProviders(), lang),
803
802
  buildPresetTab(presetInput()),
804
- buildTuiTab(savedTuiPrefs()),
803
+ buildTuiTab(tuiPrefs(), lang),
805
804
  buildAutonomyTab({
806
805
  goalLoop: goalLoop(),
807
806
  budgets: budgets(),
@@ -17,7 +17,8 @@ export const SUPPORTED_LANGUAGES = SETTINGS_LANGUAGES_CYCLE
17
17
 
18
18
  /**
19
19
  * Resolve effective language: 'pt-BR' or 'en'.
20
- * Defaults to 'pt-BR' if system locale contains 'pt', otherwise 'en'.
20
+ * Defaults to 'pt-BR' if system locale contains 'pt', if Intl locale is pt,
21
+ * or if system timezone is Brazilian/Portuguese; otherwise 'en'.
21
22
  */
22
23
  export function resolveLanguage(
23
24
  preference: string = 'auto',
@@ -26,10 +27,44 @@ export function resolveLanguage(
26
27
  if (preference === 'pt-BR') return 'pt-BR'
27
28
  if (preference === 'en') return 'en'
28
29
 
29
- // Auto-detection based on environment locale
30
- const lang = (env.LC_ALL ?? env.LC_MESSAGES ?? env.LANG ?? '').toLowerCase()
30
+ // 1. Auto-detection based on environment locale variables
31
+ const lang = (env.LC_ALL ?? env.LC_MESSAGES ?? env.LANG ?? env.LANGUAGE ?? '').toLowerCase()
31
32
  if (lang.startsWith('pt')) return 'pt-BR'
32
33
 
34
+ // 2. Auto-detection based on Intl locale
35
+ try {
36
+ const intlLocale = Intl.DateTimeFormat().resolvedOptions().locale.toLowerCase()
37
+ if (intlLocale.startsWith('pt')) return 'pt-BR'
38
+ } catch {}
39
+
40
+ // 3. Auto-detection based on timezone (Brazil & Portugal)
41
+ try {
42
+ const tz = (env.TZ ?? Intl.DateTimeFormat().resolvedOptions().timeZone ?? '').toLowerCase()
43
+ if (
44
+ tz.includes('sao_paulo') ||
45
+ tz.includes('brazil') ||
46
+ tz.includes('fortaleza') ||
47
+ tz.includes('recife') ||
48
+ tz.includes('manaus') ||
49
+ tz.includes('belem') ||
50
+ tz.includes('cuiaba') ||
51
+ tz.includes('campo_grande') ||
52
+ tz.includes('porto_velho') ||
53
+ tz.includes('rio_branco') ||
54
+ tz.includes('boa_vista') ||
55
+ tz.includes('maceio') ||
56
+ tz.includes('bahia') ||
57
+ tz.includes('noronha') ||
58
+ tz.includes('araguaina') ||
59
+ tz.includes('santarem') ||
60
+ tz.includes('lisbon') ||
61
+ tz.includes('madeira') ||
62
+ tz.includes('azores')
63
+ ) {
64
+ return 'pt-BR'
65
+ }
66
+ } catch {}
67
+
33
68
  return 'en'
34
69
  }
35
70
 
@@ -17,6 +17,7 @@ import type { Context } from '@opencode/plugin/tui/context'
17
17
  import type { Accessor, Setter } from 'solid-js'
18
18
  import { createSignal } from 'solid-js'
19
19
  import type { SettingsDraft, SettingsRow, SettingsTab } from './pantheon-settings-state.ts'
20
+ import { resolveLanguage } from './settings-i18n.ts'
20
21
 
21
22
  // ── The durable store handle (host storage, one per plugin) ────────────
22
23
  // Created once at setup and stashed under a globalThis symbol so
@@ -338,70 +339,83 @@ const row = (id: string, name: string, value: boolean, note: string): SettingsRo
338
339
  note,
339
340
  })
340
341
 
341
- export function buildTuiTab(prefs: TuiPrefs): SettingsTab {
342
+ export function buildTuiTab(prefs: TuiPrefs, languagePref?: string): SettingsTab {
343
+ const isPt = resolveLanguage(languagePref ?? prefs.layout?.language) === 'pt-BR'
342
344
  return {
343
345
  id: 'tui',
344
346
  title: 'TUI',
345
347
  groups: [
346
348
  {
347
- title: 'Preset & Layout',
349
+ title: isPt ? 'Predefinição & Layout' : 'Preset & Layout',
348
350
  rows: [
349
351
  {
350
352
  id: 'tui.layout.preset',
351
- name: 'Layout preset',
353
+ name: isPt ? 'Predefinição de layout' : 'Layout preset',
352
354
  value: prefs.layout?.preset ?? DEFAULT_TUI_PREFS.layout.preset,
353
355
  cycle: LAYOUT_PRESETS_CYCLE,
354
- note: 'comfortable | compact — sets spacing & borders',
356
+ note: isPt
357
+ ? 'comfortable | compact — define espaçamento e bordas'
358
+ : 'comfortable | compact — sets spacing & borders',
355
359
  },
356
360
  {
357
361
  id: 'tui.layout.separator',
358
- name: 'Separator',
362
+ name: isPt ? 'Separador' : 'Separator',
359
363
  value: prefs.layout?.separator ?? DEFAULT_TUI_PREFS.layout.separator,
360
364
  cycle: SEPARATOR_STYLES_CYCLE,
361
- note: 'spaces | pipes | dots | slashes — status line glyphs',
365
+ note: isPt
366
+ ? 'spaces | pipes | dots | slashes — glifos na linha de status'
367
+ : 'spaces | pipes | dots | slashes — status line glyphs',
362
368
  },
363
369
  {
364
370
  id: 'tui.layout.settingsView',
365
- name: 'Settings surface',
371
+ name: isPt ? 'Superfície de configurações' : 'Settings surface',
366
372
  value: tuiRowValue(prefs, 'tui.layout.settingsView') ?? 'docked',
367
373
  cycle: SETTINGS_VIEW_MODES,
368
- note: 'docked (above prompt) | fullscreen router page | dialog overlay',
374
+ note: isPt
375
+ ? 'docked (acima do prompt) | fullscreen | dialog'
376
+ : 'docked (above prompt) | fullscreen router page | dialog overlay',
369
377
  },
370
378
  {
371
379
  id: 'tui.layout.language',
372
- name: 'Language / Idioma',
380
+ name: isPt ? 'Idioma / Language' : 'Language / Idioma',
373
381
  value: tuiRowValue(prefs, 'tui.layout.language') ?? 'auto',
374
382
  cycle: LANGUAGE_CYCLE,
375
- note: 'auto (LANG/LC_ALL) | pt-BR (Português) | en (English)',
383
+ note: isPt
384
+ ? 'auto (detecta via fuso/locale) | pt-BR (Português) | en (English)'
385
+ : 'auto (detect via timezone/locale) | pt-BR (Português) | en (English)',
376
386
  },
377
387
  ],
378
388
  },
379
389
  {
380
- title: 'Bars & Gauges',
390
+ title: isPt ? 'Barras & Medidores' : 'Bars & Gauges',
381
391
  rows: [
382
392
  {
383
393
  id: 'tui.sidebar.context.barShape',
384
- name: 'Bar shape',
394
+ name: isPt ? 'Formato da barra' : 'Bar shape',
385
395
  value: prefs.sidebar.context.barShape,
386
396
  cycle: BAR_SHAPES_CYCLE,
387
397
  note: 'line (━─) | block (▰▱) | smooth (█░) | ascii (=) | dots (●○) | braille',
388
398
  },
389
399
  {
390
400
  id: 'tui.sidebar.context.barWidth',
391
- name: 'Bar width',
401
+ name: isPt ? 'Largura da barra' : 'Bar width',
392
402
  value: prefs.sidebar.context.barWidth,
393
403
  cycle: BAR_WIDTHS_CYCLE,
394
- note: 'standard (12) | compact (8) | wide (16) | full (20 cells)',
404
+ note: isPt
405
+ ? 'standard (12) | compact (8) | wide (16) | full (20 células)'
406
+ : 'standard (12) | compact (8) | wide (16) | full (20 cells)',
395
407
  },
396
408
  row(
397
409
  'tui.sidebar.context.evenMark',
398
- 'Even-use mark',
410
+ isPt ? 'Marca central (50%)' : 'Even-use mark',
399
411
  prefs.sidebar.context.evenMark,
400
- '| indicator at 50% midpoint in gauge bars',
412
+ isPt
413
+ ? '| indicador aos 50% nas barras de medição'
414
+ : '| indicator at 50% midpoint in gauge bars',
401
415
  ),
402
416
  {
403
417
  id: 'tui.sidebar.context.gauge',
404
- name: 'Gauge style',
418
+ name: isPt ? 'Estilo do medidor' : 'Gauge style',
405
419
  value: prefs.sidebar.context.gauge,
406
420
  cycle: GAUGE_STYLES,
407
421
  note: 'both | bar | percent | off — `▰▱ 42% of 200k`',
@@ -409,106 +423,110 @@ export function buildTuiTab(prefs: TuiPrefs): SettingsTab {
409
423
  ],
410
424
  },
411
425
  {
412
- title: 'Sidebar header',
426
+ title: isPt ? 'Cabeçalho da barra lateral' : 'Sidebar header',
413
427
  rows: [
414
428
  row(
415
429
  'tui.sidebar.header.version',
416
- 'Version line',
430
+ isPt ? 'Linha de versão' : 'Version line',
417
431
  prefs.sidebar.header.version,
418
- 'the `Pantheon v…` line',
432
+ isPt ? 'linha `Pantheon v…`' : 'the `Pantheon v…` line',
419
433
  ),
420
434
  row(
421
435
  'tui.sidebar.header.preset',
422
- 'Preset line',
436
+ isPt ? 'Linha de preset' : 'Preset line',
423
437
  prefs.sidebar.header.preset,
424
- 'the `▸ preset · provider` line',
438
+ isPt ? 'linha `▸ preset · provider`' : 'the `▸ preset · provider` line',
425
439
  ),
426
440
  row(
427
441
  'tui.sidebar.header.session',
428
- 'Session line',
442
+ isPt ? 'Linha de sessão' : 'Session line',
429
443
  prefs.sidebar.header.session,
430
- 'the active session title',
444
+ isPt ? 'título da sessão ativa' : 'the active session title',
431
445
  ),
432
446
  ],
433
447
  },
434
448
  {
435
- title: 'Sidebar blocks',
449
+ title: isPt ? 'Blocos da barra lateral' : 'Sidebar blocks',
436
450
  rows: [
437
451
  row(
438
452
  'tui.sidebar.block.context',
439
- 'Context block',
453
+ isPt ? 'Bloco de contexto' : 'Context block',
440
454
  prefs.sidebar.blocks.context,
441
- 'tokens, gauge, spend, model usage',
455
+ isPt ? 'tokens, medidor, custo, uso de modelos' : 'tokens, gauge, spend, model usage',
442
456
  ),
443
457
  row(
444
458
  'tui.sidebar.block.git',
445
- 'Git block',
459
+ isPt ? 'Bloco do Git' : 'Git block',
446
460
  prefs.sidebar.blocks.git,
447
- 'branch + working-tree counts',
461
+ isPt ? 'branch + contagem de alterações' : 'branch + working-tree counts',
448
462
  ),
449
463
  row(
450
464
  'tui.sidebar.block.todo',
451
- 'Todo block',
465
+ isPt ? 'Bloco Todo' : 'Todo block',
452
466
  prefs.sidebar.blocks.todo,
453
- 'the newest todowrite',
467
+ isPt ? 'tarefas pendentes mais recentes' : 'the newest todowrite',
454
468
  ),
455
469
  row(
456
470
  'tui.sidebar.block.dispatch',
457
- 'Dispatch block',
471
+ isPt ? 'Bloco Dispatch' : 'Dispatch block',
458
472
  prefs.sidebar.blocks.dispatch,
459
- 'live delegations + rollup',
473
+ isPt ? 'delegações em tempo real' : 'live delegations + rollup',
460
474
  ),
461
475
  ],
462
476
  },
463
477
  {
464
- title: 'Context block detail',
478
+ title: isPt ? 'Detalhe do bloco de contexto' : 'Context block detail',
465
479
  rows: [
466
480
  row(
467
481
  'tui.sidebar.context.tokens',
468
- 'Tokens row',
482
+ isPt ? 'Linha de tokens' : 'Tokens row',
469
483
  prefs.sidebar.context.tokens,
470
- 'the raw token count line',
484
+ isPt ? 'contagem bruta de tokens' : 'the raw token count line',
471
485
  ),
472
486
  row(
473
487
  'tui.sidebar.context.spent',
474
- 'Spent row',
488
+ isPt ? 'Linha de custo' : 'Spent row',
475
489
  prefs.sidebar.context.spent,
476
- 'the `$… spent in session` line',
490
+ isPt ? 'linha `$… gastos na sessão`' : 'the `$… spent in session` line',
477
491
  ),
478
492
  row(
479
493
  'tui.sidebar.context.modelUsage',
480
- 'Model usage table',
494
+ isPt ? 'Tabela de uso de modelos' : 'Model usage table',
481
495
  prefs.sidebar.context.modelUsage,
482
- 'per-model tokens/USD',
496
+ isPt ? 'resumo de chamadas por modelo' : 'per-model tokens/USD',
483
497
  ),
484
498
  row(
485
499
  'tui.sidebar.context.performance',
486
- 'Performance line',
500
+ isPt ? 'Linha de desempenho' : 'Performance row',
487
501
  prefs.sidebar.context.performance,
488
- 'cache % + tok/s',
502
+ isPt ? 'tokens/segundo e latência' : 'cache % + tok/s',
489
503
  ),
490
504
  row(
491
505
  'tui.sidebar.context.localSpend',
492
- 'Local spend',
506
+ isPt ? 'Linha de custo local' : 'Local spend row',
493
507
  prefs.sidebar.context.localSpend,
494
- 'hoje / 30d totals',
508
+ isPt ? 'totais de hoje / 30 dias' : 'hoje / 30d totals',
495
509
  ),
496
510
  ],
497
511
  },
498
512
  {
499
- title: 'Footers',
513
+ title: isPt ? 'Rodapés' : 'Footers',
500
514
  rows: [
501
515
  row(
502
516
  'tui.footer.prompt',
503
- 'Prompt footer',
517
+ isPt ? 'Prompt inferior' : 'Prompt footer',
504
518
  prefs.footer.prompt,
505
- 'the `▸preset · ✦n ativos` line while delegations run',
519
+ isPt
520
+ ? 'linha `▸preset · ✦n ativos` durante delegações'
521
+ : 'the `▸preset · ✦n ativos` line while delegations run',
506
522
  ),
507
523
  row(
508
524
  'tui.footer.home',
509
- 'Home status',
525
+ isPt ? 'Status inicial' : 'Home status',
510
526
  prefs.footer.home,
511
- 'the `Pantheon v…` line under the home prompt',
527
+ isPt
528
+ ? 'linha `Pantheon v…` sob o prompt inicial'
529
+ : 'the `Pantheon v…` line under the home prompt',
512
530
  ),
513
531
  ],
514
532
  },
@@ -70,7 +70,7 @@ 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. **Ambiguity Resolution:**
74
- - With decision router active, use `pantheon_jev_decide` (mode: `choice`) for non-trivial architectural trade-offs.
75
- - Fall back to native `question` tool with options and marked defaults if Jev is off or unavailable.
76
- - Non-blocking gaps use sensible declared defaults.
73
+ 5. **Interactive Questioning & Ambiguity Resolution:**
74
+ - Whenever prompt refinement requires user disambiguation or confirmation of critical trade-offs, **always invoke the native `question` tool** with structured choices and marked defaults.
75
+ - 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.