codex-copilot-dx 1.1.0 → 1.1.1

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/README.md CHANGED
@@ -21,7 +21,7 @@ enabled. In restricted Windows PowerShell, use `npm.cmd` to install and `ccdx.cm
21
21
 
22
22
  The [local control console](http://127.0.0.1:2026/) has a sidebar for **Overview, Clients, Model services, Usage and diagnostics, System and settings**. Codex image generation, input predictions and conversation buffering are explicitly Codex-specific. Provider authorization, model directories, retained usage and operations keep their own scopes. Browsing a catalog never switches the active source.
23
23
 
24
- Startup shows bounded checks, existing owned-configuration reconciliation and enabled prediction recovery. After Ready, an interactive terminal has a fixed four-line status region with returned usage for this process, business activity and coalesced notices. It does not scroll individual requests. `ccdx --verbose` (also `--show-request-id`, or debug logging) retains detail output; optional file logging remains independently controlled. Non-TTY, CI, dumb or very narrow terminals use plain output. `Ready` only means the core service is available.
24
+ Startup shows bounded checks, discovered Provider catalogs and Claude Code/App configuration. Prediction normally uses one summary line; `ccdx prediction status` retains recovery and environment details. After Ready, an interactive terminal shows current Provider/Claude state and a line-framed table of this process's returned usage and inference counters. Notices and activity each have their own line; individual requests do not scroll. Input includes cache-read tokens. `ccdx --verbose` (also `--show-request-id`, or debug logging) retains detail output; optional file logging remains independently controlled. Non-TTY, CI, dumb or terminals smaller than 40 columns / 16 rows use plain output. `Ready` only means the core service is available; discovered catalogs and configured clients do not prove inference access.
25
25
 
26
26
  WebUI settings apply animation choices live, pause/resume configured image calls and prediction adaptation without removing credentials/trust, change the Codex source explicitly, and manage the conversation-buffer limit. Saved preference and effective state are separate. First-time image/prediction setup still uses the existing CLI; trust, client routing and cached client capabilities may require a normal App relaunch. Busy M365 requests must finish before disabling that provider. See the [control reference](docs/REFERENCE.md#control-console-and-online-settings).
27
27
 
package/bin/cli.mjs CHANGED
@@ -22,7 +22,7 @@ import { createProfileModelRuntime } from "../src/profile-model-runtime.mjs";
22
22
  import { createCodexModelCatalog } from "../src/codex-model-catalog.mjs";
23
23
  import { createProviderRuntime } from "../src/provider-runtime.mjs";
24
24
  import { setResponseHistoryMaxBytes } from "../src/response-history.mjs";
25
- import { startupBanner, startupCheck, startupReady, startupLogger, predictionStartupCheck } from "../src/startup-ui.mjs";
25
+ import { startupBanner, startupCheck, startupReady, startupLogger, predictionStartupCheck, providerStartupChecks } from "../src/startup-ui.mjs";
26
26
  import { createTerminalConsole } from "../src/terminal-console.mjs";
27
27
  import { createServiceControl } from "../src/service-control.mjs";
28
28
  import { openDashboard } from "../src/browser-launch.mjs";
@@ -323,6 +323,7 @@ async function reuseRunningAdapterIfAvailable() {
323
323
  }
324
324
  if (!running.ok) return false;
325
325
 
326
+ const serviceStatus = readAdapterStatus({ host: ADAPTER_HOST, port: ADAPTER_PORT }).catch(() => null);
326
327
  console.log(startupCheck("ok", "Adapter", `Using existing service at ${running.baseUrl}`));
327
328
  console.log(startupCheck("info", "Auth", "Using existing service credentials; not rechecked"));
328
329
  const { compressionSetup, imageEnabled, imageMcpSkipped } = await configureCodexClient();
@@ -352,6 +353,7 @@ async function reuseRunningAdapterIfAvailable() {
352
353
  console.log(predictionStartupCheck({ configured: predictionConfigured, bridge: predictionPacUrl ? "running" : "unknown", launch_route: launchRoute }));
353
354
  console.log(startupCheck(imageEnabled && imageMcpSkipped ? "warn" : "info", "Images", imageEnabled
354
355
  ? imageMcpSkipped ? "Client setup skipped; see warning above" : "Configured; provider not tested" : "Off"));
356
+ console.log(providerStartupChecks((await serviceStatus)?.data));
355
357
  console.log(startupReady({ baseUrl: running.baseUrl, commandName: CLI_NAME, reused: true }));
356
358
  await launchDashboard();
357
359
  await compressionSetup;
@@ -486,6 +488,7 @@ try {
486
488
  console.log(predictionStartupCheck(clientIntegration?.snapshot().prediction));
487
489
  console.log(startupCheck(imageEnabled && imageMcpSkipped ? "warn" : "info", "Images", imageEnabled
488
490
  ? imageMcpSkipped ? "Client setup skipped; see warning above" : "Configured; provider not tested" : "Off"));
491
+ console.log(providerStartupChecks(activeServer.ccdxSnapshot?.()));
489
492
 
490
493
  // Periodically refresh the model list + endpoint cache so a long-running
491
494
  // adapter picks up newly released models without a restart.
@@ -305,6 +305,11 @@ before-values, preserving foreign or edited fields. Saved allow gates are separa
305
305
  from provisioning; pausing never deletes the Provider key or prediction trust.
306
306
 
307
307
  `terminal-console.mjs` owns a bounded TTY status region and activity only.
308
+ Its 15-line region has Provider/Claude summaries, a responsive line-framed table,
309
+ then separate notice and activity rows. Snapshot data is read about once a second;
310
+ animation ticks reuse the table and write only changed rows. Small viewports
311
+ (under 40 columns or 16 rows) retain plain output. Client-originated cancellations
312
+ are informational; timeouts and actual failures remain notices and file diagnostics.
308
313
  `log.mjs` routes terminal presentation independently from existing opt-in,
309
314
  redacted rotating file records. Returned usage accumulates scalar process-local
310
315
  totals in `usage-store.mjs`, without a historical-log scan or per-token callback.
package/docs/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # Documentation index
2
2
 
3
+ - [1.1.1: Clear startup checks and framed terminal status](RELEASE_1.1.1.md)
3
4
  - [1.1.0: Shared entry, control console and quiet terminal](RELEASE_1.1.0.md)
4
5
  - [1.0.0: Provider dashboard and Claude effort adaptation](RELEASE_1.0.0.md)
5
6
 
package/docs/REFERENCE.md CHANGED
@@ -1142,6 +1142,32 @@ Dark/light, English/Chinese and reduced motion remain supported. Language change
1142
1142
  translate page labels in place without fetching models or rebuilding charts;
1143
1143
  commands, identifiers and upstream error text retain their original values.
1144
1144
 
1145
+ The atom logo stays in the sidebar brand (compact top navigation on narrow screens).
1146
+ It rotates once on load and manual Refresh, never on scheduled reads, and respects
1147
+ reduced motion. Terminal animation settings are independent of the WebUI logo.
1148
+
1149
+ Startup lists the number of discovered cached/live Provider catalogs, their model
1150
+ counts and source, and separate Claude Code/App configuration states. Checking,
1151
+ unavailable, preserved custom settings and uninspected configurations remain
1152
+ distinct. Background discovery does not delay core readiness; its latest state
1153
+ appears in the running terminal region. These observations do not prove inference
1154
+ access. Normal prediction startup uses one line; exceptions retain reasons and
1155
+ required restart guidance. `ccdx prediction status` retains environment/recovery
1156
+ details, including routing, CA and TLS verification state.
1157
+
1158
+ After Ready, a supported TTY has a 15-line region: uptime, Provider/Claude state,
1159
+ a line-framed usage/inference table, one notice row and one activity row below it.
1160
+ Input includes cache read; partial records count returned usage with missing fields.
1161
+ Inference HTTP calls exclude catalog/count-tokens requests; model outcomes are
1162
+ separate protocol observations, not an HTTP-success total. Activity motion includes
1163
+ image MCP traffic; inference counters exclude it. Usage is process-local returned
1164
+ data, not a bill or pending estimate. Counts/tokens use compact display.
1165
+ Data refreshes about once a second; animation ticks reuse the table and redraw only
1166
+ changed rows. Historical notices do not turn a running service into a health verdict.
1167
+ Client cancellations remain in verbose/file diagnostics as informational records;
1168
+ timeouts and actual failures remain notices. Non-TTY, CI, dumb and terminals under
1169
+ 40 columns or 16 rows retain plain output. No runtime terminal dependency is added.
1170
+
1145
1171
  Terminal appearance lives in System/settings, with a sidebar shortcut on wide
1146
1172
  screens. Preview frames load on opening; closing, hiding the view/page or reduced
1147
1173
  motion stops preview timers. Saving changes the running supported status terminal.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codex-copilot-dx",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Local Codex adapter and optional Microsoft 365 Claude gateway",
5
5
  "author": "Dale Xiao",
6
6
  "type": "module",
@@ -18,7 +18,7 @@
18
18
  <body>
19
19
  <div class="shell">
20
20
  <aside class="sidebar">
21
- <a class="sidebar-brand" href="#overview">CCDX<span data-i18n>LOCAL CONTROL</span></a>
21
+ <a class="sidebar-brand" href="#overview"><svg id="status-icon" class="status-icon" viewBox="0 0 64 64" aria-hidden="true" focusable="false"><g fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round"><ellipse cx="32" cy="32" rx="26" ry="10"/><ellipse cx="32" cy="32" rx="26" ry="10" transform="rotate(60 32 32)"/><ellipse cx="32" cy="32" rx="26" ry="10" transform="rotate(120 32 32)"/></g><circle cx="32" cy="32" r="4.5" fill="currentColor"/></svg><span class="brand-name">CCDX</span><span class="brand-caption" data-i18n>LOCAL CONTROL</span></a>
22
22
  <nav aria-label="Main navigation" data-i18n-label>
23
23
  <a href="#overview" data-route="overview" aria-current="page" data-i18n>Overview</a>
24
24
  <span class="nav-group" data-i18n>Clients</span>
@@ -38,7 +38,7 @@
38
38
 
39
39
  <main id="main-content" tabindex="-1">
40
40
  <section class="intro">
41
- <h1><svg id="status-icon" class="status-icon" viewBox="0 0 64 64" aria-hidden="true" focusable="false"><g fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round"><ellipse cx="32" cy="32" rx="26" ry="10"/><ellipse cx="32" cy="32" rx="26" ry="10" transform="rotate(60 32 32)"/><ellipse cx="32" cy="32" rx="26" ry="10" transform="rotate(120 32 32)"/></g><circle cx="32" cy="32" r="4.5" fill="currentColor"/></svg> <span id="page-title" data-i18n>Overview</span></h1>
41
+ <h1><span id="page-title" data-i18n>Overview</span></h1>
42
42
  <div class="snapshot-meta"><p id="auth-account" role="status" data-i18n data-i18n-title title="Provider status / authorization and inference are separate.">READING</p><p id="updated" data-i18n>Reading status…</p></div>
43
43
  <p id="page-settings-note" class="hint" role="status"></p>
44
44
  </section>
@@ -24,7 +24,7 @@ button:disabled { opacity: .55; cursor: wait; }
24
24
  :root[data-theme="light"] .icon-moon { display: block; }
25
25
  .intro { display: flex; justify-content: space-between; align-items: baseline; gap: 20px; padding: 38px 0 25px; }
26
26
  h1 { margin: 0; font-size: clamp(20px, 3vw, 27px); font-weight: 650; letter-spacing: -.035em; }
27
- .status-icon { display: inline-block; width: 1em; height: 1em; vertical-align: -.125em; color: var(--accent); }
27
+ .status-icon { display: block; grid-row: 1 / 3; width: 44px; height: 44px; color: var(--accent); }
28
28
  .intro p { margin: 0; color: var(--subtle); font-size: 11px; }
29
29
  .snapshot-meta { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: baseline; gap: 8px 18px; min-width: 0; }
30
30
  .intro .snapshot-meta p { margin: 0; overflow-wrap: anywhere; }
@@ -151,8 +151,8 @@ footer { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; color:
151
151
  [hidden] { display: none !important; }
152
152
  .shell { max-width: 1520px; display: grid; grid-template-columns: 204px minmax(0, 1fr); column-gap: 34px; padding: 0 28px; }
153
153
  .sidebar { grid-row: 1 / 4; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 28px 22px 24px 0; border-right: 1px solid var(--border); }
154
- .sidebar-brand { color: var(--accent); text-decoration: none; font-size: 23px; font-weight: 750; letter-spacing: .04em; }
155
- .sidebar-brand span { display: block; color: var(--muted); font-size: 10px; font-weight: 500; letter-spacing: .1em; margin-top: 8px; }
154
+ .sidebar-brand { display: grid; grid-template-columns: 44px minmax(0, 1fr); align-items: center; column-gap: 12px; color: var(--accent); text-decoration: none; font-size: 23px; font-weight: 750; letter-spacing: .04em; }
155
+ .sidebar-brand .brand-caption { display: block; color: var(--muted); font-size: 10px; font-weight: 500; letter-spacing: .1em; margin-top: 8px; }
156
156
  .sidebar nav { display: flex; flex-direction: column; gap: 5px; margin-top: 36px; }
157
157
  .sidebar nav a { color: var(--muted); text-decoration: none; padding: 11px 12px; font-size: 13px; border-left: 2px solid transparent; }
158
158
  .sidebar nav a:hover { background: var(--option-hover); color: var(--text); }
@@ -188,4 +188,4 @@ input[role="switch"]:focus-visible, input[type="number"]:focus-visible { outline
188
188
  input[role="switch"]:disabled { opacity: .5; cursor: wait; }
189
189
  #process-queues { overflow-wrap: anywhere; font-size: 11px; }
190
190
  @media (max-width: 900px) { .shell { grid-template-columns: 170px minmax(0, 1fr); column-gap: 20px; padding: 0 20px; } .topbar .brand { display: none; } .topbar { justify-content: flex-end; } .setting-row { grid-template-columns: minmax(0, 1fr) 44px; } .setting-row .hint { grid-column: 1 / -1; } .overview { grid-template-columns: 1fr; } }
191
- @media (max-width: 640px) { .shell { display: block; padding: 0 16px; } .sidebar { position: static; height: auto; padding: 20px 0 14px; border-right: 0; border-bottom: 1px solid var(--border); } .sidebar-brand { font-size: 20px; } .sidebar-brand span { display: inline; margin-left: 12px; } .sidebar nav { display: flex; flex-direction: row; flex-wrap: wrap; gap: 4px; margin-top: 16px; } .sidebar nav a { padding: 9px 10px; font-size: 12px; border-left: 0; border-bottom: 2px solid transparent; } .sidebar nav a[aria-current="page"] { border-bottom-color: var(--accent); } .nav-group, .sidebar-bottom { display: none; } .topbar { min-height: 62px; justify-content: flex-start; } .topbar-actions { justify-content: flex-start; gap: 9px; } .intro { padding: 24px 0 18px; } .panel, .lower { padding: 17px; } .section-actions > label { width: 100%; } .stats { gap: 12px; } }
191
+ @media (max-width: 640px) { .shell { display: block; padding: 0 16px; } .sidebar { position: static; height: auto; padding: 20px 0 14px; border-right: 0; border-bottom: 1px solid var(--border); } .sidebar-brand { font-size: 20px; width: fit-content; } .sidebar-brand .brand-caption { margin-top: 4px; } .sidebar nav { display: flex; flex-direction: row; flex-wrap: wrap; gap: 4px; margin-top: 16px; } .sidebar nav a { padding: 9px 10px; font-size: 12px; border-left: 0; border-bottom: 2px solid transparent; } .sidebar nav a[aria-current="page"] { border-bottom-color: var(--accent); } .nav-group, .sidebar-bottom { display: none; } .topbar { min-height: 62px; justify-content: flex-start; } .topbar-actions { justify-content: flex-start; gap: 9px; } .intro { padding: 24px 0 18px; } .panel, .lower { padding: 17px; } .section-actions > label { width: 100%; } .stats { gap: 12px; } }
@@ -373,5 +373,6 @@ export function logRequestFailure(label, err, abort) {
373
373
 
374
374
  const reason = abort?.reason || "aborted";
375
375
  err.statusCode ||= abortErrorStatusCode(reason);
376
- console.warn(status("warn", `${label} request aborted: ${reason}`));
376
+ const cancelled = reason === "client_aborted" || reason === "client_closed";
377
+ console[cancelled ? "log" : "warn"](status(cancelled ? "info" : "warn", `${label} request aborted: ${reason}`));
377
378
  }
package/src/launcher.mjs CHANGED
@@ -83,10 +83,10 @@ export async function openCodex({ env = process.env, spawnImpl = spawn, platform
83
83
  const running = windowsAppProcesses(current.app, { env });
84
84
  if (running.length) {
85
85
  if (running.length === 1 && running[0].readable && running[0].route === predictionPacUrl) {
86
- onPredictionRoute("verified");log(status("ok", "Running Codex App uses the current prediction route"));return true;
86
+ onPredictionRoute("verified");log(status("ok", "Codex already running"));return true;
87
87
  }
88
88
  if (running.length === 1 && running[0].readable && !running[0].route && persistedPredictionRoute) {
89
- onPredictionRoute("persisted");log(status("info", "App route preference is saved; waiting for configuration traffic to confirm it"));return true;
89
+ onPredictionRoute("persisted");log(status("info", "Codex already running"));return true;
90
90
  }
91
91
  throw new Error("Running Codex App uses an old or unverified prediction route. Fully quit the App, then run ccdx again; no process was stopped");
92
92
  }
@@ -105,7 +105,7 @@ export async function openCodex({ env = process.env, spawnImpl = spawn, platform
105
105
  const routeRetained = actual.length === 1 && actual[0].readable && actual[0].route === predictionPacUrl;
106
106
  onPredictionRoute(routeRetained ? "verified" : "unverified");
107
107
  log(status(routeRetained ? "info" : "warn", routeRetained
108
- ? "Codex launch route verified; prediction status will show when configuration traffic is observed"
108
+ ? "Codex opened"
109
109
  : "Codex launch requested, but the active App did not retain the current prediction route. Core adapter remains available"));
110
110
  return routeRetained;
111
111
  } catch (error) {
@@ -132,10 +132,10 @@ export async function openCodex({ env = process.env, spawnImpl = spawn, platform
132
132
  const running = macAppProcesses(predictionApp);
133
133
  if (running.length) {
134
134
  if (running.length === 1 && running[0].readable && running[0].route === predictionPacUrl) {
135
- onPredictionRoute("verified");log(status("ok", "Running Codex App uses the current prediction route"));return true;
135
+ onPredictionRoute("verified");log(status("ok", "Codex already running"));return true;
136
136
  }
137
137
  if (running.length === 1 && running[0].readable && !running[0].route && persistedPredictionRoute) {
138
- onPredictionRoute("persisted");log(status("info", "App route preference is saved; waiting for configuration traffic to confirm it"));return true;
138
+ onPredictionRoute("persisted");log(status("info", "Codex already running"));return true;
139
139
  }
140
140
  throw new Error("Running Codex App uses an old or unverified prediction route. Fully quit the App, then run ccdx again; no process was stopped");
141
141
  }
@@ -146,7 +146,7 @@ export async function openCodex({ env = process.env, spawnImpl = spawn, platform
146
146
  for (let attempt = 0; attempt < 10; attempt++) {
147
147
  const actual = macAppProcesses(predictionApp);
148
148
  if (actual.length === 1 && actual[0].readable && actual[0].route === predictionPacUrl) {
149
- onPredictionRoute("verified");log(status("info", "Codex launch route verified; prediction status will show when configuration traffic is observed"));return true;
149
+ onPredictionRoute("verified");log(status("info", "Codex opened"));return true;
150
150
  }
151
151
  if (actual.length) break;
152
152
  if (attempt < 9) await new Promise(resolve => setTimeout(resolve, 100));
@@ -1,6 +1,5 @@
1
1
  import { status } from "./status.mjs";
2
2
  import { terminalCell } from "./terminal-text.mjs";
3
- import { formatPredictionEnvironment } from "./native-prediction-state.mjs";
4
3
 
5
4
  // The favicon's three ellipses, rasterized as terminal half-blocks. No runtime
6
5
  // graphics library or terminal cursor control is needed.
@@ -42,12 +41,39 @@ export function startupLogger(name, output = console.log) {
42
41
 
43
42
  export function predictionStartupCheck(prediction) {
44
43
  if (!prediction?.configured) return startupCheck("info", "Prediction", "Off");
45
- const details = prediction.environment ? `\n${startupCheck("info", "Environment", formatPredictionEnvironment(prediction.environment))}` : "";
46
- if (prediction.bridge !== "running") return startupCheck("warn", "Prediction", prediction.reason || "Bridge unavailable; core service is available") + details;
47
- const route = prediction.launch_route;
48
- const summary = startupCheck(route === "unverified" ? "warn" : "info", "Prediction", route === "verified"
49
- ? "Bridge running; App route verified; suggestion not checked"
50
- : "Bridge running; App route not verified; suggestion not checked");
51
- const pause = prediction.active === false ? `\n${startupCheck("info", "Prediction", "Adaptation paused; existing trust/route retained")}` : "";
52
- return (prediction.recovery ? `${summary}\n${startupCheck("info", "Recovery", `${prediction.recovery.attempts}/3 attempts used; persistent route ${prediction.persistence || "unknown"}`)}` : summary) + pause + details;
44
+ const environment = prediction.environment?.status;
45
+ const problem = ["unavailable", "needs_service_restart", "needs_app_relaunch"].includes(environment);
46
+ let detail = prediction.bridge !== "running" ? prediction.bridge === "recovering" ? "Bridge recovering" : "Bridge unavailable"
47
+ : prediction.active === false ? "Paused; trust and route retained"
48
+ : `Running; App route ${prediction.launch_route === "verified" ? "verified" : prediction.launch_route === "persisted" ? "saved, not verified" : "not verified"}; suggestion unchecked`;
49
+ if (problem) detail += environment === "needs_service_restart" ? "; restart CCDX" : environment === "needs_app_relaunch" ? "; relaunch Codex" : "; environment unavailable";
50
+ const warning = prediction.bridge !== "running" || problem || prediction.launch_route === "unverified";
51
+ const lines = [startupCheck(warning ? "warn" : "info", "Prediction", detail)];
52
+ if (prediction.bridge !== "running" && prediction.reason) lines.push(startupCheck("warn", "Reason", prediction.reason));
53
+ if (warning) lines.push(startupCheck("info", "Details", "ccdx prediction status"));
54
+ return lines.join("\n");
55
+ }
56
+
57
+ // Catalog discovery, client configuration and inference access are distinct.
58
+ export function providerStartupSummary(data = {}) {
59
+ if (!data.providers) return { catalogs: "Status unavailable; see WebUI", claude: "Configuration not checked", warning: false };
60
+ const providers = data.providers, ms = providers?.m365;
61
+ const github = data.profiles?.codex?.models || (data.models?.provider !== "m365" ? data.models : null);
62
+ const found = catalog => ["cache", "live"].includes(catalog?.source) && Number.isSafeInteger(catalog?.models ?? catalog?.total) && (catalog.models ?? catalog.total) > 0;
63
+ const githubFound = found(github), m365Found = ms?.enabled !== false && found(ms?.models);
64
+ const catalog = (name, value) => `${name} ${value.models ?? value.total} (${value.source})`;
65
+ const m365State = { disabled: "off", unsupported: "unsupported", checking: "checking", idle: "not checked", unavailable: "unavailable", ready: "ready" }[ms?.state] || "unknown";
66
+ const count = Number(githubFound) + Number(m365Found);
67
+ const catalogs = `${count} catalog${count === 1 ? "" : "s"} found / ${githubFound ? catalog("GitHub", github) : github ? "GitHub not discovered" : "GitHub not checked"}; ${m365Found ? `${catalog("M365", ms.models)}${ms.state !== "ready" ? `, ${m365State}` : ""}` : `M365 ${m365State}`}`;
68
+ const states = { configured: "configured", partially_preserved: "partly configured; custom settings kept", preserved: "custom/managed settings kept", not_installed: "not installed", configuration_unavailable: "config unreadable", not_configured: "not checked" };
69
+ const client = id => states[ms?.claude?.clients?.[id]] || "not checked";
70
+ const gatewayReason = ms?.claude?.reason === "m365_no_claude_models" ? "no Claude models" : m365State;
71
+ const gateway = ms?.claude?.gateway === "running" ? "gateway running" : `gateway off (${gatewayReason})`;
72
+ const claude = `Code: ${client("code")} / App: ${client("app")} / ${gateway}`;
73
+ return { catalogs, claude, warning: Object.values(ms?.claude?.clients || {}).includes("configuration_unavailable") };
74
+ }
75
+
76
+ export function providerStartupChecks(data) {
77
+ const summary = providerStartupSummary(data);
78
+ return `${startupCheck("info", "Providers", summary.catalogs)}\n${startupCheck(summary.warning ? "warn" : "info", "Claude", summary.claude)}`;
53
79
  }
@@ -4,6 +4,7 @@ import { redactDiagnosticText } from "./diagnostic-text.mjs";
4
4
  import { DEFAULT_TERMINAL_ANIMATION_THEME, TERMINAL_ANIMATION_THEMES, isTerminalAnimationTheme, renderTerminalAnimationFrame,
5
5
  getTerminalAnimationCycleLength, getTerminalAnimationFrameDelay } from "./terminal-animation.mjs";
6
6
  import { displayWidth } from "./cli-table.mjs";
7
+ import { providerStartupSummary } from "./startup-ui.mjs";
7
8
 
8
9
  const clear = "\r\x1b[2K";
9
10
  const flagOff = value => /^(0|false|no|off)$/i.test(String(value || ""));
@@ -13,12 +14,13 @@ export function createTerminalConsole({ output = process.stdout, errorOutput = p
13
14
  snapshot = () => ({}), preferences = () => ({}), baseUrl = "", verbose = false,
14
15
  timers = { setTimeout, clearTimeout }, now = Date.now } = {}) {
15
16
  let running = false, timer = null, lines = 0, active = 0, frame = 0, lastRead = 0, data = {};
16
- let notices = 0, lastNotice = "", lastPrintedNotice = "", lastRender = "";
17
+ let notices = 0, lastNotice = "", lastPrintedNotice = "", previous = [];
18
+ let content = [], dirty = true;
17
19
  let current = { theme: DEFAULT_TERMINAL_ANIMATION_THEME, terminal_animation_enabled: true };
18
20
  let frameDelay = 1000;
19
21
  const tty = output.isTTY === true && errorOutput.isTTY === true && (!env.CI || flagOff(env.CI)) && env.TERM !== "dumb";
20
- const supported = () => tty && (Number(output.columns) || 80) >= 40;
21
- const resized = () => { if (lines) output.write("\n");lines = 0;lastRender = "";frame = 0; };
22
+ const supported = () => tty && (Number(output.columns) || 80) >= 40 && (Number(output.rows) || 24) >= 16;
23
+ const resized = () => { if (lines) output.write("\n");lines = 0;previous = [];frame = 0;dirty = true; };
22
24
  output.on?.("resize", resized);
23
25
  const segmenter = new Intl.Segmenter("en", { granularity: "grapheme" });
24
26
  const clip = (value, width) => {
@@ -28,14 +30,26 @@ export function createTerminalConsole({ output = process.stdout, errorOutput = p
28
30
  }
29
31
  return text;
30
32
  };
31
- const compact = value => new Intl.NumberFormat("en", { notation: "compact", maximumFractionDigits: 1 }).format(Number(value) || 0);
33
+ const numbers = new Intl.NumberFormat("en", { notation: "compact", maximumFractionDigits: 1 });
34
+ const compact = value => numbers.format(Number(value) || 0);
35
+ function table(width, usage, requests, inferenceActive, sum) {
36
+ const left = Math.floor((width - 3) / 2), right = width - 3 - left;
37
+ const cell = (label, value, size) => {
38
+ const number = value === undefined ? "" : compact(value), inner = size - 2;
39
+ const text = clip(label, Math.max(0, inner - displayWidth(number) - (number ? 1 : 0)));
40
+ return ` ${text}${" ".repeat(Math.max(0, inner - displayWidth(text) - displayWidth(number)))}${number} `;
41
+ };
42
+ const row = (a, b) => `│${a}│${b}│`;
43
+ const rule = (a, b, c) => `${a}${"─".repeat(left)}${b}${"─".repeat(right)}${c}`;
44
+ const usageRows = [["Records", usage.records || 0], ["Input total", usage.input_tokens], ["Cache read", usage.cached_input_tokens],
45
+ ["Output", usage.output_tokens], ["Partial records", usage.partial_records || 0], ["", undefined]];
46
+ const requestRows = [["HTTP calls", requests], ["Active", inferenceActive], ["Completed", sum("completed")], ["Incomplete", sum("incomplete")], ["Failed", sum("failed")], ["Cancelled", sum("cancelled")]];
47
+ return [rule("┌", "┬", "┐"), row(cell("Usage / this run", undefined, left), cell("Inference", undefined, right)), rule("├", "┼", "┤"),
48
+ ...usageRows.map(([label, value], index) => row(cell(label, value ?? (label ? 0 : undefined), left), cell(...requestRows[index], right))), rule("└", "┴", "┘")];
49
+ }
32
50
  function render() {
33
51
  if (!running || !supported() || verbose) { frameDelay = 1000;return; }
34
52
  const width = Math.max(1, Math.min(160, Number(output.columns) || 80) - 1);
35
- const usage = data.runtime_usage || {}, routes = data.requests?.by_route || {};
36
- const outcomes = [data.stream_performance?.by_route?.responses, data.stream_performance?.by_route?.responses_compact, data.providers?.m365?.claude?.requests?.performance?.by_route?.messages]
37
- .map(route => route?.terminal_outcomes?.totals || {});
38
- const sum = key => outcomes.reduce((total, item) => total + (Number(item[key]) || 0), 0);
39
53
  let motion = active ? "●" : "○";
40
54
  frameDelay = 1000;
41
55
  if (active && current.terminal_animation_enabled && !flagOff(env.CCDX_TERMINAL_ANIMATION) && width >= 24) {
@@ -46,25 +60,38 @@ export function createTerminalConsole({ output = process.stdout, errorOutput = p
46
60
  frame = (frame + 1) % getTerminalAnimationCycleLength(current.theme);
47
61
  frameDelay = getTerminalAnimationFrameDelay(current.theme, index) + (frame === 0 ? metadata.loopPauseMs : 0);
48
62
  }
49
- const requests = ["responses", "responses_compact", "messages"].reduce((total, key) => total + (routes[key]?.total || 0), 0);
50
- const body = [
51
- `CCDX ${lastNotice ? "ATTENTION" : "READY"} / uptime ${Math.floor((data.uptime_ms || 0) / 60000)}m / ${baseUrl}`,
52
- `This run · usage records ${usage.records || 0} · input ${compact(usage.input_tokens)} · cache read ${compact(usage.cached_input_tokens)} · output ${compact(usage.output_tokens)}${usage.partial_records ? " ~" : ""}`,
53
- `Inference · ${requests} HTTP calls · active ${active} · done ${sum("completed")} · incomplete ${sum("incomplete")} · failed ${sum("failed")} · cancelled ${sum("cancelled")}`,
54
- ].map(line => clip(line, width));
55
- const notice = lastNotice ? `${notices} notices / ${lastNotice}` : active ? "Working" : "Idle / details in WebUI";
56
- body.push(width >= 24 ? `${motion} ${clip(notice, Math.max(0, width - displayWidth(stripVTControlCharacters(motion)) - 1))}` : clip(`${motion} ${notice}`, width));
57
- const rendered = body.join("\n");
58
- if (rendered === lastRender) return;
59
- lastRender = rendered;
60
- output.write(`${lines ? `\x1b[${lines - 1}A` : ""}${body.map(line => clear + line).join("\n")}\r`);
61
- lines = 4;
63
+ if (dirty) {
64
+ const usage = data.runtime_usage || {}, routes = data.requests?.by_route || {};
65
+ const outcomes = [data.stream_performance?.by_route?.responses, data.stream_performance?.by_route?.responses_compact, data.providers?.m365?.claude?.requests?.performance?.by_route?.messages]
66
+ .map(route => route?.terminal_outcomes?.totals || {});
67
+ const sum = key => outcomes.reduce((total, item) => total + (Number(item[key]) || 0), 0);
68
+ const requests = ["responses", "responses_compact", "messages"].reduce((total, key) => total + (routes[key]?.total || 0), 0);
69
+ const inferenceActive = ["responses", "responses_compact", "messages"].reduce((total, key) => total + (routes[key]?.active || 0), 0);
70
+ const providers = providerStartupSummary(data);
71
+ content = [`CCDX RUNNING / uptime ${Math.floor((data.uptime_ms || 0) / 60000)}m / ${baseUrl}`,
72
+ `Providers / ${providers.catalogs}`, `Claude / ${providers.claude}`].map(line => clip(line, width));
73
+ content.push(...table(width, usage, requests, inferenceActive, sum));
74
+ content.push(clip(`${notices} notices${lastNotice ? ` / latest: ${lastNotice}` : " / details in WebUI"}`, width));
75
+ dirty = false;
76
+ }
77
+ const body = [...content, `${motion} ${active ? "Working" : "Idle"}`];
78
+ // Animation ticks update only the final line; data stays on its 1s cadence.
79
+ let update = "";
80
+ if (!lines) update = `${body.map(line => clear + line).join("\n")}\r`;
81
+ else for (let index = 0; index < body.length; index++) {
82
+ if (body[index] === previous[index]) continue;
83
+ const offset = body.length - 1 - index;
84
+ update += `${offset ? `\x1b[${offset}A` : ""}${clear}${body[index]}\r${offset ? `\x1b[${offset}B` : ""}`;
85
+ }
86
+ if (update) output.write(update);
87
+ previous = body;lines = body.length;
62
88
  }
63
89
  function tick() {
64
90
  if (!running) return;
65
91
  if (now() - lastRead >= 1000 || !lastRead) {
66
92
  try { data = snapshot();current = { ...current, ...preferences() };if (!isTerminalAnimationTheme(current.theme)) current.theme = DEFAULT_TERMINAL_ANIMATION_THEME; } catch {}
67
93
  lastRead = now();
94
+ dirty = true;
68
95
  }
69
96
  render();
70
97
  timer = timers.setTimeout(tick, frameDelay);timer?.unref?.();
@@ -72,12 +99,12 @@ export function createTerminalConsole({ output = process.stdout, errorOutput = p
72
99
  return {
73
100
  get enabled() { return supported() && !verbose; },
74
101
  start() { if (running) return;running = true;tick(); },
75
- beginRequest() { active++;let done = false;return () => { if (!done) { done = true;active = Math.max(0, active - 1); } }; },
102
+ beginRequest() { active++;dirty = true;let done = false;return () => { if (!done) { done = true;active = Math.max(0, active - 1);dirty = true; } }; },
76
103
  log(method, args) {
77
104
  const message = redactDiagnosticText(format(...args));
78
105
  if (verbose) { (method === "error" || method === "warn" ? errorOutput : output).write(`${message}\n`);return; }
79
106
  if (method !== "error" && method !== "warn" && !/^\[(WARN|ERR)\]/.test(message.trim())) return;
80
- notices++;lastNotice = message.replace(/\s+/g, " ").slice(0, 240);
107
+ notices++;lastNotice = message.replace(/\s+/g, " ").slice(0, 240);dirty = true;
81
108
  if (!supported() && lastNotice !== lastPrintedNotice) { errorOutput.write(`${lastNotice}\n`);lastPrintedNotice = lastNotice; }
82
109
  },
83
110
  snapshot() { return { notices, last_notice: lastNotice || null, mode: verbose ? "verbose" : supported() ? "status" : "plain" }; },