pantheon-opencode 2.0.0 → 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.
- package/CHANGELOG.md +47 -9
- package/README.md +13 -2
- package/README.pt-BR.md +13 -2
- package/package.json +1 -1
- package/plugin.json +1 -1
- package/pyproject.toml +1 -1
- package/src/agents/athena.md +14 -7
- package/src/instructions/zeus-council-synthesis.instructions.md +28 -9
- package/src/plugins/tui/dist/tui.js +124 -72
- 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 +51 -22
- package/src/plugins/tui/src/decision-router-state.ts +59 -24
- package/src/plugins/tui/src/j1-gate-status.ts +26 -9
- package/src/plugins/tui/src/pantheon-settings.tsx +24 -20
- package/src/plugins/tui/src/settings-i18n.ts +203 -0
- package/src/plugins/tui/src/tui-prefs.ts +25 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pantheon-tui",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pantheon-tui",
|
|
9
|
-
"version": "2.0.
|
|
9
|
+
"version": "2.0.1",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@opencode/plugin": "2.0.26",
|
|
@@ -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:
|
|
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
|
-
'
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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
|
-
?
|
|
354
|
-
|
|
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:
|
|
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
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
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
|
-
:
|
|
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:
|
|
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:
|
|
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
|
|
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:
|
|
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: `${
|
|
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:
|
|
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
|
},
|
|
@@ -795,26 +795,30 @@ function createWindowController(
|
|
|
795
795
|
return input
|
|
796
796
|
}
|
|
797
797
|
|
|
798
|
-
const tabs = (): SettingsTab[] =>
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
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
|
+
}
|
|
818
822
|
|
|
819
823
|
const rows = () => tabRows(tabs()[page()] ?? tabs()[0] ?? EMPTY_TAB)
|
|
820
824
|
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* settings-i18n.ts — Bilingual (PT-BR / EN) internationalization for TUI settings.
|
|
3
|
+
*
|
|
4
|
+
* Provides localized titles, labels, and explanations for:
|
|
5
|
+
* - Decision Router & Jev model selection
|
|
6
|
+
* - Autonomy & Budgets
|
|
7
|
+
* - Safety & J1 Risk Gate
|
|
8
|
+
*
|
|
9
|
+
* Automatically detects environment locale (LANG / LC_ALL) while allowing
|
|
10
|
+
* manual override in TUI preferences.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export type SettingsLanguage = 'auto' | 'pt-BR' | 'en'
|
|
14
|
+
|
|
15
|
+
export const SETTINGS_LANGUAGES_CYCLE: readonly string[] = Object.freeze(['auto', 'pt-BR', 'en'])
|
|
16
|
+
export const SUPPORTED_LANGUAGES = SETTINGS_LANGUAGES_CYCLE
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Resolve effective language: 'pt-BR' or 'en'.
|
|
20
|
+
* Defaults to 'pt-BR' if system locale contains 'pt', otherwise 'en'.
|
|
21
|
+
*/
|
|
22
|
+
export function resolveLanguage(
|
|
23
|
+
preference: string = 'auto',
|
|
24
|
+
env: Record<string, string | undefined> = process.env,
|
|
25
|
+
): 'pt-BR' | 'en' {
|
|
26
|
+
if (preference === 'pt-BR') return 'pt-BR'
|
|
27
|
+
if (preference === 'en') return 'en'
|
|
28
|
+
|
|
29
|
+
// Auto-detection based on environment locale
|
|
30
|
+
const lang = (env.LC_ALL ?? env.LC_MESSAGES ?? env.LANG ?? '').toLowerCase()
|
|
31
|
+
if (lang.startsWith('pt')) return 'pt-BR'
|
|
32
|
+
|
|
33
|
+
return 'en'
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface I18nStringPair {
|
|
37
|
+
en: string
|
|
38
|
+
pt: string
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export const I18N = {
|
|
42
|
+
tabs: {
|
|
43
|
+
decision: { en: 'Decision (Jev)', pt: 'Decisão (Jev)' },
|
|
44
|
+
autonomy: { en: 'Autonomy', pt: 'Autonomia' },
|
|
45
|
+
safety: { en: 'Safety (J1)', pt: 'Segurança (J1)' },
|
|
46
|
+
tui: { en: 'TUI', pt: 'TUI' },
|
|
47
|
+
},
|
|
48
|
+
decision: {
|
|
49
|
+
groupRouter: {
|
|
50
|
+
en: 'Decision Router (Jev Assistant)',
|
|
51
|
+
pt: 'Assistente de Decisão (Jev)',
|
|
52
|
+
},
|
|
53
|
+
groupCredentials: {
|
|
54
|
+
en: 'Credentials (status only — values never enter the window)',
|
|
55
|
+
pt: 'Credenciais (apenas status — valores protegidos)',
|
|
56
|
+
},
|
|
57
|
+
routerName: {
|
|
58
|
+
en: 'Router (Decision Assistant)',
|
|
59
|
+
pt: 'Assistente Jev',
|
|
60
|
+
},
|
|
61
|
+
routerNote: {
|
|
62
|
+
en: 'applies live — enables intelligent route arbitration and candidate ranking',
|
|
63
|
+
pt: 'aplica em tempo real — motor de arbitragem inteligente e ranking de rotas',
|
|
64
|
+
},
|
|
65
|
+
modelName: {
|
|
66
|
+
en: 'Decision model',
|
|
67
|
+
pt: 'Modelo de Decisão',
|
|
68
|
+
},
|
|
69
|
+
modelNote: {
|
|
70
|
+
en: 'local routes on-device (free); auto/explicit pick a remote decision model',
|
|
71
|
+
pt: 'local decide no seu PC (grátis); auto/explícito usa modelo nuvem (OpenRouter)',
|
|
72
|
+
},
|
|
73
|
+
selectionModeName: {
|
|
74
|
+
en: 'Selection mode',
|
|
75
|
+
pt: 'Modo de operação',
|
|
76
|
+
},
|
|
77
|
+
selectionModeNote: {
|
|
78
|
+
en: 'local routes on-device; auto/explicit pick a remote decision model',
|
|
79
|
+
pt: 'local decide no dispositivo; auto/explícito usa modelo remoto',
|
|
80
|
+
},
|
|
81
|
+
egressName: {
|
|
82
|
+
en: 'Cloud API access (Egress)',
|
|
83
|
+
pt: 'Acesso à Nuvem (Egress)',
|
|
84
|
+
},
|
|
85
|
+
egressNoteGranted: {
|
|
86
|
+
en: 'granted = remote decision routes may call their gateway (budget-capped)',
|
|
87
|
+
pt: 'permitido = rotas remotas podem consultar a API (com limite de orçamento)',
|
|
88
|
+
},
|
|
89
|
+
egressNoteNotGranted: {
|
|
90
|
+
en: 'not granted = remote routes blocked; local heuristic decisions only',
|
|
91
|
+
pt: 'não permitido = chamadas remotas bloqueadas; apenas heurística local',
|
|
92
|
+
},
|
|
93
|
+
candidatesName: {
|
|
94
|
+
en: 'Active candidates',
|
|
95
|
+
pt: 'Candidatos ativos',
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
autonomy: {
|
|
99
|
+
groupGoalLoop: {
|
|
100
|
+
en: 'Goal loop (multi-turn session auto-continuation)',
|
|
101
|
+
pt: 'Execução Contínua (Goal Loop)',
|
|
102
|
+
},
|
|
103
|
+
goalLoopName: {
|
|
104
|
+
en: 'Goal loop',
|
|
105
|
+
pt: 'Loop contínuo',
|
|
106
|
+
},
|
|
107
|
+
goalLoopNote: {
|
|
108
|
+
en: 'auto-continues multi-turn tasks when session goes idle · applies after OpenCode restart',
|
|
109
|
+
pt: 'continua tarefas de múltiplos passos automaticamente · requer reinício',
|
|
110
|
+
},
|
|
111
|
+
maxContinuationsName: {
|
|
112
|
+
en: 'Max continuations',
|
|
113
|
+
pt: 'Limite de turnos',
|
|
114
|
+
},
|
|
115
|
+
maxContinuationsNote: {
|
|
116
|
+
en: '1..200 — safety ceiling to prevent runaway tasks',
|
|
117
|
+
pt: '1..200 — teto de segurança contra tarefas infinitas',
|
|
118
|
+
},
|
|
119
|
+
cooldownName: {
|
|
120
|
+
en: 'Cooldown (ms)',
|
|
121
|
+
pt: 'Intervalo (ms)',
|
|
122
|
+
},
|
|
123
|
+
cooldownNote: {
|
|
124
|
+
en: 'delay between autonomous turns (min 1000ms)',
|
|
125
|
+
pt: 'tempo de espera entre turnos autônomos (mín 1000ms)',
|
|
126
|
+
},
|
|
127
|
+
groupBudgets: {
|
|
128
|
+
en: 'Decision budgets (applies live per gated call)',
|
|
129
|
+
pt: 'Orçamento Jev (teto financeiro de proteção)',
|
|
130
|
+
},
|
|
131
|
+
monthlyCapName: {
|
|
132
|
+
en: 'Monthly cap',
|
|
133
|
+
pt: 'Teto mensal (USD)',
|
|
134
|
+
},
|
|
135
|
+
monthlyCapNote: {
|
|
136
|
+
en: 'monthly USD ceiling for gated arbitrator decisions',
|
|
137
|
+
pt: 'teto mensal em dólares para decisões do assistente Jev',
|
|
138
|
+
},
|
|
139
|
+
perDecisionCapName: {
|
|
140
|
+
en: 'Per-decision cap',
|
|
141
|
+
pt: 'Teto por consulta (USD)',
|
|
142
|
+
},
|
|
143
|
+
perDecisionCapNote: {
|
|
144
|
+
en: 'price cap — gated decisions above this are refused',
|
|
145
|
+
pt: 'teto por decisão — consultas remotas que excederem são recusadas',
|
|
146
|
+
},
|
|
147
|
+
groupGradient: {
|
|
148
|
+
en: 'Decision gradient (reference policy · J1 owns the risk axis)',
|
|
149
|
+
pt: 'Níveis de Decisão & Segurança (Referência)',
|
|
150
|
+
},
|
|
151
|
+
soloName: {
|
|
152
|
+
en: 'Decide solo',
|
|
153
|
+
pt: 'Decisão direta',
|
|
154
|
+
},
|
|
155
|
+
soloNote: {
|
|
156
|
+
en: 'reversible & low-risk edits, routine fixes (no gate)',
|
|
157
|
+
pt: 'edições reversíveis e baixo risco, sem portão de bloqueio',
|
|
158
|
+
},
|
|
159
|
+
jevName: {
|
|
160
|
+
en: 'Jev decides',
|
|
161
|
+
pt: 'Decisão Jev',
|
|
162
|
+
},
|
|
163
|
+
jevNote: {
|
|
164
|
+
en: 'typed ambiguity & candidate ranking (budget-capped)',
|
|
165
|
+
pt: 'ambiguidade e ranking de skills com teto de orçamento',
|
|
166
|
+
},
|
|
167
|
+
humanName: {
|
|
168
|
+
en: 'Human decides',
|
|
169
|
+
pt: 'Aprovação humana',
|
|
170
|
+
},
|
|
171
|
+
humanNote: {
|
|
172
|
+
en: 'high-risk & destructive operations (J1 gate)',
|
|
173
|
+
pt: 'ações de alto risco e destrutivas (portão de segurança J1)',
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
safety: {
|
|
177
|
+
groupSafety: {
|
|
178
|
+
en: 'Safety & Risk Level (J1 Gate)',
|
|
179
|
+
pt: 'Nível de Proteção & Portão de Risco (J1)',
|
|
180
|
+
},
|
|
181
|
+
modeName: {
|
|
182
|
+
en: 'Protection mode',
|
|
183
|
+
pt: 'Modo de proteção',
|
|
184
|
+
},
|
|
185
|
+
thresholdName: {
|
|
186
|
+
en: 'Enforce threshold',
|
|
187
|
+
pt: 'Teto para bloqueio',
|
|
188
|
+
},
|
|
189
|
+
thresholdNote: {
|
|
190
|
+
en: 'deny at or above · 0..1 · default 0.8',
|
|
191
|
+
pt: 'bloqueia em ou acima de · 0..1 · padrão 0.8',
|
|
192
|
+
},
|
|
193
|
+
gateName: {
|
|
194
|
+
en: 'Safety gate',
|
|
195
|
+
pt: 'Portão de segurança',
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
} as const
|
|
199
|
+
|
|
200
|
+
/** Helper to get localized text */
|
|
201
|
+
export function t(entry: I18nStringPair, lang: 'pt-BR' | 'en'): string {
|
|
202
|
+
return lang === 'pt-BR' ? entry.pt : entry.en
|
|
203
|
+
}
|