pantheon-opencode 2.0.2 → 2.0.4

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.
@@ -0,0 +1,89 @@
1
+ /**
2
+ * Prompt Prefix Cache Hierarchy Optimizer — Late-2026 KV-Cache Alignment.
3
+ *
4
+ * Enforces deterministic hierarchical ordering for agent prompts to maximize
5
+ * prefix cache hit rates across LLM providers (Anthropic Claude 3.5/3.7,
6
+ * Gemini 2.0/Flash, OpenAI GPT-5/o3/Luna):
7
+ *
8
+ * [Tier 1: Static Identity & Invariants] ->
9
+ * [Tier 2: Tool Schemas & Governance] ->
10
+ * [Tier 3: Repository Standards & Gates] ->
11
+ * [Tier 4: Ephemeral Session History] ->
12
+ * [Tier 5: Current Turn & Scratchpad]
13
+ *
14
+ * Pure TypeScript — zero external dependencies.
15
+ *
16
+ * @module prompt-cache-order
17
+ */
18
+
19
+ export interface PromptLayers {
20
+ readonly identity: string
21
+ readonly tools?: readonly string[] | undefined
22
+ readonly conventions?: readonly string[] | undefined
23
+ readonly history?: readonly string[] | undefined
24
+ readonly currentTurn: string
25
+ }
26
+
27
+ export interface CachedPromptResult {
28
+ readonly prompt: string
29
+ /** The byte/character offset separating invariant prefix from volatile turns */
30
+ readonly prefixBoundaryIndex: number
31
+ /** Estimated token length (heuristic ~4 chars/token) */
32
+ readonly estimatedTokens: number
33
+ /** Whether the prefix meets typical provider minimum threshold (e.g. 1024 tokens) */
34
+ readonly cacheEligible: boolean
35
+ }
36
+
37
+ /** Standard token threshold for provider-level prompt caching (Anthropic=1024, OpenAI=1024) */
38
+ export const DEFAULT_CACHE_MIN_TOKENS = 1024
39
+
40
+ /**
41
+ * Assemble agent prompt with strict invariant-prefix ordering to maximize KV cache hit rate.
42
+ */
43
+ export function buildPrefixCachedPrompt(
44
+ layers: PromptLayers,
45
+ minCacheTokens = DEFAULT_CACHE_MIN_TOKENS,
46
+ ): CachedPromptResult {
47
+ const invariantParts: string[] = []
48
+
49
+ // 1. Identity & Core System Instructions
50
+ invariantParts.push(layers.identity.trim())
51
+
52
+ // 2. Tools & Permissions Schemas
53
+ if (layers.tools && layers.tools.length > 0) {
54
+ invariantParts.push(`## Tool Specifications\n${layers.tools.map((t) => t.trim()).join('\n\n')}`)
55
+ }
56
+
57
+ // 3. Project Conventions & Architecture Gates
58
+ if (layers.conventions && layers.conventions.length > 0) {
59
+ invariantParts.push(
60
+ `## Project Standards & Gates\n${layers.conventions.map((c) => c.trim()).join('\n\n')}`,
61
+ )
62
+ }
63
+
64
+ const prefix = invariantParts.join('\n\n')
65
+ const prefixBoundaryIndex = prefix.length
66
+
67
+ const volatileParts: string[] = []
68
+
69
+ // 4. Conversation History (if any)
70
+ if (layers.history && layers.history.length > 0) {
71
+ volatileParts.push(
72
+ `## Conversation History\n${layers.history.map((h) => h.trim()).join('\n\n')}`,
73
+ )
74
+ }
75
+
76
+ // 5. Current Turn Payload
77
+ volatileParts.push(layers.currentTurn.trim())
78
+
79
+ const fullPrompt = [prefix, volatileParts.join('\n\n')].join('\n\n')
80
+ const estimatedTokens = Math.ceil(fullPrompt.length / 4)
81
+ const estimatedPrefixTokens = Math.ceil(prefix.length / 4)
82
+
83
+ return {
84
+ prompt: fullPrompt,
85
+ prefixBoundaryIndex,
86
+ estimatedTokens,
87
+ cacheEligible: estimatedPrefixTokens >= minCacheTokens,
88
+ }
89
+ }
@@ -0,0 +1,164 @@
1
+ /**
2
+ * Themis Local Reflex Loop — Self-healing inline verification for implementer agents.
3
+ *
4
+ * Catches syntax errors, lint failures, and sliced test failures directly in the
5
+ * implementer's execution cycle, granting up to 2 bounded retry attempts before
6
+ * escalating to the Zeus coordinator.
7
+ *
8
+ * Emits reactive events on `getSharedBus()` for auditability and observability.
9
+ *
10
+ * Pure TypeScript — zero external dependencies.
11
+ *
12
+ * @module themis-reflex
13
+ */
14
+
15
+ import { getSharedBus } from './bus.ts'
16
+
17
+ export interface ThemisDiscrepancy {
18
+ readonly file: string
19
+ readonly error: string
20
+ readonly expected?: string
21
+ readonly actual?: string
22
+ readonly suggestedFix?: string
23
+ }
24
+
25
+ export interface ReflexAttemptState {
26
+ taskID: string
27
+ agent: string
28
+ attempt: number
29
+ maxAttempts: number
30
+ discrepancies: ThemisDiscrepancy[]
31
+ timestamp: number
32
+ }
33
+
34
+ export type ThemisReflexDecision =
35
+ | {
36
+ readonly action: 'retry'
37
+ readonly prompt: string
38
+ readonly attempt: number
39
+ readonly maxAttempts: number
40
+ }
41
+ | {
42
+ readonly action: 'escalate'
43
+ readonly verdict: 'BLOCK' | 'FAIL'
44
+ readonly reason: string
45
+ readonly attempts: number
46
+ }
47
+ | {
48
+ readonly action: 'pass'
49
+ readonly verdict: 'PASS'
50
+ }
51
+
52
+ export class ThemisReflexController {
53
+ private readonly states: Map<string, ReflexAttemptState> = new Map()
54
+ private readonly maxRetries: number
55
+
56
+ constructor(options: { maxRetries?: number } = {}) {
57
+ this.maxRetries = options.maxRetries ?? 2
58
+ }
59
+
60
+ /**
61
+ * Evaluate a task execution result against Themis verification findings.
62
+ * If discrepancies are found and attempts remain, returns an actionable retry directive.
63
+ */
64
+ evaluate(
65
+ taskID: string,
66
+ agent: string,
67
+ discrepancies: readonly ThemisDiscrepancy[],
68
+ ): ThemisReflexDecision {
69
+ if (discrepancies.length === 0) {
70
+ const existing = this.states.get(taskID)
71
+ if (existing) {
72
+ getSharedBus().emit('themis:reflex:resolved', {
73
+ taskID,
74
+ agent,
75
+ file: existing.discrepancies[0]?.file ?? '',
76
+ error: '',
77
+ attempt: existing.attempt,
78
+ maxAttempts: this.maxRetries,
79
+ timestamp: Date.now(),
80
+ resolved: true,
81
+ })
82
+ this.states.delete(taskID)
83
+ }
84
+ return { action: 'pass', verdict: 'PASS' }
85
+ }
86
+
87
+ let state = this.states.get(taskID)
88
+ if (!state) {
89
+ state = {
90
+ taskID,
91
+ agent,
92
+ attempt: 0,
93
+ maxAttempts: this.maxRetries,
94
+ discrepancies: [...discrepancies],
95
+ timestamp: Date.now(),
96
+ }
97
+ this.states.set(taskID, state)
98
+ }
99
+
100
+ state.attempt += 1
101
+ state.discrepancies = [...discrepancies]
102
+ state.timestamp = Date.now()
103
+
104
+ const firstDisc = discrepancies[0]
105
+ getSharedBus().emit('themis:reflex:discrepancy', {
106
+ taskID,
107
+ agent,
108
+ file: firstDisc?.file ?? 'unknown',
109
+ error: firstDisc?.error ?? 'unspecified',
110
+ attempt: state.attempt,
111
+ maxAttempts: this.maxRetries,
112
+ timestamp: state.timestamp,
113
+ })
114
+
115
+ if (state.attempt <= this.maxRetries) {
116
+ const prompt = this.formatReflexPrompt(state.attempt, this.maxRetries, discrepancies)
117
+ return {
118
+ action: 'retry',
119
+ prompt,
120
+ attempt: state.attempt,
121
+ maxAttempts: this.maxRetries,
122
+ }
123
+ }
124
+
125
+ // Retries exhausted — escalate to coordinator
126
+ this.states.delete(taskID)
127
+ return {
128
+ action: 'escalate',
129
+ verdict: 'FAIL',
130
+ reason: `themis.reflex.exhausted:${state.attempt - 1}_retries_failed`,
131
+ attempts: state.attempt,
132
+ }
133
+ }
134
+
135
+ /**
136
+ * Format an inline, high-density reflex prompt directing the implementer to self-heal.
137
+ */
138
+ private formatReflexPrompt(
139
+ attempt: number,
140
+ maxAttempts: number,
141
+ discrepancies: readonly ThemisDiscrepancy[],
142
+ ): string {
143
+ const lines = [
144
+ `[THEMIS INLINE REFLEX — Attempt ${attempt}/${maxAttempts}]`,
145
+ 'Themis automated audit detected discrepancies in your edits. Fix them directly before returning:',
146
+ ]
147
+
148
+ for (const d of discrepancies) {
149
+ lines.push(`- File: ${d.file}`)
150
+ lines.push(` Error: ${d.error}`)
151
+ if (d.expected) lines.push(` Expected: ${d.expected}`)
152
+ if (d.actual) lines.push(` Actual: ${d.actual}`)
153
+ if (d.suggestedFix) lines.push(` Fix hint: ${d.suggestedFix}`)
154
+ }
155
+
156
+ lines.push('Do NOT escalate to Zeus yet. Apply the targeted fix and re-verify your slice.')
157
+ return lines.join('\n')
158
+ }
159
+
160
+ /** Reset state for a taskID */
161
+ reset(taskID: string): void {
162
+ this.states.delete(taskID)
163
+ }
164
+ }
@@ -2273,7 +2273,7 @@ function readUserDecisionRouterConfig({ env = process.env } = {}) {
2273
2273
  const filePath = resolveUserDecisionRouterConfigPath(env);
2274
2274
  try {
2275
2275
  assertNoSymlinkAncestors(filePath);
2276
- assertTrustedDirectoryChain(dirname2(filePath));
2276
+ assertTrustedDirectoryChain(dirname2(filePath), { env });
2277
2277
  const stat2 = lstatSync2(filePath);
2278
2278
  assertPrivatePath(stat2, true);
2279
2279
  const parsed = JSON.parse(readFileSync2(filePath, "utf8"));
@@ -2349,7 +2349,16 @@ function assertPrivatePath(stat2, isFile) {
2349
2349
  if ((stat2.mode & 63) !== 0)
2350
2350
  throw new Error("Decision-router configuration permissions must be private");
2351
2351
  }
2352
- function assertTrustedDirectoryChain(directory) {
2352
+ function isPermittedGroupWritable(_current, env = process.env) {
2353
+ if (env.PANTHEON_ALLOW_GROUP_WRITABLE === "1" || env.PANTHEON_ALLOW_GROUP_WRITABLE === "true") {
2354
+ return true;
2355
+ }
2356
+ if (env.JUPYTERHUB_USER || env.JUPYTER_IMAGE || env.JUPYTER_SERVER_ROOT || env.KUBERNETES_SERVICE_HOST || env.container || existsSync("/.dockerenv")) {
2357
+ return true;
2358
+ }
2359
+ return false;
2360
+ }
2361
+ function assertTrustedDirectoryChain(directory, { env = process.env } = {}) {
2353
2362
  const absolute = resolve2(directory);
2354
2363
  const root = parse2(absolute).root;
2355
2364
  const parts = absolute.slice(root.length).split(sep2).filter(Boolean);
@@ -2369,14 +2378,22 @@ function assertTrustedDirectoryChain(directory) {
2369
2378
  if (!stat2.isDirectory() || stat2.isSymbolicLink()) {
2370
2379
  throw new Error("Decision-router configuration path contains a non-directory component");
2371
2380
  }
2372
- if (stat2.uid !== uid && stat2.uid !== 0) {
2381
+ const mode = stat2.mode & 4095;
2382
+ const isSticky = (mode & 512) !== 0;
2383
+ const isSystemOrUser = stat2.uid === uid || stat2.uid === 0 || isSticky && stat2.uid === 65534;
2384
+ if (!isSystemOrUser) {
2373
2385
  throw new Error("Decision-router configuration path has an untrusted owner");
2374
2386
  }
2375
- const mode = stat2.mode & 4095;
2376
- const rootStickyDirectory = stat2.uid === 0 && (mode & 512) !== 0;
2377
- if ((mode & 18) !== 0 && !rootStickyDirectory) {
2387
+ const worldWritable = (mode & 2) !== 0;
2388
+ const groupWritable = (mode & 16) !== 0;
2389
+ if (worldWritable && !isSticky) {
2378
2390
  throw new Error("Decision-router configuration path is writable by other users");
2379
2391
  }
2392
+ if (groupWritable && !isSticky && !isPermittedGroupWritable(current, env)) {
2393
+ throw new Error(
2394
+ `Decision-router configuration path "${current}" is group-writable (mode ${(mode & 511).toString(8)}). In containers or JupyterHub, set PANTHEON_ALLOW_GROUP_WRITABLE=1 to permit group-writable ancestors, or run: chmod +t "${current}"`
2395
+ );
2396
+ }
2380
2397
  }
2381
2398
  }
2382
2399
 
@@ -5837,7 +5854,14 @@ function createJ1RiskGateObserver(options) {
5837
5854
 
5838
5855
  // src/pantheon/local-decision-budget.ts
5839
5856
  import { randomUUID } from "node:crypto";
5840
- import { chmodSync as chmodSync2, closeSync as closeSync2, lstatSync as lstatSync4, mkdirSync as mkdirSync3, openSync as openSync2 } from "node:fs";
5857
+ import {
5858
+ chmodSync as chmodSync2,
5859
+ closeSync as closeSync2,
5860
+ existsSync as existsSync2,
5861
+ lstatSync as lstatSync4,
5862
+ mkdirSync as mkdirSync3,
5863
+ openSync as openSync2
5864
+ } from "node:fs";
5841
5865
  import { homedir as homedir2 } from "node:os";
5842
5866
  import { basename, dirname as dirname4, isAbsolute as isAbsolute3, join as join6, parse as parse3, resolve as resolve3, sep as sep3 } from "node:path";
5843
5867
  import { performance } from "node:perf_hooks";
@@ -6762,20 +6786,34 @@ function ensureTrustedDirectoryChain(directoryPath) {
6762
6786
  }
6763
6787
  }
6764
6788
  }
6789
+ function isPermittedGroupWritable2(env = process.env) {
6790
+ if (env.PANTHEON_ALLOW_GROUP_WRITABLE === "1" || env.PANTHEON_ALLOW_GROUP_WRITABLE === "true") {
6791
+ return true;
6792
+ }
6793
+ if (env.JUPYTERHUB_USER || env.JUPYTER_IMAGE || env.JUPYTER_SERVER_ROOT || env.KUBERNETES_SERVICE_HOST || env.container || existsSync2("/.dockerenv")) {
6794
+ return true;
6795
+ }
6796
+ return false;
6797
+ }
6765
6798
  function validateDirectoryTrust(stat2, uid, isFinalDirectory) {
6766
6799
  if (!stat2.isDirectory() || stat2.isSymbolicLink()) {
6767
6800
  throw new Error("Budget ledger path contains a non-directory or symlink ancestor");
6768
6801
  }
6769
- if (stat2.uid !== uid && stat2.uid !== 0) {
6802
+ const mode = stat2.mode & 4095;
6803
+ const isSticky = (mode & 512) !== 0;
6804
+ const isSystemOrUser = stat2.uid === uid || stat2.uid === 0 || isSticky && stat2.uid === 65534;
6805
+ if (!isSystemOrUser) {
6770
6806
  throw new Error("Budget ledger path contains an untrusted owner");
6771
6807
  }
6772
6808
  if (isFinalDirectory && stat2.uid !== uid) {
6773
6809
  throw new Error("Budget ledger directory must be owned by the current user");
6774
6810
  }
6775
- const mode = stat2.mode & 4095;
6776
- const writableByOthers = (mode & 18) !== 0;
6777
- const rootStickyDirectory = stat2.uid === 0 && (mode & 512) !== 0;
6778
- if (writableByOthers && !rootStickyDirectory) {
6811
+ const worldWritable = (mode & 2) !== 0;
6812
+ const groupWritable = (mode & 16) !== 0;
6813
+ if (worldWritable && !isSticky) {
6814
+ throw new Error("Budget ledger path contains a group/other-writable directory");
6815
+ }
6816
+ if (groupWritable && !isSticky && !isFinalDirectory && !isPermittedGroupWritable2()) {
6779
6817
  throw new Error("Budget ledger path contains a group/other-writable directory");
6780
6818
  }
6781
6819
  }
@@ -6870,8 +6908,9 @@ async function runGatedNativeJevCall(params) {
6870
6908
  let config;
6871
6909
  try {
6872
6910
  config = readUserDecisionRouterConfig();
6873
- } catch {
6874
- return { ok: false, reasonCode: "CONFIG_UNAVAILABLE" };
6911
+ } catch (error) {
6912
+ const detail = error instanceof Error && error.message.includes("group-writable") ? "CONFIG_PATH_GROUP_WRITABLE" : error instanceof Error ? error.name : "ConfigError";
6913
+ return { ok: false, reasonCode: "CONFIG_UNAVAILABLE", detail };
6875
6914
  }
6876
6915
  if (!config.enabled) return { ok: false, reasonCode: "DISABLED" };
6877
6916
  if (!config.egress_consent) return { ok: false, reasonCode: "CONSENT_MISSING" };
@@ -8045,7 +8084,7 @@ function safeSessionPath(id) {
8045
8084
  import { createHash as createHash5, randomUUID as randomUUID2 } from "node:crypto";
8046
8085
  import {
8047
8086
  chmodSync as chmodSync3,
8048
- existsSync as existsSync2,
8087
+ existsSync as existsSync3,
8049
8088
  mkdirSync as mkdirSync4,
8050
8089
  readdirSync,
8051
8090
  readFileSync as readFileSync5,
@@ -8297,7 +8336,7 @@ function extractCredentialCellToken(value) {
8297
8336
  }
8298
8337
  async function readV2CredentialToken(providerIDs, stateDir, env) {
8299
8338
  const dbPath = v2CredentialDbPath(stateDir, env);
8300
- if (!existsSync2(dbPath)) return null;
8339
+ if (!existsSync3(dbPath)) return null;
8301
8340
  let sqlite;
8302
8341
  try {
8303
8342
  sqlite = await import("node:sqlite");
@@ -10383,7 +10422,7 @@ var TodoEnforcer = class {
10383
10422
 
10384
10423
  // src/pantheon/cost-command.ts
10385
10424
  import { execFile } from "node:child_process";
10386
- import { accessSync, constants as constants3, existsSync as existsSync4, statSync as statSync3 } from "node:fs";
10425
+ import { accessSync, constants as constants3, existsSync as existsSync5, statSync as statSync3 } from "node:fs";
10387
10426
  import { delimiter, dirname as dirname8, join as join14 } from "node:path";
10388
10427
  import { fileURLToPath as fileURLToPath4 } from "node:url";
10389
10428
  import { z } from "zod";
@@ -10393,7 +10432,7 @@ import { homedir as homedir6 } from "node:os";
10393
10432
  import { join as join13 } from "node:path";
10394
10433
 
10395
10434
  // src/plugins/tui/src/model-pricing.ts
10396
- import { existsSync as existsSync3, mkdirSync as mkdirSync5, readFileSync as readFileSync6, renameSync as renameSync3, writeFileSync as writeFileSync4 } from "node:fs";
10435
+ import { existsSync as existsSync4, mkdirSync as mkdirSync5, readFileSync as readFileSync6, renameSync as renameSync3, writeFileSync as writeFileSync4 } from "node:fs";
10397
10436
  import { homedir as homedir5 } from "node:os";
10398
10437
  import { dirname as dirname7, join as join12 } from "node:path";
10399
10438
  var MODELS_DEV_URL = "https://models.dev/api.json";
@@ -10539,7 +10578,7 @@ function parseCachedCatalog(raw) {
10539
10578
  }
10540
10579
  function readPricingCache(cachePath) {
10541
10580
  try {
10542
- if (!existsSync3(cachePath)) return void 0;
10581
+ if (!existsSync4(cachePath)) return void 0;
10543
10582
  return parseCachedCatalog(JSON.parse(readFileSync6(cachePath, "utf8")));
10544
10583
  } catch {
10545
10584
  return void 0;
@@ -10770,7 +10809,7 @@ var costArgs = {
10770
10809
  };
10771
10810
  function findExistingDb(override) {
10772
10811
  const candidate = override === void 0 ? resolveCostDbPath() : resolveCostDbPath({ dbPath: override });
10773
- return existsSync4(candidate) ? candidate : void 0;
10812
+ return existsSync5(candidate) ? candidate : void 0;
10774
10813
  }
10775
10814
  var COST_AGGREGATE_SQL = {
10776
10815
  message: (sessionId) => `
@@ -11476,7 +11515,7 @@ async function queryWithCliFallback(dbPath, days, deps) {
11476
11515
  const execFileAsync = deps?.execFile ?? defaultExecFile;
11477
11516
  const isExecutable = deps?.isExecutable ?? defaultIsExecutable;
11478
11517
  const costScript = join14(__dirname, "..", "..", "scripts", "cost.mjs");
11479
- if (!existsSync4(costScript)) {
11518
+ if (!existsSync5(costScript)) {
11480
11519
  throw new Error(`CLI fallback script not found: ${costScript}`);
11481
11520
  }
11482
11521
  const node = resolveNodeExecutable(env, isExecutable);
@@ -194,11 +194,11 @@ function buildAutonomyTab(input) {
194
194
  title: isPt ? "Autonomia" : "Autonomy",
195
195
  groups: [
196
196
  {
197
- title: isPt ? "Goal loop (auto-continuação de sessões multi-turn)" : "Goal loop (multi-turn session auto-continuation)",
197
+ title: isPt ? "Loop Contínuo (auto-continuação de sessões multi-turn)" : "Auto-Continue Loop (multi-turn session auto-continuation)",
198
198
  rows: [
199
199
  {
200
200
  id: "autonomy.goal_loop.enabled",
201
- name: isPt ? "Goal loop" : "Goal loop",
201
+ name: isPt ? "Loop Contínuo" : "Auto-Continue Loop",
202
202
  value: input.goalLoop.enabled ? "enabled" : "disabled",
203
203
  cycle: GOAL_LOOP_ENABLED_CYCLE,
204
204
  note: isPt ? "continua tarefas multi-turn quando a sessão fica ociosa" + (input.goalLoopRestartPending ? " · [!] reinício necessário para aplicar (restart)" : " · aplicado após reiniciar o OpenCode") : "auto-continues multi-turn tasks when session goes idle" + (input.goalLoopRestartPending ? " · [!] restart required to apply" : " · applies after OpenCode restart")
@@ -220,16 +220,16 @@ function buildAutonomyTab(input) {
220
220
  ]
221
221
  },
222
222
  {
223
- title: isPt ? "Orçamento Jev (aplicado em tempo real por decisão)" : "Decision budgets (applies live per gated call)",
223
+ title: isPt ? "Orçamentos de Decisão (Jev)" : "Decision Budgets (Jev)",
224
224
  rows: [{
225
225
  id: "autonomy.budget.monthly",
226
- name: isPt ? "Teto mensal" : "Monthly cap",
226
+ name: isPt ? "Teto Mensal (USD)" : "Monthly Budget Cap",
227
227
  value: formatUsd(input.budgets.monthlyUsd),
228
228
  cycle: MONTHLY_USD_CYCLE,
229
229
  note: isPt ? "teto mensal em USD para arbitragem do Jev" : "monthly USD ceiling for gated arbitrator decisions"
230
230
  }, {
231
231
  id: "autonomy.budget.perDecision",
232
- name: isPt ? "Teto por decisão" : "Per-decision cap",
232
+ name: isPt ? "Teto por Consulta" : "Per-Decision Cap",
233
233
  value: formatUsd(input.budgets.perDecisionUsd),
234
234
  cycle: PER_DECISION_USD_CYCLE,
235
235
  note: isPt ? "teto de custo por decisão — acima disso é recusada" : "price cap — gated decisions above this are refused"
@@ -534,13 +534,13 @@ function buildDecisionTab(read, env = process.env, authProviders = /* @__PURE__
534
534
  const { config, corrupt } = read;
535
535
  const rows = [{
536
536
  id: "decision.enabled",
537
- name: isPt ? "Assistente Jev" : "Router",
537
+ name: isPt ? "Assistente Jev" : "Jev Assistant",
538
538
  value: config.enabled ? "enabled" : "disabled",
539
539
  ...corrupt ? {} : { cycle: DECISION_ENABLED_CYCLE },
540
540
  note: corrupt ? isPt ? "config inválida — runtime fail-closes; repair via `decision-router setup-model`" : "config unreadable/invalid — runtime fail-closes; repair via `decision-router setup-model`" : isPt ? "applies live — arbitragem de decisões relida em tempo real a cada chamada" : "applies live — the runtime re-reads this on every gated call"
541
541
  }, {
542
542
  id: "decision.selection.mode",
543
- name: isPt ? "Modo de operação" : "Selection mode",
543
+ name: isPt ? "Modo de Operação" : "Operation Mode",
544
544
  value: config.selection.mode,
545
545
  ...corrupt ? {} : { cycle: DECISION_SELECTION_CYCLE },
546
546
  note: isPt ? "local = no seu PC (grátis); auto/explícito = modelo nuvem (OpenRouter)" : "local routes on-device; auto/explicit pick a remote decision model"
@@ -548,7 +548,7 @@ function buildDecisionTab(read, env = process.env, authProviders = /* @__PURE__
548
548
  const explicitTarget = config.selection.provider ? `${config.selection.provider}/${config.selection.model ?? ""}` : DECISION_TARGET_CYCLE[0] ?? "openrouter-jev/typesafe/jev-1.13";
549
549
  rows.push({
550
550
  id: "decision.selection.target",
551
- name: isPt ? "Modelo de decisão" : "Explicit target",
551
+ name: isPt ? "Modelo de Decisão" : "Decision Model",
552
552
  value: config.selection.mode === "local" ? config.selection.provider ? `${config.selection.provider}/${config.selection.model ?? ""}` : "local (on-device)" : explicitTarget,
553
553
  ...corrupt ? {} : { cycle: DECISION_TARGET_CYCLE },
554
554
  note: isPt ? config.selection.mode === "local" ? "ciclar seleciona modelo remoto e ativa modo explícito" : "provedor/modelo ativo — define candidato para arbitragem" : config.selection.mode === "local" ? "cycle to select a remote model and activate explicit mode" : "provider/model — sets the candidate list"
@@ -561,7 +561,7 @@ function buildDecisionTab(read, env = process.env, authProviders = /* @__PURE__
561
561
  });
562
562
  rows.push({
563
563
  id: "decision.consent",
564
- name: isPt ? "Acesso à nuvem (Egress)" : "Egress consent",
564
+ name: isPt ? "Acesso à Nuvem" : "Cloud API Access",
565
565
  value: config.egress_consent ? "granted" : "not granted",
566
566
  ...corrupt ? {} : { cycle: DECISION_CONSENT_CYCLE },
567
567
  note: isPt ? config.egress_consent ? "granted = rotas remotas podem consultar gateway de API (com teto de custo)" : "not granted = chamadas remotas bloqueadas; requer granted para nuvem" : config.egress_consent ? "granted = remote decision routes may call their gateway (budget-capped)" : "not granted = remote routes fail closed; grant to allow cloud calls"
@@ -570,7 +570,7 @@ function buildDecisionTab(read, env = process.env, authProviders = /* @__PURE__
570
570
  id: "decision",
571
571
  title: isPt ? "Decisão" : "Decision",
572
572
  groups: [{
573
- title: isPt ? "Assistente de Decisão" : "Decision router",
573
+ title: isPt ? "Assistente de Decisão (Jev)" : "Decision Assistant (Jev)",
574
574
  rows
575
575
  }, {
576
576
  title: isPt ? "Credenciais (status apenas — valores nunca gravados na janela)" : "Credentials (status only — values never enter the window)",
@@ -1119,13 +1119,13 @@ function buildJ1Tab(env, disabledByOverride, languagePref) {
1119
1119
  const desc = isPt ? MODE_DESCRIPTION_PT[mode] : MODE_DESCRIPTION_EN[mode];
1120
1120
  return {
1121
1121
  id: "j1",
1122
- title: isPt ? "Segurança J1" : "J1",
1122
+ title: isPt ? "Segurança J1" : "J1 Safety",
1123
1123
  groups: [{
1124
- title: isPt ? "Nível de Segurança e Portão de Risco J1 (env-only)" : "Safety Level & Risk Gate (J1) (env-only — never written here)",
1124
+ title: isPt ? "Portão de Segurança (J1)" : "Safety Risk Gate (J1)",
1125
1125
  rows: [
1126
1126
  {
1127
1127
  id: "j1.mode",
1128
- name: isPt ? "Modo de execução" : "Mode",
1128
+ name: isPt ? "Modo de Operação" : "Operation Mode",
1129
1129
  value: mode,
1130
1130
  note: `${desc} · ${isPt ? "reinício necessário (restart applies)" : "restart applies"}`
1131
1131
  },
@@ -1137,7 +1137,7 @@ function buildJ1Tab(env, disabledByOverride, languagePref) {
1137
1137
  },
1138
1138
  {
1139
1139
  id: "j1.gate",
1140
- name: isPt ? "Estado do portão" : "Gate",
1140
+ name: isPt ? "Portão de Segurança" : "Safety Risk Gate",
1141
1141
  value: gateState,
1142
1142
  note: `${J1_FLAG_ENV} / ${J1_THRESHOLD_ENV} · ${isPt ? "lido na inicialização" : "read once at startup"}`
1143
1143
  }
@@ -1950,7 +1950,7 @@ async function readChangelogForBundle(bundleUrl) {
1950
1950
  }
1951
1951
  /** The ambient build-time version, or null outside a tsdown build. */
1952
1952
  function embeddedVersion() {
1953
- return "2.0.2";
1953
+ return "2.0.4";
1954
1954
  }
1955
1955
  /**
1956
1956
  * Resolve the running Pantheon version for the what's-new window: the plugin
@@ -2175,7 +2175,7 @@ function persistUpdateCheckState(previous, latest) {
2175
2175
  } catch {}
2176
2176
  }
2177
2177
  function resolveRunningVersion() {
2178
- return "2.0.2";
2178
+ return "2.0.4";
2179
2179
  }
2180
2180
  const VALUE_WIDTH = 24;
2181
2181
  function SettingsWindow(props) {
@@ -6341,7 +6341,7 @@ async function checkForPantheonUpdate(context) {
6341
6341
  const latest = String((await response.json())?.version ?? "");
6342
6342
  if (!latest) return;
6343
6343
  const notice = pickUpdateNotice({
6344
- currentVersion: "2.0.2",
6344
+ currentVersion: "2.0.4",
6345
6345
  latestVersion: latest,
6346
6346
  state: readState(),
6347
6347
  nowMs: Date.now()
@@ -7153,7 +7153,7 @@ function Sidebar(props) {
7153
7153
  get children() {
7154
7154
  var _el$13 = createElement("text");
7155
7155
  setProp(_el$13, "attributes", 1);
7156
- insert(_el$13, `Pantheon v2.0.2`);
7156
+ insert(_el$13, `Pantheon v2.0.4`);
7157
7157
  effect((_$p) => setProp(_el$13, "fg", text(), _$p));
7158
7158
  return _el$13;
7159
7159
  }
@@ -7925,7 +7925,7 @@ function HomeStatus(props) {
7925
7925
  },
7926
7926
  get children() {
7927
7927
  var _el$73 = createElement("text");
7928
- insert(_el$73, () => `Pantheon v2.0.2${preset().name ? ` ▸ ${preset().name}` : ""}`);
7928
+ insert(_el$73, () => `Pantheon v2.0.4${preset().name ? ` ▸ ${preset().name}` : ""}`);
7929
7929
  effect((_$p) => setProp(_el$73, "fg", muted(), _$p));
7930
7930
  return _el$73;
7931
7931
  }