codex-copilot-dx 1.4.14 → 1.4.15

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.
@@ -67,12 +67,16 @@ Automatic Codex opening uses the saved `codex_auto_launch` preference, default f
67
67
 
68
68
  `source-admission.mjs` wraps each provider client once and shares account-scoped leases across Responses, Messages, Chat, Images and relevant search/native-Google calls. HTTP providers enter admission after final serialization and reuse that wire text for queued-byte accounting and sending. Upstream timing starts at dispatch, after the queue. Internal consumers settle ownership in their existing read, error and cancellation callbacks through `source-response.mjs`, retaining native Responses without another stream or facade. Unmanaged clients keep the compatibility wrapper. Lease ownership ends at upstream-body completion/cancellation, not response headers. Counting/catalog reads bypass generation admission. Request-body memory reservations remain separate and shrink only after a complete upload; compressed decoded-body accounting remains intact. Rejected response bodies release their leases before nested recovery calls, with a bounded release barrier for compaction.
69
69
 
70
+ Custom API admission groups retain the active and queued leases for a source and credential while the endpoint configuration changes. The deployment fingerprint covers the protocol endpoints and authentication modes. A different fingerprint clears learned cooldown and model limits, and late feedback from an earlier deployment cannot train the new one. Dashboard use of request-purpose filters captures the purpose in the refresh identity before loading usage.
71
+
70
72
  Raw HTTP 429 responses without private classified evidence receive a bounded clone read before being returned, so feedback does not depend on a caller retaining the error body. The original response remains available. A timed-out inspection retains body-consumption fallback; successful classification is not repeated and Retry-After stays anchored to the response arrival. Real upstream EOF on any clone releases the source slot; cancelling only one clone does not. Unchanged request-body reservations do not drain their queue again.
71
73
 
72
74
  Explicit concurrency rejections contract once per observed burst. Stable success retains growth eligibility through idle periods; waiting demand then grows capacity additively. Persistence notifications remain throttled separately. Model quota/rate evidence and explicit account-wide evidence keep separate scopes. Ordinary parameter errors, slow thinking and untyped output text do not train capacity. HTTP 200 stream errors enter feedback only through existing structured protocol parsers. API providers pass a private fixed-field Symbol through safe error projection; original vendor text is never persisted. Queue limits are 16 per account, 8 MiB globally and 30 seconds; the initial 128-slot ceiling preserves the existing small held-stream workload and is not an upstream capacity claim. A manual source ceiling is optional. Stable capacity persistence is asynchronous, bounded and keyed by hashes; invalid or stale metadata is discarded.
73
75
 
