codex-copilot-dx 1.3.22 → 1.3.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.
Files changed (41) hide show
  1. package/README.md +3 -0
  2. package/docs/ARCHITECTURE.md +29 -1
  3. package/docs/REFERENCE.md +61 -1
  4. package/package.json +2 -2
  5. package/src/adapter.mjs +45 -10
  6. package/src/antigravity-chat-bridge.mjs +240 -0
  7. package/src/antigravity-handler.mjs +141 -0
  8. package/src/antigravity-images.mjs +28 -0
  9. package/src/antigravity-models.mjs +34 -0
  10. package/src/antigravity-runtime.mjs +82 -0
  11. package/src/carbon-search.mjs +37 -0
  12. package/src/carbon-tool-bridge.mjs +384 -0
  13. package/src/cli-command-spec.mjs +2 -0
  14. package/src/cli-management.mjs +37 -8
  15. package/src/clients/codex-models.mjs +6 -2
  16. package/src/copilot-web-fetch.mjs +75 -0
  17. package/src/copilot-web.mjs +225 -0
  18. package/src/dashboard/connections.js +2 -1
  19. package/src/dashboard/console.js +1 -1
  20. package/src/dashboard/flow.js +2 -2
  21. package/src/dashboard/gemini.js +54 -0
  22. package/src/dashboard/index.html +30 -20
  23. package/src/dashboard/language.js +14 -0
  24. package/src/dashboard/status.js +4 -0
  25. package/src/dashboard/ui.js +3 -0
  26. package/src/dashboard-api.mjs +13 -0
  27. package/src/dashboard.mjs +17 -13
  28. package/src/gemini-app.mjs +34 -0
  29. package/src/http-transport.mjs +3 -2
  30. package/src/local-privacy.mjs +7 -1
  31. package/src/native-images.mjs +2 -1
  32. package/src/observability.mjs +5 -1
  33. package/src/optional-routes.mjs +4 -0
  34. package/src/privacy-stream.mjs +2 -0
  35. package/src/privacy-transform.mjs +1 -0
  36. package/src/providers/github.mjs +3 -1
  37. package/src/request-application.mjs +1 -1
  38. package/src/responses-bridge.mjs +14 -5
  39. package/src/responses-handler.mjs +24 -4
  40. package/src/stream-performance.mjs +1 -1
  41. package/src/terminal-state.mjs +6 -5
@@ -193,11 +193,12 @@ export async function readJsonBody(req, {
193
193
  maxBodyBytes = MAX_BODY_BYTES,
194
194
  maxDecodedBodyBytes = MAX_DECODED_BODY_BYTES,
195
195
  signal,
196
+ parse = parseRequestJson,
196
197
  } = {}) {
197
198
  if (signal?.aborted) throw admissionAbortError(signal);
198
199
  const encodings = contentEncodings(req.headers?.["content-encoding"]);
199
200
  if (encodings.every((encoding) => encoding === "identity")) {
200
- return parseRequestJson(await readIdentityText(req, maxBodyBytes, maxDecodedBodyBytes, signal));
201
+ return parse(await readIdentityText(req, maxBodyBytes, maxDecodedBodyBytes, signal));
201
202
  }
202
203
  const buffer = await readRequestBuffer(req, maxBodyBytes, signal);
203
204
  let releaseDecompression = () => {};
@@ -251,7 +252,7 @@ export async function readJsonBody(req, {
251
252
  if (supportsResizableReservation) decodedReservation.resize(decoded.length);
252
253
  else decodedReservation = await admission?.reserveDecodedBody?.(decoded.length, { signal });
253
254
  }
254
- const parsed = parseRequestJson(decoded.toString("utf8"));
255
+ const parsed = parse(decoded.toString("utf8"));
255
256
  retainDecodedReservation = true;
256
257
  return parsed;
257
258
  } finally {
@@ -43,7 +43,7 @@ export function createLocalPrivacy(options = {}) {
43
43
  });changes.changed();
44
44
  }
45
45
  const find = (texts, options) => detection.find(texts, options);
