codex-copilot-dx 1.4.8 → 1.4.10
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.
- package/docs/REFERENCE.md +4 -4
- package/package.json +1 -1
- package/src/antigravity-handler.mjs +34 -11
- package/src/antigravity-runtime.mjs +1 -1
- package/src/application-configuration.mjs +1 -1
- package/src/carbon-tool-schema.mjs +72 -0
- package/src/copilot-client.mjs +6 -4
- package/src/copilot-send-timing.mjs +63 -0
- package/src/copilot.mjs +5 -1
- package/src/dashboard/applications.js +9 -5
- package/src/dashboard/connections.js +6 -3
- package/src/dashboard/console.js +2 -2
- package/src/dashboard/flow.js +1 -1
- package/src/dashboard/gemini.js +19 -12
- package/src/dashboard/index.html +29 -16
- package/src/dashboard/language.js +71 -47
- package/src/dashboard/privacy.js +1 -1
- package/src/dashboard/status.js +81 -29
- package/src/dashboard/tool-activity.js +8 -2
- package/src/dashboard/tools.js +1 -1
- package/src/dashboard/ui.css +27 -1
- package/src/dashboard/updates.js +1 -1
- package/src/response-failures.mjs +6 -2
- package/src/responses-bridge.mjs +10 -2
- package/src/responses-handler.mjs +5 -1
- package/src/source-transport.mjs +1 -1
- package/src/stream-performance.mjs +20 -1
- package/src/upstream-headers.mjs +23 -0
package/src/dashboard/status.js
CHANGED
|
@@ -46,12 +46,11 @@
|
|
|
46
46
|
applications.get(id).push({ provider, client });
|
|
47
47
|
}
|
|
48
48
|
if (provider.requests) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
done: number(provider.requests.completed), incomplete: number(provider.requests.incomplete), failed: number(provider.requests.failed) });
|
|
52
|
-
requests.append(item);
|
|
49
|
+
requests.append(tableRow([provider.name, provider.request_scope || "Claude Messages", number(provider.requests.completed),
|
|
50
|
+
number(provider.requests.incomplete), number(provider.requests.failed)]));
|
|
53
51
|
}
|
|
54
52
|
}
|
|
53
|
+
if (!requests.children.length) emptyTable("provider-requests", 5, "no_requests_observed");
|
|
55
54
|
for (const entries of applications.values()) {
|
|
56
55
|
const selected = entries.find(entry => entry.client.selected === true) || (entries.length === 1 ? entries[0] : null);
|
|
57
56
|
const client = selected?.client || { name: entries[0].client.name, state: entries.every(entry => entry.client.state === "paused") ? "paused" : "unknown" };
|
|
@@ -100,6 +99,15 @@
|
|
|
100
99
|
return days ? `${days}d ${hours}h` : hours ? `${hours}h ${minutes}m` : `${minutes}m`;
|
|
101
100
|
}
|
|
102
101
|
|
|
102
|
+
const requestTime = ms => ms >= 1000 ? `${(ms / 1000).toFixed(2)} s` : `${number(ms)} ms`;
|
|
103
|
+
function retryAfterSeconds(failure) {
|
|
104
|
+
const value = failure.retry_after;
|
|
105
|
+
if (typeof value !== "string") return null;
|
|
106
|
+
if (/^\d{1,8}$/.test(value)) return Number(value) || null;
|
|
107
|
+
const seconds = Math.ceil((Date.parse(value) - Date.parse(failure.at)) / 1000);
|
|
108
|
+
return Number.isFinite(seconds) && seconds > 0 ? seconds : null;
|
|
109
|
+
}
|
|
110
|
+
|
|
103
111
|
function renderFailures(recent, recentRequests = []) {
|
|
104
112
|
if (!visible(element("failures"))) return;
|
|
105
113
|
const signature = JSON.stringify([element("failure-kind")?.value, recent, recentRequests]);
|
|
@@ -144,6 +152,9 @@
|
|
|
144
152
|
details.dataset.key = `${failure.at}/${failure.request_id || failure.response_id}/${failure.code}`;
|
|
145
153
|
details.open = expanded.has(details.dataset.key);
|
|
146
154
|
const title = document.createElement("summary");
|
|
155
|
+
const timeline = failure.timeline;
|
|
156
|
+
const attempt = (failure.attempt_timings || timeline?.attempts)?.at(-1);
|
|
157
|
+
const seconds = retryAfterSeconds(failure);
|
|
147
158
|
const cause = failure.route === "messages_count_tokens" && [404, 405, 501].includes(failure.http_status) ? "issue_count_unavailable"
|
|
148
159
|
: ["credit_balance_exhausted", "insufficient_quota", "quota_exceeded"].includes(failure.upstream_code) ? "issue_source_quota"
|
|
149
160
|
: ["rate_limit_exceeded", "rate_limit_error"].includes(failure.upstream_code) ? "issue_source_rate"
|
|
@@ -152,12 +163,15 @@
|
|
|
152
163
|
: ["rate_limit_error", "rate_limit_exceeded", "insufficient_quota", "http_429"].includes(failure.code) ? "issue_source_limit"
|
|
153
164
|
: /^m365_catalog_http_/.test(failure.code || "") ? "issue_catalog_unavailable"
|
|
154
165
|
: failure.reason === "ccdx_model_not_selected" ? "issue_model_not_selected"
|
|
155
|
-
: failure.http_status ===
|
|
166
|
+
: failure.http_status === 429 && failure.origin === "upstream_http" ? "issue_source_rate"
|
|
167
|
+
: failure.http_status === 504 && failure.code === "upstream_timeout"
|
|
168
|
+
? Number.isFinite(attempt?.body_sent_ms) && attempt.headers_ms === null ? "issue_after_send_timeout" : "issue_upstream_timeout"
|
|
169
|
+
: failure.http_status === 401 || failure.http_status === 403 ? "issue_access_denied" : "issue_request_failed";
|
|
156
170
|
const summary = {
|
|
157
171
|
detail: phrase("issue_brief", {
|
|
158
172
|
time: failure.at ? time(failure.at, { date: true }) : phrase("unknown_time"),
|
|
159
173
|
model: notModelRequest ? phrase("not_applicable") : failure.model ? String(failure.model).slice(0, 80) : phrase("unknown_model"),
|
|
160
|
-
cause: phrase(cause),
|
|
174
|
+
cause: failure.http_status === 429 && failure.origin === "upstream_http" && seconds ? phrase("issue_source_rate_wait", { seconds: number(seconds) }) : phrase(cause),
|
|
161
175
|
}),
|
|
162
176
|
retry: phrase(failure.upstream_attempts === 0 ? "no_upstream_call" : failure.retried ? "retry_attempted" : "no_retry"),
|
|
163
177
|
};
|
|
@@ -166,7 +180,6 @@
|
|
|
166
180
|
summary.detail = phrase("repeated_issue", { detail: summary.detail, count: failure.occurrences });
|
|
167
181
|
localize(title, "detail_retry", summary);
|
|
168
182
|
}
|
|
169
|
-
const timeline = failure.timeline;
|
|
170
183
|
const provider = failure.provider || timeline?.provider;
|
|
171
184
|
if (provider) {
|
|
172
185
|
const source = sourceLabel(provider);
|
|
@@ -176,8 +189,10 @@
|
|
|
176
189
|
const timings = timeline?.timings_ms || {};
|
|
177
190
|
const timingText = ["admission", "body", "history", "images", "serialization", "upstream_start", "upstream_headers", "first_output", "last_activity", "terminal", "finished"]
|
|
178
191
|
.filter((key) => finite(timings[key])).map((key) => `${key}=${Number(timings[key]).toFixed(1)}`).join(" / ");
|
|
179
|
-
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,
|
|
180
|
-
message: failure.message, response_id: failure.response_id,
|
|
192
|
+
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 === "gemini_app" ? phrase("flow_app_gemini_app") : failure.application, occurrences: failure.occurrences > 1 ? failure.occurrences : undefined, capability_cached: failure.capability_cached, shared_upstream: failure.shared_upstream,
|
|
193
|
+
message: failure.message, response_id: failure.response_id, client_request_id: attempt?.client_request_id,
|
|
194
|
+
upstream_request_id: failure.upstream_request_id, retry_after: failure.retry_after,
|
|
195
|
+
request_total_time: Number.isFinite(timings.finished) ? requestTime(timings.finished) : undefined,
|
|
181
196
|
retry: failure.retried ? (timeline ? "attempted" : "attempted (outcome not recorded here)") : "not attempted",
|
|
182
197
|
retry_policy: failure.retry_policy, retry_skipped: failure.retry_skipped,
|
|
183
198
|
recovery: failure.recovery ? JSON.stringify(failure.recovery) : undefined,
|
|
@@ -189,7 +204,7 @@
|
|
|
189
204
|
request_options: failure.request_options ? JSON.stringify(failure.request_options) : undefined,
|
|
190
205
|
transport: failure.transport ? JSON.stringify(failure.transport) : undefined,
|
|
191
206
|
output_requested: timeline?.context?.max_output_tokens_requested, output_sent: timeline?.context?.max_output_tokens_sent,
|
|
192
|
-
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,
|
|
207
|
+
output_used: timeline?.context?.output_tokens, stop_reason: timeline?.stop_reason, requested_model: failure.requested_model, request_kind: failure.request_kind === "unknown" ? undefined : failure.request_kind, provider: failure.provider || timeline?.provider,
|
|
193
208
|
attempt_timings: failure.attempt_timings || timeline?.attempts ? JSON.stringify(failure.attempt_timings || timeline.attempts) : undefined,
|
|
194
209
|
timings_ms: timingText };
|
|
195
210
|
const diagnostic = document.createElement("dl");
|
|
@@ -223,6 +238,20 @@
|
|
|
223
238
|
}
|
|
224
239
|
}
|
|
225
240
|
|
|
241
|
+
function renderRequestCounts(data) {
|
|
242
|
+
const requests = data.requests || {};
|
|
243
|
+
text("requests", number(requests.total));
|
|
244
|
+
text("requests-4xx", number(requests.status_4xx));
|
|
245
|
+
text("requests-5xx", number(requests.status_5xx));
|
|
246
|
+
text("requests-active", number(requests.active));
|
|
247
|
+
const categories = data.http_errors?.by_category;
|
|
248
|
+
for (const key of ["inference", "capability", "protocol", "route", "other"]) {
|
|
249
|
+
const value = categories ? number(categories[key] ?? 0) : "—";
|
|
250
|
+
text(`http-${key}`, value);
|
|
251
|
+
text(`http-mobile-${key}`, value);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
226
255
|
function render(data) {
|
|
227
256
|
if (data.scope === "summary") {
|
|
228
257
|
globalThis.ccdxDashboardActivity?.update(data.model_activity);
|
|
@@ -243,12 +272,7 @@
|
|
|
243
272
|
text("models", number(models.models));
|
|
244
273
|
text("model-source", "source_source_live_ccdx_models", { source: phrase(String(models.source || "unknown").slice(0, 80)) });
|
|
245
274
|
|
|
246
|
-
|
|
247
|
-
text("requests", number(requests.total));
|
|
248
|
-
text("request-errors", "4xx_client_5xx_server_active_active", { client: number(requests.status_4xx), server: number(requests.status_5xx), active: number(requests.active) });
|
|
249
|
-
const categories = data.http_errors?.by_category;
|
|
250
|
-
text("http-error-breakdown", categories ? "http_categories" : "—",
|
|
251
|
-
categories ? Object.fromEntries(["inference", "capability", "protocol", "route", "other"].map(key => [key, number(categories[key] || 0)])) : {});
|
|
275
|
+
renderRequestCounts(data);
|
|
252
276
|
text("body-limits", "raw_raw_decoded_decoded", { raw: mib(data.limits?.max_body_bytes), decoded: mib(data.limits?.max_decoded_body_bytes) });
|
|
253
277
|
|
|
254
278
|
const outcomes = data.stream_performance?.by_route?.responses?.terminal_outcomes?.totals || {};
|
|
@@ -334,11 +358,7 @@
|
|
|
334
358
|
globalThis.ccdxDashboardFlow?.update(data, { live: true });globalThis.ccdxToolActivity?.update(data, { live: true });
|
|
335
359
|
text("version", `v${data.version || "?"}`);
|
|
336
360
|
text("uptime", "pid_pid_uptime_duration", { pid: number(data.pid), duration: duration(data.uptime_ms) });
|
|
337
|
-
|
|
338
|
-
text("request-errors", "4xx_client_5xx_server_active_active", { client: number(data.requests?.status_4xx), server: number(data.requests?.status_5xx), active: number(data.requests?.active) });
|
|
339
|
-
const categories = data.http_errors?.by_category;
|
|
340
|
-
text("http-error-breakdown", categories ? "http_categories" : "—",
|
|
341
|
-
categories ? Object.fromEntries(["inference", "capability", "protocol", "route", "other"].map(key => [key, number(categories[key] || 0)])) : {});
|
|
361
|
+
renderRequestCounts(data);
|
|
342
362
|
for (const key of ["completed", "incomplete", "failed", "cancelled"]) {
|
|
343
363
|
text(key, number(data.stream_performance?.by_route?.responses?.terminal_outcomes?.totals[key]));
|
|
344
364
|
text(`claude-${key}`, number(data.providers?.claude?.requests?.performance?.by_route?.messages?.terminal_outcomes?.totals[key]));
|
|
@@ -376,7 +396,19 @@
|
|
|
376
396
|
const signature = JSON.stringify(contextRequests);
|
|
377
397
|
if (signature === contextSignature) return;
|
|
378
398
|
contextSignature = signature;
|
|
379
|
-
const
|
|
399
|
+
const openDetails = [...(body.querySelectorAll?.("details[open]") || [])].filter(details => details.dataset.disclosureClosing !== "true");
|
|
400
|
+
const expanded = new Set(openDetails.map(details => details.getAttribute("data-request-key")));
|
|
401
|
+
const viewport = document.defaultView;
|
|
402
|
+
const focused = document.activeElement?.closest?.(".request-details > summary");
|
|
403
|
+
const keepFocus = Boolean(focused && body.contains?.(focused));
|
|
404
|
+
const topInView = summary => {
|
|
405
|
+
if (!viewport?.scrollY || !summary) return null;
|
|
406
|
+
const box = summary.getBoundingClientRect();return box.bottom > 0 && box.top < viewport.innerHeight ? box.top : null;
|
|
407
|
+
};
|
|
408
|
+
let reading = keepFocus ? focused : null;
|
|
409
|
+
if (!reading && viewport?.scrollY) reading = openDetails.map(details => details.querySelector("summary")).find(summary => topInView(summary) !== null);
|
|
410
|
+
const readingKey = reading?.parentElement?.getAttribute("data-request-key"), readingTop = topInView(reading);
|
|
411
|
+
let restoredSummary;
|
|
380
412
|
body.replaceChildren();
|
|
381
413
|
for (const request of contextRequests) {
|
|
382
414
|
const context = request.context || {};
|
|
@@ -385,9 +417,12 @@
|
|
|
385
417
|
const ratio = finite(context.input_tokens) && finite(context.context_window_tokens) && Number(context.context_window_tokens) > 0
|
|
386
418
|
? `${(100 * Number(context.input_tokens) / Number(context.context_window_tokens)).toFixed(1)}%` : "—";
|
|
387
419
|
const at = Date.parse(request.at);
|
|
388
|
-
const
|
|
389
|
-
|
|
390
|
-
|
|
420
|
+
const totalMs = request.timings_ms?.finished;
|
|
421
|
+
const app = ["codex", "codex_app", "codex_cli", "claude", "claude_app", "claude_code", "gemini_app", "api"].includes(request.application) ? request.application : "api";
|
|
422
|
+
const row = tableRow([Number.isFinite(at) ? time(at) : "—", "",
|
|
423
|
+
String(request.model || "unknown").slice(0, 80), outcome, Number.isFinite(totalMs) ? requestTime(totalMs) : "—", ""], { labels: [3] });
|
|
424
|
+
localize(row.children[1], `flow_app_${app}`);
|
|
425
|
+
row.children[4].className = "recent-request-duration";
|
|
391
426
|
const wireFailure = Number.isInteger(request.http_status) && request.http_status >= 400;
|
|
392
427
|
if (request.rejection_reason) {
|
|
393
428
|
if (globalThis.ccdxIcons) globalThis.ccdxIcons.set(row.children[3], "request_access_blocked", "unavailable");else localize(row.children[3], "request_access_blocked");
|
|
@@ -397,22 +432,32 @@
|
|
|
397
432
|
const details = document.createElement("details"), summary = document.createElement("summary"), fields = document.createElement("dl");
|
|
398
433
|
const key = String(request.request_id || `${request.at || ""}/${request.provider || ""}/${request.model || ""}`).slice(0, 256);
|
|
399
434
|
details.setAttribute?.("data-request-key", key);details.open = expanded.has(key);
|
|
435
|
+
if (key === readingKey) restoredSummary = summary;
|
|
400
436
|
details.className = "request-details";fields.className = "failure-detail";
|
|
401
|
-
|
|
402
|
-
else localize(summary, "request_metadata");details.append(summary, fields);
|
|
437
|
+
localize(summary, "tools_details");details.append(summary, fields);
|
|
403
438
|
const queue = context.body_queue;
|
|
404
439
|
const queueResult = queue?.outcome === "admitted" ? "body_queue_admitted" : queue?.outcome === "timed_out" ? "body_queue_timed_out"
|
|
405
440
|
: queue?.outcome === "aborted" ? "body_queue_aborted" : "body_queue_result_unknown";
|
|
406
441
|
const queueReason = queue?.reason === "upload_in_progress" ? "body_queue_upload_in_progress" : queue?.reason === "upload_growth" ? "body_queue_upload_growth"
|
|
407
442
|
: queue?.reason === "exclusive_waiter" ? "body_queue_exclusive"
|
|
408
443
|
: queue?.length_known === false && queue.requested_bytes === queue.limit_bytes ? "body_queue_unknown_length" : "body_queue_budget";
|
|
444
|
+
const attempt = request.attempts?.at(-1);
|
|
409
445
|
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],
|
|
410
446
|
["time", Number.isFinite(at) ? time(at, { date: true }) : "—"],
|
|
411
|
-
|
|
447
|
+
["source", String(sourceLabel(request.provider) || "—").slice(0, 80)], ["input_tokens", number(context.input_tokens)],
|
|
448
|
+
...(Number.isSafeInteger(queue?.wait_ms) && queue.wait_ms > 0 ? [["body_queue_wait", phrase("body_queue_detail", {
|
|
412
449
|
ms: number(queue.wait_ms), result: phrase(queueResult), reason: phrase(queueReason),
|
|
413
450
|
reserved: mib(queue.requested_bytes), occupied: mib(queue.active_bytes), limit: mib(queue.limit_bytes),
|
|
414
451
|
})]] : []),
|
|
415
|
-
...(Number.isSafeInteger(context.source_queue_ms) ? [["source_queue_wait", `${number(context.source_queue_ms)} ms`]] : []),
|
|
452
|
+
...(Number.isSafeInteger(context.source_queue_ms) && context.source_queue_ms > 0 ? [["source_queue_wait", `${number(context.source_queue_ms)} ms`]] : []),
|
|
453
|
+
...(Number.isSafeInteger(attempt?.body_written_bytes) && !Number.isFinite(attempt.body_sent_ms) ? [["upstream_body_written", `${number(attempt.body_written_bytes)} / ${number(context.payload_bytes)} B`]] : []),
|
|
454
|
+
...(attempt?.transport_error ? [["upstream_transport_error", attempt.transport_error]] : []),
|
|
455
|
+
...(Number.isFinite(attempt?.body_sent_ms) ? [["upstream_request_sent", `${number(attempt.body_sent_ms - attempt.started_ms)} ms`]] : []),
|
|
456
|
+
...(Number.isFinite(attempt?.body_sent_ms) && Number.isFinite(attempt.headers_ms) ? [["upstream_wait_headers", requestTime(Math.max(0, attempt.headers_ms - attempt.body_sent_ms))]]
|
|
457
|
+
: Number.isFinite(attempt?.body_sent_ms) && attempt.headers_ms === null && request.origin === "transport" && request.http_status === 504 ? [["upstream_wait_headers", phrase("upstream_no_headers")]] : []),
|
|
458
|
+
...(Number.isFinite(request.timings_ms?.first_output) ? [["request_first_output", requestTime(request.timings_ms.first_output)]] : []),
|
|
459
|
+
...(attempt?.client_request_id ? [["client_request_id", attempt.client_request_id]] : []),
|
|
460
|
+
...(Number.isSafeInteger(context.privacy_count) ? [["request_masking", phrase("privacy_result", { count: context.privacy_count, ms: context.privacy_ms || 0 })]] : []),
|
|
416
461
|
["wire_mib", finite(context.payload_bytes) ? `${(Number(context.payload_bytes) / 1048576).toFixed(2)} MiB` : "—"],
|
|
417
462
|
["images", number(context.images)], ["model_window", number(context.context_window_tokens)], ["input_window", ratio],
|
|
418
463
|
["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 || "—"],
|
|
@@ -425,6 +470,13 @@
|
|
|
425
470
|
}
|
|
426
471
|
row.children[5].append(details);body.append(row);
|
|
427
472
|
}
|
|
473
|
+
if (restoredSummary) {
|
|
474
|
+
if (keepFocus) restoredSummary.focus({ preventScroll: true });
|
|
475
|
+
if (readingTop !== null) {
|
|
476
|
+
const shift = restoredSummary.getBoundingClientRect().top - readingTop;
|
|
477
|
+
if (Math.abs(shift) > 1) viewport.scrollBy(0, shift);
|
|
478
|
+
}
|
|
479
|
+
}
|
|
428
480
|
if (!contextRequests.length) emptyTable("context-body", 6, "no_observed_request_metadata");
|
|
429
481
|
}
|
|
430
482
|
return { render, renderActivity, renderProviders, renderFailures, renderContext };
|
|
@@ -148,7 +148,7 @@
|
|
|
148
148
|
const displayed = active.length ? rows : agents.length ? agents : rows;
|
|
149
149
|
const groups = new Map(displayed.map(row => [`${row.application}:${row.provider}:${row.model}`, row]));
|
|
150
150
|
el("tool-context").hidden = !displayed.length;
|
|
151
|
-
el("tool-context").textContent = groups.size === 1 ?
|
|
151
|
+
el("tool-context").textContent = groups.size === 1 ? phrase("model_action_label", { name: appName(displayed[0].application), action: displayed[0].model === "other" ? phrase("flow_model_pending") : displayed[0].model }) : phrase("tool_groups", { count: groups.size });
|
|
152
152
|
const list = el("tool-list");list.replaceChildren();
|
|
153
153
|
for (const row of displayed.slice(0, 6)) {
|
|
154
154
|
const agent = row.responding !== undefined;
|
|
@@ -161,7 +161,13 @@
|
|
|
161
161
|
el("tool-details").hidden = !rows.length;
|
|
162
162
|
el("tool-technical").replaceChildren();
|
|
163
163
|
for (const row of rows) {
|
|
164
|
-
const line = document.createElement("
|
|
164
|
+
const line = document.createElement("dl");line.className = "tool-record-fields";
|
|
165
|
+
for (const [label, value] of [["client", appName(row.application)], ["source", sourceName(row.provider)],
|
|
166
|
+
["model", row.model], ["tool_heading", row.name || phrase("tool_action_generic")], ["outcome", phrase(`tool_row_${row.state}`)]]) {
|
|
167
|
+
const term = document.createElement("dt"), detail = document.createElement("dd");
|
|
168
|
+
term.textContent = phrase(label);detail.textContent = value;line.append(term, detail);
|
|
169
|
+
}
|
|
170
|
+
el("tool-technical").append(line);
|
|
165
171
|
}
|
|
166
172
|
el("tool-more").hidden = rows.length <= 6 && !omitted;
|
|
167
173
|
text("tool-more", "tool_more", { count: Math.max(0, rows.length - 6) + omitted });
|
package/src/dashboard/tools.js
CHANGED
|
@@ -167,7 +167,7 @@
|
|
|
167
167
|
el("config-preview-details").textContent = data.checks.map(check => check.message).join("\n");
|
|
168
168
|
text("checks-note", "tools_review_repair");
|
|
169
169
|
} else if (action.action === "compatibility") {
|
|
170
|
-
el("compatibility-note").textContent = (data.checks || []).map(check => check.message).join("
|
|
170
|
+
el("compatibility-note").textContent = (data.checks || []).map(check => check.message).join("\n");
|
|
171
171
|
} else if (action.action === "repair") {
|
|
172
172
|
el("config-repair-preview").hidden = true;repairPreview = null;
|
|
173
173
|
if (data.local?.checked_at) renderChecks(data.local);
|
package/src/dashboard/ui.css
CHANGED
|
@@ -594,7 +594,7 @@ input[role="switch"]:disabled { opacity: .5; cursor: wait; }
|
|
|
594
594
|
.binding-table td:first-child { grid-column: 1; min-width: 0; }
|
|
595
595
|
.binding-table td:first-child label { overflow-wrap: anywhere; }
|
|
596
596
|
.binding-table td[data-label] { grid-column: 1 / -1; color: var(--muted); }
|
|
597
|
-
.binding-table td[data-label]::before { content: attr(data-label)
|
|
597
|
+
.binding-table td[data-label]::before { content: attr(data-label); margin-inline-end: 8px; color: var(--subtle); }
|
|
598
598
|
.binding-table td:last-child { grid-column: 2; grid-row: 1; align-self: center; }
|
|
599
599
|
.binding-table td:last-child button { min-width: 88px; padding: 9px; }
|
|
600
600
|
.binding-table td[colspan] { grid-column: 1 / -1; }
|
|
@@ -708,3 +708,29 @@ input[role="switch"]:disabled { opacity: .5; cursor: wait; }
|
|
|
708
708
|
@keyframes tool-cursor { 50% { opacity:0; } }
|
|
709
709
|
@media(max-width:620px) { .tool-stage { grid-template-columns:1fr;gap:8px; }.tool-visual { width:100%;max-width:330px;margin:auto; }.tool-content { padding-bottom:8px; }.tool-context { margin-bottom:4px; } }
|
|
710
710
|
@media(prefers-reduced-motion:reduce) { #tool-cursor { animation:none; } }
|
|
711
|
+
|
|
712
|
+
/* Compact request statistics in the existing diagnostics panel. */
|
|
713
|
+
.request-kpis { display: flex; flex-wrap: wrap; gap: 5px 16px; margin: 8px 0; font-size: 12px; }
|
|
714
|
+
.request-kpis > div, .http-error-grid > div { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
|
|
715
|
+
.request-kpis dt, .http-error-grid dt { color: var(--muted); }
|
|
716
|
+
.request-kpis dd, .http-error-grid dd { margin: 0; font-weight: 650; font-variant-numeric: tabular-nums; }
|
|
717
|
+
.http-error-table { width: auto; margin: 4px 0; }
|
|
718
|
+
.http-error-table :is(th,td) { text-align: right; white-space: normal; padding-block: 4px; font-variant-numeric: tabular-nums; }
|
|
719
|
+
.http-error-grid { display: none; }
|
|
720
|
+
.request-limits-line { display: flex; flex-wrap: wrap; gap: 4px 10px; }
|
|
721
|
+
.recent-request-duration { text-align: right; font-variant-numeric: tabular-nums; }
|
|
722
|
+
@media (max-width: 620px) {
|
|
723
|
+
.http-error-table { display: none; }
|
|
724
|
+
.http-error-grid { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: 4px 10px; margin: 6px 0; font-size: 12px; }
|
|
725
|
+
.http-error-grid > div { grid-column: span 2; justify-content: space-between; }
|
|
726
|
+
.http-error-grid > div:nth-child(n+4) { grid-column: span 3; }
|
|
727
|
+
.http-error-grid dt { overflow-wrap: anywhere; }
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
.metadata-check-time { display: block; color: var(--muted); }
|
|
731
|
+
.tool-record-fields { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 2px 8px; margin: 4px 0 8px; }
|
|
732
|
+
.tool-record-fields dt { color: var(--muted); }
|
|
733
|
+
.tool-record-fields dd { margin: 0; overflow-wrap: anywhere; }
|
|
734
|
+
[data-view="system"] .setting-row { gap: 10px; padding-block: 8px; }
|
|
735
|
+
[data-view="overview"] .card { min-height: 0; padding-block: 12px; }
|
|
736
|
+
[data-view="overview"] .card strong { margin-top: 6px; }
|
package/src/dashboard/updates.js
CHANGED
|
@@ -31,7 +31,7 @@ try {
|
|
|
31
31
|
const command = installationCommand(platform, snapshot?.current?.version, snapshot?.latest?.version);
|
|
32
32
|
element("install-command").textContent = command;
|
|
33
33
|
element("copy-install").disabled = !command;
|
|
34
|
-
element("install-shell").textContent = platform === "windows" ? "Windows
|
|
34
|
+
element("install-shell").textContent = platform === "windows" ? "Windows PowerShell" : "macOS Terminal";
|
|
35
35
|
element("install-windows-policy").hidden = platform !== "windows";
|
|
36
36
|
}
|
|
37
37
|
function render(data) {
|
|
@@ -4,6 +4,8 @@ import { isProviderId } from "./provider-metadata.mjs";
|
|
|
4
4
|
import { transportErrorDetails } from "./operation-error.mjs";
|
|
5
5
|
import { safeUpstreamReason } from "./safe-upstream-error.mjs";
|
|
6
6
|
|
|
7
|
+
import { upstreamRetryAfter } from "./upstream-headers.mjs";
|
|
8
|
+
|
|
7
9
|
const DEFAULT_RECENT_FAILURES = 10;
|
|
8
10
|
|
|
9
11
|
function safeIdentifier(value, fallback = "unknown") {
|
|
@@ -159,7 +161,7 @@ export function createHttpFailureDiagnostics({ maxEntries = 20, now } = {}) {
|
|
|
159
161
|
all.record(details);
|
|
160
162
|
const accessNotice = details.reason === "ccdx_model_not_selected" || details.reason === "ccdx_client_source_disabled";
|
|
161
163
|
const category = accessNotice || details.route === "messages_count_tokens" ? "capability"
|
|
162
|
-
: ["responses", "responses_compact", "messages"].includes(details.route) ? "inference"
|
|
164
|
+
: ["responses", "responses_compact", "messages", "antigravity"].includes(details.route) ? "inference"
|
|
163
165
|
: details.route === "image_mcp" && details.http_status === 405 ? "protocol"
|
|
164
166
|
: details.route === "not_found" ? "route" : "other";
|
|
165
167
|
counts[category]++;
|
|
@@ -208,7 +210,9 @@ export function buildHttpFailureDetails({ statusCode, route, requestId, model, c
|
|
|
208
210
|
: error_body === "empty" ? "Upstream returned no error details." : "HTTP request failed; original response was preserved.");
|
|
209
211
|
const details = responseFailureDetails({ model, error: { code: typeof code === "string" && /^[a-z\d_.:-]{1,80}$/i.test(code) ? code : `http_${statusCode}`,
|
|
210
212
|
message: model_error ? "The model source reported an error; the original HTTP response was preserved." : message } }, model_error ? "model.error" : "http.error", { headers, provider });
|
|
213
|
+
const retryAfter = origin === "upstream_http" && [429, 503].includes(statusCode) ? upstreamRetryAfter(headers) : null;
|
|
211
214
|
return { ...details, request_id: requestId, http_status: statusCode, route,
|
|
215
|
+
...(retryAfter === null ? {} : { retry_after: retryAfter }),
|
|
212
216
|
origin: origin || (route === "not_found" ? "route" : "unclassified"), local_message: true,
|
|
213
217
|
...(error_body ? { error_body } : {}), ...(error_type ? { error_type } : {}),
|
|
214
218
|
...(safeUpstreamReason(upstream_code, statusCode) ? { upstream_code } : {}), ...(parameter ? { parameter } : {}),
|
|
@@ -217,7 +221,7 @@ export function buildHttpFailureDetails({ statusCode, route, requestId, model, c
|
|
|
217
221
|
...(request_options ? { request_options } : {}),
|
|
218
222
|
...(attempt_timings ? { attempt_timings } : {}),
|
|
219
223
|
...(requested_model ? { requested_model, request_kind: requested_model === "codex-auto-review" ? "auto_review" : "unknown" } : {}),
|
|
220
|
-
...(["codex_app", "codex_cli", "codex", "claude_app", "claude_code", "claude", "api"].includes(application) ? { application } : {}),
|
|
224
|
+
...(["codex_app", "codex_cli", "codex", "claude_app", "claude_code", "claude", "gemini_app", "api"].includes(application) ? { application } : {}),
|
|
221
225
|
...(Object.hasOwn(reasons, reason) ? { reason } : {}),
|
|
222
226
|
...(capability_cached === true ? { capability_cached: true } : {}), ...(shared_upstream === true ? { shared_upstream: true } : {}),
|
|
223
227
|
...(transport ? { transport: transportErrorDetails({ transport }) } : {}),
|
package/src/responses-bridge.mjs
CHANGED
|
@@ -86,8 +86,11 @@ function emptyReasoningItem(item) {
|
|
|
86
86
|
&& Object.keys(item).every(key => ["type", "id", "status", "summary", "content", "encrypted_content"].includes(key));
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
+
const isEmptyUser = message => message.role === "user" && (message.content === "" || Array.isArray(message.content) && message.content.length === 0);
|
|
90
|
+
|
|
89
91
|
export function responsesToChat(body, { reasoningEfforts, cacheSupport } = {}) {
|
|
90
92
|
const messages = [];
|
|
93
|
+
let emptyUserPlaceholder = false;
|
|
91
94
|
if (body.instructions) messages.push({ role: "system", content: body.instructions });
|
|
92
95
|
|
|
93
96
|
const cacheFields = value => {
|
|
@@ -134,7 +137,9 @@ export function responsesToChat(body, { reasoningEfforts, cacheSupport } = {}) {
|
|
|
134
137
|
&& ["user", "assistant", "system", "developer"].includes(item?.role)
|
|
135
138
|
&& Object.prototype.hasOwnProperty.call(item, "content");
|
|
136
139
|
if (item?.type === "message" || isEasyMessage) {
|
|
137
|
-
|
|
140
|
+
const message = { role: item.role, content: messageContent(item.content, item) };
|
|
141
|
+
if (isEmptyUser(message)) emptyUserPlaceholder = true;
|
|
142
|
+
messages.push(message);
|
|
138
143
|
} else if (item?.type === "agent_message") {
|
|
139
144
|
if (typeof item.author !== "string" || typeof item.recipient !== "string" || !Array.isArray(item.content) || item.encrypted_content != null) {
|
|
140
145
|
throw chatCompatibilityError("input item", "agent_message");
|
|
@@ -195,7 +200,10 @@ export function responsesToChat(body, { reasoningEfforts, cacheSupport } = {}) {
|
|
|
195
200
|
}
|
|
196
201
|
}
|
|
197
202
|
|
|
198
|
-
|
|
203
|
+
// A media placeholder can be empty after Codex compaction. Preserve lone
|
|
204
|
+
// empty input for provider validation, and keep images and cache markers.
|
|
205
|
+
const omitPlaceholders = emptyUserPlaceholder && messages.some(message => message.role === "user" && message.content !== null && !isEmptyUser(message));
|
|
206
|
+
const chatReq = { model: body.model, messages: omitPlaceholders ? messages.filter(message => !isEmptyUser(message)) : messages, stream: true };
|
|
199
207
|
for (const k of ["temperature", "top_p", "stop", "presence_penalty", "frequency_penalty"]) {
|
|
200
208
|
if (body[k] !== undefined) chatReq[k] = body[k];
|
|
201
209
|
}
|
|
@@ -379,8 +379,12 @@ export function createResponsesHandler(options) {
|
|
|
379
379
|
carbonBridge = prepareCarbonToolBridge(prepared.body, prepared.currentInputStart);
|
|
380
380
|
if (streaming) carbonStream = createCarbonStreamAdapter(carbonBridge);
|
|
381
381
|
}
|
|
382
|
-
|
|
382
|
+
let chatContext = carbonBridge
|
|
383
383
|
? { ...prepared, body: carbonBridge.body, currentInputStart: carbonBridge.currentInputStart } : prepared;
|
|
384
|
+
if (carbonRoute) {
|
|
385
|
+
const { normalizeCarbonToolSchemas } = await import("./carbon-tool-schema.mjs");
|
|
386
|
+
chatContext = { ...chatContext, body: normalizeCarbonToolSchemas(chatContext.body) };
|
|
387
|
+
}
|
|
384
388
|
let { chatReq, bodyText } = await prepareResponsesChatPayload(chatContext, {
|
|
385
389
|
assertActive: assertPrepareActive,
|
|
386
390
|
payloadOptions: responsesPayloadOptions,
|
package/src/source-transport.mjs
CHANGED
|
@@ -14,6 +14,6 @@ export function sourceTransport(options, input) {
|
|
|
14
14
|
const context = options[SOURCE_HTTP_CONTEXT];
|
|
15
15
|
if (!context || options.countTokens) return send(input);
|
|
16
16
|
return context.scheduler.run(context.descriptor(), send, { args: input, signal: options.signal,
|
|
17
|
-
model: input.model, client: currentRequestContext()?.application || "other", bodyText: input.bodyText,
|
|
17
|
+
model: input.model, client: currentRequestContext()?.application || "other", bodyText: input.bodyText, bytes: input.bodyBytes,
|
|
18
18
|
sourceBodyManaged: options.sourceBodyManaged === true });
|
|
19
19
|
}
|
|
@@ -287,7 +287,7 @@ export function createStreamPerformanceMetrics({ now = () => performance.now(),
|
|
|
287
287
|
changes.changed();
|
|
288
288
|
};
|
|
289
289
|
|
|
290
|
-
|
|
290
|
+
const tracker = {
|
|
291
291
|
beginStage(stage) {
|
|
292
292
|
const histogram = route.preparation[stage];
|
|
293
293
|
if (!histogram || finished) return null;
|
|
@@ -473,6 +473,21 @@ export function createStreamPerformanceMetrics({ now = () => performance.now(),
|
|
|
473
473
|
else route.success_with_output += 1;
|
|
474
474
|
},
|
|
475
475
|
};
|
|
476
|
+
if (routeName === "antigravity") tracker.observeUpstreamBodyWrite = clientRequestId => {
|
|
477
|
+
const attempt = attemptTimings.at(-1);
|
|
478
|
+
if (!attempt || finished) return;
|
|
479
|
+
return (kind, value) => {
|
|
480
|
+
if (finished) return;
|
|
481
|
+
if (kind === "start") {
|
|
482
|
+
attempt.body_written_bytes ??= 0;
|
|
483
|
+
if (typeof clientRequestId === "string" && /^[a-f0-9]{8}(?:-[a-f0-9]{4}){3}-[a-f0-9]{12}$/i.test(clientRequestId)) attempt.client_request_id = clientRequestId;
|
|
484
|
+
}
|
|
485
|
+
if (kind === "chunk") attempt.body_written_bytes = (attempt.body_written_bytes || 0) + value;
|
|
486
|
+
if (kind === "sent") attempt.body_sent_ms ??= elapsed(now());
|
|
487
|
+
if (kind === "error") attempt.transport_error ??= value;
|
|
488
|
+
};
|
|
489
|
+
};
|
|
490
|
+
return tracker;
|
|
476
491
|
},
|
|
477
492
|
contextSnapshot: () => contexts.snapshot(),
|
|
478
493
|
activitySnapshot() {
|
|
@@ -530,6 +545,10 @@ export function markUpstreamStarted(streaming = true) {
|
|
|
530
545
|
tracker()?.upstreamStarted(streaming);
|
|
531
546
|
}
|
|
532
547
|
|
|
548
|
+
export function observeUpstreamBodyWrite(clientRequestId) {
|
|
549
|
+
return tracker()?.observeUpstreamBodyWrite?.(clientRequestId);
|
|
550
|
+
}
|
|
551
|
+
|
|
533
552
|
export function markUpstreamHeaders(statusCode) {
|
|
534
553
|
tracker()?.upstreamHeaders?.(statusCode);
|
|
535
554
|
}
|
package/src/upstream-headers.mjs
CHANGED
|
@@ -27,6 +27,29 @@ function headerValue(headers, name) {
|
|
|
27
27
|
return typeof value === "string" && value.trim() ? value : null;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
// Keep only a valid delay or an HTTP-date from an upstream rejection.
|
|
31
|
+
export function upstreamRetryAfter(headers) {
|
|
32
|
+
const value = headerValue(headers, "retry-after")?.trim();
|
|
33
|
+
if (!value) return null;
|
|
34
|
+
if (/^\d{1,8}(?:\.\d{1,3})?$/.test(value)) return String(Math.ceil(Number(value)));
|
|
35
|
+
if (!/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), \d{2} [A-Za-z]{3} \d{4} \d{2}:\d{2}:\d{2} GMT$/.test(value)) return null;
|
|
36
|
+
const parsed = Date.parse(value);
|
|
37
|
+
return Number.isFinite(parsed) && new Date(parsed).toUTCString() === value ? value : null;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function upstreamRejectionHeaders(status, headers) {
|
|
41
|
+
const out = new Headers();
|
|
42
|
+
if (status === 429 || status === 503) {
|
|
43
|
+
const retry = upstreamRetryAfter(headers);
|
|
44
|
+
if (retry !== null) out.set("Retry-After", retry);
|
|
45
|
+
}
|
|
46
|
+
for (const name of REQUEST_ID_HEADERS) {
|
|
47
|
+
const id = headerValue(headers, name)?.trim();
|
|
48
|
+
if (/^[A-Za-z0-9._:/-]{1,160}$/.test(id || "")) { out.set(name, id);break; }
|
|
49
|
+
}
|
|
50
|
+
return out;
|
|
51
|
+
}
|
|
52
|
+
|
|
30
53
|
function canonicalHeaderName(name) {
|
|
31
54
|
return String(name).split("-").map((part) => (
|
|
32
55
|
part ? `${part[0].toUpperCase()}${part.slice(1).toLowerCase()}` : part
|