74
76
  The upstream references are deliberately narrow: [Floway's model-scoped quota correction](https://github.com/Menci/Floway/commit/49813611aac1f7d0cccb10cfd343c1df7541790e) and [single Chat output cap](https://github.com/Menci/Floway/commit/63f1100af6bc2823e7f0f478fbd785aa56dc0cd7), [Magpie's quota/compaction boundary](https://github.com/yetone/magpie/issues/2725), and [LiteLLM's disconnect outcome report](https://github.com/BerriAI/litellm/issues/51978). CCDX preserves an already observed terminal result while marking delivery cancellation separately; an unfinished stream is not promoted to success. The existing CC Switch-style separation of configuration, discovery and application activation is retained. No upstream runtime, distributed queue or automatic account rotation is introduced.
75
77
 
78
+ Antigravity's management views group per-effort catalog entries only when the record declares a valid `base_model_id` and `reasoning_effort`. Group selection continues to store the existing individual aliases. Requests keep the original model IDs and capabilities.
79
+
76
80
  ### Manual connection graph
77
81
 
78
82
  `provider-runtime.mjs` composes built-in lifecycle with `connection-runtime.mjs`,
package/docs/REFERENCE.md CHANGED
@@ -134,7 +134,7 @@ Each protocol observer retains at most 64 series of 64 request points and 16 com
134
134
 
135
135
  ## Observed tool calls
136
136
 
137
- **Requests → Tool and agent activity** offers Assembly line, Dual-lane sorter, Gantry transfer and Indexing table. Assembly line is the default and replaces removed preferences. Choose Off to keep status text without drawing. The setting is per browser. The display follows observed request and tool activity. Motion stops on completion, failure, cancellation, stale evidence, hidden views or reduced-motion settings. The pictures show activity and do not measure progress.
137
+ **Requests → Tool and agent activity** offers Production line, Gear clock, Assembly line, Dual-lane sorter, Gantry transfer and Indexing table. Production line is the default for new browsers and replaces unsupported preferences. Saved styles with the same name use the new drawings. Choose Off to keep status text without drawing. The setting is per browser. The display follows observed request and tool activity. Motion stops on completion, failure, cancellation, stale evidence, hidden views or reduced-motion settings. The pictures show activity and do not measure progress. Expand Call details for the full list. Recent requests show total time next to the timestamp, with details below each request.
138
138
 
139
139
  Calls are correlated using their IDs and the existing app/profile/session scope. A model emitting a tool call does not prove that the client executed it. Only a matching returned result ends the wait; ambiguous name-only Gemini results stay unconfirmed. Without a reliable session, completed requests show unconfirmed tool state. After 90 seconds without observable tool or response activity, the UI pauses and shows that fresh status is needed. Late results can update retained unconfirmed observations for another five minutes. These display deadlines never cancel tools or change source timeouts.
140
140
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codex-copilot-dx",
3
- "version": "1.4.14",
3
+ "version": "1.4.15",
4
4
  "description": "Local gateway for Codex, Claude and Gemini Antigravity with Copilot, Microsoft 365 and custom APIs",
5
5
  "author": "Dale Xiao",
6
6
  "type": "module",
@@ -3,10 +3,12 @@ import {modelDisplayName} from "./model-display.mjs";
3
3
  import {modelReasoningEfforts} from "./provider-metadata.mjs";
4
4
  export const ANTIGRAVITY_MODEL_PREFIX = "ccdx-copilot-";
5
5
  export const ANTIGRAVITY_NATIVE_PREFIX = "ccdx-gemini-";
6
+ const geminiModel = /^gemini-[a-z0-9][a-z0-9._-]{0,100}$/;
7
+ const knownEfforts = new Set(["minimal", "low", "medium", "high", "xhigh", "max"]);
6
8
 
7
9
  export function antigravityCopilotModels(catalog) {
8
10
  const data=Array.isArray(catalog)?catalog:catalog?.data;
9
- return uniqueModelEntries(Array.isArray(data)?data:[]).filter(model=>/^gemini-[a-z0-9][a-z0-9._-]{0,100}$/.test(model?.id)
11
+ return uniqueModelEntries(Array.isArray(data)?data:[]).filter(model=>geminiModel.test(model?.id)
10
12
  &&model.model_picker_enabled!==false&&(!model.policy?.state||model.policy.state==="enabled")
11
13
  &&(!model.capabilities?.type||model.capabilities.type==="chat")
12
14
  &&model.capabilities?.supports?.streaming!==false&&model.capabilities?.supports?.tool_calls!==false
@@ -23,6 +25,35 @@ export function antigravityCopilotModels(catalog) {
23
25
  });
24
26
  }
25
27
 
28
+ export function groupAntigravityModels(listed, catalog) {
29
+ const data = Array.isArray(catalog) ? catalog : catalog?.data;
30
+ const base = new Map();
31
+ for (const model of uniqueModelEntries(Array.isArray(data) ? data : [])) {
32
+ if (!geminiModel.test(model?.base_model_id) || !geminiModel.test(model.id) || model.base_model_id === model.id
33
+ || !knownEfforts.has(model.reasoning_effort)) continue;
34
+ base.set(model.id, { id: model.base_model_id, effort: model.reasoning_effort });
35
+ }
36
+ const nameOf = name => name.split(" · Copilot")[0];
37
+ const names = new Map(listed.map(variant => [variant.model, nameOf(variant.name)]));
38
+ const groups = new Map();
39
+ for (const variant of listed) {
40
+ const candidate = base.get(variant.model);
41
+ const explicit = candidate && !base.has(candidate.id) && (!variant.effort || variant.effort === candidate.effort) ? candidate : null;
42
+ const id = explicit?.id || variant.model;
43
+ if (!groups.has(id)) {
44
+ const name = names.get(id) || id.split("-").map(word => word[0]?.toUpperCase() + word.slice(1)).join(" ");
45
+ groups.set(id, { id, name, source: "github", context_window: variant.context_window, default: false, efforts: [] });
46
+ }
47
+ const group = groups.get(id);
48
+ if (Number.isFinite(group.context_window) && Number.isFinite(variant.context_window)) {
49
+ group.context_window = Math.min(group.context_window, variant.context_window);
50
+ } else group.context_window = undefined;
51
+ group.default ||= variant.default;
52
+ group.efforts.push({ id: variant.id, effort: explicit?.effort || variant.effort, selected: variant.selected });
53
+ }
54
+ return [...groups.values()];
55
+ }
56
+
26
57
  // Use the upstream's existing agent-default field only when it names a model
27
58
  // in the same catalog. Do not invent a default contract for an unknown catalog.
28
59
  export function hasAntigravityAgentDefault(catalog) {
@@ -18,7 +18,7 @@ import {withFileLockSync} from "./lock.mjs";
18
18
  import {httpError} from "./http-errors.mjs";
19
19
  import {createAntigravityBindings, validModel} from "./antigravity-bindings.mjs";
20
20
  import {parseTimerMs} from "./runtime-config.mjs";
21
- import {antigravityCopilotModels,ANTIGRAVITY_MODEL_PREFIX,ANTIGRAVITY_NATIVE_PREFIX} from "./antigravity-models.mjs";
21
+ import {antigravityCopilotModels,groupAntigravityModels,ANTIGRAVITY_MODEL_PREFIX,ANTIGRAVITY_NATIVE_PREFIX} from "./antigravity-models.mjs";
22
22
 
23
23
  const execute=promisify(execFile),key="gemini_antigravity_enabled",modelKey="gemini_antigravity_models",defaultKey="gemini_antigravity_default_model";
24
24
  const timeoutKey="gemini_antigravity_copilot_timeout_seconds";
@@ -97,12 +97,9 @@ export function createAntigravityRuntime({client,models=()=>[],refreshModels,pri
97
97
  function snapshot(){
98
98
  const config=settings(),sourceEnabled=readAccessSettings(options).providers.github,activity=handler.snapshot(config);
99
99
  const sources=nativeSources(), selectedNative=sources.find(item=>item.id===config.native_source);
100
- const listed=antigravityCopilotModels(models()).map(({id,model,displayName,effort,maxTokens})=>({id,model,name:displayName,effort,context_window:maxTokens,default:id===config.default_model,selected:config.selected_models===null||config.selected_models.includes(id)}));
101
- const groups=new Map();
102
- for(const variant of listed){
103
- if(!groups.has(variant.model))groups.set(variant.model,{id:variant.model,name:variant.name.split(" · Copilot")[0],source:"github",context_window:variant.context_window,default:false,efforts:[]});
104
- const group=groups.get(variant.model);group.default||=variant.default;group.efforts.push({id:variant.id,effort:variant.effort,selected:variant.selected});
105
- }
100
+ const catalog=models();
101
+ const listed=antigravityCopilotModels(catalog).map(({id,model,displayName,effort,maxTokens})=>({id,model,name:displayName,effort,context_window:maxTokens,default:id===config.default_model,selected:config.selected_models===null||config.selected_models.includes(id)}));
102
+ const groups=groupAntigravityModels(listed,catalog);
106
103
  const expected=[...(config.enabled&&sourceEnabled?listed.filter(model=>model.selected).map(model=>model.id):[]),...nativeModels(config.native_source).map(model=>model.id)].sort();
107
104
  const desiredDefault=expected.includes(config.default_model)?config.default_model:null;
108
105
  const reload=config.enabled&&sourceEnabled||config.native_source?(activity.catalog_models===null?null:JSON.stringify([...activity.catalog_models].sort())!==JSON.stringify(expected)
@@ -114,7 +111,7 @@ export function createAntigravityRuntime({client,models=()=>[],refreshModels,pri
114
111
  source_enabled:sourceEnabled,default_model_unavailable:defaultUnavailable,models_reload_required:reload,app:visibleApp,application:current||null,route_observed:activity.observed,
115
112
  model_source:["Google",...(config.enabled&&sourceEnabled?["GitHub Copilot"]:[]),...(selectedNative?[selectedNative.name]:[])].join(" + "),background_source:"GitHub Copilot",ordinary_chat_source:"Google (unchanged)",
116
113
  compaction_source:"Observed conversation source; existing background policy when unassigned",
117
- models:listed,model_groups:[...groups.values()],activity,last_operation:lastOperation};
114
+ models:listed,model_groups:groups,activity,last_operation:lastOperation};
118
115
  }
119
116
  async function action(input={},baseUrl){
120
117
  if(input&&Object.keys(input).some(name=>!["action","accept_background_copilot","models","default_model","copilot_timeout_seconds","native_source"].includes(name)))throw httpError("Invalid Gemini operation",400);
@@ -403,11 +403,12 @@
403
403
  <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>
404
404
  </section>
405
405
  <section id="tool-activity" class="panel dashboard-section" aria-labelledby="tool-title" data-paused="true">
406
- <div class="panel-heading"><h2 id="tool-title" data-i18n="tool_heading">TOOL AND AGENT ACTIVITY</h2><label class="tool-style" for="tool-style"><span data-i18n="tool_style">Style</span><select id="tool-style"><option value="assembly" data-i18n="tool_style_assembly">Assembly line</option><option value="sorter" data-i18n="tool_style_sorter">Dual-lane sorter</option><option value="gantry" data-i18n="tool_style_gantry">Gantry transfer</option><option value="rotary" data-i18n="tool_style_rotary">Indexing table</option><option value="off" data-i18n="tool_style_off">Off</option></select></label></div>
407
- <div id="tool-stage" class="tool-stage" data-style="assembly">
406
+ <div class="panel-heading"><h2 id="tool-title" data-i18n="tool_heading">TOOL AND AGENT ACTIVITY</h2><label class="tool-style" for="tool-style"><span data-i18n="tool_style">Style</span><select id="tool-style"><option value="production" data-i18n="tool_style_production">Production line</option><option value="clock" data-i18n="tool_style_clock">Gear clock</option><option value="assembly" data-i18n="tool_style_assembly">Assembly line</option><option value="sorter" data-i18n="tool_style_sorter">Dual-lane sorter</option><option value="gantry" data-i18n="tool_style_gantry">Gantry transfer</option><option value="rotary" data-i18n="tool_style_rotary">Indexing table</option><option value="off" data-i18n="tool_style_off">Off</option></select></label></div>
407
+ <div id="tool-stage" class="tool-stage" data-style="production">
408
408
  <div class="tool-visual"><div class="tool-orbit"><canvas id="tool-canvas" role="img" data-i18n-label="tool_heading" aria-label="Tool and agent activity"></canvas></div><p class="tool-narration"><span id="tool-state" role="status" aria-live="polite" data-i18n="flow_status_unknown">Waiting for a fresh status</span><span id="tool-cursor" aria-hidden="true" hidden> …</span></p></div>
409
- <div class="tool-content"><p id="tool-context" class="tool-context" hidden></p><div id="tool-list"></div><p id="tool-more" class="hint" hidden></p><details id="tool-details" class="tool-details tool-technical" hidden><summary data-i18n="tool_details">Call details</summary><div class="table-wrap"><table class="dense-table"><thead><tr><th data-i18n="client">App</th><th data-i18n="source">Source</th><th data-i18n="model">Model</th><th data-i18n="tool_name">Tool</th><th data-i18n="outcome">Result</th></tr></thead><tbody id="tool-technical"></tbody></table></div></details></div>
409
+ <div class="tool-content"><p id="tool-context" class="tool-context" hidden></p><div id="tool-list"></div><p id="tool-more" class="hint" hidden></p></div>
410
410
  </div>
411
+ <details id="tool-details" class="tool-details tool-technical" hidden><summary data-i18n="tool_details">Call details</summary><div class="table-wrap"><table class="dense-table"><thead><tr><th data-i18n="client">App</th><th data-i18n="source">Source</th><th data-i18n="model">Model</th><th data-i18n="tool_name">Tool</th><th data-i18n="outcome">Result</th></tr></thead><tbody id="tool-technical"></tbody></table></div></details>
411
412
  </section>
412
413
  <details id="flow-active" class="panel dashboard-section"><summary id="flow-active-title" data-i18n="flow_active_requests">Active requests</summary><div class="table-wrap"><table><thead><tr><th data-i18n="client">App</th><th data-i18n="source">Source</th><th data-i18n="model">Model</th><th data-i18n="state">State</th><th data-i18n="flow_elapsed">Elapsed</th><th data-i18n="attempts">Attempts</th></tr></thead><tbody id="flow-active-body"></tbody></table></div></details>
413
414
  <details class="panel dashboard-section" id="source-requests" open>
@@ -418,7 +419,7 @@
418
419
  </details>
419
420
  <details class="panel dashboard-section" id="request-context" open>
420
421
  <summary data-i18n="recent_request_context">RECENT REQUESTS</summary>
421
- <div class="table-wrap"><table class="recent-requests-table dense-table"><thead><tr><th scope="col" data-i18n="time">Time</th><th scope="col" data-i18n="client">App</th><th scope="col" data-i18n="model">MODEL</th><th scope="col" data-i18n="outcome">RESULT</th><th scope="col" class="recent-request-duration" data-i18n="request_total_time">Total time</th><th scope="col" data-i18n="tools_details">Details</th></tr></thead><tbody id="context-body"><tr><td colspan="6" data-i18n="no_observed_request_metadata">No request records yet.</td></tr></tbody></table></div>
422
+ <div class="table-wrap"><table class="recent-requests-table dense-table"><thead><tr><th scope="col" class="recent-request-time" data-i18n="time">Time</th><th scope="col" class="recent-request-duration" data-i18n="request_total_time">Total time</th><th scope="col" class="recent-request-app" data-i18n="client">App</th><th scope="col" class="recent-request-model" data-i18n="model">MODEL</th><th scope="col" class="recent-request-result" data-i18n="outcome">RESULT</th><th scope="col" data-i18n="tools_details">Details</th></tr></thead><tbody id="context-body"><tr><td colspan="6" data-i18n="no_observed_request_metadata">No request records yet.</td></tr></tbody></table></div>
422
423
  <details class="tool-details"><summary data-i18n="record_scope">Record scope</summary><p id="context-note" class="table-note">—</p><p class="hint" data-i18n="recent_upstream_request_metadata_not_exact_live_session_occupanc">No prompts or images are stored. — means unavailable data.</p><p class="hint" data-i18n="http_2xx_model_completed">HTTP status and model outcome are recorded separately.</p></details>
423
424
  </details>
424
425
  <details class="lower" id="recent-failures" open>
@@ -6,6 +6,8 @@
6
6
  "tool_style_sorter": ["Dual-lane sorter","双轨分拣"],
7
7
  "tool_style_gantry": ["Gantry transfer","龙门移载"],
8
8
  "tool_style_rotary": ["Indexing table","分度转盘"],
9
+ "tool_style_production": ["Production line", "工业生产线"],
10
+ "tool_style_clock": ["Gear clock", "齿轮钟表"],
9
11
  "tool_style_assembly": ["Assembly line","装配线"],
10
12
  "refresh_models": ["Refresh models", "刷新模型"],
11
13
  "routing_reason": ["Model routing", "选模依据"],
@@ -397,21 +397,21 @@
397
397
  const signature = JSON.stringify(contextRequests);
398
398
  if (signature === contextSignature) return;
399
399
  contextSignature = signature;
400
- const openDetails = [...(body.querySelectorAll?.("details[open]") || [])].filter(details => details.dataset.disclosureClosing !== "true");
401
- const expanded = new Set(openDetails.map(details => details.getAttribute("data-request-key")));
400
+ const openDetails = [...(body.querySelectorAll?.(".request-disclosure[aria-expanded=true]") || [])];
401
+ const expanded = new Set(openDetails.map(button => button.getAttribute("data-request-key")));
402
402
  const viewport = document.defaultView;
403
- const focused = document.activeElement?.closest?.(".request-details > summary");
403
+ const focused = document.activeElement?.closest?.(".request-disclosure");
404
404
  const keepFocus = Boolean(focused && body.contains?.(focused));
405
405
  const topInView = summary => {
406
406
  if (!viewport?.scrollY || !summary) return null;
407
407
  const box = summary.getBoundingClientRect();return box.bottom > 0 && box.top < viewport.innerHeight ? box.top : null;
408
408
  };
409
409
  let reading = keepFocus ? focused : null;
410
- if (!reading && viewport?.scrollY) reading = openDetails.map(details => details.querySelector("summary")).find(summary => topInView(summary) !== null);
411
- const readingKey = reading?.parentElement?.getAttribute("data-request-key"), readingTop = topInView(reading);
410
+ if (!reading && viewport?.scrollY) reading = openDetails.find(button => topInView(button) !== null);
411
+ const readingKey = reading?.getAttribute("data-request-key"), readingTop = topInView(reading);
412
412
  let restoredSummary;
413
413
  body.replaceChildren();
414
- for (const request of contextRequests) {
414
+ for (const [rowIndex, request] of contextRequests.entries()) {
415
415
  const context = request.context || {};
416
416
  const outcome = ["completed", "incomplete", "failed", "cancelled"].includes(request.outcome)
417
417
  ? request.outcome[0].toUpperCase() + request.outcome.slice(1) : "unknown";
@@ -420,22 +420,37 @@
420
420
  const at = Date.parse(request.at);
421
421
  const totalMs = request.timings_ms?.finished;
422
422
  const app = ["codex", "codex_app", "codex_cli", "claude", "claude_app", "claude_code", "gemini_app", "api"].includes(request.application) ? request.application : "api";
423
- const row = tableRow([Number.isFinite(at) ? time(at) : "—", "",
424
- String(request.model || "unknown").slice(0, 80), outcome, Number.isFinite(totalMs) ? requestTime(totalMs) : "—", ""], { labels: [3] });
425
- localize(row.children[1], `flow_app_${app}`);
426
- row.children[4].className = "recent-request-duration";
423
+ const row = tableRow([Number.isFinite(at) ? time(at) : "—", Number.isFinite(totalMs) ? requestTime(totalMs) : "—", "",
424
+ String(request.model || "unknown").slice(0, 80), outcome, ""], { labels: [4] });
425
+ localize(row.children[2], `flow_app_${app}`);
426
+ ["time", "duration", "app", "model", "result"].forEach((name, index) => { row.children[index].className = "recent-request-" + name; });
427
427
  const wireFailure = Number.isInteger(request.http_status) && request.http_status >= 400;
428
428
  if (request.rejection_reason) {
429
- if (globalThis.ccdxIcons) globalThis.ccdxIcons.set(row.children[3], "request_access_blocked", "unavailable");else localize(row.children[3], "request_access_blocked");
430
- } else if (globalThis.ccdxIcons) globalThis.ccdxIcons.set(row.children[3], wireFailure ? "request_http_failure" : outcome.toLowerCase(),
429
+ if (globalThis.ccdxIcons) globalThis.ccdxIcons.set(row.children[4], "request_access_blocked", "unavailable");else localize(row.children[4], "request_access_blocked");
430
+ } else if (globalThis.ccdxIcons) globalThis.ccdxIcons.set(row.children[4], wireFailure ? "request_http_failure" : outcome.toLowerCase(),
431
431
  wireFailure ? "warning" : globalThis.ccdxIcons.kind(outcome.toLowerCase()), wireFailure ? { status: request.http_status } : {});
432
- else if (wireFailure) localize(row.children[3], "request_http_failure", { status: request.http_status });
433
- const details = document.createElement("details"), summary = document.createElement("summary"), fields = document.createElement("dl");
432
+ else if (wireFailure) localize(row.children[4], "request_http_failure", { status: request.http_status });
433
+ const disclosure = document.createElement("button"), detailRow = document.createElement("tr"),
434
+ cell = document.createElement("td"), fields = document.createElement("dl");
434
435
  const key = String(request.request_id || `${request.at || ""}/${request.provider || ""}/${request.model || ""}`).slice(0, 256);
435
- details.setAttribute?.("data-request-key", key);details.open = expanded.has(key);
436
- if (key === readingKey) restoredSummary = summary;
437
- details.className = "request-details";fields.className = "failure-detail";
438
- localize(summary, "tools_details");details.append(summary, fields);
436
+ const id = "request-detail-" + rowIndex;
437
+ disclosure.type = "button";
438
+ disclosure.className = "request-disclosure";
439
+ disclosure.setAttribute("data-request-key", key);
440
+ disclosure.setAttribute("aria-controls", id);
441
+ detailRow.className = "request-detail-row";
442
+ detailRow.id = id;
443
+ cell.colSpan = 6;
444
+ cell.className = "request-detail-cell";
445
+ fields.className = "request-detail-fields";
446
+ localize(disclosure, "tools_details");
447
+ function showDetails(open) {
448
+ disclosure.setAttribute("aria-expanded", String(open));
449
+ detailRow.hidden = !open;
450
+ }
451
+ showDetails(expanded.has(key));
452
+ disclosure.addEventListener("click", () => showDetails(detailRow.hidden));
453
+ if (key === readingKey) restoredSummary = disclosure;
439
454
  const queue = context.body_queue;
440
455
  const queueResult = queue?.outcome === "admitted" ? "body_queue_admitted" : queue?.outcome === "timed_out" ? "body_queue_timed_out"
441
456
  : queue?.outcome === "aborted" ? "body_queue_aborted" : "body_queue_result_unknown";
@@ -471,9 +486,12 @@
471
486
  ...(context.client_tool_errors_received > 0 ? [["client_tool_errors_received", number(context.client_tool_errors_received)]] : [])]) {
472
487
  const term = document.createElement("dt"), detail = document.createElement("dd");localize(term, key);
473
488
  if (value?.key) localize(detail, value.key, value.values);else detail.textContent = value;
474
- fields.append(term, detail);
489
+ const pair = document.createElement("div");
490
+ if (["request_id", "client_request_id", "body_queue_wait", "upstream_transport_error", "requested_model"].includes(key)) pair.className = "request-detail-wide";
491
+ pair.append(term, detail);fields.append(pair);
475
492
  }
476
- row.children[5].append(details);body.append(row);
493
+ cell.append(fields);detailRow.append(cell);
494
+ row.children[5].append(disclosure);body.append(row, detailRow);
477
495
  }
478
496
  if (restoredSummary) {
479
497
  if (keepFocus) restoredSummary.focus({ preventScroll: true });