codex-copilot-dx 1.2.29 → 1.2.31

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.
@@ -4,6 +4,7 @@
4
4
  let data = null, editing = null, editingClient = null, disabling = null, models = [], selectedModels = new Set(), busy = false, generation = 0;
5
5
  let claudeClient = "claude_app", bindingSelection = new Set(), bindingDefault = null, bindingDirty = false;
6
6
  let memoryAction = null, memoryOrigin = null;
7
+ let disableRevision = null;
7
8
  const drafts = new Map();let editorOrigin = null, discovery = null, desiredSource = null;
8
9
  const apiForm = el("connection-api-form"), clientForm = el("connection-client-form");
9
10
  const node = (tag, text, className) => { const item = document.createElement(tag);if (text !== undefined) item.textContent = text;if (className) item.className = className;return item; };
@@ -66,17 +67,17 @@
66
67
  if (provider.discovery?.state === "stale") { const warning = node("p", undefined, "hint");words(warning, "cap_catalog_stale");warning.append(" ", provider.discovery.code);info.append(warning); }
67
68
  if (!provider.builtin) actions.append(button("api_manage", () => editApi(provider)));
68
69
  const toggle = node("input");toggle.type = "checkbox";toggle.checked = true;toggle.setAttribute("role", "switch");toggle.setAttribute("aria-label", format("api_disable_source") + " " + provider.name);
69
- toggle.addEventListener("change", () => { toggle.checked = true;disableSource(provider); });actions.append(toggle);
70
+ toggle.addEventListener("change", () => { toggle.checked = true;disableSource(provider); });const hit = node("label", undefined, "switch-hit");hit.append(toggle);actions.append(hit);
70
71
  } else actions.append(button("api_restore", () => void change({ operation: "provider", id: provider.id, enabled: true })));
71
72
  row.append(info, actions);if (!provider.enabled) disabledSources.append(row);else if (provider.id === selectedProvider) providerList.append(row);
72
73
  }
73
74
  const current = editingClient && client(editingClient);
74
75
  if (current) {
75
- const row = node("div", undefined, "connection-row"), title = node("h3", current.name), toggle = node("input");
76
+ const row = node("div", undefined, "connection-row"), title = node("strong", current.name), toggle = node("input");
76
77
  toggle.type = "checkbox";toggle.checked = current.enabled;toggle.setAttribute("role", "switch");toggle.setAttribute("aria-label", current.name);
77
78
  toggle.addEventListener("change", () => void change({ operation: "client", id: current.id, enabled: toggle.checked,
78
79
  source: toggle.checked ? current.source : null, allowed: current.allowed, ...(Array.isArray(current.deployments) ? { deployments: current.deployments, default_model: current.default_model, auto_sync: current.auto_sync } : {}) }));
79
- row.append(title, toggle);clientList.append(row);
80
+ const hit = node("label", undefined, "switch-hit");hit.append(toggle);row.append(title, hit);clientList.append(row);
80
81
  }
81
82
  for (const c of data.clients.filter(c => !c.enabled)) {
82
83
  const row = node("div", undefined, "connection-row");row.append(node("span", c.name), button("api_restore", () => void change({ operation: "client", id: c.id, enabled: true, source: null, allowed: c.allowed })));disabledClients.append(row);
@@ -109,16 +110,28 @@
109
110
  panels();let key = input.operation === "save_api" ? "api_config_saved" : input.operation === "provider" ? input.enabled ? "api_provider_enabled" : "api_provider_disabled"
110
111
  : !input.enabled ? "api_client_disabled" : !input.source ? "api_client_enabled" : "api_saved";
111
112
  const setup = data.clients.find(c => c.id === input.id)?.setup;
112
- if (input.operation === "client" && input.source && ["preserved", "partially_preserved"].includes(setup)) key = "api_client_preserved";
113
- if (input.operation === "client" && input.source && setup === "configuration_unavailable") key = "api_client_config_failed";
114
- if (input.operation === "client" && input.source && setup === "not_installed") key = "api_client_not_installed";
113
+ if (input.operation === "client" && ["preserved", "partially_preserved"].includes(setup)) key = "api_client_preserved";
114
+ if (input.operation === "client" && setup === "configuration_unavailable") key = "api_client_config_failed";
115
+ if (input.operation === "client" && setup === "not_installed") key = "api_client_not_installed";
116
+ if (input.operation === "client" && setup === "configured") key = "sync_config_written";
117
+ if (input.operation === "client" && setup === "manual_sync") key = "sync_manual";
115
118
  if (input.operation === "client") words(el("connection-client-note"), key);else message(key);
119
+ if (input.operation === "save_api" && input.config.models.length) for (const c of data.clients.filter(c => c.enabled && input.allowed.includes(c.id))) {
120
+ const link = node("a", c.name, "section-link");link.href = c.id === "codex" ? "#codex" : "#claude";link.addEventListener("click", event => { event.preventDefault();editClient(c); });el("connection-note").append(" ", link);
121
+ }
116
122
  }window.dispatchEvent(new CustomEvent("ccdx:connections"));void dashboardRefresh.refresh("auth", { force: true });void dashboardRefresh.refresh("status", { force: true }); }
117
- catch (error) { if (input.operation === "source_access") accessError = error.message;else if (input.operation === "client") words(el("connection-client-note"), error.message);else message(error.message); }
123
+ catch (error) {
124
+ if (input.operation === "provider" && !input.enabled && error.message === "ccdx_connections_conflict") {
125
+ try { data = await api();list();disableSource(source(input.id));message("api_impact_changed"); } catch { message(error.message); }return;
126
+ }
127
+ if (input.operation === "source_access") accessError = error.message;else if (input.operation === "client") words(el("connection-client-note"), error.message);else message(error.message);return;
128
+ }
118
129
  finally { busy = false;if (trigger?.tagName === "BUTTON") { trigger.removeAttribute("aria-busy");trigger.disabled = false;if (oldKey) words(trigger, oldKey);else trigger.textContent = oldText; }
119
130
  if (["client", "preview_client"].includes(input.operation)) bindingRows();
120
131
  if (input.operation === "source_access") renderAccess();
132
+ if (input.operation === "save_api") words(apiForm.querySelector('button[type="submit"]'), editing ? "api_save" : "api_save_read");
121
133
  }
