codex-copilot-dx 1.3.2 → 1.3.4
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 +4 -2
- package/bin/cli.mjs +1 -0
- package/docs/ARCHITECTURE.md +16 -0
- package/docs/README.md +2 -0
- package/docs/REFERENCE.md +9 -1
- package/package.json +1 -1
- package/src/activity-events.mjs +75 -0
- package/src/adapter.mjs +23 -2
- package/src/dashboard/activity.js +1 -1
- package/src/dashboard/flow.js +6 -4
- package/src/dashboard/index.html +2 -1
- package/src/dashboard/language.js +2 -2
- package/src/dashboard/live.js +52 -0
- package/src/dashboard/status.js +42 -21
- package/src/dashboard/ui.css +45 -42
- package/src/dashboard/ui.js +34 -10
- package/src/dashboard.mjs +1 -0
- package/src/management-routes.mjs +12 -2
- package/src/observability.mjs +5 -0
- package/src/optional-routes.mjs +1 -1
- package/src/shutdown.mjs +1 -0
- package/src/status-summary.mjs +1 -1
- package/src/stream-performance.mjs +25 -2
- package/src/terminal-console.mjs +16 -7
package/README.md
CHANGED
|
@@ -15,8 +15,8 @@ ccdx
|
|
|
15
15
|
|
|
16
16
|
Without Node.js, download and run the installer for your system:
|
|
17
17
|
|
|
18
|
-
- macOS: [install.sh](https://github.com/DaleXiao/codex-copilot-dx/releases/download/v1.3.
|
|
19
|
-
- Windows: [install.ps1](https://github.com/DaleXiao/codex-copilot-dx/releases/download/v1.3.
|
|
18
|
+
- macOS: [install.sh](https://github.com/DaleXiao/codex-copilot-dx/releases/download/v1.3.4/install.sh), then `sh install.sh`.
|
|
19
|
+
- Windows: [install.ps1](https://github.com/DaleXiao/codex-copilot-dx/releases/download/v1.3.4/install.ps1), then `./install.ps1` under your current shell policy.
|
|
20
20
|
|
|
21
21
|
The installer reuses a compatible Node.js or installs a private, verified copy. Git and a compiler are not required. Complete platform packages include their dependencies. Company registry, proxy, certificate and shell policies are kept.
|
|
22
22
|
|
|
@@ -72,6 +72,8 @@ ccdx update github
|
|
|
72
72
|
ccdx version
|
|
73
73
|
```
|
|
74
74
|
|
|
75
|
+
Web UI activity updates through server push; the terminal uses the same in-process activity feed. Reconnecting restores current state and bounded recent records.
|
|
76
|
+
|
|
75
77
|
The foreground terminal stops with **Ctrl+C**. Client configuration marked **Unchanged** means CCDX kept the existing settings. Configuration and successful model access are separate checks.
|
|
76
78
|
|
|
77
79
|
If models are missing, check the selected source and app models first. After a client update or configuration change, fully quit and reopen that app. Use **Checks & repairs** or `ccdx doctor` for local diagnostics.
|
package/bin/cli.mjs
CHANGED
|
@@ -481,6 +481,7 @@ try {
|
|
|
481
481
|
const terminalAnimationTheme = terminalAnimationPreference().theme;
|
|
482
482
|
terminalConsole = createTerminalConsole({ baseUrl: webUiUrl, verbose: CLI.verbose === true || CLI.showRequestId === true || LOGGING.level === "debug",
|
|
483
483
|
snapshot: () => activeServer?.ccdxSnapshot?.() || {},
|
|
484
|
+
subscribe: listener => activeServer?.ccdxSubscribeActivity?.(listener),
|
|
484
485
|
preferences: () => { const { saved, theme, color_theme } = serviceSettingsSnapshot();return { ...saved, theme, color_theme }; } });
|
|
485
486
|
const serviceControl = createServiceControl({ providerRuntime, clientIntegration: earlyIntegration, terminal: terminalConsole, nightlyStatus: () => serviceWorker?.status() || null, nightlyChanged: enabled => serviceWorker?.preferenceChanged(enabled) });
|
|
486
487
|
const codexModelCatalog = createCodexModelCatalog();
|
package/docs/ARCHITECTURE.md
CHANGED
|
@@ -1014,3 +1014,19 @@ Messages window observation belongs to `claude-gateway.mjs`, independently of th
|
|
|
1014
1014
|
`boundedDiagnosticText` is a presentation-only boundary: a fixed input budget precedes terminal normalization/redaction, then UTF-16 surrogate boundaries are preserved at the existing output limits. `redactDiagnosticText` itself is unchanged because validators also use its exact result. Protocol bodies and retry classifiers do not consume the bounded diagnostic copy.
|
|
1015
1015
|
|
|
1016
1016
|
`usageSummaryVersion` retains its default settled-file semantics. Its explicit unsettled read mode exposes only an observed file identity for in-flight coalescing. Usage summary and analytics readers reuse the existing abort-aware singleflight and release completed flights; they do not add a persistent ledger/index. Filters and, for analytics, time zone/calendar date scope the key. Each caller still gets an isolated aggregate. HTTP usage readers forward cancellation to active-query waiters and avoid writes to cancelled responses. The underlying bounded scan may finish; it publishes no active-file cache entry.
|
|
1017
|
+
|
|
1018
|
+
|
|
1019
|
+
### Live activity
|
|
1020
|
+
|
|
1021
|
+
`activity-events.mjs` owns a process-local presentation channel and bounded SSE subscribers. Request counters and Responses/Messages observers expose change subscriptions; they remain the sole owners of request state. The channel subscribes only while a TUI or browser is present, coalesces changes for 50 ms and takes one lightweight snapshot for the fan-out. It reads active/retained scalar metadata, outcomes and current-run usage, without provider/configuration snapshots, file reads, catalog refreshes or inference. Per-token activity publishes only its first phase transition.
|
|
1022
|
+
|
|
1023
|
+
`management-routes.mjs` protects `/_ccdx/activity` with loopback/Host checks and rejects conflicting Origin or cross-site browser requests. Management streams do not enter model counters, work/drain decisions or the inference data path. At most eight streams are retained. Write backpressure replaces one pending snapshot rather than accumulating events; a blocked heartbeat closes that stream. `closeHttpServer` closes owned activity streams before waiting for ordinary HTTP shutdown.
|
|
1024
|
+
|
|
1025
|
+
`dashboard/live.js` owns one EventSource, liveness and page/Auto refresh lifecycle. Each connection receives a current snapshot; there are no cursors, replay storage or cross-restart history claims. A 15-second heartbeat and 45-second silence deadline replace the six-second manual-snapshot expiry for push consumers. Healthy events update only activity/counters/request tables and visible context evidence. Animation frames and elapsed time stay local. `refresh.js` retains low-frequency diagnostic, account, model, retained usage and update resources. TUI consumes the same channel directly; static setup/preferences are sampled locally every ten seconds and existing callers without subscriptions keep their previous cadence.
|
|
1026
|
+
|
|
1027
|
+
|
|
1028
|
+
### Compact dashboard spacing
|
|
1029
|
+
|
|
1030
|
+
`dashboard/ui.css` retains the existing color/type system and grid/navigation boundaries. Shared `--control-height` and `--inline-control-height` values align controls at 32/30 px, with 44 px coarse-pointer targets; multiline choice cards keep intrinsic height. Existing narrow-header rules still own reflow. Panel/header/table/form spacing is adjusted in its existing rules rather than adding a second layout mode. Request-flow geometry continues to measure actual anchors after resize and disclosure changes. Browser replays assert actual sizes and unchanged header anchors alongside bilingual themes, model details, drafts and reduced motion.
|
|
1031
|
+
|
|
1032
|
+
The Auto refresh button overlays its visible and width-measuring labels in one centered grid cell. Browser acceptance measures the visible text range against the button on both axes, including ON/OFF in both languages; the outer control height alone is not alignment evidence.
|
package/docs/README.md
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
- [Reference](REFERENCE.md): commands, settings, diagnostics, images and native suggestions.
|
|
5
5
|
- [Architecture](ARCHITECTURE.md): module ownership and runtime boundaries.
|
|
6
6
|
- [State orchestration](STATE_REFACTOR_PLAN.md): implemented boundaries, preservation checks and deferred work.
|
|
7
|
+
- [1.3.4](RELEASE_1.3.4.md): centered Auto refresh labels at compact control heights.
|
|
8
|
+
- [1.3.3](RELEASE_1.3.3.md): live activity updates and compact WebUI spacing.
|
|
7
9
|
- [1.3.2](RELEASE_1.3.2.md): protected App keys, bounded diagnostics and coalesced usage reads.
|
|
8
10
|
- [1.3.1](RELEASE_1.3.1.md): bounded context observations and anchored WebUI details.
|
|
9
11
|
- [1.3.0](RELEASE_1.3.0.md): scope, compatibility changes and verification.
|
package/docs/REFERENCE.md
CHANGED
|
@@ -60,7 +60,7 @@ Messages observes the selected model's effective capability snapshot after alias
|
|
|
60
60
|
|
|
61
61
|
Only explicit, bounded session IDs can link requests. Local display identifiers replace native IDs and titles; account/profile, app, source, model and declared subagent identities remain separate. Unidentified requests appear individually. Concurrent observations are points rather than a connected conversation curve. Compaction records cover observed Responses compact calls, not every client-side summary, and their elapsed time includes the whole gateway request. No before/after size is invented from summary output tokens.
|
|
62
62
|
|
|
63
|
-
Each protocol observer retains at most 64 series of 64 request points and 16 compaction records, plus 20 unidentified requests. These numeric observations are memory-only and reset on restart. The page reads them on demand through the existing dashboard refresh controller; ordinary status payloads do not include them. There is no prompt storage, text tokenization, transcript scan, extra provider request, content breakdown or compression control.
|
|
63
|
+
Each protocol observer retains at most 64 series of 64 request points and 16 compaction records, plus 20 unidentified requests. These numeric observations are memory-only and reset on restart. The page reads them on demand and after observed request completion through the existing dashboard refresh controller; ordinary status payloads do not include them. There is no prompt storage, text tokenization, transcript scan, extra provider request, content breakdown or compression control.
|
|
64
64
|
|
|
65
65
|
## Sources and client access
|
|
66
66
|
|
|
@@ -112,6 +112,14 @@ Settings separates saved preferences from effective state. Auto-save applies cha
|
|
|
112
112
|
|
|
113
113
|
Web and terminal colors are independent. Web appearance is browser-local. The terminal keeps its selected color and animation; NO_COLOR, dumb/non-TTY and narrow output remain supported. Reduced motion disables decorative movement. Closed tabs and hidden views stop scheduled work. Model/usage data loads on demand; the Web UI adds no inference calls.
|
|
114
114
|
|
|
115
|
+
Activity, flow and current-run counters use one visible-page SSE connection at `/_ccdx/activity`. TUI activity subscribes to the same in-process notifications. Request starts, model/provider selection, first output, retries and completion coalesce within 50 ms; ordinary output chunks do not trigger pushes. A connection starts with current memory-only state, including the existing recent-request limits. Reconnection restores current state and totals; it does not replay animations or recover arbitrary old history. No replay buffer or durable event store is added.
|
|
116
|
+
|
|
117
|
+
The stream sends a small heartbeat every 15 seconds; the browser replaces a silent connection after 45 seconds. Hidden/suspended pages and Auto refresh OFF close the stream; returning reconnects with a fresh snapshot. A lost connection means activity is unknown, not idle. The old six-second snapshot expiry applies only to manual HTTP snapshots, not healthy push state. Catalogs, accounts, retained usage and update checks keep their separate on-demand/low-frequency reads. Visible context series refresh after request completion through the existing bounded reader.
|
|
118
|
+
|
|
119
|
+
Push reads do not invoke the complete diagnostic snapshot, read usage files, refresh credentials/catalogs or send inference. Up to eight native/same-origin loopback streams are accepted. Slow streams keep at most one newer snapshot and close if still blocked at the next heartbeat. Streams are excluded from request/work counts and closed before normal service shutdown. TUI static setup/preferences retain a ten-second local read; live activity does not wait for it. Animation frames and elapsed-time updates remain local. Existing reduced-motion and terminal output controls remain.
|
|
120
|
+
|
|
121
|
+
Desktop spacing keeps existing fonts, palettes, navigation and disclosure anchors. The header is 64 px at desktop widths; its existing narrow-screen layout stays responsive. Panels use 16 px padding and ordinary rows use 7 px vertical cell padding. Standard controls are 32 px high and inline source/model actions 30 px; coarse pointers retain 44 px controls. Multi-line animation choices retain their natural height. Compact padding does not change model lists, draft fields, settings behavior or focus outlines.
|
|
122
|
+
|
|
115
123
|
## Installation and updates
|
|
116
124
|
|
|
117
125
|
Use the installers linked in the [README](../README.md) when Node.js is unavailable. They support macOS and Windows on x64/ARM64, reuse a compatible Node.js, or install verified Node 24.22.0 privately. They do not install Git, compilers or system package managers, or change company registry/proxy/certificate/shell policy.
|
package/package.json
CHANGED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// Notifications carry no request payloads and cannot interrupt inference.
|
|
2
|
+
export function createChangeSignal() {
|
|
3
|
+
const listeners = new Set();
|
|
4
|
+
return {
|
|
5
|
+
subscribe(listener) { listeners.add(listener);return () => listeners.delete(listener); },
|
|
6
|
+
changed() { for (const listener of listeners) { try { listener(); } catch {} } },
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const ACTIVITY_EVENTS_PATH = "/_ccdx/activity";
|
|
11
|
+
|
|
12
|
+
export function createActivityEvents({ snapshot, sources, timers = { setTimeout, clearTimeout, setInterval, clearInterval } }) {
|
|
13
|
+
const listeners = new Set(), streams = new Set();
|
|
14
|
+
let pending = null, subscriptions = [], closed = false;
|
|
15
|
+
function publish() {
|
|
16
|
+
pending = null;
|
|
17
|
+
if (!listeners.size || closed) return;
|
|
18
|
+
try {
|
|
19
|
+
const value = snapshot();
|
|
20
|
+
for (const listener of listeners) { try { listener(value); } catch {} }
|
|
21
|
+
} catch { /* The next change or reconnect reads a fresh snapshot. */ }
|
|
22
|
+
}
|
|
23
|
+
function changed() {
|
|
24
|
+
if (closed || !listeners.size || pending) return;
|
|
25
|
+
pending = timers.setTimeout(publish, 50);pending?.unref?.();
|
|
26
|
+
}
|
|
27
|
+
function subscribe(listener) {
|
|
28
|
+
if (closed) return () => {};
|
|
29
|
+
listeners.add(listener);
|
|
30
|
+
if (listeners.size === 1) subscriptions = sources.filter(Boolean).map(source => source.subscribe?.(changed)).filter(Boolean);
|
|
31
|
+
try { listener(snapshot()); } catch {}
|
|
32
|
+
return () => {
|
|
33
|
+
listeners.delete(listener);
|
|
34
|
+
if (!listeners.size) {
|
|
35
|
+
for (const unsubscribe of subscriptions) unsubscribe();subscriptions = [];
|
|
36
|
+
if (pending) timers.clearTimeout(pending);pending = null;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function serve(req, res) {
|
|
41
|
+
if (closed || streams.size >= 8) { res.writeHead(503, { "Retry-After": "5" });res.end();return; }
|
|
42
|
+
res.writeHead(200, { "Content-Type": "text/event-stream; charset=utf-8", "Cache-Control": "no-store", "X-Content-Type-Options": "nosniff" });
|
|
43
|
+
res.flushHeaders?.();
|
|
44
|
+
let blocked = false, latest = null, disposed = false, unsubscribe = () => {};
|
|
45
|
+
const write = (event, value) => {
|
|
46
|
+
if (disposed) return;
|
|
47
|
+
if (blocked) { latest = value;return; }
|
|
48
|
+
try { blocked = !res.write(`event: ${event}\ndata: ${JSON.stringify(value)}\n\n`); }
|
|
49
|
+
catch { close(); }
|
|
50
|
+
};
|
|
51
|
+
const drain = () => { blocked = false;if (latest) { const value = latest;latest = null;write("activity", value); } };
|
|
52
|
+
const heartbeat = timers.setInterval(() => {
|
|
53
|
+
if (blocked) { close();return; }
|
|
54
|
+
write("heartbeat", { at: Date.now() });
|
|
55
|
+
}, 15000);heartbeat?.unref?.();
|
|
56
|
+
function close() {
|
|
57
|
+
if (disposed) return;
|
|
58
|
+
disposed = true;streams.delete(close);unsubscribe();latest = null;
|
|
59
|
+
timers.clearInterval(heartbeat);res.off?.("drain", drain);res.off?.("close", close);res.off?.("error", close);
|
|
60
|
+
if (blocked) res.destroy?.();
|
|
61
|
+
else if (!res.destroyed) res.end();
|
|
62
|
+
}
|
|
63
|
+
streams.add(close);res.on("drain", drain);res.once("close", close);res.once("error", close);
|
|
64
|
+
unsubscribe = subscribe(value => write("activity", value));
|
|
65
|
+
if (disposed) unsubscribe();
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
subscribe, serve,
|
|
69
|
+
close() {
|
|
70
|
+
closed = true;for (const close of streams) close();
|
|
71
|
+
for (const unsubscribe of subscriptions) unsubscribe();subscriptions = [];listeners.clear();
|
|
72
|
+
if (pending) timers.clearTimeout(pending);pending = null;
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
}
|
package/src/adapter.mjs
CHANGED
|
@@ -14,7 +14,9 @@ import { createStreamPerformanceMetrics } from "./stream-performance.mjs";
|
|
|
14
14
|
import { status } from "./status.mjs";
|
|
15
15
|
import { exportResponseHistory, importResponseHistory } from "./response-history.mjs";
|
|
16
16
|
import { createTerminalActivityIndicator } from "./terminal-activity.mjs";
|
|
17
|
-
import { ADAPTER_HEALTH_PATH, ADAPTER_PREDICTION_FIX_PATH } from "./running-adapter.mjs";
|
|
17
|
+
import { ADAPTER_HEALTH_PATH, ADAPTER_PREDICTION_FIX_PATH, adapterHealthPayload } from "./running-adapter.mjs";
|
|
18
|
+
import { ACTIVITY_EVENTS_PATH, createActivityEvents } from "./activity-events.mjs";
|
|
19
|
+
import { runtimeUsageSnapshot } from "./usage-store.mjs";
|
|
18
20
|
import { createManagementHandler, isManagementRoute } from "./management-routes.mjs";
|
|
19
21
|
import { createOptionalRoutes, isOptionalRoute, DASHBOARD_PATHS, DASHBOARD_API_PATHS } from "./optional-routes.mjs";
|
|
20
22
|
import { createResponsesCompactHandler, createResponsesHandler } from "./responses-handler.mjs";
|
|
@@ -185,8 +187,22 @@ export function createAdapterHandler(options = {}) {
|
|
|
185
187
|
providerStateFn: () => options.providerRuntime.dashboardProviders(),
|
|
186
188
|
providerAccountsFn: () => options.providerRuntime.action({ action: "accounts" }),
|
|
187
189
|
connectionsFn: input => options.providerRuntime.manageConnections(input) } : {}) } });
|
|
190
|
+
const activityEvents = createActivityEvents({
|
|
191
|
+
sources: [requestMetrics, streamPerformanceMetrics, options.providerRuntime?.claudePerformance],
|
|
192
|
+
snapshot: () => {
|
|
193
|
+
const requests = requestMetrics.snapshot(), image = optionalRoutes.imageStats();
|
|
194
|
+
const active = ["responses", "responses_compact", "messages"].reduce((sum, route) => sum + requests.by_route[route].active, image?.active || 0);
|
|
195
|
+
const claude = options.providerRuntime?.claudePerformance?.activitySnapshot?.();
|
|
196
|
+
return { ...adapterHealthPayload(), scope: "activity", uptime_ms: Math.round(process.uptime() * 1000),
|
|
197
|
+
model_activity: { active }, requests, runtime_usage: runtimeUsageSnapshot(),
|
|
198
|
+
stream_performance: streamPerformanceMetrics.activitySnapshot(),
|
|
199
|
+
...(claude ? { providers: { claude: { requests: { performance: claude } } } } : {}),
|
|
200
|
+
http_errors: httpErrors.snapshot(), response_failures: responseFailures.snapshot() };
|
|
201
|
+
},
|
|
202
|
+
});
|
|
188
203
|
let statusSnapshot;
|
|
189
204
|
const managementHandler = createManagementHandler({
|
|
205
|
+
activityEvents,
|
|
190
206
|
nativePredictionPac: options.nativePredictionPac, fixPrediction: options.fixPrediction, requestBodyTimeoutMs,
|
|
191
207
|
statusSnapshot: statusSnapshot = () => {
|
|
192
208
|
const snapshot = runtimeStatusPayload({ metrics: requestMetrics, streamPerformance: streamPerformanceMetrics, admission: acquireRequest,
|
|
@@ -403,6 +419,7 @@ export function createAdapterHandler(options = {}) {
|
|
|
403
419
|
}
|
|
404
420
|
|
|
405
421
|
const trackRequest = pathname !== ADAPTER_HEALTH_PATH
|
|
422
|
+
&& pathname !== ACTIVITY_EVENTS_PATH
|
|
406
423
|
&& pathname !== ADAPTER_STATUS_PATH
|
|
407
424
|
&& pathname !== ADAPTER_CACHE_PATH
|
|
408
425
|
&& pathname !== ADAPTER_PREDICTION_FIX_PATH
|
|
@@ -494,13 +511,15 @@ export function createAdapterHandler(options = {}) {
|
|
|
494
511
|
}
|
|
495
512
|
};
|
|
496
513
|
handler.snapshot = statusSnapshot;
|
|
514
|
+
handler.subscribeActivity = activityEvents.subscribe;
|
|
515
|
+
handler.closeActivity = activityEvents.close;
|
|
497
516
|
handler.busy = () => optionalRoutes.busy() || options.providerRuntime?.busy?.() === true;
|
|
498
517
|
handler.exportState = () => ({ version: 1, history: exportResponseHistory(), optional: optionalRoutes.exportState() });
|
|
499
518
|
handler.importState = async state => {
|
|
500
519
|
if (state?.version !== 1) throw new Error("Unsupported service-state version");
|
|
501
520
|
importResponseHistory(state.history);await optionalRoutes.importState(state.optional);
|
|
502
521
|
};
|
|
503
|
-
handler.cleanup = () => optionalRoutes.dispose();
|
|
522
|
+
handler.cleanup = () => { activityEvents.close();optionalRoutes.dispose(); };
|
|
504
523
|
return handler;
|
|
505
524
|
}
|
|
506
525
|
|
|
@@ -515,6 +534,8 @@ export async function startAdapter(port = 2026, host = "127.0.0.1", options = {}
|
|
|
515
534
|
const handler = createAdapterHandler({ ...options, terminalActivity, imageMcpHostname: host });
|
|
516
535
|
const server = http.createServer(handler);
|
|
517
536
|
server.ccdxSnapshot = handler.snapshot;
|
|
537
|
+
server.ccdxSubscribeActivity = handler.subscribeActivity;
|
|
538
|
+
server.ccdxCloseActivity = handler.closeActivity;
|
|
518
539
|
server.ccdxBusy = handler.busy;
|
|
519
540
|
server.ccdxExportState = handler.exportState;
|
|
520
541
|
server.ccdxImportState = handler.importState;
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
globalThis.addEventListener("pageshow", pause);
|
|
21
21
|
function unavailable() { clearTimeout(expiry);expiry = null;deadline = 0;show(null); }
|
|
22
22
|
globalThis.ccdxDashboardActivity = {
|
|
23
|
-
update(data) { clearTimeout(expiry);show(data?.active);deadline = Date.now() + 6000;expiry = setTimeout(unavailable, 6000); },
|
|
23
|
+
update(data, { live = false } = {}) { clearTimeout(expiry);show(data?.active);deadline = live ? 0 : Date.now() + 6000;expiry = live ? null : setTimeout(unavailable, 6000); },
|
|
24
24
|
unavailable, visibilityChanged: pause,
|
|
25
25
|
};
|
|
26
26
|
pause();
|
package/src/dashboard/flow.js
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
let rows = [], total = null, omitted = 0, fresh = false, deadline = 0, expiry = null;
|
|
12
12
|
let selected = null, expanded = false, lastSignature = "", geometry = "", wireState = "", positions = null, known = false;
|
|
13
13
|
let lastApps = [], lastModels = [];
|
|
14
|
+
let sampledAt = Date.now();
|
|
14
15
|
const resize = new ResizeObserver(() => { positions = null;draw(); });
|
|
15
16
|
const visible = () => document.visibilityState === "visible" && !root.closest("[hidden]");
|
|
16
17
|
const integer = value => Number.isSafeInteger(value) && value >= 0;
|
|
@@ -90,7 +91,7 @@
|
|
|
90
91
|
const id = row.request_id || JSON.stringify([row.application, row.provider, row.model, index]);wanted.add(id);
|
|
91
92
|
let tr = detailRows.get(id);
|
|
92
93
|
if (!tr) { tr = entry("tr");for (let i = 0; i < 6; i++) tr.append(entry("td"));detailRows.set(id, tr); }
|
|
93
|
-
const values = [appName(row.application), sourceName(row.provider), modelName(row.model), format(fresh ? status(row) : "flow_last_observed"), `${(row.elapsed_ms / 1000).toFixed(1)} s`, row.upstream_attempts.toLocaleString()];
|
|
94
|
+
const values = [appName(row.application), sourceName(row.provider), modelName(row.model), format(fresh ? status(row) : "flow_last_observed"), `${((row.elapsed_ms + Math.max(0, Date.now() - sampledAt)) / 1000).toFixed(1)} s`, row.upstream_attempts.toLocaleString()];
|
|
94
95
|
values.forEach((value, i) => { if (tr.children[i].textContent !== value) tr.children[i].textContent = value; });
|
|
95
96
|
if (body.children[index] !== tr) body.insertBefore(tr, body.children[index] || null);
|
|
96
97
|
}
|
|
@@ -183,7 +184,7 @@
|
|
|
183
184
|
resize.observe(el("flow-network"));
|
|
184
185
|
new MutationObserver(() => { lastSignature = "";positions = null;render(); }).observe(document.documentElement, { attributes: true, attributeFilter: ["lang"] });
|
|
185
186
|
globalThis.ccdxDashboardFlow = {
|
|
186
|
-
update(data) {
|
|
187
|
+
update(data, { live = false } = {}) {
|
|
187
188
|
const parts = [data?.stream_performance, (data?.providers?.claude || data?.providers?.m365?.claude)?.requests?.performance].filter(Boolean);
|
|
188
189
|
if (!parts.length || parts.some(part => !integer(part.active_total) || !Array.isArray(part.active_requests))) { unavailable();return; }
|
|
189
190
|
const values = parts.flatMap(part => part.active_requests).slice(0, 128);
|
|
@@ -196,8 +197,9 @@
|
|
|
196
197
|
}));
|
|
197
198
|
total = parts.reduce((sum, part) => sum + part.active_total, 0);
|
|
198
199
|
if (!integer(total) || total < rows.length) { unavailable();return; }
|
|
199
|
-
omitted = total - rows.length;fresh = true;known = true;
|
|
200
|
-
clearTimeout(expiry);deadline = Date.now() + 6000;expiry = setTimeout(unavailable, 6000);render();
|
|
200
|
+
omitted = total - rows.length;fresh = true;known = true;sampledAt = Date.now();
|
|
201
|
+
clearTimeout(expiry);deadline = live ? 0 : Date.now() + 6000;expiry = live ? null : setTimeout(unavailable, 6000);render();
|
|
201
202
|
}, unavailable, visibilityChanged,
|
|
203
|
+
tick() { if (fresh && total && visible()) details(); },
|
|
202
204
|
};
|
|
203
205
|
})();
|
package/src/dashboard/index.html
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
<script src="/theme.js"></script>
|
|
10
10
|
<link rel="stylesheet" href="/ui.css">
|
|
11
11
|
<script src="/refresh.js" defer></script>
|
|
12
|
+
<script src="/live.js" defer></script>
|
|
12
13
|
<script src="/icons.js" defer></script>
|
|
13
14
|
<script src="/disclosure.js" defer></script>
|
|
14
15
|
<script src="/time.js" defer></script>
|
|
@@ -46,7 +47,7 @@
|
|
|
46
47
|
|
|
47
48
|
<header class="topbar">
|
|
48
49
|
<div class="brand">CCDX <span class="brand-detail" data-i18n="local_status">/ DASHBOARD</span></div>
|
|
49
|
-
<div class="topbar-actions"><span id="connection" class="badge neutral" role="status" data-i18n="reading">READING</span><button id="theme-toggle" class="icon-button" type="button" aria-label="Switch to light mode" title="Switch to light mode"><svg class="icon-sun" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" aria-hidden="true" focusable="false"><circle cx="12" cy="12" r="4"/><path d="M12 2v2m0 16v2M4.93 4.93l1.42 1.42m11.3 11.3 1.42 1.42M2 12h2m16 0h2M4.93 19.07l1.42-1.42m11.3-11.3 1.42-1.42"/></svg><svg class="icon-moon" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true" focusable="false"><path d="M12 3A9 9 0 1 0 21 12 7 7 0 0 1 12 3Z"/></svg></button><button id="language-toggle" class="icon-button language-button" type="button" aria-label="Switch to Chinese" title="Switch to Chinese">中文</button><button id="auto-refresh" type="button" aria-pressed="true" data-i18n-title="
|
|
50
|
+
<div class="topbar-actions"><span id="connection" class="badge neutral" role="status" data-i18n="reading">READING</span><button id="theme-toggle" class="icon-button" type="button" aria-label="Switch to light mode" title="Switch to light mode"><svg class="icon-sun" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" aria-hidden="true" focusable="false"><circle cx="12" cy="12" r="4"/><path d="M12 2v2m0 16v2M4.93 4.93l1.42 1.42m11.3 11.3 1.42 1.42M2 12h2m16 0h2M4.93 19.07l1.42-1.42m11.3-11.3 1.42-1.42"/></svg><svg class="icon-moon" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true" focusable="false"><path d="M12 3A9 9 0 1 0 21 12 7 7 0 0 1 12 3Z"/></svg></button><button id="language-toggle" class="icon-button language-button" type="button" aria-label="Switch to Chinese" title="Switch to Chinese">中文</button><button id="auto-refresh" type="button" aria-pressed="true" data-i18n-title="activity_updates_live" title="Activity updates live. Catalogs and retained usage refresh on demand or every 30 minutes while open."><span class="auto-refresh-measure" aria-hidden="true" data-i18n="auto_refresh_off">Auto refresh · OFF</span><span id="auto-refresh-label" data-i18n="auto_refresh_on">Auto refresh · ON</span></button><button id="refresh" type="button" data-i18n="refresh">Refresh</button></div>
|
|
50
51
|
</header>
|
|
51
52
|
|
|
52
53
|
<main id="main-content" tabindex="-1">
|
|
@@ -606,7 +606,7 @@
|
|
|
606
606
|
"codex_body_admission_active_active_queued_queued_queue_limit_lim": ["Codex body admission: active {active} / queued {queued} / queue limit {limit}", "Codex请求体:进行中{active}\n排队{queued} / 队列上限{limit}"],
|
|
607
607
|
"terminal_animation_unavailable_in_this_output_mode": ["Terminal animation unavailable in this output mode", "当前输出模式不播放终端动效"],
|
|
608
608
|
"prediction_integration_setup": ["Suggestion setup", "建议设置"],
|
|
609
|
-
"
|
|
609
|
+
"activity_updates_live": ["Activity updates live. Catalogs and retained usage refresh on demand or every 30 minutes while open.", "活动状态实时更新。\n列表和留存用量按需更新,\n展开时每30分钟刷新。"],
|
|
610
610
|
"request_records": ["Requests", "请求记录"],
|
|
611
611
|
"source_changes_new_requests": ["Applies to new requests after saving.", "保存后用于新的请求。"],
|
|
612
612
|
"conversation_model": ["Conversation model", "对话模型"],
|
|
@@ -1021,7 +1021,7 @@
|
|
|
1021
1021
|
"Codex body admission: active {active} / queued {queued} / queue limit {limit}": "codex_body_admission_active_active_queued_queued_queue_limit_lim",
|
|
1022
1022
|
"Terminal animation unavailable in this output mode": "terminal_animation_unavailable_in_this_output_mode",
|
|
1023
1023
|
"Prediction integration setup": "prediction_integration_setup",
|
|
1024
|
-
"
|
|
1024
|
+
"Activity updates live. Catalogs and retained usage refresh on demand or every 30 minutes while open.": "activity_updates_live",
|
|
1025
1025
|
"Clients": "clients",
|
|
1026
1026
|
"Model services": "model_services",
|
|
1027
1027
|
"Usage and diagnostics": "usage_and_diagnostics",
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
(() => {
|
|
2
|
+
function create({ visible, apply, state, tick = () => {}, eventSource = url => new EventSource(url), setTimer = setTimeout, clearTimer = clearTimeout }) {
|
|
3
|
+
let source = null, automatic = true, suspended = false, expiry = null, clock = null, last = null;
|
|
4
|
+
function stop() {
|
|
5
|
+
const previous = source;source = null;previous?.close();
|
|
6
|
+
clearTimer(expiry);clearTimer(clock);expiry = null;clock = null;last = null;
|
|
7
|
+
}
|
|
8
|
+
function animate() {
|
|
9
|
+
clearTimer(clock);clock = null;
|
|
10
|
+
if (!source || !last?.model_activity.active || !visible()) return;
|
|
11
|
+
clock = setTimer(() => { tick();animate(); }, 1000);
|
|
12
|
+
}
|
|
13
|
+
function alive() {
|
|
14
|
+
clearTimer(expiry);
|
|
15
|
+
expiry = setTimer(() => { stop();state("connecting");sync(); }, 45000);
|
|
16
|
+
}
|
|
17
|
+
function sync() {
|
|
18
|
+
if (!automatic || suspended || !visible()) { stop();state("paused");return; }
|
|
19
|
+
if (source) return;
|
|
20
|
+
state("connecting");
|
|
21
|
+
try {
|
|
22
|
+
const current = source = eventSource("/_ccdx/activity");
|
|
23
|
+
current.addEventListener("activity", event => {
|
|
24
|
+
if (current !== source) return;
|
|
25
|
+
try {
|
|
26
|
+
const value = JSON.parse(event.data), active = value.model_activity?.active;
|
|
27
|
+
if (value.scope !== "activity" || value.ok !== true || value.name !== "codex-copilot-dx"
|
|
28
|
+
|| !Number.isSafeInteger(active) || active < 0 || !Array.isArray(value.stream_performance?.active_requests)) throw Error("Invalid activity snapshot");
|
|
29
|
+
last = value;alive();apply(value);state("live");animate();
|
|
30
|
+
} catch { last = null;clearTimer(clock);clock = null;state("connecting"); }
|
|
31
|
+
});
|
|
32
|
+
current.addEventListener("heartbeat", () => { if (current === source && last) { alive();state("live"); } });
|
|
33
|
+
current.onerror = () => {
|
|
34
|
+
if (current !== source) return;
|
|
35
|
+
clearTimer(clock);clock = null;last = null;state("connecting");
|
|
36
|
+
if (current.readyState === 2) {
|
|
37
|
+
clearTimer(expiry);expiry = setTimer(() => { stop();sync(); }, 5000);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
alive();
|
|
41
|
+
} catch { source = null;state("unavailable"); }
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
sync,
|
|
45
|
+
setAutomatic(value) { automatic = value === true;sync(); },
|
|
46
|
+
suspend() { suspended = true;sync(); },
|
|
47
|
+
resume() { suspended = false;sync(); },
|
|
48
|
+
get current() { return last; },
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
globalThis.ccdxLive = { create };
|
|
52
|
+
})();
|
package/src/dashboard/status.js
CHANGED
|
@@ -264,6 +264,32 @@
|
|
|
264
264
|
|
|
265
265
|
const claude = data.providers?.claude || data.providers?.m365?.claude, claudeMetrics = claude?.requests?.performance;
|
|
266
266
|
percentiles("claude-ttft-percentiles", claudeMetrics?.by_route?.messages?.ttft_ms);
|
|
267
|
+
renderRequestTables(data);
|
|
268
|
+
if (element("claude-route") && visible(element("claude-route"))) {
|
|
269
|
+
element("claude-route").textContent = claude?.base_url || "—";
|
|
270
|
+
const clientState = value => ({ configured: "configured", restored: "settings_restored", preserved: "existing_settings_kept", partially_preserved: "existing_settings_kept",
|
|
271
|
+
not_installed: "not_installed", configuration_unavailable: "setup_unavailable" })[value] || "unknown";
|
|
272
|
+
text("claude-client-state", "claude_code_code_claude_app_app", { code: phrase(clientState(claude?.clients?.code)), app: phrase(clientState(claude?.clients?.app)) });
|
|
273
|
+
const totals = claudeMetrics?.by_route?.messages?.terminal_outcomes?.totals || claude?.requests || {};
|
|
274
|
+
for (const key of ["completed", "incomplete", "failed", "cancelled"]) text(`claude-${key}`, totals[key] === undefined ? "—" : number(totals[key]));
|
|
275
|
+
for (const [id, metric, unit] of [["claude-ttft", claudeMetrics?.by_route?.messages?.ttft_ms, "ms"], ["claude-speed", claudeMetrics?.by_route?.messages?.output_tokens_per_second, "token/s"]]) {
|
|
276
|
+
text(id, metric?.samples > 0 ? `${Number(metric.avg).toFixed(1)} ${unit} / ${metric.samples}` : "—");
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
renderRuntimeUsage(data);
|
|
280
|
+
if (element("prediction-preference") && visible(element("prediction-preference"))) {
|
|
281
|
+
const prediction = data.client_integrations?.prediction;
|
|
282
|
+
text("prediction-preference", prediction ? prediction.configured ? "configured" : "not_configured" : "unknown");
|
|
283
|
+
text("prediction-bridge", ({ running: "running_f4cca", recovering: "recovering", stopped: "stopped", unavailable: "unavailable_ca184" })[prediction?.bridge] || "unknown");
|
|
284
|
+
text("prediction-route", prediction?.client_route === "observed" ? "observed" : "unknown");
|
|
285
|
+
text("prediction-candidate", "unknown");
|
|
286
|
+
const note = element("prediction-note");
|
|
287
|
+
if (note) note.textContent = prediction?.reason || "";
|
|
288
|
+
}
|
|
289
|
+
text("updated", "snapshot_time", { time: time(Date.now()) });
|
|
290
|
+
}
|
|
291
|
+
function renderRequestTables(data) {
|
|
292
|
+
const claudeMetrics = (data.providers?.claude || data.providers?.m365?.claude)?.requests?.performance;
|
|
267
293
|
const sourceBody = element("source-requests-body");
|
|
268
294
|
if (sourceBody && visible(sourceBody)) {
|
|
269
295
|
sourceBody.replaceChildren();
|
|
@@ -286,27 +312,22 @@
|
|
|
286
312
|
const kind = element("failure-kind")?.value || "issues";
|
|
287
313
|
renderFailures(issueGroups[kind] || [], kind === "issues" ? recentRequests : []);
|
|
288
314
|
renderContext({ ...data.stream_performance, recent_requests: recentRequests });
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
text("prediction-preference", prediction ? prediction.configured ? "configured" : "not_configured" : "unknown");
|
|
304
|
-
text("prediction-bridge", ({ running: "running_f4cca", recovering: "recovering", stopped: "stopped", unavailable: "unavailable_ca184" })[prediction?.bridge] || "unknown");
|
|
305
|
-
text("prediction-route", prediction?.client_route === "observed" ? "observed" : "unknown");
|
|
306
|
-
text("prediction-candidate", "unknown");
|
|
307
|
-
const note = element("prediction-note");
|
|
308
|
-
if (note) note.textContent = prediction?.reason || "";
|
|
315
|
+
}
|
|
316
|
+
function renderActivity(data) {
|
|
317
|
+
globalThis.ccdxDashboardActivity?.update(data.model_activity, { live: true });
|
|
318
|
+
globalThis.ccdxDashboardFlow?.update(data, { live: true });
|
|
319
|
+
text("version", `v${data.version || "?"}`);
|
|
320
|
+
text("uptime", "pid_pid_uptime_duration", { pid: number(data.pid), duration: duration(data.uptime_ms) });
|
|
321
|
+
text("requests", number(data.requests?.total));
|
|
322
|
+
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) });
|
|
323
|
+
const categories = data.http_errors?.by_category;
|
|
324
|
+
text("http-error-breakdown", categories ? "http_categories" : "—",
|
|
325
|
+
categories ? Object.fromEntries(["inference", "capability", "protocol", "route", "other"].map(key => [key, number(categories[key] || 0)])) : {});
|
|
326
|
+
for (const key of ["completed", "incomplete", "failed", "cancelled"]) {
|
|
327
|
+
text(key, number(data.stream_performance?.by_route?.responses?.terminal_outcomes?.totals[key]));
|
|
328
|
+
text(`claude-${key}`, number(data.providers?.claude?.requests?.performance?.by_route?.messages?.terminal_outcomes?.totals[key]));
|
|
309
329
|
}
|
|
330
|
+
renderRuntimeUsage(data);renderRequestTables(data);
|
|
310
331
|
text("updated", "snapshot_time", { time: time(Date.now()) });
|
|
311
332
|
}
|
|
312
333
|
function renderRuntimeUsage(data) {
|
|
@@ -373,7 +394,7 @@
|
|
|
373
394
|
}
|
|
374
395
|
if (!contextRequests.length) emptyTable("context-body", 6, "no_observed_request_metadata");
|
|
375
396
|
}
|
|
376
|
-
return { render, renderProviders, renderFailures, renderContext };
|
|
397
|
+
return { render, renderActivity, renderProviders, renderFailures, renderContext };
|
|
377
398
|
}
|
|
378
399
|
globalThis.ccdxDashboardStatus = { create };
|
|
379
400
|
})();
|
package/src/dashboard/ui.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
:root { color-scheme: dark; --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", "Noto Sans SC", "WenQuanYi Micro Hei", monospace; font-family: var(--font-mono); --page: #0b110d; --surface: #111a13; --text: #e0e9df; --strong: #f0f6ec; --muted: #9aada0; --badge: #a9b9aa; --subtle: #78917d; --quiet: #819987; --footer: #7f9785; --border: #2b3b2f; --top-border: #2a3a2e; --accent: #a6f5a8; --accent-soft: #84e99e; --heading: #83b98b; --bad: #ff947e; --failed: #ff9f91; --incomplete: #e3c77c; --button-border: #45634b; --button-bg: #152219; --button-fg: #b2f1bd; --button-hover: #203526; --selected-bg: #192a1d; --option-hover: #1a2a1e; --table-text: #d8e2d8; --preview: #657d69; --ansi-white: #f5fff5; --ansi-159: #9af5e9; --ansi-123: #75e4d9; --ansi-87: #5ad0d4; --ansi-51: #42b9d8; --ansi-45: #3ca2d0; --ansi-39: #4389c2; --ansi-33: #4775b2; }
|
|
1
|
+
:root { --control-height:32px; --inline-control-height:30px; color-scheme: dark; --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", "Noto Sans SC", "WenQuanYi Micro Hei", monospace; font-family: var(--font-mono); --page: #0b110d; --surface: #111a13; --text: #e0e9df; --strong: #f0f6ec; --muted: #9aada0; --badge: #a9b9aa; --subtle: #78917d; --quiet: #819987; --footer: #7f9785; --border: #2b3b2f; --top-border: #2a3a2e; --accent: #a6f5a8; --accent-soft: #84e99e; --heading: #83b98b; --bad: #ff947e; --failed: #ff9f91; --incomplete: #e3c77c; --button-border: #45634b; --button-bg: #152219; --button-fg: #b2f1bd; --button-hover: #203526; --selected-bg: #192a1d; --option-hover: #1a2a1e; --table-text: #d8e2d8; --preview: #657d69; --ansi-white: #f5fff5; --ansi-159: #9af5e9; --ansi-123: #75e4d9; --ansi-87: #5ad0d4; --ansi-51: #42b9d8; --ansi-45: #3ca2d0; --ansi-39: #4389c2; --ansi-33: #4775b2; }
|
|
2
2
|
:root[data-theme="light"] { color-scheme: light; --page: #f5f8f3; --surface: #ffffff; --text: #1b2b20; --strong: #122219; --muted: #475d4e; --badge: #475d4e; --subtle: #4b6652; --quiet: #55715c; --footer: #59735f; --border: #c4d2c5; --top-border: #b8c9ba; --accent: #176b3a; --accent-soft: #176b3a; --heading: #235f37; --bad: #a33625; --failed: #a33625; --incomplete: #835600; --button-border: #79a085; --button-bg: #ebf4ec; --button-fg: #185b32; --button-hover: #dbeedd; --selected-bg: #e4f3e7; --option-hover: #edf6ee; --table-text: #233b2b; --preview: #596f60; --ansi-white: #234231; --ansi-159: #116b64; --ansi-123: #0d7771; --ansi-87: #116b75; --ansi-51: #14697e; --ansi-45: #1a6183; --ansi-39: #265f8d; --ansi-33: #365a8d; }
|
|
3
3
|
* { box-sizing: border-box; }
|
|
4
4
|
input, textarea, select, button { font-family: inherit; }
|
|
@@ -16,7 +16,7 @@ html { scrollbar-gutter: stable; }
|
|
|
16
16
|
.badge::before { content: "●"; margin-right: 8px; }
|
|
17
17
|
.badge.good { color: var(--accent-soft); }
|
|
18
18
|
.badge.bad { color: var(--bad); }
|
|
19
|
-
button, .button-link { border: 1px solid var(--button-border); border-radius: 2px; background: var(--button-bg); color: var(--button-fg); padding:
|
|
19
|
+
button, .button-link { border: 1px solid var(--button-border); border-radius: 2px; background: var(--button-bg); color: var(--button-fg); min-height:var(--control-height); padding: 0 10px; font: inherit; font-size: 11px; line-height:1.2; font-weight: 700; text-transform: uppercase; cursor: pointer; }
|
|
20
20
|
button:hover, .button-link:hover { background: var(--button-hover); }
|
|
21
21
|
button:focus-visible, .button-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
|
|
22
22
|
.button-link { display:inline-flex;align-items:center;justify-content:center;text-decoration:none; }
|
|
@@ -45,10 +45,10 @@ h1 { margin: 0; font-size: clamp(20px, 3vw, 27px); font-weight: 650; letter-spac
|
|
|
45
45
|
.intro .snapshot-meta p { margin: 0; overflow-wrap: anywhere; }
|
|
46
46
|
.overview { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 11px; }
|
|
47
47
|
.card, .panel, .lower { min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 2px; }
|
|
48
|
-
.card { min-height:
|
|
48
|
+
.card { min-height: 108px; padding: 16px; }
|
|
49
49
|
.card h2, .panel h2, .lower h2, .panel > summary, .analytics-section > summary { color: var(--heading); font-size: 11px; font-weight: 700; letter-spacing: .08em; line-height: 1.6; margin: 0; }
|
|
50
|
-
.card strong, .panel > strong { display: block; margin-top:
|
|
51
|
-
.card p { margin:
|
|
50
|
+
.card strong, .panel > strong { display: block; margin-top: 12px; color: var(--strong); font-size: 23px; font-weight: 650; line-height: 1.25; letter-spacing: -.035em; overflow-wrap: anywhere; }
|
|
51
|
+
.card p { margin: 6px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; overflow-wrap: anywhere; }
|
|
52
52
|
.details { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 11px; margin-top: 11px; }
|
|
53
53
|
.panel { min-height: 205px; padding: 18px; }
|
|
54
54
|
.panel-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
|
|
@@ -59,27 +59,28 @@ h1 { margin: 0; font-size: clamp(20px, 3vw, 27px); font-weight: 650; letter-spac
|
|
|
59
59
|
.stats dd { margin: 0; font-size: 14px; font-weight: 650; }
|
|
60
60
|
#incomplete { color: var(--incomplete); }
|
|
61
61
|
#failed { color: var(--failed); }
|
|
62
|
-
.hint { color: var(--subtle); font-size: 11px; line-height: 1.5; margin:
|
|
62
|
+
.hint { color: var(--subtle); font-size: 11px; line-height: 1.5; margin: 10px 0 0; overflow-wrap: anywhere; }
|
|
63
63
|
.meter { display: block; width: 100%; height: 6px; border: 0; border-radius: 0; background: var(--border); margin-top: 20px; appearance: none; }
|
|
64
64
|
.meter::-webkit-progress-bar { background: var(--border); }
|
|
65
65
|
.meter::-webkit-progress-value { background: var(--accent-soft); }
|
|
66
66
|
.meter::-moz-progress-bar { background: var(--accent-soft); }
|
|
67
|
-
.dashboard-section { min-height: 0; margin-top:
|
|
68
|
-
.connection-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding:
|
|
67
|
+
.dashboard-section { min-height: 0; margin-top: 12px; }
|
|
68
|
+
.connection-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--border); min-width: 0; }
|
|
69
69
|
.connection-row:last-child { border-bottom: 0; padding-bottom: 0; }
|
|
70
70
|
.connection-row > div:first-child { min-width: 0; }
|
|
71
71
|
.connection-row h3 { margin: 0; color: var(--text); font-size: 13px; }
|
|
72
72
|
.connection-row p { margin: 5px 0 0; overflow-wrap: anywhere; }
|
|
73
73
|
.connection-actions, .connection-checks { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
|
|
74
74
|
.connection-actions { flex: 0 0 auto; }
|
|
75
|
+
.connection-actions button, .model-catalog td button { min-height:var(--inline-control-height); height:var(--inline-control-height); padding:0 9px; }
|
|
75
76
|
.connection-checks label { display: inline-flex; align-items: center; gap: 7px; min-height: 30px; white-space: nowrap; }
|
|
76
77
|
.connection-checks input { flex: none; accent-color: var(--accent); }
|
|
77
|
-
.connection-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin:
|
|
78
|
+
.connection-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 12px 0; }
|
|
78
79
|
.connection-fields > label { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
|
|
79
|
-
.connection-fields input, .connection-fields select { width: 100%; min-width: 0; min-height:
|
|
80
|
+
.connection-fields input, .connection-fields select { width: 100%; min-width: 0; height:var(--control-height); min-height:var(--control-height); }
|
|
80
81
|
.connection-fields input, #connection-model-id { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--button-border); border-radius: 2px; padding: 7px 10px; }
|
|
81
82
|
.connection-fields input:focus-visible, #connection-model-id:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
|
|
82
|
-
#connection-editor fieldset, #connection-client-editor fieldset { border: 0; padding: 0; margin:
|
|
83
|
+
#connection-editor fieldset, #connection-client-editor fieldset { border: 0; padding: 0; margin: 16px 0; min-width: 0; }
|
|
83
84
|
#connection-editor legend, #connection-client-editor legend { padding: 0; margin-bottom: 9px; color: var(--text); }
|
|
84
85
|
#connection-models td { white-space: normal; overflow-wrap: anywhere; }
|
|
85
86
|
#connection-models td:first-child { min-width: 140px; }
|
|
@@ -107,14 +108,14 @@ h1 { margin: 0; font-size: clamp(20px, 3vw, 27px); font-weight: 650; letter-spac
|
|
|
107
108
|
.ansi-45 { color: var(--ansi-45); }
|
|
108
109
|
.ansi-39 { color: var(--ansi-39); }
|
|
109
110
|
.ansi-33 { color: var(--ansi-33); }
|
|
110
|
-
.section-actions { display: flex; align-items: center; gap:
|
|
111
|
+
.section-actions { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
|
|
111
112
|
.section-actions span { color: var(--muted); font-size: 11px; }
|
|
112
|
-
.table-note { margin:
|
|
113
|
+
.table-note { margin: 10px 0 6px; color: var(--muted); font-size: 11px; }
|
|
113
114
|
.card p, .hint, .table-note, .section-actions span, .chart-heading span { white-space: pre-line; }
|
|
114
115
|
.table-wrap { width: 100%; overflow-x: auto; }
|
|
115
116
|
table { width: 100%; border-collapse: collapse; font-size: 11px; }
|
|
116
117
|
th { color: var(--heading); text-align: left; font-weight: 700; letter-spacing: .05em; }
|
|
117
|
-
th, td { padding:
|
|
118
|
+
th, td { padding: 7px 12px 7px 0; border-bottom: 1px solid var(--border); white-space: nowrap; }
|
|
118
119
|
th:last-child, td:last-child { padding-right: 0; }
|
|
119
120
|
tbody tr:last-child td { border-bottom: 0; }
|
|
120
121
|
td { color: var(--table-text); }
|
|
@@ -157,7 +158,7 @@ td details > :is(dl, p, pre, div, ul, ol), #connection-model-detail { contain: i
|
|
|
157
158
|
.analytics-section { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
|
|
158
159
|
.analytics-controls { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 18px; }
|
|
159
160
|
.analytics-controls label { color: var(--muted); font-size: 11px; }
|
|
160
|
-
select { appearance: none; -webkit-appearance: none; max-width: 260px; min-height:
|
|
161
|
+
select { appearance: none; -webkit-appearance: none; max-width: 260px; height:var(--control-height); min-height:var(--control-height); padding: 0 30px 0 10px; font: inherit; color: var(--text); background-color: var(--surface); border: 1px solid var(--button-border); border-radius: 0; box-shadow: none; background-image: linear-gradient(45deg, transparent 50%, var(--text) 50%), linear-gradient(135deg, var(--text) 50%, transparent 50%); background-position: calc(100% - 13px) center, calc(100% - 9px) center; background-size: 4px 4px; background-repeat: no-repeat; }
|
|
161
162
|
select:focus { border-color: var(--accent); border-radius: 0; box-shadow: none; }
|
|
162
163
|
select:focus:not(:focus-visible) { outline: none; }
|
|
163
164
|
select option { color: var(--text); background: var(--surface); }
|
|
@@ -229,25 +230,25 @@ footer { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; color:
|
|
|
229
230
|
|
|
230
231
|
/* Each view has one scope. The sidebar stays separate from business data. */
|
|
231
232
|
[hidden] { display: none !important; }
|
|
232
|
-
.shell { max-width: 1520px; min-height: 100vh; display: grid; grid-template-columns: 204px minmax(0, 1fr); grid-template-rows:
|
|
233
|
+
.shell { max-width: 1520px; min-height: 100vh; display: grid; grid-template-columns: 204px minmax(0, 1fr); grid-template-rows: 64px minmax(0, 1fr) auto; column-gap: 34px; padding: 0 28px; }
|
|
233
234
|
.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); }
|
|
234
235
|
.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; }
|
|
235
236
|
.sidebar-brand .brand-caption { display: block; color: var(--muted); font-size: 10px; font-weight: 500; letter-spacing: .1em; margin-top: 8px; }
|
|
236
|
-
.sidebar nav { display: flex; flex-direction: column; gap: 5px; margin-top:
|
|
237
|
-
.sidebar nav a { color: var(--muted); text-decoration: none; padding:
|
|
237
|
+
.sidebar nav { display: flex; flex-direction: column; gap: 5px; margin-top: 28px; }
|
|
238
|
+
.sidebar nav a { color: var(--muted); text-decoration: none; padding: 8px 12px; font-size: 13px; border-left: 2px solid transparent; }
|
|
238
239
|
.sidebar nav a:hover { background: var(--option-hover); color: var(--text); }
|
|
239
240
|
.sidebar nav a[aria-current="page"] { color: var(--accent); background: var(--selected-bg); border-left-color: var(--accent); }
|
|
240
241
|
.sidebar nav a:focus-visible, .sidebar-brand:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
|
|
241
|
-
.nav-group { color: var(--subtle); font-size: 10px; padding:
|
|
242
|
+
.nav-group { color: var(--subtle); font-size: 10px; padding: 14px 12px 4px; text-transform: uppercase; letter-spacing: .08em; }
|
|
242
243
|
.topbar, main, footer { grid-column: 2; min-width: 0; }
|
|
243
|
-
.topbar { height:
|
|
244
|
+
.topbar { height: 64px; min-height: 64px; gap: 14px; position: sticky; top: 0; z-index: 5; background: var(--page); }
|
|
244
245
|
.brand { font-size: 12px; }
|
|
245
246
|
.topbar-actions { gap: 12px; flex-wrap: nowrap; }
|
|
246
247
|
.topbar-actions #connection { width: 154px; flex: none; }
|
|
247
|
-
.topbar-actions #auto-refresh { display:inline-grid; flex:none; justify-self:start; white-space:nowrap; }
|
|
248
|
+
.topbar-actions #auto-refresh { display:inline-grid; place-items:center; flex:none; justify-self:start; white-space:nowrap; }
|
|
248
249
|
#auto-refresh span { grid-column:1; grid-row:1; }
|
|
249
250
|
#auto-refresh .auto-refresh-measure { visibility:hidden; }
|
|
250
|
-
.intro { display: block; padding:
|
|
251
|
+
.intro { display: block; padding: 20px 0 16px; min-height: 0; }
|
|
251
252
|
main { align-self: start; }
|
|
252
253
|
#main-content:focus { outline: none; }
|
|
253
254
|
.section-link { display: inline-block; color: var(--accent); font-size: 12px; text-underline-offset: 3px; }
|
|
@@ -267,15 +268,15 @@ main { align-self: start; }
|
|
|
267
268
|
.snapshot-meta { justify-content: flex-start; margin-top: 14px; line-height: 1.7; }
|
|
268
269
|
.overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
|
269
270
|
.client-overview { grid-template-columns: 1fr; }
|
|
270
|
-
.card { min-height:
|
|
271
|
-
.panel, .lower { padding:
|
|
271
|
+
.card { min-height: 108px; }
|
|
272
|
+
.panel, .lower { padding: 16px; }
|
|
272
273
|
.panel h2, .lower h2, .panel > summary { font-size: 12px; letter-spacing: .045em; }
|
|
273
274
|
.hint, .table-note, td, th, .stats dt { font-size: 12px; line-height: 1.7; }
|
|
274
275
|
.section-actions { flex-wrap: wrap; align-items: end; }
|
|
275
276
|
.section-actions label { display: grid; gap: 7px; color: var(--muted); font-size: 12px; max-width: 100%; }
|
|
276
|
-
.section-actions input, .section-actions select { max-width: 100%; min-height:
|
|
277
|
+
.section-actions input, .section-actions select { max-width: 100%; min-height:var(--control-height); }
|
|
277
278
|
input[type="number"] { width: 120px; font: inherit; color: var(--text); background: var(--page); border: 1px solid var(--border); padding: 7px; }
|
|
278
|
-
.setting-row { display: grid; grid-template-columns: minmax(160px, 1fr) 44px minmax(0, 1.4fr); align-items: center; gap: 16px; padding:
|
|
279
|
+
.setting-row { display: grid; grid-template-columns: minmax(160px, 1fr) 44px minmax(0, 1.4fr); align-items: center; gap: 16px; padding: 12px 0; font-size: 13px; }
|
|
279
280
|
.setting-row .hint { margin: 0; }
|
|
280
281
|
input[role="switch"] { appearance: none; width: 38px; height: 22px; border: 1px solid var(--button-border); border-radius: 20px; background: var(--border); cursor: pointer; margin: 0; position: relative; }
|
|
281
282
|
input[role="switch"]::before { content: ""; position: absolute; width: 14px; height: 14px; left: 3px; top: 3px; border-radius: 50%; background: var(--muted); }
|
|
@@ -294,7 +295,7 @@ input[role="switch"]:disabled { opacity: .5; cursor: wait; }
|
|
|
294
295
|
.section-actions > label { min-width: 0; max-width: 100%; }
|
|
295
296
|
.section-actions select { min-width: 180px; width: 100%; max-width: 320px; }
|
|
296
297
|
.section-actions input:not([type="checkbox"]), .section-actions select, .section-actions button, .section-actions .button-link,
|
|
297
|
-
.analytics-controls select { box-sizing: border-box; height:
|
|
298
|
+
.analytics-controls select { box-sizing: border-box; height:var(--control-height); min-height:var(--control-height); line-height:normal; }
|
|
298
299
|
.section-actions button, .section-actions .button-link { padding-top: 0; padding-bottom: 0; }
|
|
299
300
|
@media (max-width: 640px) {
|
|
300
301
|
.topbar { height:auto; min-height:96px; padding:8px 0; }
|
|
@@ -328,21 +329,21 @@ input[role="switch"]:disabled { opacity: .5; cursor: wait; }
|
|
|
328
329
|
--bad:#ff947e; --failed:#ff9f91; --incomplete:#e3c77c;
|
|
329
330
|
}
|
|
330
331
|
|
|
331
|
-
.appearance-row { display:grid; grid-template-columns:minmax(0,1fr) 200px; align-items:center; gap:18px; margin-top:
|
|
332
|
+
.appearance-row { display:grid; grid-template-columns:minmax(0,1fr) 200px; align-items:center; gap:18px; margin-top:12px; }
|
|
332
333
|
.appearance-label { min-width:0; }
|
|
333
334
|
.appearance-label label { display:block; font-size:13px; color:var(--text); line-height:1.65; }
|
|
334
|
-
.appearance-label p { margin:
|
|
335
|
-
.appearance-select { width:100%; max-width:100%; min-width:0; height:
|
|
336
|
-
.appearance-note { color:var(--subtle); margin:
|
|
337
|
-
.appearance-animation { margin-top:
|
|
335
|
+
.appearance-label p { margin:3px 0 0; font-size:12px; color:var(--subtle); line-height:1.7; }
|
|
336
|
+
.appearance-select { width:100%; max-width:100%; min-width:0; height:var(--control-height); box-sizing:border-box; border-radius:0; padding:0 30px 0 10px; font-size:12px; }
|
|
337
|
+
.appearance-note { color:var(--subtle); margin:12px 0 0; font-size:12px; line-height:1.7; }
|
|
338
|
+
.appearance-animation { margin-top:16px; }
|
|
338
339
|
.terminal-animation-toggle { border-bottom:0; }
|
|
339
340
|
.sidebar nav a { display:flex; align-items:center; gap:10px; }
|
|
340
341
|
.nav-icon { width:17px; height:17px; flex:none; fill:none; stroke:currentColor; stroke-width:1.5; stroke-linecap:round; stroke-linejoin:round; }
|
|
341
342
|
#source-detail { display:flex; flex-wrap:wrap; gap:5px 22px; }
|
|
342
343
|
.version-heading, .install-command-heading { display:flex; align-items:center; justify-content:space-between; gap:14px; flex-wrap:wrap; }
|
|
343
344
|
.version-heading h2 { margin:0; }
|
|
344
|
-
.version-list { margin:
|
|
345
|
-
.version-list > div { display:grid; grid-template-columns:minmax(110px,1fr) auto minmax(150px,1fr); align-items:baseline; gap:16px; padding:
|
|
345
|
+
.version-list { margin:10px 0 0; }
|
|
346
|
+
.version-list > div { display:grid; grid-template-columns:minmax(110px,1fr) auto minmax(150px,1fr); align-items:baseline; gap:16px; padding:10px 0; border-bottom:1px solid var(--border); }
|
|
346
347
|
.version-list > div:last-child { border-bottom:0; }
|
|
347
348
|
.version-list dt { font-size:12px; }
|
|
348
349
|
.version-list dd { margin:0; }
|
|
@@ -464,7 +465,7 @@ input[role="switch"]:disabled { opacity: .5; cursor: wait; }
|
|
|
464
465
|
.account-fields { display:grid; grid-template-columns:minmax(110px,150px) minmax(0,1fr); gap:10px 18px; margin:20px 0; font-size:12px; line-height:1.7; }
|
|
465
466
|
.account-fields dt { color:var(--muted); }
|
|
466
467
|
.account-fields dd { margin:0; min-width:0; }
|
|
467
|
-
.tool-details, .tool-flow { margin-top:
|
|
468
|
+
.tool-details, .tool-flow { margin-top:16px; }
|
|
468
469
|
.tool-details summary, .tool-flow h3 { color:var(--heading); font-size:12px; }
|
|
469
470
|
.device-code { display:block; color:var(--accent); font-size:23px; letter-spacing:.1em; margin:16px 0; }
|
|
470
471
|
.tool-link { display:inline-flex; min-height:36px; align-items:center; color:var(--accent); margin-right:16px; }
|
|
@@ -483,20 +484,20 @@ input[role="switch"]:disabled { opacity: .5; cursor: wait; }
|
|
|
483
484
|
.source-account-actions { margin-top: 18px; }
|
|
484
485
|
@media(max-width:640px) { .account-summary { grid-template-columns:1fr; } }
|
|
485
486
|
|
|
486
|
-
.flow-network { position:relative;display:grid;grid-template-columns:minmax(130px,1fr) 70px minmax(170px,1fr);column-gap:clamp(36px,6vw,92px);align-items:stretch;min-height:
|
|
487
|
+
.flow-network { position:relative;display:grid;grid-template-columns:minmax(130px,1fr) 70px minmax(170px,1fr);column-gap:clamp(36px,6vw,92px);align-items:stretch;min-height:218px;margin:16px 0 12px; }
|
|
487
488
|
.flow-wires { position:absolute;inset:0;width:100%;height:100%;pointer-events:none;overflow:visible; }
|
|
488
489
|
.flow-activity { will-change:transform; }
|
|
489
490
|
.flow-wires .flow-split { visibility:hidden;animation:none; }
|
|
490
491
|
.flow-column,.flow-hub-column { position:relative;min-width:0; }
|
|
491
492
|
.flow-column { display:flex;flex-direction:column; }
|
|
492
|
-
.flow-column-title { height:18px;line-height:18px;margin:0 0
|
|
493
|
-
.flow-apps,#flow-models { display:flex;flex:1;flex-direction:column;justify-content:center;align-items:center;gap:
|
|
493
|
+
.flow-column-title { height:18px;line-height:18px;margin:0 0 14px;color:var(--muted);font-size:11px;text-align:center; }
|
|
494
|
+
.flow-apps,#flow-models { display:flex;flex:1;flex-direction:column;justify-content:center;align-items:center;gap:44px;padding:20px 0;min-width:0; }
|
|
494
495
|
#flow-apps { align-items:flex-end; }
|
|
495
496
|
#flow-apps .flow-node { justify-content:flex-end; }
|
|
496
497
|
#flow-apps .flow-choice { text-align:right; }
|
|
497
498
|
#flow-apps .flow-count { margin-right:9px; }
|
|
498
499
|
#flow-apps .flow-note { left:auto;right:9px;text-align:right; }
|
|
499
|
-
.flow-hub-column { display:flex;align-items:center;justify-content:center;padding-top:
|
|
500
|
+
.flow-hub-column { display:flex;align-items:center;justify-content:center;padding-top:32px; }
|
|
500
501
|
.flow-node { position:relative;display:flex;align-items:center;gap:8px;width:max-content;max-width:100%;min-height:34px; }
|
|
501
502
|
.flow-choice { min-width:0;max-width:100%;min-height:34px;padding:7px 9px;border-color:transparent;background:transparent;color:var(--text);font-size:12px;font-weight:600;text-transform:none;text-align:center;overflow-wrap:anywhere; }
|
|
502
503
|
.flow-choice:hover { background:var(--option-hover); }
|
|
@@ -599,7 +600,7 @@ input[role="switch"]:disabled { opacity: .5; cursor: wait; }
|
|
|
599
600
|
.model-identity { display:grid;grid-template-columns:auto 1fr;gap:8px 16px;font-size:12px;margin:18px 0; }
|
|
600
601
|
.model-identity dt { color:var(--muted); }
|
|
601
602
|
.model-identity dd { margin:0;overflow-wrap:anywhere; }
|
|
602
|
-
.memory-model-row { display:flex;align-items:center;justify-content:space-between;gap:16px;flex-wrap:wrap;padding:
|
|
603
|
+
.memory-model-row { display:flex;align-items:center;justify-content:space-between;gap:16px;flex-wrap:wrap;padding:12px 0; }
|
|
603
604
|
.memory-model-value { display:flex;align-items:center;gap:12px;flex-wrap:wrap; }
|
|
604
605
|
.memory-model-notice { margin:0 0 18px;color:var(--incomplete);font-size:12px;line-height:1.7; }
|
|
605
606
|
.memory-model-badge { display:block;margin:5px 0 0 23px;color:var(--muted);font-size:11px; }
|
|
@@ -616,7 +617,7 @@ input[role="switch"]:disabled { opacity: .5; cursor: wait; }
|
|
|
616
617
|
|
|
617
618
|
/* Settings-page preferences keep their own draft, save and recovery controls. */
|
|
618
619
|
.preferences-status { color:var(--muted); font-size:11px; }
|
|
619
|
-
.preferences-row { display:flex; align-items:center; justify-content:space-between; gap:20px; padding:
|
|
620
|
+
.preferences-row { display:flex; align-items:center; justify-content:space-between; gap:20px; padding:12px 0; font-size:13px; }
|
|
620
621
|
.preferences-row:last-of-type { padding-bottom:0; }
|
|
621
622
|
.preferences-row .hint { margin-top:5px; }
|
|
622
623
|
.preferences-row input[role="switch"] { flex:none; }
|
|
@@ -643,7 +644,7 @@ input[role="switch"]:disabled { opacity: .5; cursor: wait; }
|
|
|
643
644
|
.context-sessions th:nth-child(3) { width:32%; }
|
|
644
645
|
.context-sessions th:last-child, .context-sessions td:last-child { text-align:right; }
|
|
645
646
|
.context-session { text-transform:none;max-width:100%;overflow-wrap:anywhere; }
|
|
646
|
-
.context-metrics { display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:16px;margin:
|
|
647
|
+
.context-metrics { display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:16px;margin:18px 0; }
|
|
647
648
|
.context-metrics dt { color:var(--muted);font-size:11px; }
|
|
648
649
|
.context-metrics dd { margin:8px 0 0;font-size:23px;font-variant-numeric:tabular-nums; }
|
|
649
650
|
.context-history-chart { min-height:210px;color:var(--muted);margin-top:14px; }
|
|
@@ -654,3 +655,5 @@ input[role="switch"]:disabled { opacity: .5; cursor: wait; }
|
|
|
654
655
|
.context-point { fill:var(--accent); }
|
|
655
656
|
.context-compact { stroke:var(--muted);stroke-width:1;stroke-dasharray:3 5; }
|
|
656
657
|
@media (max-width:640px) { .context-metrics { grid-template-columns:repeat(2,minmax(0,1fr));gap:18px; } .context-metrics dd { font-size:21px; } }
|
|
658
|
+
|
|
659
|
+
@media (pointer:coarse) { :root { --control-height:44px; --inline-control-height:44px; } }
|
package/src/dashboard/ui.js
CHANGED
|
@@ -18,7 +18,7 @@ const mib = (value) => finite(value) ? `${(Number(value) / 1048576).toFixed(1)}
|
|
|
18
18
|
const time = (value, options) => globalThis.ccdxTime?.format(value, options) ?? (value ? new Date(value).toLocaleTimeString() : "—");
|
|
19
19
|
const viewHelpers = { time, element, phrase, localize, text, finite, number, mib, tableRow, emptyTable, document, navigator: globalThis.navigator,
|
|
20
20
|
motionAllowed: () => !reducedMotion.matches && document.visibilityState === "visible" && element("usage-analytics").open && !element("usage-analytics").closest("[hidden]") };
|
|
21
|
-
const { render, renderProviders, renderFailures, renderContext } = globalThis.ccdxViewBoundary.create("client-features", () => globalThis.ccdxDashboardStatus.create(viewHelpers), ["render", "renderProviders", "renderFailures", "renderContext"]);
|
|
21
|
+
const { render, renderActivity, renderProviders, renderFailures, renderContext } = globalThis.ccdxViewBoundary.create("client-features", () => globalThis.ccdxDashboardStatus.create(viewHelpers), ["render", "renderActivity", "renderProviders", "renderFailures", "renderContext"]);
|
|
22
22
|
const usageView = globalThis.ccdxViewBoundary.create("usage-analytics", () => globalThis.ccdxDashboardUsage.create(viewHelpers), ["applyUsage", "renderUsageState", "renderAnalytics", "renderUsageTable", "selectUsageDay", "usageValues", "setChartVisible", "revealChart", "stopMotion"]);
|
|
23
23
|
const { applyUsage, renderUsageState, renderAnalytics, renderUsageTable, selectUsageDay } = usageView;
|
|
24
24
|
const loadAuth = () => dashboardRefresh.refresh("auth", { force: true });
|
|
@@ -252,8 +252,8 @@ for (const [key, ids] of [["auth", ["account-authorization", "client-features",
|
|
|
252
252
|
|
|
253
253
|
const updateView = globalThis.ccdxDashboardUpdates.create(viewHelpers);
|
|
254
254
|
function statusState(state) {
|
|
255
|
-
if (state.error || !state.value) globalThis.ccdxDashboardActivity?.unavailable();
|
|
256
|
-
if ((state.error || !state.value) && statusResourceKey() === "status") globalThis.ccdxDashboardFlow?.unavailable();
|
|
255
|
+
if (!liveActivity.current && (state.error || !state.value)) globalThis.ccdxDashboardActivity?.unavailable();
|
|
256
|
+
if (!liveActivity.current && (state.error || !state.value) && statusResourceKey() === "status") globalThis.ccdxDashboardFlow?.unavailable();
|
|
257
257
|
text("connection", state.pending && !state.value ? "reading" : state.error ? "unavailable_eb0be" : "service_reachable");
|
|
258
258
|
element("connection").className = `badge ${state.pending ? "neutral" : state.error ? "bad" : "good"}`;
|
|
259
259
|
globalThis.ccdxIcons?.set(element("connection"), state.pending && !state.value ? "reading" : state.error ? "unavailable_eb0be" : "service_reachable",
|
|
@@ -289,7 +289,7 @@ const dashboardRefresh = globalThis.ccdxRefresh.createController({
|
|
|
289
289
|
if (data.ok !== true || data.name !== "codex-copilot-dx") throw new Error("Unexpected status response");
|
|
290
290
|
return data;
|
|
291
291
|
},
|
|
292
|
-
apply: data => { if (statusResourceKey() === "status") render(data); },
|
|
292
|
+
apply: data => { if (statusResourceKey() === "status") { render(data);restoreLive(data); } },
|
|
293
293
|
state: state => { if (statusResourceKey() === "status") statusState(state); },
|
|
294
294
|
},
|
|
295
295
|
"status-summary": {
|
|
@@ -299,7 +299,7 @@ const dashboardRefresh = globalThis.ccdxRefresh.createController({
|
|
|
299
299
|
if (data.ok !== true || data.name !== "codex-copilot-dx") throw new Error("Unexpected status response");
|
|
300
300
|
return data;
|
|
301
301
|
},
|
|
302
|
-
apply: data => { if (statusResourceKey() === "status-summary") render(data); },
|
|
302
|
+
apply: data => { if (statusResourceKey() === "status-summary") { render(data);restoreLive(data); } },
|
|
303
303
|
state: state => { if (statusResourceKey() === "status-summary") statusState(state); },
|
|
304
304
|
},
|
|
305
305
|
auth: {
|
|
@@ -417,22 +417,46 @@ const dashboardRefresh = globalThis.ccdxRefresh.createController({
|
|
|
417
417
|
});
|
|
418
418
|
|
|
419
419
|
const autoRefreshKey = "ccdx.dashboard.autoRefresh";
|
|
420
|
+
let liveCompleted = null;
|
|
421
|
+
const liveActivity = globalThis.ccdxLive.create({
|
|
422
|
+
visible: () => document.visibilityState === "visible",
|
|
423
|
+
apply: data => {
|
|
424
|
+
renderActivity(data);
|
|
425
|
+
const completed = JSON.stringify([data.instance_id, data.requests?.completed]);
|
|
426
|
+
if (completed !== liveCompleted && globalThis.ccdxContextView?.visible()) void dashboardRefresh.refresh("context", { force: true });
|
|
427
|
+
liveCompleted = completed;
|
|
428
|
+
},
|
|
429
|
+
tick: () => globalThis.ccdxDashboardFlow?.tick(),
|
|
430
|
+
state: value => {
|
|
431
|
+
if (value === "live") {
|
|
432
|
+
element("connection").className = "badge good";
|
|
433
|
+
globalThis.ccdxIcons?.set(element("connection"), "service_reachable", "connected");
|
|
434
|
+
} else {
|
|
435
|
+
globalThis.ccdxDashboardActivity?.unavailable();globalThis.ccdxDashboardFlow?.unavailable();
|
|
436
|
+
if (value !== "paused") {
|
|
437
|
+
element("connection").className = "badge neutral";
|
|
438
|
+
globalThis.ccdxIcons?.set(element("connection"), "reading", "unknown");
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
},
|
|
442
|
+
});
|
|
443
|
+
function restoreLive(data) { if (liveActivity.current && liveActivity.current.instance_id === data.instance_id) renderActivity(liveActivity.current); }
|
|
420
444
|
const updateAutoRefresh = () => {
|
|
421
445
|
element("auto-refresh").setAttribute("aria-pressed", String(dashboardRefresh.automatic));
|
|
422
446
|
text("auto-refresh-label", dashboardRefresh.automatic ? "auto_refresh_on" : "auto_refresh_off");
|
|
423
447
|
};
|
|
424
448
|
let automatic = true;
|
|
425
449
|
try { automatic = localStorage.getItem(autoRefreshKey) !== "off"; } catch { /* Keep the default when browser storage is unavailable. */ }
|
|
426
|
-
dashboardRefresh.setAutomatic(automatic);
|
|
450
|
+
dashboardRefresh.setAutomatic(automatic);liveActivity.setAutomatic(automatic);
|
|
427
451
|
updateAutoRefresh();
|
|
428
452
|
element("auto-refresh").addEventListener("click", () => {
|
|
429
|
-
dashboardRefresh.setAutomatic(!dashboardRefresh.automatic);
|
|
453
|
+
dashboardRefresh.setAutomatic(!dashboardRefresh.automatic);liveActivity.setAutomatic(dashboardRefresh.automatic);
|
|
430
454
|
updateAutoRefresh();
|
|
431
455
|
try { localStorage.setItem(autoRefreshKey, dashboardRefresh.automatic ? "on" : "off"); } catch { /* Keep the current choice. */ }
|
|
432
456
|
});
|
|
433
|
-
document.addEventListener("visibilitychange", () => dashboardRefresh.visibilityChanged());
|
|
434
|
-
window.addEventListener("pagehide", () => { dashboardRefresh.suspend(); stopAnimationPreview();usageView.stopMotion(); });
|
|
435
|
-
window.addEventListener("pageshow", () => { dashboardRefresh.resume(); syncAnimationPreview(); });
|
|
457
|
+
document.addEventListener("visibilitychange", () => { dashboardRefresh.visibilityChanged();liveActivity.sync(); });
|
|
458
|
+
window.addEventListener("pagehide", () => { dashboardRefresh.suspend();liveActivity.suspend(); stopAnimationPreview();usageView.stopMotion(); });
|
|
459
|
+
window.addEventListener("pageshow", () => { dashboardRefresh.resume();liveActivity.resume(); syncAnimationPreview(); });
|
|
436
460
|
|
|
437
461
|
for (const [id, key] of [["account-authorization", "auth"], ["client-features", "status"], ["request-context", "status"], ["recent-failures", "status"], ["upstream-models", "models"], ["model-usage", "usage"]]) {
|
|
438
462
|
element(id).addEventListener("toggle", () => {
|
package/src/dashboard.mjs
CHANGED
|
@@ -21,6 +21,7 @@ const ASSETS = new Map([
|
|
|
21
21
|
["/usage.js", ["./dashboard/usage.js", "text/javascript; charset=utf-8"]],
|
|
22
22
|
["/context.js", ["./dashboard/context.js", "text/javascript; charset=utf-8"]],
|
|
23
23
|
["/refresh.js", ["./dashboard/refresh.js", "text/javascript; charset=utf-8"]],
|
|
24
|
+
["/live.js", ["./dashboard/live.js", "text/javascript; charset=utf-8"]],
|
|
24
25
|
["/icons.js", ["./dashboard/icons.js", "text/javascript; charset=utf-8"]],
|
|
25
26
|
["/disclosure.js", ["./dashboard/disclosure.js", "text/javascript; charset=utf-8"]],
|
|
26
27
|
["/tools.js", ["./dashboard/tools.js", "text/javascript; charset=utf-8"]],
|
|
@@ -4,17 +4,27 @@ import { createRequestAbort, readJsonBody, sendJsonError } from "./http-transpor
|
|
|
4
4
|
import { httpError } from "./http-errors.mjs";
|
|
5
5
|
import { isLoopbackAddress, isLoopbackHostHeader } from "./security.mjs";
|
|
6
6
|
import { statusSummary } from "./status-summary.mjs";
|
|
7
|
+
import { ACTIVITY_EVENTS_PATH } from "./activity-events.mjs";
|
|
7
8
|
|
|
8
9
|
export function isManagementRoute(method, pathname) {
|
|
9
|
-
return (method === "GET" && [ADAPTER_STATUS_PATH, ADAPTER_HEALTH_PATH].includes(pathname))
|
|
10
|
+
return (method === "GET" && [ADAPTER_STATUS_PATH, ADAPTER_HEALTH_PATH, ACTIVITY_EVENTS_PATH].includes(pathname))
|
|
10
11
|
|| pathname === ADAPTER_PREDICTION_FIX_PATH || pathname === ADAPTER_CACHE_PATH;
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
// Management retains its own access checks; it receives snapshots and explicit
|
|
14
15
|
// actions, never an inference client or a second integration lifecycle.
|
|
15
|
-
export function createManagementHandler({ statusSnapshot, nativePredictionPac, fixPrediction, requestBodyTimeoutMs } = {}) {
|
|
16
|
+
export function createManagementHandler({ statusSnapshot, activityEvents, nativePredictionPac, fixPrediction, requestBodyTimeoutMs } = {}) {
|
|
16
17
|
const options = { nativePredictionPac, fixPrediction };
|
|
17
18
|
return async (req, res, pathname) => {
|
|
19
|
+
if (req.method === "GET" && pathname === ACTIVITY_EVENTS_PATH) {
|
|
20
|
+
const origin = req.headers?.origin;
|
|
21
|
+
if (!isLoopbackAddress(req.socket?.remoteAddress) || !isLoopbackHostHeader(req.headers?.host)
|
|
22
|
+
|| origin !== undefined && origin !== `http://${req.headers.host}`
|
|
23
|
+
|| req.headers["sec-fetch-site"] === "cross-site") {
|
|
24
|
+
res.writeHead(403);res.end();return;
|
|
25
|
+
}
|
|
26
|
+
activityEvents.serve(req, res);return;
|
|
27
|
+
}
|
|
18
28
|
if (req.method === "GET" && pathname === ADAPTER_STATUS_PATH) {
|
|
19
29
|
if (!isLoopbackAddress(req.socket?.remoteAddress) || !isLoopbackHostHeader(req.headers?.host)) {
|
|
20
30
|
res.writeHead(403, { "Content-Type": "application/json" });
|
package/src/observability.mjs
CHANGED
|
@@ -7,6 +7,7 @@ import { decodedBodyLimitPreference } from "./user-settings.mjs";
|
|
|
7
7
|
import { profileRouting } from "./profile-routing.mjs";
|
|
8
8
|
import { usageLoggingStats, runtimeUsageSnapshot } from "./usage-store.mjs";
|
|
9
9
|
import { debugLoggingStats } from "./log.mjs";
|
|
10
|
+
import { createChangeSignal } from "./activity-events.mjs";
|
|
10
11
|
|
|
11
12
|
export { ADAPTER_STATUS_PATH };
|
|
12
13
|
export { isLoopbackAddress, isLoopbackHostHeader } from "./security.mjs";
|
|
@@ -58,6 +59,7 @@ function counterSnapshot(counter) {
|
|
|
58
59
|
}
|
|
59
60
|
|
|
60
61
|
export function createRequestMetrics({ now = Date.now } = {}) {
|
|
62
|
+
const changes = createChangeSignal();
|
|
61
63
|
const total = emptyCounter();
|
|
62
64
|
const routes = Object.fromEntries(ROUTE_NAMES.map((name) => [name, emptyCounter()]));
|
|
63
65
|
|
|
@@ -68,6 +70,7 @@ export function createRequestMetrics({ now = Date.now } = {}) {
|
|
|
68
70
|
total.active += 1;
|
|
69
71
|
route.total += 1;
|
|
70
72
|
route.active += 1;
|
|
73
|
+
changes.changed();
|
|
71
74
|
let completed = false;
|
|
72
75
|
|
|
73
76
|
return ({ statusCode = 0, aborted = false } = {}) => {
|
|
@@ -84,11 +87,13 @@ export function createRequestMetrics({ now = Date.now } = {}) {
|
|
|
84
87
|
const bucket = statusBucket(statusCode);
|
|
85
88
|
if (bucket) counter[bucket] += 1;
|
|
86
89
|
}
|
|
90
|
+
changes.changed();
|
|
87
91
|
};
|
|
88
92
|
};
|
|
89
93
|
|
|
90
94
|
return {
|
|
91
95
|
begin,
|
|
96
|
+
subscribe: changes.subscribe,
|
|
92
97
|
snapshot() {
|
|
93
98
|
return {
|
|
94
99
|
...counterSnapshot(total),
|
package/src/optional-routes.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const DASHBOARD_PATHS = new Set(["/", "/ui.css", "/theme.js", "/language.js", "/refresh.js", "/time.js", "/animation.js", "/status.js", "/view-boundary.js", "/activity.js", "/flow.js", "/usage.js", "/context.js", "/ui.js", "/console.js", "/updates.js", "/preferences.js", "/icons.js", "/disclosure.js", "/tools.js", "/connections.js"]);
|
|
1
|
+
export const DASHBOARD_PATHS = new Set(["/", "/ui.css", "/theme.js", "/language.js", "/refresh.js", "/live.js", "/time.js", "/animation.js", "/status.js", "/view-boundary.js", "/activity.js", "/flow.js", "/usage.js", "/context.js", "/ui.js", "/console.js", "/updates.js", "/preferences.js", "/icons.js", "/disclosure.js", "/tools.js", "/connections.js"]);
|
|
2
2
|
export const DASHBOARD_API_PATHS = new Set(["/_ccdx/ui/animation", "/_ccdx/ui/models/live", "/_ccdx/ui/usage", "/_ccdx/ui/auth", "/_ccdx/ui/providers", "/_ccdx/ui/settings", "/_ccdx/ui/m365/accounts", "/_ccdx/ui/updates", "/_ccdx/ui/account", "/_ccdx/ui/checks", "/_ccdx/ui/connections", "/_ccdx/ui/context"]);
|
|
3
3
|
|
|
4
4
|
export function isOptionalRoute(method, pathname) {
|
package/src/shutdown.mjs
CHANGED
package/src/status-summary.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// An explicit projection, never a partial replacement for the full diagnostic
|
|
2
2
|
// snapshot. Old callers keep the complete status contract by default.
|
|
3
3
|
export function statusSummary(snapshot) {
|
|
4
|
-
return Object.fromEntries([...['ok', 'name', 'version', 'pid', 'uptime_ms', 'model_activity', 'runtime_usage']
|
|
4
|
+
return Object.fromEntries([...['ok', 'name', 'version', 'pid', 'instance_id', 'uptime_ms', 'model_activity', 'runtime_usage']
|
|
5
5
|
.map(key => [key, snapshot[key]]), ['scope', 'summary']]);
|
|
6
6
|
}
|
|
@@ -3,6 +3,7 @@ import { currentRequestContext } from "./request-context.mjs";
|
|
|
3
3
|
import { isProviderId } from "./provider-metadata.mjs";
|
|
4
4
|
import { applicationLabel } from "./request-application.mjs";
|
|
5
5
|
import { createContextMetrics } from "./context-metrics.mjs";
|
|
6
|
+
import { createChangeSignal } from "./activity-events.mjs";
|
|
6
7
|
|
|
7
8
|
const PERFORMANCE_ROUTES = Object.freeze(["responses", "responses_compact"]);
|
|
8
9
|
const PREPARATION_STAGES = Object.freeze(["admission", "body", "history", "images", "serialization"]);
|
|
@@ -214,6 +215,7 @@ function routeSnapshot(route) {
|
|
|
214
215
|
}
|
|
215
216
|
|
|
216
217
|
export function createStreamPerformanceMetrics({ now = () => performance.now(), wallNow = () => new Date().toISOString(), routeNames = PERFORMANCE_ROUTES } = {}) {
|
|
218
|
+
const changes = createChangeSignal();
|
|
217
219
|
const routes = Object.fromEntries(routeNames.map((name) => [name, createRoutePerformance()]));
|
|
218
220
|
const recentRequests = [];
|
|
219
221
|
const contexts = createContextMetrics();
|
|
@@ -221,6 +223,7 @@ export function createStreamPerformanceMetrics({ now = () => performance.now(),
|
|
|
221
223
|
let activeTotal = 0, activeSequence = 0;
|
|
222
224
|
|
|
223
225
|
return {
|
|
226
|
+
subscribe: changes.subscribe,
|
|
224
227
|
begin(routeName, { requestId, application } = {}) {
|
|
225
228
|
const route = routes[routeName];
|
|
226
229
|
if (!route) return null;
|
|
@@ -262,6 +265,7 @@ export function createStreamPerformanceMetrics({ now = () => performance.now(),
|
|
|
262
265
|
upstream_attempts: attempts, terminal_outcome: terminalOutcome,
|
|
263
266
|
attempts: attemptTimings.map(attempt => ({ ...attempt })),
|
|
264
267
|
}));
|
|
268
|
+
changes.changed();
|
|
265
269
|
const assignProvider = value => {
|
|
266
270
|
if (finished || sourceStats || !isProviderId(value)) return;
|
|
267
271
|
provider = value;
|
|
@@ -269,6 +273,7 @@ export function createStreamPerformanceMetrics({ now = () => performance.now(),
|
|
|
269
273
|
if (!route.providers.has(label)) route.providers.set(label, { requests: 0, active: 0, finished: 0, totals: emptyOutcomes(), models: new Map(),
|
|
270
274
|
ttft: createHistogram(TTFT_EDGES_MS), preparation: Object.fromEntries(PREPARATION_STAGES.map(stage => [stage, createHistogram(PREPARATION_EDGES_MS)])) });
|
|
271
275
|
sourceStats = route.providers.get(label);sourceStats.requests++;sourceStats.active++;
|
|
276
|
+
changes.changed();
|
|
272
277
|
};
|
|
273
278
|
|
|
274
279
|
return {
|
|
@@ -294,6 +299,7 @@ export function createStreamPerformanceMetrics({ now = () => performance.now(),
|
|
|
294
299
|
attemptTimings.push({ attempt: attempts, started_ms: elapsed(time), headers_ms: null, http_status: null });
|
|
295
300
|
firstAttemptAt ??= time;
|
|
296
301
|
phase = "upstream_connection";
|
|
302
|
+
changes.changed();
|
|
297
303
|
if (streaming && upstreamStartedAt === null) upstreamStartedAt = time;
|
|
298
304
|
},
|
|
299
305
|
upstreamHeaders(statusCode) {
|
|
@@ -301,6 +307,7 @@ export function createStreamPerformanceMetrics({ now = () => performance.now(),
|
|
|
301
307
|
headersAt = now();
|
|
302
308
|
lastActivityAt = headersAt;
|
|
303
309
|
phase = "upstream_response";
|
|
310
|
+
changes.changed();
|
|
304
311
|
const attempt = attemptTimings.at(-1);
|
|
305
312
|
if (attempt) {
|
|
306
313
|
attempt.headers_ms = elapsed(headersAt);
|
|
@@ -310,12 +317,13 @@ export function createStreamPerformanceMetrics({ now = () => performance.now(),
|
|
|
310
317
|
upstreamActivity() {
|
|
311
318
|
if (finished) return;
|
|
312
319
|
lastActivityAt = now();
|
|
313
|
-
phase = "upstream_stream";
|
|
320
|
+
if (phase !== "upstream_stream") { phase = "upstream_stream";changes.changed(); }
|
|
314
321
|
},
|
|
315
322
|
firstOutput(source = "delta") {
|
|
316
323
|
if (firstOutputAt === null) {
|
|
317
324
|
firstOutputAt = now();
|
|
318
325
|
firstOutputSource = Object.hasOwn(route.outputSources, source) ? source : "delta";
|
|
326
|
+
changes.changed();
|
|
319
327
|
}
|
|
320
328
|
},
|
|
321
329
|
setOutputTokens(value) {
|
|
@@ -324,7 +332,8 @@ export function createStreamPerformanceMetrics({ now = () => performance.now(),
|
|
|
324
332
|
if (Number.isFinite(tokens) && tokens >= 0) outputTokens = tokens;
|
|
325
333
|
},
|
|
326
334
|
setModel(value, { configured = false } = {}) {
|
|
327
|
-
|
|
335
|
+
const next = modelLabel(value, configured);
|
|
336
|
+
if (next !== model) { model = next;changes.changed(); }
|
|
328
337
|
},
|
|
329
338
|
setProvider: assignProvider,
|
|
330
339
|
observeSession(key) { if (!finished && typeof key === "string" && /^[a-f0-9]{64}$/.test(key)) session = key; },
|
|
@@ -362,6 +371,7 @@ export function createStreamPerformanceMetrics({ now = () => performance.now(),
|
|
|
362
371
|
if (!sourceStats) assignProvider("unknown");
|
|
363
372
|
finished = true;
|
|
364
373
|
activeTotal--;activeRequests.delete(activeId);
|
|
374
|
+
changes.changed();
|
|
365
375
|
failed ||= finishFailed;
|
|
366
376
|
const outcome = terminalOutcome || (aborted ? "cancelled" : "unknown");
|
|
367
377
|
const emptyStreamCompletion = outcome === "completed" && upstreamStartedAt !== null
|
|
@@ -436,6 +446,19 @@ export function createStreamPerformanceMetrics({ now = () => performance.now(),
|
|
|
436
446
|
};
|
|
437
447
|
},
|
|
438
448
|
contextSnapshot: () => contexts.snapshot(),
|
|
449
|
+
activitySnapshot() {
|
|
450
|
+
return {
|
|
451
|
+
by_route: Object.fromEntries(routeNames.map(name => [name, {
|
|
452
|
+
terminal_outcomes: { totals: { ...routes[name].terminalTotals } },
|
|
453
|
+
by_provider: Object.fromEntries([...routes[name].providers].map(([id, value]) => [id, {
|
|
454
|
+
active: value.active, terminal_outcomes: { totals: { ...value.totals } },
|
|
455
|
+
}])),
|
|
456
|
+
}])),
|
|
457
|
+
active_requests: [...activeRequests.values()].map(read => read()), active_total: activeTotal,
|
|
458
|
+
active_omitted: Math.max(0, activeTotal - activeRequests.size),
|
|
459
|
+
recent_requests: recentRequests.map(entry => ({ ...entry, context: { ...entry.context }, timings_ms: { ...entry.timings_ms } })),
|
|
460
|
+
};
|
|
461
|
+
},
|
|
439
462
|
snapshot() {
|
|
440
463
|
return {
|
|
441
464
|
by_route: Object.fromEntries(routeNames.map((name) => [name, routeSnapshot(routes[name])])),
|
package/src/terminal-console.mjs
CHANGED
|
@@ -12,13 +12,15 @@ const flagOff = value => /^(0|false|no|off)$/i.test(String(value || ""));
|
|
|
12
12
|
|
|
13
13
|
// A bounded status region, independent of file logging and inference delivery.
|
|
14
14
|
export function createTerminalConsole({ output = process.stdout, errorOutput = process.stderr, env = process.env,
|
|
15
|
-
snapshot = () => ({}), preferences = () => ({}), baseUrl = "", verbose = false,
|
|
15
|
+
snapshot = () => ({}), subscribe, preferences = () => ({}), baseUrl = "", verbose = false,
|
|
16
16
|
timers = { setTimeout, clearTimeout }, now = Date.now } = {}) {
|
|
17
17
|
let running = false, timer = null, lines = 0, frame = 0, lastRead = 0, data = {}, projection = projectTerminalState();
|
|
18
18
|
let notices = 0, lastNotice = "", lastPrintedNotice = "", previous = [];
|
|
19
19
|
let content = [], dirty = true, readFailed = false, updatedAt = null, fits = true;
|
|
20
20
|
let current = { theme: DEFAULT_TERMINAL_ANIMATION_THEME, color_theme: "green", terminal_animation_enabled: true };
|
|
21
21
|
let frameDelay = 1000;
|
|
22
|
+
let unsubscribe = null, live = null;
|
|
23
|
+
const mergeActivity = value => live ? { ...value, ...live, providers: { ...value.providers, ...live.providers } } : value;
|
|
22
24
|
const tty = output.isTTY === true && errorOutput.isTTY === true && (!env.CI || flagOff(env.CI)) && env.TERM !== "dumb";
|
|
23
25
|
const supported = () => tty && (Number(output.columns) || 80) >= 40 && (Number(output.rows) || 24) >= 16;
|
|
24
26
|
const resized = () => { if (lines) output.write("\n");lines = 0;previous = [];frame = 0;dirty = true; };
|
|
@@ -103,7 +105,7 @@ export function createTerminalConsole({ output = process.stdout, errorOutput = p
|
|
|
103
105
|
? colorTerminalText(line, current.color_theme, { output, env }) : line), `${motion} ${active === null ? "Status unknown" : active ? "Active" : "Idle"}`];
|
|
104
106
|
fits = body.length < (Number(output.rows) || 24);
|
|
105
107
|
if (!fits) { frameDelay = 1000;return; }
|
|
106
|
-
// Animation ticks
|
|
108
|
+
// Animation ticks do not read status; activity notifications update state.
|
|
107
109
|
let update = "";
|
|
108
110
|
if (lines && lines !== body.length) {
|
|
109
111
|
update = `${lines > 1 ? `\x1b[${lines - 1}A` : ""}\r\x1b[J`;lines = 0;previous = [];
|
|
@@ -119,10 +121,10 @@ export function createTerminalConsole({ output = process.stdout, errorOutput = p
|
|
|
119
121
|
}
|
|
120
122
|
function tick() {
|
|
121
123
|
if (!running) return;
|
|
122
|
-
if (now() - lastRead >= 1000 || !lastRead) {
|
|
124
|
+
if (now() - lastRead >= (subscribe ? 10000 : 1000) || !lastRead) {
|
|
123
125
|
try {
|
|
124
126
|
const next = snapshot(), nextPreferences = preferences();
|
|
125
|
-
data = next;projection = projectTerminalState(data);current = { ...current, ...nextPreferences };readFailed = false;updatedAt = now();
|
|
127
|
+
data = mergeActivity(next);projection = projectTerminalState(data);current = { ...current, ...nextPreferences };readFailed = false;updatedAt = now();
|
|
126
128
|
if (!isTerminalAnimationTheme(current.theme)) current.theme = DEFAULT_TERMINAL_ANIMATION_THEME;
|
|
127
129
|
} catch { readFailed = true; }
|
|
128
130
|
lastRead = now();
|
|
@@ -133,8 +135,15 @@ export function createTerminalConsole({ output = process.stdout, errorOutput = p
|
|
|
133
135
|
}
|
|
134
136
|
return {
|
|
135
137
|
get enabled() { return supported() && fits && !verbose; },
|
|
136
|
-
start() {
|
|
137
|
-
|
|
138
|
+
start() {
|
|
139
|
+
if (running) return;running = true;live = null;lastRead = 0;tick();
|
|
140
|
+
unsubscribe = subscribe?.(value => {
|
|
141
|
+
if (!running) return;
|
|
142
|
+
live = value;data = mergeActivity(data);projection = projectTerminalState(data);readFailed = false;updatedAt = now();dirty = true;
|
|
143
|
+
if (timer) timers.clearTimeout(timer);tick();
|
|
144
|
+
});
|
|
145
|
+
},
|
|
146
|
+
pause() { running = false;unsubscribe?.();unsubscribe = null;if (timer) timers.clearTimeout(timer);timer = null;if (lines) output.write("\n");lines = 0;previous = [];dirty = true; },
|
|
138
147
|
beginRequest() { dirty = true;return () => { dirty = true; }; },
|
|
139
148
|
log(method, args) {
|
|
140
149
|
const message = redactDiagnosticText(format(...args));
|
|
@@ -146,6 +155,6 @@ export function createTerminalConsole({ output = process.stdout, errorOutput = p
|
|
|
146
155
|
snapshot() { return { notices, last_notice: lastNotice || null, mode: verbose ? "verbose" : supported() && fits ? "status" : "plain",
|
|
147
156
|
data_state: readFailed ? updatedAt === null ? "unavailable" : "stale" : updatedAt === null ? "unknown" : "current", updated_at: updatedAt === null ? null : new Date(updatedAt).toISOString() }; },
|
|
148
157
|
apply(value) { if (value.theme && value.theme !== current.theme) frame = 0;current = { ...current, ...value };lastRead = 0; },
|
|
149
|
-
cleanup() { running = false;if (timer) timers.clearTimeout(timer);timer = null;if (lines) output.write("\n");lines = 0;output.off?.("resize", resized); },
|
|
158
|
+
cleanup() { running = false;unsubscribe?.();unsubscribe = null;if (timer) timers.clearTimeout(timer);timer = null;if (lines) output.write("\n");lines = 0;output.off?.("resize", resized); },
|
|
150
159
|
};
|
|
151
160
|
}
|