codex-copilot-dx 1.3.6 → 1.3.8
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 +7 -16
- package/bin/cli.mjs +55 -31
- package/docs/ARCHITECTURE.md +14 -2
- package/docs/REFERENCE.md +38 -5
- package/package.json +6 -2
- package/src/claude-gateway.mjs +2 -1
- package/src/cli-command-spec.mjs +3 -2
- package/src/cli-image.mjs +2 -80
- package/src/cli-options.mjs +1 -1
- package/src/client-integration.mjs +11 -4
- package/src/dashboard/connections.js +4 -0
- package/src/dashboard/console.js +12 -6
- package/src/dashboard/features.js +68 -0
- package/src/dashboard/index.html +11 -9
- package/src/dashboard/language.js +57 -14
- package/src/dashboard/status.js +2 -1
- package/src/dashboard/tools.js +4 -1
- package/src/dashboard/ui.js +1 -1
- package/src/dashboard-api.mjs +2 -2
- package/src/dashboard-tools.mjs +2 -1
- package/src/dashboard.mjs +1 -0
- package/src/doctor-compat.mjs +19 -13
- package/src/doctor.mjs +1 -1
- package/src/image-setup.mjs +110 -0
- package/src/local-privacy.mjs +1 -0
- package/src/local-tools.mjs +8 -2
- package/src/native-prediction-profile.mjs +5 -2
- package/src/native-prediction.mjs +18 -2
- package/src/optional-routes.mjs +1 -1
- package/src/prediction-control.mjs +64 -0
- package/src/prediction-operations.mjs +68 -0
- package/src/prediction-preference.mjs +75 -0
- package/src/privacy-model.mjs +6 -4
- package/src/privacy-transform.mjs +39 -25
- package/src/response-failures.mjs +8 -2
- package/src/responses-handler.mjs +2 -2
- package/src/responses-proxy.mjs +1 -1
- package/src/service-control.mjs +33 -7
- package/src/service-supervisor.mjs +39 -18
- package/src/service-worker.mjs +13 -1
- package/src/stream-performance.mjs +2 -2
package/src/dashboard/console.js
CHANGED
|
@@ -68,13 +68,14 @@
|
|
|
68
68
|
async function api(body) {
|
|
69
69
|
const response = await fetch("/_ccdx/ui/settings", { method: body ? "POST" : "GET", cache: "no-store",
|
|
70
70
|
headers: { "X-CCDX-Dashboard": "1", ...(body ? { "Content-Type": "application/json" } : {}) },
|
|
71
|
-
...(body ? { body: JSON.stringify(body) } : {}), signal: AbortSignal.timeout(body?.operation === "account" ? 65000 : 15000) });
|
|
71
|
+
...(body ? { body: JSON.stringify(body) } : {}), signal: AbortSignal.timeout(body?.action === "prediction" ? 210000 : body?.action === "image" || body?.operation === "account" ? 65000 : 15000) });
|
|
72
72
|
const data = await response.json();if (!response.ok) throw Object.assign(new Error(data.error || `HTTP ${response.status}`), { code: data.code });return data;
|
|
73
73
|
}
|
|
74
74
|
const preferences = globalThis.ccdxDashboardPreferences?.create({ element: el, api, applied: applySettings, time,
|
|
75
75
|
selectAnimation: theme => animationView.select(theme),
|
|
76
76
|
refreshAnimation() { dashboardRefresh.invalidate("animation");if (current === "system") void dashboardRefresh.refresh("animation", { force: true }); } });
|
|
77
77
|
globalThis.ccdxSettingsPreferences = preferences;
|
|
78
|
+
const features = globalThis.ccdxDashboardFeatures?.create({ element: el, api, apply: applySettings, change, localize: label });
|
|
78
79
|
const states = { immediate: "effective_now", terminal_unavailable: "terminal_animation_unavailable_in_this_output_mode", next_start: "next_ccdx_start", next_call: "applies_to_new_calls", needs_setup: "setup_required",
|
|
79
80
|
next_config_request: "next_configuration_request_cached_suggestions_may_remain", needs_app_relaunch: "reopen_the_client_to_finish", needs_service_restart: "restart_ccdx_to_finish" };
|
|
80
81
|
const selectedSource = () => providerEntries.find(source => source.id === el("source-provider").value);
|
|
@@ -115,6 +116,7 @@
|
|
|
115
116
|
function applySettings(data, meta) {
|
|
116
117
|
globalThis.ccdxPrivacy?.sync(data.local_privacy);
|
|
117
118
|
settings = data;
|
|
119
|
+
features?.render(data);
|
|
118
120
|
const nightly = data.nightly_update;
|
|
119
121
|
el("nightly-update").checked = nightly?.enabled === true;el("nightly-update").disabled = false;
|
|
120
122
|
el("nightly-rules").hidden = nightly?.enabled !== true;
|
|
@@ -125,7 +127,7 @@
|
|
|
125
127
|
el("animation-settings").dataset.terminalPalette = data.color_theme || "green";
|
|
126
128
|
label(el("terminal-color-note"), data.terminal?.mode !== "status"
|
|
127
129
|
? "terminal_theme_unavailable" : "terminal_theme_applied");
|
|
128
|
-
for (const key of ["terminal_animation_enabled", "open_webui", "image_enabled"
|
|
130
|
+
for (const key of ["terminal_animation_enabled", "open_webui", "image_enabled"]) {
|
|
129
131
|
const input = el(`setting-${key}`), effective = data.effective[key];
|
|
130
132
|
input.checked = data.saved[key];input.disabled = Boolean(effective.locked);
|
|
131
133
|
label(el(`effect-${key}`), data.saved[key] === effective.value && !effective.locked ? "preference_effect" : "saved_saved_effective_effective_state", {
|
|
@@ -195,9 +197,9 @@
|
|
|
195
197
|
if (settingsPending) return;
|
|
196
198
|
settingsPending = true;
|
|
197
199
|
syncAccountControls();
|
|
198
|
-
const controls = [...document.querySelectorAll("[role=switch], #save-history, #clean-history, #fix-prediction, #apply-source, #save-review, #source-provider, #source-model, #source-review, #source-review-effort, #terminal-color-theme, #m365-enabled")];
|
|
200
|
+
const controls = [...document.querySelectorAll("[role=switch], #save-history, #clean-history, #fix-prediction, #apply-source, #save-review, #source-provider, #source-model, #source-review, #source-review-effort, #terminal-color-theme, #m365-enabled, #prediction-continue, #prediction-open, #prediction-setup, #prediction-remove, #image-setup-form input, #image-setup-form select, #image-setup-form button, #decoded-limit, #decoded-limit-save, #decoded-limit-default, #install-update")];
|
|
199
201
|
controls.forEach(input => { input.disabled = true; });
|
|
200
|
-
const note = el(body.action === "nightly_update" ? "nightly-state" : body.key ? `effect-${body.key}` : body.action === "color_theme" ? "terminal-color-note"
|
|
202
|
+
const note = el(body.action === "prediction" ? "prediction-action-note" : body.action === "image" ? "image-setup-note" : body.action === "update" ? "manual-update-note" : body.action === "decoded_limit" ? "decoded-limit-note" : body.action === "nightly_update" ? "nightly-state" : body.key ? `effect-${body.key}` : body.action === "color_theme" ? "terminal-color-note"
|
|
201
203
|
: body.action.startsWith("history_") ? "effect-history" : body.action === "prediction_fix" ? "prediction-note"
|
|
202
204
|
: body.operation === "switch" ? "source-control-note" : body.operation === "auto-review" ? "review-control-note"
|
|
203
205
|
: body.operation === "account" ? "m365-account-note" : "m365-control-note");
|
|
@@ -219,22 +221,26 @@
|
|
|
219
221
|
label(el("m365-account-note"), "company_account_checked");
|
|
220
222
|
}
|
|
221
223
|
if (body.action !== "color_theme") { await refreshStatus();await dashboardRefresh.refresh("auth", { force: true }); }
|
|
224
|
+
return data;
|
|
222
225
|
}
|
|
223
226
|
catch (error) {
|
|
224
227
|
if (settings) applySettings(settings);
|
|
225
228
|
if (body.operation === "account") { label(el("m365-account-note"), "company_account_not_saved", { reason: { key: accountReasons.has(error.code) ? error.code : error.message } });return; }
|
|
226
229
|
if (body.action === "color_theme") { label(el("terminal-color-note"), "not_saved_error", { error: error.message });return; }
|
|
227
|
-
|
|
230
|
+
if (error.code === "ccdx_prediction_app_open") label(note, error.code);
|
|
231
|
+
else note.textContent = error.message;
|
|
228
232
|
} finally {
|
|
229
233
|
settingsPending = false;controls.forEach(input => { input.disabled = false; });
|
|
230
234
|
syncAccountControls();
|
|
231
235
|
if (settings) for (const [key, value] of Object.entries(settings.effective)) if (value.locked) el(`setting-${key}`).disabled = true;
|
|
232
236
|
if (settings?.history.source === "environment") el("save-history").disabled = true;
|
|
233
237
|
el("apply-source").disabled = !sourceReady();el("source-model").disabled = !selectedSource()?.selection.models_required;syncReviewButton();
|
|
238
|
+
features?.render(settings, { notes: false });
|
|
234
239
|
button?.removeAttribute("aria-busy");
|
|
235
240
|
}
|
|
236
241
|
}
|
|
237
242
|
for (const input of document.querySelectorAll('[role=switch][id^="setting-"]')) input.addEventListener("change", () => {
|
|
243
|
+
if (input.id === "setting-prediction_enabled") return;
|
|
238
244
|
if (preferences && input.closest('[data-view="system"]')) return;
|
|
239
245
|
void change({ action: "preference", key: input.id.slice("setting-".length), value: input.checked }, input);
|
|
240
246
|
});
|
|
@@ -243,7 +249,7 @@
|
|
|
243
249
|
el("clean-history").addEventListener("click", () => {
|
|
244
250
|
if (window.confirm(globalThis.ccdxLanguage.format("clear_inactive_codex_conversation_data_older_continuation_ids_ma"))) void change({ action: "history_clean" }, el("clean-history"));
|
|
245
251
|
});
|
|
246
|
-
|
|
252
|
+
|
|
247
253
|
el("m365-enabled").addEventListener("change", () => {
|
|
248
254
|
const operation = el("m365-enabled").checked ? "on" : "off";
|
|
249
255
|
if (operation === "off" && !window.confirm(globalThis.ccdxLanguage.format("confirm_disable_m365"))) {
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
(() => {
|
|
2
|
+
function create({ element: el, change, localize }) {
|
|
3
|
+
let saved = null, imageDirty = false;
|
|
4
|
+
const prediction = operation => change({ action: "prediction", operation }, el("prediction-continue"));
|
|
5
|
+
el("setting-prediction_enabled").addEventListener("change", () => void prediction(el("setting-prediction_enabled").checked ? "enable" : "disable"));
|
|
6
|
+
el("prediction-continue").addEventListener("click", () => void prediction(saved?.features?.prediction?.enabled ? "enable" : "disable"));
|
|
7
|
+
el("fix-prediction").addEventListener("click", () => void prediction("repair"));
|
|
8
|
+
el("prediction-open").addEventListener("click", () => void prediction("open"));
|
|
9
|
+
el("prediction-setup").addEventListener("click", () => void prediction("setup"));
|
|
10
|
+
el("prediction-remove").addEventListener("click", () => { if (window.confirm(globalThis.ccdxLanguage.format("prediction_remove_confirm"))) void prediction("remove"); });
|
|
11
|
+
const imageInput = operation => ({ action: "image", operation, endpoint: el("image-setup-endpoint").value,
|
|
12
|
+
key: el("image-setup-key").value, model: el("image-setup-model").value || undefined });
|
|
13
|
+
el("image-setup-form").addEventListener("input", () => { imageDirty = true; });
|
|
14
|
+
el("image-setup-inspect").addEventListener("click", async () => {
|
|
15
|
+
const data = await change(imageInput("inspect"), el("image-setup-inspect"));
|
|
16
|
+
const result = data?.last_operation?.result;
|
|
17
|
+
if (!Array.isArray(result?.models)) return;
|
|
18
|
+
imageDirty = true;
|
|
19
|
+
const current = el("image-setup-model").value;
|
|
20
|
+
el("image-setup-model").replaceChildren(...result.models.map(id => { const item = document.createElement("option");item.value = item.textContent = id;return item; }));
|
|
21
|
+
if (result.models.includes(current)) el("image-setup-model").value = current;
|
|
22
|
+
localize(el("image-setup-note"), "image_models_ready");
|
|
23
|
+
});
|
|
24
|
+
el("image-setup-form").addEventListener("submit", async event => {
|
|
25
|
+
event.preventDefault();
|
|
26
|
+
const data = await change(imageInput("setup"), el("image-setup-save"));
|
|
27
|
+
if (data?.last_operation?.result?.configured) { imageDirty = false;el("image-setup-key").value = "";render(data);localize(el("image-setup-note"), "image_setup_saved"); }
|
|
28
|
+
});
|
|
29
|
+
el("image-setup-remove").addEventListener("click", async () => {
|
|
30
|
+
if (!window.confirm(globalThis.ccdxLanguage.format("image_remove_confirm"))) return;
|
|
31
|
+
const data = await change({ action: "image", operation: "remove" }, el("image-setup-remove"));
|
|
32
|
+
if (data) { imageDirty = false;el("image-setup-key").value = "";render(data); }
|
|
33
|
+
});
|
|
34
|
+
el("decoded-limit-save").addEventListener("click", () => void change({ action: "decoded_limit", mib: Number(el("decoded-limit").value) }, el("decoded-limit-save")));
|
|
35
|
+
el("decoded-limit-default").addEventListener("click", () => void change({ action: "decoded_limit", mib: null }, el("decoded-limit-default")));
|
|
36
|
+
el("install-update").addEventListener("click", () => {
|
|
37
|
+
if (window.confirm(globalThis.ccdxLanguage.format("update_install_confirm"))) void change({ action: "update", confirmed: true }, el("install-update"));
|
|
38
|
+
});
|
|
39
|
+
function render(data, { notes = true } = {}) {
|
|
40
|
+
if (!data) return;
|
|
41
|
+
saved = data;
|
|
42
|
+
const value = data.features?.prediction;
|
|
43
|
+
el("setting-prediction_enabled").checked = value?.enabled === true;
|
|
44
|
+
el("setting-prediction_enabled").disabled = !value || value.status === "unavailable";
|
|
45
|
+
const pending = value?.display_pending || value?.enabled && (!value.configured || value.display?.enabled === false);
|
|
46
|
+
el("prediction-continue").hidden = !pending;
|
|
47
|
+
el("prediction-open").disabled = !value?.configured;
|
|
48
|
+
el("prediction-remove").disabled = !value?.configured;
|
|
49
|
+
if (notes) localize(el("prediction-action-note"), !value ? "feature_unavailable" : value.status === "unavailable" ? "feature_read_failed" : pending ? "prediction_quit_continue" : value.enabled && value.bridge !== "running" ? "prediction_bridge_missing" : value.enabled ? "prediction_ready" : "prediction_disabled");
|
|
50
|
+
localize(el("effect-prediction_enabled"), pending ? "feature_pending" : value?.enabled ? "on" : "off");
|
|
51
|
+
const image = data.features?.image;
|
|
52
|
+
if (!imageDirty) {
|
|
53
|
+
el("image-setup-endpoint").value = image?.endpoint || "";
|
|
54
|
+
const option = document.createElement("option");option.value = option.textContent = image?.model || "";el("image-setup-model").replaceChildren(option);
|
|
55
|
+
}
|
|
56
|
+
el("image-setup-remove").disabled = !image?.configured;
|
|
57
|
+
const limit = data.decoded_body;
|
|
58
|
+
if (document.activeElement !== el("decoded-limit")) el("decoded-limit").value = limit?.bytes / 1048576 || 128;
|
|
59
|
+
el("decoded-limit").disabled = el("decoded-limit-save").disabled = el("decoded-limit-default").disabled = !limit || limit.source === "environment";
|
|
60
|
+
localize(el("decoded-limit-note"), limit?.source === "environment" ? "controlled_by_environment" : "next_ccdx_start");
|
|
61
|
+
el("install-update").disabled = !data.manual_update?.available;
|
|
62
|
+
const update = data.nightly_update;
|
|
63
|
+
if (notes) localize(el("manual-update-note"), !data.manual_update?.available ? "update_external_launch" : update?.manual ? `manual_update_${update.phase}` : "update_idle_switch");
|
|
64
|
+
}
|
|
65
|
+
return { render };
|
|
66
|
+
}
|
|
67
|
+
globalThis.ccdxDashboardFeatures = { create };
|
|
68
|
+
})();
|
package/src/dashboard/index.html
CHANGED
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
<script src="/animation.js" defer></script>
|
|
24
24
|
<script src="/ui.js" defer></script>
|
|
25
25
|
<script src="/preferences.js" defer></script>
|
|
26
|
+
<script src="/features.js" defer></script>
|
|
26
27
|
<script src="/console.js" defer></script>
|
|
27
28
|
<script src="/tools.js" defer></script>
|
|
28
29
|
<script src="/connections.js" defer></script>
|
|
@@ -119,15 +120,15 @@
|
|
|
119
120
|
</section>
|
|
120
121
|
<details class="panel dashboard-section" id="prediction-settings" open>
|
|
121
122
|
<summary class="panel-heading"><h2 data-i18n="codex_input_predictions">INPUT SUGGESTIONS</h2><span data-i18n="codex_only">CODEX ONLY</span></summary>
|
|
122
|
-
<div class="setting-row"><label for="setting-prediction_enabled" data-i18n="
|
|
123
|
-
<p class="hint"
|
|
123
|
+
<div class="setting-row"><label for="setting-prediction_enabled" data-i18n="predictions_enable">Input suggestions</label><input id="setting-prediction_enabled" type="checkbox" role="switch" disabled><span id="effect-prediction_enabled" class="hint" role="status"></span></div>
|
|
124
|
+
<p id="prediction-action-note" class="hint" role="status"></p><div class="section-actions"><button id="prediction-continue" type="button" data-i18n="feature_continue" hidden>Continue setup</button><button id="prediction-open" type="button" data-i18n="prediction_open">Open Codex</button></div>
|
|
124
125
|
<details class="tool-details"><summary data-i18n="status_and_repair">Status and repair</summary>
|
|
125
126
|
<dl class="stats"><div><dt data-i18n="prediction_integration_setup">Suggestion setup</dt><dd id="prediction-preference">—</dd></div><div><dt data-i18n="local_bridge">Local service</dt><dd id="prediction-bridge">—</dd></div><div><dt data-i18n="client_route">App settings requests</dt><dd id="prediction-route">—</dd></div><div><dt data-i18n="visible_candidate">Suggestion displayed</dt><dd id="prediction-candidate">—</dd></div></dl>
|
|
126
127
|
<p id="prediction-note" class="hint">—</p>
|
|
127
|
-
|
|
128
|
+
|
|
128
129
|
|
|
129
130
|
<div class="section-actions"><button id="fix-prediction" type="button" data-i18n="check_and_repair">Check and repair</button></div>
|
|
130
|
-
<
|
|
131
|
+
<button id="prediction-setup" type="button" data-i18n="prediction_setup_again">Set up again</button><button id="prediction-remove" type="button" data-i18n="feature_remove">Remove setup</button>
|
|
131
132
|
</details>
|
|
132
133
|
</details>
|
|
133
134
|
<details class="panel dashboard-section" id="additional-capabilities">
|
|
@@ -135,7 +136,7 @@
|
|
|
135
136
|
<strong id="image">—</strong><p id="image-detail" class="hint">—</p>
|
|
136
137
|
<div class="setting-row"><label for="setting-image_enabled" data-i18n="allow_new_image_calls">Allow image requests</label><input id="setting-image_enabled" type="checkbox" role="switch" disabled><span id="effect-image_enabled" class="hint" role="status"></span></div>
|
|
137
138
|
<p class="hint" data-i18n="pause_keeps_the_provider_configuration_running_calls_can_finish_">Existing image requests can finish after pausing.</p>
|
|
138
|
-
<details class="tool-details"><summary data-i18n="
|
|
139
|
+
<details class="tool-details" id="image-setup-panel"><summary data-i18n="image_setup">Configure image generation</summary><form id="image-setup-form"><div class="connection-fields"><label><span data-i18n="api_base">API address</span><input id="image-setup-endpoint" type="url" required maxlength="2048" autocomplete="off" spellcheck="false"></label><label>API Key<input id="image-setup-key" type="password" maxlength="8192" autocomplete="off"><span class="hint" data-i18n="image_key_keep">Leave empty to keep the key for the same address.</span></label><label><span data-i18n="model">Model</span><select id="image-setup-model" required></select></label></div><div class="section-actions"><button id="image-setup-inspect" type="button" data-i18n="api_read_models">Read models</button><button type="submit" id="image-setup-save" data-i18n="api_save">Save</button><button id="image-setup-remove" type="button" data-i18n="feature_remove">Remove setup</button></div></form><p id="image-setup-note" class="hint" role="status"></p></details>
|
|
139
140
|
</details>
|
|
140
141
|
<details class="panel dashboard-section" id="runtime-resources">
|
|
141
142
|
<summary data-i18n="codex_conversation_buffer">CONVERSATION BUFFER</summary>
|
|
@@ -284,8 +285,8 @@
|
|
|
284
285
|
</details>
|
|
285
286
|
<details class="panel dashboard-section"><summary data-i18n="more_checks_reports">MORE CHECKS AND REPORTS</summary>
|
|
286
287
|
<div class="section-actions"><button id="check-network" type="button" data-i18n="tools_network_check">Network settings</button></div><p id="network-check-result" class="hint" role="status"></p>
|
|
287
|
-
<h3 data-i18n="tools_compatibility">Model compatibility</h3><p class="hint" data-i18n="
|
|
288
|
-
<div class="tool-details"><h3 data-i18n="diagnostic_report">Diagnostic report</h3><p class="hint" data-i18n="tools_report_scope">Reports omit credentials, account details and chat content.</p><div class="section-actions"><button id="export-report" type="button" data-i18n="tools_export_report">Export report</button></div></div>
|
|
288
|
+
<h3 data-i18n="tools_compatibility">Model compatibility</h3><p class="hint" data-i18n="compatibility_scope">Tests Codex Responses, streaming and compaction. Uses quota.</p><p id="compatibility-note" class="hint" role="status"></p>
|
|
289
|
+
<div class="tool-details"><h3 data-i18n="diagnostic_report">Diagnostic report</h3><p class="hint" data-i18n="tools_report_scope">Reports omit credentials, account details and chat content.</p><div class="section-actions"><button id="check-compatibility" type="button" data-i18n="compatibility_test">Test Codex model compatibility</button><button id="export-report" type="button" data-i18n="tools_export_report">Export report</button></div></div>
|
|
289
290
|
</details>
|
|
290
291
|
</div>
|
|
291
292
|
<div data-view="usage" hidden>
|
|
@@ -427,7 +428,7 @@
|
|
|
427
428
|
<div id="nightly-rules" hidden><dl class="nightly-rules"><div><dt data-i18n="nightly_window">Update window</dt><dd data-i18n="nightly_window_value">00:00–04:00 · Local time</dd></div><div><dt data-i18n="nightly_when">When to update</dt><dd data-i18n="nightly_when_value">Idle for 10 minutes, after checks pass</dd></div><div><dt data-i18n="nightly_versions">Versions</dt><dd data-i18n="nightly_versions_value">Stable patches released at least 24 hours ago</dd></div><div><dt data-i18n="nightly_failure">If an update fails</dt><dd data-i18n="nightly_failure_value">Try restoring the previous version and pause this update</dd></div></dl></div>
|
|
428
429
|
</div>
|
|
429
430
|
<p id="update-state" class="hint" role="status" data-i18n="reading">READING</p>
|
|
430
|
-
<div id="update-command-row" class="update-command"><code id="update-command">ccdx update github</code><button type="button" id="copy-update" data-i18n="copy_command">Copy command</button></div>
|
|
431
|
+
<div class="section-actions"><button id="install-update" type="button" data-i18n="update_install_now" disabled>Install update</button><span id="manual-update-note" class="hint" role="status"></span></div><details class="tool-details" id="update-advanced"><summary data-i18n="advanced_terminal">Advanced: terminal commands</summary><div id="update-command-row" class="update-command"><code id="update-command">ccdx update github</code><button type="button" id="copy-update" data-i18n="copy_command">Copy command</button></div>
|
|
431
432
|
<p class="hint" data-i18n="update_restart">Run in your terminal, then restart CCDX.</p>
|
|
432
433
|
<p id="update-checked" class="refresh-time"></p>
|
|
433
434
|
<details class="update-install"><summary data-i18n="update_install_help">Update failed? View full installation commands</summary><p class="hint" data-i18n="update_install_hint">Download the official installer. No Git required.</p>
|
|
@@ -435,7 +436,7 @@
|
|
|
435
436
|
<div class="install-command-heading"><span id="install-shell" class="hint">macOS · Terminal</span><button type="button" id="copy-install" data-i18n="copy_command">Copy command</button></div><pre id="install-command" class="install-command"></pre>
|
|
436
437
|
<p class="hint" data-i18n="update_install_policy">Reuses compatible Node/npm or installs a private runtime. Keeps your registry, proxy, certificates and shell policy.</p>
|
|
437
438
|
<p id="install-windows-policy" class="hint" hidden data-i18n="update_windows_policy">If scripts are blocked, use your company’s approved installation method.</p>
|
|
438
|
-
</details><p id="update-copy-note" class="hint" role="status"></p>
|
|
439
|
+
</details></details><p id="update-copy-note" class="hint" role="status"></p>
|
|
439
440
|
</section>
|
|
440
441
|
<section class="panel dashboard-section" id="privacy-settings" aria-labelledby="privacy-heading">
|
|
441
442
|
<h2 id="privacy-heading" data-i18n="privacy_heading">ADVANCED</h2>
|
|
@@ -449,6 +450,7 @@
|
|
|
449
450
|
<div class="section-actions"><button id="privacy-cancel" type="button" hidden data-i18n="cancel">Cancel</button><button id="privacy-retry" type="button" hidden data-i18n="view_retry">Retry</button><button id="privacy-remove" type="button" hidden data-i18n="privacy_remove">Delete model</button><p id="privacy-error" class="hint" role="alert"></p></div>
|
|
450
451
|
</section>
|
|
451
452
|
<dialog id="privacy-dialog" class="preferences-dialog" aria-labelledby="privacy-dialog-title"><h2 id="privacy-dialog-title" data-i18n="privacy_enable">Local masking</h2><p data-i18n="privacy_download">Downloads about 39 MB plus the local component. Checks may add delay or mistake ordinary text.</p><p data-i18n="privacy_fail_closed">If a check cannot finish, the request is not sent.</p><div class="section-actions"><button id="privacy-dialog-cancel" type="button" data-i18n="cancel">Cancel</button><button id="privacy-dialog-confirm" type="button" data-i18n="privacy_confirm">Download & enable</button></div></dialog>
|
|
453
|
+
<details class="panel dashboard-section" id="request-limits"><summary data-i18n="advanced_limits">Advanced: request limits</summary><div class="section-actions"><label><span data-i18n="decoded_limit">Decoded request limit (MiB)</span><input id="decoded-limit" type="number" min="128" max="512" step="1"></label><button id="decoded-limit-save" type="button" data-i18n="api_save">Save</button><button id="decoded-limit-default" type="button" data-i18n="limit_default">Use default</button></div><p id="decoded-limit-note" class="hint" role="status"></p></details>
|
|
452
454
|
<section class="panel dashboard-section" id="settings-preferences" aria-labelledby="preferences-heading">
|
|
453
455
|
<h2 id="preferences-heading" data-i18n="preferences_heading">SAVE & RESTORE</h2>
|
|
454
456
|
<div class="preferences-row"><div><label for="preferences-auto" data-i18n="preferences_auto">Save changes automatically</label><p class="hint" data-i18n="preferences_auto_hint">Valid changes on this page save automatically.</p></div><input id="preferences-auto" type="checkbox" role="switch" disabled checked></div>
|
|
@@ -1,5 +1,42 @@
|
|
|
1
1
|
(() => {
|
|
2
2
|
const translations = {
|
|
3
|
+
limit_default: ["Use default", "使用默认值"],
|
|
4
|
+
ccdx_prediction_app_open: ["Quit Codex, then continue setup here.", "请退出 Codex,再在此继续配置。"], feature_read_failed: ["Settings could not be read. Existing files were preserved.", "无法读取设置,原有文件已保留。"],
|
|
5
|
+
prediction_setup_again: ["Set up again", "重新配置"], prediction_bridge_missing: ["Not ready. Check and repair, or quit Codex and set up again.", "尚未就绪。请检查修复,或退出 Codex 后重新配置。"],
|
|
6
|
+
predictions_enable: ["Input suggestions", "输入建议"],
|
|
7
|
+
feature_continue: ["Continue setup", "继续配置"],
|
|
8
|
+
prediction_open: ["Open Codex", "打开 Codex"],
|
|
9
|
+
feature_remove: ["Remove setup", "移除接入"],
|
|
10
|
+
image_setup: ["Configure image generation", "配置图片生成"],
|
|
11
|
+
image_key_keep: ["Leave empty to keep the key for the same address.", "同一地址留空可保留原密钥。"],
|
|
12
|
+
update_install_now: ["Install update", "安装更新"],
|
|
13
|
+
advanced_terminal: ["Advanced: terminal commands", "高级:终端命令"],
|
|
14
|
+
compatibility_test: ["Test Codex model compatibility", "测试 Codex 模型兼容性"],
|
|
15
|
+
compatibility_scope: ["Tests Codex Responses, streaming and compaction. Uses quota.", "测试 Codex Responses、流式响应与压缩,会消耗用量。"],
|
|
16
|
+
advanced_limits: ["Advanced: request limits", "高级:请求限制"],
|
|
17
|
+
decoded_limit: ["Decoded request limit (MiB)", "解码后请求上限(MiB)"],
|
|
18
|
+
prediction_remove_confirm: ["Remove the CCDX prediction trust and route? Quit Codex to finish cleanup.", "移除 CCDX 预测信任与路由?退出 Codex 后才能完成清理。"],
|
|
19
|
+
image_remove_confirm: ["Remove the image service key and CCDX image integration?", "移除图片服务密钥与 CCDX 图片接入?"],
|
|
20
|
+
update_install_confirm: ["Install the latest stable release and switch CCDX when idle? Active work postpones the switch.", "安装最新稳定版并在空闲时切换 CCDX?有执行中的工作时会推迟切换。"],
|
|
21
|
+
image_models_ready: ["Models read. Choose a model, then save.", "已读取模型。选择模型后保存。"],
|
|
22
|
+
image_setup_saved: ["Image generation configured. Existing App tasks may need to refresh their tools.", "图片生成已配置。现有 App 任务可能需要刷新工具。"],
|
|
23
|
+
feature_unavailable: ["Restart the updated CCDX to use these controls.", "重启更新后的 CCDX 以使用这些控制。"],
|
|
24
|
+
prediction_quit_continue: ["Quit Codex, then continue setup here. No terminal command is needed.", "请退出 Codex,再在此继续配置。无需终端命令。"],
|
|
25
|
+
prediction_ready: ["Enabled. App and thread eligibility still apply.", "已开启。仍受 App 与会话适用条件限制。"],
|
|
26
|
+
prediction_disabled: ["Disabled. Cached suggestions may require a normal App restart to clear.", "已关闭。缓存建议可能需要正常重开 App 才会清除。"],
|
|
27
|
+
feature_pending: ["Waiting for Codex to close", "等待 Codex 退出"],
|
|
28
|
+
update_external_launch: ["This launch cannot update itself. Use the installer or the installed CCDX command.", "此启动方式无法自行更新。请使用安装器或已安装的 CCDX 命令。"],
|
|
29
|
+
update_idle_switch: ["Switches the service only when idle.", "仅在空闲时切换服务。"],
|
|
30
|
+
manual_update_checking: ["Checking the release…", "正在检查版本…"],
|
|
31
|
+
manual_update_preparing: ["Downloading and verifying…", "正在下载与验证…"],
|
|
32
|
+
manual_update_switching: ["Switching the service…", "正在切换服务…"],
|
|
33
|
+
manual_update_updated: ["Update completed.", "更新完成。"],
|
|
34
|
+
manual_update_current: ["Already current.", "已是最新版。"],
|
|
35
|
+
manual_update_deferred: ["Active work postponed this update. Try again when idle.", "执行中的工作推迟了更新。空闲后请重试。"],
|
|
36
|
+
manual_update_failed: ["Update failed; check the diagnostic report.", "更新失败,请查看诊断报告。"],
|
|
37
|
+
api_remove_source: ["Delete API", "删除 API"],
|
|
38
|
+
api_remove_source_confirm: ["Delete this disabled API and its saved key?", "删除此已停用 API 及其保存的密钥?"],
|
|
39
|
+
|
|
3
40
|
privacy_heading: ["ADVANCED", "高级"], privacy_enable: ["Local masking", "本地脱敏"], privacy_scope: ["Conversation and tool text. Images and predictions keep their current behavior.", "检查对话和工具文本。图片与预测保持原有行为。"], privacy_state_checking: ["On · checking locally", "已开启 · 本地检查中"],
|
|
4
41
|
privacy_personal: ["Include personal information", "同时保护个人信息"], privacy_personal_hint: ["Names and addresses may be mistaken for code.", "姓名和地址可能与代码混淆。"], privacy_try: ["Try locally", "本地试用"], privacy_sample: ["Sample text", "试用文本"], privacy_check: ["Check text", "检查文本"], privacy_remove: ["Delete model", "删除模型"],
|
|
5
42
|
privacy_download: ["Downloads about 39 MB plus the local component. Checks may add delay or mistake ordinary text.", "下载约 39 MB 模型及本地组件。检查可能增加等待或误识别。"], privacy_fail_closed: ["If a check cannot finish, the request is not sent.", "检查未完成时,请求不会发出。"], privacy_confirm: ["Download & enable", "下载并开启"],
|
|
@@ -142,6 +179,7 @@
|
|
|
142
179
|
"output_used": ["Returned output tokens", "返回输出用量"],
|
|
143
180
|
"stop_reason": ["Stop reason", "停止原因"],
|
|
144
181
|
"transport": ["Network details", "网络详情"],
|
|
182
|
+
"client_tool_errors_received": ["Client-reported tool errors", "客户端回传的工具错误"],
|
|
145
183
|
"output_limit_reached": ["Output limit reached.", "本次生成达到输出上限。"],
|
|
146
184
|
"source_connection_failed": ["Connection to the model source failed.", "与模型来源的连接失败。"],
|
|
147
185
|
"issue_category": ["Issue category", "问题分类"],
|
|
@@ -355,8 +393,8 @@
|
|
|
355
393
|
"flow_count": ["{count} requests", "{count} 个请求"],
|
|
356
394
|
"flow_count_lower": ["≥{count} requests", "≥{count} 个请求"],
|
|
357
395
|
"flow_app_codex": ["Codex", "Codex"],
|
|
358
|
-
"prediction_first_setup": ["Quit Codex before first setup: ccdx prediction
|
|
359
|
-
"image_first_setup": ["First setup: ccdx
|
|
396
|
+
"prediction_first_setup": ["Quit Codex before first setup: ccdx app codex prediction setup", "首次配置前请退出 Codex:ccdx app codex prediction setup"],
|
|
397
|
+
"image_first_setup": ["First setup: ccdx app codex image setup", "首次配置:ccdx app codex image setup"],
|
|
360
398
|
"record_scope": ["Record scope", "记录范围"],
|
|
361
399
|
"estimated_percentiles": ["Approx. first-output P50 / P95", "首个输出 P50 / P95(约)"],
|
|
362
400
|
"percentile_values": ["{p50} / {p95} ms · {samples} samples", "{p50} / {p95} ms · {samples} 次样本"],
|
|
@@ -740,7 +778,7 @@
|
|
|
740
778
|
"local_bridge": ["Local service", "本机服务"],
|
|
741
779
|
"client_route": ["App settings requests", "应用请求"],
|
|
742
780
|
"visible_candidate": ["Suggestion displayed", "建议显示"],
|
|
743
|
-
"configured_does_not_mean_displayed_use_ccdx_prediction_status_fo": ["Check suggestion status: ccdx prediction status", "检查建议状态:ccdx prediction status"],
|
|
781
|
+
"configured_does_not_mean_displayed_use_ccdx_prediction_status_fo": ["Check suggestion status: ccdx app codex prediction status", "检查建议状态:ccdx app codex prediction status"],
|
|
744
782
|
"enabled": ["Enabled", "已开启"],
|
|
745
783
|
"disabled": ["Disabled", "已关闭"],
|
|
746
784
|
"running_f4cca": ["Running", "运行中"],
|
|
@@ -900,7 +938,7 @@
|
|
|
900
938
|
"unconfirmed": ["NOT CONFIRMED", "未确认"],
|
|
901
939
|
"service_token_ttl_duration": ["Sign-in valid for {duration}", "登录信息剩余有效期:{duration}"],
|
|
902
940
|
"service_token_not_cached": ["No saved access details.", "暂无已保存的访问信息。"],
|
|
903
|
-
"source_source_live_ccdx_models": ["
|
|
941
|
+
"source_source_live_ccdx_models": ["Catalog source: {source}", "列表来源:{source}"],
|
|
904
942
|
"built_in": ["built-in list", "内置列表"],
|
|
905
943
|
"cache": ["existing list", "已有列表"],
|
|
906
944
|
"live": ["online list", "在线列表"],
|
|
@@ -911,7 +949,7 @@
|
|
|
911
949
|
"count_succeeded": ["{count} succeeded", "成功:{count}次"],
|
|
912
950
|
"not_initialized": ["NOT CONFIRMED", "未确认"],
|
|
913
951
|
"active_active_failed_failed_delivery_failures_delivery": ["Running: {active} / generation failed: {failed}\nFile delivery failed: {delivery}", "进行中:{active}/生成失败:{failed}\n文件交付失败:{delivery}"],
|
|
914
|
-
"setup_state_unknown_ccdx_image_status": ["
|
|
952
|
+
"setup_state_unknown_ccdx_image_status": ["Use Configure image generation below.", "请在下方配置图片生成。"],
|
|
915
953
|
"snapshot_time": ["Status updated {time}", "状态更新:{time}"],
|
|
916
954
|
"status_unavailable_check_ccdx_then_refresh": ["Cannot read status. Check CCDX and refresh.", "无法读取状态。\n请检查 CCDX 后刷新。"],
|
|
917
955
|
"count_retained_requests_events": ["{count} records retained", "保留:{count}条"],
|
|
@@ -978,13 +1016,13 @@
|
|
|
978
1016
|
"log_unavailable": ["READ FAILED", "读取失败"],
|
|
979
1017
|
"no_usage_summary_available": ["Cannot read usage records.", "无法读取用量记录。"],
|
|
980
1018
|
"analytics_unavailable_refresh_usage_to_retry": ["Trends unavailable. Refresh Model usage to retry.", "统计失败,请刷新用量。"],
|
|
981
|
-
"animation_settings_are_invalid_inspect_them_with_ccdx_animation": ["
|
|
982
|
-
"animation_setting_was_not_saved_check_ccdx_animation": ["
|
|
1019
|
+
"animation_settings_are_invalid_inspect_them_with_ccdx_animation": ["Animation setting is invalid. Choose a style here.", "动效设置无效,请在此重新选择样式。"],
|
|
1020
|
+
"animation_setting_was_not_saved_check_ccdx_animation": ["Animation was not saved. Check the selection and retry.", "动效未保存,请检查选择后重试。"],
|
|
983
1021
|
"could_not_read_local_usage_summary": ["Cannot read usage. Refresh to retry.", "无法读取用量,请刷新。"],
|
|
984
|
-
"live_model_lookup_timed_out_retry_or_run_ccdx_models": ["Model lookup timed out.
|
|
985
|
-
"github_token_not_found_start_ccdx_to_sign_in": ["
|
|
986
|
-
"live_model_lookup_failed_run_ccdx_models_for_details": ["Could not get models
|
|
987
|
-
"live_model_lookup_failed_http_status_run_ccdx_models_for_details": ["Model lookup failed: HTTP {status}
|
|
1022
|
+
"live_model_lookup_timed_out_retry_or_run_ccdx_models": ["Model lookup timed out. Refresh the selected source.", "模型查询超时,请刷新所选来源。"],
|
|
1023
|
+
"github_token_not_found_start_ccdx_to_sign_in": ["Sign in under Model sources → GitHub.", "请在模型来源 → GitHub 中登录。"],
|
|
1024
|
+
"live_model_lookup_failed_run_ccdx_models_for_details": ["Could not get models. Check the selected source.", "模型查询失败,请检查所选来源。"],
|
|
1025
|
+
"live_model_lookup_failed_http_status_run_ccdx_models_for_details": ["Model lookup failed: HTTP {status}. Check the selected source.", "模型查询失败:HTTP {status},请检查所选来源。"],
|
|
988
1026
|
"select_a_listed_animation_theme": ["Choose an animation from the list.", "请选择列表中的动效。"],
|
|
989
1027
|
"animation_changes_require_the_same_origin_dashboard": ["Save from this computer’s dashboard.", "请从本机面板保存动效。"],
|
|
990
1028
|
"animation_changes_require_application_json": ["Invalid save format.", "保存格式有误。"],
|
|
@@ -1058,8 +1096,8 @@
|
|
|
1058
1096
|
"Buffer limit MiB": "buffer_limit_mib",
|
|
1059
1097
|
"Apply limit": "apply_limit",
|
|
1060
1098
|
"Clear inactive buffer": "clear_inactive_buffer",
|
|
1061
|
-
"Pause keeps the provider configuration. Running calls can finish. First-time setup: ccdx
|
|
1062
|
-
"Pause keeps the existing trust and route. Codex may retain cached suggestions. First-time setup: quit Codex, then ccdx prediction
|
|
1099
|
+
"Pause keeps the provider configuration. Running calls can finish. First-time setup: ccdx app codex image setup.": "pause_keeps_the_provider_configuration_running_calls_can_finish_",
|
|
1100
|
+
"Pause keeps the existing trust and route. Codex may retain cached suggestions. First-time setup: quit Codex, then ccdx app codex prediction setup.": "pause_keeps_the_existing_trust_and_route_codex_may_retain_cached",
|
|
1063
1101
|
"SERVICE SETTINGS": "service_settings",
|
|
1064
1102
|
"Saved preference and effective state are separate. Environment overrides and client restarts are shown explicitly.": "saved_preference_and_effective_state_are_separate_environment_ov",
|
|
1065
1103
|
"Terminal animation": "terminal_animation",
|
|
@@ -1141,7 +1179,7 @@
|
|
|
1141
1179
|
"Local bridge": "local_bridge",
|
|
1142
1180
|
"Client route": "client_route",
|
|
1143
1181
|
"Visible candidate": "visible_candidate",
|
|
1144
|
-
"Configured does not mean displayed. Use ccdx prediction status for details.": "configured_does_not_mean_displayed_use_ccdx_prediction_status_fo",
|
|
1182
|
+
"Configured does not mean displayed. Use ccdx app codex prediction status for details.": "configured_does_not_mean_displayed_use_ccdx_prediction_status_fo",
|
|
1145
1183
|
"Enabled": "enabled",
|
|
1146
1184
|
"Disabled": "disabled",
|
|
1147
1185
|
"Running": "running_f4cca",
|
|
@@ -1394,6 +1432,11 @@
|
|
|
1394
1432
|
"GitHub token not found. Start ccdx to sign in.": "github_token_not_found_start_ccdx_to_sign_in",
|
|
1395
1433
|
"Live model lookup failed. Run ccdx models for details.": "live_model_lookup_failed_run_ccdx_models_for_details",
|
|
1396
1434
|
"Live model lookup failed (HTTP {status}). Run ccdx models for details.": "live_model_lookup_failed_http_status_run_ccdx_models_for_details",
|
|
1435
|
+
"Live model lookup timed out. Retry or run ccdx app codex models.": "live_model_lookup_timed_out_retry_or_run_ccdx_models",
|
|
1436
|
+
"Live model lookup failed. Run ccdx app codex models for details.": "live_model_lookup_failed_run_ccdx_models_for_details",
|
|
1437
|
+
"Live model lookup failed (HTTP {status}). Run ccdx app codex models for details.": "live_model_lookup_failed_http_status_run_ccdx_models_for_details",
|
|
1438
|
+
"Animation settings are invalid; inspect them with ccdx config animation": "animation_settings_are_invalid_inspect_them_with_ccdx_animation",
|
|
1439
|
+
"Animation setting was not saved; check ccdx config animation": "animation_setting_was_not_saved_check_ccdx_animation",
|
|
1397
1440
|
"Select a listed animation theme": "select_a_listed_animation_theme",
|
|
1398
1441
|
"Animation changes require the same-origin dashboard": "animation_changes_require_the_same_origin_dashboard",
|
|
1399
1442
|
"Animation changes require application/json": "animation_changes_require_application_json",
|
package/src/dashboard/status.js
CHANGED
|
@@ -389,7 +389,8 @@
|
|
|
389
389
|
["time", Number.isFinite(at) ? time(at, { date: true }) : "—"],
|
|
390
390
|
["wire_mib", finite(context.payload_bytes) ? `${(Number(context.payload_bytes) / 1048576).toFixed(2)} MiB` : "—"],
|
|
391
391
|
["images", number(context.images)], ["model_window", number(context.context_window_tokens)], ["input_window", ratio],
|
|
392
|
-
["output_requested", number(context.max_output_tokens_requested)], ["output_sent", number(context.max_output_tokens_sent)], ["output_used", number(context.output_tokens)], ["stop_reason", request.stop_reason || "—"]
|
|
392
|
+
["output_requested", number(context.max_output_tokens_requested)], ["output_sent", number(context.max_output_tokens_sent)], ["output_used", number(context.output_tokens)], ["stop_reason", request.stop_reason || "—"],
|
|
393
|
+
...(context.client_tool_errors_received > 0 ? [["client_tool_errors_received", number(context.client_tool_errors_received)]] : [])]) {
|
|
393
394
|
const term = document.createElement("dt"), detail = document.createElement("dd");localize(term, key);detail.textContent = value;fields.append(term, detail);
|
|
394
395
|
}
|
|
395
396
|
row.children[5].append(details);body.append(row);
|
package/src/dashboard/tools.js
CHANGED
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
async function api(path, body) {
|
|
44
44
|
const response = await fetch(`/_ccdx/ui/${path}`, { method: body ? "POST" : "GET", cache: "no-store",
|
|
45
45
|
headers: { "X-CCDX-Dashboard": "1", ...(body ? { "Content-Type": "application/json" } : {}) },
|
|
46
|
-
...(body ? { body: JSON.stringify(body) } : {}), signal: AbortSignal.timeout(35000) });
|
|
46
|
+
...(body ? { body: JSON.stringify(body) } : {}), signal: AbortSignal.timeout(body?.action === "compatibility" ? 600000 : 35000) });
|
|
47
47
|
const data = await response.json();
|
|
48
48
|
if (!response.ok) throw Object.assign(new Error("tools_action_failed"), { code: data.code || "tools_action_failed" });
|
|
49
49
|
return data;
|
|
@@ -165,6 +165,8 @@
|
|
|
165
165
|
field(fields, "tools_backup", data.backup);
|
|
166
166
|
el("config-preview-details").textContent = data.checks.map(check => check.message).join("\n");
|
|
167
167
|
text("checks-note", "tools_review_repair");
|
|
168
|
+
} else if (action.action === "compatibility") {
|
|
169
|
+
el("compatibility-note").textContent = (data.checks || []).map(check => check.message).join(" · ");
|
|
168
170
|
} else if (action.action === "repair") {
|
|
169
171
|
el("config-repair-preview").hidden = true;repairPreview = null;
|
|
170
172
|
if (data.local?.checked_at) renderChecks(data.local);
|
|
@@ -181,6 +183,7 @@
|
|
|
181
183
|
for (const [id, action] of [["check-local", "check"], ["check-network", "network"], ["export-report", "report"], ["preview-config-repair", "preview"]]) {
|
|
182
184
|
el(id).addEventListener("click", () => void localAction({ action }, el(id)));
|
|
183
185
|
}
|
|
186
|
+
el("check-compatibility")?.addEventListener("click", () => { if (window.confirm(language.format("compatibility_scope"))) void localAction({ action: "compatibility", confirmed: true }, el("check-compatibility")); });
|
|
184
187
|
el("apply-config-repair").addEventListener("click", () => { if (repairPreview) void localAction({ action: "repair", revision: repairPreview.revision }, el("apply-config-repair")); });
|
|
185
188
|
el("cancel-config-repair").addEventListener("click", () => { repairPreview = null;el("config-repair-preview").hidden = true; });
|
|
186
189
|
el("check-account-link").addEventListener("click", () => { chooseProvider("github");location.hash = "models"; });
|
package/src/dashboard/ui.js
CHANGED
|
@@ -339,7 +339,7 @@ const dashboardRefresh = globalThis.ccdxRefresh.createController({
|
|
|
339
339
|
if (!state.error) catalogReadDetails(evidence);
|
|
340
340
|
if (state.error) {
|
|
341
341
|
const message = String(state.error.message || state.error).slice(0, 240);
|
|
342
|
-
const httpError = /^Live model lookup failed \(HTTP (\d{3})\)\. Run ccdx models for details\.$/.exec(message);
|
|
342
|
+
const httpError = /^Live model lookup failed \(HTTP (\d{3})\)\. Run ccdx (?:app codex )?models for details\.$/.exec(message);
|
|
343
343
|
const sourceReason = /^Model catalog unavailable \/ (m365_[a-z0-9_]+)$/.exec(message);
|
|
344
344
|
const diagnostic = state.error.diagnostic || {}, network = diagnostic.network, catalog = diagnostic.catalog;
|
|
345
345
|
const reason = catalog ? phrase(`catalog_cause_${catalog.cause_code}`) : network ? phrase(`network_cause_${network.cause_code}`) : httpError ? phrase("live_model_lookup_failed_http_status_run_ccdx_models_for_details", { status: httpError[1] })
|
package/src/dashboard-api.mjs
CHANGED
|
@@ -237,12 +237,12 @@ export async function handleDashboardApi(req, res, pathname, {
|
|
|
237
237
|
if (!/^application\/json(?:\s*;|$)/i.test(req.headers["content-type"] || "")) { sendJson(res, 415, { error: "Expected application/json" });return; }
|
|
238
238
|
const abort = createRequestAbort(req, res);abort.setTimeout(5000, "request_body_timeout");
|
|
239
239
|
try {
|
|
240
|
-
const input = await readJsonBody(req, { maxBodyBytes:
|
|
240
|
+
const input = await readJsonBody(req, { maxBodyBytes: 16384, maxDecodedBodyBytes: 16384, signal: abort.signal });
|
|
241
241
|
abort.clearTimeout();const data = await serviceControl.action(input);
|
|
242
242
|
if (!res.destroyed && !res.writableEnded) sendJson(res, 200, data);
|
|
243
243
|
} catch (error) {
|
|
244
244
|
sendJson(res, error.statusCode || (error.code?.startsWith("ccdx_cache_") ? 409 : 400), { error: safeText(error.message, 300),
|
|
245
|
-
...(/^(?:m365_[a-z_]+|ccdx_settings_[a-z_]
|
|
245
|
+
...(/^(?:m365_[a-z_]+|ccdx_settings_[a-z_]+|ccdx_prediction_app_open)$/.test(error.code || "") ? { code: error.code } : {}) });
|
|
246
246
|
} finally { abort.cleanup(); }
|
|
247
247
|
return;
|
|
248
248
|
}
|
package/src/dashboard-tools.mjs
CHANGED
|
@@ -24,12 +24,13 @@ export function createDashboardTools(options = {}) {
|
|
|
24
24
|
const input = await readJsonBody(req, { maxBodyBytes: 4096, maxDecodedBodyBytes: 4096, signal: abort.signal });
|
|
25
25
|
abort.clearTimeout();
|
|
26
26
|
const fields = account ? { check: ["action"], start: ["action", "reauth"], cancel: ["action", "id"], logout: ["action", "confirmed"], reload: ["action"] }
|
|
27
|
-
: { check: ["action"], preview: ["action"], repair: ["action", "revision"], network: ["action"], report: ["action"] };
|
|
27
|
+
: { check: ["action"], preview: ["action"], repair: ["action", "revision"], network: ["action"], report: ["action"], compatibility: ["action", "confirmed"] };
|
|
28
28
|
const allowed = input && typeof input === "object" && !Array.isArray(input) && fields[input.action];
|
|
29
29
|
if (!allowed || Object.keys(input).some(key => !allowed.includes(key)) || (input.action === "start" && input.reauth !== undefined && typeof input.reauth !== "boolean")) {
|
|
30
30
|
sendJson(res, 400, { error: "tools_invalid_action", code: "tools_invalid_action" });return;
|
|
31
31
|
}
|
|
32
32
|
const target = account ? accounts : local;
|
|
33
|
+
if (input.action === "compatibility" && input.confirmed !== true) { sendJson(res, 400, { error: "Confirm model requests and quota use" });return; }
|
|
33
34
|
if (!account && input.action === "report" && !local.snapshot().checked_at) await local.check();
|
|
34
35
|
const value = await (input.action === "start" ? target.start({ reauth: input.reauth })
|
|
35
36
|
: input.action === "cancel" ? target.cancel(input.id) : input.action === "logout" ? target.logout(input)
|
package/src/dashboard.mjs
CHANGED
|
@@ -13,6 +13,7 @@ const ASSETS = new Map([
|
|
|
13
13
|
["/ui.js", ["./dashboard/ui.js", "text/javascript; charset=utf-8"]],
|
|
14
14
|
["/console.js", ["./dashboard/console.js", "text/javascript; charset=utf-8"]],
|
|
15
15
|
["/updates.js", ["./dashboard/updates.js", "text/javascript; charset=utf-8"]],
|
|
16
|
+
["/features.js", ["./dashboard/features.js", "text/javascript; charset=utf-8"]],
|
|
16
17
|
["/preferences.js", ["./dashboard/preferences.js", "text/javascript; charset=utf-8"]],
|
|
17
18
|
["/time.js", ["./dashboard/time.js", "text/javascript; charset=utf-8"]],
|
|
18
19
|
["/view-boundary.js", ["./dashboard/view-boundary.js", "text/javascript; charset=utf-8"]],
|
package/src/doctor-compat.mjs
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { CODEX_AUTO_REVIEW_MODEL } from "./models.mjs";
|
|
2
2
|
import { readBoundedResponseText } from "./upstream-body.mjs";
|
|
3
|
+
import { readClientGatewayKeys } from "./client-gateway-keys.mjs";
|
|
4
|
+
import { isLoopbackHost } from "./security.mjs";
|
|
5
|
+
import { redactDiagnosticText } from "./diagnostic-text.mjs";
|
|
3
6
|
|
|
4
7
|
function localGatewayBaseUrl(host, port) {
|
|
5
8
|
const normalized = host === "0.0.0.0" ? "127.0.0.1" : host === "::" ? "::1" : host;
|
|
@@ -20,10 +23,8 @@ export function selectCompatibilityModels(models) {
|
|
|
20
23
|
const candidates = copilotModelData(models)
|
|
21
24
|
.filter((model) => model?.model_picker_enabled !== false)
|
|
22
25
|
.filter((model) => {
|
|
23
|
-
const id = String(model?.id || "");
|
|
24
26
|
const endpoints = modelEndpoints(model);
|
|
25
|
-
return
|
|
26
|
-
&& (endpoints.includes("/responses") || endpoints.includes("/v1/responses"));
|
|
27
|
+
return endpoints.includes("/responses") || endpoints.includes("/v1/responses");
|
|
27
28
|
});
|
|
28
29
|
const responsesOnly = [...candidates].reverse()
|
|
29
30
|
.find((model) => !modelEndpoints(model).includes("/chat/completions"));
|
|
@@ -34,7 +35,7 @@ async function fetchTextWithTimeout(fetchImpl, url, init, timeoutMs) {
|
|
|
34
35
|
const controller = new AbortController();
|
|
35
36
|
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
36
37
|
try {
|
|
37
|
-
const resp = await fetchImpl(url, { ...init, signal: controller.signal });
|
|
38
|
+
const resp = await fetchImpl(url, { ...init, redirect: "error", signal: controller.signal });
|
|
38
39
|
return { resp, text: await readBoundedResponseText(resp, { maxBytes: 4 * 1024 * 1024, signal: controller.signal, label: "Doctor response" }) };
|
|
39
40
|
} finally {
|
|
40
41
|
clearTimeout(timer);
|
|
@@ -42,14 +43,14 @@ async function fetchTextWithTimeout(fetchImpl, url, init, timeoutMs) {
|
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
function responseFailure(resp, text) {
|
|
45
|
-
const detail = String(text || "").replace(/\s+/g, " ").trim().slice(0, 240);
|
|
46
|
+
const detail = redactDiagnosticText(String(text || "")).replace(/\s+/g, " ").trim().slice(0, 240);
|
|
46
47
|
return new Error(`HTTP ${resp.status}${detail ? `: ${detail}` : ""}`);
|
|
47
48
|
}
|
|
48
49
|
|
|
49
|
-
async function compatibilityRequest(fetchImpl, url, body, timeoutMs) {
|
|
50
|
+
async function compatibilityRequest(fetchImpl, url, body, timeoutMs, headers) {
|
|
50
51
|
const { resp, text } = await fetchTextWithTimeout(fetchImpl, url, {
|
|
51
52
|
method: "POST",
|
|
52
|
-
headers: { "Content-Type": "application/json", Accept: body.stream ? "text/event-stream" : "application/json" },
|
|
53
|
+
headers: { ...headers, "Content-Type": "application/json", Accept: body.stream ? "text/event-stream" : "application/json" },
|
|
53
54
|
body: JSON.stringify(body),
|
|
54
55
|
}, timeoutMs);
|
|
55
56
|
if (!resp.ok) throw responseFailure(resp, text);
|
|
@@ -92,11 +93,16 @@ export async function inspectAdapterCompatibility({
|
|
|
92
93
|
port = 2026,
|
|
93
94
|
fetchImpl = fetch,
|
|
94
95
|
timeoutMs = 120000,
|
|
96
|
+
home, env = process.env,
|
|
95
97
|
} = {}) {
|
|
96
98
|
const baseUrl = localGatewayBaseUrl(host, port);
|
|
99
|
+
let headers = {};
|
|
100
|
+
if (isLoopbackHost(new URL(baseUrl).hostname)) {
|
|
101
|
+
try { headers = { Authorization: `Bearer ${readClientGatewayKeys({ home, env, create: false }).codex}` }; } catch { /* Unconfigured credentials remain a normal access-check failure. */ }
|
|
102
|
+
}
|
|
97
103
|
const checks = [];
|
|
98
104
|
const models = await runCompatibilityCheck(checks, "Compatibility model discovery", async () => {
|
|
99
|
-
const { resp, text } = await fetchTextWithTimeout(fetchImpl, `${baseUrl}/v1/models`, { headers: { Accept: "application/json" } }, timeoutMs);
|
|
105
|
+
const { resp, text } = await fetchTextWithTimeout(fetchImpl, `${baseUrl}/v1/models`, { headers: { ...headers, Accept: "application/json" } }, timeoutMs);
|
|
100
106
|
if (!resp.ok) throw responseFailure(resp, text);
|
|
101
107
|
const parsed = JSON.parse(text);
|
|
102
108
|
if (!copilotModelData(parsed).length) throw new Error("model list is empty");
|
|
@@ -106,7 +112,7 @@ export async function inspectAdapterCompatibility({
|
|
|
106
112
|
|
|
107
113
|
const { responsesModel } = selectCompatibilityModels(models);
|
|
108
114
|
if (!responsesModel) {
|
|
109
|
-
checks.push({ kind: "err", message: "Compatibility Responses check failed: no
|
|
115
|
+
checks.push({ kind: "err", message: "Compatibility Responses check failed: no selected model advertises /responses" });
|
|
110
116
|
return checks;
|
|
111
117
|
}
|
|
112
118
|
|
|
@@ -115,7 +121,7 @@ export async function inspectAdapterCompatibility({
|
|
|
115
121
|
model: CODEX_AUTO_REVIEW_MODEL,
|
|
116
122
|
stream: false,
|
|
117
123
|
input: "Reply with OK only.",
|
|
118
|
-
}, timeoutMs);
|
|
124
|
+
}, timeoutMs, headers);
|
|
119
125
|
parseResponseObject(text);
|
|
120
126
|
});
|
|
121
127
|
|
|
@@ -124,7 +130,7 @@ export async function inspectAdapterCompatibility({
|
|
|
124
130
|
model: responsesModel,
|
|
125
131
|
stream: false,
|
|
126
132
|
input: "Reply with OK only.",
|
|
127
|
-
}, timeoutMs);
|
|
133
|
+
}, timeoutMs, headers);
|
|
128
134
|
return parseResponseObject(text);
|
|
129
135
|
});
|
|
130
136
|
|
|
@@ -135,7 +141,7 @@ export async function inspectAdapterCompatibility({
|
|
|
135
141
|
stream: true,
|
|
136
142
|
previous_response_id: firstResponse.id,
|
|
137
143
|
input: "Reply with OK again.",
|
|
138
|
-
}, timeoutMs);
|
|
144
|
+
}, timeoutMs, headers);
|
|
139
145
|
const events = text.split(/\r?\n\r?\n/).map(block => {
|
|
140
146
|
const data = block.split(/\r?\n/).filter(line => line.startsWith("data:")).map(line => line.slice(5).trim()).join("\n");
|
|
141
147
|
try { return JSON.parse(data); } catch { return null; }
|
|
@@ -152,7 +158,7 @@ export async function inspectAdapterCompatibility({
|
|
|
152
158
|
model: responsesModel,
|
|
153
159
|
stream: false,
|
|
154
160
|
input: "Compact this short context.",
|
|
155
|
-
}, timeoutMs);
|
|
161
|
+
}, timeoutMs, headers);
|
|
156
162
|
parseCompactionResponse(text);
|
|
157
163
|
});
|
|
158
164
|
|