codex-copilot-dx 1.3.26 → 1.3.28

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 (42) hide show
  1. package/README.md +5 -2
  2. package/bin/cli.mjs +5 -2
  3. package/docs/ARCHITECTURE.md +16 -3
  4. package/docs/REFERENCE.md +28 -4
  5. package/package.json +1 -1
  6. package/src/adapter.mjs +4 -2
  7. package/src/claude-app-contract.mjs +96 -0
  8. package/src/claude-capability-config.mjs +26 -10
  9. package/src/claude-client-config.mjs +56 -7
  10. package/src/claude-gateway.mjs +7 -5
  11. package/src/claude-models.mjs +4 -2
  12. package/src/cli-command-spec.mjs +8 -2
  13. package/src/cli-management.mjs +26 -6
  14. package/src/client-versions.mjs +17 -13
  15. package/src/connection-client-sync.mjs +1 -0
  16. package/src/connection-management.mjs +5 -0
  17. package/src/connection-policy.mjs +2 -2
  18. package/src/connection-routing.mjs +2 -1
  19. package/src/connection-runtime.mjs +26 -2
  20. package/src/connection-view.mjs +11 -2
  21. package/src/dashboard/connections.js +33 -3
  22. package/src/dashboard/console.js +1 -1
  23. package/src/dashboard/context.js +8 -4
  24. package/src/dashboard/gemini.js +3 -7
  25. package/src/dashboard/index.html +5 -2
  26. package/src/dashboard/language.js +24 -0
  27. package/src/dashboard/status.js +8 -1
  28. package/src/dashboard/ui.js +3 -0
  29. package/src/dashboard-api.mjs +2 -2
  30. package/src/doctor-compat.mjs +1 -1
  31. package/src/model-capabilities.mjs +17 -4
  32. package/src/provider-cooldown.mjs +43 -0
  33. package/src/providers/api-model-metadata.mjs +7 -0
  34. package/src/providers/api.mjs +32 -11
  35. package/src/request-context.mjs +5 -0
  36. package/src/response-failures.mjs +4 -2
  37. package/src/safe-upstream-error.mjs +36 -4
  38. package/src/source-import.mjs +51 -0
  39. package/src/stream-performance.mjs +7 -5
  40. package/src/usage-analysis.mjs +2 -2
  41. package/src/usage-query.mjs +5 -2
  42. package/src/usage-store.mjs +2 -1
@@ -196,7 +196,7 @@ function createGuardedMessagesObserver(onEvent, maxBytes, clientModel, guard, re
196
196
  return { write: chunk => run("write", chunk), finish: () => run("finish") };
197
197
  }
198
198
 
