codex-copilot-dx 1.1.1 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -11
- package/bin/cli.mjs +23 -23
- package/docs/ARCHITECTURE.md +40 -6
- package/docs/REFERENCE.md +128 -94
- package/package.json +6 -4
- 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 +112 -38
- package/src/dashboard/index.html +122 -90
- package/src/dashboard/language.js +791 -362
- package/src/dashboard/status.js +53 -41
- package/src/dashboard/ui.css +13 -0
- package/src/dashboard/ui.js +31 -28
- package/src/dashboard/usage.js +16 -16
- package/src/dashboard-api.mjs +2 -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 +43 -11
- package/src/prediction-retirement.mjs +2 -7
- package/src/provider-metadata.mjs +2 -1
- package/src/provider-registry.mjs +19 -0
- package/src/provider-runtime.mjs +42 -33
- package/src/provider-settings.mjs +2 -1
- package/src/release-install.mjs +192 -0
- package/src/response-failures.mjs +2 -1
- package/src/service-control.mjs +7 -8
- 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/src/version.mjs +2 -6
- package/src/windows-command.mjs +13 -1
package/docs/REFERENCE.md
CHANGED
|
@@ -263,7 +263,7 @@ certificate store is opened. Existing valid PEM credentials are reused without
|
|
|
263
263
|
conversion or reauthorization. macOS retains its system OpenSSL setup path.
|
|
264
264
|
CCDX does not download a runtime or bypass company PowerShell policy; unavailable
|
|
265
265
|
system APIs fail the optional setup without preventing core service startup.
|
|
266
|
-
|
|
266
|
+
Git is also unnecessary for `ccdx update github` since 1.2.1; it uses a verified Release tarball.
|
|
267
267
|
Run CCDX using Windows-native Node, not inside WSL. The App's agent may still use
|
|
268
268
|
WSL independently. No administrator prompt or execution-policy change is added.
|
|
269
269
|
AppData may be virtualized by MSIX: setup selects an existing `Codex/Local State`
|
|
@@ -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, indented Codex/Claude Apps, Model sources, Usage, Requests, 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 Requests view contains Requests by source, recent failures and request context; `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;
|
|
@@ -911,97 +911,132 @@ ccdx update npm
|
|
|
911
911
|
ccdx update github
|
|
912
912
|
```
|
|
913
913
|
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
ccdx.cmd
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
prints registry credentials. The global context matches `npm install --global`;
|
|
961
|
-
an unrelated project's `.npmrc` cannot silently grant update permission. Old npm
|
|
962
|
-
versions without this restriction do not receive an unsupported option. Failed
|
|
963
|
-
policy discovery does not block an ordinary installation; explicitly requesting
|
|
964
|
-
an override with unknown support fails before installation.
|
|
965
|
-
|
|
966
|
-
npm 12 normally sets `allow-remote=none`. A company registry may return a tarball
|
|
967
|
-
URL on a different origin/path, which can trigger `EALLOWREMOTE` even for a named
|
|
968
|
-
dependency such as sharp. The default update does not weaken this policy. When
|
|
969
|
-
the installation fails under a restrictive policy, CCDX gives conditional guidance
|
|
970
|
-
to check npm's actual error; it does not label every failure a remote-policy error.
|
|
971
|
-
|
|
972
|
-
Only if permitted by company policy and you trust the package/dependency tree,
|
|
973
|
-
grant URL downloads for one explicit update:
|
|
914
|
+
Since 1.2.1, the GitHub channel resolves the latest stable Release, downloads
|
|
915
|
+
`codex-copilot-dx-VERSION.tgz` and `SHA256SUMS` from that exact release, checks
|
|
916
|
+
SHA-256 and the packed package name/version, and gives the verified local file
|
|
917
|
+
to npm. **Git is not required.** It never installs `main`, falls back to another
|
|
918
|
+
channel or automatically grants remote-download permission. Each asset has a
|
|
919
|
+
60-second download deadline and bounded size (64 KiB manifest, 16 MiB package,
|
|
920
|
+
64 MiB decompressed metadata scan). The checksum comes from the same HTTPS
|
|
921
|
+
release; it detects corrupt/mismatched files and is not a separate signature.
|
|
922
|
+
Dependencies still use npm's configured registry, including a company mirror.
|
|
923
|
+
This is not a fully offline or registry-free distribution.
|
|
924
|
+
|
|
925
|
+
Windows runs `npm.cmd` through system `cmd.exe` with AutoRun and delayed expansion
|
|
926
|
+
disabled. Its fixed tarball basename is passed separately from the temporary
|
|
927
|
+
working directory, including when that path has spaces or shell metacharacters.
|
|
928
|
+
Use `ccdx.cmd` if PowerShell blocks npm's `.ps1` entry. No PowerShell policy,
|
|
929
|
+
registry, proxy, certificate setting or persistent npm permission is changed.
|
|
930
|
+
macOS/Linux keep direct npm execution with separate argument arrays.
|
|
931
|
+
|
|
932
|
+
Before npm changes a discovered global target, CCDX backs up only its package
|
|
933
|
+
and two command entries and acquires an exclusive install lock. A linked target
|
|
934
|
+
is preserved and refused. Installer or runtime-verification failure restores the
|
|
935
|
+
old package/commands; successful installation removes the backup. A failed restore
|
|
936
|
+
reports the retained backup and lock for manual recovery. A lock left by a killed
|
|
937
|
+
installer requires checking that no installation is running before removing it.
|
|
938
|
+
There is no promise of crash/power-loss atomicity. Other apps, credentials,
|
|
939
|
+
settings, caches and the running service are not replaced. Readonly/busy Windows
|
|
940
|
+
files can prevent installation; finish use of that installation and retry.
|
|
941
|
+
|
|
942
|
+
The selected target must have the correct name/stable version (exact version for
|
|
943
|
+
GitHub), a working version command and working sharp. A previously installed
|
|
944
|
+
native M365 broker must remain loadable. A mismatched npm prefix warns and retains
|
|
945
|
+
the caller's choice; if the target cannot be discovered, verification/rollback
|
|
946
|
+
cannot be guaranteed and the command explicitly says so. Restart CCDX separately.
|
|
947
|
+
|
|
948
|
+
Normal startup still checks GitHub's `releases/latest` web redirect once in the
|
|
949
|
+
background, with a two-second deadline and no npm/REST/PAT access. It validates
|
|
950
|
+
only the redirect header, cancels the body and silently skips errors; it never
|
|
951
|
+
installs, polls or retries. Explicit GitHub updates use a ten-second lookup.
|
|
952
|
+
`ccdx update gh` is shorthand. `ccdx update npm` keeps the configured registry and
|
|
953
|
+
installs `codex-copilot-dx@latest`; it never silently switches to GitHub.
|
|
954
|
+
|
|
955
|
+
npm policy is read using bounded named global fields, without printing credentials.
|
|
956
|
+
An unrelated project's `.npmrc` cannot grant permission. npm 12's
|
|
957
|
+
`allow-remote=none` can reject a mirror's cross-origin dependency URL with
|
|
958
|
+
`EALLOWREMOTE`. Only if company policy permits and you trust this entire package
|
|
959
|
+
tree, use the explicit one-install exception:
|
|
974
960
|
|
|
975
961
|
```sh
|
|
976
962
|
ccdx update github --allow-remote
|
|
977
|
-
# Or, for the configured npm registry:
|
|
978
963
|
ccdx update npm --allow-remote
|
|
979
964
|
```
|
|
980
965
|
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
this is not permission to run every package script. Windows uses the same fixed
|
|
986
|
-
system `cmd.exe` launch; use `ccdx.cmd` if PowerShell blocks `.ps1` shims.
|
|
966
|
+
This grants URL downloads throughout that installation's dependency tree, not a
|
|
967
|
+
hostname allowlist. It does not change `.npmrc`, add a retry, allow every script
|
|
968
|
+
or override other administrator policy. Older npm receives no unsupported flag.
|
|
969
|
+
Unknown support prevents an explicitly requested exception from starting.
|
|
987
970
|
|
|
988
|
-
|
|
989
|
-
bootstrap `0.9.38` from a version that fails with `EALLOWREMOTE`, the equivalent
|
|
990
|
-
explicit per-install command is, only with the same policy/trust approval:
|
|
971
|
+
For an older updater that still requires Git, install the Release tarball directly:
|
|
991
972
|
|
|
992
973
|
```sh
|
|
993
|
-
npm install -g
|
|
974
|
+
npm install -g https://github.com/DaleXiao/codex-copilot-dx/releases/download/v1.2.1/codex-copilot-dx-1.2.1.tgz
|
|
994
975
|
# Windows PowerShell: use npm.cmd instead of npm.
|
|
995
976
|
```
|
|
996
977
|
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
978
|
+
This manual npm URL command relies on npm/HTTPS and does not perform CCDX's
|
|
979
|
+
separate SHA-256 check. Under strict remote policy, use the verified bootstrap or
|
|
980
|
+
an administrator-approved local package/cache; do not automatically broaden policy.
|
|
981
|
+
A failed old `github:owner/repo#tag` install with `spawn git ENOENT` means npm
|
|
982
|
+
could not launch Git, often because Git was absent from the terminal's PATH.
|
|
983
|
+
It is unrelated to Wave styling; unknown-option warnings are separate.
|
|
984
|
+
|
|
985
|
+
### Install without Node or Git
|
|
986
|
+
|
|
987
|
+
The Release also contains `install.sh`, `install.ps1`, `ccdx-install.mjs` and
|
|
988
|
+
`SHA256SUMS`. Download the platform script from the intended release and run it
|
|
989
|
+
with the current shell policy. The scripts reuse compatible Node/npm and the
|
|
990
|
+
configured global prefix. If unavailable, they download **only official Node
|
|
991
|
+
24.22.0 LTS** for the current platform, verify the pinned official SHA-256,
|
|
992
|
+
and keep it inside CCDX's private directory. macOS arm64/x64, Windows arm64/x64
|
|
993
|
+
and glibc Linux arm64/x64 archives are selected explicitly. Linux musl users can
|
|
994
|
+
reuse an existing approved compatible Node; this bootstrap does not add libc.
|
|
995
|
+
Unsupported platforms fail before installing a system runtime.
|
|
996
|
+
|
|
997
|
+
Default private prefixes are `${XDG_DATA_HOME:-~/.local/share}/ccdx` and
|
|
998
|
+
`%LOCALAPPDATA%\CCDX`; an explicit `npm_config_prefix` takes precedence. No global
|
|
999
|
+
Node, Git, Python, compiler, Build Tools or package manager is installed. Native
|
|
1000
|
+
packages use prebuilt dependencies with install scripts disabled. The bootstrap
|
|
1001
|
+
verifies sharp and the native broker on macOS/Windows; a missing required prebuilt
|
|
1002
|
+
component fails and restores the old CCDX package. The private Node remains
|
|
1003
|
+
available for a retry if a later package download is blocked.
|
|
1004
|
+
|
|
1005
|
+
The helper and package are verified against the release checksum list. The
|
|
1006
|
+
bootstrap script itself is initially trusted through the selected HTTPS release;
|
|
1007
|
+
review it or compare its checksum through an independent trusted copy if needed.
|
|
1008
|
+
The helper reuses the selected npm's bundled `make-fetch-happen` downloader and
|
|
1009
|
+
bounded named proxy/no-proxy/CA/TLS/offline settings, with no automatic retries.
|
|
1010
|
+
It adds no downloader dependency, forwards no registry credentials and refuses
|
|
1011
|
+
network downloads in npm offline mode. A nonstandard npm missing that component
|
|
1012
|
+
fails with local-package guidance. Outer platform-script downloads use curl or
|
|
1013
|
+
Windows' download tool under their existing network/certificate policy; managed
|
|
1014
|
+
PAC-only/offline environments may require administrator-provided Release files.
|
|
1015
|
+
The bootstrap keeps user/global npm configuration, proxy and certificate choices.
|
|
1016
|
+
Unavailable downloads or restrictive policy stop with no channel fallback.
|
|
1017
|
+
It still needs approved access to GitHub Release assets, Node downloads when
|
|
1018
|
+
needed, and the configured registry for dependencies. For offline/managed devices,
|
|
1019
|
+
ask the administrator to pre-stage these exact files and dependency cache or use
|
|
1020
|
+
an approved existing Node/npm distribution; CCDX does not bypass network policy.
|
|
1021
|
+
|
|
1022
|
+
Private launchers bind the chosen Node and set `CCDX_PRIVATE_INSTALL_PREFIX` for
|
|
1023
|
+
future updates. Windows bootstrap uses these validated commands even with an
|
|
1024
|
+
existing Node, so spaces and shell metacharacters in the prefix do not break npm's generated batch commands. Exact npm-owned PowerShell launchers are removed; custom scripts and script policy stay unchanged. They supply a private `npm_config_prefix` only when the caller has
|
|
1025
|
+
not set one. Updates preserve those launchers. PATH and shell profiles are not
|
|
1026
|
+
rewritten: the installer prints the full command path and the directory to add
|
|
1027
|
+
for `ccdx` shorthand. Compatible POSIX installations keep npm's normal commands. Windows PowerShell
|
|
1028
|
+
expands percent signs in batch command filenames, before CCDX can run. The
|
|
1029
|
+
Windows bootstrap refuses an install prefix containing `%` before modifying it;
|
|
1030
|
+
choose a writable prefix without `%` using `npm_config_prefix`. Unicode, spaces,
|
|
1031
|
+
`&` and `!` are covered, including a legacy console code page. This avoids shipping
|
|
1032
|
+
an additional native executable just to bypass the shell's path parsing.
|
|
1033
|
+
No install hook is added to the npm package.
|
|
1034
|
+
|
|
1035
|
+
The scripts accept only `sh install.sh [--allow-remote]` or
|
|
1036
|
+
`./install.ps1 [-AllowRemote]`; the permission is explicit and applies to that
|
|
1037
|
+
one installation, with the same whole-tree meaning described above. Do not use
|
|
1038
|
+
it when company policy forbids it. Interrupted runtime downloads stay in a cleaned
|
|
1039
|
+
temporary directory; installed private runtime cleanup is a separate user choice.
|
|
1005
1040
|
|
|
1006
1041
|
## Diagnostics
|
|
1007
1042
|
|
|
@@ -1098,8 +1133,7 @@ once by default, using the configured main port when customized. See
|
|
|
1098
1133
|
startup preferences, output modes and effective-state rules. Assets require both
|
|
1099
1134
|
a loopback connection and loopback Host, including when the main listener uses LAN mode.
|
|
1100
1135
|
|
|
1101
|
-
The sidebar separates Overview, Codex/Claude
|
|
1102
|
-
diagnostics, and System/settings. Codex-specific images, prediction integration
|
|
1136
|
+
The sidebar separates Overview, indented Codex/Claude Apps, Model sources, Usage, Requests, and Settings. Codex-specific images, prediction integration
|
|
1103
1137
|
and conversation buffering stay under Codex. HTTP traffic counts include model
|
|
1104
1138
|
catalogs and route errors; model outcomes and timing are named by protocol.
|
|
1105
1139
|
Microsoft 365's Claude Messages summary is not a Provider-wide request total.
|
|
@@ -1114,7 +1148,7 @@ shows selected client-to-Provider routes; it is not an account label.
|
|
|
1114
1148
|
Catalog tabs browse registered Provider directories without changing routing.
|
|
1115
1149
|
Rows retain protocol, eligible clients, reasoning metadata and directory state.
|
|
1116
1150
|
Unknown metadata stays unknown; listings are not verified inference access.
|
|
1117
|
-
|
|
1151
|
+
The source form lives under Codex and explicitly applies subsequent routing. GitHub conversation models are selected in Codex, so its conversation-model field is hidden rather than empty. Auto Review has its own model/effort form under Codex, for either source; choices use the same advertised-effort policy and preference storage as the CLI. First source setup initializes the review choices atomically; later conversation-model saves preserve the saved review choice, and review changes use their own Save button. The GitHub model environment override is shown and locked. Microsoft 365 enable/disable stays under Model sources; disabling confirms that Claude local access stops, unchanged CCDX-owned settings are restored and Codex returns to GitHub. Active requests still block disabling.
|
|
1118
1152
|
Existing active streams keep their Provider binding. User/organization client
|
|
1119
1153
|
configuration is not overwritten by browsing or by a pause operation.
|
|
1120
1154
|
|
|
@@ -1155,9 +1189,9 @@ access. Normal prediction startup uses one line; exceptions retain reasons and
|
|
|
1155
1189
|
required restart guidance. `ccdx prediction status` retains environment/recovery
|
|
1156
1190
|
details, including routing, CA and TLS verification state.
|
|
1157
1191
|
|
|
1158
|
-
After Ready, a supported TTY has a
|
|
1192
|
+
After Ready, a supported TTY has a bounded region: uptime, source/Claude state,
|
|
1159
1193
|
a line-framed usage/inference table, one notice row and one activity row below it.
|
|
1160
|
-
Input includes
|
|
1194
|
+
Input includes reused input; partial usage counts returned records with missing fields.
|
|
1161
1195
|
Inference HTTP calls exclude catalog/count-tokens requests; model outcomes are
|
|
1162
1196
|
separate protocol observations, not an HTTP-success total. Activity motion includes
|
|
1163
1197
|
image MCP traffic; inference counters exclude it. Usage is process-local returned
|
|
@@ -1166,7 +1200,7 @@ Data refreshes about once a second; animation ticks reuse the table and redraw o
|
|
|
1166
1200
|
changed rows. Historical notices do not turn a running service into a health verdict.
|
|
1167
1201
|
Client cancellations remain in verbose/file diagnostics as informational records;
|
|
1168
1202
|
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.
|
|
1203
|
+
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
1204
|
|
|
1171
1205
|
Terminal appearance lives in System/settings, with a sidebar shortcut on wide
|
|
1172
1206
|
screens. Preview frames load on opening; closing, hiding the view/page or reduced
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codex-copilot-dx",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "Local Codex adapter and optional Microsoft 365 Claude gateway",
|
|
5
5
|
"author": "Dale Xiao",
|
|
6
6
|
"type": "module",
|
|
@@ -48,11 +48,13 @@
|
|
|
48
48
|
"bench:check": "node scripts/benchmark.mjs --check",
|
|
49
49
|
"pack:check": "npm pack --dry-run --json",
|
|
50
50
|
"verify": "npm test && npm run test:smoke && npm run bench:check && npm run pack:check",
|
|
51
|
-
"prepublishOnly": "npm run verify"
|
|
51
|
+
"prepublishOnly": "npm run verify",
|
|
52
|
+
"release:pack": "node scripts/release-artifacts.mjs",
|
|
53
|
+
"test:release-network": "node scripts/release-network-replay.mjs"
|
|
52
54
|
},
|
|
53
55
|
"dependencies": {
|
|
54
|
-
"sharp": "0.35.
|
|
55
|
-
"smol-toml": "1.
|
|
56
|
+
"sharp": "0.35.5",
|
|
57
|
+
"smol-toml": "1.9.1"
|
|
56
58
|
},
|
|
57
59
|
"optionalDependencies": {
|
|
58
60
|
"@azure/msal-node-runtime": "0.20.6"
|
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
|
|