codex-copilot-dx 1.4.13 → 1.4.15

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.
@@ -55,6 +55,8 @@ Antigravity keeps a bounded local conversation route table with keyed session ha
55
55
 
56
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
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
+
58
60
  ## Composition and lifecycle
59
61
 
60
62
  ### Application control and shared source admission
@@ -65,12 +67,16 @@ Automatic Codex opening uses the saved `codex_auto_launch` preference, default f
65
67
 
66
68
  `source-admission.mjs` wraps each provider client once and shares account-scoped leases across Responses, Messages, Chat, Images and relevant search/native-Google calls. HTTP providers enter admission after final serialization and reuse that wire text for queued-byte accounting and sending. Upstream timing starts at dispatch, after the queue. Internal consumers settle ownership in their existing read, error and cancellation callbacks through `source-response.mjs`, retaining native Responses without another stream or facade. Unmanaged clients keep the compatibility wrapper. Lease ownership ends at upstream-body completion/cancellation, not response headers. Counting/catalog reads bypass generation admission. Request-body memory reservations remain separate and shrink only after a complete upload; compressed decoded-body accounting remains intact. Rejected response bodies release their leases before nested recovery calls, with a bounded release barrier for compaction.
67
69
 
70
+ Custom API admission groups retain the active and queued leases for a source and credential while the endpoint configuration changes. The deployment fingerprint covers the protocol endpoints and authentication modes. A different fingerprint clears learned cooldown and model limits, and late feedback from an earlier deployment cannot train the new one. Dashboard use of request-purpose filters captures the purpose in the refresh identity before loading usage.
71
+
68
72
  Raw HTTP 429 responses without private classified evidence receive a bounded clone read before being returned, so feedback does not depend on a caller retaining the error body. The original response remains available. A timed-out inspection retains body-consumption fallback; successful classification is not repeated and Retry-After stays anchored to the response arrival. Real upstream EOF on any clone releases the source slot; cancelling only one clone does not. Unchanged request-body reservations do not drain their queue again.
69
73
 
70
74
  Explicit concurrency rejections contract once per observed burst. Stable success retains growth eligibility through idle periods; waiting demand then grows capacity additively. Persistence notifications remain throttled separately. Model quota/rate evidence and explicit account-wide evidence keep separate scopes. Ordinary parameter errors, slow thinking and untyped output text do not train capacity. HTTP 200 stream errors enter feedback only through existing structured protocol parsers. API providers pass a private fixed-field Symbol through safe error projection; original vendor text is never persisted. Queue limits are 16 per account, 8 MiB globally and 30 seconds; the initial 128-slot ceiling preserves the existing small held-stream workload and is not an upstream capacity claim. A manual source ceiling is optional. Stable capacity persistence is asynchronous, bounded and keyed by hashes; invalid or stale metadata is discarded.
71
75
 
