codex-copilot-dx 1.4.12 → 1.4.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/dashboard.mjs CHANGED
@@ -17,6 +17,7 @@ const ASSETS = new Map([
17
17
  ["/status.js", ["./dashboard/status.js", "text/javascript; charset=utf-8"]],
18
18
  ["/activity.js", ["./dashboard/activity.js", "text/javascript; charset=utf-8"]],
19
19
  ["/flow.js", ["./dashboard/flow.js", "text/javascript; charset=utf-8"]],
20
+ ["/tool-activity-machines.js", ["./dashboard/tool-activity-machines.js", "text/javascript; charset=utf-8"]],
20
21
  ["/tool-activity.js", ["./dashboard/tool-activity.js", "text/javascript; charset=utf-8"]],
21
22
  ["/usage.js", ["./dashboard/usage.js", "text/javascript; charset=utf-8"]],
22
23
  ["/context.js", ["./dashboard/context.js", "text/javascript; charset=utf-8"]],
@@ -210,14 +210,18 @@ export function buildHttpFailureDetails({ statusCode, route, requestId, model, c
210
210
  : origin === "privacy" ? "Local privacy processing failed. Review its error code and request timeline."
211
211
  : origin === "client_validation" ? "The request was rejected locally before an upstream call."
212
212
  : error_body === "empty" ? "Upstream returned no error details." : "HTTP request failed; original response was preserved.");
213
+ const streamError = model_error === true && origin === "upstream_event";
214
+ const safeReason = safeUpstreamReason(upstream_code, statusCode, { stream: streamError });
213
215
  const details = responseFailureDetails({ model, error: { code: typeof code === "string" && /^[a-z\d_.:-]{1,80}$/i.test(code) ? code : `http_${statusCode}`,
214
- message: model_error ? "The model source reported an error; the original HTTP response was preserved." : message } }, model_error ? "model.error" : "http.error", { headers, provider });
215
- const retryAfter = origin === "upstream_http" && [429, 503].includes(statusCode) ? upstreamRetryAfter(headers) : null;
216
+ message: streamError ? safeReason?.message || "The source reported an error while streaming."
217
+ : model_error ? "The model source reported an error; the original HTTP response was preserved." : message } }, model_error ? "model.error" : "http.error", { headers, provider });
218
+ const retryAfter = (origin === "upstream_http" && [429, 503].includes(statusCode)
219
+ || streamError && safeReason && safeUpstreamReason(safeReason.code, 429)) ? upstreamRetryAfter(headers) : null;
216
220
  return { ...details, request_id: requestId, http_status: statusCode, route,
217
221
  ...(retryAfter === null ? {} : { retry_after: retryAfter }),
218
222
  origin: origin || (route === "not_found" ? "route" : "unclassified"), local_message: true,
219
223
  ...(error_body ? { error_body } : {}), ...(error_type ? { error_type } : {}),
220
- ...(safeUpstreamReason(upstream_code, statusCode) ? { upstream_code } : {}), ...(parameter ? { parameter } : {}),
224
+ ...(safeReason ? { upstream_code: safeReason.code } : {}), ...(parameter ? { parameter } : {}),
221
225
  ...(diagnostic_message ? { diagnostic_message } : {}),
222
226
  ...(method ? { method } : {}), ...(target ? { target } : {}),
223
227
  ...(request_options ? { request_options } : {}),
@@ -27,9 +27,9 @@ const reasons = new Map([
27
27
  const MAX_ACTIVE_READS = 4;
28
28
  let activeReads = 0;
29
29
 
30
- export function safeUpstreamReason(code, status) {
30
+ export function safeUpstreamReason(code, status, { stream = false } = {}) {
31
31
  const reason = typeof code === "string" ? reasons.get(code) : null;
32
- return reason?.statuses.includes(status) ? { code, message: reason.message } : null;
32
+ return reason && (stream || reason.statuses.includes(status)) ? { code, message: reason.message } : null;
33
33
  }
34
34
 
35
35
  export function safeUpstreamParameter(value){
@@ -361,7 +361,7 @@ export function createStreamPerformanceMetrics({ now = () => performance.now(),
361
361
  if (Number.isSafeInteger(values.source_queue_ms) && values.source_queue_ms >= 0) context.source_queue_ms = values.source_queue_ms;
362
362
  if (values.delivery_cancelled === 1) context.delivery_cancelled = 1;
363
363
  if (Number.isSafeInteger(values.cached_input_tokens) && values.cached_input_tokens >= 0) cachedInput = values.cached_input_tokens;
364
- for (const key of [...Object.keys(context), "compaction", "requested_model", "reasoning_effort_requested", "reasoning_effort_sent", "usage_state", "capability_revision", "capability_constraints", "privacy_count", "privacy_ms", "privacy_state", "privacy_pending_bytes", "privacy_new_bytes", "privacy_pending_windows", "privacy_wait_budget_ms", "privacy_error", "privacy_event_type", "privacy_channel_type", "privacy_buffered_bytes", "privacy_terminal_seen", "client_tool_errors_received"]) {
364
+ for (const key of [...Object.keys(context), "compaction", "requested_model", "routing_reason", "reasoning_effort_requested", "reasoning_effort_sent", "usage_state", "capability_revision", "capability_constraints", "privacy_count", "privacy_ms", "privacy_state", "privacy_pending_bytes", "privacy_new_bytes", "privacy_pending_windows", "privacy_wait_budget_ms", "privacy_error", "privacy_event_type", "privacy_channel_type", "privacy_buffered_bytes", "privacy_terminal_seen", "client_tool_errors_received"]) {
365
365
  const value = values[key];
366
366
  if (["reasoning_effort_requested", "reasoning_effort_sent"].includes(key)) { if (["none", "minimal", "low", "medium", "high", "xhigh", "max"].includes(value)) context[key] = value;continue; }
367
367
  if (key === "requested_model") { if (typeof value === "string" && /^[\w][\w./:@+-]{0,159}$/.test(value) && redactDiagnosticText(value) === value) context[key] = value;continue; }
@@ -8,7 +8,10 @@ export function terminalRequestState(row) {
8
8
  if (row.terminal_outcome) return "Finishing";
9
9
  if (row.first_output_ms != null) return "Responding";
10
10
  if (row.phase === "admission") return "Queued";
11
- if (row.upstream_attempts > 1) return "Retrying";
11
+ const attempt = row.attempts?.at(-1);
12
+ if (attempt?.headers_ms != null || ["upstream_response", "upstream_stream"].includes(row.phase)) return "Reading response";
13
+ if (attempt?.body_sent_ms != null) return "Waiting for response headers";
14
+ if (attempt?.body_written_bytes != null) return "Sending request";
12
15
  return row.upstream_attempts ? "Waiting upstream" : "Processing input";
13
16
  }
14
17
  const labels = { configured: "Configured", paused: "Paused", disabled: "Disabled", not_configured: "Not configured", not_installed: "Not installed",
@@ -72,7 +75,10 @@ export function retainedRequests(data = {}) {
72
75
  }
73
76
  for (const record of data.http_errors?.recent || data.http_errors?.actionable_recent || []) if (record.request_id) {
74
77
  const existing = rows.get(record.request_id);
75
- rows.set(record.request_id, { ...existing, ...record, error: true, active: existing?.active === true, state: ["cancelled", "incomplete"].includes(existing?.state) ? existing.state : "failed" });
78
+ const capability = record.route === "messages_count_tokens" || ["ccdx_model_not_selected", "ccdx_client_source_disabled"].includes(record.reason);
79
+ rows.set(record.request_id, { ...existing, ...record, error: true, active: existing?.active === true,
80
+ ...(capability ? { failure_category: "capability" } : {}),
81
+ state: capability ? "capability" : ["cancelled", "incomplete"].includes(existing?.state) ? existing.state : "failed" });
76
82
  }
77
83
  const time = row => { const value = Date.parse(row.at || row.time || "");return Number.isFinite(value) ? value : 0; };
78
84
  return [...rows.values()].sort((a, b) => Number(a.active) - Number(b.active) || time(a) - time(b));