claudish 14.27.0 → 14.27.2

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 +922 -316
  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.2";
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:55:50.416Z",
14149
14149
  format: 1,
14150
14150
  recommendations: {
14151
14151
  contractVersion: 3,
@@ -21107,6 +21107,21 @@ function readModelIdEffort(raw) {
21107
21107
  map.baseServed = record.baseServed;
21108
21108
  return map;
21109
21109
  }
21110
+ function publishedEffortWireId(connection, requested) {
21111
+ const map = readModelIdEffort(connection.modelIdEffort);
21112
+ if (!map)
21113
+ return;
21114
+ const ids = [...Object.values(map.values), ...map.off ? [map.off] : []];
21115
+ if (ids.includes(requested))
21116
+ return requested;
21117
+ const lowered = requested.toLowerCase();
21118
+ const spellings = new Set(ids.filter((id) => id.toLowerCase() === lowered));
21119
+ return spellings.size === 1 ? [...spellings][0] : undefined;
21120
+ }
21121
+ function implicitEffortWireId(connection, requested) {
21122
+ const id = publishedEffortWireId(connection, requested);
21123
+ return id !== undefined && !isOptInWireId(id) ? id : undefined;
21124
+ }
21110
21125
  function asRecord(value) {
21111
21126
  return value && typeof value === "object" && !Array.isArray(value) ? value : undefined;
21112
21127
  }
@@ -21129,10 +21144,10 @@ function mapIdForEffort(map, effort) {
21129
21144
  return map.values[chosen];
21130
21145
  }
21131
21146
  function chooseModelIdForEffort(map, effort, provider) {
21132
- if (effort === "none")
21133
- return map.off ? provider.sendable(map.off) : undefined;
21134
- const id = mapIdForEffort(map, effort);
21135
- return id ? provider.sendable(id) : undefined;
21147
+ const id = effort === "none" ? map.off : mapIdForEffort(map, effort);
21148
+ if (!id || isOptInWireId(id))
21149
+ return;
21150
+ return provider.sendable(id);
21136
21151
  }
21137
21152
  var SPEED_PREMIUM_SUFFIXES;
21138
21153
  var init_model_id_effort = __esm(() => {
@@ -21336,7 +21351,12 @@ function resolveSubscriptionRouting(modelId, provider, cachePath) {
21336
21351
  if (included.length !== plans.length)
21337
21352
  return { kind: "unknown" };
21338
21353
  const connection = entry.aggregators?.find((candidate) => candidate.routeStatus === "mapped" && catalogRouteMatchesProvider(candidate.route, provider));
21339
- return connection?.externalModelId ? { kind: "serves", externalId: connection.externalModelId } : { kind: "unknown" };
21354
+ if (!connection?.externalModelId)
21355
+ return { kind: "unknown" };
21356
+ return {
21357
+ kind: "serves",
21358
+ externalId: implicitEffortWireId(connection, modelId) ?? connection.externalModelId
21359
+ };
21340
21360
  }
21341
21361
  if (plans.some((plan) => plan.modelDiscovery !== "catalog"))
21342
21362
  return { kind: "unknown" };
@@ -23351,11 +23371,25 @@ var init_gemini_api_format = __esm(() => {
23351
23371
  init_base_api_format();
23352
23372
  GeminiAPIFormat = class GeminiAPIFormat extends BaseAPIFormat {
23353
23373
  thinkingFromModelName;
23374
+ serverCallIds;
23354
23375
  constructor(modelId, wireFormat, options = {}) {
23355
23376
  super(modelId, wireFormat);
23356
23377
  this.thinkingFromModelName = options.thinkingFromModelName === true;
23378
+ this.serverCallIds = options.serverCallIds === true;
23357
23379
  }
23358
23380
  toolCallMap = new Map;
23381
+ functionResponsePart(toolInfo, text) {
23382
+ if (!this.serverCallIds) {
23383
+ return { functionResponse: { name: toolInfo.name, response: { content: text } } };
23384
+ }
23385
+ return {
23386
+ functionResponse: {
23387
+ ...toolInfo.callId ? { id: toolInfo.callId } : {},
23388
+ name: toolInfo.name,
23389
+ response: { output: text }
23390
+ }
23391
+ };
23392
+ }
23359
23393
  callIdOf = new WeakMap;
23360
23394
  convertMessages(claudeRequest, _filterIdentityFn) {
23361
23395
  const messages = [];
@@ -23446,25 +23480,11 @@ var init_gemini_api_format = __esm(() => {
23446
23480
  textParts.push(item.text);
23447
23481
  }
23448
23482
  }
23449
- parts.push({
23450
- functionResponse: {
23451
- name: toolInfo.name,
23452
- response: {
23453
- content: textParts.join(`
23454
- `) || "OK"
23455
- }
23456
- }
23457
- });
23483
+ parts.push(this.functionResponsePart(toolInfo, textParts.join(`
23484
+ `) || "OK"));
23458
23485
  parts.push(...imageParts);
23459
23486
  } 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
- });
23487
+ parts.push(this.functionResponsePart(toolInfo, typeof block.content === "string" ? block.content : JSON.stringify(block.content)));
23468
23488
  }
23469
23489
  for (const part of parts.slice(firstResultPart)) {
23470
23490
  this.callIdOf.set(part, block.tool_use_id);
@@ -23485,12 +23505,14 @@ var init_gemini_api_format = __esm(() => {
23485
23505
  } else if (block.type === "tool_use") {
23486
23506
  const toolInfo = this.toolCallMap.get(block.id);
23487
23507
  let thoughtSignature = toolInfo?.thoughtSignature;
23488
- if (!thoughtSignature) {
23508
+ const sentUnsigned = this.serverCallIds && toolInfo?.fromResponse === true;
23509
+ if (!thoughtSignature && !sentUnsigned) {
23489
23510
  thoughtSignature = "skip_thought_signature_validator";
23490
23511
  log(`[GeminiAPIFormat] Using dummy thoughtSignature for tool ${block.name} (${block.id})`);
23491
23512
  }
23492
23513
  const functionCallPart = {
23493
23514
  functionCall: {
23515
+ ...this.serverCallIds && toolInfo?.callId ? { id: toolInfo.callId } : {},
23494
23516
  name: block.name,
23495
23517
  args: block.input
23496
23518
  }
@@ -23619,8 +23641,8 @@ CRITICAL INSTRUCTION FOR OUTPUT FORMAT:
23619
23641
  return 8192;
23620
23642
  }
23621
23643
  }
23622
- registerToolCall(toolId, name, thoughtSignature) {
23623
- this.toolCallMap.set(toolId, { name, thoughtSignature });
23644
+ registerToolCall(toolId, name, thoughtSignature, callId) {
23645
+ this.toolCallMap.set(toolId, { name, thoughtSignature, callId, fromResponse: true });
23624
23646
  if (thoughtSignature) {
23625
23647
  log(`[GeminiAPIFormat] Captured thoughtSignature for tool ${name} (${toolId})`);
23626
23648
  }
@@ -34042,7 +34064,7 @@ function resolveProbeModel() {
34042
34064
  const cache = JSON.parse(readFileSync15(cachePath, "utf-8"));
34043
34065
  for (const m of cache.models ?? []) {
34044
34066
  const slug = m?.slug ?? m?.id;
34045
- if (typeof slug === "string" && slug.length > 0)
34067
+ if (typeof slug === "string" && slug.length > 0 && !isOptInWireId(slug))
34046
34068
  return slug;
34047
34069
  }
34048
34070
  } catch {}
@@ -34182,22 +34204,28 @@ var init_codex2 = __esm(() => {
34182
34204
  function getAgyClientVersion() {
34183
34205
  return version2;
34184
34206
  }
34207
+ function getAgyClientBuild() {
34208
+ return build;
34209
+ }
34185
34210
  function agyClientVersionReadFor(accessToken) {
34186
34211
  return readForToken === accessToken;
34187
34212
  }
34188
- function recordAgyClientVersionRead(read, accessToken) {
34213
+ function recordAgyClientVersionRead(read, accessToken, readBuild = null) {
34189
34214
  readForToken = accessToken;
34190
- if (read === null || read === version2)
34215
+ if (read === null)
34216
+ return false;
34217
+ build = readBuild;
34218
+ if (read === version2)
34191
34219
  return false;
34192
34220
  version2 = read;
34193
34221
  return true;
34194
34222
  }
34195
- var version2 = null, readForToken = null;
34223
+ var version2 = null, readForToken = null, build = null;
34196
34224
 
34197
34225
  // src/auth/antigravity-token.ts
34198
34226
  import { execFileSync } from "child_process";
34199
34227
  import { createHash as createHash3 } from "crypto";
34200
- import { existsSync as existsSync11 } from "fs";
34228
+ import { closeSync as closeSync5, existsSync as existsSync11, openSync as openSync5, readSync, realpathSync as realpathSync3 } from "fs";
34201
34229
  import { homedir as homedir12 } from "os";
34202
34230
  import { join as join12 } from "path";
34203
34231
  function invalidateReadStoreMemo() {
@@ -34285,6 +34313,40 @@ function defaultReadAgyVersion() {
34285
34313
  return null;
34286
34314
  }
34287
34315
  }
34316
+ function readAgyBuildFromBinary(path) {
34317
+ let fd;
34318
+ try {
34319
+ fd = openSync5(path, "r");
34320
+ const chunk = Buffer.alloc(AGY_BUILD_SCAN_CHUNK);
34321
+ let position = 0;
34322
+ for (;; ) {
34323
+ const read = readSync(fd, chunk, 0, chunk.length, position);
34324
+ if (read <= 0)
34325
+ return null;
34326
+ const found = chunk.subarray(0, read).toString("latin1").match(AGY_BUILD_STAMP);
34327
+ if (found)
34328
+ return found[1];
34329
+ if (read < chunk.length)
34330
+ return null;
34331
+ position += read - AGY_BUILD_SCAN_OVERLAP;
34332
+ }
34333
+ } catch {
34334
+ return null;
34335
+ } finally {
34336
+ if (fd !== undefined)
34337
+ closeSync5(fd);
34338
+ }
34339
+ }
34340
+ function defaultReadAgyBuild() {
34341
+ const agy = locateAgyBinary();
34342
+ if (!agy)
34343
+ return null;
34344
+ try {
34345
+ return readAgyBuildFromBinary(realpathSync3(agy));
34346
+ } catch {
34347
+ return null;
34348
+ }
34349
+ }
34288
34350
  function defaultAntigravityTokenDeps() {
34289
34351
  return { ...defaultDeps3 };
34290
34352
  }
@@ -34386,7 +34448,7 @@ function captureAgyClientVersion(accessToken, deps) {
34386
34448
  if (!deps.readAgyVersion || agyClientVersionReadFor(accessToken))
34387
34449
  return;
34388
34450
  const read = deps.readAgyVersion();
34389
- recordAgyClientVersionRead(read, accessToken);
34451
+ recordAgyClientVersionRead(read, accessToken, read ? deps.readAgyBuild?.() ?? null : null);
34390
34452
  if (read) {
34391
34453
  log(`[Antigravity] Client version from agy: ${read}`);
34392
34454
  } else {
@@ -34520,22 +34582,269 @@ function resetObservedTokenState() {
34520
34582
  observedLineage = null;
34521
34583
  invalidateReadStoreMemo();
34522
34584
  }
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;
34585
+ 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
34586
  var init_antigravity_token = __esm(() => {
34525
34587
  init_logger();
34526
34588
  init_keychain();
34589
+ AGY_BUILD_STAMP = /changelist (\d+) with baseline/;
34590
+ AGY_BUILD_SCAN_CHUNK = 8 << 20;
34527
34591
  defaultDeps3 = {
34528
34592
  readStore: defaultReadStore,
34529
34593
  writeStore: defaultWriteStore,
34530
34594
  deleteStore: defaultDeleteStore,
34531
34595
  runAgyRefresh: defaultRunAgyRefresh,
34532
34596
  readAgyVersion: defaultReadAgyVersion,
34597
+ readAgyBuild: defaultReadAgyBuild,
34533
34598
  now: () => Date.now()
34534
34599
  };
34535
34600
  KEYCHAIN_LOCKED_EXIT_CODES = new Set([36, 51, 128]);
34536
34601
  lineageByAccessToken = new Map;
34537
34602
  });
34538
34603
 
34604
+ // src/providers/transport/antigravity-fetch.ts
34605
+ import http from "http";
34606
+ import https from "https";
34607
+ import { Readable, pipeline } from "stream";
34608
+ import { createGunzip } from "zlib";
34609
+ function nodeHttpWritesOwnHead(bunVersion) {
34610
+ if (!bunVersion)
34611
+ return true;
34612
+ const part = (version) => version.split("-")[0].split(".").map(Number);
34613
+ const have = part(bunVersion);
34614
+ const need = part(FIRST_BUN_WITH_OWN_HTTP_HEAD);
34615
+ for (let i = 0;i < need.length; i++) {
34616
+ const n = have[i];
34617
+ if (!Number.isFinite(n))
34618
+ return false;
34619
+ if (n !== need[i])
34620
+ return n > need[i];
34621
+ }
34622
+ return !bunVersion.includes("-");
34623
+ }
34624
+ function headerRecord(headers) {
34625
+ const out = {};
34626
+ if (!headers)
34627
+ return out;
34628
+ if (headers instanceof Headers) {
34629
+ headers.forEach((value, name) => {
34630
+ out[name] = value;
34631
+ });
34632
+ return out;
34633
+ }
34634
+ for (const [name, value] of Array.isArray(headers) ? headers : Object.entries(headers)) {
34635
+ if (typeof value === "string")
34636
+ out[name] = value;
34637
+ }
34638
+ return out;
34639
+ }
34640
+ function sendsChunked(target) {
34641
+ return target.pathname.includes(":streamGenerateContent");
34642
+ }
34643
+ function antigravityHeaderLines(headers, bodyBytes, chunked) {
34644
+ const given = headerRecord(headers);
34645
+ const find = (lower) => {
34646
+ for (const [name, value] of Object.entries(given)) {
34647
+ if (name.toLowerCase() === lower)
34648
+ return value;
34649
+ }
34650
+ return;
34651
+ };
34652
+ const lines = [];
34653
+ const userAgent = find("user-agent");
34654
+ if (userAgent !== undefined)
34655
+ lines.push(["User-Agent", userAgent]);
34656
+ if (bodyBytes !== null) {
34657
+ lines.push(chunked ? ["Transfer-Encoding", "chunked"] : ["Content-Length", String(bodyBytes)]);
34658
+ }
34659
+ const authorization = find("authorization");
34660
+ if (authorization !== undefined)
34661
+ lines.push(["Authorization", authorization]);
34662
+ const contentType = find("content-type");
34663
+ if (contentType !== undefined)
34664
+ lines.push(["Content-Type", contentType]);
34665
+ lines.push(["Accept-Encoding", "gzip"]);
34666
+ for (const [name, value] of Object.entries(given)) {
34667
+ if (!OWN_HEADERS.has(name.toLowerCase()))
34668
+ lines.push([name, value]);
34669
+ }
34670
+ return lines;
34671
+ }
34672
+ function envValue(...names) {
34673
+ for (const name of names) {
34674
+ const value = process.env[name];
34675
+ if (value)
34676
+ return value;
34677
+ }
34678
+ return;
34679
+ }
34680
+ function bypassesProxy(target) {
34681
+ const list = envValue("NO_PROXY", "no_proxy");
34682
+ if (!list)
34683
+ return false;
34684
+ const name = target.hostname.toLowerCase();
34685
+ const port = target.port || (target.protocol === "https:" ? "443" : "80");
34686
+ return list.split(",").some((raw) => {
34687
+ let entry = raw.trim().toLowerCase();
34688
+ const withPort = entry.match(/^(.*[^:]):(\d+)$/);
34689
+ if (withPort) {
34690
+ if (withPort[2] !== port)
34691
+ return false;
34692
+ entry = withPort[1];
34693
+ }
34694
+ entry = entry.replace(/^\*?\./, "");
34695
+ if (!entry)
34696
+ return false;
34697
+ return entry === "*" || name === entry || name.endsWith(`.${entry}`);
34698
+ });
34699
+ }
34700
+ function proxyFor(target) {
34701
+ if (bypassesProxy(target))
34702
+ return null;
34703
+ const value = target.protocol === "https:" ? envValue("HTTPS_PROXY", "https_proxy", "ALL_PROXY", "all_proxy") : envValue("HTTP_PROXY", "http_proxy", "ALL_PROXY", "all_proxy");
34704
+ if (!value)
34705
+ return null;
34706
+ try {
34707
+ return new URL(value);
34708
+ } catch {
34709
+ return null;
34710
+ }
34711
+ }
34712
+ function idleTimeoutError(ms) {
34713
+ return Object.assign(new Error(`The Antigravity backend sent nothing for ${ms} ms`), {
34714
+ code: "ETIMEDOUT"
34715
+ });
34716
+ }
34717
+ async function antigravityFetch(url, init = {}, runtime = {
34718
+ idleTimeoutMs: ANTIGRAVITY_IDLE_TIMEOUT_MS,
34719
+ bunVersion: process.versions.bun
34720
+ }) {
34721
+ if (process.env[ANTIGRAVITY_PLAIN_FETCH_ENV] === "1")
34722
+ return fetch(url, init);
34723
+ if (!nodeHttpWritesOwnHead(runtime.bunVersion))
34724
+ return fetch(url, init);
34725
+ if (init.body != null && typeof init.body !== "string")
34726
+ return fetch(url, init);
34727
+ let target = new URL(url);
34728
+ if (proxyFor(target))
34729
+ return fetch(url, init);
34730
+ let current = init;
34731
+ for (let hop = 0;; hop++) {
34732
+ const response = await sendOnce(target, current, runtime.idleTimeoutMs);
34733
+ const location = response.headers.get("location");
34734
+ const redirected = (response.status === 307 || response.status === 308) && location;
34735
+ if (!redirected || init.redirect === "manual" || hop >= MAX_REDIRECTS)
34736
+ return response;
34737
+ await response.body?.cancel().catch(() => {});
34738
+ if (init.redirect === "error") {
34739
+ throw new TypeError(`The Antigravity backend answered ${response.status} with a redirect`);
34740
+ }
34741
+ const next = new URL(location, target);
34742
+ if (next.origin !== target.origin) {
34743
+ const kept = {};
34744
+ const sent = new Headers(current.headers);
34745
+ sent.forEach((value, name) => {
34746
+ if (name.toLowerCase() !== "authorization")
34747
+ kept[name] = value;
34748
+ });
34749
+ current = { ...current, headers: kept };
34750
+ }
34751
+ target = next;
34752
+ if (proxyFor(target))
34753
+ return fetch(target.href, current);
34754
+ }
34755
+ }
34756
+ async function sendOnce(target, init, idleTimeoutMs) {
34757
+ const secure = target.protocol === "https:";
34758
+ const signal = init.signal ?? undefined;
34759
+ if (signal?.aborted)
34760
+ throw signal.reason;
34761
+ const method = (init.method ?? "GET").toUpperCase();
34762
+ const body = typeof init.body === "string" ? Buffer.from(init.body, "utf8") : null;
34763
+ const chunked = body !== null && sendsChunked(target);
34764
+ return new Promise((resolve, reject) => {
34765
+ const request = (secure ? https : http).request(target, { method, agent: false });
34766
+ try {
34767
+ request.removeHeader("Connection");
34768
+ for (const [name, value] of antigravityHeaderLines(init.headers, body?.length ?? null, chunked)) {
34769
+ request.setHeader(name, value);
34770
+ }
34771
+ } catch (error) {
34772
+ request.once("error", () => {});
34773
+ request.destroy();
34774
+ reject(error);
34775
+ return;
34776
+ }
34777
+ let incoming;
34778
+ request.setTimeout(idleTimeoutMs, () => {
34779
+ const error = idleTimeoutError(idleTimeoutMs);
34780
+ request.destroy(error);
34781
+ incoming?.destroy(error);
34782
+ });
34783
+ const untilResponse = setTimeout(() => request.destroy(idleTimeoutError(idleTimeoutMs)), idleTimeoutMs);
34784
+ const onAbort = () => {
34785
+ request.destroy(signal?.reason);
34786
+ incoming?.destroy(signal?.reason);
34787
+ };
34788
+ const release = () => signal?.removeEventListener("abort", onAbort);
34789
+ signal?.addEventListener("abort", onAbort, { once: true });
34790
+ request.once("error", (error) => {
34791
+ clearTimeout(untilResponse);
34792
+ release();
34793
+ reject(error);
34794
+ });
34795
+ request.once("response", (res) => {
34796
+ clearTimeout(untilResponse);
34797
+ incoming = res;
34798
+ res.once("close", release);
34799
+ const status = res.statusCode ?? 0;
34800
+ const headers = new Headers;
34801
+ for (let i = 0;i + 1 < res.rawHeaders.length; i += 2) {
34802
+ headers.append(res.rawHeaders[i], res.rawHeaders[i + 1]);
34803
+ }
34804
+ let source = res;
34805
+ if (/\bgzip\b/i.test(headers.get("content-encoding") ?? "")) {
34806
+ source = pipeline(res, createGunzip(), () => {});
34807
+ headers.delete("content-encoding");
34808
+ headers.delete("content-length");
34809
+ }
34810
+ const bodiless = method === "HEAD" || status === 204 || status === 304;
34811
+ if (bodiless)
34812
+ res.resume();
34813
+ try {
34814
+ resolve(new Response(bodiless ? null : Readable.toWeb(source), {
34815
+ status,
34816
+ statusText: res.statusMessage ?? "",
34817
+ headers
34818
+ }));
34819
+ } catch (error) {
34820
+ res.destroy();
34821
+ reject(error);
34822
+ }
34823
+ });
34824
+ if (body === null)
34825
+ request.end();
34826
+ else if (chunked) {
34827
+ request.write(body);
34828
+ request.end();
34829
+ } else
34830
+ request.end(body);
34831
+ });
34832
+ }
34833
+ 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;
34834
+ var init_antigravity_fetch = __esm(() => {
34835
+ OWN_HEADERS = new Set([
34836
+ "host",
34837
+ "accept",
34838
+ "connection",
34839
+ "content-length",
34840
+ "transfer-encoding",
34841
+ "accept-encoding",
34842
+ "user-agent",
34843
+ "authorization",
34844
+ "content-type"
34845
+ ]);
34846
+ });
34847
+
34539
34848
  // src/auth/antigravity-user.ts
34540
34849
  function antigravityHost() {
34541
34850
  const override = process.env.AICODE_ENDPOINT_URL?.trim();
@@ -34557,7 +34866,9 @@ function antigravityClientVersion() {
34557
34866
  return resolveAntigravityClientVersion().version;
34558
34867
  }
34559
34868
  function userAgentFor(version) {
34560
- return `antigravity/cli/${version} (aidev_client; os_type=${process.platform}; arch=${process.arch}; auth_method=consumer)`;
34869
+ const build = version === getAgyClientVersion() ? getAgyClientBuild() : null;
34870
+ const cl = build ? ` cl=${build};` : "";
34871
+ return `antigravity/cli/${version} (aidev_client; os_type=${process.platform}; arch=${process.arch};${cl} auth_method=consumer)`;
34561
34872
  }
34562
34873
  function antigravityUserAgentFor(version) {
34563
34874
  return userAgentFor(version);
@@ -34594,7 +34905,7 @@ function mayPublishFor(lineage) {
34594
34905
  return true;
34595
34906
  }
34596
34907
  async function callLoadCodeAssistAntigravity(accessToken) {
34597
- const res = await fetch(`${apiBase()}:loadCodeAssist`, {
34908
+ const res = await antigravityFetch(`${apiBase()}:loadCodeAssist`, {
34598
34909
  method: "POST",
34599
34910
  headers: {
34600
34911
  Authorization: `Bearer ${accessToken}`,
@@ -34646,7 +34957,7 @@ function getAntigravityTierDisplayName() {
34646
34957
  }
34647
34958
  async function retrieveUserQuota(accessToken, projectId) {
34648
34959
  try {
34649
- const res = await fetch(`${apiBase()}:retrieveUserQuota`, {
34960
+ const res = await antigravityFetch(`${apiBase()}:retrieveUserQuota`, {
34650
34961
  method: "POST",
34651
34962
  headers: {
34652
34963
  Authorization: `Bearer ${accessToken}`,
@@ -34692,7 +35003,7 @@ async function fetchAntigravityAvailableModelsRaw(accessToken, projectId, opts)
34692
35003
  };
34693
35004
  let res;
34694
35005
  try {
34695
- res = await fetch(url, {
35006
+ res = await antigravityFetch(url, {
34696
35007
  method: "POST",
34697
35008
  headers: {
34698
35009
  Authorization: `Bearer ${accessToken}`,
@@ -34761,6 +35072,12 @@ async function getServedAntigravityModels(accessToken, projectId, opts) {
34761
35072
  if (typeof record?.displayName === "string" && record.displayName) {
34762
35073
  entry.displayName = record.displayName;
34763
35074
  }
35075
+ if (typeof record?.model === "string" && record.model) {
35076
+ entry.modelEnum = record.model;
35077
+ }
35078
+ if (typeof record?.thinkingLevel === "number") {
35079
+ entry.thinkingLevel = record.thinkingLevel;
35080
+ }
34764
35081
  meta[id] = entry;
34765
35082
  }
34766
35083
  const excludedIds = new Set;
@@ -34818,6 +35135,7 @@ function peekServedAntigravityModels() {
34818
35135
  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
35136
  var init_antigravity_user = __esm(() => {
34820
35137
  init_logger();
35138
+ init_antigravity_fetch();
34821
35139
  init_antigravity_token();
34822
35140
  SERVED_MODELS_TTL_MS = 10 * 60 * 1000;
34823
35141
  });
@@ -34954,10 +35272,10 @@ var init_antigravity = __esm(() => {
34954
35272
  // src/auth/credential-file.ts
34955
35273
  import { randomBytes as randomBytes4 } from "crypto";
34956
35274
  import {
34957
- closeSync as closeSync5,
35275
+ closeSync as closeSync6,
34958
35276
  fsyncSync as fsyncSync2,
34959
35277
  mkdirSync as mkdirSync9,
34960
- openSync as openSync5,
35278
+ openSync as openSync6,
34961
35279
  readFileSync as readFileSync16,
34962
35280
  renameSync as renameSync5,
34963
35281
  statSync as statSync6,
@@ -34983,12 +35301,12 @@ function writeCredentialFileAtomic(path, data) {
34983
35301
  mkdirSync9(dirname8(path), { recursive: true });
34984
35302
  const tmp = `${path}.tmp-${process.pid}-${randomBytes4(6).toString("hex")}`;
34985
35303
  try {
34986
- const fd = openSync5(tmp, "wx", 384);
35304
+ const fd = openSync6(tmp, "wx", 384);
34987
35305
  try {
34988
35306
  writeSync5(fd, JSON.stringify(data, null, 2));
34989
35307
  fsyncSync2(fd);
34990
35308
  } finally {
34991
- closeSync5(fd);
35309
+ closeSync6(fd);
34992
35310
  }
34993
35311
  renameSync5(tmp, path);
34994
35312
  } catch (err) {
@@ -44379,7 +44697,7 @@ async function resolveObserverModel(config) {
44379
44697
  return cachedModel;
44380
44698
  try {
44381
44699
  const models = await fetchOllamaModels({ enrichCapabilities: false });
44382
- const usable = models.filter((m) => !m.isEmbeddingModel && isGenuinelyLocal(m));
44700
+ const usable = models.filter((m) => !m.isEmbeddingModel && isGenuinelyLocal(m) && !isOptInWireId(m.name));
44383
44701
  if (usable.length === 0) {
44384
44702
  log("[hooks:observer] No local Ollama models found \u2014 observer disabled for this run");
44385
44703
  cachedModel = null;
@@ -48500,12 +48818,12 @@ var init_raw = __esm(() => {
48500
48818
 
48501
48819
  // src/hooks/injection/inbox.ts
48502
48820
  import {
48503
- closeSync as closeSync6,
48821
+ closeSync as closeSync7,
48504
48822
  existsSync as existsSync16,
48505
48823
  fstatSync as fstatSync2,
48506
- openSync as openSync6,
48824
+ openSync as openSync7,
48507
48825
  readFileSync as readFileSync20,
48508
- readSync,
48826
+ readSync as readSync2,
48509
48827
  rmSync as rmSync6,
48510
48828
  statSync as statSync7
48511
48829
  } from "fs";
@@ -48586,7 +48904,7 @@ class FileInbox {
48586
48904
  return [];
48587
48905
  let fd;
48588
48906
  try {
48589
- fd = openSync6(this.path, "r");
48907
+ fd = openSync7(this.path, "r");
48590
48908
  } catch {
48591
48909
  return [];
48592
48910
  }
@@ -48595,7 +48913,7 @@ class FileInbox {
48595
48913
  if (size <= this.offset)
48596
48914
  return [];
48597
48915
  const buf = Buffer.alloc(size - this.offset);
48598
- const n = readSync(fd, buf, 0, buf.length, this.offset);
48916
+ const n = readSync2(fd, buf, 0, buf.length, this.offset);
48599
48917
  const bytes = Buffer.concat([this.partial, buf.subarray(0, n)]);
48600
48918
  const nl = bytes.lastIndexOf(10);
48601
48919
  const complete = nl === -1 ? "" : bytes.subarray(0, nl).toString("utf8");
@@ -48612,7 +48930,7 @@ class FileInbox {
48612
48930
  }
48613
48931
  return out;
48614
48932
  } finally {
48615
- closeSync6(fd);
48933
+ closeSync7(fd);
48616
48934
  }
48617
48935
  }
48618
48936
  }
@@ -48761,7 +49079,7 @@ function createHookInbox(dir, name = HOOK_INBOX_FILE) {
48761
49079
  const path = join20(dir, name);
48762
49080
  try {
48763
49081
  rmSync6(path, { force: true });
48764
- closeSync6(openSync6(path, "wx", 384));
49082
+ closeSync7(openSync7(path, "wx", 384));
48765
49083
  return path;
48766
49084
  } catch {
48767
49085
  return null;
@@ -49344,6 +49662,155 @@ function decideCodexSpeed(speed, modelInfo) {
49344
49662
  }
49345
49663
  var CODEX_SERVICE_TIER_POINTER = "/service_tier";
49346
49664
 
49665
+ // src/providers/antigravity-envelope.ts
49666
+ import { createHash as createHash13, randomBytes as randomBytes7, randomUUID as randomUUID3 } from "crypto";
49667
+
49668
+ class AntigravityConversations {
49669
+ limit;
49670
+ newId;
49671
+ byFirstMessage = new Map;
49672
+ sessionId;
49673
+ constructor(limit = 64, newId = randomUUID3, sessionId = randomSessionId()) {
49674
+ this.limit = limit;
49675
+ this.newId = newId;
49676
+ this.sessionId = sessionId;
49677
+ }
49678
+ of(inner, scope = "") {
49679
+ const key = `${scope}
49680
+ ${firstMessageKey(inner)}`;
49681
+ const known = this.byFirstMessage.get(key);
49682
+ if (known) {
49683
+ this.byFirstMessage.delete(key);
49684
+ this.byFirstMessage.set(key, known);
49685
+ return known;
49686
+ }
49687
+ const created = { cascadeId: this.newId(), trajectoryId: this.newId(), requestCount: 0 };
49688
+ this.byFirstMessage.set(key, created);
49689
+ if (this.byFirstMessage.size > this.limit) {
49690
+ const oldest = this.byFirstMessage.keys().next().value;
49691
+ if (oldest !== undefined)
49692
+ this.byFirstMessage.delete(oldest);
49693
+ }
49694
+ return created;
49695
+ }
49696
+ }
49697
+ function randomSessionId() {
49698
+ return randomBytes7(8).readBigInt64BE().toString();
49699
+ }
49700
+ function firstMessageKey(inner) {
49701
+ const contents = inner?.contents;
49702
+ const first = Array.isArray(contents) && contents.length > 0 ? contents[0] : null;
49703
+ return createHash13("sha256").update(JSON.stringify(first)).digest("hex");
49704
+ }
49705
+ function lastStepIndex(contents) {
49706
+ if (!Array.isArray(contents))
49707
+ return 0;
49708
+ let steps = 0;
49709
+ for (const content of contents.slice(1)) {
49710
+ const parts = Array.isArray(content?.parts) ? content.parts : [];
49711
+ const results = parts.filter((part) => part?.functionResponse !== undefined).length;
49712
+ steps += results > 0 ? results : 1;
49713
+ }
49714
+ return steps;
49715
+ }
49716
+ function toolResultsAsModelEntries(contents) {
49717
+ if (!Array.isArray(contents))
49718
+ return contents;
49719
+ const out = [];
49720
+ for (const content of contents) {
49721
+ const parts = Array.isArray(content?.parts) ? content.parts : [];
49722
+ const results = parts.filter((part) => part?.functionResponse !== undefined);
49723
+ if (results.length === 0) {
49724
+ out.push(content);
49725
+ continue;
49726
+ }
49727
+ const others = parts.filter((part) => part?.functionResponse === undefined);
49728
+ out.push({ ...content, role: "model", parts: results });
49729
+ if (others.length > 0)
49730
+ out.push({ ...content, parts: others });
49731
+ }
49732
+ return out;
49733
+ }
49734
+ function oneToolPerDeclaration(tools) {
49735
+ if (!Array.isArray(tools))
49736
+ return tools;
49737
+ const out = [];
49738
+ for (const entry of tools) {
49739
+ const declarations = entry?.functionDeclarations;
49740
+ if (!Array.isArray(declarations) || declarations.length <= 1) {
49741
+ out.push(entry);
49742
+ continue;
49743
+ }
49744
+ const { functionDeclarations: _all, ...rest } = entry;
49745
+ for (const declaration of declarations) {
49746
+ out.push({ ...rest, functionDeclarations: [declaration] });
49747
+ }
49748
+ }
49749
+ return out;
49750
+ }
49751
+ function labelsFor(model, meta, conversation, stepIndex) {
49752
+ const claude = model.startsWith("claude");
49753
+ const gemini = model.startsWith("gemini");
49754
+ const labels = {
49755
+ cascade_id: conversation.cascadeId,
49756
+ last_step_index: String(stepIndex)
49757
+ };
49758
+ if (meta?.modelEnum)
49759
+ labels.model_enum = meta.modelEnum;
49760
+ labels.request_id = `${conversation.trajectoryId}-${conversation.requestCount}`;
49761
+ labels.root_cascade_id = conversation.cascadeId;
49762
+ labels.trajectory_id = conversation.trajectoryId;
49763
+ labels.used_claude = String(claude);
49764
+ labels.used_claude_conservative = String(claude);
49765
+ labels.used_non_gemini_model = String(!gemini);
49766
+ return labels;
49767
+ }
49768
+ function buildAntigravityEnvelope(input) {
49769
+ const { model, meta, conversation } = input;
49770
+ const inner = input.inner ?? {};
49771
+ const {
49772
+ contents,
49773
+ systemInstruction,
49774
+ tools,
49775
+ generationConfig,
49776
+ labels: _labels,
49777
+ sessionId: _sessionId,
49778
+ ...others
49779
+ } = inner;
49780
+ const stepIndex = lastStepIndex(contents);
49781
+ const request = { contents: toolResultsAsModelEntries(contents) };
49782
+ if (systemInstruction && typeof systemInstruction === "object") {
49783
+ const { role: _role, ...instruction } = systemInstruction;
49784
+ request.systemInstruction = { role: "user", ...instruction };
49785
+ }
49786
+ if (tools !== undefined)
49787
+ request.tools = oneToolPerDeclaration(tools);
49788
+ Object.assign(request, others);
49789
+ request.labels = labelsFor(model, meta, conversation, stepIndex);
49790
+ const {
49791
+ temperature: _temperature,
49792
+ maxOutputTokens,
49793
+ ...config
49794
+ } = generationConfig ?? {};
49795
+ const cap = meta?.maxOutputTokens ?? maxOutputTokens;
49796
+ request.generationConfig = cap === undefined ? config : { maxOutputTokens: cap, ...config };
49797
+ request.sessionId = input.sessionId;
49798
+ const envelope = {
49799
+ project: input.projectId,
49800
+ requestId: `agent/${conversation.cascadeId}/${input.now ?? Date.now()}/${conversation.trajectoryId}/${stepIndex + 1}`,
49801
+ request,
49802
+ model,
49803
+ userAgent: "antigravity",
49804
+ requestType: "agent"
49805
+ };
49806
+ conversation.requestCount += 1;
49807
+ return envelope;
49808
+ }
49809
+ var antigravityConversations;
49810
+ var init_antigravity_envelope = __esm(() => {
49811
+ antigravityConversations = new AntigravityConversations;
49812
+ });
49813
+
49347
49814
  // src/handlers/shared/gemini-queue.ts
49348
49815
  function rejectIfAborted(request) {
49349
49816
  if (request.onAbort)
@@ -50044,13 +50511,13 @@ function getCatalogEntries() {
50044
50511
  function catalogOrigin() {
50045
50512
  return getCatalogSnapshot()?.origin ?? "none";
50046
50513
  }
50047
- function latestAnthropicTierModelId(tier) {
50514
+ function latestAnthropicTierModelId(tier, accept = () => true) {
50048
50515
  const snapshot = getCatalogSnapshot();
50049
50516
  if (snapshot?.origin !== "disk")
50050
50517
  return null;
50051
50518
  const { entries } = snapshot;
50052
50519
  const family = new RegExp(`^claude-${tier}-`, "i");
50053
- const matches = entries.filter((entry) => family.test(entry.modelId));
50520
+ const matches = entries.filter((entry) => family.test(entry.modelId) && accept(entry.modelId));
50054
50521
  if (matches.length === 0)
50055
50522
  return null;
50056
50523
  matches.sort((a, b) => {
@@ -50084,9 +50551,49 @@ function externalIdFor(entry, provider) {
50084
50551
  return wireIds.find((wireId) => !isMovingPointer(wireId)) ?? null;
50085
50552
  }
50086
50553
  function publishesWireIdFor(entry, provider, wireId) {
50087
- return allConnections(entry).some((connection) => connection.routeStatus === "mapped" && connection.externalModelId === wireId && catalogRouteMatchesProvider(connection.route, provider));
50554
+ return allConnections(entry).some((connection) => connection.routeStatus === "mapped" && catalogRouteMatchesProvider(connection.route, provider) && (connection.externalModelId === wireId || effortMapListsWireId(connection, wireId)));
50555
+ }
50556
+ function effortMapListsWireId(connection, wireId) {
50557
+ return publishedEffortWireId(connection, wireId) === wireId;
50558
+ }
50559
+ function publishesImplicitWireIdFor(entry, provider, wireId) {
50560
+ return (entry.aggregators ?? []).some((connection) => connection.routeStatus === "mapped" && catalogRouteMatchesProvider(connection.route, provider) && (connection.externalModelId === wireId || implicitEffortWireId(connection, wireId) === wireId));
50088
50561
  }
50089
50562
  function resolveExternalId(userInput, provider, cachePath) {
50563
+ return resolveWireId(userInput, provider, cachePath, "explicit");
50564
+ }
50565
+ function resolveImplicitExternalId(userInput, provider, cachePath) {
50566
+ return resolveWireId(userInput, provider, cachePath, "implicit");
50567
+ }
50568
+ function effortMapOwnerFor(entries, provider, wireId) {
50569
+ const baseIds = new Set;
50570
+ for (const entry of entries) {
50571
+ const owns = allConnections(entry).some((connection) => connection.routeStatus === "mapped" && catalogRouteMatchesProvider(connection.route, provider) && effortMapListsWireId(connection, wireId));
50572
+ if (!owns)
50573
+ continue;
50574
+ const baseId = externalIdFor(entry, provider);
50575
+ if (baseId)
50576
+ baseIds.add(baseId);
50577
+ }
50578
+ const [first, ...rest] = baseIds;
50579
+ if (first === undefined)
50580
+ return { kind: "none" };
50581
+ if (rest.length > 0)
50582
+ return { kind: "ambiguous" };
50583
+ return { kind: "one", wireId: first };
50584
+ }
50585
+ function answerBeforeLookup(entries, provider, userInput, resolution) {
50586
+ const publishesExactly = resolution === "explicit" ? publishesWireIdFor : publishesImplicitWireIdFor;
50587
+ if (entries.some((entry) => publishesExactly(entry, provider, userInput)))
50588
+ return userInput;
50589
+ if (resolution === "explicit")
50590
+ return isOptInWireId(userInput) ? userInput : undefined;
50591
+ const owner = effortMapOwnerFor(entries, provider, userInput);
50592
+ if (owner.kind === "one")
50593
+ return owner.wireId;
50594
+ return owner.kind === "ambiguous" ? null : undefined;
50595
+ }
50596
+ function resolveWireId(userInput, provider, cachePath, resolution) {
50090
50597
  const entries = cachePath ? readAllModelsCache(cachePath)?.entries : getCatalogEntries();
50091
50598
  if (userInput.includes("/")) {
50092
50599
  if (entries?.some((entry) => allExternalIds(entry).includes(userInput)))
@@ -50095,8 +50602,9 @@ function resolveExternalId(userInput, provider, cachePath) {
50095
50602
  }
50096
50603
  if (!entries)
50097
50604
  return null;
50098
- if (entries.some((entry) => publishesWireIdFor(entry, provider, userInput)))
50099
- return userInput;
50605
+ const answered = answerBeforeLookup(entries, provider, userInput, resolution);
50606
+ if (answered !== undefined)
50607
+ return answered;
50100
50608
  const byModelId = entries.find((entry) => entry.modelId === userInput);
50101
50609
  if (byModelId)
50102
50610
  return externalIdFor(byModelId, provider);
@@ -50147,10 +50655,13 @@ function resolveTargetForCatalog(target, isExplicitProvider, model, provider, re
50147
50655
  };
50148
50656
  }
50149
50657
  function logResolution(userInput, result, quiet = false) {
50150
- if (result.wasResolved && !quiet) {
50151
- process.stderr.write(`[Model] Resolved "${userInput}" \u2192 "${result.resolvedId}" (${result.sourceLabel})
50658
+ if (!result.wasResolved)
50659
+ return;
50660
+ const line = `[Model] Resolved "${userInput}" \u2192 "${result.resolvedId}" (${result.sourceLabel})`;
50661
+ log(line);
50662
+ if (!quiet)
50663
+ process.stderr.write(`${line}
50152
50664
  `);
50153
- }
50154
50665
  }
50155
50666
  function catalogWarmDisabled() {
50156
50667
  return catalogWarmDisabledFor(process.env.CLAUDISH_DISABLE_CATALOG_WARM);
@@ -50500,6 +51011,7 @@ var init_catalog_client = __esm(() => {
50500
51011
  init_catalog_reachability();
50501
51012
  init_catalog_route_bindings();
50502
51013
  init_connection_wire();
51014
+ init_model_id_effort();
50503
51015
  init_probe_discovery();
50504
51016
  });
50505
51017
 
@@ -50791,16 +51303,19 @@ function mappedAntigravityModelId(req, served, effort) {
50791
51303
  function antigravityCarriesEffortInModelId(sent) {
50792
51304
  return carriesEffortInModelId(sent.trim(), "antigravity");
50793
51305
  }
50794
- function antigravityBodyForModelId(inner, sent) {
51306
+ function antigravityBodyForModelId(inner, sent, backendLevel) {
50795
51307
  const body = inner;
50796
51308
  const thinking = body?.generationConfig?.thinkingConfig;
50797
51309
  if (!thinking || typeof thinking !== "object")
50798
51310
  return inner;
50799
- if (!("thinkingLevel" in thinking) && !("thinkingBudget" in thinking))
50800
- return inner;
50801
51311
  if (!antigravityCarriesEffortInModelId(sent))
50802
51312
  return inner;
51313
+ const level = backendLevel !== undefined && sent.trim().startsWith("gemini") ? BACKEND_THINKING_LEVELS[backendLevel] : undefined;
51314
+ if (!level && !("thinkingLevel" in thinking) && !("thinkingBudget" in thinking))
51315
+ return inner;
50803
51316
  const { thinkingLevel: _level, thinkingBudget: _budget, ...kept } = thinking;
51317
+ if (level)
51318
+ kept.thinkingLevel = level;
50804
51319
  const generationConfig = { ...body?.generationConfig };
50805
51320
  if (Object.keys(kept).length > 0)
50806
51321
  generationConfig.thinkingConfig = kept;
@@ -50853,6 +51368,8 @@ function resolveAntigravityServedModel(requested, served, effort) {
50853
51368
  }
50854
51369
  function chooseAntigravityServedModel(requested, served, effort) {
50855
51370
  const req = requested.trim();
51371
+ if (isOptInWireId(req))
51372
+ return { id: req, effort, source: "exact id" };
50856
51373
  const isMappedBase = findModelIdEffortConnection(req, "antigravity") !== undefined;
50857
51374
  if (!isMappedBase && served.servedIds.includes(req)) {
50858
51375
  return { id: req, effort, source: "exact id" };
@@ -50865,15 +51382,16 @@ function chooseAntigravityServedModel(requested, served, effort) {
50865
51382
  return decision.choice;
50866
51383
  if (servesSelectable(served, req))
50867
51384
  return existingResolutionChoice(req, effort, decision);
50868
- const selectable = served.servedIds.filter((id) => !isExcluded2(served, id));
51385
+ const selectable = served.servedIds.filter((id) => !isExcluded2(served, id) && !isOptInWireId(id));
50869
51386
  const defaultId = served.defaultId && selectable.includes(served.defaultId) ? served.defaultId : null;
50870
51387
  const id = resolveAntigravityModelId(requested, selectable, defaultId, lookupFamilyDefaultVariant(requested, "antigravity"));
50871
51388
  return existingResolutionChoice(id, effort, decision);
50872
51389
  }
50873
- var REASONING_TIER_RANK;
51390
+ var BACKEND_THINKING_LEVELS, REASONING_TIER_RANK;
50874
51391
  var init_antigravity_model_id = __esm(() => {
50875
51392
  init_model_catalog();
50876
51393
  init_model_id_effort_choice();
51394
+ BACKEND_THINKING_LEVELS = { 1: "LOW", 2: "MEDIUM", 3: "HIGH" };
50877
51395
  REASONING_TIER_RANK = {
50878
51396
  high: 0,
50879
51397
  medium: 1,
@@ -51205,6 +51723,20 @@ var init_wire_request = __esm(() => {
51205
51723
  LIMIT_REQUIRED_APIS = new Set(["anthropic-messages"]);
51206
51724
  });
51207
51725
 
51726
+ // src/providers/transport/conversation-key.ts
51727
+ import { createHash as createHash14, randomBytes as randomBytes8 } from "crypto";
51728
+ function conversationKey(claudeRequest) {
51729
+ const sessionId = extractSessionId(claudeRequest);
51730
+ if (!sessionId)
51731
+ return `claudish_${FALLBACK_CONVERSATION_KEY}`;
51732
+ return `claudish_${createHash14("sha256").update(sessionId).digest("hex").slice(0, 32)}`;
51733
+ }
51734
+ var FALLBACK_CONVERSATION_KEY;
51735
+ var init_conversation_key = __esm(() => {
51736
+ init_harness();
51737
+ FALLBACK_CONVERSATION_KEY = randomBytes8(16).toString("hex");
51738
+ });
51739
+
51208
51740
  // src/providers/transport/antigravity.ts
51209
51741
  var exports_antigravity = {};
51210
51742
  __export(exports_antigravity, {
@@ -51213,7 +51745,6 @@ __export(exports_antigravity, {
51213
51745
  chooseAntigravityServedModel: () => chooseAntigravityServedModel,
51214
51746
  resolveAntigravityServedModel: () => resolveAntigravityServedModel
51215
51747
  });
51216
- import { randomUUID as randomUUID3 } from "crypto";
51217
51748
  function antigravityEndpoint() {
51218
51749
  return `${antigravityHost()}/v1internal:streamGenerateContent?alt=sse`;
51219
51750
  }
@@ -51225,9 +51756,6 @@ function effortOf(claudeRequest, pinned) {
51225
51756
  return "none";
51226
51757
  return isEffortLevel(choices.effort) ? choices.effort : undefined;
51227
51758
  }
51228
- function createActivityRequestId() {
51229
- return Math.random().toString(36).substring(7);
51230
- }
51231
51759
  function classify429(responseBody) {
51232
51760
  try {
51233
51761
  const raw = JSON.parse(responseBody);
@@ -51296,16 +51824,19 @@ class AntigravityProviderTransport {
51296
51824
  return this._displayName;
51297
51825
  }
51298
51826
  streamFormat = "gemini-sse";
51827
+ fetch(url, init) {
51828
+ return antigravityFetch(url, init);
51829
+ }
51299
51830
  modelName;
51300
51831
  servedModelName;
51301
51832
  accessToken = null;
51302
51833
  projectId = null;
51303
- tierId = null;
51304
51834
  cachedAuth = null;
51305
51835
  requests = new WeakMap;
51306
51836
  lastRequest;
51307
51837
  pinnedEffort;
51308
51838
  servedModels = [];
51839
+ modelMeta = {};
51309
51840
  served = {
51310
51841
  servedIds: [],
51311
51842
  defaultId: null
@@ -51334,8 +51865,7 @@ class AntigravityProviderTransport {
51334
51865
  buildLocalHeaders() {
51335
51866
  return {
51336
51867
  Authorization: `Bearer ${this.accessToken}`,
51337
- "User-Agent": buildAntigravityUserAgent(),
51338
- "x-activity-request-id": createActivityRequestId()
51868
+ "User-Agent": buildAntigravityUserAgent()
51339
51869
  };
51340
51870
  }
51341
51871
  async refreshAuth() {
@@ -51343,12 +51873,12 @@ class AntigravityProviderTransport {
51343
51873
  model: this.modelName
51344
51874
  });
51345
51875
  this.accessToken = await getValidAntigravityAccessToken();
51346
- const { projectId, tierId } = await setupAntigravityUser(this.accessToken);
51876
+ const { projectId } = await setupAntigravityUser(this.accessToken);
51347
51877
  this.projectId = projectId;
51348
- this.tierId = tierId;
51349
51878
  this._displayName = getAntigravityTierDisplayName();
51350
51879
  const served = await getServedAntigravityModels(this.accessToken, this.projectId);
51351
51880
  this.served = served;
51881
+ this.modelMeta = served.meta ?? {};
51352
51882
  this.servedModels = served.servedIds;
51353
51883
  this.servedModelName = resolveAntigravityServedModel(this.modelName, served, this.pinnedEffort);
51354
51884
  log(`[Antigravity] Auth refreshed, project: ${this.projectId}, tier: ${this._displayName}, ` + `model: ${this.modelName} -> ${this.servedModelName}, served: ${this.servedModels.join(",") || "(none)"}`);
@@ -51374,17 +51904,24 @@ class AntigravityProviderTransport {
51374
51904
  }
51375
51905
  transformPayload(payload, claudeRequest) {
51376
51906
  let choice;
51907
+ const conversationScope = conversationKey(claudeRequest);
51377
51908
  const request = {
51378
51909
  effort: effortOf(claudeRequest, this.pinnedEffort),
51379
51910
  onModelChoice: (decided) => {
51380
51911
  choice = decided;
51381
- }
51912
+ },
51913
+ conversationScope
51382
51914
  };
51383
51915
  const envelope = this.cachedAuth?.transformPayload ? this.cachedAuth.transformPayload(payload, request) : this.buildLocalEnvelope(payload, request);
51384
51916
  if (typeof envelope?.model === "string" && envelope.model) {
51385
51917
  this.servedModelName = envelope.model;
51386
51918
  }
51387
- const state = { payload, sentId: this.servedModelName, choice };
51919
+ const state = {
51920
+ payload,
51921
+ sentId: this.servedModelName,
51922
+ choice,
51923
+ conversationScope
51924
+ };
51388
51925
  if (envelope && typeof envelope === "object")
51389
51926
  this.requests.set(envelope, state);
51390
51927
  this.lastRequest = envelope ? state : undefined;
@@ -51395,19 +51932,17 @@ class AntigravityProviderTransport {
51395
51932
  buildLocalEnvelope(payload, request) {
51396
51933
  const choice = chooseAntigravityServedModel(this.modelName, this.served, request.effort);
51397
51934
  request.onModelChoice?.(choice);
51398
- return this.buildEnvelope(antigravityBodyForModelId(payload, choice.id), choice.id);
51935
+ return this.buildEnvelope(antigravityBodyForModelId(payload, choice.id, this.modelMeta[choice.id]?.thinkingLevel), choice.id, request.conversationScope);
51399
51936
  }
51400
- buildEnvelope(innerPayload, model) {
51401
- const envelope = {
51937
+ buildEnvelope(innerPayload, model, conversationScope) {
51938
+ return buildAntigravityEnvelope({
51939
+ inner: innerPayload,
51402
51940
  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;
51941
+ projectId: this.projectId,
51942
+ meta: this.modelMeta[model],
51943
+ conversation: antigravityConversations.of(innerPayload, conversationScope),
51944
+ sessionId: antigravityConversations.sessionId
51945
+ });
51411
51946
  }
51412
51947
  async enqueueRequest(fetchFn, opts) {
51413
51948
  const queue = GeminiRequestQueue.getInstance();
@@ -51460,7 +51995,7 @@ class AntigravityProviderTransport {
51460
51995
  }
51461
51996
  async handleCapacityExhausted(originalResponse, queue, request, sentId, signal) {
51462
51997
  const excluded = this.served.excludedIds;
51463
- const candidates = this.servedModels.filter((m) => m !== sentId && !excluded?.has(m));
51998
+ const candidates = this.servedModels.filter((m) => m !== sentId && !excluded?.has(m) && !isOptInWireId(m));
51464
51999
  if (candidates.length === 0) {
51465
52000
  log(`[Antigravity] ${sentId} capacity exhausted, no fallback models available`);
51466
52001
  return originalResponse;
@@ -51483,7 +52018,7 @@ class AntigravityProviderTransport {
51483
52018
  if (choice)
51484
52019
  logModelIdChoice("Antigravity", this.modelName, { ...choice, id: fallbackModel });
51485
52020
  tried.push(fallbackModel);
51486
- const fallbackEnvelope = this.buildEnvelope(antigravityBodyForModelId(originalPayload, fallbackModel), fallbackModel);
52021
+ const fallbackEnvelope = this.buildEnvelope(antigravityBodyForModelId(originalPayload, fallbackModel, this.modelMeta[fallbackModel]?.thinkingLevel), fallbackModel, request.conversationScope);
51487
52022
  const headers = this.buildLocalHeaders();
51488
52023
  headers["Content-Type"] = "application/json";
51489
52024
  const fallbackResponse = await this.fetchCapacityCandidate(queue, endpoint, headers, fallbackEnvelope, signal);
@@ -51519,8 +52054,8 @@ class AntigravityProviderTransport {
51519
52054
  fetchCapacityCandidate(queue, endpoint, headers, envelope, signal) {
51520
52055
  const init = { method: "POST", headers, body: JSON.stringify(envelope) };
51521
52056
  if (!signal)
51522
- return queue.enqueue(() => fetch(endpoint, init));
51523
- return queue.enqueue(() => signal.aborted ? Promise.reject(callAbortError()) : fetch(endpoint, { ...init, signal }), { signal });
52057
+ return queue.enqueue(() => antigravityFetch(endpoint, init));
52058
+ return queue.enqueue(() => signal.aborted ? Promise.reject(callAbortError()) : antigravityFetch(endpoint, { ...init, signal }), { signal });
51524
52059
  }
51525
52060
  rewriteModelNotFound(response, sentId, capacityFallbacksExhausted = false) {
51526
52061
  const served = this.servedModels;
@@ -51652,9 +52187,12 @@ var init_antigravity2 = __esm(() => {
51652
52187
  init_call_context();
51653
52188
  init_gemini_queue();
51654
52189
  init_logger();
52190
+ init_antigravity_envelope();
51655
52191
  init_antigravity_model_id();
51656
52192
  init_model_id_effort_choice();
51657
52193
  init_wire_request();
52194
+ init_antigravity_fetch();
52195
+ init_conversation_key();
51658
52196
  init_provider_model_discovery();
51659
52197
  init_antigravity_model_id();
51660
52198
  });
@@ -51673,11 +52211,6 @@ function redactSecrets2(text) {
51673
52211
  }
51674
52212
 
51675
52213
  // 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
52214
  class AntigravityCredentialProvider {
51682
52215
  catalogName = "antigravity";
51683
52216
  async describeReadiness() {
@@ -51703,33 +52236,31 @@ ${antigravityHost()}` : undefined;
51703
52236
  }
51704
52237
  async getRequestAuth(ctx) {
51705
52238
  const token = await getValidAntigravityAccessToken();
51706
- const { projectId, tierId } = await setupAntigravityUser(token);
52239
+ const { projectId } = await setupAntigravityUser(token);
51707
52240
  const served = await getServedAntigravityModels(token, projectId);
51708
52241
  return {
51709
52242
  headers: {
51710
52243
  Authorization: `Bearer ${token}`,
51711
- "User-Agent": buildAntigravityUserAgent(),
51712
- "x-activity-request-id": createActivityRequestId2()
52244
+ "User-Agent": buildAntigravityUserAgent()
51713
52245
  },
51714
52246
  transformPayload: (inner, request) => {
51715
52247
  const choice = chooseAntigravityServedModel(ctx.model, served, request?.effort);
51716
52248
  request?.onModelChoice?.(choice);
51717
52249
  const model = choice.id;
51718
- const env = {
52250
+ return buildAntigravityEnvelope({
52251
+ inner: antigravityBodyForModelId(inner, model, served.meta?.[model]?.thinkingLevel),
51719
52252
  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;
52253
+ projectId,
52254
+ meta: served.meta?.[model],
52255
+ conversation: antigravityConversations.of(inner, request?.conversationScope),
52256
+ sessionId: antigravityConversations.sessionId
52257
+ });
51728
52258
  }
51729
52259
  };
51730
52260
  }
51731
52261
  }
51732
52262
  var init_antigravity_credential = __esm(() => {
52263
+ init_antigravity_envelope();
51733
52264
  init_antigravity2();
51734
52265
  init_antigravity_token();
51735
52266
  init_antigravity_user();
@@ -54405,7 +54936,7 @@ var init_dist12 = __esm(() => {
54405
54936
 
54406
54937
  // src/auth/codex-pkce.ts
54407
54938
  import { exec as exec4 } from "child_process";
54408
- import { createHash as createHash13, randomBytes as randomBytes7 } from "crypto";
54939
+ import { createHash as createHash15, randomBytes as randomBytes9 } from "crypto";
54409
54940
  import { createServer } from "http";
54410
54941
  import { promisify as promisify3 } from "util";
54411
54942
  function loginClaims(idToken) {
@@ -54516,9 +55047,9 @@ function waitForCallback(options, deps) {
54516
55047
  }
54517
55048
  async function loginCodexPkce(deps = {}) {
54518
55049
  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");
55050
+ const verifier = randomBytes9(64).toString("base64url");
55051
+ const challenge = createHash15("sha256").update(verifier).digest("base64url");
55052
+ const state = randomBytes9(32).toString("base64url");
54522
55053
  const options = {
54523
55054
  port: 1455,
54524
55055
  timeoutMs: 5 * 60 * 1000,
@@ -55110,7 +55641,7 @@ var init_codex_oauth = __esm(() => {
55110
55641
  });
55111
55642
 
55112
55643
  // src/auth/accounts/management.ts
55113
- import { randomBytes as randomBytes8 } from "crypto";
55644
+ import { randomBytes as randomBytes10 } from "crypto";
55114
55645
  import { accessSync, constants as fsConstants, lstatSync as lstatSync3, readFileSync as readFileSync23 } from "fs";
55115
55646
  function legacyMoveDeferredMessage(outcome, env = process.env) {
55116
55647
  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 +55823,7 @@ class CodexAccountManagement {
55292
55823
  }
55293
55824
  newId(entry, reserved) {
55294
55825
  for (let attempt = 0;attempt < 16; attempt++) {
55295
- const id = this.deps.newId?.() ?? randomBytes8(6).toString("hex");
55826
+ const id = this.deps.newId?.() ?? randomBytes10(6).toString("hex");
55296
55827
  if (!ACCOUNT_ID_PATTERN.test(id))
55297
55828
  throw new Error("The account id generator returned an invalid id.");
55298
55829
  if (id !== reserved && !entry.accounts.some((row) => row.id === id))
@@ -55382,7 +55913,7 @@ class CodexAccountManagement {
55382
55913
  fingerprint: fingerprintOf(credentials2.refresh_token),
55383
55914
  journal: null,
55384
55915
  updatedAt: this.now(),
55385
- writeId: randomBytes8(16).toString("hex")
55916
+ writeId: randomBytes10(16).toString("hex")
55386
55917
  };
55387
55918
  }
55388
55919
  async run(command) {
@@ -55820,7 +56351,7 @@ class CodexAccountManagement {
55820
56351
  const existing = await dest.read(row, { uncached: true });
55821
56352
  const record = {
55822
56353
  ...material,
55823
- writeId: randomBytes8(16).toString("hex"),
56354
+ writeId: randomBytes10(16).toString("hex"),
55824
56355
  updatedAt: this.now()
55825
56356
  };
55826
56357
  const resumed = existing !== null && sameDurableRecord(existing, material);
@@ -56029,14 +56560,14 @@ var init_management = __esm(() => {
56029
56560
  });
56030
56561
 
56031
56562
  // src/auth/accounts/legacy-move.ts
56032
- import { lstatSync as lstatSync4, realpathSync as realpathSync3 } from "fs";
56563
+ import { lstatSync as lstatSync4, realpathSync as realpathSync4 } from "fs";
56033
56564
  import { join as join23, resolve as resolve2 } from "path";
56034
56565
  function legacyMoveKeychainBlocked(env = process.env) {
56035
56566
  return env.CLAUDISH_DISABLE_KEYCHAIN === "1" || !isKeychainSupported();
56036
56567
  }
56037
56568
  function canonical(path) {
56038
56569
  try {
56039
- return realpathSync3(path);
56570
+ return realpathSync4(path);
56040
56571
  } catch {
56041
56572
  return resolve2(path);
56042
56573
  }
@@ -56465,12 +56996,12 @@ var init_grok_credential = __esm(() => {
56465
56996
 
56466
56997
  // src/auth/kimi-oauth.ts
56467
56998
  import { exec as exec5 } from "child_process";
56468
- import { randomBytes as randomBytes9 } from "crypto";
56999
+ import { randomBytes as randomBytes11 } from "crypto";
56469
57000
  import {
56470
- closeSync as closeSync7,
57001
+ closeSync as closeSync8,
56471
57002
  existsSync as existsSync19,
56472
57003
  mkdirSync as mkdirSync12,
56473
- openSync as openSync7,
57004
+ openSync as openSync8,
56474
57005
  readFileSync as readFileSync25,
56475
57006
  unlinkSync as unlinkSync7,
56476
57007
  writeSync as writeSync6
@@ -56552,13 +57083,13 @@ class KimiOAuth {
56552
57083
  log(`[KimiOAuth] Failed to load device ID: ${e.message}`);
56553
57084
  }
56554
57085
  }
56555
- const deviceId = randomBytes9(16).toString("hex").replace(/(.{8})(.{4})(.{4})(.{4})(.{12})/, "$1-$2-$3-$4-$5");
57086
+ const deviceId = randomBytes11(16).toString("hex").replace(/(.{8})(.{4})(.{4})(.{4})(.{12})/, "$1-$2-$3-$4-$5");
56556
57087
  try {
56557
- const fd = openSync7(deviceIdPath, "w", 384);
57088
+ const fd = openSync8(deviceIdPath, "w", 384);
56558
57089
  try {
56559
57090
  writeSync6(fd, deviceId, 0, "utf-8");
56560
57091
  } finally {
56561
- closeSync7(fd);
57092
+ closeSync8(fd);
56562
57093
  }
56563
57094
  log(`[KimiOAuth] New device ID created: ${deviceId}`);
56564
57095
  } catch (e) {
@@ -57904,14 +58435,14 @@ var init_vertex_credential = __esm(() => {
57904
58435
  });
57905
58436
 
57906
58437
  // src/providers/dynamic-models-catalog-store.ts
57907
- import { createHmac, randomBytes as randomBytes10 } from "crypto";
58438
+ import { createHmac, randomBytes as randomBytes12 } from "crypto";
57908
58439
  import {
57909
- closeSync as closeSync8,
58440
+ closeSync as closeSync9,
57910
58441
  fsyncSync as fsyncSync3,
57911
58442
  linkSync as linkSync2,
57912
58443
  lstatSync as lstatSync5,
57913
58444
  mkdirSync as mkdirSync15,
57914
- openSync as openSync8,
58445
+ openSync as openSync9,
57915
58446
  readFileSync as readFileSync29,
57916
58447
  readdirSync as readdirSync3,
57917
58448
  rmSync as rmSync9,
@@ -57980,13 +58511,13 @@ function readSecret(path) {
57980
58511
  function createSecret(path) {
57981
58512
  const dir = dirname13(path);
57982
58513
  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);
58514
+ const temp = join29(dir, `.dynamic-models-catalog.key.${process.pid}.${randomBytes12(6).toString("hex")}`);
58515
+ const fd = openSync9(temp, "wx", 384);
57985
58516
  try {
57986
- writeSync7(fd, randomBytes10(32).toString("hex"));
58517
+ writeSync7(fd, randomBytes12(32).toString("hex"));
57987
58518
  fsyncSync3(fd);
57988
58519
  } finally {
57989
- closeSync8(fd);
58520
+ closeSync9(fd);
57990
58521
  }
57991
58522
  try {
57992
58523
  linkSync2(temp, path);
@@ -58214,7 +58745,7 @@ var init_dynamic_models_catalog_store = __esm(() => {
58214
58745
  });
58215
58746
 
58216
58747
  // src/providers/dynamic-models-catalog.ts
58217
- import { createHmac as createHmac2, randomBytes as randomBytes11 } from "crypto";
58748
+ import { createHmac as createHmac2, randomBytes as randomBytes13 } from "crypto";
58218
58749
  function nowOf2(opts) {
58219
58750
  return opts?.now ? opts.now() : Date.now();
58220
58751
  }
@@ -58432,7 +58963,7 @@ var init_dynamic_models_catalog = __esm(() => {
58432
58963
  init_dynamic_models_catalog_store();
58433
58964
  init_model_discovery();
58434
58965
  init_provider_definitions();
58435
- processSecret = randomBytes11(32);
58966
+ processSecret = randomBytes13(32);
58436
58967
  identityMemo = new Map;
58437
58968
  liveMemory = new Map;
58438
58969
  inFlight4 = new Map;
@@ -59355,14 +59886,14 @@ var init_proto_codec = __esm(() => {
59355
59886
  });
59356
59887
 
59357
59888
  // src/providers/devin/devin-request.ts
59358
- import { randomUUID as randomUUID5 } from "crypto";
59889
+ import { randomUUID as randomUUID4 } from "crypto";
59359
59890
  function encodeChatMetadata(meta) {
59360
59891
  const version = meta.clientVersion ?? DEVIN_CLI_VERSION;
59361
59892
  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
59893
  }
59363
59894
  function encodeMessage(message) {
59364
59895
  const parts = [
59365
- bytes(1, message.id ?? randomUUID5()),
59896
+ bytes(1, message.id ?? randomUUID4()),
59366
59897
  vint(2, DEVIN_ROLE[message.role])
59367
59898
  ];
59368
59899
  if (message.text)
@@ -59425,7 +59956,7 @@ var init_devin_request = __esm(() => {
59425
59956
  });
59426
59957
 
59427
59958
  // src/providers/devin/devin-models.ts
59428
- import { createHash as createHash14 } from "crypto";
59959
+ import { createHash as createHash16 } from "crypto";
59429
59960
  function unaryMetadata(apiKey) {
59430
59961
  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
59962
  }
@@ -59614,7 +60145,7 @@ function decodeAllowedUids(body) {
59614
60145
  return uids;
59615
60146
  }
59616
60147
  function hashApiKey(apiKey) {
59617
- return createHash14("sha256").update(apiKey).digest("hex");
60148
+ return createHash16("sha256").update(apiKey).digest("hex");
59618
60149
  }
59619
60150
  async function getServedDevinModels(opts) {
59620
60151
  const now = Date.now();
@@ -59767,7 +60298,8 @@ function formatWindow(tokens) {
59767
60298
 
59768
60299
  class DevinModelResolver {
59769
60300
  provider = "devin";
59770
- collapse(modelsCatalog) {
60301
+ collapse(listed) {
60302
+ const modelsCatalog = withoutOptIn(listed);
59771
60303
  const groups = new Map;
59772
60304
  for (const entry of modelsCatalog) {
59773
60305
  const key = keyOf(entry);
@@ -59820,9 +60352,14 @@ class DevinModelResolver {
59820
60352
  logModelIdChoice("Devin", selection.trim() || selection, choice);
59821
60353
  return choice.id;
59822
60354
  }
59823
- choose(selection, modelsCatalog, effort) {
60355
+ choose(selection, listed, effort) {
59824
60356
  const requested = selection.trim();
59825
60357
  const lower = requested.toLowerCase();
60358
+ if (isOptInWireId(requested)) {
60359
+ const listedId = listed.find((entry) => entry.wireId.toLowerCase() === lower)?.wireId;
60360
+ return { id: listedId ?? requested, effort, source: "exact id" };
60361
+ }
60362
+ const modelsCatalog = withoutOptIn(listed);
59826
60363
  const exact = modelsCatalog.find((entry) => entry.wireId.toLowerCase() === lower);
59827
60364
  const isMappedBase = requested !== "" && findModelIdEffortConnection(requested, "devin") !== undefined;
59828
60365
  if (exact && !effort && isMappedBase) {
@@ -59863,6 +60400,9 @@ class DevinModelResolver {
59863
60400
  return unmapped(pickForEffort(groups.get(keyOf(chosen)), effort).wireId);
59864
60401
  }
59865
60402
  }
60403
+ function withoutOptIn(modelsCatalog) {
60404
+ return modelsCatalog.filter((entry) => !isOptInWireId(entry.wireId));
60405
+ }
59866
60406
  function mappedWireId(requested, modelsCatalog, effort) {
59867
60407
  const byId = new Map;
59868
60408
  for (const entry of modelsCatalog) {
@@ -60191,7 +60731,7 @@ var init_model_discovery_builtins = __esm(() => {
60191
60731
  });
60192
60732
 
60193
60733
  // src/providers/model-discovery.ts
60194
- import { createHash as createHash15 } from "crypto";
60734
+ import { createHash as createHash17 } from "crypto";
60195
60735
  function toModelsCatalogEntry(model) {
60196
60736
  const { id, ...rest } = model;
60197
60737
  return { wireId: id, ...rest };
@@ -60204,7 +60744,7 @@ function getModelDiscoveryFetcher(format) {
60204
60744
  }
60205
60745
  async function accountFingerprint(providerName) {
60206
60746
  const identity = await credentials.accountIdentity(providerName, { allowOpPrompt: false });
60207
- return identity ? createHash15("sha256").update(identity).digest("hex") : undefined;
60747
+ return identity ? createHash17("sha256").update(identity).digest("hex") : undefined;
60208
60748
  }
60209
60749
  function recordFailure(failure) {
60210
60750
  _failures.set(failure.provider, failure);
@@ -60916,12 +61456,12 @@ function getCachedEntries() {
60916
61456
  _memoMtimeMs = mtimeMs;
60917
61457
  return _memoEntries;
60918
61458
  }
60919
- function findEntryByAlias(alias) {
61459
+ function findEntryByAlias(alias, accept = () => true) {
60920
61460
  const entries = getCachedEntries();
60921
61461
  if (!entries || entries.length === 0)
60922
61462
  return null;
60923
61463
  for (const entry of entries) {
60924
- if (entry.aliases.includes(alias)) {
61464
+ if (entry.aliases.includes(alias) && accept(entry.modelId)) {
60925
61465
  return project(entry);
60926
61466
  }
60927
61467
  }
@@ -60943,7 +61483,7 @@ function findVisionAlias(alias) {
60943
61483
  if (!entries || entries.length === 0)
60944
61484
  return null;
60945
61485
  for (const entry of entries) {
60946
- if (entry.supportsVision === true && entry.aliases.includes(alias)) {
61486
+ if (entry.supportsVision === true && entry.aliases.includes(alias) && !isOptInWireId(entry.modelId)) {
60947
61487
  return project(entry);
60948
61488
  }
60949
61489
  }
@@ -61176,7 +61716,7 @@ function reduceEvent(state, event) {
61176
61716
  }
61177
61717
 
61178
61718
  // src/session-events/transcript-tailer.ts
61179
- import { closeSync as closeSync9, openSync as openSync9, readSync as readSync2, statSync as statSync12 } from "fs";
61719
+ import { closeSync as closeSync10, openSync as openSync10, readSync as readSync3, statSync as statSync12 } from "fs";
61180
61720
 
61181
61721
  class TranscriptTailer {
61182
61722
  filePath;
@@ -61229,16 +61769,16 @@ class TranscriptTailer {
61229
61769
  }
61230
61770
  if (size === this.offset)
61231
61771
  return;
61232
- const fd = openSync9(this.filePath, "r");
61772
+ const fd = openSync10(this.filePath, "r");
61233
61773
  let chunk;
61234
61774
  try {
61235
61775
  chunk = Buffer.alloc(size - this.offset);
61236
- const bytesRead = readSync2(fd, chunk, 0, chunk.length, this.offset);
61776
+ const bytesRead = readSync3(fd, chunk, 0, chunk.length, this.offset);
61237
61777
  this.offset += bytesRead;
61238
61778
  if (bytesRead < chunk.length)
61239
61779
  chunk = chunk.subarray(0, bytesRead);
61240
61780
  } finally {
61241
- closeSync9(fd);
61781
+ closeSync10(fd);
61242
61782
  }
61243
61783
  this.buffer += this.decoder.decode(chunk, { stream: true });
61244
61784
  const lines = this.buffer.split(`
@@ -61747,7 +62287,7 @@ function formatOtlpBatch(events, resource) {
61747
62287
  }
61748
62288
 
61749
62289
  // src/telemetry.ts
61750
- import { randomBytes as randomBytes12 } from "crypto";
62290
+ import { randomBytes as randomBytes14 } from "crypto";
61751
62291
  function getVersion() {
61752
62292
  return VERSION;
61753
62293
  }
@@ -62016,7 +62556,7 @@ function initTelemetry(_config) {
62016
62556
  } catch {
62017
62557
  consentEnabled = false;
62018
62558
  }
62019
- sessionId = randomBytes12(8).toString("hex");
62559
+ sessionId = randomBytes14(8).toString("hex");
62020
62560
  claudishVersion = getVersion();
62021
62561
  installMethod = detectInstallMethod();
62022
62562
  }
@@ -63594,6 +64134,25 @@ function toolReferencesAsText(messages, wording = {}) {
63594
64134
  }
63595
64135
  var identity2 = (name) => name, always = () => true, loadedText = (name) => `Loaded: ${name}. It is in your tool list now.`, notLoadedText = (name) => `Not loaded: ${name}. It is not in your tool list.`, isReference = (item) => item?.type === "tool_reference";
63596
64136
 
64137
+ // src/handlers/shared/repeat-window.ts
64138
+ function firstInWindow(line, now = Date.now()) {
64139
+ const at = lastPrinted.get(line);
64140
+ if (at !== undefined && now - at < REPEAT_WINDOW_MS)
64141
+ return false;
64142
+ lastPrinted.set(line, now);
64143
+ if (lastPrinted.size > 256) {
64144
+ for (const [key, t] of lastPrinted) {
64145
+ if (now - t >= REPEAT_WINDOW_MS)
64146
+ lastPrinted.delete(key);
64147
+ }
64148
+ }
64149
+ return true;
64150
+ }
64151
+ var REPEAT_WINDOW_MS = 30000, lastPrinted;
64152
+ var init_repeat_window = __esm(() => {
64153
+ lastPrinted = new Map;
64154
+ });
64155
+
63597
64156
  // src/handlers/shared/responses-leg-issuer.ts
63598
64157
  function isSameCredentialSilo(turn, next) {
63599
64158
  return (turn.auth?.arm ?? undefined) === (next.auth?.arm ?? undefined) && turn.accountKey === next.accountKey;
@@ -64911,7 +65470,7 @@ data: ${JSON.stringify(data)}
64911
65470
  };
64912
65471
  toolCalls.set(toolIdx, t);
64913
65472
  if (opts.onToolCall) {
64914
- opts.onToolCall(toolId, part.functionCall.name, part.thoughtSignature);
65473
+ opts.onToolCall(toolId, part.functionCall.name, part.thoughtSignature, typeof part.functionCall.id === "string" ? part.functionCall.id : undefined);
64915
65474
  }
64916
65475
  send("content_block_start", {
64917
65476
  type: "content_block_start",
@@ -68111,7 +68670,7 @@ var init_upstream_error_capture = __esm(() => {
68111
68670
  });
68112
68671
 
68113
68672
  // src/handlers/composed-handler.ts
68114
- import { randomUUID as randomUUID6 } from "crypto";
68673
+ import { randomUUID as randomUUID5 } from "crypto";
68115
68674
  function startAllowanceFlight() {
68116
68675
  try {
68117
68676
  return getAllowanceService().requestStarted();
@@ -68632,7 +69191,7 @@ class ComposedHandler {
68632
69191
  overload: { attempts: 0 },
68633
69192
  deadlineAt: tier1DeadlineAt(c),
68634
69193
  payloadVersion: 0,
68635
- requestId: randomUUID6(),
69194
+ requestId: randomUUID5(),
68636
69195
  outcomes: new Map,
68637
69196
  observedResponses: new WeakSet,
68638
69197
  ledger
@@ -69148,7 +69707,8 @@ class ComposedHandler {
69148
69707
  const fetchCurrent = () => {
69149
69708
  if (callSignal?.aborted)
69150
69709
  return Promise.reject(callAbortError());
69151
- return fetch(activeEndpoint, mergeSignalIntoInit({
69710
+ const send = this.provider.fetch ? (url, init) => this.provider.fetch(url, init) : fetch;
69711
+ return send(activeEndpoint, mergeSignalIntoInit({
69152
69712
  method: "POST",
69153
69713
  headers: activeHeaders,
69154
69714
  body: serialized.body,
@@ -69564,7 +70124,11 @@ class ComposedHandler {
69564
70124
  const providerMsg = extractProviderMessage(parsedErrorBody ?? errorText);
69565
70125
  const oneLineMsg = providerMsg.replace(/\s+/g, " ").trim();
69566
70126
  const msgTail = oneLineMsg ? ` (${oneLineMsg.length > 200 ? `${oneLineMsg.slice(0, 200)}\u2026` : oneLineMsg})` : "";
69567
- logStderr(`Error [${this.provider.displayName}]: HTTP ${response.status}. ${hint}${msgTail}`);
70127
+ const errorLine = `Error [${this.provider.displayName}]: HTTP ${response.status}. ${hint}${msgTail}`;
70128
+ if (firstInWindow(errorLine))
70129
+ logStderr(errorLine);
70130
+ else
70131
+ log(errorLine);
69568
70132
  let providerErrorType;
69569
70133
  try {
69570
70134
  const parsed = JSON.parse(errorText);
@@ -69618,7 +70182,7 @@ class ComposedHandler {
69618
70182
  providerMessage: providerMsg,
69619
70183
  leadPhrase: isContextOverflowError(response.status, errorText) ? CONTEXT_OVERFLOW_PHRASE : undefined
69620
70184
  });
69621
- const verdictHeaders = this.signedBilling(binding).subscription && isCredentialRejection(response.status, errorText) ? authVerdictHeaders("terminal") : undefined;
70185
+ const verdictHeaders = isCredentialRejection(response.status, errorText) ? authVerdictHeaders("terminal") : undefined;
69622
70186
  return c.json(wrapAnthropicError(400, surfaced, "invalid_request_error", response.status, providerMsg), 400, verdictHeaders);
69623
70187
  }
69624
70188
  return c.json(ensureAnthropicErrorFormat(response.status, errorBody), response.status);
@@ -70111,9 +70675,9 @@ class ComposedHandler {
70111
70675
  onToolCallObserved: observeToolCall
70112
70676
  });
70113
70677
  case "gemini-sse": {
70114
- const onToolCall = (toolId, name, thoughtSignature) => {
70678
+ const onToolCall = (toolId, name, thoughtSignature, callId) => {
70115
70679
  if (typeof adapter.registerToolCall === "function") {
70116
- adapter.registerToolCall(toolId, name, thoughtSignature);
70680
+ adapter.registerToolCall(toolId, name, thoughtSignature, callId);
70117
70681
  }
70118
70682
  };
70119
70683
  return createGeminiSseStream(c, response, {
@@ -70343,6 +70907,7 @@ var init_composed_handler = __esm(() => {
70343
70907
  init_model_unsupported();
70344
70908
  init_quota_exhaustion();
70345
70909
  init_remote_provider_types();
70910
+ init_repeat_window();
70346
70911
  init_responses_leg_issuer();
70347
70912
  init_stream_head_sniffer();
70348
70913
  init_anthropic_sse();
@@ -70833,7 +71398,14 @@ class DevinProviderTransport {
70833
71398
  if (served.length === 0) {
70834
71399
  return { model: null, reason: "Devin reported no models for this subscription" };
70835
71400
  }
70836
- const ranked = [...served].sort((a, b) => {
71401
+ const ordinary = served.filter((model) => !isOptInWireId(model.uid));
71402
+ if (ordinary.length === 0) {
71403
+ return {
71404
+ model: null,
71405
+ reason: "Devin lists only content-use opt-in models for this subscription"
71406
+ };
71407
+ }
71408
+ const ranked = [...ordinary].sort((a, b) => {
70837
71409
  const diff = b.contextWindow - a.contextWindow;
70838
71410
  return diff !== 0 ? diff : a.uid.localeCompare(b.uid);
70839
71411
  });
@@ -71097,20 +71669,6 @@ var init_ollamacloud = __esm(() => {
71097
71669
  init_probe_discovery();
71098
71670
  });
71099
71671
 
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
71672
  // src/providers/transport/openai-codex.ts
71115
71673
  var OpenAICodexTransport;
71116
71674
  var init_openai_codex = __esm(() => {
@@ -71395,9 +71953,10 @@ async function discoverVertexProbeModel(exclude) {
71395
71953
  } catch (e) {
71396
71954
  return fail(`Vertex AI model list failed: ${e instanceof Error ? e.message : String(e)}`);
71397
71955
  }
71398
- const ranked = rankDiscoveredModels(listing.models).map((m) => m.id).filter(isChatCapable);
71956
+ const chatCapable = rankDiscoveredModels(listing.models).map((m) => m.id).filter(isChatCapable);
71957
+ const ranked = chatCapable.filter((id) => !isOptInWireId(id));
71399
71958
  if (ranked.length === 0) {
71400
- return fail(listing.listed === 0 ? `${listing.endpoint} listed no models for this project` : `no chat-capable model among the ${listing.listed} that ${listing.endpoint} listed for this project`);
71959
+ return fail(noCandidateReason(listing, chatCapable.length));
71401
71960
  }
71402
71961
  if (!config) {
71403
71962
  return fail("no Google Cloud project resolved");
@@ -71413,6 +71972,14 @@ async function discoverVertexProbeModel(exclude) {
71413
71972
  _cache3.set(cacheKey, { ranked: served, expiresAt: Date.now() + CACHE_TTL_MS3 });
71414
71973
  return pickFrom(served, undefined, exclude);
71415
71974
  }
71975
+ function noCandidateReason(listing, chatCapableCount) {
71976
+ if (listing.listed === 0)
71977
+ return `${listing.endpoint} listed no models for this project`;
71978
+ if (chatCapableCount > 0) {
71979
+ return `no chat-capable model that is not a content-use opt-in id among the ${listing.listed} that ${listing.endpoint} listed for this project`;
71980
+ }
71981
+ return `no chat-capable model among the ${listing.listed} that ${listing.endpoint} listed for this project`;
71982
+ }
71416
71983
  function pickFrom(ranked, reason, exclude) {
71417
71984
  if (ranked.length === 0)
71418
71985
  return { model: null, reason };
@@ -72356,7 +72923,10 @@ var init_provider_profiles = __esm(() => {
72356
72923
  antigravityProfile = {
72357
72924
  createHandler(ctx) {
72358
72925
  const transport = new AntigravityProviderTransport(ctx.modelName);
72359
- const adapter = new GeminiAPIFormat(ctx.modelName, undefined, { thinkingFromModelName: true });
72926
+ const adapter = new GeminiAPIFormat(ctx.modelName, undefined, {
72927
+ thinkingFromModelName: true,
72928
+ serverCallIds: true
72929
+ });
72360
72930
  const handler = new ComposedHandler(transport, ctx.targetModel, ctx.modelName, ctx.port, {
72361
72931
  adapter,
72362
72932
  unwrapGeminiResponse: true,
@@ -84093,44 +84663,42 @@ var init_native_route = __esm(() => {
84093
84663
  function decideHopFailure(input) {
84094
84664
  if (input.kind === "thrown")
84095
84665
  return { action: "advance", reason: "thrown" };
84096
- const { status, headers, body, provider, name } = input;
84666
+ const { status, headers, body, name } = input;
84097
84667
  if (hasRecoveryMarker(headers))
84098
84668
  return { action: "stop", reason: "recovery-hold" };
84099
84669
  if (hasStreamFailureMarker(headers))
84100
84670
  return { action: "stop", reason: "stream-failure" };
84101
84671
  const connectionFault = isClaudishConnectionVerdict(headers);
84102
84672
  const verdict = authVerdict(headers);
84103
- const subscriptionRejected = !connectionFault && verdict === "terminal" && !!provider && isSubscriptionProvider(provider);
84104
- if (verdict && !subscriptionRejected)
84673
+ const terminalRejection = !connectionFault && verdict === "terminal";
84674
+ if (verdict && !terminalRejection)
84105
84675
  return { action: "stop", reason: "credential-hold" };
84106
- if (subscriptionRejected || !connectionFault && isSubscriptionCredentialRejection(status, body, provider)) {
84107
- return { action: "advance", reason: "subscription-credential-rejected" };
84676
+ if (terminalRejection || !connectionFault && isRejectedCredentialAnswer(status, body)) {
84677
+ return { action: "advance", reason: "credential-rejected" };
84108
84678
  }
84109
- if (!isRetryableError(status, body, name, headers, provider)) {
84679
+ if (!isRetryableError(status, body, name, headers)) {
84110
84680
  return { action: "stop", reason: "non-retryable" };
84111
84681
  }
84112
84682
  return { action: "advance", reason: "retryable" };
84113
84683
  }
84114
- function isSubscriptionCredentialRejection(status, errorBody, providerId) {
84115
- if (!providerId || !isSubscriptionProvider(providerId))
84116
- return false;
84684
+ function isRejectedCredentialAnswer(status, errorBody) {
84117
84685
  const recovered = status === 400 ? extractUpstreamStatus(errorBody) : undefined;
84118
84686
  if ((status === 401 || recovered === 401) && isCredentialRejection(401, errorBody)) {
84119
84687
  return true;
84120
84688
  }
84121
84689
  return status === 403 && isCredentialRejection(403, errorBody);
84122
84690
  }
84123
- function isRetryableError(status, errorBody, provider, headers, providerId) {
84691
+ function isRetryableError(status, errorBody, provider, headers) {
84124
84692
  if (isClaudishConnectionVerdict(headers))
84125
84693
  return false;
84126
84694
  if (hasStreamFailureMarker(headers))
84127
84695
  return false;
84128
84696
  const verdict = authVerdict(headers);
84129
84697
  if (verdict)
84130
- return verdict === "terminal" && !!providerId && isSubscriptionProvider(providerId);
84698
+ return verdict === "terminal";
84131
84699
  if (hasQuotaExhaustionWording(errorBody))
84132
84700
  return true;
84133
- if (isSubscriptionCredentialRejection(status, errorBody, providerId))
84701
+ if (isRejectedCredentialAnswer(status, errorBody))
84134
84702
  return true;
84135
84703
  const upstream = status === 400 ? extractUpstreamStatus(errorBody) : undefined;
84136
84704
  if (upstream === 401 || upstream === 403 || upstream === 402 || upstream === 429) {
@@ -84180,7 +84748,6 @@ var init_hop_decision = __esm(() => {
84180
84748
  init_anthropic_error();
84181
84749
  init_auth_failure();
84182
84750
  init_quota_exhaustion();
84183
- init_remote_provider_types();
84184
84751
  });
84185
84752
 
84186
84753
  // src/providers/probe-hop-origin.ts
@@ -84326,7 +84893,6 @@ function chainDecisionOf(response, body, provider) {
84326
84893
  status: response.status,
84327
84894
  headers: response.headers,
84328
84895
  body,
84329
- provider,
84330
84896
  name: provider
84331
84897
  });
84332
84898
  return { chainAction: decision.action, chainReason: decision.reason };
@@ -85558,7 +86124,7 @@ function catalogModelId(model, cachePath) {
85558
86124
  const entries = cachePath ? readAllModelsCache(cachePath)?.entries : getCatalogEntries();
85559
86125
  return entries ? findCatalogEntry(entries, model)?.modelId : undefined;
85560
86126
  }
85561
- function gatherFromConnections(entry, candidates, excluded, unmappedRoutes, cachePath) {
86127
+ function gatherFromConnections(model, entry, candidates, excluded, unmappedRoutes, cachePath) {
85562
86128
  for (const connection of entry.aggregators ?? []) {
85563
86129
  if (connection.routeStatus !== "mapped")
85564
86130
  continue;
@@ -85567,9 +86133,10 @@ function gatherFromConnections(entry, candidates, excluded, unmappedRoutes, cach
85567
86133
  const tier = getProviderByName(provider)?.tier;
85568
86134
  if (!tier)
85569
86135
  continue;
85570
- const wireId = externalIdFor(entry, provider);
85571
- if (!wireId || wireId !== connection.externalModelId)
86136
+ const baseWireId = externalIdFor(entry, provider);
86137
+ if (!baseWireId || baseWireId !== connection.externalModelId)
85572
86138
  continue;
86139
+ const wireId = implicitEffortWireId(connection, model) ?? baseWireId;
85573
86140
  const candidate = connectionCandidate(entry, connection, provider, tier, wireId);
85574
86141
  if (tier === "subscription" && resolveSubscriptionRouting(entry.modelId, provider, cachePath).kind === "not-served") {
85575
86142
  excluded.push({ candidate, outcome: "excluded-by-membership" });
@@ -85643,6 +86210,8 @@ function catalogConnects(entry, provider) {
85643
86210
  function gatherVendorClaims(model, entry, candidates) {
85644
86211
  if (!entry || !isChatModelEntry(entry))
85645
86212
  return;
86213
+ if (isOptInWireId(model))
86214
+ return;
85646
86215
  for (const def of getAllProviders()) {
85647
86216
  if (def.tier !== "dynamic-subscription")
85648
86217
  continue;
@@ -85667,6 +86236,8 @@ function listedRow(provider, model, models, excludedIds) {
85667
86236
  return row && !isOptInWireId(row.id) ? row : undefined;
85668
86237
  }
85669
86238
  function gatherAccountListed(model, entry, lists, candidates, excluded, cachePath) {
86239
+ if (isOptInWireId(model))
86240
+ return;
85670
86241
  for (const [provider, list] of lists) {
85671
86242
  const tier = getProviderByName(provider)?.tier;
85672
86243
  if (!tier)
@@ -85720,7 +86291,7 @@ function gatherRouteCandidates(model, cachePath, lists = new Map) {
85720
86291
  const setAside = [];
85721
86292
  const unmappedRoutes = new Set;
85722
86293
  if (entry)
85723
- gatherFromConnections(entry, gathered, setAside, unmappedRoutes, cachePath);
86294
+ gatherFromConnections(model, entry, gathered, setAside, unmappedRoutes, cachePath);
85724
86295
  gatherVendorClaims(model, entry, gathered);
85725
86296
  gatherAccountListed(model, entry, lists, gathered, setAside, cachePath);
85726
86297
  const keyOf = (candidate) => JSON.stringify([candidate.provider, candidate.wireId]);
@@ -85773,6 +86344,12 @@ function catalogMapsOnlyOptIn(provider, model, cachePath) {
85773
86344
  const mapsHere = (connection) => connection.routeStatus === "mapped" && catalogRouteMatchesProvider(connection.route, provider);
85774
86345
  return !(entry.aggregators ?? []).some(mapsHere) && (entry.optInConnections ?? []).some(mapsHere);
85775
86346
  }
86347
+ function isUnvouchedOptInWireId(provider, wireId, cachePath) {
86348
+ if (!isOptInWireId(wireId))
86349
+ return false;
86350
+ const entries = cachePath ? readAllModelsCache(cachePath)?.entries : getCatalogEntries();
86351
+ return !(entries ?? []).some((entry) => (entry.aggregators ?? []).some((connection) => connection.routeStatus === "mapped" && catalogRouteMatchesProvider(connection.route, provider) && connection.externalModelId === wireId));
86352
+ }
85776
86353
  function routeOwnership(provider) {
85777
86354
  const probe = readProbeModelsCache();
85778
86355
  if (!probe)
@@ -85791,6 +86368,7 @@ var init_route_candidates = __esm(() => {
85791
86368
  init_antigravity_model_id();
85792
86369
  init_catalog_client();
85793
86370
  init_catalog_route_bindings();
86371
+ init_model_id_effort();
85794
86372
  init_registry4();
85795
86373
  init_probe_catalog();
85796
86374
  init_provider_definitions();
@@ -86058,7 +86636,7 @@ function resolveRoutingEntries(entries, originalModelName, cachePath, opts = {})
86058
86636
  }
86059
86637
  }
86060
86638
  if (!wireIdResolved) {
86061
- const externalId = resolveExternalId(modelName, provider, cachePath);
86639
+ const externalId = atIdx === -1 ? resolveImplicitExternalId(modelName, provider, cachePath) : resolveExternalId(modelName, provider, cachePath);
86062
86640
  if (externalId === null && atIdx === -1 && readsGatewayList(provider, cachePath)) {
86063
86641
  const answer = gatewayListAnswer(provider, modelName, opts.gatewayLists);
86064
86642
  if (answer.wireId === undefined) {
@@ -86075,6 +86653,13 @@ function resolveRoutingEntries(entries, originalModelName, cachePath, opts = {})
86075
86653
  modelName = externalId ?? modelName;
86076
86654
  }
86077
86655
  }
86656
+ if (atIdx === -1 && isUnvouchedOptInWireId(provider, modelName, cachePath)) {
86657
+ resolved.push({
86658
+ route: routeFor(provider, modelName),
86659
+ exclusion: "excluded-by-content-use"
86660
+ });
86661
+ continue;
86662
+ }
86078
86663
  resolved.push({ route: routeFor(provider, modelName) });
86079
86664
  }
86080
86665
  return resolved;
@@ -86096,7 +86681,7 @@ function gatewayListAnswer(provider, model, gatewayLists) {
86096
86681
  return { wireId: gatewayWireIdFor(entry?.modelId ?? model, entry?.provider, list) };
86097
86682
  }
86098
86683
  function gatewayListsNeeded(entries, model, cachePath) {
86099
- const providers = entries.filter((entry) => !entry.includes("@")).map(ruleEntryProvider).filter((provider) => readsGatewayList(provider, cachePath) && resolveExternalId(model, provider, cachePath) === null);
86684
+ const providers = entries.filter((entry) => !entry.includes("@")).map(ruleEntryProvider).filter((provider) => readsGatewayList(provider, cachePath) && resolveImplicitExternalId(model, provider, cachePath) === null);
86100
86685
  return [...new Set(providers)];
86101
86686
  }
86102
86687
  function routeFor(provider, wireId) {
@@ -86784,6 +87369,18 @@ function describeCatalogOrigin(explanation) {
86784
87369
  }
86785
87370
  return `catalog \xB7 ${firstHopPhrase(explanation)}`;
86786
87371
  }
87372
+ function droppedHopPhrase(candidate) {
87373
+ if (candidate.outcome === "kept")
87374
+ return "";
87375
+ if (candidate.outcome !== "excluded-by-content-use") {
87376
+ return DROPPED_FALLBACK_PHRASE[candidate.outcome];
87377
+ }
87378
+ if (isOptInWireId(candidate.wireId)) {
87379
+ const prefix = PROVIDER_TO_PREFIX[candidate.provider] ?? candidate.provider;
87380
+ return `would send a contributor (content-use opt-in) id, which claudish never chooses; type ${prefix}@${candidate.wireId} to opt in`;
87381
+ }
87382
+ return "maps it only through a contributor (content-use opt-in) id";
87383
+ }
86787
87384
  function describeAbsentEntry(explanation) {
86788
87385
  const head = `catalog has no entry for "${explanation.routedModel}"`;
86789
87386
  const withheld = explanation.fallbackWithheld;
@@ -86796,7 +87393,7 @@ function describeAbsentEntry(explanation) {
86796
87393
  const fallback = explanation.candidates.find((candidate) => candidate.position === "fallback");
86797
87394
  if (!fallback)
86798
87395
  return `${head} \xB7 ${firstHopPhrase(explanation)}`;
86799
- return fallback.outcome === "kept" ? `${head} \xB7 fallback only` : `${head} \xB7 fallback ${fallback.displayName} ${DROPPED_FALLBACK_PHRASE[fallback.outcome]}`;
87396
+ return fallback.outcome === "kept" ? `${head} \xB7 fallback only` : `${head} \xB7 fallback ${fallback.displayName} ${droppedHopPhrase(fallback)}`;
86800
87397
  }
86801
87398
  function firstHopPhrase(explanation) {
86802
87399
  if (explanation.outcome.kind === "no-route")
@@ -86853,7 +87450,6 @@ var init_routing_rules = __esm(() => {
86853
87450
  "credential-unreadable": "has a credential that could not be read",
86854
87451
  "not-served": "does not serve it",
86855
87452
  "excluded-by-membership": "is outside its plan's membership",
86856
- "excluded-by-content-use": "maps it only through a contributor (content-use opt-in) id",
86857
87453
  "unknown-provider": "is not a known provider shortcut",
86858
87454
  "gateway-id-unknown": "has no exact id for it in its models list"
86859
87455
  };
@@ -87381,7 +87977,7 @@ function herdrPaneEnv(env = process.env) {
87381
87977
  }
87382
87978
 
87383
87979
  // src/auth/claude-code-facts.ts
87384
- import { createHash as createHash17 } from "crypto";
87980
+ import { createHash as createHash18 } from "crypto";
87385
87981
  import { homedir as homedir35 } from "os";
87386
87982
  import { isAbsolute as isAbsolute2, resolve as resolve4 } from "path";
87387
87983
  function defaultConfigDir(env) {
@@ -87394,7 +87990,7 @@ function claudeCodeConfigDir(env = process.env) {
87394
87990
  return isAbsolute2(raw) ? resolve4(raw) : resolve4(process.cwd(), raw);
87395
87991
  }
87396
87992
  function configDirHash(configDir) {
87397
- return createHash17("sha256").update(configDir).digest("hex").slice(0, 8);
87993
+ return createHash18("sha256").update(configDir).digest("hex").slice(0, 8);
87398
87994
  }
87399
87995
  function claudeCodeSecureStorageServices(kind, env = process.env) {
87400
87996
  const base = `${BASE_KEYCHAIN_SERVICE}${kind}`;
@@ -89407,7 +90003,7 @@ var init_slot_steps = __esm(() => {
89407
90003
  });
89408
90004
 
89409
90005
  // src/pane/subagent-ledger.ts
89410
- import { createHash as createHash18 } from "crypto";
90006
+ import { createHash as createHash19 } from "crypto";
89411
90007
  function str4(v) {
89412
90008
  return typeof v === "string" && v.length > 0 ? v : null;
89413
90009
  }
@@ -89419,7 +90015,7 @@ function subagentDescription(v) {
89419
90015
  return line ? line.slice(0, SUBAGENT_DESCRIPTION_MAX) : null;
89420
90016
  }
89421
90017
  function digest(text) {
89422
- return createHash18("sha256").update(text).digest("base64");
90018
+ return createHash19("sha256").update(text).digest("base64");
89423
90019
  }
89424
90020
  function userText(r) {
89425
90021
  const c = r.message?.content;
@@ -89735,14 +90331,14 @@ var init_subagent_ledger = __esm(() => {
89735
90331
 
89736
90332
  // src/pane/transcript-follower.ts
89737
90333
  import {
89738
- closeSync as closeSync10,
90334
+ closeSync as closeSync11,
89739
90335
  existsSync as existsSync27,
89740
90336
  fstatSync as fstatSync3,
89741
- openSync as openSync10,
90337
+ openSync as openSync11,
89742
90338
  readFileSync as readFileSync36,
89743
- readSync as readSync3,
90339
+ readSync as readSync4,
89744
90340
  readdirSync as readdirSync6,
89745
- realpathSync as realpathSync4,
90341
+ realpathSync as realpathSync5,
89746
90342
  statSync as statSync13
89747
90343
  } from "fs";
89748
90344
  import { join as join39 } from "path";
@@ -89762,7 +90358,7 @@ function initialFollowerState(resolvePath = safeRealpath) {
89762
90358
  }
89763
90359
  function safeRealpath(p) {
89764
90360
  try {
89765
- return realpathSync4(p);
90361
+ return realpathSync5(p);
89766
90362
  } catch {
89767
90363
  return p;
89768
90364
  }
@@ -90250,7 +90846,7 @@ class Tail {
90250
90846
  read() {
90251
90847
  let fd;
90252
90848
  try {
90253
- fd = openSync10(this.path, "r");
90849
+ fd = openSync11(this.path, "r");
90254
90850
  } catch {
90255
90851
  return [];
90256
90852
  }
@@ -90259,7 +90855,7 @@ class Tail {
90259
90855
  if (size <= this.offset)
90260
90856
  return [];
90261
90857
  const chunk = Buffer.alloc(size - this.offset);
90262
- const got = readSync3(fd, chunk, 0, chunk.length, this.offset);
90858
+ const got = readSync4(fd, chunk, 0, chunk.length, this.offset);
90263
90859
  this.offset += got;
90264
90860
  const fresh = chunk.subarray(0, got);
90265
90861
  const buf = this.rest.length ? Buffer.concat([this.rest, fresh]) : fresh;
@@ -90276,7 +90872,7 @@ class Tail {
90276
90872
  this.rest = Buffer.from(buf.subarray(start));
90277
90873
  return out;
90278
90874
  } finally {
90279
- closeSync10(fd);
90875
+ closeSync11(fd);
90280
90876
  }
90281
90877
  }
90282
90878
  }
@@ -90537,7 +91133,7 @@ __export(exports_session_discovery, {
90537
91133
  transcriptPathFor: () => transcriptPathFor
90538
91134
  });
90539
91135
  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";
91136
+ import { closeSync as closeSync12, openSync as openSync12, readSync as readSync5, readdirSync as readdirSync7, realpathSync as realpathSync6, statSync as statSync14 } from "fs";
90541
91137
  import { basename as basename3, join as join41 } from "path";
90542
91138
  function projectsDir(env = process.env) {
90543
91139
  return join41(claudeConfigDir(env), "projects");
@@ -90548,7 +91144,7 @@ function slugForPath(absPath) {
90548
91144
  function transcriptPathFor(cwd, sessionUuid, projectsRoot = projectsDir()) {
90549
91145
  let real = cwd;
90550
91146
  try {
90551
- real = realpathSync5(cwd);
91147
+ real = realpathSync6(cwd);
90552
91148
  } catch {}
90553
91149
  return join41(projectsRoot, slugForPath(real), `${sessionUuid}.jsonl`);
90554
91150
  }
@@ -90787,16 +91383,16 @@ function readChunk(file, pos, len) {
90787
91383
  return "";
90788
91384
  let fd = null;
90789
91385
  try {
90790
- fd = openSync11(file, "r");
91386
+ fd = openSync12(file, "r");
90791
91387
  const buf = Buffer.allocUnsafe(len);
90792
- const n = readSync4(fd, buf, 0, len, pos);
91388
+ const n = readSync5(fd, buf, 0, len, pos);
90793
91389
  return buf.subarray(0, n).toString("utf-8");
90794
91390
  } catch {
90795
91391
  return "";
90796
91392
  } finally {
90797
91393
  if (fd !== null) {
90798
91394
  try {
90799
- closeSync11(fd);
91395
+ closeSync12(fd);
90800
91396
  } catch {}
90801
91397
  }
90802
91398
  }
@@ -92066,11 +92662,11 @@ var init_magmux_binary = () => {};
92066
92662
  // src/launcher/magmux-wrapper.ts
92067
92663
  import {
92068
92664
  chmodSync as chmodSync3,
92069
- closeSync as closeSync12,
92665
+ closeSync as closeSync13,
92070
92666
  existsSync as existsSync30,
92071
92667
  mkdirSync as mkdirSync20,
92072
92668
  mkdtempSync,
92073
- openSync as openSync12,
92669
+ openSync as openSync13,
92074
92670
  rmSync as rmSync11,
92075
92671
  writeFileSync as writeFileSync16
92076
92672
  } from "fs";
@@ -92146,11 +92742,11 @@ function planMagmuxWrap(input) {
92146
92742
  const scriptPath = join44(scriptDir, "claude-launch.sh");
92147
92743
  const parentEnv = input.parentEnv ?? process.env;
92148
92744
  const deltas = envDeltas(parentEnv, input.childEnv);
92149
- const fd = openSync12(scriptPath, "wx", 384);
92745
+ const fd = openSync13(scriptPath, "wx", 384);
92150
92746
  try {
92151
92747
  writeFileSync16(fd, buildLauncherScript(input.claudeBinary, input.claudeArgs, deltas));
92152
92748
  } finally {
92153
- closeSync12(fd);
92749
+ closeSync13(fd);
92154
92750
  }
92155
92751
  const env = { ...input.childEnv };
92156
92752
  for (const k of STRIPPED_CHILD_VARS)
@@ -102363,7 +102959,8 @@ function claudeAdvisorModelFor(model) {
102363
102959
  }
102364
102960
  const tier = claudeCodeTierAlias(normalized);
102365
102961
  if (tier) {
102366
- const resolved = findEntryByAlias(tier)?.modelId ?? latestAnthropicTierModelId(tier);
102962
+ const notOptIn = (modelId) => !isOptInWireId(modelId);
102963
+ const resolved = findEntryByAlias(tier, notOptIn)?.modelId ?? latestAnthropicTierModelId(tier, notOptIn);
102367
102964
  if (resolved)
102368
102965
  return { refused: false, id: resolved };
102369
102966
  return {
@@ -102435,7 +103032,6 @@ class FallbackHandler {
102435
103032
  status: response.status,
102436
103033
  headers: response.headers,
102437
103034
  body: errorBody,
102438
- provider,
102439
103035
  name
102440
103036
  });
102441
103037
  switch (decision.reason) {
@@ -102450,7 +103046,7 @@ class FallbackHandler {
102450
103046
  logStderr(`[Fallback] ${name}: credential ${verdict === "terminal" ? "rejected" : "temporarily unavailable"} \u2014 stopping the chain here.`);
102451
103047
  }
102452
103048
  return response;
102453
- case "subscription-credential-rejected": {
103049
+ case "credential-rejected": {
102454
103050
  errors.push({ provider: name, status: response.status, message: errorBody });
102455
103051
  if (!firstRejection)
102456
103052
  firstRejection = { name, response, body: errorBody };
@@ -102470,7 +103066,8 @@ class FallbackHandler {
102470
103066
  errors.push({ provider: name, status: response.status, message: errorBody });
102471
103067
  if (!isLast) {
102472
103068
  if (hasQuotaExhaustionWording(errorBody)) {
102473
- logStderr(`[Fallback] ${name} subscription allowance is spent \u2014 falling through to the next provider, which is billed PER TOKEN. Use a provider prefix (e.g. \`zgo@model\`) to fail instead of switching.`);
103069
+ const next = this.candidates[(idx + 1) % this.candidates.length];
103070
+ announceSpentAllowance({ name, provider }, response.status, errorBody, next);
102474
103071
  } else {
102475
103072
  logStderr(`[Fallback] ${name} failed (HTTP ${response.status}), trying next provider...`);
102476
103073
  }
@@ -102537,6 +103134,14 @@ function announceCredentialRejection(rejected, status, errorBody, next) {
102537
103134
  announcedRejections.add(key);
102538
103135
  logStderr(line);
102539
103136
  }
103137
+ function announceSpentAllowance(spent, status, errorBody, next) {
103138
+ const upstreamStatus = (status === 400 ? extractUpstreamStatus(errorBody) : undefined) ?? status;
103139
+ const providerMessage = truncate3(parseProviderMessage(redactForClient(errorBody)).replace(/\s+/g, " ").trim(), 200);
103140
+ const shortcut = spent.provider ? getShortestPrefix(spent.provider) : "";
103141
+ const pin = shortcut ? ` Name the provider (${shortcut}@\u2026) to stop here instead of switching.` : "";
103142
+ const spentBilling = spent.provider && isSubscriptionProvider(spent.provider) ? "subscription" : "metered";
103143
+ logStderr(`[Fallback] ${spent.name} (${spentBilling}) has no allowance or balance left ` + `(${upstreamStatus}: ${providerMessage}) \u2014 moving to ${next.name} (${hopBillingWords(next.provider)}).${pin}`);
103144
+ }
102540
103145
  function exhaustedChainStatus(errors) {
102541
103146
  if (errors.length === 0)
102542
103147
  return 400;
@@ -102578,6 +103183,7 @@ function truncate3(s, max) {
102578
103183
  var announcedRejections;
102579
103184
  var init_fallback_handler = __esm(() => {
102580
103185
  init_logger();
103186
+ init_provider_definitions();
102581
103187
  init_redact();
102582
103188
  init_composed_handler();
102583
103189
  init_anthropic_error();
@@ -102897,7 +103503,7 @@ async function classifyHandler(handler, hop) {
102897
103503
  kind: "refused",
102898
103504
  handler,
102899
103505
  message: refusalMessageOf(body),
102900
- chainContinues: isRetryableError(response.status, body, hop.displayName, response.headers, hop.provider)
103506
+ chainContinues: isRetryableError(response.status, body, hop.displayName, response.headers)
102901
103507
  };
102902
103508
  }
102903
103509
  if (handler instanceof ComposedHandler) {
@@ -107205,9 +107811,9 @@ var init_seam_hooks = __esm(() => {
107205
107811
  });
107206
107812
 
107207
107813
  // src/hooks/seam-tap.ts
107208
- import { randomUUID as randomUUID7 } from "crypto";
107814
+ import { randomUUID as randomUUID6 } from "crypto";
107209
107815
  function newRequestId() {
107210
- return randomUUID7();
107816
+ return randomUUID6();
107211
107817
  }
107212
107818
 
107213
107819
  class EndLine {
@@ -110477,7 +111083,7 @@ var init_process_identity = __esm(() => {
110477
111083
 
110478
111084
  // src/pane/pane-launch.ts
110479
111085
  import { spawn } from "child_process";
110480
- import { randomBytes as randomBytes14 } from "crypto";
111086
+ import { randomBytes as randomBytes15 } from "crypto";
110481
111087
  import {
110482
111088
  chmodSync as chmodSync4,
110483
111089
  lstatSync as lstatSync7,
@@ -110538,7 +111144,7 @@ function ensureSockRoot(given = sockRootFor()) {
110538
111144
  }
110539
111145
  function mintPaneId(kind, label) {
110540
111146
  const head = `c${process.pid}-${OWNER_START36}-${kind}`;
110541
- const tail = `-${randomBytes14(3).toString("hex")}`;
111147
+ const tail = `-${randomBytes15(3).toString("hex")}`;
110542
111148
  const room = Math.max(0, 40 - head.length - tail.length);
110543
111149
  const clean = label.replace(/[^A-Za-z0-9_]/g, "").slice(0, room);
110544
111150
  const id = `${head}${clean}${tail}`;
@@ -111695,14 +112301,14 @@ var init_terminal_isolation = __esm(() => {
111695
112301
 
111696
112302
  // src/claude-runner.ts
111697
112303
  import { spawn as spawn2 } from "child_process";
111698
- import { randomUUID as randomUUID8 } from "crypto";
112304
+ import { randomUUID as randomUUID7 } from "crypto";
111699
112305
  import {
111700
112306
  chmodSync as chmodSync5,
111701
- closeSync as closeSync13,
112307
+ closeSync as closeSync14,
111702
112308
  existsSync as existsSync37,
111703
112309
  mkdirSync as mkdirSync26,
111704
112310
  mkdtempSync as mkdtempSync3,
111705
- openSync as openSync13,
112311
+ openSync as openSync14,
111706
112312
  readFileSync as readFileSync43,
111707
112313
  readdirSync as readdirSync9,
111708
112314
  rmSync as rmSync12,
@@ -113010,11 +113616,11 @@ Or set CLAUDE_PATH to your custom installation:`);
113010
113616
  const childWantsTty = config.interactive && !process.stdout.isTTY && Boolean(process.stdin.isTTY);
113011
113617
  if (childWantsTty) {
113012
113618
  try {
113013
- const fd = openSync13("/dev/fd/0", "r+");
113619
+ const fd = openSync14("/dev/fd/0", "r+");
113014
113620
  if (isatty(fd)) {
113015
113621
  ttyFd = fd;
113016
113622
  } else {
113017
- closeSync13(fd);
113623
+ closeSync14(fd);
113018
113624
  }
113019
113625
  } catch {
113020
113626
  ttyFd = undefined;
@@ -113033,7 +113639,7 @@ Or set CLAUDE_PATH to your custom installation:`);
113033
113639
  const sessionFlags = sessionFlagsOf(config.claudeArgs);
113034
113640
  let driverLaunch = null;
113035
113641
  if (surfaces.driver) {
113036
- const minted = sessionFlags.sessionId || sessionFlags.resumes ? null : randomUUID8();
113642
+ const minted = sessionFlags.sessionId || sessionFlags.resumes ? null : randomUUID7();
113037
113643
  const turnDir = mkdtempSync3(join53(tmpdir2(), "claudish-turns-"));
113038
113644
  chmodSync5(turnDir, 448);
113039
113645
  claudeArgs.unshift(...driverLeadingArgs({ mintedSessionId: minted, turnDir }));
@@ -113125,7 +113731,7 @@ Or set CLAUDE_PATH to your custom installation:`);
113125
113731
  const fdToClose = ttyFd;
113126
113732
  proc.on("spawn", () => {
113127
113733
  try {
113128
- closeSync13(fdToClose);
113734
+ closeSync14(fdToClose);
113129
113735
  } catch {}
113130
113736
  });
113131
113737
  }
@@ -113441,7 +114047,7 @@ var init_contract = __esm(() => {
113441
114047
  });
113442
114048
 
113443
114049
  // src/pane/reason-detail.ts
113444
- import { closeSync as closeSync14, fstatSync as fstatSync4, openSync as openSync14, readSync as readSync5 } from "fs";
114050
+ import { closeSync as closeSync15, fstatSync as fstatSync4, openSync as openSync15, readSync as readSync6 } from "fs";
113445
114051
  function reasonDetail(input, upstreamRecords = []) {
113446
114052
  if (!isTerminalState(input.state) || input.state === "COMPLETED")
113447
114053
  return null;
@@ -113522,11 +114128,11 @@ function isObject3(v) {
113522
114128
  function readTailLines(path, maxBytes) {
113523
114129
  let fd = null;
113524
114130
  try {
113525
- fd = openSync14(path, "r");
114131
+ fd = openSync15(path, "r");
113526
114132
  const size = fstatSync4(fd).size;
113527
114133
  const start = Math.max(0, size - maxBytes);
113528
114134
  const buf = Buffer.alloc(size - start);
113529
- readSync5(fd, buf, 0, buf.length, start);
114135
+ readSync6(fd, buf, 0, buf.length, start);
113530
114136
  const lines = buf.toString("utf-8").split(`
113531
114137
  `);
113532
114138
  if (start > 0)
@@ -113537,7 +114143,7 @@ function readTailLines(path, maxBytes) {
113537
114143
  } finally {
113538
114144
  if (fd !== null) {
113539
114145
  try {
113540
- closeSync14(fd);
114146
+ closeSync15(fd);
113541
114147
  } catch {}
113542
114148
  }
113543
114149
  }
@@ -114155,7 +114761,7 @@ var init_token_watch = __esm(() => {
114155
114761
  });
114156
114762
 
114157
114763
  // src/view/view-claims.ts
114158
- import { randomBytes as randomBytes15 } from "crypto";
114764
+ import { randomBytes as randomBytes16 } from "crypto";
114159
114765
  function ownerOf(caller) {
114160
114766
  return caller.kind === "mcp" ? "mcp" : caller.connId;
114161
114767
  }
@@ -114187,7 +114793,7 @@ class ViewClaims {
114187
114793
  const same = cur?.owner === by;
114188
114794
  const next = {
114189
114795
  ...who,
114190
- claimId: same && cur ? cur.claimId : randomBytes15(8).toString("hex"),
114796
+ claimId: same && cur ? cur.claimId : randomBytes16(8).toString("hex"),
114191
114797
  owner: by,
114192
114798
  since: same && cur ? cur.since : new Date(now).toISOString(),
114193
114799
  expiresAt: now + CLAUDE_CODE_CLAIM_TTL_MS
@@ -114278,14 +114884,14 @@ var init_view_claims = __esm(() => {
114278
114884
  });
114279
114885
 
114280
114886
  // src/team-orchestrator.ts
114281
- import { randomBytes as randomBytes16, randomUUID as randomUUID9 } from "crypto";
114887
+ import { randomBytes as randomBytes17, randomUUID as randomUUID8 } from "crypto";
114282
114888
  import {
114283
114889
  existsSync as existsSync39,
114284
114890
  lstatSync as lstatSync8,
114285
114891
  mkdirSync as mkdirSync27,
114286
114892
  readFileSync as readFileSync45,
114287
114893
  readdirSync as readdirSync11,
114288
- realpathSync as realpathSync6,
114894
+ realpathSync as realpathSync7,
114289
114895
  rmSync as rmSync14,
114290
114896
  statSync as statSync21,
114291
114897
  writeFileSync as writeFileSync22
@@ -114825,13 +115431,13 @@ function answerFailureDetail(v, answer, requirePattern, outcomes) {
114825
115431
  function readWrittenFile(path, root) {
114826
115432
  let realRoot;
114827
115433
  try {
114828
- realRoot = realpathSync6(root);
115434
+ realRoot = realpathSync7(root);
114829
115435
  } catch {
114830
115436
  realRoot = resolve7(root);
114831
115437
  }
114832
115438
  let real;
114833
115439
  try {
114834
- real = realpathSync6(resolve7(root, path));
115440
+ real = realpathSync7(resolve7(root, path));
114835
115441
  } catch {
114836
115442
  return { skip: "missing" };
114837
115443
  }
@@ -114903,11 +115509,11 @@ function validateSessionPath(sessionPath) {
114903
115509
  }
114904
115510
  let real;
114905
115511
  try {
114906
- real = join56(realpathSync6(existing), ...tail);
115512
+ real = join56(realpathSync7(existing), ...tail);
114907
115513
  } catch {
114908
115514
  throw outside();
114909
115515
  }
114910
- const cwd = realpathSync6(process.cwd());
115516
+ const cwd = realpathSync7(process.cwd());
114911
115517
  if (real !== cwd && !real.startsWith(cwd + sep)) {
114912
115518
  throw outside();
114913
115519
  }
@@ -115008,7 +115614,7 @@ async function preflightTeamRun(opts) {
115008
115614
  throw new Error(`pane_limit: ${live} live panes for this user, ${opts.slots} more would exceed ${MAX_LIVE_PANES}`);
115009
115615
  }
115010
115616
  function mintRunId(path, startMs) {
115011
- return `${basename6(path)}-${startMs.toString(36)}-${randomBytes16(3).toString("hex")}`;
115617
+ return `${basename6(path)}-${startMs.toString(36)}-${randomBytes17(3).toString("hex")}`;
115012
115618
  }
115013
115619
  function startModels(sessionPath, opts = {}) {
115014
115620
  const flight = { aborted: false };
@@ -115409,7 +116015,7 @@ async function startModelsIn(flight, sessionPath, opts) {
115409
116015
  stopReason: null
115410
116016
  };
115411
116017
  entries.set(id, e);
115412
- const uuid = randomUUID9();
116018
+ const uuid = randomUUID8();
115413
116019
  const transcriptPath = transcriptPathFor(cwd, uuid, projects);
115414
116020
  updateModelStatus(id, {
115415
116021
  state: "STARTING",
@@ -115968,16 +116574,16 @@ var init_scrollback_buffer = __esm(() => {
115968
116574
  });
115969
116575
 
115970
116576
  // src/mcp-session/session-manager.ts
115971
- import { randomUUID as randomUUID10 } from "crypto";
116577
+ import { randomUUID as randomUUID9 } from "crypto";
115972
116578
  import {
115973
116579
  appendFileSync as appendFileSync7,
115974
- closeSync as closeSync15,
116580
+ closeSync as closeSync16,
115975
116581
  createWriteStream,
115976
116582
  existsSync as existsSync41,
115977
116583
  mkdirSync as mkdirSync28,
115978
- openSync as openSync15,
116584
+ openSync as openSync16,
115979
116585
  readFileSync as readFileSync47,
115980
- readSync as readSync6,
116586
+ readSync as readSync7,
115981
116587
  renameSync as renameSync10,
115982
116588
  rmSync as rmSync15,
115983
116589
  statSync as statSync23,
@@ -116096,15 +116702,15 @@ function readTailText(path, maxBytes) {
116096
116702
  const start = Math.max(0, size - maxBytes);
116097
116703
  const length = size - start;
116098
116704
  const buf = Buffer.alloc(length);
116099
- fd = openSync15(path, "r");
116100
- readSync6(fd, buf, 0, length, start);
116705
+ fd = openSync16(path, "r");
116706
+ readSync7(fd, buf, 0, length, start);
116101
116707
  return { text: buf.toString("utf-8"), truncated: start > 0 };
116102
116708
  } catch {
116103
116709
  return null;
116104
116710
  } finally {
116105
116711
  if (fd !== null) {
116106
116712
  try {
116107
- closeSync15(fd);
116713
+ closeSync16(fd);
116108
116714
  } catch {}
116109
116715
  }
116110
116716
  }
@@ -116244,7 +116850,7 @@ class SessionManager {
116244
116850
  let id = "";
116245
116851
  let dir = "";
116246
116852
  for (let attempt = 0;; attempt++) {
116247
- id = `team-${randomUUID10().replace(/-/g, "").slice(0, 8)}`;
116853
+ id = `team-${randomUUID9().replace(/-/g, "").slice(0, 8)}`;
116248
116854
  dir = join58(this.sessionsDir, id);
116249
116855
  try {
116250
116856
  mkdirSync28(dir);
@@ -116371,8 +116977,8 @@ class SessionManager {
116371
116977
  }
116372
116978
  }
116373
116979
  recordSession(opts, inheritedLayer) {
116374
- const sessionId = opts.sessionId ?? randomUUID10().slice(0, 8);
116375
- const claudeSessionId = randomUUID10();
116980
+ const sessionId = opts.sessionId ?? randomUUID9().slice(0, 8);
116981
+ const claudeSessionId = randomUUID9();
116376
116982
  const timeout = normaliseTimeoutSeconds(opts.timeoutSeconds);
116377
116983
  const agentRequested = requestedAgentOf(opts.claudishFlags ?? []);
116378
116984
  const startedAt = new Date().toISOString();
@@ -117451,7 +118057,7 @@ var init_session_manager = __esm(() => {
117451
118057
  });
117452
118058
 
117453
118059
  // src/view/history.ts
117454
- import { closeSync as closeSync16, openSync as openSync16, readSync as readSync7, readdirSync as readdirSync12, statSync as statSync24 } from "fs";
118060
+ import { closeSync as closeSync17, openSync as openSync17, readSync as readSync8, readdirSync as readdirSync12, statSync as statSync24 } from "fs";
117455
118061
  import { join as join59 } from "path";
117456
118062
  function finishedDetail(promptSummary) {
117457
118063
  return {
@@ -117473,15 +118079,15 @@ function readJson(path) {
117473
118079
  function readHead(path, bytes) {
117474
118080
  let fd = null;
117475
118081
  try {
117476
- fd = openSync16(path, "r");
118082
+ fd = openSync17(path, "r");
117477
118083
  const buf = Buffer.alloc(bytes);
117478
- const n = readSync7(fd, buf, 0, bytes, 0);
118084
+ const n = readSync8(fd, buf, 0, bytes, 0);
117479
118085
  return buf.subarray(0, n).toString("utf8");
117480
118086
  } catch {
117481
118087
  return null;
117482
118088
  } finally {
117483
118089
  if (fd !== null)
117484
- closeSync16(fd);
118090
+ closeSync17(fd);
117485
118091
  }
117486
118092
  }
117487
118093
  function runDirs(sessionsDir) {
@@ -118699,7 +119305,7 @@ var init_pane_registry = __esm(() => {
118699
119305
  });
118700
119306
 
118701
119307
  // src/pane/gate-binding.ts
118702
- import { realpathSync as realpathSync7 } from "fs";
119308
+ import { realpathSync as realpathSync8 } from "fs";
118703
119309
  import { basename as basename8, dirname as dirname26, join as join62, resolve as resolve10 } from "path";
118704
119310
  function normaliseTranscriptPath(p) {
118705
119311
  const abs = resolve10(p);
@@ -118707,7 +119313,7 @@ function normaliseTranscriptPath(p) {
118707
119313
  let cur = abs;
118708
119314
  for (;; ) {
118709
119315
  try {
118710
- return tail.length ? join62(realpathSync7(cur), ...tail.reverse()) : realpathSync7(cur);
119316
+ return tail.length ? join62(realpathSync8(cur), ...tail.reverse()) : realpathSync8(cur);
118711
119317
  } catch {
118712
119318
  const parent = dirname26(cur);
118713
119319
  if (parent === cur)
@@ -119133,7 +119739,7 @@ var init_view_socket = __esm(() => {
119133
119739
  });
119134
119740
 
119135
119741
  // src/pane/pane-session.ts
119136
- import { readFileSync as readFileSync51, realpathSync as realpathSync8, rmSync as rmSync18, statSync as statSync25, writeFileSync as writeFileSync26 } from "fs";
119742
+ import { readFileSync as readFileSync51, realpathSync as realpathSync9, rmSync as rmSync18, statSync as statSync25, writeFileSync as writeFileSync26 } from "fs";
119137
119743
  import { join as join64 } from "path";
119138
119744
  function iso3(ms) {
119139
119745
  return new Date(ms).toISOString();
@@ -121728,7 +122334,7 @@ function preparePane(o, root, parentEnv) {
121728
122334
  try {
121729
122335
  const paneId = mintPaneId(o.kind, o.label);
121730
122336
  const sockPath = sockPathOf(root, paneId);
121731
- const cwd = realpathSync8(o.cwd);
122337
+ const cwd = realpathSync9(o.cwd);
121732
122338
  const launch = o.claudishSpawn ?? resolveClaudishLaunch(parentEnv);
121733
122339
  dirs = createLaunchDirs(root);
121734
122340
  const argv = buildClaudishPaneArgv(o.spawnModel, o.sessionUuid, dirs.turnDir, o.callerFlags, o.spawnPinned === true);
@@ -122900,14 +123506,14 @@ var init_transcript_redaction = __esm(() => {
122900
123506
  // src/pane/transcript-page.ts
122901
123507
  import {
122902
123508
  constants as constants5,
122903
- closeSync as closeSync17,
123509
+ closeSync as closeSync18,
122904
123510
  fstatSync as fstatSync5,
122905
123511
  lstatSync as lstatSync10,
122906
- openSync as openSync17,
122907
- readSync as readSync8,
123512
+ openSync as openSync18,
123513
+ readSync as readSync9,
122908
123514
  readdirSync as readdirSync15,
122909
123515
  readlinkSync,
122910
- realpathSync as realpathSync9,
123516
+ realpathSync as realpathSync10,
122911
123517
  statSync as statSync26
122912
123518
  } from "fs";
122913
123519
  import { basename as basename9, dirname as dirname27, join as join66, sep as sep3 } from "path";
@@ -122957,7 +123563,7 @@ class LineScanner {
122957
123563
  return null;
122958
123564
  const n = Math.min(READ_CHUNK, this.size - at);
122959
123565
  const b = Buffer.alloc(n);
122960
- const got = readSync8(this.fd, b, 0, n, at);
123566
+ const got = readSync9(this.fd, b, 0, n, at);
122961
123567
  if (got <= 0)
122962
123568
  return null;
122963
123569
  this.chunk = got < n ? b.subarray(0, got) : b;
@@ -122992,7 +123598,7 @@ function absentPage(from) {
122992
123598
  }
122993
123599
  function closeQuietly(fd) {
122994
123600
  try {
122995
- closeSync17(fd);
123601
+ closeSync18(fd);
122996
123602
  } catch {}
122997
123603
  }
122998
123604
  function readTranscriptPageFd(fd, from, limits) {
@@ -123005,7 +123611,7 @@ function readTranscriptPageFd(fd, from, limits) {
123005
123611
  throw new ContractErrorException("invalid_args", "'since' is past the end of the transcript");
123006
123612
  if (from.offset > 0) {
123007
123613
  const b = Buffer.alloc(1);
123008
- const got = readSync8(fd, b, 0, 1, from.offset - 1);
123614
+ const got = readSync9(fd, b, 0, 1, from.offset - 1);
123009
123615
  if (got !== 1 || b[0] !== 10)
123010
123616
  throw new ContractErrorException("invalid_args", "'since' is not at a line start");
123011
123617
  }
@@ -123122,8 +123728,8 @@ function openContainedTranscript(path, uuid, projectsRoot) {
123122
123728
  let real;
123123
123729
  let root;
123124
123730
  try {
123125
- real = realpathSync9(path);
123126
- root = realpathSync9(projectsRoot);
123731
+ real = realpathSync10(path);
123732
+ root = realpathSync10(projectsRoot);
123127
123733
  } catch (e) {
123128
123734
  if (!isEnoent(e))
123129
123735
  logRejection(path, errText(e));
@@ -123135,7 +123741,7 @@ function openContainedTranscript(path, uuid, projectsRoot) {
123135
123741
  }
123136
123742
  let fd;
123137
123743
  try {
123138
- fd = openSync17(real, OPEN_FLAGS);
123744
+ fd = openSync18(real, OPEN_FLAGS);
123139
123745
  } catch (e) {
123140
123746
  if (e?.code === "ELOOP")
123141
123747
  logRejection(path, "the transcript became a symlink");
@@ -123152,7 +123758,7 @@ function openContainedTranscript(path, uuid, projectsRoot) {
123152
123758
  }
123153
123759
  const parent = dirname27(real);
123154
123760
  const named = lstatSync10(real);
123155
- if (realpathSync9(parent) !== parent || !named.isFile() || named.dev !== st.dev || named.ino !== st.ino || !kernelPathMatches(fd, real)) {
123761
+ if (realpathSync10(parent) !== parent || !named.isFile() || named.dev !== st.dev || named.ino !== st.ino || !kernelPathMatches(fd, real)) {
123156
123762
  logRejection(path, "the opened file is not the one under the projects directory");
123157
123763
  closeQuietly(fd);
123158
123764
  return null;
@@ -123183,7 +123789,7 @@ function transcriptHeadCwd(path, uuid, projectsRoot) {
123183
123789
  let text;
123184
123790
  try {
123185
123791
  const buf = Buffer.alloc(HEAD_CWD_MAX_BYTES);
123186
- const n = readSync8(fd, buf, 0, HEAD_CWD_MAX_BYTES, 0);
123792
+ const n = readSync9(fd, buf, 0, HEAD_CWD_MAX_BYTES, 0);
123187
123793
  text = buf.toString("utf8", 0, n);
123188
123794
  } catch {
123189
123795
  return null;
@@ -123295,7 +123901,7 @@ var init_pane = __esm(() => {
123295
123901
  });
123296
123902
 
123297
123903
  // 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";
123904
+ import { constants as constants6, closeSync as closeSync19, fstatSync as fstatSync6, openSync as openSync19, statSync as statSync27, unlinkSync as unlinkSync13 } from "fs";
123299
123905
  function bindFlock() {
123300
123906
  const library = process.platform === "darwin" ? "libSystem.B.dylib" : process.platform === "linux" ? "libc.so.6" : null;
123301
123907
  if (!library)
@@ -123338,7 +123944,7 @@ function lockOf(fd, path) {
123338
123944
  return;
123339
123945
  open = false;
123340
123946
  try {
123341
- closeSync18(fd);
123947
+ closeSync19(fd);
123342
123948
  } catch {}
123343
123949
  }
123344
123950
  };
@@ -123348,10 +123954,10 @@ function tryAcquire(path) {
123348
123954
  if (!lib)
123349
123955
  throw new KernelLockUnavailable("flock is not available in this process");
123350
123956
  for (let attempt = 0;attempt < 5; attempt++) {
123351
- const fd = openSync18(path, constants6.O_RDWR | constants6.O_CREAT | O_CLOEXEC, 384);
123957
+ const fd = openSync19(path, constants6.O_RDWR | constants6.O_CREAT | O_CLOEXEC, 384);
123352
123958
  if (lib.flock(fd, LOCK_EX | LOCK_NB) !== 0) {
123353
123959
  const errno = lib.errno();
123354
- closeSync18(fd);
123960
+ closeSync19(fd);
123355
123961
  if (errno === EWOULDBLOCK)
123356
123962
  return null;
123357
123963
  throw new KernelLockUnavailable(`flock ${path}: errno ${errno}`);
@@ -123364,7 +123970,7 @@ function tryAcquire(path) {
123364
123970
  }
123365
123971
  if (same)
123366
123972
  return lockOf(fd, path);
123367
- closeSync18(fd);
123973
+ closeSync19(fd);
123368
123974
  }
123369
123975
  throw new KernelLockUnavailable(`flock ${path}: the file keeps being replaced`);
123370
123976
  }
@@ -123553,7 +124159,7 @@ var init_peer_link = __esm(() => {
123553
124159
  });
123554
124160
 
123555
124161
  // src/view/replay-registry.ts
123556
- import { randomBytes as randomBytes17 } from "crypto";
124162
+ import { randomBytes as randomBytes18 } from "crypto";
123557
124163
  import { readFileSync as readFileSync52, readdirSync as readdirSync16, renameSync as renameSync13, rmSync as rmSync20, writeFileSync as writeFileSync28 } from "fs";
123558
124164
  import { join as join67 } from "path";
123559
124165
  function parseEntry(raw) {
@@ -123626,7 +124232,7 @@ class ReplayRegistry {
123626
124232
  }
123627
124233
  writeLocked(uuid, entry) {
123628
124234
  const path = this.entryPathOf(uuid);
123629
- const tmp = `${path}.${randomBytes17(4).toString("hex")}.tmp`;
124235
+ const tmp = `${path}.${randomBytes18(4).toString("hex")}.tmp`;
123630
124236
  writeFileSync28(tmp, `${JSON.stringify(entry)}
123631
124237
  `, { mode: 384, flag: "wx" });
123632
124238
  try {
@@ -123718,8 +124324,8 @@ var init_replay_registry = __esm(() => {
123718
124324
  });
123719
124325
 
123720
124326
  // 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";
124327
+ import { randomBytes as randomBytes19, randomUUID as randomUUID10 } from "crypto";
124328
+ import { constants as constants7, accessSync as accessSync3, closeSync as closeSync20, existsSync as existsSync43, realpathSync as realpathSync11, statSync as statSync28 } from "fs";
123723
124329
  import { dirname as dirname28, resolve as resolve11 } from "path";
123724
124330
  function unavailable2(reason, message) {
123725
124331
  return new ContractErrorException("replay_unavailable", message, reason);
@@ -123734,10 +124340,10 @@ function replayCwd(own) {
123734
124340
  if (own) {
123735
124341
  try {
123736
124342
  if (statSync28(own).isDirectory())
123737
- return realpathSync10(own);
124343
+ return realpathSync11(own);
123738
124344
  } catch {}
123739
124345
  }
123740
- return realpathSync10(process.cwd());
124346
+ return realpathSync11(process.cwd());
123741
124347
  }
123742
124348
  async function replayClaudeBinary(env) {
123743
124349
  const named = env.CLAUDE_PATH ? resolve11(env.CLAUDE_PATH) : "";
@@ -124038,11 +124644,11 @@ class ReplayManager {
124038
124644
  return entry;
124039
124645
  }
124040
124646
  mintReplayId() {
124041
- return `replay-${randomBytes18(8).toString("hex")}`;
124647
+ return `replay-${randomBytes19(8).toString("hex")}`;
124042
124648
  }
124043
124649
  async spawn(slot, target, size, opener, lock, replayId, paneId) {
124044
124650
  const uuid = slot.uuid;
124045
- const forkUuid = randomUUID11();
124651
+ const forkUuid = randomUUID10();
124046
124652
  const cwd = replayCwd(target.cwd);
124047
124653
  const projectsRoot = resolve11(target.projectsRoot);
124048
124654
  const forkPath = transcriptPathFor(cwd, forkUuid, projectsRoot);
@@ -124374,7 +124980,7 @@ class ReplayManager {
124374
124980
  const fd = openContainedTranscript(path, uuid, target.projectsRoot);
124375
124981
  if (fd === null)
124376
124982
  throw noRecord("the session's Claude Code record is gone");
124377
- closeSync19(fd);
124983
+ closeSync20(fd);
124378
124984
  return uuid;
124379
124985
  }
124380
124986
  itemOf(e) {
@@ -132842,7 +133448,7 @@ __export(exports_subscription_probe_command, {
132842
133448
  runProbeWith: () => runProbeWith,
132843
133449
  subscriptionProbeCommand: () => subscriptionProbeCommand
132844
133450
  });
132845
- import { randomUUID as randomUUID12 } from "crypto";
133451
+ import { randomUUID as randomUUID11 } from "crypto";
132846
133452
  function probeExitCodeFor(failure) {
132847
133453
  if (failure.class === "internal") {
132848
133454
  return CALLER_CODES.includes(failure.code) ? PROBE_EXIT.usage : PROBE_EXIT.internal;
@@ -132985,13 +133591,13 @@ async function runProbeWith(deps, facts, secrets, requestFileMessage, determine)
132985
133591
  }
132986
133592
  return result.exitCode;
132987
133593
  }
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}}`;
133594
+ function firstRequestId() {
133595
+ return `agent/${randomUUID11()}/${Date.now()}/${randomUUID11()}/1`;
132992
133596
  }
132993
- function createActivityRequestId3() {
132994
- return Math.random().toString(36).substring(7);
133597
+ function buildProbeEnvelopeBody(model, projectId, requestText, requestId = firstRequestId()) {
133598
+ const head = JSON.stringify({ project: projectId, requestId });
133599
+ const tail = JSON.stringify({ model, userAgent: "antigravity", requestType: "agent" });
133600
+ return `${head.slice(0, -1)},"request":${requestText},${tail.slice(1)}`;
132995
133601
  }
132996
133602
  async function determineAntigravity2(deps, secrets, facts, args) {
132997
133603
  const request = await readRequestFileChecked(deps.readRequestFile, args.requestFile);
@@ -133011,15 +133617,14 @@ async function determineAntigravity2(deps, secrets, facts, args) {
133011
133617
  try {
133012
133618
  let res;
133013
133619
  try {
133014
- res = await fetch(url, {
133620
+ res = await antigravityFetch(url, {
133015
133621
  method: "POST",
133016
133622
  headers: {
133017
133623
  Authorization: `Bearer ${session.accessToken}`,
133018
133624
  "Content-Type": "application/json",
133019
- "User-Agent": antigravityUserAgentFor(version.version),
133020
- "x-activity-request-id": createActivityRequestId3()
133625
+ "User-Agent": antigravityUserAgentFor(version.version)
133021
133626
  },
133022
- body: buildProbeEnvelopeBody(args.model, session.projectId, session.tierId, request.text),
133627
+ body: buildProbeEnvelopeBody(args.model, session.projectId, request.text),
133023
133628
  signal: controller.signal,
133024
133629
  redirect: "manual"
133025
133630
  });
@@ -133084,6 +133689,7 @@ var PROBE_FAILURE_CODES, PROBE_EXIT, CALLER_CODES, SUBSCRIPTION_PROBE_USAGE = "u
133084
133689
  var init_subscription_probe_command = __esm(() => {
133085
133690
  init_antigravity_token();
133086
133691
  init_antigravity_user();
133692
+ init_antigravity_fetch();
133087
133693
  init_subscription_antigravity_session();
133088
133694
  init_subscription_dispatch();
133089
133695
  init_subscription_secret_guard();
@@ -143090,7 +143696,7 @@ var init_advisor_startup = __esm(() => {
143090
143696
  });
143091
143697
 
143092
143698
  // src/session/conversation.ts
143093
- import { closeSync as closeSync20, openSync as openSync19, readSync as readSync9, statSync as statSync31 } from "fs";
143699
+ import { closeSync as closeSync21, openSync as openSync20, readSync as readSync10, statSync as statSync31 } from "fs";
143094
143700
  import { StringDecoder } from "string_decoder";
143095
143701
  function looksLikeTurn(line) {
143096
143702
  const assistant = line.includes('"type":"assistant"');
@@ -143146,7 +143752,7 @@ function readConversation(file, opts = {}) {
143146
143752
  let fd = null;
143147
143753
  try {
143148
143754
  const size = statSync31(file).size;
143149
- fd = openSync19(file, "r");
143755
+ fd = openSync20(file, "r");
143150
143756
  const buf = Buffer.allocUnsafe(chunkBytes);
143151
143757
  const decoder = new StringDecoder("utf-8");
143152
143758
  let pending = "";
@@ -143178,7 +143784,7 @@ function readConversation(file, opts = {}) {
143178
143784
  take({ role: raw.role, text, elided });
143179
143785
  };
143180
143786
  while (pos < size) {
143181
- const n = readSync9(fd, buf, 0, Math.min(chunkBytes, size - pos), pos);
143787
+ const n = readSync10(fd, buf, 0, Math.min(chunkBytes, size - pos), pos);
143182
143788
  if (n <= 0)
143183
143789
  break;
143184
143790
  pos += n;
@@ -143202,7 +143808,7 @@ function readConversation(file, opts = {}) {
143202
143808
  } catch {} finally {
143203
143809
  if (fd !== null) {
143204
143810
  try {
143205
- closeSync20(fd);
143811
+ closeSync21(fd);
143206
143812
  } catch {}
143207
143813
  }
143208
143814
  }
@@ -144780,15 +145386,15 @@ var MODEL_SETTING_LEDGER_FILE = "model-setting-restore.json";
144780
145386
  var init_model_setting_ledger_path = () => {};
144781
145387
 
144782
145388
  // src/launcher/model-setting-restore.ts
144783
- import { randomUUID as randomUUID13 } from "crypto";
145389
+ import { randomUUID as randomUUID12 } from "crypto";
144784
145390
  import {
144785
- closeSync as closeSync21,
145391
+ closeSync as closeSync22,
144786
145392
  fchmodSync as fchmodSync2,
144787
145393
  fsyncSync as fsyncSync4,
144788
- openSync as openSync20,
145394
+ openSync as openSync21,
144789
145395
  readFileSync as readFileSync59,
144790
145396
  readdirSync as readdirSync20,
144791
- realpathSync as realpathSync11,
145397
+ realpathSync as realpathSync12,
144792
145398
  renameSync as renameSync15,
144793
145399
  rmSync as rmSync22,
144794
145400
  statSync as statSync32,
@@ -144802,7 +145408,7 @@ function canonicalSettingsPath(path) {
144802
145408
  const rest = [];
144803
145409
  for (;; ) {
144804
145410
  try {
144805
- return join78(realpathSync11.native(head), ...rest);
145411
+ return join78(realpathSync12.native(head), ...rest);
144806
145412
  } catch {
144807
145413
  const parent = dirname31(head);
144808
145414
  if (parent === head)
@@ -144902,7 +145508,7 @@ function restoreRound(settingsKey, target, entry, deps, fence) {
144902
145508
  const planned = nextSettingsText(text, entry);
144903
145509
  if ("outcome" in planned)
144904
145510
  return planned.outcome;
144905
- const temp = join78(dirname31(target), `${TEMP_PREFIX}${deps.pid ?? process.pid}-${randomUUID13()}`);
145511
+ const temp = join78(dirname31(target), `${TEMP_PREFIX}${deps.pid ?? process.pid}-${randomUUID12()}`);
144906
145512
  try {
144907
145513
  deps.writeNew(temp, planned.next, statA.mode & 4095);
144908
145514
  } catch {
@@ -145194,7 +145800,7 @@ async function beginModelSettingWatch(listedSpecs, deps = {}) {
145194
145800
  heartbeatMs: LOCK_HEARTBEAT_MS,
145195
145801
  onUnavailable: "fail"
145196
145802
  };
145197
- const sessionId = randomUUID13();
145803
+ const sessionId = randomUUID12();
145198
145804
  const launcherPid = deps.pid ?? process.pid;
145199
145805
  const noRestore = "so claudish will not put back your Claude Code default model after this session";
145200
145806
  let registered = false;
@@ -145348,17 +145954,17 @@ var init_model_setting_restore = __esm(() => {
145348
145954
  init_model_setting_ledger_path();
145349
145955
  GIVE_UP_AFTER_MS = 14 * 24 * 60 * 60 * 1000;
145350
145956
  realRestoreFs = {
145351
- realpath: (path) => realpathSync11.native(path),
145957
+ realpath: (path) => realpathSync12.native(path),
145352
145958
  readFile: (path) => readFileSync59(path),
145353
145959
  stat: (path) => toFileStat(statSync32(path)),
145354
145960
  writeNew: (path, data, mode) => {
145355
- const fd = openSync20(path, "wx", mode);
145961
+ const fd = openSync21(path, "wx", mode);
145356
145962
  try {
145357
145963
  fchmodSync2(fd, mode);
145358
145964
  writeWholeSync(fd, data);
145359
145965
  fsyncSync4(fd);
145360
145966
  } finally {
145361
- closeSync21(fd);
145967
+ closeSync22(fd);
145362
145968
  }
145363
145969
  },
145364
145970
  rename: (from, to) => renameSync15(from, to),