72
76
  The upstream references are deliberately narrow: [Floway's model-scoped quota correction](https://github.com/Menci/Floway/commit/49813611aac1f7d0cccb10cfd343c1df7541790e) and [single Chat output cap](https://github.com/Menci/Floway/commit/63f1100af6bc2823e7f0f478fbd785aa56dc0cd7), [Magpie's quota/compaction boundary](https://github.com/yetone/magpie/issues/2725), and [LiteLLM's disconnect outcome report](https://github.com/BerriAI/litellm/issues/51978). CCDX preserves an already observed terminal result while marking delivery cancellation separately; an unfinished stream is not promoted to success. The existing CC Switch-style separation of configuration, discovery and application activation is retained. No upstream runtime, distributed queue or automatic account rotation is introduced.
73
77
 
78
+ Antigravity's management views group per-effort catalog entries only when the record declares a valid `base_model_id` and `reasoning_effort`. Group selection continues to store the existing individual aliases. Requests keep the original model IDs and capabilities.
79
+
74
80
  ### Manual connection graph
75
81
 
76
82
  `provider-runtime.mjs` composes built-in lifecycle with `connection-runtime.mjs`,
package/docs/REFERENCE.md CHANGED
@@ -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
- all Antigravity summaries, searches and image generation use GitHub Copilot,
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,7 +89,7 @@ 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-header timeout (s)** to 1–600 seconds and save, or leave it blank to use the shared default. 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.
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
 
@@ -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** 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.
137
+ **Requests → Tool and agent activity** offers Production line, Gear clock, Assembly line, Dual-lane sorter, Gantry transfer and Indexing table. Production line is the default for new browsers and replaces unsupported preferences. Saved styles with the same name use the new drawings. 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. Expand Call details for the full list. Recent requests show total time next to the timestamp, with details below each request.
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
 
@@ -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 a previously observed conversation source/model. 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.
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
 
@@ -830,7 +829,7 @@ The old external image provider, Qwen-specific generation/editing, `/mcp/image`,
830
829
  | `CCDX_MAX_UPSTREAM_BODY_BYTES` | `31457280` | Strict maximum forwarded Responses body size; larger payloads are adapted locally or rejected with `413` |
831
830
  | `CCDX_MAX_SSE_BUFFER_BYTES` | `8388608` | Maximum buffered bytes for one unterminated upstream SSE line or event |
832
831
  | `CCDX_UPSTREAM_TIMEOUT_MS` | `120000` | Per-phase timeout for Responses/Messages preparation and non-streaming upstream requests |
833
- | `CCDX_ANTIGRAVITY_COPILOT_TIMEOUT_MS` | `unset` | Startup override for Antigravity Copilot generation through response headers. If unset, use the saved value or the shared timeout. |
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. |
834
833
  | `CCDX_STREAM_HANDSHAKE_TIMEOUT_MS` | `120000` | Timeout while waiting for upstream streaming response headers |
835
834
  | `CCDX_STREAM_IDLE_TIMEOUT_MS` | `120000` | Maximum idle time between upstream streaming body chunks |
836
835
  | `CCDX_UPSTREAM_RETRIES` | `2` | Retries for safe requests and clearly pre-connect POST failures; capped at `5` |
@@ -1009,6 +1008,8 @@ Each request pins its masking choice, including compatibility retries. Checks no
1009
1008
 
1010
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.
1011
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
+
1012
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.
1013
1014
 
1014
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codex-copilot-dx",
3
- "version": "1.4.13",
3
+ "version": "1.4.15",
4
4
  "description": "Local gateway for Codex, Claude and Gemini Antigravity with Copilot, Microsoft 365 and custom APIs",
5
5
  "author": "Dale Xiao",
6
6
  "type": "module",
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
+ }
@@ -45,18 +45,24 @@ function groundedSearch(result,query){
45
45
 
46
46
  export function createAntigravityHandler({client,models=()=>[],selectedModels=()=>null,defaultModel=()=>null,enabled=()=>false,privacy,searchFn,imageFn,guardSource,acquireRequest=async()=>()=>{},sourceAdmission,applicationEvidence,
47
47
  nativeModels=()=>[],resolveNativeModel=()=>null,
48
- compaction,compactionProfile=()=>"github",rememberConversationSource=()=>{},resolveCompactionSource=()=>null,recordUsageFn=recordUsage,fetchGoogle=fetch,googleOrigin=GOOGLE_ORIGIN,requestBodyTimeoutMs=120000,upstreamTimeoutMs=180000,copilotTimeoutMs,streamIdleTimeoutMs=60000,
48
+ compaction,compactionProfile=()=>"github",prepareConversationBinding=()=>{},resolveCompactionSource=()=>null,recordUsageFn=recordUsage,fetchGoogle=fetch,googleOrigin=GOOGLE_ORIGIN,requestBodyTimeoutMs=120000,upstreamTimeoutMs=180000,copilotTimeoutMs,streamIdleTimeoutMs=60000,
49
49
  requestSettings,generationSettings=()=>({ selection:selectedModels(), copilotTimeoutMs, preferred:defaultModel() })}={}) {
50
50
  if(![GOOGLE_ORIGIN,"https://cloudcode-pa.googleapis.com"].includes(googleOrigin))throw new Error("Unrecognized Google control origin");
51
51
  const acquireControl=createRequestAdmission({maxBytes:4*CONTROL_BODY_BYTES,maxQueued:8});
52
52
  let active=0,observed=false,catalogModels=null,catalogDefaultSupported=null,catalogDefaultModel=null;const nativeWindows=new Map();
53
53
  const counts={total:0,google:0,copilot:0,search:0,images:0,failed:0};
54
54
  const handler=async(req,res)=>{
55
- const abort=createRequestAbort(req,res);let release=()=>{},releaseControl,session,body,request,converted,phase="validation",usageEvent=null,usageModel=null,outcome=null,usageMode,usageProvider;
55
+ const startedAt=performance.timeOrigin+performance.now(),abort=createRequestAbort(req,res);let commitBinding,release=()=>{},releaseControl,session,body,request,converted,phase="validation",usageEvent=null,usageModel=null,outcome=null,usageMode,usageProvider;
56
56
  const releaseInput=()=>{
57
57
  body=null;request=null;if(converted)converted.chat=null;if(session)session.body=null;
58
58
  const done=release;release=()=>{};done();
59
59
  };
60
+ const confirmBinding=()=>{
61
+ if(outcome==="completed"&&commitBinding&&!abort.signal.aborted){
62
+ abort.clearTimeout();
63
+ return commitBinding(abort.signal);
64
+ }
65
+ };
60
66
  const captureUsage=(event,usage=mergeChatUsage(null,event?.usage))=>{
61
67
  if(!event?.usage&&!event?.copilot_usage)return;
62
68
  const known=value=>Number.isSafeInteger(value)&&value>=0,u=usage||{};
@@ -154,8 +160,11 @@ export function createAntigravityHandler({client,models=()=>[],selectedModels=()
154
160
  }
155
161
  }}):null;
156
162
  res.writeHead(upstream.status,safeUpstreamResponseHeaders(upstream.headers));
157
- let observedEof=false;
158
- const finishObservation=()=>{if(observer?.finish().unavailable&&!usageEvent)markRequestObservation({usage_state:"unavailable"})};
163
+ let observedEof=false,unavailable=false;
164
+ const finishObservation=()=>{
165
+ unavailable=observer?.finish().unavailable===true;
166
+ if(unavailable&&!usageEvent)markRequestObservation({usage_state:"unavailable"});
167
+ };
159
168
  try{
160
169
  if(upstream.body){const reader=sourceResponseReader(upstream);try{while(true){
161
170
  let next;try{next=await reader.read()}catch(error){failSourceRead(reader);throw error}
@@ -166,6 +175,7 @@ export function createAntigravityHandler({client,models=()=>[],selectedModels=()
166
175
  }}finally{await cancelSourceReader(reader).catch(()=>{});releaseSourceReader(reader)}}
167
176
  }finally{if(!observedEof)finishObservation()}
168
177
  if(generation&&!upstream.ok)outcome="failed";
178
+ if(observedEof&&!unavailable&&commitBinding)await confirmBinding();
169
179
  if(outcome==="failed")counts.failed++;
170
180
  if(outcome)markResponseTerminal(outcome,outcome==="failed"?{origin:upstream.ok?"upstream_event":"upstream_http"}:undefined);
171
181
  res.end();
@@ -201,7 +211,7 @@ export function createAntigravityHandler({client,models=()=>[],selectedModels=()
201
211
  if(!selected)throw httpError("The selected Gemini source is unavailable",503);
202
212
  if(!["agent","checkpoint","summarization","title"].includes(body.requestType))throw httpError("Unsupported native Gemini request type",400);
203
213
  const profile=await guardSource?.(body,selected.source,abort.signal);
204
- if(body.requestType==="agent")await rememberConversationSource(body,selected.source,abort.signal,profile);
214
+ if(body.requestType==="agent")commitBinding=prepareConversationBinding(body,selected.source,profile,startedAt);
205
215
  const stream=method==="streamGenerateContent",source=selected.transport;
206
216
  usageProvider=selected.source;usageModel=selected.model;usageMode=stream?"sse":"json";
207
217
  if(context){context.provider=selected.source;context.streamPerformance?.setProvider?.(selected.source)}
@@ -238,7 +248,7 @@ export function createAntigravityHandler({client,models=()=>[],selectedModels=()
238
248
  if(candidates.some(candidate=>candidate.finishReason)){outcome=candidates.every(candidate=>candidate.finishReason==="STOP")?"completed":"incomplete";sourceResponseAccepted(upstream);}
239
249
  const wrapped=JSON.stringify({response:reply});
240
250
  if(stream){if(!await writeOrDrain(res,"data: "+wrapped+"\n\n",{signal:abort.signal}))throw httpError("Antigravity client disconnected",499);}
241
- else res.end(wrapped);
251
+ else {if(commitBinding)await confirmBinding();res.end(wrapped);}
242
252
  };
243
253
  try {
244
254
  if(!upstream.body||stream&&!/^text\/event-stream/i.test(upstream.headers.get("content-type")||""))throw httpError("Expected a Gemini response stream",502);
@@ -262,7 +272,7 @@ export function createAntigravityHandler({client,models=()=>[],selectedModels=()
262
272
  await emit(value);
263
273
  }
264
274
  if(!outcome)throw httpError("Gemini response ended without a terminal result",502);
265
- markResponseTerminal(outcome);if(stream)res.end();
275
+ markResponseTerminal(outcome);if(stream){if(commitBinding)await confirmBinding();res.end();}
266
276
  }catch(error){sourceResponseFailed(upstream);await cancelSourceResponse(upstream).catch(()=>{});markResponseErrorOrigin("upstream_event");throw error;}
267
277
  return;
268
278
  }
@@ -271,7 +281,7 @@ export function createAntigravityHandler({client,models=()=>[],selectedModels=()
271
281
  if(body.model.startsWith(ANTIGRAVITY_MODEL_PREFIX))throw httpError("The selected Copilot model is unavailable",503);
272
282
  const hasSession=body.requestType==="agent"||body.request?.labels?.root_cascade_id||body.request?.labels?.cascade_id;
273
283
  const profile=hasSession?await guardSource?.(body,"google",abort.signal):undefined;
274
- if(body.requestType==="agent")await rememberConversationSource(body,"google",abort.signal,profile);
284
+ if(body.requestType==="agent")commitBinding=prepareConversationBinding(body,"google",profile,startedAt);
275
285
  return await native();
276
286
  }
277
287
  const profile=body.requestType==="agent"||compactBinding?.source==="github"
@@ -309,7 +319,7 @@ export function createAntigravityHandler({client,models=()=>[],selectedModels=()
309
319
  }
310
320
  }
311
321
  if(!target)throw httpError(bound?"The conversation model is unavailable for Antigravity":"No eligible Copilot model is available for Antigravity background tasks",503);
312
- if(body.requestType==="agent")await rememberConversationSource(body,"github",abort.signal,profile);
322
+ if(body.requestType==="agent")commitBinding=prepareConversationBinding(body,"github",profile,startedAt);
313
323
  const stream=method==="streamGenerateContent";usageModel=target.model;usageMode=stream?"sse":"json";usageProvider="github";
314
324
  converted=antigravityToChat(request,{model:target.model,effort:target.effort,reasoningEfforts:target.effort?[target.effort]:[],stream});
315
325
  markResponseModel(target.model);markRequestObservation({usage_state:"pending",context_window_tokens:target.maxTokens,
@@ -337,7 +347,9 @@ export function createAntigravityHandler({client,models=()=>[],selectedModels=()
337
347
  const usage=mergeChatUsage(null,data.usage);captureUsage(data,usage);
338
348
  const result=chatToAntigravity(data,converted.originalNames,usage);markToolActivity(result,"gemini");
339
349
  outcome=result.candidates[0].finishReason==="STOP"?"completed":"incomplete";markResponseTerminal(outcome);
340
- res.writeHead(200,{"Content-Type":"application/json"});res.end(JSON.stringify({response:session.restoreValue(result)}));return;
350
+ const response=JSON.stringify({response:session.restoreValue(result)});
351
+ if(commitBinding)await confirmBinding();
352
+ res.writeHead(200,{"Content-Type":"application/json"});res.end(response);return;
341
353
  }
342
354
  if (!upstream.body) {
343
355
  sourceResponseFailed(upstream);
@@ -363,7 +375,8 @@ export function createAntigravityHandler({client,models=()=>[],selectedModels=()
363
375
  else if(typeof part.text==="string"&&!part.thought)part.text=text.push(part.text);
364
376
  }
365
377
  if(candidate?.finishReason){const tail=text.finish();if(tail)await emit({response:{candidates:[{index:0,content:{role:"model",parts:[{text:tail}]}}]}});outcome=candidate.finishReason==="STOP"?"completed":"incomplete";markResponseTerminal(outcome)}
366
- await emit(chunk);
378
+ if(candidate?.finishReason&&commitBinding)await confirmBinding();
379
+ if(!await emit(chunk))throw httpError("Antigravity client disconnected",499);
367
380
  }
368
381
  res.end();
369
382
  }catch(error){
@@ -3,10 +3,12 @@ import {modelDisplayName} from "./model-display.mjs";
3
3
  import {modelReasoningEfforts} from "./provider-metadata.mjs";
4
4
  export const ANTIGRAVITY_MODEL_PREFIX = "ccdx-copilot-";
5
5
  export const ANTIGRAVITY_NATIVE_PREFIX = "ccdx-gemini-";
6
+ const geminiModel = /^gemini-[a-z0-9][a-z0-9._-]{0,100}$/;
7
+ const knownEfforts = new Set(["minimal", "low", "medium", "high", "xhigh", "max"]);
6
8
 
7
9
  export function antigravityCopilotModels(catalog) {
8
10
  const data=Array.isArray(catalog)?catalog:catalog?.data;
9
- return uniqueModelEntries(Array.isArray(data)?data:[]).filter(model=>/^gemini-[a-z0-9][a-z0-9._-]{0,100}$/.test(model?.id)
11
+ return uniqueModelEntries(Array.isArray(data)?data:[]).filter(model=>geminiModel.test(model?.id)
10
12
  &&model.model_picker_enabled!==false&&(!model.policy?.state||model.policy.state==="enabled")
11
13
  &&(!model.capabilities?.type||model.capabilities.type==="chat")
12
14
  &&model.capabilities?.supports?.streaming!==false&&model.capabilities?.supports?.tool_calls!==false
@@ -23,6 +25,35 @@ export function antigravityCopilotModels(catalog) {
23
25
  });
24
26
  }
25
27
 
28
+ export function groupAntigravityModels(listed, catalog) {
29
+ const data = Array.isArray(catalog) ? catalog : catalog?.data;
30
+ const base = new Map();
31
+ for (const model of uniqueModelEntries(Array.isArray(data) ? data : [])) {
32
+ if (!geminiModel.test(model?.base_model_id) || !geminiModel.test(model.id) || model.base_model_id === model.id
33
+ || !knownEfforts.has(model.reasoning_effort)) continue;
34
+ base.set(model.id, { id: model.base_model_id, effort: model.reasoning_effort });
35
+ }
36
+ const nameOf = name => name.split(" · Copilot")[0];
37
+ const names = new Map(listed.map(variant => [variant.model, nameOf(variant.name)]));
38
+ const groups = new Map();
39
+ for (const variant of listed) {
40
+ const candidate = base.get(variant.model);
41
+ const explicit = candidate && !base.has(candidate.id) && (!variant.effort || variant.effort === candidate.effort) ? candidate : null;
42
+ const id = explicit?.id || variant.model;
43
+ if (!groups.has(id)) {
44
+ const name = names.get(id) || id.split("-").map(word => word[0]?.toUpperCase() + word.slice(1)).join(" ");
45
+ groups.set(id, { id, name, source: "github", context_window: variant.context_window, default: false, efforts: [] });
46
+ }
47
+ const group = groups.get(id);
48
+ if (Number.isFinite(group.context_window) && Number.isFinite(variant.context_window)) {
49
+ group.context_window = Math.min(group.context_window, variant.context_window);
50
+ } else group.context_window = undefined;
51
+ group.default ||= variant.default;
52
+ group.efforts.push({ id: variant.id, effort: explicit?.effort || variant.effort, selected: variant.selected });
53
+ }
54
+ return [...groups.values()];
55
+ }
56
+
26
57
  // Use the upstream's existing agent-default field only when it names a model
27
58
  // in the same catalog. Do not invent a default contract for an unknown catalog.
28
59
  export function hasAntigravityAgentDefault(catalog) {
@@ -1,5 +1,4 @@
1
1
  import fs from "node:fs";
2
- import {createHmac} from "node:crypto";
3
2
  import os from "node:os";
4
3
  import path from "node:path";
5
4
  import {execFile} from "node:child_process";
@@ -9,23 +8,22 @@ import {createAntigravityImages} from "./antigravity-images.mjs";
9
8
  import {createCopilotWeb} from "./copilot-web.mjs";
10
9
  import {inspectGeminiApp,planGeminiAppLaunch} from "./gemini-app.mjs";
11
10
  import {readUserSettings,userSettingsPath} from "./user-settings.mjs";
12
- import {accessSettingsPath,readAccessSettings} from "./access-settings.mjs";
11
+ import {readAccessSettings} from "./access-settings.mjs";
13
12
  import {readClientGatewayKeys} from "./client-gateway-keys.mjs";
14
13
  import {createConversationSourceGuard} from "./conversation-source-guard.mjs";
15
14
  import {readSavedGithubToken} from "./auth-credentials.mjs";
16
15
  import {githubTokenFingerprint} from "./github-identity.mjs";
17
- import {atomicWriteFile,atomicWriteFileIfChangedSync} from "./atomic-file.mjs";
18
- import {withFileLock,withFileLockSync} from "./lock.mjs";
19
- import {readBoundedFile} from "./bounded-file.mjs";
20
- import {redactDiagnosticText} from "./diagnostic-text.mjs";
16
+ import {atomicWriteFileIfChangedSync} from "./atomic-file.mjs";
17
+ import {withFileLockSync} from "./lock.mjs";
21
18
  import {httpError} from "./http-errors.mjs";
22
- import {antigravityCopilotModels,ANTIGRAVITY_MODEL_PREFIX,ANTIGRAVITY_NATIVE_PREFIX} from "./antigravity-models.mjs";
19
+ import {createAntigravityBindings, validModel} from "./antigravity-bindings.mjs";
20
+ import {parseTimerMs} from "./runtime-config.mjs";
21
+ import {antigravityCopilotModels,groupAntigravityModels,ANTIGRAVITY_MODEL_PREFIX,ANTIGRAVITY_NATIVE_PREFIX} from "./antigravity-models.mjs";
23
22
 
24
23
  const execute=promisify(execFile),key="gemini_antigravity_enabled",modelKey="gemini_antigravity_models",defaultKey="gemini_antigravity_default_model";
25
24
  const timeoutKey="gemini_antigravity_copilot_timeout_seconds";
26
25
  const nativeSourceKey="gemini_antigravity_native_source";
27
26
  const validTimeout=value=>Number.isSafeInteger(value)&&value>=1&&value<=600;
28
- const validModel=id=>typeof id==="string"&&/^[\w][\w./:@+-]{0,159}$/.test(id)&&redactDiagnosticText(id)===id;
29
27
  const validAlias=id=>typeof id==="string"&&/^ccdx-copilot-[a-z0-9._-]{1,140}$/.test(id);
30
28
 
31
29
  export function createAntigravityRuntime({client,models=()=>[],refreshModels,privacy,home=os.homedir(),env=process.env,inspect=inspectGeminiApp,
@@ -33,23 +31,8 @@ export function createAntigravityRuntime({client,models=()=>[],refreshModels,pri
33
31
  upstreamTimeoutMs=180000,copilotTimeoutMs,nativeSources=()=>[],getSource=()=>null,...timeouts}={}) {
34
32
  const options={home,env},guard=createConversationSourceGuard(options);
35
33
  const web=searchFn?null:createCopilotWeb({client,readToken});
36
- let app={status:"unknown"},route=null,lastOperation=null,compactionSalt,conversationRoutes;
37
- const routeFile=path.join(path.dirname(accessSettingsPath(options)),"antigravity-conversations.json");
38
- const readRoutes=async()=>{
39
- let value;
40
- try{value=JSON.parse(await readBoundedFile(routeFile,{encoding:"utf8",maxBytes:128*1024}));}
41
- catch(error){if(error.code==="ENOENT")return {};throw httpError("Antigravity conversation routing data could not be read",409);}
42
- if(!value||typeof value!=="object"||Array.isArray(value)||Object.keys(value).length>256||
43
- Object.entries(value).some(([id,item])=>!/^[a-f0-9]{64}$/.test(id)||!item||
44
- !/^[a-f0-9]{64}$/.test(item.owner)||!validModel(item.model)))throw httpError("Invalid Antigravity conversation routing data",409);
45
- return value;
46
- };
47
- const conversationKey=body=>{
48
- const id=body?.request?.labels?.root_cascade_id||body?.request?.labels?.cascade_id;
49
- if(typeof id!=="string"||!id||id.length>160||/[\u0000-\u001f\u007f]/.test(id))return null;
50
- compactionSalt||=readClientGatewayKeys({...options,create:false}).codex;
51
- return createHmac("sha256",compactionSalt).update("antigravity-compression\0"+id).digest("hex");
52
- };
34
+ let app={status:"unknown"},route=null,lastOperation=null;
35
+ const bindings=createAntigravityBindings(options,guard);
53
36
  const settings=()=>{
54
37
  const saved=readUserSettings({...options,strict:true});
55
38
  if(saved[key]!==undefined&&typeof saved[key]!=="boolean")throw httpError("Invalid Gemini integration setting",409);
@@ -58,7 +41,8 @@ export function createAntigravityRuntime({client,models=()=>[],refreshModels,pri
58
41
  return {configured:Object.hasOwn(saved,key),enabled:saved[key]===true,selected_models:saved[modelKey]??null,default_model:saved[defaultKey]??null,
59
42
  copilot_timeout_seconds:validTimeout(saved[timeoutKey])?saved[timeoutKey]:null,native_source:typeof saved[nativeSourceKey]==="string"?saved[nativeSourceKey]:null};
60
43
  };
61
- const configuredTimeout=saved=>copilotTimeoutMs??(saved.copilot_timeout_seconds===null?undefined:saved.copilot_timeout_seconds*1000);
44
+ const defaultCopilotTimeoutMs=parseTimerMs(env.CCDX_UPSTREAM_TIMEOUT_MS,180000);
45
+ const effectiveCopilotTimeoutMs=saved=>copilotTimeoutMs??(saved.copilot_timeout_seconds===null?defaultCopilotTimeoutMs:saved.copilot_timeout_seconds*1000);
62
46
  const available=(saved=settings())=>saved.enabled&&readAccessSettings(options).providers.github?models():[];
63
47
  const nativeModels=(sourceId=settings().native_source)=>{
64
48
  if(!sourceId)return [];
@@ -70,7 +54,6 @@ export function createAntigravityRuntime({client,models=()=>[],refreshModels,pri
70
54
  };
71
55
  const profileFor=source=>source==="github"?"codex:"+githubTokenFingerprint(readToken()||"")
72
56
  :source==="google"?"google:gemini-native":getSource(source)?.profileId("gemini");
73
- const hashProfile=profile=>createHmac("sha256",compactionSalt).update(profile).digest("hex");
74
57
  const sourceGuard=guardSource||(async(body,source,signal)=>{
75
58
  const labels=body.request?.labels||{},id=labels.root_cascade_id||labels.cascade_id;
76
59
  if(typeof id!=="string"||!id||id.length>160)throw httpError("Antigravity request has no stable conversation identifier",400);
@@ -88,62 +71,35 @@ export function createAntigravityRuntime({client,models=()=>[],refreshModels,pri
88
71
  const source=getSource(model.source);return source?.client?.gemini?{...model,transport:source}:null;
89
72
  },
90
73
  imageFn:imageFn||createAntigravityImages({client,models:available,privacy}),guardSource:sourceGuard,compactionProfile:()=>githubTokenFingerprint(readToken()||""),
91
- async rememberConversationSource(body,source,signal,observedProfile){
92
- const key=conversationKey(body);if(!key||!validModel(body.model))return;
93
- const profile=typeof observedProfile==="string"?observedProfile:profileFor(source);if(!profile)return;
94
- const owner=hashProfile(profile), cached=conversationRoutes?.[key];
95
- if(cached?.owner===owner&&cached.model===body.model)return;
96
- const remember=routes=>{
97
- delete routes[key];routes[key]={owner,model:body.model};
98
- const keys=Object.keys(routes);for(const id of keys.slice(0,Math.max(0,keys.length-256)))delete routes[id];
99
- };
100
- try{
101
- await withFileLock(routeFile+".lock",async()=>{
102
- const routes=await readRoutes();signal?.throwIfAborted();
103
- if(routes[key]?.owner!==owner||routes[key].model!==body.model){
104
- remember(routes);
105
- await atomicWriteFile(routeFile,JSON.stringify(routes)+"\n",{mode:0o600});
106
- }
107
- conversationRoutes=routes;
108
- },{timeoutMs:1000,signal});
109
- }catch{
110
- signal?.throwIfAborted();
111
- // Existing source ownership still governs routing if this optional model record cannot be saved.
112
- remember(conversationRoutes||={});
113
- }
74
+ prepareConversationBinding(body,source,profile,startedAt){
75
+ return bindings.prepare(body,profile||profileFor(source),startedAt);
114
76
  },
115
77
  async resolveCompactionSource(body,saved=settings()){
116
- const key=conversationKey(body);if(!key)return null;
117
- const id=body.request.labels.root_cascade_id||body.request.labels.cascade_id;
118
- const owner=await guard.owner("gemini",id,compactionSalt);
119
- if(!owner)return null;
120
- conversationRoutes ||= await readRoutes();
121
- const entry=conversationRoutes[key], pinned=entry?.owner===owner?entry.model:null;
122
- if(owner===hashProfile(profileFor("google"))){
78
+ const binding=await bindings.resolve(body);
79
+ if(!binding)return null;
80
+ const {owner,pinned}=binding;
81
+ if(owner===bindings.hashProfile(profileFor("google"))){
123
82
  const model=pinned||body.model;
124
83
  if(!validModel(model)||model.startsWith(ANTIGRAVITY_MODEL_PREFIX)||model.startsWith(ANTIGRAVITY_NATIVE_PREFIX))throw httpError("The conversation belongs to another model source",409);
125
84
  return{source:"google",model};
126
85
  }
127
- if(owner===hashProfile(profileFor("github"))){
86
+ if(owner===bindings.hashProfile(profileFor("github"))){
128
87
  const model=pinned||(validAlias(body.model)?body.model:null);
129
88
  return model?{source:"github",model}:{source:"github",background:true};
130
89
  }
131
90
  const selected=saved.native_source, profile=selected&&profileFor(selected);
132
- const model=profile&&owner===hashProfile(profile)&&nativeModels(selected).find(entry=>entry.id===(pinned||body.model));
91
+ const model=profile&&owner===bindings.hashProfile(profile)&&nativeModels(selected).find(entry=>entry.id===(pinned||body.model));
133
92
  if(model)return{source:selected,model:model.id};
134
93
  throw httpError("The conversation belongs to another model source",409);
135
94
  },fetchGoogle:googleFetch,acquireRequest,upstreamTimeoutMs,...timeouts,generationSettings(saved){
136
- return { selection:saved.selected_models, copilotTimeoutMs:configuredTimeout(saved), preferred:saved.default_model };
95
+ return { selection:saved.selected_models, copilotTimeoutMs:effectiveCopilotTimeoutMs(saved), preferred:saved.default_model };
137
96
  }});
138
97
  function snapshot(){
139
98
  const config=settings(),sourceEnabled=readAccessSettings(options).providers.github,activity=handler.snapshot(config);
140
99
  const sources=nativeSources(), selectedNative=sources.find(item=>item.id===config.native_source);
141
- const listed=antigravityCopilotModels(models()).map(({id,model,displayName,effort,maxTokens})=>({id,model,name:displayName,effort,context_window:maxTokens,default:id===config.default_model,selected:config.selected_models===null||config.selected_models.includes(id)}));
142
- const groups=new Map();
143
- for(const variant of listed){
144
- if(!groups.has(variant.model))groups.set(variant.model,{id:variant.model,name:variant.name.split(" · Copilot")[0],source:"github",context_window:variant.context_window,default:false,efforts:[]});
145
- const group=groups.get(variant.model);group.default||=variant.default;group.efforts.push({id:variant.id,effort:variant.effort,selected:variant.selected});
146
- }
100
+ const catalog=models();
101
+ const listed=antigravityCopilotModels(catalog).map(({id,model,displayName,effort,maxTokens})=>({id,model,name:displayName,effort,context_window:maxTokens,default:id===config.default_model,selected:config.selected_models===null||config.selected_models.includes(id)}));
102
+ const groups=groupAntigravityModels(listed,catalog);
147
103
  const expected=[...(config.enabled&&sourceEnabled?listed.filter(model=>model.selected).map(model=>model.id):[]),...nativeModels(config.native_source).map(model=>model.id)].sort();
148
104
  const desiredDefault=expected.includes(config.default_model)?config.default_model:null;
149
105
  const reload=config.enabled&&sourceEnabled||config.native_source?(activity.catalog_models===null?null:JSON.stringify([...activity.catalog_models].sort())!==JSON.stringify(expected)
@@ -151,11 +107,11 @@ export function createAntigravityRuntime({client,models=()=>[],refreshModels,pri
151
107
  const defaultUnavailable=config.default_model!==null&&(!desiredDefault||activity.catalog_default_supported===false);
152
108
  const current=applicationControl?.snapshot().antigravity;
153
109
  const visibleApp=current?{status:current.status,version:current.version||null,pids:current.pid?[current.pid]:[]}:app;
154
- return {source:"gemini_antigravity",...config,native_sources:sources.map(({id,name})=>({id,name})),copilot_timeout:{effective_ms:configuredTimeout(config)??upstreamTimeoutMs,default_ms:upstreamTimeoutMs,locked:copilotTimeoutMs!==undefined},
110
+ return {source:"gemini_antigravity",...config,native_sources:sources.map(({id,name})=>({id,name})),copilot_timeout:{effective_ms:effectiveCopilotTimeoutMs(config),default_ms:defaultCopilotTimeoutMs,locked:copilotTimeoutMs!==undefined},
155
111
  source_enabled:sourceEnabled,default_model_unavailable:defaultUnavailable,models_reload_required:reload,app:visibleApp,application:current||null,route_observed:activity.observed,
156
112
  model_source:["Google",...(config.enabled&&sourceEnabled?["GitHub Copilot"]:[]),...(selectedNative?[selectedNative.name]:[])].join(" + "),background_source:"GitHub Copilot",ordinary_chat_source:"Google (unchanged)",
157
113
  compaction_source:"Observed conversation source; existing background policy when unassigned",
158
- models:listed,model_groups:[...groups.values()],activity,last_operation:lastOperation};
114
+ models:listed,model_groups:groups,activity,last_operation:lastOperation};
159
115
  }
160
116
  async function action(input={},baseUrl){
161
117
  if(input&&Object.keys(input).some(name=>!["action","accept_background_copilot","models","default_model","copilot_timeout_seconds","native_source"].includes(name)))throw httpError("Invalid Gemini operation",400);