claude-use 11.57.0 → 11.58.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, path71) {
322
- if (!path71)
321
+ function getElementAtPath(obj, path72) {
322
+ if (!path72)
323
323
  return obj;
324
- return path71.reduce((acc, key) => acc?.[key], obj);
324
+ return path72.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(path71, issues) {
583
+ function prefixIssues(path72, issues) {
584
584
  return issues.map((iss) => {
585
585
  var _a4;
586
586
  (_a4 = iss).path ?? (_a4.path = []);
587
- iss.path.unshift(path71);
587
+ iss.path.unshift(path72);
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, path71 = []) => {
1108
+ const processError = (error64, path72 = []) => {
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 }, [...path71, ...issue2.path]));
1111
+ issue2.errors.map((issues) => processError({ issues }, [...path72, ...issue2.path]));
1112
1112
  } else if (issue2.code === "invalid_key") {
1113
- processError({ issues: issue2.issues }, [...path71, ...issue2.path]);
1113
+ processError({ issues: issue2.issues }, [...path72, ...issue2.path]);
1114
1114
  } else if (issue2.code === "invalid_element") {
1115
- processError({ issues: issue2.issues }, [...path71, ...issue2.path]);
1115
+ processError({ issues: issue2.issues }, [...path72, ...issue2.path]);
1116
1116
  } else {
1117
- const fullpath = [...path71, ...issue2.path];
1117
+ const fullpath = [...path72, ...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, path71 = []) => {
1156
+ const processError = (error64, path72 = []) => {
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 }, [...path71, ...issue2.path]));
1160
+ issue2.errors.map((issues) => processError({ issues }, [...path72, ...issue2.path]));
1161
1161
  } else if (issue2.code === "invalid_key") {
1162
- processError({ issues: issue2.issues }, [...path71, ...issue2.path]);
1162
+ processError({ issues: issue2.issues }, [...path72, ...issue2.path]);
1163
1163
  } else if (issue2.code === "invalid_element") {
1164
- processError({ issues: issue2.issues }, [...path71, ...issue2.path]);
1164
+ processError({ issues: issue2.issues }, [...path72, ...issue2.path]);
1165
1165
  } else {
1166
- const fullpath = [...path71, ...issue2.path];
1166
+ const fullpath = [...path72, ...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 path71 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1206
- for (const seg of path71) {
1205
+ const path72 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1206
+ for (const seg of path72) {
1207
1207
  if (typeof seg === "number")
1208
1208
  segs.push(`[${seg}]`);
1209
1209
  else if (typeof seg === "symbol")
@@ -9022,8 +9022,8 @@ var init_ko = __esm({
9022
9022
  });
9023
9023
 
9024
9024
  // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/lt.js
9025
- function getUnitTypeFromNumber(number5) {
9026
- const abs = Math.abs(number5);
9025
+ function getUnitTypeFromNumber(number6) {
9026
+ const abs = Math.abs(number6);
9027
9027
  const last = abs % 10;
9028
9028
  const last2 = abs % 100;
9029
9029
  if (last2 >= 11 && last2 <= 19 || last === 0)
@@ -9041,8 +9041,8 @@ var capitalizeFirstCharacter, error33;
9041
9041
  var init_lt = __esm({
9042
9042
  "node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/lt.js"() {
9043
9043
  init_util();
9044
- capitalizeFirstCharacter = (text4) => {
9045
- return text4.charAt(0).toUpperCase() + text4.slice(1);
9044
+ capitalizeFirstCharacter = (text5) => {
9045
+ return text5.charAt(0).toUpperCase() + text5.slice(1);
9046
9046
  };
9047
9047
  error33 = () => {
9048
9048
  const Sizable = {
@@ -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 path71 = ref.slice(1).split("/").filter(Boolean);
19203
- if (path71.length === 0) {
19202
+ const path72 = ref.slice(1).split("/").filter(Boolean);
19203
+ if (path72.length === 0) {
19204
19204
  return ctx.rootSchema;
19205
19205
  }
19206
19206
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
19207
- if (path71[0] === defsKey) {
19208
- const key = path71[1] === void 0 ? void 0 : decodeJSONPointerSegment(path71[1]);
19207
+ if (path72[0] === defsKey) {
19208
+ const key = path72[1] === void 0 ? void 0 : decodeJSONPointerSegment(path72[1]);
19209
19209
  if (!key || !ctx.defs[key]) {
19210
19210
  throw new Error(`Reference not found: ${ref}`);
19211
19211
  }
@@ -20530,8 +20530,8 @@ var require_common = __commonJS({
20530
20530
  }
20531
20531
  return result;
20532
20532
  }
20533
- function isNegativeZero(number5) {
20534
- return number5 === 0 && Number.NEGATIVE_INFINITY === 1 / number5;
20533
+ function isNegativeZero(number6) {
20534
+ return number6 === 0 && Number.NEGATIVE_INFINITY === 1 / number6;
20535
20535
  }
20536
20536
  module2.exports.isNothing = isNothing;
20537
20537
  module2.exports.isObject = isObject5;
@@ -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 path71 = require("path");
23715
+ var path72 = require("path");
23716
23716
  var os14 = require("os");
23717
23717
  var homedir = os14.homedir();
23718
23718
  var tmpdir = os14.tmpdir();
23719
23719
  var { env } = process;
23720
23720
  var macos = (name) => {
23721
- const library = path71.join(homedir, "Library");
23721
+ const library = path72.join(homedir, "Library");
23722
23722
  return {
23723
- data: path71.join(library, "Application Support", name),
23724
- config: path71.join(library, "Preferences", name),
23725
- cache: path71.join(library, "Caches", name),
23726
- log: path71.join(library, "Logs", name),
23727
- temp: path71.join(tmpdir, name)
23723
+ data: path72.join(library, "Application Support", name),
23724
+ config: path72.join(library, "Preferences", name),
23725
+ cache: path72.join(library, "Caches", name),
23726
+ log: path72.join(library, "Logs", name),
23727
+ temp: path72.join(tmpdir, name)
23728
23728
  };
23729
23729
  };
23730
23730
  var windows = (name) => {
23731
- const appData = env.APPDATA || path71.join(homedir, "AppData", "Roaming");
23732
- const localAppData = env.LOCALAPPDATA || path71.join(homedir, "AppData", "Local");
23731
+ const appData = env.APPDATA || path72.join(homedir, "AppData", "Roaming");
23732
+ const localAppData = env.LOCALAPPDATA || path72.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: path71.join(localAppData, name, "Data"),
23736
- config: path71.join(appData, name, "Config"),
23737
- cache: path71.join(localAppData, name, "Cache"),
23738
- log: path71.join(localAppData, name, "Log"),
23739
- temp: path71.join(tmpdir, name)
23735
+ data: path72.join(localAppData, name, "Data"),
23736
+ config: path72.join(appData, name, "Config"),
23737
+ cache: path72.join(localAppData, name, "Cache"),
23738
+ log: path72.join(localAppData, name, "Log"),
23739
+ temp: path72.join(tmpdir, name)
23740
23740
  };
23741
23741
  };
23742
23742
  var linux = (name) => {
23743
- const username = path71.basename(homedir);
23743
+ const username = path72.basename(homedir);
23744
23744
  return {
23745
- data: path71.join(env.XDG_DATA_HOME || path71.join(homedir, ".local", "share"), name),
23746
- config: path71.join(env.XDG_CONFIG_HOME || path71.join(homedir, ".config"), name),
23747
- cache: path71.join(env.XDG_CACHE_HOME || path71.join(homedir, ".cache"), name),
23745
+ data: path72.join(env.XDG_DATA_HOME || path72.join(homedir, ".local", "share"), name),
23746
+ config: path72.join(env.XDG_CONFIG_HOME || path72.join(homedir, ".config"), name),
23747
+ cache: path72.join(env.XDG_CACHE_HOME || path72.join(homedir, ".cache"), name),
23748
23748
  // https://wiki.debian.org/XDGBaseDirectorySpecification#state
23749
- log: path71.join(env.XDG_STATE_HOME || path71.join(homedir, ".local", "state"), name),
23750
- temp: path71.join(tmpdir, username, name)
23749
+ log: path72.join(env.XDG_STATE_HOME || path72.join(homedir, ".local", "state"), name),
23750
+ temp: path72.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, path71) {
23819
- if (typeof path71 === "string" && Object.prototype.hasOwnProperty.call(source, path71)) {
23820
- return source[path71];
23818
+ function getPropertyByPath(source, path72) {
23819
+ if (typeof path72 === "string" && Object.prototype.hasOwnProperty.call(source, path72)) {
23820
+ return source[path72];
23821
23821
  }
23822
- const parsedPath = typeof path71 === "string" ? path71.split(".") : path71;
23822
+ const parsedPath = typeof path72 === "string" ? path72.split(".") : path72;
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(path71) {
23845
+ async function isDirectory(path72) {
23846
23846
  try {
23847
- const stat = await fs_1.promises.stat(path71);
23847
+ const stat = await fs_1.promises.stat(path72);
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(path71) {
23857
+ function isDirectorySync(path72) {
23858
23858
  try {
23859
- const stat = fs_1.default.statSync(path71);
23859
+ const stat = fs_1.default.statSync(path72);
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((path71, i10) => `${i10 + 1}. ${path71}`).join("\n")} (same as ${idx + 1}.)`);
23957
+ ${[...importStack, fullPath].map((path72, i10) => `${i10 + 1}. ${path72}`).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(path71) {
24145
+ async #fileExists(path72) {
24146
24146
  try {
24147
- await promises_1.default.stat(path71);
24147
+ await promises_1.default.stat(path72);
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(path71) {
24307
+ #fileExists(path72) {
24308
24308
  try {
24309
- fs_1.default.statSync(path71);
24309
+ fs_1.default.statSync(path72);
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((path71) => path71.replace("{name}", moduleName));
24433
+ const userConfiguredSearchPlaces = userConfiguredOptions.searchPlaces?.map((path72) => path72.replace("{name}", moduleName));
24434
24434
  if (userConfiguredOptions.mergeSearchPlaces) {
24435
24435
  return [...userConfiguredSearchPlaces ?? [], ...toolDefinedSearchPlaces];
24436
24436
  }
@@ -24560,7 +24560,7 @@ function parseIgnoringUnrecognisedKeys(schema, raw) {
24560
24560
  return second.success ? { success: true, data: second.data, ignored } : { success: false, issues: second.error.issues };
24561
24561
  }
24562
24562
  function describeIgnoredKeys(filePath, ignored) {
24563
- const places = ignored.map(({ path: path71, keys }) => `${path71.length === 0 ? "" : `${path71.map(String).join(".")}.`}${keys.join(", ")}`);
24563
+ const places = ignored.map(({ path: path72, keys }) => `${path72.length === 0 ? "" : `${path72.map(String).join(".")}.`}${keys.join(", ")}`);
24564
24564
  return `${filePath} has settings this version of agent-shim does not know and ignores: ${places.join("; ")}. A newer release may read them.`;
24565
24565
  }
24566
24566
  function noteIgnoredKeys(filePath, ignored) {
@@ -24582,9 +24582,9 @@ function restoreIgnoredKeys(filePath, value2) {
24582
24582
  return value2;
24583
24583
  }
24584
24584
  const restored = structuredClone(value2);
24585
- for (const { path: path71, values } of ignored) {
24585
+ for (const { path: path72, values } of ignored) {
24586
24586
  let holder = restored;
24587
- for (const step2 of path71) {
24587
+ for (const step2 of path72) {
24588
24588
  holder = isRecord(holder) ? holder[step2] : void 0;
24589
24589
  }
24590
24590
  if (isRecord(holder)) {
@@ -24807,6 +24807,24 @@ var init_processRole = __esm({
24807
24807
  }
24808
24808
  });
24809
24809
 
24810
+ // src/blockingSpawn.ts
24811
+ function spawnSyncBlocking(operation, command, args, options) {
24812
+ refuseToBlockInRole(operation);
24813
+ return (0, import_node_child_process2.spawnSync)(command, args, options ?? {});
24814
+ }
24815
+ function execFileSyncBlocking(operation, file2, args, options) {
24816
+ refuseToBlockInRole(operation);
24817
+ return (0, import_node_child_process2.execFileSync)(file2, args, options ?? {});
24818
+ }
24819
+ var import_node_child_process2;
24820
+ var init_blockingSpawn = __esm({
24821
+ "src/blockingSpawn.ts"() {
24822
+ "use strict";
24823
+ import_node_child_process2 = require("node:child_process");
24824
+ init_processRole();
24825
+ }
24826
+ });
24827
+
24810
24828
  // src/versionDiscovery.ts
24811
24829
  function defaultVersionsDir() {
24812
24830
  return import_node_path3.default.join(import_node_os.default.homedir(), ".local", "share", "claude", "versions");
@@ -25304,8 +25322,8 @@ var init_string_width = __esm({
25304
25322
  });
25305
25323
 
25306
25324
  // src/statusline/blank.ts
25307
- function drawsNothing(text4) {
25308
- return stringWidth(text4.replace(BLANK_CELLS, "")) === 0;
25325
+ function drawsNothing(text5) {
25326
+ return stringWidth(text5.replace(BLANK_CELLS, "")) === 0;
25309
25327
  }
25310
25328
  var BLANK_CELLS;
25311
25329
  var init_blank = __esm({
@@ -25317,8 +25335,8 @@ var init_blank = __esm({
25317
25335
  });
25318
25336
 
25319
25337
  // src/statusline/graphemes.ts
25320
- function graphemesOf(text4) {
25321
- return Array.from(SEGMENTER.segment(text4), (part) => part.segment);
25338
+ function graphemesOf(text5) {
25339
+ return Array.from(SEGMENTER.segment(text5), (part) => part.segment);
25322
25340
  }
25323
25341
  var SEGMENTER;
25324
25342
  var init_graphemes = __esm({
@@ -25332,8 +25350,8 @@ var init_graphemes = __esm({
25332
25350
  function distinctList(member) {
25333
25351
  return external_exports.array(member).refine((items) => new Set(items).size === items.length, "must not repeat an entry");
25334
25352
  }
25335
- function isSingleVisibleGrapheme(text4) {
25336
- return graphemesOf(text4).length === 1 && stringWidth(text4) === 1 && !/[\p{C}\p{Z}]/u.test(text4) && !drawsNothing(text4);
25353
+ function isSingleVisibleGrapheme(text5) {
25354
+ return graphemesOf(text5).length === 1 && stringWidth(text5) === 1 && !/[\p{C}\p{Z}]/u.test(text5) && !drawsNothing(text5);
25337
25355
  }
25338
25356
  function isPlainObject2(value2) {
25339
25357
  return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
@@ -25355,7 +25373,7 @@ function resolveStatusline(settings2) {
25355
25373
  }
25356
25374
  return resolved;
25357
25375
  }
25358
- var STATUSLINE_HEADER_SEGMENTS, STATUSLINE_ROWS, STATUSLINE_COLOUR_NAMES, DEFAULT_HEADER_SEGMENTS, DEFAULT_ROWS, STATUSLINE_PATH_LEVELS, STATUSLINE_USAGE_VALUES, STATUSLINE_TIME_FORMATS, STATUSLINE_HOUR_CYCLES, MAX_PERCENT, MAX_STATUSLINE_PALETTE_INDEX, MAX_STATUSLINE_LABEL_COLUMNS, MAX_BAR_CELLS, MAX_ACCOUNT_USER_CHARS, MAX_DISPLAY_TEXT_CHARS, LABEL_RE2, OPTIONAL_LABEL_RE, colourValue, barCharacter, labelText, overrideText, wholePercent, thresholdPercent, SHAPES, StatuslineSchema, ResolvedStatuslineSchema, STATUSLINE_DEFAULTS, STATUSLINE_ENV;
25376
+ var STATUSLINE_HEADER_SEGMENTS, STATUSLINE_ROWS, STATUSLINE_SESSION_TIME_PARTS, PROMPT_CACHE_TTL_SECONDS, STATUSLINE_COLOUR_NAMES, DEFAULT_HEADER_SEGMENTS, DEFAULT_ROWS, STATUSLINE_PATH_LEVELS, STATUSLINE_USAGE_VALUES, STATUSLINE_TIME_FORMATS, STATUSLINE_HOUR_CYCLES, MAX_PERCENT, MAX_STATUSLINE_PALETTE_INDEX, MAX_STATUSLINE_LABEL_COLUMNS, MAX_BAR_CELLS, MAX_ACCOUNT_USER_CHARS, MAX_DISPLAY_TEXT_CHARS, LABEL_RE2, OPTIONAL_LABEL_RE, colourValue, barCharacter, labelText, overrideText, wholePercent, thresholdPercent, SHAPES, StatuslineSchema, ResolvedStatuslineSchema, STATUSLINE_DEFAULTS, STATUSLINE_ENV;
25359
25377
  var init_statusline = __esm({
25360
25378
  "src/config/statusline.ts"() {
25361
25379
  "use strict";
@@ -25363,8 +25381,10 @@ var init_statusline = __esm({
25363
25381
  init_zod();
25364
25382
  init_blank();
25365
25383
  init_graphemes();
25366
- STATUSLINE_HEADER_SEGMENTS = ["model", "provider", "route", "account", "identity", "headroom", "project", "vcs", "effort", "advisor", "version", "outputStyle", "cost", "dailyCost"];
25367
- STATUSLINE_ROWS = ["context", "quota", "addedDirs", "gitFiles", "memory", "environment"];
25384
+ STATUSLINE_HEADER_SEGMENTS = ["model", "provider", "route", "account", "identity", "headroom", "project", "vcs", "effort", "advisor", "version", "outputStyle", "cost", "dailyCost", "sessionName", "duration", "speed"];
25385
+ STATUSLINE_ROWS = ["context", "quota", "addedDirs", "gitFiles", "memory", "environment", "sessionTime", "promptCache", "compactions"];
25386
+ STATUSLINE_SESSION_TIME_PARTS = ["started", "lastReply"];
25387
+ PROMPT_CACHE_TTL_SECONDS = { fiveMinutes: 300, oneHour: 3600 };
25368
25388
  STATUSLINE_COLOUR_NAMES = [
25369
25389
  "default",
25370
25390
  "dim",
@@ -25401,7 +25421,7 @@ var init_statusline = __esm({
25401
25421
  OPTIONAL_LABEL_RE = /^(?:[^\p{C}\p{Z}]+(?: [^\p{C}\p{Z}]+)*)?$/u;
25402
25422
  colourValue = external_exports.union([external_exports.enum(STATUSLINE_COLOUR_NAMES), external_exports.number().int().min(0).max(MAX_STATUSLINE_PALETTE_INDEX), external_exports.string().regex(/^#[0-9a-fA-F]{6}$/, "must be a colour name, a palette index from 0 to 255 or #rrggbb")]);
25403
25423
  barCharacter = external_exports.string().refine(isSingleVisibleGrapheme, "must be a single visible character that takes one terminal column");
25404
- labelText = external_exports.string().refine((text4) => stringWidth(text4) <= MAX_STATUSLINE_LABEL_COLUMNS, `must take no more than ${String(MAX_STATUSLINE_LABEL_COLUMNS)} terminal columns`).refine((text4) => !drawsNothing(text4), "must show something: a label of only combining marks or blank characters draws nothing").regex(LABEL_RE2, "must be visible text without control characters");
25424
+ labelText = external_exports.string().refine((text5) => stringWidth(text5) <= MAX_STATUSLINE_LABEL_COLUMNS, `must take no more than ${String(MAX_STATUSLINE_LABEL_COLUMNS)} terminal columns`).refine((text5) => !drawsNothing(text5), "must show something: a label of only combining marks or blank characters draws nothing").regex(LABEL_RE2, "must be visible text without control characters");
25405
25425
  overrideText = external_exports.string().max(MAX_DISPLAY_TEXT_CHARS).regex(OPTIONAL_LABEL_RE, "must be visible text without control characters");
25406
25426
  wholePercent = external_exports.number().int().min(1).max(MAX_PERCENT);
25407
25427
  thresholdPercent = external_exports.number().int().min(0).max(MAX_PERCENT);
@@ -25461,6 +25481,12 @@ var init_statusline = __esm({
25461
25481
  environment: {
25462
25482
  threshold: external_exports.number().int().min(0).describe("The fewest configuration items in total (CLAUDE.md files, rules, MCP servers and hook events) that must exist for the environment row to draw its counts.")
25463
25483
  },
25484
+ sessionTime: {
25485
+ parts: distinctList(external_exports.enum(STATUSLINE_SESSION_TIME_PARTS)).describe("The parts of the sessionTime row to draw, in drawing order: when the session started, and how long ago the last response was written; a part left out is hidden, and an empty list hides the row.")
25486
+ },
25487
+ promptCache: {
25488
+ ttlSeconds: external_exports.number().int().min(1).describe("How long the prompt cache lives, in seconds, when the transcript has not yet shown which tier the session writes (five minutes or one hour); the tier the transcript shows takes over once it does.")
25489
+ },
25464
25490
  colours: {
25465
25491
  context: colourValue.describe("The colour of the context bar and its figures below the warning threshold."),
25466
25492
  usage: colourValue.describe("The colour of the quota bars and their figures below the warning threshold."),
@@ -25507,6 +25533,8 @@ var init_statusline = __esm({
25507
25533
  clock: external_exports.strictObject(SHAPES.clock).partial().optional(),
25508
25534
  cost: external_exports.strictObject(SHAPES.cost).partial().optional(),
25509
25535
  environment: external_exports.strictObject(SHAPES.environment).partial().optional(),
25536
+ sessionTime: external_exports.strictObject(SHAPES.sessionTime).partial().optional(),
25537
+ promptCache: external_exports.strictObject(SHAPES.promptCache).partial().optional(),
25510
25538
  colours: external_exports.strictObject(SHAPES.colours).partial().optional(),
25511
25539
  project: external_exports.strictObject(SHAPES.project).partial().optional(),
25512
25540
  git: external_exports.strictObject(SHAPES.git).partial().optional(),
@@ -25526,6 +25554,8 @@ var init_statusline = __esm({
25526
25554
  clock: external_exports.strictObject(SHAPES.clock),
25527
25555
  cost: external_exports.strictObject(SHAPES.cost),
25528
25556
  environment: external_exports.strictObject(SHAPES.environment),
25557
+ sessionTime: external_exports.strictObject(SHAPES.sessionTime),
25558
+ promptCache: external_exports.strictObject(SHAPES.promptCache),
25529
25559
  colours: external_exports.strictObject(SHAPES.colours),
25530
25560
  project: external_exports.strictObject(SHAPES.project),
25531
25561
  git: external_exports.strictObject(SHAPES.git),
@@ -25545,6 +25575,8 @@ var init_statusline = __esm({
25545
25575
  clock: { hourCycle: "auto", seconds: false },
25546
25576
  cost: { routed: false },
25547
25577
  environment: { threshold: 0 },
25578
+ sessionTime: { parts: [...STATUSLINE_SESSION_TIME_PARTS] },
25579
+ promptCache: { ttlSeconds: PROMPT_CACHE_TTL_SECONDS.fiveMinutes },
25548
25580
  colours: {
25549
25581
  context: "green",
25550
25582
  usage: "green",
@@ -28648,8 +28680,8 @@ function redactHeaders(headers) {
28648
28680
  }
28649
28681
  return result;
28650
28682
  }
28651
- function redactText(text4) {
28652
- return SECRET_BODY_PATTERNS.reduce((accumulated, { pattern, replacement }) => accumulated.replace(pattern, replacement), text4);
28683
+ function redactText(text5) {
28684
+ return SECRET_BODY_PATTERNS.reduce((accumulated, { pattern, replacement }) => accumulated.replace(pattern, replacement), text5);
28653
28685
  }
28654
28686
  function redactJsonValue(value2) {
28655
28687
  if (typeof value2 === "string") {
@@ -28664,12 +28696,12 @@ function redactJsonValue(value2) {
28664
28696
  return value2;
28665
28697
  }
28666
28698
  function redactBody(chunk2) {
28667
- const text4 = chunk2.toString("utf8");
28699
+ const text5 = chunk2.toString("utf8");
28668
28700
  try {
28669
- const parsed = JSON.parse(text4);
28701
+ const parsed = JSON.parse(text5);
28670
28702
  return JSON.stringify(redactJsonValue(parsed));
28671
28703
  } catch {
28672
- return redactText(text4);
28704
+ return redactText(text5);
28673
28705
  }
28674
28706
  }
28675
28707
  function captureFromEnv(env, logsDir) {
@@ -28704,8 +28736,8 @@ function createFileCapture(file2, now = () => /* @__PURE__ */ new Date()) {
28704
28736
  }
28705
28737
  const excerpt2 = chunk2.subarray(0, Math.min(CHUNK_LOG_CAP_BYTES, budget));
28706
28738
  stored[direction] += excerpt2.length;
28707
- const text4 = excerpt2.toString("utf8");
28708
- const faithful = Buffer.from(text4, "utf8").equals(excerpt2);
28739
+ const text5 = excerpt2.toString("utf8");
28740
+ const faithful = Buffer.from(text5, "utf8").equals(excerpt2);
28709
28741
  append({
28710
28742
  kind: "stream-chunk",
28711
28743
  id: id2,
@@ -28714,7 +28746,7 @@ function createFileCapture(file2, now = () => /* @__PURE__ */ new Date()) {
28714
28746
  bytes: chunk2.length,
28715
28747
  stored: excerpt2.length,
28716
28748
  truncated: excerpt2.length < chunk2.length,
28717
- ...faithful ? { body: redactText(text4) } : { b64: excerpt2.toString("base64") }
28749
+ ...faithful ? { body: redactText(text5) } : { b64: excerpt2.toString("base64") }
28718
28750
  });
28719
28751
  },
28720
28752
  onEnd: () => {
@@ -29398,8 +29430,8 @@ var init_report = __esm({
29398
29430
  });
29399
29431
 
29400
29432
  // src/logStyle.ts
29401
- function styledDiagnostic(style, colour, text4) {
29402
- return text4.split("\n").map((line, index) => {
29433
+ function styledDiagnostic(style, colour, text5) {
29434
+ return text5.split("\n").map((line, index) => {
29403
29435
  const lead = index === 0 ? DIAGNOSTIC_LEAD.exec(line) : null;
29404
29436
  if (lead === null) {
29405
29437
  return style([colour], line);
@@ -29427,7 +29459,7 @@ function createLogPort(sinks, styleFor) {
29427
29459
  };
29428
29460
  }
29429
29461
  function styleTextFor(stream) {
29430
- return (formats, text4) => (0, import_node_util3.styleText)([...formats], text4, { stream });
29462
+ return (formats, text5) => (0, import_node_util3.styleText)([...formats], text5, { stream });
29431
29463
  }
29432
29464
  var import_node_util3, DIAGNOSTIC_LEAD;
29433
29465
  var init_logStyle = __esm({
@@ -29459,16 +29491,14 @@ function realIsProcessAlive(pid) {
29459
29491
  }
29460
29492
  }
29461
29493
  function realIsProcessZombie(pid) {
29462
- refuseToBlockInRole("a synchronous process-table read");
29463
- const result = (0, import_node_child_process2.spawnSync)("ps", ["-o", "stat=", "-p", String(pid)], { encoding: "utf8" });
29494
+ const result = spawnSyncBlocking("a process-table read", "ps", ["-o", "stat=", "-p", String(pid)], { encoding: "utf8" });
29464
29495
  return result.status === 0 && result.stdout.trim().startsWith("Z");
29465
29496
  }
29466
29497
  function realIsProcessRunning(pid) {
29467
29498
  return realIsProcessAlive(pid) && !realIsProcessZombie(pid);
29468
29499
  }
29469
29500
  function realIsFrontDoorSupervisor(pid) {
29470
- refuseToBlockInRole("a synchronous process-table read");
29471
- const result = (0, import_node_child_process2.spawnSync)("ps", ["-o", "pid=,command=", "-p", String(pid)], { encoding: "utf8" });
29501
+ const result = spawnSyncBlocking("a process-table read", "ps", ["-o", "pid=,command=", "-p", String(pid)], { encoding: "utf8" });
29472
29502
  return result.status === 0 && parseFrontDoorSupervisorPids(result.stdout).includes(pid);
29473
29503
  }
29474
29504
  function leadingContinuationBytes(bytes) {
@@ -29516,20 +29546,18 @@ function realReadFileTail(filePath, fromByte, maxBytes) {
29516
29546
  }
29517
29547
  }
29518
29548
  function realProcessCommandLine(pid) {
29519
- refuseToBlockInRole("a synchronous process-table read");
29520
- const result = (0, import_node_child_process2.spawnSync)("ps", ["-o", "command=", "-p", String(pid)], { encoding: "utf8", timeout: PS_TIMEOUT_MS });
29549
+ const result = spawnSyncBlocking("a process-table read", "ps", ["-o", "command=", "-p", String(pid)], { encoding: "utf8", timeout: PS_TIMEOUT_MS });
29521
29550
  return result.status === 0 ? result.stdout.trim() : void 0;
29522
29551
  }
29523
29552
  function realFrontDoorLiveness(pids) {
29524
- refuseToBlockInRole("a synchronous process-table read");
29525
29553
  return frontDoorLivenessOf(pids, (asked) => {
29526
- const result = (0, import_node_child_process2.spawnSync)("ps", ["-o", "pid=,stat=,command=", "-p", asked.map(String).join(",")], { encoding: "utf8", timeout: PS_TIMEOUT_MS });
29554
+ const result = spawnSyncBlocking("a process-table read", "ps", ["-o", "pid=,stat=,command=", "-p", asked.map(String).join(",")], { encoding: "utf8", timeout: PS_TIMEOUT_MS });
29527
29555
  return { status: result.status, stdout: result.stdout, stderr: result.stderr, ...result.error === void 0 ? {} : { error: result.error } };
29528
29556
  });
29529
29557
  }
29530
29558
  async function readProcessStates(pids) {
29531
29559
  return await new Promise((resolve2) => {
29532
- (0, import_node_child_process2.execFile)("ps", ["-o", "pid=,stat=", "-p", pids.map(String).join(",")], { encoding: "utf8", timeout: PS_TIMEOUT_MS }, (_error, stdout2) => {
29560
+ (0, import_node_child_process3.execFile)("ps", ["-o", "pid=,stat=", "-p", pids.map(String).join(",")], { encoding: "utf8", timeout: PS_TIMEOUT_MS }, (_error, stdout2) => {
29533
29561
  const states = /* @__PURE__ */ new Map();
29534
29562
  for (const line of stdout2.split("\n")) {
29535
29563
  const [pidText, stat] = line.trim().split(/\s+/);
@@ -29549,12 +29577,19 @@ async function realRunningAmong(pids) {
29549
29577
  const states = await readProcessStates(existing);
29550
29578
  return new Set(existing.filter((pid) => states.get(pid)?.startsWith("Z") !== true));
29551
29579
  }
29580
+ async function realRunAsync(command, args) {
29581
+ return await new Promise((resolve2) => {
29582
+ (0, import_node_child_process3.execFile)(command, [...args], { encoding: "utf8", timeout: PS_TIMEOUT_MS }, (error63, stdout2, stderr) => {
29583
+ resolve2({ status: error63 === null ? 0 : typeof error63.code === "number" ? error63.code : null, stdout: stdout2, stderr });
29584
+ });
29585
+ });
29586
+ }
29552
29587
  function expandHome(filePath) {
29553
29588
  return filePath.startsWith("~/") ? import_node_path9.default.join(import_node_os2.default.homedir(), filePath.slice(1)) : filePath;
29554
29589
  }
29555
29590
  function hasDesktopSession() {
29556
29591
  if (process.platform === "darwin") {
29557
- const result = (0, import_node_child_process2.spawnSync)("launchctl", ["managername"], { encoding: "utf8" });
29592
+ const result = spawnSyncBlocking("a desktop-session check", "launchctl", ["managername"], { encoding: "utf8" });
29558
29593
  return result.status === 0 && result.stdout.trim() === MACOS_GUI_SESSION_MANAGER;
29559
29594
  }
29560
29595
  return hasDisplayServer();
@@ -29570,7 +29605,7 @@ async function hasDesktopSessionAsync() {
29570
29605
  return hasDisplayServer();
29571
29606
  }
29572
29607
  return await new Promise((resolve2) => {
29573
- (0, import_node_child_process2.execFile)("launchctl", ["managername"], { encoding: "utf8" }, (error63, stdout2) => {
29608
+ (0, import_node_child_process3.execFile)("launchctl", ["managername"], { encoding: "utf8" }, (error63, stdout2) => {
29574
29609
  resolve2(error63 === null && stdout2.trim() === MACOS_GUI_SESSION_MANAGER);
29575
29610
  });
29576
29611
  });
@@ -29578,7 +29613,7 @@ async function hasDesktopSessionAsync() {
29578
29613
  async function runCredentialCommand(argv, options) {
29579
29614
  const [command, ...args] = argv;
29580
29615
  return await new Promise((resolve2) => {
29581
- const child = (0, import_node_child_process2.spawn)(command, args, { stdio: options.interactive ? ["inherit", "pipe", "inherit"] : ["ignore", "pipe", "pipe"] });
29616
+ const child = (0, import_node_child_process3.spawn)(command, args, { stdio: options.interactive ? ["inherit", "pipe", "inherit"] : ["ignore", "pipe", "pipe"] });
29582
29617
  let stdout2 = "";
29583
29618
  let stderr = "";
29584
29619
  let timedOut = false;
@@ -29637,7 +29672,7 @@ function selfInvocation(args) {
29637
29672
  }
29638
29673
  function spawnSelfDetached(paths, args) {
29639
29674
  const invocation = selfInvocation(args);
29640
- const child = (0, import_node_child_process2.spawn)(invocation.command, [...invocation.args], { detached: true, stdio: "ignore", env: { ...process.env, AGENT_SHIM_HOME: paths.root } });
29675
+ const child = (0, import_node_child_process3.spawn)(invocation.command, [...invocation.args], { detached: true, stdio: "ignore", env: { ...process.env, AGENT_SHIM_HOME: paths.root } });
29641
29676
  child.unref();
29642
29677
  }
29643
29678
  function detachedDaemonSpawnOptions(logFd, env) {
@@ -29656,7 +29691,7 @@ function spawnDetachedDaemon(invocation, paths, subcommand, logPath) {
29656
29691
  import_node_fs3.default.mkdirSync(import_node_path9.default.dirname(logPath), { recursive: true });
29657
29692
  const logFd = import_node_fs3.default.openSync(logPath, "a");
29658
29693
  try {
29659
- const child = (0, import_node_child_process2.spawn)(invocation.command, invocation.args, detachedDaemonSpawnOptions(logFd, { ...process.env, AGENT_SHIM_HOME: paths.root }));
29694
+ const child = (0, import_node_child_process3.spawn)(invocation.command, invocation.args, detachedDaemonSpawnOptions(logFd, { ...process.env, AGENT_SHIM_HOME: paths.root }));
29660
29695
  child.unref();
29661
29696
  if (child.pid === void 0) {
29662
29697
  throw new Error(`spawning ${subcommand} returned no pid`);
@@ -29806,12 +29841,13 @@ function realResolveClaudeBinary(isOwnBinary) {
29806
29841
  function realInstalledClaudeVersions() {
29807
29842
  return installedVersions(listVersionsDir(defaultVersionsDir()));
29808
29843
  }
29809
- var import_node_child_process2, import_node_crypto4, import_node_fs3, import_node_os2, import_node_path9, import_node_sea, realFsPort, OWNER_ONLY_DIR_MODE, OWNER_ONLY_FILE_MODE, PERMISSION_BITS, realFarmFs, INT32_BYTE_LENGTH, KEY_POLL_MS, CTRL_C_BYTE, realHoldPort, LINE_FEED, UTF8_CONTINUATION_MASK, UTF8_CONTINUATION_BITS, PS_TIMEOUT_MS, realRunPort, MACOS_GUI_SESSION_MANAGER, realCredentialPort, realAsyncCredentialPort, SOCKET_PERMISSION_BITS, realHeadroomSocketTrust, realSpawnPort, realProcPort, realLogPort, EXECUTE_BITS_MASK, WINDOWS_DEFAULT_PATHEXT;
29844
+ var import_node_child_process3, import_node_crypto4, import_node_fs3, import_node_os2, import_node_path9, import_node_sea, realFsPort, OWNER_ONLY_DIR_MODE, OWNER_ONLY_FILE_MODE, PERMISSION_BITS, realFarmFs, INT32_BYTE_LENGTH, KEY_POLL_MS, CTRL_C_BYTE, realHoldPort, LINE_FEED, UTF8_CONTINUATION_MASK, UTF8_CONTINUATION_BITS, PS_TIMEOUT_MS, realRunPort, MACOS_GUI_SESSION_MANAGER, realCredentialPort, realAsyncCredentialPort, SOCKET_PERMISSION_BITS, realHeadroomSocketTrust, realSpawnPort, realProcPort, realLogPort, EXECUTE_BITS_MASK, WINDOWS_DEFAULT_PATHEXT;
29810
29845
  var init_realPorts = __esm({
29811
29846
  "src/realPorts.ts"() {
29812
29847
  "use strict";
29848
+ init_blockingSpawn();
29813
29849
  init_processRole();
29814
- import_node_child_process2 = require("node:child_process");
29850
+ import_node_child_process3 = require("node:child_process");
29815
29851
  import_node_crypto4 = require("node:crypto");
29816
29852
  import_node_fs3 = __toESM(require("node:fs"), 1);
29817
29853
  import_node_os2 = __toESM(require("node:os"), 1);
@@ -29986,7 +30022,7 @@ var init_realPorts = __esm({
29986
30022
  PS_TIMEOUT_MS = 2e3;
29987
30023
  realRunPort = {
29988
30024
  run(command, args) {
29989
- const result = (0, import_node_child_process2.spawnSync)(command, [...args], { encoding: "utf8" });
30025
+ const result = spawnSyncBlocking("an external command", command, args, { encoding: "utf8" });
29990
30026
  return { status: result.status, stdout: result.stdout, stderr: result.stderr };
29991
30027
  }
29992
30028
  };
@@ -30009,7 +30045,7 @@ var init_realPorts = __esm({
30009
30045
  },
30010
30046
  runCommand(argv, options) {
30011
30047
  const [command, ...args] = argv;
30012
- const result = (0, import_node_child_process2.spawnSync)(command, args, {
30048
+ const result = spawnSyncBlocking("a credential command", command, args, {
30013
30049
  encoding: "utf8",
30014
30050
  timeout: options.timeoutMs,
30015
30051
  stdio: options.interactive ? ["inherit", "pipe", "inherit"] : ["ignore", "pipe", "pipe"]
@@ -30053,7 +30089,7 @@ var init_realPorts = __esm({
30053
30089
  };
30054
30090
  realSpawnPort = {
30055
30091
  spawnSync(command, args, options) {
30056
- const result = (0, import_node_child_process2.spawnSync)(command, args, options);
30092
+ const result = spawnSyncBlocking("a spawned program", command, args, options);
30057
30093
  return { status: result.status, signal: result.signal, ...result.error === void 0 ? {} : { error: result.error } };
30058
30094
  }
30059
30095
  };
@@ -30650,8 +30686,8 @@ var require_utils = __commonJS({
30650
30686
  }
30651
30687
  return output2;
30652
30688
  };
30653
- exports2.basename = (path71, { windows } = {}) => {
30654
- const segs = path71.split(windows ? /[\\/]/ : "/");
30689
+ exports2.basename = (path72, { windows } = {}) => {
30690
+ const segs = path72.split(windows ? /[\\/]/ : "/");
30655
30691
  const last = segs[segs.length - 1];
30656
30692
  if (last === "") {
30657
30693
  return segs[segs.length - 2];
@@ -32416,9 +32452,9 @@ var init_identity = __esm({
32416
32452
  });
32417
32453
 
32418
32454
  // src/statusline/keys.ts
32419
- function valueAt(source, path71) {
32455
+ function valueAt(source, path72) {
32420
32456
  let current = source;
32421
- for (const part of path71) {
32457
+ for (const part of path72) {
32422
32458
  if (!isPlainObject2(current)) {
32423
32459
  return void 0;
32424
32460
  }
@@ -32426,8 +32462,8 @@ function valueAt(source, path71) {
32426
32462
  }
32427
32463
  return current;
32428
32464
  }
32429
- function keyOf(path71, leaf) {
32430
- const common = { path: path71.join("."), description: leaf.description ?? "", defaultValue: valueAt(STATUSLINE_DEFAULTS, path71) };
32465
+ function keyOf(path72, leaf) {
32466
+ const common = { path: path72.join("."), description: leaf.description ?? "", defaultValue: valueAt(STATUSLINE_DEFAULTS, path72) };
32431
32467
  if (leaf instanceof external_exports.ZodNumber) {
32432
32468
  return { ...common, kind: "integer", choices: [] };
32433
32469
  }
@@ -32446,7 +32482,7 @@ function keyOf(path71, leaf) {
32446
32482
  if (leaf instanceof external_exports.ZodArray && leaf.element instanceof external_exports.ZodEnum) {
32447
32483
  return { ...common, kind: "list", choices: Object.values(leaf.element.enum).map(String) };
32448
32484
  }
32449
- throw new TypeError(`statusline setting ${path71.join(".")} has a kind the key listing does not describe`);
32485
+ throw new TypeError(`statusline setting ${path72.join(".")} has a kind the key listing does not describe`);
32450
32486
  }
32451
32487
  function walk(shape, prefix) {
32452
32488
  return Object.entries(shape).flatMap(([name, schema]) => schema instanceof external_exports.ZodObject ? walk(schema.shape, [...prefix, name]) : [keyOf([...prefix, name], schema)]);
@@ -32470,47 +32506,47 @@ var init_keys = __esm({
32470
32506
  });
32471
32507
 
32472
32508
  // src/statusline/change.ts
32473
- function keyNamed(path71) {
32474
- const found = statuslineKeys().find((key) => key.path === path71);
32509
+ function keyNamed(path72) {
32510
+ const found = statuslineKeys().find((key) => key.path === path72);
32475
32511
  if (found === void 0) {
32476
- throw new UsageError(`"${path71}" is not a statusline setting; \`agent-shim statusline keys\` lists them.`);
32512
+ throw new UsageError(`"${path72}" is not a statusline setting; \`agent-shim statusline keys\` lists them.`);
32477
32513
  }
32478
32514
  return found;
32479
32515
  }
32480
- function parseStatuslineAssignment(text4) {
32481
- const split = text4.indexOf("=");
32516
+ function parseStatuslineAssignment(text5) {
32517
+ const split = text5.indexOf("=");
32482
32518
  if (split < 1) {
32483
- throw new UsageError(`"${text4}" is not <setting>=<value>.`);
32519
+ throw new UsageError(`"${text5}" is not <setting>=<value>.`);
32484
32520
  }
32485
- const path71 = text4.slice(0, split);
32486
- const raw = text4.slice(split + 1);
32487
- const key = keyNamed(path71);
32521
+ const path72 = text5.slice(0, split);
32522
+ const raw = text5.slice(split + 1);
32523
+ const key = keyNamed(path72);
32488
32524
  switch (key.kind) {
32489
32525
  case "integer": {
32490
- const number5 = Number(raw);
32491
- if (raw.trim() === "" || !Number.isFinite(number5)) {
32492
- throw new UsageError(`${path71}: "${raw}" is not a number.`);
32526
+ const number6 = Number(raw);
32527
+ if (raw.trim() === "" || !Number.isFinite(number6)) {
32528
+ throw new UsageError(`${path72}: "${raw}" is not a number.`);
32493
32529
  }
32494
- return { path: path71, value: number5 };
32530
+ return { path: path72, value: number6 };
32495
32531
  }
32496
32532
  case "boolean":
32497
32533
  if (raw !== "true" && raw !== "false") {
32498
- throw new UsageError(`${path71}: "${raw}" is not true or false.`);
32534
+ throw new UsageError(`${path72}: "${raw}" is not true or false.`);
32499
32535
  }
32500
- return { path: path71, value: raw === "true" };
32536
+ return { path: path72, value: raw === "true" };
32501
32537
  case "text":
32502
32538
  case "choice":
32503
- return { path: path71, value: raw };
32539
+ return { path: path72, value: raw };
32504
32540
  case "colour":
32505
- return { path: path71, value: /^\d+$/.test(raw) ? Number(raw) : raw };
32541
+ return { path: path72, value: /^\d+$/.test(raw) ? Number(raw) : raw };
32506
32542
  case "list":
32507
- return { path: path71, value: raw === "" ? [] : raw.split(",") };
32543
+ return { path: path72, value: raw === "" ? [] : raw.split(",") };
32508
32544
  default:
32509
32545
  return key.kind;
32510
32546
  }
32511
32547
  }
32512
- function setAt(target, path71, value2) {
32513
- const [head, ...rest] = path71;
32548
+ function setAt(target, path72, value2) {
32549
+ const [head, ...rest] = path72;
32514
32550
  if (head === void 0) {
32515
32551
  return;
32516
32552
  }
@@ -32523,8 +32559,8 @@ function setAt(target, path71, value2) {
32523
32559
  target[head] = next;
32524
32560
  setAt(next, rest, value2);
32525
32561
  }
32526
- function removeAt(target, path71) {
32527
- const [head, ...rest] = path71;
32562
+ function removeAt(target, path72) {
32563
+ const [head, ...rest] = path72;
32528
32564
  if (head === void 0) {
32529
32565
  return;
32530
32566
  }
@@ -32542,13 +32578,13 @@ function removeAt(target, path71) {
32542
32578
  }
32543
32579
  function applyStatuslineChange(existing, change) {
32544
32580
  const draft = structuredClone(existing ?? {});
32545
- for (const [path71, value2] of Object.entries(change.set ?? {})) {
32546
- keyNamed(path71);
32547
- setAt(draft, path71.split("."), value2);
32581
+ for (const [path72, value2] of Object.entries(change.set ?? {})) {
32582
+ keyNamed(path72);
32583
+ setAt(draft, path72.split("."), value2);
32548
32584
  }
32549
- for (const path71 of change.unset ?? []) {
32550
- keyNamed(path71);
32551
- removeAt(draft, path71.split("."));
32585
+ for (const path72 of change.unset ?? []) {
32586
+ keyNamed(path72);
32587
+ removeAt(draft, path72.split("."));
32552
32588
  }
32553
32589
  const result = StatuslineSchema.safeParse(draft);
32554
32590
  if (!result.success) {
@@ -35691,7 +35727,7 @@ function keyUsageExtension(bits) {
35691
35727
  }
35692
35728
  function ipv6Groups(address) {
35693
35729
  const [head = "", tail] = address.split("::");
35694
- const split = (text4) => text4 === "" ? [] : text4.split(":");
35730
+ const split = (text5) => text5 === "" ? [] : text5.split(":");
35695
35731
  const expand = (groups) => groups.flatMap((group) => {
35696
35732
  if (!import_node_net.default.isIPv4(group)) {
35697
35733
  return [Number.parseInt(group, HEX_RADIX)];
@@ -36025,11 +36061,11 @@ function identifyRequest(headers) {
36025
36061
  function directOrigin2(port) {
36026
36062
  return `http://127.0.0.1:${String(port)}`;
36027
36063
  }
36028
- function parseProviderPath(path71) {
36029
- if (!path71.startsWith(PROVIDER_PATH_PREFIX)) {
36064
+ function parseProviderPath(path72) {
36065
+ if (!path72.startsWith(PROVIDER_PATH_PREFIX)) {
36030
36066
  return void 0;
36031
36067
  }
36032
- const tail = path71.slice(PROVIDER_PATH_PREFIX.length);
36068
+ const tail = path72.slice(PROVIDER_PATH_PREFIX.length);
36033
36069
  const slash = tail.indexOf("/");
36034
36070
  if (slash <= 0) {
36035
36071
  return void 0;
@@ -36303,8 +36339,8 @@ function parseConnectTarget(authority) {
36303
36339
  }
36304
36340
  return { host, port };
36305
36341
  }
36306
- function servedByPipeline(path71) {
36307
- return path71?.startsWith(ROUTED_PATH_PREFIX) === true;
36342
+ function servedByPipeline(path72) {
36343
+ return path72?.startsWith(ROUTED_PATH_PREFIX) === true;
36308
36344
  }
36309
36345
  function forwardableHeaders(headers) {
36310
36346
  const connectionTokens = new Set(
@@ -36782,7 +36818,7 @@ var init_package = __esm({
36782
36818
  "package.json"() {
36783
36819
  package_default = {
36784
36820
  name: "claude-use",
36785
- version: "11.57.0",
36821
+ version: "11.58.0",
36786
36822
  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.",
36787
36823
  license: "MIT",
36788
36824
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -37047,9 +37083,9 @@ function errorInfo(raw) {
37047
37083
  function isObject3(value2) {
37048
37084
  return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
37049
37085
  }
37050
- function parseJson2(text4) {
37086
+ function parseJson2(text5) {
37051
37087
  try {
37052
- const parsed = JSON.parse(text4);
37088
+ const parsed = JSON.parse(text5);
37053
37089
  return parsed;
37054
37090
  } catch {
37055
37091
  return void 0;
@@ -37097,26 +37133,26 @@ function createSseScanner() {
37097
37133
  return void 0;
37098
37134
  };
37099
37135
  const completeLine = (complete) => {
37100
- const text4 = complete.endsWith("\r") ? complete.slice(0, -1) : complete;
37101
- if (text4 === "") {
37136
+ const text5 = complete.endsWith("\r") ? complete.slice(0, -1) : complete;
37137
+ if (text5 === "") {
37102
37138
  dispatch();
37103
37139
  return;
37104
37140
  }
37105
- if (text4.startsWith("event:")) {
37106
- eventName = text4.slice("event:".length).trim();
37141
+ if (text5.startsWith("event:")) {
37142
+ eventName = text5.slice("event:".length).trim();
37107
37143
  return;
37108
37144
  }
37109
- if (text4.startsWith("data:")) {
37110
- const value2 = text4.slice("data:".length);
37145
+ if (text5.startsWith("data:")) {
37146
+ const value2 = text5.slice("data:".length);
37111
37147
  data.push(value2.startsWith(" ") ? value2.slice(1) : value2);
37112
37148
  }
37113
37149
  };
37114
37150
  return {
37115
- push: (text4) => {
37151
+ push: (text5) => {
37116
37152
  let start = 0;
37117
37153
  for (; ; ) {
37118
- const newline = text4.indexOf("\n", start);
37119
- const piece = newline === -1 ? text4.slice(start) : text4.slice(start, newline);
37154
+ const newline = text5.indexOf("\n", start);
37155
+ const piece = newline === -1 ? text5.slice(start) : text5.slice(start, newline);
37120
37156
  if (!skipping) {
37121
37157
  line += piece;
37122
37158
  if (worthKeeping(line) === false) {
@@ -37230,8 +37266,8 @@ function createJsonScanner() {
37230
37266
  }
37231
37267
  };
37232
37268
  return {
37233
- push: (text4) => {
37234
- for (const char of text4) {
37269
+ push: (text5) => {
37270
+ for (const char of text5) {
37235
37271
  step2(char);
37236
37272
  }
37237
37273
  },
@@ -37305,12 +37341,12 @@ function decoderFor(encoding) {
37305
37341
  return void 0;
37306
37342
  }
37307
37343
  }
37308
- function destinationOf(path71, sessionProvider) {
37309
- const scoped = parseProviderPath(path71);
37344
+ function destinationOf(path72, sessionProvider) {
37345
+ const scoped = parseProviderPath(path72);
37310
37346
  if (scoped !== void 0) {
37311
37347
  return { provider: scoped.provider, endpoint: scoped.rest };
37312
37348
  }
37313
- return { provider: sessionProvider ?? ANTHROPIC_PROVIDER, endpoint: path71 };
37349
+ return { provider: sessionProvider ?? ANTHROPIC_PROVIDER, endpoint: path72 };
37314
37350
  }
37315
37351
  function modelChoiceOf(event, servedModel, provider) {
37316
37352
  if (event.modelChoice !== void 0) return event.modelChoice;
@@ -37359,13 +37395,13 @@ function createUsageMiddleware(deps) {
37359
37395
  const scanner = scannerFor(event.headers);
37360
37396
  const decoder = scanner === void 0 ? null : decoderFor(headerValue(event.headers, "content-encoding"));
37361
37397
  let scanning = scanner !== void 0 && decoder !== void 0;
37362
- const text4 = new TextDecoder();
37398
+ const text5 = new TextDecoder();
37363
37399
  const feed = (bytes, final) => {
37364
37400
  if (!scanning || scanner === void 0) {
37365
37401
  return;
37366
37402
  }
37367
37403
  try {
37368
- scanner.push(text4.decode(bytes, { stream: !final }));
37404
+ scanner.push(text5.decode(bytes, { stream: !final }));
37369
37405
  } catch (error63) {
37370
37406
  scanning = false;
37371
37407
  deps.log(`usage: body scan failed for ${event.route}: ${error63 instanceof Error ? error63.message : String(error63)}`);
@@ -38217,12 +38253,12 @@ function requireKeychain() {
38217
38253
  }
38218
38254
  }
38219
38255
  function security(args, stdin2) {
38220
- const result = (0, import_node_child_process3.spawnSync)("security", args, { encoding: "utf8", ...stdin2 === void 0 ? {} : { input: stdin2 }, stdio: ["pipe", "pipe", "ignore"] });
38256
+ const result = spawnSyncBlocking("a keychain call", "security", args, { encoding: "utf8", ...stdin2 === void 0 ? {} : { input: stdin2 }, stdio: ["pipe", "pipe", "ignore"] });
38221
38257
  return { status: result.status, stdout: result.stdout };
38222
38258
  }
38223
38259
  async function securityAsync(args, stdin2) {
38224
38260
  return await new Promise((resolve2) => {
38225
- const child = (0, import_node_child_process3.spawn)("security", args, { stdio: ["pipe", "pipe", "ignore"] });
38261
+ const child = (0, import_node_child_process4.spawn)("security", args, { stdio: ["pipe", "pipe", "ignore"] });
38226
38262
  let stdout2 = "";
38227
38263
  let settled = false;
38228
38264
  const settle2 = (status) => {
@@ -38332,13 +38368,14 @@ function createAsyncRealCredentialCache(root) {
38332
38368
  function realAsyncCredentialCacheEnv(paths) {
38333
38369
  return { port: createAsyncRealCredentialCache(paths.root), platform: process.platform, now: () => Date.now() };
38334
38370
  }
38335
- var import_node_child_process3, import_node_fs9, import_node_path29, KEYCHAIN_CACHE_SERVICE, CACHE_DIR_MODE, CACHE_FILE_MODE;
38371
+ var import_node_child_process4, import_node_fs9, import_node_path29, KEYCHAIN_CACHE_SERVICE, CACHE_DIR_MODE, CACHE_FILE_MODE;
38336
38372
  var init_realCredentialCache = __esm({
38337
38373
  "src/realCredentialCache.ts"() {
38338
38374
  "use strict";
38339
- import_node_child_process3 = require("node:child_process");
38375
+ import_node_child_process4 = require("node:child_process");
38340
38376
  import_node_fs9 = __toESM(require("node:fs"), 1);
38341
38377
  import_node_path29 = __toESM(require("node:path"), 1);
38378
+ init_blockingSpawn();
38342
38379
  init_credentialCache();
38343
38380
  KEYCHAIN_CACHE_SERVICE = "agent-shim-credential-cache";
38344
38381
  CACHE_DIR_MODE = 448;
@@ -40345,14 +40382,14 @@ var require_util2 = __commonJS({
40345
40382
  }
40346
40383
  const port = url2.port != null ? url2.port : url2.protocol === "https:" ? 443 : 80;
40347
40384
  let origin = url2.origin != null ? url2.origin : `${url2.protocol || ""}//${url2.hostname || ""}:${port}`;
40348
- let path71 = url2.path != null ? url2.path : `${url2.pathname || ""}${url2.search || ""}`;
40385
+ let path72 = url2.path != null ? url2.path : `${url2.pathname || ""}${url2.search || ""}`;
40349
40386
  if (origin[origin.length - 1] === "/") {
40350
40387
  origin = origin.slice(0, origin.length - 1);
40351
40388
  }
40352
- if (path71 && path71[0] !== "/") {
40353
- path71 = `/${path71}`;
40389
+ if (path72 && path72[0] !== "/") {
40390
+ path72 = `/${path72}`;
40354
40391
  }
40355
- return new URL(`${origin}${path71}`);
40392
+ return new URL(`${origin}${path72}`);
40356
40393
  }
40357
40394
  if (!isHttpOrHttpsPrefixed(url2.origin || url2.protocol)) {
40358
40395
  throw new InvalidArgumentError2("Invalid URL protocol: the URL must start with `http:` or `https:`.");
@@ -41173,9 +41210,9 @@ var require_diagnostics = __commonJS({
41173
41210
  "undici:client:sendHeaders",
41174
41211
  (evt) => {
41175
41212
  const {
41176
- request: { method, path: path71, origin }
41213
+ request: { method, path: path72, origin }
41177
41214
  } = evt;
41178
- debugLog("sending request to %s %s%s", method, origin, path71);
41215
+ debugLog("sending request to %s %s%s", method, origin, path72);
41179
41216
  }
41180
41217
  );
41181
41218
  }
@@ -41193,14 +41230,14 @@ var require_diagnostics = __commonJS({
41193
41230
  "undici:request:headers",
41194
41231
  (evt) => {
41195
41232
  const {
41196
- request: { method, path: path71, origin },
41233
+ request: { method, path: path72, origin },
41197
41234
  response: { statusCode }
41198
41235
  } = evt;
41199
41236
  debugLog(
41200
41237
  "received response to %s %s%s - HTTP %d",
41201
41238
  method,
41202
41239
  origin,
41203
- path71,
41240
+ path72,
41204
41241
  statusCode
41205
41242
  );
41206
41243
  }
@@ -41209,23 +41246,23 @@ var require_diagnostics = __commonJS({
41209
41246
  "undici:request:trailers",
41210
41247
  (evt) => {
41211
41248
  const {
41212
- request: { method, path: path71, origin }
41249
+ request: { method, path: path72, origin }
41213
41250
  } = evt;
41214
- debugLog("trailers received from %s %s%s", method, origin, path71);
41251
+ debugLog("trailers received from %s %s%s", method, origin, path72);
41215
41252
  }
41216
41253
  );
41217
41254
  diagnosticsChannel.subscribe(
41218
41255
  "undici:request:error",
41219
41256
  (evt) => {
41220
41257
  const {
41221
- request: { method, path: path71, origin },
41258
+ request: { method, path: path72, origin },
41222
41259
  error: error63
41223
41260
  } = evt;
41224
41261
  debugLog(
41225
41262
  "request to %s %s%s errored - %s",
41226
41263
  method,
41227
41264
  origin,
41228
- path71,
41265
+ path72,
41229
41266
  error63.message
41230
41267
  );
41231
41268
  }
@@ -41340,7 +41377,7 @@ var require_request = __commonJS({
41340
41377
  var kHandler = /* @__PURE__ */ Symbol("handler");
41341
41378
  var Request2 = class {
41342
41379
  constructor(origin, {
41343
- path: path71,
41380
+ path: path72,
41344
41381
  method,
41345
41382
  body,
41346
41383
  headers,
@@ -41357,11 +41394,11 @@ var require_request = __commonJS({
41357
41394
  maxRedirections,
41358
41395
  typeOfService
41359
41396
  }, handler) {
41360
- if (typeof path71 !== "string") {
41397
+ if (typeof path72 !== "string") {
41361
41398
  throw new InvalidArgumentError2("path must be a string");
41362
- } else if (path71[0] !== "/" && !(path71.startsWith("http://") || path71.startsWith("https://")) && method !== "CONNECT") {
41399
+ } else if (path72[0] !== "/" && !(path72.startsWith("http://") || path72.startsWith("https://")) && method !== "CONNECT") {
41363
41400
  throw new InvalidArgumentError2("path must be an absolute URL or start with a slash");
41364
- } else if (invalidPathRegex.test(path71)) {
41401
+ } else if (invalidPathRegex.test(path72)) {
41365
41402
  throw new InvalidArgumentError2("invalid request path");
41366
41403
  }
41367
41404
  if (typeof method !== "string") {
@@ -41436,7 +41473,7 @@ var require_request = __commonJS({
41436
41473
  this.completed = false;
41437
41474
  this.aborted = false;
41438
41475
  this.upgrade = upgrade || null;
41439
- this.path = query ? serializePathWithQuery(path71, query) : path71;
41476
+ this.path = query ? serializePathWithQuery(path72, query) : path72;
41440
41477
  this.origin = origin;
41441
41478
  this.protocol = getProtocolFromUrlString(origin);
41442
41479
  this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent;
@@ -46618,7 +46655,7 @@ var require_client_h1 = __commonJS({
46618
46655
  return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT";
46619
46656
  }
46620
46657
  function writeH1(client, request7) {
46621
- const { method, path: path71, host, upgrade, blocking, reset } = request7;
46658
+ const { method, path: path72, host, upgrade, blocking, reset } = request7;
46622
46659
  let { body, headers, contentLength } = request7;
46623
46660
  const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH";
46624
46661
  if (util2.isFormDataLike(body)) {
@@ -46696,7 +46733,7 @@ var require_client_h1 = __commonJS({
46696
46733
  if (socket.setTypeOfService) {
46697
46734
  socket.setTypeOfService(request7.typeOfService);
46698
46735
  }
46699
- let header = `${method} ${path71} HTTP/1.1\r
46736
+ let header = `${method} ${path72} HTTP/1.1\r
46700
46737
  `;
46701
46738
  if (typeof host === "string") {
46702
46739
  header += `host: ${host}\r
@@ -47375,7 +47412,7 @@ var require_client_h2 = __commonJS({
47375
47412
  const headersTimeout = request7.headersTimeout ?? client[kHeadersTimeout];
47376
47413
  const bodyTimeout = request7.bodyTimeout ?? client[kBodyTimeout];
47377
47414
  const session = client[kHTTP2Session];
47378
- const { method, path: path71, host, upgrade, expectContinue, signal, protocol, headers: reqHeaders } = request7;
47415
+ const { method, path: path72, host, upgrade, expectContinue, signal, protocol, headers: reqHeaders } = request7;
47379
47416
  let { body } = request7;
47380
47417
  if (upgrade != null && upgrade !== "websocket") {
47381
47418
  util2.errorRequest(client, request7, new InvalidArgumentError2(`Custom upgrade "${upgrade}" not supported over HTTP/2`));
@@ -47444,7 +47481,7 @@ var require_client_h2 = __commonJS({
47444
47481
  }
47445
47482
  headers[HTTP2_HEADER_METHOD] = "CONNECT";
47446
47483
  headers[HTTP2_HEADER_PROTOCOL] = "websocket";
47447
- headers[HTTP2_HEADER_PATH] = path71;
47484
+ headers[HTTP2_HEADER_PATH] = path72;
47448
47485
  if (protocol === "ws:" || protocol === "wss:") {
47449
47486
  headers[HTTP2_HEADER_SCHEME] = protocol === "ws:" ? "http" : "https";
47450
47487
  } else {
@@ -47486,7 +47523,7 @@ var require_client_h2 = __commonJS({
47486
47523
  stream.setTimeout(headersTimeout);
47487
47524
  return true;
47488
47525
  }
47489
- headers[HTTP2_HEADER_PATH] = path71;
47526
+ headers[HTTP2_HEADER_PATH] = path72;
47490
47527
  headers[HTTP2_HEADER_SCHEME] = protocol === "http:" ? "http" : "https";
47491
47528
  const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH";
47492
47529
  if (body && typeof body.read === "function") {
@@ -49838,10 +49875,10 @@ var require_proxy_agent = __commonJS({
49838
49875
  };
49839
49876
  const {
49840
49877
  origin,
49841
- path: path71 = "/",
49878
+ path: path72 = "/",
49842
49879
  headers = {}
49843
49880
  } = opts;
49844
- opts.path = origin + path71;
49881
+ opts.path = origin + path72;
49845
49882
  if (!("host" in headers) && !("Host" in headers)) {
49846
49883
  const { host } = new URL(origin);
49847
49884
  headers.host = host;
@@ -51950,20 +51987,20 @@ var require_mock_utils = __commonJS({
51950
51987
  }
51951
51988
  return normalizedQp;
51952
51989
  }
51953
- function safeUrl(path71) {
51954
- if (typeof path71 !== "string") {
51955
- return path71;
51990
+ function safeUrl(path72) {
51991
+ if (typeof path72 !== "string") {
51992
+ return path72;
51956
51993
  }
51957
- const pathSegments = path71.split("?", 3);
51994
+ const pathSegments = path72.split("?", 3);
51958
51995
  if (pathSegments.length !== 2) {
51959
- return path71;
51996
+ return path72;
51960
51997
  }
51961
51998
  const qp2 = new URLSearchParams(pathSegments.pop());
51962
51999
  qp2.sort();
51963
52000
  return [...pathSegments, qp2.toString()].join("?");
51964
52001
  }
51965
- function matchKey(mockDispatch2, { path: path71, method, body, headers }) {
51966
- const pathMatch = matchValue(mockDispatch2.path, path71);
52002
+ function matchKey(mockDispatch2, { path: path72, method, body, headers }) {
52003
+ const pathMatch = matchValue(mockDispatch2.path, path72);
51967
52004
  const methodMatch = matchValue(mockDispatch2.method, method);
51968
52005
  const bodyMatch = typeof mockDispatch2.body !== "undefined" ? matchValue(mockDispatch2.body, body) : true;
51969
52006
  const headersMatch = matchHeaders(mockDispatch2, headers);
@@ -51988,8 +52025,8 @@ var require_mock_utils = __commonJS({
51988
52025
  const basePath = key.query ? serializePathWithQuery(key.path, key.query) : key.path;
51989
52026
  const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath;
51990
52027
  const resolvedPathWithoutTrailingSlash = removeTrailingSlash(resolvedPath);
51991
- let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path71, ignoreTrailingSlash }) => {
51992
- return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(path71)), resolvedPathWithoutTrailingSlash) : matchValue(safeUrl(path71), resolvedPath);
52028
+ let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path72, ignoreTrailingSlash }) => {
52029
+ return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(path72)), resolvedPathWithoutTrailingSlash) : matchValue(safeUrl(path72), resolvedPath);
51993
52030
  });
51994
52031
  if (matchedMockDispatches.length === 0) {
51995
52032
  throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`);
@@ -52028,19 +52065,19 @@ var require_mock_utils = __commonJS({
52028
52065
  mockDispatches.splice(index, 1);
52029
52066
  }
52030
52067
  }
52031
- function removeTrailingSlash(path71) {
52032
- while (path71.endsWith("/")) {
52033
- path71 = path71.slice(0, -1);
52068
+ function removeTrailingSlash(path72) {
52069
+ while (path72.endsWith("/")) {
52070
+ path72 = path72.slice(0, -1);
52034
52071
  }
52035
- if (path71.length === 0) {
52036
- path71 = "/";
52072
+ if (path72.length === 0) {
52073
+ path72 = "/";
52037
52074
  }
52038
- return path71;
52075
+ return path72;
52039
52076
  }
52040
52077
  function buildKey(opts) {
52041
- const { path: path71, method, body, headers, query } = opts;
52078
+ const { path: path72, method, body, headers, query } = opts;
52042
52079
  return {
52043
- path: path71,
52080
+ path: path72,
52044
52081
  method,
52045
52082
  body,
52046
52083
  headers,
@@ -52559,17 +52596,17 @@ var require_mock_call_history = __commonJS({
52559
52596
  lastCall() {
52560
52597
  return this.logs.at(-1);
52561
52598
  }
52562
- nthCall(number5) {
52563
- if (typeof number5 !== "number") {
52599
+ nthCall(number6) {
52600
+ if (typeof number6 !== "number") {
52564
52601
  throw new InvalidArgumentError2("nthCall must be called with a number");
52565
52602
  }
52566
- if (!Number.isInteger(number5)) {
52603
+ if (!Number.isInteger(number6)) {
52567
52604
  throw new InvalidArgumentError2("nthCall must be called with an integer");
52568
52605
  }
52569
- if (Math.sign(number5) !== 1) {
52606
+ if (Math.sign(number6) !== 1) {
52570
52607
  throw new InvalidArgumentError2("nthCall must be called with a positive value. use firstCall or lastCall instead");
52571
52608
  }
52572
- return this.logs.at(number5 - 1);
52609
+ return this.logs.at(number6 - 1);
52573
52610
  }
52574
52611
  filterCalls(criteria, options) {
52575
52612
  if (this.logs.length === 0) {
@@ -52730,10 +52767,10 @@ var require_pending_interceptors_formatter = __commonJS({
52730
52767
  }
52731
52768
  format(pendingInterceptors) {
52732
52769
  const withPrettyHeaders = pendingInterceptors.map(
52733
- ({ method, path: path71, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
52770
+ ({ method, path: path72, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
52734
52771
  Method: method,
52735
52772
  Origin: origin,
52736
- Path: path71,
52773
+ Path: path72,
52737
52774
  "Status code": statusCode,
52738
52775
  Persistent: persist ? PERSISTENT : NOT_PERSISTENT,
52739
52776
  Invocations: timesInvoked,
@@ -52815,9 +52852,9 @@ var require_mock_agent = __commonJS({
52815
52852
  const acceptNonStandardSearchParameters = this[kMockAgentAcceptsNonStandardSearchParameters];
52816
52853
  const dispatchOpts = { ...opts };
52817
52854
  if (acceptNonStandardSearchParameters && dispatchOpts.path) {
52818
- const [path71, searchParams] = dispatchOpts.path.split("?");
52855
+ const [path72, searchParams] = dispatchOpts.path.split("?");
52819
52856
  const normalizedSearchParams = normalizeSearchParams(searchParams, acceptNonStandardSearchParameters);
52820
- dispatchOpts.path = `${path71}?${normalizedSearchParams}`;
52857
+ dispatchOpts.path = `${path72}?${normalizedSearchParams}`;
52821
52858
  }
52822
52859
  return this[kAgent].dispatch(dispatchOpts, handler);
52823
52860
  }
@@ -53218,12 +53255,12 @@ var require_snapshot_recorder = __commonJS({
53218
53255
  * @return {Promise<void>} - Resolves when snapshots are loaded
53219
53256
  */
53220
53257
  async loadSnapshots(filePath) {
53221
- const path71 = filePath || this.#snapshotPath;
53222
- if (!path71) {
53258
+ const path72 = filePath || this.#snapshotPath;
53259
+ if (!path72) {
53223
53260
  throw new InvalidArgumentError2("Snapshot path is required");
53224
53261
  }
53225
53262
  try {
53226
- const data = await readFile(resolve2(path71), "utf8");
53263
+ const data = await readFile(resolve2(path72), "utf8");
53227
53264
  const parsed = JSON.parse(data);
53228
53265
  if (Array.isArray(parsed)) {
53229
53266
  this.#snapshots.clear();
@@ -53237,7 +53274,7 @@ var require_snapshot_recorder = __commonJS({
53237
53274
  if (error63.code === "ENOENT") {
53238
53275
  this.#snapshots.clear();
53239
53276
  } else {
53240
- throw new UndiciError(`Failed to load snapshots from ${path71}`, { cause: error63 });
53277
+ throw new UndiciError(`Failed to load snapshots from ${path72}`, { cause: error63 });
53241
53278
  }
53242
53279
  }
53243
53280
  }
@@ -53248,11 +53285,11 @@ var require_snapshot_recorder = __commonJS({
53248
53285
  * @returns {Promise<void>} - Resolves when snapshots are saved
53249
53286
  */
53250
53287
  async saveSnapshots(filePath) {
53251
- const path71 = filePath || this.#snapshotPath;
53252
- if (!path71) {
53288
+ const path72 = filePath || this.#snapshotPath;
53289
+ if (!path72) {
53253
53290
  throw new InvalidArgumentError2("Snapshot path is required");
53254
53291
  }
53255
- const resolvedPath = resolve2(path71);
53292
+ const resolvedPath = resolve2(path72);
53256
53293
  await mkdir(dirname3(resolvedPath), { recursive: true });
53257
53294
  const data = Array.from(this.#snapshots.entries()).map(([hash2, snapshot]) => ({
53258
53295
  hash: hash2,
@@ -53884,15 +53921,15 @@ var require_redirect_handler = __commonJS({
53884
53921
  return;
53885
53922
  }
53886
53923
  const { origin, pathname, search } = util2.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)));
53887
- const path71 = search ? `${pathname}${search}` : pathname;
53888
- const redirectUrlString = `${origin}${path71}`;
53924
+ const path72 = search ? `${pathname}${search}` : pathname;
53925
+ const redirectUrlString = `${origin}${path72}`;
53889
53926
  for (const historyUrl of this.history) {
53890
53927
  if (historyUrl.toString() === redirectUrlString) {
53891
53928
  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.`);
53892
53929
  }
53893
53930
  }
53894
53931
  this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin);
53895
- this.opts.path = path71;
53932
+ this.opts.path = path72;
53896
53933
  this.opts.origin = origin;
53897
53934
  this.opts.query = null;
53898
53935
  }
@@ -55652,10 +55689,10 @@ var require_cache_handler = __commonJS({
55652
55689
  }
55653
55690
  return locationUrl.pathname + locationUrl.search;
55654
55691
  }
55655
- function deleteCachedUri(store, cacheKey, path71) {
55692
+ function deleteCachedUri(store, cacheKey, path72) {
55656
55693
  deleteCachedValue(store, {
55657
55694
  ...cacheKey,
55658
- path: path71
55695
+ path: path72
55659
55696
  });
55660
55697
  for (let i10 = 0; i10 < util2.safeHTTPMethods.length; i10++) {
55661
55698
  const method = util2.safeHTTPMethods[i10];
@@ -55663,7 +55700,7 @@ var require_cache_handler = __commonJS({
55663
55700
  deleteCachedValue(store, {
55664
55701
  ...cacheKey,
55665
55702
  method,
55666
- path: path71
55703
+ path: path72
55667
55704
  });
55668
55705
  }
55669
55706
  }
@@ -55674,9 +55711,9 @@ var require_cache_handler = __commonJS({
55674
55711
  }
55675
55712
  const values = Array.isArray(headerValue2) ? headerValue2 : [headerValue2];
55676
55713
  for (let i10 = 0; i10 < values.length; i10++) {
55677
- const path71 = getSameOriginPath(cacheKey, values[i10]);
55678
- if (path71 !== void 0) {
55679
- deleteCachedUri(store, cacheKey, path71);
55714
+ const path72 = getSameOriginPath(cacheKey, values[i10]);
55715
+ if (path72 !== void 0) {
55716
+ deleteCachedUri(store, cacheKey, path72);
55680
55717
  }
55681
55718
  }
55682
55719
  }
@@ -60676,11 +60713,11 @@ var require_fetch = __commonJS({
60676
60713
  function dispatch({ body }) {
60677
60714
  const url2 = requestCurrentURL(request7);
60678
60715
  const agent = fetchParams.controller.dispatcher;
60679
- const path71 = url2.pathname + url2.search;
60716
+ const path72 = url2.pathname + url2.search;
60680
60717
  const hasTrailingQuestionMark = url2.search.length === 0 && url2.href[url2.href.length - url2.hash.length - 1] === "?";
60681
60718
  return new Promise((resolve2, reject) => agent.dispatch(
60682
60719
  {
60683
- path: hasTrailingQuestionMark ? `${path71}?` : path71,
60720
+ path: hasTrailingQuestionMark ? `${path72}?` : path72,
60684
60721
  origin: url2.origin,
60685
60722
  method: request7.method,
60686
60723
  body: agent.isMockActive ? request7.body && (request7.body.source || request7.body.stream) : body,
@@ -61627,9 +61664,9 @@ var require_util5 = __commonJS({
61627
61664
  }
61628
61665
  }
61629
61666
  }
61630
- function validateCookiePath(path71) {
61631
- for (let i10 = 0; i10 < path71.length; ++i10) {
61632
- const code = path71.charCodeAt(i10);
61667
+ function validateCookiePath(path72) {
61668
+ for (let i10 = 0; i10 < path72.length; ++i10) {
61669
+ const code = path72.charCodeAt(i10);
61633
61670
  if (code < 32 || // exclude CTLs (0-31)
61634
61671
  code > 126 || // exclude DEL and non-ascii
61635
61672
  code === 59) {
@@ -64977,11 +65014,11 @@ var require_undici = __commonJS({
64977
65014
  if (typeof opts.path !== "string") {
64978
65015
  throw new InvalidArgumentError2("invalid opts.path");
64979
65016
  }
64980
- let path71 = opts.path;
65017
+ let path72 = opts.path;
64981
65018
  if (!opts.path.startsWith("/")) {
64982
- path71 = `/${path71}`;
65019
+ path72 = `/${path72}`;
64983
65020
  }
64984
- url2 = new URL(util2.parseOrigin(url2).origin + path71);
65021
+ url2 = new URL(util2.parseOrigin(url2).origin + path72);
64985
65022
  } else {
64986
65023
  if (!opts) {
64987
65024
  opts = typeof url2 === "object" ? url2 : {};
@@ -66397,8 +66434,8 @@ function countOf(usage, key) {
66397
66434
  const value2 = key in usage ? Reflect.get(usage, key) : void 0;
66398
66435
  return typeof value2 === "number" && Number.isFinite(value2) && value2 >= 0 ? value2 : 0;
66399
66436
  }
66400
- function contextTokensOfTranscript(text4) {
66401
- const lines = text4.split("\n");
66437
+ function contextTokensOfTranscript(text5) {
66438
+ const lines = text5.split("\n");
66402
66439
  for (let index = lines.length - 1; index >= 0; index -= 1) {
66403
66440
  const line = lines[index];
66404
66441
  if (line === void 0 || line === "") {
@@ -66449,8 +66486,8 @@ function resumedContextTokens(fs30, params) {
66449
66486
  }
66450
66487
  const projectDir = import_node_path43.default.join(params.claudeHome, "projects", projectDirNameOf(params.cwd));
66451
66488
  const file2 = target.kind === "id" ? import_node_path43.default.join(projectDir, `${target.id}.jsonl`) : newestTranscript(fs30, projectDir);
66452
- const text4 = file2 === void 0 ? void 0 : fs30.readFileUtf8(file2);
66453
- return text4 === void 0 ? void 0 : contextTokensOfTranscript(text4);
66489
+ const text5 = file2 === void 0 ? void 0 : fs30.readFileUtf8(file2);
66490
+ return text5 === void 0 ? void 0 : contextTokensOfTranscript(text5);
66454
66491
  }
66455
66492
  var import_node_path43;
66456
66493
  var init_resumeContext = __esm({
@@ -66713,8 +66750,8 @@ function farmRow(links, builtDirectories, adopted) {
66713
66750
  const parts = [counted2(links, "link", "links"), counted2(builtDirectories, "built directory", "built directories"), ...adopted === 0 ? [] : [`${String(adopted)} adopted`]];
66714
66751
  return { label: "farm", value: "resynced", detail: parts.join(", ") };
66715
66752
  }
66716
- function noteRow(text4) {
66717
- return { label: "note", value: text4 };
66753
+ function noteRow(text5) {
66754
+ return { label: "note", value: text5 };
66718
66755
  }
66719
66756
  var init_launchReport = __esm({
66720
66757
  "src/launcher/launchReport.ts"() {
@@ -67491,9 +67528,9 @@ function flattenToolResult(content) {
67491
67528
  }
67492
67529
  return content.map((block2) => isTextBlock(block2) ? block2.text : NON_TEXT_TOOL_RESULT).join("\n");
67493
67530
  }
67494
- function systemReminder(text4) {
67531
+ function systemReminder(text5) {
67495
67532
  return `<system-reminder>
67496
- ${text4}
67533
+ ${text5}
67497
67534
  </system-reminder>`;
67498
67535
  }
67499
67536
  function turnBlocks(message) {
@@ -67730,9 +67767,9 @@ function flattenToolResult2(content) {
67730
67767
  }
67731
67768
  return content.map((block2) => isTextBlock(block2) ? block2.text : NON_TEXT_TOOL_RESULT2).join("\n");
67732
67769
  }
67733
- function systemReminder2(text4) {
67770
+ function systemReminder2(text5) {
67734
67771
  return `<system-reminder>
67735
- ${text4}
67772
+ ${text5}
67736
67773
  </system-reminder>`;
67737
67774
  }
67738
67775
  function turnBlocks2(message) {
@@ -67857,12 +67894,12 @@ var init_translate2 = __esm({
67857
67894
  function catalogueCachePath(paths, name) {
67858
67895
  return import_node_path44.default.join(paths.catalogueDir, `${name}.json`);
67859
67896
  }
67860
- function parseCatalogueCache(text4) {
67861
- if (text4 === void 0) {
67897
+ function parseCatalogueCache(text5) {
67898
+ if (text5 === void 0) {
67862
67899
  return void 0;
67863
67900
  }
67864
67901
  try {
67865
- const parsed = CatalogueCacheSchema.safeParse(JSON.parse(text4));
67902
+ const parsed = CatalogueCacheSchema.safeParse(JSON.parse(text5));
67866
67903
  return parsed.success ? parsed.data : void 0;
67867
67904
  } catch {
67868
67905
  return void 0;
@@ -68956,14 +68993,57 @@ var init_launcher = __esm({
68956
68993
  }
68957
68994
  });
68958
68995
 
68996
+ // src/replayRun.ts
68997
+ function keyOf2(command, args) {
68998
+ return JSON.stringify([command, args]);
68999
+ }
69000
+ async function resolveWithAsyncRuns(decide, runAsync2) {
69001
+ const answers = /* @__PURE__ */ new Map();
69002
+ const replay = {
69003
+ run: (command, args) => {
69004
+ const answer = answers.get(keyOf2(command, args));
69005
+ if (answer === void 0) {
69006
+ throw new RunNeededError(command, args);
69007
+ }
69008
+ return answer;
69009
+ }
69010
+ };
69011
+ for (; ; ) {
69012
+ try {
69013
+ return decide(replay);
69014
+ } catch (error63) {
69015
+ if (!(error63 instanceof RunNeededError)) {
69016
+ throw error63;
69017
+ }
69018
+ answers.set(keyOf2(error63.command, error63.args), await runAsync2(error63.command, error63.args));
69019
+ }
69020
+ }
69021
+ }
69022
+ var RunNeededError;
69023
+ var init_replayRun = __esm({
69024
+ "src/replayRun.ts"() {
69025
+ "use strict";
69026
+ RunNeededError = class extends Error {
69027
+ constructor(command, args) {
69028
+ super(`no recorded answer for ${command} ${args.join(" ")}`);
69029
+ this.command = command;
69030
+ this.args = args;
69031
+ this.name = "RunNeededError";
69032
+ }
69033
+ command;
69034
+ args;
69035
+ };
69036
+ }
69037
+ });
69038
+
68959
69039
  // src/launchWiring.ts
68960
- function buildFarmRuntime(paths, cwd) {
69040
+ function buildFarmRuntime(paths, cwd, run = realRunPort) {
68961
69041
  const home = import_node_os9.default.homedir();
68962
69042
  const read = cosmiconfigReader();
68963
69043
  const classification = loadClassification(paths);
68964
69044
  const loaded = loadCascadeInput({ paths, home, cwd, read });
68965
69045
  const selections = readDirectorySelections(loaded);
68966
- const git = resolveGitBranch(realRunPort, cwd);
69046
+ const git = resolveGitBranch(run, cwd);
68967
69047
  const updateMode = resolveUpdateMode(loaded.globalConfig);
68968
69048
  return {
68969
69049
  runtime: {
@@ -69010,7 +69090,7 @@ function realPrepareLaunchParams(paths, options) {
69010
69090
  frontdoor: realFrontDoorPort(paths, options.spawnDaemon),
69011
69091
  credentials: { ...realCredentialPort, cache: realCredentialCacheEnv(paths) },
69012
69092
  hold: realHoldPort,
69013
- hasStoredLogin: (identity) => identitySignIn(realFarmFs, { platform: process.platform, run: realRunPort }, { farmRoot: import_node_path46.default.join(paths.identitiesDir, identity), hasCredentialBlock: false }).state !== "signed-out",
69093
+ hasStoredLogin: (identity) => identitySignIn(realFarmFs, { platform: process.platform, run: options.run ?? realRunPort }, { farmRoot: import_node_path46.default.join(paths.identitiesDir, identity), hasCredentialBlock: false }).state !== "signed-out",
69014
69094
  ...farm.directoryIdentity === void 0 ? {} : { directoryPinnedIdentity: farm.directoryIdentity },
69015
69095
  ...farm.directoryConfigProfile === void 0 ? {} : { directoryRuleConfigProfile: farm.directoryConfigProfile },
69016
69096
  ...farm.globalDefaultConfigProfile === void 0 ? {} : { globalDefaultConfigProfile: farm.globalDefaultConfigProfile },
@@ -69022,7 +69102,7 @@ function realPrepareLaunchParams(paths, options) {
69022
69102
  function daemonSpawnerFor(agentShim) {
69023
69103
  return agentShim === void 0 ? (spawnPaths, subcommand, logPath) => spawnDaemonThroughScript(agentShimCliPath())(spawnPaths, subcommand, logPath) : spawnDaemonThrough(agentShim);
69024
69104
  }
69025
- function resolveClaudeLaunch(options) {
69105
+ function resolveClaudeLaunch(options, run = realRunPort) {
69026
69106
  const paths = options.paths ?? resolveLayoutPaths();
69027
69107
  const refusals = [];
69028
69108
  const warnings = [];
@@ -69046,7 +69126,10 @@ function resolveClaudeLaunch(options) {
69046
69126
  const spawnDaemon = () => {
69047
69127
  throw new Error("resolving a launch starts no daemon");
69048
69128
  };
69049
- return { resolution: resolveLaunch(realPrepareLaunchParams(paths, { proc, log, spawnDaemon, farm: buildFarmRuntime(paths, options.cwd) })), warnings };
69129
+ return { resolution: resolveLaunch(realPrepareLaunchParams(paths, { proc, log, spawnDaemon, run, farm: buildFarmRuntime(paths, options.cwd, run) })), warnings };
69130
+ }
69131
+ async function resolveClaudeLaunchAsync(options, runAsync2 = realRunAsync) {
69132
+ return await resolveWithAsyncRuns((run) => resolveClaudeLaunch(options, run), runAsync2);
69050
69133
  }
69051
69134
  var import_node_os9, import_node_path46, import_node_crypto21, LaunchRefusedError;
69052
69135
  var init_launchWiring = __esm({
@@ -69065,6 +69148,7 @@ var init_launchWiring = __esm({
69065
69148
  init_launcher();
69066
69149
  init_launchHook();
69067
69150
  init_cascade();
69151
+ init_replayRun();
69068
69152
  init_paths();
69069
69153
  init_signIn();
69070
69154
  init_realPorts();
@@ -106249,8 +106333,8 @@ var require_utils3 = __commonJS({
106249
106333
  }
106250
106334
  return ind;
106251
106335
  }
106252
- function removeDotSegments(path71) {
106253
- let input2 = path71;
106336
+ function removeDotSegments(path72) {
106337
+ let input2 = path72;
106254
106338
  const output2 = [];
106255
106339
  let nextSlash = -1;
106256
106340
  let len = 0;
@@ -106659,8 +106743,8 @@ var require_schemes = __commonJS({
106659
106743
  }
106660
106744
  if (wsComponent.resourceName) {
106661
106745
  const queryIndex = wsComponent.resourceName.indexOf("?");
106662
- const path71 = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
106663
- wsComponent.path = path71 && path71 !== "/" ? path71 : void 0;
106746
+ const path72 = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
106747
+ wsComponent.path = path72 && path72 !== "/" ? path72 : void 0;
106664
106748
  wsComponent.query = queryIndex === -1 ? void 0 : wsComponent.resourceName.slice(queryIndex + 1);
106665
106749
  wsComponent.resourceName = void 0;
106666
106750
  }
@@ -107612,7 +107696,7 @@ var require_core2 = __commonJS({
107612
107696
  errorsText(errors = this.errors, { separator = ", ", dataVar = "data" } = {}) {
107613
107697
  if (!errors || errors.length === 0)
107614
107698
  return "No errors";
107615
- return errors.map((e14) => `${dataVar}${e14.instancePath} ${e14.message}`).reduce((text4, msg) => text4 + separator + msg);
107699
+ return errors.map((e14) => `${dataVar}${e14.instancePath} ${e14.message}`).reduce((text5, msg) => text5 + separator + msg);
107616
107700
  }
107617
107701
  $dataMetaSchema(metaSchema, keywordsJsonPointers) {
107618
107702
  const rules = this.RULES.all;
@@ -110187,7 +110271,7 @@ var require_dist2 = __commonJS({
110187
110271
  });
110188
110272
 
110189
110273
  // src/cli.ts
110190
- var import_node_path70 = __toESM(require("node:path"), 1);
110274
+ var import_node_path71 = __toESM(require("node:path"), 1);
110191
110275
 
110192
110276
  // node_modules/.pnpm/commander@15.0.0/node_modules/commander/lib/error.js
110193
110277
  var CommanderError = class extends Error {
@@ -113300,9 +113384,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
113300
113384
  * @param {string} [path]
113301
113385
  * @return {(string|null|Command)}
113302
113386
  */
113303
- executableDir(path71) {
113304
- if (path71 === void 0) return this._executableDir;
113305
- this._executableDir = path71;
113387
+ executableDir(path72) {
113388
+ if (path72 === void 0) return this._executableDir;
113389
+ this._executableDir = path72;
113306
113390
  return this;
113307
113391
  }
113308
113392
  /**
@@ -113319,9 +113403,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
113319
113403
  helpWidth: context.helpWidth,
113320
113404
  outputHasColors: context.hasColors
113321
113405
  });
113322
- const text4 = helper.formatHelp(this, helper);
113323
- if (context.hasColors) return text4;
113324
- return this._outputConfiguration.stripColor(text4);
113406
+ const text5 = helper.formatHelp(this, helper);
113407
+ if (context.hasColors) return text5;
113408
+ return this._outputConfiguration.stripColor(text5);
113325
113409
  }
113326
113410
  /**
113327
113411
  * @typedef HelpContext
@@ -113481,7 +113565,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
113481
113565
  * @param {(string | Function)} text - string to add, or a function returning a string
113482
113566
  * @return {Command} `this` command for chaining
113483
113567
  */
113484
- addHelpText(position, text4) {
113568
+ addHelpText(position, text5) {
113485
113569
  const allowedValues = ["beforeAll", "before", "after", "afterAll"];
113486
113570
  if (!allowedValues.includes(position)) {
113487
113571
  throw new Error(`Unexpected value for position to addHelpText.
@@ -113490,10 +113574,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
113490
113574
  const helpEvent = `${position}Help`;
113491
113575
  this.on(helpEvent, (context) => {
113492
113576
  let helpStr;
113493
- if (typeof text4 === "function") {
113494
- helpStr = text4({ error: context.error, command: context.command });
113577
+ if (typeof text5 === "function") {
113578
+ helpStr = text5({ error: context.error, command: context.command });
113495
113579
  } else {
113496
- helpStr = text4;
113580
+ helpStr = text5;
113497
113581
  }
113498
113582
  if (helpStr) {
113499
113583
  context.write(`${helpStr}
@@ -114778,19 +114862,19 @@ function writePools(paths, pools) {
114778
114862
  applyPatch(paths.globalConfigFile, GlobalConfigSchema, { pools }, { defaults: {} });
114779
114863
  }
114780
114864
  function poolCycleOf(pools, name) {
114781
- const walk3 = (current, path71) => {
114865
+ const walk3 = (current, path72) => {
114782
114866
  for (const entry of pools[current]?.identities ?? []) {
114783
114867
  const nested = poolNameOf(poolMemberIdentity(entry));
114784
114868
  if (nested === void 0) {
114785
114869
  continue;
114786
114870
  }
114787
114871
  if (nested === name) {
114788
- return [...path71, nested];
114872
+ return [...path72, nested];
114789
114873
  }
114790
- if (path71.includes(nested)) {
114874
+ if (path72.includes(nested)) {
114791
114875
  continue;
114792
114876
  }
114793
- const found = walk3(nested, [...path71, nested]);
114877
+ const found = walk3(nested, [...path72, nested]);
114794
114878
  if (found !== void 0) {
114795
114879
  return found;
114796
114880
  }
@@ -115991,7 +116075,7 @@ function statuslineChangeOf(options) {
115991
116075
  return void 0;
115992
116076
  }
115993
116077
  const assignments = (options.statusline ?? []).map(parseStatuslineAssignment);
115994
- return { set: Object.fromEntries(assignments.map(({ path: path71, value: value2 }) => [path71, value2])), unset: options.unsetStatusline ?? [] };
116078
+ return { set: Object.fromEntries(assignments.map(({ path: path72, value: value2 }) => [path72, value2])), unset: options.unsetStatusline ?? [] };
115995
116079
  }
115996
116080
  function registerProfileCommand(program2, deps) {
115997
116081
  const { paths } = deps;
@@ -117340,7 +117424,7 @@ async function runSiwcLogout(ports) {
117340
117424
  }
117341
117425
 
117342
117426
  // src/codex/siwcPorts.ts
117343
- var import_node_child_process4 = require("node:child_process");
117427
+ var import_node_child_process5 = require("node:child_process");
117344
117428
  var import_node_crypto11 = require("node:crypto");
117345
117429
  var import_node_http = __toESM(require("node:http"), 1);
117346
117430
 
@@ -117406,7 +117490,7 @@ async function listenForCallback(port, state) {
117406
117490
  }
117407
117491
  function openInBrowser(url2) {
117408
117492
  const command = process.platform === "darwin" ? { file: "open", args: [url2] } : process.platform === "win32" ? { file: "cmd", args: ["/c", "start", "", url2] } : { file: "xdg-open", args: [url2] };
117409
- (0, import_node_child_process4.spawn)(command.file, command.args, { detached: true, stdio: "ignore" }).unref();
117493
+ (0, import_node_child_process5.spawn)(command.file, command.args, { detached: true, stdio: "ignore" }).unref();
117410
117494
  }
117411
117495
 
117412
117496
  // src/codex/siwcStore.ts
@@ -118013,9 +118097,9 @@ function listDirOrReport(fs30, configDir, relative, report) {
118013
118097
  return [];
118014
118098
  }
118015
118099
  }
118016
- function parseJson3(text4) {
118100
+ function parseJson3(text5) {
118017
118101
  try {
118018
- const value2 = JSON.parse(text4);
118102
+ const value2 = JSON.parse(text5);
118019
118103
  return value2;
118020
118104
  } catch {
118021
118105
  return void 0;
@@ -118061,11 +118145,11 @@ function readSessionAgentTree(fs30, configDir, ref, options = {}) {
118061
118145
  }
118062
118146
  const agents = /* @__PURE__ */ new Map();
118063
118147
  for (const candidate of located) {
118064
- const text4 = readFileOrReport(fs30, configDir, candidate.metaPath, report);
118065
- if (text4 === void 0) {
118148
+ const text5 = readFileOrReport(fs30, configDir, candidate.metaPath, report);
118149
+ if (text5 === void 0) {
118066
118150
  continue;
118067
118151
  }
118068
- const parsed = AgentMetaSchema.safeParse(parseJson3(text4));
118152
+ const parsed = AgentMetaSchema.safeParse(parseJson3(text5));
118069
118153
  if (!parsed.success) {
118070
118154
  report({ path: candidate.metaPath, reason: "meta file is not a JSON object with an agentType" });
118071
118155
  continue;
@@ -118109,9 +118193,9 @@ function resolveParents(fs30, configDir, agents, report) {
118109
118193
  if (cached2 !== void 0) {
118110
118194
  return cached2;
118111
118195
  }
118112
- const text4 = readFileOrReport(fs30, configDir, agent.located.transcriptPath, report) ?? "";
118113
- transcriptCache.set(agent.located.id, text4);
118114
- return text4;
118196
+ const text5 = readFileOrReport(fs30, configDir, agent.located.transcriptPath, report) ?? "";
118197
+ transcriptCache.set(agent.located.id, text5);
118198
+ return text5;
118115
118199
  };
118116
118200
  const wouldCycle = (child, parent) => {
118117
118201
  for (let cursor3 = parent; cursor3 !== void 0; cursor3 = parentOf4.get(cursor3)) {
@@ -118168,11 +118252,11 @@ function readTasks(fs30, configDir, ownLists, sharedLists, report) {
118168
118252
  continue;
118169
118253
  }
118170
118254
  const relative = import_node_path35.default.join(relativeDir, name);
118171
- const text4 = readFileOrReport(fs30, configDir, relative, report);
118172
- const parsed = TaskFileSchema.safeParse(text4 === void 0 ? void 0 : parseJson3(text4));
118255
+ const text5 = readFileOrReport(fs30, configDir, relative, report);
118256
+ const parsed = TaskFileSchema.safeParse(text5 === void 0 ? void 0 : parseJson3(text5));
118173
118257
  if (parsed.success) {
118174
118258
  tasks.push(index < ownLists.length ? parsed.data : { ...parsed.data, taskList: scope });
118175
- } else if (text4 !== void 0) {
118259
+ } else if (text5 !== void 0) {
118176
118260
  report({ path: relative, reason: "task file is not a task" });
118177
118261
  }
118178
118262
  }
@@ -118186,10 +118270,10 @@ function readWorkflowRuns(fs30, configDir, relativeDir, report) {
118186
118270
  continue;
118187
118271
  }
118188
118272
  const relative = import_node_path35.default.join(relativeDir, name);
118189
- const text4 = readFileOrReport(fs30, configDir, relative, report);
118190
- const parsed = WorkflowRunFileSchema.safeParse(text4 === void 0 ? void 0 : parseJson3(text4));
118273
+ const text5 = readFileOrReport(fs30, configDir, relative, report);
118274
+ const parsed = WorkflowRunFileSchema.safeParse(text5 === void 0 ? void 0 : parseJson3(text5));
118191
118275
  if (!parsed.success) {
118192
- if (text4 !== void 0) {
118276
+ if (text5 !== void 0) {
118193
118277
  report({ path: relative, reason: "workflow run file is not a run record" });
118194
118278
  }
118195
118279
  continue;
@@ -118754,14 +118838,14 @@ init_poolPick();
118754
118838
  init_realAnthropicUsageProbe();
118755
118839
 
118756
118840
  // src/usage/childRun.ts
118757
- var import_node_child_process5 = require("node:child_process");
118841
+ var import_node_child_process6 = require("node:child_process");
118758
118842
  init_realPorts();
118759
118843
  var CHILD_GRACE_MS = 3e4;
118760
118844
  var STDERR_TAIL_CHARS = 2e3;
118761
118845
  async function runChild(options) {
118762
118846
  const invocation = (options.invocation ?? selfInvocation)(options.args);
118763
118847
  await new Promise((resolve2, reject) => {
118764
- const child = (0, import_node_child_process5.spawn)(invocation.command, [...invocation.args], { stdio: ["ignore", "ignore", "pipe"], env: { ...process.env, AGENT_SHIM_HOME: options.paths.root } });
118848
+ const child = (0, import_node_child_process6.spawn)(invocation.command, [...invocation.args], { stdio: ["ignore", "ignore", "pipe"], env: { ...process.env, AGENT_SHIM_HOME: options.paths.root } });
118765
118849
  let stderr = "";
118766
118850
  child.stderr.on("data", (chunk2) => {
118767
118851
  stderr = `${stderr}${chunk2.toString()}`.slice(-STDERR_TAIL_CHARS);
@@ -119552,8 +119636,8 @@ function finiteNumber(record2, field) {
119552
119636
  const value2 = record2 === void 0 ? void 0 : record2[field];
119553
119637
  return typeof value2 === "number" && Number.isFinite(value2) ? value2 : void 0;
119554
119638
  }
119555
- function excerpt(text4) {
119556
- return text4.length <= RC_PENDING_SUMMARY_EXCERPT_CHARS ? text4 : `${text4.slice(0, RC_PENDING_SUMMARY_EXCERPT_CHARS)}...`;
119639
+ function excerpt(text5) {
119640
+ return text5.length <= RC_PENDING_SUMMARY_EXCERPT_CHARS ? text5 : `${text5.slice(0, RC_PENDING_SUMMARY_EXCERPT_CHARS)}...`;
119557
119641
  }
119558
119642
  function payloadEventsOf(body) {
119559
119643
  const parsed = parseJsonObject(body);
@@ -119658,11 +119742,11 @@ function createRcSessionTracker(deps) {
119658
119742
  };
119659
119743
  const observeExchange = (request7) => {
119660
119744
  const method = (request7.method ?? "").toUpperCase();
119661
- const path71 = new URL(request7.url ?? "/", "http://127.0.0.1").pathname;
119662
- if (!path71.startsWith(RC_SESSIONS_PATH_PREFIX)) {
119745
+ const path72 = new URL(request7.url ?? "/", "http://127.0.0.1").pathname;
119746
+ if (!path72.startsWith(RC_SESSIONS_PATH_PREFIX)) {
119663
119747
  return void 0;
119664
119748
  }
119665
- const tail = path71.slice(RC_SESSIONS_PATH_PREFIX.length);
119749
+ const tail = path72.slice(RC_SESSIONS_PATH_PREFIX.length);
119666
119750
  const facts = {
119667
119751
  oauthAuthorization: oauthAuthorizationOf(request7.headers),
119668
119752
  anthropicVersion: singleHeader(request7.headers, "anthropic-version"),
@@ -119683,8 +119767,8 @@ function createRcSessionTracker(deps) {
119683
119767
  if (!accepted2 || buffered2 >= RC_CREATE_RESPONSE_CAP_BYTES) {
119684
119768
  return;
119685
119769
  }
119686
- const text4 = Buffer.from(chunk2).toString("utf8");
119687
- body = body + text4.slice(0, RC_CREATE_RESPONSE_CAP_BYTES - buffered2);
119770
+ const text5 = Buffer.from(chunk2).toString("utf8");
119771
+ body = body + text5.slice(0, RC_CREATE_RESPONSE_CAP_BYTES - buffered2);
119688
119772
  buffered2 = body.length;
119689
119773
  },
119690
119774
  onEnd: () => {
@@ -119902,13 +119986,13 @@ function teeRoutedResponse(response, observer, onSettled) {
119902
119986
  }
119903
119987
 
119904
119988
  // src/frontdoor/rcWrites.ts
119905
- function buildRcUserMessagePayload(uuid3, sessionId, text4) {
119989
+ function buildRcUserMessagePayload(uuid3, sessionId, text5) {
119906
119990
  return {
119907
119991
  type: "user",
119908
119992
  uuid: uuid3,
119909
119993
  session_id: sessionId,
119910
119994
  parent_tool_use_id: null,
119911
- message: { role: "user", content: text4 }
119995
+ message: { role: "user", content: text5 }
119912
119996
  };
119913
119997
  }
119914
119998
  function buildRcEventWriteBody(payload) {
@@ -119973,7 +120057,7 @@ function rcWriteHeaders(credential) {
119973
120057
  }
119974
120058
  return headers;
119975
120059
  }
119976
- async function injectRcUserMessage(deps, sessionId, text4) {
120060
+ async function injectRcUserMessage(deps, sessionId, text5) {
119977
120061
  const credential = deps.credentialOf(sessionId);
119978
120062
  if (credential === void 0) {
119979
120063
  return { ok: false, message: rcSessionNotObservedMessage(sessionId) };
@@ -119981,7 +120065,7 @@ async function injectRcUserMessage(deps, sessionId, text4) {
119981
120065
  if (credential.authorization === void 0) {
119982
120066
  return noOAuthCredentialResult(sessionId);
119983
120067
  }
119984
- const body = JSON.stringify(buildRcEventWriteBody(buildRcUserMessagePayload(deps.newUuid(), sessionId, text4)));
120068
+ const body = JSON.stringify(buildRcEventWriteBody(buildRcUserMessagePayload(deps.newUuid(), sessionId, text5)));
119985
120069
  let answer;
119986
120070
  try {
119987
120071
  answer = await deps.dial.writeEvents(sessionId, rcWriteHeaders(credential), body);
@@ -120031,8 +120115,8 @@ var RC_READ_FILE_ENCODINGS = ["utf-8", "base64"];
120031
120115
  function isRcReadFileEncoding(value2) {
120032
120116
  return RC_READ_FILE_ENCODINGS.some((encoding) => encoding === value2);
120033
120117
  }
120034
- function buildRcReadFilePayload(requestId, path71, options) {
120035
- return buildRcControlRequestPayload(requestId, { subtype: "read_file", path: path71, ...options?.maxBytes === void 0 ? {} : { max_bytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } });
120118
+ function buildRcReadFilePayload(requestId, path72, options) {
120119
+ return buildRcControlRequestPayload(requestId, { subtype: "read_file", path: path72, ...options?.maxBytes === void 0 ? {} : { max_bytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } });
120036
120120
  }
120037
120121
  function buildRcFileSuggestionsPayload(requestId, query) {
120038
120122
  return buildRcControlRequestPayload(requestId, { subtype: "file_suggestions", query });
@@ -120134,15 +120218,15 @@ async function getRcSessionContextUsage(deps, sessionId, detail) {
120134
120218
  const result = await deliverRcClientPayload(deps, sessionId, buildRcGetContextUsagePayload(requestId, detail), `request the context usage of session ${sessionId}`);
120135
120219
  return result.ok ? { ...result, requestId } : result;
120136
120220
  }
120137
- async function readRcSessionFile(deps, sessionId, path71, options) {
120138
- if (path71 === "") {
120221
+ async function readRcSessionFile(deps, sessionId, path72, options) {
120222
+ if (path72 === "") {
120139
120223
  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" };
120140
120224
  }
120141
120225
  if (options?.maxBytes !== void 0 && (!Number.isInteger(options.maxBytes) || options.maxBytes <= 0)) {
120142
120226
  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" };
120143
120227
  }
120144
120228
  const requestId = deps.newUuid();
120145
- const result = await deliverRcClientPayload(deps, sessionId, buildRcReadFilePayload(requestId, path71, options), `read ${path71} from session ${sessionId}`);
120229
+ const result = await deliverRcClientPayload(deps, sessionId, buildRcReadFilePayload(requestId, path72, options), `read ${path72} from session ${sessionId}`);
120146
120230
  return result.ok ? { ...result, requestId } : result;
120147
120231
  }
120148
120232
  async function suggestRcSessionFiles(deps, sessionId, query) {
@@ -120204,9 +120288,9 @@ var RC_PERMISSION_MODE_LIST = RC_PERMISSION_MODES.join(", ");
120204
120288
  var CONTROL_PATH_PREFIX = "/__agent-shim/rc";
120205
120289
  var CONTROL_BODY_CAP_BYTES = 10485760;
120206
120290
  function answerJson(response, status, body) {
120207
- const text4 = JSON.stringify(body);
120208
- response.writeHead(status, { "content-type": "application/json", "content-length": String(Buffer.byteLength(text4, "utf8")) });
120209
- response.end(text4);
120291
+ const text5 = JSON.stringify(body);
120292
+ response.writeHead(status, { "content-type": "application/json", "content-length": String(Buffer.byteLength(text5, "utf8")) });
120293
+ response.end(text5);
120210
120294
  }
120211
120295
  function isJsonObject(value2) {
120212
120296
  return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
@@ -120313,11 +120397,11 @@ function createRcControlHandler(deps) {
120313
120397
  path: "read-file",
120314
120398
  read: (body) => {
120315
120399
  const session = bodyString(body, "session");
120316
- const path71 = bodyString(body, "path");
120400
+ const path72 = bodyString(body, "path");
120317
120401
  const maxBytes = "maxBytes" in body ? bodyPositiveInteger(body, "maxBytes") : void 0;
120318
120402
  const encoding = "encoding" in body && isRcReadFileEncoding(body.encoding) ? body.encoding : void 0;
120319
- const refused2 = session === void 0 || path71 === void 0 || "maxBytes" in body && maxBytes === void 0 || "encoding" in body && encoding === void 0;
120320
- 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, path71, { ...maxBytes === void 0 ? {} : { maxBytes }, ...encoding === void 0 ? {} : { encoding } }) };
120403
+ const refused2 = session === void 0 || path72 === void 0 || "maxBytes" in body && maxBytes === void 0 || "encoding" in body && encoding === void 0;
120404
+ 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, path72, { ...maxBytes === void 0 ? {} : { maxBytes }, ...encoding === void 0 ? {} : { encoding } }) };
120321
120405
  }
120322
120406
  },
120323
120407
  {
@@ -120455,12 +120539,12 @@ function createRcControlHandler(deps) {
120455
120539
  answerJson(response, HTTP_STATUS.badRequest, { error: "the answer body must be JSON naming a non-empty session id, request id, and an approve boolean" });
120456
120540
  return;
120457
120541
  }
120458
- const text4 = "text" in parsed && typeof parsed.text === "string" ? parsed.text : void 0;
120459
- if (parsed.approve && text4 !== void 0 && text4 !== "") {
120542
+ const text5 = "text" in parsed && typeof parsed.text === "string" ? parsed.text : void 0;
120543
+ if (parsed.approve && text5 !== void 0 && text5 !== "") {
120460
120544
  answerJson(response, HTTP_STATUS.badRequest, { error: "an approval carries no text (the protocol's allow result has no message field); text is the denial message" });
120461
120545
  return;
120462
120546
  }
120463
- const result = await deps.answer(parsed.session, parsed.request, { approve: parsed.approve, message: parsed.approve ? void 0 : text4 });
120547
+ const result = await deps.answer(parsed.session, parsed.request, { approve: parsed.approve, message: parsed.approve ? void 0 : text5 });
120464
120548
  if (result.ok) {
120465
120549
  answerJson(response, HTTP_STATUS.ok, { session: parsed.session, request: parsed.request, sequenceNums: result.sequenceNums });
120466
120550
  return;
@@ -120627,9 +120711,9 @@ function requestIdOfBody(body) {
120627
120711
  }
120628
120712
  function frontDoorRcControl(transport, token) {
120629
120713
  const headers = { authorization: `Bearer ${token}` };
120630
- const listAnswerOf = async (path71, what) => {
120714
+ const listAnswerOf = async (path72, what) => {
120631
120715
  try {
120632
- return await transport.request({ method: "GET", path: path71, headers });
120716
+ return await transport.request({ method: "GET", path: path72, headers });
120633
120717
  } catch (error63) {
120634
120718
  throw new Error(`${what}: could not reach the front door's control listener: ${error63 instanceof Error ? error63.message : String(error63)}`, { cause: error63 });
120635
120719
  }
@@ -120701,10 +120785,10 @@ function frontDoorRcControl(transport, token) {
120701
120785
  }
120702
120786
  return pending;
120703
120787
  };
120704
- const writeOf = async (path71, body, describeFailure2) => {
120788
+ const writeOf = async (path72, body, describeFailure2) => {
120705
120789
  let answer;
120706
120790
  try {
120707
- answer = await transport.request({ method: "POST", path: path71, headers: { ...headers, "content-type": "application/json" }, body });
120791
+ answer = await transport.request({ method: "POST", path: path72, headers: { ...headers, "content-type": "application/json" }, body });
120708
120792
  } catch (error63) {
120709
120793
  return { ok: false, message: `could not reach the front door's control listener: ${error63 instanceof Error ? error63.message : String(error63)}` };
120710
120794
  }
@@ -120723,7 +120807,7 @@ function frontDoorRcControl(transport, token) {
120723
120807
  listSessions: async () => sessionsOf(await listAnswerOf(`${CONTROL_PATH_PREFIX}/sessions`, "listing the door's Remote Control sessions"), "listing the door's Remote Control sessions"),
120724
120808
  statusOf: async (sessionId) => statusesOf(await listAnswerOf(`${CONTROL_PATH_PREFIX}/status${sessionQuery(sessionId)}`, "reading the door's Remote Control session status"), "reading the door's Remote Control session status"),
120725
120809
  pendingOf: async (sessionId) => pendingOfAnswer(await listAnswerOf(`${CONTROL_PATH_PREFIX}/pending${sessionQuery(sessionId)}`, "listing the door's pending Remote Control control requests"), "listing the door's pending Remote Control control requests"),
120726
- sendPrompt: async (sessionId, text4) => await writeOf(`${CONTROL_PATH_PREFIX}/inject`, JSON.stringify({ session: sessionId, text: text4 }), (status, message) => `injecting into ${sessionId} failed (HTTP ${String(status)}): ${message}`),
120810
+ sendPrompt: async (sessionId, text5) => await writeOf(`${CONTROL_PATH_PREFIX}/inject`, JSON.stringify({ session: sessionId, text: text5 }), (status, message) => `injecting into ${sessionId} failed (HTTP ${String(status)}): ${message}`),
120727
120811
  answerRequest: async (sessionId, requestId, decision) => await writeOf(
120728
120812
  `${CONTROL_PATH_PREFIX}/answer`,
120729
120813
  JSON.stringify({ session: sessionId, request: requestId, approve: decision.approve, ...decision.approve || decision.message === void 0 ? {} : { text: decision.message } }),
@@ -120735,10 +120819,10 @@ function frontDoorRcControl(transport, token) {
120735
120819
  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}`),
120736
120820
  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}`),
120737
120821
  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}`),
120738
- readFile: async (sessionId, path71, options) => await writeOf(
120822
+ readFile: async (sessionId, path72, options) => await writeOf(
120739
120823
  `${CONTROL_PATH_PREFIX}/read-file`,
120740
- JSON.stringify({ session: sessionId, path: path71, ...options?.maxBytes === void 0 ? {} : { maxBytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } }),
120741
- (status, message) => `reading ${path71} from ${sessionId} failed (HTTP ${String(status)}): ${message}`
120824
+ JSON.stringify({ session: sessionId, path: path72, ...options?.maxBytes === void 0 ? {} : { maxBytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } }),
120825
+ (status, message) => `reading ${path72} from ${sessionId} failed (HTTP ${String(status)}): ${message}`
120742
120826
  ),
120743
120827
  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}`),
120744
120828
  keepAlive: async (sessionId) => await writeOf(`${CONTROL_PATH_PREFIX}/keep-alive`, JSON.stringify({ session: sessionId }), (status, message) => `keeping ${sessionId} alive failed (HTTP ${String(status)}): ${message}`),
@@ -121051,12 +121135,12 @@ function tlsFacts(options) {
121051
121135
  }
121052
121136
  function realRcEventDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_PORT }) {
121053
121137
  const agent = new ExemptTlsAgent();
121054
- const post = async (path71, headers, body) => await new Promise((resolve2, reject) => {
121138
+ const post = async (path72, headers, body) => await new Promise((resolve2, reject) => {
121055
121139
  const options = {
121056
121140
  host: target.host,
121057
121141
  port: target.port,
121058
121142
  method: "POST",
121059
- path: path71,
121143
+ path: path72,
121060
121144
  // 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.
121061
121145
  headers: { ...headers, host: target.servername ?? target.host, "content-length": String(Buffer.byteLength(body, "utf8")) },
121062
121146
  agent
@@ -121121,12 +121205,12 @@ function lateRcStreamDial(resolve2) {
121121
121205
  }
121122
121206
  function realRcStreamDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_PORT }) {
121123
121207
  const agent = new ExemptTlsAgent();
121124
- const request7 = async (method, path71, headers, body, signal) => await new Promise((resolve2, reject) => {
121208
+ const request7 = async (method, path72, headers, body, signal) => await new Promise((resolve2, reject) => {
121125
121209
  const options = {
121126
121210
  host: target.host,
121127
121211
  port: target.port,
121128
121212
  method,
121129
- path: path71,
121213
+ path: path72,
121130
121214
  // 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.
121131
121215
  headers: { ...headers, host: target.servername ?? target.host, ...body === void 0 ? {} : { "content-length": String(Buffer.byteLength(body, "utf8")) } },
121132
121216
  agent,
@@ -121168,9 +121252,9 @@ function realRcStreamDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_P
121168
121252
  return { status, body: await readAll(response) };
121169
121253
  },
121170
121254
  openStream: async (sessionId, headers, resume, signal) => {
121171
- const path71 = resume === void 0 ? `/v1/code/sessions/${encodeURIComponent(sessionId)}/events/stream` : `/v1/code/sessions/${encodeURIComponent(sessionId)}/events/stream?from_sequence_num=${String(resume.fromSequenceNum)}`;
121255
+ const path72 = resume === void 0 ? `/v1/code/sessions/${encodeURIComponent(sessionId)}/events/stream` : `/v1/code/sessions/${encodeURIComponent(sessionId)}/events/stream?from_sequence_num=${String(resume.fromSequenceNum)}`;
121172
121256
  const streamHeaders = resume === void 0 ? headers : { ...headers, "last-event-id": String(resume.fromSequenceNum) };
121173
- const { status, response } = await request7("GET", path71, streamHeaders, void 0, signal);
121257
+ const { status, response } = await request7("GET", path72, streamHeaders, void 0, signal);
121174
121258
  if (!isSuccessful2(status)) {
121175
121259
  await readAll(response);
121176
121260
  return { status, chunks: NO_CHUNKS };
@@ -122436,11 +122520,11 @@ var AsyncIteratorClass = class {
122436
122520
  return this;
122437
122521
  }
122438
122522
  };
122439
- function parseEmptyableJSON(text4) {
122440
- if (!text4) {
122523
+ function parseEmptyableJSON(text5) {
122524
+ if (!text5) {
122441
122525
  return void 0;
122442
122526
  }
122443
- return JSON.parse(text4);
122527
+ return JSON.parse(text5);
122444
122528
  }
122445
122529
  function stringifyJSON(value2) {
122446
122530
  return JSON.stringify(value2);
@@ -122571,11 +122655,11 @@ function tryOrUndefined(fn2) {
122571
122655
  return void 0;
122572
122656
  }
122573
122657
  }
122574
- function pathToHttpPath(path71) {
122575
- return `/${path71.map(safeEncodeURIComponent).join("/")}`;
122658
+ function pathToHttpPath(path72) {
122659
+ return `/${path72.map(safeEncodeURIComponent).join("/")}`;
122576
122660
  }
122577
- function normalizeHttpPath(path71) {
122578
- const paths = path71.split("/");
122661
+ function normalizeHttpPath(path72) {
122662
+ const paths = path72.split("/");
122579
122663
  if (paths.at(0) === "") {
122580
122664
  paths.shift();
122581
122665
  }
@@ -122760,9 +122844,9 @@ function isPlainObject3(value2) {
122760
122844
  function getOwn(object3, key) {
122761
122845
  return Object.hasOwn(object3, key) ? object3[key] : void 0;
122762
122846
  }
122763
- function get(object3, path71) {
122847
+ function get(object3, path72) {
122764
122848
  let current = object3;
122765
- for (const key of path71) {
122849
+ for (const key of path72) {
122766
122850
  if (!isTypescriptObject(current)) {
122767
122851
  return void 0;
122768
122852
  }
@@ -123491,8 +123575,8 @@ function createORPCErrorFromMalformedResponse(options) {
123491
123575
  }
123492
123576
  var INFERRED_MESSAGE_MIN_LENGTH = 1;
123493
123577
  var INFERRED_MESSAGE_MAX_LENGTH = 256;
123494
- function isInferableMessage(text4) {
123495
- return text4.length >= INFERRED_MESSAGE_MIN_LENGTH && text4.length <= INFERRED_MESSAGE_MAX_LENGTH;
123578
+ function isInferableMessage(text5) {
123579
+ return text5.length >= INFERRED_MESSAGE_MIN_LENGTH && text5.length <= INFERRED_MESSAGE_MAX_LENGTH;
123496
123580
  }
123497
123581
  function inferMalformedResponseMessage(response) {
123498
123582
  if (typeof response.body === "string" && isInferableMessage(response.body)) {
@@ -123985,7 +124069,7 @@ function resolveClientRest(rest) {
123985
124069
  // rest[1] can be undefined if all fields of FriendlyClientOptions are optional
123986
124070
  ];
123987
124071
  }
123988
- function createORPCClient(link, { path: path71 = [], ...options } = {}) {
124072
+ function createORPCClient(link, { path: path72 = [], ...options } = {}) {
123989
124073
  const procedureClient = (...rest) => {
123990
124074
  const [input2, callOptions] = resolveClientRest(rest);
123991
124075
  const interceptors = [
@@ -123994,7 +124078,7 @@ function createORPCClient(link, { path: path71 = [], ...options } = {}) {
123994
124078
  ];
123995
124079
  return intercept(
123996
124080
  interceptors,
123997
- { ...callOptions, input: input2, path: path71 },
124081
+ { ...callOptions, input: input2, path: path72 },
123998
124082
  ({ path: path210, input: input22, ...callOptions2 }) => link.call(path210, input22, callOptions2)
123999
124083
  );
124000
124084
  };
@@ -124008,7 +124092,7 @@ function createORPCClient(link, { path: path71 = [], ...options } = {}) {
124008
124092
  if (client === void 0) {
124009
124093
  client = createORPCClient(link, {
124010
124094
  ...options,
124011
- path: [...path71, key],
124095
+ path: [...path72, key],
124012
124096
  scoped: options.scoped?.[key]
124013
124097
  });
124014
124098
  cache.set(key, client);
@@ -124030,24 +124114,24 @@ var BracketNotationSerializer = class {
124030
124114
  this.internalSerialize(data, "", true, result);
124031
124115
  return result;
124032
124116
  }
124033
- internalSerialize(data, path71, isRoot, result) {
124117
+ internalSerialize(data, path72, isRoot, result) {
124034
124118
  if (Array.isArray(data)) {
124035
124119
  data.forEach((item, i10) => {
124036
- this.internalSerialize(item, isRoot ? i10.toString() : `${path71}[${i10}]`, false, result);
124120
+ this.internalSerialize(item, isRoot ? i10.toString() : `${path72}[${i10}]`, false, result);
124037
124121
  });
124038
124122
  } else if (isPlainObject3(data)) {
124039
124123
  for (const key of Object.keys(data)) {
124040
- this.internalSerialize(data[key], isRoot ? key : `${path71}[${key}]`, false, result);
124124
+ this.internalSerialize(data[key], isRoot ? key : `${path72}[${key}]`, false, result);
124041
124125
  }
124042
124126
  } else {
124043
- result.push([path71, data]);
124127
+ result.push([path72, data]);
124044
124128
  }
124045
124129
  }
124046
124130
  deserialize(serialized) {
124047
124131
  const arrayPushStyles = /* @__PURE__ */ new WeakSet();
124048
124132
  const root = new NullProtoObj();
124049
- for (const [path71, value2] of serialized) {
124050
- const segments = this.parsePath(path71);
124133
+ for (const [path72, value2] of serialized) {
124134
+ const segments = this.parsePath(path72);
124051
124135
  let currentRef = root;
124052
124136
  let nextSegment = segments[0];
124053
124137
  for (let i10 = 1; i10 < segments.length; i10++) {
@@ -124098,13 +124182,13 @@ var BracketNotationSerializer = class {
124098
124182
  }
124099
124183
  return result;
124100
124184
  }
124101
- parsePath(path71) {
124185
+ parsePath(path72) {
124102
124186
  const segments = [];
124103
124187
  let inBrackets = false;
124104
124188
  let currentSegment = "";
124105
- for (let i10 = 0; i10 < path71.length; i10++) {
124106
- const char = path71[i10];
124107
- const nextChar = path71[i10 + 1];
124189
+ for (let i10 = 0; i10 < path72.length; i10++) {
124190
+ const char = path72[i10];
124191
+ const nextChar = path72[i10 + 1];
124108
124192
  if (inBrackets && char === "]" && (nextChar === void 0 || nextChar === "[")) {
124109
124193
  if (nextChar === void 0) {
124110
124194
  inBrackets = false;
@@ -124120,7 +124204,7 @@ var BracketNotationSerializer = class {
124120
124204
  currentSegment += char;
124121
124205
  }
124122
124206
  }
124123
- return inBrackets || segments.length === 0 ? [path71] : segments;
124207
+ return inBrackets || segments.length === 0 ? [path72] : segments;
124124
124208
  }
124125
124209
  };
124126
124210
  var INTEGER_PATTERN = /^0$|^[1-9]\d*$/;
@@ -124693,11 +124777,11 @@ var OpenAPISerializer = class {
124693
124777
  return json2;
124694
124778
  }
124695
124779
  const form = new FormData();
124696
- for (const [path71, value22] of this.bracketNotation.serialize(json2)) {
124780
+ for (const [path72, value22] of this.bracketNotation.serialize(json2)) {
124697
124781
  if (value22 instanceof Blob) {
124698
- form.append(path71, value22);
124782
+ form.append(path72, value22);
124699
124783
  } else if (value22 !== void 0 && value22 !== null) {
124700
- form.append(path71, String(value22));
124784
+ form.append(path72, String(value22));
124701
124785
  }
124702
124786
  }
124703
124787
  return form;
@@ -124735,30 +124819,30 @@ function isBodylessMethod(method) {
124735
124819
  return method === "GET" || method === "HEAD";
124736
124820
  }
124737
124821
  var PARAMETER_NAME_REGEX = /^[\w-]+$/;
124738
- function getDynamicPathParams(path71) {
124739
- if (!path71.includes("{")) {
124822
+ function getDynamicPathParams(path72) {
124823
+ if (!path72.includes("{")) {
124740
124824
  return void 0;
124741
124825
  }
124742
- const len = path71.length;
124826
+ const len = path72.length;
124743
124827
  let params;
124744
124828
  let index = 1;
124745
124829
  while (index < len) {
124746
124830
  const segmentStart = index;
124747
- const slashPos = path71.indexOf("/", index);
124831
+ const slashPos = path72.indexOf("/", index);
124748
124832
  const segmentEnd = slashPos === -1 ? len : slashPos;
124749
- if (segmentEnd > segmentStart && path71.charCodeAt(segmentStart) === 123 && path71.charCodeAt(segmentEnd - 1) === 125) {
124833
+ if (segmentEnd > segmentStart && path72.charCodeAt(segmentStart) === 123 && path72.charCodeAt(segmentEnd - 1) === 125) {
124750
124834
  let parameterStart = segmentStart + 1;
124751
124835
  let allowsSlash = false;
124752
- const operator = path71.charCodeAt(parameterStart);
124836
+ const operator = path72.charCodeAt(parameterStart);
124753
124837
  if (operator === 43) {
124754
124838
  allowsSlash = true;
124755
124839
  parameterStart++;
124756
124840
  }
124757
- const parameterName = path71.slice(parameterStart, segmentEnd - 1);
124841
+ const parameterName = path72.slice(parameterStart, segmentEnd - 1);
124758
124842
  if (PARAMETER_NAME_REGEX.test(parameterName)) {
124759
124843
  params ??= [];
124760
124844
  params.push({
124761
- segment: path71.slice(segmentStart, segmentEnd),
124845
+ segment: path72.slice(segmentStart, segmentEnd),
124762
124846
  startIndex: segmentStart,
124763
124847
  parameterName,
124764
124848
  allowsSlash
@@ -124801,8 +124885,8 @@ openapi.method = (method) => ({
124801
124885
  ...openapi({ method }),
124802
124886
  name: "~openapi/method"
124803
124887
  });
124804
- openapi.path = (path71) => ({
124805
- ...openapi({ path: path71 }),
124888
+ openapi.path = (path72) => ({
124889
+ ...openapi({ path: path72 }),
124806
124890
  name: "~openapi/path"
124807
124891
  });
124808
124892
  openapi.spec = (spec) => ({
@@ -125663,22 +125747,22 @@ function visitJsonSchemaRefs(value2, visit2, schemaLevel = true, seen = /* @__PU
125663
125747
  }
125664
125748
  }
125665
125749
  }
125666
- function mapJsonSchemaRefs(value2, map2, schemaLevel = true, path71 = []) {
125750
+ function mapJsonSchemaRefs(value2, map2, schemaLevel = true, path72 = []) {
125667
125751
  if (!value2 || typeof value2 !== "object") {
125668
125752
  return value2;
125669
125753
  }
125670
125754
  if (Array.isArray(value2)) {
125671
- return value2.map((item, index) => mapJsonSchemaRefs(item, map2, schemaLevel, [...path71, index]));
125755
+ return value2.map((item, index) => mapJsonSchemaRefs(item, map2, schemaLevel, [...path72, index]));
125672
125756
  }
125673
125757
  const result = {};
125674
125758
  for (const key of Object.keys(value2)) {
125675
125759
  const val = value2[key];
125676
125760
  if (key === "$ref" && typeof val === "string") {
125677
- setOwn(result, key, map2(val, [...path71, key]));
125761
+ setOwn(result, key, map2(val, [...path72, key]));
125678
125762
  } else if (!schemaLevel) {
125679
- setOwn(result, key, mapJsonSchemaRefs(val, map2, true, [...path71, key]));
125763
+ setOwn(result, key, mapJsonSchemaRefs(val, map2, true, [...path72, key]));
125680
125764
  } else if (JSON_SCHEMA_LOGIC_KEYWORDS.has(key) || JSON_SCHEMA_RECORD_KEYWORDS.has(key)) {
125681
- setOwn(result, key, mapJsonSchemaRefs(val, map2, !JSON_SCHEMA_RECORD_KEYWORDS.has(key), [...path71, key]));
125765
+ setOwn(result, key, mapJsonSchemaRefs(val, map2, !JSON_SCHEMA_RECORD_KEYWORDS.has(key), [...path72, key]));
125682
125766
  } else {
125683
125767
  setOwn(result, key, val);
125684
125768
  }
@@ -126208,7 +126292,7 @@ function unlazy(maybeLazy) {
126208
126292
  function createProcedureClient(lazyableProcedure, ...rest) {
126209
126293
  const options = resolveMaybeOptionalOptions(rest);
126210
126294
  return async (...[input2, callerOptions]) => {
126211
- const path71 = toArray(options.path);
126295
+ const path72 = toArray(options.path);
126212
126296
  const { default: procedure } = await unlazy(lazyableProcedure);
126213
126297
  const clientContext = callerOptions?.context ?? {};
126214
126298
  const context = await value(options.context, clientContext) ?? {};
@@ -126221,7 +126305,7 @@ function createProcedureClient(lazyableProcedure, ...rest) {
126221
126305
  };
126222
126306
  try {
126223
126307
  const output2 = await runWithSpan("call_procedure", (span) => {
126224
- span?.setAttribute("procedure.path", path71);
126308
+ span?.setAttribute("procedure.path", path72);
126225
126309
  return intercept(
126226
126310
  options.interceptors,
126227
126311
  {
@@ -126229,7 +126313,7 @@ function createProcedureClient(lazyableProcedure, ...rest) {
126229
126313
  // input can be optional if it is undefinable
126230
126314
  input: input2,
126231
126315
  errors,
126232
- path: path71,
126316
+ path: path72,
126233
126317
  procedure,
126234
126318
  signal: callerOptions?.signal,
126235
126319
  lastEventId: callerOptions?.lastEventId
@@ -126480,10 +126564,10 @@ function augmentRouter(router, options) {
126480
126564
  }
126481
126565
  return enhanced;
126482
126566
  }
126483
- function getRouter(router, path71) {
126567
+ function getRouter(router, path72) {
126484
126568
  let current = router;
126485
- for (let i10 = 0; i10 < path71.length; i10++) {
126486
- const segment = path71[i10];
126569
+ for (let i10 = 0; i10 < path72.length; i10++) {
126570
+ const segment = path72[i10];
126487
126571
  if (!isTypescriptObject(current)) {
126488
126572
  return void 0;
126489
126573
  }
@@ -126495,7 +126579,7 @@ function getRouter(router, path71) {
126495
126579
  continue;
126496
126580
  }
126497
126581
  const lazied = current;
126498
- const rest = path71.slice(i10);
126582
+ const rest = path72.slice(i10);
126499
126583
  return new Lazy({
126500
126584
  ...lazied["~orpc"],
126501
126585
  async loader() {
@@ -126510,40 +126594,40 @@ function getRouter(router, path71) {
126510
126594
  }
126511
126595
  return current;
126512
126596
  }
126513
- function walkProcedureContractsSync(router, callback, path71 = []) {
126597
+ function walkProcedureContractsSync(router, callback, path72 = []) {
126514
126598
  const lazyResults = [];
126515
- walkProcedureContractsSyncInternal(router, callback, path71.slice(), lazyResults);
126599
+ walkProcedureContractsSyncInternal(router, callback, path72.slice(), lazyResults);
126516
126600
  return lazyResults;
126517
126601
  }
126518
- function walkProcedureContractsSyncInternal(router, callback, path71, lazyResults) {
126602
+ function walkProcedureContractsSyncInternal(router, callback, path72, lazyResults) {
126519
126603
  const hiddenContract = getHiddenRouterContract(router);
126520
126604
  if (hiddenContract !== void 0) {
126521
126605
  router = hiddenContract;
126522
126606
  }
126523
126607
  if (router instanceof ProcedureContract) {
126524
- callback(router, path71.slice());
126608
+ callback(router, path72.slice());
126525
126609
  return;
126526
126610
  }
126527
126611
  if (!isTypescriptObject(router)) {
126528
126612
  return;
126529
126613
  }
126530
126614
  for (const [key, value2] of Object.entries(router)) {
126531
- path71.push(key);
126615
+ path72.push(key);
126532
126616
  if (value2 instanceof Lazy) {
126533
- lazyResults.push({ router: value2, path: path71.slice() });
126617
+ lazyResults.push({ router: value2, path: path72.slice() });
126534
126618
  } else {
126535
- walkProcedureContractsSyncInternal(value2, callback, path71, lazyResults);
126619
+ walkProcedureContractsSyncInternal(value2, callback, path72, lazyResults);
126536
126620
  }
126537
- path71.pop();
126621
+ path72.pop();
126538
126622
  }
126539
126623
  }
126540
- async function walkProcedureContractsAsync(router, callback, path71 = []) {
126624
+ async function walkProcedureContractsAsync(router, callback, path72 = []) {
126541
126625
  const hiddenContract = getHiddenRouterContract(router);
126542
126626
  if (hiddenContract !== void 0) {
126543
126627
  router = hiddenContract;
126544
126628
  }
126545
126629
  if (router instanceof ProcedureContract) {
126546
- await callback(router, path71);
126630
+ await callback(router, path72);
126547
126631
  return;
126548
126632
  }
126549
126633
  if (!isTypescriptObject(router)) {
@@ -126552,9 +126636,9 @@ async function walkProcedureContractsAsync(router, callback, path71 = []) {
126552
126636
  for (const [key, value2] of Object.entries(router)) {
126553
126637
  if (value2 instanceof Lazy) {
126554
126638
  const { default: router2 } = await unlazy(value2);
126555
- await walkProcedureContractsAsync(router2, callback, [...path71, key]);
126639
+ await walkProcedureContractsAsync(router2, callback, [...path72, key]);
126556
126640
  } else {
126557
- await walkProcedureContractsAsync(value2, callback, [...path71, key]);
126641
+ await walkProcedureContractsAsync(value2, callback, [...path72, key]);
126558
126642
  }
126559
126643
  }
126560
126644
  }
@@ -127040,18 +127124,18 @@ function rewriteComponentSchemaRefs(schema, renameMap) {
127040
127124
  }
127041
127125
  var OpenAPIGeneratorError = class extends TypeError {
127042
127126
  };
127043
- function toOpenAPIPath(path71, dynamicPathParams) {
127127
+ function toOpenAPIPath(path72, dynamicPathParams) {
127044
127128
  if (!dynamicPathParams?.length) {
127045
- return path71;
127129
+ return path72;
127046
127130
  }
127047
127131
  let normalized = "";
127048
127132
  let currentIndex = 0;
127049
127133
  for (const param of dynamicPathParams) {
127050
- normalized += path71.slice(currentIndex, param.startIndex);
127134
+ normalized += path72.slice(currentIndex, param.startIndex);
127051
127135
  normalized += `{${param.parameterName}}`;
127052
127136
  currentIndex = param.startIndex + param.segment.length;
127053
127137
  }
127054
- normalized += path71.slice(currentIndex);
127138
+ normalized += path72.slice(currentIndex);
127055
127139
  return normalized;
127056
127140
  }
127057
127141
  function buildRequest(ctx, operation, def, meta3, dynamicPathParams) {
@@ -127485,8 +127569,8 @@ var OpenAPIGenerator = class {
127485
127569
  customErrorResponseBodySchema: options.customErrorResponseBodySchema
127486
127570
  };
127487
127571
  const errors = [];
127488
- await walkProcedureContractsAsync(router, (contract, path71) => {
127489
- if (value(options.filter, contract, path71) === false) {
127572
+ await walkProcedureContractsAsync(router, (contract, path72) => {
127573
+ if (value(options.filter, contract, path72) === false) {
127490
127574
  return;
127491
127575
  }
127492
127576
  try {
@@ -127498,7 +127582,7 @@ var OpenAPIGenerator = class {
127498
127582
  `QUERY operations require OpenAPI 3.2, but version "${version2}" was requested.`
127499
127583
  );
127500
127584
  }
127501
- const postPath = meta3?.path ?? pathToHttpPath(path71);
127585
+ const postPath = meta3?.path ?? pathToHttpPath(path72);
127502
127586
  const httpPath = meta3?.prefix ? mergeHttpPath(meta3.prefix, postPath) : postPath;
127503
127587
  const dynamicPathParams = getDynamicPathParams(httpPath);
127504
127588
  const openApiPath = toOpenAPIPath(httpPath, dynamicPathParams);
@@ -127507,7 +127591,7 @@ var OpenAPIGenerator = class {
127507
127591
  operation = meta3.spec;
127508
127592
  } else {
127509
127593
  operation = {
127510
- operationId: meta3?.operationId ?? path71.join("."),
127594
+ operationId: meta3?.operationId ?? path72.join("."),
127511
127595
  summary: meta3?.summary,
127512
127596
  description: meta3?.description,
127513
127597
  deprecated: meta3?.deprecated,
@@ -127527,7 +127611,7 @@ var OpenAPIGenerator = class {
127527
127611
  if (!(e14 instanceof OpenAPIGeneratorError)) {
127528
127612
  throw e14;
127529
127613
  }
127530
- errors.push(`Procedure at ${path71.join(".") || "(root)"}: ${e14.message}`);
127614
+ errors.push(`Procedure at ${path72.join(".") || "(root)"}: ${e14.message}`);
127531
127615
  }
127532
127616
  });
127533
127617
  if (errors.length) {
@@ -128229,15 +128313,15 @@ async function toStandardBody(re, options) {
128229
128313
  throw new TypeError("Failed to read body: body stream already read");
128230
128314
  }
128231
128315
  if (hint === "json") {
128232
- const text4 = await re.text();
128233
- return parseEmptyableJSON(text4);
128316
+ const text5 = await re.text();
128317
+ return parseEmptyableJSON(text5);
128234
128318
  }
128235
128319
  if (hint === "form-data") {
128236
128320
  return await re.formData();
128237
128321
  }
128238
128322
  if (hint === "url-search-params") {
128239
- const text4 = await re.text();
128240
- return new URLSearchParams(text4);
128323
+ const text5 = await re.text();
128324
+ return new URLSearchParams(text5);
128241
128325
  }
128242
128326
  if (hint === "event-stream") {
128243
128327
  return toAsyncIteratorObject(re.body);
@@ -128374,16 +128458,16 @@ var StandardLink = class {
128374
128458
  /**
128375
128459
  * @throws ORPCError, transport-level errors (network failures, timeouts, etc.)
128376
128460
  */
128377
- call(path71, input2, options) {
128378
- return runWithSpan(`${ORPC_NAME}.${path71.join("/")}`, (span) => {
128461
+ call(path72, input2, options) {
128462
+ return runWithSpan(`${ORPC_NAME}.${path72.join("/")}`, (span) => {
128379
128463
  span?.setAttribute("rpc.system", ORPC_NAME);
128380
- span?.setAttribute("rpc.method", path71.join("."));
128464
+ span?.setAttribute("rpc.method", path72.join("."));
128381
128465
  if (getTracer() && isAsyncIteratorObject(input2)) {
128382
128466
  input2 = override(input2, traceAsyncIterator("consume_async_iterator_object_input", input2));
128383
128467
  } else if (getTracer() && input2 instanceof ReadableStream) {
128384
128468
  input2 = override(input2, traceReadableStream("consume_octet_stream_input", input2));
128385
128469
  }
128386
- return intercept(this.interceptors, { ...options, path: path71, input: input2 }, async ({ path: path210, input: input22, ...options2 }) => {
128470
+ return intercept(this.interceptors, { ...options, path: path72, input: input2 }, async ({ path: path210, input: input22, ...options2 }) => {
128387
128471
  const tracer = getTracer();
128388
128472
  const activeSpan = tracer?.getActiveSpan() ?? span;
128389
128473
  let request7 = await runWithSpan(
@@ -128440,18 +128524,18 @@ var RPCLinkCodec = class {
128440
128524
  this.headers = options.headers ?? {};
128441
128525
  this.serializer = options.serializer ?? new RPCSerializer();
128442
128526
  }
128443
- async encodeInput(input2, path71, options) {
128444
- let headers = toResolvedStandardHeaders(await value(this.headers, options, path71, input2));
128527
+ async encodeInput(input2, path72, options) {
128528
+ let headers = toResolvedStandardHeaders(await value(this.headers, options, path72, input2));
128445
128529
  if (options.lastEventId !== void 0) {
128446
128530
  headers = mergeStandardHeaders(headers, { "last-event-id": options.lastEventId });
128447
128531
  }
128448
- const expectedMethod = await value(this.expectedMethod, options, path71, input2);
128449
- const baseUrl = await value(this.baseUrl, options, path71, input2);
128532
+ const expectedMethod = await value(this.expectedMethod, options, path72, input2);
128533
+ const baseUrl = await value(this.baseUrl, options, path72, input2);
128450
128534
  const [pathname, search, hash2] = parseStandardUrl(baseUrl);
128451
- const newPathname = `${pathname.replace(END_SLASH_REGEX, "")}${pathToHttpPath(path71)}`;
128535
+ const newPathname = `${pathname.replace(END_SLASH_REGEX, "")}${pathToHttpPath(path72)}`;
128452
128536
  const serialized = this.serializer.serialize(input2);
128453
128537
  if (expectedMethod === "GET" && !(serialized instanceof Blob) && !(serialized instanceof ReadableStream) && !(serialized instanceof FormData) && !isAsyncIteratorObject(serialized)) {
128454
- const maxUrlLength = await value(this.maxUrlLength, options, path71, input2);
128538
+ const maxUrlLength = await value(this.maxUrlLength, options, path72, input2);
128455
128539
  const mergedSearch = new URLSearchParams(search);
128456
128540
  mergedSearch.append("data", stringifyJSON(serialized) ?? "");
128457
128541
  const url22 = `${newPathname}?${mergedSearch}${hash2 ?? ""}`;
@@ -128536,8 +128620,8 @@ var FetchLinkTransport = class {
128536
128620
  this.fetch = options.fetch ?? ((url2, init) => globalThis.fetch(url2, init));
128537
128621
  this.toFetchRequestOptions = options.toFetchRequest;
128538
128622
  }
128539
- async send(standardRequest, path71, options) {
128540
- let origin = await value(this.origin, options, path71);
128623
+ async send(standardRequest, path72, options) {
128624
+ let origin = await value(this.origin, options, path72);
128541
128625
  if (origin?.endsWith("/")) {
128542
128626
  origin = origin.slice(0, -1);
128543
128627
  }
@@ -128557,7 +128641,7 @@ var FetchLinkTransport = class {
128557
128641
  }
128558
128642
  }
128559
128643
  const fetch3 = this.fetch;
128560
- const response = await fetch3(url2, init, options, path71);
128644
+ const response = await fetch3(url2, init, options, path72);
128561
128645
  const standardResponse = toStandardLazyResponse(response);
128562
128646
  return standardResponse;
128563
128647
  }
@@ -128713,16 +128797,16 @@ async function toStandardBody2(req, options = {}) {
128713
128797
  throw new TypeError("Failed to read body: body stream already read or destroyed");
128714
128798
  }
128715
128799
  if (hint === "json") {
128716
- const text4 = await _streamToString(req);
128717
- return parseEmptyableJSON(text4);
128800
+ const text5 = await _streamToString(req);
128801
+ return parseEmptyableJSON(text5);
128718
128802
  }
128719
128803
  const contentType = req.headers["content-type"];
128720
128804
  if (hint === "form-data") {
128721
128805
  return _streamToFormData(req, contentType);
128722
128806
  }
128723
128807
  if (hint === "url-search-params") {
128724
- const text4 = await _streamToString(req);
128725
- return new URLSearchParams(text4);
128808
+ const text5 = await _streamToString(req);
128809
+ return new URLSearchParams(text5);
128726
128810
  }
128727
128811
  if (hint === "event-stream") {
128728
128812
  return toAsyncIteratorObject2(req);
@@ -128948,14 +129032,14 @@ var StandardHandler = class {
128948
129032
  span?.setAttribute("url.path", request22.url);
128949
129033
  return { matched: false };
128950
129034
  }
128951
- const { path: path71, procedure, decodeInput } = matchedOrNot;
128952
- span?.updateName(`${ORPC_NAME}.${path71.join("/")}`);
129035
+ const { path: path72, procedure, decodeInput } = matchedOrNot;
129036
+ span?.updateName(`${ORPC_NAME}.${path72.join("/")}`);
128953
129037
  span?.setAttribute("rpc.system", ORPC_NAME);
128954
- span?.setAttribute("rpc.method", path71.join("."));
129038
+ span?.setAttribute("rpc.method", path72.join("."));
128955
129039
  try {
128956
129040
  const response = await intercept(
128957
129041
  this.interceptors,
128958
- { context: context2, prefix: prefix2, request: request22, path: path71, procedure, decodeInput },
129042
+ { context: context2, prefix: prefix2, request: request22, path: path72, procedure, decodeInput },
128959
129043
  async ({ context: context3, prefix: prefix3, request: request32, path: path210, procedure: procedure2, decodeInput: decodeInput2 }) => {
128960
129044
  step2 = "decode_input";
128961
129045
  let input2 = await runWithSpan("decode_input", decodeInput2);
@@ -128989,7 +129073,7 @@ var StandardHandler = class {
128989
129073
  message: `Malformed request. Ensure the request body is properly formatted and the 'Content-Type' header is set correctly.`,
128990
129074
  cause: e14
128991
129075
  }) : toORPCError(e14);
128992
- const response = await this.codec.encodeError(error63, procedure, path71, { context: context2, prefix: prefix2 });
129076
+ const response = await this.codec.encodeError(error63, procedure, path72, { context: context2, prefix: prefix2 });
128993
129077
  return { matched: true, response };
128994
129078
  }
128995
129079
  }
@@ -129095,7 +129179,7 @@ var RPCMatcher = class {
129095
129179
  this.rootRouter = router;
129096
129180
  this.index(router);
129097
129181
  }
129098
- index(router, path71 = []) {
129182
+ index(router, path72 = []) {
129099
129183
  const lazyResults = walkProcedureContractsSync(router, (procedure, procedurePath) => {
129100
129184
  if (!value(this.filter, procedure, procedurePath)) {
129101
129185
  return;
@@ -129106,7 +129190,7 @@ var RPCMatcher = class {
129106
129190
  // contract-first entries have no implementation yet, resolveProcedure fills it in on demand
129107
129191
  procedure: procedure instanceof Procedure ? procedure : void 0
129108
129192
  });
129109
- }, path71);
129193
+ }, path72);
129110
129194
  for (const result of lazyResults) {
129111
129195
  this.pendingLazyRouters.set(pathToHttpPath(result.path), result);
129112
129196
  }
@@ -129238,10 +129322,10 @@ var RPCHandlerCodec = class {
129238
129322
  }
129239
129323
  };
129240
129324
  }
129241
- encodeOutput(output2, procedure, path71, options) {
129325
+ encodeOutput(output2, procedure, path72, options) {
129242
129326
  return {
129243
129327
  headers: {},
129244
- status: value(this.outputStatus, output2, procedure, path71, options) ?? DEFAULT_SUCCESS_STATUS,
129328
+ status: value(this.outputStatus, output2, procedure, path72, options) ?? DEFAULT_SUCCESS_STATUS,
129245
129329
  body: this.serializer.serialize(output2)
129246
129330
  };
129247
129331
  }
@@ -129295,39 +129379,39 @@ function createRouter() {
129295
129379
  static: new NullProtoObj2()
129296
129380
  };
129297
129381
  }
129298
- function scanFirstGroup(path71) {
129382
+ function scanFirstGroup(path72) {
129299
129383
  let i10 = 0;
129300
129384
  let depth = 0;
129301
- for (; i10 < path71.length; i10++) {
129302
- const c10 = path71.charCodeAt(i10);
129385
+ for (; i10 < path72.length; i10++) {
129386
+ const c10 = path72.charCodeAt(i10);
129303
129387
  if (c10 === 92) i10++;
129304
129388
  else if (c10 === 40) depth++;
129305
129389
  else if (c10 === 41 && depth > 0) depth--;
129306
129390
  else if (c10 === 123 && depth === 0) break;
129307
129391
  }
129308
- if (i10 >= path71.length) return;
129392
+ if (i10 >= path72.length) return;
129309
129393
  let j10 = i10 + 1;
129310
129394
  depth = 0;
129311
- for (; j10 < path71.length; j10++) {
129312
- const c10 = path71.charCodeAt(j10);
129395
+ for (; j10 < path72.length; j10++) {
129396
+ const c10 = path72.charCodeAt(j10);
129313
129397
  if (c10 === 92) j10++;
129314
129398
  else if (c10 === 40) depth++;
129315
129399
  else if (c10 === 41 && depth > 0) depth--;
129316
129400
  else if (c10 === 125 && depth === 0) break;
129317
129401
  }
129318
- if (j10 >= path71.length) return;
129319
- const mod = path71[j10 + 1];
129402
+ if (j10 >= path72.length) return;
129403
+ const mod = path72[j10 + 1];
129320
129404
  const hasMod = mod === "?" || mod === "+" || mod === "*";
129321
129405
  return [
129322
- path71.slice(0, i10),
129323
- path71.slice(i10 + 1, j10),
129324
- path71.slice(j10 + (hasMod ? 2 : 1)),
129406
+ path72.slice(0, i10),
129407
+ path72.slice(i10 + 1, j10),
129408
+ path72.slice(j10 + (hasMod ? 2 : 1)),
129325
129409
  hasMod ? mod : void 0
129326
129410
  ];
129327
129411
  }
129328
- function expandGroupDelimiters(path71) {
129329
- if (!path71.includes("{")) return;
129330
- const group = scanFirstGroup(path71);
129412
+ function expandGroupDelimiters(path72) {
129413
+ if (!path72.includes("{")) return;
129414
+ const group = scanFirstGroup(path72);
129331
129415
  if (!group) return;
129332
129416
  const [pre2, body, suf, mod] = group;
129333
129417
  if (!mod) return [pre2 + body + suf];
@@ -129397,9 +129481,9 @@ function replaceSegmentWildcards(segment, unnamedStart, toGroupKey = toUnnamedGr
129397
129481
  }
129398
129482
  return [replaced, nextIndex];
129399
129483
  }
129400
- function encodeEscapes(path71) {
129401
- if (!path71.includes("\\")) return path71;
129402
- return path71.replace(/\\([:(){}])/g, (_, c10) => "\uFFFD" + "ABCDE"[":(){}".indexOf(c10)]);
129484
+ function encodeEscapes(path72) {
129485
+ if (!path72.includes("\\")) return path72;
129486
+ return path72.replace(/\\([:(){}])/g, (_, c10) => "\uFFFD" + "ABCDE"[":(){}".indexOf(c10)]);
129403
129487
  }
129404
129488
  function segmentKey(segment) {
129405
129489
  if (segment.startsWith("**")) return 2;
@@ -129428,22 +129512,22 @@ function expandModifiers(segments) {
129428
129512
  return m10[2] === "+" ? [wc2] : [wc2, without];
129429
129513
  }
129430
129514
  }
129431
- function normalizePath(path71) {
129432
- if (!path71.includes("/.")) return path71;
129515
+ function normalizePath(path72) {
129516
+ if (!path72.includes("/.")) return path72;
129433
129517
  const r10 = [];
129434
- for (const s of path71.split("/")) if (s === ".") continue;
129518
+ for (const s of path72.split("/")) if (s === ".") continue;
129435
129519
  else if (s === ".." && r10.length > 1) r10.pop();
129436
129520
  else r10.push(s);
129437
129521
  return r10.join("/") || "/";
129438
129522
  }
129439
- function splitPath(path71) {
129440
- const s = path71.split("/");
129523
+ function splitPath(path72) {
129524
+ const s = path72.split("/");
129441
129525
  s.shift();
129442
129526
  if (s[s.length - 1] === "") s.pop();
129443
129527
  return s;
129444
129528
  }
129445
- function splitRoute(path71) {
129446
- const s = splitPath(path71);
129529
+ function splitRoute(path72) {
129530
+ const s = splitPath(path72);
129447
129531
  while (s[s.length - 1] === "") s.pop();
129448
129532
  return s;
129449
129533
  }
@@ -129459,16 +129543,16 @@ function getMatchParams(segments, paramsMap) {
129459
129543
  }
129460
129544
  return params;
129461
129545
  }
129462
- function addRoute(ctx, method = "", path71, data) {
129546
+ function addRoute(ctx, method = "", path72, data) {
129463
129547
  method = method.toUpperCase();
129464
- if (path71.charCodeAt(0) !== 47) path71 = `/${path71}`;
129465
- const groupExpanded = expandGroupDelimiters(path71);
129548
+ if (path72.charCodeAt(0) !== 47) path72 = `/${path72}`;
129549
+ const groupExpanded = expandGroupDelimiters(path72);
129466
129550
  if (groupExpanded) {
129467
129551
  for (const expandedPath of groupExpanded) addRoute(ctx, method, expandedPath, data);
129468
129552
  return;
129469
129553
  }
129470
- path71 = encodeEscapes(path71);
129471
- const segments = splitRoute(path71);
129554
+ path72 = encodeEscapes(path72);
129555
+ const segments = splitRoute(path72);
129472
129556
  const expanded = expandModifiers(segments);
129473
129557
  if (expanded) {
129474
129558
  for (const p of expanded) addRoute(ctx, method, p, data);
@@ -129559,15 +129643,15 @@ function getParamRegexp(segment, unnamedStart = 0) {
129559
129643
  const regex2 = _s2.replace(/:([\w-]+)(?:\(([^)]*)\))?/g, (_, id2, p) => `(?<${toGroupName(id2)}>${p || "[^/]+"})`).replace(/\((?![?<])/g, () => `(?<${toUnnamedGroupKey(_i2++)}>`).replace(/\uFFFE(.)/g, (_, c10) => /[.*+?^${}()|[\]\\]/.test(c10) ? `\\${c10}` : c10);
129560
129644
  return [new RegExp(`^${regex2}$`), _i2];
129561
129645
  }
129562
- function findRoute(ctx, method = "", path71, opts) {
129563
- if (opts?.normalize) path71 = normalizePath(path71);
129564
- if (path71.charCodeAt(path71.length - 1) === 47) path71 = path71.slice(0, -1);
129565
- const staticNode = ctx.static[path71];
129646
+ function findRoute(ctx, method = "", path72, opts) {
129647
+ if (opts?.normalize) path72 = normalizePath(path72);
129648
+ if (path72.charCodeAt(path72.length - 1) === 47) path72 = path72.slice(0, -1);
129649
+ const staticNode = ctx.static[path72];
129566
129650
  if (staticNode && staticNode.methods) {
129567
129651
  const staticMatch = staticNode.methods[method] || staticNode.methods[""];
129568
129652
  if (staticMatch !== void 0) return staticMatch[0];
129569
129653
  }
129570
- const segments = splitPath(path71);
129654
+ const segments = splitPath(path72);
129571
129655
  const match = _lookupTree(ctx.root, method, segments, 0);
129572
129656
  if (match === void 0) return;
129573
129657
  if (opts?.params === false) return match;
@@ -129767,7 +129851,7 @@ var OpenAPIMatcher = class {
129767
129851
  this.rootRouter = router;
129768
129852
  this.index(router);
129769
129853
  }
129770
- index(router, path71 = []) {
129854
+ index(router, path72 = []) {
129771
129855
  const lazyResults = walkProcedureContractsSync(router, (contract, path210) => {
129772
129856
  if (!value(this.filter, contract, path210)) {
129773
129857
  return;
@@ -129782,7 +129866,7 @@ var OpenAPIMatcher = class {
129782
129866
  contract,
129783
129867
  procedure: contract instanceof Procedure ? contract : void 0
129784
129868
  });
129785
- }, path71);
129869
+ }, path72);
129786
129870
  for (const result of lazyResults) {
129787
129871
  const prefix = getOpenAPIMeta(result.router)?.prefix;
129788
129872
  this.pendingLazyRouters.add({
@@ -129869,20 +129953,20 @@ var OpenAPIMatcher = class {
129869
129953
  return entry.procedure;
129870
129954
  }
129871
129955
  };
129872
- function toRou3Pattern(path71) {
129873
- const params = getDynamicPathParams(path71);
129956
+ function toRou3Pattern(path72) {
129957
+ const params = getDynamicPathParams(path72);
129874
129958
  if (!params?.length) {
129875
- return path71;
129959
+ return path72;
129876
129960
  }
129877
129961
  for (let i10 = params.length - 1; i10 >= 0; i10--) {
129878
129962
  const param = params[i10];
129879
129963
  const pattern = param.allowsSlash ? `**:${param.parameterName}` : `:${param.parameterName}`;
129880
- path71 = path71.slice(0, param.startIndex) + pattern + path71.slice(param.startIndex + param.segment.length);
129964
+ path72 = path72.slice(0, param.startIndex) + pattern + path72.slice(param.startIndex + param.segment.length);
129881
129965
  }
129882
- return path71;
129966
+ return path72;
129883
129967
  }
129884
- function toRou3PrefixMatcher(path71) {
129885
- const pattern = toRou3Pattern(path71);
129968
+ function toRou3PrefixMatcher(path72) {
129969
+ const pattern = toRou3Pattern(path72);
129886
129970
  return routeToRegExp(pattern === "/" ? "/**" : `${pattern}/**`);
129887
129971
  }
129888
129972
  function decodeParams(params) {
@@ -129961,7 +130045,7 @@ var OpenAPIHandlerCodecCore = class {
129961
130045
  /**
129962
130046
  * @throws {TypeError} If `outputStructure` is "detailed" and the output doesn't match the expected structure.
129963
130047
  */
129964
- encodeOutput(output2, procedure, path71) {
130048
+ encodeOutput(output2, procedure, path72) {
129965
130049
  const meta3 = getOpenAPIMeta(procedure);
129966
130050
  const successStatus = meta3?.successStatus ?? DEFAULT_SUCCESS_STATUS;
129967
130051
  const outputStructure = meta3?.outputStructure ?? DEFAULT_OPENAPI_OUTPUT_STRUCTURE;
@@ -129974,7 +130058,7 @@ var OpenAPIHandlerCodecCore = class {
129974
130058
  }
129975
130059
  if (!isValidDetailedOutput(output2)) {
129976
130060
  throw new TypeError(`
129977
- Invalid "detailed" output structure returned by procedure (${path71.join(".")}):
130061
+ Invalid "detailed" output structure returned by procedure (${path72.join(".")}):
129978
130062
  \u2022 Expected an object with optional properties:
129979
130063
  - status (number <400)
129980
130064
  - headers (object)
@@ -130542,7 +130626,7 @@ function profileValue(name, paths) {
130542
130626
  function createConfigApiRouter(deps) {
130543
130627
  const authed = doorApiAuth(deps.expectedToken);
130544
130628
  const { paths } = deps;
130545
- const route = (path71, summary) => authed.meta(openapi({ method: "POST", path: path71, summary, tags: [CONFIG_API_TAG] }));
130629
+ const route = (path72, summary) => authed.meta(openapi({ method: "POST", path: path72, summary, tags: [CONFIG_API_TAG] }));
130546
130630
  return {
130547
130631
  config: {
130548
130632
  identity: {
@@ -130973,9 +131057,9 @@ function createLaunchApiRouter(deps) {
130973
131057
  // A POST because the launch's environment and arguments are a body, but the answer changes nothing.
130974
131058
  spec: (current) => ({ ...current, [READ_ONLY_OPERATION_EXTENSION]: true })
130975
131059
  })
130976
- ).input(LaunchResolveInputSchema).output(LaunchResolveOutputSchema).handler(({ input: input2 }) => {
131060
+ ).input(LaunchResolveInputSchema).output(LaunchResolveOutputSchema).handler(async ({ input: input2 }) => {
130977
131061
  try {
130978
- const { resolution, warnings } = deps.resolveLaunch({ path: input2.path, argv: input2.argv ?? [], env: input2.env ?? {} });
131062
+ const { resolution, warnings } = await deps.resolveLaunch({ path: input2.path, argv: input2.argv ?? [], env: input2.env ?? {} });
130979
131063
  return { ...resolution, warnings };
130980
131064
  } catch (error63) {
130981
131065
  if (error63 instanceof CliError) {
@@ -131502,16 +131586,16 @@ function walk2(body, hashing, parentAfter) {
131502
131586
  continue;
131503
131587
  }
131504
131588
  const isKey = kind === STRING && depth >= 1 && expectKey[depth - 1] === true;
131505
- const text4 = isKey ? body.toString("latin1", start, end) : void 0;
131506
- if (isKey && text4 === CACHE_MARKER_KEY) {
131589
+ const text5 = isKey ? body.toString("latin1", start, end) : void 0;
131590
+ if (isKey && text5 === CACHE_MARKER_KEY) {
131507
131591
  skipNextValue = true;
131508
131592
  continue;
131509
131593
  }
131510
131594
  if (depth === 1 && isKey) {
131511
- topKey = text4;
131595
+ topKey = text5;
131512
131596
  }
131513
131597
  const closesMessages = kind === CLOSE && inMessages && depth === MESSAGES_ARRAY_DEPTH;
131514
- if (hashing && !closesMessages && !(depth === 1 && isKey && !THREAD_MEMBER_KEYS.has(text4 ?? ""))) {
131598
+ if (hashing && !closesMessages && !(depth === 1 && isKey && !THREAD_MEMBER_KEYS.has(text5 ?? ""))) {
131515
131599
  const target = inMessages ? messages : depth >= 1 && topKey !== void 0 && THREAD_MEMBER_KEYS.has(topKey) ? thread : void 0;
131516
131600
  if (target !== void 0) {
131517
131601
  target.update(body.subarray(start, end));
@@ -132485,8 +132569,8 @@ function createCodexRoute(ports) {
132485
132569
  if (!parsed.success) {
132486
132570
  return errorResponse(HTTP_STATUS.badRequest, "not a count_tokens request");
132487
132571
  }
132488
- const text4 = JSON.stringify({ system: parsed.data.system, messages: parsed.data.messages, tools: parsed.data.tools });
132489
- return { status: HTTP_STATUS.ok, headers: { "Content-Type": "application/json" }, body: JSON.stringify({ input_tokens: Math.ceil(text4.length / CHARS_PER_TOKEN) }) };
132572
+ const text5 = JSON.stringify({ system: parsed.data.system, messages: parsed.data.messages, tools: parsed.data.tools });
132573
+ return { status: HTTP_STATUS.ok, headers: { "Content-Type": "application/json" }, body: JSON.stringify({ input_tokens: Math.ceil(text5.length / CHARS_PER_TOKEN) }) };
132490
132574
  };
132491
132575
  return async (request7) => {
132492
132576
  if (request7.method === "GET" && request7.path === "/healthz") {
@@ -132569,8 +132653,8 @@ function createCodexRouteMount(ports, upstreamBase, provider) {
132569
132653
  request7.body.resume();
132570
132654
  return;
132571
132655
  }
132572
- const path71 = new URL(request7.url, "http://127.0.0.1").pathname;
132573
- const translated = { method: request7.method, path: path71, body, signal: request7.signal };
132656
+ const path72 = new URL(request7.url, "http://127.0.0.1").pathname;
132657
+ const translated = { method: request7.method, path: path72, body, signal: request7.signal };
132574
132658
  const routed = await route(translated);
132575
132659
  if (request7.signal.aborted) {
132576
132660
  return;
@@ -132767,7 +132851,7 @@ init_translate();
132767
132851
  init_cloudUpstream();
132768
132852
 
132769
132853
  // src/antigravity/localUpstream.ts
132770
- var import_node_child_process6 = require("node:child_process");
132854
+ var import_node_child_process7 = require("node:child_process");
132771
132855
  var import_node_net2 = __toESM(require("node:net"), 1);
132772
132856
  var import_node_readline2 = __toESM(require("node:readline"), 1);
132773
132857
  init_zod();
@@ -132792,7 +132876,7 @@ function spawnProcess(command, signal) {
132792
132876
  throw new Error("ACP command cannot be empty");
132793
132877
  }
132794
132878
  const args = command.slice(1);
132795
- const proc = (0, import_node_child_process6.spawn)(bin, args, {
132879
+ const proc = (0, import_node_child_process7.spawn)(bin, args, {
132796
132880
  stdio: ["pipe", "pipe", "inherit"],
132797
132881
  signal
132798
132882
  });
@@ -133191,8 +133275,8 @@ function createAntigravityRouteMount(ports, upstreamBase, provider) {
133191
133275
  request7.body.resume();
133192
133276
  return;
133193
133277
  }
133194
- const path71 = new URL(request7.url, "http://127.0.0.1").pathname;
133195
- const translated = { method: request7.method, path: path71, body, signal: request7.signal };
133278
+ const path72 = new URL(request7.url, "http://127.0.0.1").pathname;
133279
+ const translated = { method: request7.method, path: path72, body, signal: request7.signal };
133196
133280
  const routed = await route(translated);
133197
133281
  if (request7.signal.aborted) {
133198
133282
  return;
@@ -133233,7 +133317,7 @@ function createPassthroughRoute(name, target) {
133233
133317
  headroomUpstream: target.headroomUpstream,
133234
133318
  serve: async (request7, response) => {
133235
133319
  const incoming = new URL(request7.url, "http://127.0.0.1");
133236
- const path71 = target.stripPrefix !== void 0 && incoming.pathname.startsWith(target.stripPrefix) ? incoming.pathname.slice(target.stripPrefix.length) : incoming.pathname;
133320
+ const path72 = target.stripPrefix !== void 0 && incoming.pathname.startsWith(target.stripPrefix) ? incoming.pathname.slice(target.stripPrefix.length) : incoming.pathname;
133237
133321
  const headers = forwardableHeaders(request7.headers);
133238
133322
  delete headers.host;
133239
133323
  await new Promise((resolve2) => {
@@ -133241,7 +133325,7 @@ function createPassthroughRoute(name, target) {
133241
133325
  host: base.hostname,
133242
133326
  port: base.port === "" ? void 0 : Number(base.port),
133243
133327
  method: request7.method,
133244
- path: `${basePath}${path71}${incoming.search}`,
133328
+ path: `${basePath}${path72}${incoming.search}`,
133245
133329
  headers,
133246
133330
  agent
133247
133331
  };
@@ -133347,28 +133431,28 @@ async function scanRequestHead(request7, wholeBody = false) {
133347
133431
  const body = request7.body;
133348
133432
  const head = [];
133349
133433
  let seen = 0;
133350
- let text4 = "";
133434
+ let text5 = "";
133351
133435
  let decided = false;
133352
133436
  let ended = false;
133353
133437
  let error63;
133354
133438
  const replay = new import_node_stream2.PassThrough();
133355
- const modelIn = () => /"model"\s*:\s*"([^"]+)"/.exec(text4)?.[1];
133439
+ const modelIn = () => /"model"\s*:\s*"([^"]+)"/.exec(text5)?.[1];
133356
133440
  const settled = new Promise((resolve2) => {
133357
133441
  const settle2 = () => {
133358
133442
  const model = modelIn();
133359
- const hasImage = /"type"\s*:\s*"image"/.test(text4);
133443
+ const hasImage = /"type"\s*:\s*"image"/.test(text5);
133360
133444
  for (const chunk2 of head) {
133361
133445
  replay.write(chunk2);
133362
133446
  }
133363
- const maxTokens = /"max_tokens"\s*:\s*([0-9]+)/.exec(text4)?.[1];
133447
+ const maxTokens = /"max_tokens"\s*:\s*([0-9]+)/.exec(text5)?.[1];
133364
133448
  resolve2({
133365
133449
  ...model === void 0 ? {} : { model },
133366
133450
  hasImage,
133367
- toolsPresent: /"tools"\s*:\s*\[\s*\{/.test(text4),
133368
- thinking: /"thinking"\s*:\s*\{\s*"type"\s*:\s*"enabled"/.test(text4),
133451
+ toolsPresent: /"tools"\s*:\s*\[\s*\{/.test(text5),
133452
+ thinking: /"thinking"\s*:\s*\{\s*"type"\s*:\s*"enabled"/.test(text5),
133369
133453
  ...maxTokens === void 0 ? {} : { maxTokens: Number(maxTokens) },
133370
133454
  isCountTokens: request7.url.includes("/v1/messages/count_tokens"),
133371
- ...wholeBody ? { whole: true, text: text4 } : {},
133455
+ ...wholeBody ? { whole: true, text: text5 } : {},
133372
133456
  replayed: { ...request7, body: replay }
133373
133457
  });
133374
133458
  };
@@ -133384,7 +133468,7 @@ async function scanRequestHead(request7, wholeBody = false) {
133384
133468
  }
133385
133469
  head.push(chunk2);
133386
133470
  seen += chunk2.length;
133387
- text4 += chunk2.toString("utf8");
133471
+ text5 += chunk2.toString("utf8");
133388
133472
  if (!wholeBody && (modelIn() !== void 0 || seen >= REQUEST_SCAN_CAP_BYTES)) {
133389
133473
  decided = true;
133390
133474
  settle2();
@@ -133413,13 +133497,13 @@ async function scanRequestHead(request7, wholeBody = false) {
133413
133497
  }
133414
133498
 
133415
133499
  // src/frontdoor/providerRoute.ts
133416
- var isRcSelfHostPath = (path71) => path71 === "/v1/code/sessions" || path71.startsWith("/v1/code/sessions/") || path71 === "/v1/sessions" || path71.startsWith("/v1/sessions/");
133500
+ var isRcSelfHostPath = (path72) => path72 === "/v1/code/sessions" || path72.startsWith("/v1/code/sessions/") || path72 === "/v1/sessions" || path72.startsWith("/v1/sessions/");
133417
133501
  function scopeSessionProviderPath(request7) {
133418
133502
  if (request7.session.provider === void 0) {
133419
133503
  return request7;
133420
133504
  }
133421
- const path71 = new URL(request7.url, "http://127.0.0.1").pathname;
133422
- if (!path71.startsWith("/v1/") || isRcSelfHostPath(path71)) {
133505
+ const path72 = new URL(request7.url, "http://127.0.0.1").pathname;
133506
+ if (!path72.startsWith("/v1/") || isRcSelfHostPath(path72)) {
133423
133507
  return request7;
133424
133508
  }
133425
133509
  return { ...request7, url: `${PROVIDER_PATH_PREFIX}${encodeURIComponent(request7.session.provider)}${request7.url}` };
@@ -133543,13 +133627,13 @@ function createProviderRouteResolver(deps) {
133543
133627
  return route;
133544
133628
  };
133545
133629
  const resolve2 = (request7) => {
133546
- const path71 = new URL(request7.url, "http://127.0.0.1").pathname;
133547
- const scoped = parseProviderPath(path71);
133630
+ const path72 = new URL(request7.url, "http://127.0.0.1").pathname;
133631
+ const scoped = parseProviderPath(path72);
133548
133632
  if (scoped === void 0) {
133549
- if (deps.rcSelfHostRoute !== void 0 && isRcSelfHostPath(path71)) {
133633
+ if (deps.rcSelfHostRoute !== void 0 && isRcSelfHostPath(path72)) {
133550
133634
  return { ok: true, route: deps.rcSelfHostRoute };
133551
133635
  }
133552
- return path71.startsWith("/v1/") ? { ok: true, route: oauthRoute } : { ok: false, status: HTTP_STATUS.notFound, message: `no such endpoint: ${path71}` };
133636
+ return path72.startsWith("/v1/") ? { ok: true, route: oauthRoute } : { ok: false, status: HTTP_STATUS.notFound, message: `no such endpoint: ${path72}` };
133553
133637
  }
133554
133638
  const { provider } = scoped;
133555
133639
  let definition;
@@ -133641,8 +133725,8 @@ function createProviderRouteResolver(deps) {
133641
133725
  let modelChoice;
133642
133726
  const visited = /* @__PURE__ */ new Set();
133643
133727
  for (; ; ) {
133644
- const path71 = new URL(current.url, "http://127.0.0.1").pathname;
133645
- const scoped = parseProviderPath(path71);
133728
+ const path72 = new URL(current.url, "http://127.0.0.1").pathname;
133729
+ const scoped = parseProviderPath(path72);
133646
133730
  const providerName = scoped?.provider ?? current.session.provider;
133647
133731
  if (providerName !== void 0 && visited.has(providerName)) {
133648
133732
  return { ok: false, status: HTTP_STATUS.internalServerError, message: `provider routing cycle: ${[...visited, providerName].join(" -> ")}` };
@@ -133657,7 +133741,7 @@ function createProviderRouteResolver(deps) {
133657
133741
  } catch {
133658
133742
  routes = void 0;
133659
133743
  }
133660
- const resolvesNames = !nameResolved && !isRcSelfHostPath(path71);
133744
+ const resolvesNames = !nameResolved && !isRcSelfHostPath(path72);
133661
133745
  if (resolvesNames) {
133662
133746
  const scan2 = await scanRequestHead(current, true);
133663
133747
  if (scan2.replayed === void 0) {
@@ -133696,7 +133780,7 @@ function createProviderRouteResolver(deps) {
133696
133780
  }
133697
133781
  if (routed.provider !== providerName) {
133698
133782
  const scopedPrefix = providerName === void 0 ? void 0 : `${PROVIDER_PATH_PREFIX}${encodeURIComponent(providerName)}`;
133699
- const rest2 = scopedPrefix !== void 0 && path71.startsWith(scopedPrefix) ? path71.slice(scopedPrefix.length) : path71;
133783
+ const rest2 = scopedPrefix !== void 0 && path72.startsWith(scopedPrefix) ? path72.slice(scopedPrefix.length) : path72;
133700
133784
  const query2 = current.url.includes("?") ? current.url.slice(current.url.indexOf("?")) : "";
133701
133785
  const carried = replay;
133702
133786
  current = { ...current, url: `${PROVIDER_PATH_PREFIX}${encodeURIComponent(routed.provider)}${rest2}${query2}`, body: carried.body, headers: carried.headers };
@@ -133750,7 +133834,7 @@ function createProviderRouteResolver(deps) {
133750
133834
  const headers = Object.fromEntries(Object.entries(replay.headers).filter(([name]) => name.toLowerCase() !== "content-length"));
133751
133835
  replay = { ...replay, headers, body: import_node_stream3.Readable.from([Buffer.from(rewritten, "utf8")]) };
133752
133836
  }
133753
- const rest = scoped === void 0 ? path71 : path71.slice(`${PROVIDER_PATH_PREFIX}${encodeURIComponent(scoped.provider)}`.length);
133837
+ const rest = scoped === void 0 ? path72 : path72.slice(`${PROVIDER_PATH_PREFIX}${encodeURIComponent(scoped.provider)}`.length);
133754
133838
  const query = current.url.includes("?") ? current.url.slice(current.url.indexOf("?")) : "";
133755
133839
  current = { ...current, url: `${PROVIDER_PATH_PREFIX}${encodeURIComponent(matched.provider)}${rest}${query}`, body: replay.body, headers: replay.headers };
133756
133840
  }
@@ -133888,9 +133972,9 @@ function growthBookFeatures() {
133888
133972
  };
133889
133973
  }
133890
133974
  var answerServerJson = (response, status, body) => {
133891
- const text4 = JSON.stringify(body);
133892
- response.writeHead(status, { "content-type": "application/json", "content-length": String(Buffer.byteLength(text4, "utf8")) });
133893
- response.end(text4);
133975
+ const text5 = JSON.stringify(body);
133976
+ response.writeHead(status, { "content-type": "application/json", "content-length": String(Buffer.byteLength(text5, "utf8")) });
133977
+ response.end(text5);
133894
133978
  };
133895
133979
  function createRcSelfHostLocal(deps) {
133896
133980
  return {
@@ -134101,8 +134185,8 @@ function formatRcPendingList(pending) {
134101
134185
  }
134102
134186
  return pending.map((request7) => `${request7.sessionId} ${request7.requestId} ${request7.type}${request7.summary === "" ? "" : ` ${request7.summary}`} observed ${new Date(request7.observedAt).toISOString()}`);
134103
134187
  }
134104
- function eventExcerpt(text4) {
134105
- return text4.length <= RC_PENDING_SUMMARY_EXCERPT_CHARS ? text4 : `${text4.slice(0, RC_PENDING_SUMMARY_EXCERPT_CHARS)}...`;
134188
+ function eventExcerpt(text5) {
134189
+ return text5.length <= RC_PENDING_SUMMARY_EXCERPT_CHARS ? text5 : `${text5.slice(0, RC_PENDING_SUMMARY_EXCERPT_CHARS)}...`;
134106
134190
  }
134107
134191
  var PERCENT_SCALE = 100;
134108
134192
  var MS_PER_SECOND14 = 1e3;
@@ -135801,9 +135885,9 @@ data: ${JSON.stringify(envelope)}
135801
135885
  };
135802
135886
  const sessionRow = (session) => ({ id: session.id, title: session.title, created_at: new Date(session.createdAt).toISOString(), status: "active", conversation_id: session.conversation.id });
135803
135887
  const answerJson2 = async (response, status, body, extraHeaders = {}) => {
135804
- const text4 = JSON.stringify(body);
135805
- response.start(status, { "content-type": "application/json", "content-length": String(Buffer.byteLength(text4, "utf8")), ...extraHeaders });
135806
- await response.write(text4);
135888
+ const text5 = JSON.stringify(body);
135889
+ response.start(status, { "content-type": "application/json", "content-length": String(Buffer.byteLength(text5, "utf8")), ...extraHeaders });
135890
+ await response.write(text5);
135807
135891
  response.end();
135808
135892
  };
135809
135893
  const noCredential = async (response) => {
@@ -136205,8 +136289,8 @@ function createSseParser() {
136205
136289
  let dataLines = [];
136206
136290
  let seenAnyText = false;
136207
136291
  return {
136208
- write: (text4) => {
136209
- let incoming = text4;
136292
+ write: (text5) => {
136293
+ let incoming = text5;
136210
136294
  if (!seenAnyText) {
136211
136295
  seenAnyText = true;
136212
136296
  incoming = incoming.charCodeAt(0) === SSE_BYTE_ORDER_MARK ? incoming.slice(1) : incoming;
@@ -137099,7 +137183,7 @@ function realFrontDoorSupervisorPorts(paths, respawnGeneration, retire, trackTun
137099
137183
  startProviderListener: async (preferredPort) => {
137100
137184
  const authority = loadCa();
137101
137185
  const rcDial = rcSelfHost ? lateRcEventDial(rcSelfHostDialTarget) : realRcEventDial();
137102
- const rcInject = async (sessionId, text4) => await injectRcUserMessage({ credentialOf: rcTracker.credentialOf, noteSequenceNums: rcTracker.noteSequenceNums, dial: rcDial, newUuid: import_node_crypto25.randomUUID }, sessionId, text4);
137186
+ const rcInject = async (sessionId, text5) => await injectRcUserMessage({ credentialOf: rcTracker.credentialOf, noteSequenceNums: rcTracker.noteSequenceNums, dial: rcDial, newUuid: import_node_crypto25.randomUUID }, sessionId, text5);
137103
137187
  const rcAnswer = async (sessionId, requestId, decision) => await answerRcControlRequest({ credentialOf: rcTracker.credentialOf, pendingOf: (id2) => rcTracker.pendingOf(id2), completePending: rcTracker.completePending, noteSequenceNums: rcTracker.noteSequenceNums, dial: rcDial }, sessionId, requestId, decision);
137104
137188
  const rcControlRequestDeps = { credentialOf: rcTracker.credentialOf, noteSequenceNums: rcTracker.noteSequenceNums, dial: rcDial, newUuid: import_node_crypto25.randomUUID };
137105
137189
  const rcInterrupt = async (sessionId) => await interruptRcSession(rcControlRequestDeps, sessionId);
@@ -137133,7 +137217,7 @@ function realFrontDoorSupervisorPorts(paths, respawnGeneration, retire, trackTun
137133
137217
  },
137134
137218
  poolNames: () => Object.keys(readPools(paths)).sort(),
137135
137219
  // A read-only resolution of what a launch from one directory would do: the launcher's own decision with its effects left out, so a read never recovers or resyncs a farm, starts a daemon, records a pool pick or runs a credential command.
137136
- resolveLaunch: (request7) => resolveClaudeLaunch({ argv: request7.argv, cwd: request7.path, env: request7.env, paths }),
137220
+ resolveLaunch: async (request7) => resolveClaudeLaunchAsync({ argv: request7.argv, cwd: request7.path, env: request7.env, paths }),
137137
137221
  // The identities are read per call, like the pool table, so an identity added after the door started is listed the moment the CLI would see it.
137138
137222
  sessionList: (filters) => collectSessionList(realSessionFs, paths.identitiesDir, listIdentities(paths).map((entry) => entry.name), { ...filters.identity === void 0 ? {} : { identity: filters.identity }, ...filters.all === void 0 ? {} : { all: filters.all } }),
137139
137223
  liveTasks: () => rcTracker.liveTasksOf(),
@@ -137385,7 +137469,7 @@ function registerFrontDoorCommand(program2, deps) {
137385
137469
  // src/statusline/commands.ts
137386
137470
  var import_node_child_process8 = require("node:child_process");
137387
137471
  var import_node_os13 = __toESM(require("node:os"), 1);
137388
- var import_node_path61 = __toESM(require("node:path"), 1);
137472
+ var import_node_path62 = __toESM(require("node:path"), 1);
137389
137473
  init_commandDeps();
137390
137474
  init_statusline();
137391
137475
  init_providersStore();
@@ -137827,7 +137911,7 @@ function viewOf(payload) {
137827
137911
  }
137828
137912
 
137829
137913
  // src/statusline/ports.ts
137830
- var import_node_child_process7 = require("node:child_process");
137914
+ init_blockingSpawn();
137831
137915
  var import_node_fs22 = __toESM(require("node:fs"), 1);
137832
137916
  var import_node_os12 = __toESM(require("node:os"), 1);
137833
137917
  var import_node_path56 = __toESM(require("node:path"), 1);
@@ -137857,9 +137941,9 @@ function usedBytesFromVmStat(output2) {
137857
137941
  }
137858
137942
  return (Number(active) + Number(wired) + Number(compressed)) * Number(pageSize);
137859
137943
  }
137860
- function memoryUseFromMeminfo(text4) {
137861
- const totalKibibytes = /^MemTotal:\s+(\d+)\s+kB/m.exec(text4)?.[1];
137862
- const availableKibibytes = /^MemAvailable:\s+(\d+)\s+kB/m.exec(text4)?.[1];
137944
+ function memoryUseFromMeminfo(text5) {
137945
+ const totalKibibytes = /^MemTotal:\s+(\d+)\s+kB/m.exec(text5)?.[1];
137946
+ const availableKibibytes = /^MemAvailable:\s+(\d+)\s+kB/m.exec(text5)?.[1];
137863
137947
  if (totalKibibytes === void 0 || availableKibibytes === void 0) {
137864
137948
  return void 0;
137865
137949
  }
@@ -137872,7 +137956,7 @@ var RUN_TIMEOUT_MS = 2e3;
137872
137956
  var RUN_MAX_BUFFER_BYTES = 1048576;
137873
137957
  function runProgram(file2, args, cwd) {
137874
137958
  try {
137875
- return (0, import_node_child_process7.execFileSync)(file2, [...args], { cwd, encoding: "utf8", timeout: RUN_TIMEOUT_MS, maxBuffer: RUN_MAX_BUFFER_BYTES, stdio: ["ignore", "pipe", "ignore"], windowsHide: true });
137959
+ return execFileSyncBlocking("a statusline command", file2, args, { cwd, encoding: "utf8", timeout: RUN_TIMEOUT_MS, maxBuffer: RUN_MAX_BUFFER_BYTES, stdio: ["ignore", "pipe", "ignore"], windowsHide: true });
137876
137960
  } catch {
137877
137961
  return void 0;
137878
137962
  }
@@ -137958,11 +138042,11 @@ function realStatuslinePorts(env, stateDirectory) {
137958
138042
  return void 0;
137959
138043
  }
137960
138044
  },
137961
- writeText: (target, text4) => {
138045
+ writeText: (target, text5) => {
137962
138046
  const temporary = import_node_path56.default.join(import_node_path56.default.dirname(target), `.${import_node_path56.default.basename(target)}.${String(process.pid)}.tmp`);
137963
138047
  try {
137964
138048
  import_node_fs22.default.mkdirSync(import_node_path56.default.dirname(target), { recursive: true, mode: STATE_DIRECTORY_MODE });
137965
- import_node_fs22.default.writeFileSync(temporary, text4, { mode: STATE_FILE_MODE });
138049
+ import_node_fs22.default.writeFileSync(temporary, text5, { mode: STATE_FILE_MODE });
137966
138050
  import_node_fs22.default.renameSync(temporary, target);
137967
138051
  } catch {
137968
138052
  discard(temporary);
@@ -137984,13 +138068,13 @@ var ESCAPE = String.fromCharCode(ESCAPE_CHAR_CODE);
137984
138068
  var BELL = "\\u0007";
137985
138069
  var ESCAPE_SEQUENCE_PATTERN = [`${ESCAPE}\\[[0-?]*[ -/]*[@-~]`, `${ESCAPE}\\][^${BELL}${ESCAPE}]*(?:${BELL}|${ESCAPE}\\\\)?`, `${ESCAPE}[@-Z\\\\-_]`].join("|");
137986
138070
  var SPLIT_ON_ESCAPES = new RegExp(`(${ESCAPE_SEQUENCE_PATTERN})`);
137987
- function visibleLength(text4) {
137988
- return stringWidth(text4);
138071
+ function visibleLength(text5) {
138072
+ return stringWidth(text5);
137989
138073
  }
137990
- function truncateToColumns(text4, columns) {
138074
+ function truncateToColumns(text5, columns) {
137991
138075
  let used = 0;
137992
138076
  let kept = "";
137993
- text4.split(SPLIT_ON_ESCAPES).forEach((part, index) => {
138077
+ text5.split(SPLIT_ON_ESCAPES).forEach((part, index) => {
137994
138078
  if (index % 2 === 1) {
137995
138079
  kept += part;
137996
138080
  return;
@@ -138032,8 +138116,8 @@ function measureGrid(rows, separatorLength, baseBarCells) {
138032
138116
  const fixed = [...prefixWidths, ...suffixWidths].reduce((total, width) => total + width, 0) + columns * (baseBarCells + BRACKET_COLUMNS);
138033
138117
  return { rows, columns, prefixWidths, suffixWidths, baseWidth: fixed + separatorLength * (columns - 1) };
138034
138118
  }
138035
- function padTo(text4, width) {
138036
- return text4 + " ".repeat(Math.max(0, width - visibleLength(text4)));
138119
+ function padTo(text5, width) {
138120
+ return text5 + " ".repeat(Math.max(0, width - visibleLength(text5)));
138037
138121
  }
138038
138122
  function renderGrid(grid, maxWidth, separator, baseBarCells) {
138039
138123
  const separatorLength = visibleLength(separator);
@@ -138149,19 +138233,19 @@ init_blank();
138149
138233
  init_graphemes();
138150
138234
  var ESCAPE_SEQUENCES = new RegExp(ESCAPE_SEQUENCE_PATTERN, "g");
138151
138235
  var CONTROL_AND_BIDI = /[\p{Cc}\u061c\u200e\u200f\u202a-\u202e\u2066-\u2069\u206a-\u206f]/gu;
138152
- function sanitiseDisplayText(text4) {
138153
- return text4.replace(ESCAPE_SEQUENCES, "").replace(CONTROL_AND_BIDI, "");
138236
+ function sanitiseDisplayText(text5) {
138237
+ return text5.replace(ESCAPE_SEQUENCES, "").replace(CONTROL_AND_BIDI, "");
138154
138238
  }
138155
- function boundedDisplayText(text4) {
138156
- return graphemesOf(sanitiseDisplayText(text4).trim()).slice(0, MAX_DISPLAY_TEXT_CHARS).join("").trim();
138239
+ function boundedDisplayText(text5) {
138240
+ return graphemesOf(sanitiseDisplayText(text5).trim()).slice(0, MAX_DISPLAY_TEXT_CHARS).join("").trim();
138157
138241
  }
138158
138242
  var TAG_SEQUENCE2 = "\\u{1F3F4}[\\u{E0020}-\\u{E007E}]+\\u{E007F}";
138159
138243
  var INVISIBLE_FORMAT = new RegExp(`(${TAG_SEQUENCE2})|(?![\\u200C\\u200D])\\p{Cf}`, "gu");
138160
138244
  var LINE_SEPARATORS = /[\u2028\u2029]/gu;
138161
138245
  var HANGUL_JAMO = "\\u1100-\\u115E\\u1161-\\u11FF\\uA960-\\uA97F\\uD7B0-\\uD7FF";
138162
138246
  var STANDALONE_HANGUL_FILLER = new RegExp(`(?<![${HANGUL_JAMO}])[\\u115F\\u1160](?![${HANGUL_JAMO}])`, "gu");
138163
- function visibleDisplayText(text4) {
138164
- const cleaned = sanitiseDisplayText(text4).replace(LINE_SEPARATORS, "").replace(BLANK_CELLS, " ").replace(STANDALONE_HANGUL_FILLER, " ").replace(INVISIBLE_FORMAT, (_match, tagSequence) => tagSequence ?? "");
138247
+ function visibleDisplayText(text5) {
138248
+ const cleaned = sanitiseDisplayText(text5).replace(LINE_SEPARATORS, "").replace(BLANK_CELLS, " ").replace(STANDALONE_HANGUL_FILLER, " ").replace(INVISIBLE_FORMAT, (_match, tagSequence) => tagSequence ?? "");
138165
138249
  return graphemesOf(cleaned).map((grapheme) => {
138166
138250
  const body = grapheme.replace(/^ /u, "");
138167
138251
  const space = body === grapheme ? "" : " ";
@@ -138232,13 +138316,13 @@ function localDay(nowMs) {
138232
138316
  const date5 = new Date(nowMs);
138233
138317
  return `${String(date5.getFullYear())}-${String(date5.getMonth() + 1).padStart(2, "0")}-${String(date5.getDate()).padStart(2, "0")}`;
138234
138318
  }
138235
- function parseEntry3(text4) {
138236
- if (text4 === void 0) {
138319
+ function parseEntry3(text5) {
138320
+ if (text5 === void 0) {
138237
138321
  return void 0;
138238
138322
  }
138239
138323
  let raw;
138240
138324
  try {
138241
- raw = JSON.parse(text4);
138325
+ raw = JSON.parse(text5);
138242
138326
  } catch {
138243
138327
  return void 0;
138244
138328
  }
@@ -138299,6 +138383,49 @@ function dailyCostSegment(context) {
138299
138383
  return spend === void 0 ? void 0 : `Today ${formatUsd(spend)}`;
138300
138384
  }
138301
138385
 
138386
+ // src/statusline/elements/sessionFormat.ts
138387
+ var MS_PER_SECOND17 = 1e3;
138388
+ var SECONDS_PER_MINUTE2 = 60;
138389
+ var MINUTES_PER_HOUR4 = 60;
138390
+ var HOURS_PER_DAY9 = 24;
138391
+ function formatElapsed(ms2) {
138392
+ const minutes = Math.floor(ms2 / (MS_PER_SECOND17 * SECONDS_PER_MINUTE2));
138393
+ if (minutes < 1) {
138394
+ return "<1m";
138395
+ }
138396
+ if (minutes < MINUTES_PER_HOUR4) {
138397
+ return `${String(minutes)}m`;
138398
+ }
138399
+ return `${String(Math.floor(minutes / MINUTES_PER_HOUR4))}h ${String(minutes % MINUTES_PER_HOUR4)}m`;
138400
+ }
138401
+ function twoUnits(larger, smaller, largerUnit, smallerUnit) {
138402
+ return smaller > 0 ? `${String(larger)}${largerUnit} ${String(smaller)}${smallerUnit}` : `${String(larger)}${largerUnit}`;
138403
+ }
138404
+ function formatAgo(ms2) {
138405
+ if (ms2 < 0) {
138406
+ return "just now";
138407
+ }
138408
+ const seconds = Math.floor(ms2 / MS_PER_SECOND17);
138409
+ if (seconds < SECONDS_PER_MINUTE2) {
138410
+ return `${String(seconds)}s ago`;
138411
+ }
138412
+ const minutes = Math.floor(seconds / SECONDS_PER_MINUTE2);
138413
+ if (minutes < MINUTES_PER_HOUR4) {
138414
+ return `${String(minutes)}m ago`;
138415
+ }
138416
+ const hours = Math.floor(minutes / MINUTES_PER_HOUR4);
138417
+ if (hours < HOURS_PER_DAY9) {
138418
+ return `${twoUnits(hours, minutes % MINUTES_PER_HOUR4, "h", "m")} ago`;
138419
+ }
138420
+ return `${twoUnits(Math.floor(hours / HOURS_PER_DAY9), hours % HOURS_PER_DAY9, "d", "h")} ago`;
138421
+ }
138422
+
138423
+ // src/statusline/elements/header/duration.ts
138424
+ function durationSegment(context) {
138425
+ const startedAtMs = context.transcript()?.session.startedAtMs;
138426
+ return startedAtMs === void 0 ? void 0 : `\u23F1\uFE0F ${formatElapsed(context.nowMs - startedAtMs)}`;
138427
+ }
138428
+
138302
138429
  // src/statusline/palette.ts
138303
138430
  init_statusline();
138304
138431
  var RESET = `${ESCAPE}[0m`;
@@ -138348,16 +138475,16 @@ function createPalette(colours, enabled) {
138348
138475
  };
138349
138476
  return {
138350
138477
  ansi,
138351
- paint: (role, text4) => {
138478
+ paint: (role, text5) => {
138352
138479
  const start = ansi(role);
138353
- return start === "" ? text4 : `${start}${text4}${RESET}`;
138480
+ return start === "" ? text5 : `${start}${text5}${RESET}`;
138354
138481
  }
138355
138482
  };
138356
138483
  }
138357
138484
 
138358
138485
  // src/statusline/style.ts
138359
- var SECONDS_PER_MINUTE2 = 60;
138360
- var MINUTES_PER_HOUR4 = 60;
138486
+ var SECONDS_PER_MINUTE3 = 60;
138487
+ var MINUTES_PER_HOUR5 = 60;
138361
138488
  var SECONDS_PER_DAY = 86400;
138362
138489
  var THOUSAND = 1e3;
138363
138490
  var MILLION = 1e6;
@@ -138365,8 +138492,8 @@ var TEN = 10;
138365
138492
  var TWENTY = 20;
138366
138493
  var FULL_PERCENT3 = 100;
138367
138494
  var ONE_PERCENT = 1;
138368
- function withColor(color, text4) {
138369
- return color === "" ? text4 : `${color}${text4}${RESET}`;
138495
+ function withColor(color, text5) {
138496
+ return color === "" ? text5 : `${color}${text5}${RESET}`;
138370
138497
  }
138371
138498
  function statusColor(fraction, isUsedMetric, style) {
138372
138499
  const yellowAt = style.bands.warnAt / FULL_PERCENT3;
@@ -138399,12 +138526,12 @@ function formatDuration(seconds) {
138399
138526
  if (seconds === void 0 || seconds <= 0) {
138400
138527
  return "available";
138401
138528
  }
138402
- if (seconds < SECONDS_PER_MINUTE2) {
138529
+ if (seconds < SECONDS_PER_MINUTE3) {
138403
138530
  return `${String(seconds)}s`;
138404
138531
  }
138405
138532
  const days = Math.floor(seconds / SECONDS_PER_DAY);
138406
- const hours = Math.floor(seconds % SECONDS_PER_DAY / (MINUTES_PER_HOUR4 * SECONDS_PER_MINUTE2));
138407
- const minutes = Math.floor(seconds % (MINUTES_PER_HOUR4 * SECONDS_PER_MINUTE2) / SECONDS_PER_MINUTE2);
138533
+ const hours = Math.floor(seconds % SECONDS_PER_DAY / (MINUTES_PER_HOUR5 * SECONDS_PER_MINUTE3));
138534
+ const minutes = Math.floor(seconds % (MINUTES_PER_HOUR5 * SECONDS_PER_MINUTE3) / SECONDS_PER_MINUTE3);
138408
138535
  if (days > 0) {
138409
138536
  return `${String(days)}d ${String(hours)}h`;
138410
138537
  }
@@ -138505,13 +138632,13 @@ var import_node_path58 = __toESM(require("node:path"), 1);
138505
138632
  init_zod();
138506
138633
  var SettingsFileSchema = external_exports.looseObject({ outputStyle: external_exports.string().optional().catch(void 0) });
138507
138634
  function outputStyleIn(file2, readText2) {
138508
- const text4 = readText2(file2);
138509
- if (text4 === void 0) {
138635
+ const text5 = readText2(file2);
138636
+ if (text5 === void 0) {
138510
138637
  return void 0;
138511
138638
  }
138512
138639
  let parsed;
138513
138640
  try {
138514
- parsed = JSON.parse(text4);
138641
+ parsed = JSON.parse(text5);
138515
138642
  } catch {
138516
138643
  return void 0;
138517
138644
  }
@@ -138576,7 +138703,7 @@ function workingDirectoryOf(payload) {
138576
138703
  function inlineAddedDirs({ payload, palette }) {
138577
138704
  const { names, more } = addedDirNames(payload.workspace?.added_dirs);
138578
138705
  const drawn = [...names.map((name) => `+${name}`), ...more > 0 ? [`+${String(more)} more`] : []];
138579
- return drawn.length === 0 ? void 0 : drawn.map((text4) => palette.paint("label", text4)).join(" ");
138706
+ return drawn.length === 0 ? void 0 : drawn.map((text5) => palette.paint("label", text5)).join(" ");
138580
138707
  }
138581
138708
  function projectSegment(context) {
138582
138709
  const { payload, settings: settings2 } = context;
@@ -138606,6 +138733,116 @@ function versionSegment({ payload }) {
138606
138733
  return version2 === "" ? void 0 : `CC v${version2}`;
138607
138734
  }
138608
138735
 
138736
+ // src/statusline/elements/header/sessionName.ts
138737
+ function sessionNameSegment(context) {
138738
+ return context.transcript()?.session.title;
138739
+ }
138740
+
138741
+ // src/statusline/speed.ts
138742
+ init_zod();
138743
+
138744
+ // src/statusline/cacheFile.ts
138745
+ var import_node_crypto26 = require("node:crypto");
138746
+ var import_node_path59 = __toESM(require("node:path"), 1);
138747
+ var SESSION_CACHE_DIRECTORY = "session";
138748
+ function cacheDirectory(ports) {
138749
+ return import_node_path59.default.join(ports.stateDirectory, SESSION_CACHE_DIRECTORY);
138750
+ }
138751
+ function cacheFileFor(ports, kind, transcriptPath) {
138752
+ return import_node_path59.default.join(cacheDirectory(ports), `${kind}-${(0, import_node_crypto26.createHash)("sha256").update(transcriptPath).digest("hex")}.json`);
138753
+ }
138754
+ var RETENTION_DAYS = 30;
138755
+ var HOURS_PER_DAY10 = 24;
138756
+ var MINUTES_PER_HOUR6 = 60;
138757
+ var SECONDS_PER_MINUTE4 = 60;
138758
+ var MS_PER_SECOND18 = 1e3;
138759
+ var CACHE_RETENTION_MS = RETENTION_DAYS * HOURS_PER_DAY10 * MINUTES_PER_HOUR6 * SECONDS_PER_MINUTE4 * MS_PER_SECOND18;
138760
+ function pruneCache(ports, cutoffMs) {
138761
+ const directory = cacheDirectory(ports);
138762
+ const names = ports.listDirectory(directory);
138763
+ if (names === void 0) {
138764
+ return;
138765
+ }
138766
+ for (const name of names) {
138767
+ const file2 = import_node_path59.default.join(directory, name);
138768
+ const modifiedAtMs = ports.modifiedAtMs(file2);
138769
+ if (modifiedAtMs !== void 0 && modifiedAtMs < cutoffMs) {
138770
+ ports.removePath(file2);
138771
+ }
138772
+ }
138773
+ }
138774
+ function loadCache(ports, file2, schema) {
138775
+ const text5 = ports.readText(file2);
138776
+ if (text5 === void 0) {
138777
+ return void 0;
138778
+ }
138779
+ let parsed;
138780
+ try {
138781
+ parsed = JSON.parse(text5);
138782
+ } catch {
138783
+ return void 0;
138784
+ }
138785
+ const result = schema.safeParse(parsed);
138786
+ return result.success ? result.data : void 0;
138787
+ }
138788
+ function saveCache(ports, file2, value2, nowMs) {
138789
+ const isNew = ports.entryKind(file2) === void 0;
138790
+ ports.writeText(file2, JSON.stringify(value2));
138791
+ if (isNew) {
138792
+ pruneCache(ports, nowMs - CACHE_RETENTION_MS);
138793
+ }
138794
+ }
138795
+
138796
+ // src/statusline/speed.ts
138797
+ var SPEED_WINDOW_MS = 2e3;
138798
+ var MIN_SPEED_GAP_MS = 500;
138799
+ var TRANSCRIPT_BYTES_PER_TOKEN = 4;
138800
+ var SpeedSampleSchema = external_exports.strictObject({ at: external_exports.number(), outputTokens: external_exports.number().optional(), transcriptBytes: external_exports.number().optional() });
138801
+ var CACHE_KIND = "speed";
138802
+ var MS_PER_SECOND19 = 1e3;
138803
+ function tokensOf(sample, basis) {
138804
+ const value2 = sample[basis];
138805
+ return basis === "transcriptBytes" && value2 !== void 0 ? value2 / TRANSCRIPT_BYTES_PER_TOKEN : value2;
138806
+ }
138807
+ function speedBetween(previous, current) {
138808
+ const basis = current.outputTokens === void 0 ? "transcriptBytes" : "outputTokens";
138809
+ const now = tokensOf(current, basis);
138810
+ if (now === void 0) {
138811
+ return { tokensPerSecond: void 0, remember: false };
138812
+ }
138813
+ const before = previous === void 0 ? void 0 : tokensOf(previous, basis);
138814
+ if (previous === void 0 || before === void 0 || now < before) {
138815
+ return { tokensPerSecond: void 0, remember: true };
138816
+ }
138817
+ const gapMs = current.at - previous.at;
138818
+ if (gapMs > SPEED_WINDOW_MS || now === before) {
138819
+ return { tokensPerSecond: void 0, remember: true };
138820
+ }
138821
+ if (gapMs < MIN_SPEED_GAP_MS) {
138822
+ return { tokensPerSecond: void 0, remember: false };
138823
+ }
138824
+ return { tokensPerSecond: (now - before) / (gapMs / MS_PER_SECOND19), remember: true };
138825
+ }
138826
+ function trackSpeed(ports, transcriptPath, current) {
138827
+ const file2 = cacheFileFor(ports, CACHE_KIND, transcriptPath);
138828
+ const { tokensPerSecond, remember } = speedBetween(loadCache(ports, file2, SpeedSampleSchema), current);
138829
+ if (remember) {
138830
+ saveCache(ports, file2, current, current.at);
138831
+ }
138832
+ return tokensPerSecond;
138833
+ }
138834
+
138835
+ // src/statusline/elements/header/speed.ts
138836
+ function speedSegment(context) {
138837
+ const transcriptPath = context.payload.transcript_path;
138838
+ if (transcriptPath === void 0 || transcriptPath === "") {
138839
+ return void 0;
138840
+ }
138841
+ const outputTokens = context.payload.context_window?.current_usage?.output_tokens;
138842
+ const tokensPerSecond = trackSpeed(context.ports, transcriptPath, { at: context.nowMs, outputTokens, transcriptBytes: outputTokens === void 0 ? context.transcript()?.bytes : void 0 });
138843
+ return tokensPerSecond === void 0 ? void 0 : `out: ${tokensPerSecond.toFixed(1)} tok/s`;
138844
+ }
138845
+
138609
138846
  // src/statusline/vcs/git.ts
138610
138847
  var GIT = "git";
138611
138848
  var NUL = "\0";
@@ -138682,15 +138919,15 @@ function parseNumstat(output2) {
138682
138919
  if (addedText === void 0 || deletedText === void 0 || pathText === void 0) {
138683
138920
  continue;
138684
138921
  }
138685
- const path71 = pathText === "" ? fields[index + 2] : pathText;
138922
+ const path72 = pathText === "" ? fields[index + 2] : pathText;
138686
138923
  if (pathText === "") {
138687
138924
  index += 2;
138688
138925
  }
138689
138926
  const lines = { added: Number(addedText), deleted: Number(deletedText) };
138690
- if (path71 !== void 0 && Number.isInteger(lines.added) && Number.isInteger(lines.deleted)) {
138927
+ if (path72 !== void 0 && Number.isInteger(lines.added) && Number.isInteger(lines.deleted)) {
138691
138928
  added += lines.added;
138692
138929
  deleted += lines.deleted;
138693
- byPath.set(path71, lines);
138930
+ byPath.set(path72, lines);
138694
138931
  }
138695
138932
  }
138696
138933
  return { total: { added, deleted }, byPath };
@@ -138745,7 +138982,7 @@ function readGitStatus(ports, cwd, query) {
138745
138982
  }
138746
138983
 
138747
138984
  // src/statusline/vcs/jj.ts
138748
- var import_node_path59 = __toESM(require("node:path"), 1);
138985
+ var import_node_path60 = __toESM(require("node:path"), 1);
138749
138986
  var JJ2 = "jj";
138750
138987
  var MAX_WALK_DEPTH = 64;
138751
138988
  var MAX_LABEL_CODE_POINTS = 64;
@@ -138758,13 +138995,13 @@ function isJjRepository(ports, cwd) {
138758
138995
  return false;
138759
138996
  }
138760
138997
  for (let depth = 0; depth < MAX_WALK_DEPTH; depth += 1) {
138761
- if (ports.entryKind(import_node_path59.default.join(directory, ".jj")) === "directory") {
138998
+ if (ports.entryKind(import_node_path60.default.join(directory, ".jj")) === "directory") {
138762
138999
  return true;
138763
139000
  }
138764
- if (ports.entryKind(import_node_path59.default.join(directory, ".git")) !== void 0) {
139001
+ if (ports.entryKind(import_node_path60.default.join(directory, ".git")) !== void 0) {
138765
139002
  return false;
138766
139003
  }
138767
- const parent = import_node_path59.default.dirname(directory);
139004
+ const parent = import_node_path60.default.dirname(directory);
138768
139005
  if (parent === directory) {
138769
139006
  return false;
138770
139007
  }
@@ -138782,8 +139019,8 @@ var TEMPLATE = [
138782
139019
  'if(self.conflict(), "1", "0")'
138783
139020
  ].join(" ++ ");
138784
139021
  var ARGS = ["--ignore-working-copy", "--at-operation=@", "--no-pager", "log", "-r", "@", "--no-graph", "--color", "never", "-T", TEMPLATE];
138785
- function label(text4) {
138786
- const clean = sanitiseDisplayText(text4).trim();
139022
+ function label(text5) {
139023
+ const clean = sanitiseDisplayText(text5).trim();
138787
139024
  return clean === "" ? void 0 : Array.from(clean).slice(0, MAX_LABEL_CODE_POINTS).join("");
138788
139025
  }
138789
139026
  function parse4(output2) {
@@ -138843,12 +139080,12 @@ function vcsStatusOf(context) {
138843
139080
 
138844
139081
  // src/statusline/elements/header/vcs.ts
138845
139082
  function aheadText(ahead, { settings: settings2, palette }) {
138846
- const text4 = `\u2191${String(ahead)}`;
139083
+ const text5 = `\u2191${String(ahead)}`;
138847
139084
  const { pushCriticalAt, pushWarnAt } = settings2.git;
138848
139085
  if (pushCriticalAt > 0 && ahead >= pushCriticalAt) {
138849
- return palette.paint("critical", text4);
139086
+ return palette.paint("critical", text5);
138850
139087
  }
138851
- return pushWarnAt > 0 && ahead >= pushWarnAt ? palette.paint("warning", text4) : palette.paint("gitBranch", text4);
139088
+ return pushWarnAt > 0 && ahead >= pushWarnAt ? palette.paint("warning", text5) : palette.paint("gitBranch", text5);
138852
139089
  }
138853
139090
  function vcsSegment(context) {
138854
139091
  const status = vcsStatusOf(context);
@@ -138886,10 +139123,19 @@ function addedDirsRow({ payload, settings: settings2, palette }) {
138886
139123
  if (settings2.project.addedDirsLayout !== "row" || names.length === 0) {
138887
139124
  return { kind: "text", lines: [] };
138888
139125
  }
138889
- const drawn = [...names, ...more > 0 ? [`+${String(more)} more`] : []].map((text4) => palette.paint("label", text4));
139126
+ const drawn = [...names, ...more > 0 ? [`+${String(more)} more`] : []].map((text5) => palette.paint("label", text5));
138890
139127
  return { kind: "text", lines: [`${palette.paint("label", "Added dirs:")} ${drawn.join(palette.paint("label", ", "))}`] };
138891
139128
  }
138892
139129
 
139130
+ // src/statusline/elements/rows/compactions.ts
139131
+ function compactionsRow(context) {
139132
+ const transcript = context.transcript();
139133
+ if (transcript === void 0 || transcript.session.compactions === 0) {
139134
+ return { kind: "text", lines: [] };
139135
+ }
139136
+ return { kind: "text", lines: [context.palette.paint("label", `Compactions: ${String(transcript.session.compactions)}${transcript.complete ? "" : "+"}`)] };
139137
+ }
139138
+
138893
139139
  // src/statusline/elements/context.ts
138894
139140
  function barStyleOf({ settings: settings2, palette }, okRole) {
138895
139141
  return { bands: settings2.bands, palette, okRole, filled: settings2.bar.filled, empty: settings2.bar.empty };
@@ -138960,7 +139206,7 @@ function gitFilesRow(context) {
138960
139206
  }
138961
139207
 
138962
139208
  // src/statusline/configCounts.ts
138963
- var import_node_path60 = __toESM(require("node:path"), 1);
139209
+ var import_node_path61 = __toESM(require("node:path"), 1);
138964
139210
  init_zod();
138965
139211
  var nameList = external_exports.array(external_exports.unknown()).catch([]).transform((items) => items.filter((item) => typeof item === "string"));
138966
139212
  var ConfigFileSchema = external_exports.looseObject({
@@ -138979,13 +139225,13 @@ function readConfigFile(ports, file2) {
138979
139225
  if (size === void 0 || size > MAX_CONFIG_FILE_BYTES) {
138980
139226
  return void 0;
138981
139227
  }
138982
- const text4 = ports.readText(file2);
138983
- if (text4 === void 0) {
139228
+ const text5 = ports.readText(file2);
139229
+ if (text5 === void 0) {
138984
139230
  return void 0;
138985
139231
  }
138986
139232
  let raw;
138987
139233
  try {
138988
- raw = JSON.parse(text4);
139234
+ raw = JSON.parse(text5);
138989
139235
  } catch {
138990
139236
  return void 0;
138991
139237
  }
@@ -139034,7 +139280,7 @@ function countRules(ports, root) {
139034
139280
  break;
139035
139281
  }
139036
139282
  entries += 1;
139037
- const entry = import_node_path60.default.join(real, name);
139283
+ const entry = import_node_path61.default.join(real, name);
139038
139284
  const kind = followedKind(ports, entry);
139039
139285
  if (kind === "directory") {
139040
139286
  count += walk3(entry);
@@ -139051,33 +139297,33 @@ function countRules(ports, root) {
139051
139297
  return walk3(root);
139052
139298
  }
139053
139299
  function sameLocation(ports, left, right) {
139054
- return (ports.realPath(left) ?? import_node_path60.default.resolve(left)) === (ports.realPath(right) ?? import_node_path60.default.resolve(right));
139300
+ return (ports.realPath(left) ?? import_node_path61.default.resolve(left)) === (ports.realPath(right) ?? import_node_path61.default.resolve(right));
139055
139301
  }
139056
139302
  function configDirectoryOf(ports) {
139057
139303
  const pinned = ports.env.CLAUDE_CONFIG_DIR;
139058
- return pinned === void 0 || pinned === "" ? import_node_path60.default.join(ports.homeDirectory, ".claude") : pinned;
139304
+ return pinned === void 0 || pinned === "" ? import_node_path61.default.join(ports.homeDirectory, ".claude") : pinned;
139059
139305
  }
139060
139306
  function countConfiguration(ports, projectDirectory) {
139061
139307
  const userDirectory = configDirectoryOf(ports);
139062
- const userSettings = readConfigFile(ports, import_node_path60.default.join(userDirectory, "settings.json"));
139063
- const globalFile = ports.env.CLAUDE_CONFIG_DIR === void 0 || ports.env.CLAUDE_CONFIG_DIR === "" ? import_node_path60.default.join(ports.homeDirectory, ".claude.json") : import_node_path60.default.join(userDirectory, ".claude.json");
139308
+ const userSettings = readConfigFile(ports, import_node_path61.default.join(userDirectory, "settings.json"));
139309
+ const globalFile = ports.env.CLAUDE_CONFIG_DIR === void 0 || ports.env.CLAUDE_CONFIG_DIR === "" ? import_node_path61.default.join(ports.homeDirectory, ".claude.json") : import_node_path61.default.join(userDirectory, ".claude.json");
139064
139310
  const global2 = readConfigFile(ports, globalFile);
139065
139311
  const userServers = /* @__PURE__ */ new Set([...namesOf(userSettings), ...namesOf(global2)]);
139066
139312
  removeNames(userServers, global2?.disabledMcpServers);
139067
139313
  const projectServers = /* @__PURE__ */ new Set();
139068
- let claudeMd = isFile(ports, import_node_path60.default.join(userDirectory, "CLAUDE.md")) ? 1 : 0;
139069
- let rules = countRules(ports, import_node_path60.default.join(userDirectory, "rules"));
139314
+ let claudeMd = isFile(ports, import_node_path61.default.join(userDirectory, "CLAUDE.md")) ? 1 : 0;
139315
+ let rules = countRules(ports, import_node_path61.default.join(userDirectory, "rules"));
139070
139316
  let hookEvents = hookEventsOf(userSettings);
139071
139317
  if (projectDirectory !== void 0) {
139072
- const projectClaude = import_node_path60.default.join(projectDirectory, ".claude");
139318
+ const projectClaude = import_node_path61.default.join(projectDirectory, ".claude");
139073
139319
  const projectIsUser = sameLocation(ports, projectClaude, userDirectory);
139074
- const claudeMdFiles = [import_node_path60.default.join(projectDirectory, "CLAUDE.md"), import_node_path60.default.join(projectDirectory, "CLAUDE.local.md"), import_node_path60.default.join(projectClaude, "CLAUDE.local.md"), ...projectIsUser ? [] : [import_node_path60.default.join(projectClaude, "CLAUDE.md")]];
139320
+ const claudeMdFiles = [import_node_path61.default.join(projectDirectory, "CLAUDE.md"), import_node_path61.default.join(projectDirectory, "CLAUDE.local.md"), import_node_path61.default.join(projectClaude, "CLAUDE.local.md"), ...projectIsUser ? [] : [import_node_path61.default.join(projectClaude, "CLAUDE.md")]];
139075
139321
  claudeMd += claudeMdFiles.filter((file2) => isFile(ports, file2)).length;
139076
- const mcpJson = namesOf(readConfigFile(ports, import_node_path60.default.join(projectDirectory, ".mcp.json")));
139322
+ const mcpJson = namesOf(readConfigFile(ports, import_node_path61.default.join(projectDirectory, ".mcp.json")));
139077
139323
  if (!projectIsUser) {
139078
- rules += countRules(ports, import_node_path60.default.join(projectClaude, "rules"));
139079
- const settings2 = readConfigFile(ports, import_node_path60.default.join(projectClaude, "settings.json"));
139080
- const local = readConfigFile(ports, import_node_path60.default.join(projectClaude, "settings.local.json"));
139324
+ rules += countRules(ports, import_node_path61.default.join(projectClaude, "rules"));
139325
+ const settings2 = readConfigFile(ports, import_node_path61.default.join(projectClaude, "settings.json"));
139326
+ const local = readConfigFile(ports, import_node_path61.default.join(projectClaude, "settings.local.json"));
139081
139327
  hookEvents += hookEventsOf(settings2) + hookEventsOf(local);
139082
139328
  for (const name of [...namesOf(settings2), ...namesOf(local)]) {
139083
139329
  projectServers.add(name);
@@ -139110,7 +139356,7 @@ function justify(texts, maxWidth, separator) {
139110
139356
  return texts.join(separator);
139111
139357
  }
139112
139358
  const separatorLength = visibleLength(separator);
139113
- const total = texts.reduce((sum, text4) => sum + visibleLength(text4), 0) + separatorLength * (texts.length - 1);
139359
+ const total = texts.reduce((sum, text5) => sum + visibleLength(text5), 0) + separatorLength * (texts.length - 1);
139114
139360
  const spare = maxWidth - total;
139115
139361
  if (spare <= 0) {
139116
139362
  return texts.join(separator);
@@ -139119,7 +139365,7 @@ function justify(texts, maxWidth, separator) {
139119
139365
  const extraPerGap = Math.floor(spare / gaps);
139120
139366
  let remainder = spare % gaps;
139121
139367
  const parts = [];
139122
- texts.forEach((text4, index) => {
139368
+ texts.forEach((text5, index) => {
139123
139369
  if (index > 0) {
139124
139370
  const extra = extraPerGap + (remainder > 0 ? 1 : 0);
139125
139371
  if (remainder > 0) {
@@ -139128,7 +139374,7 @@ function justify(texts, maxWidth, separator) {
139128
139374
  const left = Math.floor(extra / 2);
139129
139375
  parts.push(`${" ".repeat(left + 1)}|${" ".repeat(extra - left + 1)}`);
139130
139376
  }
139131
- parts.push(text4);
139377
+ parts.push(text5);
139132
139378
  });
139133
139379
  return parts.join("");
139134
139380
  }
@@ -139137,15 +139383,15 @@ function packLines(texts, maxWidth, separator) {
139137
139383
  const lines = [];
139138
139384
  let current = [];
139139
139385
  let currentWidth = 0;
139140
- for (const text4 of texts) {
139141
- const width = visibleLength(text4);
139386
+ for (const text5 of texts) {
139387
+ const width = visibleLength(text5);
139142
139388
  const added = current.length === 0 ? width : width + separatorLength;
139143
139389
  if (current.length > 0 && currentWidth + added > maxWidth) {
139144
139390
  lines.push(current);
139145
- current = [text4];
139391
+ current = [text5];
139146
139392
  currentWidth = width;
139147
139393
  } else {
139148
- current.push(text4);
139394
+ current.push(text5);
139149
139395
  currentWidth += added;
139150
139396
  }
139151
139397
  }
@@ -139186,10 +139432,6 @@ function memoryRow(context) {
139186
139432
  return { kind: "bars", cells };
139187
139433
  }
139188
139434
 
139189
- // src/statusline/elements/rows/quota.ts
139190
- init_statusline();
139191
- init_pick();
139192
-
139193
139435
  // src/statusline/wallClock.ts
139194
139436
  var DAY_KEY_LOCALE = "en-CA";
139195
139437
  var FORMATTERS = /* @__PURE__ */ new Map();
@@ -139216,6 +139458,34 @@ function formatWallClock(atMs, nowMs, clock, settings2) {
139216
139458
  return `${formatterFor(locale, { timeZone, month: "short", day: "numeric" }).format(atMs)} ${time4}`;
139217
139459
  }
139218
139460
 
139461
+ // src/statusline/elements/rows/promptCache.ts
139462
+ var MS_PER_SECOND20 = 1e3;
139463
+ var MIN_WARNING_SECONDS = 60;
139464
+ var WARNING_FRACTION_DENOMINATOR = 5;
139465
+ function warningSecondsOf(ttlSeconds) {
139466
+ return Math.min(ttlSeconds, Math.max(MIN_WARNING_SECONDS, Math.floor(ttlSeconds / WARNING_FRACTION_DENOMINATOR)));
139467
+ }
139468
+ function promptCacheRow(context) {
139469
+ const cache = context.transcript()?.session.promptCache;
139470
+ if (cache === void 0) {
139471
+ return { kind: "text", lines: [] };
139472
+ }
139473
+ const { palette, nowMs, settings: settings2 } = context;
139474
+ const ttlSeconds = cache.ttlSeconds ?? settings2.promptCache.ttlSeconds;
139475
+ const expiresAtMs = cache.anchorAtMs + ttlSeconds * MS_PER_SECOND20;
139476
+ const remainingMs = expiresAtMs - nowMs;
139477
+ const name = palette.paint("label", "Cache");
139478
+ if (remainingMs <= 0) {
139479
+ return { kind: "text", lines: [`${name} ${palette.paint("label", "\u23F1 expired")}`] };
139480
+ }
139481
+ const role = remainingMs <= warningSecondsOf(ttlSeconds) * MS_PER_SECOND20 ? "warning" : "context";
139482
+ return { kind: "text", lines: [`${name} ${palette.paint(role, `\u23F1 until ${formatWallClock(expiresAtMs, nowMs, context.ports.clock, settings2.clock)}`)}`] };
139483
+ }
139484
+
139485
+ // src/statusline/elements/rows/quota.ts
139486
+ init_statusline();
139487
+ init_pick();
139488
+
139219
139489
  // src/statusline/resetTime.ts
139220
139490
  var AVAILABLE = formatDuration(void 0);
139221
139491
  function elapsedPercent(resetMs, periodMs, nowMs) {
@@ -139297,8 +139567,8 @@ function figuresOf(window, context, style) {
139297
139567
  const clamped = Math.max(0, Math.min(1, window.fraction));
139298
139568
  const used = window.fraction * FULL_PERCENT3;
139299
139569
  const shown = settings2.usage.value === "remaining" ? Math.max(0, FULL_PERCENT3 - used) : used;
139300
- const { text: text4, pending } = formatResetTime(window, nowMs, settings2, ports.clock);
139301
- return { value: withColor(statusColor(clamped, true, style), `${shown.toFixed(1)}%`), reset: text4, pending };
139570
+ const { text: text5, pending } = formatResetTime(window, nowMs, settings2, ports.clock);
139571
+ return { value: withColor(statusColor(clamped, true, style), `${shown.toFixed(1)}%`), reset: text5, pending };
139302
139572
  }
139303
139573
  function resetSuffix(reset, pending, context) {
139304
139574
  if (reset === "") {
@@ -139334,6 +139604,19 @@ function quotaRow(context) {
139334
139604
  return { kind: "bars", cells };
139335
139605
  }
139336
139606
 
139607
+ // src/statusline/elements/rows/sessionTime.ts
139608
+ function sessionTimeRow(context) {
139609
+ const session = context.transcript()?.session;
139610
+ const { palette, nowMs, settings: settings2 } = context;
139611
+ const parts = settings2.sessionTime.parts.flatMap((part) => {
139612
+ if (part === "started") {
139613
+ return session?.startedAtMs === void 0 ? [] : `${palette.paint("label", "Started:")} ${formatWallClock(session.startedAtMs, nowMs, context.ports.clock, settings2.clock)}`;
139614
+ }
139615
+ return session?.lastResponseAtMs === void 0 ? [] : `${palette.paint("label", "Last reply:")} ${formatAgo(nowMs - session.lastResponseAtMs)}`;
139616
+ });
139617
+ return { kind: "text", lines: parts.length === 0 ? [] : [parts.join(` ${palette.paint("label", "\u2502")} `)] };
139618
+ }
139619
+
139337
139620
  // src/statusline/elements/registry.ts
139338
139621
  var HEADER_ROLES = {
139339
139622
  model: "model",
@@ -139349,11 +139632,32 @@ var HEADER_ROLES = {
139349
139632
  version: "label",
139350
139633
  outputStyle: "label",
139351
139634
  cost: "label",
139352
- dailyCost: "label"
139635
+ dailyCost: "label",
139636
+ sessionName: "label",
139637
+ duration: "label",
139638
+ speed: "label"
139353
139639
  };
139354
139640
  var ELEMENTS = {
139355
- header: { model: modelSegment, provider: providerSegment, route: routeSegment, account: accountSegment, identity: identitySegment, headroom: headroomSegment, project: projectSegment, vcs: vcsSegment, effort: effortSegment, advisor: advisorSegment, version: versionSegment, outputStyle: outputStyleSegment, cost: costSegment, dailyCost: dailyCostSegment },
139356
- rows: { context: contextRow, quota: quotaRow, addedDirs: addedDirsRow, gitFiles: gitFilesRow, memory: memoryRow, environment: environmentRow }
139641
+ header: {
139642
+ model: modelSegment,
139643
+ provider: providerSegment,
139644
+ route: routeSegment,
139645
+ account: accountSegment,
139646
+ identity: identitySegment,
139647
+ headroom: headroomSegment,
139648
+ project: projectSegment,
139649
+ vcs: vcsSegment,
139650
+ effort: effortSegment,
139651
+ advisor: advisorSegment,
139652
+ version: versionSegment,
139653
+ outputStyle: outputStyleSegment,
139654
+ cost: costSegment,
139655
+ dailyCost: dailyCostSegment,
139656
+ sessionName: sessionNameSegment,
139657
+ duration: durationSegment,
139658
+ speed: speedSegment
139659
+ },
139660
+ rows: { context: contextRow, quota: quotaRow, addedDirs: addedDirsRow, gitFiles: gitFilesRow, memory: memoryRow, environment: environmentRow, sessionTime: sessionTimeRow, promptCache: promptCacheRow, compactions: compactionsRow }
139357
139661
  };
139358
139662
 
139359
139663
  // src/statusline/identityTranscript.ts
@@ -139446,6 +139750,240 @@ function readTranscriptIdentity(ports, transcriptPath) {
139446
139750
  return floor === 0 ? identityOfLine(decoder.decode(joined2(carry))) ?? NOT_FOUND : NOT_FOUND;
139447
139751
  }
139448
139752
 
139753
+ // src/statusline/transcript/reader.ts
139754
+ var import_node_crypto27 = require("node:crypto");
139755
+ init_zod();
139756
+
139757
+ // src/statusline/transcript/record.ts
139758
+ init_zod();
139759
+ var text4 = external_exports.string().optional().catch(void 0);
139760
+ var number5 = external_exports.number().optional().catch(void 0);
139761
+ var ContentBlockSchema2 = external_exports.looseObject({ type: text4, text: text4 });
139762
+ var TranscriptRecordSchema = external_exports.looseObject({
139763
+ type: text4,
139764
+ subtype: text4,
139765
+ timestamp: text4,
139766
+ /** The session's generated name, written on every record of the session in some versions. */
139767
+ slug: text4,
139768
+ /** The name `/rename` gave the session. */
139769
+ customTitle: text4,
139770
+ /** The title Claude Code generated for the session. */
139771
+ aiTitle: text4,
139772
+ isSidechain: external_exports.boolean().optional().catch(void 0),
139773
+ /** Shared by the records one API request produced. */
139774
+ requestId: text4,
139775
+ message: external_exports.looseObject({
139776
+ content: external_exports.union([external_exports.string(), external_exports.array(ContentBlockSchema2)]).optional().catch(void 0),
139777
+ usage: external_exports.looseObject({
139778
+ cache_creation: external_exports.looseObject({ ephemeral_5m_input_tokens: number5, ephemeral_1h_input_tokens: number5 }).optional().catch(void 0)
139779
+ }).optional().catch(void 0)
139780
+ }).optional().catch(void 0)
139781
+ }).catch({});
139782
+ function parseTranscriptRecord(line) {
139783
+ let parsed;
139784
+ try {
139785
+ parsed = JSON.parse(line);
139786
+ } catch {
139787
+ return void 0;
139788
+ }
139789
+ return typeof parsed === "object" && parsed !== null && !Array.isArray(parsed) ? TranscriptRecordSchema.parse(parsed) : void 0;
139790
+ }
139791
+ function recordTimeMs(record2) {
139792
+ if (record2.timestamp === void 0) {
139793
+ return void 0;
139794
+ }
139795
+ const ms2 = Date.parse(record2.timestamp);
139796
+ return Number.isNaN(ms2) ? void 0 : ms2;
139797
+ }
139798
+
139799
+ // src/statusline/transcript/session.ts
139800
+ init_zod();
139801
+ init_statusline();
139802
+ var PromptCacheClockSchema = external_exports.strictObject({
139803
+ previousMainAtMs: external_exports.number().optional(),
139804
+ requestId: external_exports.string().optional(),
139805
+ requestAnchorAtMs: external_exports.number().optional(),
139806
+ anchorAtMs: external_exports.number().optional(),
139807
+ /** The tier the latest request that wrote to the cache used. */
139808
+ ttlSeconds: external_exports.union([external_exports.literal(PROMPT_CACHE_TTL_SECONDS.fiveMinutes), external_exports.literal(PROMPT_CACHE_TTL_SECONDS.oneHour)]).optional(),
139809
+ /** The time of a request that has been sent and not yet answered: it has already refreshed the cache. */
139810
+ pendingAtMs: external_exports.number().optional()
139811
+ });
139812
+ var SessionStateSchema2 = external_exports.strictObject({
139813
+ startedAtMs: external_exports.number().optional(),
139814
+ /** True once the start of the transcript was read and held no timestamp, so a timestamp met later is not the session's start. */
139815
+ startUnknown: external_exports.literal(true).optional(),
139816
+ lastAssistantAtMs: external_exports.number().optional(),
139817
+ compactions: external_exports.number().int().nonnegative(),
139818
+ customTitle: external_exports.string().optional(),
139819
+ slug: external_exports.string().optional(),
139820
+ aiTitle: external_exports.string().optional(),
139821
+ cache: PromptCacheClockSchema
139822
+ });
139823
+ var EMPTY_SESSION_STATE = { compactions: 0, cache: {} };
139824
+ var LOCAL_ONLY_USER_TEXT_PREFIXES = ["<command-name>", "<command-message>", "<local-command-", "[Request interrupted by user"];
139825
+ function isLocalOnlyUserText(text5) {
139826
+ return LOCAL_ONLY_USER_TEXT_PREFIXES.some((prefix) => text5.startsWith(prefix));
139827
+ }
139828
+ function opensRequest(record2) {
139829
+ const content = record2.message?.content;
139830
+ if (typeof content === "string") {
139831
+ return !isLocalOnlyUserText(content);
139832
+ }
139833
+ if (Array.isArray(content)) {
139834
+ return content.some((block2) => block2.type === "tool_result") || !content.some((block2) => block2.type === "text" && isLocalOnlyUserText(block2.text ?? ""));
139835
+ }
139836
+ return true;
139837
+ }
139838
+ function ttlOf(record2) {
139839
+ const writes = record2.message?.usage?.cache_creation;
139840
+ if ((writes?.ephemeral_5m_input_tokens ?? 0) > 0) {
139841
+ return PROMPT_CACHE_TTL_SECONDS.fiveMinutes;
139842
+ }
139843
+ return (writes?.ephemeral_1h_input_tokens ?? 0) > 0 ? PROMPT_CACHE_TTL_SECONDS.oneHour : void 0;
139844
+ }
139845
+ function foldPromptCache(cache, record2, atMs) {
139846
+ if (atMs === void 0) {
139847
+ return cache;
139848
+ }
139849
+ let next = cache;
139850
+ if (record2.type === "assistant") {
139851
+ const startsRequest = record2.requestId === void 0 || record2.requestId !== cache.requestId;
139852
+ const requestAnchorAtMs = startsRequest ? cache.previousMainAtMs : cache.requestAnchorAtMs;
139853
+ const anchorAtMs = requestAnchorAtMs !== void 0 && requestAnchorAtMs <= atMs ? requestAnchorAtMs : atMs;
139854
+ const ttlSeconds = ttlOf(record2) ?? cache.ttlSeconds;
139855
+ next = { ...cache, requestId: startsRequest ? record2.requestId : cache.requestId, requestAnchorAtMs, anchorAtMs, ttlSeconds, pendingAtMs: void 0 };
139856
+ }
139857
+ if (record2.type === "user" && opensRequest(record2)) {
139858
+ next = { ...next, pendingAtMs: atMs };
139859
+ }
139860
+ return { ...next, previousMainAtMs: atMs };
139861
+ }
139862
+ function foldSession(state, record2) {
139863
+ const atMs = recordTimeMs(record2);
139864
+ const next = { ...state };
139865
+ if (record2.type === "custom-title" && record2.customTitle !== void 0) {
139866
+ next.customTitle = record2.customTitle;
139867
+ } else if (record2.type === "ai-title" && record2.aiTitle !== void 0) {
139868
+ next.aiTitle = record2.aiTitle;
139869
+ } else if (record2.slug !== void 0) {
139870
+ next.slug = record2.slug;
139871
+ }
139872
+ if (record2.type === "system" && record2.subtype === "compact_boundary" && atMs !== void 0) {
139873
+ next.compactions += 1;
139874
+ }
139875
+ if (atMs !== void 0 && next.startedAtMs === void 0 && next.startUnknown !== true) {
139876
+ next.startedAtMs = atMs;
139877
+ }
139878
+ if (record2.type === "assistant" && atMs !== void 0) {
139879
+ next.lastAssistantAtMs = atMs;
139880
+ }
139881
+ if (record2.isSidechain !== true) {
139882
+ next.cache = foldPromptCache(state.cache, record2, atMs);
139883
+ }
139884
+ return next;
139885
+ }
139886
+ function sessionFactsOf(state) {
139887
+ const { cache } = state;
139888
+ const anchorAtMs = cache.pendingAtMs !== void 0 && (cache.anchorAtMs === void 0 || cache.pendingAtMs > cache.anchorAtMs) ? cache.pendingAtMs : cache.anchorAtMs;
139889
+ return {
139890
+ title: [state.customTitle, state.slug, state.aiTitle].flatMap((name) => name === void 0 ? [] : visibleDisplayText(name)).find((name) => name !== ""),
139891
+ startedAtMs: state.startedAtMs,
139892
+ lastResponseAtMs: state.lastAssistantAtMs,
139893
+ compactions: state.compactions,
139894
+ promptCache: anchorAtMs === void 0 ? void 0 : { anchorAtMs, ttlSeconds: cache.ttlSeconds }
139895
+ };
139896
+ }
139897
+
139898
+ // src/statusline/transcript/reader.ts
139899
+ var MAX_TRANSCRIPT_READ_BYTES = 4194304;
139900
+ var FINGERPRINT_BYTES = 4096;
139901
+ var NEWLINE2 = 10;
139902
+ var CACHE_KIND2 = "transcript";
139903
+ var CACHE_VERSION = 2;
139904
+ var TranscriptCacheSchema = external_exports.strictObject({
139905
+ version: external_exports.literal(CACHE_VERSION),
139906
+ /** A digest of the transcript's first line when this was written: another file at the same path has another one. */
139907
+ fingerprint: external_exports.string(),
139908
+ /** How far into the transcript the state has been folded: always the start of a line. */
139909
+ offset: external_exports.number().int().nonnegative(),
139910
+ /** False once bytes were left unread, so the state may be missing records from before the part read. */
139911
+ complete: external_exports.boolean(),
139912
+ session: SessionStateSchema2
139913
+ });
139914
+ function foldLines(state, bytes) {
139915
+ const end = bytes.lastIndexOf(NEWLINE2) + 1;
139916
+ let folded = state;
139917
+ for (const line of new TextDecoder().decode(bytes.subarray(0, end)).split("\n")) {
139918
+ const record2 = line === "" ? void 0 : parseTranscriptRecord(line);
139919
+ if (record2 !== void 0) {
139920
+ folded = foldSession(folded, record2);
139921
+ }
139922
+ }
139923
+ return { state: folded, consumed: end };
139924
+ }
139925
+ function startOf(head) {
139926
+ const end = head.lastIndexOf(NEWLINE2) + 1;
139927
+ const decoder = new TextDecoder();
139928
+ let from = 0;
139929
+ while (from < end) {
139930
+ const lineEnd = head.indexOf(NEWLINE2, from);
139931
+ const record2 = parseTranscriptRecord(decoder.decode(head.subarray(from, lineEnd)));
139932
+ const atMs = record2 === void 0 ? void 0 : recordTimeMs(record2);
139933
+ if (atMs !== void 0) {
139934
+ return atMs;
139935
+ }
139936
+ from = lineEnd + 1;
139937
+ }
139938
+ return void 0;
139939
+ }
139940
+ function fingerprintOf(head) {
139941
+ const newline = head.subarray(0, FINGERPRINT_BYTES).indexOf(NEWLINE2);
139942
+ return (0, import_node_crypto27.createHash)("sha256").update(head.subarray(0, newline === -1 ? FINGERPRINT_BYTES : newline + 1)).digest("hex");
139943
+ }
139944
+ function readTail(ports, file2, size) {
139945
+ const from = Math.max(0, size - MAX_TRANSCRIPT_READ_BYTES - 1);
139946
+ const range2 = ports.readRange(file2, from, MAX_TRANSCRIPT_READ_BYTES + 1);
139947
+ if (range2 === void 0) {
139948
+ return void 0;
139949
+ }
139950
+ const firstLine = from === 0 ? 0 : range2.bytes.indexOf(NEWLINE2) + 1;
139951
+ return firstLine === 0 && from > 0 ? void 0 : { bytes: range2.bytes.subarray(firstLine), offset: from + firstLine };
139952
+ }
139953
+ function factsOf(range2, cache) {
139954
+ return { bytes: range2.size, complete: cache.complete, session: sessionFactsOf(cache.session) };
139955
+ }
139956
+ var START_UNKNOWN = { startUnknown: true };
139957
+ function readTranscript(ports, transcriptPath, nowMs) {
139958
+ const file2 = cacheFileFor(ports, CACHE_KIND2, transcriptPath);
139959
+ const loaded = loadCache(ports, file2, TranscriptCacheSchema);
139960
+ const head = loaded === void 0 ? void 0 : ports.readRange(transcriptPath, 0, FINGERPRINT_BYTES);
139961
+ const cached2 = loaded !== void 0 && head !== void 0 && head.size >= loaded.offset && fingerprintOf(head.bytes) === loaded.fingerprint ? loaded : void 0;
139962
+ const from = cached2?.offset ?? 0;
139963
+ const first = ports.readRange(transcriptPath, from, MAX_TRANSCRIPT_READ_BYTES);
139964
+ if (first === void 0) {
139965
+ return void 0;
139966
+ }
139967
+ const base = cached2 ?? { version: CACHE_VERSION, fingerprint: "", offset: 0, complete: true, session: EMPTY_SESSION_STATE };
139968
+ const fold = { ports, file: file2, nowMs, range: first, created: cached2 === void 0, head: cached2 === void 0 ? first.bytes : void 0 };
139969
+ if (first.size - from <= MAX_TRANSCRIPT_READ_BYTES) {
139970
+ return foldInto({ ...fold, base, source: { bytes: first.bytes, offset: from } });
139971
+ }
139972
+ const startedAtMs = base.session.startedAtMs ?? (cached2 === void 0 ? startOf(first.bytes) : void 0);
139973
+ const unread = { ...base, complete: false, session: startedAtMs === void 0 ? { ...base.session, ...START_UNKNOWN } : { ...base.session, startedAtMs } };
139974
+ const tail = readTail(ports, transcriptPath, first.size);
139975
+ return tail === void 0 ? factsOf(first, unread) : foldInto({ ...fold, base: unread, source: tail });
139976
+ }
139977
+ function foldInto({ ports, file: file2, nowMs, range: range2, created, head, base, source }) {
139978
+ const { state, consumed } = foldLines(base.session, source.bytes);
139979
+ const next = { ...base, offset: source.offset + consumed, session: state };
139980
+ const fingerprint = created && head !== void 0 ? fingerprintOf(head) : base.fingerprint;
139981
+ if (next.offset > base.offset) {
139982
+ saveCache(ports, file2, { ...next, fingerprint }, nowMs);
139983
+ }
139984
+ return factsOf(range2, next);
139985
+ }
139986
+
139449
139987
  // src/statusline/render.ts
139450
139988
  var RESERVED_COLUMNS = 4;
139451
139989
  function once2(read) {
@@ -139468,11 +140006,15 @@ function renderStatuslineBlock(input2) {
139468
140006
  settings: settings2,
139469
140007
  palette: createPalette(settings2.colours, colourEnabled(input2.ports.env)),
139470
140008
  ports: input2.ports,
139471
- transcriptIdentity: once2(() => input2.payload.transcript_path === void 0 ? { model: void 0, advisor: void 0 } : readTranscriptIdentity(input2.ports, input2.payload.transcript_path))
140009
+ transcriptIdentity: once2(() => input2.payload.transcript_path === void 0 ? { model: void 0, advisor: void 0 } : readTranscriptIdentity(input2.ports, input2.payload.transcript_path)),
140010
+ transcript: once2(() => {
140011
+ const transcriptPath = input2.payload.transcript_path;
140012
+ return transcriptPath === void 0 || transcriptPath === "" ? void 0 : readTranscript(input2.ports, transcriptPath, input2.nowMs);
140013
+ })
139472
140014
  };
139473
140015
  const parts = settings2.layout.header.flatMap((name) => {
139474
- const text4 = elements.header[name](context);
139475
- return text4 === void 0 ? [] : { name, text: context.palette.paint(HEADER_ROLES[name], text4) };
140016
+ const text5 = elements.header[name](context);
140017
+ return text5 === void 0 ? [] : { name, text: context.palette.paint(HEADER_ROLES[name], text5) };
139476
140018
  });
139477
140019
  const header = headerUnits(parts, settings2.git.branchOverflow);
139478
140020
  const lines = [];
@@ -139553,7 +140095,7 @@ function registerStatuslineCommand(program2, deps) {
139553
140095
  } else {
139554
140096
  const configDir = process.env.CLAUDE_CONFIG_DIR;
139555
140097
  try {
139556
- account = readAccountMetadataFile(realFarmFs, configDir === void 0 || configDir === "" ? import_node_path61.default.join(import_node_os13.default.homedir(), ".claude.json") : import_node_path61.default.join(configDir, ".claude.json"));
140098
+ account = readAccountMetadataFile(realFarmFs, configDir === void 0 || configDir === "" ? import_node_path62.default.join(import_node_os13.default.homedir(), ".claude.json") : import_node_path62.default.join(configDir, ".claude.json"));
139557
140099
  } catch {
139558
140100
  account = void 0;
139559
140101
  }
@@ -140453,7 +140995,7 @@ var EmbeddedResourceSchema = object({
140453
140995
  var ResourceLinkSchema = ResourceSchema.extend({
140454
140996
  type: literal("resource_link")
140455
140997
  });
140456
- var ContentBlockSchema2 = union([
140998
+ var ContentBlockSchema3 = union([
140457
140999
  TextContentSchema,
140458
141000
  ImageContentSchema,
140459
141001
  AudioContentSchema,
@@ -140462,7 +141004,7 @@ var ContentBlockSchema2 = union([
140462
141004
  ]);
140463
141005
  var PromptMessageSchema = object({
140464
141006
  role: RoleSchema,
140465
- content: ContentBlockSchema2
141007
+ content: ContentBlockSchema3
140466
141008
  });
140467
141009
  var GetPromptResultSchema = ResultSchema.extend({
140468
141010
  /**
@@ -140578,7 +141120,7 @@ var CallToolResultSchema = ResultSchema.extend({
140578
141120
  * If the Tool does not define an outputSchema, this field MUST be present in the result.
140579
141121
  * For backwards compatibility, this field is always present, but it may be empty.
140580
141122
  */
140581
- content: array(ContentBlockSchema2).default([]),
141123
+ content: array(ContentBlockSchema3).default([]),
140582
141124
  /**
140583
141125
  * An object containing structured tool output.
140584
141126
  *
@@ -140707,7 +141249,7 @@ var ToolChoiceSchema2 = object({
140707
141249
  var ToolResultContentSchema = object({
140708
141250
  type: literal("tool_result"),
140709
141251
  toolUseId: string2().describe("The unique identifier for the corresponding tool call."),
140710
- content: array(ContentBlockSchema2).default([]),
141252
+ content: array(ContentBlockSchema3).default([]),
140711
141253
  structuredContent: object({}).loose().optional(),
140712
141254
  isError: boolean2().optional(),
140713
141255
  /**
@@ -141654,8 +142196,8 @@ function getErrorMap2() {
141654
142196
 
141655
142197
  // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v3/helpers/parseUtil.js
141656
142198
  var makeIssue = (params) => {
141657
- const { data, path: path71, errorMaps, issueData } = params;
141658
- const fullPath = [...path71, ...issueData.path || []];
142199
+ const { data, path: path72, errorMaps, issueData } = params;
142200
+ const fullPath = [...path72, ...issueData.path || []];
141659
142201
  const fullIssue = {
141660
142202
  ...issueData,
141661
142203
  path: fullPath
@@ -141770,11 +142312,11 @@ var errorUtil;
141770
142312
 
141771
142313
  // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v3/types.js
141772
142314
  var ParseInputLazyPath = class {
141773
- constructor(parent, value2, path71, key) {
142315
+ constructor(parent, value2, path72, key) {
141774
142316
  this._cachedPath = [];
141775
142317
  this.parent = parent;
141776
142318
  this.data = value2;
141777
- this._path = path71;
142319
+ this._path = path72;
141778
142320
  this._key = key;
141779
142321
  }
141780
142322
  get path() {
@@ -145337,11 +145879,11 @@ function normalizeObjectSchema(schema) {
145337
145879
  }
145338
145880
  return void 0;
145339
145881
  }
145340
- function getDotPath(path71) {
145341
- if (path71.length === 0) {
145882
+ function getDotPath(path72) {
145883
+ if (path72.length === 0) {
145342
145884
  return "object root";
145343
145885
  }
145344
- return path71.reduce((acc, seg, index) => {
145886
+ return path72.reduce((acc, seg, index) => {
145345
145887
  if (index === 0) {
145346
145888
  return String(seg);
145347
145889
  }
@@ -149384,7 +149926,7 @@ async function serveMcp(mcp, transport, options = {}) {
149384
149926
 
149385
149927
  // src/mcp/permissions.ts
149386
149928
  var import_node_fs23 = __toESM(require("node:fs"), 1);
149387
- var import_node_path62 = __toESM(require("node:path"), 1);
149929
+ var import_node_path63 = __toESM(require("node:path"), 1);
149388
149930
  init_zod();
149389
149931
  init_store();
149390
149932
  var StoredMcpPermissionsSchema = external_exports.strictObject({
@@ -149406,10 +149948,10 @@ function effectiveMcpPermissions(flags, stored) {
149406
149948
  return { writes: flags.writes || stored.writes, remoteControl: flags.remoteControl || stored.remoteControl, history: flags.history || stored.history };
149407
149949
  }
149408
149950
  function watchMcpPermissions(paths, onChange) {
149409
- const directory = import_node_path62.default.dirname(paths.mcpPermissionsFile);
149951
+ const directory = import_node_path63.default.dirname(paths.mcpPermissionsFile);
149410
149952
  import_node_fs23.default.mkdirSync(directory, { recursive: true });
149411
149953
  const watcher = import_node_fs23.default.watch(directory, (_event, filename) => {
149412
- if (filename === null || filename === import_node_path62.default.basename(paths.mcpPermissionsFile)) {
149954
+ if (filename === null || filename === import_node_path63.default.basename(paths.mcpPermissionsFile)) {
149413
149955
  onChange();
149414
149956
  }
149415
149957
  });
@@ -149574,9 +150116,9 @@ init_cliError();
149574
150116
  init_argv();
149575
150117
  init_legacy();
149576
150118
  var COMPLETION_SHELLS = ["bash", "zsh", "fish"];
149577
- function firstSentence(text4) {
149578
- const end = text4.search(/\.(\s|$)/);
149579
- return end === -1 ? text4 : text4.slice(0, end);
150119
+ function firstSentence(text5) {
150120
+ const end = text5.search(/\.(\s|$)/);
150121
+ return end === -1 ? text5 : text5.slice(0, end);
149580
150122
  }
149581
150123
  function collectNodes(program2) {
149582
150124
  const help = new Help();
@@ -149597,11 +150139,11 @@ function collectNodes(program2) {
149597
150139
  visit2(program2, "root");
149598
150140
  return nodes;
149599
150141
  }
149600
- function singleQuote(text4) {
149601
- return `'${text4.replaceAll("'", `'\\''`)}'`;
150142
+ function singleQuote(text5) {
150143
+ return `'${text5.replaceAll("'", `'\\''`)}'`;
149602
150144
  }
149603
- function fishQuote(text4) {
149604
- return `'${text4.replaceAll("\\", "\\\\").replaceAll("'", "\\'")}'`;
150145
+ function fishQuote(text5) {
150146
+ return `'${text5.replaceAll("\\", "\\\\").replaceAll("'", "\\'")}'`;
149605
150147
  }
149606
150148
  function transitionArms(nodes, indent) {
149607
150149
  return nodes.flatMap((node2) => [...node2.children].map(([name, child]) => `${indent}${singleQuote(`${node2.id}:${name}`)}) node=${singleQuote(child)} ;;`)).join("\n");
@@ -149714,7 +150256,6 @@ function registerCompletionCommand(program2) {
149714
150256
  }
149715
150257
 
149716
150258
  // src/credentialCommand.ts
149717
- var import_node_child_process9 = require("node:child_process");
149718
150259
  init_commandDeps();
149719
150260
  init_cliError();
149720
150261
  init_schema();
@@ -149723,16 +150264,16 @@ init_credentialCache();
149723
150264
 
149724
150265
  // src/identityToken.ts
149725
150266
  var import_node_fs24 = __toESM(require("node:fs"), 1);
149726
- var import_node_path63 = __toESM(require("node:path"), 1);
150267
+ var import_node_path64 = __toESM(require("node:path"), 1);
149727
150268
  init_cliError();
149728
150269
  var TOKEN_FILE_MODE = 384;
149729
150270
  var TOKEN_DIR_MODE = 448;
149730
150271
  var OAUTH_TOKEN_RE = /^sk-ant-oat\d+-[A-Za-z0-9_-]+$/;
149731
150272
  function identityTokenDir(paths) {
149732
- return import_node_path63.default.join(paths.root, "credentials");
150273
+ return import_node_path64.default.join(paths.root, "credentials");
149733
150274
  }
149734
150275
  function identityTokenPath(paths, identityName) {
149735
- return import_node_path63.default.join(identityTokenDir(paths), `${identityName}.token`);
150276
+ return import_node_path64.default.join(identityTokenDir(paths), `${identityName}.token`);
149736
150277
  }
149737
150278
  function storeIdentityToken(paths, identityName, raw) {
149738
150279
  const token = raw.trim();
@@ -149743,7 +150284,7 @@ function storeIdentityToken(paths, identityName, raw) {
149743
150284
  import_node_fs24.default.mkdirSync(dir, { recursive: true, mode: TOKEN_DIR_MODE });
149744
150285
  import_node_fs24.default.chmodSync(dir, TOKEN_DIR_MODE);
149745
150286
  const target = identityTokenPath(paths, identityName);
149746
- const temp = import_node_path63.default.join(dir, `.${identityName}.${String(process.pid)}.tmp`);
150287
+ const temp = import_node_path64.default.join(dir, `.${identityName}.${String(process.pid)}.tmp`);
149747
150288
  import_node_fs24.default.writeFileSync(temp, `${token}
149748
150289
  `, { mode: TOKEN_FILE_MODE });
149749
150290
  import_node_fs24.default.renameSync(temp, target);
@@ -149754,6 +150295,7 @@ function storeIdentityToken(paths, identityName, raw) {
149754
150295
  init_providersStore();
149755
150296
  init_realPorts();
149756
150297
  init_realCredentialCache();
150298
+ init_blockingSpawn();
149757
150299
  async function readStandardInput() {
149758
150300
  const chunks = [];
149759
150301
  for await (const chunk2 of process.stdin) {
@@ -149775,7 +150317,7 @@ function realCommandPorts(deps) {
149775
150317
  cache: createRealCredentialCache(deps.paths.root),
149776
150318
  platform: process.platform,
149777
150319
  now: () => Date.now(),
149778
- ssh: (host, remoteCommand, input2) => (0, import_node_child_process9.spawnSync)("ssh", ["--", host, remoteCommand], { input: input2, stdio: ["pipe", "inherit", "inherit"] }).status
150320
+ ssh: (host, remoteCommand, input2) => spawnSyncBlocking("an ssh run", "ssh", ["--", host, remoteCommand], { input: input2, stdio: ["pipe", "inherit", "inherit"] }).status
149779
150321
  };
149780
150322
  }
149781
150323
  var REMOTE_ROOT_SCRIPT = 'root="${AGENT_SHIM_HOME:-${CLAUDE_USE_HOME:-}}"; if [ -z "$root" ]; then if [ ! -d "$HOME/.agent-shim" ] && [ -d "$HOME/.claude-use" ]; then root="$HOME/.claude-use"; else root="$HOME/.agent-shim"; fi; fi';
@@ -149914,8 +150456,8 @@ function registerDoctorCommand(program2, deps) {
149914
150456
  // src/headroom/commands.ts
149915
150457
  var import_node_fs25 = __toESM(require("node:fs"), 1);
149916
150458
  var import_node_http5 = __toESM(require("node:http"), 1);
149917
- var import_node_path64 = __toESM(require("node:path"), 1);
149918
- var import_node_child_process10 = require("node:child_process");
150459
+ var import_node_path65 = __toESM(require("node:path"), 1);
150460
+ var import_node_child_process9 = require("node:child_process");
149919
150461
  init_commandDeps();
149920
150462
  init_configProfilesStore();
149921
150463
  init_realFrontDoorPort();
@@ -149971,6 +150513,7 @@ function registerHeadroomRoutingCommands(headroom, deps) {
149971
150513
  init_settings();
149972
150514
  init_source();
149973
150515
  init_realPorts();
150516
+ init_blockingSpawn();
149974
150517
  init_earlierRelease();
149975
150518
  init_state2();
149976
150519
  init_socket();
@@ -150100,16 +150643,16 @@ async function readyOverSocket(socketPath) {
150100
150643
  }
150101
150644
  var HEADROOM_TOOL_NAME = "headroom-ai";
150102
150645
  function readInstalledHeadroomCommit() {
150103
- const toolDir = (0, import_node_child_process10.spawnSync)("uv", ["tool", "dir"], { encoding: "utf8" });
150646
+ const toolDir = spawnSyncBlocking("a headroom tool lookup", "uv", ["tool", "dir"], { encoding: "utf8" });
150104
150647
  if (toolDir.status !== 0) {
150105
150648
  return void 0;
150106
150649
  }
150107
- const libDir = import_node_path64.default.join(toolDir.stdout.trim(), HEADROOM_TOOL_NAME, "lib");
150650
+ const libDir = import_node_path65.default.join(toolDir.stdout.trim(), HEADROOM_TOOL_NAME, "lib");
150108
150651
  for (const python of realFarmFs.readdir(libDir)) {
150109
- const sitePackages = import_node_path64.default.join(libDir, python, "site-packages");
150652
+ const sitePackages = import_node_path65.default.join(libDir, python, "site-packages");
150110
150653
  for (const entry of realFarmFs.readdir(sitePackages)) {
150111
150654
  if (entry.startsWith("headroom_ai-") && entry.endsWith(".dist-info")) {
150112
- const directUrl = realFarmFs.readFileUtf8(import_node_path64.default.join(sitePackages, entry, "direct_url.json"));
150655
+ const directUrl = realFarmFs.readFileUtf8(import_node_path65.default.join(sitePackages, entry, "direct_url.json"));
150113
150656
  return directUrl === void 0 ? void 0 : parseInstalledCommit(directUrl);
150114
150657
  }
150115
150658
  }
@@ -150144,7 +150687,7 @@ function realSupervisorPorts(paths) {
150144
150687
  }
150145
150688
  const logFd = import_node_fs25.default.openSync(paths.headroomLogPath, "a");
150146
150689
  try {
150147
- const child = (0, import_node_child_process10.spawn)("headroom", headroomProxyArgs(socketPath, allowlistFile, settings2), {
150690
+ const child = (0, import_node_child_process9.spawn)("headroom", headroomProxyArgs(socketPath, allowlistFile, settings2), {
150148
150691
  detached: true,
150149
150692
  stdio: ["ignore", logFd, logFd],
150150
150693
  env: headroomSpawnEnv(process.env, settings2, trust?.path)
@@ -150184,7 +150727,7 @@ function realSupervisorPorts(paths) {
150184
150727
  },
150185
150728
  ready: readyOverSocket,
150186
150729
  install: (spec) => {
150187
- const result = (0, import_node_child_process10.spawnSync)("uv", ["tool", "install", spec], { encoding: "utf8", timeout: HEADROOM_INSTALL_TIMEOUT_MS });
150730
+ const result = spawnSyncBlocking("a headroom install", "uv", ["tool", "install", spec], { encoding: "utf8", timeout: HEADROOM_INSTALL_TIMEOUT_MS });
150188
150731
  if (result.error !== void 0) {
150189
150732
  const timedOut = "code" in result.error && result.error.code === "ETIMEDOUT";
150190
150733
  return {
@@ -150201,7 +150744,7 @@ function realSupervisorPorts(paths) {
150201
150744
  return result.status === 0 ? { ok: true } : { ok: false, error: `uv tool install exited ${String(result.status)}` };
150202
150745
  },
150203
150746
  headroomVersion: () => {
150204
- const result = (0, import_node_child_process10.spawnSync)("headroom", ["--version"], { encoding: "utf8" });
150747
+ const result = spawnSyncBlocking("a headroom version check", "headroom", ["--version"], { encoding: "utf8" });
150205
150748
  return result.status === 0 ? result.stdout.trim() : void 0;
150206
150749
  },
150207
150750
  installedCommit: readInstalledHeadroomCommit,
@@ -150340,9 +150883,9 @@ init_providersStore();
150340
150883
  init_realPorts();
150341
150884
  var realCatalogueFetch = async (url2, headers, timeoutMs) => {
150342
150885
  const response = await fetch(url2, { headers: { ...headers }, signal: AbortSignal.timeout(timeoutMs) });
150343
- const text4 = await response.text();
150886
+ const text5 = await response.text();
150344
150887
  try {
150345
- const body = JSON.parse(text4);
150888
+ const body = JSON.parse(text5);
150346
150889
  return { status: response.status, body };
150347
150890
  } catch {
150348
150891
  return { status: response.status, body: void 0 };
@@ -150365,7 +150908,7 @@ async function refreshCatalogueForReal(paths, name, env) {
150365
150908
  init_realPorts();
150366
150909
 
150367
150910
  // src/usage/realJobRunner.ts
150368
- var import_node_path65 = __toESM(require("node:path"), 1);
150911
+ var import_node_path66 = __toESM(require("node:path"), 1);
150369
150912
  init_conditions();
150370
150913
  init_identityClaude();
150371
150914
  var JOB_LAUNCH_FLAGS = ["--no-headroom", "--no-remote-control", "--track-usage"];
@@ -150378,7 +150921,7 @@ ${outcome.trimEnd()}
150378
150921
  }
150379
150922
  function createRealJobRunner(params) {
150380
150923
  return async (name, identity, job) => {
150381
- const logFile = import_node_path65.default.join(params.paths.jobLogsDir, `${name}.log`);
150924
+ const logFile = import_node_path66.default.join(params.paths.jobLogsDir, `${name}.log`);
150382
150925
  const append = (outcome) => {
150383
150926
  params.fs.mkdirPrivate(params.paths.jobLogsDir);
150384
150927
  params.fs.appendFilePrivate(logFile, logEntry(name, identity, params.now(), outcome));
@@ -150435,7 +150978,7 @@ function registerHeadlessCommands(program2, deps) {
150435
150978
  }
150436
150979
 
150437
150980
  // src/jobs.ts
150438
- var import_node_path66 = __toESM(require("node:path"), 1);
150981
+ var import_node_path67 = __toESM(require("node:path"), 1);
150439
150982
  init_commandDeps();
150440
150983
  init_cliError();
150441
150984
  init_schema();
@@ -150460,7 +151003,7 @@ function jobOf(options) {
150460
151003
  target: options.identity === void 0 ? { pool: options.pool ?? "" } : { identity: options.identity },
150461
151004
  trigger: options.at === void 0 ? { beforeReset: options.beforeReset ?? "fiveHour", lead: options.lead ?? "" } : { at: options.at },
150462
151005
  prompt: options.prompt,
150463
- cwd: import_node_path66.default.resolve(options.cwd ?? process.cwd()),
151006
+ cwd: import_node_path67.default.resolve(options.cwd ?? process.cwd()),
150464
151007
  timeout: options.timeout,
150465
151008
  ...options.model === void 0 ? {} : { model: options.model },
150466
151009
  ...options.allowedTool === void 0 ? {} : { allowedTools: options.allowedTool }
@@ -150533,7 +151076,7 @@ function registerJobCommand(program2, deps) {
150533
151076
  console.log(`Allowed tools: ${entry.allowedTools.join(", ")}`);
150534
151077
  }
150535
151078
  console.log(`Prompt: ${entry.prompt}`);
150536
- console.log(`Results: ${import_node_path66.default.join(paths.jobLogsDir, `${name}.log`)}`);
151079
+ console.log(`Results: ${import_node_path67.default.join(paths.jobLogsDir, `${name}.log`)}`);
150537
151080
  }),
150538
151081
  ["agent-shim job show digest"]
150539
151082
  );
@@ -150556,7 +151099,7 @@ function registerJobCommand(program2, deps) {
150556
151099
  throw new UsageError(`No member of the job's pool can be picked right now.`);
150557
151100
  }
150558
151101
  await createRealJobRunner({ paths, spawnDaemon: spawnDetachedSupervisor, fs: realFarmFs, now: () => /* @__PURE__ */ new Date() })(name, identity, entry);
150559
- console.log(`Ran job "${name}" as ${identity}; the result is in ${import_node_path66.default.join(paths.jobLogsDir, `${name}.log`)}.`);
151102
+ console.log(`Ran job "${name}" as ${identity}; the result is in ${import_node_path67.default.join(paths.jobLogsDir, `${name}.log`)}.`);
150560
151103
  }),
150561
151104
  ["agent-shim job run digest"]
150562
151105
  );
@@ -150720,7 +151263,7 @@ init_providerAliases();
150720
151263
 
150721
151264
  // src/providerRename.ts
150722
151265
  var import_node_fs26 = __toESM(require("node:fs"), 1);
150723
- var import_node_path67 = __toESM(require("node:path"), 1);
151266
+ var import_node_path68 = __toESM(require("node:path"), 1);
150724
151267
  init_schema();
150725
151268
  init_store();
150726
151269
  init_load();
@@ -150837,7 +151380,7 @@ function rewriteReferences(paths, from, to2) {
150837
151380
  const launch = renamedLaunch(profile.launch, from, to2);
150838
151381
  const models = profile.models === void 0 ? void 0 : renamedModels(profile.models, from, to2);
150839
151382
  if (launch !== void 0 || models !== void 0) {
150840
- applyPatch(import_node_path67.default.join(paths.configProfilesDir, `${name}.json`), ConfigProfileSchema, { ...launch === void 0 ? {} : { launch }, ...models === void 0 ? {} : { models } });
151383
+ applyPatch(import_node_path68.default.join(paths.configProfilesDir, `${name}.json`), ConfigProfileSchema, { ...launch === void 0 ? {} : { launch }, ...models === void 0 ? {} : { models } });
150841
151384
  rewritten.push(`profile ${name}`);
150842
151385
  }
150843
151386
  }
@@ -151664,7 +152207,7 @@ function registerSessionCommands(program2, deps) {
151664
152207
  }
151665
152208
 
151666
152209
  // src/usage/commands.ts
151667
- var import_node_path68 = __toESM(require("node:path"), 1);
152210
+ var import_node_path69 = __toESM(require("node:path"), 1);
151668
152211
  init_commandDeps();
151669
152212
  init_realPorts();
151670
152213
  init_account();
@@ -151803,7 +152346,7 @@ function collectAccounts(fs30, paths, identity, probe) {
151803
152346
  return names.map((name) => ({
151804
152347
  identity: name,
151805
152348
  account: readAccountMetadata(fs30, paths.identitiesDir, name),
151806
- signIn: identitySignIn(fs30, probe, { farmRoot: import_node_path68.default.join(paths.identitiesDir, name), hasCredentialBlock: readIdentity(paths, name)?.credential !== void 0 }),
152349
+ signIn: identitySignIn(fs30, probe, { farmRoot: import_node_path69.default.join(paths.identitiesDir, name), hasCredentialBlock: readIdentity(paths, name)?.credential !== void 0 }),
151807
152350
  usage: readUsageSnapshot(fs30, paths.usageSnapshotsDir, name)
151808
152351
  }));
151809
152352
  }
@@ -152044,7 +152587,7 @@ async function realRefresher(params) {
152044
152587
  }
152045
152588
 
152046
152589
  // src/supervise/launch.ts
152047
- var import_node_crypto26 = require("node:crypto");
152590
+ var import_node_crypto28 = require("node:crypto");
152048
152591
  init_claudeSession();
152049
152592
  init_pool();
152050
152593
  init_realPorts();
@@ -152140,8 +152683,8 @@ function createRealCompactor(params) {
152140
152683
  sizes = boundarySizes(message);
152141
152684
  }
152142
152685
  if (message.type === "result") {
152143
- const text4 = successfulResult(message);
152144
- return sizes === void 0 ? { kind: "unchanged", reason: text4 === "" ? "nothing was compacted" : text4 } : { kind: "compacted", ...sizes };
152686
+ const text5 = successfulResult(message);
152687
+ return sizes === void 0 ? { kind: "unchanged", reason: text5 === "" ? "nothing was compacted" : text5 } : { kind: "compacted", ...sizes };
152145
152688
  }
152146
152689
  }
152147
152690
  throw new Error("the compaction ended without a result");
@@ -152210,7 +152753,7 @@ function quotaHitOf(fs30, paths, identity, sessionId, sinceMs, nowMs) {
152210
152753
  }
152211
152754
 
152212
152755
  // src/supervise/move.ts
152213
- var import_node_path69 = __toESM(require("node:path"), 1);
152756
+ var import_node_path70 = __toESM(require("node:path"), 1);
152214
152757
  init_lock();
152215
152758
  init_poolPick();
152216
152759
  init_read();
@@ -152256,7 +152799,7 @@ function createMover(deps) {
152256
152799
  if (resolution.identity === request7.from) {
152257
152800
  return { kind: "stay", reason: `no other member of pool "${pool}" can take it` };
152258
152801
  }
152259
- const transcript = import_node_path69.default.join(paths.identitiesDir, resolution.identity, "projects", projectDirNameOf(deps.cwd), `${request7.sessionId}.jsonl`);
152802
+ const transcript = import_node_path70.default.join(paths.identitiesDir, resolution.identity, "projects", projectDirNameOf(deps.cwd), `${request7.sessionId}.jsonl`);
152260
152803
  if (farmFs.lstat(transcript)?.kind !== "file") {
152261
152804
  return { kind: "stay", reason: `${resolution.identity} does not share this conversation's history, so it could not resume it` };
152262
152805
  }
@@ -152290,13 +152833,13 @@ function createIdentityMover(deps) {
152290
152833
  throw error63;
152291
152834
  }
152292
152835
  try {
152293
- if (farmFs.readFileUtf8(import_node_path69.default.join(paths.identitiesDir, request7.to, "identity.json")) === void 0) {
152836
+ if (farmFs.readFileUtf8(import_node_path70.default.join(paths.identitiesDir, request7.to, "identity.json")) === void 0) {
152294
152837
  return { kind: "stay", reason: `no identity "${request7.to}"` };
152295
152838
  }
152296
152839
  if (request7.to === request7.from) {
152297
152840
  return { kind: "stay", reason: `the model already runs under this session's identity` };
152298
152841
  }
152299
- const transcript = import_node_path69.default.join(paths.identitiesDir, request7.to, "projects", projectDirNameOf(deps.cwd), `${request7.sessionId}.jsonl`);
152842
+ const transcript = import_node_path70.default.join(paths.identitiesDir, request7.to, "projects", projectDirNameOf(deps.cwd), `${request7.sessionId}.jsonl`);
152300
152843
  if (farmFs.lstat(transcript)?.kind !== "file") {
152301
152844
  return { kind: "stay", reason: `${request7.to} does not share this conversation's history, so it could not resume it` };
152302
152845
  }
@@ -152318,12 +152861,13 @@ function createIdentityMover(deps) {
152318
152861
  }
152319
152862
 
152320
152863
  // src/supervise/realPorts.ts
152321
- var import_node_child_process11 = require("node:child_process");
152864
+ var import_node_child_process10 = require("node:child_process");
152322
152865
  var import_node_fs28 = __toESM(require("node:fs"), 1);
152323
152866
  init_realPorts();
152867
+ init_blockingSpawn();
152324
152868
  var realSupervisedSpawnPort = {
152325
152869
  spawn(command, args, options) {
152326
- const child = (0, import_node_child_process11.spawn)(command, [...args], { stdio: options.stdio, env: { ...options.env } });
152870
+ const child = (0, import_node_child_process10.spawn)(command, [...args], { stdio: options.stdio, env: { ...options.env } });
152327
152871
  const exit = new Promise((resolve2) => {
152328
152872
  child.once("error", (error63) => {
152329
152873
  resolve2({ status: null, signal: null, error: error63 });
@@ -152385,7 +152929,7 @@ function resetTerminal() {
152385
152929
  return;
152386
152930
  }
152387
152931
  process.stdout.write(TERMINAL_RESET);
152388
- (0, import_node_child_process11.spawnSync)("stty", ["sane"], { stdio: ["inherit", "ignore", "ignore"] });
152932
+ spawnSyncBlocking("a terminal reset", "stty", ["sane"], { stdio: ["inherit", "ignore", "ignore"] });
152389
152933
  }
152390
152934
 
152391
152935
  // src/supervise/supervise.ts
@@ -152635,7 +153179,7 @@ async function runSupervised(params) {
152635
153179
  log.warn(`agent-shim: pool "${pool}" resumes on a spent quota, which needs a POSIX terminal; this launch runs unsupervised`);
152636
153180
  return void 0;
152637
153181
  }
152638
- const first = initialConversationOf(params.passthrough, { newId: import_node_crypto26.randomUUID, latestId: () => latestConversationId(farm.fs, { claudeHome: farm.claudeHome, cwd: farm.cwd }) });
153182
+ const first = initialConversationOf(params.passthrough, { newId: import_node_crypto28.randomUUID, latestId: () => latestConversationId(farm.fs, { claudeHome: farm.claudeHome, cwd: farm.cwd }) });
152639
153183
  if ("reason" in first) {
152640
153184
  log.warn(`agent-shim: pool "${pool}" resumes on a spent quota, but this launch runs unsupervised: ${first.reason}`);
152641
153185
  return void 0;
@@ -152874,7 +153418,7 @@ async function runClaude(argvOverride) {
152874
153418
  // src/cli.ts
152875
153419
  async function main() {
152876
153420
  aliasLegacyEnv(process.env);
152877
- const invokedName = import_node_path70.default.basename(process.argv[1] ?? "agent-shim");
153421
+ const invokedName = import_node_path71.default.basename(process.argv[1] ?? "agent-shim");
152878
153422
  if (isInvokedAsClaude(invokedName)) {
152879
153423
  await runClaude();
152880
153424
  return;