46
- async function prepare(body, { protocol, client, signal, res, policy } = {}) {
46
+ async function prepare(body, { protocol, client, signal, res, policy, onSession } = {}) {
47
47
  const saved = policy || settings();if (!saved.enabled) return body;
48
48
  if (disposed) throw privacyFailure("engine_unavailable");
49
49
  loadKey();
@@ -72,6 +72,7 @@ export function createLocalPrivacy(options = {}) {
72
72
  if (signal?.aborted) { session.release();throw signal.reason; }
73
73
  markRequestObservation({ privacy_count: session.count, privacy_ms: Math.round(performance.now() - start), privacy_state: "checked" });
74
74
  actionError = null;lastCheck = { state: "checked", at: new Date().toISOString(), elapsed_ms: Math.round(performance.now() - start), count: session.count, wait_budget_ms: budget };changes.changed();
75
+ if (onSession) { onSession(session);return session.body; }
75
76
  if (res && session.count) {
76
77
  let current = responses.get(res);
77
78
  if (!current) {
@@ -119,6 +120,11 @@ export function createLocalPrivacy(options = {}) {
119
120
  function warm() { const current = generation;if (settings().enabled) void model.load().catch(error => { if (current !== generation || !settings().enabled) return;actionError = /^ccdx_privacy_[a-z_]+$/.test(error.code || "") ? error.code : "ccdx_privacy_unavailable";changes.changed(); }); }
120
121
  try { warm(); } catch { /* Invalid preferences remain visible and are never rewritten. */ }
121
122
  return { snapshot, action, prepare, subscribe: changes.subscribe, busy: () => Boolean(pending || detection.busy() || model.busy()),
123
+ async prepareSession(body, context) {
124
+ let session;
125
+ const masked = await prepare(body, { ...context, onSession: value => { session = value; } });
126
+ return session || { body: masked, count: 0, restoreText: value => value, restoreValue: value => value, restoreToolValue: value => value, release() {} };
127
+ },
122
128
  wrap(fn, context) {
123
129
  if (!fn) return fn;
124
130
  const policy = context.res && policies.get(context.res) || settings();if (context.res) policies.set(context.res, policy);
@@ -16,7 +16,7 @@ const RESPONSE_MAX_BYTES = 48 * 1024 * 1024;
16
16
  const SIZES = new Set(["auto", "1024x1024", "1536x1024", "1024x1536"]);
17
17
  const FIELDS = new Set(["model", "prompt", "images", "background", "quality", "size", "n"]);
18
18
 
19
- async function checkedImage(value, maxBytes, mime) {
19
+ export async function checkedImage(value, maxBytes, mime) {
20
20
  if (typeof value !== "string" || !value || value.length > 4 * Math.ceil(maxBytes / 3)
21
21
  || value.length % 4 !== 0 || !/^[A-Za-z0-9+/]+={0,2}$/.test(value)) throw httpError("Invalid image data", 400);
22
22
  const bytes = Buffer.from(value, "base64");
@@ -26,6 +26,7 @@ async function checkedImage(value, maxBytes, mime) {
26
26
  catch { throw httpError("Image must be a valid PNG, JPEG or WebP", 400); }
27
27
  const type = { png: "image/png", jpeg: "image/jpeg", webp: "image/webp" }[info.format];
28
28
  if (!type || mime && mime !== type) throw httpError("Image format does not match its data", 400);
29
+ return type;
29
30
  }
30
31
 
31
32
  export async function nativeImageRequest(body, operation, selectedModel = DEFAULT_IMAGE_MODEL) {
@@ -15,8 +15,10 @@ const OBSERVABILITY_RUNTIME_CONFIG = loadRuntimeConfig();
15
15
  const OBSERVABILITY_DECODED_BODY_BYTES = decodedBodyLimitPreference().bytes;
16
16
 
17
17
  const ROUTE_NAMES = Object.freeze([
18
+ "antigravity",
18
19
  "responses",
19
20
  "responses_compact",
21
+ "search",
20
22
  "models",
21
23
  "messages",
22
24
  "messages_count_tokens",
@@ -110,9 +112,11 @@ export function classifyAdapterRoute(method, pathname) {
110
112
  if (pathname === "/anthropic/v1/models") return "claude_models";
111
113
  if (method === "POST" && pathname === "/v1/responses") return "responses";
112
114
  if (method === "POST" && pathname === "/v1/responses/compact") return "responses_compact";
115
+ if (method === "POST" && pathname === "/v1/alpha/search") return "search";
113
116
  if (method === "GET" && pathname === "/v1/models") return "models";
114
117
  if (["/v1/images/generations", "/v1/images/edits"].includes(pathname)) return "images";
115
118
  if (pathname === "/mcp/image") return "image_mcp";
119
+ if (pathname.startsWith("/antigravity/")) return ["/antigravity/v1internal:streamGenerateContent", "/antigravity/v1internal:generateContent"].includes(pathname) ? "antigravity" : "antigravity_control";
116
120
  return "not_found";
117
121
  }
118
122
 
@@ -196,7 +200,7 @@ export function runtimeStatusPayload({
196
200
  }
197
201
  const history = responseHistoryStats();
198
202
  const requests = metrics?.snapshot?.() || createRequestMetrics().snapshot();
199
- const activityCounts = ["responses", "responses_compact", "messages"].map(route => requests.by_route[route].active);
203
+ const activityCounts = ["responses", "responses_compact", "messages", "search", "antigravity"].map(route => requests.by_route[route]?.active || 0);
200
204
  activityCounts.push(imageGeneration?.active ?? 0);
201
205
  const active = activityCounts.every(value => Number.isSafeInteger(value) && value >= 0)
202
206
  && Number.isSafeInteger(activityCounts.reduce((sum, value) => sum + value, 0)) ? activityCounts.reduce((sum, value) => sum + value, 0) : null;
@@ -1,6 +1,10 @@
1
1
  export const DASHBOARD_PATHS = new Set(["/", "/ui.css", "/theme.js", "/language.js", "/refresh.js", "/live.js", "/time.js", "/animation.js", "/status.js", "/view-boundary.js", "/activity.js", "/flow.js", "/usage.js", "/context.js", "/ui.js", "/console.js", "/updates.js", "/preferences.js", "/features.js", "/icons.js", "/disclosure.js", "/tools.js", "/connections.js", "/privacy.js"]);
2
2
  export const DASHBOARD_API_PATHS = new Set(["/_ccdx/ui/animation", "/_ccdx/ui/models/live", "/_ccdx/ui/usage", "/_ccdx/ui/auth", "/_ccdx/ui/providers", "/_ccdx/ui/settings", "/_ccdx/ui/m365/accounts", "/_ccdx/ui/updates", "/_ccdx/ui/account", "/_ccdx/ui/checks", "/_ccdx/ui/connections", "/_ccdx/ui/context", "/_ccdx/ui/privacy"]);
3
3
 
4
+ DASHBOARD_PATHS.add("/gemini.js");
5
+ DASHBOARD_PATHS.add("/dashboard.js");
6
+ DASHBOARD_API_PATHS.add("/_ccdx/ui/gemini");
7
+
4
8
  export function isOptionalRoute(method, pathname) {
5
9
  return DASHBOARD_API_PATHS.has(pathname) || pathname === "/mcp/image"
6
10
  || ((method === "GET" || method === "HEAD") && DASHBOARD_PATHS.has(pathname));
@@ -112,6 +112,8 @@ function fragments(session, json, onRetained) {
112
112
  };
113
113
  }
114
114
 
115
+ export function createPrivacyTextFragments(session) { return fragments(session, false, () => {}); }
116
+
115
117
  function rewrite(wire, event, named = false) {
116
118
  let written = false;
117
119
  const output = wire.split(/(?<=\n)|(?<=\r)(?!\n)/).map(line => {
@@ -78,6 +78,7 @@ function requestTexts(body, protocol) {
78
78
  else text(item, "content");
79
79
  }
80
80
  }
81
+ if (protocol === "search") leaves(body.commands, add);
81
82
  return { items, nested };
82
83
  }
83
84
  function ruleSpans(text, personal) {
@@ -44,7 +44,9 @@ export function createGithubProvider({ client = defaultCopilotClient, profileId
44
44
  const native = nativeBase
45
45
  || ((customTools || body?.tool_choice?.type === "allowed_tools") && Array.isArray(endpoints)
46
46
  && (endpoints.includes("/responses") || endpoints.includes("/v1/responses")));
47
- if (customTools && !native) {
47
+ const carbonChat = upstreamModel === "gemini-4-carbon" && Array.isArray(endpoints)
48
+ && modelSupportsChatCompletions({ supported_endpoints: endpoints });
49
+ if (customTools && !native && !carbonChat) {
48
50
  const message = `Model ${upstreamModel} has custom tool items that cannot be represented by Chat Completions, and cached endpoint metadata does not confirm Responses support`;
49
51
  throw Object.assign(new Error(message), { statusCode: 400, code: "ccdx_custom_tools_require_responses",
50
52
  jsonBody: { error: { message, type: "invalid_request_error", code: "ccdx_custom_tools_require_responses", model: upstreamModel } } });
@@ -1,4 +1,4 @@
1
- const APPLICATIONS = new Set(["codex_app", "codex_cli", "codex", "claude_app", "claude_code", "claude", "api"]);
1
+ const APPLICATIONS = new Set(["codex_app", "codex_cli", "codex", "claude_app", "claude_code", "claude", "gemini_app", "api"]);
2
2
  const DECLARED = new Map([["codex-app", "codex_app"], ["codex-cli", "codex_cli"], ["codex", "codex"], ["claude-app", "claude_app"], ["claude-code", "claude_code"]]);
3
3
  const ORIGINATORS = new Map([["codex desktop", "codex_app"], ["codex_desktop", "codex_app"], ["codex_app", "codex_app"], ["codex_cli_rs", "codex_cli"], ["codex_exec", "codex_cli"], ["codex-cli", "codex_cli"], ["codex", "codex"], ["codex_vscode", "codex"]]);
4
4
  const hint = value => typeof value === "string" && value.length <= 80 ? value.trim().toLowerCase() : "";
@@ -282,7 +282,7 @@ function disallowedUpstreamTool() {
282
282
  return invalidUpstreamStream("Upstream did not honor the allowed tools", "upstream_tool_not_allowed");
283
283
  }
284
284
 
285
- export function chatToResponses(chatResp, model, { toolChoice } = {}) {
285
+ export function chatToResponses(chatResp, model, { toolChoice, toolAdapter } = {}) {
286
286
  const id = `resp_${uid()}`, choice = chatResp.choices?.[0], msg = choice?.message, output = [];
287
287
  const terminal = chatTerminal(choice?.finish_reason);
288
288
  const allowed = allowedToolNames(toolChoice);
@@ -291,7 +291,9 @@ export function chatToResponses(chatResp, model, { toolChoice } = {}) {
291
291
  return terminal.status === "completed" ? !allowed.has(name) : name && ![...allowed].some(candidate => candidate.startsWith(name));
292
292
  }) || terminal.status === "completed" && toolChoice.allowed_tools.mode === "required" && !msg?.tool_calls?.length)) throw disallowedUpstreamTool();
293
293
  if (msg?.content) output.push({ type: "message", id: `msg_${uid()}`, role: "assistant", status: terminal.status, content: [{ type: "output_text", text: msg.content }] });
294
- if (msg?.tool_calls) for (const tc of msg.tool_calls) output.push({ type: "function_call", id: tc.id, call_id: tc.id, name: tc.function.name, arguments: tc.function.arguments, status: terminal.status });
294
+ if (msg?.tool_calls) for (const tc of msg.tool_calls) output.push(toolAdapter
295
+ ? toolAdapter.outputItem({ id: tc.id, callId: tc.id, name: tc.function?.name, arguments: tc.function?.arguments }, terminal.status)
296
+ : { type: "function_call", id: tc.id, call_id: tc.id, name: tc.function.name, arguments: tc.function.arguments, status: terminal.status });
295
297
  return { id, object: "response", ...terminal, model: chatResp.model || model, output, usage: chatResp.usage ? { input_tokens: chatResp.usage.prompt_tokens || 0, output_tokens: chatResp.usage.completion_tokens || 0, total_tokens: chatResp.usage.total_tokens || 0 } : undefined };
296
298
  }
297
299
 
@@ -313,6 +315,7 @@ export async function forwardToChat(chatReq, emitEvent, onDone, onError, options
313
315
  releaseRequest,
314
316
  signal,
315
317
  streamIdleTimeoutMs,
318
+ toolAdapter,
316
319
  } = options;
317
320
  options = undefined;
318
321
  if (upstreamReq !== chatReq) bodyText = undefined;
@@ -408,9 +411,10 @@ export async function forwardToChat(chatReq, emitEvent, onDone, onError, options
408
411
  arguments: "",
409
412
  outputIndex: nextOutputIndex++,
410
413
  };
414
+ if (toolAdapter) tool.upstreamIdKnown = Boolean(chunk.id);
411
415
  if (allowed && !allowedPrefix(tool.name)) throw disallowedUpstreamTool();
412
416
  toolCalls.set(key, tool);
413
- await emitEvent("response.output_item.added", {
417
+ if (!toolAdapter) await emitEvent("response.output_item.added", {
414
418
  output_index: tool.outputIndex,
415
419
  item: {
416
420
  type: "function_call",
@@ -443,6 +447,10 @@ export async function forwardToChat(chatReq, emitEvent, onDone, onError, options
443
447
  output[messageItem.outputIndex] = item;
444
448
  }
445
449
  for (const tool of toolCalls.values()) {
450
+ if (toolAdapter) {
451
+ output[tool.outputIndex] = await toolAdapter.finish(tool, terminal, emitEvent);
452
+ continue;
453
+ }
446
454
  const item = {
447
455
  type: "function_call",
448
456
  id: tool.id,
@@ -522,7 +530,7 @@ export async function forwardToChat(chatReq, emitEvent, onDone, onError, options
522
530
  if (delta.tool_calls) {
523
531
  for (const tc of delta.tool_calls) {
524
532
  const { tool, created } = await ensureToolCall(tc);
525
- if (tc.id) tool.callId = tc.id;
533
+ if (tc.id) { tool.callId = tc.id;if (toolAdapter) tool.upstreamIdKnown = true; }
526
534
  if (!created && tc.function?.name) {
527
535
  const name = tc.function.name;
528
536
  let completeRepeat = name === tool.name && declaredToolNames.has(name);
@@ -539,12 +547,13 @@ export async function forwardToChat(chatReq, emitEvent, onDone, onError, options
539
547
  toolArgumentGuard.observe(tool.outputIndex, argumentDelta);
540
548
  if (argumentDelta) {
541
549
  tool.arguments += argumentDelta;
542
- await emitEvent("response.function_call_arguments.delta", {
550
+ if (!toolAdapter) await emitEvent("response.function_call_arguments.delta", {
543
551
  output_index: tool.outputIndex,
544
552
  item_id: tool.id,
545
553
  delta: argumentDelta,
546
554
  });
547
555
  }
556
+ if (toolAdapter) await toolAdapter.update(tool, emitEvent);
548
557
  }
549
558
  }
550
559
  }
@@ -17,7 +17,7 @@ import {
17
17
  modelContextWindowTokens,
18
18
  resolveOpenAIModel,
19
19
  } from "./models.mjs";
20
- import { chatToResponses, forwardToChat } from "./responses-bridge.mjs";
20
+ import { chatToResponses, forwardToChat, responsesBodyUsesCustomTools } from "./responses-bridge.mjs";
21
21
  import { prepareResponsesChatPayload } from "./responses-chat-payload.mjs";
22
22
  import { prepareResponsesCompactionRequest } from "./responses-compaction.mjs";
23
23
  import { clearResponsesToolOutputPartsCache } from "./responses-content.mjs";
@@ -303,7 +303,16 @@ export function createResponsesHandler(options) {
303
303
  } else if (routePlan.protocol === "openai-chat-completions") {
304
304
  const chatSupport = (Array.isArray(modelRegistry?.models) ? modelRegistry.models : modelRegistry?.models?.data)
305
305
  ?.find(model => model?.id === upstreamModel)?.capabilities?.supports;
306
- let { chatReq, bodyText } = await prepareResponsesChatPayload(prepared, {
306
+ const carbonRoute = provider.id === "github" && upstreamModel === "gemini-4-carbon";
307
+ let carbonBridge = null, carbonStream = null;
308
+ if (carbonRoute && responsesBodyUsesCustomTools(prepared.body)) {
309
+ const { prepareCarbonToolBridge, createCarbonStreamAdapter } = await import("./carbon-tool-bridge.mjs");
310
+ carbonBridge = prepareCarbonToolBridge(prepared.body, prepared.currentInputStart);
311
+ if (streaming) carbonStream = createCarbonStreamAdapter(carbonBridge);
312
+ }
313
+ const chatContext = carbonBridge
314
+ ? { ...prepared, body: carbonBridge.body, currentInputStart: carbonBridge.currentInputStart } : prepared;
315
+ let { chatReq, bodyText } = await prepareResponsesChatPayload(chatContext, {
307
316
  assertActive: assertPrepareActive,
308
317
  payloadOptions: responsesPayloadOptions,
309
318
  reasoningEfforts: chatSupport?.reasoning_effort,
@@ -328,7 +337,8 @@ export function createResponsesHandler(options) {
328
337
  Connection: "keep-alive",
329
338
  });
330
339
  keepalive.activity();
331
- const written = await writeOrDrain(res, `event: ${event}\ndata: ${JSON.stringify(data)}\n\n`, { signal: abort.signal });
340
+ const wireData = carbonRoute ? { type: event, sequence_number: streamMetadata.sequenceNumber, ...data } : data;
341
+ const written = await writeOrDrain(res, `event: ${event}\ndata: ${JSON.stringify(wireData)}\n\n`, { signal: abort.signal });
332
342
  if (!written) return false;
333
343
  if (data.response && typeof data.response === "object") {
334
344
  for (const key of ["id", "created_at", "model"]) if (data.response[key] !== undefined) streamMetadata.response[key] = data.response[key];
@@ -353,6 +363,15 @@ export function createResponsesHandler(options) {
353
363
  sendJsonError(res, responseError, statusCode || 500);
354
364
  return;
355
365
  }
366
+ if (carbonRoute && error?.code === "ccdx_carbon_invalid_tool_call") {
367
+ const incomplete = { type: "response.incomplete", sequence_number: streamMetadata.sequenceNumber,
368
+ response: { ...streamMetadata.response, object: "response", status: "incomplete", output: [],
369
+ incomplete_details: { reason: "invalid_tool_call" } } };
370
+ await writeOrDrain(res, `event: response.incomplete\ndata: ${JSON.stringify(incomplete)}\n\n`, { signal: AbortSignal.timeout(1000) }).catch(() => false);
371
+ markResponseTerminal("incomplete", { model, origin: "carbon_tool_validation", reason: "invalid_tool_call" });
372
+ if (!res.destroyed && !res.writableEnded) res.end();
373
+ return;
374
+ }
356
375
  await endStreamWithError(res, error || new Error(errMsg), abort, streamMetadata);
357
376
  }, {
358
377
  signal: abort.signal,
@@ -362,6 +381,7 @@ export function createResponsesHandler(options) {
362
381
  chatCompletionsFn,
363
382
  releaseRequest: releaseChatPayload,
364
383
  bodyText,
384
+ ...(carbonStream ? { toolAdapter: carbonStream } : {}),
365
385
  onUpstreamResponse: (upstreamResponse) => {
366
386
  streamResponseHeaders = safeUpstreamResponseHeaders(upstreamResponse.headers, {
367
387
  contentType: "text/event-stream",
@@ -396,7 +416,7 @@ export function createResponsesHandler(options) {
396
416
  sendUpstreamError(res, upstream, data);
397
417
  return;
398
418
  }
399
- const response = chatToResponses(JSON.parse(data), model, { toolChoice });
419
+ const response = chatToResponses(JSON.parse(data), model, { toolChoice, ...(carbonBridge ? { toolAdapter: carbonBridge } : {}) });
400
420
  markResponseTerminal(response.status, {
401
421
  model: response.model || model, origin: "chat_completion", reason: response.incomplete_details?.reason,
402
422
  });
@@ -152,7 +152,7 @@ function emptyOutcomes() {
152
152
  function modelLabel(value, configured = false) {
153
153
  const model = String(value || "").trim();
154
154
  if (configured && /^[\w][\w./:@+-]{0,159}$/.test(model)) return model;
155
- return model === "codex-auto-review" || /^(?:gpt|claude)-[A-Za-z0-9._-]{1,72}$/.test(model)
155
+ return model === "codex-auto-review" || /^(?:gpt|claude|gemini)-[A-Za-z0-9._-]{1,72}$/.test(model)
156
156
  ? model : "other";
157
157
  }
158
158
 
@@ -1,8 +1,8 @@
1
1
  import { terminalCell } from "./terminal-text.mjs";
2
2
 
3
3
  const integer = value => Number.isSafeInteger(value) && value >= 0;
4
- const appIds = { codex_app: "codex", codex_cli: "codex", codex: "codex", claude_app: "claude_app", claude_code: "claude_code" };
5
- export const TERMINAL_CLIENT_NAMES = Object.freeze({ codex: "Codex", claude_app: "Claude App", claude_code: "Claude Code" });
4
+ const appIds = { codex_app: "codex", codex_cli: "codex", codex: "codex", claude_app: "claude_app", claude_code: "claude_code", gemini_app: "antigravity" };
5
+ export const TERMINAL_CLIENT_NAMES = Object.freeze({ codex: "Codex", claude_app: "Claude App", claude_code: "Claude Code", gemini: "Antigravity", antigravity: "Antigravity" });
6
6
  const labels = { configured: "Configured", paused: "Paused", disabled: "Disabled", not_configured: "Not configured", not_installed: "Not installed",
7
7
  preserved: "Unchanged", partially_preserved: "Partly unchanged", manual_sync: "Manual sync", default_unavailable: "Default unavailable", configuration_unavailable: "Unreadable", unavailable: "Unavailable" };
8
8
  export function terminalUptime(milliseconds) {
@@ -16,17 +16,17 @@ export function clientSetup(client = {}) {
16
16
  return labels[client.setup] || "Not checked";
17
17
  }
18
18
  export function projectTerminalState(data = {}) {
19
- const routes = data.requests?.by_route, names = ["responses", "responses_compact", "messages"];
19
+ const routes = data.requests?.by_route, names = ["responses", "responses_compact", "messages", "antigravity"];
20
20
  const partialRoutes = routes && names.some(name => routes[name]);
21
21
  const active = partialRoutes ? names.reduce((sum, name) => sum + (routes[name]?.active || 0), 0) : null;
22
22
  const requests = partialRoutes ? names.reduce((sum, name) => sum + (routes[name]?.total || 0), 0) : null;
23
23
  const claude = (data.providers?.claude || data.providers?.m365?.claude)?.requests?.performance;
24
24
  const performance = [data.stream_performance, claude].filter(Boolean);
25
25
  const outcomes = Object.fromEntries(["completed", "incomplete", "failed", "cancelled", "unknown"].map(key => [key,
26
- performance.flatMap(part => Object.entries(part.by_route || {}).filter(([route]) => part === claude ? route === "messages" : ["responses", "responses_compact"].includes(route)).map(([, row]) => row.terminal_outcomes?.totals || {}))
26
+ performance.flatMap(part => Object.entries(part.by_route || {}).filter(([route]) => part === claude ? route === "messages" : ["responses", "responses_compact", "antigravity"].includes(route)).map(([, row]) => row.terminal_outcomes?.totals || {}))
27
27
  .reduce((sum, row) => sum + (integer(row[key]) ? row[key] : 0), 0)]));
28
28
  const activity = Object.hasOwn(data.model_activity || {}, "active") ? integer(data.model_activity.active) ? data.model_activity.active : null : active;
29
- const running = [...new Map(performance.flatMap(part => (part.active_requests || []).filter(row => part === claude ? !row.route || row.route === "messages" : !row.route || ["responses", "responses_compact"].includes(row.route))).map((row, i) => [row.request_id || `unknown-${i}`, row])).values()];
29
+ const running = [...new Map(performance.flatMap(part => (part.active_requests || []).filter(row => part === claude ? !row.route || row.route === "messages" : !row.route || ["responses", "responses_compact", "antigravity"].includes(row.route))).map((row, i) => [row.request_id || `unknown-${i}`, row])).values()];
30
30
  const byApp = new Map();let unidentified = 0;
31
31
  for (const row of running) {
32
32
  const app = appIds[row.application];if (app) byApp.set(app, (byApp.get(app) || 0) + 1);else unidentified++;
@@ -37,6 +37,7 @@ export function projectTerminalState(data = {}) {
37
37
  ...[["app", "claude_app"], ["code", "claude_code"]].map(([key, id]) => ({ id, setup: data.providers?.m365?.claude?.clients?.[key] })),
38
38
  ]).map(client => ({ id: client.id, name: TERMINAL_CLIENT_NAMES[client.id] || terminalCell(client.name || client.id),
39
39
  setup: clientSetup(client.id === "codex" && !connection?.managed && !client.setup && data.client_integrations?.codex?.setup ? { ...client, setup: data.client_integrations.codex.setup } : client), active: running.length || active === 0 ? byApp.get(client.id) || 0 : null, observed_at: client.observed_at || null }));
40
+ if(data.gemini||byApp.has("antigravity"))clients.push({id:"antigravity",name:TERMINAL_CLIENT_NAMES.antigravity,setup:data.gemini?.enabled?"Configured":"Paused",active:byApp.get("antigravity")||0,observed_at:null});
40
41
  if (integer(active) && active > running.length) unidentified += active - running.length;
41
42
  if (unidentified) clients.push({ id: "other", name: "Other clients", setup: "Not identified", active: unidentified });
42
43
  const sources = connection?.providers?.filter(item => item.enabled && !(item.id === "m365" && data.providers?.m365?.enabled === false)).map(item => ({ id: item.id, name: terminalCell(item.name || item.id) }))