codex-copilot-dx 1.2.6 → 1.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/bin/cli.mjs +42 -2
- package/docs/ARCHITECTURE.md +6 -0
- package/docs/README.md +4 -0
- package/docs/REFERENCE.md +22 -2
- package/package.json +1 -1
- package/src/account-tools.mjs +121 -0
- package/src/adapter.mjs +2 -0
- package/src/auth-credentials.mjs +18 -8
- package/src/auth-status.mjs +21 -7
- package/src/auth.mjs +1 -0
- package/src/cli-auth.mjs +38 -1
- package/src/cli-options.mjs +46 -13
- package/src/cli-tools.mjs +25 -0
- package/src/cli-web.mjs +37 -0
- package/src/codex-config-doctor.mjs +4 -0
- package/src/copilot-client.mjs +1 -0
- package/src/copilot-token-session.mjs +9 -0
- package/src/dashboard/console.js +1 -1
- package/src/dashboard/icons.js +24 -0
- package/src/dashboard/index.html +57 -15
- package/src/dashboard/language.js +86 -0
- package/src/dashboard/status.js +9 -0
- package/src/dashboard/tools.js +151 -0
- package/src/dashboard/ui.css +23 -0
- package/src/dashboard/ui.js +4 -1
- package/src/dashboard-api.mjs +5 -0
- package/src/dashboard-tools.mjs +43 -0
- package/src/dashboard.mjs +2 -0
- package/src/doctor.mjs +3 -2
- package/src/local-tools.mjs +53 -0
- package/src/native-prediction-environment.mjs +1 -1
- package/src/optional-routes.mjs +9 -3
- package/src/provider-runtime.mjs +2 -2
package/src/cli-options.mjs
CHANGED
|
@@ -18,6 +18,7 @@ const HELP_TOPICS = new Set([
|
|
|
18
18
|
"start",
|
|
19
19
|
"auth",
|
|
20
20
|
"auth status",
|
|
21
|
+
"auth login", "auth reauth", "auth check", "auth logout", "reauth", "web", "source", "image", "doctor network", "doctor report",
|
|
21
22
|
"doctor",
|
|
22
23
|
"doctor config",
|
|
23
24
|
"status",
|
|
@@ -129,6 +130,17 @@ function parseStartOptions(args) {
|
|
|
129
130
|
export function parseCliArgs(args = []) {
|
|
130
131
|
const [command, ...rest] = args;
|
|
131
132
|
if (!command) return baseCommand("start");
|
|
133
|
+
if (command === "reauth") return parseCliArgs(["auth", "reauth", ...rest]);
|
|
134
|
+
if (command === "source") { if (rest.length === 1 && HELP_COMMANDS.has(rest[0])) return helpCommand(["source"]);return parseCliArgs(["m365", "switch", ...rest]); }
|
|
135
|
+
if (command === "web") { if (rest.length === 1 && HELP_COMMANDS.has(rest[0])) return helpCommand(["web"]);if (rest.length) unexpectedArgs(rest);return baseCommand("web"); }
|
|
136
|
+
if (command === "image") {
|
|
137
|
+
if (rest.length === 1 && HELP_COMMANDS.has(rest[0])) return helpCommand(["image"]);
|
|
138
|
+
const [action = "status", ...extra] = rest;
|
|
139
|
+
if (!["status", "pause", "resume"].includes(action)) throw new Error("Choose image status, pause or resume.");
|
|
140
|
+
if (extra.length) unexpectedArgs(extra);
|
|
141
|
+
return baseCommand("image", { action });
|
|
142
|
+
}
|
|
143
|
+
if (command === "doctor" && ["network", "report"].includes(rest[0]) && rest.length === 2 && HELP_COMMANDS.has(rest[1])) return helpCommand(["doctor", rest[0]]);
|
|
132
144
|
if (HELP_COMMANDS.has(command)) {
|
|
133
145
|
const topic = rest;
|
|
134
146
|
if (topic.length > 2) unexpectedArgs(topic.slice(2));
|
|
@@ -241,8 +253,16 @@ export function parseCliArgs(args = []) {
|
|
|
241
253
|
};
|
|
242
254
|
}
|
|
243
255
|
if (command === "auth") {
|
|
244
|
-
const [action, ...authArgs] = rest;
|
|
245
|
-
if (
|
|
256
|
+
const [action = "status", ...authArgs] = rest;
|
|
257
|
+
if (["login", "reauth", "check", "logout"].includes(action)) {
|
|
258
|
+
const values = authArgs[0] === "github" || authArgs[0] === "codex" ? authArgs.slice(1) : authArgs;
|
|
259
|
+
const options = parseOptions(values, new Map(action === "logout" ? [["--yes", "flag"]]
|
|
260
|
+
: action === "check" ? [["--format", "value"]] : [["--login", "value"], ["--reauth", "flag"]]));
|
|
261
|
+
if (options["--login"] && !/^[a-z\d_-]{1,39}$/i.test(options["--login"])) throw new Error("Enter a GitHub account name.");
|
|
262
|
+
return baseCommand("auth", { action, ...(options["--yes"] ? { yes: true } : {}),
|
|
263
|
+
...(options["--reauth"] ? { reauth: true } : {}), ...(options["--login"] ? { expectedLogin: options["--login"] } : {}),
|
|
264
|
+
...(options["--format"] ? outputFormatOption(options["--format"]) : {}) });
|
|
265
|
+
}
|
|
246
266
|
if (action === "status") {
|
|
247
267
|
const options = parseOptions(authArgs, new Map([
|
|
248
268
|
["--online", "flag"],
|
|
@@ -258,12 +278,6 @@ export function parseCliArgs(args = []) {
|
|
|
258
278
|
...outputFormatOption(options["--format"]),
|
|
259
279
|
};
|
|
260
280
|
}
|
|
261
|
-
if (action === "login") {
|
|
262
|
-
const [profile, ...loginArgs] = authArgs;
|
|
263
|
-
if (!profile) throw new Error("Choose the claude sign-in profile.");
|
|
264
|
-
if (profile !== "claude") throw new Error(`Auth login profile must be claude: ${profile}`);
|
|
265
|
-
return baseCommand("retired", { integration: "Claude App and Claude Code" });
|
|
266
|
-
}
|
|
267
281
|
throw new Error(`Unknown auth action: ${action}`);
|
|
268
282
|
}
|
|
269
283
|
if (command === "animation") {
|
|
@@ -272,7 +286,7 @@ export function parseCliArgs(args = []) {
|
|
|
272
286
|
}
|
|
273
287
|
if (command === "prediction") {
|
|
274
288
|
const [action = "status", ...extra] = rest;
|
|
275
|
-
if (!["on", "off", "status", "fix"].includes(action)) throw new Error("Choose prediction on, off, status or
|
|
289
|
+
if (!["on", "off", "status", "fix", "pause", "resume"].includes(action)) throw new Error("Choose prediction on, off, status, fix, pause or resume.");
|
|
276
290
|
if (extra.length) unexpectedArgs(extra);
|
|
277
291
|
return baseCommand("prediction", { action });
|
|
278
292
|
}
|
|
@@ -309,6 +323,10 @@ export function parseCliArgs(args = []) {
|
|
|
309
323
|
};
|
|
310
324
|
}
|
|
311
325
|
if (command === "doctor" || command === "--doctor") {
|
|
326
|
+
if (["network", "report"].includes(rest[0])) {
|
|
327
|
+
if (rest.length > 1) unexpectedArgs(rest.slice(1));
|
|
328
|
+
return baseCommand("doctor", { tool: rest[0] });
|
|
329
|
+
}
|
|
312
330
|
const options = parseOptions(rest, new Map([
|
|
313
331
|
["--online", "flag"],
|
|
314
332
|
["--compat", "flag"],
|
|
@@ -380,9 +398,15 @@ export function cliCommandName() {
|
|
|
380
398
|
}
|
|
381
399
|
|
|
382
400
|
function topicHelp(name, topic) {
|
|
401
|
+
const authHelp = `Usage:\n ${name} auth status [--online] [--format table|plain]\n ${name} auth check [--format table|plain]\n ${name} auth login [--login ACCOUNT]\n ${name} auth reauth [--login ACCOUNT]\n ${name} auth logout [--yes]\n\n- Status reads local sign-in only. Check verifies GitHub, Copilot access and the model catalog; no inference.\n- Login uses GitHub device authorization. Reauth replaces a sign-in only after verification; cancel/failure keeps the old one.\n- The saved account is required by default. --login explicitly chooses another account; restart CCDX to change accounts.\n- New tool sign-ins use CCDX's own store; legacy sign-in stays compatible and is never deleted by logout.\n- Logout stops new authenticated requests in the notified service; other apps stay signed in.\n- ${name} reauth is a shortcut. Run ${name} web to open these tools without signing in first.`;
|
|
402
|
+
if (topic === "auth" || ["auth login", "auth reauth", "auth check", "auth logout", "reauth"].includes(topic)) return authHelp;
|
|
383
403
|
const sections = {
|
|
404
|
+
web: `Usage:\n ${name} web\n\n- Opens an existing compatible dashboard, or starts a local management service.\n- No sign-in, app edits, prediction setup or app launch is required.\n- Ctrl+C stops a management service started by this command.\n- For normal app routing and optional startup integrations, stop that management service and run ${name}.`,
|
|
405
|
+
image: `Usage:\n ${name} image [status|pause|resume]\n\n- Pause/resume keeps provider credentials and setup. Running requests can finish.\n- Resume does not install or configure an image provider; first setup: ${name} enable-image.\n- disable-image removes the stored API credential; pause does not.`,
|
|
406
|
+
source: `Usage:\n ${name} source [github|m365] [--model ID] [--auto-review-model ID]\n\n- Alias for ${name} m365 switch, with the same validation and explicit model choices.\n- Applies to new Codex requests. Start a new conversation after changing sources.`,
|
|
407
|
+
"doctor network": `Usage:\n ${name} doctor network\n\n- Reads local proxy/trust diagnostics without sending external requests.\n- Does not change proxy, PAC, certificates or policy.`,
|
|
408
|
+
"doctor report": `Usage:\n ${name} doctor report\n\n- Prints a redacted local report as JSON. No inference or external service request.\n- Account details, credentials and chat content are omitted.`,
|
|
384
409
|
start: `Usage:\n ${name} [start] [--show-request-id] [--no-browser] [--verbose]\n\n- Starts or reuses the local adapter, updates Codex configuration, and attempts to open Codex App when auto-launch is enabled and supported.\n- Interactive desktop starts also open WebUI once; --no-browser skips that attempt.\n- After startup the terminal shows fixed status/returned usage; --verbose or --show-request-id retains request detail.`,
|
|
385
|
-
auth: `Usage:\n ${name} auth status [--online] [--format table|plain]\n\n- Shows the saved GitHub Copilot account without exposing credentials.\n- --online also verifies its entitlement and model catalog.`,
|
|
386
410
|
"auth status": `Usage:\n ${name} auth status [--online] [--format table|plain]\n\n- Shows the saved GitHub Copilot account without exposing credentials.\n- --online also verifies its entitlement and model catalog.\n- Interactive terminals use a table by default.`,
|
|
387
411
|
doctor: `Usage:\n ${name} doctor [--online] [--compat] [--fix] [--json]\n ${name} doctor config\n\n- Checks credentials, managed configuration, command launchers, adapter, enabled optional features and observed client catalog.\n- Default is read-only; no inference requests.\n- --online validates account entitlement; --compat sends minimal inference requests and consumes a small amount of Copilot usage, requiring successful model completion rather than HTTP 200 alone.\n- --fix repairs owned Windows launchers and managed config, imports a verified existing credential only if none is saved, and asks the running adapter to repair enabled predictions once.\n- No interactive login, client program edits, forced App restarts, policy changes or optional feature activation.\n- Missing-credential repair can contact GitHub without --online.\n- Changed existing config is backed up to config.toml.ccdx-doctor.bak.\n- Partial repairs exit 1.\n- --json emits a redacted report, including before_checks for repairs.\n- App-internal cache and visible predictions are not externally verified.\n- The config subcommand remains strictly read-only.`,
|
|
388
412
|
"doctor config": `Usage:\n ${name} doctor config\n\n- Reads ~/.codex/config.toml, checks TOML syntax and CCDX-managed settings, and previews the existing startup writer's changes.\n- Does not merge Codex profiles or validate the complete installed Codex schema.\n- No authentication, network requests, file writes, or adapter/GUI startup.\n- Existing context_management=false is valid.\n- Exit 1 for errors, 0 for OK/warnings; unsupported arguments exit 2.`,
|
|
@@ -398,7 +422,7 @@ function topicHelp(name, topic) {
|
|
|
398
422
|
"auto-review-model": `Usage:\n ${name} auto-review-model\n\n- Select a Responses model, then an advertised reasoning effort.\n- Enter keeps the default/current choice; q cancels both steps without saving.\n- Effort 0 follows the client (low when omitted).\n- Settings apply only to Auto-review on the next request; no client patch or restart is required for adapters running 0.9.13 or newer.`,
|
|
399
423
|
"suggestion": `The CCDX prediction panel has been retired. Run ${name} suggestion off to safely remove unchanged CCDX registrations. This cleanup does not change native predictions; see ${name} prediction --help for that separate opt-in feature.`,
|
|
400
424
|
m365: `Usage:\n ${name} m365 [status|models|accounts|account|on|off|remove]\n ${name} m365 account [--id ID]\n ${name} m365 switch [github|m365] [--model ID] [--auto-review-model ID]\n\n- M365 is discovered silently at startup on supported managed environments.\n- accounts lists local company accounts without requesting tokens.\n- account chooses a company account; --id supports scripts. A running updated service is required.\n- Saved bindings stay selected. Otherwise an exact Windows sign-in match, then a single company account, is used.\n- Changing accounts applies to M365 in Codex and Claude; start a new conversation.\n- Claude uses /anthropic on the same local port.\n- Codex stays on GitHub unless you explicitly switch.\n- M365 switching requires a running compatible adapter and available GPT/Auto-review choices; it never substitutes unavailable models.\n- Select an available model in Codex after switching an existing thread.\n- Off restores only owned Claude settings and selects GitHub.\n- Remove also clears the CCDX M365 profile, retaining a disabled preference and historical usage.\n- System Microsoft sign-in, GitHub credentials, predictions and images are preserved.`,
|
|
401
|
-
prediction: `Usage:\n ${name} prediction [status|on|off|fix]\n\n- Optional native next-message predictions; off by default. macOS and Windows.\n- Windows requires the registered official MSIX App, an initialized profile, Windows PowerShell and .NET Framework 4.7.2+; Git/OpenSSL is not required for prediction setup.\n- Quit Codex before on/off, then restart ccdx.\n- On adds private App-profile certificate trust and an App-only route for chatgpt.com and ab.chatgpt.com.\n- HTTPS on those hosts is decrypted locally; only prediction configuration is changed.\n- No client program files, OS trust, account permissions, MCP or Hooks are changed.\n- Static HTTP/HTTPS/SOCKS5 proxies and bypass rules are preserved.\n- Windows supports company PAC/WPAD; macOS dynamic PAC/WPAD remains unsupported.\n- Static IPv4/IPv6 CIDRs match URL IP literals without DNS.\n- The bridge port persists across restarts/updates; a busy saved port disables only predictions.\n- Launch/reuse checks the App's actual route; an older random or missing route may require one full App quit.\n- Official prediction configuration is preserved; the conversation's model is used.\n- App updates require another compatibility check.\n- Status distinguishes saved preference and observed config traffic from unverified candidate visibility.\n- Fix asks a compatible running CCDX adapter to repair the enabled bridge once on its saved port.\n- It never enables predictions, renews certificates or force-restarts Codex.\n- Healthy unchanged bridges are retained.\n- Fix rechecks system proxy settings.\n- Changed routes may need a normal App relaunch to reload cached PAC; failed rechecks preserve the previous bridge with a nonzero exit.\n- Process environment variables and Node trust are not hot-reloaded; changed trust inputs need a CCDX service restart.\n- Startup, status and doctor share sanitized environment diagnostics.\n- Missing App routes require a normal full quit and ccdx launch; partial repair exits 1.\n- An older adapter must first be upgraded and restarted once to gain this repair endpoint.`,
|
|
425
|
+
prediction: `Usage:\n ${name} prediction [status|on|off|fix|pause|resume]\n\n- Pause/resume only pauses adaptation; trust and route setup are kept.\n- Resume does not activate a feature that has not been set up.\n- Optional native next-message predictions; off by default. macOS and Windows.\n- Windows requires the registered official MSIX App, an initialized profile, Windows PowerShell and .NET Framework 4.7.2+; Git/OpenSSL is not required for prediction setup.\n- Quit Codex before on/off, then restart ccdx.\n- On adds private App-profile certificate trust and an App-only route for chatgpt.com and ab.chatgpt.com.\n- HTTPS on those hosts is decrypted locally; only prediction configuration is changed.\n- No client program files, OS trust, account permissions, MCP or Hooks are changed.\n- Static HTTP/HTTPS/SOCKS5 proxies and bypass rules are preserved.\n- Windows supports company PAC/WPAD; macOS dynamic PAC/WPAD remains unsupported.\n- Static IPv4/IPv6 CIDRs match URL IP literals without DNS.\n- The bridge port persists across restarts/updates; a busy saved port disables only predictions.\n- Launch/reuse checks the App's actual route; an older random or missing route may require one full App quit.\n- Official prediction configuration is preserved; the conversation's model is used.\n- App updates require another compatibility check.\n- Status distinguishes saved preference and observed config traffic from unverified candidate visibility.\n- Fix asks a compatible running CCDX adapter to repair the enabled bridge once on its saved port.\n- It never enables predictions, renews certificates or force-restarts Codex.\n- Healthy unchanged bridges are retained.\n- Fix rechecks system proxy settings.\n- Changed routes may need a normal App relaunch to reload cached PAC; failed rechecks preserve the previous bridge with a nonzero exit.\n- Process environment variables and Node trust are not hot-reloaded; changed trust inputs need a CCDX service restart.\n- Startup, status and doctor share sanitized environment diagnostics.\n- Missing App routes require a normal full quit and ccdx launch; partial repair exits 1.\n- An older adapter must first be upgraded and restarted once to gain this repair endpoint.`,
|
|
402
426
|
update: `Usage:\n ${name} update [npm|github] [--allow-remote]\n\n- Updates the global package from the configured npm registry or the latest stable GitHub release.\n- With no source, an interactive terminal prompts for one.\n- Windows uses system cmd.exe to run npm.cmd without changing PowerShell policy; use the .cmd entrypoint if scripts are blocked.\n- GitHub verifies a Release tarball; Git is not required. Dependencies use the configured npm registry.\n- By default npm's remote-download policy is preserved.\n- If npm reports EALLOWREMOTE for a trusted mirror tarball, --allow-remote explicitly permits URL dependencies for this one installation's entire dependency tree; it is not a hostname allowlist.\n- No .npmrc, registry or persistent policy is changed, and failed installations are not retried automatically.\n- Use this only if company policy permits it.\n- Restart the running adapter after installation.`,
|
|
403
427
|
version: `Usage:\n ${name} --version`,
|
|
404
428
|
};
|
|
@@ -414,6 +438,12 @@ export function cliHelp(commandName = "ccdx", topic = "") {
|
|
|
414
438
|
${name} auth status [--online] [--format table|plain]
|
|
415
439
|
${name} doctor [--online] [--compat] [--fix] [--json]
|
|
416
440
|
${name} doctor config
|
|
441
|
+
${name} doctor network
|
|
442
|
+
${name} doctor report
|
|
443
|
+
${name} auth [login|reauth|check|logout]
|
|
444
|
+
${name} web
|
|
445
|
+
${name} source [github|m365]
|
|
446
|
+
${name} image [status|pause|resume]
|
|
417
447
|
${name} status
|
|
418
448
|
${name} models [--format table|plain]
|
|
419
449
|
${name} usage [--format table|plain] [--provider ID]
|
|
@@ -424,7 +454,7 @@ export function cliHelp(commandName = "ccdx", topic = "") {
|
|
|
424
454
|
${name} disable-image
|
|
425
455
|
${name} image-status
|
|
426
456
|
${name} auto-review-model
|
|
427
|
-
${name} prediction [status|on|off|fix]
|
|
457
|
+
${name} prediction [status|on|off|fix|pause|resume]
|
|
428
458
|
${name} m365 [status|models|accounts|account|switch|on|off|remove]
|
|
429
459
|
${name} update [npm|github] [--allow-remote]
|
|
430
460
|
${name} --version
|
|
@@ -432,7 +462,10 @@ export function cliHelp(commandName = "ccdx", topic = "") {
|
|
|
432
462
|
|
|
433
463
|
Commands:
|
|
434
464
|
start Start or reuse the adapter and configure Codex
|
|
435
|
-
auth
|
|
465
|
+
auth Manage GitHub sign-in and check access
|
|
466
|
+
web Open local account and repair tools
|
|
467
|
+
source Choose a Codex model source
|
|
468
|
+
image Inspect, pause or resume image requests
|
|
436
469
|
doctor Diagnose local config; optional live and inference checks
|
|
437
470
|
status Show runtime routing, performance, queue, and cache health
|
|
438
471
|
models Show the selected Codex provider's GPT model catalog
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { adapterBaseUrl, checkRunningAdapter } from "./running-adapter.mjs";
|
|
2
|
+
import { isLoopbackHost } from "./security.mjs";
|
|
3
|
+
import { readBoundedResponseText } from "./upstream-body.mjs";
|
|
4
|
+
import { writeServicePreference } from "./user-settings.mjs";
|
|
5
|
+
|
|
6
|
+
export async function dashboardToolRequest({ host = "127.0.0.1", port = 2026, path = "account", body, fetchImpl = fetch, timeoutMs = 5000 } = {}) {
|
|
7
|
+
const baseUrl = adapterBaseUrl(isLoopbackHost(host) ? host : "127.0.0.1", port);
|
|
8
|
+
const running = await checkRunningAdapter({ host, port, fetchImpl, timeoutMs });
|
|
9
|
+
if (!running.ok) throw new Error("Start or restart CCDX to use this tool.");
|
|
10
|
+
const response = await fetchImpl(`${baseUrl}/_ccdx/ui/${path}`, { method: body ? "POST" : "GET", redirect: "error",
|
|
11
|
+
headers: { "X-CCDX-Dashboard": "1", Origin: baseUrl, ...(body ? { "Content-Type": "application/json" } : {}) },
|
|
12
|
+
...(body ? { body: JSON.stringify(body) } : {}), signal: AbortSignal.timeout(timeoutMs) });
|
|
13
|
+
const data = JSON.parse(await readBoundedResponseText(response, { maxBytes: 1024 * 1024, label: "Local tool response" }));
|
|
14
|
+
if (!response.ok) throw new Error("Local tool is unavailable. Restart the updated CCDX service.");
|
|
15
|
+
return data;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export async function pauseServiceFeature({ feature, action, home, env = process.env, host, port, request = dashboardToolRequest } = {}) {
|
|
19
|
+
const key = `${feature}_enabled`, value = action === "resume";
|
|
20
|
+
if (!["image", "prediction"].includes(feature) || !["pause", "resume"].includes(action)) throw new Error("Choose pause or resume for images or predictions.");
|
|
21
|
+
writeServicePreference(key, value, { home, env });
|
|
22
|
+
let applied = false;
|
|
23
|
+
try { await request({ host, port, path: "settings", body: { action: "preference", key, value } });applied = true; } catch {}
|
|
24
|
+
return `${feature === "image" ? "Image requests" : "Prediction adaptation"}: ${value ? "resumed" : "paused"}. Setup and credentials kept.${applied ? "" : " Start or restart CCDX to apply."}`;
|
|
25
|
+
}
|
package/src/cli-web.mjs
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { startAdapter } from "./adapter.mjs";
|
|
2
|
+
import { defaultCopilotClient } from "./copilot.mjs";
|
|
3
|
+
import { createProfileRuntime } from "./profile-runtime.mjs";
|
|
4
|
+
import { createProfileModelRuntime } from "./profile-model-runtime.mjs";
|
|
5
|
+
import { createProviderRuntime } from "./provider-runtime.mjs";
|
|
6
|
+
import { createServiceControl } from "./service-control.mjs";
|
|
7
|
+
import { openDashboard } from "./browser-launch.mjs";
|
|
8
|
+
import { adapterBaseUrl, checkRunningAdapter } from "./running-adapter.mjs";
|
|
9
|
+
import { assertSafeAdapterHost, isLoopbackHost } from "./security.mjs";
|
|
10
|
+
import { closeHttpServer } from "./shutdown.mjs";
|
|
11
|
+
|
|
12
|
+
// Starts management without requesting sign-in or editing/launching an app.
|
|
13
|
+
export async function runWebCommand({ host = "127.0.0.1", port = 2026, env = process.env, home, output = console.log } = {}) {
|
|
14
|
+
assertSafeAdapterHost(host, env);
|
|
15
|
+
const baseUrl = adapterBaseUrl(isLoopbackHost(host) ? host : "127.0.0.1", port);
|
|
16
|
+
const running = await checkRunningAdapter({ host, port });
|
|
17
|
+
if (running.incompatible) throw new Error("Restart the updated CCDX service before opening the dashboard.");
|
|
18
|
+
if (running.ok) { await openDashboard(baseUrl, { env, interactive: true });output(`Web UI: ${baseUrl}`);return; }
|
|
19
|
+
let profile = createProfileRuntime({ home, codexClient: defaultCopilotClient });
|
|
20
|
+
const models = createProfileModelRuntime({ home, env, codexClient: defaultCopilotClient, codexCredentialFingerprint: () => profile.codexCredentialFingerprint });
|
|
21
|
+
const providers = createProviderRuntime({ home, env, corePort: port, githubClient: defaultCopilotClient,
|
|
22
|
+
githubRegistry: models.codexRegistry, githubClientConfigured: false, githubCredentialFingerprint: () => profile.codexCredentialFingerprint });
|
|
23
|
+
const serviceControl = createServiceControl({ home, env, providerRuntime: providers });
|
|
24
|
+
const server = await startAdapter(port, host, { providerRuntime: providers, codexModelRegistry: models.codexRegistry,
|
|
25
|
+
dashboardOptions: { home, env, host, port, serviceControl, credentialsChanged: () => {
|
|
26
|
+
defaultCopilotClient.invalidateCredentials();profile = createProfileRuntime({ home, codexClient: defaultCopilotClient });
|
|
27
|
+
} } });
|
|
28
|
+
let closing = false;
|
|
29
|
+
const stop = () => { if (closing) return;closing = true;void closeHttpServer(server).catch(() => { server.closeAllConnections();server.close(); }); };
|
|
30
|
+
server.ccdxWebClosed = new Promise(resolve => server.once("close", () => {
|
|
31
|
+
process.removeListener("SIGINT", stop);process.removeListener("SIGTERM", stop);
|
|
32
|
+
void providers.close().then(resolve, () => { output("Provider shutdown could not be verified.");resolve(); });
|
|
33
|
+
}));
|
|
34
|
+
process.once("SIGINT", stop);process.once("SIGTERM", stop);
|
|
35
|
+
await openDashboard(baseUrl, { env, interactive: true });output(`Web UI: ${baseUrl}\nManagement service running. Ctrl+C stops it.`);
|
|
36
|
+
return server;
|
|
37
|
+
}
|
|
@@ -2,6 +2,7 @@ import fs from "node:fs";
|
|
|
2
2
|
import os from "node:os";
|
|
3
3
|
import { codexPaths } from "./codex-paths.mjs";
|
|
4
4
|
import { isDeepStrictEqual } from "node:util";
|
|
5
|
+
import { createHash } from "node:crypto";
|
|
5
6
|
import { parse } from "smol-toml";
|
|
6
7
|
import { computeUpdatedCodexConfig, initialCodexConfig } from "./config.mjs";
|
|
7
8
|
import { adapterBaseUrl } from "./running-adapter.mjs";
|
|
@@ -177,6 +178,9 @@ export function repairCodexConfig(options = {}) {
|
|
|
177
178
|
}
|
|
178
179
|
let content = null;
|
|
179
180
|
try { content = fs.readFileSync(file, "utf8"); } catch (error) { if (error.code !== "ENOENT") throw error; }
|
|
181
|
+
if (options.expectedRevision !== undefined && options.expectedRevision !== (content === null ? "missing" : createHash("sha256").update(content).digest("hex"))) {
|
|
182
|
+
throw Object.assign(new Error("config_preview_changed"), { code: "config_preview_changed", statusCode: 409 });
|
|
183
|
+
}
|
|
180
184
|
const next = content === null ? { content: initialCodexConfig(port, host), changed: true }
|
|
181
185
|
: computeUpdatedCodexConfig(content, port, host);
|
|
182
186
|
if (!next.changed) return { status: "unchanged", changed: false };
|
package/src/copilot-client.mjs
CHANGED
|
@@ -231,6 +231,7 @@ export function createCopilotClientRuntime({
|
|
|
231
231
|
getApiBase: tokenSession.getApiBase,
|
|
232
232
|
runtimeStatus,
|
|
233
233
|
getCopilotToken: tokenSession.getToken,
|
|
234
|
+
invalidateCredentials: tokenSession.invalidateCredentials,
|
|
234
235
|
resetTokenForTests: tokenSession.resetForTests,
|
|
235
236
|
chatCompletions,
|
|
236
237
|
listModels,
|
|
@@ -304,6 +304,7 @@ export function createCopilotTokenSession({
|
|
|
304
304
|
fetchImpl,
|
|
305
305
|
signal,
|
|
306
306
|
});
|
|
307
|
+
if (signal?.aborted) throw abortError(signal);
|
|
307
308
|
const token = cacheTokenData(data, {
|
|
308
309
|
sourceKey: credentials.sourceKey,
|
|
309
310
|
githubToken: credentials.token,
|
|
@@ -384,10 +385,18 @@ export function createCopilotTokenSession({
|
|
|
384
385
|
apiBase = defaultApiBase;
|
|
385
386
|
}
|
|
386
387
|
|
|
388
|
+
function invalidateCredentials() {
|
|
389
|
+
refreshFlight?.controller.abort();
|
|
390
|
+
refreshFlight = null;
|
|
391
|
+
copilotToken = null;copilotTokenExpiry = 0;refreshRetryAt = 0;
|
|
392
|
+
// Keep the account binding. Switching accounts still requires a restart.
|
|
393
|
+
}
|
|
394
|
+
|
|
387
395
|
return Object.freeze({
|
|
388
396
|
getToken,
|
|
389
397
|
getApiBase: () => apiBase,
|
|
390
398
|
runtimeStatus,
|
|
399
|
+
invalidateCredentials,
|
|
391
400
|
resetForTests,
|
|
392
401
|
});
|
|
393
402
|
}
|
package/src/dashboard/console.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
(() => {
|
|
2
2
|
const el = id => document.getElementById(id);
|
|
3
3
|
const label = (node, key, values = {}) => globalThis.ccdxLanguage.set(node, key, values);
|
|
4
|
-
const titles = { overview: "overview", codex: "Codex", claude: "Claude", models: "model_services", usage: "usage_and_diagnostics", requests: "request_records", system: "system_and_settings" };
|
|
4
|
+
const titles = { overview: "overview", codex: "Codex", claude: "Claude", models: "model_services", usage: "usage_and_diagnostics", requests: "request_records", checks: "tools_checks_title", system: "system_and_settings" };
|
|
5
5
|
let current = "overview", settings = null, settingsPending = false, stopped = false, timer = null, ticks = 0;
|
|
6
6
|
let sourceDirty = false, reviewDirty = false, sourceModels = [], modelsPreference = null, sourceGeneration = 0, modelsSource = null;
|
|
7
7
|
let settingsReadAt = null;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
(() => {
|
|
2
|
+
const shapes = { ok: ["path", { d: "m8 12 2.5 2.5L16 9" }], running: ["path", { d: "m10 8 6 4-6 4Z" }],
|
|
3
|
+
warning: ["path", { d: "M12 7.5v5m0 3.5h.01" }], unavailable: ["path", { d: "M8 12h8" }] };
|
|
4
|
+
function icon(kind = "unknown") {
|
|
5
|
+
const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
6
|
+
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
|
+
const circle = document.createElementNS(svg.namespaceURI, "circle");
|
|
8
|
+
circle.setAttribute("cx", "12");circle.setAttribute("cy", "12");circle.setAttribute("r", "9");svg.append(circle);
|
|
9
|
+
if (shapes[kind]) { const [tag, attributes] = shapes[kind], shape = document.createElementNS(svg.namespaceURI, tag);
|
|
10
|
+
for (const [key, value] of Object.entries(attributes)) shape.setAttribute(key, value);svg.append(shape); }
|
|
11
|
+
return svg;
|
|
12
|
+
}
|
|
13
|
+
function set(target, key, kind = "unknown", values = {}) {
|
|
14
|
+
const label = document.createElement("span"), wrapper = document.createElement("span");
|
|
15
|
+
wrapper.className = `state-label state-${kind}`;
|
|
16
|
+
globalThis.ccdxLanguage.set(label, key, values);wrapper.append(icon(kind), label);
|
|
17
|
+
target.removeAttribute("data-i18n");target.replaceChildren(wrapper);
|
|
18
|
+
}
|
|
19
|
+
const kind = value => ["running", "active"].includes(value) ? "running"
|
|
20
|
+
: ["ready", "authorized", "configured", "saved", "passed", "ok", "completed"].includes(value) ? "ok"
|
|
21
|
+
: ["unavailable", "disabled", "unsupported", "not_installed", "unconfigured"].includes(value) ? "unavailable"
|
|
22
|
+
: ["warn", "err", "invalid", "failed", "configuration_unavailable"].includes(value) ? "warning" : "unknown";
|
|
23
|
+
globalThis.ccdxIcons = { icon, set, kind };
|
|
24
|
+
})();
|
package/src/dashboard/index.html
CHANGED
|
@@ -9,11 +9,13 @@
|
|
|
9
9
|
<script src="/theme.js"></script>
|
|
10
10
|
<link rel="stylesheet" href="/ui.css">
|
|
11
11
|
<script src="/refresh.js" defer></script>
|
|
12
|
+
<script src="/icons.js" defer></script>
|
|
12
13
|
<script src="/status.js" defer></script>
|
|
13
14
|
<script src="/usage.js" defer></script>
|
|
14
15
|
<script src="/updates.js" defer></script>
|
|
15
16
|
<script src="/ui.js" defer></script>
|
|
16
17
|
<script src="/console.js" defer></script>
|
|
18
|
+
<script src="/tools.js" defer></script>
|
|
17
19
|
<title data-i18n="ccdx_local_dashboard">CCDX · Dashboard</title>
|
|
18
20
|
</head>
|
|
19
21
|
<body>
|
|
@@ -28,6 +30,7 @@
|
|
|
28
30
|
<a href="#models" data-route="models"><svg class="nav-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="m12 3 10 5-10 5L2 8Zm-10 9 10 5 10-5M2 16l10 5 10-5"/></svg><span data-i18n="model_services">Model sources</span></a>
|
|
29
31
|
<a href="#usage" data-route="usage"><svg class="nav-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M3 3v18h18M7 16v-5m5 5V7m5 9V4"/></svg><span data-i18n="usage_and_diagnostics">Usage</span></a>
|
|
30
32
|
<a href="#requests" data-route="requests"><svg class="nav-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01"/></svg><span data-i18n="request_records">Requests</span></a>
|
|
33
|
+
<a href="#checks" data-route="checks"><svg class="nav-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="m3 7 2 2 4-4m3 2h9M3 13l2 2 4-4m3 2h9M3 19l2 2 4-4m3 2h9"/></svg><span data-i18n="tools_checks_title">Checks & repairs</span></a>
|
|
31
34
|
<a href="#system" data-route="system"><svg class="nav-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M3 6h4m4 0h10M3 12h10m4 0h4M3 18h4m4 0h10"/><circle cx="9" cy="6" r="2"/><circle cx="15" cy="12" r="2"/><circle cx="9" cy="18" r="2"/></svg><span data-i18n="system_and_settings">Settings</span></a>
|
|
32
35
|
</nav>
|
|
33
36
|
</aside>
|
|
@@ -123,21 +126,27 @@
|
|
|
123
126
|
</section>
|
|
124
127
|
</div>
|
|
125
128
|
<div data-view="models" hidden>
|
|
126
|
-
<
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
<
|
|
133
|
-
<div
|
|
134
|
-
<
|
|
135
|
-
<
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
129
|
+
<div id="model-providers" class="provider-tabs" role="tablist" aria-label="Model providers" data-i18n-label="model_providers"></div>
|
|
130
|
+
<p class="hint source-browse-note" data-i18n="tools_source_browse">Browsing a source does not change app settings.</p>
|
|
131
|
+
<div id="source-account-panel" role="tabpanel">
|
|
132
|
+
<section class="panel dashboard-section" id="github-account">
|
|
133
|
+
<div class="panel-heading"><h2>GitHub Copilot</h2><span id="github-account-state"></span></div>
|
|
134
|
+
<p id="github-account-name" class="account-name">—</p><p id="github-account-hint" class="hint"></p>
|
|
135
|
+
<dl id="github-account-fields" class="account-fields"></dl>
|
|
136
|
+
<div class="section-actions"><button id="github-signin" type="button" data-i18n="tools_login">Sign in to GitHub</button><button id="github-check" type="button" data-i18n="tools_check_connection">Check connection</button></div>
|
|
137
|
+
<p class="hint" data-i18n="tools_no_inference">Checks access and models. No chat request is sent.</p>
|
|
138
|
+
<section id="github-login-flow" class="tool-flow" hidden aria-label="GitHub sign-in">
|
|
139
|
+
<h3 id="github-flow-state" data-i18n="tools_waiting">Waiting for GitHub</h3>
|
|
140
|
+
<p class="hint" data-i18n="tools_device_instructions">Open GitHub, enter this code, and authorize CCDX.</p><code id="github-user-code" class="device-code">—</code>
|
|
141
|
+
<a id="github-authorize" class="tool-link" href="https://github.com/login/device" target="_blank" rel="noopener noreferrer" data-i18n="tools_open_github">Open GitHub</a>
|
|
142
|
+
<button id="github-cancel" type="button" data-i18n="cancel">Cancel</button>
|
|
143
|
+
<p class="hint" data-i18n="tools_keep_old_signin">Old sign-in is kept until verification succeeds.</p>
|
|
144
|
+
</section>
|
|
145
|
+
<p id="github-account-note" class="hint" role="status" aria-live="polite"></p>
|
|
146
|
+
<details class="tool-details"><summary data-i18n="tools_details">Check details</summary><dl class="failure-detail"><dt data-i18n="tools_storage">Saved sign-in</dt><dd id="github-store">—</dd><dt data-i18n="tools_error_code">Error code</dt><dd id="github-check-code">—</dd><dt>HTTP</dt><dd id="github-check-http">—</dd></dl></details>
|
|
147
|
+
<details class="tool-details"><summary data-i18n="tools_more_actions">More actions</summary><div class="section-actions"><button id="github-force-reauth" type="button" data-i18n="tools_reauth">Sign in again</button><button id="github-logout" type="button" data-i18n="tools_logout">Sign out of CCDX</button></div><p class="hint" data-i18n="tools_logout_scope">Other apps stay signed in.</p></details>
|
|
148
|
+
</section>
|
|
149
|
+
<section class="panel dashboard-section" id="m365-source-access" hidden aria-labelledby="source-access-heading">
|
|
141
150
|
<h2 id="source-access-heading">Microsoft 365</h2>
|
|
142
151
|
<p class="hint" data-i18n="m365_source_access">Provides models for Codex and Claude on supported devices.</p>
|
|
143
152
|
<div class="section-actions"><button id="m365-on" type="button" data-i18n="enable_service">Enable source</button><button id="m365-off" type="button" data-i18n="disable_service">Disable source</button></div>
|
|
@@ -151,6 +160,39 @@
|
|
|
151
160
|
</div>
|
|
152
161
|
<p id="m365-account-note" class="hint" role="status" aria-live="polite"></p>
|
|
153
162
|
</section>
|
|
163
|
+
<details class="panel dashboard-section" id="upstream-models" open>
|
|
164
|
+
<summary class="panel-heading"><h2 data-i18n="model_catalog">MODEL LIST</h2><span id="models-state" data-i18n="checking_live">CHECKING</span></summary>
|
|
165
|
+
<div class="section-actions"><button id="refresh-models" type="button" data-i18n="refresh">Refresh</button></div>
|
|
166
|
+
<p id="models-note" class="table-note" data-i18n="reading_provider_catalog">Loading model list…</p>
|
|
167
|
+
<details id="model-check-details" class="model-check-details" hidden><summary data-i18n="source_check_details">Check details</summary><dl id="model-check-fields" class="failure-detail"></dl><p class="hint" data-i18n="source_check_action">Use Refresh to check this source again.</p></details>
|
|
168
|
+
<div class="table-wrap"><table><thead><tr><th scope="col" data-i18n="model">MODEL</th><th scope="col" data-i18n="vendor">MODEL MAKER</th><th scope="col" data-i18n="api">CONNECTION TYPE</th><th scope="col" data-i18n="client">APP</th><th scope="col" data-i18n="reasoning">THINKING LEVEL</th><th scope="col" data-i18n="state">STATE</th></tr></thead><tbody id="live-models-body" role="tabpanel"><tr><td colspan="6" data-i18n="loading">Loading…</td></tr></tbody></table></div>
|
|
169
|
+
<p class="hint" data-i18n="catalog_listing_does_not_guarantee_inference_access">Listed does not mean your account can use it.</p>
|
|
170
|
+
</details>
|
|
171
|
+
<details class="panel dashboard-section" id="account-authorization">
|
|
172
|
+
<summary class="panel-heading"><h2 data-i18n="account_authorization">ACCOUNT AUTHORIZATION</h2><span data-i18n="by_provider">BY SOURCE</span></summary>
|
|
173
|
+
<p class="hint" data-i18n="saved_credentials_authorization_model_access_and_client_requests">Saved sign-in, access, models and app requests are separate checks.</p>
|
|
174
|
+
<div class="table-wrap"><table><thead><tr><th data-i18n="source">Source</th><th data-i18n="account">ACCOUNT</th><th data-i18n="authorization">AUTHORIZATION</th><th data-i18n="service">SERVICE</th><th data-i18n="last_verified">LAST VERIFIED</th><th data-i18n="time_left">Time left</th></tr></thead><tbody id="provider-auth"></tbody></table></div>
|
|
175
|
+
</details>
|
|
176
|
+
</div>
|
|
177
|
+
</div>
|
|
178
|
+
<div data-view="checks" hidden>
|
|
179
|
+
<section class="panel dashboard-section">
|
|
180
|
+
<h2 data-i18n="tools_checks_title">Checks & repairs</h2>
|
|
181
|
+
<p class="hint" data-i18n="tools_local_scope">Local checks do not contact external services.</p>
|
|
182
|
+
<div class="section-actions"><button id="check-local" type="button" data-i18n="tools_check_local">Check this computer</button><button id="check-account-link" type="button" data-i18n="tools_check_connection">Check connection</button><button id="export-report" type="button" data-i18n="tools_export_report">Export report</button></div>
|
|
183
|
+
<p id="checks-note" class="table-note" role="status" aria-live="polite" data-i18n="tools_checks_empty">Run a check to see the results.</p>
|
|
184
|
+
<div class="table-wrap"><table class="checks-table"><thead><tr><th data-i18n="tools_check_item">Check</th><th data-i18n="state">State</th><th data-i18n="tools_details">Details</th></tr></thead><tbody id="checks-body"></tbody></table></div>
|
|
185
|
+
</section>
|
|
186
|
+
<section class="panel dashboard-section">
|
|
187
|
+
<h2 data-i18n="tools_codex_connection">Codex connection</h2><p class="hint" data-i18n="tools_config_scope">Review CCDX-managed fields before repair. Other settings are preserved.</p>
|
|
188
|
+
<div class="section-actions"><button id="preview-config-repair" type="button" data-i18n="tools_review_repair">Review repair</button></div>
|
|
189
|
+
<section id="config-repair-preview" class="tool-flow" hidden><h3 data-i18n="tools_repair_preview">Repair preview</h3><dl id="config-repair-fields" class="failure-detail"></dl><pre id="config-preview-details" class="tool-code"></pre><div class="section-actions"><button id="apply-config-repair" type="button" data-i18n="tools_apply_repair">Back up and repair</button><button id="cancel-config-repair" type="button" data-i18n="cancel">Cancel</button></div></section>
|
|
190
|
+
</section>
|
|
191
|
+
<details class="panel dashboard-section"><summary data-i18n="tools_more_checks">More checks</summary>
|
|
192
|
+
<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>
|
|
193
|
+
<h3 data-i18n="tools_compatibility">Model compatibility</h3><p class="hint" data-i18n="tools_compatibility_scope">This test sends model requests and uses quota. Run it explicitly in your terminal:</p><pre class="tool-code">ccdx doctor --compat</pre>
|
|
194
|
+
<p class="hint" data-i18n="tools_report_scope">Reports omit credentials, account details and chat content.</p>
|
|
195
|
+
</details>
|
|
154
196
|
</div>
|
|
155
197
|
<div data-view="usage" hidden>
|
|
156
198
|
|
|
@@ -1,5 +1,91 @@
|
|
|
1
1
|
(() => {
|
|
2
2
|
const translations = {
|
|
3
|
+
"cancel": ["Cancel", "取消"],
|
|
4
|
+
"tools_checks_title": ["Checks & repairs", "检查与修复"],
|
|
5
|
+
"tools_source_browse": ["Browsing a source does not change app settings.", "切换标签只查看来源,不改变应用设置。"],
|
|
6
|
+
"tools_saved_account": ["Saved GitHub sign-in", "已保存 GitHub 登录"],
|
|
7
|
+
"tools_not_signed_in": ["Not signed in", "尚未登录"],
|
|
8
|
+
"tools_signin_invalid": ["Sign-in invalid", "登录已失效"],
|
|
9
|
+
"tools_verified": ["Passed", "检查通过"],
|
|
10
|
+
"tools_unavailable": ["Unavailable", "无法使用"],
|
|
11
|
+
"tools_not_checked": ["Not checked", "尚未检查"],
|
|
12
|
+
"tools_login_hint": ["Sign in to check Copilot access and models.", "登录后检查 Copilot 权限和模型。"],
|
|
13
|
+
"tools_saved_not_valid": ["A saved sign-in does not confirm current access.", "保存过登录,不代表当前仍可用。"],
|
|
14
|
+
"tools_access_hint": ["Check access or network settings before changing sign-in.", "先检查权限或网络,再决定是否重新登录。"],
|
|
15
|
+
"tools_account_hint": ["Saved sign-in and online access are checked separately.", "本地登录与在线权限分别检查。"],
|
|
16
|
+
"tools_saved_signin": ["Saved sign-in", "本地登录"],
|
|
17
|
+
"tools_github_identity": ["GitHub identity", "GitHub 身份"],
|
|
18
|
+
"tools_copilot_access": ["Copilot access", "Copilot 权限"],
|
|
19
|
+
"tools_catalog_read": ["Model catalog", "模型读取"],
|
|
20
|
+
"tools_login": ["Sign in to GitHub", "登录 GitHub"],
|
|
21
|
+
"tools_reauth": ["Sign in again", "重新登录"],
|
|
22
|
+
"tools_check_connection": ["Check connection", "检查连接"],
|
|
23
|
+
"tools_logout": ["Sign out of CCDX", "退出 CCDX 登录"],
|
|
24
|
+
"tools_logout_scope": ["Other apps stay signed in.", "不会退出其他应用的登录。"],
|
|
25
|
+
"tools_logout_confirm": ["Sign out of CCDX? New requests will need a sign-in. Other apps stay signed in.", "退出 CCDX 登录?新请求需要重新登录。其他应用不受影响。"],
|
|
26
|
+
"tools_no_inference": ["Checks access and models. No chat request is sent.", "只检查权限和模型,不发送对话。"],
|
|
27
|
+
"tools_waiting": ["Waiting for GitHub", "等待 GitHub 授权"],
|
|
28
|
+
"tools_verifying": ["Verifying account and models", "正在检查账号和模型"],
|
|
29
|
+
"tools_device_instructions": ["Open GitHub, enter this code, and authorize CCDX.", "打开 GitHub,输入代码并授权。"],
|
|
30
|
+
"tools_open_github": ["Open GitHub", "打开 GitHub"],
|
|
31
|
+
"tools_keep_old_signin": ["Old sign-in is kept until verification succeeds.", "验证成功后才替换原登录。"],
|
|
32
|
+
"tools_signin_complete": ["Sign-in verified. Start a new conversation. Restart CCDX to change accounts.", "登录已验证,请开始新对话。切换账号需重启 CCDX。"],
|
|
33
|
+
"tools_check_complete": ["Account access and model catalog checks passed.", "账号权限和模型目录检查通过。"],
|
|
34
|
+
"tools_storage": ["Saved sign-in", "登录保存位置"],
|
|
35
|
+
"tools_error_code": ["Error code", "错误代码"],
|
|
36
|
+
"tools_ccdx_store": ["CCDX sign-in store", "CCDX 自有登录"],
|
|
37
|
+
"tools_legacy_store": ["Legacy sign-in (compatible read)", "兼容读取旧登录"],
|
|
38
|
+
"tools_details": ["Details", "详细结果"],
|
|
39
|
+
"tools_more_actions": ["More actions", "更多操作"],
|
|
40
|
+
"tools_reauth_hint": ["GitHub rejected this sign-in. Sign in again.", "GitHub 拒绝了当前登录,请重新登录。"],
|
|
41
|
+
"tools_access_denied": ["GitHub sign-in is valid. Check your Copilot access or company policy.", "GitHub 登录有效。请检查 Copilot 权限或公司策略。"],
|
|
42
|
+
"tools_network_hint": ["Connection could not be verified. Check network settings; saved sign-in is kept.", "连接未能验证。请检查网络,原登录已保留。"],
|
|
43
|
+
"tools_local_scope": ["Local checks do not contact external services.", "本机检查不访问外部服务。"],
|
|
44
|
+
"tools_check_local": ["Check this computer", "本机检查"],
|
|
45
|
+
"tools_export_report": ["Export report", "导出报告"],
|
|
46
|
+
"tools_checks_empty": ["Run a check to see the results.", "运行本机检查后显示结果。"],
|
|
47
|
+
"tools_checks_completed": ["Local checks completed at {time}.", "本机检查完成于 {time}。"],
|
|
48
|
+
"tools_check_item": ["Check", "检查项"],
|
|
49
|
+
"tools_github_signin": ["GitHub sign-in", "GitHub 登录"],
|
|
50
|
+
"tools_codex_settings": ["Codex settings", "Codex 配置"],
|
|
51
|
+
"tools_windows_command": ["Windows command", "Windows 命令"],
|
|
52
|
+
"tools_environment": ["Local environment", "本机环境"],
|
|
53
|
+
"tools_needs_attention": ["Needs attention", "需要处理"],
|
|
54
|
+
"tools_observed": ["Recorded", "已记录"],
|
|
55
|
+
"tools_codex_connection": ["Codex connection", "Codex 连接"],
|
|
56
|
+
"tools_config_scope": ["Review CCDX-managed fields before repair. Other settings are preserved.", "先查看 CCDX 管理的字段,再决定是否修复。其他设置保留。"],
|
|
57
|
+
"tools_review_repair": ["Review repair", "查看修复"],
|
|
58
|
+
"tools_repair_preview": ["Repair preview", "修复预览"],
|
|
59
|
+
"tools_managed_fields": ["Managed fields", "管理字段"],
|
|
60
|
+
"tools_backup": ["Backup", "配置备份"],
|
|
61
|
+
"tools_apply_repair": ["Back up and repair", "备份并修复"],
|
|
62
|
+
"tools_repair_complete": ["Configuration repaired and checked. Previous settings were backed up when present.", "配置已修复并检查。原配置存在时已备份。"],
|
|
63
|
+
"tools_repair_preserved": ["Settings preserved. Review the configuration before retrying.", "配置已保留,请先检查原文件。"],
|
|
64
|
+
"tools_more_checks": ["More checks", "更多检查"],
|
|
65
|
+
"tools_network_check": ["Network settings", "网络设置"],
|
|
66
|
+
"tools_network_read_only": ["Network settings read. Proxy and certificate policies are unchanged.", "已读取网络设置,代理和证书策略保持不变。"],
|
|
67
|
+
"tools_compatibility": ["Model compatibility", "模型兼容性"],
|
|
68
|
+
"tools_compatibility_scope": ["This test sends model requests and uses quota. Run it explicitly in your terminal:", "此检查会调用模型并产生用量。请在终端明确执行:"],
|
|
69
|
+
"tools_report_scope": ["Reports omit credentials, account details and chat content.", "报告不含凭据、账号详情和对话内容。"],
|
|
70
|
+
"tools_report_saved": ["Report exported. Share it only with people you trust.", "报告已导出,请仅分享给可信的人。"],
|
|
71
|
+
"tools_read_failed": ["Could not read tool status. Restart the updated CCDX service.", "无法读取工具状态,请重启新版 CCDX。"],
|
|
72
|
+
"tools_action_failed": ["Could not complete the action. Existing settings were preserved where possible.", "操作未完成,请查看当前状态。"],
|
|
73
|
+
"tools_invalid_action": ["Unsupported tool action.", "不支持此工具操作。"],
|
|
74
|
+
"auth_busy": ["A sign-in is already in progress.", "已有登录正在进行。"],
|
|
75
|
+
"auth_retry_later": ["Wait 30 seconds before starting another sign-in.", "请等待 30 秒后再开始登录。"],
|
|
76
|
+
"auth_invalid_account": ["Enter a valid GitHub account name.", "请输入有效的 GitHub 账号名。"],
|
|
77
|
+
"auth_start_failed": ["Could not start GitHub sign-in. Saved sign-in kept.", "无法开始 GitHub 登录,原登录已保留。"],
|
|
78
|
+
"auth_verification_failed": ["Could not verify the new sign-in. Saved sign-in kept.", "新登录未能验证,原登录已保留。"],
|
|
79
|
+
"auth_account_mismatch": ["The new account differs from the saved account. Saved sign-in kept. Use CLI --login to choose another account.", "新账号与原账号不同,原登录已保留。请在命令行用 --login 指定账号。"],
|
|
80
|
+
"auth_signin_changed": ["Saved sign-in changed during authorization. Retry; no credential was overwritten.", "授权期间登录已变化,请重试。未覆盖凭据。"],
|
|
81
|
+
"auth_cancelled": ["Sign-in cancelled. Previous sign-in kept.", "登录已取消,原登录已保留。"],
|
|
82
|
+
"auth_expired": ["Authorization code expired. Previous sign-in kept.", "授权代码已过期,原登录已保留。"],
|
|
83
|
+
"auth_denied": ["Authorization was not completed. Previous sign-in kept.", "授权未完成,原登录已保留。"],
|
|
84
|
+
"auth_operation_changed": ["Sign-in changed. Refresh this page.", "登录流程已变化,请刷新。"],
|
|
85
|
+
"auth_confirmation_required": ["Confirm sign-out before continuing.", "请先确认退出登录。"],
|
|
86
|
+
"auth_restart_required": ["Sign-in saved. Restart CCDX to apply it.", "登录已保存,请重启 CCDX 生效。"],
|
|
87
|
+
"copilot_access_denied": ["Copilot access denied. Check account permissions; previous sign-in kept.", "Copilot 拒绝访问。请检查权限,原登录已保留。"],
|
|
88
|
+
"config_preview_changed": ["Configuration changed. Review a fresh repair preview.", "配置已变化,请重新查看修复预览。"],
|
|
3
89
|
"chart_view": ["Chart view", "图表视图"],
|
|
4
90
|
"bar_chart": ["Bar chart", "柱状图"],
|
|
5
91
|
"line_chart": ["Line chart", "曲线图"],
|
package/src/dashboard/status.js
CHANGED
|
@@ -26,11 +26,20 @@
|
|
|
26
26
|
if (network) localize(authRow.children[3], "network_detail", { source: phrase(`network_source_${network.source}`),
|
|
27
27
|
stage: phrase(`network_stage_${network.stage}`), code: network.cause_code, category: provider.reason }, "title");
|
|
28
28
|
}
|
|
29
|
+
if (globalThis.ccdxIcons) {
|
|
30
|
+
globalThis.ccdxIcons.set(authRow.children[2], states[identity.state] || "unknown", globalThis.ccdxIcons.kind(identity.state));
|
|
31
|
+
globalThis.ccdxIcons.set(authRow.children[3], provider.reason ? "state_reason" : states[provider.state] || "unknown", globalThis.ccdxIcons.kind(provider.state),
|
|
32
|
+
provider.reason ? { state: phrase(states[provider.state] || "unknown"), reason: provider.network_diagnostic ? phrase(`network_cause_${provider.network_diagnostic.cause_code}`) : provider.reason } : {});
|
|
33
|
+
}
|
|
29
34
|
auth.append(authRow);
|
|
30
35
|
for (const client of provider.clients || []) {
|
|
31
36
|
const row = tableRow([provider.name, client.name, states[client.state] || client.state,
|
|
32
37
|
client.gateway || "—", client.last_request_at || "—"], { labels: [2, 3] });
|
|
33
38
|
if (client.reason) localize(row.children[2], "state_reason", { state: phrase(states[client.state] || "unknown"), reason: client.reason });
|
|
39
|
+
if (globalThis.ccdxIcons) {
|
|
40
|
+
globalThis.ccdxIcons.set(row.children[2], client.reason ? "state_reason" : states[client.state] || client.state, globalThis.ccdxIcons.kind(client.state), client.reason ? { state: phrase(states[client.state] || "unknown"), reason: client.reason } : {});
|
|
41
|
+
if (["running", "unavailable"].includes(client.gateway)) globalThis.ccdxIcons.set(row.children[3], client.gateway, globalThis.ccdxIcons.kind(client.gateway));
|
|
42
|
+
}
|
|
34
43
|
clients.append(row);
|
|
35
44
|
}
|
|
36
45
|
if (provider.requests) {
|