134
+ return true;
122
135
  }
123
136
  const resolved = (model, protocol = model.protocols.includes("messages") ? "messages" : model.protocols[0]) => {
124
137
  const metadata = model.metadata?.deployment === source(editing)?.deployment_revision ? model.metadata : null;
@@ -230,11 +243,12 @@
230
243
  apiForm.elements.key.required = !provider;globalThis.ccdxLanguage.set(apiForm.elements.key, provider ? "api_key_keep" : "api_key_enter", {}, "placeholder");
231
244
  apiForm.elements.auth_header.value = provider?.auth_header || "x-api-key";
232
245
  apiForm.elements.key_env.value = provider?.key_env || "";keyMode();
233
- for (const input of apiForm.querySelectorAll('[name="protocol"]')) input.checked = provider ? provider.protocols.includes(input.value) : input.value !== "chat";
246
+ for (const input of apiForm.querySelectorAll('[name="protocol"]')) input.checked = provider ? Boolean(provider.endpoints?.[input.value]) : input.value !== "chat";
234
247
  setEndpoints(provider?.base_url || "", provider?.endpoints);
235
248
  const allowed = el("connection-allowed-clients");allowed.replaceChildren(...data.clients.filter(c => c.enabled).map(c => check("allowed", c.id, c.allowed.includes(editing), c.name)));
236
249
  el("connection-model-detail").hidden = true;
237
250
  models = structuredClone(provider?.models || []);selectedModels = new Set(models.map(model => model.id));modelRows();el("connection-manual-model").open = false;el("connection-discover").disabled = !editing;el("connection-model-id").value = "";apiForm.elements.name.focus();
251
+ words(apiForm.querySelector('button[type="submit"]'), provider ? "api_save" : "api_save_read");
238
252
  }
239
253
  apiForm.elements.base.addEventListener("change", () => setEndpoints(apiForm.elements.base.value));
240
254
  for (const input of apiForm.querySelectorAll('[name="protocol"]')) input.addEventListener("change", () => {
@@ -253,10 +267,15 @@
253
267
  }
254
268
  const endpoints = Object.fromEntries([...apiForm.querySelectorAll('[name="protocol"]:checked')].map(input => [input.value, apiForm.elements[input.value + "_url"].value.trim()]));
255
269
  const key = apiForm.elements.key.value;apiForm.elements.key.value = "";
256
- void change({ operation: "save_api", ...(editing ? { id: editing } : {}), key,
270
+ const first = !editing;
271
+ const input = { operation: "save_api", ...(editing ? { id: editing } : {}), key,
257
272
  config: { name: apiForm.elements.name.value.trim(), base_url: apiForm.elements.base.value.trim().replace(/\/+$/, ""), endpoints, auth_header: apiForm.elements.auth_header.value, models: chosenModels,
258
273
  ...(apiForm.elements.key_env.value.trim() ? { key_env: apiForm.elements.key_env.value.trim() } : {}) },
259
- allowed: [...apiForm.querySelectorAll('[name="allowed"]:checked')].map(input => input.value).concat(data.clients.filter(c => !c.enabled && c.allowed.includes(editing)).map(c => c.id)) });
274
+ allowed: [...apiForm.querySelectorAll('[name="allowed"]:checked')].map(input => input.value).concat(data.clients.filter(c => !c.enabled && c.allowed.includes(editing)).map(c => c.id)) };
275
+ void (async () => {
276
+ const saved = await change(input, first ? result => { const provider = result.providers.find(p => !p.builtin && p.name === input.config.name);if (provider) editApi(provider); } : undefined);
277
+ if (saved && first && editing) await discoverModels();
278
+ })();
260
279
  });
