codex-copilot-dx 1.4.23 → 1.4.24
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 +1 -1
- package/docs/REFERENCE.md +3 -3
- package/package.json +1 -1
- package/src/antigravity-handler.mjs +21 -5
- package/src/antigravity-models.mjs +57 -5
- package/src/application-process.mjs +8 -3
- package/src/client-versions.mjs +11 -4
- package/src/gemini-app.mjs +12 -7
- package/src/macos-antigravity-app.mjs +13 -0
- package/src/providers/api.mjs +6 -2
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ Antigravity can use compatible Copilot Gemini models with their advertised reaso
|
|
|
6
6
|
|
|
7
7
|
| Antigravity client | Integration |
|
|
8
8
|
| --- | --- |
|
|
9
|
-
| macOS Gemini App | Integrated App detection, model routing and launch |
|
|
9
|
+
| macOS Antigravity App or Gemini App | Integrated App detection, model routing and launch |
|
|
10
10
|
| Windows x64/ARM64 Antigravity App | Native launch path for the official 2.35.1 payloads. Signed-in App routing is pending live verification. |
|
|
11
11
|
| Antigravity standalone IDE or CLI | Separate clients outside this integration |
|
|
12
12
|
|
package/docs/REFERENCE.md
CHANGED
|
@@ -74,7 +74,7 @@ Choose **Follow conversation model** to use an observed model from the same Code
|
|
|
74
74
|
## Antigravity in Gemini App
|
|
75
75
|
|
|
76
76
|
The **Antigravity** page and `ccdx app antigravity status|models|enable|disable|open`
|
|
77
|
-
manage the macOS Gemini App and the native Windows App launch path described below. Enable requires acceptance of this data
|
|
77
|
+
manage the macOS Antigravity App or Gemini App and the native Windows App launch path described below. Enable requires acceptance of this data
|
|
78
78
|
scope: Antigravity main answers follow the selected Google or Copilot model;
|
|
79
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
|
|
80
80
|
keeps its Google route. No OpenAI account or search fallback is used.
|
|
@@ -86,7 +86,7 @@ Copilot source page, or with `source github access --edit --apps codex,antigravi
|
|
|
86
86
|
Choose its exposed models on the Antigravity page or with
|
|
87
87
|
`app antigravity models --edit`. Each WebUI row represents one model. Compatible Gemini chat models come from the current GitHub catalog, rather than a fixed Carbon/Argon list. The Reasoning column lists advertised levels, including Hydrogen's `xhigh` when available. The model checkbox controls visibility. Save/Discard, refresh, navigation, pausing and an off/on toggle preserve an existing saved route subset. CLI model editing and model files remain available for fine-grained effort selection. Refresh on this page or run `app antigravity models --refresh` to read the upstream catalog through the existing GitHub refresh runtime. Refresh does not change saved choices, save drafts, restart clients or invoke inference; failed reads retain the last usable list.
|
|
88
88
|
|
|
89
|
-
The native
|
|
89
|
+
The native catalog keeps a distinct routing alias for each level. Catalogs with a recognized native grouping contract display one Copilot model with its advertised levels in the App picker. Other catalogs keep the separate aliases visible. JSON model output retains the 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.
|
|
90
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.
|
|
91
91
|
|
|
92
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.
|
|
@@ -108,7 +108,7 @@ error rather than successful completion.
|
|
|
108
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.
|
|
109
109
|
|
|
110
110
|
`enable` saves CCDX settings and prepares its local source guard. `open --preview` shows the inspected application state without launching it.
|
|
111
|
-
`open` starts a closed, verified Gemini App in `/Applications` or `~/Applications` with a process-local
|
|
111
|
+
`open` starts a closed, verified Antigravity App or Gemini App in `/Applications` or `~/Applications` on macOS with a process-local
|
|
112
112
|
Antigravity endpoint. An already running App is focused. Reopen requests a normal
|
|
113
113
|
exit after confirmation, through the same controller used by the page header. Existing gateway environment settings cause a
|
|
114
114
|
conflict instead of being overwritten. The Gemini bundle, Google credentials,
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@ import {safeUpstreamResponseHeaders,upstreamRejectionHeaders} from "./upstream-h
|
|
|
6
6
|
import {isLoopbackAddress,isLoopbackHostHeader} from "./security.mjs";
|
|
7
7
|
import {antigravityToChat,chatToAntigravity,chatStreamToAntigravity,mergeChatUsage,chatReasoningTokens,parseAntigravityJSON} from "./antigravity-chat-bridge.mjs";
|
|
8
8
|
import {createAntigravityOpaqueReasoning} from "./antigravity-opaque-reasoning.mjs";
|
|
9
|
-
import {ANTIGRAVITY_MODEL_PREFIX,ANTIGRAVITY_NATIVE_PREFIX,antigravityCopilotModels,hasAntigravityAgentDefault,mergeAntigravityModels} from "./antigravity-models.mjs";
|
|
9
|
+
import {ANTIGRAVITY_MODEL_PREFIX,ANTIGRAVITY_NATIVE_PREFIX,antigravityCopilotModels,groupedAntigravityRoutes,hasAntigravityAgentDefault,mergeAntigravityModels} from "./antigravity-models.mjs";
|
|
10
10
|
import {createPrivacyTextFragments} from "./privacy-stream.mjs";
|
|
11
11
|
import {createGoogleResponseObserver,googleUsageEvent} from "./antigravity-usage.mjs";
|
|
12
12
|
import {currentRequestContext,observeRequestedModel} from "./request-context.mjs";
|
|
@@ -61,7 +61,8 @@ export function createAntigravityHandler({client,models=()=>[],selectedModels=()
|
|
|
61
61
|
if(![GOOGLE_ORIGIN,"https://cloudcode-pa.googleapis.com"].includes(googleOrigin))throw new Error("Unrecognized Google control origin");
|
|
62
62
|
const acquireControl=createRequestAdmission({maxBytes:4*CONTROL_BODY_BYTES,maxQueued:8});
|
|
63
63
|
const opaqueReasoning=createAntigravityOpaqueReasoning();
|
|
64
|
-
let active=0,observed=false,catalogModels=null,catalogDefaultSupported=null,catalogDefaultModel=null;
|
|
64
|
+
let active=0,observed=false,catalogModels=null,catalogDefaultSupported=null,catalogDefaultModel=null;
|
|
65
|
+
const nativeWindows=new Map(),catalogGroups=new Map();
|
|
65
66
|
const counts={total:0,google:0,copilot:0,search:0,images:0,failed:0};
|
|
66
67
|
const handler=async(req,res)=>{
|
|
67
68
|
const startedAt=performance.timeOrigin+performance.now(),abort=createRequestAbort(req,res);let commitBinding,release=()=>{},releaseControl,session,body,request,converted,finish,phase="validation",usageEvent=null,usageModel=null,outcome=null,usageMode,usageProvider;
|
|
@@ -153,9 +154,16 @@ export function createAntigravityHandler({client,models=()=>[],selectedModels=()
|
|
|
153
154
|
const value=JSON.parse(await readBoundedResponseText(upstream,{maxBytes:8*1024*1024,signal:abort.signal,label:"Google model catalog"}));
|
|
154
155
|
nativeWindows.clear();for(const[id,entry]of Object.entries(value.models||{}).slice(0,256))if(Number.isSafeInteger(entry?.maxTokens)&&entry.maxTokens>0){nativeWindows.set(id,entry.maxTokens);if(typeof entry.model==="string")nativeWindows.set(entry.model,entry.maxTokens)}
|
|
155
156
|
const merged=mergeAntigravityModels(value,models(config),selectedModels(config),defaultModel(config),nativeModels(config));
|
|
157
|
+
catalogGroups.clear();
|
|
158
|
+
for(const [id,group] of Object.entries(merged.groupedModels||{})){
|
|
159
|
+
if(!id.startsWith(ANTIGRAVITY_MODEL_PREFIX)||Object.hasOwn(value.groupedModels??{},id))continue;
|
|
160
|
+
const routes=groupedAntigravityRoutes(id,group,merged.models);
|
|
161
|
+
if(routes.defaultAlias)catalogGroups.set(id,routes);
|
|
162
|
+
}
|
|
156
163
|
catalogDefaultSupported=hasAntigravityAgentDefault(value);
|
|
157
164
|
catalogDefaultModel=catalogDefaultSupported&&merged.defaultAgentModelId.startsWith(ANTIGRAVITY_MODEL_PREFIX)?merged.defaultAgentModelId:null;
|
|
158
|
-
catalogModels=Object.keys(merged.models).filter(id
|
|
165
|
+
catalogModels=Object.keys(merged.models).filter(id=>!catalogGroups.has(id)&&
|
|
166
|
+
(id.startsWith(ANTIGRAVITY_MODEL_PREFIX)||id.startsWith(ANTIGRAVITY_NATIVE_PREFIX)));
|
|
159
167
|
res.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"});res.end(JSON.stringify(merged));return;
|
|
160
168
|
}
|
|
161
169
|
const nativeStreaming=/text\/event-stream/i.test(upstream.headers.get("content-type")||"");
|
|
@@ -289,7 +297,14 @@ export function createAntigravityHandler({client,models=()=>[],selectedModels=()
|
|
|
289
297
|
}catch(error){sourceResponseFailed(upstream);await cancelSourceResponse(upstream).catch(()=>{});markResponseErrorOrigin("upstream_event");throw error;}
|
|
290
298
|
return;
|
|
291
299
|
}
|
|
292
|
-
const copilotModels=antigravityCopilotModels(models(config)),
|
|
300
|
+
const copilotModels=antigravityCopilotModels(models(config)),group=catalogGroups.get(body.model);
|
|
301
|
+
let selectedId=body.model;
|
|
302
|
+
if(group){
|
|
303
|
+
const effort=body.request?.generationConfig?.thinkingConfig?.thinkingLevel;
|
|
304
|
+
selectedId=effort===undefined?group.defaultAlias:typeof effort==="string"?group.aliases.get(effort.toLowerCase()):null;
|
|
305
|
+
if(!selectedId)throw httpError("Unsupported Antigravity reasoning level",400);
|
|
306
|
+
}
|
|
307
|
+
const selected=copilotModels.find(model=>model.id===selectedId&&(selection===null||selection.includes(model.id)));
|
|
293
308
|
if((body.requestType==="agent"||compactBinding?.source==="google")&&!selected){
|
|
294
309
|
if(body.model.startsWith(ANTIGRAVITY_MODEL_PREFIX))throw httpError("The selected Copilot model is unavailable",503);
|
|
295
310
|
const hasSession=body.requestType==="agent"||body.request?.labels?.root_cascade_id||body.request?.labels?.cascade_id;
|
|
@@ -332,7 +347,8 @@ export function createAntigravityHandler({client,models=()=>[],selectedModels=()
|
|
|
332
347
|
}
|
|
333
348
|
}
|
|
334
349
|
if(!target)throw httpError(bound?"The conversation model is unavailable for Antigravity":"No eligible Copilot model is available for Antigravity background tasks",503);
|
|
335
|
-
if(body.requestType==="agent")commitBinding=prepareConversationBinding(
|
|
350
|
+
if(body.requestType==="agent")commitBinding=prepareConversationBinding(
|
|
351
|
+
body.model===target.id?body:{...body,model:target.id},"github",profile,startedAt);
|
|
336
352
|
const stream=method==="streamGenerateContent";usageModel=target.model;usageMode=stream?"sse":"json";usageProvider="github";
|
|
337
353
|
const conversation=request.labels?.root_cascade_id||request.labels?.cascade_id;
|
|
338
354
|
const scope=body.requestType==="agent"&&typeof profile==="string"&&profile&&typeof conversation==="string"&&conversation.length<=160
|
|
@@ -61,15 +61,42 @@ export function hasAntigravityAgentDefault(catalog) {
|
|
|
61
61
|
return typeof id==="string"&&!!catalog.models&&Object.hasOwn(catalog.models,id);
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
+
function nativeGrouping(catalog) {
|
|
65
|
+
const groups = catalog.groupedModels;
|
|
66
|
+
if (!groups || typeof groups !== "object" || Array.isArray(groups) || !Array.isArray(catalog.agentModelSorts)) return null;
|
|
67
|
+
const listed = new Set(catalog.agentModelSorts.flatMap(sort =>
|
|
68
|
+
Array.isArray(sort?.groups) ? sort.groups.flatMap(group => Array.isArray(group?.modelIds) ? group.modelIds : []) : []));
|
|
69
|
+
for (const [id, group] of Object.entries(groups)) {
|
|
70
|
+
if (!listed.has(id) || !Array.isArray(group?.supportedThinkingLevels)) continue;
|
|
71
|
+
const proved = group.supportedThinkingLevels.find(level => typeof level?.thinkingSuffix === "string" &&
|
|
72
|
+
/^(?:-)?[a-z][a-z0-9-]{0,30}$/.test(level.thinkingSuffix) &&
|
|
73
|
+
(Object.hasOwn(catalog.models, id + level.thinkingSuffix) || Object.hasOwn(catalog.models, id + "-" + level.thinkingSuffix)));
|
|
74
|
+
if (proved) return { dashedSuffix: proved.thinkingSuffix.startsWith("-"), parentInModels: Object.hasOwn(catalog.models, id) };
|
|
75
|
+
}
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export function groupedAntigravityRoutes(id, group, models) {
|
|
80
|
+
const aliases = new Map((group.supportedThinkingLevels || []).flatMap(({thinkingSuffix:suffix})=>{
|
|
81
|
+
const effort=suffix.replace(/^-/,""),alias=id+"-"+effort;
|
|
82
|
+
return Object.hasOwn(models,alias)?[[effort,alias]]:[];
|
|
83
|
+
}));
|
|
84
|
+
return {aliases,defaultAlias:aliases.get(group.defaultThinkingSuffix?.replace(/^-/,""))};
|
|
85
|
+
}
|
|
86
|
+
|
|
64
87
|
export function mergeAntigravityModels(googleCatalog,copilotCatalog,selection=null,defaultModel=null,nativeModels=[]) {
|
|
65
88
|
if(!googleCatalog?.models||typeof googleCatalog.models!=="object"||Array.isArray(googleCatalog.models))throw new Error("Unrecognized Google model catalog");
|
|
66
89
|
const entries=[...antigravityCopilotModels(copilotCatalog).filter(model=>selection===null||selection.includes(model.id)),...nativeModels],models={...googleCatalog.models};
|
|
67
90
|
if(!entries.length)return googleCatalog;
|
|
68
91
|
const used=new Set(Object.values(models).map(model=>model?.model));let next=500;
|
|
69
|
-
|
|
92
|
+
const modelId=()=>{
|
|
70
93
|
while(next<600&&used.has("MODEL_PLACEHOLDER_M"+next))next++;
|
|
71
|
-
if(next>=600
|
|
72
|
-
const model="MODEL_PLACEHOLDER_M"+next++;used.add(model);
|
|
94
|
+
if(next>=600)return null;
|
|
95
|
+
const model="MODEL_PLACEHOLDER_M"+next++;used.add(model);return model;
|
|
96
|
+
};
|
|
97
|
+
for(const entry of entries){
|
|
98
|
+
const model=modelId();
|
|
99
|
+
if(!model||Object.hasOwn(models,entry.id))throw new Error("Antigravity model catalog has no free client identifiers");
|
|
73
100
|
models[entry.id]={displayName:entry.displayName,model,maxTokens:entry.maxTokens,maxOutputTokens:entry.maxOutputTokens,
|
|
74
101
|
supportsImages:entry.supportsImages,supportsThinking:Boolean(entry.effort),apiProvider:"API_PROVIDER_GOOGLE_GEMINI"};
|
|
75
102
|
}
|
|
@@ -77,7 +104,32 @@ export function mergeAntigravityModels(googleCatalog,copilotCatalog,selection=nu
|
|
|
77
104
|
// Gemini App reads only the first group in the Recommended sort.
|
|
78
105
|
const sort=sorts.find(item=>item.displayName?.toLowerCase()==="recommended")||sorts[0];
|
|
79
106
|
sort.groups??=[];sort.groups[0]??={modelIds:[]};
|
|
80
|
-
|
|
81
|
-
|
|
107
|
+
const contract=nativeGrouping(googleCatalog), parents=new Map();
|
|
108
|
+
let groupedModels;
|
|
109
|
+
if(contract){
|
|
110
|
+
const families=new Map();
|
|
111
|
+
for(const row of entries){
|
|
112
|
+
if(!row.effort||!row.id.startsWith(ANTIGRAVITY_MODEL_PREFIX))continue;
|
|
113
|
+
const rows=families.get(row.model)||[];rows.push(row);families.set(row.model,rows);
|
|
114
|
+
}
|
|
115
|
+
groupedModels={...googleCatalog.groupedModels};
|
|
116
|
+
for(const [family,rows] of families){
|
|
117
|
+
const parent=ANTIGRAVITY_MODEL_PREFIX+family;
|
|
118
|
+
if(rows.length<2||Object.hasOwn(models,parent)||Object.hasOwn(groupedModels,parent))continue;
|
|
119
|
+
const chosen=rows.find(row=>row.id===defaultModel)||rows.find(row=>row.effort==="medium")||rows[0];
|
|
120
|
+
const displayName=chosen.displayName.split(" · Copilot")[0]+" · Copilot";
|
|
121
|
+
if(contract.parentInModels){
|
|
122
|
+
const model=modelId();if(!model)continue;
|
|
123
|
+
models[parent]={...models[chosen.id],model,displayName};
|
|
124
|
+
}
|
|
125
|
+
const suffix=effort=>(contract.dashedSuffix?"-":"")+effort;
|
|
126
|
+
groupedModels[parent]={displayName,defaultThinkingSuffix:suffix(chosen.effort),supportedThinkingLevels:rows.map(row=>({
|
|
127
|
+
thinkingSuffix:suffix(row.effort),thinkingDisplayName:row.effort[0].toUpperCase()+row.effort.slice(1),
|
|
128
|
+
}))};
|
|
129
|
+
for(const row of rows)parents.set(row.id,parent);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
sort.groups[0].modelIds=[...(sort.groups[0].modelIds||[]),...new Set(entries.map(entry=>parents.get(entry.id)||entry.id))];
|
|
133
|
+
return {...googleCatalog,models,agentModelSorts:sorts,...(groupedModels?{groupedModels}:{}),
|
|
82
134
|
...(hasAntigravityAgentDefault(googleCatalog)&&entries.some(entry=>entry.id===defaultModel)?{defaultAgentModelId:defaultModel}:{})};
|
|
83
135
|
}
|
|
@@ -5,12 +5,13 @@ import { execFile } from "node:child_process";
|
|
|
5
5
|
import { promisify } from "node:util";
|
|
6
6
|
import { installedWindowsPredictionAppAsync } from "./native-prediction-windows.mjs";
|
|
7
7
|
import { inspectWindowsAntigravity } from "./windows-antigravity-app.mjs";
|
|
8
|
+
import { macAntigravityBundles } from "./macos-antigravity-app.mjs";
|
|
8
9
|
|
|
9
10
|
const execute = promisify(execFile);
|
|
10
11
|
const definitions = {
|
|
11
12
|
codex: { bundles: ["Codex.app", "ChatGPT.app"], id: "com.openai.codex", executables: ["Codex", "ChatGPT"] },
|
|
12
13
|
claude_app: { bundles: ["Claude.app"], id: "com.anthropic.claudefordesktop", executables: ["Claude"] },
|
|
13
|
-
antigravity: { bundles:
|
|
14
|
+
antigravity: { bundles: Object.keys(macAntigravityBundles) },
|
|
14
15
|
};
|
|
15
16
|
const runOptions = { encoding: "utf8", timeout: 3000, maxBuffer: 4 * 1024 * 1024, windowsHide: true };
|
|
16
17
|
const metadataEnvironment = env => ({ ...Object.fromEntries(["PATH", "SystemRoot", "WINDIR", "TEMP", "TMP", "LOCALAPPDATA", "APPDATA", "USERPROFILE", "HOME", "TZ"]
|
|
@@ -49,8 +50,12 @@ export async function inspectApplicationProcesses({ platform = process.platform,
|
|
|
49
50
|
try { await fs.access(file); } catch { continue; }
|
|
50
51
|
const result = await exec("/usr/bin/plutil", ["-convert", "json", "-o", "-", file], { ...runOptions, maxBuffer: 65536 });
|
|
51
52
|
const info = JSON.parse(result.stdout);
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
const antigravity = id === "antigravity" ? macAntigravityBundles[bundle] : null;
|
|
54
|
+
const identity = antigravity?.identifier ?? definition.id;
|
|
55
|
+
if (info.CFBundleIdentifier !== identity ||
|
|
56
|
+
!(antigravity ? antigravity.executable === info.CFBundleExecutable : definition.executables.includes(info.CFBundleExecutable))) continue;
|
|
57
|
+
if (antigravity) try { await fs.access(path.join(app, antigravity.helper)); } catch { continue; }
|
|
58
|
+
installed.push({ app, target: app, identity, executable: path.join(app, "Contents/MacOS", info.CFBundleExecutable), version: info.CFBundleShortVersionString });
|
|
54
59
|
}
|
|
55
60
|
const running = installed.filter(info => processes.some(row => row.command === info.executable));
|
|
56
61
|
apps[id] = running.length > 1 ? { status: "multiple" } : running[0] || installed[0] || { status: "not_installed" };
|
package/src/client-versions.mjs
CHANGED
|
@@ -4,12 +4,13 @@ import path from "node:path";
|
|
|
4
4
|
import { atomicWriteFile } from "./atomic-file.mjs";
|
|
5
5
|
import { readBoundedFile } from "./bounded-file.mjs";
|
|
6
6
|
import { userSettingsPath } from "./user-settings.mjs";
|
|
7
|
+
import { macAntigravityBundles } from "./macos-antigravity-app.mjs";
|
|
7
8
|
|
|
8
9
|
const MAX_METADATA_BYTES = 64 * 1024;
|
|
9
|
-
const MAX_APPS =
|
|
10
|
+
const MAX_APPS = 12;
|
|
10
11
|
export const clientVersionName = client => ({ codex: "Codex App", claude: "Claude App", antigravity: "Antigravity" })[client] || client;
|
|
11
12
|
const validId = value => /^(?:codex|claude)_(?:system|user|windows)_(?:chatgpt|codex|claude)$/.test(value)
|
|
12
|
-
|| /^antigravity_(?:system|user)
|
|
13
|
+
|| /^antigravity_(?:system|user)_(?:gemini|antigravity)$/.test(value) || value === "antigravity_windows_antigravity";
|
|
13
14
|
const validVersion = value => typeof value === "string" && /^[0-9][0-9A-Za-z.+_-]{0,63}$/.test(value);
|
|
14
15
|
const optionalVersion = value => value == null || validVersion(value);
|
|
15
16
|
const validDate = value => value == null || typeof value === "string" && /^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d\.\d{3}Z$/.test(value);
|
|
@@ -33,9 +34,14 @@ async function stableRead(file) {
|
|
|
33
34
|
|
|
34
35
|
async function macBundle(root, scope, name, client) {
|
|
35
36
|
const bundle = path.join(root, name), infoPath = path.join(bundle, "Contents", "Info.plist"), info = await stableRead(infoPath), plist = info.data;
|
|
36
|
-
const
|
|
37
|
+
const antigravity = client === "antigravity" ? macAntigravityBundles[name] : null;
|
|
38
|
+
const expected = antigravity?.identifier ?? (client === "codex" ? "com.openai.codex" : "com.anthropic.claudefordesktop");
|
|
37
39
|
const version = tag(plist, "CFBundleShortVersionString"), build = tag(plist, "CFBundleVersion");
|
|
38
40
|
if (tag(plist, "CFBundleIdentifier") !== expected || !validVersion(version) || !optionalVersion(build)) return null;
|
|
41
|
+
if (name === "Antigravity.app") {
|
|
42
|
+
if (tag(plist, "CFBundleExecutable") !== antigravity.executable) return null;
|
|
43
|
+
await fs.access(path.join(bundle, antigravity.helper));
|
|
44
|
+
}
|
|
39
45
|
let cliVersion = null;
|
|
40
46
|
if (client === "codex") try {
|
|
41
47
|
const metadata = JSON.parse((await stableRead(path.join(bundle, "Contents", "Resources", "codex-cli", "codex-package.json"))).data);
|
|
@@ -49,7 +55,8 @@ export async function inspectInstalledClientVersions({ home = os.homedir(), env
|
|
|
49
55
|
systemApplications = "/Applications", windowsCodexVersion, windowsAntigravityVersion } = {}) {
|
|
50
56
|
if (platform === "darwin") {
|
|
51
57
|
const roots = [["system", systemApplications], ["user", path.join(home, "Applications")]], jobs = [];
|
|
52
|
-
for (const [scope, root] of roots) for (const [name, client] of [["ChatGPT.app", "codex"], ["Codex.app", "codex"], ["Claude.app", "claude"],
|
|
58
|
+
for (const [scope, root] of roots) for (const [name, client] of [["ChatGPT.app", "codex"], ["Codex.app", "codex"], ["Claude.app", "claude"],
|
|
59
|
+
...Object.keys(macAntigravityBundles).map(name => [name, "antigravity"])]) {
|
|
53
60
|
jobs.push(macBundle(root, scope, name, client).catch(() => null));
|
|
54
61
|
}
|
|
55
62
|
return (await Promise.all(jobs)).filter(Boolean);
|
package/src/gemini-app.mjs
CHANGED
|
@@ -4,25 +4,30 @@ import os from "node:os";
|
|
|
4
4
|
import {execFile} from "node:child_process";
|
|
5
5
|
import {promisify} from "node:util";
|
|
6
6
|
import { inspectWindowsAntigravity, windowsAntigravityEnvironment, windowsAntigravityPath } from "./windows-antigravity-app.mjs";
|
|
7
|
+
import { googleMacTeam, macAntigravityBundles, macAntigravityBundlePaths } from "./macos-antigravity-app.mjs";
|
|
7
8
|
|
|
8
9
|
const execute=promisify(execFile);
|
|
9
10
|
|
|
10
|
-
export async function inspectGeminiApp({platform=process.platform,app,env=process.env,exec=execute,exists=fs.existsSync}={}) {
|
|
11
|
+
export async function inspectGeminiApp({platform=process.platform,app,home=os.homedir(),env=process.env,exec=execute,exists=fs.existsSync}={}) {
|
|
11
12
|
if(platform==="win32"){
|
|
12
13
|
const state=await inspectWindowsAntigravity({env,exec,app});
|
|
13
14
|
return !app&&state.app?inspectWindowsAntigravity({env,exec,app:state.app}):state;
|
|
14
15
|
}
|
|
15
16
|
if(platform!=="darwin")return {status:"unsupported"};
|
|
16
|
-
app??="/
|
|
17
|
+
app??=macAntigravityBundlePaths(home).find(candidate=>exists(path.join(candidate,"Contents/Info.plist")));
|
|
18
|
+
if(!app)return {status:"not_installed"};
|
|
19
|
+
const bundle=macAntigravityBundles[path.basename(app)];
|
|
20
|
+
if(!bundle)throw new Error("Unrecognized Antigravity App identity");
|
|
17
21
|
const metadata=path.join(app,"Contents/Info.plist");
|
|
18
22
|
if(!exists(metadata))return {status:"not_installed"};
|
|
19
23
|
const result=await exec("/usr/bin/plutil",["-convert","json","-o","-",metadata],{encoding:"utf8",timeout:3000,maxBuffer:65536});
|
|
20
24
|
const info=JSON.parse(String(result.stdout??result));
|
|
21
|
-
if(info.CFBundleIdentifier!==
|
|
22
|
-
const helper=path.join(app,
|
|
25
|
+
if(info.CFBundleIdentifier!==bundle.identifier||info.CFBundleExecutable!==bundle.executable)throw new Error("Unrecognized Antigravity App identity");
|
|
26
|
+
const helper=path.join(app,bundle.helper);
|
|
23
27
|
if(!exists(helper))return {status:"antigravity_unavailable"};
|
|
24
|
-
await exec("/usr/bin/codesign",["--verify","--deep","--strict","-R",
|
|
25
|
-
|
|
28
|
+
await exec("/usr/bin/codesign",["--verify","--deep","--strict","-R",
|
|
29
|
+
`=identifier "${bundle.identifier}" and anchor apple generic and certificate leaf[subject.OU] = "${googleMacTeam}"`,app],{encoding:"utf8",timeout:15000,maxBuffer:65536});
|
|
30
|
+
const executable=path.join(app,"Contents/MacOS",bundle.executable);
|
|
26
31
|
const processes=await exec("/bin/ps",["-axo","pid=,comm="],{encoding:"utf8",timeout:3000,maxBuffer:4*1024*1024});
|
|
27
32
|
const pids=String(processes.stdout??processes).split("\n").flatMap(line=>{const match=/^\s*(\d+)\s+(.+?)\s*$/.exec(line);return match?.[2]===executable?[Number(match[1])]:[]});
|
|
28
33
|
return {status:pids.length>1?"multiple":pids.length?"running":"stopped",app,executable,helper,version:info.CFBundleShortVersionString,pids};
|
|
@@ -33,7 +38,7 @@ export async function inspectGeminiApp({platform=process.platform,app,env=proces
|
|
|
33
38
|
export function planGeminiAppLaunch(state,{cloudCodeUrl,env=process.env,home=os.homedir(),platform=process.platform,managedGateway=false}={}) {
|
|
34
39
|
if(!["running","stopped","multiple"].includes(state?.status))return {status:state?.status||"unknown"};
|
|
35
40
|
if(state.status==="stopped"&&!(platform==="win32"?windowsAntigravityPath(state.app):
|
|
36
|
-
|
|
41
|
+
macAntigravityBundlePaths(home).includes(state.app)))throw new Error("Unrecognized Gemini App location");
|
|
37
42
|
const url=cloudCodeUrl===undefined?null:new URL(cloudCodeUrl);
|
|
38
43
|
if(url&&(url.protocol!=="http:"||url.hostname!=="127.0.0.1"||!url.port||Number(url.port)<1||url.username||url.password||url.search||url.hash))throw new Error("Gemini route must use a local CCDX endpoint");
|
|
39
44
|
if(url&&(managedGateway||platform==="win32"&&state.wsl||Object.entries(env).some(([name,value])=>{
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import os from "node:os";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
|
|
4
|
+
export const macAntigravityBundles = {
|
|
5
|
+
"Gemini.app": { identifier: "com.google.GeminiMacOS", executable: "Gemini", helper: "Contents/Helpers/agy" },
|
|
6
|
+
"Antigravity.app": { identifier: "com.google.antigravity", executable: "Antigravity", helper: "Contents/Resources/bin/language_server" },
|
|
7
|
+
};
|
|
8
|
+
export const googleMacTeam = "EQHXZ8M8AV";
|
|
9
|
+
|
|
10
|
+
export function macAntigravityBundlePaths(home = os.homedir()) {
|
|
11
|
+
const names=Object.keys(macAntigravityBundles);
|
|
12
|
+
return [...names.map(name=>"/Applications/"+name),...names.map(name=>path.join(home,"Applications",name))];
|
|
13
|
+
}
|
package/src/providers/api.mjs
CHANGED
|
@@ -118,10 +118,14 @@ export function createApiProvider({ config, secrets, env = process.env, platform
|
|
|
118
118
|
const recovery = cooldown?.enter();let observed = false;
|
|
119
119
|
try {
|
|
120
120
|
const transport = !closed && network && (network.healthy?.() ?? true) ? network : await getNetwork(options.signal);
|
|
121
|
+
const generation = api === "gemini" ? body?.generationConfig : undefined;
|
|
122
|
+
const thinkingLevel = generation?.thinkingConfig?.thinkingLevel;
|
|
121
123
|
const result = await sourceTransport(options, { send: transport.fetch, receiver: transport, args: [url, { method: body ? "POST" : "GET", headers, body: serialized, signal: options.signal }],
|
|
122
124
|
model: requestModel, bodyText: serialized, stream, observe: Boolean(body && options.observeUpstream !== false),
|
|
123
|
-
evidence: body && !options.countTokens ? { max_output_tokens_sent: api === "messages" ? body.max_tokens : api === "chat" ? body.max_completion_tokens :
|
|
124
|
-
|
|
125
|
+
evidence: body && !options.countTokens ? { max_output_tokens_sent: api === "messages" ? body.max_tokens : api === "chat" ? body.max_completion_tokens :
|
|
126
|
+
api === "gemini" ? generation?.maxOutputTokens : body.max_output_tokens,
|
|
127
|
+
reasoning_effort_sent: api === "messages" ? body.output_config?.effort : api === "chat" ? body.reasoning_effort :
|
|
128
|
+
api === "gemini" ? typeof thinkingLevel === "string" ? thinkingLevel.toLowerCase() : undefined : body.reasoning?.effort } : undefined });
|
|
125
129
|
const temporary = result.status === 502 || result.status === 503 || result.status === 504;
|
|
126
130
|
let retryAfterMs = 0;
|
|
127
131
|
if (temporary) { const retry = result.headers.get("retry-after");retryAfterMs = /^\d{1,8}$/.test(retry || "") ? Number(retry) * 1000 : Math.max(0, Date.parse(retry) - now()); }
|