codex-copilot-dx 1.2.23 → 1.2.25

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,8 @@ import { accessSettingsPath, readAccessSettings, updateAccessSettings, checkedAp
4
4
  import { createApiSecretStore, checkedApiKey } from "./api-secrets.mjs";
5
5
  import { createApiCatalogRefresh } from "./api-catalog-refresh.mjs";
6
6
  import { createApiProvider } from "./providers/api.mjs";
7
+ import { createApiModelDisplayStore } from "./api-model-display.mjs";
8
+ import { createCodexMemoryModel } from "./codex-memory-model.mjs";
7
9
  import { readClientGatewayKeys, gatewayClient } from "./client-gateway-keys.mjs";
8
10
  import { createClaudeGatewayHandler } from "./claude-gateway.mjs";
9
11
  import { configureClaudeClients, restoreClaudeClients, inspectClaudeDesktopPolicy } from "./claude-client-config.mjs";
@@ -21,12 +23,14 @@ const validObject = (value, keys) => value && typeof value === "object" && !Arra
21
23
  export function createConnectionRuntime({ legacy, home, env = process.env, platform = process.platform, corePort = 2026,
22
24
  secretStore, createApi = createApiProvider, configureClaude = configureClaudeClients, restoreClaude = restoreClaudeClients,
23
25
  configureCodex = configureCodexApi, inspectDesktop = inspectClaudeDesktopPolicy, clientAccessChanged, preserveClientConfiguration, now = Date.now, log = () => {} } = {}) {
24
- const options = { home, env, platform, preserveClientConfiguration }, secrets = secretStore || createApiSecretStore(options);
26
+ const options = { home, env, platform, preserveClientConfiguration }, secrets = secretStore || createApiSecretStore(options), modelDisplay = createApiModelDisplayStore(options);
25
27
  const guardConversation = createConversationSourceGuard(options), acquireClaudeRequest = createRequestAdmission({ maxBytes: 16 * 1024 * 1024, maxQueued: 8 });
28
+ const memoryModel = createCodexMemoryModel({ ...options, corePort });
26
29
  let settings = readAccessSettings(options), managed = fs.existsSync(accessSettingsPath(options)), serial = Promise.resolve(), keys, closed = false;
27
30
  const instances = new Map(), active = new Map(), retired = new Set(), handlers = new Map(), summaries = new WeakMap(), sourceSecrets = new WeakMap(), setup = {}, lastClients = {};
28
31
  const retiredSecrets = new Map(), cleanups = new Set(), plans = new Map(), discoveries = new Map();
29
32
  const catalogRefresh = createApiCatalogRefresh({ config: id => settings.apis.find(api => api.id === id), source: getSource, track,
33
+ complete: api => modelDisplay.has(api.id, deploymentRevision(api, env)),
30
34
  revision: api => deploymentRevision(api, env), now,
31
35
  commit: (...args) => enqueue(() => applyCatalog(...args)),
32
36
  onState: (id, state) => state ? discoveries.set(id, state) : discoveries.delete(id) });
@@ -46,8 +50,16 @@ export function createConnectionRuntime({ legacy, home, env = process.env, platf
46
50
  const binding = id => managed ? settings.clients[id] : { ...settings.clients[id], source: id === "codex" ? legacy.selection().codex : legacy.snapshot().m365.enabled ? "m365" : null };
47
51
  // GitHub-only selections retain the existing native loopback access contract.
48
52
  // Any other deployment still requires the private per-client credential.
49
- const codexRequiresKey = () => !Array.isArray(binding("codex").deployments)
50
- || !binding("codex").deployments.length || binding("codex").deployments.some(item => item.source !== "github");
53
+ function codexAccessMode() {
54
+ const client = binding("codex");
55
+ if (!client.enabled) return "disabled";
56
+ if (Array.isArray(client.deployments)) {
57
+ if (!client.deployments.length) return "paused";
58
+ return client.deployments.every(item => item.source === "github") ? "native" : "gateway";
59
+ }
60
+ return !client.source ? "paused" : client.source === "github" ? "native" : "gateway";
61
+ }
62
+ const codexRequiresKey = () => codexAccessMode() === "gateway";
51
63
  function requireCodexKey(req) {
52
64
  if (gatewayClient(req.headers, identities()) === "codex") return;
53
65
  // An old native process may still send its ChatGPT bearer. A local access
@@ -61,7 +73,7 @@ export function createConnectionRuntime({ legacy, home, env = process.env, platf
61
73
  const previous = instances.get(id), revision = deploymentRevision(config, env);if (previous?.config === config && previous.revision === revision) return previous.source;
62
74
  const signature = JSON.stringify(config) + revision;
63
75
  if (previous?.signature === signature) return previous.source;
64
- const source = createApi({ config, secrets, env: { ...env }, platform });instances.set(id, { signature, source, config, revision });sourceSecrets.set(source, config.secret_ref);
76
+ const source = createApi({ config, secrets, env: { ...env }, platform, modelDisplay: model => modelDisplay.get(id, revision, model) });instances.set(id, { signature, source, config, revision });sourceSecrets.set(source, config.secret_ref);
65
77
  if (previous) retire(previous.source);return source;
66
78
  }
67
79
  function plan(id) {
@@ -121,9 +133,11 @@ export function createConnectionRuntime({ legacy, home, env = process.env, platf
121
133
  return structuredClone({ source: "connections", providers: [
122
134
  { id: "github", name: "GitHub Copilot", enabled: config.providers.github, builtin: true, protocols: ["responses"] },
123
135
  { id: "m365", name: "Microsoft 365", enabled: config.providers.m365, builtin: true, protocols: ["messages", "responses"] },
124
- ...config.apis.map(api => { const { secret_ref, ...publicApi } = api;return { ...(compact ? { id: api.id, name: api.name, enabled: api.enabled } : publicApi),
125
- ...summary(api), ...(compact ? {} : { deployment_revision: deploymentRevision(api, env) }), discovery: discoveries.get(api.id) || null, builtin: false, key_saved: api.key_env ? Boolean(env[api.key_env]) : Boolean(secret_ref) }; }),
136
+ ...config.apis.map(api => { const { secret_ref, ...publicApi } = api, revision = compact ? null : deploymentRevision(api, env);return { ...(compact ? { id: api.id, name: api.name, enabled: api.enabled } : publicApi),
137
+ ...summary(api), ...(compact ? {} : { deployment_revision: revision,
138
+ model_display: Object.fromEntries(api.models.map(model => [model.id, modelDisplay.get(api.id, revision, model.id)])) }), discovery: discoveries.get(api.id) || null, builtin: false, key_saved: api.key_env ? Boolean(env[api.key_env]) : Boolean(secret_ref) }; }),
126
139
  ], clients: CLIENT_IDS.map(id => ({ id, name: CLIENT_NAMES[id], ...config.clients[id], setup: setup[id] || null,
140
+ ...(id === "codex" ? { memory_model: memoryModel.snapshot() } : {}),
127
141
  observed_at: lastClients[id] || null, ...(compact ? {} : { model_plan: { default_model: plan(id).defaultModel, default_unavailable: plan(id).defaultUnavailable,
128
142
  models: plan(id).models.map(model => ({ source: model.source_id, id: model.id, public_id: model.public_id, route_id: model.route_id, capability: model.capability })),
129
143
  unavailable: (config.clients[id].deployments || []).filter(item => !plan(id).models.some(model => model.source_id === item.source && model.id === item.model))
@@ -141,9 +155,12 @@ export function createConnectionRuntime({ legacy, home, env = process.env, platf
141
155
  if (!managed || closed) return;
142
156
  if (options.preserveClientConfiguration?.()) { for (const id of targets) setup[id] = "preserved";return; }
143
157
  const codex = binding("codex"), compiledCodex = plan("codex");
144
- const explicit = Array.isArray(codex.deployments), native = explicit ? codex.deployments.length > 0 && codex.deployments.every(item => item.source === "github") : codex.source === "github";
158
+ const explicit = Array.isArray(codex.deployments), mode = codexAccessMode(), native = mode === "native";
145
159
  if (targets.has("codex")) try {
146
- if (codex.enabled && codex.auto_sync === false) setup.codex = "manual_sync";
160
+ if (mode === "paused" || mode === "disabled") {
161
+ if (mode === "disabled" || codex.auto_sync !== false) configureCodex({ ...options, restore: true });
162
+ setup.codex = mode;
163
+ } else if (codex.auto_sync === false) setup.codex = "manual_sync";
147
164
  else if (codex.enabled && compiledCodex.defaultUnavailable && !native) setup.codex = "default_unavailable";
148
165
  else {
149
166
  setup.codex = configureCodex({ ...options, ...(codex.enabled && (native || explicit && codex.deployments.length || codex.source?.startsWith("api_"))
@@ -194,6 +211,7 @@ export function createConnectionRuntime({ legacy, home, env = process.env, platf
194
211
  const next = editable(), current = next.apis.find(api => api.id === id);
195
212
  if (!current?.enabled || deploymentRevision(current, env) !== revision) throw accessError("ccdx_connections_conflict", 409);
196
213
  const byId = new Map(models.map(model => [model.id, model]));
214
+ try { modelDisplay.set(id, revision, models); } catch { log("warn", "Model maker metadata could not be saved; routing is unchanged"); }
197
215
  for (const model of current.models) if (byId.get(model.id)?.metadata) model.metadata = byId.get(model.id).metadata;
198
216
  current.checked_at = checkedAt;
199
217
  if (JSON.stringify(current) !== JSON.stringify(settings.apis.find(api => api.id === id))) {
@@ -209,7 +227,14 @@ export function createConnectionRuntime({ legacy, home, env = process.env, platf
209
227
  if (input.operation === "save_api") {
210
228
  const existing = next.apis.find(api => api.id === input.id);
211
229
  if (!existing && next.apis.length >= 16) throw accessError("ccdx_api_limit");
212
- if (!validObject(input.config, ["name", "base_url", "endpoints", "auth_header", "models", "key_env"])) throw accessError("ccdx_api_config_invalid");
230
+ if (!validObject(input.config, ["name", "base_url", "endpoints", "auth_header", "models", "key_env", "model_display"])) throw accessError("ccdx_api_config_invalid");
231
+ // Existing clients round-trip catalog data. New display-only fields must
232
+ // remain readable without becoming editable connection configuration.
233
+ const { model_display, ...editableConfig } = input.config;
234
+ input = { ...input, config: { ...editableConfig, models: Array.isArray(editableConfig.models) ? editableConfig.models.map(model => {
235
+ if (!model || typeof model !== "object" || Array.isArray(model)) return model;
236
+ const { display, ...editable } = model;return editable;
237
+ }) : editableConfig.models } };
213
238
  const id = existing?.id || "api_" + randomBytes(8).toString("hex");
214
239
  if (input.key !== undefined && input.key !== "") { checkedApiKey(input.key);freshRef = randomBytes(16).toString("hex"); }
215
240
  if (input.config.key_env && freshRef || !input.config.key_env && !freshRef && !existing?.secret_ref) throw accessError("ccdx_api_key_invalid");
@@ -336,7 +361,7 @@ export function createConnectionRuntime({ legacy, home, env = process.env, platf
336
361
  busy: () => operations > 0 || active.size > 0 || Boolean(syncFlight) || catalogRefresh.busy() || legacy.snapshot().m365.account_change_in_flight === true || legacy.snapshot().m365.state === "checking",
337
362
  syncClients,
338
363
  async manageConnections(input) {
339
- if (!input) return snapshot();
364
+ if (!input) { if (binding("codex").enabled) void memoryModel.refresh();return snapshot(); }
340
365
  if (validObject(input, ["operation", "id"]) && input.operation === "discover") {
341
366
  const models = await catalogRefresh.refresh(input.id, true);return { ...snapshot(), discovered: models };
342
367
  }
@@ -348,7 +373,7 @@ export function createConnectionRuntime({ legacy, home, env = process.env, platf
348
373
  } else if (input.operation === "provider" && input.enabled && input.id?.startsWith("api_")) void catalogRefresh.refresh(input.id).catch(() => {});
349
374
  return input.operation === "save_api" ? snapshot() : result;
350
375
  },
351
- async start() { const old = legacy.start();if (managed) await syncClients();const result = await old;if (managed) await syncClients();void refreshApis();return result; },
376
+ async start() { if (binding("codex").enabled) void memoryModel.refresh();const old = legacy.start();if (managed) await syncClients();const result = await old;if (managed) await syncClients();void refreshApis();return result; },
352
377
  async refresh() { const result = await Promise.allSettled([!managed || settings.providers.m365 ? legacy.refresh() : Promise.resolve(), refreshApis()]);if (result[0].status === "rejected") throw result[0].reason; },
353
378
  selection() { return { ...legacy.selection(), codex: binding("codex").enabled ? binding("codex").source : null }; },
354
379
  providerPreference(id) {
@@ -373,9 +398,10 @@ export function createConnectionRuntime({ legacy, home, env = process.env, platf
373
398
  },
374
399
  current(req) {
375
400
  if (!managed) return legacy.current();
401
+ const mode = codexAccessMode();
402
+ if (mode === "paused" || mode === "disabled") throw accessError("ccdx_client_source_disabled", 503);
376
403
  const c = binding("codex"), compiled = plan("codex");
377
404
  if (Array.isArray(c.deployments) && req?.method === "GET") {
378
- if (!c.enabled) throw accessError("ccdx_client_source_disabled", 503);
379
405
  if (codexRequiresKey()) requireCodexKey(req);
380
406
  return { id: "connections", registry: { models: { data: compiled.models.map(model => ({ ...model, id: model.public_id })) } },
381
407
  client: { listModels: async () => ({ status: 200, body: JSON.stringify({ data: compiled.models.map(model => ({ ...model, id: model.public_id })) }) }) },
@@ -393,7 +419,10 @@ export function createConnectionRuntime({ legacy, home, env = process.env, platf
393
419
  },
394
420
  hasModelBindings(client = "codex") { return managed && Array.isArray(binding(client).deployments); },
395
421
  resolveCodex(body, req) {
396
- if (!managed || !Array.isArray(binding("codex").deployments)) return null;
422
+ if (!managed) return null;
423
+ const mode = codexAccessMode();
424
+ if (mode === "paused" || mode === "disabled") throw accessError("ccdx_client_source_disabled", 503);
425
+ if (!Array.isArray(binding("codex").deployments)) return null;
397
426
  if (codexRequiresKey()) requireCodexKey(req);
398
427
  const requested = body.model === "codex-auto-review" ? binding("codex").auto_review_model || plan("codex").defaultModel : body.model;
399
428
  if (body.model === "codex-auto-review") {
@@ -492,6 +521,6 @@ export function createConnectionRuntime({ legacy, home, env = process.env, platf
492
521
  if (managed && input.action === "switch") { const next = editable();if (next.clients.codex.source !== input.provider) next.clients.codex.history_isolation = true;next.clients.codex.source = input.provider;next.clients.codex.deployments = null;next.clients.codex.default_model = null;for (const key of ["model", "auto_review_model", "auto_review_effort"]) delete next.clients.codex[key];if (input.provider === "m365") Object.assign(next.clients.codex, legacy.selection().m365);save(next);await syncClients(); }
493
522
  return result;
494
523
  },
495
- async close() { closed = true;await catalogRefresh.close();await serial;await syncFlight;for (const { source } of instances.values()) source.close();for (const source of retired) source.close();active.clear();for (const id of retiredSecrets.keys()) cleanSecrets(id);await Promise.allSettled([...cleanups]);secrets.close();await legacy.close(); },
524
+ async close() { closed = true;await memoryModel.close();await catalogRefresh.close();await serial;await syncFlight;for (const { source } of instances.values()) source.close();for (const source of retired) source.close();active.clear();for (const id of retiredSecrets.keys()) cleanSecrets(id);await Promise.allSettled([...cleanups]);secrets.close();await legacy.close(); },
496
525
  };
497
526
  }
@@ -3,6 +3,7 @@
3
3
  const words = (node, key, args) => globalThis.ccdxLanguage.set(node, key, args), format = key => globalThis.ccdxLanguage.format(key);
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
+ let memoryAction = null, memoryOrigin = null;
6
7
  const drafts = new Map();let editorOrigin = null, discovery = null, desiredSource = null;
7
8
  const apiForm = el("connection-api-form"), clientForm = el("connection-client-form");
8
9
  const node = (tag, text, className) => { const item = document.createElement(tag);if (text !== undefined) item.textContent = text;if (className) item.className = className;return item; };
@@ -112,6 +113,12 @@
112
113
  const protocol = choice(model.protocols.map(id => ({ id, name: id === "messages" ? "Messages" : id === "responses" ? "Responses" : "Chat" })), model.protocols.includes("messages") ? "messages" : model.protocols[0], false);
113
114
  protocol.setAttribute("aria-label", format("cap_api"));detail.append(protocol);
114
115
  const status = node("p", undefined, "hint"), table = node("table"), body = node("tbody");table.append(body);detail.append(status, table);
116
+ const maker = model.display || source(editing)?.model_display?.[model.id] || {};
117
+ const identity = node("dl", undefined, "model-identity");
118
+ for (const [label, value] of [["vendor", maker.publisher || maker.vendor || format("cap_unknown")], ["model_owner", maker.owned_by]]) {
119
+ if (!value) continue;const term = node("dt");words(term, label);identity.append(term, node("dd", value));
120
+ }
121
+ detail.insertBefore(identity, protocol);
115
122
  const advanced = node("details"), summary = node("summary");words(summary, "cap_manual");advanced.append(summary);detail.append(advanced);
116
123
  const note = node("p", undefined, "hint");words(note, "cap_metadata_scope");advanced.append(note);
117
124
  const fields = node("div", undefined, "connection-fields");
@@ -177,6 +184,8 @@
177
184
  tr.dataset.model = model.id;
178
185
  const selection = check("selected-model", model.id, selectedModels.has(model.id), model.id);
179
186
  selection.firstChild.addEventListener("change", e => { if (e.target.checked) selectedModels.add(model.id);else selectedModels.delete(model.id); });name.append(selection);
187
+ const maker = model.display || source(editing)?.model_display?.[model.id];
188
+ if (maker?.publisher || maker?.vendor) name.append(node("span", maker.publisher || maker.vendor, "model-maker"));
180
189
  for (const protocol of ["messages", "responses", "chat"]) {
181
190
  const label = check("model-api", protocol, model.protocols.includes(protocol), protocol === "chat" ? "Chat" : protocol === "messages" ? "Messages" : "Responses");
182
191
  label.firstChild.disabled = !apiForm.querySelector(`[name="protocol"][value="${protocol}"]`).checked;
@@ -212,7 +221,7 @@
212
221
  apiForm.elements.key_env.addEventListener("input", keyMode);
213
222
  apiForm.addEventListener("submit", e => {
214
223
  e.preventDefault();if (busy || !apiForm.reportValidity()) return;
215
- const chosenModels = models.filter(model => selectedModels.has(model.id));
224
+ const chosenModels = models.filter(model => selectedModels.has(model.id)).map(({ display, ...model }) => model);
216
225
  const invalid = chosenModels.find(model => !model.protocols.length);
217
226
  if (invalid) {
218
227
  message("api_model_protocol_required", { model: invalid.id });
@@ -242,11 +251,43 @@
242
251
  try {
243
252
  const result = await api({ operation: "discover", id: read.id }, read.controller.signal);if (discovery !== read || editing !== read.id) return;
244
253
  data = result;
245
- 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.metadata ? { metadata: model.metadata } : {}) } : model); }
254
+ 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); }
246
255
  models = [...known.values()].slice(0, 500);modelRows();message("api_models_read");
247
256
  } catch (error) { if (discovery === read) message(error.message); }
248
257
  finally { if (discovery === read) { discovery = null;trigger.disabled = false;trigger.removeAttribute("aria-busy");words(trigger, "api_read_models");el("connection-discover-cancel").hidden = true; } }
249
258
  });
259
+ function memoryMatches(item) {
260
+ const model = client("codex")?.memory_model?.model;
261
+ return Boolean(model && [item.id, item.model, item.route_id, item.public_id].includes(model));
262
+ }
263
+ function memoryRender() {
264
+ const area = el("connection-memory-model");if (!area || !data) return;
265
+ area.hidden = editingClient !== "codex";if (area.hidden) return;
266
+ const c = client("codex"), dep = c.memory_model || {};
267
+ el("connection-memory-name").textContent = dep.model || format(dep.enabled === true ? "memory_codex_default" : dep.enabled === false ? "memory_generation_off" : "memory_not_detected");
268
+ words(el("connection-memory-basis"), dep.model ? `memory_basis_${dep.basis}` : dep.enabled === true ? "memory_default_unknown" : "");
269
+ const selected = (c.deployments || c.model_plan?.models || []).some(memoryMatches);
270
+ const draft = dep.model && [...bindingSelection].some(key => {
271
+ const [source, id] = key.split("\0");return memoryMatches({ id, route_id: c.model_plan?.available?.find(x => x.source === source && x.id === id)?.route_id });
272
+ });
273
+ const pending = bindingDirty && Boolean(draft) !== selected;
274
+ const label = !dep.model ? "memory_not_detected" : dep.enabled === false ? "memory_generation_off" : pending ? draft ? "memory_pending_on" : "memory_pending_off" : selected ? "memory_model_on" : "memory_model_off";
275
+ const state = el("connection-memory-state");state.hidden = !dep.model;
276
+ if (globalThis.ccdxIcons) globalThis.ccdxIcons.set(state, label, dep.enabled === false ? "unavailable" : !selected || pending && !draft ? "warning" : "ok");else words(state, label);
277
+ const warning = el("connection-memory-warning");warning.hidden = !dep.model || dep.enabled === false || selected && !pending;
278
+ words(warning, selected && pending && !draft ? "memory_pending_warning" : "memory_off_warning");
279
+ }
280
+ function confirmMemory(action) {
281
+ memoryAction = action;memoryOrigin = document.activeElement;
282
+ el("connection-memory-confirm").showModal();el("connection-memory-keep").focus();
283
+ }
284
+ function closeMemory(confirm) {
285
+ const action = memoryAction;memoryAction = null;el("connection-memory-confirm").close();
286
+ if (confirm) action?.();else if (memoryOrigin?.isConnected) memoryOrigin.focus();
287
+ }
288
+ el("connection-memory-keep").addEventListener("click", () => closeMemory(false));
289
+ el("connection-memory-close").addEventListener("click", () => closeMemory(true));
290
+ el("connection-memory-confirm").addEventListener("cancel", () => { memoryAction = null; });
250
291
  const bindingKey = (source, model) => source + "\0" + model;
251
292
  const routeId = item => item.route_id || item.public_id;
252
293
  function rememberDraft() {
@@ -271,6 +312,7 @@
271
312
  bindingRows(document.activeElement?.name === "binding-model" ? { kind: "selection", key: document.activeElement.value } : document.activeElement?.dataset.binding ? { kind: "default", key: document.activeElement.dataset.binding } : null);words(el("connection-client-title"), "cap_visible_model");list();
272
313
  }
273
314
  function bindingRows(focus) {
315
+ memoryRender();
274
316
  el("connection-client-cancel").disabled = !bindingDirty;
275
317
  const body = el("connection-bindings"), c = client(editingClient);body.replaceChildren();
276
318
  const available = c.model_plan?.available || [], availableKeys = new Set(available.map(item => bindingKey(item.source, item.id)));
@@ -279,10 +321,16 @@
279
321
  const key = bindingKey(item.source, item.id), row = node("tr"), name = node("td"), capability = item.capability?.values || {};
280
322
  const selection = check("binding-model", key, bindingSelection.has(key), item.id);
281
323
  selection.firstChild.addEventListener("change", event => {
282
- bindingDirty = true;if (event.target.checked) { bindingSelection.add(key);bindingDefault ||= routeId(item); }
283
- else { bindingSelection.delete(key);if (bindingDefault === routeId(item) || !bindingSelection.size) bindingDefault = null; }
284
- rememberDraft();bindingRows({ kind: "selection", key });
324
+ const checked = event.target.checked;
325
+ const apply = () => {
326
+ bindingDirty = true;if (checked) { bindingSelection.add(key);bindingDefault ||= routeId(item); }
327
+ else { bindingSelection.delete(key);if (bindingDefault === routeId(item) || !bindingSelection.size) bindingDefault = null; }
328
+ rememberDraft();bindingRows({ kind: "selection", key });
329
+ };
330
+ if (!checked && editingClient === "codex" && client("codex").memory_model?.enabled !== false && memoryMatches(item)) { event.target.checked = true;confirmMemory(apply); }
331
+ else apply();
285
332
  });name.append(selection);
333
+ if (editingClient === "codex" && memoryMatches(item)) { const badge = node("span", undefined, "memory-model-badge");words(badge, "memory_extract_role");name.append(badge); }
286
334
  const action = button(bindingDefault === routeId(item) && bindingSelection.has(key) ? "cap_default" : "cap_set_default", () => { bindingDirty = true;bindingSelection.add(key);bindingDefault = routeId(item);rememberDraft();bindingRows({ kind: "default", key }); });
287
335
  action.setAttribute("aria-pressed", String(bindingDefault === routeId(item) && bindingSelection.has(key)));
288
336
  action.dataset.binding = key;action.disabled = Boolean(item.unavailable);action.setAttribute("aria-label", item.id + " · " + format(bindingDefault === routeId(item) ? "cap_default" : "cap_set_default"));
@@ -313,7 +361,11 @@
313
361
  }
314
362
  clientForm.addEventListener("submit", event => { event.preventDefault();void change(bindingInput("client")); });
315
363
  el("connection-sync-preview").addEventListener("click", () => void change(bindingInput("preview_client"), result => syncPreview(result.preview)));
316
- function disableSource(provider) {
364
+ function disableSource(provider, confirmed = false) {
365
+ const c = client("codex");
366
+ if (!confirmed && c?.enabled && c.memory_model?.enabled !== false && c.model_plan?.models.some(item => item.source === provider.id && memoryMatches(item))) {
367
+ confirmMemory(() => disableSource(provider, true));return;
368
+ }
317
369
  const affected = data.clients.filter(c => c.enabled && c.source === provider.id);
318
370
  if (!affected.length) { void change({ operation: "provider", id: provider.id, enabled: false });return; }
319
371
  disabling = provider.id;panels("disable");const area = el("connection-replacements");area.replaceChildren();
@@ -323,12 +375,14 @@
323
375
  replacements: Object.fromEntries([...el("connection-replacements").querySelectorAll("select")].map(select => [select.name, select.value || null])) }); });
324
376
  el("connection-add").addEventListener("click", () => { if (data) editApi(); });
325
377
  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(); });
378
+ el("refresh").addEventListener("click", () => { if (["#models", "#codex", "#claude"].includes(location.hash)) void load(); });
326
379
  window.addEventListener("hashchange", () => { apiForm.elements.key.value = "";mountClient();if (["#models", "#claude", "#codex"].includes(location.hash)) void load(); });
327
380
  window.addEventListener("ccdx:choose-source", event => { if (typeof event.detail?.id === "string" && providerEntries.some(p => p.id === event.detail.id)) chooseProvider(event.detail.id); });
328
381
  window.addEventListener("ccdx:source-view", () => { if (data) list(); });
329
382
  window.addEventListener("ccdx:providers", () => { if (desiredSource && providerEntries.some(p => p.id === desiredSource)) { const id = desiredSource;desiredSource = null;chooseProvider(id); }if (data) list(); });
330
383
  new MutationObserver(() => { if (data) list(); }).observe(document.documentElement, { attributes: true, attributeFilter: ["lang"] });
331
- globalThis.ccdxConnections = { load, editClient: id => { if (data && client(id)) { editClient(client(id)); } } };
384
+ globalThis.ccdxConnections = { load,
385
+ updateMemory(snapshot) { const c = snapshot?.clients?.find(c => c.id === "codex");if (data && c?.memory_model) { client("codex").memory_model = c.memory_model;memoryRender(); } }, editClient: id => { if (data && client(id)) { editClient(client(id)); } } };
332
386
  for (const button of document.querySelectorAll("[data-client-access]")) button.addEventListener("click", () => globalThis.ccdxConnections.editClient(button.dataset.clientAccess));
333
387
  void load();
334
388
  })();
@@ -7,6 +7,7 @@
7
7
  const format = (key, values = {}) => globalThis.ccdxLanguage.format(key, values);
8
8
  const nodes = { apps: new Map(), models: new Map() };
9
9
  const detailRows = new Map();
10
+ const movingWires = new Map();
10
11
  let rows = [], total = null, omitted = 0, fresh = false, deadline = 0, expiry = null;
11
12
  let selected = null, expanded = false, lastSignature = "", geometry = "", wireState = "", positions = null, known = false;
12
13
  let lastApps = [], lastModels = [];
@@ -150,22 +151,25 @@
150
151
  const matches = rows.filter(row => (edge.left ? row.application : modelKey(row)) === edge.id && related(row));
151
152
  return { active: fresh && matches.length > 0, moving: fresh && matches.some(responding), dim: edge.node.dataset.related === "false" };
152
153
  });
153
- const state = JSON.stringify(states), wires = el("flow-wires");
154
+ const state = JSON.stringify(states), wires = el("flow-wires"), activity = el("flow-active-wires");
154
155
  if (next === geometry && state === wireState) return;
155
156
  if (next !== geometry) {
156
157
  geometry = next;wires.setAttribute("viewBox", `0 0 ${width} ${height}`);wires.replaceChildren();
157
- for (const edge of edges) wires.append(svg("path", { d: edge.d }), svg("circle", { r: 2.4 }));
158
+ activity.setAttribute("viewBox", `0 0 ${width} ${height}`);activity.replaceChildren();movingWires.clear();
159
+ for (const edge of edges) wires.append(svg("path", { d: edge.d }));
158
160
  }
159
161
  wireState = state;
160
162
  edges.forEach((edge, index) => {
161
- const value = states[index], path = wires.children[index * 2], dot = wires.children[index * 2 + 1];
162
- path.setAttribute("class", `flow-wire${value.dim ? " flow-dim" : value.active ? " flow-live" : ""}`);
163
- dot.setAttribute("class", value.moving ? "flow-packet" : "flow-wait");
164
- dot.style.display = value.active ? "" : "none";
165
- dot.style.offsetPath = value.moving ? `path('${edge.d}')` : "none";
166
- dot.style.animationDelay = edge.left ? "-.9s" : "0s";
167
- dot.setAttribute("cx", value.moving ? 0 : edge.x);dot.setAttribute("cy", value.moving ? 0 : edge.y);
163
+ const value = states[index], path = wires.children[index];
164
+ const classes = `flow-wire${value.dim ? " flow-dim" : value.active ? " flow-live" : ""}${value.moving ? " flow-streaming" : value.active ? " flow-waiting" : ""}`;
165
+ path.setAttribute("class", classes + (value.moving ? " flow-split" : ""));
166
+ let copy = movingWires.get(path);
167
+ if (value.moving) {
168
+ if (!copy) { copy = svg("path", { d: edge.d });activity.append(copy);movingWires.set(path, copy); }
169
+ copy.setAttribute("class", classes);
170
+ } else if (copy) { copy.remove();movingWires.delete(path); }
168
171
  });
172
+ if (movingWires.size) activity.removeAttribute("hidden");else activity.setAttribute("hidden", "");
169
173
  }
170
174
  function unavailable() { clearTimeout(expiry);expiry = null;fresh = false;deadline = 0;render(); }
171
175
  function visibilityChanged() { if (deadline && Date.now() >= deadline) { unavailable();return; }render();draw(); }
@@ -18,7 +18,7 @@
18
18
  }
19
19
  const kind = value => ["running", "active"].includes(value) ? "running"
20
20
  : ["ready", "authorized", "configured", "saved", "passed", "ok", "completed"].includes(value) ? "ok"
21
- : ["unavailable", "disabled", "unsupported", "not_installed", "unconfigured"].includes(value) ? "unavailable"
21
+ : ["unavailable", "disabled", "paused", "unsupported", "not_installed", "unconfigured"].includes(value) ? "unavailable"
22
22
  : ["warn", "err", "invalid", "failed", "configuration_unavailable"].includes(value) ? "warning" : "unknown";
23
23
  globalThis.ccdxIcons = { icon, set, kind };
24
24
  })();
@@ -72,6 +72,10 @@
72
72
  <section class="panel dashboard-section" id="connection-client-editor" hidden aria-labelledby="connection-client-title">
73
73
  <div class="panel-heading"><h2 id="connection-client-title"></h2><span id="connection-draft-state" class="hint"></span></div>
74
74
  <form id="connection-client-form">
75
+ <div id="connection-memory-model" hidden>
76
+ <div class="memory-model-row"><span data-i18n="memory_extract_model">Memory extraction model</span><div class="memory-model-value"><strong id="connection-memory-name">—</strong><span id="connection-memory-basis" class="hint"></span><span id="connection-memory-state"></span></div></div>
77
+ <p id="connection-memory-warning" class="memory-model-notice" role="status" hidden></p>
78
+ </div>
75
79
  <p id="connection-default-note" class="hint" role="status" hidden></p>
76
80
  <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>
77
81
  <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>
@@ -307,6 +311,7 @@
307
311
  <div class="panel-heading"><h2 data-i18n="request_flow">REQUEST FLOW</h2><span id="flow-state" role="status" aria-live="polite" data-i18n="flow_status_unknown">Status unavailable</span></div>
308
312
  <div id="flow-network" class="flow-network" role="group" data-i18n-label="request_flow" aria-label="Request flow">
309
313
  <svg id="flow-wires" class="flow-wires" aria-hidden="true"></svg>
314
+ <svg id="flow-active-wires" class="flow-wires flow-activity" aria-hidden="true" hidden></svg>
310
315
  <div class="flow-column"><p class="flow-column-title" data-i18n="clients">Apps</p><div id="flow-apps" class="flow-apps"></div></div>
311
316
  <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>
312
317
  <div class="flow-column"><p class="flow-column-title" data-i18n="flow_sources_models">Sources / models</p><div id="flow-models"></div></div>
@@ -414,5 +419,6 @@
414
419
  </main>
415
420
  <footer data-i18n="local_only_visible_page_updates">THIS COMPUTER ONLY / UPDATES WHILE VISIBLE</footer>
416
421
  </div>
422
+ <dialog id="connection-memory-confirm" class="memory-confirm" aria-labelledby="connection-memory-confirm-title"><h2 id="connection-memory-confirm-title" data-i18n="memory_close_title">Turn off the memory extraction model?</h2><p data-i18n="memory_close_body">Codex uses this model to extract new memories. Turning it off may prevent new memory generation.</p><p class="hint" data-i18n="memory_existing_kept">Existing memories will not be deleted.</p><div class="section-actions"><button type="button" id="connection-memory-keep" data-i18n="memory_keep_enabled">Keep enabled</button><button type="button" id="connection-memory-close" data-i18n="memory_close_anyway">Turn off anyway</button></div></dialog>
417
423
  </body>
418
424
  </html>
@@ -1,10 +1,40 @@
1
1
  (() => {
2
2
  const translations = {
3
+ "request_access_blocked": ["Access blocked", "请求已拦截"],
4
+ "access_paused": ["Access paused", "接入已暂停"],
5
+ "not_applicable": ["Not applicable", "不适用"],
6
+ "model_owner": ["Model owner", "模型归属"],
7
+ "memory_extract_model": ["Memory extraction model", "记忆提取模型"],
8
+ "memory_extract_role": ["Memory extraction", "记忆提取"],
9
+ "memory_not_detected": ["Not detected", "未检测到"],
10
+ "memory_codex_default": ["Chosen by Codex", "由 Codex 选择"],
11
+ "memory_default_unknown": ["Default model ID not available.", "尚未取得默认型号。"],
12
+ "memory_basis_configured": ["Configured in Codex", "Codex 已配置"],
13
+ "memory_basis_observed": ["Recently observed", "最近检测到"],
14
+ "memory_model_on": ["Enabled", "已启用"],
15
+ "memory_model_off": ["Not selected", "未选入"],
16
+ "memory_generation_off": ["Memory generation is off", "记忆生成已关闭"],
17
+ "memory_pending_on": ["Enabled after saving", "启用待保存"],
18
+ "memory_pending_off": ["Disabled after saving", "关闭待保存"],
19
+ "memory_off_warning": ["The memory extraction model is not enabled. New memory generation may be affected.", "记忆提取模型未启用,新记忆生成可能受影响。"],
20
+ "memory_pending_warning": ["Saving disables the memory extraction model. New memory generation may be affected.", "保存后将关闭记忆提取模型,新记忆生成可能受影响。"],
21
+ "memory_close_title": ["Turn off the memory extraction model?", "关闭记忆提取模型?"],
22
+ "memory_close_body": ["Codex uses this model to extract new memories. Turning it off may prevent new memory generation.", "Codex 使用此模型提取新记忆。关闭后,可能无法生成新记忆。"],
23
+ "memory_existing_kept": ["Existing memories will not be deleted.", "已有记忆不会因此删除。"],
24
+ "memory_keep_enabled": ["Keep enabled", "保留启用"],
25
+ "memory_close_anyway": ["Turn off anyway", "仍然关闭"],
26
+ "output_requested": ["Requested output budget", "请求输出预算"],
27
+ "output_sent": ["Forwarded output budget", "转发输出预算"],
28
+ "output_used": ["Returned output tokens", "返回输出用量"],
29
+ "stop_reason": ["Stop reason", "停止原因"],
30
+ "transport": ["Network details", "网络详情"],
31
+ "output_limit_reached": ["Output limit reached.", "本次生成达到输出上限。"],
32
+ "source_connection_failed": ["Connection to the model source failed.", "与模型来源的连接失败。"],
3
33
  "issue_category": ["Issue category", "问题分类"],
4
34
  "issue_replies": ["Reply issues", "回复问题"],
5
- "issue_capabilities": ["Capability notices", "能力提示"],
35
+ "issue_capabilities": ["Capabilities and access", "能力与访问"],
6
36
  "issue_connections": ["Connections and paths", "连接与路径"],
7
- "http_categories": ["Generation {inference} · Capabilities {capability} · Methods {protocol} · Paths {route} · Other {other}", "生成 {inference} · 能力 {capability} · 方法 {protocol} · 路径 {route} · 其他 {other}"],
37
+ "http_categories": ["Generation {inference} · Capabilities/access {capability} · Methods {protocol} · Paths {route} · Other {other}", "生成 {inference} · 能力/访问 {capability} · 方法 {protocol} · 路径 {route} · 其他 {other}"],
8
38
  "no_upstream_call": ["No upstream call", "未调用上游"],
9
39
  "repeated_issue": ["{detail} · {count} occurrences", "{detail} · 出现 {count} 次"],
10
40
  "reason": ["Reason", "具体原因"],
@@ -14,7 +44,7 @@
14
44
  "model_not_selected_message": ["This model is not selected for this app.", "此应用尚未选入该模型。"],
15
45
  "model_ambiguous_message": ["This model name matches multiple sources. Select its source-specific entry.", "模型同名,请选择明确来源。"],
16
46
  "model_catalog_unavailable_message": ["The selected model is not currently available in its source catalog.", "来源目录中暂时没有该模型。"],
17
- "client_source_disabled_message": ["This app or its model source is turned off.", "应用或模型来源已关闭。"],
47
+ "client_source_disabled_message": ["Access is paused. Enable the app and source, then select a model.", "接入已暂停。请启用应用和来源,并选择模型。"],
18
48
  "local_validation_message": ["The request was rejected locally before an upstream call.", "本机校验未通过,未调用上游。"],
19
49
  "count_endpoint_missing_message": ["The source's token-count endpoint returned HTTP 404. Message generation is separate.", "上游计数接口返回 404,回复另行处理。"],
20
50
  "nightly_update": ["Update overnight", "夜间自动更新"],
@@ -186,7 +216,7 @@
186
216
  "ccdx_source_in_use": ["Change the current source or pause its clients first.", "请先更换来源,或暂停相关客户端。"],
187
217
  "ccdx_source_busy": ["A previous M365 request is still running. Let it finish before disabling.", "旧的 M365 请求仍在运行,请结束后关闭。"],
188
218
  "ccdx_provider_environment_disabled": ["Microsoft 365 is disabled by CCDX_M365=0.", "Microsoft 365 已被环境设置关闭。"],
189
- "ccdx_client_source_disabled": ["The client or source is disabled. Review Settings.", "客户端或来源已关闭,请查看设置。"],
219
+ "ccdx_client_source_disabled": ["Access is paused. Enable the app and source, then select a model.", "接入已暂停。请启用应用和来源,并选择模型。"],
190
220
  "ccdx_client_source_mismatch": ["Save the selected source before changing its review model.", "请先保存来源,再修改审查模型。"],
191
221
  "ccdx_conversation_source_changed": ["This history belongs to another source or key. Start a new conversation.", "此历史属于其他来源或 Key,请新建对话。"],
192
222
  "ccdx_conversation_state_invalid": ["Conversation source records are unreadable. The existing file was kept.", "会话来源记录无法读取,原文件已保留。"],
@@ -1183,6 +1213,8 @@
1183
1213
  "This app or its model source is turned off.": "client_source_disabled_message",
1184
1214
  "The request was rejected locally before an upstream call.": "local_validation_message",
1185
1215
  "The source's token-count endpoint returned HTTP 404. Message generation is separate.": "count_endpoint_missing_message",
1216
+ "Output limit reached.": "output_limit_reached",
1217
+ "Connection to the model source failed.": "source_connection_failed",
1186
1218
  "HTTP request failed; original response was preserved.": "http_request_failed_original_response_was_preserved",
1187
1219
  "phase": "phase",
1188
1220
  "http_status": "http_status",
@@ -12,7 +12,7 @@
12
12
  function renderProviders(data) {
13
13
  const providers = data.providers || [];
14
14
  const states = { saved: "saved_locally", authorized: "authorized", disabled: "disabled", unavailable: "unavailable_ca184",
15
- unknown: "unknown", unconfigured: "not_configured", ready: "ready", checking: "checking", unsupported: "unsupported",
15
+ unknown: "unknown", paused: "access_paused", unconfigured: "not_configured", ready: "ready", checking: "checking", unsupported: "unsupported",
16
16
  configured: "configured", default_unavailable: "cap_default_unavailable", preserved: "existing_settings_kept", partially_preserved: "existing_settings_kept",
17
17
  restored: "settings_restored", not_installed: "not_installed", configuration_unavailable: "setup_unavailable", not_configured: "unknown", standby: "standby" };
18
18
  const auth = element("provider-auth"), clients = element("provider-clients"), requests = element("provider-requests"), claudeClients = element("claude-clients");
@@ -51,7 +51,7 @@
51
51
  }
52
52
  for (const entries of applications.values()) {
53
53
  const selected = entries.find(entry => entry.client.selected === true) || (entries.length === 1 ? entries[0] : null);
54
- const client = selected?.client || { name: entries[0].client.name, state: "unknown" };
54
+ const client = selected?.client || { name: entries[0].client.name, state: entries.every(entry => entry.client.state === "paused") ? "paused" : "unknown" };
55
55
  const row = tableRow([client.name, selected?.provider.name || "—", states[client.state] || "unknown",
56
56
  client.gateway || "—", time(client.last_request_at)], { labels: [2, 3] });
57
57
  if (client.reason) localize(row.children[2], "state_reason", { state: phrase(states[client.state] || "unknown"), reason: client.reason });
@@ -106,10 +106,10 @@
106
106
  const failures = [...grouped.values()].slice(-10);
107
107
  const recorded = new Set(failures.map((failure) => failure.request_id).filter(Boolean));
108
108
  for (const request of requests) {
109
- if (!request.failed || recorded.has(request.request_id)) continue;
109
+ if (!request.failed || request.outcome === "cancelled" || request.rejection_reason || recorded.has(request.request_id)) continue;
110
110
  failures.push({ at: request.at, model: request.model, request_id: request.request_id,
111
111
  event_type: `request.${request.outcome}`, code: request.origin, timeline: request,
112
- message: "Request ended without successful completion.", local_message: true, retried: request.upstream_attempts > 1 });
112
+ message: request.stop_reason === "max_tokens" ? "Output limit reached." : "Request ended without successful completion.", local_message: true, retried: request.upstream_attempts > 1 });
113
113
  }
114
114
  failures.sort((a, b) => (Date.parse(a.at) || 0) - (Date.parse(b.at) || 0));
115
115
  failures.splice(0, Math.max(0, failures.length - 10));
@@ -123,6 +123,7 @@
123
123
  return;
124
124
  }
125
125
  for (const failure of failures) {
126
+ const notModelRequest = ["not_found", "image_mcp", "models", "claude_models"].includes(failure.route);
126
127
  const item = document.createElement("li");
127
128
  const details = document.createElement("details");
128
129
  details.dataset.key = `${failure.at}/${failure.request_id || failure.response_id}/${failure.code}`;
@@ -131,7 +132,7 @@
131
132
  const summary = {
132
133
  detail: phrase("time_model_code", {
133
134
  time: failure.at ? time(failure.at, { date: true }) : phrase("unknown_time"),
134
- model: failure.model ? String(failure.model).slice(0, 80) : phrase("unknown_model"),
135
+ model: notModelRequest ? phrase("not_applicable") : failure.model ? String(failure.model).slice(0, 80) : phrase("unknown_model"),
135
136
  code: failure.code ? String(failure.code).slice(0, 80) : phrase("unknown_error"),
136
137
  }),
137
138
  retry: phrase(failure.upstream_attempts === 0 ? "no_upstream_call" : failure.retried ? "retry_attempted" : "no_retry"),
@@ -151,7 +152,7 @@
151
152
  const timings = timeline?.timings_ms || {};
152
153
  const timingText = ["admission", "body", "history", "images", "serialization", "upstream_start", "upstream_headers", "first_output", "last_activity", "terminal", "finished"]
153
154
  .filter((key) => finite(timings[key])).map((key) => `${key}=${Number(timings[key]).toFixed(1)}`).join(" / ");
154
- const fields = { time: failure.at, model: failure.model, event: failure.event_type, code: failure.code, reason: failure.reason, application: failure.application, occurrences: failure.occurrences > 1 ? failure.occurrences : undefined, capability_cached: failure.capability_cached, shared_upstream: failure.shared_upstream,
155
+ const fields = { time: failure.at, model: notModelRequest ? phrase("not_applicable") : failure.model, event: failure.event_type, code: failure.code, reason: failure.reason, application: failure.application, occurrences: failure.occurrences > 1 ? failure.occurrences : undefined, capability_cached: failure.capability_cached, shared_upstream: failure.shared_upstream,
155
156
  message: failure.message, response_id: failure.response_id, upstream_request_id: failure.upstream_request_id,
156
157
  retry: failure.retried ? (timeline ? "attempted" : "attempted (outcome not recorded here)") : "not attempted",
157
158
  retry_policy: failure.retry_policy, retry_skipped: failure.retry_skipped,
@@ -162,7 +163,9 @@
162
163
  error_type: failure.error_type, parameter: failure.parameter, error_body: failure.error_body,
163
164
  diagnostic_message: failure.diagnostic_message, method: failure.method, target: failure.target,
164
165
  request_options: failure.request_options ? JSON.stringify(failure.request_options) : undefined,
165
- requested_model: failure.requested_model, request_kind: failure.request_kind, provider: failure.provider || timeline?.provider,
166
+ transport: failure.transport ? JSON.stringify(failure.transport) : undefined,
167
+ output_requested: timeline?.context?.max_output_tokens_requested, output_sent: timeline?.context?.max_output_tokens_sent,
168
+ output_used: timeline?.context?.output_tokens, stop_reason: timeline?.stop_reason, requested_model: failure.requested_model, request_kind: failure.request_kind, provider: failure.provider || timeline?.provider,
166
169
  attempt_timings: failure.attempt_timings || timeline?.attempts ? JSON.stringify(failure.attempt_timings || timeline.attempts) : undefined,
167
170
  timings_ms: timingText };
168
171
  const diagnostic = document.createElement("dl");
@@ -198,6 +201,7 @@
198
201
 
199
202
  function render(data) {
200
203
  for (const source of data.providers?.connections?.providers || []) sourceNames.set(source.id, source.name);
204
+ globalThis.ccdxConnections?.updateMemory?.(data.providers?.connections);
201
205
  globalThis.ccdxDashboardActivity?.update(data.model_activity);
202
206
  globalThis.ccdxDashboardFlow?.update(data);
203
207
  text("version", `v${data.version || "?"}`);
@@ -326,7 +330,9 @@
326
330
  String(sourceLabel(request.provider) || "—").slice(0, 80),
327
331
  String(request.model || "unknown").slice(0, 80), outcome, number(context.input_tokens), ""], { labels: [3] });
328
332
  const wireFailure = Number.isInteger(request.http_status) && request.http_status >= 400;
329
- if (globalThis.ccdxIcons) globalThis.ccdxIcons.set(row.children[3], wireFailure ? "request_http_failure" : outcome.toLowerCase(),
333
+ if (request.rejection_reason) {
334
+ if (globalThis.ccdxIcons) globalThis.ccdxIcons.set(row.children[3], "request_access_blocked", "unavailable");else localize(row.children[3], "request_access_blocked");
335
+ } else if (globalThis.ccdxIcons) globalThis.ccdxIcons.set(row.children[3], wireFailure ? "request_http_failure" : outcome.toLowerCase(),
330
336
  wireFailure ? "warning" : globalThis.ccdxIcons.kind(outcome.toLowerCase()), wireFailure ? { status: request.http_status } : {});
331
337
  else if (wireFailure) localize(row.children[3], "request_http_failure", { status: request.http_status });
332
338
  const details = document.createElement("details"), summary = document.createElement("summary"), fields = document.createElement("dl");
@@ -337,7 +343,8 @@
337
343
  for (const [key, value] of [["request_id", request.request_id || "—"], ["http_status", number(request.http_status)], ["attempts", number(request.upstream_attempts)], ["model_outcome", globalThis.ccdxLanguage?.format(outcome.toLowerCase()) || outcome],
338
344
  ["time", Number.isFinite(at) ? time(at, { date: true }) : "—"],
339
345
  ["wire_mib", finite(context.payload_bytes) ? `${(Number(context.payload_bytes) / 1048576).toFixed(2)} MiB` : "—"],
340
- ["images", number(context.images)], ["model_window", number(context.context_window_tokens)], ["input_window", ratio]]) {
346
+ ["images", number(context.images)], ["model_window", number(context.context_window_tokens)], ["input_window", ratio],
347
+ ["output_requested", number(context.max_output_tokens_requested)], ["output_sent", number(context.max_output_tokens_sent)], ["output_used", number(context.output_tokens)], ["stop_reason", request.stop_reason || "—"]]) {
341
348
  const term = document.createElement("dt"), detail = document.createElement("dd");localize(term, key);detail.textContent = value;fields.append(term, detail);
342
349
  }
343
350
  row.children[5].append(details);body.append(row);