codex-copilot-dx 1.2.11 → 1.2.13

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.
Files changed (44) hide show
  1. package/README.md +14 -14
  2. package/bin/cli.mjs +12 -8
  3. package/docs/ARCHITECTURE.md +75 -5
  4. package/docs/REFERENCE.md +117 -4
  5. package/package.json +2 -2
  6. package/src/access-settings.mjs +98 -0
  7. package/src/adapter.mjs +19 -7
  8. package/src/api-secrets.mjs +69 -0
  9. package/src/auto-review-model.mjs +4 -3
  10. package/src/claude-client-config.mjs +16 -11
  11. package/src/claude-gateway.mjs +11 -8
  12. package/src/cli-m365.mjs +48 -8
  13. package/src/cli-models.mjs +2 -1
  14. package/src/cli-options.mjs +1 -1
  15. package/src/cli-status.mjs +1 -1
  16. package/src/client-gateway-keys.mjs +29 -0
  17. package/src/codex-api-config.mjs +51 -0
  18. package/src/connection-runtime.mjs +289 -0
  19. package/src/conversation-source-guard.mjs +42 -0
  20. package/src/dashboard/connections.js +163 -0
  21. package/src/dashboard/console.js +6 -4
  22. package/src/dashboard/flow.js +17 -18
  23. package/src/dashboard/index.html +46 -3
  24. package/src/dashboard/language.js +88 -3
  25. package/src/dashboard/status.js +1 -1
  26. package/src/dashboard/ui.css +54 -26
  27. package/src/dashboard/ui.js +5 -3
  28. package/src/dashboard-api.mjs +19 -4
  29. package/src/dashboard.mjs +1 -0
  30. package/src/optional-routes.mjs +2 -2
  31. package/src/private-helper-environment.mjs +7 -0
  32. package/src/provider-management.mjs +1 -1
  33. package/src/provider-runtime.mjs +37 -5
  34. package/src/providers/api-network.mjs +51 -0
  35. package/src/providers/api.mjs +129 -0
  36. package/src/proxy-tunnel.mjs +6 -4
  37. package/src/request-application.mjs +12 -6
  38. package/src/responses-handler.mjs +6 -4
  39. package/src/startup-ui.mjs +9 -0
  40. package/src/stream-performance.mjs +7 -6
  41. package/src/terminal-console.mjs +1 -1
  42. package/src/usage-store.mjs +1 -1
  43. package/src/windows-http-network.mjs +11 -6
  44. package/src/windows-prediction-network.cs +6 -4
@@ -2,7 +2,7 @@
2
2
  const root = document.getElementById("request-flow");
3
3
  if (!root) return;
4
4
  const el = id => document.getElementById(id), ns = "http://www.w3.org/2000/svg";
5
- const clients = new Set(["codex_app", "codex_cli", "claude_app", "claude_code", "claude", "api"]);
5
+ const clients = new Set(["codex_app", "codex_cli", "codex", "claude_app", "claude_code", "claude", "api"]);
6
6
  const label = (node, key, values = {}) => globalThis.ccdxLanguage.set(node, key, values);
7
7
  const format = (key, values = {}) => globalThis.ccdxLanguage.format(key, values);
8
8
  const nodes = { apps: new Map(), models: new Map() };
@@ -12,7 +12,7 @@
12
12
  const visible = () => document.visibilityState === "visible" && !root.closest("[hidden]");
13
13
  const integer = value => Number.isSafeInteger(value) && value >= 0;
14
14
  const appName = id => format(`flow_app_${id}`);
15
- const sourceName = id => id === "github" ? "GitHub Copilot" : id === "m365" ? "Microsoft 365" : format("flow_source_unknown");
15
+ const sourceName = id => id === "github" ? "GitHub Copilot" : id === "m365" ? "Microsoft 365" : globalThis.ccdxConnectionNames?.[id] || format("flow_source_unknown");
16
16
  const modelName = id => !id || id === "other" ? format("flow_model_unknown") : id;
17
17
  const modelKey = row => JSON.stringify([row.provider, row.model]);
18
18
  const related = row => !selected || (selected.type === "apps" ? row.application === selected.id : modelKey(row) === selected.id);
@@ -35,18 +35,14 @@
35
35
  if (!map.has(id)) map.set(id, { id, provider: row.provider, model: row.model, rows: [] });
36
36
  map.get(id).rows.push(row);
37
37
  }
38
- const order = ["codex_app", "codex_cli", "claude_code", "claude_app", "claude", "api"];
38
+ const order = ["codex_app", "codex_cli", "codex", "claude_code", "claude_app", "claude", "api"];
39
39
  return [...map.values()].sort((a, b) => type === "apps" ? order.indexOf(a.id) - order.indexOf(b.id) : a.id.localeCompare(b.id));
40
40
  }
41
41
  function project(type, groups) {
42
42
  const target = el(type === "apps" ? "flow-apps" : "flow-models"), cache = nodes[type], fragments = [];
43
43
  const ids = new Set(groups.map(group => group.id));
44
44
  for (const [id, node] of cache) if (!ids.has(id)) { node.remove();cache.delete(id); }
45
- let priorSource = null;
46
45
  for (const group of groups) {
47
- if (type === "models" && group.provider !== priorSource) {
48
- const heading = entry("div", "flow-source");heading.textContent = sourceName(group.provider);fragments.push(heading);priorSource = group.provider;
49
- }
50
46
  let node = cache.get(group.id);
51
47
  if (!node) {
52
48
  node = entry("div", "flow-node");
@@ -55,17 +51,21 @@
55
51
  selected = selected?.type === type && selected.id === group.id ? null : { type, id: group.id };
56
52
  el("flow-active").open = Boolean(selected);lastSignature = "";render();
57
53
  });
58
- node.append(button, count, note);cache.set(group.id, node);
54
+ node.append(button, count, note);
55
+ if (type === "models") node.append(entry("span", "flow-source"));
56
+ cache.set(group.id, node);
59
57
  }
60
58
  const [button, count, note] = node.children;
61
59
  button.textContent = type === "apps" ? appName(group.id) : modelName(group.model);
62
60
  button.setAttribute("aria-pressed", String(selected?.type === type && selected.id === group.id));
63
- count.textContent = fresh && (group.rows.length || total === 0)
64
- ? `${omitted && group.rows.length ? "≥" : ""}${group.rows.length.toLocaleString()}` : "—";
61
+ count.hidden = fresh && omitted === 0 && group.rows.length < 2;
62
+ if (fresh && (group.rows.length || total === 0)) label(count, omitted ? "flow_count_lower" : "flow_count", { count: group.rows.length.toLocaleString() });
63
+ else count.textContent = "—";
64
+ if (type === "models") node.children[3].textContent = sourceName(group.provider);
65
65
  const output = group.rows.filter(responding).length;
66
66
  const phase = group.rows.every(row => row.terminal_outcome) ? "flow_finishing"
67
67
  : group.rows.every(row => row.upstream_attempts > 1) ? "flow_retrying" : "flow_waiting";
68
- label(note, !fresh || total && !group.rows.length ? "flow_last_observed" : !group.rows.length ? "flow_idle" : output ? "flow_group_response" : phase, { count: output });
68
+ label(note, !fresh || total && !group.rows.length ? "flow_last_observed" : !group.rows.length ? "flow_idle" : output ? group.rows.length === 1 ? "flow_responding" : "flow_group_response" : phase, { count: output });
69
69
  node.dataset.related = String(!selected || group.rows.some(related));fragments.push(node);
70
70
  }
71
71
  // Keep existing buttons and their focus when counts or phases change.
@@ -102,7 +102,6 @@
102
102
  const state = el("flow-state");
103
103
  if (fresh && total === 0) label(state, "flow_idle");
