claudish 14.27.0 → 14.27.1

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 (2) hide show
  1. package/dist/index.js +716 -262
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -5542,7 +5542,7 @@ var init_env_placeholder = __esm(() => {
5542
5542
  });
5543
5543
 
5544
5544
  // src/version.ts
5545
- var VERSION = "14.27.0";
5545
+ var VERSION = "14.27.1";
5546
5546
 
5547
5547
  // src/redact.ts
5548
5548
  function isPlaceholder(value) {
@@ -14145,7 +14145,7 @@ var init_bundled_recommended_list = __esm(() => {
14145
14145
  }
14146
14146
  }
14147
14147
  },
14148
- fetchedAt: "2026-11-16T00:56:54.374Z",
14148
+ fetchedAt: "2026-11-16T12:10:44.345Z",
14149
14149
  format: 1,
14150
14150
  recommendations: {
14151
14151
  contractVersion: 3,
@@ -23351,11 +23351,25 @@ var init_gemini_api_format = __esm(() => {
23351
23351
  init_base_api_format();
23352
23352
  GeminiAPIFormat = class GeminiAPIFormat extends BaseAPIFormat {
23353
23353
  thinkingFromModelName;
23354
+ serverCallIds;
23354
23355
  constructor(modelId, wireFormat, options = {}) {
23355
23356
  super(modelId, wireFormat);
23356
23357
  this.thinkingFromModelName = options.thinkingFromModelName === true;
23358
+ this.serverCallIds = options.serverCallIds === true;
23357
23359
  }
23358
23360
  toolCallMap = new Map;
23361
+ functionResponsePart(toolInfo, text) {
23362
+ if (!this.serverCallIds) {
23363
+ return { functionResponse: { name: toolInfo.name, response: { content: text } } };
23364
+ }
23365
+ return {
23366
+ functionResponse: {
23367
+ ...toolInfo.callId ? { id: toolInfo.callId } : {},
23368
+ name: toolInfo.name,
23369
+ response: { output: text }
23370
+ }
23371
+ };
23372
+ }
23359
23373
  callIdOf = new WeakMap;
23360
23374
  convertMessages(claudeRequest, _filterIdentityFn) {
23361
23375
  const messages = [];
@@ -23446,25 +23460,11 @@ var init_gemini_api_format = __esm(() => {
23446
23460
  textParts.push(item.text);
23447
23461
  }
23448
23462
  }
23449
- parts.push({
23450
- functionResponse: {
23451
- name: toolInfo.name,
23452
- response: {
23453
- content: textParts.join(`
23454
- `) || "OK"
23455
- }
23456
- }
23457
- });
23463
+ parts.push(this.functionResponsePart(toolInfo, textParts.join(`
23464
+ `) || "OK"));
23458
23465
  parts.push(...imageParts);
23459
23466
  } else {
23460
- parts.push({
23461
- functionResponse: {
23462
- name: toolInfo.name,
23463
- response: {
23464
- content: typeof block.content === "string" ? block.content : JSON.stringify(block.content)
23465
- }
23466
- }
23467
- });
23467
+ parts.push(this.functionResponsePart(toolInfo, typeof block.content === "string" ? block.content : JSON.stringify(block.content)));
23468
23468
  }
23469
23469
  for (const part of parts.slice(firstResultPart)) {
23470
23470
  this.callIdOf.set(part, block.tool_use_id);
@@ -23485,12 +23485,14 @@ var init_gemini_api_format = __esm(() => {
23485
23485
  } else if (block.type === "tool_use") {
23486
23486
  const toolInfo = this.toolCallMap.get(block.id);
23487
23487
  let thoughtSignature = toolInfo?.thoughtSignature;
23488
- if (!thoughtSignature) {
23488
+ const sentUnsigned = this.serverCallIds && toolInfo?.fromResponse === true;
23489
+ if (!thoughtSignature && !sentUnsigned) {
23489
23490
  thoughtSignature = "skip_thought_signature_validator";
23490
23491
  log(`[GeminiAPIFormat] Using dummy thoughtSignature for tool ${block.name} (${block.id})`);
23491
23492
  }
23492
23493
  const functionCallPart = {
23493
23494
  functionCall: {
23495
+ ...this.serverCallIds && toolInfo?.callId ? { id: toolInfo.callId } : {},
23494
23496
  name: block.name,
23495
23497
  args: block.input
23496
23498
  }
@@ -23619,8 +23621,8 @@ CRITICAL INSTRUCTION FOR OUTPUT FORMAT:
23619
23621
  return 8192;
23620
23622
  }
23621
23623
  }
23622
- registerToolCall(toolId, name, thoughtSignature) {
23623
- this.toolCallMap.set(toolId, { name, thoughtSignature });
23624
+ registerToolCall(toolId, name, thoughtSignature, callId) {
23625
+ this.toolCallMap.set(toolId, { name, thoughtSignature, callId, fromResponse: true });
23624
23626
  if (thoughtSignature) {
23625
23627
  log(`[GeminiAPIFormat] Captured thoughtSignature for tool ${name} (${toolId})`);
23626
23628
  }
@@ -34182,22 +34184,28 @@ var init_codex2 = __esm(() => {
34182
34184
  function getAgyClientVersion() {
34183
34185
  return version2;
34184
34186
  }
34187
+ function getAgyClientBuild() {
34188
+ return build;
34189
+ }
34185
34190
  function agyClientVersionReadFor(accessToken) {
34186
34191
  return readForToken === accessToken;
34187
34192
  }
34188
- function recordAgyClientVersionRead(read, accessToken) {
34193
+ function recordAgyClientVersionRead(read, accessToken, readBuild = null) {
34189
34194
  readForToken = accessToken;
34190
- if (read === null || read === version2)
34195
+ if (read === null)
34196
+ return false;
34197
+ build = readBuild;
34198
+ if (read === version2)
34191
34199
  return false;
34192
34200
  version2 = read;
34193
34201
  return true;
34194
34202
  }
34195
- var version2 = null, readForToken = null;
34203
+ var version2 = null, readForToken = null, build = null;
34196
34204
 
34197
34205
  // src/auth/antigravity-token.ts
34198
34206
  import { execFileSync } from "child_process";
34199
34207
  import { createHash as createHash3 } from "crypto";
34200
- import { existsSync as existsSync11 } from "fs";
34208
+ import { closeSync as closeSync5, existsSync as existsSync11, openSync as openSync5, readSync, realpathSync as realpathSync3 } from "fs";
34201
34209
  import { homedir as homedir12 } from "os";
34202
34210
  import { join as join12 } from "path";
34203
34211
  function invalidateReadStoreMemo() {
@@ -34285,6 +34293,40 @@ function defaultReadAgyVersion() {
34285
34293
  return null;
34286
34294
  }
34287
34295
  }
34296
+ function readAgyBuildFromBinary(path) {
34297
+ let fd;
34298
+ try {
34299
+ fd = openSync5(path, "r");
34300
+ const chunk = Buffer.alloc(AGY_BUILD_SCAN_CHUNK);
34301
+ let position = 0;
34302
+ for (;; ) {
34303
+ const read = readSync(fd, chunk, 0, chunk.length, position);
34304
+ if (read <= 0)
34305
+ return null;
34306
+ const found = chunk.subarray(0, read).toString("latin1").match(AGY_BUILD_STAMP);
34307
+ if (found)
34308
+ return found[1];
34309
+ if (read < chunk.length)
34310
+ return null;
34311
+ position += read - AGY_BUILD_SCAN_OVERLAP;
34312
+ }
34313
+ } catch {
34314
+ return null;
34315
+ } finally {
34316
+ if (fd !== undefined)
34317
+ closeSync5(fd);
34318
+ }
34319
+ }
34320
+ function defaultReadAgyBuild() {
34321
+ const agy = locateAgyBinary();
34322
+ if (!agy)
34323
+ return null;
34324
+ try {
34325
+ return readAgyBuildFromBinary(realpathSync3(agy));
34326
+ } catch {
34327
+ return null;
34328
+ }
34329
+ }
34288
34330
  function defaultAntigravityTokenDeps() {
34289
34331
  return { ...defaultDeps3 };
34290
34332
  }
@@ -34386,7 +34428,7 @@ function captureAgyClientVersion(accessToken, deps) {
34386
34428
  if (!deps.readAgyVersion || agyClientVersionReadFor(accessToken))
34387
34429
  return;
34388
34430
  const read = deps.readAgyVersion();
34389
- recordAgyClientVersionRead(read, accessToken);
34431
+ recordAgyClientVersionRead(read, accessToken, read ? deps.readAgyBuild?.() ?? null : null);
34390
34432
  if (read) {
34391
34433
  log(`[Antigravity] Client version from agy: ${read}`);
34392
34434
  } else {
@@ -34520,22 +34562,269 @@ function resetObservedTokenState() {
34520
34562
  observedLineage = null;
34521
34563
  invalidateReadStoreMemo();
34522
34564
  }
34523
- var KC_SERVICE = "gemini", KC_ACCOUNT = "antigravity", PREFIX = "go-keyring-base64:", EXPIRY_SKEW_MS = 120000, AGY_REFRESH_TIMEOUT_MS = 12000, AGY_VERSION_TIMEOUT_MS = 5000, READ_STORE_TTL_MS = 3000, cachedRawStore = null, defaultDeps3, KEYCHAIN_LOCKED_EXIT_CODES, cachedHasToken = null, HAS_TOKEN_TTL_MS = 5000, inFlight = null, observedLineage = null, MAX_TRACKED_ACCESS_TOKENS = 8, lineageByAccessToken;
34565
+ var KC_SERVICE = "gemini", KC_ACCOUNT = "antigravity", PREFIX = "go-keyring-base64:", EXPIRY_SKEW_MS = 120000, AGY_REFRESH_TIMEOUT_MS = 12000, AGY_VERSION_TIMEOUT_MS = 5000, READ_STORE_TTL_MS = 3000, cachedRawStore = null, AGY_BUILD_STAMP, AGY_BUILD_SCAN_CHUNK, AGY_BUILD_SCAN_OVERLAP = 64, defaultDeps3, KEYCHAIN_LOCKED_EXIT_CODES, cachedHasToken = null, HAS_TOKEN_TTL_MS = 5000, inFlight = null, observedLineage = null, MAX_TRACKED_ACCESS_TOKENS = 8, lineageByAccessToken;
34524
34566
  var init_antigravity_token = __esm(() => {
34525
34567
  init_logger();
34526
34568
  init_keychain();
34569
+ AGY_BUILD_STAMP = /changelist (\d+) with baseline/;
34570
+ AGY_BUILD_SCAN_CHUNK = 8 << 20;
34527
34571
  defaultDeps3 = {
34528
34572
  readStore: defaultReadStore,
34529
34573
  writeStore: defaultWriteStore,
34530
34574
  deleteStore: defaultDeleteStore,
34531
34575
  runAgyRefresh: defaultRunAgyRefresh,
34532
34576
  readAgyVersion: defaultReadAgyVersion,
34577
+ readAgyBuild: defaultReadAgyBuild,
34533
34578
  now: () => Date.now()
34534
34579
  };
34535
34580
  KEYCHAIN_LOCKED_EXIT_CODES = new Set([36, 51, 128]);
34536
34581
  lineageByAccessToken = new Map;
34537
34582
  });
34538
34583
 
34584
+ // src/providers/transport/antigravity-fetch.ts
34585
+ import http from "http";
34586
+ import https from "https";
34587
+ import { Readable, pipeline } from "stream";
34588
+ import { createGunzip } from "zlib";
34589
+ function nodeHttpWritesOwnHead(bunVersion) {
34590
+ if (!bunVersion)
34591
+ return true;
34592
+ const part = (version) => version.split("-")[0].split(".").map(Number);
34593
+ const have = part(bunVersion);
34594
+ const need = part(FIRST_BUN_WITH_OWN_HTTP_HEAD);
34595
+ for (let i = 0;i < need.length; i++) {
34596
+ const n = have[i];
34597
+ if (!Number.isFinite(n))
34598
+ return false;
34599
+ if (n !== need[i])
34600
+ return n > need[i];
34601
+ }
34602
+ return !bunVersion.includes("-");
34603
+ }
34604
+ function headerRecord(headers) {
34605
+ const out = {};
34606
+ if (!headers)
34607
+ return out;
34608
+ if (headers instanceof Headers) {
34609
+ headers.forEach((value, name) => {
34610
+ out[name] = value;
34611
+ });
34612
+ return out;
34613
+ }
34614
+ for (const [name, value] of Array.isArray(headers) ? headers : Object.entries(headers)) {
34615
+ if (typeof value === "string")
34616
+ out[name] = value;
34617
+ }
34618
+ return out;
34619
+ }
34620
+ function sendsChunked(target) {
34621
+ return target.pathname.includes(":streamGenerateContent");
34622
+ }
34623
+ function antigravityHeaderLines(headers, bodyBytes, chunked) {
34624
+ const given = headerRecord(headers);
34625
+ const find = (lower) => {
34626
+ for (const [name, value] of Object.entries(given)) {
34627
+ if (name.toLowerCase() === lower)
34628
+ return value;
34629
+ }
34630
+ return;
34631
+ };
34632
+ const lines = [];
34633
+ const userAgent = find("user-agent");
34634
+ if (userAgent !== undefined)
34635
+ lines.push(["User-Agent", userAgent]);
34636
+ if (bodyBytes !== null) {
34637
+ lines.push(chunked ? ["Transfer-Encoding", "chunked"] : ["Content-Length", String(bodyBytes)]);
34638
+ }
34639
+ const authorization = find("authorization");
34640
+ if (authorization !== undefined)
34641
+ lines.push(["Authorization", authorization]);
34642
+ const contentType = find("content-type");
34643
+ if (contentType !== undefined)
34644
+ lines.push(["Content-Type", contentType]);
34645
+ lines.push(["Accept-Encoding", "gzip"]);
34646
+ for (const [name, value] of Object.entries(given)) {
34647
+ if (!OWN_HEADERS.has(name.toLowerCase()))
34648
+ lines.push([name, value]);
34649
+ }
34650
+ return lines;
34651
+ }
34652
+ function envValue(...names) {
34653
+ for (const name of names) {
34654
+ const value = process.env[name];
34655
+ if (value)
34656
+ return value;
34657
+ }
34658
+ return;
34659
+ }
34660
+ function bypassesProxy(target) {
34661
+ const list = envValue("NO_PROXY", "no_proxy");
34662
+ if (!list)
34663
+ return false;
34664
+ const name = target.hostname.toLowerCase();
34665
+ const port = target.port || (target.protocol === "https:" ? "443" : "80");
34666
+ return list.split(",").some((raw) => {
34667
+ let entry = raw.trim().toLowerCase();
34668
+ const withPort = entry.match(/^(.*[^:]):(\d+)$/);
34669
+ if (withPort) {
34670
+ if (withPort[2] !== port)
34671
+ return false;
34672
+ entry = withPort[1];
34673
+ }
34674
+ entry = entry.replace(/^\*?\./, "");
34675
+ if (!entry)
34676
+ return false;
34677
+ return entry === "*" || name === entry || name.endsWith(`.${entry}`);
34678
+ });
34679
+ }
34680
+ function proxyFor(target) {
34681
+ if (bypassesProxy(target))
34682
+ return null;
34683
+ const value = target.protocol === "https:" ? envValue("HTTPS_PROXY", "https_proxy", "ALL_PROXY", "all_proxy") : envValue("HTTP_PROXY", "http_proxy", "ALL_PROXY", "all_proxy");
34684
+ if (!value)
34685
+ return null;
34686
+ try {
34687
+ return new URL(value);
34688
+ } catch {
34689
+ return null;
34690
+ }
34691
+ }
34692
+ function idleTimeoutError(ms) {
34693
+ return Object.assign(new Error(`The Antigravity backend sent nothing for ${ms} ms`), {
34694
+ code: "ETIMEDOUT"
34695
+ });
34696
+ }
34697
+ async function antigravityFetch(url, init = {}, runtime = {
34698
+ idleTimeoutMs: ANTIGRAVITY_IDLE_TIMEOUT_MS,
34699
+ bunVersion: process.versions.bun
34700
+ }) {
34701
+ if (process.env[ANTIGRAVITY_PLAIN_FETCH_ENV] === "1")
34702
+ return fetch(url, init);
34703
+ if (!nodeHttpWritesOwnHead(runtime.bunVersion))
34704
+ return fetch(url, init);
34705
+ if (init.body != null && typeof init.body !== "string")
34706
+ return fetch(url, init);
34707
+ let target = new URL(url);
34708
+ if (proxyFor(target))
34709
+ return fetch(url, init);
34710
+ let current = init;
34711
+ for (let hop = 0;; hop++) {
34712
+ const response = await sendOnce(target, current, runtime.idleTimeoutMs);
34713
+ const location = response.headers.get("location");
34714
+ const redirected = (response.status === 307 || response.status === 308) && location;
34715
+ if (!redirected || init.redirect === "manual" || hop >= MAX_REDIRECTS)
34716
+ return response;
34717
+ await response.body?.cancel().catch(() => {});
34718
+ if (init.redirect === "error") {
34719
+ throw new TypeError(`The Antigravity backend answered ${response.status} with a redirect`);
34720
+ }
34721
+ const next = new URL(location, target);
34722
+ if (next.origin !== target.origin) {
34723
+ const kept = {};
34724
+ const sent = new Headers(current.headers);
34725
+ sent.forEach((value, name) => {
34726
+ if (name.toLowerCase() !== "authorization")
34727
+ kept[name] = value;
34728
+ });
34729
+ current = { ...current, headers: kept };
34730
+ }
34731
+ target = next;
34732
+ if (proxyFor(target))
34733
+ return fetch(target.href, current);
34734
+ }
34735
+ }
34736
+ async function sendOnce(target, init, idleTimeoutMs) {
34737
+ const secure = target.protocol === "https:";
34738
+ const signal = init.signal ?? undefined;
34739
+ if (signal?.aborted)
34740
+ throw signal.reason;
34741
+ const method = (init.method ?? "GET").toUpperCase();
34742
+ const body = typeof init.body === "string" ? Buffer.from(init.body, "utf8") : null;
34743
+ const chunked = body !== null && sendsChunked(target);
34744
+ return new Promise((resolve, reject) => {
34745
+ const request = (secure ? https : http).request(target, { method, agent: false });
34746
+ try {
34747
+ request.removeHeader("Connection");
34748
+ for (const [name, value] of antigravityHeaderLines(init.headers, body?.length ?? null, chunked)) {
34749
+ request.setHeader(name, value);
34750
+ }
34751
+ } catch (error) {
34752
+ request.once("error", () => {});
34753
+ request.destroy();
34754
+ reject(error);
34755
+ return;
34756
+ }
34757
+ let incoming;
34758
+ request.setTimeout(idleTimeoutMs, () => {
34759
+ const error = idleTimeoutError(idleTimeoutMs);
34760
+ request.destroy(error);
34761
+ incoming?.destroy(error);
34762
+ });
34763
+ const untilResponse = setTimeout(() => request.destroy(idleTimeoutError(idleTimeoutMs)), idleTimeoutMs);
34764
+ const onAbort = () => {
34765
+ request.destroy(signal?.reason);
34766
+ incoming?.destroy(signal?.reason);
34767
+ };
34768
+ const release = () => signal?.removeEventListener("abort", onAbort);
34769
+ signal?.addEventListener("abort", onAbort, { once: true });
34770
+ request.once("error", (error) => {
34771
+ clearTimeout(untilResponse);
34772
+ release();
34773
+ reject(error);
34774
+ });
34775
+ request.once("response", (res) => {
34776
+ clearTimeout(untilResponse);
34777
+ incoming = res;
34778
+ res.once("close", release);
34779
+ const status = res.statusCode ?? 0;
34780
+ const headers = new Headers;
34781
+ for (let i = 0;i + 1 < res.rawHeaders.length; i += 2) {
34782
+ headers.append(res.rawHeaders[i], res.rawHeaders[i + 1]);
34783
+ }
34784
+ let source = res;
34785
+ if (/\bgzip\b/i.test(headers.get("content-encoding") ?? "")) {
34786
+ source = pipeline(res, createGunzip(), () => {});
34787
+ headers.delete("content-encoding");
34788
+ headers.delete("content-length");
34789
+ }
34790
+ const bodiless = method === "HEAD" || status === 204 || status === 304;
34791
+ if (bodiless)
34792
+ res.resume();
34793
+ try {
34794
+ resolve(new Response(bodiless ? null : Readable.toWeb(source), {
34795
+ status,
34796
+ statusText: res.statusMessage ?? "",
34797
+ headers
34798
+ }));
34799
+ } catch (error) {
34800
+ res.destroy();
34801
+ reject(error);
34802
+ }
34803
+ });
34804
+ if (body === null)
34805
+ request.end();
34806
+ else if (chunked) {
34807
+ request.write(body);
34808
+ request.end();
34809
+ } else
34810
+ request.end(body);
34811
+ });
34812
+ }
34813
+ var ANTIGRAVITY_PLAIN_FETCH_ENV = "CLAUDISH_ANTIGRAVITY_PLAIN_FETCH", FIRST_BUN_WITH_OWN_HTTP_HEAD = "1.4.0", OWN_HEADERS, ANTIGRAVITY_IDLE_TIMEOUT_MS = 300000, MAX_REDIRECTS = 5;
34814
+ var init_antigravity_fetch = __esm(() => {
34815
+ OWN_HEADERS = new Set([
34816
+ "host",
34817
+ "accept",
34818
+ "connection",
34819
+ "content-length",
34820
+ "transfer-encoding",
34821
+ "accept-encoding",
34822
+ "user-agent",
34823
+ "authorization",
34824
+ "content-type"
34825
+ ]);
34826
+ });
34827
+
34539
34828
  // src/auth/antigravity-user.ts
34540
34829
  function antigravityHost() {
34541
34830
  const override = process.env.AICODE_ENDPOINT_URL?.trim();
@@ -34557,7 +34846,9 @@ function antigravityClientVersion() {
34557
34846
  return resolveAntigravityClientVersion().version;
34558
34847
  }
34559
34848
  function userAgentFor(version) {
34560
- return `antigravity/cli/${version} (aidev_client; os_type=${process.platform}; arch=${process.arch}; auth_method=consumer)`;
34849
+ const build = version === getAgyClientVersion() ? getAgyClientBuild() : null;
34850
+ const cl = build ? ` cl=${build};` : "";
34851
+ return `antigravity/cli/${version} (aidev_client; os_type=${process.platform}; arch=${process.arch};${cl} auth_method=consumer)`;
34561
34852
  }
34562
34853
  function antigravityUserAgentFor(version) {
34563
34854
  return userAgentFor(version);
@@ -34594,7 +34885,7 @@ function mayPublishFor(lineage) {
34594
34885
  return true;
34595
34886
  }
34596
34887
  async function callLoadCodeAssistAntigravity(accessToken) {
34597
- const res = await fetch(`${apiBase()}:loadCodeAssist`, {
34888
+ const res = await antigravityFetch(`${apiBase()}:loadCodeAssist`, {
34598
34889
  method: "POST",
34599
34890
  headers: {
34600
34891
  Authorization: `Bearer ${accessToken}`,
@@ -34646,7 +34937,7 @@ function getAntigravityTierDisplayName() {
34646
34937
  }
34647
34938
  async function retrieveUserQuota(accessToken, projectId) {
34648
34939
  try {
34649
- const res = await fetch(`${apiBase()}:retrieveUserQuota`, {
34940
+ const res = await antigravityFetch(`${apiBase()}:retrieveUserQuota`, {
34650
34941
  method: "POST",
34651
34942
  headers: {
34652
34943
  Authorization: `Bearer ${accessToken}`,
@@ -34692,7 +34983,7 @@ async function fetchAntigravityAvailableModelsRaw(accessToken, projectId, opts)
34692
34983
  };
34693
34984
  let res;
34694
34985
  try {
34695
- res = await fetch(url, {
34986
+ res = await antigravityFetch(url, {
34696
34987
  method: "POST",
34697
34988
  headers: {
34698
34989
  Authorization: `Bearer ${accessToken}`,
@@ -34761,6 +35052,12 @@ async function getServedAntigravityModels(accessToken, projectId, opts) {
34761
35052
  if (typeof record?.displayName === "string" && record.displayName) {
34762
35053
  entry.displayName = record.displayName;
34763
35054
  }
35055
+ if (typeof record?.model === "string" && record.model) {
35056
+ entry.modelEnum = record.model;
35057
+ }
35058
+ if (typeof record?.thinkingLevel === "number") {
35059
+ entry.thinkingLevel = record.thinkingLevel;
35060
+ }
34764
35061
  meta[id] = entry;
34765
35062
  }
34766
35063
  const excludedIds = new Set;
@@ -34818,6 +35115,7 @@ function peekServedAntigravityModels() {
34818
35115
  var ANTIGRAVITY_DEFAULT_HOST = "https://daily-cloudcode-pa.googleapis.com", SERVED_MODELS_TTL_MS, ANTIGRAVITY_IDE_TYPE = "ANTIGRAVITY", AGY_FALLBACK_CLIENT_VERSION = "1.1.9", cachedAgProjectId = null, cachedAgTierId = null, cachedAgTierName = null, cachedAgLineage = null, agServedCache = null, agServedCacheAt = 0, agServedCacheVersion = null;
34819
35116
  var init_antigravity_user = __esm(() => {
34820
35117
  init_logger();
35118
+ init_antigravity_fetch();
34821
35119
  init_antigravity_token();
34822
35120
  SERVED_MODELS_TTL_MS = 10 * 60 * 1000;
34823
35121
  });
@@ -34954,10 +35252,10 @@ var init_antigravity = __esm(() => {
34954
35252
  // src/auth/credential-file.ts
34955
35253
  import { randomBytes as randomBytes4 } from "crypto";
34956
35254
  import {
34957
- closeSync as closeSync5,
35255
+ closeSync as closeSync6,
34958
35256
  fsyncSync as fsyncSync2,
34959
35257
  mkdirSync as mkdirSync9,
34960
- openSync as openSync5,
35258
+ openSync as openSync6,
34961
35259
  readFileSync as readFileSync16,
34962
35260
  renameSync as renameSync5,
34963
35261
  statSync as statSync6,
@@ -34983,12 +35281,12 @@ function writeCredentialFileAtomic(path, data) {
34983
35281
  mkdirSync9(dirname8(path), { recursive: true });
34984
35282
  const tmp = `${path}.tmp-${process.pid}-${randomBytes4(6).toString("hex")}`;
34985
35283
  try {
34986
- const fd = openSync5(tmp, "wx", 384);
35284
+ const fd = openSync6(tmp, "wx", 384);
34987
35285
  try {
34988
35286
  writeSync5(fd, JSON.stringify(data, null, 2));
34989
35287
  fsyncSync2(fd);
34990
35288
  } finally {
34991
- closeSync5(fd);
35289
+ closeSync6(fd);
34992
35290
  }
34993
35291
  renameSync5(tmp, path);
34994
35292
  } catch (err) {
@@ -48500,12 +48798,12 @@ var init_raw = __esm(() => {
48500
48798
 
48501
48799
  // src/hooks/injection/inbox.ts
48502
48800
  import {
48503
- closeSync as closeSync6,
48801
+ closeSync as closeSync7,
48504
48802
  existsSync as existsSync16,
48505
48803
  fstatSync as fstatSync2,
48506
- openSync as openSync6,
48804
+ openSync as openSync7,
48507
48805
  readFileSync as readFileSync20,
48508
- readSync,
48806
+ readSync as readSync2,
48509
48807
  rmSync as rmSync6,
48510
48808
  statSync as statSync7
48511
48809
  } from "fs";
@@ -48586,7 +48884,7 @@ class FileInbox {
48586
48884
  return [];
48587
48885
  let fd;
48588
48886
  try {
48589
- fd = openSync6(this.path, "r");
48887
+ fd = openSync7(this.path, "r");
48590
48888
  } catch {
48591
48889
  return [];
48592
48890
  }
@@ -48595,7 +48893,7 @@ class FileInbox {
48595
48893
  if (size <= this.offset)
48596
48894
  return [];
48597
48895
  const buf = Buffer.alloc(size - this.offset);
48598
- const n = readSync(fd, buf, 0, buf.length, this.offset);
48896
+ const n = readSync2(fd, buf, 0, buf.length, this.offset);
48599
48897
  const bytes = Buffer.concat([this.partial, buf.subarray(0, n)]);
48600
48898
  const nl = bytes.lastIndexOf(10);
48601
48899
  const complete = nl === -1 ? "" : bytes.subarray(0, nl).toString("utf8");
@@ -48612,7 +48910,7 @@ class FileInbox {
48612
48910
  }
48613
48911
  return out;
48614
48912
  } finally {
48615
- closeSync6(fd);
48913
+ closeSync7(fd);
48616
48914
  }
48617
48915
  }
48618
48916
  }
@@ -48761,7 +49059,7 @@ function createHookInbox(dir, name = HOOK_INBOX_FILE) {
48761
49059
  const path = join20(dir, name);
48762
49060
  try {
48763
49061
  rmSync6(path, { force: true });
48764
- closeSync6(openSync6(path, "wx", 384));
49062
+ closeSync7(openSync7(path, "wx", 384));
48765
49063
  return path;
48766
49064
  } catch {
48767
49065
  return null;
@@ -49344,6 +49642,155 @@ function decideCodexSpeed(speed, modelInfo) {
49344
49642
  }
49345
49643
  var CODEX_SERVICE_TIER_POINTER = "/service_tier";
49346
49644
 
49645
+ // src/providers/antigravity-envelope.ts
49646
+ import { createHash as createHash13, randomBytes as randomBytes7, randomUUID as randomUUID3 } from "crypto";
49647
+
49648
+ class AntigravityConversations {
49649
+ limit;
49650
+ newId;
49651
+ byFirstMessage = new Map;
49652
+ sessionId;
49653
+ constructor(limit = 64, newId = randomUUID3, sessionId = randomSessionId()) {
49654
+ this.limit = limit;
49655
+ this.newId = newId;
49656
+ this.sessionId = sessionId;
49657
+ }
49658
+ of(inner, scope = "") {
49659
+ const key = `${scope}
49660
+ ${firstMessageKey(inner)}`;
49661
+ const known = this.byFirstMessage.get(key);
49662
+ if (known) {
49663
+ this.byFirstMessage.delete(key);
49664
+ this.byFirstMessage.set(key, known);
49665
+ return known;
49666
+ }
49667
+ const created = { cascadeId: this.newId(), trajectoryId: this.newId(), requestCount: 0 };
49668
+ this.byFirstMessage.set(key, created);
49669
+ if (this.byFirstMessage.size > this.limit) {
49670
+ const oldest = this.byFirstMessage.keys().next().value;
49671
+ if (oldest !== undefined)
49672
+ this.byFirstMessage.delete(oldest);
49673
+ }
49674
+ return created;
49675
+ }
49676
+ }
49677
+ function randomSessionId() {
49678
+ return randomBytes7(8).readBigInt64BE().toString();
49679
+ }
49680
+ function firstMessageKey(inner) {
49681
+ const contents = inner?.contents;
49682
+ const first = Array.isArray(contents) && contents.length > 0 ? contents[0] : null;
49683
+ return createHash13("sha256").update(JSON.stringify(first)).digest("hex");
49684
+ }
49685
+ function lastStepIndex(contents) {
49686
+ if (!Array.isArray(contents))
49687
+ return 0;
49688
+ let steps = 0;
49689
+ for (const content of contents.slice(1)) {
49690
+ const parts = Array.isArray(content?.parts) ? content.parts : [];
49691
+ const results = parts.filter((part) => part?.functionResponse !== undefined).length;
49692
+ steps += results > 0 ? results : 1;
49693
+ }
49694
+ return steps;
49695
+ }
49696
+ function toolResultsAsModelEntries(contents) {
49697
+ if (!Array.isArray(contents))
49698
+ return contents;
49699
+ const out = [];
49700
+ for (const content of contents) {
49701
+ const parts = Array.isArray(content?.parts) ? content.parts : [];
49702
+ const results = parts.filter((part) => part?.functionResponse !== undefined);
49703
+ if (results.length === 0) {
49704
+ out.push(content);
49705
+ continue;
49706
+ }
49707
+ const others = parts.filter((part) => part?.functionResponse === undefined);
49708
+ out.push({ ...content, role: "model", parts: results });
49709
+ if (others.length > 0)
49710
+ out.push({ ...content, parts: others });
49711
+ }
49712
+ return out;
49713
+ }
49714
+ function oneToolPerDeclaration(tools) {
49715
+ if (!Array.isArray(tools))
49716
+ return tools;
49717
+ const out = [];
49718
+ for (const entry of tools) {
49719
+ const declarations = entry?.functionDeclarations;
49720
+ if (!Array.isArray(declarations) || declarations.length <= 1) {
49721
+ out.push(entry);
49722
+ continue;
49723
+ }
49724
+ const { functionDeclarations: _all, ...rest } = entry;
49725
+ for (const declaration of declarations) {
49726
+ out.push({ ...rest, functionDeclarations: [declaration] });
49727
+ }
49728
+ }
49729
+ return out;
49730
+ }
49731
+ function labelsFor(model, meta, conversation, stepIndex) {
49732
+ const claude = model.startsWith("claude");
49733
+ const gemini = model.startsWith("gemini");
49734
+ const labels = {
49735
+ cascade_id: conversation.cascadeId,
49736
+ last_step_index: String(stepIndex)
49737
+ };
49738
+ if (meta?.modelEnum)
49739
+ labels.model_enum = meta.modelEnum;
49740
+ labels.request_id = `${conversation.trajectoryId}-${conversation.requestCount}`;
49741
+ labels.root_cascade_id = conversation.cascadeId;
49742
+ labels.trajectory_id = conversation.trajectoryId;
49743
+ labels.used_claude = String(claude);
49744
+ labels.used_claude_conservative = String(claude);
49745
+ labels.used_non_gemini_model = String(!gemini);
49746
+ return labels;
49747
+ }
49748
+ function buildAntigravityEnvelope(input) {
49749
+ const { model, meta, conversation } = input;
49750
+ const inner = input.inner ?? {};
49751
+ const {
49752
+ contents,
49753
+ systemInstruction,
49754
+ tools,
49755
+ generationConfig,
49756
+ labels: _labels,
49757
+ sessionId: _sessionId,
49758
+ ...others
49759
+ } = inner;
49760
+ const stepIndex = lastStepIndex(contents);
49761
+ const request = { contents: toolResultsAsModelEntries(contents) };
49762
+ if (systemInstruction && typeof systemInstruction === "object") {
49763
+ const { role: _role, ...instruction } = systemInstruction;
49764
+ request.systemInstruction = { role: "user", ...instruction };
49765
+ }
49766
+ if (tools !== undefined)
49767
+ request.tools = oneToolPerDeclaration(tools);
49768
+ Object.assign(request, others);
49769
+ request.labels = labelsFor(model, meta, conversation, stepIndex);
49770
+ const {
49771
+ temperature: _temperature,
49772
+ maxOutputTokens,
49773
+ ...config
49774
+ } = generationConfig ?? {};
49775
+ const cap = meta?.maxOutputTokens ?? maxOutputTokens;
49776
+ request.generationConfig = cap === undefined ? config : { maxOutputTokens: cap, ...config };
49777
+ request.sessionId = input.sessionId;
49778
+ const envelope = {
49779
+ project: input.projectId,
49780
+ requestId: `agent/${conversation.cascadeId}/${input.now ?? Date.now()}/${conversation.trajectoryId}/${stepIndex + 1}`,
49781
+ request,
49782
+ model,
49783
+ userAgent: "antigravity",
49784
+ requestType: "agent"
49785
+ };
49786
+ conversation.requestCount += 1;
49787
+ return envelope;
49788
+ }
49789
+ var antigravityConversations;
49790
+ var init_antigravity_envelope = __esm(() => {
49791
+ antigravityConversations = new AntigravityConversations;
49792
+ });
49793
+
49347
49794
  // src/handlers/shared/gemini-queue.ts
49348
49795
  function rejectIfAborted(request) {
49349
49796
  if (request.onAbort)
@@ -50791,16 +51238,19 @@ function mappedAntigravityModelId(req, served, effort) {
50791
51238
  function antigravityCarriesEffortInModelId(sent) {
50792
51239
  return carriesEffortInModelId(sent.trim(), "antigravity");
50793
51240
  }
50794
- function antigravityBodyForModelId(inner, sent) {
51241
+ function antigravityBodyForModelId(inner, sent, backendLevel) {
50795
51242
  const body = inner;
50796
51243
  const thinking = body?.generationConfig?.thinkingConfig;
50797
51244
  if (!thinking || typeof thinking !== "object")
50798
51245
  return inner;
50799
- if (!("thinkingLevel" in thinking) && !("thinkingBudget" in thinking))
50800
- return inner;
50801
51246
  if (!antigravityCarriesEffortInModelId(sent))
50802
51247
  return inner;
51248
+ const level = backendLevel !== undefined && sent.trim().startsWith("gemini") ? BACKEND_THINKING_LEVELS[backendLevel] : undefined;
51249
+ if (!level && !("thinkingLevel" in thinking) && !("thinkingBudget" in thinking))
51250
+ return inner;
50803
51251
  const { thinkingLevel: _level, thinkingBudget: _budget, ...kept } = thinking;
51252
+ if (level)
51253
+ kept.thinkingLevel = level;
50804
51254
  const generationConfig = { ...body?.generationConfig };
50805
51255
  if (Object.keys(kept).length > 0)
50806
51256
  generationConfig.thinkingConfig = kept;
@@ -50870,10 +51320,11 @@ function chooseAntigravityServedModel(requested, served, effort) {
50870
51320
  const id = resolveAntigravityModelId(requested, selectable, defaultId, lookupFamilyDefaultVariant(requested, "antigravity"));
50871
51321
  return existingResolutionChoice(id, effort, decision);
50872
51322
  }
50873
- var REASONING_TIER_RANK;
51323
+ var BACKEND_THINKING_LEVELS, REASONING_TIER_RANK;
50874
51324
  var init_antigravity_model_id = __esm(() => {
50875
51325
  init_model_catalog();
50876
51326
  init_model_id_effort_choice();
51327
+ BACKEND_THINKING_LEVELS = { 1: "LOW", 2: "MEDIUM", 3: "HIGH" };
50877
51328
  REASONING_TIER_RANK = {
50878
51329
  high: 0,
50879
51330
  medium: 1,
@@ -51205,6 +51656,20 @@ var init_wire_request = __esm(() => {
51205
51656
  LIMIT_REQUIRED_APIS = new Set(["anthropic-messages"]);
51206
51657
  });
51207
51658
 
51659
+ // src/providers/transport/conversation-key.ts
51660
+ import { createHash as createHash14, randomBytes as randomBytes8 } from "crypto";
51661
+ function conversationKey(claudeRequest) {
51662
+ const sessionId = extractSessionId(claudeRequest);
51663
+ if (!sessionId)
51664
+ return `claudish_${FALLBACK_CONVERSATION_KEY}`;
51665
+ return `claudish_${createHash14("sha256").update(sessionId).digest("hex").slice(0, 32)}`;
51666
+ }
51667
+ var FALLBACK_CONVERSATION_KEY;
51668
+ var init_conversation_key = __esm(() => {
51669
+ init_harness();
51670
+ FALLBACK_CONVERSATION_KEY = randomBytes8(16).toString("hex");
51671
+ });
51672
+
51208
51673
  // src/providers/transport/antigravity.ts
51209
51674
  var exports_antigravity = {};
51210
51675
  __export(exports_antigravity, {
@@ -51213,7 +51678,6 @@ __export(exports_antigravity, {
51213
51678
  chooseAntigravityServedModel: () => chooseAntigravityServedModel,
51214
51679
  resolveAntigravityServedModel: () => resolveAntigravityServedModel
51215
51680
  });
51216
- import { randomUUID as randomUUID3 } from "crypto";
51217
51681
  function antigravityEndpoint() {
51218
51682
  return `${antigravityHost()}/v1internal:streamGenerateContent?alt=sse`;
51219
51683
  }
@@ -51225,9 +51689,6 @@ function effortOf(claudeRequest, pinned) {
51225
51689
  return "none";
51226
51690
  return isEffortLevel(choices.effort) ? choices.effort : undefined;
51227
51691
  }
51228
- function createActivityRequestId() {
51229
- return Math.random().toString(36).substring(7);
51230
- }
51231
51692
  function classify429(responseBody) {
51232
51693
  try {
51233
51694
  const raw = JSON.parse(responseBody);
@@ -51296,16 +51757,19 @@ class AntigravityProviderTransport {
51296
51757
  return this._displayName;
51297
51758
  }
51298
51759
  streamFormat = "gemini-sse";
51760
+ fetch(url, init) {
51761
+ return antigravityFetch(url, init);
51762
+ }
51299
51763
  modelName;
51300
51764
  servedModelName;
51301
51765
  accessToken = null;
51302
51766
  projectId = null;
51303
- tierId = null;
51304
51767
  cachedAuth = null;
51305
51768
  requests = new WeakMap;
51306
51769
  lastRequest;
51307
51770
  pinnedEffort;
51308
51771
  servedModels = [];
51772
+ modelMeta = {};
51309
51773
  served = {
51310
51774
  servedIds: [],
51311
51775
  defaultId: null
@@ -51334,8 +51798,7 @@ class AntigravityProviderTransport {
51334
51798
  buildLocalHeaders() {
51335
51799
  return {
51336
51800
  Authorization: `Bearer ${this.accessToken}`,
51337
- "User-Agent": buildAntigravityUserAgent(),
51338
- "x-activity-request-id": createActivityRequestId()
51801
+ "User-Agent": buildAntigravityUserAgent()
51339
51802
  };
51340
51803
  }
51341
51804
  async refreshAuth() {
@@ -51343,12 +51806,12 @@ class AntigravityProviderTransport {
51343
51806
  model: this.modelName
51344
51807
  });
51345
51808
  this.accessToken = await getValidAntigravityAccessToken();
51346
- const { projectId, tierId } = await setupAntigravityUser(this.accessToken);
51809
+ const { projectId } = await setupAntigravityUser(this.accessToken);
51347
51810
  this.projectId = projectId;
51348
- this.tierId = tierId;
51349
51811
  this._displayName = getAntigravityTierDisplayName();
51350
51812
  const served = await getServedAntigravityModels(this.accessToken, this.projectId);
51351
51813
  this.served = served;
51814
+ this.modelMeta = served.meta ?? {};
51352
51815
  this.servedModels = served.servedIds;
51353
51816
  this.servedModelName = resolveAntigravityServedModel(this.modelName, served, this.pinnedEffort);
51354
51817
  log(`[Antigravity] Auth refreshed, project: ${this.projectId}, tier: ${this._displayName}, ` + `model: ${this.modelName} -> ${this.servedModelName}, served: ${this.servedModels.join(",") || "(none)"}`);
@@ -51374,17 +51837,24 @@ class AntigravityProviderTransport {
51374
51837
  }
51375
51838
  transformPayload(payload, claudeRequest) {
51376
51839
  let choice;
51840
+ const conversationScope = conversationKey(claudeRequest);
51377
51841
  const request = {
51378
51842
  effort: effortOf(claudeRequest, this.pinnedEffort),
51379
51843
  onModelChoice: (decided) => {
51380
51844
  choice = decided;
51381
- }
51845
+ },
51846
+ conversationScope
51382
51847
  };
51383
51848
  const envelope = this.cachedAuth?.transformPayload ? this.cachedAuth.transformPayload(payload, request) : this.buildLocalEnvelope(payload, request);
51384
51849
  if (typeof envelope?.model === "string" && envelope.model) {
51385
51850
  this.servedModelName = envelope.model;
51386
51851
  }
51387
- const state = { payload, sentId: this.servedModelName, choice };
51852
+ const state = {
51853
+ payload,
51854
+ sentId: this.servedModelName,
51855
+ choice,
51856
+ conversationScope
51857
+ };
51388
51858
  if (envelope && typeof envelope === "object")
51389
51859
  this.requests.set(envelope, state);
51390
51860
  this.lastRequest = envelope ? state : undefined;
@@ -51395,19 +51865,17 @@ class AntigravityProviderTransport {
51395
51865
  buildLocalEnvelope(payload, request) {
51396
51866
  const choice = chooseAntigravityServedModel(this.modelName, this.served, request.effort);
51397
51867
  request.onModelChoice?.(choice);
51398
- return this.buildEnvelope(antigravityBodyForModelId(payload, choice.id), choice.id);
51868
+ return this.buildEnvelope(antigravityBodyForModelId(payload, choice.id, this.modelMeta[choice.id]?.thinkingLevel), choice.id, request.conversationScope);
51399
51869
  }
51400
- buildEnvelope(innerPayload, model) {
51401
- const envelope = {
51870
+ buildEnvelope(innerPayload, model, conversationScope) {
51871
+ return buildAntigravityEnvelope({
51872
+ inner: innerPayload,
51402
51873
  model,
51403
- project: this.projectId,
51404
- user_prompt_id: randomUUID3(),
51405
- request: innerPayload
51406
- };
51407
- if (this.tierId && this.tierId !== "free-tier") {
51408
- envelope.enabled_credit_types = ["GOOGLE_ONE_AI"];
51409
- }
51410
- return envelope;
51874
+ projectId: this.projectId,
51875
+ meta: this.modelMeta[model],
51876
+ conversation: antigravityConversations.of(innerPayload, conversationScope),
51877
+ sessionId: antigravityConversations.sessionId
51878
+ });
51411
51879
  }
51412
51880
  async enqueueRequest(fetchFn, opts) {
51413
51881
  const queue = GeminiRequestQueue.getInstance();
@@ -51483,7 +51951,7 @@ class AntigravityProviderTransport {
51483
51951
  if (choice)
51484
51952
  logModelIdChoice("Antigravity", this.modelName, { ...choice, id: fallbackModel });
51485
51953
  tried.push(fallbackModel);
51486
- const fallbackEnvelope = this.buildEnvelope(antigravityBodyForModelId(originalPayload, fallbackModel), fallbackModel);
51954
+ const fallbackEnvelope = this.buildEnvelope(antigravityBodyForModelId(originalPayload, fallbackModel, this.modelMeta[fallbackModel]?.thinkingLevel), fallbackModel, request.conversationScope);
51487
51955
  const headers = this.buildLocalHeaders();
51488
51956
  headers["Content-Type"] = "application/json";
51489
51957
  const fallbackResponse = await this.fetchCapacityCandidate(queue, endpoint, headers, fallbackEnvelope, signal);
@@ -51519,8 +51987,8 @@ class AntigravityProviderTransport {
51519
51987
  fetchCapacityCandidate(queue, endpoint, headers, envelope, signal) {
51520
51988
  const init = { method: "POST", headers, body: JSON.stringify(envelope) };
51521
51989
  if (!signal)
51522
- return queue.enqueue(() => fetch(endpoint, init));
51523
- return queue.enqueue(() => signal.aborted ? Promise.reject(callAbortError()) : fetch(endpoint, { ...init, signal }), { signal });
51990
+ return queue.enqueue(() => antigravityFetch(endpoint, init));
51991
+ return queue.enqueue(() => signal.aborted ? Promise.reject(callAbortError()) : antigravityFetch(endpoint, { ...init, signal }), { signal });
51524
51992
  }
51525
51993
  rewriteModelNotFound(response, sentId, capacityFallbacksExhausted = false) {
51526
51994
  const served = this.servedModels;
@@ -51652,9 +52120,12 @@ var init_antigravity2 = __esm(() => {
51652
52120
  init_call_context();
51653
52121
  init_gemini_queue();
51654
52122
  init_logger();
52123
+ init_antigravity_envelope();
51655
52124
  init_antigravity_model_id();
51656
52125
  init_model_id_effort_choice();
51657
52126
  init_wire_request();
52127
+ init_antigravity_fetch();
52128
+ init_conversation_key();
51658
52129
  init_provider_model_discovery();
51659
52130
  init_antigravity_model_id();
51660
52131
  });
@@ -51673,11 +52144,6 @@ function redactSecrets2(text) {
51673
52144
  }
51674
52145
 
51675
52146
  // src/auth/credentials/antigravity-credential.ts
51676
- import { randomUUID as randomUUID4 } from "crypto";
51677
- function createActivityRequestId2() {
51678
- return Math.random().toString(36).substring(7);
51679
- }
51680
-
51681
52147
  class AntigravityCredentialProvider {
51682
52148
  catalogName = "antigravity";
51683
52149
  async describeReadiness() {
@@ -51703,33 +52169,31 @@ ${antigravityHost()}` : undefined;
51703
52169
  }
51704
52170
  async getRequestAuth(ctx) {
51705
52171
  const token = await getValidAntigravityAccessToken();
51706
- const { projectId, tierId } = await setupAntigravityUser(token);
52172
+ const { projectId } = await setupAntigravityUser(token);
51707
52173
  const served = await getServedAntigravityModels(token, projectId);
51708
52174
  return {
51709
52175
  headers: {
51710
52176
  Authorization: `Bearer ${token}`,
51711
- "User-Agent": buildAntigravityUserAgent(),
51712
- "x-activity-request-id": createActivityRequestId2()
52177
+ "User-Agent": buildAntigravityUserAgent()
51713
52178
  },
51714
52179
  transformPayload: (inner, request) => {
51715
52180
  const choice = chooseAntigravityServedModel(ctx.model, served, request?.effort);
51716
52181
  request?.onModelChoice?.(choice);
51717
52182
  const model = choice.id;
51718
- const env = {
52183
+ return buildAntigravityEnvelope({
52184
+ inner: antigravityBodyForModelId(inner, model, served.meta?.[model]?.thinkingLevel),
51719
52185
  model,
51720
- project: projectId,
51721
- user_prompt_id: randomUUID4(),
51722
- request: antigravityBodyForModelId(inner, model)
51723
- };
51724
- if (tierId && tierId !== "free-tier") {
51725
- env.enabled_credit_types = ["GOOGLE_ONE_AI"];
51726
- }
51727
- return env;
52186
+ projectId,
52187
+ meta: served.meta?.[model],
52188
+ conversation: antigravityConversations.of(inner, request?.conversationScope),
52189
+ sessionId: antigravityConversations.sessionId
52190
+ });
51728
52191
  }
51729
52192
  };
51730
52193
  }
51731
52194
  }
51732
52195
  var init_antigravity_credential = __esm(() => {
52196
+ init_antigravity_envelope();
51733
52197
  init_antigravity2();
51734
52198
  init_antigravity_token();
51735
52199
  init_antigravity_user();
@@ -54405,7 +54869,7 @@ var init_dist12 = __esm(() => {
54405
54869
 
54406
54870
  // src/auth/codex-pkce.ts
54407
54871
  import { exec as exec4 } from "child_process";
54408
- import { createHash as createHash13, randomBytes as randomBytes7 } from "crypto";
54872
+ import { createHash as createHash15, randomBytes as randomBytes9 } from "crypto";
54409
54873
  import { createServer } from "http";
54410
54874
  import { promisify as promisify3 } from "util";
54411
54875
  function loginClaims(idToken) {
@@ -54516,9 +54980,9 @@ function waitForCallback(options, deps) {
54516
54980
  }
54517
54981
  async function loginCodexPkce(deps = {}) {
54518
54982
  log("[CodexOAuth] Starting OAuth login flow");
54519
- const verifier = randomBytes7(64).toString("base64url");
54520
- const challenge = createHash13("sha256").update(verifier).digest("base64url");
54521
- const state = randomBytes7(32).toString("base64url");
54983
+ const verifier = randomBytes9(64).toString("base64url");
54984
+ const challenge = createHash15("sha256").update(verifier).digest("base64url");
54985
+ const state = randomBytes9(32).toString("base64url");
54522
54986
  const options = {
54523
54987
  port: 1455,
54524
54988
  timeoutMs: 5 * 60 * 1000,
@@ -55110,7 +55574,7 @@ var init_codex_oauth = __esm(() => {
55110
55574
  });
55111
55575
 
55112
55576
  // src/auth/accounts/management.ts
55113
- import { randomBytes as randomBytes8 } from "crypto";
55577
+ import { randomBytes as randomBytes10 } from "crypto";
55114
55578
  import { accessSync, constants as fsConstants, lstatSync as lstatSync3, readFileSync as readFileSync23 } from "fs";
55115
55579
  function legacyMoveDeferredMessage(outcome, env = process.env) {
55116
55580
  return `Could not move the existing Codex login into the macOS Keychain (${outcome.reason}: ` + `${redactSecrets(outcome.detail)}). The login was not moved; ${legacyCodexCredentialsPath(env)} was kept. ` + MOVE_HINTS[outcome.reason];
@@ -55292,7 +55756,7 @@ class CodexAccountManagement {
55292
55756
  }
55293
55757
  newId(entry, reserved) {
55294
55758
  for (let attempt = 0;attempt < 16; attempt++) {
55295
- const id = this.deps.newId?.() ?? randomBytes8(6).toString("hex");
55759
+ const id = this.deps.newId?.() ?? randomBytes10(6).toString("hex");
55296
55760
  if (!ACCOUNT_ID_PATTERN.test(id))
55297
55761
  throw new Error("The account id generator returned an invalid id.");
55298
55762
  if (id !== reserved && !entry.accounts.some((row) => row.id === id))
@@ -55382,7 +55846,7 @@ class CodexAccountManagement {
55382
55846
  fingerprint: fingerprintOf(credentials2.refresh_token),
55383
55847
  journal: null,
55384
55848
  updatedAt: this.now(),
55385
- writeId: randomBytes8(16).toString("hex")
55849
+ writeId: randomBytes10(16).toString("hex")
55386
55850
  };
55387
55851
  }
55388
55852
  async run(command) {
@@ -55820,7 +56284,7 @@ class CodexAccountManagement {
55820
56284
  const existing = await dest.read(row, { uncached: true });
55821
56285
  const record = {
55822
56286
  ...material,
55823
- writeId: randomBytes8(16).toString("hex"),
56287
+ writeId: randomBytes10(16).toString("hex"),
55824
56288
  updatedAt: this.now()
55825
56289
  };
55826
56290
  const resumed = existing !== null && sameDurableRecord(existing, material);
@@ -56029,14 +56493,14 @@ var init_management = __esm(() => {
56029
56493
  });
56030
56494
 
56031
56495
  // src/auth/accounts/legacy-move.ts
56032
- import { lstatSync as lstatSync4, realpathSync as realpathSync3 } from "fs";
56496
+ import { lstatSync as lstatSync4, realpathSync as realpathSync4 } from "fs";
56033
56497
  import { join as join23, resolve as resolve2 } from "path";
56034
56498
  function legacyMoveKeychainBlocked(env = process.env) {
56035
56499
  return env.CLAUDISH_DISABLE_KEYCHAIN === "1" || !isKeychainSupported();
56036
56500
  }
56037
56501
  function canonical(path) {
56038
56502
  try {
56039
- return realpathSync3(path);
56503
+ return realpathSync4(path);
56040
56504
  } catch {
56041
56505
  return resolve2(path);
56042
56506
  }
@@ -56465,12 +56929,12 @@ var init_grok_credential = __esm(() => {
56465
56929
 
56466
56930
  // src/auth/kimi-oauth.ts
56467
56931
  import { exec as exec5 } from "child_process";
56468
- import { randomBytes as randomBytes9 } from "crypto";
56932
+ import { randomBytes as randomBytes11 } from "crypto";
56469
56933
  import {
56470
- closeSync as closeSync7,
56934
+ closeSync as closeSync8,
56471
56935
  existsSync as existsSync19,
56472
56936
  mkdirSync as mkdirSync12,
56473
- openSync as openSync7,
56937
+ openSync as openSync8,
56474
56938
  readFileSync as readFileSync25,
56475
56939
  unlinkSync as unlinkSync7,
56476
56940
  writeSync as writeSync6
@@ -56552,13 +57016,13 @@ class KimiOAuth {
56552
57016
  log(`[KimiOAuth] Failed to load device ID: ${e.message}`);
56553
57017
  }
56554
57018
  }
56555
- const deviceId = randomBytes9(16).toString("hex").replace(/(.{8})(.{4})(.{4})(.{4})(.{12})/, "$1-$2-$3-$4-$5");
57019
+ const deviceId = randomBytes11(16).toString("hex").replace(/(.{8})(.{4})(.{4})(.{4})(.{12})/, "$1-$2-$3-$4-$5");
56556
57020
  try {
56557
- const fd = openSync7(deviceIdPath, "w", 384);
57021
+ const fd = openSync8(deviceIdPath, "w", 384);
56558
57022
  try {
56559
57023
  writeSync6(fd, deviceId, 0, "utf-8");
56560
57024
  } finally {
56561
- closeSync7(fd);
57025
+ closeSync8(fd);
56562
57026
  }
56563
57027
  log(`[KimiOAuth] New device ID created: ${deviceId}`);
56564
57028
  } catch (e) {
@@ -57904,14 +58368,14 @@ var init_vertex_credential = __esm(() => {
57904
58368
  });
57905
58369
 
57906
58370
  // src/providers/dynamic-models-catalog-store.ts
57907
- import { createHmac, randomBytes as randomBytes10 } from "crypto";
58371
+ import { createHmac, randomBytes as randomBytes12 } from "crypto";
57908
58372
  import {
57909
- closeSync as closeSync8,
58373
+ closeSync as closeSync9,
57910
58374
  fsyncSync as fsyncSync3,
57911
58375
  linkSync as linkSync2,
57912
58376
  lstatSync as lstatSync5,
57913
58377
  mkdirSync as mkdirSync15,
57914
- openSync as openSync8,
58378
+ openSync as openSync9,
57915
58379
  readFileSync as readFileSync29,
57916
58380
  readdirSync as readdirSync3,
57917
58381
  rmSync as rmSync9,
@@ -57980,13 +58444,13 @@ function readSecret(path) {
57980
58444
  function createSecret(path) {
57981
58445
  const dir = dirname13(path);
57982
58446
  mkdirSync15(dir, { recursive: true, mode: 448 });
57983
- const temp = join29(dir, `.dynamic-models-catalog.key.${process.pid}.${randomBytes10(6).toString("hex")}`);
57984
- const fd = openSync8(temp, "wx", 384);
58447
+ const temp = join29(dir, `.dynamic-models-catalog.key.${process.pid}.${randomBytes12(6).toString("hex")}`);
58448
+ const fd = openSync9(temp, "wx", 384);
57985
58449
  try {
57986
- writeSync7(fd, randomBytes10(32).toString("hex"));
58450
+ writeSync7(fd, randomBytes12(32).toString("hex"));
57987
58451
  fsyncSync3(fd);
57988
58452
  } finally {
57989
- closeSync8(fd);
58453
+ closeSync9(fd);
57990
58454
  }
57991
58455
  try {
57992
58456
  linkSync2(temp, path);
@@ -58214,7 +58678,7 @@ var init_dynamic_models_catalog_store = __esm(() => {
58214
58678
  });
58215
58679
 
58216
58680
  // src/providers/dynamic-models-catalog.ts
58217
- import { createHmac as createHmac2, randomBytes as randomBytes11 } from "crypto";
58681
+ import { createHmac as createHmac2, randomBytes as randomBytes13 } from "crypto";
58218
58682
  function nowOf2(opts) {
58219
58683
  return opts?.now ? opts.now() : Date.now();
58220
58684
  }
@@ -58432,7 +58896,7 @@ var init_dynamic_models_catalog = __esm(() => {
58432
58896
  init_dynamic_models_catalog_store();
58433
58897
  init_model_discovery();
58434
58898
  init_provider_definitions();
58435
- processSecret = randomBytes11(32);
58899
+ processSecret = randomBytes13(32);
58436
58900
  identityMemo = new Map;
58437
58901
  liveMemory = new Map;
58438
58902
  inFlight4 = new Map;
@@ -59355,14 +59819,14 @@ var init_proto_codec = __esm(() => {
59355
59819
  });
59356
59820
 
59357
59821
  // src/providers/devin/devin-request.ts
59358
- import { randomUUID as randomUUID5 } from "crypto";
59822
+ import { randomUUID as randomUUID4 } from "crypto";
59359
59823
  function encodeChatMetadata(meta) {
59360
59824
  const version = meta.clientVersion ?? DEVIN_CLI_VERSION;
59361
59825
  return msg(bytes(1, "devin-cli"), bytes(2, version), bytes(3, meta.apiKey), bytes(4, "en"), bytes(5, meta.platform ?? process.platform), bytes(7, version), bytes(12, "chisel"), bytes(28, "chisel"));
59362
59826
  }
59363
59827
  function encodeMessage(message) {
59364
59828
  const parts = [
59365
- bytes(1, message.id ?? randomUUID5()),
59829
+ bytes(1, message.id ?? randomUUID4()),
59366
59830
  vint(2, DEVIN_ROLE[message.role])
59367
59831
  ];
59368
59832
  if (message.text)
@@ -59425,7 +59889,7 @@ var init_devin_request = __esm(() => {
59425
59889
  });
59426
59890
 
59427
59891
  // src/providers/devin/devin-models.ts
59428
- import { createHash as createHash14 } from "crypto";
59892
+ import { createHash as createHash16 } from "crypto";
59429
59893
  function unaryMetadata(apiKey) {
59430
59894
  return msg(bytes(1, "chisel"), bytes(2, DEVIN_CLI_VERSION), bytes(3, apiKey), bytes(4, "en"), bytes(5, process.platform), bytes(7, DEVIN_CLI_VERSION));
59431
59895
  }
@@ -59614,7 +60078,7 @@ function decodeAllowedUids(body) {
59614
60078
  return uids;
59615
60079
  }
59616
60080
  function hashApiKey(apiKey) {
59617
- return createHash14("sha256").update(apiKey).digest("hex");
60081
+ return createHash16("sha256").update(apiKey).digest("hex");
59618
60082
  }
59619
60083
  async function getServedDevinModels(opts) {
59620
60084
  const now = Date.now();
@@ -60191,7 +60655,7 @@ var init_model_discovery_builtins = __esm(() => {
60191
60655
  });
60192
60656
 
60193
60657
  // src/providers/model-discovery.ts
60194
- import { createHash as createHash15 } from "crypto";
60658
+ import { createHash as createHash17 } from "crypto";
60195
60659
  function toModelsCatalogEntry(model) {
60196
60660
  const { id, ...rest } = model;
60197
60661
  return { wireId: id, ...rest };
@@ -60204,7 +60668,7 @@ function getModelDiscoveryFetcher(format) {
60204
60668
  }
60205
60669
  async function accountFingerprint(providerName) {
60206
60670
  const identity = await credentials.accountIdentity(providerName, { allowOpPrompt: false });
60207
- return identity ? createHash15("sha256").update(identity).digest("hex") : undefined;
60671
+ return identity ? createHash17("sha256").update(identity).digest("hex") : undefined;
60208
60672
  }
60209
60673
  function recordFailure(failure) {
60210
60674
  _failures.set(failure.provider, failure);
@@ -61176,7 +61640,7 @@ function reduceEvent(state, event) {
61176
61640
  }
61177
61641
 
61178
61642
  // src/session-events/transcript-tailer.ts
61179
- import { closeSync as closeSync9, openSync as openSync9, readSync as readSync2, statSync as statSync12 } from "fs";
61643
+ import { closeSync as closeSync10, openSync as openSync10, readSync as readSync3, statSync as statSync12 } from "fs";
61180
61644
 
61181
61645
  class TranscriptTailer {
61182
61646
  filePath;
@@ -61229,16 +61693,16 @@ class TranscriptTailer {
61229
61693
  }
61230
61694
  if (size === this.offset)
61231
61695
  return;
61232
- const fd = openSync9(this.filePath, "r");
61696
+ const fd = openSync10(this.filePath, "r");
61233
61697
  let chunk;
61234
61698
  try {
61235
61699
  chunk = Buffer.alloc(size - this.offset);
61236
- const bytesRead = readSync2(fd, chunk, 0, chunk.length, this.offset);
61700
+ const bytesRead = readSync3(fd, chunk, 0, chunk.length, this.offset);
61237
61701
  this.offset += bytesRead;
61238
61702
  if (bytesRead < chunk.length)
61239
61703
  chunk = chunk.subarray(0, bytesRead);
61240
61704
  } finally {
61241
- closeSync9(fd);
61705
+ closeSync10(fd);
61242
61706
  }
61243
61707
  this.buffer += this.decoder.decode(chunk, { stream: true });
61244
61708
  const lines = this.buffer.split(`
@@ -61747,7 +62211,7 @@ function formatOtlpBatch(events, resource) {
61747
62211
  }
61748
62212
 
61749
62213
  // src/telemetry.ts
61750
- import { randomBytes as randomBytes12 } from "crypto";
62214
+ import { randomBytes as randomBytes14 } from "crypto";
61751
62215
  function getVersion() {
61752
62216
  return VERSION;
61753
62217
  }
@@ -62016,7 +62480,7 @@ function initTelemetry(_config) {
62016
62480
  } catch {
62017
62481
  consentEnabled = false;
62018
62482
  }
62019
- sessionId = randomBytes12(8).toString("hex");
62483
+ sessionId = randomBytes14(8).toString("hex");
62020
62484
  claudishVersion = getVersion();
62021
62485
  installMethod = detectInstallMethod();
62022
62486
  }
@@ -64911,7 +65375,7 @@ data: ${JSON.stringify(data)}
64911
65375
  };
64912
65376
  toolCalls.set(toolIdx, t);
64913
65377
  if (opts.onToolCall) {
64914
- opts.onToolCall(toolId, part.functionCall.name, part.thoughtSignature);
65378
+ opts.onToolCall(toolId, part.functionCall.name, part.thoughtSignature, typeof part.functionCall.id === "string" ? part.functionCall.id : undefined);
64915
65379
  }
64916
65380
  send("content_block_start", {
64917
65381
  type: "content_block_start",
@@ -68111,7 +68575,7 @@ var init_upstream_error_capture = __esm(() => {
68111
68575
  });
68112
68576
 
68113
68577
  // src/handlers/composed-handler.ts
68114
- import { randomUUID as randomUUID6 } from "crypto";
68578
+ import { randomUUID as randomUUID5 } from "crypto";
68115
68579
  function startAllowanceFlight() {
68116
68580
  try {
68117
68581
  return getAllowanceService().requestStarted();
@@ -68632,7 +69096,7 @@ class ComposedHandler {
68632
69096
  overload: { attempts: 0 },
68633
69097
  deadlineAt: tier1DeadlineAt(c),
68634
69098
  payloadVersion: 0,
68635
- requestId: randomUUID6(),
69099
+ requestId: randomUUID5(),
68636
69100
  outcomes: new Map,
68637
69101
  observedResponses: new WeakSet,
68638
69102
  ledger
@@ -69148,7 +69612,8 @@ class ComposedHandler {
69148
69612
  const fetchCurrent = () => {
69149
69613
  if (callSignal?.aborted)
69150
69614
  return Promise.reject(callAbortError());
69151
- return fetch(activeEndpoint, mergeSignalIntoInit({
69615
+ const send = this.provider.fetch ? (url, init) => this.provider.fetch(url, init) : fetch;
69616
+ return send(activeEndpoint, mergeSignalIntoInit({
69152
69617
  method: "POST",
69153
69618
  headers: activeHeaders,
69154
69619
  body: serialized.body,
@@ -70111,9 +70576,9 @@ class ComposedHandler {
70111
70576
  onToolCallObserved: observeToolCall
70112
70577
  });
70113
70578
  case "gemini-sse": {
70114
- const onToolCall = (toolId, name, thoughtSignature) => {
70579
+ const onToolCall = (toolId, name, thoughtSignature, callId) => {
70115
70580
  if (typeof adapter.registerToolCall === "function") {
70116
- adapter.registerToolCall(toolId, name, thoughtSignature);
70581
+ adapter.registerToolCall(toolId, name, thoughtSignature, callId);
70117
70582
  }
70118
70583
  };
70119
70584
  return createGeminiSseStream(c, response, {
@@ -71097,20 +71562,6 @@ var init_ollamacloud = __esm(() => {
71097
71562
  init_probe_discovery();
71098
71563
  });
71099
71564
 
71100
- // src/providers/transport/conversation-key.ts
71101
- import { createHash as createHash16, randomBytes as randomBytes13 } from "crypto";
71102
- function conversationKey(claudeRequest) {
71103
- const sessionId = extractSessionId(claudeRequest);
71104
- if (!sessionId)
71105
- return `claudish_${FALLBACK_CONVERSATION_KEY}`;
71106
- return `claudish_${createHash16("sha256").update(sessionId).digest("hex").slice(0, 32)}`;
71107
- }
71108
- var FALLBACK_CONVERSATION_KEY;
71109
- var init_conversation_key = __esm(() => {
71110
- init_harness();
71111
- FALLBACK_CONVERSATION_KEY = randomBytes13(16).toString("hex");
71112
- });
71113
-
71114
71565
  // src/providers/transport/openai-codex.ts
71115
71566
  var OpenAICodexTransport;
71116
71567
  var init_openai_codex = __esm(() => {
@@ -72356,7 +72807,10 @@ var init_provider_profiles = __esm(() => {
72356
72807
  antigravityProfile = {
72357
72808
  createHandler(ctx) {
72358
72809
  const transport = new AntigravityProviderTransport(ctx.modelName);
72359
- const adapter = new GeminiAPIFormat(ctx.modelName, undefined, { thinkingFromModelName: true });
72810
+ const adapter = new GeminiAPIFormat(ctx.modelName, undefined, {
72811
+ thinkingFromModelName: true,
72812
+ serverCallIds: true
72813
+ });
72360
72814
  const handler = new ComposedHandler(transport, ctx.targetModel, ctx.modelName, ctx.port, {
72361
72815
  adapter,
72362
72816
  unwrapGeminiResponse: true,
@@ -87381,7 +87835,7 @@ function herdrPaneEnv(env = process.env) {
87381
87835
  }
87382
87836
 
87383
87837
  // src/auth/claude-code-facts.ts
87384
- import { createHash as createHash17 } from "crypto";
87838
+ import { createHash as createHash18 } from "crypto";
87385
87839
  import { homedir as homedir35 } from "os";
87386
87840
  import { isAbsolute as isAbsolute2, resolve as resolve4 } from "path";
87387
87841
  function defaultConfigDir(env) {
@@ -87394,7 +87848,7 @@ function claudeCodeConfigDir(env = process.env) {
87394
87848
  return isAbsolute2(raw) ? resolve4(raw) : resolve4(process.cwd(), raw);
87395
87849
  }
87396
87850
  function configDirHash(configDir) {
87397
- return createHash17("sha256").update(configDir).digest("hex").slice(0, 8);
87851
+ return createHash18("sha256").update(configDir).digest("hex").slice(0, 8);
87398
87852
  }
87399
87853
  function claudeCodeSecureStorageServices(kind, env = process.env) {
87400
87854
  const base = `${BASE_KEYCHAIN_SERVICE}${kind}`;
@@ -89407,7 +89861,7 @@ var init_slot_steps = __esm(() => {
89407
89861
  });
89408
89862
 
89409
89863
  // src/pane/subagent-ledger.ts
89410
- import { createHash as createHash18 } from "crypto";
89864
+ import { createHash as createHash19 } from "crypto";
89411
89865
  function str4(v) {
89412
89866
  return typeof v === "string" && v.length > 0 ? v : null;
89413
89867
  }
@@ -89419,7 +89873,7 @@ function subagentDescription(v) {
89419
89873
  return line ? line.slice(0, SUBAGENT_DESCRIPTION_MAX) : null;
89420
89874
  }
89421
89875
  function digest(text) {
89422
- return createHash18("sha256").update(text).digest("base64");
89876
+ return createHash19("sha256").update(text).digest("base64");
89423
89877
  }
89424
89878
  function userText(r) {
89425
89879
  const c = r.message?.content;
@@ -89735,14 +90189,14 @@ var init_subagent_ledger = __esm(() => {
89735
90189
 
89736
90190
  // src/pane/transcript-follower.ts
89737
90191
  import {
89738
- closeSync as closeSync10,
90192
+ closeSync as closeSync11,
89739
90193
  existsSync as existsSync27,
89740
90194
  fstatSync as fstatSync3,
89741
- openSync as openSync10,
90195
+ openSync as openSync11,
89742
90196
  readFileSync as readFileSync36,
89743
- readSync as readSync3,
90197
+ readSync as readSync4,
89744
90198
  readdirSync as readdirSync6,
89745
- realpathSync as realpathSync4,
90199
+ realpathSync as realpathSync5,
89746
90200
  statSync as statSync13
89747
90201
  } from "fs";
89748
90202
  import { join as join39 } from "path";
@@ -89762,7 +90216,7 @@ function initialFollowerState(resolvePath = safeRealpath) {
89762
90216
  }
89763
90217
  function safeRealpath(p) {
89764
90218
  try {
89765
- return realpathSync4(p);
90219
+ return realpathSync5(p);
89766
90220
  } catch {
89767
90221
  return p;
89768
90222
  }
@@ -90250,7 +90704,7 @@ class Tail {
90250
90704
  read() {
90251
90705
  let fd;
90252
90706
  try {
90253
- fd = openSync10(this.path, "r");
90707
+ fd = openSync11(this.path, "r");
90254
90708
  } catch {
90255
90709
  return [];
90256
90710
  }
@@ -90259,7 +90713,7 @@ class Tail {
90259
90713
  if (size <= this.offset)
90260
90714
  return [];
90261
90715
  const chunk = Buffer.alloc(size - this.offset);
90262
- const got = readSync3(fd, chunk, 0, chunk.length, this.offset);
90716
+ const got = readSync4(fd, chunk, 0, chunk.length, this.offset);
90263
90717
  this.offset += got;
90264
90718
  const fresh = chunk.subarray(0, got);
90265
90719
  const buf = this.rest.length ? Buffer.concat([this.rest, fresh]) : fresh;
@@ -90276,7 +90730,7 @@ class Tail {
90276
90730
  this.rest = Buffer.from(buf.subarray(start));
90277
90731
  return out;
90278
90732
  } finally {
90279
- closeSync10(fd);
90733
+ closeSync11(fd);
90280
90734
  }
90281
90735
  }
90282
90736
  }
@@ -90537,7 +90991,7 @@ __export(exports_session_discovery, {
90537
90991
  transcriptPathFor: () => transcriptPathFor
90538
90992
  });
90539
90993
  import { execFile as execFile4, execFileSync as execFileSync2 } from "child_process";
90540
- import { closeSync as closeSync11, openSync as openSync11, readSync as readSync4, readdirSync as readdirSync7, realpathSync as realpathSync5, statSync as statSync14 } from "fs";
90994
+ import { closeSync as closeSync12, openSync as openSync12, readSync as readSync5, readdirSync as readdirSync7, realpathSync as realpathSync6, statSync as statSync14 } from "fs";
90541
90995
  import { basename as basename3, join as join41 } from "path";
90542
90996
  function projectsDir(env = process.env) {
90543
90997
  return join41(claudeConfigDir(env), "projects");
@@ -90548,7 +91002,7 @@ function slugForPath(absPath) {
90548
91002
  function transcriptPathFor(cwd, sessionUuid, projectsRoot = projectsDir()) {
90549
91003
  let real = cwd;
90550
91004
  try {
90551
- real = realpathSync5(cwd);
91005
+ real = realpathSync6(cwd);
90552
91006
  } catch {}
90553
91007
  return join41(projectsRoot, slugForPath(real), `${sessionUuid}.jsonl`);
90554
91008
  }
@@ -90787,16 +91241,16 @@ function readChunk(file, pos, len) {
90787
91241
  return "";
90788
91242
  let fd = null;
90789
91243
  try {
90790
- fd = openSync11(file, "r");
91244
+ fd = openSync12(file, "r");
90791
91245
  const buf = Buffer.allocUnsafe(len);
90792
- const n = readSync4(fd, buf, 0, len, pos);
91246
+ const n = readSync5(fd, buf, 0, len, pos);
90793
91247
  return buf.subarray(0, n).toString("utf-8");
90794
91248
  } catch {
90795
91249
  return "";
90796
91250
  } finally {
90797
91251
  if (fd !== null) {
90798
91252
  try {
90799
- closeSync11(fd);
91253
+ closeSync12(fd);
90800
91254
  } catch {}
90801
91255
  }
90802
91256
  }
@@ -92066,11 +92520,11 @@ var init_magmux_binary = () => {};
92066
92520
  // src/launcher/magmux-wrapper.ts
92067
92521
  import {
92068
92522
  chmodSync as chmodSync3,
92069
- closeSync as closeSync12,
92523
+ closeSync as closeSync13,
92070
92524
  existsSync as existsSync30,
92071
92525
  mkdirSync as mkdirSync20,
92072
92526
  mkdtempSync,
92073
- openSync as openSync12,
92527
+ openSync as openSync13,
92074
92528
  rmSync as rmSync11,
92075
92529
  writeFileSync as writeFileSync16
92076
92530
  } from "fs";
@@ -92146,11 +92600,11 @@ function planMagmuxWrap(input) {
92146
92600
  const scriptPath = join44(scriptDir, "claude-launch.sh");
92147
92601
  const parentEnv = input.parentEnv ?? process.env;
92148
92602
  const deltas = envDeltas(parentEnv, input.childEnv);
92149
- const fd = openSync12(scriptPath, "wx", 384);
92603
+ const fd = openSync13(scriptPath, "wx", 384);
92150
92604
  try {
92151
92605
  writeFileSync16(fd, buildLauncherScript(input.claudeBinary, input.claudeArgs, deltas));
92152
92606
  } finally {
92153
- closeSync12(fd);
92607
+ closeSync13(fd);
92154
92608
  }
92155
92609
  const env = { ...input.childEnv };
92156
92610
  for (const k of STRIPPED_CHILD_VARS)
@@ -107205,9 +107659,9 @@ var init_seam_hooks = __esm(() => {
107205
107659
  });
107206
107660
 
107207
107661
  // src/hooks/seam-tap.ts
107208
- import { randomUUID as randomUUID7 } from "crypto";
107662
+ import { randomUUID as randomUUID6 } from "crypto";
107209
107663
  function newRequestId() {
107210
- return randomUUID7();
107664
+ return randomUUID6();
107211
107665
  }
107212
107666
 
107213
107667
  class EndLine {
@@ -110477,7 +110931,7 @@ var init_process_identity = __esm(() => {
110477
110931
 
110478
110932
  // src/pane/pane-launch.ts
110479
110933
  import { spawn } from "child_process";
110480
- import { randomBytes as randomBytes14 } from "crypto";
110934
+ import { randomBytes as randomBytes15 } from "crypto";
110481
110935
  import {
110482
110936
  chmodSync as chmodSync4,
110483
110937
  lstatSync as lstatSync7,
@@ -110538,7 +110992,7 @@ function ensureSockRoot(given = sockRootFor()) {
110538
110992
  }
110539
110993
  function mintPaneId(kind, label) {
110540
110994
  const head = `c${process.pid}-${OWNER_START36}-${kind}`;
110541
- const tail = `-${randomBytes14(3).toString("hex")}`;
110995
+ const tail = `-${randomBytes15(3).toString("hex")}`;
110542
110996
  const room = Math.max(0, 40 - head.length - tail.length);
110543
110997
  const clean = label.replace(/[^A-Za-z0-9_]/g, "").slice(0, room);
110544
110998
  const id = `${head}${clean}${tail}`;
@@ -111695,14 +112149,14 @@ var init_terminal_isolation = __esm(() => {
111695
112149
 
111696
112150
  // src/claude-runner.ts
111697
112151
  import { spawn as spawn2 } from "child_process";
111698
- import { randomUUID as randomUUID8 } from "crypto";
112152
+ import { randomUUID as randomUUID7 } from "crypto";
111699
112153
  import {
111700
112154
  chmodSync as chmodSync5,
111701
- closeSync as closeSync13,
112155
+ closeSync as closeSync14,
111702
112156
  existsSync as existsSync37,
111703
112157
  mkdirSync as mkdirSync26,
111704
112158
  mkdtempSync as mkdtempSync3,
111705
- openSync as openSync13,
112159
+ openSync as openSync14,
111706
112160
  readFileSync as readFileSync43,
111707
112161
  readdirSync as readdirSync9,
111708
112162
  rmSync as rmSync12,
@@ -113010,11 +113464,11 @@ Or set CLAUDE_PATH to your custom installation:`);
113010
113464
  const childWantsTty = config.interactive && !process.stdout.isTTY && Boolean(process.stdin.isTTY);
113011
113465
  if (childWantsTty) {
113012
113466
  try {
113013
- const fd = openSync13("/dev/fd/0", "r+");
113467
+ const fd = openSync14("/dev/fd/0", "r+");
113014
113468
  if (isatty(fd)) {
113015
113469
  ttyFd = fd;
113016
113470
  } else {
113017
- closeSync13(fd);
113471
+ closeSync14(fd);
113018
113472
  }
113019
113473
  } catch {
113020
113474
  ttyFd = undefined;
@@ -113033,7 +113487,7 @@ Or set CLAUDE_PATH to your custom installation:`);
113033
113487
  const sessionFlags = sessionFlagsOf(config.claudeArgs);
113034
113488
  let driverLaunch = null;
113035
113489
  if (surfaces.driver) {
113036
- const minted = sessionFlags.sessionId || sessionFlags.resumes ? null : randomUUID8();
113490
+ const minted = sessionFlags.sessionId || sessionFlags.resumes ? null : randomUUID7();
113037
113491
  const turnDir = mkdtempSync3(join53(tmpdir2(), "claudish-turns-"));
113038
113492
  chmodSync5(turnDir, 448);
113039
113493
  claudeArgs.unshift(...driverLeadingArgs({ mintedSessionId: minted, turnDir }));
@@ -113125,7 +113579,7 @@ Or set CLAUDE_PATH to your custom installation:`);
113125
113579
  const fdToClose = ttyFd;
113126
113580
  proc.on("spawn", () => {
113127
113581
  try {
113128
- closeSync13(fdToClose);
113582
+ closeSync14(fdToClose);
113129
113583
  } catch {}
113130
113584
  });
113131
113585
  }
@@ -113441,7 +113895,7 @@ var init_contract = __esm(() => {
113441
113895
  });
113442
113896
 
113443
113897
  // src/pane/reason-detail.ts
113444
- import { closeSync as closeSync14, fstatSync as fstatSync4, openSync as openSync14, readSync as readSync5 } from "fs";
113898
+ import { closeSync as closeSync15, fstatSync as fstatSync4, openSync as openSync15, readSync as readSync6 } from "fs";
113445
113899
  function reasonDetail(input, upstreamRecords = []) {
113446
113900
  if (!isTerminalState(input.state) || input.state === "COMPLETED")
113447
113901
  return null;
@@ -113522,11 +113976,11 @@ function isObject3(v) {
113522
113976
  function readTailLines(path, maxBytes) {
113523
113977
  let fd = null;
113524
113978
  try {
113525
- fd = openSync14(path, "r");
113979
+ fd = openSync15(path, "r");
113526
113980
  const size = fstatSync4(fd).size;
113527
113981
  const start = Math.max(0, size - maxBytes);
113528
113982
  const buf = Buffer.alloc(size - start);
113529
- readSync5(fd, buf, 0, buf.length, start);
113983
+ readSync6(fd, buf, 0, buf.length, start);
113530
113984
  const lines = buf.toString("utf-8").split(`
113531
113985
  `);
113532
113986
  if (start > 0)
@@ -113537,7 +113991,7 @@ function readTailLines(path, maxBytes) {
113537
113991
  } finally {
113538
113992
  if (fd !== null) {
113539
113993
  try {
113540
- closeSync14(fd);
113994
+ closeSync15(fd);
113541
113995
  } catch {}
113542
113996
  }
113543
113997
  }
@@ -114155,7 +114609,7 @@ var init_token_watch = __esm(() => {
114155
114609
  });
114156
114610
 
114157
114611
  // src/view/view-claims.ts
114158
- import { randomBytes as randomBytes15 } from "crypto";
114612
+ import { randomBytes as randomBytes16 } from "crypto";
114159
114613
  function ownerOf(caller) {
114160
114614
  return caller.kind === "mcp" ? "mcp" : caller.connId;
114161
114615
  }
@@ -114187,7 +114641,7 @@ class ViewClaims {
114187
114641
  const same = cur?.owner === by;
114188
114642
  const next = {
114189
114643
  ...who,
114190
- claimId: same && cur ? cur.claimId : randomBytes15(8).toString("hex"),
114644
+ claimId: same && cur ? cur.claimId : randomBytes16(8).toString("hex"),
114191
114645
  owner: by,
114192
114646
  since: same && cur ? cur.since : new Date(now).toISOString(),
114193
114647
  expiresAt: now + CLAUDE_CODE_CLAIM_TTL_MS
@@ -114278,14 +114732,14 @@ var init_view_claims = __esm(() => {
114278
114732
  });
114279
114733
 
114280
114734
  // src/team-orchestrator.ts
114281
- import { randomBytes as randomBytes16, randomUUID as randomUUID9 } from "crypto";
114735
+ import { randomBytes as randomBytes17, randomUUID as randomUUID8 } from "crypto";
114282
114736
  import {
114283
114737
  existsSync as existsSync39,
114284
114738
  lstatSync as lstatSync8,
114285
114739
  mkdirSync as mkdirSync27,
114286
114740
  readFileSync as readFileSync45,
114287
114741
  readdirSync as readdirSync11,
114288
- realpathSync as realpathSync6,
114742
+ realpathSync as realpathSync7,
114289
114743
  rmSync as rmSync14,
114290
114744
  statSync as statSync21,
114291
114745
  writeFileSync as writeFileSync22
@@ -114825,13 +115279,13 @@ function answerFailureDetail(v, answer, requirePattern, outcomes) {
114825
115279
  function readWrittenFile(path, root) {
114826
115280
  let realRoot;
114827
115281
  try {
114828
- realRoot = realpathSync6(root);
115282
+ realRoot = realpathSync7(root);
114829
115283
  } catch {
114830
115284
  realRoot = resolve7(root);
114831
115285
  }
114832
115286
  let real;
114833
115287
  try {
114834
- real = realpathSync6(resolve7(root, path));
115288
+ real = realpathSync7(resolve7(root, path));
114835
115289
  } catch {
114836
115290
  return { skip: "missing" };
114837
115291
  }
@@ -114903,11 +115357,11 @@ function validateSessionPath(sessionPath) {
114903
115357
  }
114904
115358
  let real;
114905
115359
  try {
114906
- real = join56(realpathSync6(existing), ...tail);
115360
+ real = join56(realpathSync7(existing), ...tail);
114907
115361
  } catch {
114908
115362
  throw outside();
114909
115363
  }
114910
- const cwd = realpathSync6(process.cwd());
115364
+ const cwd = realpathSync7(process.cwd());
114911
115365
  if (real !== cwd && !real.startsWith(cwd + sep)) {
114912
115366
  throw outside();
114913
115367
  }
@@ -115008,7 +115462,7 @@ async function preflightTeamRun(opts) {
115008
115462
  throw new Error(`pane_limit: ${live} live panes for this user, ${opts.slots} more would exceed ${MAX_LIVE_PANES}`);
115009
115463
  }
115010
115464
  function mintRunId(path, startMs) {
115011
- return `${basename6(path)}-${startMs.toString(36)}-${randomBytes16(3).toString("hex")}`;
115465
+ return `${basename6(path)}-${startMs.toString(36)}-${randomBytes17(3).toString("hex")}`;
115012
115466
  }
115013
115467
  function startModels(sessionPath, opts = {}) {
115014
115468
  const flight = { aborted: false };
@@ -115409,7 +115863,7 @@ async function startModelsIn(flight, sessionPath, opts) {
115409
115863
  stopReason: null
115410
115864
  };
115411
115865
  entries.set(id, e);
115412
- const uuid = randomUUID9();
115866
+ const uuid = randomUUID8();
115413
115867
  const transcriptPath = transcriptPathFor(cwd, uuid, projects);
115414
115868
  updateModelStatus(id, {
115415
115869
  state: "STARTING",
@@ -115968,16 +116422,16 @@ var init_scrollback_buffer = __esm(() => {
115968
116422
  });
115969
116423
 
115970
116424
  // src/mcp-session/session-manager.ts
115971
- import { randomUUID as randomUUID10 } from "crypto";
116425
+ import { randomUUID as randomUUID9 } from "crypto";
115972
116426
  import {
115973
116427
  appendFileSync as appendFileSync7,
115974
- closeSync as closeSync15,
116428
+ closeSync as closeSync16,
115975
116429
  createWriteStream,
115976
116430
  existsSync as existsSync41,
115977
116431
  mkdirSync as mkdirSync28,
115978
- openSync as openSync15,
116432
+ openSync as openSync16,
115979
116433
  readFileSync as readFileSync47,
115980
- readSync as readSync6,
116434
+ readSync as readSync7,
115981
116435
  renameSync as renameSync10,
115982
116436
  rmSync as rmSync15,
115983
116437
  statSync as statSync23,
@@ -116096,15 +116550,15 @@ function readTailText(path, maxBytes) {
116096
116550
  const start = Math.max(0, size - maxBytes);
116097
116551
  const length = size - start;
116098
116552
  const buf = Buffer.alloc(length);
116099
- fd = openSync15(path, "r");
116100
- readSync6(fd, buf, 0, length, start);
116553
+ fd = openSync16(path, "r");
116554
+ readSync7(fd, buf, 0, length, start);
116101
116555
  return { text: buf.toString("utf-8"), truncated: start > 0 };
116102
116556
  } catch {
116103
116557
  return null;
116104
116558
  } finally {
116105
116559
  if (fd !== null) {
116106
116560
  try {
116107
- closeSync15(fd);
116561
+ closeSync16(fd);
116108
116562
  } catch {}
116109
116563
  }
116110
116564
  }
@@ -116244,7 +116698,7 @@ class SessionManager {
116244
116698
  let id = "";
116245
116699
  let dir = "";
116246
116700
  for (let attempt = 0;; attempt++) {
116247
- id = `team-${randomUUID10().replace(/-/g, "").slice(0, 8)}`;
116701
+ id = `team-${randomUUID9().replace(/-/g, "").slice(0, 8)}`;
116248
116702
  dir = join58(this.sessionsDir, id);
116249
116703
  try {
116250
116704
  mkdirSync28(dir);
@@ -116371,8 +116825,8 @@ class SessionManager {
116371
116825
  }
116372
116826
  }
116373
116827
  recordSession(opts, inheritedLayer) {
116374
- const sessionId = opts.sessionId ?? randomUUID10().slice(0, 8);
116375
- const claudeSessionId = randomUUID10();
116828
+ const sessionId = opts.sessionId ?? randomUUID9().slice(0, 8);
116829
+ const claudeSessionId = randomUUID9();
116376
116830
  const timeout = normaliseTimeoutSeconds(opts.timeoutSeconds);
116377
116831
  const agentRequested = requestedAgentOf(opts.claudishFlags ?? []);
116378
116832
  const startedAt = new Date().toISOString();
@@ -117451,7 +117905,7 @@ var init_session_manager = __esm(() => {
117451
117905
  });
117452
117906
 
117453
117907
  // src/view/history.ts
117454
- import { closeSync as closeSync16, openSync as openSync16, readSync as readSync7, readdirSync as readdirSync12, statSync as statSync24 } from "fs";
117908
+ import { closeSync as closeSync17, openSync as openSync17, readSync as readSync8, readdirSync as readdirSync12, statSync as statSync24 } from "fs";
117455
117909
  import { join as join59 } from "path";
117456
117910
  function finishedDetail(promptSummary) {
117457
117911
  return {
@@ -117473,15 +117927,15 @@ function readJson(path) {
117473
117927
  function readHead(path, bytes) {
117474
117928
  let fd = null;
117475
117929
  try {
117476
- fd = openSync16(path, "r");
117930
+ fd = openSync17(path, "r");
117477
117931
  const buf = Buffer.alloc(bytes);
117478
- const n = readSync7(fd, buf, 0, bytes, 0);
117932
+ const n = readSync8(fd, buf, 0, bytes, 0);
117479
117933
  return buf.subarray(0, n).toString("utf8");
117480
117934
  } catch {
117481
117935
  return null;
117482
117936
  } finally {
117483
117937
  if (fd !== null)
117484
- closeSync16(fd);
117938
+ closeSync17(fd);
117485
117939
  }
117486
117940
  }
117487
117941
  function runDirs(sessionsDir) {
@@ -118699,7 +119153,7 @@ var init_pane_registry = __esm(() => {
118699
119153
  });
118700
119154
 
118701
119155
  // src/pane/gate-binding.ts
118702
- import { realpathSync as realpathSync7 } from "fs";
119156
+ import { realpathSync as realpathSync8 } from "fs";
118703
119157
  import { basename as basename8, dirname as dirname26, join as join62, resolve as resolve10 } from "path";
118704
119158
  function normaliseTranscriptPath(p) {
118705
119159
  const abs = resolve10(p);
@@ -118707,7 +119161,7 @@ function normaliseTranscriptPath(p) {
118707
119161
  let cur = abs;
118708
119162
  for (;; ) {
118709
119163
  try {
118710
- return tail.length ? join62(realpathSync7(cur), ...tail.reverse()) : realpathSync7(cur);
119164
+ return tail.length ? join62(realpathSync8(cur), ...tail.reverse()) : realpathSync8(cur);
118711
119165
  } catch {
118712
119166
  const parent = dirname26(cur);
118713
119167
  if (parent === cur)
@@ -119133,7 +119587,7 @@ var init_view_socket = __esm(() => {
119133
119587
  });
119134
119588
 
119135
119589
  // src/pane/pane-session.ts
119136
- import { readFileSync as readFileSync51, realpathSync as realpathSync8, rmSync as rmSync18, statSync as statSync25, writeFileSync as writeFileSync26 } from "fs";
119590
+ import { readFileSync as readFileSync51, realpathSync as realpathSync9, rmSync as rmSync18, statSync as statSync25, writeFileSync as writeFileSync26 } from "fs";
119137
119591
  import { join as join64 } from "path";
119138
119592
  function iso3(ms) {
119139
119593
  return new Date(ms).toISOString();
@@ -121728,7 +122182,7 @@ function preparePane(o, root, parentEnv) {
121728
122182
  try {
121729
122183
  const paneId = mintPaneId(o.kind, o.label);
121730
122184
  const sockPath = sockPathOf(root, paneId);
121731
- const cwd = realpathSync8(o.cwd);
122185
+ const cwd = realpathSync9(o.cwd);
121732
122186
  const launch = o.claudishSpawn ?? resolveClaudishLaunch(parentEnv);
121733
122187
  dirs = createLaunchDirs(root);
121734
122188
  const argv = buildClaudishPaneArgv(o.spawnModel, o.sessionUuid, dirs.turnDir, o.callerFlags, o.spawnPinned === true);
@@ -122900,14 +123354,14 @@ var init_transcript_redaction = __esm(() => {
122900
123354
  // src/pane/transcript-page.ts
122901
123355
  import {
122902
123356
  constants as constants5,
122903
- closeSync as closeSync17,
123357
+ closeSync as closeSync18,
122904
123358
  fstatSync as fstatSync5,
122905
123359
  lstatSync as lstatSync10,
122906
- openSync as openSync17,
122907
- readSync as readSync8,
123360
+ openSync as openSync18,
123361
+ readSync as readSync9,
122908
123362
  readdirSync as readdirSync15,
122909
123363
  readlinkSync,
122910
- realpathSync as realpathSync9,
123364
+ realpathSync as realpathSync10,
122911
123365
  statSync as statSync26
122912
123366
  } from "fs";
122913
123367
  import { basename as basename9, dirname as dirname27, join as join66, sep as sep3 } from "path";
@@ -122957,7 +123411,7 @@ class LineScanner {
122957
123411
  return null;
122958
123412
  const n = Math.min(READ_CHUNK, this.size - at);
122959
123413
  const b = Buffer.alloc(n);
122960
- const got = readSync8(this.fd, b, 0, n, at);
123414
+ const got = readSync9(this.fd, b, 0, n, at);
122961
123415
  if (got <= 0)
122962
123416
  return null;
122963
123417
  this.chunk = got < n ? b.subarray(0, got) : b;
@@ -122992,7 +123446,7 @@ function absentPage(from) {
122992
123446
  }
122993
123447
  function closeQuietly(fd) {
122994
123448
  try {
122995
- closeSync17(fd);
123449
+ closeSync18(fd);
122996
123450
  } catch {}
122997
123451
  }
122998
123452
  function readTranscriptPageFd(fd, from, limits) {
@@ -123005,7 +123459,7 @@ function readTranscriptPageFd(fd, from, limits) {
123005
123459
  throw new ContractErrorException("invalid_args", "'since' is past the end of the transcript");
123006
123460
  if (from.offset > 0) {
123007
123461
  const b = Buffer.alloc(1);
123008
- const got = readSync8(fd, b, 0, 1, from.offset - 1);
123462
+ const got = readSync9(fd, b, 0, 1, from.offset - 1);
123009
123463
  if (got !== 1 || b[0] !== 10)
123010
123464
  throw new ContractErrorException("invalid_args", "'since' is not at a line start");
123011
123465
  }
@@ -123122,8 +123576,8 @@ function openContainedTranscript(path, uuid, projectsRoot) {
123122
123576
  let real;
123123
123577
  let root;
123124
123578
  try {
123125
- real = realpathSync9(path);
123126
- root = realpathSync9(projectsRoot);
123579
+ real = realpathSync10(path);
123580
+ root = realpathSync10(projectsRoot);
123127
123581
  } catch (e) {
123128
123582
  if (!isEnoent(e))
123129
123583
  logRejection(path, errText(e));
@@ -123135,7 +123589,7 @@ function openContainedTranscript(path, uuid, projectsRoot) {
123135
123589
  }
123136
123590
  let fd;
123137
123591
  try {
123138
- fd = openSync17(real, OPEN_FLAGS);
123592
+ fd = openSync18(real, OPEN_FLAGS);
123139
123593
  } catch (e) {
123140
123594
  if (e?.code === "ELOOP")
123141
123595
  logRejection(path, "the transcript became a symlink");
@@ -123152,7 +123606,7 @@ function openContainedTranscript(path, uuid, projectsRoot) {
123152
123606
  }
123153
123607
  const parent = dirname27(real);
123154
123608
  const named = lstatSync10(real);
123155
- if (realpathSync9(parent) !== parent || !named.isFile() || named.dev !== st.dev || named.ino !== st.ino || !kernelPathMatches(fd, real)) {
123609
+ if (realpathSync10(parent) !== parent || !named.isFile() || named.dev !== st.dev || named.ino !== st.ino || !kernelPathMatches(fd, real)) {
123156
123610
  logRejection(path, "the opened file is not the one under the projects directory");
123157
123611
  closeQuietly(fd);
123158
123612
  return null;
@@ -123183,7 +123637,7 @@ function transcriptHeadCwd(path, uuid, projectsRoot) {
123183
123637
  let text;
123184
123638
  try {
123185
123639
  const buf = Buffer.alloc(HEAD_CWD_MAX_BYTES);
123186
- const n = readSync8(fd, buf, 0, HEAD_CWD_MAX_BYTES, 0);
123640
+ const n = readSync9(fd, buf, 0, HEAD_CWD_MAX_BYTES, 0);
123187
123641
  text = buf.toString("utf8", 0, n);
123188
123642
  } catch {
123189
123643
  return null;
@@ -123295,7 +123749,7 @@ var init_pane = __esm(() => {
123295
123749
  });
123296
123750
 
123297
123751
  // src/view/kernel-lock.ts
123298
- import { constants as constants6, closeSync as closeSync18, fstatSync as fstatSync6, openSync as openSync18, statSync as statSync27, unlinkSync as unlinkSync13 } from "fs";
123752
+ import { constants as constants6, closeSync as closeSync19, fstatSync as fstatSync6, openSync as openSync19, statSync as statSync27, unlinkSync as unlinkSync13 } from "fs";
123299
123753
  function bindFlock() {
123300
123754
  const library = process.platform === "darwin" ? "libSystem.B.dylib" : process.platform === "linux" ? "libc.so.6" : null;
123301
123755
  if (!library)
@@ -123338,7 +123792,7 @@ function lockOf(fd, path) {
123338
123792
  return;
123339
123793
  open = false;
123340
123794
  try {
123341
- closeSync18(fd);
123795
+ closeSync19(fd);
123342
123796
  } catch {}
123343
123797
  }
123344
123798
  };
@@ -123348,10 +123802,10 @@ function tryAcquire(path) {
123348
123802
  if (!lib)
123349
123803
  throw new KernelLockUnavailable("flock is not available in this process");
123350
123804
  for (let attempt = 0;attempt < 5; attempt++) {
123351
- const fd = openSync18(path, constants6.O_RDWR | constants6.O_CREAT | O_CLOEXEC, 384);
123805
+ const fd = openSync19(path, constants6.O_RDWR | constants6.O_CREAT | O_CLOEXEC, 384);
123352
123806
  if (lib.flock(fd, LOCK_EX | LOCK_NB) !== 0) {
123353
123807
  const errno = lib.errno();
123354
- closeSync18(fd);
123808
+ closeSync19(fd);
123355
123809
  if (errno === EWOULDBLOCK)
123356
123810
  return null;
123357
123811
  throw new KernelLockUnavailable(`flock ${path}: errno ${errno}`);
@@ -123364,7 +123818,7 @@ function tryAcquire(path) {
123364
123818
  }
123365
123819
  if (same)
123366
123820
  return lockOf(fd, path);
123367
- closeSync18(fd);
123821
+ closeSync19(fd);
123368
123822
  }
123369
123823
  throw new KernelLockUnavailable(`flock ${path}: the file keeps being replaced`);
123370
123824
  }
@@ -123553,7 +124007,7 @@ var init_peer_link = __esm(() => {
123553
124007
  });
123554
124008
 
123555
124009
  // src/view/replay-registry.ts
123556
- import { randomBytes as randomBytes17 } from "crypto";
124010
+ import { randomBytes as randomBytes18 } from "crypto";
123557
124011
  import { readFileSync as readFileSync52, readdirSync as readdirSync16, renameSync as renameSync13, rmSync as rmSync20, writeFileSync as writeFileSync28 } from "fs";
123558
124012
  import { join as join67 } from "path";
123559
124013
  function parseEntry(raw) {
@@ -123626,7 +124080,7 @@ class ReplayRegistry {
123626
124080
  }
123627
124081
  writeLocked(uuid, entry) {
123628
124082
  const path = this.entryPathOf(uuid);
123629
- const tmp = `${path}.${randomBytes17(4).toString("hex")}.tmp`;
124083
+ const tmp = `${path}.${randomBytes18(4).toString("hex")}.tmp`;
123630
124084
  writeFileSync28(tmp, `${JSON.stringify(entry)}
123631
124085
  `, { mode: 384, flag: "wx" });
123632
124086
  try {
@@ -123718,8 +124172,8 @@ var init_replay_registry = __esm(() => {
123718
124172
  });
123719
124173
 
123720
124174
  // src/mcp-session/replay-manager.ts
123721
- import { randomBytes as randomBytes18, randomUUID as randomUUID11 } from "crypto";
123722
- import { constants as constants7, accessSync as accessSync3, closeSync as closeSync19, existsSync as existsSync43, realpathSync as realpathSync10, statSync as statSync28 } from "fs";
124175
+ import { randomBytes as randomBytes19, randomUUID as randomUUID10 } from "crypto";
124176
+ import { constants as constants7, accessSync as accessSync3, closeSync as closeSync20, existsSync as existsSync43, realpathSync as realpathSync11, statSync as statSync28 } from "fs";
123723
124177
  import { dirname as dirname28, resolve as resolve11 } from "path";
123724
124178
  function unavailable2(reason, message) {
123725
124179
  return new ContractErrorException("replay_unavailable", message, reason);
@@ -123734,10 +124188,10 @@ function replayCwd(own) {
123734
124188
  if (own) {
123735
124189
  try {
123736
124190
  if (statSync28(own).isDirectory())
123737
- return realpathSync10(own);
124191
+ return realpathSync11(own);
123738
124192
  } catch {}
123739
124193
  }
123740
- return realpathSync10(process.cwd());
124194
+ return realpathSync11(process.cwd());
123741
124195
  }
123742
124196
  async function replayClaudeBinary(env) {
123743
124197
  const named = env.CLAUDE_PATH ? resolve11(env.CLAUDE_PATH) : "";
@@ -124038,11 +124492,11 @@ class ReplayManager {
124038
124492
  return entry;
124039
124493
  }
124040
124494
  mintReplayId() {
124041
- return `replay-${randomBytes18(8).toString("hex")}`;
124495
+ return `replay-${randomBytes19(8).toString("hex")}`;
124042
124496
  }
124043
124497
  async spawn(slot, target, size, opener, lock, replayId, paneId) {
124044
124498
  const uuid = slot.uuid;
124045
- const forkUuid = randomUUID11();
124499
+ const forkUuid = randomUUID10();
124046
124500
  const cwd = replayCwd(target.cwd);
124047
124501
  const projectsRoot = resolve11(target.projectsRoot);
124048
124502
  const forkPath = transcriptPathFor(cwd, forkUuid, projectsRoot);
@@ -124374,7 +124828,7 @@ class ReplayManager {
124374
124828
  const fd = openContainedTranscript(path, uuid, target.projectsRoot);
124375
124829
  if (fd === null)
124376
124830
  throw noRecord("the session's Claude Code record is gone");
124377
- closeSync19(fd);
124831
+ closeSync20(fd);
124378
124832
  return uuid;
124379
124833
  }
124380
124834
  itemOf(e) {
@@ -132842,7 +133296,7 @@ __export(exports_subscription_probe_command, {
132842
133296
  runProbeWith: () => runProbeWith,
132843
133297
  subscriptionProbeCommand: () => subscriptionProbeCommand
132844
133298
  });
132845
- import { randomUUID as randomUUID12 } from "crypto";
133299
+ import { randomUUID as randomUUID11 } from "crypto";
132846
133300
  function probeExitCodeFor(failure) {
132847
133301
  if (failure.class === "internal") {
132848
133302
  return CALLER_CODES.includes(failure.code) ? PROBE_EXIT.usage : PROBE_EXIT.internal;
@@ -132985,13 +133439,13 @@ async function runProbeWith(deps, facts, secrets, requestFileMessage, determine)
132985
133439
  }
132986
133440
  return result.exitCode;
132987
133441
  }
132988
- function buildProbeEnvelopeBody(model, projectId, tierId, requestText, userPromptId = randomUUID12()) {
132989
- const head = JSON.stringify({ model, project: projectId, user_prompt_id: userPromptId });
132990
- const credits = tierId && tierId !== "free-tier" ? `,"enabled_credit_types":${JSON.stringify(["GOOGLE_ONE_AI"])}` : "";
132991
- return `${head.slice(0, -1)},"request":${requestText}${credits}}`;
133442
+ function firstRequestId() {
133443
+ return `agent/${randomUUID11()}/${Date.now()}/${randomUUID11()}/1`;
132992
133444
  }
132993
- function createActivityRequestId3() {
132994
- return Math.random().toString(36).substring(7);
133445
+ function buildProbeEnvelopeBody(model, projectId, requestText, requestId = firstRequestId()) {
133446
+ const head = JSON.stringify({ project: projectId, requestId });
133447
+ const tail = JSON.stringify({ model, userAgent: "antigravity", requestType: "agent" });
133448
+ return `${head.slice(0, -1)},"request":${requestText},${tail.slice(1)}`;
132995
133449
  }
132996
133450
  async function determineAntigravity2(deps, secrets, facts, args) {
132997
133451
  const request = await readRequestFileChecked(deps.readRequestFile, args.requestFile);
@@ -133011,15 +133465,14 @@ async function determineAntigravity2(deps, secrets, facts, args) {
133011
133465
  try {
133012
133466
  let res;
133013
133467
  try {
133014
- res = await fetch(url, {
133468
+ res = await antigravityFetch(url, {
133015
133469
  method: "POST",
133016
133470
  headers: {
133017
133471
  Authorization: `Bearer ${session.accessToken}`,
133018
133472
  "Content-Type": "application/json",
133019
- "User-Agent": antigravityUserAgentFor(version.version),
133020
- "x-activity-request-id": createActivityRequestId3()
133473
+ "User-Agent": antigravityUserAgentFor(version.version)
133021
133474
  },
133022
- body: buildProbeEnvelopeBody(args.model, session.projectId, session.tierId, request.text),
133475
+ body: buildProbeEnvelopeBody(args.model, session.projectId, request.text),
133023
133476
  signal: controller.signal,
133024
133477
  redirect: "manual"
133025
133478
  });
@@ -133084,6 +133537,7 @@ var PROBE_FAILURE_CODES, PROBE_EXIT, CALLER_CODES, SUBSCRIPTION_PROBE_USAGE = "u
133084
133537
  var init_subscription_probe_command = __esm(() => {
133085
133538
  init_antigravity_token();
133086
133539
  init_antigravity_user();
133540
+ init_antigravity_fetch();
133087
133541
  init_subscription_antigravity_session();
133088
133542
  init_subscription_dispatch();
133089
133543
  init_subscription_secret_guard();
@@ -143090,7 +143544,7 @@ var init_advisor_startup = __esm(() => {
143090
143544
  });
143091
143545
 
143092
143546
  // src/session/conversation.ts
143093
- import { closeSync as closeSync20, openSync as openSync19, readSync as readSync9, statSync as statSync31 } from "fs";
143547
+ import { closeSync as closeSync21, openSync as openSync20, readSync as readSync10, statSync as statSync31 } from "fs";
143094
143548
  import { StringDecoder } from "string_decoder";
143095
143549
  function looksLikeTurn(line) {
143096
143550
  const assistant = line.includes('"type":"assistant"');
@@ -143146,7 +143600,7 @@ function readConversation(file, opts = {}) {
143146
143600
  let fd = null;
143147
143601
  try {
143148
143602
  const size = statSync31(file).size;
143149
- fd = openSync19(file, "r");
143603
+ fd = openSync20(file, "r");
143150
143604
  const buf = Buffer.allocUnsafe(chunkBytes);
143151
143605
  const decoder = new StringDecoder("utf-8");
143152
143606
  let pending = "";
@@ -143178,7 +143632,7 @@ function readConversation(file, opts = {}) {
143178
143632
  take({ role: raw.role, text, elided });
143179
143633
  };
143180
143634
  while (pos < size) {
143181
- const n = readSync9(fd, buf, 0, Math.min(chunkBytes, size - pos), pos);
143635
+ const n = readSync10(fd, buf, 0, Math.min(chunkBytes, size - pos), pos);
143182
143636
  if (n <= 0)
143183
143637
  break;
143184
143638
  pos += n;
@@ -143202,7 +143656,7 @@ function readConversation(file, opts = {}) {
143202
143656
  } catch {} finally {
143203
143657
  if (fd !== null) {
143204
143658
  try {
143205
- closeSync20(fd);
143659
+ closeSync21(fd);
143206
143660
  } catch {}
143207
143661
  }
143208
143662
  }
@@ -144780,15 +145234,15 @@ var MODEL_SETTING_LEDGER_FILE = "model-setting-restore.json";
144780
145234
  var init_model_setting_ledger_path = () => {};
144781
145235
 
144782
145236
  // src/launcher/model-setting-restore.ts
144783
- import { randomUUID as randomUUID13 } from "crypto";
145237
+ import { randomUUID as randomUUID12 } from "crypto";
144784
145238
  import {
144785
- closeSync as closeSync21,
145239
+ closeSync as closeSync22,
144786
145240
  fchmodSync as fchmodSync2,
144787
145241
  fsyncSync as fsyncSync4,
144788
- openSync as openSync20,
145242
+ openSync as openSync21,
144789
145243
  readFileSync as readFileSync59,
144790
145244
  readdirSync as readdirSync20,
144791
- realpathSync as realpathSync11,
145245
+ realpathSync as realpathSync12,
144792
145246
  renameSync as renameSync15,
144793
145247
  rmSync as rmSync22,
144794
145248
  statSync as statSync32,
@@ -144802,7 +145256,7 @@ function canonicalSettingsPath(path) {
144802
145256
  const rest = [];
144803
145257
  for (;; ) {
144804
145258
  try {
144805
- return join78(realpathSync11.native(head), ...rest);
145259
+ return join78(realpathSync12.native(head), ...rest);
144806
145260
  } catch {
144807
145261
  const parent = dirname31(head);
144808
145262
  if (parent === head)
@@ -144902,7 +145356,7 @@ function restoreRound(settingsKey, target, entry, deps, fence) {
144902
145356
  const planned = nextSettingsText(text, entry);
144903
145357
  if ("outcome" in planned)
144904
145358
  return planned.outcome;
144905
- const temp = join78(dirname31(target), `${TEMP_PREFIX}${deps.pid ?? process.pid}-${randomUUID13()}`);
145359
+ const temp = join78(dirname31(target), `${TEMP_PREFIX}${deps.pid ?? process.pid}-${randomUUID12()}`);
144906
145360
  try {
144907
145361
  deps.writeNew(temp, planned.next, statA.mode & 4095);
144908
145362
  } catch {
@@ -145194,7 +145648,7 @@ async function beginModelSettingWatch(listedSpecs, deps = {}) {
145194
145648
  heartbeatMs: LOCK_HEARTBEAT_MS,
145195
145649
  onUnavailable: "fail"
145196
145650
  };
145197
- const sessionId = randomUUID13();
145651
+ const sessionId = randomUUID12();
145198
145652
  const launcherPid = deps.pid ?? process.pid;
145199
145653
  const noRestore = "so claudish will not put back your Claude Code default model after this session";
145200
145654
  let registered = false;
@@ -145348,17 +145802,17 @@ var init_model_setting_restore = __esm(() => {
145348
145802
  init_model_setting_ledger_path();
145349
145803
  GIVE_UP_AFTER_MS = 14 * 24 * 60 * 60 * 1000;
145350
145804
  realRestoreFs = {
145351
- realpath: (path) => realpathSync11.native(path),
145805
+ realpath: (path) => realpathSync12.native(path),
145352
145806
  readFile: (path) => readFileSync59(path),
145353
145807
  stat: (path) => toFileStat(statSync32(path)),
145354
145808
  writeNew: (path, data, mode) => {
145355
- const fd = openSync20(path, "wx", mode);
145809
+ const fd = openSync21(path, "wx", mode);
145356
145810
  try {
145357
145811
  fchmodSync2(fd, mode);
145358
145812
  writeWholeSync(fd, data);
145359
145813
  fsyncSync4(fd);
145360
145814
  } finally {
145361
- closeSync21(fd);
145815
+ closeSync22(fd);
145362
145816
  }
145363
145817
  },
145364
145818
  rename: (from, to) => renameSync15(from, to),