codex-copilot-dx 1.1.1 → 1.2.0
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 +4 -4
- package/bin/cli.mjs +23 -23
- package/docs/ARCHITECTURE.md +20 -6
- package/docs/REFERENCE.md +12 -13
- package/package.json +1 -1
- package/src/auth-device-flow.mjs +1 -1
- package/src/auth-status.mjs +1 -1
- package/src/auto-review-model.mjs +2 -2
- package/src/claude-client-lifecycle.mjs +33 -0
- package/src/claude-gateway.mjs +15 -6
- package/src/cli-auth.mjs +6 -6
- package/src/cli-cache.mjs +5 -5
- package/src/cli-image.mjs +1 -1
- package/src/cli-m365.mjs +5 -5
- package/src/cli-models.mjs +2 -2
- package/src/cli-options.mjs +26 -26
- package/src/cli-status.mjs +6 -1
- package/src/dashboard/console.js +58 -26
- package/src/dashboard/index.html +95 -87
- package/src/dashboard/language.js +779 -362
- package/src/dashboard/status.js +53 -41
- package/src/dashboard/ui.js +31 -28
- package/src/dashboard/usage.js +16 -16
- package/src/dashboard-api.mjs +1 -0
- package/src/doctor.mjs +4 -4
- package/src/http-transport.mjs +3 -2
- package/src/launcher.mjs +8 -8
- package/src/native-prediction.mjs +3 -3
- package/src/operation-error.mjs +12 -7
- package/src/package-update.mjs +3 -3
- package/src/provider-registry.mjs +19 -0
- package/src/provider-runtime.mjs +22 -27
- package/src/provider-settings.mjs +2 -1
- package/src/response-failures.mjs +2 -1
- package/src/service-control.mjs +4 -5
- package/src/startup-ui.mjs +17 -9
- package/src/stream-performance.mjs +29 -1
- package/src/terminal-console.mjs +43 -15
- package/src/usage-store.mjs +10 -5
- package/src/user-settings.mjs +16 -3
package/README.md
CHANGED
|
@@ -19,16 +19,16 @@ on `127.0.0.1:2026`, configures Codex, and opens the App. Interactive desktop st
|
|
|
19
19
|
is needed. On Windows, open the App manually unless native prediction setup is
|
|
20
20
|
enabled. In restricted Windows PowerShell, use `npm.cmd` to install and `ccdx.cmd` for the first launch, or run `ccdx.cmd doctor --fix`. Startup, updates and explicit repair remove only CCDX's exact npm-generated `.ps1` launchers so later calls can use `ccdx`. No install script, alias or policy change is added; custom launchers are preserved. npm's own script is untouched. The configured `dummy` API key is a placeholder, not a credential.
|
|
21
21
|
|
|
22
|
-
The [local control console](http://127.0.0.1:2026/) has a sidebar for **Overview,
|
|
22
|
+
The [local control console](http://127.0.0.1:2026/) has a sidebar for **Overview, Apps, Model sources, Usage and issues, Settings**. Codex image generation, input predictions and conversation buffering are explicitly Codex-specific. Provider authorization, model directories, retained usage and operations keep their own scopes. Browsing a catalog never switches the active source.
|
|
23
23
|
|
|
24
|
-
Startup shows bounded checks, discovered
|
|
24
|
+
Startup shows bounded checks, sources with discovered model lists and Claude Code/App configuration. Prediction normally uses one summary line; `ccdx prediction status` retains recovery and environment details. After Ready, an interactive terminal shows current source/Claude state and a line-framed table of this process's returned usage and inference counters. Notices and activity each have their own line; individual requests do not scroll. Input includes reused input tokens. `ccdx --verbose` (also `--show-request-id`, or debug logging) retains detail output; optional file logging remains independently controlled. Source and Claude summaries wrap on narrow terminals. Failed reads show previous-data status and the last successful update time. Non-TTY, CI, dumb, or terminals too small for the full region use plain output (at least 40 columns / 16 rows are required). `Ready` only means the core service is available; discovered catalogs and configured clients do not prove inference access.
|
|
25
25
|
|
|
26
|
-
WebUI settings apply animation choices live, pause/resume configured image calls and prediction adaptation without removing credentials/trust, change the Codex source explicitly, and manage the conversation-buffer limit. Saved preference and effective state are separate. First-time image/prediction setup still uses the existing CLI; trust, client routing and cached client capabilities may require a normal App relaunch. Busy M365 requests must finish before disabling that provider. See the [control reference](docs/REFERENCE.md#control-console-and-online-settings).
|
|
26
|
+
WebUI settings apply animation choices live, pause/resume configured image calls and prediction adaptation without removing credentials/trust, change the Codex source explicitly, and manage the conversation-buffer limit. Saved preference and effective state are separate; browser opening is labeled for the next start. Clearing the conversation buffer clears **all** buffered continuations. Busy cleanup is refused; retry after active requests finish. Saved Codex transcripts are retained. First-time image/prediction setup still uses the existing CLI; trust, client routing and cached client capabilities may require a normal App relaunch. Busy M365 requests must finish before disabling that provider. See the [control reference](docs/REFERENCE.md#control-console-and-online-settings).
|
|
27
27
|
|
|
28
28
|
While visible and auto-refresh is on, the console reads the small status snapshot about every two seconds and source/settings evidence about every 16 seconds. Catalogs and retained usage are fetched on demand and at most once per 30-minute refresh interval while their view is open. Hidden pages stop scheduled reads. First output uses **ms**, estimated speed **token/s**, and each protocol has its own samples. HTTP traffic includes catalog and routing requests; it is not a conversation count.
|
|
29
|
+
The **Requests by source** section and `ccdx status` separate request outcomes by source and protocol. Process-local returned usage also retains bounded source totals; missing usage remains partial. Configuration, sign-in, discovery and a completed reply remain separate evidence. CLI text stays English; WebUI stays bilingual. See the [copy inventory](https://github.com/DaleXiao/codex-copilot-dx/blob/main/docs/UX_COPY.md) and [1.2.0 verification](https://github.com/DaleXiao/codex-copilot-dx/blob/main/docs/RELEASE_1.2.0.md).
|
|
29
30
|
|
|
30
31
|
## Commands
|
|
31
|
-
|
|
32
32
|
| Command | Purpose |
|
|
33
33
|
| --- | --- |
|
|
34
34
|
| `ccdx help` | Command help; use `ccdx help <command>` for details |
|
package/bin/cli.mjs
CHANGED
|
@@ -14,7 +14,7 @@ import { runInBackground } from "../src/startup.mjs";
|
|
|
14
14
|
import { cliCommandName, cliHelp, parseAdapterAddressOptions, parseAdapterProbeOptions, parseCliArgs, parseRuntimeOptions } from "../src/cli-options.mjs";
|
|
15
15
|
import { formatAdapterStatus, readAdapterStatus } from "../src/cli-status.mjs";
|
|
16
16
|
import { closeHttpServer } from "../src/shutdown.mjs";
|
|
17
|
-
import { autoReviewModelPreference, autoReviewPreference, responseHistoryLimitPreference, terminalAnimationPreference, servicePreferences } from "../src/user-settings.mjs";
|
|
17
|
+
import { autoReviewModelPreference, autoReviewPreference, responseHistoryLimitPreference, terminalAnimationPreference, servicePreferences, serviceSettingsSnapshot } from "../src/user-settings.mjs";
|
|
18
18
|
import { formatLiveCopilotModels } from "../src/cli-models.mjs";
|
|
19
19
|
import { runAuthCommand } from "../src/cli-auth.mjs";
|
|
20
20
|
import { createProfileRuntime } from "../src/profile-runtime.mjs";
|
|
@@ -36,7 +36,7 @@ try {
|
|
|
36
36
|
CLI = parseCliArgs(process.argv.slice(2));
|
|
37
37
|
} catch (e) {
|
|
38
38
|
console.error(e.message);
|
|
39
|
-
console.error(`
|
|
39
|
+
console.error(`Help: ${CLI_NAME} --help`);
|
|
40
40
|
process.exit(2);
|
|
41
41
|
}
|
|
42
42
|
|
|
@@ -88,9 +88,9 @@ if (CLI.command === "suggestion") {
|
|
|
88
88
|
try {
|
|
89
89
|
const { retirePredictionIntegration } = await import("../src/prediction-retirement.mjs");
|
|
90
90
|
const result = retirePredictionIntegration({ dryRun: CLI.action === "status" });
|
|
91
|
-
console.log("The
|
|
91
|
+
console.log("The old suggestion panel is no longer supported.");
|
|
92
92
|
if (CLI.action === "status" && result.changed) console.log(`Legacy settings remain; run ${CLI_NAME} suggestion off to clean them up.`);
|
|
93
|
-
if (result.preserved) console.warn("
|
|
93
|
+
if (result.preserved) console.warn("Your edited suggestion settings were kept.");
|
|
94
94
|
process.exit(0);
|
|
95
95
|
} catch (error) {
|
|
96
96
|
console.error(status("err", error.message));
|
|
@@ -292,8 +292,8 @@ const webUiUrl = `http://${ADAPTER_HOST === "::1" ? "[::1]" : "127.0.0.1"}:${ADA
|
|
|
292
292
|
async function launchDashboard() {
|
|
293
293
|
try {
|
|
294
294
|
const result = await openDashboard(webUiUrl, { enabled: !CLI.noBrowser && servicePreferences().open_webui });
|
|
295
|
-
if (result.state === "unavailable") console.warn(startupCheck("warn", "
|
|
296
|
-
} catch (error) { console.warn(startupCheck("warn", "
|
|
295
|
+
if (result.state === "unavailable") console.warn(startupCheck("warn", "Dashboard", `Could not open browser. Open ${webUiUrl}`));
|
|
296
|
+
} catch (error) { console.warn(startupCheck("warn", "Dashboard", error.message)); }
|
|
297
297
|
}
|
|
298
298
|
|
|
299
299
|
async function clientIntegrations() {
|
|
@@ -301,14 +301,14 @@ async function clientIntegrations() {
|
|
|
301
301
|
const { createClientIntegration } = await import("../src/client-integration.mjs");
|
|
302
302
|
clientIntegration = createClientIntegration({ port: ADAPTER_PORT, host: ADAPTER_HOST,
|
|
303
303
|
configLog: startupLogger("Config"),
|
|
304
|
-
info: (message) => console.log(startupCheck("info", "
|
|
304
|
+
info: (message) => console.log(startupCheck("info", "App", message)), warning: (message) => console.warn(startupCheck("warn", "App", message)) });
|
|
305
305
|
}
|
|
306
306
|
return clientIntegration;
|
|
307
307
|
}
|
|
308
308
|
|
|
309
309
|
if (LOGGING.filePath) {
|
|
310
|
-
console.log(status("info", `
|
|
311
|
-
if (LOGGING.level === "debug") console.log(status("debug", "
|
|
310
|
+
console.log(status("info", `Details log: ${LOGGING.filePath}`));
|
|
311
|
+
if (LOGGING.level === "debug") console.log(status("debug", "Detailed logging on"));
|
|
312
312
|
}
|
|
313
313
|
|
|
314
314
|
async function reuseRunningAdapterIfAvailable() {
|
|
@@ -324,8 +324,8 @@ async function reuseRunningAdapterIfAvailable() {
|
|
|
324
324
|
if (!running.ok) return false;
|
|
325
325
|
|
|
326
326
|
const serviceStatus = readAdapterStatus({ host: ADAPTER_HOST, port: ADAPTER_PORT }).catch(() => null);
|
|
327
|
-
console.log(startupCheck("ok", "
|
|
328
|
-
console.log(startupCheck("info", "
|
|
327
|
+
console.log(startupCheck("ok", "Service", `Using running service: ${running.baseUrl}`));
|
|
328
|
+
console.log(startupCheck("info", "Sign-in", "Using saved sign-in; not rechecked"));
|
|
329
329
|
const { compressionSetup, imageEnabled, imageMcpSkipped } = await configureCodexClient();
|
|
330
330
|
|
|
331
331
|
let predictionPacUrl = null;
|
|
@@ -352,7 +352,7 @@ async function reuseRunningAdapterIfAvailable() {
|
|
|
352
352
|
onPredictionRoute: route => { launchRoute = route; }, log: startupLogger("App") });
|
|
353
353
|
console.log(predictionStartupCheck({ configured: predictionConfigured, bridge: predictionPacUrl ? "running" : "unknown", launch_route: launchRoute }));
|
|
354
354
|
console.log(startupCheck(imageEnabled && imageMcpSkipped ? "warn" : "info", "Images", imageEnabled
|
|
355
|
-
? imageMcpSkipped ? "
|
|
355
|
+
? imageMcpSkipped ? "App setup skipped; see warning" : "Configured; not tested" : "Off"));
|
|
356
356
|
console.log(providerStartupChecks((await serviceStatus)?.data));
|
|
357
357
|
console.log(startupReady({ baseUrl: running.baseUrl, commandName: CLI_NAME, reused: true }));
|
|
358
358
|
await launchDashboard();
|
|
@@ -396,9 +396,9 @@ try {
|
|
|
396
396
|
try {
|
|
397
397
|
const { inspectWindowsCommand } = await import("../src/windows-command.mjs");
|
|
398
398
|
const command = inspectWindowsCommand({ repair: true });
|
|
399
|
-
if (command.changed) console.log(startupCheck("ok", "Command", "Windows command
|
|
399
|
+
if (command.changed) console.log(startupCheck("ok", "Command", "Windows command ready; use ccdx"));
|
|
400
400
|
else if (command.status === "preserved") console.warn(startupCheck("warn", "Command", "Existing launcher preserved; use ccdx.cmd doctor to inspect it"));
|
|
401
|
-
} catch { console.warn(startupCheck("warn", "Command", "
|
|
401
|
+
} catch { console.warn(startupCheck("warn", "Command", "Command setup skipped; service will start")); }
|
|
402
402
|
}
|
|
403
403
|
const updateNotice = runInBackground(printUpdateNotice);
|
|
404
404
|
if (await reuseRunningAdapterIfAvailable()) {
|
|
@@ -429,11 +429,11 @@ try {
|
|
|
429
429
|
log: (kind, message) => console.log(startupComplete ? status(kind, message) : startupCheck(kind, "M365", message)) });
|
|
430
430
|
const m365Setup = runInBackground(() => providerRuntime.start());
|
|
431
431
|
if (providerRuntime.selection().codex === "github") {
|
|
432
|
-
try { await ensureAuth({ log: startupLogger("
|
|
433
|
-
catch (error) { if (!await m365Setup) throw error;console.warn(startupCheck("warn", "
|
|
432
|
+
try { await ensureAuth({ log: startupLogger("Sign-in") }); }
|
|
433
|
+
catch (error) { if (!await m365Setup) throw error;console.warn(startupCheck("warn", "Sign-in", "GitHub authorization is unavailable; Microsoft 365 is independent. Check ccdx m365 status or switch")); }
|
|
434
434
|
} else {
|
|
435
435
|
await m365Setup;
|
|
436
|
-
console.log(startupCheck("info", "
|
|
436
|
+
console.log(startupCheck("info", "Source", "Codex source: Microsoft 365"));
|
|
437
437
|
}
|
|
438
438
|
profileRuntime = createProfileRuntime({ codexClient: defaultCopilotClient });
|
|
439
439
|
|
|
@@ -452,11 +452,11 @@ try {
|
|
|
452
452
|
const terminalAnimationTheme = terminalAnimationPreference().theme;
|
|
453
453
|
terminalConsole = createTerminalConsole({ baseUrl: webUiUrl, verbose: CLI.verbose === true || CLI.showRequestId === true || LOGGING.level === "debug",
|
|
454
454
|
snapshot: () => activeServer?.ccdxSnapshot?.() || {},
|
|
455
|
-
preferences: () =>
|
|
455
|
+
preferences: () => { const { saved, theme } = serviceSettingsSnapshot();return { ...saved, theme }; } });
|
|
456
456
|
const serviceControl = createServiceControl({ providerRuntime, clientIntegration: earlyIntegration, terminal: terminalConsole });
|
|
457
457
|
const codexModelCatalog = createCodexModelCatalog();
|
|
458
458
|
activeServer = await startAdapter(ADAPTER_PORT, ADAPTER_HOST, {
|
|
459
|
-
log: startupLogger("
|
|
459
|
+
log: startupLogger("Service"),
|
|
460
460
|
autoReviewModelResolver: () => autoReviewPreference(),
|
|
461
461
|
codexClient: profileRuntime.codexClient,
|
|
462
462
|
codexModelCatalog,
|
|
@@ -487,7 +487,7 @@ try {
|
|
|
487
487
|
onPredictionRoute: route => clientIntegration?.launched(route), log: startupLogger("App") });
|
|
488
488
|
console.log(predictionStartupCheck(clientIntegration?.snapshot().prediction));
|
|
489
489
|
console.log(startupCheck(imageEnabled && imageMcpSkipped ? "warn" : "info", "Images", imageEnabled
|
|
490
|
-
? imageMcpSkipped ? "
|
|
490
|
+
? imageMcpSkipped ? "App setup skipped; see warning" : "Configured; not tested" : "Off"));
|
|
491
491
|
console.log(providerStartupChecks(activeServer.ccdxSnapshot?.()));
|
|
492
492
|
|
|
493
493
|
// Periodically refresh the model list + endpoint cache so a long-running
|
|
@@ -510,18 +510,18 @@ try {
|
|
|
510
510
|
if (shuttingDown) return;
|
|
511
511
|
shuttingDown = true;
|
|
512
512
|
LOGGING.setTerminalSink(null);terminalConsole?.cleanup();
|
|
513
|
-
console.log(`\n${status("wait", `
|
|
513
|
+
console.log(`\n${status("wait", `Stopping: ${signal}`)}`);
|
|
514
514
|
let exitCode = 0;
|
|
515
515
|
try {
|
|
516
516
|
if (modelRefreshTimer) clearInterval(modelRefreshTimer);
|
|
517
517
|
await clientIntegration?.close();
|
|
518
518
|
await providerRuntime?.close();
|
|
519
519
|
const result = await closeHttpServer(activeServer, { timeoutMs: RUNTIME.shutdownTimeoutMs });
|
|
520
|
-
if (result.forced) console.warn(status("warn", "
|
|
520
|
+
if (result.forced) console.warn(status("warn", "Remaining service connections closed"));
|
|
521
521
|
await flushUsageWrites();
|
|
522
522
|
} catch (e) {
|
|
523
523
|
exitCode = 1;
|
|
524
|
-
console.error(status("err", `
|
|
524
|
+
console.error(status("err", `Could not stop: ${e.message}`));
|
|
525
525
|
} finally {
|
|
526
526
|
await LOGGING.cleanup();
|
|
527
527
|
process.exit(exitCode);
|
package/docs/ARCHITECTURE.md
CHANGED
|
@@ -8,8 +8,8 @@ Client integration, image tools and the dashboard are not a general plugin frame
|
|
|
8
8
|
| --- | --- | --- |
|
|
9
9
|
| Core inference | `adapter.mjs`, Responses modules, model catalog, history | Codex wire contracts, streaming and recovery |
|
|
10
10
|
| Providers | `providers/github.mjs`, `providers/m365*.mjs` | Source-owned auth, discovery, routing, capabilities and transport |
|
|
11
|
-
| Provider composition | `provider-runtime.mjs`, `provider-settings.mjs` | Explicit selection, lifecycle, history namespaces and snapshots |
|
|
12
|
-
| Claude clients | `claude-gateway.mjs`, `claude-client-config.mjs`, `claude-models.mjs` | Native Messages relay and field-owned reversible client setup |
|
|
11
|
+
| Provider composition | `provider-runtime.mjs`, `provider-registry.mjs`, `provider-settings.mjs` | Explicit selection, lifecycle, history namespaces and snapshots |
|
|
12
|
+
| Claude clients | `claude-gateway.mjs`, `claude-client-lifecycle.mjs`, `claude-client-config.mjs`, `claude-models.mjs` | Native Messages relay and field-owned reversible client setup |
|
|
13
13
|
| Client integration | `client-integration.mjs`, Codex config, native prediction | Client setup, optional start/stop, diagnostic snapshots |
|
|
14
14
|
| Optional images | Image provider, CLI setup, image MCP and skill | Opt-in API access and image delivery; failures do not block core startup |
|
|
15
15
|
| Management | CLI, dashboard, observability, package updates | Bounded metadata and explicit user actions |
|
|
@@ -25,6 +25,8 @@ its Fast mapping, retries and recovery are not applied blindly to M365. Protocol
|
|
|
25
25
|
adaptation belongs to the client boundary. There is no generic intermediate message
|
|
26
26
|
format that would erase native Responses or Anthropic semantics.
|
|
27
27
|
|
|
28
|
+
`provider-registry.mjs` declares the bounded internal source metadata used by selection validation and dashboard source choices. It loads no external code; GitHub and M365 are the two production sources. Source-specific selection/model rules remain with composition. A third source is only a contract test fixture.
|
|
29
|
+
|
|
28
30
|
`provider-runtime.mjs` owns source selection, not the providers themselves. Each
|
|
29
31
|
request pins a provider before admission. An explicit change affects later requests;
|
|
30
32
|
it does not reroute an in-flight stream or retry it through another account. Core
|
|
@@ -46,6 +48,7 @@ to M365. No GitHub token, image credential or browser Cookie is reused. Windows
|
|
|
46
48
|
use a separate OS WinHTTP worker for M365 company routing; macOS preserves static
|
|
47
49
|
system/environment routing and reports unsupported dynamic PAC. Native runtime
|
|
48
50
|
absence and policy refusal do not disable GitHub.
|
|
51
|
+
`claude-client-lifecycle.mjs` owns configuration reconciliation and restore state, independently from source auth/catalog code. It checks lifecycle/profile validity after asynchronous policy inspection and preserves the existing field-ownership writer.
|
|
49
52
|
Claude handler/configuration readiness is also separate from M365 provider
|
|
50
53
|
readiness. A Claude setup failure or a GPT-only catalog cannot block the explicitly
|
|
51
54
|
selected Codex backup; a catalog without Claude models does not install Claude settings.
|
|
@@ -305,18 +308,21 @@ before-values, preserving foreign or edited fields. Saved allow gates are separa
|
|
|
305
308
|
from provisioning; pausing never deletes the Provider key or prediction trust.
|
|
306
309
|
|
|
307
310
|
`terminal-console.mjs` owns a bounded TTY status region and activity only.
|
|
308
|
-
Its
|
|
311
|
+
Its region has wrapping source/Claude summaries, a responsive line-framed table,
|
|
309
312
|
then separate notice and activity rows. Snapshot data is read about once a second;
|
|
310
|
-
animation ticks reuse the table and write only changed rows. Small viewports
|
|
311
|
-
(under 40 columns or 16 rows) retain plain output. Client-originated cancellations
|
|
313
|
+
animation ticks reuse the table and write only changed rows. Small viewports (under 40 columns / 16 rows, or unable to fit the full region) retain plain output. Failed snapshot/preference reads preserve the last successful view with an explicit stale marker and timestamp; initial read failure is distinct. Client-originated cancellations
|
|
312
314
|
are informational; timeouts and actual failures remain notices and file diagnostics.
|
|
313
315
|
`log.mjs` routes terminal presentation independently from existing opt-in,
|
|
314
|
-
redacted rotating file records. Returned usage accumulates
|
|
316
|
+
redacted rotating file records. Returned usage accumulates bounded process-local/source
|
|
315
317
|
totals in `usage-store.mjs`, without a historical-log scan or per-token callback.
|
|
316
318
|
`browser-launch.mjs` makes one bounded local desktop-open attempt after readiness;
|
|
317
319
|
no headless/SSH launch, browser dependency, generic shell or background tab watcher
|
|
318
320
|
is added. Neither terminal nor WebUI rendering is required for inference.
|
|
319
321
|
|
|
322
|
+
Dashboard messages have stable IDs independent of English and Chinese display text. Static HTML carries IDs and readable English; dynamic rendering uses the same catalog. Compatibility keys remain for runtime state/diagnostic messages. The synchronous catalog preserves language/theme initialization without an extra fetch.
|
|
323
|
+
|
|
324
|
+
`serviceSettingsSnapshot` projects flags, animation and the history preference from one strict file read per update; no new persistence cache hides external edits or corrupt configuration.
|
|
325
|
+
|
|
320
326
|
## Configuration ownership
|
|
321
327
|
|
|
322
328
|
`CODEX_HOME` selects Codex configuration. App profile/trust paths have their own
|
|
@@ -368,3 +374,11 @@ installed sharp without provider calls. It does not claim a live Codex UI test
|
|
|
368
374
|
or the GitHub updater's network installation; the Windows command chain has a
|
|
369
375
|
separate actual-process fixture. Direct runtime dependencies are exact versions;
|
|
370
376
|
the lockfile fixes CI transitives, not consumers' future transitive resolution.
|
|
377
|
+
|
|
378
|
+
### Source-level observations
|
|
379
|
+
|
|
380
|
+
Stream performance retains existing route totals and adds `by_route.<route>.by_provider`. Each source has started/active/finished counts, terminal totals, bounded model outcomes, request-to-first-output timing and preparation histograms. Source assignment is pinned once. There are at most 16 source labels plus `other`, and 32 model labels plus `other` per source. Unassigned finished requests use `unknown`; request IDs, accounts and URLs never become metric labels. Recent requests remain capped at 20. `runtime_usage.by_provider` has at most 16 labels plus `other`; unknown usage stays partial and persisted historical records retain their source.
|
|
381
|
+
|
|
382
|
+
`operation-error.mjs` distinguishes client cancellation, unspecified abort, timeout, network/TLS/proxy, authentication and access denial. HTTP 403 is not proof of credential expiry. Claude and Codex cancellations are informational; request-body timeouts use 408, upstream/idle timeouts 504, and local client cancellation diagnostics 499. Original upstream error status/body and protocol-specific stream bytes retain their existing path.
|
|
383
|
+
|
|
384
|
+
Byte-weighted request admission is not a simultaneous-stream limit. The 1.2.0 load replay exercises 16/64/128 small-body held streams, management responsiveness and downstream cancellation against 1.1.1. It does not establish a universal safe concurrency maximum. Existing defaults remain unchanged; see the release receipt for measured bounds.
|
package/docs/REFERENCE.md
CHANGED
|
@@ -755,7 +755,7 @@ ccdx cache --clean --history
|
|
|
755
755
|
|
|
756
756
|
`ccdx cache` separates the shared in-memory Responses history from the rebuildable input-image transform cache. The history limit accepts 16–1024 MiB, is saved in the normal CCDX settings file, and applies immediately to a compatible running adapter. `CCDX_RESPONSE_HISTORY_MAX_BYTES` remains the higher-precedence environment override. Lowering the limit below current usage is rejected rather than evicting tasks silently. `ccdx cache -128` is a short alias for `--limit 128`; `-clean` aliases `--clean`.
|
|
757
757
|
|
|
758
|
-
Plain `--clean` clears only completed image transforms; the next matching request may recompute them. Adding `--history` also invalidates all process-local `previous_response_id` chains and can make a task's next continuation fail, so it requires interactive confirmation or `--yes`. Cleanup
|
|
758
|
+
Plain `--clean` clears only completed image transforms; the next matching request may recompute them. Adding `--history` also invalidates all process-local `previous_response_id` chains and can make a task's next continuation fail, so it requires interactive confirmation or `--yes`. Cleanup refuses active cache users; retry after current requests finish. It never deletes Codex transcripts, generated image files, provider credentials, image edit handles, model catalogs, or usage/debug logs. A stopped or older adapter must be restarted before runtime cleanup; a saved limit applies on the next start.
|
|
759
759
|
|
|
760
760
|
### Request-body limits
|
|
761
761
|
|
|
@@ -770,8 +770,7 @@ ccdx limits --decoded default
|
|
|
770
770
|
|
|
771
771
|
### Control console and online settings
|
|
772
772
|
|
|
773
|
-
The sidebar separates Overview, Codex/Claude
|
|
774
|
-
diagnostics, and System/settings. Codex owns optional image generation, native
|
|
773
|
+
The sidebar separates Overview, Codex/Claude Apps, Model sources, Usage and issues, and Settings. Codex owns optional image generation, native
|
|
775
774
|
prediction adaptation and the temporary Responses conversation buffer. That
|
|
776
775
|
buffer supports continuation; it is not a chat archive. Shared HTTP traffic and
|
|
777
776
|
per-protocol model outcomes are distinct. Claude Messages metrics are not labeled
|
|
@@ -785,15 +784,16 @@ Query commands do not open it. Headless/CI/SSH or noninteractive starts skip it;
|
|
|
785
784
|
a browser-launch failure does not stop the service. This is an opening attempt,
|
|
786
785
|
not a guarantee that every browser will reuse an existing tab.
|
|
787
786
|
|
|
788
|
-
The default TTY display uses
|
|
789
|
-
raw keyboard input. It shows usage returned since this process began; pending
|
|
787
|
+
The default TTY display uses wrapping source/Claude summaries, a line-framed usage/inference table, and separate notice/activity rows, without an alternate screen or raw keyboard input. It shows usage returned since this process began; pending
|
|
790
788
|
usage is excluded, missing usage stays partial, and this is not an invoice.
|
|
791
789
|
Business requests drive activity; status/catalog polling does not. Existing nine
|
|
792
790
|
animation themes retain their timing/palette and cycle pauses. `--verbose`,
|
|
793
791
|
`--show-request-id` or `CCDX_LOG_LEVEL=debug` restore detailed terminal output.
|
|
794
|
-
Non-TTY/CI/dumb/
|
|
792
|
+
Failed reads show previous-data status and the last successful update time, or that no data has been received. Narrow summaries wrap rather than hiding Claude App/Code state. Non-TTY/CI/dumb/too-small terminals use plain output; repeated identical notices
|
|
795
793
|
are coalesced. File logging retains its existing explicit opt-in and redaction.
|
|
796
|
-
In-memory usage still updates when `CCDX_DISABLE_USAGE=1` disables persistence.
|
|
794
|
+
In-memory usage still updates when `CCDX_DISABLE_USAGE=1` disables persistence. `runtime_usage.by_provider` separates returned process-local usage by source. The Usage and issues view adds Requests by source; `ccdx status` also lists source/protocol outcomes. Unknown outcomes and partial usage remain distinct. CLI remains English; WebUI keeps English/Chinese.
|
|
795
|
+
|
|
796
|
+
The Clear conversation buffer action clears all process-local conversation continuation data. If image optimization or conversation history is active, cleanup is refused; retry after current requests finish. Old chats may fail to continue; saved Codex transcripts remain. It invokes the existing image-transform/history cleanup operation, rather than an inactive-only selector.
|
|
797
797
|
|
|
798
798
|
The settings API is local, requires the dashboard header, bounded JSON and
|
|
799
799
|
same-origin POST. It invokes the same Provider, cache and integration operations;
|
|
@@ -808,7 +808,7 @@ service preferences fail closed for optional calls rather than reopening them.
|
|
|
808
808
|
| Image calls | New local MCP calls; keeps provider credentials and allows an already-started call to finish |
|
|
809
809
|
| Prediction adaptation | Subsequent configuration traffic on an already-provisioned bridge; keeps trust/route, and App caches can remain |
|
|
810
810
|
| Model source | Explicit validated selection for subsequent Codex requests; existing requests retain their binding |
|
|
811
|
-
| Conversation buffer | Live validated limit; cleanup refuses pinned/active data
|
|
811
|
+
| Conversation buffer | Live validated limit; cleanup refuses pinned/active data, then clears all buffered continuation IDs |
|
|
812
812
|
|
|
813
813
|
Boolean allow preferences `terminal_animation_enabled`, `image_enabled` and
|
|
814
814
|
`prediction_enabled` default to true, preserving already configured features;
|
|
@@ -1098,8 +1098,7 @@ once by default, using the configured main port when customized. See
|
|
|
1098
1098
|
startup preferences, output modes and effective-state rules. Assets require both
|
|
1099
1099
|
a loopback connection and loopback Host, including when the main listener uses LAN mode.
|
|
1100
1100
|
|
|
1101
|
-
The sidebar separates Overview, Codex/Claude
|
|
1102
|
-
diagnostics, and System/settings. Codex-specific images, prediction integration
|
|
1101
|
+
The sidebar separates Overview, Codex/Claude Apps, Model sources, Usage and issues, and Settings. Codex-specific images, prediction integration
|
|
1103
1102
|
and conversation buffering stay under Codex. HTTP traffic counts include model
|
|
1104
1103
|
catalogs and route errors; model outcomes and timing are named by protocol.
|
|
1105
1104
|
Microsoft 365's Claude Messages summary is not a Provider-wide request total.
|
|
@@ -1155,9 +1154,9 @@ access. Normal prediction startup uses one line; exceptions retain reasons and
|
|
|
1155
1154
|
required restart guidance. `ccdx prediction status` retains environment/recovery
|
|
1156
1155
|
details, including routing, CA and TLS verification state.
|
|
1157
1156
|
|
|
1158
|
-
After Ready, a supported TTY has a
|
|
1157
|
+
After Ready, a supported TTY has a bounded region: uptime, source/Claude state,
|
|
1159
1158
|
a line-framed usage/inference table, one notice row and one activity row below it.
|
|
1160
|
-
Input includes
|
|
1159
|
+
Input includes reused input; partial usage counts returned records with missing fields.
|
|
1161
1160
|
Inference HTTP calls exclude catalog/count-tokens requests; model outcomes are
|
|
1162
1161
|
separate protocol observations, not an HTTP-success total. Activity motion includes
|
|
1163
1162
|
image MCP traffic; inference counters exclude it. Usage is process-local returned
|
|
@@ -1166,7 +1165,7 @@ Data refreshes about once a second; animation ticks reuse the table and redraw o
|
|
|
1166
1165
|
changed rows. Historical notices do not turn a running service into a health verdict.
|
|
1167
1166
|
Client cancellations remain in verbose/file diagnostics as informational records;
|
|
1168
1167
|
timeouts and actual failures remain notices. Non-TTY, CI, dumb and terminals under
|
|
1169
|
-
40 columns or 16 rows retain plain output. No runtime terminal dependency is added.
|
|
1168
|
+
40 columns or 16 rows retain plain output. At 40×16 the compact table keeps all metrics and short source/Code/App states. Larger terminals wrap full state descriptions. No runtime terminal dependency is added.
|
|
1170
1169
|
|
|
1171
1170
|
Terminal appearance lives in System/settings, with a sidebar shortcut on wide
|
|
1172
1171
|
screens. Preview frames load on opening; closing, hiding the view/page or reduced
|
package/package.json
CHANGED
package/src/auth-device-flow.mjs
CHANGED
|
@@ -18,7 +18,7 @@ export function interpretPoll(data) {
|
|
|
18
18
|
|
|
19
19
|
export function abortError(signal) {
|
|
20
20
|
if (signal?.reason instanceof Error) return signal.reason;
|
|
21
|
-
const error = new Error("
|
|
21
|
+
const error = new Error("Cancelled");
|
|
22
22
|
error.name = "AbortError";
|
|
23
23
|
return error;
|
|
24
24
|
}
|
package/src/auth-status.mjs
CHANGED
|
@@ -13,7 +13,7 @@ function responseDetail(value) {
|
|
|
13
13
|
|
|
14
14
|
function abortError(signal) {
|
|
15
15
|
if (signal?.reason instanceof Error) return signal.reason;
|
|
16
|
-
const error = new Error("
|
|
16
|
+
const error = new Error("Cancelled");
|
|
17
17
|
error.name = "AbortError";
|
|
18
18
|
return error;
|
|
19
19
|
}
|
|
@@ -126,7 +126,7 @@ export async function runAutoReviewModelCommand({
|
|
|
126
126
|
let selectedEffort;
|
|
127
127
|
try {
|
|
128
128
|
while (!selectedModel) {
|
|
129
|
-
const answer = String(await ask(`
|
|
129
|
+
const answer = String(await ask(`Choose a model [${defaultIndex + 1}], or q to cancel: `) || "").trim();
|
|
130
130
|
if (answer.toLowerCase() === "q" || answer.toLowerCase() === "quit") {
|
|
131
131
|
output.write("No changes made.\n");
|
|
132
132
|
return { changed: false, cancelled: true, model: current.model };
|
|
@@ -153,7 +153,7 @@ export async function runAutoReviewModelCommand({
|
|
|
153
153
|
});
|
|
154
154
|
if (!efforts.length) output.write("No reasoning efforts are advertised; no override will be set.\n");
|
|
155
155
|
while (selectedEffort === undefined) {
|
|
156
|
-
const answer = String(await ask(`
|
|
156
|
+
const answer = String(await ask(`Choose thinking level [${effortIndex}], or q to cancel: `) || "").trim();
|
|
157
157
|
if (["q", "quit"].includes(answer.toLowerCase())) {
|
|
158
158
|
output.write("No changes made.\n");
|
|
159
159
|
return { changed: false, cancelled: true, model: current.model };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Client files have their own ownership and policy lifecycle, independent of
|
|
2
|
+
// source authentication, catalog discovery and inference transport.
|
|
3
|
+
export function createClaudeClientLifecycle({ options, configureClients, restoreClients } = {}) {
|
|
4
|
+
let clients = { code: "not_configured", app: "not_configured" }, reason = null, pending = null;
|
|
5
|
+
return {
|
|
6
|
+
snapshot: () => ({ clients: { ...clients }, reason }),
|
|
7
|
+
sync({ source, baseUrl, apiKey, current = () => true }) {
|
|
8
|
+
if (pending) return pending;
|
|
9
|
+
pending = (async () => {
|
|
10
|
+
try {
|
|
11
|
+
const integration = configureClients ? null : await import("./claude-client-config.mjs");
|
|
12
|
+
const desktopManaged = integration ? await integration.inspectClaudeDesktopPolicy(options) : false;
|
|
13
|
+
if (!current()) return;
|
|
14
|
+
clients = (configureClients || integration.configureClaudeClients)({ ...options, desktopManaged, baseUrl,
|
|
15
|
+
apiKey: apiKey(), models: source.models("claude") });
|
|
16
|
+
reason = null;
|
|
17
|
+
} catch {
|
|
18
|
+
if (!current()) return;
|
|
19
|
+
clients = { code: "configuration_unavailable", app: "configuration_unavailable" };
|
|
20
|
+
reason = "m365_claude_config_unavailable";
|
|
21
|
+
}
|
|
22
|
+
})().finally(() => { pending = null; });
|
|
23
|
+
return pending;
|
|
24
|
+
},
|
|
25
|
+
async restore() {
|
|
26
|
+
await pending;
|
|
27
|
+
const restore = restoreClients || (await import("./claude-client-config.mjs")).restoreClaudeClients;
|
|
28
|
+
const result = restore(options);
|
|
29
|
+
clients = { code: result.preserved ? "preserved" : "restored", app: result.preserved ? "preserved" : "restored" };
|
|
30
|
+
reason = null;return result;
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
}
|
package/src/claude-gateway.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { isProviderId } from "./provider-metadata.mjs";
|
|
|
2
2
|
import { claudeModelEntries } from "./claude-models.mjs";
|
|
3
3
|
import http from "node:http";
|
|
4
4
|
import { randomUUID, timingSafeEqual } from "node:crypto";
|
|
5
|
-
import { createRequestAbort, readJsonBody, readBoundedResponseText, writeOrDrain, MAX_UPSTREAM_ERROR_BODY_BYTES } from "./http-transport.mjs";
|
|
5
|
+
import { createRequestAbort, abortErrorStatusCode, readJsonBody, readBoundedResponseText, writeOrDrain, MAX_UPSTREAM_ERROR_BODY_BYTES } from "./http-transport.mjs";
|
|
6
6
|
import { createRequestAdmission } from "./request-admission.mjs";
|
|
7
7
|
import { loadRuntimeConfig } from "./runtime-config.mjs";
|
|
8
8
|
import { isLoopbackAddress, isLoopbackHostHeader } from "./security.mjs";
|
|
@@ -12,6 +12,7 @@ import { createStreamPerformanceMetrics } from "./stream-performance.mjs";
|
|
|
12
12
|
import { buildMessagesUsageRecord, recordUsage } from "./usage-store.mjs";
|
|
13
13
|
import { redactDiagnosticText } from "./diagnostic-text.mjs";
|
|
14
14
|
import { decodedBodyLimitPreference } from "./user-settings.mjs";
|
|
15
|
+
import { operationErrorDetails } from "./operation-error.mjs";
|
|
15
16
|
|
|
16
17
|
function send(res, code, value) {
|
|
17
18
|
if (res.destroyed || res.writableEnded) return;
|
|
@@ -84,6 +85,7 @@ export function createClaudeGatewayHandler({ provider, apiKey, log = () => {}, o
|
|
|
84
85
|
tracker?.setProvider(provider.id);
|
|
85
86
|
const abort = createRequestAbort(req, res);
|
|
86
87
|
let release = () => {}, outcome = "failed", model = null, responseId = null, usage = null, stopReason = null, streamed = false, sawStop = false, failedEvent = false;
|
|
88
|
+
let terminalOrigin = "client_validation", failureStatus = null;
|
|
87
89
|
if (!countTokens) { stats.total++;stats.active++;stats.last_request_at = new Date().toISOString(); }
|
|
88
90
|
await runWithRequestContext({ requestId, provider: provider.id, route: "messages", streamPerformance: tracker }, async () => {
|
|
89
91
|
try {
|
|
@@ -94,9 +96,11 @@ export function createClaudeGatewayHandler({ provider, apiKey, log = () => {}, o
|
|
|
94
96
|
send(res, 400, apiError("ccdx_messages_invalid", "Expected a model and messages array"));return;
|
|
95
97
|
}
|
|
96
98
|
model = body.model;stats.last_model = model;streamed = !countTokens && body.stream === true;tracker?.setModel(model);
|
|
99
|
+
terminalOrigin = "transport";
|
|
97
100
|
const upstream = await provider.client.messages(body, { headers: req.headers, countTokens, signal: abort.signal,
|
|
98
101
|
onUpstreamStart() { abort.setTimeout(streamed ? config.streamHandshakeTimeoutMs : config.upstreamTimeoutMs, "upstream_timeout"); } });
|
|
99
102
|
body = null;
|
|
103
|
+
terminalOrigin = upstream.ok ? "upstream_response" : "upstream_http";
|
|
100
104
|
tracker?.upstreamHeaders(upstream.status);
|
|
101
105
|
release();release = () => {};
|
|
102
106
|
try { onRequest({ client: req.headers["x-ccdx-client"] === "claude-app" ? "claude_app" : req.headers["x-ccdx-client"] === "claude-code" ? "claude_code" : "claude" }); } catch {}
|
|
@@ -138,18 +142,23 @@ export function createClaudeGatewayHandler({ provider, apiKey, log = () => {}, o
|
|
|
138
142
|
} finally { await reader.cancel().catch(() => {});reader.releaseLock(); }
|
|
139
143
|
}
|
|
140
144
|
} catch (error) {
|
|
141
|
-
|
|
145
|
+
const detail = operationErrorDetails(error, { reason: abort.reason });
|
|
146
|
+
outcome = detail.source === "cancelled" ? "cancelled" : "failed";
|
|
147
|
+
const statusCode = detail.status || (abort.reason ? abortErrorStatusCode(abort.reason) : 502);
|
|
148
|
+
failureStatus = statusCode;terminalOrigin = outcome === "cancelled" ? "client_disconnect" : "transport";
|
|
142
149
|
const message = redactDiagnosticText(error.message).split(apiKey).join("[redacted]").slice(0, 240);
|
|
143
|
-
log("warn", `Claude request ${requestId}: ${
|
|
144
|
-
|
|
150
|
+
log(outcome === "cancelled" ? "info" : "warn", `Claude request ${requestId}: ${detail.code}`);
|
|
151
|
+
tracker?.setErrorOrigin(outcome === "cancelled" ? "client_disconnect" : "transport");
|
|
152
|
+
if (outcome === "cancelled") return;
|
|
153
|
+
if (!res.headersSent) send(res, statusCode, apiError(error.code || abort.reason || "ccdx_gateway_error", message));
|
|
145
154
|
else if (!res.destroyed && !res.writableEnded) res.end(`event: error\ndata: ${JSON.stringify(apiError("ccdx_gateway_error", message))}\n\n`);
|
|
146
155
|
} finally {
|
|
147
156
|
release();abort.cleanup();
|
|
148
157
|
if (!countTokens) {
|
|
149
158
|
stats.active--;stats[outcome]++;
|
|
150
159
|
tracker?.setModel(model);tracker?.setOutputTokens(usage?.output_tokens);
|
|
151
|
-
tracker?.terminal(outcome, { origin: failedEvent ? "upstream_event" :
|
|
152
|
-
tracker?.finish({ failed: outcome === "failed" || outcome === "cancelled", aborted: outcome === "cancelled", statusCode: res.statusCode });
|
|
160
|
+
tracker?.terminal(outcome, { origin: failedEvent ? "upstream_event" : terminalOrigin, reason: stopReason === "max_tokens" ? "max_output_tokens" : undefined });
|
|
161
|
+
tracker?.finish({ failed: outcome === "failed" || outcome === "cancelled", aborted: outcome === "cancelled", statusCode: failureStatus || res.statusCode });
|
|
153
162
|
const client = req.headers["x-ccdx-client"] === "claude-app" ? "claude_app" : req.headers["x-ccdx-client"] === "claude-code" ? "claude_code" : "claude";
|
|
154
163
|
try { void Promise.resolve(record(buildMessagesUsageRecord({ model, responseId, usage, mode: streamed ? "stream" : "json", client, provider: provider.id }))).catch(() => {}); } catch {}
|
|
155
164
|
}
|
package/src/cli-auth.mjs
CHANGED
|
@@ -70,16 +70,16 @@ export function formatAuthStatus(snapshot = authStatus(), {
|
|
|
70
70
|
}];
|
|
71
71
|
const table = formatResponsiveCliTable({
|
|
72
72
|
columns: [
|
|
73
|
-
{ key: "profile", label: "
|
|
73
|
+
{ key: "profile", label: "APP" },
|
|
74
74
|
{ key: "account", label: "ACCOUNT" },
|
|
75
|
-
{ key: "local", label: "
|
|
76
|
-
{ key: "online", label: "
|
|
75
|
+
{ key: "local", label: "SAVED SIGN-IN" },
|
|
76
|
+
{ key: "online", label: "ACCESS CHECK" },
|
|
77
77
|
{ key: "models", label: "MODELS", align: "right" },
|
|
78
78
|
],
|
|
79
79
|
compactColumns: [
|
|
80
|
-
{ key: "profile", label: "
|
|
81
|
-
{ key: "local", label: "
|
|
82
|
-
{ key: "online", label: "
|
|
80
|
+
{ key: "profile", label: "APP" },
|
|
81
|
+
{ key: "local", label: "SAVED SIGN-IN" },
|
|
82
|
+
{ key: "online", label: "ACCESS CHECK" },
|
|
83
83
|
],
|
|
84
84
|
rows,
|
|
85
85
|
width,
|
package/src/cli-cache.mjs
CHANGED
|
@@ -45,23 +45,23 @@ async function runningSnapshot(baseUrl, options) {
|
|
|
45
45
|
async function confirmHistoryCleanup({ input, output, prompt, yes }) {
|
|
46
46
|
if (yes) return;
|
|
47
47
|
if (prompt) {
|
|
48
|
-
if (!await prompt()) throw new Error("
|
|
48
|
+
if (!await prompt()) throw new Error("Buffer cleanup cancelled");
|
|
49
49
|
return;
|
|
50
50
|
}
|
|
51
51
|
if (!input.isTTY || !output.isTTY) {
|
|
52
|
-
throw new Error("
|
|
52
|
+
throw new Error("Clearing the buffer may prevent chats from continuing.\nUse --yes to confirm.");
|
|
53
53
|
}
|
|
54
54
|
const readline = createInterface({ input, output });
|
|
55
55
|
try {
|
|
56
56
|
const answer = String(await readline.question(
|
|
57
|
-
"Clear
|
|
57
|
+
"Clear the buffer for all chats? They may not continue [y/N]: ",
|
|
58
58
|
)).trim().toLowerCase();
|
|
59
|
-
if (!["y", "yes"].includes(answer)) throw new Error("
|
|
59
|
+
if (!["y", "yes"].includes(answer)) throw new Error("Buffer cleanup cancelled");
|
|
60
60
|
} finally { readline.close(); }
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
function formatStatus(preference, runtime) {
|
|
64
|
-
const lines = ["ccdx cache", `
|
|
64
|
+
const lines = ["ccdx cache", `Saved buffer limit: ${mib(preference.bytes)} (${preference.source})`];
|
|
65
65
|
if (!runtime?.supported) {
|
|
66
66
|
lines.push(runtime?.offline
|
|
67
67
|
? "Runtime cache: adapter is not running"
|
package/src/cli-image.mjs
CHANGED
|
@@ -219,7 +219,7 @@ export async function runImageCommand({
|
|
|
219
219
|
const askSecret = promptSecret || ((question) => hiddenQuestion(input, output, question));
|
|
220
220
|
output.write(`${commandName} enable-image\n`);
|
|
221
221
|
output.write("Enter an HTTPS base URL (for example, https://api.example/v1) or a full /images/generations endpoint.\n");
|
|
222
|
-
const endpointAnswer = String(await ask(`
|
|
222
|
+
const endpointAnswer = String(await ask(`Image service URL${current ? ` [${current.endpoint}]` : ""}: `) || "").trim();
|
|
223
223
|
if (!endpointAnswer && !current?.endpoint) throw new Error("Image API base URL or endpoint is required");
|
|
224
224
|
const endpoint = normalizeImageEndpoint(endpointAnswer || current.endpoint);
|
|
225
225
|
const sameOrigin = current && new URL(endpoint).origin === new URL(current.endpoint).origin;
|
package/src/cli-m365.mjs
CHANGED
|
@@ -49,7 +49,7 @@ export async function runProviderAutoReviewCommand(options = {}) {
|
|
|
49
49
|
const settings = readProviderSettings(options);
|
|
50
50
|
if (settings.codex !== "m365") return runAutoReviewModelCommand(options);
|
|
51
51
|
const state = await providerControl(options);
|
|
52
|
-
if (state.codex_provider !== "m365") throw new Error("
|
|
52
|
+
if (state.codex_provider !== "m365") throw new Error("Saved and active sources differ.\nRestart CCDX before changing review settings.");
|
|
53
53
|
const preference = state.m365?.preference || settings.m365;
|
|
54
54
|
return runAutoReviewModelCommand({ ...options, env: { ...(options.env || process.env), CCDX_AUTO_REVIEW_MODEL: "" },
|
|
55
55
|
loadCatalog: async () => {
|
|
@@ -66,7 +66,7 @@ export async function runM365Command({ action = "status", provider, model, autoR
|
|
|
66
66
|
env = process.env, input = process.stdin, output = process.stdout, prompt, control = providerControl } = {}) {
|
|
67
67
|
const options = { home, env };
|
|
68
68
|
let readline;
|
|
69
|
-
const ask = prompt || (question => { if (!input.isTTY || !output.isTTY) throw new Error("
|
|
69
|
+
const ask = prompt || (question => { if (!input.isTTY || !output.isTTY) throw new Error("Choose the source and models with command arguments.");
|
|
70
70
|
readline ||= createInterface({ input, output });return readline.question(question); });
|
|
71
71
|
const request = value => control({ host, port, action: value });
|
|
72
72
|
try {
|
|
@@ -81,14 +81,14 @@ export async function runM365Command({ action = "status", provider, model, autoR
|
|
|
81
81
|
if (action === "switch") {
|
|
82
82
|
if (!provider) {
|
|
83
83
|
output.write("Codex provider:\n 1. GitHub Copilot (default)\n 2. Microsoft 365 (backup)\n");
|
|
84
|
-
const answer = String(await ask("
|
|
84
|
+
const answer = String(await ask("Choose 1 or 2; q cancels: ")).trim();
|
|
85
85
|
if (answer === "q") return { cancelled: true };
|
|
86
|
-
if (!["1", "2"].includes(answer)) throw new Error("
|
|
86
|
+
if (!["1", "2"].includes(answer)) throw new Error("Choose 1 or 2");provider = answer === "1" ? "github" : "m365";
|
|
87
87
|
}
|
|
88
88
|
if (provider === "m365") {
|
|
89
89
|
const available = await request({ action: "models", family: "gpt" });
|
|
90
90
|
const models = available.models || [], ids = models.map(entry => entry.id);
|
|
91
|
-
if (!ids.length) throw new Error("No M365 GPT models
|
|
91
|
+
if (!ids.length) throw new Error("No M365 GPT models available. The current source is unchanged.");
|
|
92
92
|
const saved = readProviderSettings(options).m365;
|
|
93
93
|
const choose = async (label, supplied, preferred) => {
|
|
94
94
|
if (supplied) { if (!ids.includes(supplied)) throw new Error(`${label} model is not available: ${terminalCell(supplied)}`);return supplied; }
|
package/src/cli-models.mjs
CHANGED
|
@@ -29,7 +29,7 @@ function liveCatalogHeader(catalog, { commandName, models }) {
|
|
|
29
29
|
function formatLiveCopilotModelsPlain(catalog, { commandName, models }, { sanitize = false } = {}) {
|
|
30
30
|
const lines = liveCatalogHeader(catalog, { commandName, models });
|
|
31
31
|
if (!models.length) {
|
|
32
|
-
lines.push(status("warn", "No selectable GPT models
|
|
32
|
+
lines.push(status("warn", "No selectable GPT models listed."));
|
|
33
33
|
return (sanitize ? lines.map((line) => terminalCell(line, { fallback: "" })) : lines).join("\n");
|
|
34
34
|
}
|
|
35
35
|
|
|
@@ -59,7 +59,7 @@ export function formatLiveCopilotModels(catalog, {
|
|
|
59
59
|
|
|
60
60
|
const lines = liveCatalogHeader(catalog, context);
|
|
61
61
|
if (!models.length) {
|
|
62
|
-
lines.push(status("warn", "No selectable GPT models
|
|
62
|
+
lines.push(status("warn", "No selectable GPT models listed."));
|
|
63
63
|
return lines.join("\n");
|
|
64
64
|
}
|
|
65
65
|
|