claude-use 11.12.0 → 11.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.cjs CHANGED
@@ -318,10 +318,10 @@ function mergeDefs(...defs) {
318
318
  function cloneDef(schema) {
319
319
  return mergeDefs(schema._zod.def);
320
320
  }
321
- function getElementAtPath(obj, path59) {
322
- if (!path59)
321
+ function getElementAtPath(obj, path61) {
322
+ if (!path61)
323
323
  return obj;
324
- return path59.reduce((acc, key) => acc?.[key], obj);
324
+ return path61.reduce((acc, key) => acc?.[key], obj);
325
325
  }
326
326
  function promiseAllObject(promisesObj) {
327
327
  const keys = Object.keys(promisesObj);
@@ -580,11 +580,11 @@ function explicitlyAborted(x, startIndex = 0) {
580
580
  }
581
581
  return false;
582
582
  }
583
- function prefixIssues(path59, issues) {
583
+ function prefixIssues(path61, issues) {
584
584
  return issues.map((iss) => {
585
585
  var _a4;
586
586
  (_a4 = iss).path ?? (_a4.path = []);
587
- iss.path.unshift(path59);
587
+ iss.path.unshift(path61);
588
588
  return iss;
589
589
  });
590
590
  }
@@ -1105,16 +1105,16 @@ function flattenError(error63, mapper = (issue2) => issue2.message) {
1105
1105
  }
1106
1106
  function formatError(error63, mapper = (issue2) => issue2.message) {
1107
1107
  const fieldErrors = { _errors: [] };
1108
- const processError = (error64, path59 = []) => {
1108
+ const processError = (error64, path61 = []) => {
1109
1109
  for (const issue2 of error64.issues) {
1110
1110
  if (issue2.code === "invalid_union" && issue2.errors.length) {
1111
- issue2.errors.map((issues) => processError({ issues }, [...path59, ...issue2.path]));
1111
+ issue2.errors.map((issues) => processError({ issues }, [...path61, ...issue2.path]));
1112
1112
  } else if (issue2.code === "invalid_key") {
1113
- processError({ issues: issue2.issues }, [...path59, ...issue2.path]);
1113
+ processError({ issues: issue2.issues }, [...path61, ...issue2.path]);
1114
1114
  } else if (issue2.code === "invalid_element") {
1115
- processError({ issues: issue2.issues }, [...path59, ...issue2.path]);
1115
+ processError({ issues: issue2.issues }, [...path61, ...issue2.path]);
1116
1116
  } else {
1117
- const fullpath = [...path59, ...issue2.path];
1117
+ const fullpath = [...path61, ...issue2.path];
1118
1118
  if (fullpath.length === 0) {
1119
1119
  fieldErrors._errors.push(mapper(issue2));
1120
1120
  } else {
@@ -1153,17 +1153,17 @@ function formatError(error63, mapper = (issue2) => issue2.message) {
1153
1153
  }
1154
1154
  function treeifyError(error63, mapper = (issue2) => issue2.message) {
1155
1155
  const result = { errors: [] };
1156
- const processError = (error64, path59 = []) => {
1156
+ const processError = (error64, path61 = []) => {
1157
1157
  var _a4;
1158
1158
  for (const issue2 of error64.issues) {
1159
1159
  if (issue2.code === "invalid_union" && issue2.errors.length) {
1160
- issue2.errors.map((issues) => processError({ issues }, [...path59, ...issue2.path]));
1160
+ issue2.errors.map((issues) => processError({ issues }, [...path61, ...issue2.path]));
1161
1161
  } else if (issue2.code === "invalid_key") {
1162
- processError({ issues: issue2.issues }, [...path59, ...issue2.path]);
1162
+ processError({ issues: issue2.issues }, [...path61, ...issue2.path]);
1163
1163
  } else if (issue2.code === "invalid_element") {
1164
- processError({ issues: issue2.issues }, [...path59, ...issue2.path]);
1164
+ processError({ issues: issue2.issues }, [...path61, ...issue2.path]);
1165
1165
  } else {
1166
- const fullpath = [...path59, ...issue2.path];
1166
+ const fullpath = [...path61, ...issue2.path];
1167
1167
  if (fullpath.length === 0) {
1168
1168
  result.errors.push(mapper(issue2));
1169
1169
  continue;
@@ -1202,8 +1202,8 @@ function treeifyError(error63, mapper = (issue2) => issue2.message) {
1202
1202
  }
1203
1203
  function toDotPath(_path) {
1204
1204
  const segs = [];
1205
- const path59 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1206
- for (const seg of path59) {
1205
+ const path61 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1206
+ for (const seg of path61) {
1207
1207
  if (typeof seg === "number")
1208
1208
  segs.push(`[${seg}]`);
1209
1209
  else if (typeof seg === "symbol")
@@ -3494,7 +3494,7 @@ var init_schemas = __esm({
3494
3494
  }
3495
3495
  return propValues;
3496
3496
  });
3497
- const isObject4 = isObject;
3497
+ const isObject5 = isObject;
3498
3498
  const catchall = def.catchall;
3499
3499
  let value2;
3500
3500
  const memo2 = globalConfig.memoizer;
@@ -3502,7 +3502,7 @@ var init_schemas = __esm({
3502
3502
  inst._zod.parse = (payload, ctx) => {
3503
3503
  value2 ?? (value2 = _normalized.value);
3504
3504
  const input2 = payload.value;
3505
- if (!isObject4(input2)) {
3505
+ if (!isObject5(input2)) {
3506
3506
  payload.issues.push({
3507
3507
  expected: "object",
3508
3508
  code: "invalid_type",
@@ -3638,7 +3638,7 @@ var init_schemas = __esm({
3638
3638
  return doc.compile();
3639
3639
  };
3640
3640
  let fastpass;
3641
- const isObject4 = isObject;
3641
+ const isObject5 = isObject;
3642
3642
  const jit = !globalConfig.jitless;
3643
3643
  const allowsEval2 = allowsEval;
3644
3644
  const fastEnabled = jit && allowsEval2.value;
@@ -3647,7 +3647,7 @@ var init_schemas = __esm({
3647
3647
  inst._zod.parse = (payload, ctx) => {
3648
3648
  value2 ?? (value2 = _normalized.value);
3649
3649
  const input2 = payload.value;
3650
- if (!isObject4(input2)) {
3650
+ if (!isObject5(input2)) {
3651
3651
  payload.issues.push({
3652
3652
  expected: "object",
3653
3653
  code: "invalid_type",
@@ -19199,13 +19199,13 @@ function resolveRef(ref, ctx) {
19199
19199
  if (!ref.startsWith("#")) {
19200
19200
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
19201
19201
  }
19202
- const path59 = ref.slice(1).split("/").filter(Boolean);
19203
- if (path59.length === 0) {
19202
+ const path61 = ref.slice(1).split("/").filter(Boolean);
19203
+ if (path61.length === 0) {
19204
19204
  return ctx.rootSchema;
19205
19205
  }
19206
19206
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
19207
- if (path59[0] === defsKey) {
19208
- const key = path59[1] === void 0 ? void 0 : decodeJSONPointerSegment(path59[1]);
19207
+ if (path61[0] === defsKey) {
19208
+ const key = path61[1] === void 0 ? void 0 : decodeJSONPointerSegment(path61[1]);
19209
19209
  if (!key || !ctx.defs[key]) {
19210
19210
  throw new Error(`Reference not found: ${ref}`);
19211
19211
  }
@@ -20505,7 +20505,7 @@ var require_common = __commonJS({
20505
20505
  function isNothing(subject) {
20506
20506
  return typeof subject === "undefined" || subject === null;
20507
20507
  }
20508
- function isObject4(subject) {
20508
+ function isObject5(subject) {
20509
20509
  return typeof subject === "object" && subject !== null;
20510
20510
  }
20511
20511
  function toArray2(sequence2) {
@@ -20534,7 +20534,7 @@ var require_common = __commonJS({
20534
20534
  return number4 === 0 && Number.NEGATIVE_INFINITY === 1 / number4;
20535
20535
  }
20536
20536
  module2.exports.isNothing = isNothing;
20537
- module2.exports.isObject = isObject4;
20537
+ module2.exports.isObject = isObject5;
20538
20538
  module2.exports.toArray = toArray2;
20539
20539
  module2.exports.repeat = repeat;
20540
20540
  module2.exports.isNegativeZero = isNegativeZero;
@@ -23712,42 +23712,42 @@ var require_defaults = __commonJS({
23712
23712
  var require_env_paths = __commonJS({
23713
23713
  "node_modules/.pnpm/env-paths@2.2.1/node_modules/env-paths/index.js"(exports2, module2) {
23714
23714
  "use strict";
23715
- var path59 = require("path");
23716
- var os12 = require("os");
23717
- var homedir = os12.homedir();
23718
- var tmpdir = os12.tmpdir();
23715
+ var path61 = require("path");
23716
+ var os13 = require("os");
23717
+ var homedir = os13.homedir();
23718
+ var tmpdir = os13.tmpdir();
23719
23719
  var { env } = process;
23720
23720
  var macos = (name) => {
23721
- const library = path59.join(homedir, "Library");
23721
+ const library = path61.join(homedir, "Library");
23722
23722
  return {
23723
- data: path59.join(library, "Application Support", name),
23724
- config: path59.join(library, "Preferences", name),
23725
- cache: path59.join(library, "Caches", name),
23726
- log: path59.join(library, "Logs", name),
23727
- temp: path59.join(tmpdir, name)
23723
+ data: path61.join(library, "Application Support", name),
23724
+ config: path61.join(library, "Preferences", name),
23725
+ cache: path61.join(library, "Caches", name),
23726
+ log: path61.join(library, "Logs", name),
23727
+ temp: path61.join(tmpdir, name)
23728
23728
  };
23729
23729
  };
23730
23730
  var windows = (name) => {
23731
- const appData = env.APPDATA || path59.join(homedir, "AppData", "Roaming");
23732
- const localAppData = env.LOCALAPPDATA || path59.join(homedir, "AppData", "Local");
23731
+ const appData = env.APPDATA || path61.join(homedir, "AppData", "Roaming");
23732
+ const localAppData = env.LOCALAPPDATA || path61.join(homedir, "AppData", "Local");
23733
23733
  return {
23734
23734
  // Data/config/cache/log are invented by me as Windows isn't opinionated about this
23735
- data: path59.join(localAppData, name, "Data"),
23736
- config: path59.join(appData, name, "Config"),
23737
- cache: path59.join(localAppData, name, "Cache"),
23738
- log: path59.join(localAppData, name, "Log"),
23739
- temp: path59.join(tmpdir, name)
23735
+ data: path61.join(localAppData, name, "Data"),
23736
+ config: path61.join(appData, name, "Config"),
23737
+ cache: path61.join(localAppData, name, "Cache"),
23738
+ log: path61.join(localAppData, name, "Log"),
23739
+ temp: path61.join(tmpdir, name)
23740
23740
  };
23741
23741
  };
23742
23742
  var linux = (name) => {
23743
- const username = path59.basename(homedir);
23743
+ const username = path61.basename(homedir);
23744
23744
  return {
23745
- data: path59.join(env.XDG_DATA_HOME || path59.join(homedir, ".local", "share"), name),
23746
- config: path59.join(env.XDG_CONFIG_HOME || path59.join(homedir, ".config"), name),
23747
- cache: path59.join(env.XDG_CACHE_HOME || path59.join(homedir, ".cache"), name),
23745
+ data: path61.join(env.XDG_DATA_HOME || path61.join(homedir, ".local", "share"), name),
23746
+ config: path61.join(env.XDG_CONFIG_HOME || path61.join(homedir, ".config"), name),
23747
+ cache: path61.join(env.XDG_CACHE_HOME || path61.join(homedir, ".cache"), name),
23748
23748
  // https://wiki.debian.org/XDGBaseDirectorySpecification#state
23749
- log: path59.join(env.XDG_STATE_HOME || path59.join(homedir, ".local", "state"), name),
23750
- temp: path59.join(tmpdir, username, name)
23749
+ log: path61.join(env.XDG_STATE_HOME || path61.join(homedir, ".local", "state"), name),
23750
+ temp: path61.join(tmpdir, username, name)
23751
23751
  };
23752
23752
  };
23753
23753
  var envPaths = (name, options) => {
@@ -23815,11 +23815,11 @@ var require_util = __commonJS({
23815
23815
  return result;
23816
23816
  }
23817
23817
  exports2.emplace = emplace;
23818
- function getPropertyByPath(source, path59) {
23819
- if (typeof path59 === "string" && Object.prototype.hasOwnProperty.call(source, path59)) {
23820
- return source[path59];
23818
+ function getPropertyByPath(source, path61) {
23819
+ if (typeof path61 === "string" && Object.prototype.hasOwnProperty.call(source, path61)) {
23820
+ return source[path61];
23821
23821
  }
23822
- const parsedPath = typeof path59 === "string" ? path59.split(".") : path59;
23822
+ const parsedPath = typeof path61 === "string" ? path61.split(".") : path61;
23823
23823
  return parsedPath.reduce((previous, key) => {
23824
23824
  if (previous === void 0) {
23825
23825
  return previous;
@@ -23842,9 +23842,9 @@ var require_util = __commonJS({
23842
23842
  return Object.fromEntries(Object.entries(options).filter(([, value2]) => value2 !== void 0));
23843
23843
  }
23844
23844
  exports2.removeUndefinedValuesFromObject = removeUndefinedValuesFromObject;
23845
- async function isDirectory(path59) {
23845
+ async function isDirectory(path61) {
23846
23846
  try {
23847
- const stat = await fs_1.promises.stat(path59);
23847
+ const stat = await fs_1.promises.stat(path61);
23848
23848
  return stat.isDirectory();
23849
23849
  } catch (e14) {
23850
23850
  if (e14.code === "ENOENT") {
@@ -23854,9 +23854,9 @@ var require_util = __commonJS({
23854
23854
  }
23855
23855
  }
23856
23856
  exports2.isDirectory = isDirectory;
23857
- function isDirectorySync(path59) {
23857
+ function isDirectorySync(path61) {
23858
23858
  try {
23859
- const stat = fs_1.default.statSync(path59);
23859
+ const stat = fs_1.default.statSync(path61);
23860
23860
  return stat.isDirectory();
23861
23861
  } catch (e14) {
23862
23862
  if (e14.code === "ENOENT") {
@@ -23954,7 +23954,7 @@ var require_ExplorerBase = __commonJS({
23954
23954
  const idx = importStack.indexOf(fullPath);
23955
23955
  if (idx !== -1) {
23956
23956
  throw new Error(`Circular import detected:
23957
- ${[...importStack, fullPath].map((path59, i10) => `${i10 + 1}. ${path59}`).join("\n")} (same as ${idx + 1}.)`);
23957
+ ${[...importStack, fullPath].map((path61, i10) => `${i10 + 1}. ${path61}`).join("\n")} (same as ${idx + 1}.)`);
23958
23958
  }
23959
23959
  }
23960
23960
  }
@@ -24142,9 +24142,9 @@ var require_Explorer = __commonJS({
24142
24142
  throw error63;
24143
24143
  }
24144
24144
  }
24145
- async #fileExists(path59) {
24145
+ async #fileExists(path61) {
24146
24146
  try {
24147
- await promises_1.default.stat(path59);
24147
+ await promises_1.default.stat(path61);
24148
24148
  return true;
24149
24149
  } catch (e14) {
24150
24150
  return false;
@@ -24304,9 +24304,9 @@ var require_ExplorerSync = __commonJS({
24304
24304
  throw error63;
24305
24305
  }
24306
24306
  }
24307
- #fileExists(path59) {
24307
+ #fileExists(path61) {
24308
24308
  try {
24309
- fs_1.default.statSync(path59);
24309
+ fs_1.default.statSync(path61);
24310
24310
  return true;
24311
24311
  } catch (e14) {
24312
24312
  return false;
@@ -24430,7 +24430,7 @@ var require_dist = __commonJS({
24430
24430
  };
24431
24431
  }
24432
24432
  function getResolvedSearchPlaces(moduleName, toolDefinedSearchPlaces, userConfiguredOptions) {
24433
- const userConfiguredSearchPlaces = userConfiguredOptions.searchPlaces?.map((path59) => path59.replace("{name}", moduleName));
24433
+ const userConfiguredSearchPlaces = userConfiguredOptions.searchPlaces?.map((path61) => path61.replace("{name}", moduleName));
24434
24434
  if (userConfiguredOptions.mergeSearchPlaces) {
24435
24435
  return [...userConfiguredSearchPlaces ?? [], ...toolDefinedSearchPlaces];
24436
24436
  }
@@ -29683,8 +29683,8 @@ var require_utils = __commonJS({
29683
29683
  }
29684
29684
  return output2;
29685
29685
  };
29686
- exports2.basename = (path59, { windows } = {}) => {
29687
- const segs = path59.split(windows ? /[\\/]/ : "/");
29686
+ exports2.basename = (path61, { windows } = {}) => {
29687
+ const segs = path61.split(windows ? /[\\/]/ : "/");
29688
29688
  const last = segs[segs.length - 1];
29689
29689
  if (last === "") {
29690
29690
  return segs[segs.length - 2];
@@ -31055,7 +31055,7 @@ var require_picomatch = __commonJS({
31055
31055
  var parse4 = require_parse();
31056
31056
  var utils = require_utils();
31057
31057
  var constants2 = require_constants();
31058
- var isObject4 = (val) => val && typeof val === "object" && !Array.isArray(val);
31058
+ var isObject5 = (val) => val && typeof val === "object" && !Array.isArray(val);
31059
31059
  var picomatch3 = (glob, options, returnState = false) => {
31060
31060
  if (Array.isArray(glob)) {
31061
31061
  const fns = glob.map((input2) => picomatch3(input2, options, returnState));
@@ -31068,7 +31068,7 @@ var require_picomatch = __commonJS({
31068
31068
  };
31069
31069
  return arrayMatcher;
31070
31070
  }
31071
- const isState = isObject4(glob) && glob.tokens && glob.input;
31071
+ const isState = isObject5(glob) && glob.tokens && glob.input;
31072
31072
  if (glob === "" || typeof glob !== "string" && !isState) {
31073
31073
  throw new TypeError("Expected pattern to be a non-empty string");
31074
31074
  }
@@ -34093,7 +34093,7 @@ var init_package = __esm({
34093
34093
  "package.json"() {
34094
34094
  package_default = {
34095
34095
  name: "claude-use",
34096
- version: "11.12.0",
34096
+ version: "11.14.0",
34097
34097
  description: "A profile manager and launcher for Claude Code that lets one person run multiple logins from one machine while controlling what gets shared between them.",
34098
34098
  license: "MIT",
34099
34099
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -34210,7 +34210,9 @@ function readAccountMetadata(fs24, identitiesDir, identity) {
34210
34210
  if (!isIdentityName(identity)) {
34211
34211
  throw new Error(`"${identity}" is not a valid identity name.`);
34212
34212
  }
34213
- const file2 = claudeJsonPath(identitiesDir, identity);
34213
+ return readAccountMetadataFile(fs24, claudeJsonPath(identitiesDir, identity));
34214
+ }
34215
+ function readAccountMetadataFile(fs24, file2) {
34214
34216
  const raw = fs24.readFileUtf8(file2);
34215
34217
  if (raw === void 0) {
34216
34218
  return void 0;
@@ -34364,11 +34366,11 @@ function identifyRequest(headers) {
34364
34366
  function directOrigin2(port) {
34365
34367
  return `http://127.0.0.1:${String(port)}`;
34366
34368
  }
34367
- function parseProviderPath(path59) {
34368
- if (!path59.startsWith(PROVIDER_PATH_PREFIX)) {
34369
+ function parseProviderPath(path61) {
34370
+ if (!path61.startsWith(PROVIDER_PATH_PREFIX)) {
34369
34371
  return void 0;
34370
34372
  }
34371
- const tail = path59.slice(PROVIDER_PATH_PREFIX.length);
34373
+ const tail = path61.slice(PROVIDER_PATH_PREFIX.length);
34372
34374
  const slash = tail.indexOf("/");
34373
34375
  if (slash <= 0) {
34374
34376
  return void 0;
@@ -34695,12 +34697,12 @@ function decoderFor(encoding) {
34695
34697
  return void 0;
34696
34698
  }
34697
34699
  }
34698
- function destinationOf(path59, sessionProvider) {
34699
- const scoped = parseProviderPath(path59);
34700
+ function destinationOf(path61, sessionProvider) {
34701
+ const scoped = parseProviderPath(path61);
34700
34702
  if (scoped !== void 0) {
34701
34703
  return { provider: scoped.provider, endpoint: scoped.rest };
34702
34704
  }
34703
- return { provider: sessionProvider ?? ANTHROPIC_PROVIDER, endpoint: path59 };
34705
+ return { provider: sessionProvider ?? ANTHROPIC_PROVIDER, endpoint: path61 };
34704
34706
  }
34705
34707
  function buildRecord(event, context) {
34706
34708
  const { scan } = context;
@@ -37203,14 +37205,14 @@ var require_util2 = __commonJS({
37203
37205
  }
37204
37206
  const port = url2.port != null ? url2.port : url2.protocol === "https:" ? 443 : 80;
37205
37207
  let origin = url2.origin != null ? url2.origin : `${url2.protocol || ""}//${url2.hostname || ""}:${port}`;
37206
- let path59 = url2.path != null ? url2.path : `${url2.pathname || ""}${url2.search || ""}`;
37208
+ let path61 = url2.path != null ? url2.path : `${url2.pathname || ""}${url2.search || ""}`;
37207
37209
  if (origin[origin.length - 1] === "/") {
37208
37210
  origin = origin.slice(0, origin.length - 1);
37209
37211
  }
37210
- if (path59 && path59[0] !== "/") {
37211
- path59 = `/${path59}`;
37212
+ if (path61 && path61[0] !== "/") {
37213
+ path61 = `/${path61}`;
37212
37214
  }
37213
- return new URL(`${origin}${path59}`);
37215
+ return new URL(`${origin}${path61}`);
37214
37216
  }
37215
37217
  if (!isHttpOrHttpsPrefixed(url2.origin || url2.protocol)) {
37216
37218
  throw new InvalidArgumentError2("Invalid URL protocol: the URL must start with `http:` or `https:`.");
@@ -38031,9 +38033,9 @@ var require_diagnostics = __commonJS({
38031
38033
  "undici:client:sendHeaders",
38032
38034
  (evt) => {
38033
38035
  const {
38034
- request: { method, path: path59, origin }
38036
+ request: { method, path: path61, origin }
38035
38037
  } = evt;
38036
- debugLog("sending request to %s %s%s", method, origin, path59);
38038
+ debugLog("sending request to %s %s%s", method, origin, path61);
38037
38039
  }
38038
38040
  );
38039
38041
  }
@@ -38051,14 +38053,14 @@ var require_diagnostics = __commonJS({
38051
38053
  "undici:request:headers",
38052
38054
  (evt) => {
38053
38055
  const {
38054
- request: { method, path: path59, origin },
38056
+ request: { method, path: path61, origin },
38055
38057
  response: { statusCode }
38056
38058
  } = evt;
38057
38059
  debugLog(
38058
38060
  "received response to %s %s%s - HTTP %d",
38059
38061
  method,
38060
38062
  origin,
38061
- path59,
38063
+ path61,
38062
38064
  statusCode
38063
38065
  );
38064
38066
  }
@@ -38067,23 +38069,23 @@ var require_diagnostics = __commonJS({
38067
38069
  "undici:request:trailers",
38068
38070
  (evt) => {
38069
38071
  const {
38070
- request: { method, path: path59, origin }
38072
+ request: { method, path: path61, origin }
38071
38073
  } = evt;
38072
- debugLog("trailers received from %s %s%s", method, origin, path59);
38074
+ debugLog("trailers received from %s %s%s", method, origin, path61);
38073
38075
  }
38074
38076
  );
38075
38077
  diagnosticsChannel.subscribe(
38076
38078
  "undici:request:error",
38077
38079
  (evt) => {
38078
38080
  const {
38079
- request: { method, path: path59, origin },
38081
+ request: { method, path: path61, origin },
38080
38082
  error: error63
38081
38083
  } = evt;
38082
38084
  debugLog(
38083
38085
  "request to %s %s%s errored - %s",
38084
38086
  method,
38085
38087
  origin,
38086
- path59,
38088
+ path61,
38087
38089
  error63.message
38088
38090
  );
38089
38091
  }
@@ -38198,7 +38200,7 @@ var require_request = __commonJS({
38198
38200
  var kHandler = /* @__PURE__ */ Symbol("handler");
38199
38201
  var Request2 = class {
38200
38202
  constructor(origin, {
38201
- path: path59,
38203
+ path: path61,
38202
38204
  method,
38203
38205
  body,
38204
38206
  headers,
@@ -38215,11 +38217,11 @@ var require_request = __commonJS({
38215
38217
  maxRedirections,
38216
38218
  typeOfService
38217
38219
  }, handler) {
38218
- if (typeof path59 !== "string") {
38220
+ if (typeof path61 !== "string") {
38219
38221
  throw new InvalidArgumentError2("path must be a string");
38220
- } else if (path59[0] !== "/" && !(path59.startsWith("http://") || path59.startsWith("https://")) && method !== "CONNECT") {
38222
+ } else if (path61[0] !== "/" && !(path61.startsWith("http://") || path61.startsWith("https://")) && method !== "CONNECT") {
38221
38223
  throw new InvalidArgumentError2("path must be an absolute URL or start with a slash");
38222
- } else if (invalidPathRegex.test(path59)) {
38224
+ } else if (invalidPathRegex.test(path61)) {
38223
38225
  throw new InvalidArgumentError2("invalid request path");
38224
38226
  }
38225
38227
  if (typeof method !== "string") {
@@ -38294,7 +38296,7 @@ var require_request = __commonJS({
38294
38296
  this.completed = false;
38295
38297
  this.aborted = false;
38296
38298
  this.upgrade = upgrade || null;
38297
- this.path = query ? serializePathWithQuery(path59, query) : path59;
38299
+ this.path = query ? serializePathWithQuery(path61, query) : path61;
38298
38300
  this.origin = origin;
38299
38301
  this.protocol = getProtocolFromUrlString(origin);
38300
38302
  this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent;
@@ -43476,7 +43478,7 @@ var require_client_h1 = __commonJS({
43476
43478
  return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT";
43477
43479
  }
43478
43480
  function writeH1(client, request7) {
43479
- const { method, path: path59, host, upgrade, blocking, reset } = request7;
43481
+ const { method, path: path61, host, upgrade, blocking, reset } = request7;
43480
43482
  let { body, headers, contentLength } = request7;
43481
43483
  const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH";
43482
43484
  if (util2.isFormDataLike(body)) {
@@ -43554,7 +43556,7 @@ var require_client_h1 = __commonJS({
43554
43556
  if (socket.setTypeOfService) {
43555
43557
  socket.setTypeOfService(request7.typeOfService);
43556
43558
  }
43557
- let header = `${method} ${path59} HTTP/1.1\r
43559
+ let header = `${method} ${path61} HTTP/1.1\r
43558
43560
  `;
43559
43561
  if (typeof host === "string") {
43560
43562
  header += `host: ${host}\r
@@ -44233,7 +44235,7 @@ var require_client_h2 = __commonJS({
44233
44235
  const headersTimeout = request7.headersTimeout ?? client[kHeadersTimeout];
44234
44236
  const bodyTimeout = request7.bodyTimeout ?? client[kBodyTimeout];
44235
44237
  const session = client[kHTTP2Session];
44236
- const { method, path: path59, host, upgrade, expectContinue, signal, protocol, headers: reqHeaders } = request7;
44238
+ const { method, path: path61, host, upgrade, expectContinue, signal, protocol, headers: reqHeaders } = request7;
44237
44239
  let { body } = request7;
44238
44240
  if (upgrade != null && upgrade !== "websocket") {
44239
44241
  util2.errorRequest(client, request7, new InvalidArgumentError2(`Custom upgrade "${upgrade}" not supported over HTTP/2`));
@@ -44302,7 +44304,7 @@ var require_client_h2 = __commonJS({
44302
44304
  }
44303
44305
  headers[HTTP2_HEADER_METHOD] = "CONNECT";
44304
44306
  headers[HTTP2_HEADER_PROTOCOL] = "websocket";
44305
- headers[HTTP2_HEADER_PATH] = path59;
44307
+ headers[HTTP2_HEADER_PATH] = path61;
44306
44308
  if (protocol === "ws:" || protocol === "wss:") {
44307
44309
  headers[HTTP2_HEADER_SCHEME] = protocol === "ws:" ? "http" : "https";
44308
44310
  } else {
@@ -44344,7 +44346,7 @@ var require_client_h2 = __commonJS({
44344
44346
  stream.setTimeout(headersTimeout);
44345
44347
  return true;
44346
44348
  }
44347
- headers[HTTP2_HEADER_PATH] = path59;
44349
+ headers[HTTP2_HEADER_PATH] = path61;
44348
44350
  headers[HTTP2_HEADER_SCHEME] = protocol === "http:" ? "http" : "https";
44349
44351
  const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH";
44350
44352
  if (body && typeof body.read === "function") {
@@ -46696,10 +46698,10 @@ var require_proxy_agent = __commonJS({
46696
46698
  };
46697
46699
  const {
46698
46700
  origin,
46699
- path: path59 = "/",
46701
+ path: path61 = "/",
46700
46702
  headers = {}
46701
46703
  } = opts;
46702
- opts.path = origin + path59;
46704
+ opts.path = origin + path61;
46703
46705
  if (!("host" in headers) && !("Host" in headers)) {
46704
46706
  const { host } = new URL(origin);
46705
46707
  headers.host = host;
@@ -48808,20 +48810,20 @@ var require_mock_utils = __commonJS({
48808
48810
  }
48809
48811
  return normalizedQp;
48810
48812
  }
48811
- function safeUrl(path59) {
48812
- if (typeof path59 !== "string") {
48813
- return path59;
48813
+ function safeUrl(path61) {
48814
+ if (typeof path61 !== "string") {
48815
+ return path61;
48814
48816
  }
48815
- const pathSegments = path59.split("?", 3);
48817
+ const pathSegments = path61.split("?", 3);
48816
48818
  if (pathSegments.length !== 2) {
48817
- return path59;
48819
+ return path61;
48818
48820
  }
48819
48821
  const qp2 = new URLSearchParams(pathSegments.pop());
48820
48822
  qp2.sort();
48821
48823
  return [...pathSegments, qp2.toString()].join("?");
48822
48824
  }
48823
- function matchKey(mockDispatch2, { path: path59, method, body, headers }) {
48824
- const pathMatch = matchValue(mockDispatch2.path, path59);
48825
+ function matchKey(mockDispatch2, { path: path61, method, body, headers }) {
48826
+ const pathMatch = matchValue(mockDispatch2.path, path61);
48825
48827
  const methodMatch = matchValue(mockDispatch2.method, method);
48826
48828
  const bodyMatch = typeof mockDispatch2.body !== "undefined" ? matchValue(mockDispatch2.body, body) : true;
48827
48829
  const headersMatch = matchHeaders(mockDispatch2, headers);
@@ -48846,8 +48848,8 @@ var require_mock_utils = __commonJS({
48846
48848
  const basePath = key.query ? serializePathWithQuery(key.path, key.query) : key.path;
48847
48849
  const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath;
48848
48850
  const resolvedPathWithoutTrailingSlash = removeTrailingSlash(resolvedPath);
48849
- let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path59, ignoreTrailingSlash }) => {
48850
- return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(path59)), resolvedPathWithoutTrailingSlash) : matchValue(safeUrl(path59), resolvedPath);
48851
+ let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path61, ignoreTrailingSlash }) => {
48852
+ return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(path61)), resolvedPathWithoutTrailingSlash) : matchValue(safeUrl(path61), resolvedPath);
48851
48853
  });
48852
48854
  if (matchedMockDispatches.length === 0) {
48853
48855
  throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`);
@@ -48886,19 +48888,19 @@ var require_mock_utils = __commonJS({
48886
48888
  mockDispatches.splice(index, 1);
48887
48889
  }
48888
48890
  }
48889
- function removeTrailingSlash(path59) {
48890
- while (path59.endsWith("/")) {
48891
- path59 = path59.slice(0, -1);
48891
+ function removeTrailingSlash(path61) {
48892
+ while (path61.endsWith("/")) {
48893
+ path61 = path61.slice(0, -1);
48892
48894
  }
48893
- if (path59.length === 0) {
48894
- path59 = "/";
48895
+ if (path61.length === 0) {
48896
+ path61 = "/";
48895
48897
  }
48896
- return path59;
48898
+ return path61;
48897
48899
  }
48898
48900
  function buildKey(opts) {
48899
- const { path: path59, method, body, headers, query } = opts;
48901
+ const { path: path61, method, body, headers, query } = opts;
48900
48902
  return {
48901
- path: path59,
48903
+ path: path61,
48902
48904
  method,
48903
48905
  body,
48904
48906
  headers,
@@ -49588,10 +49590,10 @@ var require_pending_interceptors_formatter = __commonJS({
49588
49590
  }
49589
49591
  format(pendingInterceptors) {
49590
49592
  const withPrettyHeaders = pendingInterceptors.map(
49591
- ({ method, path: path59, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
49593
+ ({ method, path: path61, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
49592
49594
  Method: method,
49593
49595
  Origin: origin,
49594
- Path: path59,
49596
+ Path: path61,
49595
49597
  "Status code": statusCode,
49596
49598
  Persistent: persist ? PERSISTENT : NOT_PERSISTENT,
49597
49599
  Invocations: timesInvoked,
@@ -49673,9 +49675,9 @@ var require_mock_agent = __commonJS({
49673
49675
  const acceptNonStandardSearchParameters = this[kMockAgentAcceptsNonStandardSearchParameters];
49674
49676
  const dispatchOpts = { ...opts };
49675
49677
  if (acceptNonStandardSearchParameters && dispatchOpts.path) {
49676
- const [path59, searchParams] = dispatchOpts.path.split("?");
49678
+ const [path61, searchParams] = dispatchOpts.path.split("?");
49677
49679
  const normalizedSearchParams = normalizeSearchParams(searchParams, acceptNonStandardSearchParameters);
49678
- dispatchOpts.path = `${path59}?${normalizedSearchParams}`;
49680
+ dispatchOpts.path = `${path61}?${normalizedSearchParams}`;
49679
49681
  }
49680
49682
  return this[kAgent].dispatch(dispatchOpts, handler);
49681
49683
  }
@@ -50076,12 +50078,12 @@ var require_snapshot_recorder = __commonJS({
50076
50078
  * @return {Promise<void>} - Resolves when snapshots are loaded
50077
50079
  */
50078
50080
  async loadSnapshots(filePath) {
50079
- const path59 = filePath || this.#snapshotPath;
50080
- if (!path59) {
50081
+ const path61 = filePath || this.#snapshotPath;
50082
+ if (!path61) {
50081
50083
  throw new InvalidArgumentError2("Snapshot path is required");
50082
50084
  }
50083
50085
  try {
50084
- const data = await readFile(resolve2(path59), "utf8");
50086
+ const data = await readFile(resolve2(path61), "utf8");
50085
50087
  const parsed = JSON.parse(data);
50086
50088
  if (Array.isArray(parsed)) {
50087
50089
  this.#snapshots.clear();
@@ -50095,7 +50097,7 @@ var require_snapshot_recorder = __commonJS({
50095
50097
  if (error63.code === "ENOENT") {
50096
50098
  this.#snapshots.clear();
50097
50099
  } else {
50098
- throw new UndiciError(`Failed to load snapshots from ${path59}`, { cause: error63 });
50100
+ throw new UndiciError(`Failed to load snapshots from ${path61}`, { cause: error63 });
50099
50101
  }
50100
50102
  }
50101
50103
  }
@@ -50106,11 +50108,11 @@ var require_snapshot_recorder = __commonJS({
50106
50108
  * @returns {Promise<void>} - Resolves when snapshots are saved
50107
50109
  */
50108
50110
  async saveSnapshots(filePath) {
50109
- const path59 = filePath || this.#snapshotPath;
50110
- if (!path59) {
50111
+ const path61 = filePath || this.#snapshotPath;
50112
+ if (!path61) {
50111
50113
  throw new InvalidArgumentError2("Snapshot path is required");
50112
50114
  }
50113
- const resolvedPath = resolve2(path59);
50115
+ const resolvedPath = resolve2(path61);
50114
50116
  await mkdir(dirname3(resolvedPath), { recursive: true });
50115
50117
  const data = Array.from(this.#snapshots.entries()).map(([hash2, snapshot]) => ({
50116
50118
  hash: hash2,
@@ -50742,15 +50744,15 @@ var require_redirect_handler = __commonJS({
50742
50744
  return;
50743
50745
  }
50744
50746
  const { origin, pathname, search } = util2.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)));
50745
- const path59 = search ? `${pathname}${search}` : pathname;
50746
- const redirectUrlString = `${origin}${path59}`;
50747
+ const path61 = search ? `${pathname}${search}` : pathname;
50748
+ const redirectUrlString = `${origin}${path61}`;
50747
50749
  for (const historyUrl of this.history) {
50748
50750
  if (historyUrl.toString() === redirectUrlString) {
50749
50751
  throw new InvalidArgumentError2(`Redirect loop detected. Cannot redirect to ${origin}. This typically happens when using a Client or Pool with cross-origin redirects. Use an Agent for cross-origin redirects.`);
50750
50752
  }
50751
50753
  }
50752
50754
  this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin);
50753
- this.opts.path = path59;
50755
+ this.opts.path = path61;
50754
50756
  this.opts.origin = origin;
50755
50757
  this.opts.query = null;
50756
50758
  }
@@ -52510,10 +52512,10 @@ var require_cache_handler = __commonJS({
52510
52512
  }
52511
52513
  return locationUrl.pathname + locationUrl.search;
52512
52514
  }
52513
- function deleteCachedUri(store, cacheKey, path59) {
52515
+ function deleteCachedUri(store, cacheKey, path61) {
52514
52516
  deleteCachedValue(store, {
52515
52517
  ...cacheKey,
52516
- path: path59
52518
+ path: path61
52517
52519
  });
52518
52520
  for (let i10 = 0; i10 < util2.safeHTTPMethods.length; i10++) {
52519
52521
  const method = util2.safeHTTPMethods[i10];
@@ -52521,7 +52523,7 @@ var require_cache_handler = __commonJS({
52521
52523
  deleteCachedValue(store, {
52522
52524
  ...cacheKey,
52523
52525
  method,
52524
- path: path59
52526
+ path: path61
52525
52527
  });
52526
52528
  }
52527
52529
  }
@@ -52532,9 +52534,9 @@ var require_cache_handler = __commonJS({
52532
52534
  }
52533
52535
  const values = Array.isArray(headerValue2) ? headerValue2 : [headerValue2];
52534
52536
  for (let i10 = 0; i10 < values.length; i10++) {
52535
- const path59 = getSameOriginPath(cacheKey, values[i10]);
52536
- if (path59 !== void 0) {
52537
- deleteCachedUri(store, cacheKey, path59);
52537
+ const path61 = getSameOriginPath(cacheKey, values[i10]);
52538
+ if (path61 !== void 0) {
52539
+ deleteCachedUri(store, cacheKey, path61);
52538
52540
  }
52539
52541
  }
52540
52542
  }
@@ -57534,11 +57536,11 @@ var require_fetch = __commonJS({
57534
57536
  function dispatch({ body }) {
57535
57537
  const url2 = requestCurrentURL(request7);
57536
57538
  const agent = fetchParams.controller.dispatcher;
57537
- const path59 = url2.pathname + url2.search;
57539
+ const path61 = url2.pathname + url2.search;
57538
57540
  const hasTrailingQuestionMark = url2.search.length === 0 && url2.href[url2.href.length - url2.hash.length - 1] === "?";
57539
57541
  return new Promise((resolve2, reject) => agent.dispatch(
57540
57542
  {
57541
- path: hasTrailingQuestionMark ? `${path59}?` : path59,
57543
+ path: hasTrailingQuestionMark ? `${path61}?` : path61,
57542
57544
  origin: url2.origin,
57543
57545
  method: request7.method,
57544
57546
  body: agent.isMockActive ? request7.body && (request7.body.source || request7.body.stream) : body,
@@ -58485,9 +58487,9 @@ var require_util5 = __commonJS({
58485
58487
  }
58486
58488
  }
58487
58489
  }
58488
- function validateCookiePath(path59) {
58489
- for (let i10 = 0; i10 < path59.length; ++i10) {
58490
- const code = path59.charCodeAt(i10);
58490
+ function validateCookiePath(path61) {
58491
+ for (let i10 = 0; i10 < path61.length; ++i10) {
58492
+ const code = path61.charCodeAt(i10);
58491
58493
  if (code < 32 || // exclude CTLs (0-31)
58492
58494
  code > 126 || // exclude DEL and non-ascii
58493
58495
  code === 59) {
@@ -61835,11 +61837,11 @@ var require_undici = __commonJS({
61835
61837
  if (typeof opts.path !== "string") {
61836
61838
  throw new InvalidArgumentError2("invalid opts.path");
61837
61839
  }
61838
- let path59 = opts.path;
61840
+ let path61 = opts.path;
61839
61841
  if (!opts.path.startsWith("/")) {
61840
- path59 = `/${path59}`;
61842
+ path61 = `/${path61}`;
61841
61843
  }
61842
- url2 = new URL(util2.parseOrigin(url2).origin + path59);
61844
+ url2 = new URL(util2.parseOrigin(url2).origin + path61);
61843
61845
  } else {
61844
61846
  if (!opts) {
61845
61847
  opts = typeof url2 === "object" ? url2 : {};
@@ -64152,7 +64154,7 @@ function quotaFreshnessMs(quota) {
64152
64154
  const lengths = quota.windows.flatMap((window) => window.periodMs === void 0 ? [] : [window.periodMs]);
64153
64155
  return lengths.length === 0 ? Number.POSITIVE_INFINITY : Math.min(...lengths) / PERCENT3;
64154
64156
  }
64155
- var ProviderQuotaError, MS_PER_SECOND6, SECONDS_PER_HOUR, HOURS_PER_DAY3, DAYS_PER_MONTH, PERCENT3, HTTP_OK, ZAI_SOURCE, ZAI_HOST, ZAI_QUOTA_URL, ZAI_UNIT_HOURS, ZAI_UNIT_MONTHS, ZAI_UNIT_MS, ZAI_MEASURES, ZaiLimitSchema, ZaiResponseSchema, zaiQuotaAdapter, OPENROUTER_SOURCE, OPENROUTER_HOST, OPENROUTER_KEY_URL, OPENROUTER_CREDITS_URL, HTTP_FORBIDDEN, MS_PER_DAY2, OpenRouterKeySchema, OpenRouterCreditsSchema, openRouterQuotaAdapter, ANTIGRAVITY_SOURCE, ANTIGRAVITY_HOST, ANTIGRAVITY_QUOTA_URL, GOOGLE_TOKENINFO_URL, FIVE_HOURS2, DAYS_PER_WEEK, FIVE_HOURS_MS, WEEK_MS, AntigravityBucketSchema, AntigravitySummarySchema, GoogleTokenInfoSchema, ANTIGRAVITY_WINDOW_MS, antigravityQuotaAdapter, PROVIDER_QUOTA_ADAPTERS;
64157
+ var ProviderQuotaError, MS_PER_SECOND6, SECONDS_PER_HOUR, HOURS_PER_DAY3, DAYS_PER_MONTH, PERCENT3, HTTP_OK, ZAI_SOURCE, ZAI_HOST, ZAI_QUOTA_URL, ZAI_UNIT_HOURS, ZAI_UNIT_MONTHS, ZAI_UNIT_MS, ZAI_MEASURES, ZaiLimitSchema, ZaiResponseSchema, zaiQuotaAdapter, OPENROUTER_SOURCE, OPENROUTER_HOST, OPENROUTER_KEY_URL, OPENROUTER_CREDITS_URL, HTTP_FORBIDDEN, MS_PER_DAY2, OpenRouterKeySchema, OpenRouterCreditsSchema, openRouterQuotaAdapter, ANTIGRAVITY_SOURCE, ANTIGRAVITY_HOST, ANTIGRAVITY_QUOTA_URL, ANTIGRAVITY_USER_URL, GOOGLE_TOKENINFO_URL, FIVE_HOURS2, DAYS_PER_WEEK, FIVE_HOURS_MS, WEEK_MS, AntigravityBucketSchema, AntigravitySummarySchema, GoogleTokenInfoSchema, AntigravityUserSchema, ANTIGRAVITY_WINDOW_MS, antigravityQuotaAdapter, PROVIDER_QUOTA_ADAPTERS;
64156
64158
  var init_providerQuota = __esm({
64157
64159
  "src/usage/providerQuota.ts"() {
64158
64160
  "use strict";
@@ -64274,6 +64276,7 @@ var init_providerQuota = __esm({
64274
64276
  ANTIGRAVITY_SOURCE = "Cloud Code";
64275
64277
  ANTIGRAVITY_HOST = "daily-cloudcode-pa.googleapis.com";
64276
64278
  ANTIGRAVITY_QUOTA_URL = `https://${ANTIGRAVITY_HOST}/v1internal:retrieveUserQuotaSummary`;
64279
+ ANTIGRAVITY_USER_URL = `https://${ANTIGRAVITY_HOST}/v1internal:loadCodeAssist`;
64277
64280
  GOOGLE_TOKENINFO_URL = "https://oauth2.googleapis.com/tokeninfo";
64278
64281
  FIVE_HOURS2 = 5;
64279
64282
  DAYS_PER_WEEK = 7;
@@ -64289,6 +64292,12 @@ var init_providerQuota = __esm({
64289
64292
  email: external_exports.string().optional(),
64290
64293
  sub: external_exports.string().optional()
64291
64294
  });
64295
+ AntigravityUserSchema = external_exports.object({
64296
+ /** The code-assist tier context, which defaults to the free tier for every account. */
64297
+ currentTier: external_exports.object({ name: external_exports.string().optional(), id: external_exports.string().optional() }).optional(),
64298
+ /** The account's paid subscription; absent when the account has none. */
64299
+ paidTier: external_exports.object({ name: external_exports.string().optional(), id: external_exports.string().optional() }).optional()
64300
+ });
64292
64301
  ANTIGRAVITY_WINDOW_MS = { "gemini-5h": FIVE_HOURS_MS, "3p-5h": FIVE_HOURS_MS, "gemini-weekly": WEEK_MS, "3p-weekly": WEEK_MS };
64293
64302
  antigravityQuotaAdapter = {
64294
64303
  source: ANTIGRAVITY_SOURCE,
@@ -64320,9 +64329,20 @@ var init_providerQuota = __esm({
64320
64329
  } catch {
64321
64330
  }
64322
64331
  }
64332
+ let level;
64333
+ const userResponse = await http8(ANTIGRAVITY_USER_URL, headers, signal, { method: "POST", body: "{}" });
64334
+ if (userResponse.status === HTTP_OK) {
64335
+ try {
64336
+ const tiers = AntigravityUserSchema.parse(JSON.parse(userResponse.text));
64337
+ const tier = tiers.paidTier ?? tiers.currentTier;
64338
+ level = tier?.name ?? tier?.id;
64339
+ } catch {
64340
+ }
64341
+ }
64323
64342
  return ProviderQuotaSchema.parse({
64324
64343
  observedAt: new Date(nowMs).toISOString(),
64325
64344
  source: ANTIGRAVITY_SOURCE,
64345
+ ...level === void 0 ? {} : { level },
64326
64346
  ...account === void 0 ? {} : { account },
64327
64347
  windows: parsed.data.groups.flatMap(
64328
64348
  (group) => group.buckets.map((bucket) => ({
@@ -101209,8 +101229,8 @@ var require_utils3 = __commonJS({
101209
101229
  }
101210
101230
  return ind;
101211
101231
  }
101212
- function removeDotSegments(path59) {
101213
- let input2 = path59;
101232
+ function removeDotSegments(path61) {
101233
+ let input2 = path61;
101214
101234
  const output2 = [];
101215
101235
  let nextSlash = -1;
101216
101236
  let len = 0;
@@ -101619,8 +101639,8 @@ var require_schemes = __commonJS({
101619
101639
  }
101620
101640
  if (wsComponent.resourceName) {
101621
101641
  const queryIndex = wsComponent.resourceName.indexOf("?");
101622
- const path59 = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
101623
- wsComponent.path = path59 && path59 !== "/" ? path59 : void 0;
101642
+ const path61 = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
101643
+ wsComponent.path = path61 && path61 !== "/" ? path61 : void 0;
101624
101644
  wsComponent.query = queryIndex === -1 ? void 0 : wsComponent.resourceName.slice(queryIndex + 1);
101625
101645
  wsComponent.resourceName = void 0;
101626
101646
  }
@@ -105147,7 +105167,7 @@ var require_dist2 = __commonJS({
105147
105167
  });
105148
105168
 
105149
105169
  // src/cli.ts
105150
- var import_node_path58 = __toESM(require("node:path"), 1);
105170
+ var import_node_path60 = __toESM(require("node:path"), 1);
105151
105171
 
105152
105172
  // node_modules/.pnpm/commander@15.0.0/node_modules/commander/lib/error.js
105153
105173
  var CommanderError = class extends Error {
@@ -108260,9 +108280,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
108260
108280
  * @param {string} [path]
108261
108281
  * @return {(string|null|Command)}
108262
108282
  */
108263
- executableDir(path59) {
108264
- if (path59 === void 0) return this._executableDir;
108265
- this._executableDir = path59;
108283
+ executableDir(path61) {
108284
+ if (path61 === void 0) return this._executableDir;
108285
+ this._executableDir = path61;
108266
108286
  return this;
108267
108287
  }
108268
108288
  /**
@@ -109911,19 +109931,19 @@ function writePools(paths, pools) {
109911
109931
  applyPatch(paths.globalConfigFile, GlobalConfigSchema, { pools }, { defaults: {} });
109912
109932
  }
109913
109933
  function poolCycleOf(pools, name) {
109914
- const walk2 = (current, path59) => {
109934
+ const walk2 = (current, path61) => {
109915
109935
  for (const entry of pools[current]?.identities ?? []) {
109916
109936
  const nested = poolNameOf(poolMemberIdentity(entry));
109917
109937
  if (nested === void 0) {
109918
109938
  continue;
109919
109939
  }
109920
109940
  if (nested === name) {
109921
- return [...path59, nested];
109941
+ return [...path61, nested];
109922
109942
  }
109923
- if (path59.includes(nested)) {
109943
+ if (path61.includes(nested)) {
109924
109944
  continue;
109925
109945
  }
109926
- const found = walk2(nested, [...path59, nested]);
109946
+ const found = walk2(nested, [...path61, nested]);
109927
109947
  if (found !== void 0) {
109928
109948
  return found;
109929
109949
  }
@@ -114695,8 +114715,8 @@ function parseConnectTarget(authority) {
114695
114715
  }
114696
114716
  return { host, port };
114697
114717
  }
114698
- function servedByPipeline(path59) {
114699
- return path59?.startsWith(ROUTED_PATH_PREFIX) === true;
114718
+ function servedByPipeline(path61) {
114719
+ return path61?.startsWith(ROUTED_PATH_PREFIX) === true;
114700
114720
  }
114701
114721
  var HOP_BY_HOP_HEADERS = /* @__PURE__ */ new Set([
114702
114722
  "connection",
@@ -115381,11 +115401,11 @@ function createRcSessionTracker(deps) {
115381
115401
  };
115382
115402
  const observeExchange = (request7) => {
115383
115403
  const method = (request7.method ?? "").toUpperCase();
115384
- const path59 = new URL(request7.url ?? "/", "http://127.0.0.1").pathname;
115385
- if (!path59.startsWith(RC_SESSIONS_PATH_PREFIX)) {
115404
+ const path61 = new URL(request7.url ?? "/", "http://127.0.0.1").pathname;
115405
+ if (!path61.startsWith(RC_SESSIONS_PATH_PREFIX)) {
115386
115406
  return void 0;
115387
115407
  }
115388
- const tail = path59.slice(RC_SESSIONS_PATH_PREFIX.length);
115408
+ const tail = path61.slice(RC_SESSIONS_PATH_PREFIX.length);
115389
115409
  const facts = {
115390
115410
  oauthAuthorization: oauthAuthorizationOf(request7.headers),
115391
115411
  anthropicVersion: singleHeader(request7.headers, "anthropic-version"),
@@ -115754,8 +115774,8 @@ var RC_READ_FILE_ENCODINGS = ["utf-8", "base64"];
115754
115774
  function isRcReadFileEncoding(value2) {
115755
115775
  return RC_READ_FILE_ENCODINGS.some((encoding) => encoding === value2);
115756
115776
  }
115757
- function buildRcReadFilePayload(requestId, path59, options) {
115758
- return buildRcControlRequestPayload(requestId, { subtype: "read_file", path: path59, ...options?.maxBytes === void 0 ? {} : { max_bytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } });
115777
+ function buildRcReadFilePayload(requestId, path61, options) {
115778
+ return buildRcControlRequestPayload(requestId, { subtype: "read_file", path: path61, ...options?.maxBytes === void 0 ? {} : { max_bytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } });
115759
115779
  }
115760
115780
  function buildRcFileSuggestionsPayload(requestId, query) {
115761
115781
  return buildRcControlRequestPayload(requestId, { subtype: "file_suggestions", query });
@@ -115857,15 +115877,15 @@ async function getRcSessionContextUsage(deps, sessionId, detail) {
115857
115877
  const result = await deliverRcClientPayload(deps, sessionId, buildRcGetContextUsagePayload(requestId, detail), `request the context usage of session ${sessionId}`);
115858
115878
  return result.ok ? { ...result, requestId } : result;
115859
115879
  }
115860
- async function readRcSessionFile(deps, sessionId, path59, options) {
115861
- if (path59 === "") {
115880
+ async function readRcSessionFile(deps, sessionId, path61, options) {
115881
+ if (path61 === "") {
115862
115882
  return { ok: false, message: "a read-file write needs a non-empty path: the SDK's own field names the file the worker resolves against the session's cwd, and an empty string names none" };
115863
115883
  }
115864
115884
  if (options?.maxBytes !== void 0 && (!Number.isInteger(options.maxBytes) || options.maxBytes <= 0)) {
115865
115885
  return { ok: false, message: "a read-file write's max-bytes is a positive whole number of bytes: the SDK's own field caps the read, and a zero or negative cap reads nothing" };
115866
115886
  }
115867
115887
  const requestId = deps.newUuid();
115868
- const result = await deliverRcClientPayload(deps, sessionId, buildRcReadFilePayload(requestId, path59, options), `read ${path59} from session ${sessionId}`);
115888
+ const result = await deliverRcClientPayload(deps, sessionId, buildRcReadFilePayload(requestId, path61, options), `read ${path61} from session ${sessionId}`);
115869
115889
  return result.ok ? { ...result, requestId } : result;
115870
115890
  }
115871
115891
  async function suggestRcSessionFiles(deps, sessionId, query) {
@@ -116036,11 +116056,11 @@ function createRcControlHandler(deps) {
116036
116056
  path: "read-file",
116037
116057
  read: (body) => {
116038
116058
  const session = bodyString(body, "session");
116039
- const path59 = bodyString(body, "path");
116059
+ const path61 = bodyString(body, "path");
116040
116060
  const maxBytes = "maxBytes" in body ? bodyPositiveInteger(body, "maxBytes") : void 0;
116041
116061
  const encoding = "encoding" in body && isRcReadFileEncoding(body.encoding) ? body.encoding : void 0;
116042
- const refused2 = session === void 0 || path59 === void 0 || "maxBytes" in body && maxBytes === void 0 || "encoding" in body && encoding === void 0;
116043
- return refused2 ? { error: `the read-file body must be JSON naming a non-empty session id and path, maxBytes only as a positive whole number or absent, and an encoding the SDK's own type permits (${RC_READ_FILE_ENCODINGS.join(", ")}) or none` } : { session, run: async () => await deps.readFile(session, path59, { ...maxBytes === void 0 ? {} : { maxBytes }, ...encoding === void 0 ? {} : { encoding } }) };
116062
+ const refused2 = session === void 0 || path61 === void 0 || "maxBytes" in body && maxBytes === void 0 || "encoding" in body && encoding === void 0;
116063
+ return refused2 ? { error: `the read-file body must be JSON naming a non-empty session id and path, maxBytes only as a positive whole number or absent, and an encoding the SDK's own type permits (${RC_READ_FILE_ENCODINGS.join(", ")}) or none` } : { session, run: async () => await deps.readFile(session, path61, { ...maxBytes === void 0 ? {} : { maxBytes }, ...encoding === void 0 ? {} : { encoding } }) };
116044
116064
  }
116045
116065
  },
116046
116066
  {
@@ -116350,9 +116370,9 @@ function requestIdOfBody(body) {
116350
116370
  }
116351
116371
  function frontDoorRcControl(transport, token) {
116352
116372
  const headers = { authorization: `Bearer ${token}` };
116353
- const listAnswerOf = async (path59, what) => {
116373
+ const listAnswerOf = async (path61, what) => {
116354
116374
  try {
116355
- return await transport.request({ method: "GET", path: path59, headers });
116375
+ return await transport.request({ method: "GET", path: path61, headers });
116356
116376
  } catch (error63) {
116357
116377
  throw new Error(`${what}: could not reach the front door's control listener: ${error63 instanceof Error ? error63.message : String(error63)}`, { cause: error63 });
116358
116378
  }
@@ -116424,10 +116444,10 @@ function frontDoorRcControl(transport, token) {
116424
116444
  }
116425
116445
  return pending;
116426
116446
  };
116427
- const writeOf = async (path59, body, describeFailure2) => {
116447
+ const writeOf = async (path61, body, describeFailure2) => {
116428
116448
  let answer;
116429
116449
  try {
116430
- answer = await transport.request({ method: "POST", path: path59, headers: { ...headers, "content-type": "application/json" }, body });
116450
+ answer = await transport.request({ method: "POST", path: path61, headers: { ...headers, "content-type": "application/json" }, body });
116431
116451
  } catch (error63) {
116432
116452
  return { ok: false, message: `could not reach the front door's control listener: ${error63 instanceof Error ? error63.message : String(error63)}` };
116433
116453
  }
@@ -116458,10 +116478,10 @@ function frontDoorRcControl(transport, token) {
116458
116478
  endSession: async (sessionId, reason) => await writeOf(`${CONTROL_PATH_PREFIX}/end-session`, JSON.stringify({ session: sessionId, ...reason === void 0 ? {} : { reason } }), (status, message) => `ending ${sessionId} failed (HTTP ${String(status)}): ${message}`),
116459
116479
  getUsage: async (sessionId, skipBehaviors) => await writeOf(`${CONTROL_PATH_PREFIX}/get-usage`, JSON.stringify({ session: sessionId, ...skipBehaviors === void 0 ? {} : { skipBehaviors } }), (status, message) => `requesting the usage of ${sessionId} failed (HTTP ${String(status)}): ${message}`),
116460
116480
  getContextUsage: async (sessionId, detail) => await writeOf(`${CONTROL_PATH_PREFIX}/get-context-usage`, JSON.stringify({ session: sessionId, ...detail === void 0 ? {} : { detail } }), (status, message) => `requesting the context usage of ${sessionId} failed (HTTP ${String(status)}): ${message}`),
116461
- readFile: async (sessionId, path59, options) => await writeOf(
116481
+ readFile: async (sessionId, path61, options) => await writeOf(
116462
116482
  `${CONTROL_PATH_PREFIX}/read-file`,
116463
- JSON.stringify({ session: sessionId, path: path59, ...options?.maxBytes === void 0 ? {} : { maxBytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } }),
116464
- (status, message) => `reading ${path59} from ${sessionId} failed (HTTP ${String(status)}): ${message}`
116483
+ JSON.stringify({ session: sessionId, path: path61, ...options?.maxBytes === void 0 ? {} : { maxBytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } }),
116484
+ (status, message) => `reading ${path61} from ${sessionId} failed (HTTP ${String(status)}): ${message}`
116465
116485
  ),
116466
116486
  fileSuggestions: async (sessionId, query) => await writeOf(`${CONTROL_PATH_PREFIX}/file-suggestions`, JSON.stringify({ session: sessionId, query }), (status, message) => `requesting file suggestions from ${sessionId} failed (HTTP ${String(status)}): ${message}`),
116467
116487
  keepAlive: async (sessionId) => await writeOf(`${CONTROL_PATH_PREFIX}/keep-alive`, JSON.stringify({ session: sessionId }), (status, message) => `keeping ${sessionId} alive failed (HTTP ${String(status)}): ${message}`),
@@ -116755,12 +116775,12 @@ function tlsFacts(options) {
116755
116775
  }
116756
116776
  function realRcEventDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_PORT }) {
116757
116777
  const agent = new ExemptTlsAgent();
116758
- const post = async (path59, headers, body) => await new Promise((resolve2, reject) => {
116778
+ const post = async (path61, headers, body) => await new Promise((resolve2, reject) => {
116759
116779
  const options = {
116760
116780
  host: target.host,
116761
116781
  port: target.port,
116762
116782
  method: "POST",
116763
- path: path59,
116783
+ path: path61,
116764
116784
  // The Host header names the host whose API this is, not the address dialled: a redirected test dials a loopback stand-in while still speaking to the API host by name, exactly as the forwarded paths present their SNI.
116765
116785
  headers: { ...headers, host: target.servername ?? target.host, "content-length": String(Buffer.byteLength(body, "utf8")) },
116766
116786
  agent
@@ -116825,12 +116845,12 @@ function lateRcStreamDial(resolve2) {
116825
116845
  }
116826
116846
  function realRcStreamDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_PORT }) {
116827
116847
  const agent = new ExemptTlsAgent();
116828
- const request7 = async (method, path59, headers, body, signal) => await new Promise((resolve2, reject) => {
116848
+ const request7 = async (method, path61, headers, body, signal) => await new Promise((resolve2, reject) => {
116829
116849
  const options = {
116830
116850
  host: target.host,
116831
116851
  port: target.port,
116832
116852
  method,
116833
- path: path59,
116853
+ path: path61,
116834
116854
  // The Host header names the host whose API this is, not the address dialled: a redirected test dials a loopback stand-in while still speaking to the API host by name, exactly as the forwarded paths present their SNI.
116835
116855
  headers: { ...headers, host: target.servername ?? target.host, ...body === void 0 ? {} : { "content-length": String(Buffer.byteLength(body, "utf8")) } },
116836
116856
  agent,
@@ -116872,9 +116892,9 @@ function realRcStreamDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_P
116872
116892
  return { status, body: await readAll(response) };
116873
116893
  },
116874
116894
  openStream: async (sessionId, headers, resume, signal) => {
116875
- const path59 = resume === void 0 ? `/v1/code/sessions/${encodeURIComponent(sessionId)}/events/stream` : `/v1/code/sessions/${encodeURIComponent(sessionId)}/events/stream?from_sequence_num=${String(resume.fromSequenceNum)}`;
116895
+ const path61 = resume === void 0 ? `/v1/code/sessions/${encodeURIComponent(sessionId)}/events/stream` : `/v1/code/sessions/${encodeURIComponent(sessionId)}/events/stream?from_sequence_num=${String(resume.fromSequenceNum)}`;
116876
116896
  const streamHeaders = resume === void 0 ? headers : { ...headers, "last-event-id": String(resume.fromSequenceNum) };
116877
- const { status, response } = await request7("GET", path59, streamHeaders, void 0, signal);
116897
+ const { status, response } = await request7("GET", path61, streamHeaders, void 0, signal);
116878
116898
  if (!isSuccessful2(status)) {
116879
116899
  await readAll(response);
116880
116900
  return { status, chunks: NO_CHUNKS };
@@ -118168,11 +118188,11 @@ function tryOrUndefined(fn2) {
118168
118188
  return void 0;
118169
118189
  }
118170
118190
  }
118171
- function pathToHttpPath(path59) {
118172
- return `/${path59.map(safeEncodeURIComponent).join("/")}`;
118191
+ function pathToHttpPath(path61) {
118192
+ return `/${path61.map(safeEncodeURIComponent).join("/")}`;
118173
118193
  }
118174
- function normalizeHttpPath(path59) {
118175
- const paths = path59.split("/");
118194
+ function normalizeHttpPath(path61) {
118195
+ const paths = path61.split("/");
118176
118196
  if (paths.at(0) === "") {
118177
118197
  paths.shift();
118178
118198
  }
@@ -118357,9 +118377,9 @@ function isPlainObject2(value2) {
118357
118377
  function getOwn(object3, key) {
118358
118378
  return Object.hasOwn(object3, key) ? object3[key] : void 0;
118359
118379
  }
118360
- function get(object3, path59) {
118380
+ function get(object3, path61) {
118361
118381
  let current = object3;
118362
- for (const key of path59) {
118382
+ for (const key of path61) {
118363
118383
  if (!isTypescriptObject(current)) {
118364
118384
  return void 0;
118365
118385
  }
@@ -119582,7 +119602,7 @@ function resolveClientRest(rest) {
119582
119602
  // rest[1] can be undefined if all fields of FriendlyClientOptions are optional
119583
119603
  ];
119584
119604
  }
119585
- function createORPCClient(link, { path: path59 = [], ...options } = {}) {
119605
+ function createORPCClient(link, { path: path61 = [], ...options } = {}) {
119586
119606
  const procedureClient = (...rest) => {
119587
119607
  const [input2, callOptions] = resolveClientRest(rest);
119588
119608
  const interceptors = [
@@ -119591,7 +119611,7 @@ function createORPCClient(link, { path: path59 = [], ...options } = {}) {
119591
119611
  ];
119592
119612
  return intercept(
119593
119613
  interceptors,
119594
- { ...callOptions, input: input2, path: path59 },
119614
+ { ...callOptions, input: input2, path: path61 },
119595
119615
  ({ path: path210, input: input22, ...callOptions2 }) => link.call(path210, input22, callOptions2)
119596
119616
  );
119597
119617
  };
@@ -119605,7 +119625,7 @@ function createORPCClient(link, { path: path59 = [], ...options } = {}) {
119605
119625
  if (client === void 0) {
119606
119626
  client = createORPCClient(link, {
119607
119627
  ...options,
119608
- path: [...path59, key],
119628
+ path: [...path61, key],
119609
119629
  scoped: options.scoped?.[key]
119610
119630
  });
119611
119631
  cache.set(key, client);
@@ -119627,24 +119647,24 @@ var BracketNotationSerializer = class {
119627
119647
  this.internalSerialize(data, "", true, result);
119628
119648
  return result;
119629
119649
  }
119630
- internalSerialize(data, path59, isRoot, result) {
119650
+ internalSerialize(data, path61, isRoot, result) {
119631
119651
  if (Array.isArray(data)) {
119632
119652
  data.forEach((item, i10) => {
119633
- this.internalSerialize(item, isRoot ? i10.toString() : `${path59}[${i10}]`, false, result);
119653
+ this.internalSerialize(item, isRoot ? i10.toString() : `${path61}[${i10}]`, false, result);
119634
119654
  });
119635
119655
  } else if (isPlainObject2(data)) {
119636
119656
  for (const key of Object.keys(data)) {
119637
- this.internalSerialize(data[key], isRoot ? key : `${path59}[${key}]`, false, result);
119657
+ this.internalSerialize(data[key], isRoot ? key : `${path61}[${key}]`, false, result);
119638
119658
  }
119639
119659
  } else {
119640
- result.push([path59, data]);
119660
+ result.push([path61, data]);
119641
119661
  }
119642
119662
  }
119643
119663
  deserialize(serialized) {
119644
119664
  const arrayPushStyles = /* @__PURE__ */ new WeakSet();
119645
119665
  const root = new NullProtoObj();
119646
- for (const [path59, value2] of serialized) {
119647
- const segments = this.parsePath(path59);
119666
+ for (const [path61, value2] of serialized) {
119667
+ const segments = this.parsePath(path61);
119648
119668
  let currentRef = root;
119649
119669
  let nextSegment = segments[0];
119650
119670
  for (let i10 = 1; i10 < segments.length; i10++) {
@@ -119695,13 +119715,13 @@ var BracketNotationSerializer = class {
119695
119715
  }
119696
119716
  return result;
119697
119717
  }
119698
- parsePath(path59) {
119718
+ parsePath(path61) {
119699
119719
  const segments = [];
119700
119720
  let inBrackets = false;
119701
119721
  let currentSegment = "";
119702
- for (let i10 = 0; i10 < path59.length; i10++) {
119703
- const char = path59[i10];
119704
- const nextChar = path59[i10 + 1];
119722
+ for (let i10 = 0; i10 < path61.length; i10++) {
119723
+ const char = path61[i10];
119724
+ const nextChar = path61[i10 + 1];
119705
119725
  if (inBrackets && char === "]" && (nextChar === void 0 || nextChar === "[")) {
119706
119726
  if (nextChar === void 0) {
119707
119727
  inBrackets = false;
@@ -119717,7 +119737,7 @@ var BracketNotationSerializer = class {
119717
119737
  currentSegment += char;
119718
119738
  }
119719
119739
  }
119720
- return inBrackets || segments.length === 0 ? [path59] : segments;
119740
+ return inBrackets || segments.length === 0 ? [path61] : segments;
119721
119741
  }
119722
119742
  };
119723
119743
  var INTEGER_PATTERN = /^0$|^[1-9]\d*$/;
@@ -120290,11 +120310,11 @@ var OpenAPISerializer = class {
120290
120310
  return json2;
120291
120311
  }
120292
120312
  const form = new FormData();
120293
- for (const [path59, value22] of this.bracketNotation.serialize(json2)) {
120313
+ for (const [path61, value22] of this.bracketNotation.serialize(json2)) {
120294
120314
  if (value22 instanceof Blob) {
120295
- form.append(path59, value22);
120315
+ form.append(path61, value22);
120296
120316
  } else if (value22 !== void 0 && value22 !== null) {
120297
- form.append(path59, String(value22));
120317
+ form.append(path61, String(value22));
120298
120318
  }
120299
120319
  }
120300
120320
  return form;
@@ -120332,30 +120352,30 @@ function isBodylessMethod(method) {
120332
120352
  return method === "GET" || method === "HEAD";
120333
120353
  }
120334
120354
  var PARAMETER_NAME_REGEX = /^[\w-]+$/;
120335
- function getDynamicPathParams(path59) {
120336
- if (!path59.includes("{")) {
120355
+ function getDynamicPathParams(path61) {
120356
+ if (!path61.includes("{")) {
120337
120357
  return void 0;
120338
120358
  }
120339
- const len = path59.length;
120359
+ const len = path61.length;
120340
120360
  let params;
120341
120361
  let index = 1;
120342
120362
  while (index < len) {
120343
120363
  const segmentStart = index;
120344
- const slashPos = path59.indexOf("/", index);
120364
+ const slashPos = path61.indexOf("/", index);
120345
120365
  const segmentEnd = slashPos === -1 ? len : slashPos;
120346
- if (segmentEnd > segmentStart && path59.charCodeAt(segmentStart) === 123 && path59.charCodeAt(segmentEnd - 1) === 125) {
120366
+ if (segmentEnd > segmentStart && path61.charCodeAt(segmentStart) === 123 && path61.charCodeAt(segmentEnd - 1) === 125) {
120347
120367
  let parameterStart = segmentStart + 1;
120348
120368
  let allowsSlash = false;
120349
- const operator = path59.charCodeAt(parameterStart);
120369
+ const operator = path61.charCodeAt(parameterStart);
120350
120370
  if (operator === 43) {
120351
120371
  allowsSlash = true;
120352
120372
  parameterStart++;
120353
120373
  }
120354
- const parameterName = path59.slice(parameterStart, segmentEnd - 1);
120374
+ const parameterName = path61.slice(parameterStart, segmentEnd - 1);
120355
120375
  if (PARAMETER_NAME_REGEX.test(parameterName)) {
120356
120376
  params ??= [];
120357
120377
  params.push({
120358
- segment: path59.slice(segmentStart, segmentEnd),
120378
+ segment: path61.slice(segmentStart, segmentEnd),
120359
120379
  startIndex: segmentStart,
120360
120380
  parameterName,
120361
120381
  allowsSlash
@@ -120398,8 +120418,8 @@ openapi.method = (method) => ({
120398
120418
  ...openapi({ method }),
120399
120419
  name: "~openapi/method"
120400
120420
  });
120401
- openapi.path = (path59) => ({
120402
- ...openapi({ path: path59 }),
120421
+ openapi.path = (path61) => ({
120422
+ ...openapi({ path: path61 }),
120403
120423
  name: "~openapi/path"
120404
120424
  });
120405
120425
  openapi.spec = (spec) => ({
@@ -121260,22 +121280,22 @@ function visitJsonSchemaRefs(value2, visit2, schemaLevel = true, seen = /* @__PU
121260
121280
  }
121261
121281
  }
121262
121282
  }
121263
- function mapJsonSchemaRefs(value2, map2, schemaLevel = true, path59 = []) {
121283
+ function mapJsonSchemaRefs(value2, map2, schemaLevel = true, path61 = []) {
121264
121284
  if (!value2 || typeof value2 !== "object") {
121265
121285
  return value2;
121266
121286
  }
121267
121287
  if (Array.isArray(value2)) {
121268
- return value2.map((item, index) => mapJsonSchemaRefs(item, map2, schemaLevel, [...path59, index]));
121288
+ return value2.map((item, index) => mapJsonSchemaRefs(item, map2, schemaLevel, [...path61, index]));
121269
121289
  }
121270
121290
  const result = {};
121271
121291
  for (const key of Object.keys(value2)) {
121272
121292
  const val = value2[key];
121273
121293
  if (key === "$ref" && typeof val === "string") {
121274
- setOwn(result, key, map2(val, [...path59, key]));
121294
+ setOwn(result, key, map2(val, [...path61, key]));
121275
121295
  } else if (!schemaLevel) {
121276
- setOwn(result, key, mapJsonSchemaRefs(val, map2, true, [...path59, key]));
121296
+ setOwn(result, key, mapJsonSchemaRefs(val, map2, true, [...path61, key]));
121277
121297
  } else if (JSON_SCHEMA_LOGIC_KEYWORDS.has(key) || JSON_SCHEMA_RECORD_KEYWORDS.has(key)) {
121278
- setOwn(result, key, mapJsonSchemaRefs(val, map2, !JSON_SCHEMA_RECORD_KEYWORDS.has(key), [...path59, key]));
121298
+ setOwn(result, key, mapJsonSchemaRefs(val, map2, !JSON_SCHEMA_RECORD_KEYWORDS.has(key), [...path61, key]));
121279
121299
  } else {
121280
121300
  setOwn(result, key, val);
121281
121301
  }
@@ -121805,7 +121825,7 @@ function unlazy(maybeLazy) {
121805
121825
  function createProcedureClient(lazyableProcedure, ...rest) {
121806
121826
  const options = resolveMaybeOptionalOptions(rest);
121807
121827
  return async (...[input2, callerOptions]) => {
121808
- const path59 = toArray(options.path);
121828
+ const path61 = toArray(options.path);
121809
121829
  const { default: procedure } = await unlazy(lazyableProcedure);
121810
121830
  const clientContext = callerOptions?.context ?? {};
121811
121831
  const context = await value(options.context, clientContext) ?? {};
@@ -121818,7 +121838,7 @@ function createProcedureClient(lazyableProcedure, ...rest) {
121818
121838
  };
121819
121839
  try {
121820
121840
  const output2 = await runWithSpan("call_procedure", (span) => {
121821
- span?.setAttribute("procedure.path", path59);
121841
+ span?.setAttribute("procedure.path", path61);
121822
121842
  return intercept(
121823
121843
  options.interceptors,
121824
121844
  {
@@ -121826,7 +121846,7 @@ function createProcedureClient(lazyableProcedure, ...rest) {
121826
121846
  // input can be optional if it is undefinable
121827
121847
  input: input2,
121828
121848
  errors,
121829
- path: path59,
121849
+ path: path61,
121830
121850
  procedure,
121831
121851
  signal: callerOptions?.signal,
121832
121852
  lastEventId: callerOptions?.lastEventId
@@ -122077,10 +122097,10 @@ function augmentRouter(router, options) {
122077
122097
  }
122078
122098
  return enhanced;
122079
122099
  }
122080
- function getRouter(router, path59) {
122100
+ function getRouter(router, path61) {
122081
122101
  let current = router;
122082
- for (let i10 = 0; i10 < path59.length; i10++) {
122083
- const segment = path59[i10];
122102
+ for (let i10 = 0; i10 < path61.length; i10++) {
122103
+ const segment = path61[i10];
122084
122104
  if (!isTypescriptObject(current)) {
122085
122105
  return void 0;
122086
122106
  }
@@ -122092,7 +122112,7 @@ function getRouter(router, path59) {
122092
122112
  continue;
122093
122113
  }
122094
122114
  const lazied = current;
122095
- const rest = path59.slice(i10);
122115
+ const rest = path61.slice(i10);
122096
122116
  return new Lazy({
122097
122117
  ...lazied["~orpc"],
122098
122118
  async loader() {
@@ -122107,40 +122127,40 @@ function getRouter(router, path59) {
122107
122127
  }
122108
122128
  return current;
122109
122129
  }
122110
- function walkProcedureContractsSync(router, callback, path59 = []) {
122130
+ function walkProcedureContractsSync(router, callback, path61 = []) {
122111
122131
  const lazyResults = [];
122112
- walkProcedureContractsSyncInternal(router, callback, path59.slice(), lazyResults);
122132
+ walkProcedureContractsSyncInternal(router, callback, path61.slice(), lazyResults);
122113
122133
  return lazyResults;
122114
122134
  }
122115
- function walkProcedureContractsSyncInternal(router, callback, path59, lazyResults) {
122135
+ function walkProcedureContractsSyncInternal(router, callback, path61, lazyResults) {
122116
122136
  const hiddenContract = getHiddenRouterContract(router);
122117
122137
  if (hiddenContract !== void 0) {
122118
122138
  router = hiddenContract;
122119
122139
  }
122120
122140
  if (router instanceof ProcedureContract) {
122121
- callback(router, path59.slice());
122141
+ callback(router, path61.slice());
122122
122142
  return;
122123
122143
  }
122124
122144
  if (!isTypescriptObject(router)) {
122125
122145
  return;
122126
122146
  }
122127
122147
  for (const [key, value2] of Object.entries(router)) {
122128
- path59.push(key);
122148
+ path61.push(key);
122129
122149
  if (value2 instanceof Lazy) {
122130
- lazyResults.push({ router: value2, path: path59.slice() });
122150
+ lazyResults.push({ router: value2, path: path61.slice() });
122131
122151
  } else {
122132
- walkProcedureContractsSyncInternal(value2, callback, path59, lazyResults);
122152
+ walkProcedureContractsSyncInternal(value2, callback, path61, lazyResults);
122133
122153
  }
122134
- path59.pop();
122154
+ path61.pop();
122135
122155
  }
122136
122156
  }
122137
- async function walkProcedureContractsAsync(router, callback, path59 = []) {
122157
+ async function walkProcedureContractsAsync(router, callback, path61 = []) {
122138
122158
  const hiddenContract = getHiddenRouterContract(router);
122139
122159
  if (hiddenContract !== void 0) {
122140
122160
  router = hiddenContract;
122141
122161
  }
122142
122162
  if (router instanceof ProcedureContract) {
122143
- await callback(router, path59);
122163
+ await callback(router, path61);
122144
122164
  return;
122145
122165
  }
122146
122166
  if (!isTypescriptObject(router)) {
@@ -122149,9 +122169,9 @@ async function walkProcedureContractsAsync(router, callback, path59 = []) {
122149
122169
  for (const [key, value2] of Object.entries(router)) {
122150
122170
  if (value2 instanceof Lazy) {
122151
122171
  const { default: router2 } = await unlazy(value2);
122152
- await walkProcedureContractsAsync(router2, callback, [...path59, key]);
122172
+ await walkProcedureContractsAsync(router2, callback, [...path61, key]);
122153
122173
  } else {
122154
- await walkProcedureContractsAsync(value2, callback, [...path59, key]);
122174
+ await walkProcedureContractsAsync(value2, callback, [...path61, key]);
122155
122175
  }
122156
122176
  }
122157
122177
  }
@@ -122637,18 +122657,18 @@ function rewriteComponentSchemaRefs(schema, renameMap) {
122637
122657
  }
122638
122658
  var OpenAPIGeneratorError = class extends TypeError {
122639
122659
  };
122640
- function toOpenAPIPath(path59, dynamicPathParams) {
122660
+ function toOpenAPIPath(path61, dynamicPathParams) {
122641
122661
  if (!dynamicPathParams?.length) {
122642
- return path59;
122662
+ return path61;
122643
122663
  }
122644
122664
  let normalized = "";
122645
122665
  let currentIndex = 0;
122646
122666
  for (const param of dynamicPathParams) {
122647
- normalized += path59.slice(currentIndex, param.startIndex);
122667
+ normalized += path61.slice(currentIndex, param.startIndex);
122648
122668
  normalized += `{${param.parameterName}}`;
122649
122669
  currentIndex = param.startIndex + param.segment.length;
122650
122670
  }
122651
- normalized += path59.slice(currentIndex);
122671
+ normalized += path61.slice(currentIndex);
122652
122672
  return normalized;
122653
122673
  }
122654
122674
  function buildRequest(ctx, operation, def, meta3, dynamicPathParams) {
@@ -123082,8 +123102,8 @@ var OpenAPIGenerator = class {
123082
123102
  customErrorResponseBodySchema: options.customErrorResponseBodySchema
123083
123103
  };
123084
123104
  const errors = [];
123085
- await walkProcedureContractsAsync(router, (contract, path59) => {
123086
- if (value(options.filter, contract, path59) === false) {
123105
+ await walkProcedureContractsAsync(router, (contract, path61) => {
123106
+ if (value(options.filter, contract, path61) === false) {
123087
123107
  return;
123088
123108
  }
123089
123109
  try {
@@ -123095,7 +123115,7 @@ var OpenAPIGenerator = class {
123095
123115
  `QUERY operations require OpenAPI 3.2, but version "${version2}" was requested.`
123096
123116
  );
123097
123117
  }
123098
- const postPath = meta3?.path ?? pathToHttpPath(path59);
123118
+ const postPath = meta3?.path ?? pathToHttpPath(path61);
123099
123119
  const httpPath = meta3?.prefix ? mergeHttpPath(meta3.prefix, postPath) : postPath;
123100
123120
  const dynamicPathParams = getDynamicPathParams(httpPath);
123101
123121
  const openApiPath = toOpenAPIPath(httpPath, dynamicPathParams);
@@ -123104,7 +123124,7 @@ var OpenAPIGenerator = class {
123104
123124
  operation = meta3.spec;
123105
123125
  } else {
123106
123126
  operation = {
123107
- operationId: meta3?.operationId ?? path59.join("."),
123127
+ operationId: meta3?.operationId ?? path61.join("."),
123108
123128
  summary: meta3?.summary,
123109
123129
  description: meta3?.description,
123110
123130
  deprecated: meta3?.deprecated,
@@ -123124,7 +123144,7 @@ var OpenAPIGenerator = class {
123124
123144
  if (!(e14 instanceof OpenAPIGeneratorError)) {
123125
123145
  throw e14;
123126
123146
  }
123127
- errors.push(`Procedure at ${path59.join(".") || "(root)"}: ${e14.message}`);
123147
+ errors.push(`Procedure at ${path61.join(".") || "(root)"}: ${e14.message}`);
123128
123148
  }
123129
123149
  });
123130
123150
  if (errors.length) {
@@ -123969,16 +123989,16 @@ var StandardLink = class {
123969
123989
  /**
123970
123990
  * @throws ORPCError, transport-level errors (network failures, timeouts, etc.)
123971
123991
  */
123972
- call(path59, input2, options) {
123973
- return runWithSpan(`${ORPC_NAME}.${path59.join("/")}`, (span) => {
123992
+ call(path61, input2, options) {
123993
+ return runWithSpan(`${ORPC_NAME}.${path61.join("/")}`, (span) => {
123974
123994
  span?.setAttribute("rpc.system", ORPC_NAME);
123975
- span?.setAttribute("rpc.method", path59.join("."));
123995
+ span?.setAttribute("rpc.method", path61.join("."));
123976
123996
  if (getTracer() && isAsyncIteratorObject(input2)) {
123977
123997
  input2 = override(input2, traceAsyncIterator("consume_async_iterator_object_input", input2));
123978
123998
  } else if (getTracer() && input2 instanceof ReadableStream) {
123979
123999
  input2 = override(input2, traceReadableStream("consume_octet_stream_input", input2));
123980
124000
  }
123981
- return intercept(this.interceptors, { ...options, path: path59, input: input2 }, async ({ path: path210, input: input22, ...options2 }) => {
124001
+ return intercept(this.interceptors, { ...options, path: path61, input: input2 }, async ({ path: path210, input: input22, ...options2 }) => {
123982
124002
  const tracer = getTracer();
123983
124003
  const activeSpan = tracer?.getActiveSpan() ?? span;
123984
124004
  let request7 = await runWithSpan(
@@ -124035,18 +124055,18 @@ var RPCLinkCodec = class {
124035
124055
  this.headers = options.headers ?? {};
124036
124056
  this.serializer = options.serializer ?? new RPCSerializer();
124037
124057
  }
124038
- async encodeInput(input2, path59, options) {
124039
- let headers = toResolvedStandardHeaders(await value(this.headers, options, path59, input2));
124058
+ async encodeInput(input2, path61, options) {
124059
+ let headers = toResolvedStandardHeaders(await value(this.headers, options, path61, input2));
124040
124060
  if (options.lastEventId !== void 0) {
124041
124061
  headers = mergeStandardHeaders(headers, { "last-event-id": options.lastEventId });
124042
124062
  }
124043
- const expectedMethod = await value(this.expectedMethod, options, path59, input2);
124044
- const baseUrl = await value(this.baseUrl, options, path59, input2);
124063
+ const expectedMethod = await value(this.expectedMethod, options, path61, input2);
124064
+ const baseUrl = await value(this.baseUrl, options, path61, input2);
124045
124065
  const [pathname, search, hash2] = parseStandardUrl(baseUrl);
124046
- const newPathname = `${pathname.replace(END_SLASH_REGEX, "")}${pathToHttpPath(path59)}`;
124066
+ const newPathname = `${pathname.replace(END_SLASH_REGEX, "")}${pathToHttpPath(path61)}`;
124047
124067
  const serialized = this.serializer.serialize(input2);
124048
124068
  if (expectedMethod === "GET" && !(serialized instanceof Blob) && !(serialized instanceof ReadableStream) && !(serialized instanceof FormData) && !isAsyncIteratorObject(serialized)) {
124049
- const maxUrlLength = await value(this.maxUrlLength, options, path59, input2);
124069
+ const maxUrlLength = await value(this.maxUrlLength, options, path61, input2);
124050
124070
  const mergedSearch = new URLSearchParams(search);
124051
124071
  mergedSearch.append("data", stringifyJSON(serialized) ?? "");
124052
124072
  const url22 = `${newPathname}?${mergedSearch}${hash2 ?? ""}`;
@@ -124131,8 +124151,8 @@ var FetchLinkTransport = class {
124131
124151
  this.fetch = options.fetch ?? ((url2, init) => globalThis.fetch(url2, init));
124132
124152
  this.toFetchRequestOptions = options.toFetchRequest;
124133
124153
  }
124134
- async send(standardRequest, path59, options) {
124135
- let origin = await value(this.origin, options, path59);
124154
+ async send(standardRequest, path61, options) {
124155
+ let origin = await value(this.origin, options, path61);
124136
124156
  if (origin?.endsWith("/")) {
124137
124157
  origin = origin.slice(0, -1);
124138
124158
  }
@@ -124152,7 +124172,7 @@ var FetchLinkTransport = class {
124152
124172
  }
124153
124173
  }
124154
124174
  const fetch3 = this.fetch;
124155
- const response = await fetch3(url2, init, options, path59);
124175
+ const response = await fetch3(url2, init, options, path61);
124156
124176
  const standardResponse = toStandardLazyResponse(response);
124157
124177
  return standardResponse;
124158
124178
  }
@@ -124543,14 +124563,14 @@ var StandardHandler = class {
124543
124563
  span?.setAttribute("url.path", request22.url);
124544
124564
  return { matched: false };
124545
124565
  }
124546
- const { path: path59, procedure, decodeInput } = matchedOrNot;
124547
- span?.updateName(`${ORPC_NAME}.${path59.join("/")}`);
124566
+ const { path: path61, procedure, decodeInput } = matchedOrNot;
124567
+ span?.updateName(`${ORPC_NAME}.${path61.join("/")}`);
124548
124568
  span?.setAttribute("rpc.system", ORPC_NAME);
124549
- span?.setAttribute("rpc.method", path59.join("."));
124569
+ span?.setAttribute("rpc.method", path61.join("."));
124550
124570
  try {
124551
124571
  const response = await intercept(
124552
124572
  this.interceptors,
124553
- { context: context2, prefix: prefix2, request: request22, path: path59, procedure, decodeInput },
124573
+ { context: context2, prefix: prefix2, request: request22, path: path61, procedure, decodeInput },
124554
124574
  async ({ context: context3, prefix: prefix3, request: request32, path: path210, procedure: procedure2, decodeInput: decodeInput2 }) => {
124555
124575
  step2 = "decode_input";
124556
124576
  let input2 = await runWithSpan("decode_input", decodeInput2);
@@ -124584,7 +124604,7 @@ var StandardHandler = class {
124584
124604
  message: `Malformed request. Ensure the request body is properly formatted and the 'Content-Type' header is set correctly.`,
124585
124605
  cause: e14
124586
124606
  }) : toORPCError(e14);
124587
- const response = await this.codec.encodeError(error63, procedure, path59, { context: context2, prefix: prefix2 });
124607
+ const response = await this.codec.encodeError(error63, procedure, path61, { context: context2, prefix: prefix2 });
124588
124608
  return { matched: true, response };
124589
124609
  }
124590
124610
  }
@@ -124690,7 +124710,7 @@ var RPCMatcher = class {
124690
124710
  this.rootRouter = router;
124691
124711
  this.index(router);
124692
124712
  }
124693
- index(router, path59 = []) {
124713
+ index(router, path61 = []) {
124694
124714
  const lazyResults = walkProcedureContractsSync(router, (procedure, procedurePath) => {
124695
124715
  if (!value(this.filter, procedure, procedurePath)) {
124696
124716
  return;
@@ -124701,7 +124721,7 @@ var RPCMatcher = class {
124701
124721
  // contract-first entries have no implementation yet, resolveProcedure fills it in on demand
124702
124722
  procedure: procedure instanceof Procedure ? procedure : void 0
124703
124723
  });
124704
- }, path59);
124724
+ }, path61);
124705
124725
  for (const result of lazyResults) {
124706
124726
  this.pendingLazyRouters.set(pathToHttpPath(result.path), result);
124707
124727
  }
@@ -124833,10 +124853,10 @@ var RPCHandlerCodec = class {
124833
124853
  }
124834
124854
  };
124835
124855
  }
124836
- encodeOutput(output2, procedure, path59, options) {
124856
+ encodeOutput(output2, procedure, path61, options) {
124837
124857
  return {
124838
124858
  headers: {},
124839
- status: value(this.outputStatus, output2, procedure, path59, options) ?? DEFAULT_SUCCESS_STATUS,
124859
+ status: value(this.outputStatus, output2, procedure, path61, options) ?? DEFAULT_SUCCESS_STATUS,
124840
124860
  body: this.serializer.serialize(output2)
124841
124861
  };
124842
124862
  }
@@ -124890,39 +124910,39 @@ function createRouter() {
124890
124910
  static: new NullProtoObj2()
124891
124911
  };
124892
124912
  }
124893
- function scanFirstGroup(path59) {
124913
+ function scanFirstGroup(path61) {
124894
124914
  let i10 = 0;
124895
124915
  let depth = 0;
124896
- for (; i10 < path59.length; i10++) {
124897
- const c10 = path59.charCodeAt(i10);
124916
+ for (; i10 < path61.length; i10++) {
124917
+ const c10 = path61.charCodeAt(i10);
124898
124918
  if (c10 === 92) i10++;
124899
124919
  else if (c10 === 40) depth++;
124900
124920
  else if (c10 === 41 && depth > 0) depth--;
124901
124921
  else if (c10 === 123 && depth === 0) break;
124902
124922
  }
124903
- if (i10 >= path59.length) return;
124923
+ if (i10 >= path61.length) return;
124904
124924
  let j10 = i10 + 1;
124905
124925
  depth = 0;
124906
- for (; j10 < path59.length; j10++) {
124907
- const c10 = path59.charCodeAt(j10);
124926
+ for (; j10 < path61.length; j10++) {
124927
+ const c10 = path61.charCodeAt(j10);
124908
124928
  if (c10 === 92) j10++;
124909
124929
  else if (c10 === 40) depth++;
124910
124930
  else if (c10 === 41 && depth > 0) depth--;
124911
124931
  else if (c10 === 125 && depth === 0) break;
124912
124932
  }
124913
- if (j10 >= path59.length) return;
124914
- const mod = path59[j10 + 1];
124933
+ if (j10 >= path61.length) return;
124934
+ const mod = path61[j10 + 1];
124915
124935
  const hasMod = mod === "?" || mod === "+" || mod === "*";
124916
124936
  return [
124917
- path59.slice(0, i10),
124918
- path59.slice(i10 + 1, j10),
124919
- path59.slice(j10 + (hasMod ? 2 : 1)),
124937
+ path61.slice(0, i10),
124938
+ path61.slice(i10 + 1, j10),
124939
+ path61.slice(j10 + (hasMod ? 2 : 1)),
124920
124940
  hasMod ? mod : void 0
124921
124941
  ];
124922
124942
  }
124923
- function expandGroupDelimiters(path59) {
124924
- if (!path59.includes("{")) return;
124925
- const group = scanFirstGroup(path59);
124943
+ function expandGroupDelimiters(path61) {
124944
+ if (!path61.includes("{")) return;
124945
+ const group = scanFirstGroup(path61);
124926
124946
  if (!group) return;
124927
124947
  const [pre2, body, suf, mod] = group;
124928
124948
  if (!mod) return [pre2 + body + suf];
@@ -124992,9 +125012,9 @@ function replaceSegmentWildcards(segment, unnamedStart, toGroupKey = toUnnamedGr
124992
125012
  }
124993
125013
  return [replaced, nextIndex];
124994
125014
  }
124995
- function encodeEscapes(path59) {
124996
- if (!path59.includes("\\")) return path59;
124997
- return path59.replace(/\\([:(){}])/g, (_, c10) => "\uFFFD" + "ABCDE"[":(){}".indexOf(c10)]);
125015
+ function encodeEscapes(path61) {
125016
+ if (!path61.includes("\\")) return path61;
125017
+ return path61.replace(/\\([:(){}])/g, (_, c10) => "\uFFFD" + "ABCDE"[":(){}".indexOf(c10)]);
124998
125018
  }
124999
125019
  function segmentKey(segment) {
125000
125020
  if (segment.startsWith("**")) return 2;
@@ -125023,22 +125043,22 @@ function expandModifiers(segments) {
125023
125043
  return m10[2] === "+" ? [wc2] : [wc2, without];
125024
125044
  }
125025
125045
  }
125026
- function normalizePath(path59) {
125027
- if (!path59.includes("/.")) return path59;
125046
+ function normalizePath(path61) {
125047
+ if (!path61.includes("/.")) return path61;
125028
125048
  const r10 = [];
125029
- for (const s of path59.split("/")) if (s === ".") continue;
125049
+ for (const s of path61.split("/")) if (s === ".") continue;
125030
125050
  else if (s === ".." && r10.length > 1) r10.pop();
125031
125051
  else r10.push(s);
125032
125052
  return r10.join("/") || "/";
125033
125053
  }
125034
- function splitPath(path59) {
125035
- const s = path59.split("/");
125054
+ function splitPath(path61) {
125055
+ const s = path61.split("/");
125036
125056
  s.shift();
125037
125057
  if (s[s.length - 1] === "") s.pop();
125038
125058
  return s;
125039
125059
  }
125040
- function splitRoute(path59) {
125041
- const s = splitPath(path59);
125060
+ function splitRoute(path61) {
125061
+ const s = splitPath(path61);
125042
125062
  while (s[s.length - 1] === "") s.pop();
125043
125063
  return s;
125044
125064
  }
@@ -125054,16 +125074,16 @@ function getMatchParams(segments, paramsMap) {
125054
125074
  }
125055
125075
  return params;
125056
125076
  }
125057
- function addRoute(ctx, method = "", path59, data) {
125077
+ function addRoute(ctx, method = "", path61, data) {
125058
125078
  method = method.toUpperCase();
125059
- if (path59.charCodeAt(0) !== 47) path59 = `/${path59}`;
125060
- const groupExpanded = expandGroupDelimiters(path59);
125079
+ if (path61.charCodeAt(0) !== 47) path61 = `/${path61}`;
125080
+ const groupExpanded = expandGroupDelimiters(path61);
125061
125081
  if (groupExpanded) {
125062
125082
  for (const expandedPath of groupExpanded) addRoute(ctx, method, expandedPath, data);
125063
125083
  return;
125064
125084
  }
125065
- path59 = encodeEscapes(path59);
125066
- const segments = splitRoute(path59);
125085
+ path61 = encodeEscapes(path61);
125086
+ const segments = splitRoute(path61);
125067
125087
  const expanded = expandModifiers(segments);
125068
125088
  if (expanded) {
125069
125089
  for (const p of expanded) addRoute(ctx, method, p, data);
@@ -125154,15 +125174,15 @@ function getParamRegexp(segment, unnamedStart = 0) {
125154
125174
  const regex = _s2.replace(/:([\w-]+)(?:\(([^)]*)\))?/g, (_, id2, p) => `(?<${toGroupName(id2)}>${p || "[^/]+"})`).replace(/\((?![?<])/g, () => `(?<${toUnnamedGroupKey(_i2++)}>`).replace(/\uFFFE(.)/g, (_, c10) => /[.*+?^${}()|[\]\\]/.test(c10) ? `\\${c10}` : c10);
125155
125175
  return [new RegExp(`^${regex}$`), _i2];
125156
125176
  }
125157
- function findRoute(ctx, method = "", path59, opts) {
125158
- if (opts?.normalize) path59 = normalizePath(path59);
125159
- if (path59.charCodeAt(path59.length - 1) === 47) path59 = path59.slice(0, -1);
125160
- const staticNode = ctx.static[path59];
125177
+ function findRoute(ctx, method = "", path61, opts) {
125178
+ if (opts?.normalize) path61 = normalizePath(path61);
125179
+ if (path61.charCodeAt(path61.length - 1) === 47) path61 = path61.slice(0, -1);
125180
+ const staticNode = ctx.static[path61];
125161
125181
  if (staticNode && staticNode.methods) {
125162
125182
  const staticMatch = staticNode.methods[method] || staticNode.methods[""];
125163
125183
  if (staticMatch !== void 0) return staticMatch[0];
125164
125184
  }
125165
- const segments = splitPath(path59);
125185
+ const segments = splitPath(path61);
125166
125186
  const match = _lookupTree(ctx.root, method, segments, 0);
125167
125187
  if (match === void 0) return;
125168
125188
  if (opts?.params === false) return match;
@@ -125362,7 +125382,7 @@ var OpenAPIMatcher = class {
125362
125382
  this.rootRouter = router;
125363
125383
  this.index(router);
125364
125384
  }
125365
- index(router, path59 = []) {
125385
+ index(router, path61 = []) {
125366
125386
  const lazyResults = walkProcedureContractsSync(router, (contract, path210) => {
125367
125387
  if (!value(this.filter, contract, path210)) {
125368
125388
  return;
@@ -125377,7 +125397,7 @@ var OpenAPIMatcher = class {
125377
125397
  contract,
125378
125398
  procedure: contract instanceof Procedure ? contract : void 0
125379
125399
  });
125380
- }, path59);
125400
+ }, path61);
125381
125401
  for (const result of lazyResults) {
125382
125402
  const prefix = getOpenAPIMeta(result.router)?.prefix;
125383
125403
  this.pendingLazyRouters.add({
@@ -125464,20 +125484,20 @@ var OpenAPIMatcher = class {
125464
125484
  return entry.procedure;
125465
125485
  }
125466
125486
  };
125467
- function toRou3Pattern(path59) {
125468
- const params = getDynamicPathParams(path59);
125487
+ function toRou3Pattern(path61) {
125488
+ const params = getDynamicPathParams(path61);
125469
125489
  if (!params?.length) {
125470
- return path59;
125490
+ return path61;
125471
125491
  }
125472
125492
  for (let i10 = params.length - 1; i10 >= 0; i10--) {
125473
125493
  const param = params[i10];
125474
125494
  const pattern = param.allowsSlash ? `**:${param.parameterName}` : `:${param.parameterName}`;
125475
- path59 = path59.slice(0, param.startIndex) + pattern + path59.slice(param.startIndex + param.segment.length);
125495
+ path61 = path61.slice(0, param.startIndex) + pattern + path61.slice(param.startIndex + param.segment.length);
125476
125496
  }
125477
- return path59;
125497
+ return path61;
125478
125498
  }
125479
- function toRou3PrefixMatcher(path59) {
125480
- const pattern = toRou3Pattern(path59);
125499
+ function toRou3PrefixMatcher(path61) {
125500
+ const pattern = toRou3Pattern(path61);
125481
125501
  return routeToRegExp(pattern === "/" ? "/**" : `${pattern}/**`);
125482
125502
  }
125483
125503
  function decodeParams(params) {
@@ -125556,7 +125576,7 @@ var OpenAPIHandlerCodecCore = class {
125556
125576
  /**
125557
125577
  * @throws {TypeError} If `outputStructure` is "detailed" and the output doesn't match the expected structure.
125558
125578
  */
125559
- encodeOutput(output2, procedure, path59) {
125579
+ encodeOutput(output2, procedure, path61) {
125560
125580
  const meta3 = getOpenAPIMeta(procedure);
125561
125581
  const successStatus = meta3?.successStatus ?? DEFAULT_SUCCESS_STATUS;
125562
125582
  const outputStructure = meta3?.outputStructure ?? DEFAULT_OPENAPI_OUTPUT_STRUCTURE;
@@ -125569,7 +125589,7 @@ var OpenAPIHandlerCodecCore = class {
125569
125589
  }
125570
125590
  if (!isValidDetailedOutput(output2)) {
125571
125591
  throw new TypeError(`
125572
- Invalid "detailed" output structure returned by procedure (${path59.join(".")}):
125592
+ Invalid "detailed" output structure returned by procedure (${path61.join(".")}):
125573
125593
  \u2022 Expected an object with optional properties:
125574
125594
  - status (number <400)
125575
125595
  - headers (object)
@@ -126122,7 +126142,7 @@ function profileValue(name, paths) {
126122
126142
  function createConfigApiRouter(deps) {
126123
126143
  const authed = doorApiAuth(deps.expectedToken);
126124
126144
  const { paths } = deps;
126125
- const route = (path59, summary) => authed.meta(openapi({ method: "POST", path: path59, summary, tags: [CONFIG_API_TAG] }));
126145
+ const route = (path61, summary) => authed.meta(openapi({ method: "POST", path: path61, summary, tags: [CONFIG_API_TAG] }));
126126
126146
  return {
126127
126147
  config: {
126128
126148
  identity: {
@@ -128071,6 +128091,13 @@ function findBucket(quota, keys) {
128071
128091
  }
128072
128092
  return void 0;
128073
128093
  }
128094
+ function selectAntigravityBuckets(quota, model) {
128095
+ const isGemini = (model ?? "").toLowerCase().includes("gemini");
128096
+ return {
128097
+ fiveHour: findBucket(quota, isGemini ? GEMINI_5H_KEYS : THIRD_PARTY_5H_KEYS),
128098
+ weekly: findBucket(quota, isGemini ? GEMINI_WEEKLY_KEYS : THIRD_PARTY_WEEKLY_KEYS)
128099
+ };
128100
+ }
128074
128101
  function calculateUtilization(remainingFraction) {
128075
128102
  if (remainingFraction === void 0 || !Number.isFinite(remainingFraction)) {
128076
128103
  return void 0;
@@ -128103,13 +128130,7 @@ function parseRetryAfterSeconds(raw, defaultSeconds = DEFAULT_RETRY_AFTER_SECOND
128103
128130
  function unifiedAntigravityQuotaHeaders(params) {
128104
128131
  const rejected = params.rejected === true;
128105
128132
  const nowSec = Math.floor(params.nowMs / MS_PER_SECOND8);
128106
- const modelLower = (params.model ?? "").toLowerCase();
128107
- const isGemini = modelLower.includes("gemini");
128108
- const fiveHourKeys = isGemini ? GEMINI_5H_KEYS : THIRD_PARTY_5H_KEYS;
128109
- const weeklyKeys = isGemini ? GEMINI_WEEKLY_KEYS : THIRD_PARTY_WEEKLY_KEYS;
128110
- const quota = params.quota ?? {};
128111
- const b5h = findBucket(quota, fiveHourKeys);
128112
- const bWk = findBucket(quota, weeklyKeys);
128133
+ const { fiveHour: b5h, weekly: bWk } = selectAntigravityBuckets(params.quota ?? {}, params.model);
128113
128134
  const used5h = calculateUtilization(b5h?.remaining_fraction);
128114
128135
  const reset5h = calculateResetTimestamp(nowSec, b5h?.reset_in_seconds);
128115
128136
  const used7d = calculateUtilization(bWk?.remaining_fraction);
@@ -128820,8 +128841,8 @@ function createCodexRouteMount(ports, upstreamBase, provider) {
128820
128841
  request7.body.resume();
128821
128842
  return;
128822
128843
  }
128823
- const path59 = new URL(request7.url, "http://127.0.0.1").pathname;
128824
- const translated = { method: request7.method, path: path59, body, signal: request7.signal };
128844
+ const path61 = new URL(request7.url, "http://127.0.0.1").pathname;
128845
+ const translated = { method: request7.method, path: path61, body, signal: request7.signal };
128825
128846
  const routed = await route(translated);
128826
128847
  if (request7.signal.aborted) {
128827
128848
  return;
@@ -129421,8 +129442,8 @@ function createAntigravityRouteMount(ports, upstreamBase, provider) {
129421
129442
  request7.body.resume();
129422
129443
  return;
129423
129444
  }
129424
- const path59 = new URL(request7.url, "http://127.0.0.1").pathname;
129425
- const translated = { method: request7.method, path: path59, body, signal: request7.signal };
129445
+ const path61 = new URL(request7.url, "http://127.0.0.1").pathname;
129446
+ const translated = { method: request7.method, path: path61, body, signal: request7.signal };
129426
129447
  const routed = await route(translated);
129427
129448
  if (request7.signal.aborted) {
129428
129449
  return;
@@ -129456,7 +129477,7 @@ function createPassthroughRoute(name, target) {
129456
129477
  headroomUpstream: target.headroomUpstream,
129457
129478
  serve: async (request7, response) => {
129458
129479
  const incoming = new URL(request7.url, "http://127.0.0.1");
129459
- const path59 = target.stripPrefix !== void 0 && incoming.pathname.startsWith(target.stripPrefix) ? incoming.pathname.slice(target.stripPrefix.length) : incoming.pathname;
129480
+ const path61 = target.stripPrefix !== void 0 && incoming.pathname.startsWith(target.stripPrefix) ? incoming.pathname.slice(target.stripPrefix.length) : incoming.pathname;
129460
129481
  const headers = forwardableHeaders(request7.headers);
129461
129482
  delete headers.host;
129462
129483
  await new Promise((resolve2) => {
@@ -129464,7 +129485,7 @@ function createPassthroughRoute(name, target) {
129464
129485
  host: base.hostname,
129465
129486
  port: base.port === "" ? void 0 : Number(base.port),
129466
129487
  method: request7.method,
129467
- path: `${basePath}${path59}${incoming.search}`,
129488
+ path: `${basePath}${path61}${incoming.search}`,
129468
129489
  headers,
129469
129490
  agent
129470
129491
  };
@@ -129596,13 +129617,13 @@ async function scanRequestHead(request7, wholeBody = false) {
129596
129617
  }
129597
129618
 
129598
129619
  // src/frontdoor/providerRoute.ts
129599
- var isRcSelfHostPath = (path59) => path59 === "/v1/code/sessions" || path59.startsWith("/v1/code/sessions/") || path59 === "/v1/sessions" || path59.startsWith("/v1/sessions/");
129620
+ var isRcSelfHostPath = (path61) => path61 === "/v1/code/sessions" || path61.startsWith("/v1/code/sessions/") || path61 === "/v1/sessions" || path61.startsWith("/v1/sessions/");
129600
129621
  function scopeSessionProviderPath(request7) {
129601
129622
  if (request7.session.provider === void 0) {
129602
129623
  return request7;
129603
129624
  }
129604
- const path59 = new URL(request7.url, "http://127.0.0.1").pathname;
129605
- if (!path59.startsWith("/v1/") || isRcSelfHostPath(path59)) {
129625
+ const path61 = new URL(request7.url, "http://127.0.0.1").pathname;
129626
+ if (!path61.startsWith("/v1/") || isRcSelfHostPath(path61)) {
129606
129627
  return request7;
129607
129628
  }
129608
129629
  return { ...request7, url: `${PROVIDER_PATH_PREFIX}${encodeURIComponent(request7.session.provider)}${request7.url}` };
@@ -129645,13 +129666,13 @@ function createProviderRouteResolver(deps) {
129645
129666
  return route;
129646
129667
  };
129647
129668
  const resolve2 = (request7) => {
129648
- const path59 = new URL(request7.url, "http://127.0.0.1").pathname;
129649
- const scoped = parseProviderPath(path59);
129669
+ const path61 = new URL(request7.url, "http://127.0.0.1").pathname;
129670
+ const scoped = parseProviderPath(path61);
129650
129671
  if (scoped === void 0) {
129651
- if (deps.rcSelfHostRoute !== void 0 && isRcSelfHostPath(path59)) {
129672
+ if (deps.rcSelfHostRoute !== void 0 && isRcSelfHostPath(path61)) {
129652
129673
  return { ok: true, route: deps.rcSelfHostRoute };
129653
129674
  }
129654
- return path59.startsWith("/v1/") ? { ok: true, route: oauthRoute } : { ok: false, status: HTTP_STATUS.notFound, message: `no such endpoint: ${path59}` };
129675
+ return path61.startsWith("/v1/") ? { ok: true, route: oauthRoute } : { ok: false, status: HTTP_STATUS.notFound, message: `no such endpoint: ${path61}` };
129655
129676
  }
129656
129677
  const { provider } = scoped;
129657
129678
  let definition;
@@ -129737,8 +129758,8 @@ function createProviderRouteResolver(deps) {
129737
129758
  let replay;
129738
129759
  const visited = /* @__PURE__ */ new Set();
129739
129760
  for (; ; ) {
129740
- const path59 = new URL(current.url, "http://127.0.0.1").pathname;
129741
- const scoped = parseProviderPath(path59);
129761
+ const path61 = new URL(current.url, "http://127.0.0.1").pathname;
129762
+ const scoped = parseProviderPath(path61);
129742
129763
  const providerName = scoped?.provider ?? current.session.provider;
129743
129764
  if (providerName !== void 0 && visited.has(providerName)) {
129744
129765
  return { ok: false, status: HTTP_STATUS.internalServerError, message: `provider routing cycle: ${[...visited, providerName].join(" -> ")}` };
@@ -129796,7 +129817,7 @@ function createProviderRouteResolver(deps) {
129796
129817
  const headers = Object.fromEntries(Object.entries(replay.headers).filter(([name]) => name.toLowerCase() !== "content-length"));
129797
129818
  replay = { ...replay, headers, body: import_node_stream3.Readable.from([Buffer.from(rewritten, "utf8")]) };
129798
129819
  }
129799
- const rest = scoped === void 0 ? path59 : path59.slice(`${PROVIDER_PATH_PREFIX}${encodeURIComponent(scoped.provider)}`.length);
129820
+ const rest = scoped === void 0 ? path61 : path61.slice(`${PROVIDER_PATH_PREFIX}${encodeURIComponent(scoped.provider)}`.length);
129800
129821
  const query = current.url.includes("?") ? current.url.slice(current.url.indexOf("?")) : "";
129801
129822
  current = { ...current, url: `${PROVIDER_PATH_PREFIX}${encodeURIComponent(matched.provider)}${rest}${query}`, body: replay.body, headers: replay.headers };
129802
129823
  }
@@ -133251,12 +133272,36 @@ function registerFrontDoorCommand(program2, deps) {
133251
133272
 
133252
133273
  // src/statusline/commands.ts
133253
133274
  var import_node_child_process7 = require("node:child_process");
133275
+ var import_node_os12 = __toESM(require("node:os"), 1);
133276
+ var import_node_path53 = __toESM(require("node:path"), 1);
133254
133277
  init_commandDeps();
133278
+ init_providersStore();
133255
133279
  init_realPorts();
133280
+ init_account();
133256
133281
  init_read();
133257
133282
 
133283
+ // src/statusline/client.ts
133284
+ var import_node_path52 = __toESM(require("node:path"), 1);
133285
+ function isAntigravityPayload(payload) {
133286
+ return typeof payload === "object" && payload !== null && "product" in payload && payload.product === "antigravity";
133287
+ }
133288
+ var ANTIGRAVITY_SETTINGS_SEGMENTS = [".gemini", "antigravity-cli", "settings.json"];
133289
+ function antigravityStacksWithDefault(fs24, homeDir) {
133290
+ const raw = fs24.readFileUtf8(import_node_path52.default.join(homeDir, ...ANTIGRAVITY_SETTINGS_SEGMENTS));
133291
+ if (raw === void 0) {
133292
+ return false;
133293
+ }
133294
+ const settings2 = JSON.parse(raw);
133295
+ if (typeof settings2 !== "object" || settings2 === null || !("statusLine" in settings2)) {
133296
+ return false;
133297
+ }
133298
+ const statusLine = settings2.statusLine;
133299
+ return typeof statusLine === "object" && statusLine !== null && "stack_with_default" in statusLine && statusLine.stack_with_default === true;
133300
+ }
133301
+
133258
133302
  // src/statusline/enrich.ts
133259
133303
  var FULL_PERCENT = 100;
133304
+ var MS_PER_SECOND13 = 1e3;
133260
133305
  function identityOf(env) {
133261
133306
  const headers = env.ANTHROPIC_CUSTOM_HEADERS;
133262
133307
  if (headers !== void 0) {
@@ -133302,29 +133347,107 @@ function windowsOf(states) {
133302
133347
  }
133303
133348
  return { fiveHourUsed, fiveHourResetAt, sevenDayUsed, sevenDayResetAt };
133304
133349
  }
133350
+ function isObject4(value2) {
133351
+ return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
133352
+ }
133353
+ function payloadWindow(rateLimits, key) {
133354
+ const window = rateLimits[key];
133355
+ if (!isObject4(window) || typeof window.used_percentage !== "number" || !Number.isFinite(window.used_percentage)) {
133356
+ return void 0;
133357
+ }
133358
+ const resetsAt = window.resets_at;
133359
+ return {
133360
+ used: Math.min(FULL_PERCENT, Math.max(0, window.used_percentage)),
133361
+ resetAt: typeof resetsAt === "number" && Number.isFinite(resetsAt) ? new Date(resetsAt * MS_PER_SECOND13).toISOString() : void 0
133362
+ };
133363
+ }
133364
+ function payloadWindowsOf(payload) {
133365
+ const rateLimits = isObject4(payload) ? payload.rate_limits : void 0;
133366
+ const five = isObject4(rateLimits) ? payloadWindow(rateLimits, "five_hour") : void 0;
133367
+ const seven = isObject4(rateLimits) ? payloadWindow(rateLimits, "seven_day") : void 0;
133368
+ return { fiveHourUsed: five?.used, fiveHourResetAt: five?.resetAt, sevenDayUsed: seven?.used, sevenDayResetAt: seven?.resetAt };
133369
+ }
133370
+ function antigravityWindowsOf(payload, nowMs) {
133371
+ const quota = isObject4(payload) ? payload.quota : void 0;
133372
+ if (!isObject4(quota)) {
133373
+ return { fiveHourUsed: void 0, fiveHourResetAt: void 0, sevenDayUsed: void 0, sevenDayResetAt: void 0 };
133374
+ }
133375
+ const model = isObject4(payload) && isObject4(payload.model) && typeof payload.model.id === "string" ? payload.model.id : void 0;
133376
+ const buckets = Object.fromEntries(
133377
+ Object.entries(quota).flatMap(([key, bucket]) => {
133378
+ if (!isObject4(bucket)) {
133379
+ return [];
133380
+ }
133381
+ const remaining = bucket.remaining_fraction;
133382
+ const resetIn = bucket.reset_in_seconds;
133383
+ return [[key, { ...typeof remaining === "number" ? { remaining_fraction: remaining } : {}, ...typeof resetIn === "number" ? { reset_in_seconds: resetIn } : {} }]];
133384
+ })
133385
+ );
133386
+ const { fiveHour, weekly } = selectAntigravityBuckets(buckets, model);
133387
+ const windowOf2 = (bucket) => ({
133388
+ used: bucket?.remaining_fraction === void 0 || !Number.isFinite(bucket.remaining_fraction) ? void 0 : (1 - Math.min(1, Math.max(0, bucket.remaining_fraction))) * FULL_PERCENT,
133389
+ resetAt: bucket?.reset_in_seconds === void 0 || !Number.isFinite(bucket.reset_in_seconds) ? void 0 : new Date(nowMs + bucket.reset_in_seconds * MS_PER_SECOND13).toISOString()
133390
+ });
133391
+ const five = windowOf2(fiveHour);
133392
+ const seven = windowOf2(weekly);
133393
+ return { fiveHourUsed: five.used, fiveHourResetAt: five.resetAt, sevenDayUsed: seven.used, sevenDayResetAt: seven.resetAt };
133394
+ }
133305
133395
  function enrichStatuslinePayload(params) {
133306
133396
  const identity = identityOf(params.env);
133397
+ const clientEmail = isObject4(params.payload) && typeof params.payload.email === "string" && params.payload.email !== "" ? params.payload.email : void 0;
133398
+ const clientPlan = clientEmail !== void 0 && isObject4(params.payload) && typeof params.payload.plan_tier === "string" && params.payload.plan_tier !== "" ? params.payload.plan_tier : void 0;
133399
+ const account = clientEmail === void 0 ? params.account : void 0;
133307
133400
  let summary = {
133308
133401
  identity,
133309
133402
  provider: params.env.AGENT_SHIM_PROVIDER === void 0 || params.env.AGENT_SHIM_PROVIDER === "" ? void 0 : params.env.AGENT_SHIM_PROVIDER,
133310
133403
  providerAccountEmail: void 0,
133404
+ providerAccountSub: void 0,
133405
+ providerPlan: void 0,
133406
+ loginAccountEmail: clientEmail ?? account?.emailAddress,
133407
+ loginPlan: clientPlan,
133408
+ loginRateLimitTier: account?.userRateLimitTier ?? account?.organizationRateLimitTier,
133409
+ loginOrganizationName: account?.organizationName,
133410
+ loginOrganizationType: account?.organizationType,
133411
+ loginSeatTier: account?.seatTier === "none" ? void 0 : account?.seatTier,
133311
133412
  fiveHourUsed: void 0,
133312
133413
  fiveHourResetAt: void 0,
133313
133414
  sevenDayUsed: void 0,
133314
- sevenDayResetAt: void 0
133415
+ sevenDayResetAt: void 0,
133416
+ providerQuotaWindows: []
133315
133417
  };
133316
133418
  if (params.snapshot !== void 0) {
133317
- const scopedName = providerScopedState(params.snapshot, params.env.AGENT_SHIM_PROVIDER);
133419
+ const scopedName = providerScopedState(params.snapshot, params.providerName, params.env.AGENT_SHIM_PROVIDER);
133318
133420
  const scopedState = scopedName === void 0 ? void 0 : params.snapshot.providers[scopedName];
133319
- const states = scopedState === void 0 ? Object.values(params.snapshot.providers) : [scopedState];
133421
+ const states = summary.provider === void 0 ? Object.values(params.snapshot.providers) : scopedState === void 0 ? [] : [scopedState];
133320
133422
  let email3;
133423
+ let sub;
133424
+ let plan;
133321
133425
  for (const state of states) {
133322
- const candidate = state.quota?.account?.email;
133323
- if (email3 === void 0 && typeof candidate === "string" && candidate !== "") {
133324
- email3 = candidate;
133426
+ const providerAccount = state.quota?.account;
133427
+ const candidateEmail = providerAccount?.email;
133428
+ if (email3 === void 0 && typeof candidateEmail === "string" && candidateEmail !== "") {
133429
+ email3 = candidateEmail;
133430
+ }
133431
+ const candidateSub = providerAccount?.accountId;
133432
+ if (sub === void 0 && typeof candidateSub === "string" && candidateSub !== "") {
133433
+ sub = candidateSub;
133434
+ }
133435
+ const candidatePlan = state.quota?.level;
133436
+ if (plan === void 0 && typeof candidatePlan === "string" && candidatePlan !== "") {
133437
+ plan = candidatePlan;
133325
133438
  }
133326
133439
  }
133327
- summary = { ...summary, ...windowsOf(states), providerAccountEmail: email3 };
133440
+ const providerQuotaWindows = [...scopedState?.quota?.windows ?? []].sort((a10, b) => (a10.periodMs ?? Number.POSITIVE_INFINITY) - (b.periodMs ?? Number.POSITIVE_INFINITY)).map((window) => ({ measures: window.measures, utilization: window.utilization, resetsAt: window.resetsAt }));
133441
+ summary = { ...summary, ...windowsOf(states), providerAccountEmail: email3, providerAccountSub: sub, providerPlan: plan, providerQuotaWindows };
133442
+ }
133443
+ if (summary.provider === void 0) {
133444
+ for (const own2 of [antigravityWindowsOf(params.payload, params.nowMs), payloadWindowsOf(params.payload)]) {
133445
+ summary = {
133446
+ ...summary,
133447
+ ...own2.fiveHourUsed === void 0 ? {} : { fiveHourUsed: own2.fiveHourUsed, fiveHourResetAt: own2.fiveHourResetAt },
133448
+ ...own2.sevenDayUsed === void 0 ? {} : { sevenDayUsed: own2.sevenDayUsed, sevenDayResetAt: own2.sevenDayResetAt }
133449
+ };
133450
+ }
133328
133451
  }
133329
133452
  if (typeof params.payload !== "object" || params.payload === null || Array.isArray(params.payload)) {
133330
133453
  return { payload: params.payload, summary };
@@ -133335,7 +133458,10 @@ function enrichStatuslinePayload(params) {
133335
133458
  }
133336
133459
  return { payload: enriched, summary };
133337
133460
  }
133338
- function providerScopedState(snapshot, providerDisplayName) {
133461
+ function providerScopedState(snapshot, providerName, providerDisplayName) {
133462
+ if (providerName !== void 0 && providerName in snapshot.providers) {
133463
+ return providerName;
133464
+ }
133339
133465
  if (providerDisplayName === void 0 || providerDisplayName === "") {
133340
133466
  return void 0;
133341
133467
  }
@@ -133428,6 +133554,54 @@ function cacheShareText(view) {
133428
133554
  }
133429
133555
  return "";
133430
133556
  }
133557
+ function tierSuffixOf(tier) {
133558
+ const match = /_(\d+x)$/i.exec(tier ?? "");
133559
+ return match === null ? void 0 : match[1];
133560
+ }
133561
+ function accountPlanLabel(summary) {
133562
+ switch (summary.loginOrganizationType) {
133563
+ case void 0:
133564
+ return planLabelOf(summary.loginRateLimitTier);
133565
+ case "claude_max": {
133566
+ const tier = tierSuffixOf(summary.loginRateLimitTier);
133567
+ return tier === void 0 ? "Max" : `Max ${tier}`;
133568
+ }
133569
+ case "claude_pro":
133570
+ return "Pro";
133571
+ case "claude_team":
133572
+ if (summary.loginSeatTier === "team_standard") {
133573
+ return "Team Standard";
133574
+ }
133575
+ if (summary.loginSeatTier === "team_tier_1") {
133576
+ return "Team Premium";
133577
+ }
133578
+ return "Team";
133579
+ case "claude_enterprise":
133580
+ return "Enterprise";
133581
+ default:
133582
+ return summary.loginOrganizationType;
133583
+ }
133584
+ }
133585
+ function planLabelOf(tier) {
133586
+ if (tier === void 0 || tier === "") {
133587
+ return void 0;
133588
+ }
133589
+ const cleaned = tier.startsWith("default_") ? tier.slice("default_".length) : tier;
133590
+ if (cleaned === "free") {
133591
+ return "Free";
133592
+ }
133593
+ const maxWithMultiplier = /^claude_max_(\d+)x$/.exec(cleaned);
133594
+ if (maxWithMultiplier !== null) {
133595
+ return `Max ${maxWithMultiplier[1] ?? ""}x`;
133596
+ }
133597
+ if (cleaned === "claude_max") {
133598
+ return "Max";
133599
+ }
133600
+ if (cleaned === "claude_pro") {
133601
+ return "Pro";
133602
+ }
133603
+ return cleaned;
133604
+ }
133431
133605
  function secondsUntil(resetAt, nowMs) {
133432
133606
  if (resetAt === void 0) {
133433
133607
  return void 0;
@@ -133482,6 +133656,56 @@ function renderLineWithExtra(segments, maxWidth, separator, baseBarWidth) {
133482
133656
  }
133483
133657
  return segments.map((segment) => segment.render(baseBarWidth + (extraById.get(segment) ?? 0))).join(separator);
133484
133658
  }
133659
+ function justifySegments(segments, maxWidth, separator, baseBarWidth) {
133660
+ const rendered = segments.map((segment) => segment.render(baseBarWidth));
133661
+ if (segments.length < 2) {
133662
+ return rendered.join(separator);
133663
+ }
133664
+ const separatorLength = visibleLength(separator);
133665
+ const total = segments.reduce((sum, segment) => sum + segment.baseLength(baseBarWidth), 0) + separatorLength * (segments.length - 1);
133666
+ const spare = maxWidth - total;
133667
+ if (spare <= 0) {
133668
+ return rendered.join(separator);
133669
+ }
133670
+ const gaps = segments.length - 1;
133671
+ const extraPerGap = Math.floor(spare / gaps);
133672
+ let remainder = spare % gaps;
133673
+ const parts = [];
133674
+ segments.forEach((_, index) => {
133675
+ if (index > 0) {
133676
+ const extra = extraPerGap + (remainder > 0 ? 1 : 0);
133677
+ if (remainder > 0) {
133678
+ remainder -= 1;
133679
+ }
133680
+ const left = Math.floor(extra / 2);
133681
+ parts.push(`${" ".repeat(left + 1)}|${" ".repeat(extra - left + 1)}`);
133682
+ }
133683
+ parts.push(rendered[index] ?? "");
133684
+ });
133685
+ return parts.join("");
133686
+ }
133687
+ function packSegments(segments, maxWidth, separator, baseBarWidth, fillWrapped) {
133688
+ const separatorLength = visibleLength(separator);
133689
+ const lines = [];
133690
+ let current = [];
133691
+ let currentWidth = 0;
133692
+ for (const segment of segments) {
133693
+ const width = segment.baseLength(baseBarWidth);
133694
+ const added = current.length === 0 ? width : width + separatorLength;
133695
+ if (current.length > 0 && currentWidth + added > maxWidth) {
133696
+ lines.push(current);
133697
+ current = [segment];
133698
+ currentWidth = width;
133699
+ } else {
133700
+ current.push(segment);
133701
+ currentWidth += added;
133702
+ }
133703
+ }
133704
+ if (current.length > 0) {
133705
+ lines.push(current);
133706
+ }
133707
+ return lines.map((line) => fillWrapped ? renderLineWithExtra(line, maxWidth, separator, baseBarWidth) : justifySegments(line, maxWidth, separator, baseBarWidth));
133708
+ }
133485
133709
  function layoutGrouped(group1, group2, maxWidth, fillMode, separator, baseBarWidth) {
133486
133710
  const separatorLength = visibleLength(separator);
133487
133711
  const allSegments = [...group1, ...group2];
@@ -133495,7 +133719,7 @@ function layoutGrouped(group1, group2, maxWidth, fillMode, separator, baseBarWid
133495
133719
  if (fillUnwrapped) {
133496
133720
  return renderLineWithExtra(allSegments, maxWidth, separator, baseBarWidth);
133497
133721
  }
133498
- return allSegments.map((segment) => segment.render(baseBarWidth)).join(separator);
133722
+ return justifySegments(allSegments, maxWidth, separator, baseBarWidth);
133499
133723
  }
133500
133724
  const lines = [group1, group2].map((group) => {
133501
133725
  if (group.length === 0) {
@@ -133505,7 +133729,7 @@ function layoutGrouped(group1, group2, maxWidth, fillMode, separator, baseBarWid
133505
133729
  if (groupBase <= maxWidth) {
133506
133730
  return fillWrapped ? renderLineWithExtra(group, maxWidth, separator, baseBarWidth) : group.map((segment) => segment.render(baseBarWidth)).join(separator);
133507
133731
  }
133508
- return group.map((segment) => fillWrapped ? renderLineWithExtra([segment], maxWidth, separator, baseBarWidth) : segment.render(baseBarWidth)).join("\n");
133732
+ return packSegments(group, maxWidth, separator, baseBarWidth, fillWrapped).join("\n");
133509
133733
  });
133510
133734
  return lines.filter((line) => line !== "").join("\n");
133511
133735
  }
@@ -133514,6 +133738,21 @@ function renderStatuslineBlock(summary, view, terminalWidth, nowMs) {
133514
133738
  if (view.modelDisplayName !== void 0 && view.modelDisplayName !== "") {
133515
133739
  header.push(new Segment("static", view.modelDisplayName));
133516
133740
  }
133741
+ if (summary.provider !== void 0) {
133742
+ const account = [summary.providerAccountEmail, summary.providerPlan].filter((part) => part !== void 0);
133743
+ header.push(new Segment("static", account.length > 0 ? `${summary.provider} \xB7 ${account.join(" \xB7 ")}` : summary.provider));
133744
+ }
133745
+ const loginPlan = summary.provider === void 0 ? summary.loginPlan ?? accountPlanLabel(summary) : void 0;
133746
+ const loginOrgName = summary.loginOrganizationType === "claude_team" || summary.loginOrganizationType === "claude_enterprise" ? summary.loginOrganizationName : void 0;
133747
+ const loginParts = [summary.loginAccountEmail, loginOrgName, loginPlan].filter((part) => part !== void 0);
133748
+ if (summary.loginAccountEmail !== void 0 && summary.loginAccountEmail !== summary.providerAccountEmail) {
133749
+ header.push(new Segment("static", loginParts.join(" \xB7 ")));
133750
+ } else if (summary.provider === void 0 && loginParts.length > 0) {
133751
+ header.push(new Segment("static", loginParts.join(" \xB7 ")));
133752
+ }
133753
+ if (summary.identity !== void 0 && summary.provider !== void 0 && summary.identity !== summary.providerAccountEmail && summary.identity !== summary.loginAccountEmail) {
133754
+ header.push(new Segment("static", summary.identity));
133755
+ }
133517
133756
  const contextGroup = [];
133518
133757
  if (view.contextUsedPercentage !== void 0) {
133519
133758
  const fraction = Math.max(0, Math.min(1, view.contextUsedPercentage / FULL_PERCENT2));
@@ -133534,13 +133773,18 @@ function renderStatuslineBlock(summary, view, terminalWidth, nowMs) {
133534
133773
  const color = statusColor(fraction, true);
133535
133774
  quotaGroup.push(new Segment("bar", "", "Wk ", ` ${color}${summary.sevenDayUsed.toFixed(1)}%${RESET} (${formatDuration(secondsUntil(summary.sevenDayResetAt, nowMs))})`, fraction, true));
133536
133775
  }
133537
- if (summary.provider !== void 0) {
133538
- quotaGroup.push(new Segment("static", summary.providerAccountEmail === void 0 ? summary.provider : `${summary.provider} \xB7 ${summary.providerAccountEmail}`));
133776
+ if (summary.fiveHourUsed === void 0 && summary.sevenDayUsed === void 0) {
133777
+ for (const window of summary.providerQuotaWindows) {
133778
+ const used = window.utilization * FULL_PERCENT2;
133779
+ const fraction = Math.max(0, Math.min(1, window.utilization));
133780
+ const color = statusColor(fraction, true);
133781
+ quotaGroup.push(new Segment("bar", "", `${window.measures} `, ` ${color}${used.toFixed(1)}%${RESET} (${formatDuration(secondsUntil(window.resetsAt, nowMs))})`, fraction, true));
133782
+ }
133539
133783
  }
133540
133784
  const width = Math.max(TWENTY, terminalWidth - RESERVED_COLUMNS);
133541
133785
  const lines = [];
133542
133786
  if (header.length > 0) {
133543
- lines.push(header.map((segment) => segment.render(BAR_WIDTH)).join(SEPARATOR2));
133787
+ lines.push(layoutGrouped(header, [], width, "never", SEPARATOR2, BAR_WIDTH));
133544
133788
  }
133545
133789
  const body = layoutGrouped(contextGroup, quotaGroup, width, "always", SEPARATOR2, BAR_WIDTH);
133546
133790
  if (body !== "") {
@@ -133549,6 +133793,16 @@ function renderStatuslineBlock(summary, view, terminalWidth, nowMs) {
133549
133793
  return lines.join("\n");
133550
133794
  }
133551
133795
 
133796
+ // src/statusline/width.ts
133797
+ var DEFAULT_COLUMNS = 80;
133798
+ function terminalWidthOf(payload, env) {
133799
+ if (typeof payload === "object" && payload !== null && "terminal_width" in payload && typeof payload.terminal_width === "number" && Number.isFinite(payload.terminal_width) && payload.terminal_width > 0) {
133800
+ return Math.floor(payload.terminal_width);
133801
+ }
133802
+ const columns = Number.parseInt(env.COLUMNS ?? "", 10);
133803
+ return Number.isFinite(columns) && columns > 0 ? columns : DEFAULT_COLUMNS;
133804
+ }
133805
+
133552
133806
  // src/statusline/commands.ts
133553
133807
  function payloadViewOf(payload) {
133554
133808
  const empty = { modelDisplayName: void 0, contextUsedPercentage: void 0, contextTotalTokens: void 0, contextWindowTokens: void 0, cacheHitRatio: void 0, cacheReadTokens: void 0, freshInputTokens: void 0 };
@@ -133586,7 +133840,6 @@ async function readAllStdin() {
133586
133840
  process.stdin.resume();
133587
133841
  });
133588
133842
  }
133589
- var DEFAULT_COLUMNS = 80;
133590
133843
  function registerStatuslineCommand(program2, deps) {
133591
133844
  withExamples(
133592
133845
  program2.command("statusline").description("Serve as a statusline entrypoint: read the client's stdin payload, add the identity's live provider, account and usage windows under an agent_shim key, then run the renderer named in AGENT_SHIM_STATUSLINE_CMD or print the built-in line.").action(async () => {
@@ -133599,14 +133852,37 @@ function registerStatuslineCommand(program2, deps) {
133599
133852
  }
133600
133853
  const identity = identityOf(process.env);
133601
133854
  let snapshot;
133855
+ let account;
133602
133856
  if (identity !== void 0) {
133603
133857
  try {
133604
133858
  snapshot = readUsageSnapshot(realFarmFs, deps.paths.usageSnapshotsDir, identity);
133605
133859
  } catch {
133606
133860
  snapshot = void 0;
133607
133861
  }
133862
+ try {
133863
+ account = readAccountMetadata(realFarmFs, deps.paths.identitiesDir, identity);
133864
+ } catch {
133865
+ account = void 0;
133866
+ }
133867
+ } else {
133868
+ const configDir = process.env.CLAUDE_CONFIG_DIR;
133869
+ try {
133870
+ account = readAccountMetadataFile(realFarmFs, configDir === void 0 || configDir === "" ? import_node_path53.default.join(import_node_os12.default.homedir(), ".claude.json") : import_node_path53.default.join(configDir, ".claude.json"));
133871
+ } catch {
133872
+ account = void 0;
133873
+ }
133608
133874
  }
133609
- const { payload: enriched, summary } = enrichStatuslinePayload({ payload, env: process.env, snapshot });
133875
+ const displayName = process.env.AGENT_SHIM_PROVIDER;
133876
+ let providerName;
133877
+ if (displayName !== void 0 && displayName !== "") {
133878
+ try {
133879
+ providerName = listProviders(deps.paths).find((entry) => entry.provider.displayName === displayName)?.name;
133880
+ } catch {
133881
+ providerName = void 0;
133882
+ }
133883
+ }
133884
+ const nowMs = Date.now();
133885
+ const { payload: enriched, summary } = enrichStatuslinePayload({ payload, env: process.env, snapshot, account, providerName, nowMs });
133610
133886
  const renderer = process.env.AGENT_SHIM_STATUSLINE_CMD;
133611
133887
  if (renderer !== void 0 && renderer !== "") {
133612
133888
  const child = (0, import_node_child_process7.spawn)("/bin/sh", ["-c", renderer], { stdio: ["pipe", "inherit", "inherit"] });
@@ -133617,9 +133893,16 @@ function registerStatuslineCommand(program2, deps) {
133617
133893
  });
133618
133894
  return;
133619
133895
  }
133620
- const view = payloadViewOf(payload);
133621
- const columns = Number.parseInt(process.env.COLUMNS ?? "", 10);
133622
- console.log(renderStatuslineBlock(summary, view, Number.isNaN(columns) ? DEFAULT_COLUMNS : columns, Date.now()));
133896
+ let stackedUnderDefault = false;
133897
+ if (isAntigravityPayload(payload)) {
133898
+ try {
133899
+ stackedUnderDefault = antigravityStacksWithDefault(realFarmFs, import_node_os12.default.homedir());
133900
+ } catch {
133901
+ stackedUnderDefault = false;
133902
+ }
133903
+ }
133904
+ const view = { ...payloadViewOf(payload), ...stackedUnderDefault ? { modelDisplayName: void 0 } : {} };
133905
+ console.log(renderStatuslineBlock(summary, view, terminalWidthOf(payload, process.env), nowMs));
133623
133906
  }),
133624
133907
  ["$ agent-shim statusline # a client's statusline setting names this; it renders or delegates"]
133625
133908
  );
@@ -135643,8 +135926,8 @@ function getErrorMap2() {
135643
135926
 
135644
135927
  // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v3/helpers/parseUtil.js
135645
135928
  var makeIssue = (params) => {
135646
- const { data, path: path59, errorMaps, issueData } = params;
135647
- const fullPath = [...path59, ...issueData.path || []];
135929
+ const { data, path: path61, errorMaps, issueData } = params;
135930
+ const fullPath = [...path61, ...issueData.path || []];
135648
135931
  const fullIssue = {
135649
135932
  ...issueData,
135650
135933
  path: fullPath
@@ -135759,11 +136042,11 @@ var errorUtil;
135759
136042
 
135760
136043
  // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v3/types.js
135761
136044
  var ParseInputLazyPath = class {
135762
- constructor(parent, value2, path59, key) {
136045
+ constructor(parent, value2, path61, key) {
135763
136046
  this._cachedPath = [];
135764
136047
  this.parent = parent;
135765
136048
  this.data = value2;
135766
- this._path = path59;
136049
+ this._path = path61;
135767
136050
  this._key = key;
135768
136051
  }
135769
136052
  get path() {
@@ -139326,11 +139609,11 @@ function normalizeObjectSchema(schema) {
139326
139609
  }
139327
139610
  return void 0;
139328
139611
  }
139329
- function getDotPath(path59) {
139330
- if (path59.length === 0) {
139612
+ function getDotPath(path61) {
139613
+ if (path61.length === 0) {
139331
139614
  return "object root";
139332
139615
  }
139333
- return path59.reduce((acc, seg, index) => {
139616
+ return path61.reduce((acc, seg, index) => {
139334
139617
  if (index === 0) {
139335
139618
  return String(seg);
139336
139619
  }
@@ -143373,7 +143656,7 @@ async function serveMcp(mcp, transport, options = {}) {
143373
143656
 
143374
143657
  // src/mcp/permissions.ts
143375
143658
  var import_node_fs20 = __toESM(require("node:fs"), 1);
143376
- var import_node_path52 = __toESM(require("node:path"), 1);
143659
+ var import_node_path54 = __toESM(require("node:path"), 1);
143377
143660
  init_zod();
143378
143661
  init_store();
143379
143662
  var StoredMcpPermissionsSchema = external_exports.strictObject({
@@ -143395,10 +143678,10 @@ function effectiveMcpPermissions(flags, stored) {
143395
143678
  return { writes: flags.writes || stored.writes, remoteControl: flags.remoteControl || stored.remoteControl, history: flags.history || stored.history };
143396
143679
  }
143397
143680
  function watchMcpPermissions(paths, onChange) {
143398
- const directory = import_node_path52.default.dirname(paths.mcpPermissionsFile);
143681
+ const directory = import_node_path54.default.dirname(paths.mcpPermissionsFile);
143399
143682
  import_node_fs20.default.mkdirSync(directory, { recursive: true });
143400
143683
  const watcher = import_node_fs20.default.watch(directory, (_event, filename) => {
143401
- if (filename === null || filename === import_node_path52.default.basename(paths.mcpPermissionsFile)) {
143684
+ if (filename === null || filename === import_node_path54.default.basename(paths.mcpPermissionsFile)) {
143402
143685
  onChange();
143403
143686
  }
143404
143687
  });
@@ -143711,16 +143994,16 @@ init_credentialCache();
143711
143994
 
143712
143995
  // src/identityToken.ts
143713
143996
  var import_node_fs21 = __toESM(require("node:fs"), 1);
143714
- var import_node_path53 = __toESM(require("node:path"), 1);
143997
+ var import_node_path55 = __toESM(require("node:path"), 1);
143715
143998
  init_cliError();
143716
143999
  var TOKEN_FILE_MODE = 384;
143717
144000
  var TOKEN_DIR_MODE = 448;
143718
144001
  var OAUTH_TOKEN_RE = /^sk-ant-oat\d+-[A-Za-z0-9_-]+$/;
143719
144002
  function identityTokenDir(paths) {
143720
- return import_node_path53.default.join(paths.root, "credentials");
144003
+ return import_node_path55.default.join(paths.root, "credentials");
143721
144004
  }
143722
144005
  function identityTokenPath(paths, identityName) {
143723
- return import_node_path53.default.join(identityTokenDir(paths), `${identityName}.token`);
144006
+ return import_node_path55.default.join(identityTokenDir(paths), `${identityName}.token`);
143724
144007
  }
143725
144008
  function storeIdentityToken(paths, identityName, raw) {
143726
144009
  const token = raw.trim();
@@ -143731,7 +144014,7 @@ function storeIdentityToken(paths, identityName, raw) {
143731
144014
  import_node_fs21.default.mkdirSync(dir, { recursive: true, mode: TOKEN_DIR_MODE });
143732
144015
  import_node_fs21.default.chmodSync(dir, TOKEN_DIR_MODE);
143733
144016
  const target = identityTokenPath(paths, identityName);
143734
- const temp = import_node_path53.default.join(dir, `.${identityName}.${String(process.pid)}.tmp`);
144017
+ const temp = import_node_path55.default.join(dir, `.${identityName}.${String(process.pid)}.tmp`);
143735
144018
  import_node_fs21.default.writeFileSync(temp, `${token}
143736
144019
  `, { mode: TOKEN_FILE_MODE });
143737
144020
  import_node_fs21.default.renameSync(temp, target);
@@ -143899,7 +144182,7 @@ function registerDoctorCommand(program2, deps) {
143899
144182
  // src/headroom/commands.ts
143900
144183
  var import_node_fs22 = __toESM(require("node:fs"), 1);
143901
144184
  var import_node_http4 = __toESM(require("node:http"), 1);
143902
- var import_node_path54 = __toESM(require("node:path"), 1);
144185
+ var import_node_path56 = __toESM(require("node:path"), 1);
143903
144186
  var import_node_child_process9 = require("node:child_process");
143904
144187
  init_commandDeps();
143905
144188
  init_realFrontDoorPort();
@@ -144088,12 +144371,12 @@ function readInstalledHeadroomCommit() {
144088
144371
  if (toolDir.status !== 0) {
144089
144372
  return void 0;
144090
144373
  }
144091
- const libDir = import_node_path54.default.join(toolDir.stdout.trim(), HEADROOM_TOOL_NAME, "lib");
144374
+ const libDir = import_node_path56.default.join(toolDir.stdout.trim(), HEADROOM_TOOL_NAME, "lib");
144092
144375
  for (const python of realFarmFs.readdir(libDir)) {
144093
- const sitePackages = import_node_path54.default.join(libDir, python, "site-packages");
144376
+ const sitePackages = import_node_path56.default.join(libDir, python, "site-packages");
144094
144377
  for (const entry of realFarmFs.readdir(sitePackages)) {
144095
144378
  if (entry.startsWith("headroom_ai-") && entry.endsWith(".dist-info")) {
144096
- const directUrl = realFarmFs.readFileUtf8(import_node_path54.default.join(sitePackages, entry, "direct_url.json"));
144379
+ const directUrl = realFarmFs.readFileUtf8(import_node_path56.default.join(sitePackages, entry, "direct_url.json"));
144097
144380
  return directUrl === void 0 ? void 0 : parseInstalledCommit(directUrl);
144098
144381
  }
144099
144382
  }
@@ -144242,7 +144525,7 @@ function registerHeadroomCommand(program2, deps) {
144242
144525
  init_realPorts();
144243
144526
 
144244
144527
  // src/usage/realJobRunner.ts
144245
- var import_node_path55 = __toESM(require("node:path"), 1);
144528
+ var import_node_path57 = __toESM(require("node:path"), 1);
144246
144529
  init_conditions();
144247
144530
  init_identityClaude();
144248
144531
  var JOB_LAUNCH_FLAGS = ["--no-headroom", "--no-remote-control", "--track-usage"];
@@ -144255,7 +144538,7 @@ ${outcome.trimEnd()}
144255
144538
  }
144256
144539
  function createRealJobRunner(params) {
144257
144540
  return async (name, identity, job) => {
144258
- const logFile = import_node_path55.default.join(params.paths.jobLogsDir, `${name}.log`);
144541
+ const logFile = import_node_path57.default.join(params.paths.jobLogsDir, `${name}.log`);
144259
144542
  const append = (outcome) => {
144260
144543
  params.fs.mkdirPrivate(params.paths.jobLogsDir);
144261
144544
  params.fs.appendFilePrivate(logFile, logEntry(name, identity, params.now(), outcome));
@@ -144309,7 +144592,7 @@ function registerHeadlessCommands(program2, deps) {
144309
144592
  }
144310
144593
 
144311
144594
  // src/jobs.ts
144312
- var import_node_path56 = __toESM(require("node:path"), 1);
144595
+ var import_node_path58 = __toESM(require("node:path"), 1);
144313
144596
  init_commandDeps();
144314
144597
  init_cliError();
144315
144598
  init_schema();
@@ -144334,7 +144617,7 @@ function jobOf(options) {
144334
144617
  target: options.identity === void 0 ? { pool: options.pool ?? "" } : { identity: options.identity },
144335
144618
  trigger: options.at === void 0 ? { beforeReset: options.beforeReset ?? "fiveHour", lead: options.lead ?? "" } : { at: options.at },
144336
144619
  prompt: options.prompt,
144337
- cwd: import_node_path56.default.resolve(options.cwd ?? process.cwd()),
144620
+ cwd: import_node_path58.default.resolve(options.cwd ?? process.cwd()),
144338
144621
  timeout: options.timeout,
144339
144622
  ...options.model === void 0 ? {} : { model: options.model },
144340
144623
  ...options.allowedTool === void 0 ? {} : { allowedTools: options.allowedTool }
@@ -144407,7 +144690,7 @@ function registerJobCommand(program2, deps) {
144407
144690
  console.log(`Allowed tools: ${entry.allowedTools.join(", ")}`);
144408
144691
  }
144409
144692
  console.log(`Prompt: ${entry.prompt}`);
144410
- console.log(`Results: ${import_node_path56.default.join(paths.jobLogsDir, `${name}.log`)}`);
144693
+ console.log(`Results: ${import_node_path58.default.join(paths.jobLogsDir, `${name}.log`)}`);
144411
144694
  }),
144412
144695
  ["agent-shim job show digest"]
144413
144696
  );
@@ -144430,7 +144713,7 @@ function registerJobCommand(program2, deps) {
144430
144713
  throw new UsageError(`No member of the job's pool can be picked right now.`);
144431
144714
  }
144432
144715
  await createRealJobRunner({ paths, spawnDaemon: spawnDetachedSupervisor, fs: realFarmFs, now: () => /* @__PURE__ */ new Date() })(name, identity, entry);
144433
- console.log(`Ran job "${name}" as ${identity}; the result is in ${import_node_path56.default.join(paths.jobLogsDir, `${name}.log`)}.`);
144716
+ console.log(`Ran job "${name}" as ${identity}; the result is in ${import_node_path58.default.join(paths.jobLogsDir, `${name}.log`)}.`);
144434
144717
  }),
144435
144718
  ["agent-shim job run digest"]
144436
144719
  );
@@ -144956,7 +145239,7 @@ function registerSessionCommands(program2, deps) {
144956
145239
  }
144957
145240
 
144958
145241
  // src/usage/commands.ts
144959
- var import_node_path57 = __toESM(require("node:path"), 1);
145242
+ var import_node_path59 = __toESM(require("node:path"), 1);
144960
145243
  init_commandDeps();
144961
145244
  init_realPorts();
144962
145245
  init_account();
@@ -145094,7 +145377,7 @@ function collectAccounts(fs24, paths, identity, probe) {
145094
145377
  return names.map((name) => ({
145095
145378
  identity: name,
145096
145379
  account: readAccountMetadata(fs24, paths.identitiesDir, name),
145097
- signIn: identitySignIn(fs24, probe, { farmRoot: import_node_path57.default.join(paths.identitiesDir, name), hasCredentialBlock: readIdentity(paths, name)?.credential !== void 0 }),
145380
+ signIn: identitySignIn(fs24, probe, { farmRoot: import_node_path59.default.join(paths.identitiesDir, name), hasCredentialBlock: readIdentity(paths, name)?.credential !== void 0 }),
145098
145381
  usage: readUsageSnapshot(fs24, paths.usageSnapshotsDir, name)
145099
145382
  }));
145100
145383
  }
@@ -145443,7 +145726,7 @@ async function runClaude(argvOverride) {
145443
145726
  // src/cli.ts
145444
145727
  async function main() {
145445
145728
  aliasLegacyEnv(process.env);
145446
- const invokedName = import_node_path58.default.basename(process.argv[1] ?? "agent-shim");
145729
+ const invokedName = import_node_path60.default.basename(process.argv[1] ?? "agent-shim");
145447
145730
  if (isInvokedAsClaude(invokedName)) {
145448
145731
  await runClaude();
145449
145732
  return;