codex-copilot-dx 1.2.7 → 1.2.9
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 +3 -3
- package/docs/ARCHITECTURE.md +15 -1
- package/docs/README.md +1 -0
- package/docs/REFERENCE.md +20 -15
- package/package.json +1 -1
- package/src/claude-gateway.mjs +2 -2
- package/src/dashboard/activity.js +27 -0
- package/src/dashboard/console.js +18 -7
- package/src/dashboard/index.html +80 -56
- package/src/dashboard/language.js +44 -3
- package/src/dashboard/status.js +49 -17
- package/src/dashboard/theme.js +3 -2
- package/src/dashboard/ui.css +78 -5
- package/src/dashboard/ui.js +16 -5
- package/src/dashboard.mjs +1 -0
- package/src/observability.mjs +7 -1
- package/src/optional-routes.mjs +1 -1
- package/src/stream-performance.mjs +7 -0
- package/src/terminal-colors.mjs +8 -3
- package/src/terminal-console.mjs +5 -3
- package/src/user-settings.mjs +2 -2
package/src/dashboard/ui.css
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
* { box-sizing: border-box; }
|
|
4
4
|
[hidden] { display: none !important; }
|
|
5
5
|
body { margin: 0; color: var(--text); background: var(--page); font-size: 13px; }
|
|
6
|
+
html { scrollbar-gutter: stable; }
|
|
7
|
+
@supports not (scrollbar-gutter: stable) { html { overflow-y: scroll; } }
|
|
6
8
|
.shell { max-width: 1220px; margin: 0 auto; padding: 0 24px; }
|
|
7
9
|
.topbar { min-height: 68px; display: flex; justify-content: space-between; align-items: center; gap: 20px; border-bottom: 1px solid var(--top-border); }
|
|
8
10
|
.brand { color: var(--accent); font-size: 16px; font-weight: 750; letter-spacing: .07em; white-space: nowrap; }
|
|
@@ -158,7 +160,7 @@ footer { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; color:
|
|
|
158
160
|
|
|
159
161
|
/* Each view has one scope. The sidebar stays separate from business data. */
|
|
160
162
|
[hidden] { display: none !important; }
|
|
161
|
-
.shell { max-width: 1520px; display: grid; grid-template-columns: 204px minmax(0, 1fr); column-gap: 34px; padding: 0 28px; }
|
|
163
|
+
.shell { max-width: 1520px; min-height: 100vh; display: grid; grid-template-columns: 204px minmax(0, 1fr); grid-template-rows: 76px minmax(0, 1fr) auto; column-gap: 34px; padding: 0 28px; }
|
|
162
164
|
.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); }
|
|
163
165
|
.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; }
|
|
164
166
|
.sidebar-brand .brand-caption { display: block; color: var(--muted); font-size: 10px; font-weight: 500; letter-spacing: .1em; margin-top: 8px; }
|
|
@@ -169,10 +171,28 @@ footer { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; color:
|
|
|
169
171
|
.sidebar nav a:focus-visible, .sidebar-brand:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
|
|
170
172
|
.nav-group { color: var(--subtle); font-size: 10px; padding: 18px 12px 4px; text-transform: uppercase; letter-spacing: .08em; }
|
|
171
173
|
.topbar, main, footer { grid-column: 2; min-width: 0; }
|
|
172
|
-
.topbar { min-height: 76px; gap: 14px; }
|
|
174
|
+
.topbar { height: 76px; min-height: 76px; gap: 14px; position: sticky; top: 0; z-index: 5; background: var(--page); }
|
|
173
175
|
.brand { font-size: 12px; }
|
|
174
|
-
.topbar-actions { gap: 12px; }
|
|
175
|
-
.
|
|
176
|
+
.topbar-actions { gap: 12px; flex-wrap: nowrap; }
|
|
177
|
+
.topbar-actions #connection { width: 154px; flex: none; }
|
|
178
|
+
.topbar-actions #auto-refresh { width: 164px; flex: none; }
|
|
179
|
+
.intro { display: block; padding: 32px 0 26px; min-height: 132px; }
|
|
180
|
+
.intro .page-description { margin-top: 14px; line-height: 1.7; }
|
|
181
|
+
main { align-self: start; }
|
|
182
|
+
.section-link { display: inline-block; color: var(--accent); font-size: 12px; text-underline-offset: 3px; }
|
|
183
|
+
.section-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
|
|
184
|
+
.model-summary strong { color: var(--strong); }
|
|
185
|
+
.panel h3 { color: var(--heading); font-size: 12px; font-weight: 650; margin: 0; }
|
|
186
|
+
.setting-row + .tool-details { border-top: 0; padding-top: 0; }
|
|
187
|
+
.diagnostic-section + .diagnostic-section { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--border); }
|
|
188
|
+
.diagnostic-section > strong { display: block; color: var(--strong); font-size: 23px; margin-top: 16px; }
|
|
189
|
+
.usage-source-controls { margin: 0 0 20px; }
|
|
190
|
+
.chart-heading { flex-wrap: wrap; align-items: end; }
|
|
191
|
+
.chart-heading .analytics-controls { margin: 0; }
|
|
192
|
+
.chart-heading label { display: grid; gap: 6px; color: var(--muted); }
|
|
193
|
+
.request-details { min-width: 190px; max-width: 340px; white-space: normal; }
|
|
194
|
+
.request-details .failure-detail { grid-template-columns: minmax(95px, auto) minmax(0, 1fr); margin-bottom: 0; }
|
|
195
|
+
.request-details .failure-detail dd { overflow-wrap: anywhere; }
|
|
176
196
|
.snapshot-meta { justify-content: flex-start; margin-top: 14px; line-height: 1.7; }
|
|
177
197
|
.overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
|
178
198
|
.client-overview { grid-template-columns: 1fr; }
|
|
@@ -193,7 +213,8 @@ input[role="switch"]:checked::before { left: 19px; background: var(--accent); }
|
|
|
193
213
|
input[role="switch"]:focus-visible, input[type="number"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
|
|
194
214
|
input[role="switch"]:disabled { opacity: .5; cursor: wait; }
|
|
195
215
|
#process-queues { overflow-wrap: anywhere; font-size: 11px; }
|
|
196
|
-
@media (max-width:
|
|
216
|
+
@media (max-width: 1100px) { .topbar .brand { display: none; } .topbar { justify-content: flex-end; } }
|
|
217
|
+
@media (max-width: 900px) { .shell { grid-template-columns: 170px minmax(0, 1fr); column-gap: 20px; padding: 0 20px; } .setting-row { grid-template-columns: minmax(0, 1fr) 44px; } .setting-row .hint { grid-column: 1 / -1; } .overview { grid-template-columns: 1fr; } .shell { grid-template-rows: 96px minmax(0, 1fr) auto; } .topbar { height: 96px; } .topbar-actions { display: grid; grid-template-columns: 32px 32px minmax(0, 1fr) auto; gap: 8px 9px; width: 100%; } .topbar-actions #connection { grid-column: 1 / -1; width: auto; } .topbar-actions #auto-refresh { width: auto; min-width: 0; padding-inline: 8px; } }
|
|
197
218
|
@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 { 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; } }
|
|
198
219
|
|
|
199
220
|
/* Keep forms aligned with the existing dashboard controls. */
|
|
@@ -205,6 +226,8 @@ input[role="switch"]:disabled { opacity: .5; cursor: wait; }
|
|
|
205
226
|
.analytics-controls select { box-sizing: border-box; height: 36px; min-height: 36px; line-height: normal; }
|
|
206
227
|
.section-actions button { padding-top: 0; padding-bottom: 0; }
|
|
207
228
|
@media (max-width: 640px) {
|
|
229
|
+
.topbar { height: 96px; padding: 8px 0; }
|
|
230
|
+
.topbar-actions { justify-content: initial; }
|
|
208
231
|
.section-actions > label { flex: 1 1 180px; }
|
|
209
232
|
.section-actions select { max-width: 100%; }
|
|
210
233
|
}
|
|
@@ -283,6 +306,56 @@ input[role="switch"]:disabled { opacity: .5; cursor: wait; }
|
|
|
283
306
|
:root:not([data-theme="light"]) #animation-settings { --ansi-white:#f5fff5;--ansi-159:#9af5e9;--ansi-123:#75e4d9;--ansi-87:#5ad0d4;--ansi-51:#42b9d8;--ansi-45:#3ca2d0;--ansi-39:#4389c2;--ansi-33:#4775b2; }
|
|
284
307
|
:root:not([data-theme="light"]) #animation-settings[data-terminal-palette="klein"] { --ansi-white:#789aff;--ansi-159:#789aff;--ansi-123:#789aff;--ansi-87:#789aff;--ansi-51:#789aff;--ansi-45:#789aff;--ansi-39:#789aff;--ansi-33:#789aff; }
|
|
285
308
|
|
|
309
|
+
:root[data-palette="pink"][data-theme="light"] {
|
|
310
|
+
--page:#fff7fa; --surface:#fff; --text:#432e39; --strong:#35202d;
|
|
311
|
+
--muted:#765365; --badge:#765365; --subtle:#765365; --quiet:#805d70; --footer:#805d70;
|
|
312
|
+
--border:#e8ccd8; --top-border:#dfbdcd; --accent:#a83e68; --accent-soft:#a83e68; --heading:#a83e68;
|
|
313
|
+
--button-border:#c38ba4; --button-bg:#fff0f6; --button-fg:#a83e68; --button-hover:#f8dce9;
|
|
314
|
+
--selected-bg:#fae5ef; --option-hover:#fff0f6; --table-text:#432e39; --preview:#805d70;
|
|
315
|
+
--ansi-white:#a83e68; --ansi-159:#aa4a72; --ansi-123:#b3527c; --ansi-87:#ab4671;
|
|
316
|
+
--ansi-51:#a13f69; --ansi-45:#963c66; --ansi-39:#8e3c65; --ansi-33:#843b62;
|
|
317
|
+
--bad:#a33625; --failed:#a33625; --incomplete:#835600;
|
|
318
|
+
}
|
|
319
|
+
:root[data-palette="pink"]:not([data-theme="light"]) {
|
|
320
|
+
--page:#160f16; --surface:#211720; --text:#f2e2eb; --strong:#fff0f6;
|
|
321
|
+
--muted:#c4a7b8; --badge:#d4b8c9; --subtle:#c4a7b8; --quiet:#b598aa; --footer:#b598aa;
|
|
322
|
+
--border:#513342; --top-border:#513342; --accent:#f3a8c8; --accent-soft:#f3a8c8; --heading:#f3a8c8;
|
|
323
|
+
--button-border:#9f6885; --button-bg:#31202d; --button-fg:#f3a8c8; --button-hover:#482b3e;
|
|
324
|
+
--selected-bg:#3b2333; --option-hover:#31202d; --table-text:#f2e2eb; --preview:#c4a7b8;
|
|
325
|
+
--ansi-white:#ffe7f3; --ansi-159:#f7c4da; --ansi-123:#f3b6d1; --ansi-87:#efa8c8;
|
|
326
|
+
--ansi-51:#e99bbd; --ansi-45:#da8bb0; --ansi-39:#cd7fa5; --ansi-33:#bd739a;
|
|
327
|
+
--bad:#ff947e; --failed:#ff9f91; --incomplete:#e3c77c;
|
|
328
|
+
}
|
|
329
|
+
.terminal-sample[data-terminal-palette="pink"] { --sample-logo:#f3a8c8; --sample-table:#f3a8c8; --sample-motion:#f3a8c8; }
|
|
330
|
+
:root:not([data-theme="light"]) #animation-settings[data-terminal-palette="pink"] { --ansi-white:#f3a8c8;--ansi-159:#f3a8c8;--ansi-123:#f3a8c8;--ansi-87:#f3a8c8;--ansi-51:#f3a8c8;--ansi-45:#f3a8c8;--ansi-39:#f3a8c8;--ansi-33:#f3a8c8; }
|
|
331
|
+
:root[data-theme="light"] #animation-settings[data-terminal-palette="pink"] { --ansi-white:#a83e68;--ansi-159:#a83e68;--ansi-123:#a83e68;--ansi-87:#a83e68;--ansi-51:#a83e68;--ansi-45:#a83e68;--ansi-39:#a83e68;--ansi-33:#a83e68; }
|
|
332
|
+
|
|
333
|
+
.model-activity { display:flex;align-items:center;height:30px;margin-top:-26px;padding-left:3px;color:var(--muted);font-size:11px; }
|
|
334
|
+
.activity-lamp,.activity-dots i { position:relative;display:block;flex:none;width:4px;height:4px;border-radius:50%;background:color-mix(in srgb,var(--accent) 72%,var(--surface)); }
|
|
335
|
+
.activity-dots { display:flex;align-items:center;gap:6px;width:0;height:22px;opacity:0;transition:width 320ms ease,padding 320ms ease,opacity 220ms ease; }
|
|
336
|
+
.activity-dots i { opacity:0;transform:scale(.4); }
|
|
337
|
+
.activity-label { margin-left:10px; }
|
|
338
|
+
.model-activity[data-state="active"] .activity-dots { width:50px;padding-left:6px;opacity:1; }
|
|
339
|
+
.model-activity[data-state="active"] .activity-dots i { animation:activity-second 4s ease-in-out infinite; }
|
|
340
|
+
.model-activity[data-state="active"] .activity-dots i:nth-child(2) { animation-name:activity-third; }
|
|
341
|
+
.model-activity[data-state="active"] .activity-dots i:nth-child(3) { animation-name:activity-fourth; }
|
|
342
|
+
.model-activity[data-state="active"] .activity-dots i:nth-child(4) { animation-name:activity-fifth; }
|
|
343
|
+
.model-activity[data-state="active"] .activity-dots i:nth-child(5) { animation-name:activity-sixth; }
|
|
344
|
+
.model-activity[data-state="idle"] .activity-lamp::before { content:"";position:absolute;left:50%;top:50%;width:20px;height:20px;border-radius:50%;background:radial-gradient(circle,color-mix(in srgb,var(--accent) 24%,var(--surface)) 0%,transparent 68%);transform:translate(-50%,-50%);animation:activity-breathe 3.2s ease-in-out infinite; }
|
|
345
|
+
.model-activity[data-state="unknown"] .activity-lamp { background:transparent;border:1px solid var(--muted); }
|
|
346
|
+
.model-activity[data-paused="true"] .activity-dots i,.model-activity[data-paused="true"] .activity-lamp::before { animation-play-state:paused; }
|
|
347
|
+
@keyframes activity-breathe { 0%,100%{opacity:.45;transform:translate(-50%,-50%) scale(.8)}50%{opacity:.95;transform:translate(-50%,-50%) scale(1.18)} }
|
|
348
|
+
@keyframes activity-second { 0%,6%,94%,100%{opacity:0;transform:scale(.4)}12%,88%{opacity:1;transform:scale(1)} }
|
|
349
|
+
@keyframes activity-third { 0%,14%,86%,100%{opacity:0;transform:scale(.4)}20%,80%{opacity:1;transform:scale(1)} }
|
|
350
|
+
@keyframes activity-fourth { 0%,22%,78%,100%{opacity:0;transform:scale(.4)}28%,72%{opacity:1;transform:scale(1)} }
|
|
351
|
+
@keyframes activity-fifth { 0%,30%,70%,100%{opacity:0;transform:scale(.4)}36%,64%{opacity:1;transform:scale(1)} }
|
|
352
|
+
@keyframes activity-sixth { 0%,38%,62%,100%{opacity:0;transform:scale(.4)}44%,56%{opacity:1;transform:scale(1)} }
|
|
353
|
+
@media(prefers-reduced-motion:reduce) {
|
|
354
|
+
.activity-dots { transition:none; }
|
|
355
|
+
.model-activity[data-state="active"] .activity-dots i { animation:none;opacity:1;transform:none; }
|
|
356
|
+
.model-activity[data-state="idle"] .activity-lamp::before { animation:none;opacity:.6; }
|
|
357
|
+
}
|
|
358
|
+
|
|
286
359
|
:root[data-theme="light"] #animation-settings { --ansi-white:#234231;--ansi-159:#116b64;--ansi-123:#0d7771;--ansi-87:#116b75;--ansi-51:#14697e;--ansi-45:#1a6183;--ansi-39:#265f8d;--ansi-33:#365a8d; }
|
|
287
360
|
:root[data-theme="light"] #animation-settings[data-terminal-palette="klein"] { --ansi-white:#002fa7;--ansi-159:#002fa7;--ansi-123:#002fa7;--ansi-87:#002fa7;--ansi-51:#002fa7;--ansi-45:#002fa7;--ansi-39:#002fa7;--ansi-33:#002fa7; }
|
|
288
361
|
|
package/src/dashboard/ui.js
CHANGED
|
@@ -262,6 +262,7 @@ function syncUsageProviders() {
|
|
|
262
262
|
function chooseProvider(id) {
|
|
263
263
|
if (selectedProvider === id) return;
|
|
264
264
|
selectedProvider = id;
|
|
265
|
+
syncProviderDetails();
|
|
265
266
|
try { localStorage.setItem("ccdx.dashboard.modelProvider", id); } catch { /* Keep the current choice. */ }
|
|
266
267
|
for (const [key, button] of providerTabs) { button.setAttribute("aria-selected", String(key === id));button.tabIndex = key === id ? 0 : -1; }
|
|
267
268
|
dashboardRefresh.invalidate("models", { clear: true });
|
|
@@ -273,6 +274,10 @@ function chooseProvider(id) {
|
|
|
273
274
|
void loadModels();
|
|
274
275
|
}
|
|
275
276
|
|
|
277
|
+
function syncProviderDetails() {
|
|
278
|
+
for (const row of element("provider-auth").children) row.hidden = row.dataset.provider !== selectedProvider;
|
|
279
|
+
}
|
|
280
|
+
|
|
276
281
|
function applyProviders(data, { changed }) {
|
|
277
282
|
const wasInitialized = providerEntries.length > 0, previousSelection = selectedProvider;
|
|
278
283
|
const choices = entries => JSON.stringify(entries.map(source => [source.id, source.name, source.generation, source.selection]));
|
|
@@ -298,6 +303,7 @@ function applyProviders(data, { changed }) {
|
|
|
298
303
|
syncUsageProviders();
|
|
299
304
|
const available = providerEntries.some(provider => provider.id === selectedProvider);
|
|
300
305
|
if (!available) selectedProvider = providerEntries.find(provider => provider.clients?.some(client => client.id === "codex" && client.selected))?.id || providerEntries[0]?.id || "";
|
|
306
|
+
syncProviderDetails();
|
|
301
307
|
const container = element("model-providers");
|
|
302
308
|
for (const [id, button] of providerTabs) if (!providerEntries.some(provider => provider.id === id)) { button.remove();providerTabs.delete(id); }
|
|
303
309
|
for (const provider of providerEntries) {
|
|
@@ -358,7 +364,7 @@ function refreshTime(target, state) {
|
|
|
358
364
|
}
|
|
359
365
|
|
|
360
366
|
const timestamps = new Map();
|
|
361
|
-
for (const [key, ids] of [["auth", ["account-authorization"]], ["status", ["
|
|
367
|
+
for (const [key, ids] of [["auth", ["account-authorization", "client-features", "claude-connections"]], ["status", ["source-requests", "request-context", "recent-failures", "runtime-resources", "additional-capabilities", "codex-performance", "claude-performance", "runtime-diagnostics"]], ["models", ["upstream-models"]], ["usage", ["model-usage"]], ["animation", ["animation-settings"]]]) {
|
|
362
368
|
timestamps.set(key, ids.map(id => {
|
|
363
369
|
const node = document.createElement("p");
|
|
364
370
|
node.className = "refresh-time";
|
|
@@ -392,6 +398,7 @@ const dashboardRefresh = globalThis.ccdxRefresh.createController({
|
|
|
392
398
|
},
|
|
393
399
|
apply: render,
|
|
394
400
|
state: state => {
|
|
401
|
+
if (state.error || !state.value) globalThis.ccdxDashboardActivity?.unavailable();
|
|
395
402
|
text("connection", state.pending && !state.value ? "reading" : state.error ? "unavailable_eb0be" : "service_reachable");
|
|
396
403
|
element("connection").className = `badge ${state.pending ? "neutral" : state.error ? "bad" : "good"}`;
|
|
397
404
|
globalThis.ccdxIcons?.set(element("connection"), state.pending && !state.value ? "reading" : state.error ? "unavailable_eb0be" : "service_reachable",
|
|
@@ -406,9 +413,9 @@ const dashboardRefresh = globalThis.ccdxRefresh.createController({
|
|
|
406
413
|
apply: applyProviders,
|
|
407
414
|
state: state => {
|
|
408
415
|
if (state.error) {
|
|
409
|
-
if (state.value) localize(element("
|
|
410
|
-
else text("
|
|
411
|
-
}
|
|
416
|
+
if (state.value) localize(element("source-status-note"), "update_failed_last_time", { time: new Date(state.updatedAt).toLocaleTimeString() });
|
|
417
|
+
else text("source-status-note", "unavailable_eb0be");
|
|
418
|
+
} else element("source-status-note").textContent = "";
|
|
412
419
|
for (const node of timestamps.get("auth")) refreshTime(node, state);
|
|
413
420
|
},
|
|
414
421
|
},
|
|
@@ -494,7 +501,7 @@ const dashboardRefresh = globalThis.ccdxRefresh.createController({
|
|
|
494
501
|
},
|
|
495
502
|
},
|
|
496
503
|
animation: {
|
|
497
|
-
visible: () => element("animation-settings").open && !animationSaving,
|
|
504
|
+
visible: () => element("animation-settings").open && !element("animation-settings").closest("[hidden]") && !animationSaving,
|
|
498
505
|
variant: () => element("animation-settings").open && !animationFramesLoaded ? "frames" : "metadata",
|
|
499
506
|
project: data => [data.theme, data.source, data.disabled_by_environment, data.themes.map(theme => [theme.id, theme.label, theme.default, Boolean(theme.frames)])],
|
|
500
507
|
load: ({ variant, signal }) => readDashboard(`/_ccdx/ui/animation${variant === "frames" ? "" : "?frames=0"}`, { signal, timeout: 8000 }),
|
|
@@ -555,6 +562,10 @@ element("clear-usage-day").addEventListener("click", () => selectUsageDay(""));
|
|
|
555
562
|
element("usage-provider")?.addEventListener("change", () => { dashboardRefresh.invalidate("usage");dashboardRefresh.refresh("usage", { force: true }); });
|
|
556
563
|
element("refresh-models").addEventListener("click", loadModels);
|
|
557
564
|
element("refresh-usage").addEventListener("click", loadUsage);
|
|
565
|
+
for (const link of document.querySelectorAll("[data-source-link]")) link.addEventListener("click", () => {
|
|
566
|
+
const id = link.dataset.sourceLink === "codex" ? providerEntries.find(provider => provider.clients?.some(client => client.id === "codex" && client.selected))?.id : link.dataset.sourceLink;
|
|
567
|
+
if (providerEntries.some(provider => provider.id === id)) chooseProvider(id);
|
|
568
|
+
});
|
|
558
569
|
loadAnimation();
|
|
559
570
|
refresh();
|
|
560
571
|
loadAuth();
|
package/src/dashboard.mjs
CHANGED
|
@@ -10,6 +10,7 @@ const ASSETS = new Map([
|
|
|
10
10
|
["/console.js", ["./dashboard/console.js", "text/javascript; charset=utf-8"]],
|
|
11
11
|
["/updates.js", ["./dashboard/updates.js", "text/javascript; charset=utf-8"]],
|
|
12
12
|
["/status.js", ["./dashboard/status.js", "text/javascript; charset=utf-8"]],
|
|
13
|
+
["/activity.js", ["./dashboard/activity.js", "text/javascript; charset=utf-8"]],
|
|
13
14
|
["/usage.js", ["./dashboard/usage.js", "text/javascript; charset=utf-8"]],
|
|
14
15
|
["/refresh.js", ["./dashboard/refresh.js", "text/javascript; charset=utf-8"]],
|
|
15
16
|
["/icons.js", ["./dashboard/icons.js", "text/javascript; charset=utf-8"]],
|
package/src/observability.mjs
CHANGED
|
@@ -187,6 +187,11 @@ export function runtimeStatusPayload({
|
|
|
187
187
|
};
|
|
188
188
|
}
|
|
189
189
|
const history = responseHistoryStats();
|
|
190
|
+
const requests = metrics?.snapshot?.() || createRequestMetrics().snapshot();
|
|
191
|
+
const activityCounts = ["responses", "responses_compact", "messages"].map(route => requests.by_route[route].active);
|
|
192
|
+
activityCounts.push(imageGeneration?.active ?? 0);
|
|
193
|
+
const active = activityCounts.every(value => Number.isSafeInteger(value) && value >= 0)
|
|
194
|
+
&& Number.isSafeInteger(activityCounts.reduce((sum, value) => sum + value, 0)) ? activityCounts.reduce((sum, value) => sum + value, 0) : null;
|
|
190
195
|
return {
|
|
191
196
|
...adapterHealthPayload(),
|
|
192
197
|
uptime_ms: Math.round(process.uptime() * 1000),
|
|
@@ -197,7 +202,8 @@ export function runtimeStatusPayload({
|
|
|
197
202
|
external_bytes: memory.external,
|
|
198
203
|
array_buffers_bytes: memory.arrayBuffers,
|
|
199
204
|
},
|
|
200
|
-
requests
|
|
205
|
+
requests,
|
|
206
|
+
model_activity: { active },
|
|
201
207
|
stream_performance: streamPerformance?.snapshot?.() || null,
|
|
202
208
|
admission: admission?.diagnostics?.() || admission?.stats?.() || null,
|
|
203
209
|
response_history: history,
|
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", "/status.js", "/usage.js", "/ui.js", "/console.js", "/updates.js", "/icons.js", "/tools.js"]);
|
|
1
|
+
export const DASHBOARD_PATHS = new Set(["/", "/ui.css", "/theme.js", "/language.js", "/refresh.js", "/status.js", "/activity.js", "/usage.js", "/ui.js", "/console.js", "/updates.js", "/icons.js", "/tools.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"]);
|
|
3
3
|
|
|
4
4
|
export function isOptionalRoute(method, pathname) {
|
|
@@ -84,6 +84,13 @@ export function isChatOutputDelta(delta) {
|
|
|
84
84
|
|| nonEmptyString(delta.reasoning_text);
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
+
export function isMessagesOutputDelta(delta) {
|
|
88
|
+
if (!delta || typeof delta !== "object") return false;
|
|
89
|
+
return delta.type === "text_delta" && nonEmptyString(delta.text)
|
|
90
|
+
|| delta.type === "thinking_delta" && nonEmptyString(delta.thinking)
|
|
91
|
+
|| delta.type === "input_json_delta" && nonEmptyString(delta.partial_json);
|
|
92
|
+
}
|
|
93
|
+
|
|
87
94
|
function createHistogram(edges) {
|
|
88
95
|
return {
|
|
89
96
|
edges,
|
package/src/terminal-colors.mjs
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
export const isColorTheme = value => value === "green" || value === "klein";
|
|
1
|
+
export const isColorTheme = value => value === "green" || value === "klein" || value === "pink";
|
|
2
2
|
|
|
3
3
|
export function terminalColorCode(theme, { output = process.stdout, env = process.env } = {}) {
|
|
4
4
|
if (output.isTTY !== true || Object.hasOwn(env, "NO_COLOR") || env.TERM === "dumb") return "";
|
|
5
5
|
// Preserve the original green exactly. Blue also supports ordinary ANSI terminals.
|
|
6
|
-
if (theme !== "klein") return "\x1b[38;2;166;245;168m";
|
|
6
|
+
if (theme !== "klein" && theme !== "pink") return "\x1b[38;2;166;245;168m";
|
|
7
7
|
const depth = output.getColorDepth?.(env) || (/truecolor|24bit/i.test(env.COLORTERM || "") ? 24 : 4);
|
|
8
|
+
if (theme === "pink") {
|
|
9
|
+
const light = /^(7|15)$/.test(String(env.COLORFGBG || "").split(";").at(-1));
|
|
10
|
+
return depth >= 24 ? light ? "\x1b[38;2;168;62;104m" : "\x1b[38;2;243;168;200m"
|
|
11
|
+
: depth >= 8 ? light ? "\x1b[38;5;132m" : "\x1b[38;5;218m" : "\x1b[95m";
|
|
12
|
+
}
|
|
8
13
|
return depth >= 24 ? "\x1b[38;2;76;159;255m" : depth >= 8 ? "\x1b[38;5;75m" : "\x1b[94m";
|
|
9
14
|
}
|
|
10
15
|
|
|
@@ -14,7 +19,7 @@ export function colorTerminalText(text, theme, options) {
|
|
|
14
19
|
}
|
|
15
20
|
|
|
16
21
|
export function colorTerminalMotion(frame, theme, options) {
|
|
17
|
-
if (theme !== "klein") return frame;
|
|
22
|
+
if (theme !== "klein" && theme !== "pink") return frame;
|
|
18
23
|
const code = terminalColorCode(theme, options);
|
|
19
24
|
return frame.replace(/\x1b\[(?:38;5;\d+|97)m/g, code);
|
|
20
25
|
}
|
package/src/terminal-console.mjs
CHANGED
|
@@ -44,14 +44,16 @@ export function createTerminalConsole({ output = process.stdout, errorOutput = p
|
|
|
44
44
|
function table(width, usage, requests, inferenceActive, sum, compactTitle = false) {
|
|
45
45
|
const left = Math.floor((width - 3) / 2), right = width - 3 - left;
|
|
46
46
|
const cell = (label, value, size) => {
|
|
47
|
-
const number = value === undefined ? "" : updatedAt === null && readFailed ? "—" : compact(value), inner = size - 2;
|
|
47
|
+
const number = value === undefined ? "" : updatedAt === null && readFailed ? "—" : typeof value === "string" ? value : compact(value), inner = size - 2;
|
|
48
48
|
const text = clip(label, Math.max(0, inner - displayWidth(number) - (number ? 1 : 0)));
|
|
49
49
|
return ` ${text}${" ".repeat(Math.max(0, inner - displayWidth(text) - displayWidth(number)))}${number} `;
|
|
50
50
|
};
|
|
51
51
|
const row = (a, b) => `│${a}│${b}│`;
|
|
52
52
|
const rule = (a, b, c) => `${a}${"─".repeat(left)}${b}${"─".repeat(right)}${c}`;
|
|
53
|
+
const rate = usage.cache_hit_rate;
|
|
54
|
+
const cacheHit = Number.isFinite(rate) && rate >= 0 && rate <= 1 ? `${usage.cache_hit_rate_partial ? "~" : ""}${(rate * 100).toFixed(1)}%` : "—";
|
|
53
55
|
const usageRows = [[left < 23 ? "Records" : "Usage records", usage.records || 0], ["Input", usage.input_tokens], [left < 23 ? "Reused" : "Reused input", usage.cached_input_tokens],
|
|
54
|
-
["Output", usage.output_tokens], ["Partial usage", usage.partial_records || 0], ["",
|
|
56
|
+
["Output", usage.output_tokens], ["Partial usage", usage.partial_records || 0], ["Cache hit", cacheHit]];
|
|
55
57
|
const requestRows = [["Requests", requests], ["Active", inferenceActive], ["Completed", sum("completed")], ["Incomplete", sum("incomplete")], ["Failed", sum("failed")], ["Cancelled", sum("cancelled")]];
|
|
56
58
|
const title = compactTitle ? [`┌─ Usage ${"─".repeat(left - 8)}┬─ Inference ${"─".repeat(right - 12)}┐`]
|
|
57
59
|
: [rule("┌", "┬", "┐"), row(cell("Usage / this run", undefined, left), cell("Inference", undefined, right)), rule("├", "┼", "┤")];
|
|
@@ -95,7 +97,7 @@ export function createTerminalConsole({ output = process.stdout, errorOutput = p
|
|
|
95
97
|
dirty = false;
|
|
96
98
|
}
|
|
97
99
|
// Apply color after clipping/layout so escape sequences never consume columns.
|
|
98
|
-
const body = [...content.map(line => current.color_theme
|
|
100
|
+
const body = [...content.map(line => ["klein", "pink"].includes(current.color_theme) && /^[┌│├└]/.test(line)
|
|
99
101
|
? colorTerminalText(line, current.color_theme, { output, env }) : line), `${motion} ${active ? "Working" : "Idle"}`];
|
|
100
102
|
fits = body.length < (Number(output.rows) || 24);
|
|
101
103
|
if (!fits) { frameDelay = 1000;return; }
|
package/src/user-settings.mjs
CHANGED
|
@@ -52,7 +52,7 @@ export function readUserSettings({ env = process.env, home = os.homedir(), stric
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
if (Object.hasOwn(parsed, "terminal_color_theme") && !isColorTheme(parsed.terminal_color_theme)) {
|
|
55
|
-
if (strict) throw invalidSettings(filePath, "terminal_color_theme must be green or
|
|
55
|
+
if (strict) throw invalidSettings(filePath, "terminal_color_theme must be green, klein or pink");
|
|
56
56
|
delete parsed.terminal_color_theme;
|
|
57
57
|
}
|
|
58
58
|
if (Object.hasOwn(parsed, AUTO_REVIEW_MODEL_KEY)) {
|
|
@@ -137,7 +137,7 @@ export function terminalColorPreference(options = {}) {
|
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
export function writeTerminalColorTheme(theme, options = {}) {
|
|
140
|
-
if (!isColorTheme(theme)) throw new Error("Choose green or
|
|
140
|
+
if (!isColorTheme(theme)) throw new Error("Choose green, klein or pink for the terminal color theme");
|
|
141
141
|
return withFileLockSync(`${userSettingsPath(options)}.lock`, () => {
|
|
142
142
|
const settings = readUserSettings({ ...options, strict: true });
|
|
143
143
|
const next = { ...settings };
|