codex-copilot-dx 1.3.7 → 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 CHANGED
@@ -17,8 +17,8 @@ ccdx
17
17
 
18
18
  Without Node.js, download and run the installer for your system:
19
19
 
20
- - macOS: [install.sh](https://github.com/DaleXiao/codex-copilot-dx/releases/download/v1.3.7/install.sh), then `sh install.sh`.
21
- - Windows: [install.ps1](https://github.com/DaleXiao/codex-copilot-dx/releases/download/v1.3.7/install.ps1), then `./install.ps1` under your current shell policy.
20
+ - macOS: [install.sh](https://github.com/DaleXiao/codex-copilot-dx/releases/download/v1.3.8/install.sh), then `sh install.sh`.
21
+ - Windows: [install.ps1](https://github.com/DaleXiao/codex-copilot-dx/releases/download/v1.3.8/install.ps1), then `./install.ps1` under your current shell policy.
22
22
 
23
23
  The installer reuses a compatible Node.js or installs a private, verified copy. Git and a compiler are not required. Complete platform packages include their dependencies. Company registry, proxy, certificate and shell policies are kept.
24
24
 
@@ -57,22 +57,13 @@ Use `ccdx help` or `ccdx <command> --help` for options. The CLI uses English; th
57
57
 
58
58
  **1.3 uses one command tree.** Old command names and the `codex-copilot-dx` executable have been removed. This changes command entrypoints, not saved accounts, model selections or chats. See the [command reference](docs/REFERENCE.md#commands).
59
59
 
60
- ## Optional features
60
+ ## Features and maintenance
61
61
 
62
- Images, native input suggestions and overnight updates are **off by default**. Existing enabled settings are retained.
62
+ Use the Web UI for accounts, APIs, models, client access, input suggestions, image setup, local masking, appearance, diagnostics and updates. CLI commands remain available for automation and recovery. See the [control reference](docs/REFERENCE.md#webui-and-cli-controls).
63
63
 
64
- - **Images:** `ccdx app codex image setup`. [Image guide](docs/REFERENCE.md#optional-image-generation).
65
- - **Input suggestions:** `ccdx app codex prediction setup`. Setup adds trust within the Codex profile and locally decrypts traffic for the configured prediction hosts. Read the [setup and removal guide](docs/REFERENCE.md#optional-native-predictions) first.
66
- - **Appearance and updates:** open Settings. Web and terminal colors are independent.
67
-
68
- ## Update and troubleshoot
69
-
70
- Finish active tasks before updating the active installation. Install the update, then restart CCDX normally:
71
-
72
- ```sh
73
- ccdx update github
74
- ccdx version
75
- ```
64
+ - **Input suggestions:** new integrations attempt setup by default when Codex is closed. Saved off choices are retained. The Web UI can enable, disable, finish setup, open Codex and repair the bridge. Setup synchronizes Show predictions, adds App-profile trust and locally decrypts the prediction hosts' HTTPS traffic. App/thread eligibility still applies. [Details](docs/REFERENCE.md#optional-native-predictions).
65
+ - **Images:** configure the address, key and model in Codex → Image generation. Image setup and overnight updates remain off by default.
66
+ - **Updates:** Settings → Install update downloads and verifies a stable release, then switches the installed service when idle. Busy work postpones the switch. Unmanaged launches require the installer or an installed command. [Details](docs/REFERENCE.md#installation-and-updates).
76
67
 
77
68
  Web UI activity updates through server push; the terminal uses the same in-process activity feed. Reconnecting restores current state and bounded recent records.
78
69
 
package/bin/cli.mjs CHANGED
@@ -38,6 +38,15 @@ if (CLI.command === "manage") {
38
38
  process.exit(1);
39
39
  }
40
40
  }
41
+ if (CLI.command === "update-managed") {
42
+ try {
43
+ if (!CLI.yes) throw new Error("Confirm with --yes to install and switch the idle service. You can also use Settings in the WebUI.");
44
+ const { dashboardToolRequest } = await import("../src/cli-tools.mjs");
45
+ const address = parseAdapterAddressOptions(process.env);
46
+ console.log(JSON.stringify((await dashboardToolRequest({ host: address.adapterHost, port: address.adapterPort, path: "settings", body: { action: "update", confirmed: true }, detailedErrors: true })).last_operation));
47
+ process.exit(0);
48
+ } catch (error) { console.error(status("err", error.message));process.exit(1); }
49
+ }
41
50
  if (CLI.command === "web") {
42
51
  try {
43
52
  const { runWebCommand } = await import("../src/cli-web.mjs");
@@ -95,11 +104,21 @@ if (CLI.command === "image") {
95
104
  }
96
105
  if (CLI.command === "prediction") {
97
106
  try {
98
- if (["pause", "resume"].includes(CLI.action)) {
99
- const { pauseServiceFeature } = await import("../src/cli-tools.mjs");
107
+ if (!["status", "fix"].includes(CLI.action)) {
108
+ const { checkRunningAdapter } = await import("../src/running-adapter.mjs");
109
+ const { dashboardToolRequest } = await import("../src/cli-tools.mjs");
100
110
  const address = parseAdapterAddressOptions(process.env);
101
- console.log(await pauseServiceFeature({ feature: "prediction", action: CLI.action, host: address.adapterHost, port: address.adapterPort }));
102
- process.exit(0);
111
+ const running = await checkRunningAdapter({ host: address.adapterHost, port: address.adapterPort });
112
+ const operation = { on: "setup", off: "remove", fix: "repair" }[CLI.action] || CLI.action;
113
+ if (running.ok) {
114
+ const data = await dashboardToolRequest({ host: address.adapterHost, port: address.adapterPort, path: "settings", body: { action: "prediction", operation }, detailedErrors: true, timeoutMs: 210000 });
115
+ const result = data.last_operation?.result || data.features?.prediction;
116
+ console.log(JSON.stringify(result));process.exit(result?.status === "failed" ? 1 : 0);
117
+ }
118
+ if (["enable", "disable", "setup", "remove", "pause", "resume", "open"].includes(operation)) {
119
+ const { controlPrediction } = await import("../src/prediction-control.mjs");
120
+ console.log(JSON.stringify(await controlPrediction(operation)));process.exit(0);
121
+ }
103
122
  }
104
123
  const { readAdapterStatus } = await import("../src/cli-status.mjs");
105
124
  const { runPredictionCommand } = await import("../src/native-prediction.mjs");
@@ -234,6 +253,24 @@ if (CLI.command === "doctor" && CLI.configOnly) {
234
253
  process.exit(checks.some((check) => check.kind === "err") ? 1 : 0);
235
254
  }
236
255
 
256
+ let serviceWorker = null;
257
+ if (CLI.command === "start" && !(process.send && process.env.CCDX_SUPERVISED_SERVICE === "1")) {
258
+ const { nightlyUpdatePreference } = await import("../src/user-settings.mjs");
259
+ const { checkRunningAdapter } = await import("../src/running-adapter.mjs");
260
+
261
+ const { installedUpdateEnvironment } = await import("../src/nightly-update.mjs");
262
+ const address = parseAdapterProbeOptions(process.env);
263
+ const existing = await checkRunningAdapter({ host: address.adapterHost, port: address.adapterPort, timeoutMs: address.existingAdapterTimeoutMs });
264
+ let environment;
265
+ try { if (!existing.ok && !existing.incompatible) environment = installedUpdateEnvironment(); }
266
+ catch { if (nightlyUpdatePreference()) console.warn(status("warn", "Dashboard updates need a writable, matching npm installation. Starting without automatic updates.")); }
267
+ if (environment) {
268
+ const { runServiceSupervisor } = await import("../src/service-supervisor.mjs");
269
+ try { process.exit(await runServiceSupervisor({ environment })); }
270
+ catch { console.warn(status("warn", "Nightly runtime preparation failed. Starting without automatic updates.")); }
271
+ }
272
+ }
273
+
237
274
  // Startup components are loaded only after read-only and local tool commands exit.
238
275
  const { ensureAuth, openCodex } = await import("../src/launcher.mjs");
239
276
  const { startAdapter } = await import("../src/adapter.mjs");
@@ -257,24 +294,9 @@ const { createTerminalConsole } = await import("../src/terminal-console.mjs");
257
294
  const { createServiceControl } = await import("../src/service-control.mjs");
258
295
  const { openDashboard } = await import("../src/browser-launch.mjs");
259
296
 
260
- let serviceWorker = null;
261
- if (CLI.command === "start") {
262
- if (process.send && process.env.CCDX_SUPERVISED_SERVICE === "1") {
263
- const { createServiceWorker } = await import("../src/service-worker.mjs");
264
- serviceWorker = await createServiceWorker();
265
- } else if (nightlyUpdatePreference()) {
266
- const { installedUpdateEnvironment } = await import("../src/nightly-update.mjs");
267
- const address = parseAdapterProbeOptions(process.env);
268
- const existing = await checkRunningAdapter({ host: address.adapterHost, port: address.adapterPort, timeoutMs: address.existingAdapterTimeoutMs });
269
- let environment;
270
- try { if (!existing.ok && !existing.incompatible) environment = installedUpdateEnvironment(); }
271
- catch { console.warn(status("warn", "Nightly updates need a writable, matching npm installation. Starting without automatic updates.")); }
272
- if (environment) {
273
- const { runServiceSupervisor } = await import("../src/service-supervisor.mjs");
274
- try { process.exit(await runServiceSupervisor({ environment })); }
275
- catch { console.warn(status("warn", "Nightly runtime preparation failed. Starting without automatic updates.")); }
276
- }
277
- }
297
+ if (CLI.command === "start" && process.send && process.env.CCDX_SUPERVISED_SERVICE === "1") {
298
+ const { createServiceWorker } = await import("../src/service-worker.mjs");
299
+ serviceWorker = await createServiceWorker();
278
300
  }
279
301
 
280
302
  let RUNTIME;
@@ -415,10 +437,9 @@ try {
415
437
  else if (command.status === "preserved") console.warn(startupCheck("warn", "Command", "Existing launcher preserved; use ccdx.cmd doctor to inspect it"));
416
438
  } catch { console.warn(startupCheck("warn", "Command", "Command setup skipped; service will start")); }
417
439
  }
418
- const updateNotice = runInBackground(printUpdateNotice);
419
440
  if (!serviceWorker?.warming && await reuseRunningAdapterIfAvailable()) {
420
441
  // Ready is already displayed; finish the bounded check before this short-lived CLI exits.
421
- await updateNotice;
442
+ await printUpdateNotice();
422
443
  serviceWorker?.reused();
423
444
  startupPresentation.finish();await LOGGING.cleanup();
424
445
  process.exit(0);
@@ -445,7 +466,7 @@ try {
445
466
  githubCredentialFingerprint: () => profileRuntime.codexCredentialFingerprint,
446
467
  log: (kind, message) => console.log(startupComplete ? status(kind, message) : startupCheck(kind, "M365", message)) });
447
468
  const codexEnabled = providerRuntime.connections().clients.find(client => client.id === "codex").enabled;
448
- const predictionSetup = codexEnabled && !serviceWorker?.warming ? runInBackground(() => earlyIntegration.start()) : Promise.resolve(null);
469
+ const predictionSetup = codexEnabled && !serviceWorker?.warming ? runInBackground(() => earlyIntegration.start({ autoSetup: !serviceWorker?.preserving })) : Promise.resolve(null);
449
470
  const m365Setup = runInBackground(() => providerRuntime.start());
450
471
  if (providerRuntime.selection().codex === "github") {
451
472
  try { await ensureAuth({ log: startupLogger("Sign-in"), interactive: serviceWorker?.preserving !== true,
@@ -483,7 +504,9 @@ try {
483
504
  snapshot: () => activeServer?.ccdxSnapshot?.() || {},
484
505
  subscribe: listener => activeServer?.ccdxSubscribeActivity?.(listener),
485
506
  preferences: () => { const { saved, theme, color_theme } = serviceSettingsSnapshot();return { ...saved, theme, color_theme }; } });
486
- const serviceControl = createServiceControl({ providerRuntime, clientIntegration: earlyIntegration, terminal: terminalConsole, nightlyStatus: () => serviceWorker?.status() || null, nightlyChanged: enabled => serviceWorker?.preferenceChanged(enabled) });
507
+ const serviceControl = createServiceControl({ providerRuntime, clientIntegration: earlyIntegration, terminal: terminalConsole,
508
+ adapterPort: ADAPTER_PORT, adapterHost: ADAPTER_HOST, manualUpdate: serviceWorker ? () => serviceWorker.requestUpdate() : undefined,
509
+ nightlyStatus: () => serviceWorker?.status() || null, nightlyChanged: enabled => serviceWorker?.preferenceChanged(enabled) });
487
510
  const codexModelCatalog = createCodexModelCatalog();
488
511
  activeServer = await startAdapter(serviceWorker?.warming ? 0 : ADAPTER_PORT, serviceWorker?.warming ? "127.0.0.1" : ADAPTER_HOST, {
489
512
  log: startupLogger("Service"),
@@ -503,7 +526,7 @@ try {
503
526
  credentialsChanged: () => { defaultCopilotClient.invalidateCredentials();profileRuntime = createProfileRuntime({ codexClient: defaultCopilotClient }); },
504
527
  applyAnimation: theme => terminalConsole.apply({ theme }) },
505
528
  nativePredictionPac: () => clientIntegration?.pacUrl() || null,
506
- fixPrediction: async () => (await clientIntegrations()).fix(),
529
+ fixPrediction: async () => (await import("../src/prediction-control.mjs")).controlPrediction("repair", { integration: await clientIntegrations() }),
507
530
  clientIntegrationSnapshot: () => clientIntegration?.snapshot() || null,
508
531
  });
509
532
 
@@ -536,6 +559,7 @@ try {
536
559
 
537
560
  startupComplete = true;
538
561
  if (!startupPresentation.enabled) console.log(startupReady({ baseUrl: adapterBaseUrl(ADAPTER_HOST, ADAPTER_PORT), commandName: CLI_NAME }));
562
+ runInBackground(printUpdateNotice);
539
563
  await launchDashboard();
540
564
  if (!serviceWorker?.warming) {
541
565
  startupPresentation.finish();for (const [method, args] of startupPresentation.warnings) terminalConsole.log(method, args);
@@ -571,7 +595,7 @@ try {
571
595
  const { clientStateFingerprint, serviceBusinessState } = await import("../src/service-worker.mjs");
572
596
  if (serviceWorker.preserving) providerRuntime.validateLocalKeys();
573
597
  await serviceWorker.ready({
574
- notice: code => console.warn(status("warn", `Nightly update paused: ${code}. Run ccdx update github for details.`)),
598
+ notice: code => console.warn(status("warn", `Update notice: ${code}. See Checks & repairs in the WebUI.`)),
575
599
  stop: () => shutdown("supervisor"),
576
600
  exportState: () => ({ ...activeServer.ccdxExportState(), providers: providerRuntime.exportPrivateState() }),
577
601
  importState: async state => { await activeServer.ccdxImportState(state);providerRuntime.importPrivateState(state.providers); },
@@ -582,13 +606,13 @@ try {
582
606
  },
583
607
  resume: async () => {
584
608
  if (!activeServer.listening) await new Promise((resolve, reject) => { activeServer.once("error", reject);activeServer.listen(ADAPTER_PORT, ADAPTER_HOST, () => { activeServer.off("error", reject);resolve(); }); });
585
- await earlyIntegration.start();earlyIntegration.setPredictionActive(servicePreferences().prediction_enabled);
609
+ await earlyIntegration.start({ autoSetup: false });earlyIntegration.setPredictionActive(servicePreferences().prediction_enabled);
586
610
  await LOGGING.cleanup();LOGGING = configureLogging();terminalConsole.start();LOGGING.setTerminalSink((method, args) => terminalConsole.log(method, args));
587
611
  },
588
612
  promote: async () => {
589
613
  await closeHttpServer(activeServer, { timeoutMs: RUNTIME.shutdownTimeoutMs });
590
614
  await new Promise((resolve, reject) => { activeServer.once("error", reject);activeServer.listen(ADAPTER_PORT, ADAPTER_HOST, () => { activeServer.off("error", reject);resolve(); }); });
591
- if (codexEnabled) { nativePrediction = await earlyIntegration.start();await nativePrediction?.prepareRoute();earlyIntegration.setPredictionActive(servicePreferences().prediction_enabled); }
615
+ if (codexEnabled) { nativePrediction = await earlyIntegration.start({ autoSetup: false });await nativePrediction?.prepareRoute();earlyIntegration.setPredictionActive(servicePreferences().prediction_enabled); }
592
616
  },
593
617
  activate: async () => {
594
618
  await LOGGING.cleanup();try { LOGGING = configureLogging(); } catch { LOGGING = configureLogging({ env: { ...process.env, CCDX_LOG_PATH: "" } }); }
@@ -598,7 +622,7 @@ try {
598
622
  const data = activeServer.ccdxSnapshot(), routes = data.requests.by_route;
599
623
  let fingerprint = null;try { fingerprint = clientStateFingerprint(); } catch {}
600
624
  return { version: LOCAL_VERSION, fingerprint, business: serviceBusinessState(providerRuntime),
601
- busy: !fingerprint || activeServer.ccdxBusy() || clientIntegration.busy() || data.models.refresh_in_flight === true || data.model_activity.active === null,
625
+ busy: !fingerprint || activeServer.ccdxBusy() || clientIntegration.busy() || serviceControl.busy() || data.models.refresh_in_flight === true || data.model_activity.active === null,
602
626
  health: { github: profileRuntime.codexClient.runtimeStatus().token_cached === true && !profileModels.codexRegistry.lastError,
603
627
  m365: data.providers?.m365?.state === "ready", prediction: earlyIntegration.bridgeHealthy() },
604
628
  activity: { active: data.model_activity.active || 0, total: ["responses", "responses_compact", "messages"].reduce((n, key) => n + (routes[key]?.total || 0), data.image_generation?.total || 0) } };
@@ -1069,3 +1069,13 @@ Progress and readiness share the existing coalesced activity SSE. The settings c
1069
1069
  Local privacy failures carry a separate origin. Request-check and response-restoration messages state different outcomes. Explicit failed tool results in the latest Messages input add only a count to request metadata, without retaining their content or changing a successful model response into a claim of tool-workflow success. SDK tests use independent client parsers; native CLI replays execute a local MCP fixture in temporary profiles, return its result and require the following response to complete.
1070
1070
 
1071
1071
  Claude passthrough now holds incomplete SSE frames and validates complete data before forwarding. Malformed tails do not precede the terminal error; valid final JSON without a newline remains deliverable. Capability restoration and replacement writes use the existing ownership journal in one transaction, preserving both files and ownership on failure.
1072
+
1073
+ ## WebUI feature controls
1074
+
1075
+ `service-control.mjs` serializes management actions and projects saved/effective state. WebUI and CLI prediction/update commands call this same boundary. `prediction-control.mjs` coordinates existing native setup, bridge lifecycle and App launch; `prediction-preference.mjs` owns the closed-App display-setting transaction across desktop TOML and legacy state. A pending display write is explicit and never reported as visible-suggestion proof. Fresh default setup runs only before App launch and preserves saved off choices.
1076
+
1077
+ `image-setup.mjs` owns image provider inspection and the existing atomic config/credential and guidance transaction. CLI owns terminal prompts; `dashboard/features.js` owns browser forms. Neither renderer receives saved image keys. The model compatibility action uses `doctor-compat.mjs` through local tools and requires explicit quota confirmation.
1078
+
1079
+ The existing supervisor accepts a bounded manual update request as well as its optional nightly scheduler. Both use the same staged package verification, immutable worker, state-transfer, installation commit and rollback path. Manual and scheduled updates are mutually exclusive; settings operations contribute to busy state and image configuration and stable prediction intent/trust participate in the state fingerprint; native port allocation and App stat bookkeeping do not. Warm handoff suppresses first-time prediction setup and pending display writes. Explicit prediction reconfiguration replaces the old bridge after committing trust. An unowned installation falls back to the existing standalone launch and exposes that self-update is unavailable. No inference protocol, privacy transport or native authentication path is changed by these controls.
1080
+
1081
+ Native discovery, configuration and startup environment inspection run in bounded temporary `prediction-operations.mjs` workers. PowerShell, certificate and filesystem work do not block the gateway event loop. Registered-App discovery precedes default trust/proxy setup; missing Apps leave core startup available. Private environment results feed only bridge initialization and are not returned by WebUI actions.
package/docs/REFERENCE.md CHANGED
@@ -242,9 +242,38 @@ client after its owned configuration changes. All tests using sample capabilitie
242
242
  are isolated; they do not assign sample limits to a user's real models.
243
243
 
244
244
 
245
+ ## WebUI and CLI controls
246
+
247
+ Normal management belongs in the WebUI. CLI provides the same backend operations plus scripting and recovery:
248
+
249
+ | WebUI task | CLI | Effect |
250
+ | --- | --- | --- |
251
+ | Accounts, APIs and models | `source`, `app <id> models` | Shared connection graph, catalogs and credential storage |
252
+ | Client access and synchronization | `app <id> enable/disable/sync` | Preview/recheck ownership; no forced App exit |
253
+ | Delete a disabled, unbound API | `source <id> remove` | Shared impact revision; selected consumers block deletion |
254
+ | Input suggestions: enable/disable | `app codex prediction enable/disable` | Synchronize bridge preference and native Show predictions |
255
+ | Prediction setup/remove/repair/open | `app codex prediction setup/remove/repair/open` | Shared control; App closure may be required |
256
+ | Images: configure/remove/pause/resume | `app codex image setup/remove/pause/resume` | Shared image configuration transaction; keys never returned by WebUI |
257
+ | Install a stable update | `update apply --yes` | Same supervisor request; download, verify and idle service handoff |
258
+ | Standalone update/recovery | `update github/npm`, `doctor` | Available when service management is unavailable |
259
+ | Local/network checks, repair and report | `doctor`, `doctor network/report`, `doctor --fix` | Existing checks and configuration repair |
260
+ | Explicit model compatibility test | `doctor --compat` | Finite Codex Responses/stream/compaction requests; supports vendor IDs; local client credential stays on loopback; WebUI confirms quota use |
261
+ | Decoded request limit | `config limits --decoded <MiB>` | 128–512 MiB; saved for next start; launch environment has priority |
262
+ | Usage, requests, appearance and backups | `usage`, `requests`, `config` | Shared service data/preferences; browser appearance stays browser-local |
263
+
264
+ CLI-only interaction forms include JSON output, file input, key stdin and shell pipelines. Initial installation/startup, a failed service and headless hosts need an external launch/recovery entrypoint. These are not prerequisites for prediction or image configuration. Full runtime-cache purges, batch/file/key-stdin input, JSON formatting and one-installation remote-download exceptions remain advanced CLI operations. Company policy changes remain outside CCDX control.
265
+
266
+ ## Prediction controls
267
+
268
+ WebUI → Codex → Input suggestions is the complete enable/disable control. Setup and explicit enable write only `desktop.composer-predictions-enabled` in Codex TOML and its legacy persisted-atom equivalent; unrelated configuration/state remains intact. Writes require Codex to be closed. An open App keeps a pending display change; quit it and Continue setup, or normally launch CCDX again. The WebUI can open Codex after setup without a terminal command. No running App is forcibly closed.
269
+
270
+ Native configuration and startup environment checks use temporary work threads so OS/crypto work does not block the core service. Missing Apps are checked before trust/proxy setup. A normal cold startup attempts setup once when no CCDX prediction record exists, prediction access is allowed, and the App display preference is not saved off. Failed setup leaves core startup available and can be completed in WebUI. Saved off records and App off choices are preserved. Explicit enable intentionally overrides a prior App display-off setting. Repair keeps the selected on/off intent. Disable retains trust and routing; Remove setup owns trust/route cleanup and may defer cleanup until Codex closes. Visible predictions still require native App/thread eligibility and an actual returned suggestion.
271
+
272
+ Installed command launches use the existing supervisor and immutable workers. WebUI updates preserve accounts, models and request continuation through verified handoff; failure rolls back to the previous installation/runtime. Warm version handoff does not perform first-time setup or apply pending App display writes. Prediction intent/trust participates in the handoff fingerprint; port allocation and App stat bookkeeping are runtime data. Manual updates do not enable the overnight schedule, do not downgrade, and defer while requests or settings operations are active. Launches outside a writable matched installation display their limitation explicitly.
273
+
245
274
  ## Optional native predictions
246
275
 
247
- Native next-message predictions are **off by default** and use no MCP, Hook, skill,
276
+ New native next-message integrations **attempt setup by default when Codex is closed**. Existing CCDX or App off choices are retained. They use no MCP, Hook, skill,
248
277
  panel, renderer injection, or client-program modification. This compatibility
249
278
  feature uses the App's existing composer UI and the conversation's
250
279
  selected model through CCDX. Suggestions are not sent automatically. Native
@@ -429,9 +458,9 @@ No extra inference or bridge exists for users who leave the feature disabled.
429
458
  When enabled, prediction requests consume Copilot usage; the setting does not
430
459
  provide a separate prediction-model picker.
431
460
 
432
- `prediction off` immediately disables new local overlays. Quit/reopen Codex to
461
+ `app codex prediction remove` immediately disables new local overlays. Quit/reopen Codex to
433
462
  clear its cached predictions and temporary route. If the App is still running,
434
- trust removal is deferred; quit it and run `prediction off` again. Only the exact
463
+ trust removal is deferred; quit it and use Remove setup in WebUI again. Only the exact
435
464
  owned certificate record is removed, never the whole store. A CCDX-owned persistent
436
465
  proxy preference is restored first, preserving all unrelated preference values.
437
466
  User-replaced proxy preferences are not restored over. Failed activation
@@ -542,7 +571,7 @@ was recreated on the original address, not that gray text appeared.
542
571
 
543
572
  ## Optional image generation
544
573
 
545
- Image generation is disabled by default. Configure it interactively only when you want Codex App to receive the local CCDX image tool:
574
+ Image generation is disabled by default. Configure it in WebUI → Codex → Image generation: enter an HTTPS address and key, read models, choose one and save. An empty key retains the existing key only for the same origin. Discovery and saving use the existing missing-prompt protocol check; they do not generate an image. Removing setup deletes the saved image credential and only CCDX-owned configuration/guidance. Existing calls may finish when pausing. The same setup transaction is available interactively for advanced CLI use:
546
575
 
547
576
  ```bash
548
577
  ccdx app codex image setup
@@ -554,7 +583,7 @@ An empty key answer retains the saved key only when the normalized endpoint has
554
583
 
555
584
  The provider credential is stored in `~/.config/codex-copilot-dx/image-provider.json`, or under `XDG_CONFIG_HOME`, with mode `0600`. The API key is never written to `~/.codex/config.toml`; that file receives only a marked local MCP entry pointing to the running CCDX adapter with a 210-second tool timeout. Only after enabling, CCDX installs `ccdx-image` guidance under `~/.codex/skills`, with a self-contained Node helper. The concise `SKILL.md` keeps operation selection, safety, and final-image delivery rules; editing details and helper instructions live in references read only for those operations. Codex uses the MCP tool directly, including through deferred tool search; an already-open task without that tool can use the helper to call the same local service and display the saved image. Neither route requires Python, an OpenAI SDK, or copying credentials. Built-in skills and unrelated tools are not modified.
556
585
 
557
- The enable command verifies the local MCP handshake and generation-tool directory without generating an image. It reports provider configuration separately from local service readiness; it cannot assert that every running Codex task has refreshed its catalog. Codex normally detects changed skills; restart Codex App once if an open task has not refreshed them. Normal CCDX startup installs or updates this guidance only for an already-enabled provider, without repeating API setup. Without `enable-image`, it installs neither this skill nor the MCP registration. Unchanged guidance is not rewritten. The existing adapter can remain running because provider settings are loaded when the tool is invoked.
586
+ The enable command verifies the local MCP handshake and generation-tool directory without generating an image. It reports provider configuration separately from local service readiness; it cannot assert that every running Codex task has refreshed its catalog. Codex normally detects changed skills; restart Codex App once if an open task has not refreshed them. Normal CCDX startup installs or updates this guidance only for an already-enabled provider, without repeating API setup. Without image setup, it installs neither this skill nor the MCP registration. Unchanged guidance is not rewritten. The existing adapter can remain running because provider settings are loaded when the tool is invoked.
558
587
 
559
588
  For Qwen-style image responses, CCDX accepts canonical PNG, JPEG, or WebP `data:image/...;base64,` output within the existing 32 MiB image limit. Public HTTPS image URLs still use the same pinned-DNS download checks; HTTP, private-network targets, and URLs with embedded credentials remain rejected.
560
589
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codex-copilot-dx",
3
- "version": "1.3.7",
3
+ "version": "1.3.8",
4
4
  "description": "Local gateway for Codex and Claude with Copilot, Microsoft 365 and custom APIs",
5
5
  "author": "Dale Xiao",
6
6
  "type": "module",
@@ -126,8 +126,8 @@ export const MANAGED_COMMANDS = [
126
126
  outputFormat: flags.format,
127
127
  })
128
128
  ),
129
- ...["setup", "remove", "pause", "resume", "repair"].map(action =>
130
- command(`app codex prediction ${action}`, "Manage the optional Codex prediction integration", {}, () => ({
129
+ ...["enable", "disable", "setup", "remove", "pause", "resume", "repair", "open"].map(action =>
130
+ command(`app codex prediction ${action}`, ({ enable: "Enable suggestions and synchronize native display", disable: "Disable suggestions; synchronize display after App closure", setup: "Configure or renew App trust and suggestion display", remove: "Remove owned prediction trust and routing", pause: "Pause suggestions while retaining setup", resume: "Resume a configured prediction integration", repair: "Check and restore the selected prediction state", open: "Open Codex with the configured prediction route" })[action], {}, () => ({
131
131
  command: "prediction",
132
132
  action: { setup: "on", remove: "off", repair: "fix" }[action] || action,
133
133
  }))
@@ -188,6 +188,7 @@ export const MANAGED_COMMANDS = [
188
188
  "--provider": "value",
189
189
  }),
190
190
  command("update check", "Check a stable release without installing", read),
191
+ command("update apply", "Request the WebUI's verified idle service update", { "--yes": "flag" }, flags => ({ command: "update-managed", yes: !!flags.yes })),
191
192
  ];
192
193
 
193
194
  function pathMatch(pattern, values, partial = false) {
package/src/cli-image.mjs CHANGED
@@ -1,21 +1,17 @@
1
- import fs from "node:fs";
1
+ import { fileContent, enableImageProvider, disableImageProvider } from "./image-setup.mjs";
2
+ export { syncEnabledImageSkill } from "./image-setup.mjs";
2
3
  import os from "node:os";
3
4
  import readline from "node:readline";
4
5
  import { createInterface } from "node:readline/promises";
5
6
  import { codexPaths } from "./codex-paths.mjs";
6
- import { withFileLockSync } from "./lock.mjs";
7
- import { atomicWriteFileIfChangedSync, atomicWriteFilePairSync } from "./atomic-file.mjs";
8
7
  import { terminalCell } from "./cli-table.mjs";
9
- import { computeImageMcpCodexConfig } from "./config.mjs";
10
8
  import { probeImageTool } from "./image-readiness.mjs";
11
- import { updateImageSkill } from "./image-skill.mjs";
12
9
  import { servicePreferences, writeServicePreference } from "./user-settings.mjs";
13
10
  import {
14
11
  imageProviderConfigPath,
15
12
  inspectImageProvider,
16
13
  normalizeImageEndpoint,
17
14
  readImageProviderConfig,
18
- validateImageProviderConfig,
19
15
  } from "./image-provider-config.mjs";
20
16
  async function visibleQuestion(input, output, question) {
21
17
  const prompt = createInterface({ input, output });
@@ -61,17 +57,6 @@ export function hiddenQuestion(input, output, question, { cancelMessage = "Image
61
57
  });
62
58
  }
63
59
 
64
- function fileContent(filePath) {
65
- try { return new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(fs.readFileSync(filePath)); }
66
- catch (error) {
67
- if (error?.code === "ENOENT") return "";
68
- if (error?.code === "ERR_ENCODING_INVALID_ENCODED_DATA") {
69
- throw new Error("Codex configuration is not valid UTF-8 TOML; no configuration changes were written");
70
- }
71
- throw error;
72
- }
73
- }
74
-
75
60
  function chooseModelLines(modelIds, selected) {
76
61
  return modelIds.map((model, index) => ` ${index + 1}. ${terminalCell(model)}${model === selected ? " [current]" : ""}`);
77
62
  }
@@ -99,69 +84,6 @@ function configSummary(config) {
99
84
  };
100
85
  }
101
86
 
102
- function enableImageProvider(options) {
103
- return withFileLockSync(`${options.codexPath}.ccdx.lock`, () => enableImageProviderUnlocked(options));
104
- }
105
- function enableImageProviderUnlocked({ providerConfig, providerPath, codexPath, codexContent, adapterPort, adapterHost }) {
106
- const codex = computeImageMcpCodexConfig(codexContent, {
107
- enabled: true,
108
- adapterPort,
109
- adapterHost,
110
- });
111
- const normalized = validateImageProviderConfig(providerConfig, { filePath: providerPath });
112
- const skill = updateImageSkill({ enabled: true, codexPath, adapterPort, adapterHost });
113
- try {
114
- if (fileContent(codexPath) !== codexContent) {
115
- throw new Error("Codex configuration changed during image setup; retry to preserve the newer settings");
116
- }
117
- atomicWriteFilePairSync(
118
- codexPath,
119
- codex.content,
120
- providerPath,
121
- `${JSON.stringify(normalized, null, 2)}\n`,
122
- { mode: 0o600, writeFile: atomicWriteFileIfChangedSync },
123
- );
124
- } catch (error) {
125
- skill.rollback();
126
- throw error;
127
- }
128
- return { codexChanged: codex.changed, config: normalized };
129
- }
130
-
131
- function disableImageProvider(options) {
132
- if (!fs.existsSync(options.codexPath)) return disableImageProviderUnlocked(options);
133
- return withFileLockSync(`${options.codexPath}.ccdx.lock`, () => disableImageProviderUnlocked(options));
134
- }
135
- function disableImageProviderUnlocked({ providerPath, codexPath, codexContent, adapterPort, adapterHost }) {
136
- const codex = computeImageMcpCodexConfig(codexContent, {
137
- enabled: false,
138
- adapterPort,
139
- adapterHost,
140
- });
141
- const providerExists = fs.existsSync(providerPath);
142
- const skill = updateImageSkill({ enabled: false, codexPath, adapterPort, adapterHost });
143
- try {
144
- if (fs.existsSync(codexPath)) {
145
- if (fileContent(codexPath) !== codexContent) {
146
- throw new Error("Codex configuration changed during image cleanup; retry to preserve the newer settings");
147
- }
148
- atomicWriteFilePairSync(codexPath, codex.content, providerPath, null, {
149
- mode: 0o600, writeFile: atomicWriteFileIfChangedSync,
150
- });
151
- } else if (providerExists) {
152
- fs.unlinkSync(providerPath);
153
- }
154
- } catch (error) {
155
- skill.rollback();
156
- throw error;
157
- }
158
- return { changed: providerExists || codex.changed || skill.changed, preservedGuidance: Boolean(skill.preserved) };
159
- }
160
-
161
- export function syncEnabledImageSkill({ home = os.homedir(), env = process.env, codexPath = codexPaths({ env, home }).config, ...options } = {}) {
162
- return updateImageSkill({ ...options, enabled: true, codexPath });
163
- }
164
-
165
87
  function printImageReadiness(readiness, output, commandName) {
166
88
  if (readiness.ready) {
167
89
  output.write("Local image service: ready (generation tool verified; no image generated).\n");
@@ -92,7 +92,7 @@ export function cliCommandName() {
92
92
 
93
93
  const integrationNotes = {
94
94
  prediction:
95
- "Optional native suggestions are off by default. Windows requires the initialized official MSIX App profile, Windows PowerShell and .NET Framework 4.7.2+; Git/OpenSSL is not required. The bridge port persists across restarts/updates; a busy saved port disables predictions only. Setup/removal requires Codex to be closed, then a normal CCDX restart. HTTPS on chatgpt.com and ab.chatgpt.com is decrypted locally; only prediction configuration is changed. App-profile trust and routing are used; no OS trust or client program files are changed. Proxy/PAC policy is preserved. Repair never enables predictions or force-restarts Codex. Environment trust changes require a service restart.",
95
+ "New Codex integrations attempt prediction setup by default and preserve saved off choices. Setup enables native Show predictions; enable/disable synchronizes display, with pending changes while Codex is running. WebUI provides setup, removal, repair and App opening. Windows requires the initialized official MSIX App profile, Windows PowerShell and .NET Framework 4.7.2+; Git/OpenSSL is not required. The bridge port persists across restarts/updates; a busy saved port disables predictions only. Setup/removal requires Codex to be closed; WebUI starts the bridge without a core restart. Offline CLI setup needs the next normal CCDX launch. HTTPS on chatgpt.com and ab.chatgpt.com is decrypted locally; only prediction configuration is changed. App-profile trust and routing are used; no OS trust or client program files are changed. Proxy/PAC policy is preserved. Repair never enables predictions or force-restarts Codex. Environment trust changes require a service restart.",
96
96
  image:
97
97
  "Setup configures the image API and private credential without generating an image. An empty key keeps the saved key only for the same origin. Pause keeps credentials; remove deletes the stored image credential and unchanged CCDX guidance.",
98
98
  review:
@@ -5,17 +5,24 @@ import { runInBackground } from "./startup.mjs";
5
5
  import { createPredictionState } from "./native-prediction-state.mjs";
6
6
  import { supervisePrediction } from "./native-prediction-recovery.mjs";
7
7
  import { operationErrorDetails } from "./operation-error.mjs";
8
+ import { runPredictionOperation } from "./prediction-operations.mjs";
8
9
 
9
10
  // The CLI composes the services; this module owns optional client integration
10
11
  // lifecycle. It never forwards model requests or depends on dashboard rendering.
11
12
  export function createClientIntegration({ port, host, info = () => {}, warning = () => {}, configLog,
12
- startPrediction = async options => (await import("./native-prediction.mjs")).startNativePrediction(options) } = {}) {
13
+ startPrediction = async options => {
14
+ const preparation = options.environment ? { configured: true, environment: options.environment }
15
+ : await runPredictionOperation("startup", { autoSetup: options.autoSetup, env: process.env, platform: process.platform });
16
+ if (!preparation.configured) { options.state?.configure(false);return null; }
17
+ return (await import("./native-prediction.mjs")).startNativePrediction({ ...options, autoSetup: false, environment: preparation.environment });
18
+ } } = {}) {
13
19
  const prediction = createPredictionState();
14
20
  let native = null;
15
21
  let operation = null, operationName = null, closed = false;
16
22
  let pendingRoutePid = null, codexSetup = null;
17
- async function startPredictionBridge(expectedPort, environment) {
23
+ async function startPredictionBridge(expectedPort, environment, autoSetup = false) {
18
24
  const started = await startPrediction({ state: prediction, warning: info,
25
+ autoSetup,
19
26
  ...(environment ? { environment } : {}), ...(expectedPort ? { expectedPort } : {}) });
20
27
  if (!started) return null;
21
28
  if (closed) { await started.close();return null; }
@@ -65,9 +72,9 @@ export function createClientIntegration({ port, host, info = () => {}, warning =
65
72
  }
66
73
  return { imageEnabled: enabled, imageMcpSkipped, compressionSetup: runInBackground(ensureCodexThreadCompression) };
67
74
  },
68
- start() { return serialize("start", async () => {
75
+ start({ autoSetup = true } = {}) { return serialize("start", async () => {
69
76
  try {
70
- native ||= await startPredictionBridge();
77
+ native ||= await startPredictionBridge(undefined, undefined, autoSetup);
71
78
  } catch (error) { prediction.unavailable(error); warning(`${error.message}. Core startup will continue.`); }
72
79
  return native;
73
80
  }); },
@@ -69,6 +69,10 @@
69
69
  const toggle = node("input");toggle.type = "checkbox";toggle.checked = true;toggle.setAttribute("role", "switch");toggle.setAttribute("aria-label", format("api_disable_source") + " " + provider.name);
70
70
  toggle.addEventListener("change", () => { toggle.checked = true;disableSource(provider); });const hit = node("label", undefined, "switch-hit");hit.append(toggle);actions.append(hit);
71
71
  } else actions.append(button("api_restore", () => void change({ operation: "provider", id: provider.id, enabled: true })));
72
+ if (!provider.builtin && !provider.enabled) {
73
+ const remove = button("api_remove_source", () => { if (window.confirm(format("api_remove_source_confirm"))) void change({ operation: "remove_api", id: provider.id, impact_revision: data.source_impacts?.[provider.id]?.revision }); });
74
+ remove.disabled = data.clients.some(c => c.source === provider.id || c.deployments?.some(item => item.source === provider.id));actions.append(remove);
75
+ }
72
76
  row.append(info, actions);if (!provider.enabled) disabledSources.append(row);else if (provider.id === selectedProvider) providerList.append(row);
73
77
  }
74
78
  const current = editingClient && client(editingClient);
@@ -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", "prediction_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
- note.textContent = error.message;
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
- el("fix-prediction").addEventListener("click", () => void change({ action: "prediction_fix" }, el("fix-prediction")));
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"))) {