261
280
  el("connection-model-add").addEventListener("click", () => {
262
281
  const id = el("connection-model-id").value.trim();if (!id || models.some(model => model.id === id) || models.length >= 500) return;
@@ -268,7 +287,7 @@
268
287
  el("connection-discover").disabled = !editing;el("connection-discover").removeAttribute("aria-busy");words(el("connection-discover"), "api_read_models");el("connection-discover-cancel").hidden = true;return cancelled;
269
288
  }
270
289
  el("connection-discover-cancel").addEventListener("click", () => { stopDiscovery();message("api_read_cancelled");el("connection-discover").focus(); });
271
- el("connection-discover").addEventListener("click", async () => {
290
+ async function discoverModels() {
272
291
  if (discovery || !editing) return;
273
292
  const read = { id: editing, controller: new AbortController() };discovery = read;
274
293
  const trigger = el("connection-discover");trigger.disabled = true;trigger.setAttribute("aria-busy", "true");words(trigger, "api_reading");el("connection-discover-cancel").hidden = false;
@@ -277,9 +296,10 @@
277
296
  data = result;
278
297
  const known = new Map(models.map(model => [model.id, model]));for (const model of result.discovered || []) { const previous = known.get(model.id);known.set(model.id, previous ? { ...previous, ...(model.display ? { display: model.display } : {}), ...(model.metadata ? { metadata: model.metadata } : {}) } : model); }
279
298
  models = [...known.values()].slice(0, 500);modelRows();message("api_models_read");
280
- } catch (error) { if (discovery === read) message(error.message); }
299
+ } catch (error) { if (discovery === read) message("api_read_failed", { code: error.message }); }
281
300
  finally { if (discovery === read) { discovery = null;trigger.disabled = false;trigger.removeAttribute("aria-busy");words(trigger, "api_read_models");el("connection-discover-cancel").hidden = true; } }
282
- });
301
+ }
302
+ el("connection-discover").addEventListener("click", () => void discoverModels());
283
303
  function memoryMatches(item) {
284
304
  const model = client("codex")?.memory_model?.model;
285
305
  return Boolean(model && [item.id, item.model, item.route_id, item.public_id].includes(model));
@@ -343,7 +363,7 @@
343
363
  const missing = [...bindingSelection].filter(key => !availableKeys.has(key)).map(key => { const [source, id] = key.split("\0");return { source, id, route_id: c.model_plan?.unavailable?.find(item => item.source === source && item.id === id)?.route_id, unavailable: true }; });
344
364
  for (const item of [...available, ...missing]) {
345
365
  const key = bindingKey(item.source, item.id), row = node("tr"), name = node("td"), capability = item.capability?.values || {};
346
- const selection = check("binding-model", key, bindingSelection.has(key), item.id);
366
+ const selection = check("binding-model", key, bindingSelection.has(key), item.display_name || item.id);
347
367
  selection.firstChild.addEventListener("change", event => {
348
368
  const checked = event.target.checked;
349
369
  const apply = () => {
@@ -368,6 +388,13 @@
368
388
  const warning = el("connection-default-note");warning.hidden = !unavailableDefault;words(warning, "cap_default_unavailable");
369
389
  clientForm.querySelector('button[type="submit"]').disabled = unavailableDefault || busy;
370
390
  words(el("connection-draft-state"), bindingDirty ? "cap_unsaved" : "cap_saved");
391
+ const setup = c.setup || "not_configured", syncKey = setup === "configured" ? "sync_config_written" : setup === "manual_sync" ? "sync_manual"
392
+ : ["preserved", "partially_preserved"].includes(setup) ? "sync_preserved" : setup === "configuration_unavailable" ? "sync_failed"
393
+ : setup === "default_unavailable" ? "cap_default_unavailable" : "sync_not_configured";
394
+ globalThis.ccdxIcons.set(el("connection-setup-state"), syncKey, setup === "configured" ? "ok" : ["configuration_unavailable", "default_unavailable"].includes(setup) ? "warning" : "unavailable");
395
+ const capabilityNote = el("connection-capability-state");capabilityNote.hidden = !c.model_plan?.sync?.limitations?.some(item => item.code === "client_version_unknown");
396
+ if (!capabilityNote.hidden) words(capabilityNote, "sync_capability_unverified");
397
+ words(clientForm.querySelector('button[type="submit"]'), el("connection-auto-sync").checked ? "cap_save_sync" : "api_save");
371
398
  if (focus) { const selector = focus.kind === "selection" ? 'input[name="binding-model"]' : 'button[data-binding]';[...body.querySelectorAll(selector)].find(input => (input.value || input.dataset.binding) === focus.key)?.focus(); }
372
399
  if (!body.children.length) { const row = node("tr"), cell = node("td");cell.colSpan = 5;words(cell, "cap_no_models");const link = node("a");link.href = "#models";words(link, "model_services");cell.append(" ", link);row.append(cell);body.append(row); }
373
400
  }
@@ -376,7 +403,7 @@
376
403
  rememberDraft();claudeClient = segment.dataset.claudeClient;
377
404
  for (const button of document.querySelectorAll("[data-claude-client]")) button.setAttribute("aria-pressed", String(button === segment));mountClient(true);
378
405
  });
379
- el("connection-auto-sync").addEventListener("change", () => { bindingDirty = true;rememberDraft();el("connection-client-cancel").disabled = false;words(el("connection-draft-state"), "cap_unsaved"); });
406
+ el("connection-auto-sync").addEventListener("change", () => { bindingDirty = true;rememberDraft();el("connection-client-cancel").disabled = false;words(el("connection-draft-state"), "cap_unsaved");words(clientForm.querySelector('button[type="submit"]'), el("connection-auto-sync").checked ? "cap_save_sync" : "api_save"); });
380
407
  el("connection-client-cancel").addEventListener("click", () => { drafts.delete(editingClient);bindingDirty = false;mountClient(true); });
381
408
  function bindingInput(operation) {
382
409
  const c = client(editingClient);return { operation, id: c.id, enabled: true, allowed: c.allowed,
@@ -390,12 +417,21 @@
390
417
  if (!confirmed && c?.enabled && c.memory_model?.enabled !== false && c.model_plan?.models.some(item => item.source === provider.id && memoryMatches(item))) {
391
418
  confirmMemory(() => disableSource(provider, true));return;
392
419
  }
393
- const affected = data.clients.filter(c => c.enabled && c.source === provider.id);
394
- if (!affected.length) { void change({ operation: "provider", id: provider.id, enabled: false });return; }
420
+ const impact = data.source_impacts?.[provider.id];
421
+ if (!impact) { message("api_impact_unavailable");void load();return; }
422
+ const affected = impact.clients;disableRevision = impact.revision;
423
+ if (!affected.length) { void change({ operation: "provider", id: provider.id, enabled: false, impact_revision: disableRevision });return; }
395
424
  disabling = provider.id;panels("disable");const area = el("connection-replacements");area.replaceChildren();
396
- for (const c of affected) { const label = node("label", c.name), select = choice(data.providers.filter(p => p.id !== provider.id && p.enabled && c.allowed.includes(p.id) && selectableSource(p, c.id)));select.name = c.id;label.append(select);area.append(label); }
425
+ for (const item of affected) {
426
+ const c = client(item.id), section = node("div", undefined, "source-impact");section.append(node("strong", c.name));
427
+ const count = node("p");words(count, "api_impact_models", { before: item.removed + item.remaining, after: item.remaining, removed: item.removed });section.append(count);
428
+ const note = node("p", undefined, "hint");words(note, item.needs_replacement ? "api_choose_replacements" : "api_impact_default_kept");section.append(note);
429
+ if (item.needs_replacement) { const label = node("label"), select = choice(data.providers.filter(p => p.id !== provider.id && p.enabled && c.allowed.includes(p.id) && selectableSource(p, c.id)));select.name = c.id;select.setAttribute("aria-label", c.name);label.append(select);section.append(label); }
430
+ area.append(section);
431
+ }
397
432
  }
398
433
  el("connection-disable-form").addEventListener("submit", e => { e.preventDefault();void change({ operation: "provider", id: disabling, enabled: false,
434
+ impact_revision: disableRevision,
399
435
  replacements: Object.fromEntries([...el("connection-replacements").querySelectorAll("select")].map(select => [select.name, select.value || null])) }); });
400
436
  el("connection-add").addEventListener("click", () => { if (data) editApi(); });
401
437
  for (const id of ["connection-cancel", "connection-disable-cancel"]) el(id).addEventListener("click", () => { panels();(editorOrigin?.isConnected ? editorOrigin : el("connection-source-list").querySelector("button") || el("connection-add")).focus(); });
@@ -0,0 +1,37 @@
1
+ (() => {
2
+ const known = new WeakSet(), active = new Map(), reduced = matchMedia("(prefers-reduced-motion: reduce)");
3
+ function settle(detail, operation) {
4
+ if (active.get(detail) !== operation) return;
5
+ active.delete(detail);operation.animations.forEach(animation => animation.cancel());
6
+ if (!operation.open) detail.open = false;delete detail.dataset.disclosureClosing;
7
+ }
8
+ function decorate(root) {
9
+ const details = [...(root.matches?.("details") ? [root] : []), ...(root.querySelectorAll?.("details") || [])];
10
+ for (const detail of details) {
11
+ if (known.has(detail)) continue;
12
+ const summary = detail.querySelector(":scope > summary");if (!summary) continue;
13
+ known.add(detail);
14
+ summary.addEventListener("click", event => {
15
+ if (event.defaultPrevented || event.target.closest("button,a,input,select,textarea") || typeof summary.animate !== "function" || reduced.matches || document.hidden) return;
16
+ event.preventDefault();
17
+ const previous = active.get(detail), open = !(previous?.open ?? detail.open);
18
+ if (previous) { active.delete(detail);previous.animations.forEach(animation => animation.cancel()); }
19
+ const operation = { open, animations: [] };active.set(detail, operation);
20
+ if (open) { delete detail.dataset.disclosureClosing;detail.open = true; }
21
+ else detail.dataset.disclosureClosing = "true";
22
+ for (const child of detail.children) if (child !== summary && !child.hidden && child.getClientRects().length) {
23
+ operation.animations.push(child.animate(open ? [{ opacity: 0, transform: "translateY(-3px)" }, { opacity: 1, transform: "translateY(0)" }]
24
+ : [{ opacity: 1, transform: "translateY(0)" }, { opacity: 0, transform: "translateY(-2px)" }],
25
+ { duration: open ? 160 : 110, easing: "cubic-bezier(.25,1,.5,1)" }));
26
+ }
27
+ Promise.all(operation.animations.map(animation => animation.finished.catch(() => {}))).then(() => settle(detail, operation));
28
+ });
29
+ }
30
+ }
31
+ decorate(document);
32
+ new MutationObserver(records => { for (const record of records) for (const node of record.addedNodes) if (node.nodeType === 1) decorate(node); }).observe(document.body, { childList: true, subtree: true });
33
+ const finish = () => { for (const [detail, operation] of active) settle(detail, operation); };
34
+ reduced.addEventListener?.("change", finish);
35
+ document.addEventListener("visibilitychange", () => { if (document.hidden) finish(); });
36
+ addEventListener("pagehide", finish);
37
+ })();
@@ -10,6 +10,7 @@
10
10
  <link rel="stylesheet" href="/ui.css">
11
11
  <script src="/refresh.js" defer></script>
12
12
  <script src="/icons.js" defer></script>
13
+ <script src="/disclosure.js" defer></script>
13
14
  <script src="/time.js" defer></script>
14
15
  <script src="/view-boundary.js" defer></script>
15
16
  <script src="/status.js" defer></script>
@@ -79,6 +80,8 @@
79
80
  <p id="connection-memory-warning" class="memory-model-notice" role="status" hidden></p>
80
81
  </div>
81
82
  <p id="connection-default-note" class="hint" role="status" hidden></p>
83
+ <p id="connection-setup-state" class="client-sync-state" role="status" aria-live="polite"></p>
84
+ <p id="connection-capability-state" class="hint" hidden></p>
82
85
  <div class="table-wrap"><table class="binding-table"><thead><tr><th data-i18n="model">Model</th><th data-i18n="source">Source</th><th data-i18n="cap_context">Context</th><th data-i18n="cap_reasoning">Reasoning</th><th data-i18n="cap_default">Default</th></tr></thead><tbody id="connection-bindings"></tbody></table></div>
83
86
  <div class="setting-row"><label for="connection-auto-sync" data-i18n="cap_auto_sync">Sync model settings</label><input id="connection-auto-sync" type="checkbox" role="switch" checked><span class="hint" data-i18n="cap_sync_scope">Preserves your manual settings.</span></div>
84
87
  <div class="section-actions"><button type="submit" data-i18n="api_save">Save</button><button type="button" id="connection-client-cancel" data-i18n="cap_discard_changes">Discard changes</button><button type="button" id="connection-sync-preview" data-i18n="cap_sync_preview">Review sync</button></div>
@@ -170,7 +173,7 @@
170
173
  </div>
171
174
  <div data-view="models" hidden>
172
175
  <section class="panel dashboard-section" id="connection-sources">
173
- <div class="panel-heading"><h2 data-i18n="model_services">Model sources</h2><button id="connection-add" type="button" data-i18n="api_add">Add API</button></div>
176
+ <div class="panel-heading"><h2 data-i18n="source_accounts">Accounts &amp; APIs</h2><button id="connection-add" type="button" data-i18n="api_add">Add API</button></div>
174
177
  <div id="model-providers" class="provider-tabs" role="tablist" aria-label="Model providers" data-i18n-label="model_providers"></div>
175
178
  <div id="connection-source-list"></div>
176
179
  <details id="connection-disabled-sources" class="connection-disabled" hidden><summary data-i18n="api_disabled_sources">Disabled sources</summary><div id="connection-disabled-source-list"></div></details>
@@ -246,7 +249,7 @@
246
249
  <p id="models-note" class="table-note" data-i18n="reading_provider_catalog">Loading model list…</p>
247
250
  <details id="model-check-details" class="model-check-details" hidden><summary data-i18n="source_check_details">Check details</summary><dl id="model-check-fields" class="failure-detail"></dl></details>
248
251
  <div class="table-wrap"><table><thead><tr><th scope="col" data-i18n="model">MODEL</th><th scope="col" data-i18n="client">APP</th><th scope="col" data-i18n="tools_details">Details</th></tr></thead><tbody id="live-models-body" role="tabpanel"><tr><td colspan="3" data-i18n="loading">Loading…</td></tr></tbody></table></div>
249
- <details class="tool-details"><summary data-i18n="tools_details">Details</summary><p class="hint" data-i18n="catalog_listing_does_not_guarantee_inference_access">Models listed; inference access not verified.</p></details>
252
+ <details class="tool-details"><summary data-i18n="catalog_scope">Catalog scope</summary><p class="hint" data-i18n="catalog_listing_does_not_guarantee_inference_access">Models listed; inference access not verified.</p></details>
250
253
  </details>
251
254
  <details class="panel dashboard-section" id="account-authorization">
252
255
  <summary data-i18n="source_access_details">SOURCE ACCESS DETAILS</summary>
@@ -261,7 +264,7 @@
261
264
  <p class="hint" data-i18n="tools_local_scope">Local checks do not contact external services.</p>
262
265
  <div class="section-actions"><button id="check-local" type="button" data-i18n="tools_check_local">Check this computer</button></div>
263
266
  <p id="checks-note" class="table-note" role="status" aria-live="polite" data-i18n="tools_checks_empty">Run a check to see the results.</p>
264
- <div class="table-wrap"><table class="checks-table"><thead><tr><th data-i18n="tools_check_item">Check</th><th data-i18n="state">State</th><th data-i18n="tools_details">Details</th></tr></thead><tbody id="checks-body"></tbody></table></div>
267
+ <div class="table-wrap" id="checks-results" hidden><table class="checks-table"><thead><tr><th data-i18n="tools_check_item">Check</th><th data-i18n="state">State</th><th data-i18n="tools_details">Details</th></tr></thead><tbody id="checks-body"></tbody></table></div>
265
268
  </section>
266
269
  <section class="panel dashboard-section">
267
270
  <h2 data-i18n="account_access">ACCOUNT AND ACCESS</h2>
@@ -1,5 +1,28 @@
1
1
  (() => {
2
2
  const translations = {
3
+ "model_id": ["Model ID", "模型 ID"],
4
+ "catalog_scope": ["Catalog scope", "目录说明"],
5
+ "issue_brief": ["{cause} · {model} · {time}", "{cause} · {model} · {time}"],
6
+ "issue_count_unavailable": ["Token counting unavailable", "令牌计数接口不可用"],
7
+ "issue_source_limit": ["Source usage limit reached", "模型来源用量受限"],
8
+ "issue_catalog_unavailable": ["Model catalog could not be read", "模型目录读取失败"],
9
+ "issue_model_not_selected": ["Model not selected for this app", "应用尚未选用此模型"],
10
+ "issue_access_denied": ["Access was denied", "请求被拒绝访问"],
11
+ "issue_request_failed": ["Request did not complete", "请求未完成"],
12
+ "api_save_read": ["Save & read models", "保存并读取模型"],
13
+ "api_read_failed": ["API saved. Model lookup failed; retry here. {code}", "来源已保存;模型读取失败,可在此重试。{code}"],
14
+ "sync_capability_unverified": ["Client capabilities are unverified; existing settings were kept.", "客户端能力未验证,现有设置已保留。"],
15
+ "source_accounts": ["Accounts & APIs", "账号与 API"],
16
+ "sync_config_written": ["Configuration written · reopen the app to load changes", "配置已写入 · 重开应用查看变更"],
17
+ "sync_manual": ["Selection saved · automatic sync is off", "选择已保存 · 自动同步已关闭"],
18
+ "sync_preserved": ["Manual settings retained · review sync details", "手工设置已保留 · 查看同步详情"],
19
+ "sync_failed": ["Configuration could not be written · review sync details", "配置写入失败 · 查看同步详情"],
20
+ "sync_not_configured": ["App configuration not applied", "尚未应用到客户端配置"],
21
+ "cap_save_sync": ["Save & sync", "保存并同步"],
22
+ "api_impact_models": ["Selected models: {before} → {after} · removes {removed}", "已选模型:{before} → {after} · 移除{removed}个"],
23
+ "api_impact_default_kept": ["The default model stays unchanged.", "默认模型保持不变。"],
24
+ "api_impact_unavailable": ["Refresh the page to review affected apps.", "请刷新页面,查看受影响的应用。"],
25
+ "api_impact_changed": ["Selections changed. Review the updated impact before confirming.", "模型选择已变化,请重新确认影响。"],
3
26
  "tools_copy_code": ["Copy code", "复制验证码"],
4
27
  "tools_copy_open_github": ["Copy & open GitHub", "复制并打开验证页"],
5
28
  "tools_code_copied": ["Copied. Ready to paste.", "已复制,可直接粘贴。"],
@@ -157,7 +180,7 @@
157
180
  "cap_unknown": ["Not provided", "未提供"],
158
181
  "cap_supported": ["Supported", "支持"],
159
182
  "cap_unsupported": ["Not supported", "不支持"],
160
- "cap_auto_sync": ["Sync model settings", "同步模型设置"],
183
+ "cap_auto_sync": ["Sync app configuration after saving", "保存后同步到本机应用"],
161
184
  "cap_sync_scope": ["Preserves your manual settings.", "保留你手动修改的设置。"],
162
185
  "cap_sync_preview": ["Review sync", "查看同步"],
163
186
  "cap_no_models": ["No models yet. Add a source first.", "暂无可用模型,请先添加来源。"],
@@ -219,7 +242,7 @@
219
242
  "api_messages_auth": ["Messages authentication", "Messages 认证"],
220
243
  "api_allowed_clients": ["Allowed clients", "允许使用的客户端"],
221
244
  "api_read_models": ["Read models", "读取模型"],
222
- "api_discovery_save_first": ["Save the API first. No chat request is sent.", "先保存来源;只读取模型目录。"],
245
+ "api_discovery_save_first": ["Reads the model catalog; no inference request.", "只读取模型目录,不发起推理。"],
223
246
  "api_add_model": ["Add model", "添加模型"],
224
247
  "api_manual_model": ["Add a model manually", "手工添加模型"],
225
248
  "api_model_protocol_hint": ["Select the models to use and their supported APIs.", "勾选要使用的模型,再选择其支持的接口。"],
@@ -624,7 +647,7 @@
624
647
  "next_configuration_request_cached_suggestions_may_remain": ["Applies on the next settings request. Cached suggestions may still appear.", "下次读取建议设置时生效。\n已有建议可能仍会显示。"],
625
648
  "reopen_the_client_to_finish": ["Reopen the app", "重开应用"],
626
649
  "restart_ccdx_to_finish": ["Restart CCDX", "请重启 CCDX"],
627
- "saved_saved_effective_effective_state": ["Saved: {saved}\nActive: {effective}\n{state}", "已保存:{saved}\n已生效:{effective}\n{state}"],
650
+ "saved_saved_effective_effective_state": ["Saved {saved}; active {effective} · {state}", "已保存:{saved};当前:{effective} · {state}"],
628
651
  "on": ["On", "开启"],
629
652
  "off": ["Off", "关闭"],
630
653
  "controlled_by_environment": ["Set at startup", "启动限定"],
@@ -820,7 +843,7 @@
820
843
  "reading_874bf": ["Reading…", "读取中"],
821
844
  "reading_status": ["Reading status…", "读取中"],
822
845
  "upstream_messages_may_contain_sensitive_text": ["Review private information before sharing error details.", "分享错误详情前,请检查其中的隐私信息。"],
823
- "terminal_animation_9edf6": ["TERMINAL ANIMATION", "终端动效"],
846
+ "terminal_animation_9edf6": ["ANIMATION STYLE", "动效样式"],
824
847
  "animation_theme": ["Animation style", "动效样式"],
825
848
  "save_selection": ["Save animation", "保存动效"],
826
849
  "applies_on_next_ccdx_start": ["Save, then restart ccdx to apply.", "保存后,下次启动生效。"],
@@ -95,7 +95,7 @@
95
95
  if (signature === failureSignature) return;
96
96
  failureSignature = signature;
97
97
  const list = element("failures");
98
- const expanded = new Set([...list.querySelectorAll("details[open]")].map((item) => item.dataset.key));
98
+ const expanded = new Set([...list.querySelectorAll("details[open]")].filter(item => item.dataset.disclosureClosing !== "true").map(item => item.dataset.key));
99
99
  list.replaceChildren();
100
100
  const requests = Array.isArray(recentRequests) ? recentRequests.slice(-20) : [];
101
101
  const byRequest = new Map(requests.filter((request) => request.request_id).map((request) => [request.request_id, request]));
@@ -133,11 +133,16 @@
133
133
  details.dataset.key = `${failure.at}/${failure.request_id || failure.response_id}/${failure.code}`;
134
134
  details.open = expanded.has(details.dataset.key);
135
135
  const title = document.createElement("summary");
136
+ const cause = failure.route === "messages_count_tokens" && [404, 405, 501].includes(failure.http_status) ? "issue_count_unavailable"
137
+ : ["rate_limit_error", "rate_limit_exceeded", "insufficient_quota", "http_429"].includes(failure.code) ? "issue_source_limit"
138
+ : /^m365_catalog_http_/.test(failure.code || "") ? "issue_catalog_unavailable"
139
+ : failure.reason === "ccdx_model_not_selected" ? "issue_model_not_selected"
140
+ : failure.http_status === 401 || failure.http_status === 403 ? "issue_access_denied" : "issue_request_failed";
136
141
  const summary = {
137
- detail: phrase("time_model_code", {
142
+ detail: phrase("issue_brief", {
138
143
  time: failure.at ? time(failure.at, { date: true }) : phrase("unknown_time"),
139
144
  model: notModelRequest ? phrase("not_applicable") : failure.model ? String(failure.model).slice(0, 80) : phrase("unknown_model"),
140
- code: failure.code ? String(failure.code).slice(0, 80) : phrase("unknown_error"),
145
+ cause: phrase(cause),
141
146
  }),
142
147
  retry: phrase(failure.upstream_attempts === 0 ? "no_upstream_call" : failure.retried ? "retry_attempted" : "no_retry"),
143
148
  };
@@ -334,7 +339,7 @@
334
339
  const signature = JSON.stringify(contextRequests);
335
340
  if (signature === contextSignature) return;
336
341
  contextSignature = signature;
337
- const expanded = new Set([...(body.querySelectorAll?.("details[open]") || [])].map(details => details.getAttribute("data-request-key")));
342
+ const expanded = new Set([...(body.querySelectorAll?.("details[open]") || [])].filter(details => details.dataset.disclosureClosing !== "true").map(details => details.getAttribute("data-request-key")));
338
343
  body.replaceChildren();
339
344
  for (const request of contextRequests) {
340
345
  const context = request.context || {};
@@ -140,6 +140,7 @@
140
140
  const body = el("checks-body");body.replaceChildren();
141
141
  const groups = new Map();
142
142
  for (const check of data.checks || []) { if (!groups.has(check.id)) groups.set(check.id, []);groups.get(check.id).push(check); }
143
+ el("checks-results").hidden = !groups.size;
143
144
  for (const [id, checks] of groups) {
144
145
  const row = document.createElement("tr"), name = document.createElement("td"), result = document.createElement("td"), details = document.createElement("td");
145
146
  const kind = checks.some(check => check.kind === "err" || check.kind === "warn") ? "warning" : checks.some(check => check.kind === "ok") ? "ok" : "unknown";
@@ -129,8 +129,19 @@ summary:focus-visible, select:focus-visible { outline: 2px solid var(--accent);
129
129
  details > summary { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: baseline; gap: 8px; list-style: none; }
130
130
  details > summary::-webkit-details-marker { display: none; }
131
131
  details > summary::marker { content: ""; }
132
- details > summary::before { content: "+"; color: var(--heading); font-weight: 700; letter-spacing: 0; }
133
- details[open] > summary::before { content: "−"; }
132
+ details > summary::before { content: ""; width: 14px; height: 14px; align-self: center; background: currentColor; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat; transition: transform 160ms cubic-bezier(.25,1,.5,1); }
133
+ details[open]:not([data-disclosure-closing]) > summary::before { transform: rotate(180deg); }
134
+ @media (prefers-reduced-motion: reduce) { details > summary::before { transition: none; } }
135
+ .client-sync-state { margin: 12px 0; font-size: 12px; color: var(--text); }
136
+ .source-impact { min-width: 0; }
137
+ .source-impact p { margin: 7px 0; }
138
+ .source-impact select { margin-top: 8px; max-width: 100%; }
139
+ .switch-hit { display: inline-flex; align-items: center; justify-content: center; }
140
+ @media (pointer: coarse) {
141
+ .switch-hit { min-width: 44px; min-height: 44px; }
142
+ .setting-row > label { display: flex; align-items: center; min-height: 44px; }
143
+ .topbar-actions .icon-button { min-width: 44px; min-height: 44px; }
144
+ }
134
145
  .settings-panel > summary { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; }
135
146
  .dashboard-section > summary.panel-heading, .lower > summary.panel-heading { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; }
136
147
  .dashboard-section > summary.panel-heading span, .lower > summary.panel-heading span { white-space: normal; text-align: right; }
@@ -193,19 +193,20 @@ function catalogReadDetails(data) {
193
193
  }
194
194
  function applyModels(data, { changed }) {
195
195
  modelSnapshots.set(data.provider || selectedProvider, data);
196
+ if (changed) void globalThis.ccdxConnections?.load?.();
196
197
  if (data.provider && data.provider !== selectedProvider) return;
197
198
  if (changed) {
198
199
  const body = element("live-models-body");
199
- const expanded = new Set([...body.querySelectorAll("details[open]")].map(node => node.dataset.model));
200
+ const expanded = new Set([...body.querySelectorAll("details[open]")].filter(node => node.dataset.disclosureClosing !== "true").map(node => node.dataset.model));
200
201
  body.replaceChildren();
201
202
  for (const model of data.models) {
202
203
  const clients = (model.clients || []).map(id => ({ codex: "Codex App", claude_app: "Claude App", claude_code: "Claude Code" })[id] || id).join(" / ") || "—";
203
- const row = tableRow([model.id, clients, ""]);row.children[0].className = "model-name";
204
+ const row = tableRow([model.display_name || model.id, clients, ""]);row.children[0].className = "model-name";
204
205
  if (model.vendor && model.vendor !== "Unknown") { const maker = document.createElement("span");maker.className = "model-maker";maker.textContent = model.vendor;row.children[0].append(maker); }
205
206
  const details = document.createElement("details"), summary = document.createElement("summary"), fields = document.createElement("dl");
206
207
  details.dataset.model = model.id;details.open = expanded.has(model.id);fields.className = "failure-detail";
207
208
  localize(summary, "model_details");details.append(summary, fields);
208
- for (const [key, value, translated] of [["vendor", model.vendor && model.vendor !== "Unknown" ? model.vendor : phrase("cap_unknown")], ["model_owner", model.owned_by], ["api", model.endpoints.join(" / ") || "—"],
209
+ for (const [key, value, translated] of [["model_id", model.id], ["vendor", model.vendor && model.vendor !== "Unknown" ? model.vendor : phrase("cap_unknown")], ["model_owner", model.owned_by], ["api", model.endpoints.join(" / ") || "—"],
209
210
  ["reasoning", model.reasoning_efforts?.join(" / ") || "—"], ["state", model.preview ? "preview" : model.state || "listed", true],
210
211
  ["model_window", number(model.context_window)]]) {
211
212
  if (value === undefined) continue;
package/src/dashboard.mjs CHANGED
@@ -21,6 +21,7 @@ const ASSETS = new Map([
21
21
  ["/usage.js", ["./dashboard/usage.js", "text/javascript; charset=utf-8"]],
22
22
  ["/refresh.js", ["./dashboard/refresh.js", "text/javascript; charset=utf-8"]],
23
23
  ["/icons.js", ["./dashboard/icons.js", "text/javascript; charset=utf-8"]],
24
+ ["/disclosure.js", ["./dashboard/disclosure.js", "text/javascript; charset=utf-8"]],
24
25
  ["/tools.js", ["./dashboard/tools.js", "text/javascript; charset=utf-8"]],
25
26
  ["/connections.js", ["./dashboard/connections.js", "text/javascript; charset=utf-8"]],
26
27
  ]);
@@ -0,0 +1,9 @@
1
+ // Presentation never changes a model's upstream or client routing identity.
2
+ export function modelDisplayName(model) {
3
+ for (const key of ["display_name", "name", "id"]) {
4
+ const value = model?.[key];
5
+ if (typeof value === "string" && value.trim() && value.length <= (key === "display_name" ? 400 : 160)
6
+ && !/[\u0000-\u001f\u007f\u202a-\u202e\u2066-\u2069]/.test(value)) return value.trim();
7
+ }
8
+ return model?.id || "";
9
+ }
@@ -4,7 +4,7 @@ import path from 'node:path';
4
4
  import { execFile } from 'node:child_process';
5
5
  import { promisify } from 'node:util';
6
6
  import { inspectPackageUpdateEnvironment } from './package-update.mjs';
7
- import { downloadRelease, createNpmReleaseFetch, protectInstallation, stableVersion, writePrivateLaunchers, privateUnixLauncher } from './release-install.mjs';
7
+ import { downloadRelease, createNpmReleaseFetch, protectInstallation, stableVersion, writePrivateLaunchers, privateUnixLauncher, remoteDownloadDenied } from './release-install.mjs';
8
8
  import { inspectWindowsCommand } from './windows-command.mjs';
9
9
  import { isVersionGreater } from './version.mjs';
10
10
  import { readBoundedResponseText } from './upstream-body.mjs';
@@ -64,15 +64,22 @@ export async function prepareNightlyRelease(release, { environment, root=nightly
64
64
  const target=path.join(directory,...(process.platform==='win32'?[]:['lib']),'node_modules/codex-copilot-dx');
65
65
  const brokerRequired=fs.existsSync(path.join(environment.target,'node_modules/@azure/msal-node-runtime'));
66
66
  try {
67
- const artifact=await downloadRelease(version,{directory,fetchImpl,signal});
67
+ let artifact=await downloadRelease(version,{directory,fetchImpl,signal});
68
68
  const args=['install','--global','--ignore-scripts','--no-audit','--no-fund'];
69
- await execute(process.execPath,[environment.npmCli,...args,'--prefix',directory,artifact.file],{env,signal,timeout:300000,maxBuffer:128*1024,windowsHide:true});
69
+ const installArgs=()=>[...args,...(artifact.complete?['--offline']:[])];
70
+ try { await execute(process.execPath,[environment.npmCli,...installArgs(),'--prefix',directory,artifact.file],{env,signal,timeout:300000,maxBuffer:128*1024,windowsHide:true}); }
71
+ catch(error) {
72
+ if(!remoteDownloadDenied(error)||signal?.aborted)throw error;
73
+ artifact=await downloadRelease(version,{directory,fetchImpl,signal,complete:true});
74
+ fs.rmSync(target,{recursive:true,force:true});
75
+ await execute(process.execPath,[environment.npmCli,...installArgs(),'--prefix',directory,artifact.file],{env,signal,timeout:300000,maxBuffer:128*1024,windowsHide:true});
76
+ }
70
77
  await verify(target,version,{signal,brokerRequired});
71
78
  return { version, target, directory,
72
79
  async install() {
73
80
  signal?.throwIfAborted();const transaction=protectInstallation(environment);
74
81
  try {
75
- await execute(process.execPath,[environment.npmCli,...args,'--prefix',environment.prefix,artifact.file],{env,signal,timeout:300000,maxBuffer:128*1024,windowsHide:true});
82
+ await execute(process.execPath,[environment.npmCli,...installArgs(),'--prefix',environment.prefix,artifact.file],{env,signal,timeout:300000,maxBuffer:128*1024,windowsHide:true});
76
83
  await verify(environment.target,version,{signal,brokerRequired});
77
84
  const normalize=value=>process.platform==='win32'?path.resolve(value).toLowerCase():path.resolve(value);
78
85
  if(env.CCDX_PRIVATE_INSTALL_PREFIX&&normalize(env.CCDX_PRIVATE_INSTALL_PREFIX)===normalize(environment.prefix))await writePrivateLaunchers(environment);
@@ -1,4 +1,4 @@
1
- export const DASHBOARD_PATHS = new Set(["/", "/ui.css", "/theme.js", "/language.js", "/refresh.js", "/time.js", "/animation.js", "/status.js", "/view-boundary.js", "/activity.js", "/flow.js", "/usage.js", "/ui.js", "/console.js", "/updates.js", "/preferences.js", "/icons.js", "/tools.js", "/connections.js"]);
1
+ export const DASHBOARD_PATHS = new Set(["/", "/ui.css", "/theme.js", "/language.js", "/refresh.js", "/time.js", "/animation.js", "/status.js", "/view-boundary.js", "/activity.js", "/flow.js", "/usage.js", "/ui.js", "/console.js", "/updates.js", "/preferences.js", "/icons.js", "/disclosure.js", "/tools.js", "/connections.js"]);
2
2
  export const DASHBOARD_API_PATHS = new Set(["/_ccdx/ui/animation", "/_ccdx/ui/models/live", "/_ccdx/ui/usage", "/_ccdx/ui/auth", "/_ccdx/ui/providers", "/_ccdx/ui/settings", "/_ccdx/ui/m365/accounts", "/_ccdx/ui/updates", "/_ccdx/ui/account", "/_ccdx/ui/checks", "/_ccdx/ui/connections"]);
3
3
 
4
4
  export function isOptionalRoute(method, pathname) {