codex-copilot-dx 1.1.1 → 1.2.0

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.
@@ -7,34 +7,34 @@
7
7
 
8
8
  function renderProviders(data) {
9
9
  const providers = data.providers || [];
10
- const states = { saved: "Saved locally", authorized: "Authorized", disabled: "Disabled", unavailable: "Unavailable",
11
- unknown: "Unknown", unconfigured: "Not configured", ready: "Ready", checking: "Checking", unsupported: "Unsupported",
12
- configured: "Configured", preserved: "Existing settings kept", partially_preserved: "Existing settings kept",
13
- not_installed: "Not installed", configuration_unavailable: "Setup unavailable", not_configured: "Not configured", standby: "Standby" };
10
+ const states = { saved: "saved_locally", authorized: "authorized", disabled: "disabled", unavailable: "unavailable_ca184",
11
+ unknown: "unknown", unconfigured: "not_configured", ready: "ready", checking: "checking", unsupported: "unsupported",
12
+ configured: "configured", preserved: "existing_settings_kept", partially_preserved: "existing_settings_kept",
13
+ restored: "settings_restored", not_installed: "not_installed", configuration_unavailable: "setup_unavailable", not_configured: "unknown", standby: "standby" };
14
14
  const auth = element("provider-auth"), clients = element("provider-clients"), requests = element("provider-requests");
15
15
  auth.replaceChildren();clients.replaceChildren();requests.replaceChildren();
16
16
  const routes = [];
17
17
  for (const provider of providers) {
18
18
  const identity = provider.auth || {};
19
- const authRow = tableRow([provider.name, identity.account || "—", states[identity.state] || "Unknown",
20
- states[provider.state] || "Unknown", identity.checked_at || "—", duration(identity.expires_in_ms)], { labels: [2, 3] });
21
- if (provider.reason) localize(authRow.children[3], "{state} / {reason}", { state: phrase(states[provider.state] || "Unknown"), reason: provider.reason });
19
+ const authRow = tableRow([provider.name, identity.account || "—", states[identity.state] || "unknown",
20
+ states[provider.state] || "unknown", identity.checked_at || "—", duration(identity.expires_in_ms)], { labels: [2, 3] });
21
+ if (provider.reason) localize(authRow.children[3], "state_reason", { state: phrase(states[provider.state] || "unknown"), reason: provider.reason });
22
22
  auth.append(authRow);
23
23
  for (const client of provider.clients || []) {
24
24
  const row = tableRow([provider.name, client.name, states[client.state] || client.state,
25
25
  client.gateway || "—", client.last_request_at || "—"], { labels: [2, 3] });
26
- if (client.reason) localize(row.children[2], "{state} / {reason}", { state: phrase(states[client.state] || "Unknown"), reason: client.reason });
26
+ if (client.reason) localize(row.children[2], "state_reason", { state: phrase(states[client.state] || "unknown"), reason: client.reason });
27
27
  clients.append(row);
28
28
  if (client.selected && client.id === "codex") routes.push(`${client.name} → ${provider.name}`);
29
29
  }
30
30
  if (provider.requests) {
31
31
  const item = document.createElement("p");
32
- localize(item, "{provider}: {done} done / {incomplete} incomplete / {failed} failed", { provider: `${provider.name} · ${provider.request_scope || "Claude Messages"}`,
32
+ localize(item, "provider_done_done_incomplete_incomplete_failed_failed", { provider: `${provider.name} · ${provider.request_scope || "Claude Messages"}`,
33
33
  done: number(provider.requests.completed), incomplete: number(provider.requests.incomplete), failed: number(provider.requests.failed) });
34
34
  requests.append(item);
35
35
  }
36
36
  }
37
- text("source-summary", "{count} providers", { count: providers.filter(provider => provider.enabled).length });
37
+ text("source-summary", "count_providers", { count: providers.filter(provider => provider.enabled).length });
38
38
  element("source-detail").textContent = routes.join(" / ") || "—";
39
39
  element("auth-account").textContent = providers.flatMap(provider => (provider.clients || [])
40
40
  .filter(client => client.selected).map(client => `${client.name} → ${provider.name}`)).join(" / ") || "—";
@@ -69,11 +69,11 @@
69
69
  failures.sort((a, b) => (Date.parse(a.at) || 0) - (Date.parse(b.at) || 0));
70
70
  failures.splice(0, Math.max(0, failures.length - 10));
71
71
  failures.reverse();
72
- text("failure-count", "{count} retained / requests + events", { count: failures.length });
72
+ text("failure-count", "count_retained_requests_events", { count: failures.length });
73
73
  if (!failures.length) {
74
74
  const item = document.createElement("li");
75
75
  item.className = "empty";
76
- localize(item, "No recent request failures recorded.");
76
+ localize(item, "no_recent_request_failures_recorded");
77
77
  list.append(item);
78
78
  return;
79
79
  }
@@ -83,13 +83,13 @@
83
83
  details.dataset.key = `${failure.at}/${failure.request_id || failure.response_id}/${failure.code}`;
84
84
  details.open = expanded.has(details.dataset.key);
85
85
  const title = document.createElement("summary");
86
- localize(title, "{detail} / {retry}", {
87
- detail: phrase("{time} / {model} / {code}", {
88
- time: failure.at ? String(failure.at) : phrase("unknown time"),
86
+ localize(title, "detail_retry", {
87
+ detail: phrase("time_model_code", {
88
+ time: failure.at ? String(failure.at) : phrase("unknown_time"),
89
89
  model: failure.model ? String(failure.model).slice(0, 80) : phrase("unknown_model"),
90
90
  code: failure.code ? String(failure.code).slice(0, 80) : phrase("unknown_error"),
91
91
  }),
92
- retry: phrase(failure.retried ? "retry attempted" : "no retry"),
92
+ retry: phrase(failure.retried ? "retry_attempted" : "no_retry"),
93
93
  });
94
94
  const timeline = failure.timeline;
95
95
  const timings = timeline?.timings_ms || {};
@@ -125,12 +125,12 @@
125
125
  }
126
126
  const copy = document.createElement("button");
127
127
  copy.type = "button";
128
- localize(copy, "Copy diagnostic");
128
+ localize(copy, "copy_diagnostic");
129
129
  copy.addEventListener("click", async () => {
130
130
  try {
131
131
  await navigator.clipboard.writeText(lines.join("\n"));
132
- localize(copy, "Copied");
133
- } catch { localize(copy, "Copy unavailable"); }
132
+ localize(copy, "copied");
133
+ } catch { localize(copy, "copy_unavailable"); }
134
134
  });
135
135
  details.append(title, diagnostic, copy);
136
136
  item.append(details);
@@ -140,42 +140,52 @@
140
140
 
141
141
  function render(data) {
142
142
  text("version", `v${data.version || "?"}`);
143
- text("uptime", "pid {pid} / uptime {duration}", { pid: number(data.pid), duration: duration(data.uptime_ms) });
143
+ text("uptime", "pid_pid_uptime_duration", { pid: number(data.pid), duration: duration(data.uptime_ms) });
144
144
 
145
145
  const models = data.models || {};
146
146
  text("models", number(models.models));
147
- text("model-source", "source {source} / live: ccdx models", { source: phrase(String(models.source || "unknown").slice(0, 80)) });
147
+ text("model-source", "source_source_live_ccdx_models", { source: phrase(String(models.source || "unknown").slice(0, 80)) });
148
148
 
149
149
  const requests = data.requests || {};
150
150
  text("requests", number(requests.total));
151
- text("request-errors", "4xx {client} / 5xx {server} / active {active}", { client: number(requests.status_4xx), server: number(requests.status_5xx), active: number(requests.active) });
151
+ text("request-errors", "4xx_client_5xx_server_active_active", { client: number(requests.status_4xx), server: number(requests.status_5xx), active: number(requests.active) });
152
152
  const categories = data.http_errors?.by_category;
153
- text("http-error-breakdown", categories ? "Inference {inference} / method {protocol} / route {route} / other {other}" : "—",
153
+ text("http-error-breakdown", categories ? "inference_inference_method_protocol_route_route_other_other" : "—",
154
154
  categories ? Object.fromEntries(Object.entries(categories).map(([key, value]) => [key, number(value)])) : {});
155
- text("body-limits", "raw {raw} / decoded {decoded}", { raw: mib(data.limits?.max_body_bytes), decoded: mib(data.limits?.max_decoded_body_bytes) });
155
+ text("body-limits", "raw_raw_decoded_decoded", { raw: mib(data.limits?.max_body_bytes), decoded: mib(data.limits?.max_decoded_body_bytes) });
156
156
 
157
157
  const outcomes = data.stream_performance?.by_route?.responses?.terminal_outcomes?.totals || {};
158
158
  for (const key of ["completed", "incomplete", "failed", "cancelled"]) text(key, number(outcomes[key]));
159
159
  const timing = data.stream_performance?.by_route?.responses || {};
160
160
  for (const [id, metric, scale, unit] of [["ttft", timing.ttft_ms, 1, "ms"], ["tpot", timing.output_tokens_per_second, 1, "token/s"]]) {
161
161
  const value = metric?.samples > 0 && finite(metric.avg) ? `${(Number(metric.avg) / scale).toFixed(1)} ${unit}` : "—";
162
- text(id, "{value} / {samples} samples", { value, samples: number(metric?.samples) });
162
+ text(id, "value_samples_samples", { value, samples: number(metric?.samples) });
163
163
  }
164
164
 
165
165
  const history = data.response_history || {};
166
166
  const limit = Number(history.maxBytes || data.limits?.response_history_max_bytes || 0);
167
167
  const used = Number(history.bytes || 0);
168
168
  text("history", `${mib(used)} / ${mib(limit)}`);
169
- text("history-detail", "entries {entries} / trees {trees} / misses {misses} (evicted {evicted})", { entries: number(history.entries), trees: number(history.tree_count), misses: number(history.lookup_misses), evicted: number(history.evicted_lookup_misses) });
169
+ text("history-detail", "entries_entries_trees_trees_misses_misses_evicted_evicted", { entries: number(history.entries), trees: number(history.tree_count), misses: number(history.lookup_misses), evicted: number(history.evicted_lookup_misses) });
170
170
  element("history-meter").value = limit > 0 ? Math.min(100, Math.max(0, used / limit * 100)) : 0;
171
171
 
172
172
  const image = data.image_generation;
173
- text("image", image ? "{count} succeeded" : "NOT INITIALIZED", { count: number(image?.succeeded) });
173
+ text("image", image ? "count_succeeded" : "not_initialized", { count: number(image?.succeeded) });
174
174
  text("image-detail", image
175
- ? "active {active} / failed {failed} / delivery failures {delivery}"
176
- : "Setup state unknown / ccdx image-status", { active: number(image?.active), failed: number(image?.failed), delivery: number(image?.delivery_failures) });
175
+ ? "active_active_failed_failed_delivery_failures_delivery"
176
+ : "setup_state_unknown_ccdx_image_status", { active: number(image?.active), failed: number(image?.failed), delivery: number(image?.delivery_failures) });
177
177
 
178
178
  const claude = data.providers?.m365?.claude, claudeMetrics = claude?.requests?.performance;
179
+ const sourceBody = element("source-requests-body");
180
+ if (sourceBody) {
181
+ sourceBody.replaceChildren();
182
+ const routes = { ...data.stream_performance?.by_route, ...claudeMetrics?.by_route };
183
+ for (const [protocol, route] of Object.entries(routes)) for (const [source, stats] of Object.entries(route.by_provider || {})) {
184
+ const totals = stats.terminal_outcomes.totals;
185
+ sourceBody.append(tableRow([source, protocol, number(stats.active), ...["completed", "incomplete", "failed", "cancelled", "unknown"].map(outcome => number(totals[outcome]))]));
186
+ }
187
+ if (!sourceBody.children.length) emptyTable("source-requests-body", 8, "no_requests_observed");
188
+ }
179
189
  const recentRequests = [...(data.stream_performance?.recent_requests || []), ...(claudeMetrics?.recent_requests || [])]
180
190
  .sort((a, b) => (Date.parse(a.at) || 0) - (Date.parse(b.at) || 0));
181
191
  renderFailures([...(data.response_failures?.recent || []), ...(data.http_errors?.actionable_recent || data.http_errors?.recent || [])]
@@ -183,7 +193,9 @@
183
193
  renderContext({ ...data.stream_performance, recent_requests: recentRequests });
184
194
  if (element("claude-route")) {
185
195
  element("claude-route").textContent = claude?.base_url || "—";
186
- element("claude-client-state").textContent = Object.entries(claude?.clients || {}).map(([key, value]) => `${key}: ${value}`).join(" / ") || "—";
196
+ const clientState = value => ({ configured: "configured", restored: "settings_restored", preserved: "existing_settings_kept", partially_preserved: "existing_settings_kept",
197
+ not_installed: "not_installed", configuration_unavailable: "setup_unavailable" })[value] || "unknown";
198
+ text("claude-client-state", "claude_code_code_claude_app_app", { code: phrase(clientState(claude?.clients?.code)), app: phrase(clientState(claude?.clients?.app)) });
187
199
  const totals = claudeMetrics?.by_route?.messages?.terminal_outcomes?.totals || claude?.requests || {};
188
200
  for (const key of ["completed", "incomplete", "failed", "cancelled"]) text(`claude-${key}`, totals[key] === undefined ? "—" : number(totals[key]));
189
201
  for (const [id, metric, unit] of [["claude-ttft", claudeMetrics?.by_route?.messages?.ttft_ms, "ms"], ["claude-speed", claudeMetrics?.by_route?.messages?.output_tokens_per_second, "token/s"]]) {
@@ -192,23 +204,23 @@
192
204
  }
193
205
  if (element("runtime-usage")) {
194
206
  const usage = data.runtime_usage;
195
- text("runtime-usage", usage ? "{records} usage records / input {input} / cache read {cached} / output {output}{partial}" : "—",
207
+ text("runtime-usage", usage ? "records_usage_records_input_input_cache_read_cached_output_outpu" : "—",
196
208
  usage ? { records: number(usage.records), input: number(usage.input_tokens), cached: number(usage.cached_input_tokens), output: number(usage.output_tokens), partial: usage.partial_records ? " ~" : "" } : {});
197
209
  element("process-state").textContent = `PID ${data.pid || "—"} / ${globalThis.location?.origin || ""}`;
198
- text("process-memory", "RSS {rss} / heap {heap}", { rss: mib(data.process?.rss_bytes), heap: mib(data.process?.heap_used_bytes) });
199
- text("process-queues", "Codex body admission: active {active} / queued {queued} / queue limit {limit}", {
210
+ text("process-memory", "rss_rss_heap_heap", { rss: mib(data.process?.rss_bytes), heap: mib(data.process?.heap_used_bytes) });
211
+ text("process-queues", "codex_body_admission_active_active_queued_queued_queue_limit_lim", {
200
212
  active: number(data.admission?.activeRequests), queued: number(data.admission?.queued), limit: number(data.admission?.maxQueued) });
201
213
  }
202
214
  if (element("prediction-preference")) {
203
215
  const prediction = data.client_integrations?.prediction;
204
- text("prediction-preference", prediction ? prediction.configured ? "Configured" : "Not configured" : "Unknown");
205
- text("prediction-bridge", ({ running: "Running", recovering: "Recovering", stopped: "Stopped", unavailable: "Unavailable" })[prediction?.bridge] || "Unknown");
206
- text("prediction-route", prediction?.client_route === "observed" ? "Observed" : "Unknown");
207
- text("prediction-candidate", "Unknown");
216
+ text("prediction-preference", prediction ? prediction.configured ? "configured" : "not_configured" : "unknown");
217
+ text("prediction-bridge", ({ running: "running_f4cca", recovering: "recovering", stopped: "stopped", unavailable: "unavailable_ca184" })[prediction?.bridge] || "unknown");
218
+ text("prediction-route", prediction?.client_route === "observed" ? "observed" : "unknown");
219
+ text("prediction-candidate", "unknown");
208
220
  const note = element("prediction-note");
209
221
  if (note) note.textContent = prediction?.reason || "";
210
222
  }
211
- text("updated", "Snapshot {time}", { time: new Date().toLocaleTimeString() });
223
+ text("updated", "snapshot_time", { time: new Date().toLocaleTimeString() });
212
224
  }
213
225
 
214
226
  function renderContext(performance) {
@@ -218,7 +230,7 @@
218
230
  }
219
231
  const body = element("context-body");
220
232
  if (!body) return;
221
- text("context-note", "20 latest finished requests / compactions: {completed} completed, {incomplete} incomplete, {failed} failed", {
233
+ text("context-note", "20_latest_finished_requests_compactions_completed_completed_inco", {
222
234
  completed: number(contextCompactions.completed), incomplete: number(contextCompactions.incomplete), failed: number(contextCompactions.failed),
223
235
  });
224
236
  if (element("request-context")?.open === false) return;
@@ -229,7 +241,7 @@
229
241
  for (const request of contextRequests) {
230
242
  const context = request.context || {};
231
243
  const outcome = ["completed", "incomplete", "failed", "cancelled"].includes(request.outcome)
232
- ? request.outcome[0].toUpperCase() + request.outcome.slice(1) : "Unknown";
244
+ ? request.outcome[0].toUpperCase() + request.outcome.slice(1) : "unknown";
233
245
  const ratio = finite(context.input_tokens) && finite(context.context_window_tokens) && Number(context.context_window_tokens) > 0
234
246
  ? `${(100 * Number(context.input_tokens) / Number(context.context_window_tokens)).toFixed(1)}%` : "—";
235
247
  body.append(tableRow([String(request.model || "unknown").slice(0, 80) + (request.provider ? ` / ${request.provider}` : ""),
@@ -237,7 +249,7 @@
237
249
  number(context.images), number(context.input_tokens), number(context.context_window_tokens), ratio,
238
250
  outcome], { labels: [6] }));
239
251
  }
240
- if (!contextRequests.length) emptyTable("context-body", 7, "No observed request metadata.");
252
+ if (!contextRequests.length) emptyTable("context-body", 7, "no_observed_request_metadata");
241
253
  }
242
254
  return { render, renderProviders, renderFailures, renderContext };
243
255
  }
@@ -128,11 +128,11 @@ function buildAnimationOptions(data) {
128
128
  const name = document.createElement("span");
129
129
  name.className = "theme-name";
130
130
  const label = document.createElement("span");
131
- localize(label, "{index} {theme}", { index: String(index + 1).padStart(2, "0"), theme: phrase(theme.label) });
131
+ localize(label, "index_theme", { index: String(index + 1).padStart(2, "0"), theme: phrase(theme.label) });
132
132
  name.append(label);
133
133
  if (theme.default) {
134
134
  const marker = document.createElement("small");
135
- localize(marker, "DEFAULT");
135
+ localize(marker, "default");
136
136
  name.append(marker);
137
137
  }
138
138
  const preview = document.createElement("span");
@@ -154,8 +154,8 @@ function buildAnimationOptions(data) {
154
154
 
155
155
  function animationNote(data) {
156
156
  return data.disabled_by_environment
157
- ? "Disabled by CCDX_TERMINAL_ANIMATION; saved choice applies after override removal and next start."
158
- : "Saved choice applies to the running terminal.";
157
+ ? "disabled_by_ccdx_terminal_animation_saved_choice_applies_after_o"
158
+ : "saved_choice_applies_to_the_running_terminal";
159
159
  }
160
160
 
161
161
  function loadAnimation(options) {
@@ -181,7 +181,7 @@ function applyAnimation(data, { changed } = {}) {
181
181
  }
182
182
 
183
183
  function updateAnimationState() {
184
- text("animation-state", "CURRENT {theme}{unsaved}", { theme: phrase(savedAnimation.toUpperCase()), unsaved: selectedAnimation !== savedAnimation ? phrase(" / UNSAVED") : "" });
184
+ text("animation-state", "current_theme_unsaved", { theme: phrase(savedAnimation.toUpperCase()), unsaved: selectedAnimation !== savedAnimation ? phrase("unsaved") : "" });
185
185
  }
186
186
 
187
187
  async function saveAnimation() {
@@ -190,7 +190,7 @@ async function saveAnimation() {
190
190
  animationSaving = true;
191
191
  dashboardRefresh.invalidate("animation");
192
192
  button.disabled = true;
193
- text("animation-note", "Saving…");
193
+ text("animation-note", "saving");
194
194
  try {
195
195
  const response = await fetch("/_ccdx/ui/animation", {
196
196
  method: "POST",
@@ -204,7 +204,7 @@ async function saveAnimation() {
204
204
  updateAnimationState();
205
205
  text("animation-note", animationNote(data));
206
206
  } catch (error) {
207
- text("animation-note", "Not saved / {error}", { error: String(error.message || error).slice(0, 150) });
207
+ text("animation-note", "not_saved_error", { error: String(error.message || error).slice(0, 150) });
208
208
  } finally {
209
209
  animationSaving = false;
210
210
  button.disabled = selectedAnimation === savedAnimation;
@@ -250,7 +250,7 @@ function syncUsageProviders() {
250
250
  if (selector.dataset.providers === signature) return;
251
251
  selector.dataset.providers = signature;
252
252
  selector.replaceChildren();
253
- const all = document.createElement("option");all.value = "";localize(all, "All providers");selector.append(all);
253
+ const all = document.createElement("option");all.value = "";localize(all, "all_providers");selector.append(all);
254
254
  for (const [id, name] of entries) { const option = document.createElement("option");option.value = id;option.textContent = name;selector.append(option); }
255
255
  selector.value = entries.has(selected) ? selected : "";
256
256
  }
@@ -263,27 +263,30 @@ function chooseProvider(id) {
263
263
  dashboardRefresh.invalidate("models", { clear: true });
264
264
  const previous = modelSnapshots.get(id);
265
265
  if (previous) applyModels(previous, { changed: true });
266
- else { emptyTable("live-models-body", 6, "Reading provider catalog…");text("models-note", "Reading provider catalog…"); }
266
+ else { emptyTable("live-models-body", 6, "reading_provider_catalog");text("models-note", "reading_provider_catalog"); }
267
267
  element("live-models-body").setAttribute("aria-labelledby", `model-provider-${id}`);
268
268
  void loadModels();
269
269
  }
270
270
 
271
271
  function applyProviders(data, { changed }) {
272
272
  const wasInitialized = providerEntries.length > 0, previousSelection = selectedProvider;
273
+ const choices = entries => JSON.stringify(entries.map(source => [source.id, source.name, source.generation, source.selection]));
274
+ const sourceChoicesChanged = choices(providerEntries) !== choices(data.providers);
273
275
  let reloadModels = false;
274
276
  const previous = new Map(providerEntries.map(entry => [entry.id, JSON.stringify([entry.generation, entry.auth?.account])]));
275
277
  providerEntries = data.providers;
278
+ if (sourceChoicesChanged) window.dispatchEvent(new CustomEvent("ccdx:providers"));
276
279
  for (const [id] of modelSnapshots) {
277
280
  const provider = providerEntries.find(entry => entry.id === id);
278
281
  if (!provider) {
279
282
  modelSnapshots.delete(id);
280
- if (id === selectedProvider) { reloadModels = true;dashboardRefresh.invalidate("models", { clear: true });emptyTable("live-models-body", 6, "Reading provider catalog…"); }
283
+ if (id === selectedProvider) { reloadModels = true;dashboardRefresh.invalidate("models", { clear: true });emptyTable("live-models-body", 6, "reading_provider_catalog"); }
281
284
  }
282
285
  }
283
286
  for (const provider of providerEntries) {
284
287
  if (previous.has(provider.id) && previous.get(provider.id) !== JSON.stringify([provider.generation, provider.auth?.account])) {
285
288
  modelSnapshots.delete(provider.id);
286
- if (provider.id === selectedProvider) { reloadModels = true;dashboardRefresh.invalidate("models", { clear: true });emptyTable("live-models-body", 6, "Reading provider catalog…"); }
289
+ if (provider.id === selectedProvider) { reloadModels = true;dashboardRefresh.invalidate("models", { clear: true });emptyTable("live-models-body", 6, "reading_provider_catalog"); }
287
290
  }
288
291
  }
289
292
  if (changed || dashboardRefresh.state("auth").error) renderProviders(data);
@@ -326,9 +329,9 @@ function applyModels(data, { changed }) {
326
329
  model.reasoning_efforts === null || model.reasoning_efforts === undefined ? "—" : model.reasoning_efforts.join(" / ") || "—",
327
330
  model.preview ? "preview" : model.state || "listed"], { labels: [5] }));
328
331
  }
329
- if (!data.models.length) emptyTable("live-models-body", 6, "No models advertised.");
332
+ if (!data.models.length) emptyTable("live-models-body", 6, "no_models_advertised");
330
333
  }
331
- text("models-note", "{selectable} selectable / {advertised} advertised / {host} / {time}", { selectable: number(data.selectable), advertised: number(data.advertised), host: data.upstream_host, time: data.checked_at ? new Date(data.checked_at).toLocaleTimeString() : phrase("Unknown") });
334
+ text("models-note", "selectable_selectable_advertised_advertised_host_time", { selectable: number(data.selectable), advertised: number(data.advertised), host: data.upstream_host, time: data.checked_at ? new Date(data.checked_at).toLocaleTimeString() : phrase("unknown") });
332
335
  }
333
336
 
334
337
  async function loadUsage() { return dashboardRefresh.refresh("usage", { force: true }); }
@@ -343,8 +346,8 @@ async function readDashboard(url, { signal, timeout = 15000, source } = {}) {
343
346
 
344
347
  function refreshTime(target, state) {
345
348
  const time = state.updatedAt === null ? null : new Date(state.updatedAt).toLocaleTimeString();
346
- if (state.error) localize(target, time ? "Update failed / last {time}" : "Update failed", { time });
347
- else if (time) localize(target, "Updated {time}", { time });
349
+ if (state.error) localize(target, time ? "update_failed_last_time" : "update_failed", { time });
350
+ else if (time) localize(target, "updated_time", { time });
348
351
  }
349
352
 
350
353
  const timestamps = new Map();
@@ -375,7 +378,7 @@ const dashboardRefresh = globalThis.ccdxRefresh.createController({
375
378
  },
376
379
  apply: render,
377
380
  state: state => {
378
- text("connection", state.pending && !state.value ? "READING" : state.error ? "UNAVAILABLE" : "SERVICE REACHABLE");
381
+ text("connection", state.pending && !state.value ? "reading" : state.error ? "unavailable_eb0be" : "service_reachable");
379
382
  element("connection").className = `badge ${state.pending ? "neutral" : state.error ? "bad" : "good"}`;
380
383
  if (state.error) refreshTime(element("updated"), state);
381
384
  for (const node of timestamps.get("status")) refreshTime(node, state);
@@ -387,8 +390,8 @@ const dashboardRefresh = globalThis.ccdxRefresh.createController({
387
390
  apply: applyProviders,
388
391
  state: state => {
389
392
  if (state.error) {
390
- if (state.value) localize(element("auth-account"), "Update failed / last {time}", { time: new Date(state.updatedAt).toLocaleTimeString() });
391
- else text("auth-account", "UNAVAILABLE");
393
+ if (state.value) localize(element("auth-account"), "update_failed_last_time", { time: new Date(state.updatedAt).toLocaleTimeString() });
394
+ else text("auth-account", "unavailable_eb0be");
392
395
  }
393
396
  for (const node of timestamps.get("auth")) refreshTime(node, state);
394
397
  },
@@ -397,7 +400,7 @@ const dashboardRefresh = globalThis.ccdxRefresh.createController({
397
400
  visible: () => providerEntries.length > 0 && element("upstream-models").open && !element("upstream-models").closest("[hidden]"),
398
401
  variant: () => selectedProvider,
399
402
  load: async ({ signal, variant }) => {
400
- if (!variant) throw new Error("Reading provider catalog…");
403
+ if (!variant) throw new Error("reading_provider_catalog");
401
404
  const data = await readDashboard(`/_ccdx/ui/models/live?provider=${encodeURIComponent(variant)}`, { signal, source: ["live", "catalog"] });
402
405
  if (!Array.isArray(data.models) || data.models.some(model => !model || typeof model.id !== "string" || !Array.isArray(model.endpoints))) throw new Error("Invalid model snapshot");
403
406
  return { ...data, provider: variant };
@@ -406,14 +409,14 @@ const dashboardRefresh = globalThis.ccdxRefresh.createController({
406
409
  apply: applyModels,
407
410
  state: state => {
408
411
  element("refresh-models").disabled = Boolean(state.pending);
409
- text("models-state", state.pending ? "CHECKING LIVE" : state.error ? "LIVE LOOKUP FAILED" : state.value?.source === "catalog" ? "CATALOG SNAPSHOT" : "LIVE SNAPSHOT");
412
+ text("models-state", state.pending ? "checking_live" : state.error ? "live_lookup_failed" : state.value?.source === "catalog" ? "catalog_snapshot" : "live_snapshot");
410
413
  if (state.error) {
411
414
  const message = String(state.error.message || state.error).slice(0, 240);
412
415
  const httpError = /^Live model lookup failed \(HTTP (\d{3})\)\. Run ccdx models for details\.$/.exec(message);
413
- if (httpError) text("models-note", "Live model lookup failed (HTTP {status}). Run ccdx models for details.", { status: httpError[1] });
416
+ if (httpError) text("models-note", "live_model_lookup_failed_http_status_run_ccdx_models_for_details", { status: httpError[1] });
414
417
  else text("models-note", message);
415
418
  }
416
- if (state.error && !modelSnapshots.has(selectedProvider)) emptyTable("live-models-body", 6, "No catalog available.");
419
+ if (state.error && !modelSnapshots.has(selectedProvider)) emptyTable("live-models-body", 6, "no_catalog_available");
417
420
  for (const node of timestamps.get("models")) refreshTime(node, state);
418
421
  },
419
422
  },
@@ -439,11 +442,11 @@ const dashboardRefresh = globalThis.ccdxRefresh.createController({
439
442
  state: state => {
440
443
  element("refresh-usage").disabled = Boolean(state.pending);
441
444
  if (element("usage-provider")) element("usage-provider").disabled = Boolean(state.pending);
442
- if (state.pending) text("usage-state", "READING LOG");
445
+ if (state.pending) text("usage-state", "reading_log");
443
446
  else if (state.error) {
444
- text("usage-state", "LOG UNAVAILABLE");
445
- if (element("usage-analytics").open) text("analytics-note", "Analytics unavailable / refresh Usage to retry.");
446
- if (!state.value) emptyTable("usage-body", 7, "No usage summary available.");
447
+ text("usage-state", "log_unavailable");
448
+ if (element("usage-analytics").open) text("analytics-note", "analytics_unavailable_refresh_usage_to_retry");
449
+ if (!state.value) emptyTable("usage-body", 7, "no_usage_summary_available");
447
450
  } else if (state.value) renderUsageState();
448
451
  for (const node of timestamps.get("usage")) refreshTime(node, state);
449
452
  },
@@ -456,7 +459,7 @@ const dashboardRefresh = globalThis.ccdxRefresh.createController({
456
459
  apply: applyAnimation,
457
460
  state: state => {
458
461
  if (state.error) {
459
- text("animation-state", "UNAVAILABLE");
462
+ text("animation-state", "unavailable_eb0be");
460
463
  text("animation-note", String(state.error.message || state.error).slice(0, 180));
461
464
  }
462
465
  for (const node of timestamps.get("animation")) refreshTime(node, state);
@@ -468,7 +471,7 @@ const dashboardRefresh = globalThis.ccdxRefresh.createController({
468
471
  const autoRefreshKey = "ccdx.dashboard.autoRefresh";
469
472
  const updateAutoRefresh = () => {
470
473
  element("auto-refresh").setAttribute("aria-pressed", String(dashboardRefresh.automatic));
471
- text("auto-refresh", dashboardRefresh.automatic ? "Auto refresh / ON" : "Auto refresh / OFF");
474
+ text("auto-refresh", dashboardRefresh.automatic ? "auto_refresh_on" : "auto_refresh_off");
472
475
  };
473
476
  let automatic = true;
474
477
  try { automatic = localStorage.getItem(autoRefreshKey) !== "off"; } catch { /* Keep the default when browser storage is unavailable. */ }
@@ -20,17 +20,17 @@
20
20
  if (total.requests > 0) {
21
21
  body.append(tableRow(usageValues(total), { total: true }));
22
22
  for (const row of rows) body.append(tableRow(usageValues(row)));
23
- } else { emptyTable("usage-body", 7, "No usage records."); }
23
+ } else { emptyTable("usage-body", 7, "no_usage_records"); }
24
24
  element("clear-usage-day").hidden = !day;
25
- text("usage-state", day ? day.date : "LOCAL LOG");
26
- text("usage-note", "{records} records / {shown} of {models} models shown{day}", {
25
+ text("usage-state", day ? day.date : "local_log");
26
+ text("usage-note", "records_records_shown_of_models_models_shown_day", {
27
27
  records: number(total.requests), shown: number(rows.length), models: number(day ? rows.length : usageData.model_count),
28
- day: day ? phrase(" / {zone} / {model}", { zone: usageData.analytics.time_zone, model: model || phrase("All models") }) : "",
28
+ day: day ? phrase("zone_model", { zone: usageData.analytics.time_zone, model: model || phrase("all_models") }) : "",
29
29
  });
30
30
  }
31
31
 
32
32
  function renderUsageState() {
33
- text("usage-state", selectedUsageDate && usageData.analytics?.days.some(day => day.date === selectedUsageDate) ? selectedUsageDate : "LOCAL LOG");
33
+ text("usage-state", selectedUsageDate && usageData.analytics?.days.some(day => day.date === selectedUsageDate) ? selectedUsageDate : "local_log");
34
34
  }
35
35
 
36
36
  function analyticsPoint(day, model) {
@@ -48,11 +48,11 @@
48
48
  button.type = "button";
49
49
  button.disabled = !day.available;
50
50
  button.setAttribute("aria-pressed", String(day.date === selectedUsageDate));
51
- const description = !day.available ? phrase("no retained history")
52
- : phrase("{calls} recorded calls / input {input} / output {output} / cached {cached} (included in input){partial}", {
53
- calls: number(point.requests), input: number(point.input_tokens), output: number(point.output_tokens), cached: number(point.cache_read_tokens), partial: point.tokens_partial ? phrase(" / partial token counts") : "",
51
+ const description = !day.available ? phrase("no_retained_history")
52
+ : phrase("calls_recorded_calls_input_input_output_output_cached_cached_inc", {
53
+ calls: number(point.requests), input: number(point.input_tokens), output: number(point.output_tokens), cached: number(point.cache_read_tokens), partial: point.tokens_partial ? phrase("partial_token_counts") : "",
54
54
  });
55
- for (const attribute of ["title", "aria-label"]) localize(button, "{date} / {description}", { date: day.date, description }, attribute);
55
+ for (const attribute of ["title", "aria-label"]) localize(button, "date_description", { date: day.date, description }, attribute);
56
56
  button.addEventListener("click", () => selectUsageDay(day.date));
57
57
  return button;
58
58
  }
@@ -92,7 +92,7 @@
92
92
  return metric === "tokens" ? point.input_tokens + point.output_tokens : point.requests;
93
93
  };
94
94
  const peak = Math.max(1, ...days.map(value));
95
- text("activity-scale", "{metric} / PEAK {peak}", { metric: phrase(metric === "tokens" ? "INPUT + OUTPUT" : "RECORDED CALLS"), peak: number(peak === 1 && days.every((day) => value(day) === 0) ? 0 : peak) });
95
+ text("activity-scale", "metric_peak_peak", { metric: phrase(metric === "tokens" ? "input_output" : "recorded_calls"), peak: number(peak === 1 && days.every((day) => value(day) === 0) ? 0 : peak) });
96
96
  const calendar = element("activity-calendar");
97
97
  calendar.replaceChildren();
98
98
  const offset = (new Date(`${days[0].date}T00:00:00Z`).getUTCDay() + 6) % 7;
@@ -122,12 +122,12 @@
122
122
  button.dataset.level = String(count > 0 ? Math.min(4, Math.ceil(count / peak * 4)) : 0);
123
123
  calendar.append(button);
124
124
  }
125
- text("analytics-note", "{zone} / {from} — {to} / retained history starts {first}; oldest day may be partial.{excluded}{limit}", {
125
+ text("analytics-note", "zone_from_to_retained_history_starts_first_oldest_day_may_be_par", {
126
126
  zone: analytics.time_zone, from: daily[0].date, to: analytics.to, first: analytics.first_date || phrase("unknown"),
127
- excluded: analytics.undated_records ? phrase(" {count} records with invalid/future timestamps excluded.", { count: number(analytics.undated_records) }) : "",
128
- limit: analytics.models_truncated ? phrase(" Model filters limited to 100; all-model totals include the remainder.") : "",
127
+ excluded: analytics.undated_records ? phrase("count_records_with_invalid_future_timestamps_excluded", { count: number(analytics.undated_records) }) : "",
128
+ limit: analytics.models_truncated ? phrase("model_filters_limited_to_100_all_model_totals_include_the_remain") : "",
129
129
  });
130
- text("analytics-selection", selectedUsageDate ? "Selected {date} / {model}: totals in the Usage table above / All history resets the table." : "Select a day for model totals. Calls are usage records, not messages or time. Hatched cells: no retained history; empty cells: zero recorded calls.", { date: selectedUsageDate, model: model || phrase("All models") });
130
+ text("analytics-selection", selectedUsageDate ? "selected_date_model_totals_in_the_usage_table_above_all_history_" : "select_a_day_for_model_totals_calls_are_usage_records_not_messag", { date: selectedUsageDate, model: model || phrase("all_models") });
131
131
  }
132
132
 
133
133
  function updateAnalyticsModels() {
@@ -138,7 +138,7 @@
138
138
  const option = document.createElement("option");
139
139
  option.value = model;
140
140
  if (model) option.textContent = model;
141
- else localize(option, "All models");
141
+ else localize(option, "all_models");
142
142
  select.append(option);
143
143
  }
144
144
  select.value = previous;
@@ -154,7 +154,7 @@
154
154
  if (data.analytics) renderAnalytics();
155
155
  }
156
156
  if (data.analytics) {
157
- text("analytics-updated", "Updated {time}", { time: new Date().toLocaleTimeString() });
157
+ text("analytics-updated", "updated_time", { time: new Date().toLocaleTimeString() });
158
158
  }
159
159
  }
160
160
  return { applyUsage, renderUsageState, renderAnalytics, renderUsageTable, selectUsageDay, usageValues, get data() { return usageData; }, get selectedDate() { return selectedUsageDate; } };
@@ -121,6 +121,7 @@ function dashboardProviders(providerStateFn, authStatusFn) {
121
121
  const label = value => safeText(redactDiagnosticText(value || ""), 160);
122
122
  const code = value => typeof value === "string" && /^[a-z0-9_:-]{1,80}$/.test(value) ? value : null;
123
123
  return { id: entry.id, name: label(entry.name) || entry.id, enabled: entry.enabled === true,
124
+ selection: { codex: entry.selection?.codex === true, models_required: entry.selection?.models_required === true },
124
125
  state: code(entry.state) || "unknown", reason: code(entry.reason), generation: finite(entry.generation),
125
126
  auth: { state: code(auth.state) || "unknown", account: label(auth.account), token_cached: auth.token_cached === true,
126
127
  expires_in_ms: finite(auth.expires_in_ms), checked_at: label(auth.checked_at) || null },
package/src/doctor.mjs CHANGED
@@ -121,7 +121,7 @@ export async function inspectGitHubTokenOnline({
121
121
  const modelResp = await fetchImpl(`${apiBase}/models`, { headers, signal: controller.signal });
122
122
  if (!modelResp.ok) {
123
123
  return [
124
- { kind: "ok", message: `GitHub Copilot access verified for ${validation.login || "current account"}` },
124
+ { kind: "ok", message: `Copilot access checked: ${validation.login || "current account"}` },
125
125
  { kind: "err", message: `Copilot models endpoint returned HTTP ${modelResp.status}` },
126
126
  ];
127
127
  }
@@ -129,12 +129,12 @@ export async function inspectGitHubTokenOnline({
129
129
  const data = Array.isArray(models) ? models : models?.data;
130
130
  const validModels = Array.isArray(data) ? data.filter(model => typeof model?.id === "string" && model.id.trim()) : [];
131
131
  if (!validModels.length) return [
132
- { kind: "ok", message: `GitHub Copilot access verified for ${validation.login || "current account"}` },
132
+ { kind: "ok", message: `Copilot access checked: ${validation.login || "current account"}` },
133
133
  { kind: "err", message: "Copilot models endpoint returned no valid model directory despite HTTP 200" },
134
134
  ];
135
135
  return [
136
- { kind: "ok", message: `GitHub Copilot access verified for ${validation.login || "current account"}` },
137
- { kind: "ok", message: `Copilot models endpoint returned ${validModels.length} models` },
136
+ { kind: "ok", message: `Copilot access checked: ${validation.login || "current account"}` },
137
+ { kind: "ok", message: `Copilot listed ${validModels.length} models` },
138
138
  ];
139
139
  } catch (error) {
140
140
  const errorCode = error?.cause?.code || error?.code || "";
@@ -9,6 +9,7 @@ import { httpError } from "./http-errors.mjs";
9
9
  import { admissionAbortError, contentEncodings, requestContentLength } from "./request-admission.mjs";
10
10
  import { currentRequestContext } from "./request-context.mjs";
11
11
  import { upstreamErrorEvidence } from "./response-failures.mjs";
12
+ import { operationErrorDetails } from "./operation-error.mjs";
12
13
 
13
14
  export { httpError } from "./http-errors.mjs";
14
15
  export { createRequestAdmission } from "./request-admission.mjs";
@@ -366,13 +367,13 @@ export function createRequestAbort(req, res) {
366
367
  }
367
368
 
368
369
  export function logRequestFailure(label, err, abort) {
369
- if (!isAbortLikeError(err)) {
370
+ if (!isAbortLikeError(err) && !abort?.reason) {
370
371
  console.error(status("err", `${label} request failed: ${redactDiagnosticText(err.message)}`));
371
372
  return;
372
373
  }
373
374
 
374
375
  const reason = abort?.reason || "aborted";
375
376
  err.statusCode ||= abortErrorStatusCode(reason);
376
- const cancelled = reason === "client_aborted" || reason === "client_closed";
377
+ const cancelled = operationErrorDetails(err, { reason }).source === "cancelled";
377
378
  console[cancelled ? "log" : "warn"](status(cancelled ? "info" : "warn", `${label} request aborted: ${reason}`));
378
379
  }