codex-copilot-dx 1.4.12 → 1.4.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/docs/ARCHITECTURE.md +8 -0
- package/docs/REFERENCE.md +17 -15
- package/package.json +1 -1
- package/src/access-settings.mjs +1 -0
- package/src/adapter.mjs +2 -0
- package/src/antigravity-bindings.mjs +83 -0
- package/src/antigravity-chat-bridge.mjs +38 -8
- package/src/antigravity-handler.mjs +70 -37
- package/src/antigravity-runtime.mjs +44 -35
- package/src/cli-command-spec.mjs +1 -1
- package/src/cli-management-app.mjs +169 -0
- package/src/cli-management.mjs +7 -164
- package/src/connection-management.mjs +2 -0
- package/src/connection-routing.mjs +14 -5
- package/src/context-compaction-wire.mjs +6 -6
- package/src/dashboard/connections.js +13 -3
- package/src/dashboard/features.js +2 -2
- package/src/dashboard/index.html +41 -37
- package/src/dashboard/language.js +32 -17
- package/src/dashboard/status.js +20 -28
- package/src/dashboard/tool-activity-machines.js +362 -0
- package/src/dashboard/tool-activity.js +24 -115
- package/src/dashboard/tools.js +3 -4
- package/src/dashboard/ui.css +24 -3
- package/src/dashboard/ui.js +14 -0
- package/src/dashboard/usage.js +9 -1
- package/src/dashboard.mjs +1 -0
- package/src/local-privacy.mjs +3 -3
- package/src/management-routes.mjs +3 -3
- package/src/observability.mjs +9 -4
- package/src/privacy-transform.mjs +21 -6
- package/src/response-failures.mjs +7 -3
- package/src/safe-upstream-error.mjs +2 -2
- package/src/status-summary.mjs +13 -0
- package/src/stream-performance.mjs +1 -1
- package/src/terminal-state.mjs +8 -2
package/README.md
CHANGED
|
@@ -58,10 +58,10 @@ Model availability depends on your account and service. Microsoft 365 also requi
|
|
|
58
58
|
| Preview client setup | `ccdx app claude-app sync --preview` |
|
|
59
59
|
| Set up Antigravity | `ccdx app antigravity status` / `enable` / `open` |
|
|
60
60
|
| Inspect compression | `ccdx compact status` / `ccdx compact enable` / `ccdx compact disable` |
|
|
61
|
-
| Inspect failures | `ccdx requests --failed` |
|
|
61
|
+
| Inspect failures | `ccdx requests --failed` / `ccdx requests show ID --format json` |
|
|
62
62
|
| Inspect observed tool calls | `ccdx requests tools` / `ccdx requests tools --active` |
|
|
63
63
|
| Inspect active model requests | `ccdx requests --active` |
|
|
64
|
-
| Capture one upstream
|
|
64
|
+
| Capture one upstream Messages 400/422 | `ccdx requests diagnose --source api_work --model model-id --yes` |
|
|
65
65
|
| Read usage | `ccdx usage` / `ccdx usage --provider google --days 7` / `ccdx usage --purpose diagnostic` / `ccdx usage --scope run` |
|
|
66
66
|
| Inspect preferences | `ccdx config show --effective` |
|
|
67
67
|
| Inspect local masking | `ccdx config privacy status` |
|
|
@@ -80,7 +80,7 @@ Use the Web UI for accounts, APIs, models, client access, input suggestions, nat
|
|
|
80
80
|
- **Input suggestions:** new integrations attempt setup by default when Codex is closed. Saved off choices are retained. The Web UI can enable, disable, finish setup, open Codex and repair the bridge. Setup synchronizes Show predictions, adds App-profile trust and locally decrypts the prediction hosts' HTTPS traffic. App/thread eligibility still applies. [Details](docs/REFERENCE.md#optional-native-predictions).
|
|
81
81
|
- **Images:** Codex native host tools use the selected GitHub image model, with GPT Image 2.5 Flare as the default. Images start enabled; saved off choices are retained. On macOS with Codex 0.166+, fully quit a running App that lacks the host, start Codex through CCDX, and use a new chat. ChatGPT sign-in and Apps are retained. The Web UI provides model selection without an extra API key, MCP or CCDX image skill. [Details](docs/REFERENCE.md#native-image-generation).
|
|
82
82
|
- **Updates:** Settings → Install update downloads and verifies a stable release, then switches the installed service when idle. Busy work postpones the switch. Unmanaged launches require the installer or an installed command. [Details](docs/REFERENCE.md#installation-and-updates).
|
|
83
|
-
- **App updates:** Checks & repairs and `ccdx doctor` show observed installed Codex and
|
|
83
|
+
- **App updates:** Checks & repairs and `ccdx doctor` show observed installed Codex, Claude and Antigravity versions. A version change does not by itself verify the running App or its integrations. [Details](docs/REFERENCE.md#checks-and-troubleshooting).
|
|
84
84
|
|
|
85
85
|
Web UI activity updates through server push; the terminal uses the same in-process activity feed. Reconnecting restores current state and bounded recent records.
|
|
86
86
|
|
package/docs/ARCHITECTURE.md
CHANGED
|
@@ -49,6 +49,14 @@ conversation labels feed the existing source guard before main-answer dispatch.
|
|
|
49
49
|
Unsupported input fails explicitly, without Google or OpenAI inference fallback.
|
|
50
50
|
No independent WebKit client or private WebKit SPI is included.
|
|
51
51
|
|
|
52
|
+
Antigravity reads one request settings snapshot for model selection and its Copilot header-wait budget, and reads source access at route selection. Response headers end the Copilot header-wait deadline. Streaming then uses its independent idle budget whether the header limit was saved explicitly or inherited. The Chat bridge aggregates reported usage fields once and feeds the same numeric fields to the client and ledger. Structured stream errors retain the actual HTTP status, safe failure type and validated retry guidance. No opened stream is replayed.
|
|
53
|
+
|
|
54
|
+
Antigravity keeps a bounded local conversation route table with keyed session hashes, hashed owners and model aliases. Compression consults the existing conversation owner guard before using the retained model. Unbound background tasks prefer Carbon Low and may use a compatible selected model from the same authorized source if it is unavailable. Copilot Chat recovery summaries require both a successful stop reason and the Chat stream terminator. The other protocols retain their own terminal contracts.
|
|
55
|
+
|
|
56
|
+
For managed GitHub Codex model plans, Auto Review resolves an explicit startup override within the authorized deployments before consulting saved or observed session routing. The saved effort is associated with its selected review route. A different override uses the app's requested effort, or Low when omitted and supported.
|
|
57
|
+
|
|
58
|
+
Antigravity stages the model binding separately from the source authorization guard. It commits a binding only after protocol completion, using request order to prevent a later-arriving response from an older request replacing a confirmed choice. The binding store retains only the account and conversation hashes, model alias and order. Lightweight runtime status reads its counters directly before composing provider, catalog and diagnostic details. The terminal's app management commands share the existing formatting, confirmation and management API contracts through their own command module.
|
|
59
|
+
|
|
52
60
|
## Composition and lifecycle
|
|
53
61
|
|
|
54
62
|
### Application control and shared source admission
|
package/docs/REFERENCE.md
CHANGED
|
@@ -24,7 +24,7 @@ For installation and first use, start with the [README](../README.md). This refe
|
|
|
24
24
|
| `ccdx source github login` / `reauth` / `logout` | Manage the saved GitHub account |
|
|
25
25
|
| `ccdx source m365 accounts` / `account` | List local company accounts or select one |
|
|
26
26
|
| `ccdx app list` | Show client setup and observed activity |
|
|
27
|
-
| `ccdx app <id> status
|
|
27
|
+
| `ccdx app <id> status` | Read client configuration and scoped features |
|
|
28
28
|
| `ccdx app <id> models --edit` | Choose visible models and a default |
|
|
29
29
|
| `ccdx app <id> sync --preview` | Preview the model/configuration plan |
|
|
30
30
|
| `ccdx app <id> sync` | Write client settings owned by CCDX |
|
|
@@ -76,8 +76,7 @@ Choose **Follow conversation model** to use an observed model from the same Code
|
|
|
76
76
|
The **Antigravity** page and `ccdx app antigravity status|models|enable|disable|open`
|
|
77
77
|
manage the original macOS Gemini App. Enable requires acceptance of this data
|
|
78
78
|
scope: Antigravity main answers follow the selected Google or Copilot model;
|
|
79
|
-
|
|
80
|
-
including background work from Google-model sessions. Ordinary Gemini chat
|
|
79
|
+
unbound summaries, searches and image generation use GitHub Copilot. A known conversation retains its confirmed source, model and reasoning level for compression. Ordinary Gemini chat
|
|
81
80
|
keeps its Google route. No OpenAI account or search fallback is used.
|
|
82
81
|
|
|
83
82
|
`app list` includes Antigravity before its first WebUI visit and uses observed state without waiting for native App
|
|
@@ -90,13 +89,13 @@ Choose its exposed models on the Antigravity page or with
|
|
|
90
89
|
The native Gemini catalog still uses distinct routing aliases for each level so its original selector can choose the intended effort. JSON model output retains those aliases for compatibility, with a `model` field identifying the actual model; the management status also includes `model_groups`. A model file accepts `{"models":["gemini-4-hydrogen"]}` to expose all of its advertised levels, or individual `ccdx-copilot-...-<effort>` aliases to choose a subset. Existing Carbon/Argon aliases remain valid. Models without declared reasoning levels use one plain alias.
|
|
91
90
|
In the **New chat default** column, choose **Set default** on a Copilot model row, or choose **Use app default** to clear the preference on save. The row action uses `medium` if selected, otherwise the first selected level. `app antigravity models --edit` can choose an exact level; a model file can add `"default_model"` with a selected base ID or route alias, or `null` to clear. The gateway changes only the agent-default field in a compatible catalog; it leaves requests, existing conversation bindings, ordinary Gemini chat and background tasks unchanged. An unavailable saved default does not silently pick another Copilot model. The page reports when the catalog still needs to be loaded. Use **Reopen** in the Antigravity page when it indicates settings need loading. CCDX never reopens the app automatically. An observed connection or fetched catalog does not prove the app adopted the new default.
|
|
92
91
|
|
|
93
|
-
On the **Antigravity** page, set **Copilot response timeout (s)** to 1–600 seconds and save, or leave it blank to use the
|
|
92
|
+
On the **Antigravity** page, set **Copilot response-header timeout (s)** to 1–600 seconds and save, or leave it blank to use 180 seconds. An explicitly configured `CCDX_UPSTREAM_TIMEOUT_MS` supplies the default when the field is blank. The setting persists across restarts and applies when new Copilot generation requests send and wait for response headers. A wait already underway keeps its original deadline. When response headers arrive, the stream idle timer takes over. The same transition applies when the timeout uses its default. Queue, request-body, native Google, Codex and Claude retain their own limits. If `CCDX_ANTIGRAVITY_COPILOT_TIMEOUT_MS` is set at startup, the page shows that value and disables editing.
|
|
94
93
|
|
|
95
94
|
To use a custom Gemini API in Antigravity, add an API that declares **Gemini**. Its Gemini address is the versioned model-list URL, for example `https://generativelanguage.googleapis.com/v1beta/models`. Save an API key separately, read the model list, and save the desired Gemini deployments. In **Antigravity → Custom Gemini source**, choose the source and save. Its models appear in the client catalog alongside the existing models. Generation, streaming, and token counts use the selected source's Gemini API and key. CCDX does not send the App's Google credentials or switch an existing conversation to a different source. Reopen Antigravity only if the page shows a catalog reload is needed.
|
|
96
95
|
|
|
97
96
|
The WebUI uses one authorization form for GitHub Copilot, Microsoft 365 and custom APIs. Source switches apply immediately. App-authorization and model checkboxes are drafts until **Save**; **Discard changes** restores the saved selection. Drafts survive refresh and navigation. Source authorization does not choose app models.
|
|
98
97
|
|
|
99
|
-
Pausing Antigravity Copilot access retains its saved model selection. Native Google model routes remain available; Copilot models
|
|
98
|
+
Pausing Antigravity Copilot access retains its saved model selection. Native Google model routes remain available; Copilot models, unbound summaries, searches and images use Copilot. Bound compression retains its source, model and advertised reasoning level. The connection indicator reports observed requests separately from enabled access, and connection activity includes discovery/control requests.
|
|
100
99
|
|
|
101
100
|
The page distinguishes enabled access from an observed client connection.
|
|
102
101
|
|
|
@@ -106,7 +105,7 @@ before Copilot dispatch. Text, inline images and native function tools are
|
|
|
106
105
|
converted to the advertised Copilot Chat interface; truncated streams report an
|
|
107
106
|
error rather than successful completion.
|
|
108
107
|
|
|
109
|
-
This Copilot selection does not restrict Antigravity's original Google model directory. Google wire IDs such as `gemini-3.8-flash-tiered` can therefore appear in usage without being CCDX-added model choices. The recorded provider distinguishes Google and GitHub Copilot; the ID alone does not establish a background task or a fallback. Known conversation compaction retains its
|
|
108
|
+
This Copilot selection does not restrict Antigravity's original Google model directory. Google wire IDs such as `gemini-3.8-flash-tiered` can therefore appear in usage without being CCDX-added model choices. The recorded provider distinguishes Google and GitHub Copilot; the ID alone does not establish a background task or a fallback. Known conversation compaction retains its recorded source and model, including after a gateway restart. CCDX retains bounded per-session routing metadata with hashed session and source identifiers. Unbound title and summary jobs prefer Carbon Low when available, then a compatible model on the authorized Copilot source. Existing owner records without model metadata retain the previous background fallback when the App supplies no usable alias.
|
|
110
109
|
|
|
111
110
|
`enable` saves CCDX settings and prepares its local source guard. `open --preview` shows the inspected application state without launching it.
|
|
112
111
|
`open` starts a closed, verified Gemini App in `/Applications` or `~/Applications` with a process-local
|
|
@@ -135,7 +134,7 @@ Each protocol observer retains at most 64 series of 64 request points and 16 com
|
|
|
135
134
|
|
|
136
135
|
## Observed tool calls
|
|
137
136
|
|
|
138
|
-
**Requests → Tool and agent activity**
|
|
137
|
+
**Requests → Tool and agent activity** offers Assembly line, Dual-lane sorter, Gantry transfer and Indexing table. Assembly line is the default and replaces removed preferences. Choose Off to keep status text without drawing. The setting is per browser. The display follows observed request and tool activity. Motion stops on completion, failure, cancellation, stale evidence, hidden views or reduced-motion settings. The pictures show activity and do not measure progress.
|
|
139
138
|
|
|
140
139
|
Calls are correlated using their IDs and the existing app/profile/session scope. A model emitting a tool call does not prove that the client executed it. Only a matching returned result ends the wait; ambiguous name-only Gemini results stay unconfirmed. Without a reliable session, completed requests show unconfirmed tool state. After 90 seconds without observable tool or response activity, the UI pauses and shows that fresh status is needed. Late results can update retained unconfirmed observations for another five minutes. These display deadlines never cancel tools or change source timeouts.
|
|
141
140
|
|
|
@@ -197,7 +196,7 @@ Model details can declare `max_tool_definitions` and `supported_parameters`. Cat
|
|
|
197
196
|
|
|
198
197
|
HTTP failures retain a safe technical category, parameter path, reported numeric maximum, source, model, protocol and request ID when available. Unknown vendor explanations remain unknown. Default diagnostics do not copy vendor prose or prompts. HTTP 400 may be a parameter or context rejection; a count-endpoint 404 describes token counting separately.
|
|
199
198
|
|
|
200
|
-
For an explicit one-shot investigation, run `ccdx requests diagnose --source ID --model ID --yes` on the running service. It captures the first matching Messages HTTP 400/422 within ten minutes, including a failure recovered by an existing compatibility retry. It retains at most 512 characters of redacted technical explanation in process memory; an explanation can still contain an unlabelled request fragment. No request body is saved and no model call is made. Read the result with `ccdx requests diagnose --format json`; clear or cancel it with `ccdx requests diagnose --cancel --yes`. Restarting clears the capture. A missing, oversized or slow error body produces `unavailable`; successful requests and other sources/models do not consume it. This diagnoses the rejection and does not change request parameters or prove the original problem is fixed.
|
|
199
|
+
For an explicit one-shot Messages HTTP 400 or 422 investigation, run `ccdx requests diagnose --source ID --model ID --yes` on the running service. It captures the first matching Messages HTTP 400/422 within ten minutes, including a failure recovered by an existing compatibility retry. It retains at most 512 characters of redacted technical explanation in process memory; an explanation can still contain an unlabelled request fragment. No request body is saved and no model call is made. Read the result with `ccdx requests diagnose --format json`; clear or cancel it with `ccdx requests diagnose --cancel --yes`. Restarting clears the capture. A missing, oversized or slow error body produces `unavailable`; successful requests and other sources/models do not consume it. This diagnoses the rejection and does not change request parameters or prove the original problem is fixed.
|
|
201
200
|
|
|
202
201
|
Two confirmed connection failures or temporary 502/503/504 replies trigger a short cooldown for that source interface. The default delay is five seconds; a reported Retry-After can extend it to at most thirty seconds. One later real request checks recovery. Parameter/auth errors, missing token-count endpoints and client cancellation do not trigger it. Other sources and interfaces continue independently. There is no background paid probe or automatic model/account switch.
|
|
203
202
|
|
|
@@ -217,7 +216,7 @@ Recovery preserves human messages, system instructions, tool declarations, signe
|
|
|
217
216
|
|
|
218
217
|
Codex gateway summaries use authenticated local compression states. Only CCDX expands its own states after local authorization; vendor states stay opaque and retain their connection ownership. Source-native states carrying private placeholders preserve the required restoration map in an authenticated gateway envelope. Maps are never sent upstream or stored as plaintext files. Gateway-owned states require CCDX 1.4 or later; keep the complete local transcript before any downgrade, since older gateways cannot directly expand this versioned state. Imported maps retain the existing mapping limits and are released with their request. A changed client identity or connection cannot silently reuse the state.
|
|
219
218
|
|
|
220
|
-
Antigravity compression follows
|
|
219
|
+
Antigravity compression follows its last successfully confirmed conversation source and model, in request order. Locally rejected requests and failed streams leave the confirmed model in place. Hashed source ownership also survives a service restart. When attribution is unavailable, the already-authorized background policy is retained; the gateway does not infer a Google route from a default background model name. Other title, search and image behavior is unchanged. The native Google route retains its existing privacy policy; Copilot compression stays inside the existing masking session.
|
|
221
220
|
|
|
222
221
|
Internal summary jobs record returned usage separately with purpose `compaction`, including reported partial usage before failure. The Codex aggregate response is not logged a second time. Missing counts remain unknown and genuine zero cache counts stay zero. `ccdx usage --purpose compaction` and the WebUI purpose filter show this work; every purpose remains in default totals. Observed native Claude/Antigravity compression tasks also appear in context observations when explicit session metadata is available. Summary output length is not presented as a verified post-compression context size.
|
|
223
222
|
|
|
@@ -234,7 +233,8 @@ Catalog diagnostics distinguish local cached data from an online response and ex
|
|
|
234
233
|
- **Saved account, access denied:** use source status/check to distinguish the saved credential from current access. `source github reauth` replaces sign-in only after a successful new login. Other apps' credentials are read-only.
|
|
235
234
|
- **No client models:** inspect allowed sources, selected models and unavailable selections. An empty selection means paused access, not missing credentials.
|
|
236
235
|
- **Configuration unchanged:** CCDX kept existing settings. Preview the intended plan before syncing; do not overwrite managed settings to force success.
|
|
237
|
-
- **Request failure:** use Requests or `ccdx requests --failed`. HTTP
|
|
236
|
+
- **Request failure:** use Requests or `ccdx requests --failed`. HTTP status and model outcome are separate. An HTTP 200 response can still report a stream failure. Token-count and access notices are visible in the unfiltered request list.
|
|
237
|
+
- **Request evidence:** use `ccdx requests show ID --format json` while the request is retained. The local request ID, outbound client ID and upstream request ID identify different stages. **Recent request issues → Failures over 24 hours** groups available failure metadata by hour, app, model and phase. `ccdx status --details --format json` includes the same bounded summary under `http_errors.history`.
|
|
238
238
|
- **Token counting unavailable:** an observed API count-endpoint 404 is cached briefly per model/header scope. Inference and token counting are separate capabilities; no synthetic count is returned.
|
|
239
239
|
- **Local checks:** `doctor` is read-only by default. `--online` checks access; `--compat` sends minimal inference and consumes usage. `--fix` backs up owned configuration and performs bounded repairs. It does not enable optional features, change company policy or force-restart apps. Partial repairs exit 1.
|
|
240
240
|
- **App updates:** after the service is ready, CCDX observes installed App versions in the background. Checks & repairs shows the result; `ccdx doctor` can inspect it locally. On macOS this includes Antigravity (the original Gemini App) and uses known App bundle metadata and, when available, the bundled Codex CLI version. On Windows the registered Codex package is inspected; Claude App remains unknown if reliable metadata is unavailable. The running process may still be an older build, and a version observation does not verify images, predictions, model access or protocol compatibility. Claude capability synchronization uses the installed macOS App contract described below. An installed version alone does not establish native adoption. The compact local version record contains only App versions, builds and observation times, not credentials or conversation data. It is refreshed on startup, local checks and the existing model-refresh cadence; a reused service receives a nonblocking refresh notification.
|
|
@@ -266,9 +266,9 @@ For an identified conversation, hovering a point in the input-history chart show
|
|
|
266
266
|
|
|
267
267
|
## Shared source concurrency
|
|
268
268
|
|
|
269
|
-
In **Settings → Advanced: request limits**, **Shared request-body limit** sets the shared gateway reservation to 32–128 MiB (default 32 MiB). It applies at the next CCDX start. `ccdx config limits` shows the saved and running values. `CCDX_MAX_INFLIGHT_BODY_BYTES` still overrides the saved value. This control does not change per-request size limits, the decompressed-body or response-history pools, Claude's separate Messages queue, or provider concurrency. Increasing this limit does not fix a provider timeout. Antigravity control GETs without a framed body do not enter the upload queue. Allowlisted read-only control POSTs with a known, uncompressed body of at most 8 KiB use four independent slots and an eight-request waiting limit. Other requests still use the shared body queue. `ccdx status --json` reports the short queue under `gemini.activity.short_control_queue`.
|
|
269
|
+
In **Settings → Advanced: request limits**, **Shared request-body limit** sets the shared gateway reservation to 32–128 MiB (default 32 MiB). It applies at the next CCDX start. `ccdx config limits` shows the saved and running values. `CCDX_MAX_INFLIGHT_BODY_BYTES` still overrides the saved value. This control does not change per-request size limits, the decompressed-body or response-history pools, Claude's separate Messages queue, or provider concurrency. Increasing this limit does not fix a provider timeout. Antigravity control GETs without a framed body do not enter the upload queue. Allowlisted read-only control POSTs with a known, uncompressed body of at most 8 KiB use four independent slots and an eight-request waiting limit. Other requests still use the shared body queue. `ccdx status --details --format json` reports the short queue under `gemini.activity.short_control_queue`.
|
|
270
270
|
|
|
271
|
-
`ccdx status` shows the longest admitted wait in the gateway's local request-body queue. `status --json` retains the longest sample and up to 16 recent waits, including cancellations and timeouts. Samples record a route, request ID, wait reason and byte counts in memory; no request body or credential is retained. The request table shows the total time. Its details keep source, input usage, and the separate phases. An open request detail in view retains its place as new records arrive. If its disclosure held keyboard focus, that focus is restored. In **Checks → Service requests**, the error category table separates generation, capability and access, request method, request path, and other errors. These classify the same errors shown in the 4xx/5xx totals. The existing request details distinguish local waiting from waiting for the selected source. Local waiting ends before the body is read, and source waiting ends before sending upstream. For Antigravity Copilot Chat, `ccdx status --json` reports how many body bytes were passed to the socket (`attempts[].body_written_bytes`), when the local send finished (`body_sent_ms`, measured from request receipt), the outbound client correlation ID (`client_request_id`), and any observed transport error (`transport_error`). The WebUI shows total duration, sending time, response-header wait and first usable output when available. Copy details keeps the local ID, outbound ID and upstream response ID distinct. Valid upstream retry guidance is preserved on 429 and 503; neither response triggers an automatic resend. A local timeout is not a recorded connection error. None of these markers prove the source received or processed the body.
|
|
271
|
+
`ccdx status --details` shows the longest admitted wait in the gateway's local request-body queue. `ccdx status --details --format json` retains the longest sample and up to 16 recent waits, including cancellations and timeouts. Samples record a route, request ID, wait reason and byte counts in memory; no request body or credential is retained. The request table shows the total time. Its details keep source, input usage, and the separate phases. An open request detail in view retains its place as new records arrive. If its disclosure held keyboard focus, that focus is restored. In **Checks → Service requests**, the error category table separates generation, capability and access, request method, request path, and other errors. These classify the same errors shown in the 4xx/5xx totals. The existing request details distinguish local waiting from waiting for the selected source. Local waiting ends before the body is read, and source waiting ends before sending upstream. For Antigravity Copilot Chat, `ccdx status --details --format json` reports how many body bytes were passed to the socket (`attempts[].body_written_bytes`), when the local send finished (`body_sent_ms`, measured from request receipt), the outbound client correlation ID (`client_request_id`), and any observed transport error (`transport_error`). The WebUI shows total duration, sending time, response-header wait and first usable output when available. Copy details keeps the local ID, outbound ID and upstream response ID distinct. Valid upstream retry guidance is preserved on 429 and 503; neither response triggers an automatic resend. A local timeout is not a recorded connection error. None of these markers prove the source received or processed the body.
|
|
272
272
|
|
|
273
273
|
All three Apps share admission for the same configured source and account. A slot spans the real upstream response body through completion, cancellation or error. Request-body memory is tracked separately; uploads of unknown length start with a minimal reservation and grow it by bytes read, before retaining the data for parsing. If there is not enough room, reading pauses until existing requests release memory. Only one such reader per pool may grow at a time; a reader waiting for more memory takes priority over new admissions. Once upload is complete, another reader can start while the earlier request retains its actual body reservation. Requests larger than the pool still run exclusively at the pool ceiling, subject to the existing per-request limits. Growth waits share the existing upload deadline and can appear in the body-read time; the entry queue is recorded separately. Recovery and internal summaries acquire fresh slots after the rejected response releases its slot.
|
|
274
274
|
|
|
@@ -829,7 +829,7 @@ The old external image provider, Qwen-specific generation/editing, `/mcp/image`,
|
|
|
829
829
|
| `CCDX_MAX_UPSTREAM_BODY_BYTES` | `31457280` | Strict maximum forwarded Responses body size; larger payloads are adapted locally or rejected with `413` |
|
|
830
830
|
| `CCDX_MAX_SSE_BUFFER_BYTES` | `8388608` | Maximum buffered bytes for one unterminated upstream SSE line or event |
|
|
831
831
|
| `CCDX_UPSTREAM_TIMEOUT_MS` | `120000` | Per-phase timeout for Responses/Messages preparation and non-streaming upstream requests |
|
|
832
|
-
| `CCDX_ANTIGRAVITY_COPILOT_TIMEOUT_MS` | `unset` | Startup override for Antigravity Copilot generation through response headers. If unset, use the saved value or
|
|
832
|
+
| `CCDX_ANTIGRAVITY_COPILOT_TIMEOUT_MS` | `unset` | Startup override for Antigravity Copilot generation through response headers. If unset, use the saved value, an explicit `CCDX_UPSTREAM_TIMEOUT_MS`, or 180 seconds. |
|
|
833
833
|
| `CCDX_STREAM_HANDSHAKE_TIMEOUT_MS` | `120000` | Timeout while waiting for upstream streaming response headers |
|
|
834
834
|
| `CCDX_STREAM_IDLE_TIMEOUT_MS` | `120000` | Maximum idle time between upstream streaming body chunks |
|
|
835
835
|
| `CCDX_UPSTREAM_RETRIES` | `2` | Retries for safe requests and clearly pre-connect POST failures; capped at `5` |
|
|
@@ -865,7 +865,7 @@ The old external image provider, Qwen-specific generation/editing, `/mcp/image`,
|
|
|
865
865
|
| `CCDX_DISABLE_USAGE` | unset | Set to `1` to disable usage logging |
|
|
866
866
|
| `CCDX_SHUTDOWN_TIMEOUT_MS` | `5000` | Time to drain active HTTP connections before forcing shutdown |
|
|
867
867
|
|
|
868
|
-
Antigravity starts the body deadline after queue admission.
|
|
868
|
+
Antigravity starts the body deadline after queue admission. One-shot Copilot generation releases request-body memory when the transport finishes writing it. Compression retains reusable input through recovery until the final response opens. Response restoration retains its own request state until completion. Queue exhaustion or timeout returns `503`; a body timeout returns `408`; upstream and compaction timeouts return `504`. Client cancellation releases queued or active reservations. An HTTP success with no Copilot stream body returns `502` before CCDX opens its response stream.
|
|
869
869
|
|
|
870
870
|
## Usage logging
|
|
871
871
|
|
|
@@ -893,7 +893,7 @@ Diagnostic redaction removes Basic authorization payloads and URL userinfo, and
|
|
|
893
893
|
|
|
894
894
|
## Debug logging
|
|
895
895
|
|
|
896
|
-
Set `CCDX_LOG_PATH=1` to record diagnostic logs independently of quiet terminal presentation to `~/.local/share/codex-copilot-dx/debug.log`, or provide a custom path. Add `CCDX_LOG_LEVEL=debug` for upstream attempts, retry causes, status codes, and timings. The adapter does not deliberately dump request/response bodies or authorization headers. File diagnostics redact common credential forms and labelled content echoes, but this cannot identify every secret in arbitrary external prose; review logs before sharing them. File writes are asynchronous and batched with a 4096-record / 2 MiB pending-and-in-flight ceiling. Overflow drops excess file records with one warning and a status counter; terminal output continues. CLI exit paths flush for at most 1.5 seconds. `ccdx doctor config` bypasses file logging entirely.
|
|
896
|
+
Set `CCDX_LOG_PATH=1` to record diagnostic logs independently of quiet terminal presentation to `~/.local/share/codex-copilot-dx/debug.log`, or provide a custom path. Add `CCDX_LOG_LEVEL=debug` for upstream attempts, retry causes, status codes, and timings. The adapter does not deliberately dump request/response bodies or authorization headers. File diagnostics redact common credential forms and labelled content echoes, but this cannot identify every secret in arbitrary external prose; review logs before sharing them. Leave file diagnostics disabled for routine use. Use request details or a targeted one-shot capture before enabling debug logging. File writes are asynchronous and batched with a 4096-record / 2 MiB pending-and-in-flight ceiling. Overflow drops excess file records with one warning and a status counter; terminal output continues. CLI exit paths flush for at most 1.5 seconds. `ccdx doctor config` bypasses file logging entirely.
|
|
897
897
|
|
|
898
898
|
|
|
899
899
|
## Large histories and images
|
|
@@ -1008,6 +1008,8 @@ Each request pins its masking choice, including compatibility retries. Checks no
|
|
|
1008
1008
|
|
|
1009
1009
|
Streaming restoration emits argument fragments incrementally with JSON string escaping, keeps protocol identities and signed state opaque, and validates completion against argument snapshots or incremental JSON syntax. Only unfinished placeholder tails and structural metadata are retained; raw argument bytes per channel remain capped at 8 MiB, retained tails/metadata/validator state at 32 MiB and active channels at 1,024. Added tail deltas preserve increasing Responses sequence numbers. An incomplete or failed upstream response does not manufacture a completed tool call. Successful frame bytes remain unchanged when restoration is unnecessary. A timeout or busy check reports that nothing was sent, with `Retry-After` for temporary waits. Model readiness, the latest check and the latest protected reply are separate. WebUI and `ccdx config privacy status` report pending detection and reply-restoration errors; the CLI retains explicit enabled/disabled values, while graphical switches omit duplicate normal-state labels; request details retain bounded error/event/channel codes and buffer quantities, never their values. A loaded model or HTTP 200 does not establish that a request or client tool completed.
|
|
1010
1010
|
|
|
1011
|
+
Requests requiring no replacements use the original body. For large text checks, the full runtime status reports numeric scanning, detection (including queue wait), and merging durations in `local_privacy.last_check.timing`. The status contains no request text.
|
|
1012
|
+
|
|
1011
1013
|
Turning masking off affects subsequent requests. Existing protected replies keep their restoration mappings until they finish. The downloaded component can then be deleted separately. Settings reset backs up and resets masking choices while keeping accounts, model selections, client connections, images and prediction access. Older settings backups inherit masking off.
|
|
1012
1014
|
|
|
1013
1015
|
WebUI controls and `ccdx config privacy` use the same preparation transaction. While the service runs, `config set privacy_enabled true/false` and the personal-information preference use these same controls. Offline preference writes and backup restoration retain saved intent; they do not prove model readiness or download a missing model. Unavailable configured protection holds requests back. Use Enable/Retry or `config privacy enable` to prepare it.
|
package/package.json
CHANGED
package/src/access-settings.mjs
CHANGED
|
@@ -20,6 +20,7 @@ const messages = {
|
|
|
20
20
|
ccdx_api_model_unavailable: "This model is not configured for the requested API. Review the source's model list.",
|
|
21
21
|
ccdx_api_environment_key_missing: "Set the configured API-key environment variable before starting CCDX.",
|
|
22
22
|
ccdx_api_secret_unavailable: "The system credential store is unavailable. No plaintext fallback was used.",
|
|
23
|
+
ccdx_review_environment_override: "The startup setting CCDX_AUTO_REVIEW_MODEL controls the Auto Review model.",
|
|
23
24
|
ccdx_client_source_mismatch: "Save the source before changing its review model.",
|
|
24
25
|
};
|
|
25
26
|
export const accessError = (code, statusCode = 400) => {
|
package/src/adapter.mjs
CHANGED
|
@@ -19,6 +19,7 @@ import { createLocalPrivacy } from "./local-privacy.mjs";
|
|
|
19
19
|
import { status } from "./status.mjs";
|
|
20
20
|
import { exportResponseHistory, importResponseHistory } from "./response-history.mjs";
|
|
21
21
|
import { createTerminalActivityIndicator } from "./terminal-activity.mjs";
|
|
22
|
+
import {runtimeStatusSummary} from "./status-summary.mjs";
|
|
22
23
|
import { ADAPTER_HEALTH_PATH, ADAPTER_PREDICTION_FIX_PATH, adapterHealthPayload } from "./running-adapter.mjs";
|
|
23
24
|
import { ACTIVITY_EVENTS_PATH, createActivityEvents } from "./activity-events.mjs";
|
|
24
25
|
import { runtimeUsageSnapshot } from "./usage-store.mjs";
|
|
@@ -249,6 +250,7 @@ export function createAdapterHandler(options = {}) {
|
|
|
249
250
|
let statusSnapshot;
|
|
250
251
|
const managementHandler = createManagementHandler({
|
|
251
252
|
activityEvents,
|
|
253
|
+
summarySnapshot: () => runtimeStatusSummary(requestMetrics.snapshot(), nativeImages.stats().active),
|
|
252
254
|
nativePredictionPac: options.nativePredictionPac, fixPrediction: options.fixPrediction, requestBodyTimeoutMs,
|
|
253
255
|
statusSnapshot: statusSnapshot = () => {
|
|
254
256
|
const snapshot = runtimeStatusPayload({ metrics: requestMetrics, streamPerformance: streamPerformanceMetrics, admission: acquireRequest,
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import {createHmac} from "node:crypto";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import {accessSettingsPath} from "./access-settings.mjs";
|
|
4
|
+
import {readClientGatewayKeys} from "./client-gateway-keys.mjs";
|
|
5
|
+
import {atomicWriteFile} from "./atomic-file.mjs";
|
|
6
|
+
import {withFileLock} from "./lock.mjs";
|
|
7
|
+
import {readBoundedFile} from "./bounded-file.mjs";
|
|
8
|
+
import {redactDiagnosticText} from "./diagnostic-text.mjs";
|
|
9
|
+
import {httpError} from "./http-errors.mjs";
|
|
10
|
+
|
|
11
|
+
export const validModel=id=>typeof id==="string"&&/^[\w][\w./:@+-]{0,159}$/.test(id)&&redactDiagnosticText(id)===id;
|
|
12
|
+
|
|
13
|
+
export function createAntigravityBindings(options,guard){
|
|
14
|
+
let compactionSalt,conversationRoutes,pending=0;
|
|
15
|
+
const routeFile=path.join(path.dirname(accessSettingsPath(options)),"antigravity-conversations.json");
|
|
16
|
+
const readRoutes=async()=>{
|
|
17
|
+
let value;
|
|
18
|
+
try{value=JSON.parse(await readBoundedFile(routeFile,{encoding:"utf8",maxBytes:128*1024}));}
|
|
19
|
+
catch(error){if(error.code==="ENOENT")return {};throw httpError("Antigravity conversation routing data could not be read",409);}
|
|
20
|
+
if(!value||typeof value!=="object"||Array.isArray(value)||Object.keys(value).length>256||
|
|
21
|
+
Object.entries(value).some(([id,item])=>!/^[a-f0-9]{64}$/.test(id)||!item||
|
|
22
|
+
!/^[a-f0-9]{64}$/.test(item.owner)||!validModel(item.model)||
|
|
23
|
+
item.startedAt!==undefined&&!Number.isFinite(item.startedAt)))throw httpError("Invalid Antigravity conversation routing data",409);
|
|
24
|
+
return value;
|
|
25
|
+
};
|
|
26
|
+
const conversationKey=body=>{
|
|
27
|
+
const id=body?.request?.labels?.root_cascade_id||body?.request?.labels?.cascade_id;
|
|
28
|
+
if(typeof id!=="string"||!id||id.length>160||/[\u0000-\u001f\u007f]/.test(id))return null;
|
|
29
|
+
compactionSalt||=readClientGatewayKeys({...options,create:false}).codex;
|
|
30
|
+
return createHmac("sha256",compactionSalt).update("antigravity-compression\0"+id).digest("hex");
|
|
31
|
+
};
|
|
32
|
+
const hashProfile=profile=>createHmac("sha256",compactionSalt).update(profile).digest("hex");
|
|
33
|
+
const store=(routes,key,entry)=>{
|
|
34
|
+
delete routes[key];routes[key]=entry;
|
|
35
|
+
const keys=Object.keys(routes);
|
|
36
|
+
for(const id of keys.slice(0,Math.max(0,keys.length-256)))delete routes[id];
|
|
37
|
+
};
|
|
38
|
+
return {
|
|
39
|
+
hashProfile,
|
|
40
|
+
prepare(body,profile,startedAt){
|
|
41
|
+
const key=conversationKey(body),model=body.model;
|
|
42
|
+
if(!key||!profile||!validModel(model))return;
|
|
43
|
+
const owner=hashProfile(profile);
|
|
44
|
+
return async signal=>{
|
|
45
|
+
if(signal.aborted)return;
|
|
46
|
+
const entry={owner,model,startedAt};
|
|
47
|
+
// Check the durable order inside the lock, including successful requests
|
|
48
|
+
// that use the same model. A late completion cannot change the binding.
|
|
49
|
+
const newer=routes=>routes?.[key]?.owner!==owner||(routes[key].startedAt??0)<startedAt;
|
|
50
|
+
if(!newer(conversationRoutes))return;
|
|
51
|
+
if(!pending&&conversationRoutes?.[key]?.owner===owner&&conversationRoutes[key].model===model){
|
|
52
|
+
store(conversationRoutes,key,entry);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
pending++;
|
|
56
|
+
try{
|
|
57
|
+
await withFileLock(routeFile+".lock",async()=>{
|
|
58
|
+
const routes=await readRoutes();
|
|
59
|
+
if(signal.aborted||!newer(conversationRoutes))return;
|
|
60
|
+
if(newer(routes)){
|
|
61
|
+
const stored=routes[key];
|
|
62
|
+
store(routes,key,entry);
|
|
63
|
+
if(stored?.owner!==owner||stored.model!==model)await atomicWriteFile(routeFile,JSON.stringify(routes)+"\n",{mode:0o600});
|
|
64
|
+
}
|
|
65
|
+
if(!conversationRoutes)conversationRoutes=routes;
|
|
66
|
+
else if(newer(conversationRoutes))store(conversationRoutes,key,routes[key]);
|
|
67
|
+
},{timeoutMs:1000,signal});
|
|
68
|
+
}catch{
|
|
69
|
+
if(!signal.aborted&&newer(conversationRoutes))store(conversationRoutes||={},key,entry);
|
|
70
|
+
}finally{pending--;}
|
|
71
|
+
};
|
|
72
|
+
},
|
|
73
|
+
async resolve(body){
|
|
74
|
+
const key=conversationKey(body);if(!key)return null;
|
|
75
|
+
const id=body.request.labels.root_cascade_id||body.request.labels.cascade_id;
|
|
76
|
+
const owner=await guard.owner("gemini",id,compactionSalt);
|
|
77
|
+
if(!owner)return null;
|
|
78
|
+
conversationRoutes ||= await readRoutes();
|
|
79
|
+
const entry=conversationRoutes[key];
|
|
80
|
+
return {owner,pinned:entry?.owner===owner?entry.model:null};
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
}
|
|
@@ -167,7 +167,33 @@ export function chatFunctionPart(call, originalNames) {
|
|
|
167
167
|
return { functionCall: { id: call.id, name, args } };
|
|
168
168
|
}
|
|
169
169
|
|
|
170
|
-
|
|
170
|
+
const validCount = value => Number.isSafeInteger(value) && value >= 0;
|
|
171
|
+
export function mergeChatUsage(previous, value) {
|
|
172
|
+
if (!value || typeof value !== "object") return previous;
|
|
173
|
+
let next = previous;
|
|
174
|
+
for (const key of ["prompt_tokens", "completion_tokens", "total_tokens"]) {
|
|
175
|
+
if (validCount(value[key])) (next ||= {})[key] = value[key];
|
|
176
|
+
}
|
|
177
|
+
for (const [key, field] of [["prompt_tokens_details", "cached_tokens"], ["completion_tokens_details", "reasoning_tokens"]]) {
|
|
178
|
+
if (validCount(value[key]?.[field])) (next ||= {})[key] = { [field]: value[key][field] };
|
|
179
|
+
}
|
|
180
|
+
return next;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
function geminiUsage(usage) {
|
|
184
|
+
if (!usage) return {};
|
|
185
|
+
const result = {}, reasoning = usage.completion_tokens_details?.reasoning_tokens;
|
|
186
|
+
const separateThinking = reasoning !== undefined && usage.completion_tokens !== undefined && reasoning <= usage.completion_tokens;
|
|
187
|
+
const candidates = separateThinking ? usage.completion_tokens - reasoning : usage.completion_tokens;
|
|
188
|
+
for (const [key, value] of [["promptTokenCount", usage.prompt_tokens], ["candidatesTokenCount", candidates],
|
|
189
|
+
["totalTokenCount", usage.total_tokens], ["cachedContentTokenCount", usage.prompt_tokens_details?.cached_tokens],
|
|
190
|
+
["thoughtsTokenCount", separateThinking ? reasoning : undefined]]) {
|
|
191
|
+
if (value !== undefined) result[key] = value;
|
|
192
|
+
}
|
|
193
|
+
return { usageMetadata: result };
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export function chatToAntigravity(response, originalNames, usage = mergeChatUsage(null, response?.usage)) {
|
|
171
197
|
const choice = response?.choices?.[0], message = choice?.message;
|
|
172
198
|
if (!object(message)) throw invalid("Invalid upstream Chat response", 502);
|
|
173
199
|
const parts = [];
|
|
@@ -176,12 +202,11 @@ export function chatToAntigravity(response, originalNames) {
|
|
|
176
202
|
if (Array.isArray(message.tool_calls)) for (const call of message.tool_calls) parts.push(chatFunctionPart(call, originalNames));
|
|
177
203
|
const finish = { stop: "STOP", tool_calls: "STOP", length: "MAX_TOKENS", content_filter: "SAFETY" }[choice.finish_reason];
|
|
178
204
|
if (!finish || finish === "STOP" && !parts.some(part => !part.thought)) throw invalid("Upstream Chat response did not complete", 502);
|
|
179
|
-
const usage = response.usage;
|
|
180
205
|
return { candidates: [{ content: { role: "model", parts }, finishReason: finish, index: 0 }],
|
|
181
|
-
...(usage
|
|
206
|
+
...geminiUsage(usage) };
|
|
182
207
|
}
|
|
183
208
|
|
|
184
|
-
export async function* chatStreamToAntigravity(response, originalNames, { onChunk, onUsage } = {}) {
|
|
209
|
+
export async function* chatStreamToAntigravity(response, originalNames, { onChunk, onUsage, onError } = {}) {
|
|
185
210
|
if (!response?.body) throw invalid("Upstream Chat stream has no body", 502);
|
|
186
211
|
const calls = new Map(), data = [], guard = new ToolArgumentDeltaGuard();let done = false, finish = null, usage = null, bytes = 0, visible = false;
|
|
187
212
|
const frame = async function* () {
|
|
@@ -189,9 +214,14 @@ export async function* chatStreamToAntigravity(response, originalNames, { onChun
|
|
|
189
214
|
const raw = data.join("\n");data.length = 0;
|
|
190
215
|
if (raw === "[DONE]") { done = true;return; }
|
|
191
216
|
let event;try { event = JSON.parse(raw); } catch { throw invalid("Invalid upstream Chat stream event", 502); }
|
|
192
|
-
|
|
193
|
-
if (event?.usage
|
|
194
|
-
|
|
217
|
+
if (event?.usage) usage = mergeChatUsage(usage, event.usage);
|
|
218
|
+
if (event?.usage || event?.copilot_usage) onUsage?.(event, usage);
|
|
219
|
+
const upstreamError = upstreamChatStreamError(event);
|
|
220
|
+
if (upstreamError) {
|
|
221
|
+
observeSourceStreamFailure(response, event.error);
|
|
222
|
+
onError?.(upstreamError, event.error);
|
|
223
|
+
throw upstreamError;
|
|
224
|
+
}
|
|
195
225
|
const choice = event?.choices?.[0];
|
|
196
226
|
if (!choice) return;
|
|
197
227
|
if (choice.finish_reason) { finish = choice.finish_reason;sourceResponseAccepted(response); }
|
|
@@ -240,5 +270,5 @@ export async function* chatStreamToAntigravity(response, originalNames, { onChun
|
|
|
240
270
|
yield { response: { candidates: [{ index: 0, content: { role: "model", parts: [chatFunctionPart(call, originalNames)] } }] } };
|
|
241
271
|
}
|
|
242
272
|
yield { response: { candidates: [{ index: 0, finishReason }],
|
|
243
|
-
...(usage
|
|
273
|
+
...geminiUsage(usage) } };
|
|
244
274
|
}
|