199
- export function createClaudeGatewayHandler({ provider, apiKey, desktopAliases = false, messagesSystemMode = "passthrough", log = () => {}, onRequest = () => {}, env = process.env, performance: sharedPerformance, validateConversation,
199
+ export function createClaudeGatewayHandler({ provider, apiKey, desktopAliases = false, appContract, messagesSystemMode = "passthrough", log = () => {}, onRequest = () => {}, env = process.env, performance: sharedPerformance, validateConversation,
200
200
  resolveRequest, privacy, privacyClient = "claude", record = recordUsage, acquireRequest = createRequestAdmission({ maxBytes: 16 * 1024 * 1024, maxQueued: 8 }) } = {}) {
201
201
  if (!provider || !isProviderId(provider.id) || typeof apiKey !== "string" || apiKey.length < 32) throw new Error("Claude gateway requires a provider and private local key");
202
202
  const config = loadRuntimeConfig(env), performance = sharedPerformance || createStreamPerformanceMetrics({ routeNames: ["messages"] });
@@ -212,7 +212,9 @@ export function createClaudeGatewayHandler({ provider, apiKey, desktopAliases =
212
212
  if (req.method === "GET" && pathname === "/v1/models") {
213
213
  try {
214
214
  const entries = provider.models("claude");
215
- const models = claudeModelEntries(entries, { desktopAliases }).map((entry, index) => ({ id: entry.name, type: "model", ...(entry.supports1m ? { supports_1m: true } : {}), display_name: entry.labelOverride || typeof entries[index].name === "string" && entries[index].name || entry.name }));
215
+ const models = claudeModelEntries(entries, { desktopAliases, appContract }).map((entry, index) => ({ id: entry.name, type: "model", ...(entry.supports1m ? { supports_1m: true } : {}),
216
+ ...(entry.behavesAs ? { behaves_as: entry.behavesAs, max_effort_level: entry.maxEffort } : {}),
217
+ display_name: entry.labelOverride || typeof entries[index].name === "string" && entries[index].name || entry.name }));
216
218
  send(res, 200, { data: models, has_more: false, first_id: models[0]?.id || null, last_id: models.at(-1)?.id || null });
217
219
  } catch (error) { send(res, 503, apiError(error.code || "ccdx_catalog_unavailable", "Claude model discovery is unavailable; refresh the provider catalog.")); }
218
220
  return;
@@ -223,14 +225,14 @@ export function createClaudeGatewayHandler({ provider, apiKey, desktopAliases =
223
225
  const parent = currentRequestContext();
224
226
  if (parent) parent.provider = provider.id;
225
227
  const countTokens = pathname.endsWith("/count_tokens"), requestId = parent?.requestId || randomUUID();
226
- const tracker = countTokens ? parent?.streamPerformance : performance.begin("messages", { requestId, application: requestApplication(req.headers, "claude") });
228
+ const tracker = countTokens ? parent?.streamPerformance : performance.begin("messages", { requestId, purpose: req.headers["x-ccdx-purpose"], application: requestApplication(req.headers, "claude") });
227
229
  if (!resolveRequest) tracker?.setProvider(provider.id);
228
230
  const abort = createRequestAbort(req, res);
229
231
  let release = () => {}, conversation, outcome = "failed", model = null, configuredModel = null, clientModel = null, responseId = null, usage = null, stopReason = null, streamed = false, sawStop = false, failedEvent = false;
230
232
  let selectedModel, selectedCapability;
231
233
  let terminalOrigin = "client_validation", failureStatus = null, countDeadline = null, rejectionReason;
232
234
  if (!countTokens) { stats.total++;stats.active++;stats.last_request_at = new Date().toISOString(); }
233
- const context = parent || { requestId };
235
+ const context = parent || { requestId, purpose: req.headers["x-ccdx-purpose"] };
234
236
  context.provider = selectedProvider.id;context.application = requestApplication(req.headers, "claude");
235
237
  context.streamPerformance = tracker;context.route = countTokens ? "messages_count_tokens" : "messages";
236
238
  await runWithRequestContext(context, async () => {
@@ -265,7 +267,7 @@ export function createClaudeGatewayHandler({ provider, apiKey, desktopAliases =
265
267
  stats.last_model = model;
266
268
  context.model = configuredModel || model;
267
269
  if (!countTokens) {
268
- markRequestObservation({ max_output_tokens_requested: body.max_tokens });
270
+ markRequestObservation({ max_output_tokens_requested: body.max_tokens, reasoning_effort_requested: body.output_config?.effort });
269
271
  observeMessagesWindow(selectedProvider, configuredModel || model, selectedCapability, selectedModel);
270
272
  }
271
273
  tracker?.setModel(configuredModel || model, { configured: Boolean(configuredModel) });
@@ -2,6 +2,7 @@ import { modelReasoningEfforts } from "./provider-metadata.mjs";
2
2
  import { createHash } from "node:crypto";
3
3
  import { modelDisplayName } from "./model-display.mjs";
4
4
  import { claudeEffortPrefix } from "./model-capabilities.mjs";
5
+ import { claudeNativeModelHint } from "./claude-app-contract.mjs";
5
6
 
6
7
  const EFFORTS = ["low", "medium", "high", "xhigh", "max"];
7
8
 
@@ -19,7 +20,7 @@ function desktopModelId(id) {
19
20
  return `ccdx/claude-compatible-${BigInt(`0x${digest}`).toString(10)}`;
20
21
  }
21
22
 
22
- export function claudeModelEntries(models, { desktopAliases = false } = {}) {
23
+ export function claudeModelEntries(models, { desktopAliases = false, appContract } = {}) {
23
24
  const ids = new Set(), upstreamIds = new Set(models.map(model => model.id));
24
25
  return models.map(model => {
25
26
  const name = model.client_id || (desktopAliases ? desktopModelId(model.id) : claudeClientModelId(model.id));
@@ -28,7 +29,8 @@ export function claudeModelEntries(models, { desktopAliases = false } = {}) {
28
29
  const advertised = model.capability?.values.reasoning === false ? [] : model.capability?.values.reasoning_efforts || modelReasoningEfforts(model);
29
30
  const prefix = /^mythos-ccdx-\d+$/.test(name) ? claudeEffortPrefix(model.capability?.values) : [];
30
31
  const maxEffort = prefix.at(-1) || EFFORTS.filter(value => advertised?.includes(value)).at(-1);
31
- return { name, ...(model.display_name || name !== claudeClientModelId(model.id) ? { labelOverride: modelDisplayName(model) } : {}),
32
+ const hint = claudeNativeModelHint(model.capability?.values, appContract);
33
+ return { name, ...(hint || {}), ...(model.display_name || name !== claudeClientModelId(model.id) ? { labelOverride: modelDisplayName(model) } : {}),
32
34
  ...(model.capability?.values.context_window >= 1000000 ? { supports1m: true } : {}), ...(maxEffort ? { maxEffort } : {}) };
33
35
  });
34
36
  }
@@ -56,6 +56,9 @@ export const MANAGED_COMMANDS = [
56
56
  )
57
57
  ),
58
58
  command("source list", "List registered model sources", read),
59
+ command("source import", "Preview supplied CCDX, CC Switch or Magpie API metadata; apply one explicitly", {
60
+ ...read, "--file": "value", "--select": "integer", "--apply": "flag", "--key-stdin": "flag", ...confirm,
61
+ }),
59
62
  command("source add", "Save an API and read its model catalog", {
60
63
  "--file": "value",
61
64
  "--key-stdin": "flag",
@@ -176,6 +179,7 @@ export const MANAGED_COMMANDS = [
176
179
  "--failed": "flag",
177
180
  "--app": "value",
178
181
  "--source": "value",
182
+ "--purpose": "purpose",
179
183
  "--limit": "integer",
180
184
  }),
181
185
  command("requests show <request>", "Show a retained request and its original diagnostic fields", read),
@@ -185,6 +189,7 @@ export const MANAGED_COMMANDS = [
185
189
  "--scope": "scope",
186
190
  "--provider": "value",
187
191
  "--model": "value",
192
+ "--purpose": "purpose",
188
193
  "--days": "value",
189
194
  "--from": "value",
190
195
  "--to": "value",
@@ -226,6 +231,7 @@ function optionsFor(args, definition) {
226
231
  if (type === "format" && !["table", "plain", "json"].includes(value))
227
232
  throw new Error("Format must be table, plain or json");
228
233
  if (type === "scope" && !["run", "all"].includes(value)) throw new Error("Scope must be run or all");
234
+ if (type === "purpose" && !["conversation", "diagnostic", "compatibility", "unknown"].includes(value)) throw new Error("Purpose must be conversation, diagnostic, compatibility or unknown");
229
235
  if (type === "integer" && (!/^\d+$/.test(value) || Number(value) < 1 || Number(value) > 100))
230
236
  throw new Error("Limit must be an integer from 1 to 100");
231
237
  values[key] = type === "integer" ? Number(value) : value;
@@ -276,7 +282,7 @@ export function parseManagedCommand(args) {
276
282
 
277
283
  const extras = {
278
284
  source:
279
- "Status reads local/cached evidence. check/--refresh may contact the source; no inference.\nSource access grants do not select client models. Disable previews affected clients.\nGitHub login and company-account selection are source-specific.\nChoose visible models and defaults with app <app> models --edit.",
285
+ "Status reads local/cached evidence. check/--refresh may contact the source; no inference.\nsource import --file FILE previews supplied metadata. --select N --apply saves one source using private key input; no client access is granted.\nSource access grants do not select client models. Disable previews affected clients.\nGitHub login and company-account selection are source-specific.\nChoose visible models and defaults with app <app> models --edit.",
280
286
  app: "Configured is not App adoption or process liveness. Unknown stays unknown.\nmodels shows the selected plan; source <id> models shows the upstream catalog.\nsetup/remove changes integration setup; pause/resume retains credentials.\nsync --preview shows the model/configuration plan, not a byte-level file diff.\nNo client program is force-restarted.",
281
287
  config:
282
288
  "Only service and terminal preferences are in scope. Browser appearance stays in WebUI.\nReset keeps accounts, keys, model plans and chats and stores a pre-reset backup.\nSaved and effective values can differ; restart requirements remain explicit.",
@@ -285,7 +291,7 @@ const extras = {
285
291
  status:
286
292
  "Default interactive status is brief; --details retains the complete diagnostic view.\nThe installed package version can differ from the running service.\nA listening gateway does not prove upstream model access.",
287
293
  usage:
288
- "Default usage includes all recorded usage. Filter it with --provider, --model and --days 1..365|all, or --from/--to YYYY-MM-DD.\nDates use --time-zone (UTC by default). Source-qualified models use 'source / model'.\n--scope run reads the running service and supports only --provider.\nGemini usage includes Antigravity Copilot and native Google responses. Missing upstream counts stay unknown; historical missing usage is not reconstructed.\nUsage records are not billed request counts. Cache hit is a token-reuse estimate.",
294
+ "Default usage includes all recorded usage. Filter it with --provider, --model, --purpose and --days 1..365|all, or --from/--to YYYY-MM-DD.\nPurpose: conversation, diagnostic, compatibility or unknown. Older records without a purpose remain unknown; every purpose stays in default totals.\nDates use --time-zone (UTC by default). Source-qualified models use 'source / model'.\n--scope run reads the running service and supports only --provider.\nGemini usage includes Antigravity Copilot and native Google responses. Missing upstream counts stay unknown; historical missing usage is not reconstructed.\nUsage records are not billed request counts. Cache hit is a token-reuse estimate.",
289
295
  doctor:
290
296
  "Default checks are read-only. Explicit online/compatibility checks and owned repairs have separate options.",
291
297
  update:
@@ -12,6 +12,8 @@ import { hiddenQuestion } from "./cli-secret.mjs";
12
12
  import { readBoundedFileSync } from "./bounded-file.mjs";
13
13
  import { deploymentModelId } from "./model-capabilities.mjs";
14
14
  import { TERMINAL_COLOR_THEMES } from "./terminal-colors.mjs";
15
+ import { previewSourceImport } from "./source-import.mjs";
16
+ import { readAccessSettings } from "./access-settings.mjs";
15
17
 
16
18
  async function readSecretInput(input) {
17
19
  const chunks = [];let bytes = 0;
@@ -115,20 +117,20 @@ export async function runManagementCommand(command, options = {}) {
115
117
  const found = rows.find(row => row.request_id === ids.request);if (!found) throw new Error("Request not retained. No full-history lookup is available.");return print(found);
116
118
  }
117
119
  rows = rows.filter(row => (!flags.active || row.active) && (!flags.failed || row.state !== "cancelled" && (row.state === "failed" || row.error))
118
- && (!flags.source || row.provider === flags.source) && (!flags.app || (flags.app === "codex" ? ["codex", "codex_app", "codex_cli"].includes(row.application) : row.application === (flags.app === "antigravity" ? "gemini_app" : CLI_CLIENTS[flags.app])))).slice(-(flags.limit || 20));
120
+ && (!flags.purpose || (row.purpose || "unknown") === flags.purpose) && (!flags.source || row.provider === flags.source) && (!flags.app || (flags.app === "codex" ? ["codex", "codex_app", "codex_cli"].includes(row.application) : row.application === (flags.app === "antigravity" ? "gemini_app" : CLI_CLIENTS[flags.app])))).slice(-(flags.limit || 20));
119
121
  return print(flags.format === "json" ? rows : rows.map(row => ({ ...row, state_label: terminalRequestState(row) })), [["request_id", "Request"], ["application", "Client"], ["provider", "Source"], ["model", "Model"], ["route", "Route"], ["state_label", "State"]]);
120
122
  }
121
123
  if (group === "usage") {
122
124
  if (flags.scope === "run") {
123
- if (flags.model || flags.days || flags.from || flags.to || flags.time_zone) throw new Error("Model and date filters require --scope all; current-run totals support only --provider.");
125
+ if (flags.purpose || flags.model || flags.days || flags.from || flags.to || flags.time_zone) throw new Error("Model and date filters require --scope all; current-run totals support only --provider.");
124
126
  const usage = (await readStatus()).data.runtime_usage;
125
127
  if (!usage) throw new Error("Current-run usage is unavailable.");
126
128
  return print(flags.provider ? usage.by_provider?.[flags.provider] || { records: 0 } : usage);
127
129
  }
128
130
  const { summarizeUsageLogs } = await import("./usage-store.mjs");
129
131
  const { createUsageQuery } = await import("./usage-query.mjs");
130
- const selection = createUsageQuery({ provider: flags.provider, model: flags.model, days: flags.days, from: flags.from, to: flags.to, timeZone: flags.time_zone });
131
- const filtered = selection.filters.model || selection.filters.from || selection.filters.to;
132
+ const selection = createUsageQuery({ provider: flags.provider, model: flags.model, purpose: flags.purpose, days: flags.days, from: flags.from, to: flags.to, timeZone: flags.time_zone });
133
+ const filtered = selection.filters.purpose || selection.filters.model || selection.filters.from || selection.filters.to;
132
134
  const summary = await summarizeUsageLogs(undefined, { ...(flags.provider ? { provider: flags.provider } : {}), ...(filtered ? { recordFilter: selection.matches } : {}) });
133
135
  summary.filters = selection.filters;
134
136
  if (flags.format === "json") return print(summary);
@@ -241,7 +243,7 @@ export async function runManagementCommand(command, options = {}) {
241
243
  return print({ id: ids.app, access: client.enabled ? clientSetup(client) === "Paused" ? "Paused" : "Enabled" : "Disabled", setup: view.clients.find(row => row.id === id)?.setup || clientSetup(client),
242
244
  selected_models: Array.isArray(client.deployments) ? client.deployments.length : modelPlan?.models.length ?? null, unavailable_selection: (modelPlan?.unavailable || []).filter(model => !modelPlan?.available.some(candidate => candidate.source === model.source && candidate.id === model.id)),
243
245
  app_adoption: view.clients.find(row => row.id === id)?.active > 0 ? "Active gateway request observed; process liveness not checked" : observed ? `Gateway request observed${observed.at || observed.time ? ` at ${observed.at || observed.time}` : ""}; process liveness not checked` : client.observed_at ? `Gateway request observed at ${client.observed_at}; process liveness not checked` : "Not observed",
244
- active: view.clients.find(row => row.id === id)?.active ?? null, ...(id === "codex" && flags.details ? { features: details, chatgpt_sign_in: "Managed by Codex; not inferred from GitHub credentials" } : {}) });
246
+ active: view.clients.find(row => row.id === id)?.active ?? null, ...(id.startsWith("claude_") && flags.details ? { capability_support: modelPlan?.support, capability_adoption: client.capability_adoption, capability_sync: modelPlan?.sync } : {}), ...(id === "codex" && flags.details ? { features: details, chatgpt_sign_in: "Managed by Codex; not inferred from GitHub credentials" } : {}) });
245
247
  }
246
248
  if (action === "models" && !flags.edit) {
247
249
  if (flags.format === "json") return print(modelPlan);
@@ -313,6 +315,24 @@ export async function runManagementCommand(command, options = {}) {
313
315
  const result = await save(imageOnly ? { operation: "image_model", id: "codex", model: body.image_model, client_revision: client.revision } : body);return print({ client: ids.app, setup: getClient(result, id).setup, saved: true, app_adoption: "Not verified" });
314
316
  }
315
317
  if (group !== "source") throw new Error("Unknown management command.");
318
+ if (action === "import") {
319
+ if (!flags.file) throw new Error("Supply one explicit JSON file with --file.");
320
+ const preview = previewSourceImport(readFile(), readAccessSettings(options).apis);
321
+ if (!flags.apply || flags.preview) return print(preview);
322
+ const selected = preview.drafts[(flags.select || 0) - 1];
323
+ if (!selected) throw new Error("Review the preview, then use --select NUMBER --apply for one source.");
324
+ output.write(print(selected) + "\n");
325
+ const graph = await connection();requireManagement();
326
+ if (graph.providers.some(source => source.name?.trim().toLowerCase() === selected.config.name.trim().toLowerCase())) throw new Error("A source with this name exists. Edit its settings explicitly, or rename the imported draft.");
327
+ let key;
328
+ if (!selected.config.key_env) {
329
+ if (!flags.key_stdin) throw new Error("Use --key-stdin or a configured key_env; foreign credential values are not copied.");
330
+ key = await readSecretInput(input);
331
+ }
332
+ await confirm("Save this one API without granting client access or selecting models?");
333
+ const result = await save({ operation: "save_api", config: selected.config, allowed: [], ...(key ? { key } : {}) });key = undefined;
334
+ return print({ saved: true, source: result.providers.find(source => source.name === selected.config.name)?.id, authorized_clients: [] });
335
+ }
316
336
  let graph = await connection();
317
337
  if (!flags.preview && (flags.edit || ["add", "edit", "enable", "disable", "remove"].includes(action))) requireManagement();
318
338
  if (action === "list") return print(graph.providers.map(source => ({ id: source.id, name: source.name, enabled: source.enabled, key_saved: source.builtin ? undefined : source.key_saved })), [["id", "ID"], ["name", "Source"], ["enabled", "Enabled"]]);
@@ -325,7 +345,7 @@ export async function runManagementCommand(command, options = {}) {
325
345
  if (action === "models") return print({ source: id, evidence: "Saved API model selection; access not checked", models: source.models });
326
346
  const diagnostics = await request({ path: "providers" }), observed = diagnostics.providers.find(provider => provider.id === id);
327
347
  return print({ id, name: source.name, saved_enabled: source.enabled, runtime_state: observed?.state || "Not observed", credentials: source.builtin ? observed?.auth : { key_saved: source.key_saved },
328
- catalog: observed?.models || source.discovery || { count: source.models?.length ?? null, source: "configured" }, access: "Not inferred from saved credentials or configuration", diagnostic: observed?.catalog_diagnostic || null });
348
+ catalog: observed?.models || source.discovery || { count: source.models?.length ?? null, source: "configured" }, health: observed?.health || source.discovery?.health || null, access: "Not inferred from saved credentials or configuration", diagnostic: observed?.catalog_diagnostic || null });
329
349
  }
330
350
  if (action === "check" || action === "models" && flags.refresh) {
331
351
  if (!source.enabled || id === "m365" && graph.m365_state === "disabled") throw new Error("Source is disabled; it was not enabled automatically.");
@@ -6,6 +6,10 @@ import { readBoundedFile } from "./bounded-file.mjs";
6
6
  import { userSettingsPath } from "./user-settings.mjs";
7
7
 
8
8
  const MAX_METADATA_BYTES = 64 * 1024;
9
+ const MAX_APPS = 9;
10
+ export const clientVersionName = client => ({ codex: "Codex App", claude: "Claude App", antigravity: "Antigravity" })[client] || client;
11
+ const validId = value => /^(?:codex|claude)_(?:system|user|windows)_(?:chatgpt|codex|claude)$/.test(value)
12
+ || /^antigravity_(?:system|user)_gemini$/.test(value);
9
13
  const validVersion = value => typeof value === "string" && /^[0-9][0-9A-Za-z.+_-]{0,63}$/.test(value);
10
14
  const optionalVersion = value => value == null || validVersion(value);
11
15
  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);
@@ -29,7 +33,7 @@ async function stableRead(file) {
29
33
 
30
34
  async function macBundle(root, scope, name, client) {
31
35
  const bundle = path.join(root, name), infoPath = path.join(bundle, "Contents", "Info.plist"), info = await stableRead(infoPath), plist = info.data;
32
- const expected = client === "codex" ? "com.openai.codex" : "com.anthropic.claudefordesktop";
36
+ const expected = client === "codex" ? "com.openai.codex" : client === "claude" ? "com.anthropic.claudefordesktop" : "com.google.GeminiMacOS";
33
37
  const version = tag(plist, "CFBundleShortVersionString"), build = tag(plist, "CFBundleVersion");
34
38
  if (tag(plist, "CFBundleIdentifier") !== expected || !validVersion(version) || !optionalVersion(build)) return null;
35
39
  let cliVersion = null;
@@ -45,7 +49,7 @@ export async function inspectInstalledClientVersions({ home = os.homedir(), env
45
49
  systemApplications = "/Applications", windowsCodexVersion } = {}) {
46
50
  if (platform === "darwin") {
47
51
  const roots = [["system", systemApplications], ["user", path.join(home, "Applications")]], jobs = [];
48
- for (const [scope, root] of roots) for (const [name, client] of [["ChatGPT.app", "codex"], ["Codex.app", "codex"], ["Claude.app", "claude"]]) {
52
+ for (const [scope, root] of roots) for (const [name, client] of [["ChatGPT.app", "codex"], ["Codex.app", "codex"], ["Claude.app", "claude"], ["Gemini.app", "antigravity"]]) {
49
53
  jobs.push(macBundle(root, scope, name, client).catch(() => null));
50
54
  }
51
55
  return (await Promise.all(jobs)).filter(Boolean);
@@ -62,15 +66,15 @@ export function createClientVersionMonitor({ home = os.homedir(), env = process.
62
66
  inspect = inspectInstalledClientVersions, persist = true, timeoutMs = 3000, now = Date.now, onChange = () => {}, ...options } = {}) {
63
67
  const file = path.join(path.dirname(userSettingsPath({ home, env })), "client-versions.json");
64
68
  let saved, writable = true, flight = null, closed = false;
65
- let state = { checked_at: null, codex: [], claude: [], claude_unrecognized: false, persistence: "unknown" };
69
+ let state = { checked_at: null, codex: [], claude: [], antigravity: [], claude_unrecognized: false, persistence: "unknown" };
66
70
  const snapshot = () => structuredClone(state);
67
71
  async function load() {
68
72
  if (saved) return saved;
69
73
  try {
70
74
  const value = JSON.parse(await readBoundedFile(file, { maxBytes: MAX_METADATA_BYTES, encoding: "utf8" }));
71
75
  if (!fields(value, ["version", "apps"]) || value.version !== 1 || !value.apps || typeof value.apps !== "object" || Array.isArray(value.apps)
72
- || Object.entries(value.apps).length > 7 || Object.entries(value.apps).some(([id, entry]) =>
73
- !/^(?:codex|claude)_(?:system|user|windows)_(?:chatgpt|codex|claude)$/.test(id) || !validEntry(entry))) throw new Error("Invalid saved App versions");
76
+ || Object.entries(value.apps).length > MAX_APPS || Object.entries(value.apps).some(([id, entry]) =>
77
+ !validId(id) || !validEntry(entry))) throw new Error("Invalid saved App versions");
74
78
  saved = value.apps;
75
79
  } catch (error) {
76
80
  if (error.code !== "ENOENT") writable = false;
@@ -80,12 +84,12 @@ export function createClientVersionMonitor({ home = os.homedir(), env = process.
80
84
  }
81
85
  async function run() {
82
86
  const baseline = await load(), rows = await inspect({ home, env, platform, ...options });
83
- if (!Array.isArray(rows) || rows.length > 7) throw new Error("Invalid App version results");
87
+ if (!Array.isArray(rows) || rows.length > MAX_APPS) throw new Error("Invalid App version results");
84
88
  const at = new Date(now()).toISOString(), next = { ...baseline }, updates = [];
85
- const groups = { codex: [], claude: [] };
89
+ const groups = { codex: [], claude: [], antigravity: [] };
86
90
  for (const row of rows) {
87
- if (!/^(?:codex|claude)_(?:system|user|windows)_(?:chatgpt|codex|claude)$/.test(row.id || "")
88
- || !["codex", "claude"].includes(row.client) || !validVersion(row.version) || !optionalVersion(row.build) || !optionalVersion(row.cli_version)) continue;
91
+ if (!validId(row.id || "")
92
+ || !["codex", "claude", "antigravity"].includes(row.client) || !validVersion(row.version) || !optionalVersion(row.build) || !optionalVersion(row.cli_version)) continue;
89
93
  const current = installed(row), previous = baseline[row.id];let entry;
90
94
  if (!previous) entry = { ...current, previous: null, changed_at: null };
91
95
  else if (changed(previous, current)) {
@@ -116,10 +120,10 @@ export function createClientVersionMonitor({ home = os.homedir(), env = process.
116
120
  const timeout = new Promise(resolve => { timer = setTimeout(() => resolve(null), timeoutMs); });
117
121
  const result = Promise.race([work, timeout]).then(value => {
118
122
  if (value) return value;
119
- state = { ...state, checked_at: new Date(now()).toISOString(), codex: [], claude: [], persistence: "unavailable" };
123
+ state = { ...state, checked_at: new Date(now()).toISOString(), codex: [], claude: [], antigravity: [], persistence: "unavailable" };
120
124
  return snapshot();
121
125
  }).catch(() => {
122
- state = { ...state, checked_at: new Date(now()).toISOString(), codex: [], claude: [], persistence: "unavailable" };
126
+ state = { ...state, checked_at: new Date(now()).toISOString(), codex: [], claude: [], antigravity: [], persistence: "unavailable" };
123
127
  return snapshot();
124
128
  }).finally(() => clearTimeout(timer));
125
129
  task = { result };flight = task;
@@ -130,8 +134,8 @@ export function createClientVersionMonitor({ home = os.homedir(), env = process.
130
134
  }
131
135
 
132
136
  export function clientVersionChecks(snapshot) {
133
- return ["codex", "claude"].map(client => {
134
- const rows = snapshot?.[client] || [], name = client === "codex" ? "Codex App" : "Claude App";
137
+ return ["codex", "claude", "antigravity"].map(client => {
138
+ const rows = snapshot?.[client] || [], name = clientVersionName(client);
135
139
  if (!rows.length) return { id: "client-versions", kind: "info", message: `${name}: installed version not observed` };
136
140
  const versions = rows.map(row => `${row.name} ${row.version}${row.build ? ` (build ${row.build})` : ""}${row.cli_version ? `, CLI ${row.cli_version}` : ""}${row.changed_at ? `, changed ${row.changed_at}` : ""}`).join("; ");
137
141
  return { id: "client-versions", kind: "info", message: `${name}: ${versions}. Running version and feature compatibility are not confirmed` };
@@ -105,6 +105,7 @@ export function createConnectionClientSync({ options, corePort, configureCodex,
105
105
  client: id,
106
106
  profileName: "CCDX",
107
107
  desktopAliases: id === "claude_app" && source?.id.startsWith("api_"),
108
+ appContract: capabilitySupport.app_contract,
108
109
  disableExperimentalBetas: m365Only,
109
110
  desktopManaged: id === "claude_app" ? desktopManaged : false,
110
111
  baseUrl: `http://127.0.0.1:${corePort}/anthropic`,
@@ -1,3 +1,4 @@
1
+ import { previewSourceImport } from "./source-import.mjs";
1
2
  import { prepareSourceAccess, accessError, CLIENT_IDS } from "./access-settings.mjs";
2
3
  import { publicModelCatalog } from "./provider-metadata.mjs";
3
4
  import { createConnectionPolicy } from "./connection-policy.mjs";
@@ -138,6 +139,10 @@ export function createConnectionManagement({ binding, catalogRefresh, save, disc
138
139
  if (binding("codex").enabled) void memoryModel.refresh();
139
140
  return snapshot();
140
141
  }
142
+ if (validObject(input, ["operation", "content"]) && input.operation === "preview_import") {
143
+ try { return previewSourceImport(input.content, getSettings().apis); }
144
+ catch (error) { throw accessError(/^ccdx_import_[a-z_]+$/.test(error.message) ? error.message : "ccdx_import_metadata_invalid"); }
145
+ }
141
146
  if (validObject(input, ["operation", "id"]) && input.operation === "source_catalog") {
142
147
  if (!["github", "m365", ...getSettings().apis.map(api => api.id)].includes(input.id))
143
148
  throw accessError("ccdx_connections_action_invalid");
@@ -176,7 +176,7 @@ export function createConnectionPolicy({ validObject, binding, catalogRefresh, s
176
176
  source: getSource,
177
177
  enabled,
178
178
  names,
179
- desktopEffortAliases: capabilitySupport.app,
179
+ desktopEffortAliases: capabilitySupport.app && capabilitySupport.app_aliases !== false,
180
180
  });
181
181
  if (c.default_model && !compiled.routes.has(c.default_model))
182
182
  throw accessError("ccdx_api_model_unavailable");
@@ -233,7 +233,7 @@ export function createConnectionPolicy({ validObject, binding, catalogRefresh, s
233
233
  binding: c,
234
234
  source: getSource,
235
235
  enabled,
236
- desktopEffortAliases: capabilitySupport.app,
236
+ desktopEffortAliases: capabilitySupport.app && capabilitySupport.app_aliases !== false,
237
237
  });
238
238
  const shared =
239
239
  input.id === "codex"
@@ -6,7 +6,7 @@ import { currentRequestContext } from "./request-context.mjs";
6
6
 
7
7
  export function createConnectionRouting({ legacy, legacyClaudeAccess, isManaged, getSettings, binding, plan, permitted, getSource,
8
8
  resolveDeployment, codexAccessMode, codexRequiresKey, requireCodexKey, identities, track, guardConversation, messagesTransfer,
9
- acquireClaudeRequest, privacy, env, log, lastClients }) {
9
+ acquireClaudeRequest, privacy, env, log, lastClients, capabilitySupport }) {
10
10
  const handlers = new Map();
11
11
  function requireSource(clientId, id) {
12
12
  if (!permitted(clientId, id)) throw accessError("ccdx_client_source_disabled", 503);
@@ -152,6 +152,7 @@ export function createConnectionRouting({ legacy, legacyClaudeAccess, isManaged,
152
152
  log,
153
153
  performance: legacy.claudePerformance,
154
154
  desktopAliases: id === "claude_app",
155
+ appContract: id === "claude_app" ? capabilitySupport?.app_contract : undefined,
155
156
  messagesSystemMode: id === "claude_app" ? "legacy" : "passthrough",
156
157
  resolveRequest(body) {
157
158
  const record = resolveDeployment(id, body.model),
@@ -30,6 +30,7 @@ import { createMessagesHistoryTransfer } from "./messages-history-transfer.mjs";
30
30
  import { compileClientModels } from "./client-model-plan.mjs";
31
31
  import { currentRequestContext } from "./request-context.mjs";
32
32
  import { inspectClaudeCapabilitySupport } from "./claude-capability-config.mjs";
33
+ import { inspectClaudeAppContract, watchClaudeAppContract } from "./claude-app-contract.mjs";
33
34
  import { deploymentModelId, deploymentRevision } from "./model-capabilities.mjs";
34
35
  import { m365Paths } from "./m365-settings.mjs";
35
36
 
@@ -45,6 +46,7 @@ export function createConnectionRuntime({
45
46
  restoreClaude = restoreClaudeClients,
46
47
  configureCodex = configureCodexApi,
47
48
  inspectDesktop = inspectClaudeDesktopPolicy,
49
+ inspectAppContract = inspectClaudeAppContract,
48
50
  clientAccessChanged,
49
51
  preserveClientConfiguration,
50
52
  clientVersionsSnapshot,
@@ -86,6 +88,20 @@ export function createConnectionRuntime({
86
88
  onState: (id, state) => (state ? discoveries.set(id, state) : discoveries.delete(id)),
87
89
  });
88
90
  const capabilitySupport = inspectClaudeCapabilitySupport(options);
91
+ let capabilityFlight = null, capabilityWatch = null;
92
+ const refreshClientCapabilities = ({ sync = true } = {}) => {
93
+ if(closed||!managed||!binding("claude_app").enabled||!plan("claude_app").models.length)return Promise.resolve(structuredClone(capabilitySupport));
94
+ if (capabilityFlight) return capabilityFlight;
95
+ capabilityFlight = inspectAppContract(options).then(async contract => {
96
+ if(closed)return;
97
+ const next=inspectClaudeCapabilitySupport({...options,appContract:contract});
98
+ const changed=capabilitySupport.app_contract?.fingerprint!==contract.fingerprint||capabilitySupport.app_contract?.installation!==contract.installation||capabilitySupport.app_version!==next.app_version||capabilitySupport.app!==next.app;
99
+ await enqueue(()=>{Object.assign(capabilitySupport,next);if(changed){plans.delete("claude_app");plans.delete("claude_code")}});
100
+ if(changed&&sync&&managed)await clientSync.syncClients(["claude_app","claude_code"]);
101
+ return structuredClone(capabilitySupport);
102
+ }).finally(()=>{capabilityFlight=null});
103
+ return capabilityFlight;
104
+ };
89
105
  let operations = 0;
90
106
  const identities = () => (keys ||= readClientGatewayKeys(options));
91
107
  const enabled = id =>
@@ -180,7 +196,7 @@ export function createConnectionRuntime({
180
196
  ["m365", "Microsoft 365"],
181
197
  ...settings.apis.map(api => [api.id, api.name]),
182
198
  ]),
183
- desktopEffortAliases: capabilitySupport.app,
199
+ desktopEffortAliases: capabilitySupport.app && capabilitySupport.app_aliases !== false,
184
200
  });
185
201
  plans.set(id, { binding: selected, stamps, value });
186
202
  return value;
@@ -259,7 +275,7 @@ export function createConnectionRuntime({
259
275
  clientRevision, editable, syncClients, clientAccessChanged, setup, secrets, lifecycle, retire, memoryModel, enqueue, catalogVisibility });
260
276
  const { requireSource, methods: routing } = createConnectionRouting({ legacy, legacyClaudeAccess, isManaged: () => managed,
261
277
  getSettings: () => settings, binding, plan, permitted, getSource, resolveDeployment, codexAccessMode, codexRequiresKey, requireCodexKey,
262
- identities, track, guardConversation, messagesTransfer, acquireClaudeRequest, privacy, env, log, lastClients });
278
+ identities, track, guardConversation, messagesTransfer, acquireClaudeRequest, privacy, env, log, lastClients, capabilitySupport });
263
279
 
264
280
 
265
281
  async function applyCatalog(id, models, revision, checkedAt, active) {
@@ -358,6 +374,7 @@ export function createConnectionRuntime({
358
374
  ),
359
375
  privacy,
360
376
  busy: () => privacy.busy() ||
377
+ Boolean(capabilityFlight) ||
361
378
  operations > 0 ||
362
379
  lifecycle.busy() ||
363
380
  clientSync.busy() ||
@@ -365,11 +382,15 @@ export function createConnectionRuntime({
365
382
  legacy.snapshot().m365.account_change_in_flight === true ||
366
383
  legacy.snapshot().m365.state === "checking",
367
384
  syncClients,
385
+ refreshClientCapabilities,
368
386
  manageConnections: management.manageConnections,
369
387
  imageModels,
370
388
  async start() {
389
+ const capabilities = refreshClientCapabilities({sync:false});
390
+ capabilityWatch ||= watchClaudeAppContract({ ...options, onChange: refreshClientCapabilities });
371
391
  if (binding("codex").enabled) void memoryModel.refresh();
372
392
  const old = legacy.start();
393
+ await capabilities;
373
394
  if (managed) await syncClients();
374
395
  const result = await old;
375
396
  if (managed) await syncClients();
@@ -377,6 +398,7 @@ export function createConnectionRuntime({
377
398
  return result;
378
399
  },
379
400
  async refresh() {
401
+ await refreshClientCapabilities();
380
402
  const result = await Promise.allSettled([
381
403
  !managed || settings.providers.m365 ? legacy.refresh() : Promise.resolve(),
382
404
  refreshApis(),
@@ -403,6 +425,8 @@ export function createConnectionRuntime({
403
425
  action: management.action,
404
426
  async close() {
405
427
  closed = true;
428
+ capabilityWatch?.close();
429
+ await capabilityFlight;
406
430
  privacy.close();
407
431
  await memoryModel.close();
408
432
  await catalogRefresh.close();
@@ -38,6 +38,12 @@ export function createConnectionView({ legacy, env, binding, plan, getSource, en
38
38
  return {
39
39
  ...base,
40
40
  revision,
41
+ ...(id.startsWith("claude_") ? { capability_adoption: (() => {
42
+ const rows = legacy.claudePerformance?.snapshot?.().recent_requests || [];
43
+ const observed = rows.findLast(row => row.application === id && row.context?.reasoning_effort_sent);
44
+ return observed ? { state: "effort_observed", effort: observed.context.reasoning_effort_sent, source: observed.provider, model: observed.model, request_id: observed.request_id, at: observed.at }
45
+ : { state: "not_observed" };
46
+ })() } : {}),
41
47
  model_plan: {
42
48
  ...(id === "codex" ? { image: imageModels() } : {}),
43
49
  default_model: compiled.defaultModel,
@@ -117,7 +123,9 @@ export function createConnectionView({ legacy, env, binding, plan, getSource, en
117
123
  },
118
124
  ...config.apis.map(api => {
119
125
  const { secret_ref, ...publicApi } = api,
120
- revision = compact ? null : deploymentRevision(api, env);
126
+ revision = compact ? null : deploymentRevision(api, env),
127
+ health = compact ? null : getSource(api.id)?.health?.(),
128
+ cooling = health && Object.values(health).some(item => item.state !== "ready");
121
129
  return {
122
130
  ...(compact ? { id: api.id, name: api.name, enabled: api.enabled } : publicApi),
123
131
  ...summary(api),
@@ -129,7 +137,7 @@ export function createConnectionView({ legacy, env, binding, plan, getSource, en
129
137
  api.models.map(model => [model.id, modelDisplay.get(api.id, revision, model.id)])
130
138
  ),
131
139
  }),
132
- discovery: discoveries.get(api.id) || null,
140
+ discovery: cooling ? { ...discoveries.get(api.id), health } : discoveries.get(api.id) || null,
133
141
  builtin: false,
134
142
  key_saved: api.key_env ? Boolean(env[api.key_env]) : Boolean(secret_ref),
135
143
  };
@@ -288,6 +296,7 @@ export function createConnectionView({ legacy, env, binding, plan, getSource, en
288
296
  enabled: true,
289
297
  generation: old?.generation || source?.registry.generation || 1,
290
298
  state: old?.state || "configured",
299
+ ...(source?.health ? { health: source.health() } : {}),
291
300
  auth: old?.auth || { state: "saved", token_cached: false },
292
301
  selection: {
293
302
  codex: clients.some(client => client.id === "codex"),
@@ -62,6 +62,7 @@
62
62
  const response = await fetch("/_ccdx/ui/connections", { method: input ? "POST" : "GET", headers: { "X-CCDX-Dashboard": "1", ...(input ? { "Content-Type": "application/json" } : {}) },
63
63
  cache: "no-store", signal: signal ? AbortSignal.any([signal, AbortSignal.timeout(35000)]) : AbortSignal.timeout(35000), ...(input ? { body: JSON.stringify(input) } : {}) });
64
64
  const result = await response.json();if (!response.ok) throw new Error(result.error || "ccdx_connections_action_failed");
65
+ if (input?.operation === "preview_import" && Array.isArray(result.drafts)) return result;
65
66
  if (result.source !== "connections" || !Array.isArray(result.providers) || !Array.isArray(result.clients)) throw new Error("ccdx_connections_unavailable");return result;
66
67
  }
67
68
  function panels(which = "list") {
@@ -83,6 +84,7 @@
83
84
  const row = node("div", undefined, "connection-row"), info = node("div"), actions = node("div", undefined, "connection-actions");info.append(node("h3", provider.enabled ? format("enable_service") : provider.name));
84
85
  if (!provider.builtin) info.append(node("p", provider.base_url, "hint"));
85
86
  if (provider.enabled) {
87
+ if (provider.discovery?.health) { const notice = node("p", undefined, "hint");words(notice, "source_cooling");info.append(notice); }
86
88
  if (provider.discovery?.state === "stale") { const warning = node("p", undefined, "hint");words(warning, "cap_catalog_stale");warning.append(" ", provider.discovery.code);info.append(warning); }
87
89
  if (!provider.builtin) actions.append(button("api_manage", () => editApi(provider)));
88
90
  const toggle = node("input");toggle.type = "checkbox";toggle.checked = true;toggle.setAttribute("role", "switch");toggle.setAttribute("aria-label", format("api_disable_source") + " " + provider.name);
@@ -201,9 +203,9 @@
201
203
  const advanced = node("details"), summary = node("summary");words(summary, "cap_manual");advanced.append(summary);detail.append(advanced);
202
204
  const note = node("p", undefined, "hint");words(note, "cap_metadata_scope");advanced.append(note);
203
205
  const fields = node("div", undefined, "connection-fields");
204
- const numeric = ["context_window", "max_input_tokens", "max_output_tokens", "reasoning_budget_min", "reasoning_budget_max"];
206
+ const numeric = ["context_window", "max_input_tokens", "max_output_tokens", "reasoning_budget_min", "reasoning_budget_max", "max_tool_definitions"];
205
207
  const flags = ["reasoning", "reasoning_required", "reasoning_adaptive", "tools", "parallel_tools", "streaming", "structured_output", "mid_conversation_system"];
206
- const arrays = ["reasoning_efforts", "thinking_modes", "input_modalities", "web_search"];
208
+ const arrays = ["reasoning_efforts", "thinking_modes", "input_modalities", "web_search", "supported_parameters"];
207
209
  for (const key of [...numeric, ...flags, ...arrays, "reasoning_format"]) {
208
210
  const label = node("label"), title = node("span");words(title, "cap_field_" + key);label.append(title);
209
211
  let input;
@@ -222,7 +224,7 @@
222
224
  words(status, fresh ? "cap_catalog_" + (model.metadata.state || "reported") : "cap_unknown");
223
225
  if (fresh && model.metadata.checked_at) status.append(" · ", new Date(model.metadata.checked_at).toLocaleString());
224
226
  body.replaceChildren();
225
- for (const key of ["context_window", "max_input_tokens", "max_output_tokens", "reasoning_efforts", "reasoning_adaptive", "tools", "input_modalities", "web_search"]) {
227
+ for (const key of ["context_window", "max_input_tokens", "max_output_tokens", "max_tool_definitions", "supported_parameters", "reasoning_efforts", "reasoning_adaptive", "tools", "input_modalities", "web_search"]) {
226
228
  const row = node("tr"), label = node("th");words(label, ({ reasoning_efforts: "cap_reasoning", input_modalities: "cap_input_types", web_search: "cap_search" })[key] || "cap_field_" + key);
227
229
  const value = values[key], text = key === "reasoning_efforts" ? reasoningText(values) : key === "web_search" ? searchText(values)
228
230
  : value === undefined ? format("cap_unknown") : typeof value === "boolean" ? format(value ? "cap_supported" : "cap_unsupported") : Array.isArray(value) ? value.join(" / ") || format("cap_unsupported") : count(value);
@@ -253,6 +255,10 @@
253
255
  if (preview?.image?.selected_model) { const image = node("p");image.textContent = `${format("image_model")}: ${preview.image.selected_model}`;result.append(image); }
254
256
  const note = node("p", undefined, "hint");words(note, "cap_preview_scope");result.append(note);
255
257
  const sync = preview?.shared || c.model_plan?.sync;
258
+ if (editingClient === "claude_app" && c.model_plan?.support?.app_contract?.status === "verified") {
259
+ const contract = node("p", undefined, "hint");words(contract, "cap_contract_checked", { version: c.model_plan.support.app_version });result.append(contract);
260
+ if (c.capability_adoption?.state === "effort_observed") { const observation = node("p", undefined, "hint");words(observation, "cap_effort_observed", { effort: c.capability_adoption.effort });result.append(observation); }
261
+ }
256
262
  if (c.credential_state === "encrypted_unverified") { const kept = node("p", undefined, "hint");words(kept, "client_key_encrypted_kept");result.append(kept); }
257
263
  if (sync) { const status = node("p", undefined, "hint");words(status, "cap_sync_" + sync.state);result.append(status);
258
264
  for (const limitation of sync.limitations || []) { const line = node("p", undefined, "hint");words(line, "cap_limit_" + limitation.code);if (limitation.model) line.prepend(limitation.model + ": ");result.append(line); }
@@ -508,6 +514,30 @@
508
514
  impact_revision: disableRevision,
509
515
  replacements: Object.fromEntries([...el("connection-replacements").querySelectorAll("select")].map(select => [select.name, select.value || null])) }); });
510
516
  el("connection-add").addEventListener("click", () => { if (data) editApi(); });
517
+ el("connection-import").addEventListener("click", () => { if (data && !busy) el("connection-import-file").click(); });
518
+ el("connection-import-file").addEventListener("change", async event => {
519
+ const file = event.target.files?.[0];event.target.value = "";if (!file) return;
520
+ const preview = el("connection-import-preview");preview.hidden = true;preview.replaceChildren();
521
+ if (file.size > 256 * 1024) { message("ccdx_import_size_invalid");return; }
522
+ try {
523
+ const result = await api({ operation: "preview_import", content: JSON.parse(await file.text()) });
524
+ const heading = node("h3");words(heading, "import_preview");preview.append(heading);
525
+ const note = node("p", undefined, "hint");words(note, "import_scope");preview.append(note);
526
+ for (const draft of result.drafts) {
527
+ const row = node("div", undefined, "connection-row"), info = node("div"), actions = node("div", undefined, "connection-actions");
528
+ info.append(node("h3", draft.config.name), node("p", draft.config.base_url, "hint"));
529
+ for (const warning of draft.warnings) { const text = node("p", undefined, "hint");words(text, "import_" + warning);info.append(text); }
530
+ actions.append(button("import_review", () => {
531
+ editApi();const config = draft.config;
532
+ apiForm.elements.name.value = config.name;apiForm.elements.base.value = config.base_url;apiForm.elements.auth_header.value = config.auth_header;
533
+ apiForm.elements.key_env.value = config.key_env || "";keyMode();
534
+ for (const input of apiForm.querySelectorAll('[name="protocol"]')) input.checked = Boolean(config.endpoints[input.value]);
535
+ setEndpoints(config.base_url, config.endpoints);models = structuredClone(config.models);selectedModels = new Set(models.map(model => model.id));modelRows();preview.hidden = true;
536
+ }));row.append(info, actions);preview.append(row);
537
+ }
538
+ preview.hidden = false;
539
+ } catch (error) { message(/^ccdx_import_/.test(error.message) ? error.message : "ccdx_import_format_invalid"); }
540
+ });
511
541
  for (const id of ["connection-cancel", "connection-disable-cancel"]) el(id).addEventListener("click", () => { panels();(editorOrigin?.isConnected ? editorOrigin : el("connection-source-list").querySelector("button") || el("connection-add")).focus(); });
512
542
  el("refresh").addEventListener("click", () => { if (["#models", "#codex", "#claude"].includes(location.hash)) void load(); });
513
543
  window.addEventListener("hashchange", () => { apiForm.elements.key.value = "";mountClient();if (["#models", "#claude", "#codex"].includes(location.hash)) void load(); });
@@ -9,7 +9,7 @@
9
9
  let accountsPending = false;
10
10
  const accountReasons = new Set(["m365_account_ambiguous", "m365_account_unavailable", "m365_account_conflict", "m365_interaction_required", "m365_llm_permission_unavailable", "m365_account_busy", "m365_account_selection_stale"]);
11
11
  function renderClientVersions(value) {
12
- for (const client of ["codex", "claude"]) {
12
+ for (const client of ["codex", "claude", "antigravity"]) {
13
13
  const node = el(`client-version-${client}`);if (!node) continue;
14
14
  const rows = Array.isArray(value?.[client]) ? value[client] : [];
15
15
  if (!rows.length) { node.removeAttribute("data-i18n");node.textContent = "—";node.title = "";continue; }