104
104
  else globalThis.ccdxIcons?.set(state, !fresh ? "flow_status_unknown" : "flow_total", !fresh ? "unavailable" : "running", { count: total });
105
- label(el("flow-total"), fresh ? "flow_total" : "flow_last_observed", { count: total });
106
105
  label(el("flow-caption"), !fresh ? "flow_status_unknown" : omitted ? "flow_omitted" : selected ? "flow_related_count" : total ? "flow_group_scope" : "flow_no_active",
107
106
  { count: rows.filter(related).length, omitted, apps: apps.length, models: allModels.length });
108
107
  el("flow-clear").hidden = !selected;
@@ -124,9 +123,9 @@
124
123
  if (!rect.width) return;
125
124
  for (const type of ["apps", "models"]) for (const [id, node] of nodes[type]) {
126
125
  if (!node.isConnected) continue;
127
- const box = node.getBoundingClientRect(), left = type === "apps";
128
- const x0 = (left ? box.right : hub.right) - rect.left + inset, y0 = (left ? box.top + 17 : hub.top + hub.height / 2) - rect.top;
129
- const x1 = (left ? hub.left : box.left) - rect.left - inset, y1 = (left ? hub.top + hub.height / 2 : box.top + 17) - rect.top;
126
+ const box = node.getBoundingClientRect(), button = node.children[0].getBoundingClientRect(), left = type === "apps";
127
+ const x0 = (left ? box.right : hub.right) - rect.left + inset, y0 = (left ? button.top + button.height / 2 : hub.top + hub.height / 2) - rect.top;
128
+ const x1 = (left ? hub.left : box.left) - rect.left - inset, y1 = (left ? hub.top + hub.height / 2 : button.top + button.height / 2) - rect.top;
130
129
  if (x1 <= x0) continue;
131
130
  const matches = rows.filter(row => (left ? row.application : modelKey(row)) === id && related(row));
132
131
  edges.push({ d: rounded(x0, y0, x1, y1), active: fresh && matches.length > 0, moving: fresh && matches.some(responding), dim: node.dataset.related === "false", x: left ? x0 : x1, y: left ? y0 : y1, left });
@@ -152,13 +151,13 @@
152
151
  new MutationObserver(() => { lastSignature = "";render(); }).observe(document.documentElement, { attributes: true, attributeFilter: ["lang"] });
153
152
  globalThis.ccdxDashboardFlow = {
154
153
  update(data) {
155
- const parts = [data?.stream_performance, data?.providers?.m365?.claude?.requests?.performance].filter(Boolean);
154
+ const parts = [data?.stream_performance, (data?.providers?.claude || data?.providers?.m365?.claude)?.requests?.performance].filter(Boolean);
156
155
  if (!parts.length || parts.some(part => !integer(part.active_total) || !Array.isArray(part.active_requests))) { unavailable();return; }
157
156
  const values = parts.flatMap(part => part.active_requests).slice(0, 128);
158
157
  rows = values.filter(row => row && typeof row.model === "string" && integer(row.upstream_attempts) && Number.isFinite(row.elapsed_ms) && row.elapsed_ms >= 0).map(row => ({
159
158
  request_id: typeof row.request_id === "string" ? row.request_id.slice(0, 80) : null,
160
- application: clients.has(row.application) ? row.application : "api", provider: ["github", "m365"].includes(row.provider) ? row.provider : "unknown",
161
- model: row.model.slice(0, 100), phase: String(row.phase || "").slice(0, 40), elapsed_ms: row.elapsed_ms,
159
+ application: clients.has(row.application) ? row.application : "api", provider: typeof row.provider === "string" && /^[a-z][a-z0-9_-]{0,63}$/.test(row.provider) ? row.provider : "unknown",
160
+ model: row.model.slice(0, 160), phase: String(row.phase || "").slice(0, 40), elapsed_ms: row.elapsed_ms,
162
161
  upstream_attempts: row.upstream_attempts, first_output_ms: Number.isFinite(row.first_output_ms) && row.first_output_ms >= 0 ? row.first_output_ms : null,
163
162
  terminal_outcome: ["completed", "incomplete", "failed", "cancelled", "unknown"].includes(row.terminal_outcome) ? row.terminal_outcome : null,
164
163
  }));
@@ -20,6 +20,7 @@
20
20
  <script src="/ui.js" defer></script>
21
21
  <script src="/console.js" defer></script>
22
22
  <script src="/tools.js" defer></script>
23
+ <script src="/connections.js" defer></script>
23
24
  <title data-i18n="ccdx_local_dashboard">CCDX · Dashboard</title>
24
25
  </head>
25
26
  <body>
@@ -41,7 +42,7 @@
41
42
 
42
43
  <header class="topbar">
43
44
  <div class="brand">CCDX <span class="brand-detail" data-i18n="local_status">/ DASHBOARD</span></div>
44
- <div class="topbar-actions"><span id="connection" class="badge neutral" role="status" data-i18n="reading">READING</span><button id="theme-toggle" class="icon-button" type="button" aria-label="Switch to light mode" title="Switch to light mode"><svg class="icon-sun" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" aria-hidden="true" focusable="false"><circle cx="12" cy="12" r="4"/><path d="M12 2v2m0 16v2M4.93 4.93l1.42 1.42m11.3 11.3 1.42 1.42M2 12h2m16 0h2M4.93 19.07l1.42-1.42m11.3-11.3 1.42-1.42"/></svg><svg class="icon-moon" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true" focusable="false"><path d="M12 3A9 9 0 1 0 21 12 7 7 0 0 1 12 3Z"/></svg></button><button id="language-toggle" class="icon-button language-button" type="button" aria-label="Switch to Chinese" title="Switch to Chinese">中文</button><button id="auto-refresh" type="button" aria-pressed="true" data-i18n="auto_refresh" data-i18n-title="visible_status_updates_every_2_seconds_catalogs_and_retained_usa" title="Visible status updates every 2 seconds. Catalogs and retained usage refresh on demand or every 30 minutes while open.">Auto refresh</button><button id="refresh" type="button" data-i18n="refresh">Refresh</button></div>
45
+ <div class="topbar-actions"><span id="connection" class="badge neutral" role="status" data-i18n="reading">READING</span><button id="theme-toggle" class="icon-button" type="button" aria-label="Switch to light mode" title="Switch to light mode"><svg class="icon-sun" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" aria-hidden="true" focusable="false"><circle cx="12" cy="12" r="4"/><path d="M12 2v2m0 16v2M4.93 4.93l1.42 1.42m11.3 11.3 1.42 1.42M2 12h2m16 0h2M4.93 19.07l1.42-1.42m11.3-11.3 1.42-1.42"/></svg><svg class="icon-moon" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true" focusable="false"><path d="M12 3A9 9 0 1 0 21 12 7 7 0 0 1 12 3Z"/></svg></button><button id="language-toggle" class="icon-button language-button" type="button" aria-label="Switch to Chinese" title="Switch to Chinese">中文</button><button id="auto-refresh" type="button" aria-pressed="true" data-i18n-title="visible_status_updates_every_2_seconds_catalogs_and_retained_usa" title="Visible status updates every 2 seconds. Catalogs and retained usage refresh on demand or every 30 minutes while open."><span class="auto-refresh-measure" aria-hidden="true" data-i18n="auto_refresh_off">Auto refresh · OFF</span><span id="auto-refresh-label" data-i18n="auto_refresh_on">Auto refresh · ON</span></button><button id="refresh" type="button" data-i18n="refresh">Refresh</button></div>
45
46
  </header>
46
47
 
47
48
  <main id="main-content" tabindex="-1">
@@ -70,6 +71,7 @@
70
71
  <label><span data-i18n="source">Source</span><select id="source-provider"></select></label>
71
72
  <label id="source-model-field" hidden><span data-i18n="conversation_model">Conversation model</span><select id="source-model"></select></label>
72
73
  <button id="apply-source" type="button" data-i18n="apply_source">Use this source</button>
74
+ <button type="button" data-client-access="codex" data-i18n="api_client_settings">Manage client access</button>
73
75
  </div>
74
76
  <p id="source-model-note" class="hint" data-i18n="github_model_in_codex">Choose your conversation model in Codex.</p>
75
77
  <div id="source-control-note" class="hint" role="status"></div>
@@ -125,6 +127,7 @@
125
127
  </details>
126
128
  </div>
127
129
  <div data-view="claude" hidden>
130
+ <div class="section-actions"><button type="button" data-client-access="claude_app" data-i18n="api_claude_app_settings">Claude App settings</button><button type="button" data-client-access="claude_code" data-i18n="api_claude_code_settings">Claude Code settings</button></div>
128
131
  <section class="panel dashboard-section" id="claude-connections">
129
132
  <h2 data-i18n="client_connections">APP SETUP</h2>
130
133
  <div class="table-wrap"><table><thead><tr><th data-i18n="client">APP</th><th data-i18n="connection_setup" data-i18n-title="configured_not_successful">Setup</th><th data-i18n="local_bridge">Local service</th><th data-i18n="last_request">LAST REQUEST</th></tr></thead><tbody id="claude-clients"></tbody></table></div>
@@ -210,7 +213,7 @@
210
213
  </section>
211
214
  <section class="panel dashboard-section">
212
215
  <h2 data-i18n="account_access">ACCOUNT AND ACCESS</h2>
213
- <div class="section-actions"><button id="check-account-link" type="button" data-i18n="check_github_connection">Check GitHub connection</button><a class="section-link" href="#models" data-source-link="m365" data-i18n="view_m365_account">View M365 account</a></div>
216
+ <div class="section-actions"><button id="check-account-link" class="account-entry" type="button" data-i18n="github_account_entry">GitHub account</button><a class="button-link account-entry" href="#models" data-source-link="m365" data-i18n="m365_account_entry">M365 account</a></div>
214
217
  </section>
215
218
  <section class="panel dashboard-section">
216
219
  <h2 data-i18n="tools_codex_connection">Codex connection</h2><p class="hint" data-i18n="tools_config_scope">Review CCDX-managed fields before repair. Other settings are preserved.</p>
@@ -262,7 +265,7 @@
262
265
  <div id="flow-network" class="flow-network" role="group" data-i18n-label="request_flow" aria-label="Request flow">
263
266
  <svg id="flow-wires" class="flow-wires" aria-hidden="true"></svg>
264
267
  <div class="flow-column"><p class="flow-column-title" data-i18n="clients">Apps</p><div id="flow-apps" class="flow-apps"></div></div>
265
- <div class="flow-hub-column"><button id="flow-hub" type="button" data-i18n-label="flow_show_all" aria-label="Show all requests"><b>CCDX</b><small id="flow-total">—</small></button></div>
268
+ <div class="flow-hub-column"><button id="flow-hub" type="button" data-i18n-label="flow_show_all" aria-label="Show all requests"><b>CCDX</b></button></div>
266
269
  <div class="flow-column"><p class="flow-column-title" data-i18n="flow_sources_models">Sources / models</p><div id="flow-models"></div></div>
267
270
  </div>
268
271
  <div class="flow-caption"><span id="flow-caption" data-i18n="flow_status_unknown">Status unavailable</span><button id="flow-clear" type="button" data-i18n="flow_show_all" hidden>Show all</button><button id="flow-more" type="button" hidden>More models</button></div>
@@ -286,6 +289,46 @@
286
289
  </details>
287
290
  </div>
288
291
  <div data-view="system" hidden>
292
+ <section class="panel dashboard-section" id="connection-sources">
293
+ <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>
294
+ <div id="connection-source-list"></div>
295
+ </section>
296
+ <section class="panel dashboard-section" id="connection-clients">
297
+ <h2 data-i18n="api_clients">Clients</h2><div id="connection-client-list"></div>
298
+ </section>
299
+ <details id="connection-disabled" class="connection-disabled"><summary data-i18n="api_disabled">Disabled</summary><div id="connection-disabled-list"></div></details>
300
+ <section class="panel dashboard-section" id="connection-editor" hidden aria-labelledby="connection-editor-title">
301
+ <div class="panel-heading"><h2 id="connection-editor-title" data-i18n="api_add">Add API</h2><button type="button" id="connection-cancel" data-i18n="cancel">Cancel</button></div>
302
+ <form id="connection-api-form">
303
+ <div class="connection-fields">
304
+ <label><span data-i18n="api_name">Name</span><input id="connection-name" name="name" type="text" maxlength="60" required autocomplete="off"></label>
305
+ <label><span data-i18n="api_base">API address</span><input id="connection-base" name="base" type="url" required autocomplete="off" spellcheck="false" placeholder="https://api.example.com/v1"></label>
306
+ <label><span>API Key</span><input id="connection-key" name="key" type="password" autocomplete="off" spellcheck="false"><span class="hint" data-i18n="api_key_private">Stored separately. Never sent to clients.</span></label>
307
+ </div>
308
+ <fieldset><legend data-i18n="api_protocols">Available APIs</legend><div class="connection-checks"><label><input type="checkbox" name="protocol" value="messages" checked>Messages</label><label><input type="checkbox" name="protocol" value="responses" checked>Responses</label><label><input type="checkbox" name="protocol" value="chat">Chat Completions</label></div></fieldset>
309
+ <details class="tool-details"><summary data-i18n="api_endpoint_options">Addresses &amp; authentication</summary><div class="connection-fields">
310
+ <label>Messages<input name="messages_url" type="url"></label><label>Responses<input name="responses_url" type="url"></label><label>Chat Completions<input name="chat_url" type="url"></label>
311
+ <label><span data-i18n="api_messages_auth">Messages authentication</span><select name="auth_header"><option value="x-api-key">x-api-key</option><option value="bearer">Bearer token</option></select></label>
312
+ <label><span data-i18n="api_key_env">Read key from environment</span><input name="key_env" type="text" autocomplete="off" spellcheck="false" placeholder="CCDX_COMPANY_API_KEY"><span class="hint" data-i18n="api_key_env_hint">Optional for servers without a credential service. Set before starting CCDX.</span></label>
313
+ </div></details>
314
+ <fieldset><legend data-i18n="api_allowed_clients">Allowed clients</legend><div class="connection-checks" id="connection-allowed-clients"></div></fieldset>
315
+ <fieldset><legend data-i18n="model_catalog">Model list</legend><div class="section-actions"><button type="button" id="connection-discover" data-i18n="api_read_models">Read models</button><span class="hint" data-i18n="api_discovery_save_first">Save the API first. No chat request is sent.</span></div>
316
+ <div class="section-actions"><input type="text" id="connection-model-id" spellcheck="false" autocomplete="off" aria-label="Model ID" placeholder="Model ID"><button type="button" id="connection-model-add" data-i18n="api_add_model">Add model</button></div>
317
+ <p class="hint" data-i18n="api_model_protocol_hint">Choose the APIs each model supports.</p><div class="table-wrap"><table><thead><tr><th data-i18n="model">Model</th><th data-i18n="api_protocols">Available APIs</th><th></th></tr></thead><tbody id="connection-models"></tbody></table></div>
318
+ </fieldset>
319
+ <div class="section-actions"><button type="submit" data-i18n="api_save">Save</button></div>
320
+ </form>
321
+ </section>
322
+ <section class="panel dashboard-section" id="connection-client-editor" hidden aria-labelledby="connection-client-title">
323
+ <div class="panel-heading"><h2 id="connection-client-title"></h2><button type="button" id="connection-client-cancel" data-i18n="cancel">Cancel</button></div>
324
+ <form id="connection-client-form"><div class="connection-fields"><label><span data-i18n="api_current_source">Current source</span><select id="connection-current"></select></label><label id="connection-current-model-row"><span data-i18n="model">Model</span><select id="connection-current-model"></select></label></div>
325
+ <fieldset><legend data-i18n="api_allowed_sources">Allowed sources</legend><div id="connection-client-allowed" class="connection-checks"></div></fieldset>
326
+ <p class="hint" data-i18n="api_existing_requests">Existing requests keep their source. Use a new conversation after switching.</p>
327
+ <div class="section-actions"><button type="submit" data-i18n="api_save">Save</button></div>
328
+ </form>
329
+ </section>
330
+ <section class="panel dashboard-section" id="connection-disable-editor" hidden aria-labelledby="connection-disable-title"><h2 id="connection-disable-title" data-i18n="api_disable_source">Disable source</h2><p class="hint" data-i18n="api_choose_replacements">Choose another source or pause each affected client.</p><form id="connection-disable-form"><div id="connection-replacements" class="connection-fields"></div><div class="section-actions"><button type="submit" data-i18n="api_confirm_disable">Disable</button><button type="button" id="connection-disable-cancel" data-i18n="cancel">Cancel</button></div></form></section>
331
+ <p id="connection-note" class="hint" role="status" aria-live="polite"></p>
289
332
  <section class="panel dashboard-section" aria-labelledby="web-appearance-title">
290
333
  <h2 id="web-appearance-title" data-i18n="appearance_web_appearance">网页外观</h2>
291
334
  <div class="appearance-row">
@@ -1,5 +1,90 @@
1
1
  (() => {
2
2
  const translations = {
3
+ "api_add": ["Add API", "添加 API"],
4
+ "api_clients": ["Clients", "客户端"],
5
+ "api_disabled": ["Disabled", "已关闭"],
6
+ "api_name": ["Name", "名称"],
7
+ "api_base": ["API address", "API 地址"],
8
+ "api_key_private": ["Stored separately. Never sent to clients.", "独立保存,不会传给客户端。"],
9
+ "api_key_env": ["Read key from environment", "从环境变量读取 Key"],
10
+ "api_key_env_hint": ["Optional for servers without a credential service. Set before starting CCDX.", "无系统密钥库时可用,需在启动前设置。"],
11
+ "ccdx_api_environment_key_missing": ["Set the named environment variable, then restart CCDX.", "请设置对应环境变量,然后重启 CCDX。"],
12
+ "api_protocols": ["Available APIs", "可用接口"],
13
+ "api_endpoint_options": ["Addresses & authentication", "接口地址与认证"],
14
+ "api_messages_auth": ["Messages authentication", "Messages 认证"],
15
+ "api_allowed_clients": ["Allowed clients", "允许使用的客户端"],
16
+ "api_read_models": ["Read models", "读取模型"],
17
+ "api_discovery_save_first": ["Save the API first. No chat request is sent.", "先保存来源;只读取模型目录。"],
18
+ "api_add_model": ["Add model", "添加模型"],
19
+ "api_model_protocol_hint": ["Choose the APIs each model supports.", "为每个模型选择实际支持的接口。"],
20
+ "api_remove_model": ["Remove", "移除"],
21
+ "api_save": ["Save", "保存"],
22
+ "api_current_source": ["Current source", "当前来源"],
23
+ "api_allowed_sources": ["Allowed sources", "允许使用的来源"],
24
+ "api_existing_requests": ["Existing requests keep their source. Use a new conversation after switching.", "已有请求不变;切换后请新建对话。"],
25
+ "api_disable_source": ["Disable source", "关闭来源"],
26
+ "api_choose_replacements": ["Choose another source or pause each affected client.", "为受影响的客户端换源,或暂停接入。"],
27
+ "api_confirm_disable": ["Disable", "确认关闭"],
28
+ "api_pause": ["Pause access", "暂停接入"],
29
+ "api_allowed_summary": ["Allowed: {clients}", "允许使用:{clients}"],
30
+ "api_none": ["Not assigned", "暂未分配"],
31
+ "api_account": ["Account", "查看账号"],
32
+ "api_manage": ["Manage", "管理"],
33
+ "api_restore": ["Enable again", "重新开启"],
34
+ "api_current_summary": ["Current source: {source}", "当前来源:{source}"],
35
+ "api_client_disabled": ["CCDX access is off; the app stays open.", "接入已关闭,应用保持运行。"],
36
+ "api_close_client": ["Disable client access", "关闭客户端接入"],
37
+ "api_no_disabled": ["No disabled items.", "没有已关闭的项目。"],
38
+ "api_saved": ["Saved. Reopen the app for first-time setup; existing requests stay unchanged.", "已保存。首次接入请重新打开应用。"],
39
+ "api_config_saved": ["API saved. Current client sources are unchanged.", "API 已保存,客户端来源未改变。"],
40
+ "api_provider_disabled": ["Source disabled. Its configuration was kept.", "来源已关闭,配置已保留。"],
41
+ "api_provider_enabled": ["Source enabled. Client selections are unchanged.", "来源已开启,客户端来源未改变。"],
42
+ "api_client_enabled": ["Client enabled. Choose a source to connect.", "客户端已开启,请选择来源。"],
43
+ "api_client_preserved": ["Saved. Existing custom or managed app settings were kept.", "已保存;已有自定义或托管配置已保留。"],
44
+ "api_client_config_failed": ["Source saved, but app configuration failed. Review Checks & repairs.", "来源已保存,客户端配置失败。请检查与修复。"],
45
+ "api_client_not_installed": ["Saved. The client app was not found.", "配置已保存,未发现客户端应用。"],
46
+ "api_key_keep": ["Saved; leave blank to keep", "已保存;留空不更换"],
47
+ "api_key_enter": ["Enter API key", "输入 API Key"],
48
+ "api_models_read": ["Models read. Review their APIs before saving.", "模型已读取;请确认接口后保存。"],
49
+ "api_configured_models": ["CONFIGURED MODELS", "已配置的模型"],
50
+ "api_no_enabled_sources": ["No source is enabled. Review Settings.", "暂无启用的来源,请查看设置。"],
51
+ "api_client_settings": ["Manage client access", "设置客户端接入"],
52
+ "api_claude_app_settings": ["Claude App settings", "设置 Claude App"],
53
+ "api_claude_code_settings": ["Claude Code settings", "设置 Claude Code"],
54
+ "ccdx_connections_unavailable": ["Restart the updated CCDX to manage connections.", "请重启更新后的 CCDX。"],
55
+ "ccdx_connections_invalid": ["Connection settings are unreadable; the file was kept.", "接入配置无法读取,原文件已保留。"],
56
+ "ccdx_connections_action_failed": ["Could not save connections. Try again.", "接入配置未保存,请重试。"],
57
+ "ccdx_connections_action_invalid": ["Review the selected clients and sources.", "请检查客户端与来源选择。"],
58
+ "ccdx_connections_conflict": ["Another process changed these settings. Restart CCDX before saving.", "其他进程已改动配置,请重启 CCDX。"],
59
+ "ccdx_api_url_invalid": ["Use a complete HTTPS address without credentials or query parameters.", "请用不含凭据或查询参数的 HTTPS 地址。"],
60
+ "ccdx_api_origin_mismatch": ["API addresses must use the same host and port.", "各接口须使用相同的主机和端口。"],
61
+ "ccdx_api_config_invalid": ["Review the API name, address and authentication.", "请检查 API 名称、地址和认证。"],
62
+ "ccdx_api_key_invalid": ["Enter a valid API key.", "请输入有效的 API Key。"],
63
+ "ccdx_api_secret_unavailable": ["The system credential store is unavailable. No plaintext fallback was used.", "系统凭据库不可用,未改用明文保存。"],
64
+ "ccdx_api_models_invalid": ["Use unique model IDs and choose a supported API for each.", "模型 ID 不能重复,且需选择可用接口。"],
65
+ "ccdx_api_name_exists": ["This source name is already used. Choose another name.", "来源名称已存在,请换一个名称。"],
66
+ "ccdx_api_model_reserved": ["codex-auto-review is reserved by CCDX. Enter the real upstream model ID.", "codex-auto-review 为内部名称,请填真实模型 ID。"],
67
+ "ccdx_connections_limit": ["Connection settings exceed the 8 MiB limit.", "接入配置超过 8 MiB 上限。"],
68
+ "ccdx_api_model_unavailable": ["Choose a configured model with the required API.", "请选择支持对应接口的已配置模型。"],
69
+ "ccdx_api_protocol_required": ["Claude needs Messages; Codex needs Responses.", "Claude 需 Messages;Codex 需 Responses。"],
70
+ "ccdx_api_effort_unavailable": ["Choose a reasoning level advertised by this model, or follow the client.", "请选择模型支持的推理档位,或跟随客户端。"],
71
+ "ccdx_source_in_use": ["Change the current source or pause its clients first.", "请先更换来源,或暂停相关客户端。"],
72
+ "ccdx_source_busy": ["A previous M365 request is still running. Let it finish before disabling.", "旧的 M365 请求仍在运行,请结束后关闭。"],
73
+ "ccdx_provider_environment_disabled": ["Microsoft 365 is disabled by CCDX_M365=0.", "Microsoft 365 已被环境设置关闭。"],
74
+ "ccdx_client_source_disabled": ["The client or source is disabled. Review Settings.", "客户端或来源已关闭,请查看设置。"],
75
+ "ccdx_client_source_mismatch": ["Save the selected source before changing its review model.", "请先保存来源,再修改审查模型。"],
76
+ "ccdx_conversation_source_changed": ["This history belongs to another source or key. Start a new conversation.", "此历史属于其他来源或 Key,请新建对话。"],
77
+ "ccdx_conversation_state_invalid": ["Conversation source records are unreadable. The existing file was kept.", "会话来源记录无法读取,原文件已保留。"],
78
+ "ccdx_api_catalog_invalid": ["The model list was invalid. Existing settings were kept.", "模型列表无效,已有配置已保留。"],
79
+ "ccdx_api_catalog_http_401": ["Model access was rejected (HTTP 401). Check the key.", "模型访问被拒绝(401),请检查 Key。"],
80
+ "ccdx_api_catalog_http_403": ["Model access was denied (HTTP 403). Check permissions.", "模型访问被拒绝(403),请检查权限。"],
81
+ "ccdx_api_network_unavailable": ["Could not reach the API. Proxy and TLS rules were kept.", "无法连接 API,代理和证书规则已保留。"],
82
+ "ccdx_api_limit": ["Up to 16 manual APIs are supported.", "最多可添加 16 个手工 API。"],
83
+ "github_account_entry": ["GitHub account", "GitHub 账号"],
84
+ "m365_account_entry": ["M365 account", "M365 账号"],
85
+ "flow_count": ["{count} requests", "{count} 个请求"],
86
+ "flow_count_lower": ["≥{count} requests", "≥{count} 个请求"],
87
+ "flow_app_codex": ["Codex", "Codex"],
3
88
  "prediction_first_setup": ["Quit Codex before first setup: ccdx prediction on", "首次配置前请退出 Codex:ccdx prediction on"],
4
89
  "image_first_setup": ["First setup: ccdx enable-image", "首次配置:ccdx enable-image"],
5
90
  "record_scope": ["Record scope", "记录范围"],
@@ -29,7 +114,7 @@
29
114
  "flow_app_claude_app": ["Claude App", "Claude App"],
30
115
  "flow_app_claude_code": ["Claude Code", "Claude Code"],
31
116
  "flow_app_claude": ["Claude (app unspecified)", "Claude(未区分应用)"],
32
- "flow_app_api": ["API client", "API 客户端"],
117
+ "flow_app_api": ["Unidentified app", "未识别应用"],
33
118
  "flow_source_unknown": ["Source unknown", "来源未知"],
34
119
  "flow_model_unknown": ["Model not identified", "未识别模型"],
35
120
  "flow_responding": ["Responding", "响应中"],
@@ -1081,7 +1166,7 @@
1081
1166
  try { if (localStorage.getItem(storageKey) === "zh") language = "zh"; } catch {}
1082
1167
  document.documentElement.lang = language === "zh" ? "zh-CN" : "en";
1083
1168
  const messages = new WeakMap();
1084
- const attributes = { textContent: "data-i18n", title: "data-i18n-title", "aria-label": "data-i18n-label" };
1169
+ const attributes = { textContent: "data-i18n", title: "data-i18n-title", "aria-label": "data-i18n-label", placeholder: "data-i18n-placeholder" };
1085
1170
 
1086
1171
  function format(key, values = {}) {
1087
1172
  const id = Object.hasOwn(translations, key) ? key : Object.hasOwn(legacyMessages, key) ? legacyMessages[key] : key;
@@ -1106,7 +1191,7 @@
1106
1191
 
1107
1192
  function apply() {
1108
1193
  document.documentElement.lang = language === "zh" ? "zh-CN" : "en";
1109
- for (const target of document.querySelectorAll("[data-i18n], [data-i18n-title], [data-i18n-label]")) {
1194
+ for (const target of document.querySelectorAll("[data-i18n], [data-i18n-title], [data-i18n-label], [data-i18n-placeholder]")) {
1110
1195
  for (const [attribute, marker] of Object.entries(attributes)) {
1111
1196
  if (!target.hasAttribute(marker)) continue;
1112
1197
  const saved = messages.get(target)?.[attribute];
@@ -225,7 +225,7 @@
225
225
  ? "active_active_failed_failed_delivery_failures_delivery"
226
226
  : "setup_state_unknown_ccdx_image_status", { active: number(image?.active), failed: number(image?.failed), delivery: number(image?.delivery_failures) });
227
227
 
228
- const claude = data.providers?.m365?.claude, claudeMetrics = claude?.requests?.performance;
228
+ const claude = data.providers?.claude || data.providers?.m365?.claude, claudeMetrics = claude?.requests?.performance;
229
229
  percentiles("claude-ttft-percentiles", claudeMetrics?.by_route?.messages?.ttft_ms);
230
230
  const sourceBody = element("source-requests-body");
231
231
  if (sourceBody) {
@@ -14,15 +14,17 @@ html { scrollbar-gutter: stable; }
14
14
  .badge::before { content: "●"; margin-right: 8px; }
15
15
  .badge.good { color: var(--accent-soft); }
16
16
  .badge.bad { color: var(--bad); }
17
- button { border: 1px solid var(--button-border); border-radius: 2px; background: var(--button-bg); color: var(--button-fg); padding: 8px 13px; font: inherit; font-size: 11px; font-weight: 700; text-transform: uppercase; cursor: pointer; }
18
- button:hover { background: var(--button-hover); }
19
- button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
17
+ button, .button-link { border: 1px solid var(--button-border); border-radius: 2px; background: var(--button-bg); color: var(--button-fg); padding: 8px 13px; font: inherit; font-size: 11px; font-weight: 700; text-transform: uppercase; cursor: pointer; }
18
+ button:hover, .button-link:hover { background: var(--button-hover); }
19
+ button:focus-visible, .button-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
20
+ .button-link { display:inline-flex;align-items:center;justify-content:center;text-decoration:none; }
21
+ .account-entry { text-transform:none; }
20
22
  button:disabled { opacity: .55; cursor: default; }
21
23
  button[aria-busy="true"] { cursor: progress; }
22
- .icon-button { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 6px; border: 0; background: transparent; }
24
+ .icon-button { display: inline-flex; flex:none; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 6px; border: 0; background: transparent; }
23
25
  .icon-button:hover { background: transparent; color: var(--accent); }
24
26
  .icon-button svg { width: 18px; height: 18px; }
25
- .language-button { padding: 4px; white-space: nowrap; }
27
+ .language-button { width:auto; min-width:40px; padding:4px 6px; white-space:nowrap; word-break:normal; overflow-wrap:normal; line-height:1; }
26
28
  .icon-moon, :root[data-theme="light"] .icon-sun { display: none; }
27
29
  :root[data-theme="light"] .icon-moon { display: block; }
28
30
  .intro { display: flex; justify-content: space-between; align-items: baseline; gap: 20px; padding: 38px 0 25px; }
@@ -53,6 +55,27 @@ h1 { margin: 0; font-size: clamp(20px, 3vw, 27px); font-weight: 650; letter-spac
53
55
  .meter::-webkit-progress-value { background: var(--accent-soft); }
54
56
  .meter::-moz-progress-bar { background: var(--accent-soft); }
55
57
  .dashboard-section { min-height: 0; margin-top: 11px; }
58
+ .connection-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--border); min-width: 0; }
59
+ .connection-row:last-child { border-bottom: 0; padding-bottom: 0; }
60
+ .connection-row > div:first-child { min-width: 0; }
61
+ .connection-row h3 { margin: 0; color: var(--text); font-size: 13px; }
62
+ .connection-row p { margin: 5px 0 0; overflow-wrap: anywhere; }
63
+ .connection-actions, .connection-checks { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
64
+ .connection-actions { flex: 0 0 auto; }
65
+ .connection-checks label { display: inline-flex; align-items: center; gap: 7px; min-height: 30px; white-space: nowrap; }
66
+ .connection-checks input { flex: none; accent-color: var(--accent); }
67
+ .connection-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 18px 0; }
68
+ .connection-fields > label { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
69
+ .connection-fields input, .connection-fields select { width: 100%; min-width: 0; min-height: 38px; }
70
+ .connection-fields input, #connection-model-id { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--button-border); border-radius: 2px; padding: 7px 10px; }
71
+ .connection-fields input:focus-visible, #connection-model-id:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
72
+ #connection-editor fieldset, #connection-client-editor fieldset { border: 0; padding: 0; margin: 22px 0; min-width: 0; }
73
+ #connection-editor legend, #connection-client-editor legend { padding: 0; margin-bottom: 9px; color: var(--text); }
74
+ #connection-models td { white-space: normal; overflow-wrap: anywhere; }
75
+ #connection-models td:first-child { min-width: 140px; }
76
+ .connection-disabled { padding: 8px 0 18px; color: var(--heading); }
77
+ .connection-disabled .connection-row { padding: 13px 0; }
78
+ @media (max-width: 650px) { .connection-fields { grid-template-columns: minmax(0, 1fr); } .connection-actions { gap: 9px; } .connection-row { gap: 10px; } }
56
79
  .heading-actions { display: flex; align-items: center; gap: 16px; }
57
80
  .heading-actions button { padding: 5px 9px; }
58
81
  .animation-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 18px; }
@@ -187,7 +210,9 @@ footer { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; color:
187
210
  .brand { font-size: 12px; }
188
211
  .topbar-actions { gap: 12px; flex-wrap: nowrap; }
189
212
  .topbar-actions #connection { width: 154px; flex: none; }
190
- .topbar-actions #auto-refresh { width: 164px; flex: none; }
213
+ .topbar-actions #auto-refresh { display:inline-grid; flex:none; justify-self:start; white-space:nowrap; }
214
+ #auto-refresh span { grid-column:1; grid-row:1; }
215
+ #auto-refresh .auto-refresh-measure { visibility:hidden; }
191
216
  .intro { display: block; padding: 32px 0 26px; min-height: 98px; }
192
217
  main { align-self: start; }
193
218
  #main-content:focus { outline: none; }
@@ -226,7 +251,7 @@ input[role="switch"]:focus-visible, input[type="number"]:focus-visible { outline
226
251
  input[role="switch"]:disabled { opacity: .5; cursor: wait; }
227
252
  #process-queues { overflow-wrap: anywhere; font-size: 11px; }
228
253
  @media (max-width: 1100px) { .topbar .brand { display: none; } .topbar { justify-content: flex-end; } }
229
- @media (max-width: 900px) { .shell { grid-template-columns: 170px minmax(0, 1fr); column-gap: 20px; padding: 0 20px; } .setting-row { grid-template-columns: minmax(0, 1fr) 44px; } .setting-row .hint { grid-column: 1 / -1; } .overview { grid-template-columns: 1fr; } .shell { grid-template-rows: 96px minmax(0, 1fr) auto; } .topbar { height: 96px; } .topbar-actions { display: grid; grid-template-columns: 32px 32px minmax(0, 1fr) auto; gap: 8px 9px; width: 100%; } .topbar-actions #connection { grid-column: 1 / -1; width: auto; } .topbar-actions #auto-refresh { width: auto; min-width: 0; padding-inline: 8px; } }
254
+ @media (max-width: 900px) { .shell { grid-template-columns: 170px minmax(0, 1fr); column-gap: 20px; padding: 0 20px; } .setting-row { grid-template-columns: minmax(0, 1fr) 44px; } .setting-row .hint { grid-column: 1 / -1; } .overview { grid-template-columns: 1fr; } .shell { grid-template-rows: 96px minmax(0, 1fr) auto; } .topbar { height: 96px; } .topbar-actions { display: grid; grid-template-columns: 32px 40px max-content max-content; justify-content:end; gap: 8px 9px; width: 100%; } .topbar-actions #connection { grid-column: 1 / -1; width: auto; } .topbar-actions #auto-refresh { width: auto; min-width: 0; padding-inline: 8px; } }
230
255
  @media (max-width: 640px) { .shell { display: block; padding: 0 16px; } .sidebar { position: static; height: auto; padding: 20px 0 14px; border-right: 0; border-bottom: 1px solid var(--border); } .sidebar-brand { font-size: 20px; width: fit-content; } .sidebar-brand .brand-caption { margin-top: 4px; } .sidebar nav { display: flex; flex-direction: row; flex-wrap: wrap; gap: 4px; margin-top: 16px; } .sidebar nav a { padding: 9px 10px; font-size: 12px; border-left: 0; border-bottom: 2px solid transparent; } .sidebar nav a[aria-current="page"] { border-bottom-color: var(--accent); } .nav-group { display: none; } .topbar { min-height: 62px; justify-content: flex-start; } .topbar-actions { justify-content: flex-start; gap: 9px; } .intro { padding: 24px 0 18px; } .panel, .lower { padding: 17px; } .section-actions > label { width: 100%; } .stats { gap: 12px; } }
231
256
 
232
257
  /* Keep forms aligned with the existing dashboard controls. */
@@ -234,12 +259,13 @@ input[role="switch"]:disabled { opacity: .5; cursor: wait; }
234
259
  .sidebar nav .nav-child { padding-left: 28px; }
235
260
  .section-actions > label { min-width: 0; max-width: 100%; }
236
261
  .section-actions select { min-width: 180px; width: 100%; max-width: 320px; }
237
- .section-actions input:not([type="checkbox"]), .section-actions select, .section-actions button,
262
+ .section-actions input:not([type="checkbox"]), .section-actions select, .section-actions button, .section-actions .button-link,
238
263
  .analytics-controls select { box-sizing: border-box; height: 36px; min-height: 36px; line-height: normal; }
239
- .section-actions button { padding-top: 0; padding-bottom: 0; }
264
+ .section-actions button, .section-actions .button-link { padding-top: 0; padding-bottom: 0; }
240
265
  @media (max-width: 640px) {
241
- .topbar { height: 96px; padding: 8px 0; }
242
- .topbar-actions { justify-content: initial; }
266
+ .topbar { height:auto; min-height:96px; padding:8px 0; }
267
+ .topbar-actions { display:flex; flex-wrap:wrap; justify-content:flex-start; gap:8px; }
268
+ .topbar-actions #connection { flex-basis:100%; }
243
269
  .section-actions > label { flex: 1 1 180px; }
244
270
  .section-actions select { max-width: 100%; }
245
271
  }
@@ -402,23 +428,25 @@ input[role="switch"]:disabled { opacity: .5; cursor: wait; }
402
428
  .source-account-actions { margin-top: 18px; }
403
429
  @media(max-width:640px) { .account-summary { grid-template-columns:1fr; } }
404
430
 
405
- .flow-network { position:relative;display:grid;grid-template-columns:minmax(130px,1fr) 100px minmax(170px,1.2fr);column-gap:clamp(36px,6vw,92px);align-items:center;min-height:216px;margin:26px 0 18px;padding:4px 0; }
431
+ .flow-network { position:relative;display:grid;grid-template-columns:minmax(130px,1fr) 70px minmax(170px,1fr);column-gap:clamp(36px,6vw,92px);align-items:stretch;min-height:236px;margin:26px 0 18px; }
406
432
  .flow-wires { position:absolute;inset:0;width:100%;height:100%;pointer-events:none;overflow:visible; }
407
433
  .flow-column,.flow-hub-column { position:relative;min-width:0; }
408
- .flow-column-title { margin:0 0 20px;color:var(--muted);font-size:11px; }
409
- .flow-node { display:grid;grid-template-columns:minmax(0,max-content) auto;align-items:center;gap:4px 10px;min-height:65px; }
410
- .flow-choice { justify-self:start;max-width:100%;min-height:34px;padding:7px 9px;border-color:transparent;background:transparent;color:var(--text);font-size:12px;font-weight:600;text-transform:none;text-align:left;overflow-wrap:anywhere; }
434
+ .flow-column { display:flex;flex-direction:column; }
435
+ .flow-column-title { height:18px;line-height:18px;margin:0 0 18px;color:var(--muted);font-size:11px;text-align:center; }
436
+ .flow-apps,#flow-models { display:flex;flex:1;flex-direction:column;justify-content:center;align-items:center;gap:68px;padding:32px 0;min-width:0; }
437
+ .flow-hub-column { display:flex;align-items:center;justify-content:center;padding-top:36px; }
438
+ .flow-node { position:relative;display:flex;align-items:center;gap:8px;width:max-content;max-width:100%;min-height:34px; }
439
+ .flow-choice { min-width:0;max-width:100%;min-height:34px;padding:7px 9px;border-color:transparent;background:transparent;color:var(--text);font-size:12px;font-weight:600;text-transform:none;text-align:center;overflow-wrap:anywhere; }
411
440
  .flow-choice:hover { background:var(--option-hover); }
412
441
  .flow-choice[aria-pressed="true"],.flow-choice[aria-pressed="true"]:hover { color:var(--page);background:var(--accent);border-color:var(--accent); }
413
- .flow-count { justify-self:end;color:var(--strong);font-size:12px;font-variant-numeric:tabular-nums; }
414
- .flow-note { grid-column:1/-1;margin:0 0 14px 9px;color:var(--muted);font-size:10px; }
415
- .flow-source { color:var(--muted);font-size:10px;margin:14px 0 10px 9px; }
416
- .flow-source:first-child { margin-top:0; }
442
+ .flow-count { flex:none;color:var(--muted);font-size:11px;font-variant-numeric:tabular-nums;white-space:nowrap; }
443
+ .flow-note { position:absolute;top:calc(100% + 4px);left:9px;max-width:100%;margin:0;color:var(--muted);font-size:10px; }
444
+ .flow-source { position:absolute;bottom:calc(100% + 9px);left:9px;color:var(--muted);font-size:10px;white-space:nowrap; }
417
445
  .flow-node[data-related="false"] { opacity:.5; }
418
- #flow-hub { display:flex;flex-direction:column;align-items:center;gap:9px;width:100%;border:0;background:var(--surface);color:var(--text);padding:10px 0;text-transform:none; }
446
+ #flow-hub { position:relative;display:flex;align-items:center;justify-content:center;width:40px;height:40px;border:0;background:var(--surface);color:var(--text);padding:0;text-transform:none; }
447
+ #flow-hub b { position:absolute;top:calc(100% + 10px);left:50%;transform:translateX(-50%); }
419
448
  #flow-hub:hover { color:var(--accent); }
420
449
  .flow-logo { width:34px;height:34px;color:var(--accent); }
421
- #flow-hub small { font-size:10px;font-weight:400;color:var(--muted);white-space:normal; }
422
450
  .flow-caption { display:flex;align-items:center;flex-wrap:wrap;gap:10px 16px;min-height:30px;font-size:11px;color:var(--muted); }
423
451
  .flow-caption button { padding:5px 9px; }
424
452
  .flow-wire { fill:none;stroke:var(--border);stroke-width:1;stroke-linecap:round;stroke-linejoin:round; }
@@ -434,14 +462,14 @@ input[role="switch"]:disabled { opacity: .5; cursor: wait; }
434
462
  @media(max-width:760px) {
435
463
  .flow-network { grid-template-columns:minmax(105px,1fr) 66px minmax(120px,1fr);column-gap:18px; }
436
464
  .flow-choice { font-size:11px;padding-inline:4px; }
437
- .flow-node { column-gap:4px; }
438
- .flow-source,.flow-note { margin-left:4px; }
465
+ .flow-node { gap:4px; }
466
+ .flow-apps,#flow-models { gap:92px; }
467
+ .flow-count { position:absolute;top:calc(100% + 46px);left:0;font-size:10px; }
468
+ .flow-source,.flow-note { left:4px; }
439
469
  }
440
470
  @media(max-width:460px) {
441
471
  .flow-network { grid-template-columns:minmax(80px,1fr) 48px minmax(100px,1fr);column-gap:12px; }
442
- .flow-column-title,.flow-source,.flow-note,#flow-hub small { font-size:9px; }
443
- .flow-node { grid-template-columns:minmax(0,1fr) auto; }
444
- .flow-count { font-size:10px; }
472
+ .flow-column-title,.flow-source,.flow-note { font-size:10px; }
445
473
  .flow-logo { width:26px;height:26px; }
446
474
  }
447
475
  @media(prefers-reduced-motion:reduce) { .flow-packet,#request-flow[data-state="idle"] #flow-state::before { animation:none; } }
@@ -114,6 +114,7 @@ function applyProviders(data, { changed }) {
114
114
  let reloadModels = false;
115
115
  const previous = new Map(providerEntries.map(entry => [entry.id, JSON.stringify([entry.generation, entry.auth?.account])]));
116
116
  providerEntries = data.providers;
117
+ if (!providerEntries.length) { text("models-state", "api_no_enabled_sources");emptyTable("live-models-body", 3, "api_no_enabled_sources"); }
117
118
  for (const [id] of modelSnapshots) {
118
119
  const provider = providerEntries.find(entry => entry.id === id);
119
120
  if (!provider) {
@@ -154,6 +155,7 @@ function applyProviders(data, { changed }) {
154
155
  }
155
156
  element("live-models-body").setAttribute("aria-labelledby", `model-provider-${selectedProvider}`);
156
157
  if (sourceChoicesChanged) window.dispatchEvent(new CustomEvent("ccdx:providers"));
158
+ if (!providerEntries.length) { text("models-state", "api_no_enabled_sources");emptyTable("live-models-body", 3, "api_no_enabled_sources");return; }
157
159
  if ((!wasInitialized || reloadModels || selectedProvider !== previousSelection) && !element("upstream-models").closest("[hidden]")) { dashboardRefresh.invalidate("models", { clear: true });void loadModels(); }
158
160
  }
159
161
 
@@ -281,7 +283,7 @@ const dashboardRefresh = globalThis.ccdxRefresh.createController({
281
283
  variant: catalogProvider,
282
284
  load: async ({ signal, variant }) => {
283
285
  if (!variant) throw new Error("reading_provider_catalog");
284
- const data = await readDashboard(`/_ccdx/ui/models/live?provider=${encodeURIComponent(variant)}`, { signal, source: ["live", "catalog"] });
286
+ const data = await readDashboard(`/_ccdx/ui/models/live?provider=${encodeURIComponent(variant)}`, { signal, source: ["live", "catalog", "configured"] });
285
287
  if (!Array.isArray(data.models) || data.models.some(model => !model || typeof model.id !== "string" || !Array.isArray(model.endpoints))) throw new Error("Invalid model snapshot");
286
288
  return { ...data, provider: variant };
287
289
  },
@@ -290,7 +292,7 @@ const dashboardRefresh = globalThis.ccdxRefresh.createController({
290
292
  state: state => {
291
293
  if (state.attemptVariant !== selectedProvider) return;
292
294
  element("refresh-models").disabled = Boolean(state.pending);
293
- text("models-state", state.pending ? "checking_live" : state.error ? "live_lookup_failed" : state.value?.source === "catalog" ? "catalog_snapshot" : "live_snapshot");
295
+ text("models-state", state.pending ? "checking_live" : state.error ? "live_lookup_failed" : state.value?.source === "configured" ? "api_configured_models" : state.value?.source === "catalog" ? "catalog_snapshot" : "live_snapshot");
294
296
  element("model-check-details").hidden = !state.error;
295
297
  if (state.error) {
296
298
  const message = String(state.error.message || state.error).slice(0, 240);
@@ -378,7 +380,7 @@ const dashboardRefresh = globalThis.ccdxRefresh.createController({
378
380
  const autoRefreshKey = "ccdx.dashboard.autoRefresh";
379
381
  const updateAutoRefresh = () => {
380
382
  element("auto-refresh").setAttribute("aria-pressed", String(dashboardRefresh.automatic));
381
- text("auto-refresh", dashboardRefresh.automatic ? "auto_refresh_on" : "auto_refresh_off");
383
+ text("auto-refresh-label", dashboardRefresh.automatic ? "auto_refresh_on" : "auto_refresh_off");
382
384
  };
383
385
  let automatic = true;
384
386
  try { automatic = localStorage.getItem(autoRefreshKey) !== "off"; } catch { /* Keep the default when browser storage is unavailable. */ }
@@ -116,7 +116,7 @@ function dashboardProviders(providerStateFn, authStatusFn) {
116
116
  const local = authStatusFn()?.profiles?.codex || {};
117
117
  const entries = providerStateFn?.() || [{ id: "github", name: "GitHub Copilot", enabled: true, state: "unknown",
118
118
  clients: [{ id: "codex", name: "Codex App", selected: true, state: "configured" }] }];
119
- return entries.slice(0, 16).filter(entry => isProviderId(entry.id)).map(entry => {
119
+ return entries.slice(0, 18).filter(entry => isProviderId(entry.id)).map(entry => {
120
120
  const auth = entry.id === "github" ? { ...entry.auth,
121
121
  state: local.valid ? "saved" : local.configured ? "unavailable" : "unconfigured",
122
122
  account: local.valid ? local.login || "" : "" } : entry.auth || {};
@@ -147,6 +147,7 @@ export async function handleDashboardApi(req, res, pathname, {
147
147
  providerCatalogFn,
148
148
  providerStateFn,
149
149
  providerAccountsFn,
150
+ connectionsFn,
150
151
  updateStatusFn,
151
152
  serviceControl,
152
153
  applyAnimation,
@@ -167,6 +168,20 @@ export async function handleDashboardApi(req, res, pathname, {
167
168
  return tools.handle(req, res, pathname, sendJson, sameOrigin);
168
169
  }
169
170
 
171
+ if (pathname === "/_ccdx/ui/connections") {
172
+ if (!connectionsFn) { sendJson(res, 503, { error: "ccdx_connections_unavailable" });return; }
173
+ if (req.method === "GET") { try { sendJson(res, 200, await connectionsFn()); } catch { sendJson(res, 409, { error: "ccdx_connections_invalid" }); }return; }
174
+ if (req.method !== "POST") { sendJson(res, 405, { error: "Use GET or POST" });return; }
175
+ if (!sameOrigin(req)) { sendJson(res, 403, { error: "Connections require the same-origin dashboard" });return; }
176
+ if (!/^application\/json(?:\s*;|$)/i.test(req.headers["content-type"] || "")) { sendJson(res, 415, { error: "Expected application/json" });return; }
177
+ const abort = createRequestAbort(req, res);abort.setTimeout(5000, "request_body_timeout");
178
+ try {
179
+ const input = await readJsonBody(req, { maxBodyBytes: 256 * 1024, maxDecodedBodyBytes: 256 * 1024, signal: abort.signal });
180
+ abort.clearTimeout();const result = await connectionsFn(input);if (!res.destroyed && !res.writableEnded) sendJson(res, 200, result);
181
+ } catch (error) { sendJson(res, error.statusCode || 400, { error: /^ccdx_[a-z0-9_]+$/.test(error.code || "") ? error.code : "ccdx_connections_action_failed" }); }
182
+ finally { abort.cleanup(); }return;
183
+ }
184
+
170
185
  if (pathname === PROVIDERS_PATH && req.method === "GET") {
171
186
  try { sendJson(res, 200, { source: "provider_status", providers: dashboardProviders(providerStateFn, authStatusFn) }); }
172
187
  catch { sendJson(res, 500, { error: "Could not read provider status" }); }
@@ -290,13 +305,13 @@ export async function handleDashboardApi(req, res, pathname, {
290
305
  }
291
306
  const models = catalog.models;
292
307
  sendJson(res, 200, {
293
- source: catalog.source === "catalog" ? "catalog" : "live",
294
- checked_at: catalog.source === "catalog" ? catalog.checkedAt : new Date().toISOString(),
308
+ source: ["catalog", "configured"].includes(catalog.source) ? catalog.source : "live",
309
+ checked_at: ["catalog", "configured"].includes(catalog.source) ? catalog.checkedAt : new Date().toISOString(),
295
310
  upstream_host: safeText(catalog?.upstreamHost || "GitHub Copilot", 120),
296
311
  advertised: finite(catalog?.advertised),
297
312
  selectable: models.filter(model => model.selectable !== false).length,
298
313
  models: models.slice(0, 500).map((model) => ({
299
- id: safeText(model.id, 100),
314
+ id: safeText(model.id, 160),
300
315
  vendor: safeText(model.vendor, 80),
301
316
  endpoints: Array.isArray(model.endpoints) ? model.endpoints.filter((value) => ["responses", "chat", "messages"].includes(value)) : [],
302
317
  preview: model.preview === true,