codex-copilot-dx 1.2.33 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +65 -110
- package/bin/cli.mjs +38 -102
- package/docs/ARCHITECTURE.md +33 -7
- package/docs/README.md +10 -76
- package/docs/REFERENCE.md +147 -1936
- package/package.json +11 -4
- package/src/access-settings.mjs +2 -2
- package/src/adapter.mjs +6 -1
- package/src/auth-credentials.mjs +1 -1
- package/src/auto-review-model.mjs +2 -2
- package/src/claude-gateway.mjs +4 -1
- package/src/cli-animation.mjs +2 -2
- package/src/cli-auth.mjs +3 -3
- package/src/cli-cache.mjs +2 -2
- package/src/cli-command-spec.mjs +260 -58
- package/src/cli-image.mjs +2 -2
- package/src/cli-limits.mjs +2 -2
- package/src/cli-m365.mjs +1 -1
- package/src/cli-management.mjs +7 -3
- package/src/cli-options.mjs +71 -408
- package/src/connection-runtime.mjs +1408 -377
- package/src/context-metrics.mjs +63 -0
- package/src/copilot-token-session.mjs +1 -1
- package/src/dashboard/connections.js +23 -4
- package/src/dashboard/console.js +1 -0
- package/src/dashboard/context.js +124 -0
- package/src/dashboard/flow.js +1 -1
- package/src/dashboard/icons.js +6 -2
- package/src/dashboard/index.html +12 -0
- package/src/dashboard/language.js +23 -0
- package/src/dashboard/ui.css +36 -3
- package/src/dashboard/ui.js +12 -4
- package/src/dashboard-api.mjs +11 -5
- package/src/dashboard.mjs +1 -0
- package/src/doctor.mjs +4 -4
- package/src/image-mcp.mjs +2 -2
- package/src/native-prediction-fix.mjs +1 -1
- package/src/native-prediction-profile.mjs +1 -1
- package/src/native-prediction-windows.mjs +1 -1
- package/src/native-prediction.mjs +6 -6
- package/src/nightly-update.mjs +2 -2
- package/src/optional-routes.mjs +2 -2
- package/src/provider-runtime.mjs +1 -1
- package/src/providers/m365-accounts.mjs +1 -1
- package/src/release-install.mjs +11 -15
- package/src/responses-handler.mjs +3 -0
- package/src/startup-ui.mjs +15 -11
- package/src/stream-performance.mjs +9 -0
- package/src/terminal-console.mjs +5 -4
- package/src/terminal-state.mjs +1 -1
- package/src/usage-store.mjs +2 -1
- package/src/usage.mjs +5 -5
- package/src/windows-command.mjs +2 -2
- package/bin/codex-copilot-dx.mjs +0 -11
- package/src/cli-models.mjs +0 -94
- package/src/legacy-command-warning.mjs +0 -38
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { createHmac, randomBytes } from "node:crypto";
|
|
2
|
+
import { currentRequestContext } from "./request-context.mjs";
|
|
3
|
+
|
|
4
|
+
const salt = randomBytes(32);
|
|
5
|
+
const bounded = value => typeof value === "string" && value.length > 0 && value.length <= 512 && !/[\u0000-\u001f\u007f]/.test(value);
|
|
6
|
+
const count = value => Number.isSafeInteger(value) && value >= 0 ? value : null;
|
|
7
|
+
|
|
8
|
+
// Presentation-only correlation. Never infer identity from prompts or retain an ID.
|
|
9
|
+
export function observeContextSession(body, headers = {}, provider, protocol = "responses") {
|
|
10
|
+
const tracker = currentRequestContext()?.streamPerformance;
|
|
11
|
+
if (!tracker?.observeSession) return;
|
|
12
|
+
let session = headers.session_id || headers["session-id"] || headers["x-conversation-id"] || headers["x-claude-code-session-id"];
|
|
13
|
+
if (!session && typeof body?.metadata?.user_id === "string" && body.metadata.user_id.length <= 2048) {
|
|
14
|
+
try { session = JSON.parse(body.metadata.user_id)?.session_id; }
|
|
15
|
+
catch { session = /(?:^|_)session_([\w-]{8,128})$/.exec(body.metadata.user_id)?.[1]; }
|
|
16
|
+
}
|
|
17
|
+
if (!bounded(session)) return;
|
|
18
|
+
try {
|
|
19
|
+
const profile = provider?.profileId?.(protocol);
|
|
20
|
+
if (!bounded(profile)) return;
|
|
21
|
+
const agent = headers["x-claude-code-agent-id"];
|
|
22
|
+
const key = createHmac("sha256", salt).update(`${profile}\0${session}\0${bounded(agent) ? agent : ""}`).digest("hex");
|
|
23
|
+
tracker.observeSession(key);
|
|
24
|
+
} catch { /* Optional metadata cannot change request admission or routing. */ }
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function createContextMetrics() {
|
|
28
|
+
const sessions = new Map(), unassigned = [];
|
|
29
|
+
let sequence = 0;
|
|
30
|
+
return {
|
|
31
|
+
record({ session, application, provider, model, route, at, started, finished, request_id, outcome, context, cached_input_tokens }) {
|
|
32
|
+
const input = count(context.input_tokens), cached = count(cached_input_tokens);
|
|
33
|
+
const point = { at, order: started, request_id, outcome, input_tokens: input,
|
|
34
|
+
context_window_tokens: count(context.context_window_tokens) || null,
|
|
35
|
+
cached_input_tokens: input !== null && cached !== null && cached <= input ? cached : null,
|
|
36
|
+
elapsed_ms: Math.max(0, finished - started), finished };
|
|
37
|
+
const compact = route === "responses_compact";
|
|
38
|
+
if (!session) {
|
|
39
|
+
unassigned.push({ id: `request-${++sequence}`, application, provider, model, ...point, compact });
|
|
40
|
+
if (unassigned.length > 20) unassigned.shift();
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const key = `${application}\0${provider}\0${model}\0${session}`;
|
|
44
|
+
let entry = sessions.get(key);
|
|
45
|
+
if (!entry) entry = { id: `session-${++sequence}`, application, provider, model, points: [], compactions: [] };
|
|
46
|
+
sessions.delete(key);sessions.set(key, entry);
|
|
47
|
+
const list = compact ? entry.compactions : entry.points;
|
|
48
|
+
list.push(point);if (list.length > (compact ? 16 : 64)) list.shift();
|
|
49
|
+
if (sessions.size > 64) sessions.delete(sessions.keys().next().value);
|
|
50
|
+
},
|
|
51
|
+
snapshot() {
|
|
52
|
+
const project = entry => {
|
|
53
|
+
const points = entry.points.map(point => ({ ...point })).sort((a, b) => a.order - b.order);
|
|
54
|
+
let end = -Infinity, concurrent = false;
|
|
55
|
+
for (const point of points) { if (point.order < end) concurrent = true;end = Math.max(end, point.finished); }
|
|
56
|
+
return { ...entry, points, concurrent, compactions: entry.compactions.map(point => ({ ...point })).sort((a, b) => a.order - b.order) };
|
|
57
|
+
};
|
|
58
|
+
return { source: "run_context", sessions: [...sessions.values()].reverse().map(project),
|
|
59
|
+
unassigned: unassigned.slice().reverse().map(point => ({ ...point })),
|
|
60
|
+
limits: { sessions: 64, points: 64, compactions: 16, unassigned: 20 } };
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
}
|
|
@@ -128,7 +128,7 @@ export function createCopilotTokenSession({
|
|
|
128
128
|
});
|
|
129
129
|
}
|
|
130
130
|
if (usesDefaultTokenStore) return githubReauthMessage(reason, resolveHome(home));
|
|
131
|
-
return `${reason}\
|
|
131
|
+
return `${reason}\nReconnect the affected account in its application; other saved accounts were kept.`;
|
|
132
132
|
};
|
|
133
133
|
|
|
134
134
|
async function loadCredentials(home) {
|
|
@@ -144,9 +144,23 @@
|
|
|
144
144
|
const count = value => !value ? format("cap_unknown") : value >= 1000000 ? `${Number((value / 1000000).toFixed(2))}M` : value >= 1000 ? `${Number((value / 1000).toFixed(1))}K` : String(value);
|
|
145
145
|
const reasoningText = values => values.reasoning === false ? format("cap_unsupported") : values.reasoning_efforts?.length ? values.reasoning_efforts.join(" / ") : values.reasoning === true ? format("cap_supported") : format("cap_unknown");
|
|
146
146
|
const searchText = values => values.web_search === undefined ? format("cap_unknown") : values.web_search.length ? values.web_search.map(protocol => protocol === "messages" ? "Messages" : protocol === "responses" ? "Responses" : "Chat").join(" / ") : format("cap_unsupported");
|
|
147
|
-
function
|
|
147
|
+
function closeModelDetail() {
|
|
148
|
+
const detail = el("connection-model-detail");
|
|
149
|
+
const row = detail.closest(".connection-detail-row");
|
|
150
|
+
detail.hidden = true;
|
|
151
|
+
el("connection-models").closest("fieldset").append(detail);
|
|
152
|
+
row?.remove();
|
|
153
|
+
for (const button of el("connection-models").querySelectorAll("[data-model-details]")) button.setAttribute("aria-expanded", "false");
|
|
154
|
+
}
|
|
155
|
+
function modelDetail(model, modelRow, trigger) {
|
|
156
|
+
if (trigger.getAttribute("aria-expanded") === "true") { closeModelDetail();return; }
|
|
157
|
+
closeModelDetail();
|
|
148
158
|
const detail = el("connection-model-detail");detail.hidden = false;detail.replaceChildren();
|
|
149
|
-
const
|
|
159
|
+
const row = node("tr", undefined, "connection-detail-row"), cell = node("td");
|
|
160
|
+
cell.colSpan = modelRow.children.length;
|
|
161
|
+
cell.append(detail);row.append(cell);modelRow.after(row);
|
|
162
|
+
trigger.setAttribute("aria-expanded", "true");
|
|
163
|
+
const heading = node("div", undefined, "panel-heading");heading.append(node("h3", model.id), button("close", () => { closeModelDetail();trigger.focus(); }));detail.append(heading);
|
|
150
164
|
const protocol = choice(model.protocols.map(id => ({ id, name: id === "messages" ? "Messages" : id === "responses" ? "Responses" : "Chat" })), model.protocols.includes("messages") ? "messages" : model.protocols[0], false);
|
|
151
165
|
protocol.setAttribute("aria-label", format("cap_api"));detail.append(protocol);
|
|
152
166
|
const status = node("p", undefined, "hint"), table = node("table"), body = node("tbody");table.append(body);detail.append(status, table);
|
|
@@ -196,7 +210,7 @@
|
|
|
196
210
|
override[key] = numeric.includes(key) ? Number(text) : flags.includes(key) ? text === "true" : arrays.includes(key) ? text === "[]" ? [] : text.split(/[,,]\s*/).filter(Boolean) : text;
|
|
197
211
|
}
|
|
198
212
|
model.capabilities = override;delete model.context_window;delete model.reasoning_efforts;modelRows();detail.hidden = true;message("cap_details_draft");
|
|
199
|
-
});advanced.append(save);
|
|
213
|
+
});advanced.append(save);
|
|
200
214
|
}
|
|
201
215
|
function syncPreview(preview) {
|
|
202
216
|
const c = client(editingClient), result = el("connection-sync-result");result.hidden = false;result.replaceChildren();
|
|
@@ -215,6 +229,7 @@
|
|
|
215
229
|
}
|
|
216
230
|
}
|
|
217
231
|
function modelRows() {
|
|
232
|
+
closeModelDetail();
|
|
218
233
|
const body = el("connection-models");body.replaceChildren();
|
|
219
234
|
for (const model of models) {
|
|
220
235
|
const tr = node("tr"), name = node("td"), apis = node("td"), actions = node("td"), group = node("div", undefined, "connection-checks");
|
|
@@ -233,7 +248,11 @@
|
|
|
233
248
|
}
|
|
234
249
|
const capability = resolved(model);
|
|
235
250
|
const context = node("td", count(capability.context_window)), reasoning = node("td", reasoningText(capability)), search = node("td", searchText(capability));
|
|
236
|
-
|
|
251
|
+
const details = button("cap_details", () => modelDetail(model, tr, details));
|
|
252
|
+
details.dataset.modelDetails = "";
|
|
253
|
+
details.setAttribute("aria-expanded", "false");
|
|
254
|
+
details.setAttribute("aria-controls", "connection-model-detail");
|
|
255
|
+
apis.append(group);actions.append(details, button("api_remove_model", () => { models = models.filter(item => item !== model);selectedModels.delete(model.id);modelRows(); }));tr.append(name, apis, context, reasoning, search, actions);body.append(tr);
|
|
237
256
|
}
|
|
238
257
|
}
|
|
239
258
|
function setEndpoints(base, endpoints) { for (const [api, path] of [["messages", "messages"], ["responses", "responses"], ["chat", "chat/completions"]]) apiForm.elements[api + "_url"].value = endpoints?.[api] || base.replace(/\/+$/, "") + "/" + path; }
|
package/src/dashboard/console.js
CHANGED
|
@@ -59,6 +59,7 @@
|
|
|
59
59
|
if (settingsViews.includes(next)) void loadSettings();
|
|
60
60
|
if (next === "models") { void refreshCatalog();void dashboardRefresh.refresh("auth"); }
|
|
61
61
|
if (next === "usage") { void dashboardRefresh.refresh("usage");usageView.revealChart(); } else usageView.stopMotion();
|
|
62
|
+
globalThis.ccdxContextView?.routeChanged();
|
|
62
63
|
if (next === "requests") renderContext();
|
|
63
64
|
if (next === "system") { void dashboardRefresh.refresh("animation");void dashboardRefresh.refresh("updates"); }
|
|
64
65
|
preferences?.render();
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
(() => {
|
|
2
|
+
const root = document.getElementById("usage-context-pane");
|
|
3
|
+
if (!root) return;
|
|
4
|
+
const el = id => document.getElementById(id), ns = "http://www.w3.org/2000/svg";
|
|
5
|
+
const language = globalThis.ccdxLanguage;
|
|
6
|
+
const label = (node, key, values) => language.set(node, key, values);
|
|
7
|
+
const valid = value => Number.isSafeInteger(value) && value >= 0;
|
|
8
|
+
const number = value => valid(value) ? value.toLocaleString() : "—";
|
|
9
|
+
const ratio = (input, total) => valid(input) && valid(total) && total > 0 ? `${(input / total * 100).toFixed(1)}%` : "—";
|
|
10
|
+
const visible = () => document.visibilityState === "visible" && !root.closest("[hidden]");
|
|
11
|
+
let entries = [], selected = null, known = false;
|
|
12
|
+
const name = entry => language.format(entry.identified ? "context_conversation" : "context_request", { id: entry.id.split("-").at(-1) });
|
|
13
|
+
const app = entry => language.format(`flow_app_${entry.application}`);
|
|
14
|
+
const latest = entry => entry.points.at(-1) || entry.compactions.at(-1) || {};
|
|
15
|
+
const time = value => globalThis.ccdxTime?.format(value) || "—";
|
|
16
|
+
function cell(row, value) { const cell = document.createElement("td");cell.textContent = value;row.append(cell);return cell; }
|
|
17
|
+
function chart(entry) {
|
|
18
|
+
const host = el("context-history-chart");host.replaceChildren();
|
|
19
|
+
const points = entry.points;
|
|
20
|
+
if (!points.some(point => valid(point.input_tokens))) { label(host, "context_no_input");return; }
|
|
21
|
+
if (!entry.identified) { label(host, "context_unassigned");return; }
|
|
22
|
+
const width = host.clientWidth;if (!width) return;
|
|
23
|
+
const height = 210, left = 64, right = 12, top = 25, bottom = 35;
|
|
24
|
+
const measured = Math.max(...points.map(point => valid(point.input_tokens) ? point.input_tokens : 0), 1);
|
|
25
|
+
const maximum = Math.max(measured, latest(entry).context_window_tokens || 0);
|
|
26
|
+
const x = index => left + (width - left - right) * index / Math.max(1, points.length - 1);
|
|
27
|
+
const y = value => top + (height - top - bottom) * (1 - value / maximum);
|
|
28
|
+
const svg = document.createElementNS(ns, "svg");svg.setAttribute("viewBox", `0 0 ${width} ${height}`);
|
|
29
|
+
svg.setAttribute("role", "img");svg.setAttribute("aria-label", language.format("context_history"));host.append(svg);
|
|
30
|
+
const shape = (tag, attributes, text) => {
|
|
31
|
+
const node = document.createElementNS(ns, tag);
|
|
32
|
+
for (const [key, value] of Object.entries(attributes)) node.setAttribute(key, value);
|
|
33
|
+
if (text !== undefined) node.textContent = text;svg.append(node);return node;
|
|
34
|
+
};
|
|
35
|
+
for (let index = 0; index <= 2; index++) {
|
|
36
|
+
const value = maximum * index / 2, py = y(value);
|
|
37
|
+
shape("line", { x1: left, x2: width - right, y1: py, y2: py, class: "context-grid" });
|
|
38
|
+
shape("text", { x: left - 8, y: py + 4, "text-anchor": "end" }, Math.round(value).toLocaleString());
|
|
39
|
+
}
|
|
40
|
+
shape("text", { x: left, y: 12 }, "tokens");
|
|
41
|
+
let path = "", continuing = false;
|
|
42
|
+
points.forEach((point, index) => {
|
|
43
|
+
if (!valid(point.input_tokens)) { continuing = false;return; }
|
|
44
|
+
path += `${continuing ? "L" : "M"}${x(index)} ${y(point.input_tokens)} `;continuing = true;
|
|
45
|
+
const dot = shape("circle", { cx: x(index), cy: y(point.input_tokens), r: 3, class: "context-point" });
|
|
46
|
+
const title = document.createElementNS(ns, "title");title.textContent = `${time(point.at)} · ${number(point.input_tokens)} tokens`;dot.append(title);
|
|
47
|
+
});
|
|
48
|
+
if (!entry.concurrent) shape("path", { d: path, class: "context-line" });
|
|
49
|
+
for (const index of new Set([0, Math.floor((points.length - 1) / 2), points.length - 1])) {
|
|
50
|
+
shape("text", { x: x(index), y: height - 14, "text-anchor": index === 0 ? "start" : "end" }, String(index + 1));
|
|
51
|
+
}
|
|
52
|
+
for (const compact of entry.compactions) {
|
|
53
|
+
const index = points.findIndex(point => point.order >= compact.order);
|
|
54
|
+
if (index < 0 || compact.outcome !== "completed") continue;
|
|
55
|
+
const px = x(index);shape("line", { x1: px, x2: px, y1: top, y2: height - bottom, class: "context-compact" });
|
|
56
|
+
shape("text", { x: Math.min(width - right - 35, Math.max(left + 35, px)), y: top - 8, "text-anchor": "middle" }, language.format("context_compact_event"));
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function render() {
|
|
60
|
+
if (!visible()) return;
|
|
61
|
+
const body = el("context-sessions");body.replaceChildren();
|
|
62
|
+
for (const entry of entries) {
|
|
63
|
+
const row = document.createElement("tr"), button = document.createElement("button");button.type = "button";
|
|
64
|
+
button.className = "context-session";label(button, entry.identified ? "context_conversation" : "context_request", { id: entry.id.split("-").at(-1) });
|
|
65
|
+
button.setAttribute("aria-pressed", String(selected === entry.id));
|
|
66
|
+
button.addEventListener("click", () => { selected = entry.id;render(); });cell(row, "").append(button);
|
|
67
|
+
cell(row, app(entry));cell(row, entry.model || "—");const point = latest(entry);
|
|
68
|
+
cell(row, ratio(point.input_tokens, point.context_window_tokens));body.append(row);
|
|
69
|
+
}
|
|
70
|
+
const entry = entries.find(entry => entry.id === selected);
|
|
71
|
+
el("context-selection").hidden = !entry;
|
|
72
|
+
if (!entry) {
|
|
73
|
+
if (known) { const row = document.createElement("tr"), empty = cell(row, language.format("context_empty"));empty.colSpan = 4;body.append(row); }
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
label(el("context-selection-title"), entry.identified ? "context_conversation" : "context_request", { id: entry.id.split("-").at(-1) });
|
|
77
|
+
el("context-selection-source").textContent = entry.provider === "github" ? "GitHub Copilot" : entry.provider === "m365" ? "Microsoft 365" : globalThis.ccdxConnectionNames?.[entry.provider] || language.format("flow_source_unknown");
|
|
78
|
+
const point = latest(entry);
|
|
79
|
+
el("context-latest-input").textContent = number(point.input_tokens);
|
|
80
|
+
el("context-window").textContent = valid(point.context_window_tokens) && point.context_window_tokens > 0 ? number(point.context_window_tokens) : language.format("context_unknown_window");
|
|
81
|
+
el("context-share").textContent = ratio(point.input_tokens, point.context_window_tokens);
|
|
82
|
+
el("context-reuse").textContent = ratio(point.cached_input_tokens, point.input_tokens);
|
|
83
|
+
label(el("context-history-note"), entry.concurrent ? "context_concurrent" : "context_request_order");chart(entry);
|
|
84
|
+
const compactions = el("context-compactions");compactions.replaceChildren();
|
|
85
|
+
for (const compact of entry.compactions) {
|
|
86
|
+
const row = document.createElement("tr");cell(row, time(compact.at));const result = cell(row, "");
|
|
87
|
+
label(result, ["completed", "incomplete", "failed", "cancelled"].includes(compact.outcome) ? compact.outcome : "unknown");
|
|
88
|
+
cell(row, Number.isFinite(compact.elapsed_ms) ? `${(compact.elapsed_ms / 1000).toFixed(1)} s` : "—");compactions.append(row);
|
|
89
|
+
}
|
|
90
|
+
if (!entry.compactions.length) { const row = document.createElement("tr"), empty = cell(row, language.format("context_no_compactions"));empty.colSpan = 3;compactions.append(row); }
|
|
91
|
+
}
|
|
92
|
+
const tokensTab = el("usage-tokens-tab"), contextTab = el("usage-context-tab");
|
|
93
|
+
function select(context) {
|
|
94
|
+
root.hidden = !context;el("usage-tokens-pane").hidden = context;
|
|
95
|
+
tokensTab.setAttribute("aria-selected", String(!context));contextTab.setAttribute("aria-selected", String(context));
|
|
96
|
+
tokensTab.tabIndex = context ? -1 : 0;contextTab.tabIndex = context ? 0 : -1;
|
|
97
|
+
render();window.dispatchEvent(new CustomEvent("ccdx:context-view"));
|
|
98
|
+
}
|
|
99
|
+
tokensTab.addEventListener("click", () => select(false));contextTab.addEventListener("click", () => select(true));
|
|
100
|
+
for (const tab of [tokensTab, contextTab]) tab.addEventListener("keydown", event => {
|
|
101
|
+
if (!["ArrowLeft", "ArrowRight", "Home", "End"].includes(event.key)) return;
|
|
102
|
+
event.preventDefault();const context = event.key === "Home" ? false : event.key === "End" ? true : root.hidden;
|
|
103
|
+
select(context);(context ? contextTab : tokensTab).focus();
|
|
104
|
+
});
|
|
105
|
+
contextTab.tabIndex = -1;
|
|
106
|
+
new ResizeObserver(() => { const entry = entries.find(entry => entry.id === selected);if (entry && visible()) chart(entry); }).observe(el("context-history-chart"));
|
|
107
|
+
new MutationObserver(render).observe(document.documentElement, { attributes: true, attributeFilter: ["lang"] });
|
|
108
|
+
globalThis.ccdxContextView = {
|
|
109
|
+
visible,
|
|
110
|
+
apply(data) {
|
|
111
|
+
if (!Array.isArray(data.sessions) || !Array.isArray(data.unassigned)) throw Error("Invalid context snapshot");
|
|
112
|
+
entries = [...data.sessions.slice(0, 128).map(entry => ({ ...entry, identified: true })),
|
|
113
|
+
...data.unassigned.slice(0, 40).map(point => ({ ...point, identified: false, concurrent: false,
|
|
114
|
+
points: point.compact ? [] : [point], compactions: point.compact ? [point] : [] }))];
|
|
115
|
+
entries.sort((a, b) => Date.parse(latest(b).at) - Date.parse(latest(a).at));
|
|
116
|
+
if (!entries.some(entry => entry.id === selected)) selected = entries[0]?.id || null;
|
|
117
|
+
known = true;render();
|
|
118
|
+
},
|
|
119
|
+
state(state) {
|
|
120
|
+
label(el("context-view-state"), state.error ? "context_read_failed" : state.pending ? "reading" : "context_scope");
|
|
121
|
+
},
|
|
122
|
+
routeChanged() { render();if (visible()) window.dispatchEvent(new CustomEvent("ccdx:context-view")); },
|
|
123
|
+
};
|
|
124
|
+
})();
|
package/src/dashboard/flow.js
CHANGED
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
root.dataset.state = !fresh ? "unknown" : total ? "active" : "idle";
|
|
115
115
|
const state = el("flow-state");
|
|
116
116
|
if (fresh && total === 0) label(state, "flow_idle");
|
|
117
|
-
else globalThis.ccdxIcons?.set(state, !fresh ? "flow_status_unknown" : "flow_total", !fresh ? "unavailable" : "
|
|
117
|
+
else globalThis.ccdxIcons?.set(state, !fresh ? "flow_status_unknown" : "flow_total", !fresh ? "unavailable" : "progress", { count: total });
|
|
118
118
|
label(el("flow-caption"), !fresh ? "flow_status_unknown" : omitted ? "flow_omitted" : selected ? "flow_related_count" : total ? "flow_group_scope" : "flow_no_active",
|
|
119
119
|
{ count: rows.filter(related).length, omitted, apps: apps.length, models: allModels.length });
|
|
120
120
|
el("flow-clear").hidden = !selected;
|
package/src/dashboard/icons.js
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
(() => {
|
|
2
2
|
const shapes = { ok: ["path", { d: "m8 12 2.5 2.5L16 9" }], running: ["path", { d: "m10 8 6 4-6 4Z" }],
|
|
3
|
+
connected: ["path", { d: "M9 17H7a5 5 0 0 1 0-10h2m6 0h2a5 5 0 0 1 0 10h-2M8 12h8" }],
|
|
4
|
+
progress: ["path", { d: "M8 12h.01M12 12h.01M16 12h.01" }],
|
|
3
5
|
warning: ["path", { d: "M12 7.5v5m0 3.5h.01" }], unavailable: ["path", { d: "M8 12h8" }] };
|
|
4
6
|
function icon(kind = "unknown") {
|
|
5
7
|
const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
6
8
|
for (const [key, value] of Object.entries({ viewBox: "0 0 24 24", "aria-hidden": "true", focusable: "false", class: "state-icon" })) svg.setAttribute(key, value);
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
if (kind !== "connected") {
|
|
10
|
+
const circle = document.createElementNS(svg.namespaceURI, "circle");
|
|
11
|
+
circle.setAttribute("cx", "12");circle.setAttribute("cy", "12");circle.setAttribute("r", "9");svg.append(circle);
|
|
12
|
+
}
|
|
9
13
|
if (shapes[kind]) { const [tag, attributes] = shapes[kind], shape = document.createElementNS(svg.namespaceURI, tag);
|
|
10
14
|
for (const [key, value] of Object.entries(attributes)) shape.setAttribute(key, value);svg.append(shape); }
|
|
11
15
|
return svg;
|
package/src/dashboard/index.html
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
<script src="/activity.js" defer></script>
|
|
18
18
|
<script src="/flow.js" defer></script>
|
|
19
19
|
<script src="/usage.js" defer></script>
|
|
20
|
+
<script src="/context.js" defer></script>
|
|
20
21
|
<script src="/updates.js" defer></script>
|
|
21
22
|
<script src="/animation.js" defer></script>
|
|
22
23
|
<script src="/ui.js" defer></script>
|
|
@@ -286,6 +287,8 @@
|
|
|
286
287
|
</details>
|
|
287
288
|
</div>
|
|
288
289
|
<div data-view="usage" hidden>
|
|
290
|
+
<div class="context-tabs" role="tablist" aria-label="Usage view" data-i18n-label="context_tabs"><button type="button" id="usage-tokens-tab" role="tab" aria-selected="true" aria-controls="usage-tokens-pane" data-i18n="context_tokens">Tokens</button><button type="button" id="usage-context-tab" role="tab" aria-selected="false" aria-controls="usage-context-pane" data-i18n="context_title">Context</button></div>
|
|
291
|
+
<div id="usage-tokens-pane" role="tabpanel" aria-labelledby="usage-tokens-tab">
|
|
289
292
|
<div class="section-actions usage-source-controls"><label><span data-i18n="source_entire_page">Source / entire page</span><select id="usage-provider"><option value="" data-i18n="all_providers">All providers</option></select></label><button id="refresh-usage" type="button" data-i18n="refresh_usage">Refresh usage</button></div>
|
|
290
293
|
|
|
291
294
|
<details id="usage-analytics" class="panel dashboard-section analytics-section">
|
|
@@ -314,6 +317,15 @@
|
|
|
314
317
|
|
|
315
318
|
</details>
|
|
316
319
|
</div>
|
|
320
|
+
<div id="usage-context-pane" role="tabpanel" aria-labelledby="usage-context-tab" hidden>
|
|
321
|
+
<section class="panel dashboard-section"><h2 data-i18n="context_activity">Conversations & requests</h2><p id="context-view-state" class="table-note" role="status"></p><div class="table-wrap"><table class="context-sessions"><thead><tr><th data-i18n="context_item">Conversation / request</th><th data-i18n="client">App</th><th data-i18n="model">Model</th><th data-i18n="context_share">Input share</th></tr></thead><tbody id="context-sessions"></tbody></table></div></section>
|
|
322
|
+
<section id="context-selection" class="panel dashboard-section" aria-labelledby="context-selection-title" hidden><div class="panel-heading"><h2 id="context-selection-title"></h2><span id="context-selection-source"></span></div>
|
|
323
|
+
<dl class="context-metrics"><div><dt data-i18n="context_latest_input">Latest input</dt><dd id="context-latest-input">—</dd></div><div><dt data-i18n="model_window">Model window</dt><dd id="context-window">—</dd></div><div><dt data-i18n="context_share">Input share</dt><dd id="context-share">—</dd></div><div><dt data-i18n="context_reuse">Cache reuse</dt><dd id="context-reuse">—</dd></div></dl>
|
|
324
|
+
<div class="panel-heading"><h3 data-i18n="context_history">Input history</h3><span id="context-history-note"></span></div><div id="context-history-chart" class="context-history-chart"></div>
|
|
325
|
+
<details class="tool-details" open><summary data-i18n="context_compactions">Compactions</summary><div class="table-wrap"><table><thead><tr><th data-i18n="time">Time</th><th data-i18n="outcome">Result</th><th data-i18n="context_elapsed">Elapsed</th></tr></thead><tbody id="context-compactions"></tbody></table></div></details>
|
|
326
|
+
</section>
|
|
327
|
+
</div>
|
|
328
|
+
</div>
|
|
317
329
|
<div data-view="requests" hidden>
|
|
318
330
|
<section class="panel dashboard-section" id="request-flow" data-state="unknown">
|
|
319
331
|
<div class="panel-heading"><h2 data-i18n="request_flow">REQUEST FLOW</h2><span id="flow-state" role="status" aria-live="polite" data-i18n="flow_status_unknown">Status unavailable</span></div>
|
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
(() => {
|
|
2
2
|
const translations = {
|
|
3
|
+
"context_tabs": ["Usage view", "统计视图"],
|
|
4
|
+
"context_unknown_window": ["Unknown", "未知"],
|
|
5
|
+
"context_compact_event": ["Compaction", "压缩"],
|
|
6
|
+
"context_tokens": ["Tokens", "用量"],
|
|
7
|
+
"context_title": ["Context", "上下文"],
|
|
8
|
+
"context_activity": ["Conversations & requests", "会话与请求"],
|
|
9
|
+
"context_item": ["Conversation / request", "会话/请求"],
|
|
10
|
+
"context_share": ["Input share", "输入占比"],
|
|
11
|
+
"context_latest_input": ["Latest input", "最近输入"],
|
|
12
|
+
"context_reuse": ["Cache reuse", "缓存复用"],
|
|
13
|
+
"context_history": ["Input history", "输入变化"],
|
|
14
|
+
"context_compactions": ["Gateway compactions", "网关压缩"],
|
|
15
|
+
"context_elapsed": ["Elapsed", "耗时"],
|
|
16
|
+
"context_conversation": ["Conversation {id}", "会话 {id}"],
|
|
17
|
+
"context_request": ["Request {id}", "请求 {id}"],
|
|
18
|
+
"context_empty": ["No records in this run.", "本次运行暂无记录。"],
|
|
19
|
+
"context_no_input": ["Input usage unavailable.", "未获得输入用量。"],
|
|
20
|
+
"context_unassigned": ["No conversation ID; shown as one request.", "未识别会话,仅显示此请求。"],
|
|
21
|
+
"context_no_compactions": ["No observed compactions.", "未观测到压缩。"],
|
|
22
|
+
"context_concurrent": ["Concurrent requests", "并发请求"],
|
|
23
|
+
"context_request_order": ["Request order", "请求顺序"],
|
|
24
|
+
"context_scope": ["This run · Reported metadata", "本次运行 · 上报数据"],
|
|
25
|
+
"context_read_failed": ["Read failed. Previous data kept.", "读取失败,保留上次数据。"],
|
|
3
26
|
"model_id": ["Model ID", "模型 ID"],
|
|
4
27
|
"catalog_scope": ["Catalog scope", "目录说明"],
|
|
5
28
|
"issue_brief": ["{cause} · {model} · {time}", "{cause} · {model} · {time}"],
|
package/src/dashboard/ui.css
CHANGED
|
@@ -133,6 +133,10 @@ details > summary::-webkit-details-marker { display: none; }
|
|
|
133
133
|
details > summary::marker { content: ""; }
|
|
134
134
|
details > summary::before { content: ""; width: 14px; height: 14px; align-self: center; background: currentColor; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat; transition: transform 160ms cubic-bezier(.25,1,.5,1); }
|
|
135
135
|
details[open]:not([data-disclosure-closing]) > summary::before { transform: rotate(180deg); }
|
|
136
|
+
/* Expanded metadata contributes height, not a new preferred table-column width. */
|
|
137
|
+
tr:has(> td details) > td { vertical-align: top; }
|
|
138
|
+
td details { white-space: normal; }
|
|
139
|
+
td details > :is(dl, p, pre, div, ul, ol), #connection-model-detail { contain: inline-size; min-inline-size: 0; overflow-wrap: anywhere; }
|
|
136
140
|
@media (prefers-reduced-motion: reduce) { details > summary::before { transition: none; } }
|
|
137
141
|
.client-sync-state { margin: 12px 0; font-size: 12px; color: var(--text); }
|
|
138
142
|
.source-impact { min-width: 0; }
|
|
@@ -207,12 +211,18 @@ footer { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; color:
|
|
|
207
211
|
.provider-tabs button, .install-platforms button { text-align: center; }
|
|
208
212
|
.provider-tabs [aria-selected="true"], .provider-tabs [aria-selected="true"]:hover, .install-platforms [aria-pressed="true"], .install-platforms [aria-pressed="true"]:hover { color: var(--page); border-color: var(--accent); background: var(--accent); }
|
|
209
213
|
.model-catalog table, .model-catalog td { color: var(--text); font-size: 13px; background: var(--surface); }
|
|
214
|
+
.model-catalog table { table-layout: fixed; }
|
|
215
|
+
.model-catalog th:first-child { width: 40%; }
|
|
216
|
+
.model-catalog th:nth-child(2) { width: 25%; }
|
|
217
|
+
.model-catalog th:last-child { width: 35%; }
|
|
218
|
+
.model-catalog td { white-space: normal; overflow-wrap: anywhere; vertical-align: top; }
|
|
210
219
|
.model-catalog th { color: var(--text); font-size: 12px; }
|
|
211
220
|
.model-catalog > summary h2 { color: var(--strong); }
|
|
212
221
|
.model-catalog .model-name { color: var(--strong); font-weight: 600; }
|
|
213
222
|
.model-catalog td:last-child { white-space: normal; }
|
|
214
223
|
.model-catalog td details { margin: 0; }
|
|
215
|
-
.model-catalog .failure-detail { min-width:
|
|
224
|
+
.model-catalog .failure-detail { min-width: 0; }
|
|
225
|
+
@media (max-width: 700px) { .model-catalog .failure-detail { grid-template-columns: minmax(0, 1fr); gap: 3px; } }
|
|
216
226
|
#provider-auth td, #provider-clients td { overflow-wrap: anywhere; }
|
|
217
227
|
.details { grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
|
218
228
|
@media (max-width: 700px) { .details { grid-template-columns: 1fr; } }
|
|
@@ -445,7 +455,7 @@ input[role="switch"]:disabled { opacity: .5; cursor: wait; }
|
|
|
445
455
|
|
|
446
456
|
.state-label { display:inline-flex; align-items:center; gap:8px; max-width:100%; vertical-align:middle; white-space:normal; }
|
|
447
457
|
.state-icon { width:16px; height:16px; flex:none; fill:none; stroke:currentColor; stroke-width:1.6; stroke-linecap:round; stroke-linejoin:round; }
|
|
448
|
-
.state-label.state-ok, .state-label.state-running { color:var(--accent); }
|
|
458
|
+
.state-label.state-ok, .state-label.state-running, .state-label.state-connected, .state-label.state-progress { color:var(--accent); }
|
|
449
459
|
.state-label.state-warning { color:var(--bad); }
|
|
450
460
|
.state-label.state-unavailable, .state-label.state-unknown { color:var(--muted); }
|
|
451
461
|
.state-label > span { color:inherit; white-space:normal; }
|
|
@@ -540,7 +550,8 @@ input[role="switch"]:disabled { opacity: .5; cursor: wait; }
|
|
|
540
550
|
/* Model capability and application binding controls share the existing palette. */
|
|
541
551
|
.client-segments { margin-bottom: 18px; }
|
|
542
552
|
.client-segments button[aria-pressed="true"], .binding-table button[aria-pressed="true"] { color: var(--page); background: var(--accent); border-color: var(--accent); }
|
|
543
|
-
#connection-model-detail { margin
|
|
553
|
+
#connection-model-detail { margin: 0; padding: 18px 0; }
|
|
554
|
+
.connection-detail-row > td { white-space: normal; }
|
|
544
555
|
#connection-model-detail h3 { overflow-wrap: anywhere; }
|
|
545
556
|
#connection-model-detail .connection-fields { margin-bottom: 18px; }
|
|
546
557
|
#connection-models td:last-child { min-width: 130px; }
|
|
@@ -621,3 +632,25 @@ input[role="switch"]:disabled { opacity: .5; cursor: wait; }
|
|
|
621
632
|
.preferences-dialog dt { color:var(--muted); }.preferences-dialog dd { margin:0; }
|
|
622
633
|
.preferences-dialog .section-actions { justify-content:flex-end; margin-top:24px; }
|
|
623
634
|
@media(max-width:640px) { .preferences-row { gap:14px; flex-wrap:wrap; }.preferences-row > div:first-child { flex:1; min-width:150px; }.preferences-dialog { padding:20px; }.preferences-dialog dl > div { grid-template-columns:1fr; gap:3px; } }
|
|
635
|
+
|
|
636
|
+
/* Context observes requests without changing client behavior. */
|
|
637
|
+
.context-tabs { display:flex;gap:8px;margin-bottom:18px; }
|
|
638
|
+
.context-tabs button { min-width:80px;text-align:center; }
|
|
639
|
+
.context-tabs button[aria-selected="true"], .context-session[aria-pressed="true"] { color:var(--surface);background:var(--accent);border-color:var(--accent); }
|
|
640
|
+
.context-sessions { table-layout:fixed;min-width:420px; }
|
|
641
|
+
.context-sessions th:first-child { width:27%; }
|
|
642
|
+
.context-sessions th:nth-child(2) { width:23%; }
|
|
643
|
+
.context-sessions th:nth-child(3) { width:32%; }
|
|
644
|
+
.context-sessions th:last-child, .context-sessions td:last-child { text-align:right; }
|
|
645
|
+
.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:26px 0; }
|
|
647
|
+
.context-metrics dt { color:var(--muted);font-size:11px; }
|
|
648
|
+
.context-metrics dd { margin:8px 0 0;font-size:23px;font-variant-numeric:tabular-nums; }
|
|
649
|
+
.context-history-chart { min-height:210px;color:var(--muted);margin-top:14px; }
|
|
650
|
+
.context-history-chart svg { width:100%;height:210px;display:block; }
|
|
651
|
+
.context-history-chart text { font-size:11px;fill:var(--muted); }
|
|
652
|
+
.context-grid { stroke:var(--border);stroke-width:1; }
|
|
653
|
+
.context-line { fill:none;stroke:var(--accent);stroke-width:1.6; }
|
|
654
|
+
.context-point { fill:var(--accent); }
|
|
655
|
+
.context-compact { stroke:var(--muted);stroke-width:1;stroke-dasharray:3 5; }
|
|
656
|
+
@media (max-width:640px) { .context-metrics { grid-template-columns:repeat(2,minmax(0,1fr));gap:18px; } .context-metrics dd { font-size:21px; } }
|
package/src/dashboard/ui.js
CHANGED
|
@@ -27,7 +27,7 @@ const statusResourceKey = () => ["codex", "claude", "models", "usage", "requests
|
|
|
27
27
|
const refreshStatus = () => dashboardRefresh.refresh(statusResourceKey(), { force: true });
|
|
28
28
|
const refresh = refreshStatus;
|
|
29
29
|
|
|
30
|
-
function
|
|
30
|
+
function animateLogo() {
|
|
31
31
|
const icon = element("status-icon");
|
|
32
32
|
if (!icon || reducedMotion.matches || !icon.animate) return;
|
|
33
33
|
for (const animation of icon.getAnimations?.() || []) animation.cancel();
|
|
@@ -35,9 +35,10 @@ function animateRefresh() {
|
|
|
35
35
|
{ duration: 450, easing: "cubic-bezier(0.25, 1, 0.5, 1)" });
|
|
36
36
|
}
|
|
37
37
|
element("refresh").addEventListener("click", () => {
|
|
38
|
-
|
|
38
|
+
animateLogo();
|
|
39
39
|
dashboardRefresh.refreshVisible({ force: true });
|
|
40
40
|
});
|
|
41
|
+
document.querySelector(".sidebar-brand").addEventListener("click", animateLogo);
|
|
41
42
|
|
|
42
43
|
const reducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
43
44
|
const animationView = globalThis.ccdxViewBoundary.create("animation-settings", () => globalThis.ccdxDashboardAnimation.create({ element, phrase, localize, text, reducedMotion,
|
|
@@ -256,7 +257,7 @@ function statusState(state) {
|
|
|
256
257
|
text("connection", state.pending && !state.value ? "reading" : state.error ? "unavailable_eb0be" : "service_reachable");
|
|
257
258
|
element("connection").className = `badge ${state.pending ? "neutral" : state.error ? "bad" : "good"}`;
|
|
258
259
|
globalThis.ccdxIcons?.set(element("connection"), state.pending && !state.value ? "reading" : state.error ? "unavailable_eb0be" : "service_reachable",
|
|
259
|
-
state.pending && !state.value ? "unknown" : state.error ? "unavailable" : "
|
|
260
|
+
state.pending && !state.value ? "unknown" : state.error ? "unavailable" : "connected");
|
|
260
261
|
if (state.error) refreshTime(element("updated"), state);
|
|
261
262
|
for (const node of timestamps.get("status")) refreshTime(node, state);
|
|
262
263
|
}
|
|
@@ -269,6 +270,12 @@ const dashboardRefresh = globalThis.ccdxRefresh.createController({
|
|
|
269
270
|
element("refresh").setAttribute("aria-busy", String(busy));
|
|
270
271
|
},
|
|
271
272
|
resources: {
|
|
273
|
+
context: {
|
|
274
|
+
visible: () => globalThis.ccdxContextView?.visible() === true,
|
|
275
|
+
load: ({ signal }) => readDashboard("/_ccdx/ui/context", { signal, timeout: 5000, source: "run_context" }),
|
|
276
|
+
apply: data => globalThis.ccdxContextView?.apply(data),
|
|
277
|
+
state: state => globalThis.ccdxContextView?.state(state),
|
|
278
|
+
},
|
|
272
279
|
updates: {
|
|
273
280
|
visible: () => !element("version-updates").closest("[hidden]"),
|
|
274
281
|
load: ({ signal }) => readDashboard("/_ccdx/ui/updates", { signal, timeout: 20000, source: "release_status" }),
|
|
@@ -458,7 +465,8 @@ for (const link of document.querySelectorAll("[data-source-link]")) link.addEven
|
|
|
458
465
|
const id = link.dataset.sourceLink === "codex" ? providerEntries.find(provider => provider.clients?.some(client => client.id === "codex" && client.selected))?.id : link.dataset.sourceLink;
|
|
459
466
|
if (providerEntries.some(provider => provider.id === id)) chooseProvider(id);
|
|
460
467
|
});
|
|
468
|
+
window.addEventListener("ccdx:context-view", () => { if (globalThis.ccdxContextView?.visible()) void dashboardRefresh.refresh("context"); });
|
|
461
469
|
loadAnimation();
|
|
462
470
|
refresh();
|
|
463
471
|
loadAuth();
|
|
464
|
-
|
|
472
|
+
animateLogo();
|
package/src/dashboard-api.mjs
CHANGED
|
@@ -42,10 +42,10 @@ function safeText(value, length = 160) {
|
|
|
42
42
|
function liveModelError(error) {
|
|
43
43
|
const message = String(error?.message || error || "");
|
|
44
44
|
const status = /\bHTTP (\d{3})\b/.exec(message)?.[1];
|
|
45
|
-
if (status) return `Live model lookup failed (HTTP ${status}). Run ccdx models for details.`;
|
|
46
|
-
if (/timed out/i.test(message)) return "Live model lookup timed out. Retry or run ccdx models.";
|
|
45
|
+
if (status) return `Live model lookup failed (HTTP ${status}). Run ccdx app codex models for details.`;
|
|
46
|
+
if (/timed out/i.test(message)) return "Live model lookup timed out. Retry or run ccdx app codex models.";
|
|
47
47
|
if (/GitHub token not found/i.test(message)) return "GitHub token not found. Start ccdx to sign in.";
|
|
48
|
-
return "Live model lookup failed. Run ccdx models for details.";
|
|
48
|
+
return "Live model lookup failed. Run ccdx app codex models for details.";
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
function animationState(env, home, { includeFrames = false } = {}) {
|
|
@@ -148,6 +148,7 @@ export async function handleDashboardApi(req, res, pathname, {
|
|
|
148
148
|
providerStateFn,
|
|
149
149
|
providerAccountsFn,
|
|
150
150
|
connectionsFn,
|
|
151
|
+
contextSnapshotFn,
|
|
151
152
|
updateStatusFn,
|
|
152
153
|
serviceControl,
|
|
153
154
|
applyAnimation,
|
|
@@ -164,6 +165,11 @@ export async function handleDashboardApi(req, res, pathname, {
|
|
|
164
165
|
return;
|
|
165
166
|
}
|
|
166
167
|
|
|
168
|
+
if (pathname === "/_ccdx/ui/context") {
|
|
169
|
+
if (req.method !== "GET") { sendJson(res, 405, { error: "Use GET" });return; }
|
|
170
|
+
if (req.headers.origin && !sameOrigin(req)) { sendJson(res, 403, { error: "Context requires the same-origin dashboard" });return; }
|
|
171
|
+
sendJson(res, 200, contextSnapshotFn?.() || { source: "run_context", sessions: [], unassigned: [] });return;
|
|
172
|
+
}
|
|
167
173
|
if (["/_ccdx/ui/account", "/_ccdx/ui/checks"].includes(pathname)) {
|
|
168
174
|
return tools.handle(req, res, pathname, sendJson, sameOrigin);
|
|
169
175
|
}
|
|
@@ -252,7 +258,7 @@ export async function handleDashboardApi(req, res, pathname, {
|
|
|
252
258
|
const query = new URL(req.url, "http://localhost").searchParams;
|
|
253
259
|
sendJson(res, 200, animationState(env, home, { includeFrames: query.get("frames") !== "0" }));
|
|
254
260
|
} catch {
|
|
255
|
-
sendJson(res, 409, { error: "Animation settings are invalid; inspect them with ccdx animation" });
|
|
261
|
+
sendJson(res, 409, { error: "Animation settings are invalid; inspect them with ccdx config animation" });
|
|
256
262
|
}
|
|
257
263
|
return;
|
|
258
264
|
}
|
|
@@ -286,7 +292,7 @@ export async function handleDashboardApi(req, res, pathname, {
|
|
|
286
292
|
applyAnimation?.(body.theme);
|
|
287
293
|
sendJson(res, 200, { changed: result.changed, ...animationState(env, home) });
|
|
288
294
|
} catch {
|
|
289
|
-
sendJson(res, 409, { error: "Animation setting was not saved; check ccdx animation" });
|
|
295
|
+
sendJson(res, 409, { error: "Animation setting was not saved; check ccdx config animation" });
|
|
290
296
|
}
|
|
291
297
|
return;
|
|
292
298
|
}
|
package/src/dashboard.mjs
CHANGED
|
@@ -19,6 +19,7 @@ const ASSETS = new Map([
|
|
|
19
19
|
["/activity.js", ["./dashboard/activity.js", "text/javascript; charset=utf-8"]],
|
|
20
20
|
["/flow.js", ["./dashboard/flow.js", "text/javascript; charset=utf-8"]],
|
|
21
21
|
["/usage.js", ["./dashboard/usage.js", "text/javascript; charset=utf-8"]],
|
|
22
|
+
["/context.js", ["./dashboard/context.js", "text/javascript; charset=utf-8"]],
|
|
22
23
|
["/refresh.js", ["./dashboard/refresh.js", "text/javascript; charset=utf-8"]],
|
|
23
24
|
["/icons.js", ["./dashboard/icons.js", "text/javascript; charset=utf-8"]],
|
|
24
25
|
["/disclosure.js", ["./dashboard/disclosure.js", "text/javascript; charset=utf-8"]],
|
package/src/doctor.mjs
CHANGED
|
@@ -224,11 +224,11 @@ export async function collectDoctorChecks({
|
|
|
224
224
|
const environment = inspectPredictionEnvironmentFn({ env, platform });
|
|
225
225
|
checks.push({ kind: environment.summary.tls.extra_ca === "unreadable_or_invalid" ? "warn" : "info", message: formatPredictionEnvironment(environment.summary) });
|
|
226
226
|
} else checks.push({ kind: "warn", message: "Native predictions require macOS or Windows; existing settings preserved" });
|
|
227
|
-
} catch { checks.push({ kind: "warn", message: "Prediction environment could not be verified; existing routing and trust settings preserved", fix: "ccdx prediction status" }); }
|
|
227
|
+
} catch { checks.push({ kind: "warn", message: "Prediction environment could not be verified; existing routing and trust settings preserved", fix: "ccdx app codex prediction status" }); }
|
|
228
228
|
try {
|
|
229
229
|
const image = readImageProviderConfigFn({ home, env, strict: true });
|
|
230
230
|
checks.push({ kind: "info", message: image ? "Image generation configured; no provider request was made" : "Image generation is off; optional checks skipped" });
|
|
231
|
-
} catch { checks.push({ kind: "warn", message: "Image provider configuration is invalid; core service is unaffected", fix: "ccdx image
|
|
231
|
+
} catch { checks.push({ kind: "warn", message: "Image provider configuration is invalid; core service is unaffected", fix: "ccdx app codex image status" }); }
|
|
232
232
|
const updateEnvironment = inspectUpdateEnvironmentFn();
|
|
233
233
|
const updateMessage = updateEnvironment.state === "different" ? "npm update target differs from this CCDX installation; review PATH/prefix before updating"
|
|
234
234
|
: updateEnvironment.state === "unavailable" ? "npm update environment could not be verified; installer settings were not changed"
|
|
@@ -252,8 +252,8 @@ export async function collectDoctorChecks({
|
|
|
252
252
|
const ready = result.state?.m365?.state === "ready" && result.models?.length > 0;
|
|
253
253
|
checks.push({ kind: ready ? "ok" : "warn", id: "provider", message: ready
|
|
254
254
|
? `Microsoft 365 is ready; ${result.models.length} GPT models available`
|
|
255
|
-
: "Microsoft 365 is not ready; inspect ccdx m365 status. No GitHub fallback was selected" });
|
|
256
|
-
} catch { checks.push({ kind: "warn", id: "provider", message: "Microsoft 365 could not be checked through the running adapter; start ccdx and inspect ccdx m365 status" }); }
|
|
255
|
+
: "Microsoft 365 is not ready; inspect ccdx source m365 status. No GitHub fallback was selected" });
|
|
256
|
+
} catch { checks.push({ kind: "warn", id: "provider", message: "Microsoft 365 could not be checked through the running adapter; start ccdx and inspect ccdx source m365 status" }); }
|
|
257
257
|
} else if (!sourceError) checks.push(...await inspectAuthProfilesOnline({
|
|
258
258
|
home,
|
|
259
259
|
profile,
|
package/src/image-mcp.mjs
CHANGED
|
@@ -221,7 +221,7 @@ export function createImageMcpHandler({
|
|
|
221
221
|
instructions: config && isEnabled()
|
|
222
222
|
? `CCDX handles the configured image API and credentials; no Python or SDK setup. Embed returned image Markdown in the final reply. Redisplay reuses it without tool calls. Keep each image_id with its own image. Do not automatically retry failed/timed-out requests or switch providers.${supportsImageEditing(config) ? " Use generate_image for new images; edit_image requires the exact retained source ID." : " Use generate_image for new images. Editing is unsupported; do not substitute generation."}`
|
|
223
223
|
: config ? "Image calls are paused. Resume them in the CCDX WebUI; the provider and retained edit handles are preserved."
|
|
224
|
-
: "Image generation is disabled. Enable it with ccdx
|
|
224
|
+
: "Image generation is disabled. Enable it with ccdx app codex image setup before requesting images.",
|
|
225
225
|
});
|
|
226
226
|
return;
|
|
227
227
|
}
|
|
@@ -248,7 +248,7 @@ export function createImageMcpHandler({
|
|
|
248
248
|
if (!config || !isEnabled()) {
|
|
249
249
|
metrics.failed += 1;
|
|
250
250
|
if (!config) imageReferences.clear();
|
|
251
|
-
reply({ content: [{ type: "text", text: config ? "Image calls are paused. Resume them in the CCDX WebUI." : "Image generation is disabled. Run ccdx
|
|
251
|
+
reply({ content: [{ type: "text", text: config ? "Image calls are paused. Resume them in the CCDX WebUI." : "Image generation is disabled. Run ccdx app codex image setup first." }], isError: true });
|
|
252
252
|
return;
|
|
253
253
|
}
|
|
254
254
|
const editing = request.params.name === EDIT_TOOL_NAME;
|
|
@@ -9,7 +9,7 @@ export async function requestPredictionFix({ host = "127.0.0.1", port = 2026, fe
|
|
|
9
9
|
requiredCapabilities: [PREDICTION_FIX_CAPABILITY] });
|
|
10
10
|
if (!probe.ok) throw new Error(probe.incompatible
|
|
11
11
|
? "The running adapter lacks compatible prediction repair. Upgrade and restart the CCDX service once; the App was not restarted."
|
|
12
|
-
: "Could not reach a running CCDX adapter. Start ccdx, then retry ccdx prediction
|
|
12
|
+
: "Could not reach a running CCDX adapter. Start ccdx, then retry ccdx app codex prediction repair.");
|
|
13
13
|
const signal = AbortSignal.timeout(timeoutMs);
|
|
14
14
|
const response = await fetchImpl(probe.baseUrl + ADAPTER_PREDICTION_FIX_PATH, {
|
|
15
15
|
method: "POST", headers: { "Content-Type": "application/json", Accept: "application/json" },
|