pantheon-opencode 2.0.1 → 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.1",
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.1",
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.1",
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": {
@@ -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
  },