claude-use 11.56.0 → 11.57.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, path68) {
322
- if (!path68)
321
+ function getElementAtPath(obj, path71) {
322
+ if (!path71)
323
323
  return obj;
324
- return path68.reduce((acc, key) => acc?.[key], obj);
324
+ return path71.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(path68, issues) {
583
+ function prefixIssues(path71, issues) {
584
584
  return issues.map((iss) => {
585
585
  var _a4;
586
586
  (_a4 = iss).path ?? (_a4.path = []);
587
- iss.path.unshift(path68);
587
+ iss.path.unshift(path71);
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, path68 = []) => {
1108
+ const processError = (error64, path71 = []) => {
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 }, [...path68, ...issue2.path]));
1111
+ issue2.errors.map((issues) => processError({ issues }, [...path71, ...issue2.path]));
1112
1112
  } else if (issue2.code === "invalid_key") {
1113
- processError({ issues: issue2.issues }, [...path68, ...issue2.path]);
1113
+ processError({ issues: issue2.issues }, [...path71, ...issue2.path]);
1114
1114
  } else if (issue2.code === "invalid_element") {
1115
- processError({ issues: issue2.issues }, [...path68, ...issue2.path]);
1115
+ processError({ issues: issue2.issues }, [...path71, ...issue2.path]);
1116
1116
  } else {
1117
- const fullpath = [...path68, ...issue2.path];
1117
+ const fullpath = [...path71, ...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, path68 = []) => {
1156
+ const processError = (error64, path71 = []) => {
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 }, [...path68, ...issue2.path]));
1160
+ issue2.errors.map((issues) => processError({ issues }, [...path71, ...issue2.path]));
1161
1161
  } else if (issue2.code === "invalid_key") {
1162
- processError({ issues: issue2.issues }, [...path68, ...issue2.path]);
1162
+ processError({ issues: issue2.issues }, [...path71, ...issue2.path]);
1163
1163
  } else if (issue2.code === "invalid_element") {
1164
- processError({ issues: issue2.issues }, [...path68, ...issue2.path]);
1164
+ processError({ issues: issue2.issues }, [...path71, ...issue2.path]);
1165
1165
  } else {
1166
- const fullpath = [...path68, ...issue2.path];
1166
+ const fullpath = [...path71, ...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 path68 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1206
- for (const seg of path68) {
1205
+ const path71 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1206
+ for (const seg of path71) {
1207
1207
  if (typeof seg === "number")
1208
1208
  segs.push(`[${seg}]`);
1209
1209
  else if (typeof seg === "symbol")
@@ -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 path68 = ref.slice(1).split("/").filter(Boolean);
19203
- if (path68.length === 0) {
19202
+ const path71 = ref.slice(1).split("/").filter(Boolean);
19203
+ if (path71.length === 0) {
19204
19204
  return ctx.rootSchema;
19205
19205
  }
19206
19206
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
19207
- if (path68[0] === defsKey) {
19208
- const key = path68[1] === void 0 ? void 0 : decodeJSONPointerSegment(path68[1]);
19207
+ if (path71[0] === defsKey) {
19208
+ const key = path71[1] === void 0 ? void 0 : decodeJSONPointerSegment(path71[1]);
19209
19209
  if (!key || !ctx.defs[key]) {
19210
19210
  throw new Error(`Reference not found: ${ref}`);
19211
19211
  }
@@ -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 path68 = require("path");
23715
+ var path71 = 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 = path68.join(homedir, "Library");
23721
+ const library = path71.join(homedir, "Library");
23722
23722
  return {
23723
- data: path68.join(library, "Application Support", name),
23724
- config: path68.join(library, "Preferences", name),
23725
- cache: path68.join(library, "Caches", name),
23726
- log: path68.join(library, "Logs", name),
23727
- temp: path68.join(tmpdir, name)
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)
23728
23728
  };
23729
23729
  };
23730
23730
  var windows = (name) => {
23731
- const appData = env.APPDATA || path68.join(homedir, "AppData", "Roaming");
23732
- const localAppData = env.LOCALAPPDATA || path68.join(homedir, "AppData", "Local");
23731
+ const appData = env.APPDATA || path71.join(homedir, "AppData", "Roaming");
23732
+ const localAppData = env.LOCALAPPDATA || path71.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: path68.join(localAppData, name, "Data"),
23736
- config: path68.join(appData, name, "Config"),
23737
- cache: path68.join(localAppData, name, "Cache"),
23738
- log: path68.join(localAppData, name, "Log"),
23739
- temp: path68.join(tmpdir, name)
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)
23740
23740
  };
23741
23741
  };
23742
23742
  var linux = (name) => {
23743
- const username = path68.basename(homedir);
23743
+ const username = path71.basename(homedir);
23744
23744
  return {
23745
- data: path68.join(env.XDG_DATA_HOME || path68.join(homedir, ".local", "share"), name),
23746
- config: path68.join(env.XDG_CONFIG_HOME || path68.join(homedir, ".config"), name),
23747
- cache: path68.join(env.XDG_CACHE_HOME || path68.join(homedir, ".cache"), name),
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),
23748
23748
  // https://wiki.debian.org/XDGBaseDirectorySpecification#state
23749
- log: path68.join(env.XDG_STATE_HOME || path68.join(homedir, ".local", "state"), name),
23750
- temp: path68.join(tmpdir, username, name)
23749
+ log: path71.join(env.XDG_STATE_HOME || path71.join(homedir, ".local", "state"), name),
23750
+ temp: path71.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, path68) {
23819
- if (typeof path68 === "string" && Object.prototype.hasOwnProperty.call(source, path68)) {
23820
- return source[path68];
23818
+ function getPropertyByPath(source, path71) {
23819
+ if (typeof path71 === "string" && Object.prototype.hasOwnProperty.call(source, path71)) {
23820
+ return source[path71];
23821
23821
  }
23822
- const parsedPath = typeof path68 === "string" ? path68.split(".") : path68;
23822
+ const parsedPath = typeof path71 === "string" ? path71.split(".") : path71;
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(path68) {
23845
+ async function isDirectory(path71) {
23846
23846
  try {
23847
- const stat = await fs_1.promises.stat(path68);
23847
+ const stat = await fs_1.promises.stat(path71);
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(path68) {
23857
+ function isDirectorySync(path71) {
23858
23858
  try {
23859
- const stat = fs_1.default.statSync(path68);
23859
+ const stat = fs_1.default.statSync(path71);
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((path68, i10) => `${i10 + 1}. ${path68}`).join("\n")} (same as ${idx + 1}.)`);
23957
+ ${[...importStack, fullPath].map((path71, i10) => `${i10 + 1}. ${path71}`).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(path68) {
24145
+ async #fileExists(path71) {
24146
24146
  try {
24147
- await promises_1.default.stat(path68);
24147
+ await promises_1.default.stat(path71);
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(path68) {
24307
+ #fileExists(path71) {
24308
24308
  try {
24309
- fs_1.default.statSync(path68);
24309
+ fs_1.default.statSync(path71);
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((path68) => path68.replace("{name}", moduleName));
24433
+ const userConfiguredSearchPlaces = userConfiguredOptions.searchPlaces?.map((path71) => path71.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: path68, keys }) => `${path68.length === 0 ? "" : `${path68.map(String).join(".")}.`}${keys.join(", ")}`);
24563
+ const places = ignored.map(({ path: path71, keys }) => `${path71.length === 0 ? "" : `${path71.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: path68, values } of ignored) {
24585
+ for (const { path: path71, values } of ignored) {
24586
24586
  let holder = restored;
24587
- for (const step2 of path68) {
24587
+ for (const step2 of path71) {
24588
24588
  holder = isRecord(holder) ? holder[step2] : void 0;
24589
24589
  }
24590
24590
  if (isRecord(holder)) {
@@ -25363,8 +25363,8 @@ var init_statusline = __esm({
25363
25363
  init_zod();
25364
25364
  init_blank();
25365
25365
  init_graphemes();
25366
- STATUSLINE_HEADER_SEGMENTS = ["model", "provider", "route", "account", "identity", "headroom", "project", "vcs", "effort", "advisor", "version", "outputStyle"];
25367
- STATUSLINE_ROWS = ["context", "quota", "addedDirs", "gitFiles"];
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"];
25368
25368
  STATUSLINE_COLOUR_NAMES = [
25369
25369
  "default",
25370
25370
  "dim",
@@ -25455,6 +25455,12 @@ var init_statusline = __esm({
25455
25455
  hourCycle: external_exports.enum(STATUSLINE_HOUR_CYCLES).describe("The hour cycle of a wall-clock time: `auto` follows the system locale, `h23` and `h24` are 24-hour time (`h24` writes midnight as 24:00), and `h12` and `h11` are 12-hour time with am or pm (`h11` writes the hour after midnight as 0)."),
25456
25456
  seconds: external_exports.boolean().describe("Whether a wall-clock time includes seconds (`14:30:07`).")
25457
25457
  },
25458
+ cost: {
25459
+ routed: external_exports.boolean().describe("Whether the cost segments draw for a session routed through a provider or a cloud platform's model id, where the client's own figure is not what was billed; the figure drawn is then priced from the door's usage log with `agent-shim model price`, else the client's own when it is above zero.")
25460
+ },
25461
+ environment: {
25462
+ 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
+ },
25458
25464
  colours: {
25459
25465
  context: colourValue.describe("The colour of the context bar and its figures below the warning threshold."),
25460
25466
  usage: colourValue.describe("The colour of the quota bars and their figures below the warning threshold."),
@@ -25499,6 +25505,8 @@ var init_statusline = __esm({
25499
25505
  bar: external_exports.strictObject(SHAPES.bar).partial().optional(),
25500
25506
  usage: external_exports.strictObject(SHAPES.usage).partial().optional(),
25501
25507
  clock: external_exports.strictObject(SHAPES.clock).partial().optional(),
25508
+ cost: external_exports.strictObject(SHAPES.cost).partial().optional(),
25509
+ environment: external_exports.strictObject(SHAPES.environment).partial().optional(),
25502
25510
  colours: external_exports.strictObject(SHAPES.colours).partial().optional(),
25503
25511
  project: external_exports.strictObject(SHAPES.project).partial().optional(),
25504
25512
  git: external_exports.strictObject(SHAPES.git).partial().optional(),
@@ -25516,6 +25524,8 @@ var init_statusline = __esm({
25516
25524
  bar: external_exports.strictObject(SHAPES.bar),
25517
25525
  usage: external_exports.strictObject(SHAPES.usage),
25518
25526
  clock: external_exports.strictObject(SHAPES.clock),
25527
+ cost: external_exports.strictObject(SHAPES.cost),
25528
+ environment: external_exports.strictObject(SHAPES.environment),
25519
25529
  colours: external_exports.strictObject(SHAPES.colours),
25520
25530
  project: external_exports.strictObject(SHAPES.project),
25521
25531
  git: external_exports.strictObject(SHAPES.git),
@@ -25533,6 +25543,8 @@ var init_statusline = __esm({
25533
25543
  bar: { width: 10, filled: "\u2588", empty: "\u2591" },
25534
25544
  usage: { value: "used", bar: true, compact: false, resetLabel: false, modelScoped: false, timeFormat: "relative", threshold: 0, sevenDayThreshold: 0 },
25535
25545
  clock: { hourCycle: "auto", seconds: false },
25546
+ cost: { routed: false },
25547
+ environment: { threshold: 0 },
25536
25548
  colours: {
25537
25549
  context: "green",
25538
25550
  usage: "green",
@@ -30638,8 +30650,8 @@ var require_utils = __commonJS({
30638
30650
  }
30639
30651
  return output2;
30640
30652
  };
30641
- exports2.basename = (path68, { windows } = {}) => {
30642
- const segs = path68.split(windows ? /[\\/]/ : "/");
30653
+ exports2.basename = (path71, { windows } = {}) => {
30654
+ const segs = path71.split(windows ? /[\\/]/ : "/");
30643
30655
  const last = segs[segs.length - 1];
30644
30656
  if (last === "") {
30645
30657
  return segs[segs.length - 2];
@@ -30721,16 +30733,16 @@ var require_scan = __commonJS({
30721
30733
  let token = { value: "", depth: 0, isGlob: false };
30722
30734
  const eos = () => index >= length;
30723
30735
  const peek = () => str.charCodeAt(index + 1);
30724
- const advance = () => {
30736
+ const advance2 = () => {
30725
30737
  prev = code;
30726
30738
  return str.charCodeAt(++index);
30727
30739
  };
30728
30740
  while (index < length) {
30729
- code = advance();
30741
+ code = advance2();
30730
30742
  let next;
30731
30743
  if (code === CHAR_BACKWARD_SLASH) {
30732
30744
  backslashes = token.backslashes = true;
30733
- code = advance();
30745
+ code = advance2();
30734
30746
  if (code === CHAR_LEFT_CURLY_BRACE) {
30735
30747
  braceEscaped = true;
30736
30748
  }
@@ -30738,17 +30750,17 @@ var require_scan = __commonJS({
30738
30750
  }
30739
30751
  if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
30740
30752
  braces++;
30741
- while (eos() !== true && (code = advance())) {
30753
+ while (eos() !== true && (code = advance2())) {
30742
30754
  if (code === CHAR_BACKWARD_SLASH) {
30743
30755
  backslashes = token.backslashes = true;
30744
- advance();
30756
+ advance2();
30745
30757
  continue;
30746
30758
  }
30747
30759
  if (code === CHAR_LEFT_CURLY_BRACE) {
30748
30760
  braces++;
30749
30761
  continue;
30750
30762
  }
30751
- if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
30763
+ if (braceEscaped !== true && code === CHAR_DOT && (code = advance2()) === CHAR_DOT) {
30752
30764
  isBrace = token.isBrace = true;
30753
30765
  isGlob = token.isGlob = true;
30754
30766
  finished = true;
@@ -30804,10 +30816,10 @@ var require_scan = __commonJS({
30804
30816
  }
30805
30817
  if (scanToEnd === true) {
30806
30818
  let parens = 0;
30807
- while (eos() !== true && (code = advance())) {
30819
+ while (eos() !== true && (code = advance2())) {
30808
30820
  if (code === CHAR_BACKWARD_SLASH) {
30809
30821
  backslashes = token.backslashes = true;
30810
- advance();
30822
+ advance2();
30811
30823
  continue;
30812
30824
  }
30813
30825
  if (code === CHAR_LEFT_PARENTHESES) {
@@ -30842,10 +30854,10 @@ var require_scan = __commonJS({
30842
30854
  break;
30843
30855
  }
30844
30856
  if (code === CHAR_LEFT_SQUARE_BRACKET) {
30845
- while (eos() !== true && (next = advance())) {
30857
+ while (eos() !== true && (next = advance2())) {
30846
30858
  if (next === CHAR_BACKWARD_SLASH) {
30847
30859
  backslashes = token.backslashes = true;
30848
- advance();
30860
+ advance2();
30849
30861
  continue;
30850
30862
  }
30851
30863
  if (next === CHAR_RIGHT_SQUARE_BRACKET) {
@@ -30869,10 +30881,10 @@ var require_scan = __commonJS({
30869
30881
  isGlob = token.isGlob = true;
30870
30882
  if (scanToEnd === true) {
30871
30883
  let parens = 1;
30872
- while (eos() !== true && (code = advance())) {
30884
+ while (eos() !== true && (code = advance2())) {
30873
30885
  if (code === CHAR_BACKWARD_SLASH) {
30874
30886
  backslashes = token.backslashes = true;
30875
- advance();
30887
+ advance2();
30876
30888
  continue;
30877
30889
  }
30878
30890
  if (code === CHAR_LEFT_PARENTHESES) {
@@ -31308,7 +31320,7 @@ var require_parse = __commonJS({
31308
31320
  let value2;
31309
31321
  const eos = () => state.index === len - 1;
31310
31322
  const peek = state.peek = (n10 = 1) => input2[state.index + n10];
31311
- const advance = state.advance = () => input2[++state.index] || "";
31323
+ const advance2 = state.advance = () => input2[++state.index] || "";
31312
31324
  const remaining = () => input2.slice(state.index + 1);
31313
31325
  const consume = (value3 = "", num = 0) => {
31314
31326
  state.consumed += value3;
@@ -31321,7 +31333,7 @@ var require_parse = __commonJS({
31321
31333
  const negate = () => {
31322
31334
  let count = 1;
31323
31335
  while (peek() === "!" && (peek(2) !== "(" || peek(3) === "?")) {
31324
- advance();
31336
+ advance2();
31325
31337
  state.start++;
31326
31338
  count++;
31327
31339
  }
@@ -31375,7 +31387,7 @@ var require_parse = __commonJS({
31375
31387
  const output2 = (opts.capture ? "(" : "") + token.open;
31376
31388
  increment("parens");
31377
31389
  push({ type: type2, value: value3, output: state.output ? "" : ONE_CHAR });
31378
- push({ type: "paren", extglob: true, value: advance(), output: output2 });
31390
+ push({ type: "paren", extglob: true, value: advance2(), output: output2 });
31379
31391
  extglobs.push(token);
31380
31392
  };
31381
31393
  const extglobClose = (token) => {
@@ -31464,7 +31476,7 @@ var require_parse = __commonJS({
31464
31476
  return state;
31465
31477
  }
31466
31478
  while (!eos()) {
31467
- value2 = advance();
31479
+ value2 = advance2();
31468
31480
  if (value2 === "\0") {
31469
31481
  continue;
31470
31482
  }
@@ -31491,9 +31503,9 @@ var require_parse = __commonJS({
31491
31503
  }
31492
31504
  }
31493
31505
  if (opts.unescape === true) {
31494
- value2 = advance();
31506
+ value2 = advance2();
31495
31507
  } else {
31496
- value2 += advance();
31508
+ value2 += advance2();
31497
31509
  }
31498
31510
  if (state.brackets === 0) {
31499
31511
  push({ type: "text", value: value2 });
@@ -31513,7 +31525,7 @@ var require_parse = __commonJS({
31513
31525
  if (posix) {
31514
31526
  prev.value = pre2 + posix;
31515
31527
  state.backtrack = true;
31516
- advance();
31528
+ advance2();
31517
31529
  if (!bos.output && tokens.indexOf(prev) === 1) {
31518
31530
  bos.output = ONE_CHAR;
31519
31531
  }
@@ -31849,7 +31861,7 @@ var require_parse = __commonJS({
31849
31861
  prev.value += value2;
31850
31862
  state.output += prior.output + prev.output;
31851
31863
  state.globstar = true;
31852
- consume(value2 + advance());
31864
+ consume(value2 + advance2());
31853
31865
  push({ type: "slash", value: "/", output: "" });
31854
31866
  continue;
31855
31867
  }
@@ -31859,7 +31871,7 @@ var require_parse = __commonJS({
31859
31871
  prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
31860
31872
  state.output = prev.output;
31861
31873
  state.globstar = true;
31862
- consume(value2 + advance());
31874
+ consume(value2 + advance2());
31863
31875
  push({ type: "slash", value: "/", output: "" });
31864
31876
  continue;
31865
31877
  }
@@ -32404,9 +32416,9 @@ var init_identity = __esm({
32404
32416
  });
32405
32417
 
32406
32418
  // src/statusline/keys.ts
32407
- function valueAt(source, path68) {
32419
+ function valueAt(source, path71) {
32408
32420
  let current = source;
32409
- for (const part of path68) {
32421
+ for (const part of path71) {
32410
32422
  if (!isPlainObject2(current)) {
32411
32423
  return void 0;
32412
32424
  }
@@ -32414,8 +32426,8 @@ function valueAt(source, path68) {
32414
32426
  }
32415
32427
  return current;
32416
32428
  }
32417
- function keyOf(path68, leaf) {
32418
- const common = { path: path68.join("."), description: leaf.description ?? "", defaultValue: valueAt(STATUSLINE_DEFAULTS, path68) };
32429
+ function keyOf(path71, leaf) {
32430
+ const common = { path: path71.join("."), description: leaf.description ?? "", defaultValue: valueAt(STATUSLINE_DEFAULTS, path71) };
32419
32431
  if (leaf instanceof external_exports.ZodNumber) {
32420
32432
  return { ...common, kind: "integer", choices: [] };
32421
32433
  }
@@ -32434,7 +32446,7 @@ function keyOf(path68, leaf) {
32434
32446
  if (leaf instanceof external_exports.ZodArray && leaf.element instanceof external_exports.ZodEnum) {
32435
32447
  return { ...common, kind: "list", choices: Object.values(leaf.element.enum).map(String) };
32436
32448
  }
32437
- throw new TypeError(`statusline setting ${path68.join(".")} has a kind the key listing does not describe`);
32449
+ throw new TypeError(`statusline setting ${path71.join(".")} has a kind the key listing does not describe`);
32438
32450
  }
32439
32451
  function walk(shape, prefix) {
32440
32452
  return Object.entries(shape).flatMap(([name, schema]) => schema instanceof external_exports.ZodObject ? walk(schema.shape, [...prefix, name]) : [keyOf([...prefix, name], schema)]);
@@ -32458,10 +32470,10 @@ var init_keys = __esm({
32458
32470
  });
32459
32471
 
32460
32472
  // src/statusline/change.ts
32461
- function keyNamed(path68) {
32462
- const found = statuslineKeys().find((key) => key.path === path68);
32473
+ function keyNamed(path71) {
32474
+ const found = statuslineKeys().find((key) => key.path === path71);
32463
32475
  if (found === void 0) {
32464
- throw new UsageError(`"${path68}" is not a statusline setting; \`agent-shim statusline keys\` lists them.`);
32476
+ throw new UsageError(`"${path71}" is not a statusline setting; \`agent-shim statusline keys\` lists them.`);
32465
32477
  }
32466
32478
  return found;
32467
32479
  }
@@ -32470,35 +32482,35 @@ function parseStatuslineAssignment(text4) {
32470
32482
  if (split < 1) {
32471
32483
  throw new UsageError(`"${text4}" is not <setting>=<value>.`);
32472
32484
  }
32473
- const path68 = text4.slice(0, split);
32485
+ const path71 = text4.slice(0, split);
32474
32486
  const raw = text4.slice(split + 1);
32475
- const key = keyNamed(path68);
32487
+ const key = keyNamed(path71);
32476
32488
  switch (key.kind) {
32477
32489
  case "integer": {
32478
32490
  const number5 = Number(raw);
32479
32491
  if (raw.trim() === "" || !Number.isFinite(number5)) {
32480
- throw new UsageError(`${path68}: "${raw}" is not a number.`);
32492
+ throw new UsageError(`${path71}: "${raw}" is not a number.`);
32481
32493
  }
32482
- return { path: path68, value: number5 };
32494
+ return { path: path71, value: number5 };
32483
32495
  }
32484
32496
  case "boolean":
32485
32497
  if (raw !== "true" && raw !== "false") {
32486
- throw new UsageError(`${path68}: "${raw}" is not true or false.`);
32498
+ throw new UsageError(`${path71}: "${raw}" is not true or false.`);
32487
32499
  }
32488
- return { path: path68, value: raw === "true" };
32500
+ return { path: path71, value: raw === "true" };
32489
32501
  case "text":
32490
32502
  case "choice":
32491
- return { path: path68, value: raw };
32503
+ return { path: path71, value: raw };
32492
32504
  case "colour":
32493
- return { path: path68, value: /^\d+$/.test(raw) ? Number(raw) : raw };
32505
+ return { path: path71, value: /^\d+$/.test(raw) ? Number(raw) : raw };
32494
32506
  case "list":
32495
- return { path: path68, value: raw === "" ? [] : raw.split(",") };
32507
+ return { path: path71, value: raw === "" ? [] : raw.split(",") };
32496
32508
  default:
32497
32509
  return key.kind;
32498
32510
  }
32499
32511
  }
32500
- function setAt(target, path68, value2) {
32501
- const [head, ...rest] = path68;
32512
+ function setAt(target, path71, value2) {
32513
+ const [head, ...rest] = path71;
32502
32514
  if (head === void 0) {
32503
32515
  return;
32504
32516
  }
@@ -32511,8 +32523,8 @@ function setAt(target, path68, value2) {
32511
32523
  target[head] = next;
32512
32524
  setAt(next, rest, value2);
32513
32525
  }
32514
- function removeAt(target, path68) {
32515
- const [head, ...rest] = path68;
32526
+ function removeAt(target, path71) {
32527
+ const [head, ...rest] = path71;
32516
32528
  if (head === void 0) {
32517
32529
  return;
32518
32530
  }
@@ -32530,13 +32542,13 @@ function removeAt(target, path68) {
32530
32542
  }
32531
32543
  function applyStatuslineChange(existing, change) {
32532
32544
  const draft = structuredClone(existing ?? {});
32533
- for (const [path68, value2] of Object.entries(change.set ?? {})) {
32534
- keyNamed(path68);
32535
- setAt(draft, path68.split("."), value2);
32545
+ for (const [path71, value2] of Object.entries(change.set ?? {})) {
32546
+ keyNamed(path71);
32547
+ setAt(draft, path71.split("."), value2);
32536
32548
  }
32537
- for (const path68 of change.unset ?? []) {
32538
- keyNamed(path68);
32539
- removeAt(draft, path68.split("."));
32549
+ for (const path71 of change.unset ?? []) {
32550
+ keyNamed(path71);
32551
+ removeAt(draft, path71.split("."));
32540
32552
  }
32541
32553
  const result = StatuslineSchema.safeParse(draft);
32542
32554
  if (!result.success) {
@@ -34773,6 +34785,7 @@ function buildLayoutPaths(root) {
34773
34785
  usageDir: import_node_path20.default.join(root, "usage"),
34774
34786
  usageLogDir: import_node_path20.default.join(root, "usage", "log"),
34775
34787
  usageSnapshotsDir: import_node_path20.default.join(root, "usage", "snapshots"),
34788
+ statuslineDir: import_node_path20.default.join(root, "statusline"),
34776
34789
  catalogueDir: import_node_path20.default.join(root, "catalogues"),
34777
34790
  usagePicksFile: import_node_path20.default.join(root, "usage", "picks.json"),
34778
34791
  usageAnchorsFile: import_node_path20.default.join(root, "usage", "anchors.json"),
@@ -34843,7 +34856,7 @@ function isRateLimitHeader(name) {
34843
34856
  const lower = name.toLowerCase();
34844
34857
  return lower === "retry-after" || lower.startsWith("anthropic-ratelimit-") || lower.startsWith("x-ratelimit-") || lower.startsWith("ratelimit") || lower.startsWith("x-codex-");
34845
34858
  }
34846
- var USAGE_SCHEMA_VERSION, VersionSchema, InstantSchema, TokenCountSchema, TokenUsageSchema, LIMIT_KINDS, LimitClassificationSchema, UsageRecordSchema, QuotaWindowSchema, ExtraUsageSpendSchema, UnifiedRateLimitSchema, RateLimitStateSchema, LimitEventSchema, ProviderQuotaWindowSchema, ProviderAccountSchema, ProviderQuotaSchema, ProviderUsageStateSchema, AccountMetadataSchema, UsageSnapshotSchema;
34859
+ var USAGE_SCHEMA_VERSION, VersionSchema, InstantSchema, CLIENT_SESSION_ID_PATTERN, TokenCountSchema, TokenUsageSchema, LIMIT_KINDS, LimitClassificationSchema, UsageRecordSchema, QuotaWindowSchema, ExtraUsageSpendSchema, UnifiedRateLimitSchema, RateLimitStateSchema, LimitEventSchema, ProviderQuotaWindowSchema, ProviderAccountSchema, ProviderQuotaSchema, ProviderUsageStateSchema, AccountMetadataSchema, UsageSnapshotSchema;
34847
34860
  var init_schema2 = __esm({
34848
34861
  "src/usage/schema.ts"() {
34849
34862
  "use strict";
@@ -34851,6 +34864,7 @@ var init_schema2 = __esm({
34851
34864
  USAGE_SCHEMA_VERSION = 1;
34852
34865
  VersionSchema = external_exports.literal(USAGE_SCHEMA_VERSION);
34853
34866
  InstantSchema = external_exports.iso.datetime();
34867
+ CLIENT_SESSION_ID_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/;
34854
34868
  TokenCountSchema = external_exports.number().int().nonnegative();
34855
34869
  TokenUsageSchema = external_exports.strictObject({
34856
34870
  inputTokens: TokenCountSchema.optional(),
@@ -34880,6 +34894,8 @@ var init_schema2 = __esm({
34880
34894
  provider: external_exports.string(),
34881
34895
  /** The launch's session id, generated per launch. */
34882
34896
  sessionId: external_exports.string().optional(),
34897
+ /** The client's own id for the conversation, from the request's `x-claude-code-session-id` header: it changes when the conversation is cleared inside one launch, which `sessionId` does not, so it is what ties a request to the client's per-conversation figures. Absent when the client sent none. */
34898
+ clientSessionId: external_exports.string().regex(CLIENT_SESSION_ID_PATTERN).optional(),
34883
34899
  /** The project the launch ran in (its git repository root), when the launch sent one: headroom launches do. */
34884
34900
  project: external_exports.string().optional(),
34885
34901
  /** Whether the request crossed headroom on its way upstream. Absent on a record written before the door recorded it, and false when the request went direct. */
@@ -36009,11 +36025,11 @@ function identifyRequest(headers) {
36009
36025
  function directOrigin2(port) {
36010
36026
  return `http://127.0.0.1:${String(port)}`;
36011
36027
  }
36012
- function parseProviderPath(path68) {
36013
- if (!path68.startsWith(PROVIDER_PATH_PREFIX)) {
36028
+ function parseProviderPath(path71) {
36029
+ if (!path71.startsWith(PROVIDER_PATH_PREFIX)) {
36014
36030
  return void 0;
36015
36031
  }
36016
- const tail = path68.slice(PROVIDER_PATH_PREFIX.length);
36032
+ const tail = path71.slice(PROVIDER_PATH_PREFIX.length);
36017
36033
  const slash = tail.indexOf("/");
36018
36034
  if (slash <= 0) {
36019
36035
  return void 0;
@@ -36287,8 +36303,8 @@ function parseConnectTarget(authority) {
36287
36303
  }
36288
36304
  return { host, port };
36289
36305
  }
36290
- function servedByPipeline(path68) {
36291
- return path68?.startsWith(ROUTED_PATH_PREFIX) === true;
36306
+ function servedByPipeline(path71) {
36307
+ return path71?.startsWith(ROUTED_PATH_PREFIX) === true;
36292
36308
  }
36293
36309
  function forwardableHeaders(headers) {
36294
36310
  const connectionTokens = new Set(
@@ -36766,7 +36782,7 @@ var init_package = __esm({
36766
36782
  "package.json"() {
36767
36783
  package_default = {
36768
36784
  name: "claude-use",
36769
- version: "11.56.0",
36785
+ version: "11.57.0",
36770
36786
  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.",
36771
36787
  license: "MIT",
36772
36788
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -37289,12 +37305,12 @@ function decoderFor(encoding) {
37289
37305
  return void 0;
37290
37306
  }
37291
37307
  }
37292
- function destinationOf(path68, sessionProvider) {
37293
- const scoped = parseProviderPath(path68);
37308
+ function destinationOf(path71, sessionProvider) {
37309
+ const scoped = parseProviderPath(path71);
37294
37310
  if (scoped !== void 0) {
37295
37311
  return { provider: scoped.provider, endpoint: scoped.rest };
37296
37312
  }
37297
- return { provider: sessionProvider ?? ANTHROPIC_PROVIDER, endpoint: path68 };
37313
+ return { provider: sessionProvider ?? ANTHROPIC_PROVIDER, endpoint: path71 };
37298
37314
  }
37299
37315
  function modelChoiceOf(event, servedModel, provider) {
37300
37316
  if (event.modelChoice !== void 0) return event.modelChoice;
@@ -37315,6 +37331,7 @@ function buildRecord(event, context) {
37315
37331
  ...identity === void 0 ? {} : { identity },
37316
37332
  provider,
37317
37333
  ...sessionId === void 0 ? {} : { sessionId },
37334
+ ...event.clientSessionId === void 0 ? {} : { clientSessionId: event.clientSessionId },
37318
37335
  ...projectId === void 0 ? {} : { project: projectId },
37319
37336
  viaHeadroom: event.viaHeadroom,
37320
37337
  route: event.route,
@@ -40328,14 +40345,14 @@ var require_util2 = __commonJS({
40328
40345
  }
40329
40346
  const port = url2.port != null ? url2.port : url2.protocol === "https:" ? 443 : 80;
40330
40347
  let origin = url2.origin != null ? url2.origin : `${url2.protocol || ""}//${url2.hostname || ""}:${port}`;
40331
- let path68 = url2.path != null ? url2.path : `${url2.pathname || ""}${url2.search || ""}`;
40348
+ let path71 = url2.path != null ? url2.path : `${url2.pathname || ""}${url2.search || ""}`;
40332
40349
  if (origin[origin.length - 1] === "/") {
40333
40350
  origin = origin.slice(0, origin.length - 1);
40334
40351
  }
40335
- if (path68 && path68[0] !== "/") {
40336
- path68 = `/${path68}`;
40352
+ if (path71 && path71[0] !== "/") {
40353
+ path71 = `/${path71}`;
40337
40354
  }
40338
- return new URL(`${origin}${path68}`);
40355
+ return new URL(`${origin}${path71}`);
40339
40356
  }
40340
40357
  if (!isHttpOrHttpsPrefixed(url2.origin || url2.protocol)) {
40341
40358
  throw new InvalidArgumentError2("Invalid URL protocol: the URL must start with `http:` or `https:`.");
@@ -41156,9 +41173,9 @@ var require_diagnostics = __commonJS({
41156
41173
  "undici:client:sendHeaders",
41157
41174
  (evt) => {
41158
41175
  const {
41159
- request: { method, path: path68, origin }
41176
+ request: { method, path: path71, origin }
41160
41177
  } = evt;
41161
- debugLog("sending request to %s %s%s", method, origin, path68);
41178
+ debugLog("sending request to %s %s%s", method, origin, path71);
41162
41179
  }
41163
41180
  );
41164
41181
  }
@@ -41176,14 +41193,14 @@ var require_diagnostics = __commonJS({
41176
41193
  "undici:request:headers",
41177
41194
  (evt) => {
41178
41195
  const {
41179
- request: { method, path: path68, origin },
41196
+ request: { method, path: path71, origin },
41180
41197
  response: { statusCode }
41181
41198
  } = evt;
41182
41199
  debugLog(
41183
41200
  "received response to %s %s%s - HTTP %d",
41184
41201
  method,
41185
41202
  origin,
41186
- path68,
41203
+ path71,
41187
41204
  statusCode
41188
41205
  );
41189
41206
  }
@@ -41192,23 +41209,23 @@ var require_diagnostics = __commonJS({
41192
41209
  "undici:request:trailers",
41193
41210
  (evt) => {
41194
41211
  const {
41195
- request: { method, path: path68, origin }
41212
+ request: { method, path: path71, origin }
41196
41213
  } = evt;
41197
- debugLog("trailers received from %s %s%s", method, origin, path68);
41214
+ debugLog("trailers received from %s %s%s", method, origin, path71);
41198
41215
  }
41199
41216
  );
41200
41217
  diagnosticsChannel.subscribe(
41201
41218
  "undici:request:error",
41202
41219
  (evt) => {
41203
41220
  const {
41204
- request: { method, path: path68, origin },
41221
+ request: { method, path: path71, origin },
41205
41222
  error: error63
41206
41223
  } = evt;
41207
41224
  debugLog(
41208
41225
  "request to %s %s%s errored - %s",
41209
41226
  method,
41210
41227
  origin,
41211
- path68,
41228
+ path71,
41212
41229
  error63.message
41213
41230
  );
41214
41231
  }
@@ -41323,7 +41340,7 @@ var require_request = __commonJS({
41323
41340
  var kHandler = /* @__PURE__ */ Symbol("handler");
41324
41341
  var Request2 = class {
41325
41342
  constructor(origin, {
41326
- path: path68,
41343
+ path: path71,
41327
41344
  method,
41328
41345
  body,
41329
41346
  headers,
@@ -41340,11 +41357,11 @@ var require_request = __commonJS({
41340
41357
  maxRedirections,
41341
41358
  typeOfService
41342
41359
  }, handler) {
41343
- if (typeof path68 !== "string") {
41360
+ if (typeof path71 !== "string") {
41344
41361
  throw new InvalidArgumentError2("path must be a string");
41345
- } else if (path68[0] !== "/" && !(path68.startsWith("http://") || path68.startsWith("https://")) && method !== "CONNECT") {
41362
+ } else if (path71[0] !== "/" && !(path71.startsWith("http://") || path71.startsWith("https://")) && method !== "CONNECT") {
41346
41363
  throw new InvalidArgumentError2("path must be an absolute URL or start with a slash");
41347
- } else if (invalidPathRegex.test(path68)) {
41364
+ } else if (invalidPathRegex.test(path71)) {
41348
41365
  throw new InvalidArgumentError2("invalid request path");
41349
41366
  }
41350
41367
  if (typeof method !== "string") {
@@ -41419,7 +41436,7 @@ var require_request = __commonJS({
41419
41436
  this.completed = false;
41420
41437
  this.aborted = false;
41421
41438
  this.upgrade = upgrade || null;
41422
- this.path = query ? serializePathWithQuery(path68, query) : path68;
41439
+ this.path = query ? serializePathWithQuery(path71, query) : path71;
41423
41440
  this.origin = origin;
41424
41441
  this.protocol = getProtocolFromUrlString(origin);
41425
41442
  this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent;
@@ -46601,7 +46618,7 @@ var require_client_h1 = __commonJS({
46601
46618
  return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT";
46602
46619
  }
46603
46620
  function writeH1(client, request7) {
46604
- const { method, path: path68, host, upgrade, blocking, reset } = request7;
46621
+ const { method, path: path71, host, upgrade, blocking, reset } = request7;
46605
46622
  let { body, headers, contentLength } = request7;
46606
46623
  const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH";
46607
46624
  if (util2.isFormDataLike(body)) {
@@ -46679,7 +46696,7 @@ var require_client_h1 = __commonJS({
46679
46696
  if (socket.setTypeOfService) {
46680
46697
  socket.setTypeOfService(request7.typeOfService);
46681
46698
  }
46682
- let header = `${method} ${path68} HTTP/1.1\r
46699
+ let header = `${method} ${path71} HTTP/1.1\r
46683
46700
  `;
46684
46701
  if (typeof host === "string") {
46685
46702
  header += `host: ${host}\r
@@ -47358,7 +47375,7 @@ var require_client_h2 = __commonJS({
47358
47375
  const headersTimeout = request7.headersTimeout ?? client[kHeadersTimeout];
47359
47376
  const bodyTimeout = request7.bodyTimeout ?? client[kBodyTimeout];
47360
47377
  const session = client[kHTTP2Session];
47361
- const { method, path: path68, host, upgrade, expectContinue, signal, protocol, headers: reqHeaders } = request7;
47378
+ const { method, path: path71, host, upgrade, expectContinue, signal, protocol, headers: reqHeaders } = request7;
47362
47379
  let { body } = request7;
47363
47380
  if (upgrade != null && upgrade !== "websocket") {
47364
47381
  util2.errorRequest(client, request7, new InvalidArgumentError2(`Custom upgrade "${upgrade}" not supported over HTTP/2`));
@@ -47427,7 +47444,7 @@ var require_client_h2 = __commonJS({
47427
47444
  }
47428
47445
  headers[HTTP2_HEADER_METHOD] = "CONNECT";
47429
47446
  headers[HTTP2_HEADER_PROTOCOL] = "websocket";
47430
- headers[HTTP2_HEADER_PATH] = path68;
47447
+ headers[HTTP2_HEADER_PATH] = path71;
47431
47448
  if (protocol === "ws:" || protocol === "wss:") {
47432
47449
  headers[HTTP2_HEADER_SCHEME] = protocol === "ws:" ? "http" : "https";
47433
47450
  } else {
@@ -47469,7 +47486,7 @@ var require_client_h2 = __commonJS({
47469
47486
  stream.setTimeout(headersTimeout);
47470
47487
  return true;
47471
47488
  }
47472
- headers[HTTP2_HEADER_PATH] = path68;
47489
+ headers[HTTP2_HEADER_PATH] = path71;
47473
47490
  headers[HTTP2_HEADER_SCHEME] = protocol === "http:" ? "http" : "https";
47474
47491
  const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH";
47475
47492
  if (body && typeof body.read === "function") {
@@ -49821,10 +49838,10 @@ var require_proxy_agent = __commonJS({
49821
49838
  };
49822
49839
  const {
49823
49840
  origin,
49824
- path: path68 = "/",
49841
+ path: path71 = "/",
49825
49842
  headers = {}
49826
49843
  } = opts;
49827
- opts.path = origin + path68;
49844
+ opts.path = origin + path71;
49828
49845
  if (!("host" in headers) && !("Host" in headers)) {
49829
49846
  const { host } = new URL(origin);
49830
49847
  headers.host = host;
@@ -51933,20 +51950,20 @@ var require_mock_utils = __commonJS({
51933
51950
  }
51934
51951
  return normalizedQp;
51935
51952
  }
51936
- function safeUrl(path68) {
51937
- if (typeof path68 !== "string") {
51938
- return path68;
51953
+ function safeUrl(path71) {
51954
+ if (typeof path71 !== "string") {
51955
+ return path71;
51939
51956
  }
51940
- const pathSegments = path68.split("?", 3);
51957
+ const pathSegments = path71.split("?", 3);
51941
51958
  if (pathSegments.length !== 2) {
51942
- return path68;
51959
+ return path71;
51943
51960
  }
51944
51961
  const qp2 = new URLSearchParams(pathSegments.pop());
51945
51962
  qp2.sort();
51946
51963
  return [...pathSegments, qp2.toString()].join("?");
51947
51964
  }
51948
- function matchKey(mockDispatch2, { path: path68, method, body, headers }) {
51949
- const pathMatch = matchValue(mockDispatch2.path, path68);
51965
+ function matchKey(mockDispatch2, { path: path71, method, body, headers }) {
51966
+ const pathMatch = matchValue(mockDispatch2.path, path71);
51950
51967
  const methodMatch = matchValue(mockDispatch2.method, method);
51951
51968
  const bodyMatch = typeof mockDispatch2.body !== "undefined" ? matchValue(mockDispatch2.body, body) : true;
51952
51969
  const headersMatch = matchHeaders(mockDispatch2, headers);
@@ -51971,8 +51988,8 @@ var require_mock_utils = __commonJS({
51971
51988
  const basePath = key.query ? serializePathWithQuery(key.path, key.query) : key.path;
51972
51989
  const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath;
51973
51990
  const resolvedPathWithoutTrailingSlash = removeTrailingSlash(resolvedPath);
51974
- let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path68, ignoreTrailingSlash }) => {
51975
- return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(path68)), resolvedPathWithoutTrailingSlash) : matchValue(safeUrl(path68), resolvedPath);
51991
+ let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path71, ignoreTrailingSlash }) => {
51992
+ return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(path71)), resolvedPathWithoutTrailingSlash) : matchValue(safeUrl(path71), resolvedPath);
51976
51993
  });
51977
51994
  if (matchedMockDispatches.length === 0) {
51978
51995
  throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`);
@@ -52011,19 +52028,19 @@ var require_mock_utils = __commonJS({
52011
52028
  mockDispatches.splice(index, 1);
52012
52029
  }
52013
52030
  }
52014
- function removeTrailingSlash(path68) {
52015
- while (path68.endsWith("/")) {
52016
- path68 = path68.slice(0, -1);
52031
+ function removeTrailingSlash(path71) {
52032
+ while (path71.endsWith("/")) {
52033
+ path71 = path71.slice(0, -1);
52017
52034
  }
52018
- if (path68.length === 0) {
52019
- path68 = "/";
52035
+ if (path71.length === 0) {
52036
+ path71 = "/";
52020
52037
  }
52021
- return path68;
52038
+ return path71;
52022
52039
  }
52023
52040
  function buildKey(opts) {
52024
- const { path: path68, method, body, headers, query } = opts;
52041
+ const { path: path71, method, body, headers, query } = opts;
52025
52042
  return {
52026
- path: path68,
52043
+ path: path71,
52027
52044
  method,
52028
52045
  body,
52029
52046
  headers,
@@ -52713,10 +52730,10 @@ var require_pending_interceptors_formatter = __commonJS({
52713
52730
  }
52714
52731
  format(pendingInterceptors) {
52715
52732
  const withPrettyHeaders = pendingInterceptors.map(
52716
- ({ method, path: path68, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
52733
+ ({ method, path: path71, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
52717
52734
  Method: method,
52718
52735
  Origin: origin,
52719
- Path: path68,
52736
+ Path: path71,
52720
52737
  "Status code": statusCode,
52721
52738
  Persistent: persist ? PERSISTENT : NOT_PERSISTENT,
52722
52739
  Invocations: timesInvoked,
@@ -52798,9 +52815,9 @@ var require_mock_agent = __commonJS({
52798
52815
  const acceptNonStandardSearchParameters = this[kMockAgentAcceptsNonStandardSearchParameters];
52799
52816
  const dispatchOpts = { ...opts };
52800
52817
  if (acceptNonStandardSearchParameters && dispatchOpts.path) {
52801
- const [path68, searchParams] = dispatchOpts.path.split("?");
52818
+ const [path71, searchParams] = dispatchOpts.path.split("?");
52802
52819
  const normalizedSearchParams = normalizeSearchParams(searchParams, acceptNonStandardSearchParameters);
52803
- dispatchOpts.path = `${path68}?${normalizedSearchParams}`;
52820
+ dispatchOpts.path = `${path71}?${normalizedSearchParams}`;
52804
52821
  }
52805
52822
  return this[kAgent].dispatch(dispatchOpts, handler);
52806
52823
  }
@@ -53201,12 +53218,12 @@ var require_snapshot_recorder = __commonJS({
53201
53218
  * @return {Promise<void>} - Resolves when snapshots are loaded
53202
53219
  */
53203
53220
  async loadSnapshots(filePath) {
53204
- const path68 = filePath || this.#snapshotPath;
53205
- if (!path68) {
53221
+ const path71 = filePath || this.#snapshotPath;
53222
+ if (!path71) {
53206
53223
  throw new InvalidArgumentError2("Snapshot path is required");
53207
53224
  }
53208
53225
  try {
53209
- const data = await readFile(resolve2(path68), "utf8");
53226
+ const data = await readFile(resolve2(path71), "utf8");
53210
53227
  const parsed = JSON.parse(data);
53211
53228
  if (Array.isArray(parsed)) {
53212
53229
  this.#snapshots.clear();
@@ -53220,7 +53237,7 @@ var require_snapshot_recorder = __commonJS({
53220
53237
  if (error63.code === "ENOENT") {
53221
53238
  this.#snapshots.clear();
53222
53239
  } else {
53223
- throw new UndiciError(`Failed to load snapshots from ${path68}`, { cause: error63 });
53240
+ throw new UndiciError(`Failed to load snapshots from ${path71}`, { cause: error63 });
53224
53241
  }
53225
53242
  }
53226
53243
  }
@@ -53231,11 +53248,11 @@ var require_snapshot_recorder = __commonJS({
53231
53248
  * @returns {Promise<void>} - Resolves when snapshots are saved
53232
53249
  */
53233
53250
  async saveSnapshots(filePath) {
53234
- const path68 = filePath || this.#snapshotPath;
53235
- if (!path68) {
53251
+ const path71 = filePath || this.#snapshotPath;
53252
+ if (!path71) {
53236
53253
  throw new InvalidArgumentError2("Snapshot path is required");
53237
53254
  }
53238
- const resolvedPath = resolve2(path68);
53255
+ const resolvedPath = resolve2(path71);
53239
53256
  await mkdir(dirname3(resolvedPath), { recursive: true });
53240
53257
  const data = Array.from(this.#snapshots.entries()).map(([hash2, snapshot]) => ({
53241
53258
  hash: hash2,
@@ -53867,15 +53884,15 @@ var require_redirect_handler = __commonJS({
53867
53884
  return;
53868
53885
  }
53869
53886
  const { origin, pathname, search } = util2.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)));
53870
- const path68 = search ? `${pathname}${search}` : pathname;
53871
- const redirectUrlString = `${origin}${path68}`;
53887
+ const path71 = search ? `${pathname}${search}` : pathname;
53888
+ const redirectUrlString = `${origin}${path71}`;
53872
53889
  for (const historyUrl of this.history) {
53873
53890
  if (historyUrl.toString() === redirectUrlString) {
53874
53891
  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.`);
53875
53892
  }
53876
53893
  }
53877
53894
  this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin);
53878
- this.opts.path = path68;
53895
+ this.opts.path = path71;
53879
53896
  this.opts.origin = origin;
53880
53897
  this.opts.query = null;
53881
53898
  }
@@ -55635,10 +55652,10 @@ var require_cache_handler = __commonJS({
55635
55652
  }
55636
55653
  return locationUrl.pathname + locationUrl.search;
55637
55654
  }
55638
- function deleteCachedUri(store, cacheKey, path68) {
55655
+ function deleteCachedUri(store, cacheKey, path71) {
55639
55656
  deleteCachedValue(store, {
55640
55657
  ...cacheKey,
55641
- path: path68
55658
+ path: path71
55642
55659
  });
55643
55660
  for (let i10 = 0; i10 < util2.safeHTTPMethods.length; i10++) {
55644
55661
  const method = util2.safeHTTPMethods[i10];
@@ -55646,7 +55663,7 @@ var require_cache_handler = __commonJS({
55646
55663
  deleteCachedValue(store, {
55647
55664
  ...cacheKey,
55648
55665
  method,
55649
- path: path68
55666
+ path: path71
55650
55667
  });
55651
55668
  }
55652
55669
  }
@@ -55657,9 +55674,9 @@ var require_cache_handler = __commonJS({
55657
55674
  }
55658
55675
  const values = Array.isArray(headerValue2) ? headerValue2 : [headerValue2];
55659
55676
  for (let i10 = 0; i10 < values.length; i10++) {
55660
- const path68 = getSameOriginPath(cacheKey, values[i10]);
55661
- if (path68 !== void 0) {
55662
- deleteCachedUri(store, cacheKey, path68);
55677
+ const path71 = getSameOriginPath(cacheKey, values[i10]);
55678
+ if (path71 !== void 0) {
55679
+ deleteCachedUri(store, cacheKey, path71);
55663
55680
  }
55664
55681
  }
55665
55682
  }
@@ -60659,11 +60676,11 @@ var require_fetch = __commonJS({
60659
60676
  function dispatch({ body }) {
60660
60677
  const url2 = requestCurrentURL(request7);
60661
60678
  const agent = fetchParams.controller.dispatcher;
60662
- const path68 = url2.pathname + url2.search;
60679
+ const path71 = url2.pathname + url2.search;
60663
60680
  const hasTrailingQuestionMark = url2.search.length === 0 && url2.href[url2.href.length - url2.hash.length - 1] === "?";
60664
60681
  return new Promise((resolve2, reject) => agent.dispatch(
60665
60682
  {
60666
- path: hasTrailingQuestionMark ? `${path68}?` : path68,
60683
+ path: hasTrailingQuestionMark ? `${path71}?` : path71,
60667
60684
  origin: url2.origin,
60668
60685
  method: request7.method,
60669
60686
  body: agent.isMockActive ? request7.body && (request7.body.source || request7.body.stream) : body,
@@ -61610,9 +61627,9 @@ var require_util5 = __commonJS({
61610
61627
  }
61611
61628
  }
61612
61629
  }
61613
- function validateCookiePath(path68) {
61614
- for (let i10 = 0; i10 < path68.length; ++i10) {
61615
- const code = path68.charCodeAt(i10);
61630
+ function validateCookiePath(path71) {
61631
+ for (let i10 = 0; i10 < path71.length; ++i10) {
61632
+ const code = path71.charCodeAt(i10);
61616
61633
  if (code < 32 || // exclude CTLs (0-31)
61617
61634
  code > 126 || // exclude DEL and non-ascii
61618
61635
  code === 59) {
@@ -64960,11 +64977,11 @@ var require_undici = __commonJS({
64960
64977
  if (typeof opts.path !== "string") {
64961
64978
  throw new InvalidArgumentError2("invalid opts.path");
64962
64979
  }
64963
- let path68 = opts.path;
64980
+ let path71 = opts.path;
64964
64981
  if (!opts.path.startsWith("/")) {
64965
- path68 = `/${path68}`;
64982
+ path71 = `/${path71}`;
64966
64983
  }
64967
- url2 = new URL(util2.parseOrigin(url2).origin + path68);
64984
+ url2 = new URL(util2.parseOrigin(url2).origin + path71);
64968
64985
  } else {
64969
64986
  if (!opts) {
64970
64987
  opts = typeof url2 === "object" ? url2 : {};
@@ -65387,8 +65404,11 @@ setTimeout(() => { socket.destroy(); finish(failed, "no connection accepted with
65387
65404
  function declareThisProcessTheFrontDoor() {
65388
65405
  declaredPid = process.pid;
65389
65406
  }
65407
+ function isDeclaredFrontDoor(pid) {
65408
+ return declaredPid !== void 0 && pid === declaredPid && pid === process.pid;
65409
+ }
65390
65410
  function isFrontDoorSupervisorPid(pid, identify) {
65391
- return declaredPid !== void 0 && pid === declaredPid && pid === process.pid || identify(pid);
65411
+ return isDeclaredFrontDoor(pid) || identify(pid);
65392
65412
  }
65393
65413
  var declaredPid;
65394
65414
  var init_selfIdentity = __esm({
@@ -65439,7 +65459,8 @@ var init_trust = __esm({
65439
65459
  function realEnsurePorts(paths, spawnDaemon) {
65440
65460
  return {
65441
65461
  fs: realFarmFs,
65442
- isRunning: realIsProcessRunning,
65462
+ // The door plans launches of its own (the usage probe, the window opener, jobs), and asked whether the supervisor the state file names is running, the answer for itself is known: a synchronous `ps` here would hold the loop that answers every session.
65463
+ isRunning: (pid) => isDeclaredFrontDoor(pid) || realIsProcessRunning(pid),
65443
65464
  now: () => Date.now(),
65444
65465
  sleep: realSleepSync,
65445
65466
  spawnSupervisor: (layout) => spawnDaemon(layout, "__frontdoor-supervisor", layout.frontdoorLogPath),
@@ -66688,8 +66709,8 @@ function routingRows(facts) {
66688
66709
  ];
66689
66710
  }
66690
66711
  function farmRow(links, builtDirectories, adopted) {
66691
- const counted = (count, singular, plural2) => `${String(count)} ${count === 1 ? singular : plural2}`;
66692
- const parts = [counted(links, "link", "links"), counted(builtDirectories, "built directory", "built directories"), ...adopted === 0 ? [] : [`${String(adopted)} adopted`]];
66712
+ const counted2 = (count, singular, plural2) => `${String(count)} ${count === 1 ? singular : plural2}`;
66713
+ const parts = [counted2(links, "link", "links"), counted2(builtDirectories, "built directory", "built directories"), ...adopted === 0 ? [] : [`${String(adopted)} adopted`]];
66693
66714
  return { label: "farm", value: "resynced", detail: parts.join(", ") };
66694
66715
  }
66695
66716
  function noteRow(text4) {
@@ -106228,8 +106249,8 @@ var require_utils3 = __commonJS({
106228
106249
  }
106229
106250
  return ind;
106230
106251
  }
106231
- function removeDotSegments(path68) {
106232
- let input2 = path68;
106252
+ function removeDotSegments(path71) {
106253
+ let input2 = path71;
106233
106254
  const output2 = [];
106234
106255
  let nextSlash = -1;
106235
106256
  let len = 0;
@@ -106638,8 +106659,8 @@ var require_schemes = __commonJS({
106638
106659
  }
106639
106660
  if (wsComponent.resourceName) {
106640
106661
  const queryIndex = wsComponent.resourceName.indexOf("?");
106641
- const path68 = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
106642
- wsComponent.path = path68 && path68 !== "/" ? path68 : void 0;
106662
+ const path71 = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
106663
+ wsComponent.path = path71 && path71 !== "/" ? path71 : void 0;
106643
106664
  wsComponent.query = queryIndex === -1 ? void 0 : wsComponent.resourceName.slice(queryIndex + 1);
106644
106665
  wsComponent.resourceName = void 0;
106645
106666
  }
@@ -110166,7 +110187,7 @@ var require_dist2 = __commonJS({
110166
110187
  });
110167
110188
 
110168
110189
  // src/cli.ts
110169
- var import_node_path67 = __toESM(require("node:path"), 1);
110190
+ var import_node_path70 = __toESM(require("node:path"), 1);
110170
110191
 
110171
110192
  // node_modules/.pnpm/commander@15.0.0/node_modules/commander/lib/error.js
110172
110193
  var CommanderError = class extends Error {
@@ -113279,9 +113300,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
113279
113300
  * @param {string} [path]
113280
113301
  * @return {(string|null|Command)}
113281
113302
  */
113282
- executableDir(path68) {
113283
- if (path68 === void 0) return this._executableDir;
113284
- this._executableDir = path68;
113303
+ executableDir(path71) {
113304
+ if (path71 === void 0) return this._executableDir;
113305
+ this._executableDir = path71;
113285
113306
  return this;
113286
113307
  }
113287
113308
  /**
@@ -114757,19 +114778,19 @@ function writePools(paths, pools) {
114757
114778
  applyPatch(paths.globalConfigFile, GlobalConfigSchema, { pools }, { defaults: {} });
114758
114779
  }
114759
114780
  function poolCycleOf(pools, name) {
114760
- const walk3 = (current, path68) => {
114781
+ const walk3 = (current, path71) => {
114761
114782
  for (const entry of pools[current]?.identities ?? []) {
114762
114783
  const nested = poolNameOf(poolMemberIdentity(entry));
114763
114784
  if (nested === void 0) {
114764
114785
  continue;
114765
114786
  }
114766
114787
  if (nested === name) {
114767
- return [...path68, nested];
114788
+ return [...path71, nested];
114768
114789
  }
114769
- if (path68.includes(nested)) {
114790
+ if (path71.includes(nested)) {
114770
114791
  continue;
114771
114792
  }
114772
- const found = walk3(nested, [...path68, nested]);
114793
+ const found = walk3(nested, [...path71, nested]);
114773
114794
  if (found !== void 0) {
114774
114795
  return found;
114775
114796
  }
@@ -115970,7 +115991,7 @@ function statuslineChangeOf(options) {
115970
115991
  return void 0;
115971
115992
  }
115972
115993
  const assignments = (options.statusline ?? []).map(parseStatuslineAssignment);
115973
- return { set: Object.fromEntries(assignments.map(({ path: path68, value: value2 }) => [path68, value2])), unset: options.unsetStatusline ?? [] };
115994
+ return { set: Object.fromEntries(assignments.map(({ path: path71, value: value2 }) => [path71, value2])), unset: options.unsetStatusline ?? [] };
115974
115995
  }
115975
115996
  function registerProfileCommand(program2, deps) {
115976
115997
  const { paths } = deps;
@@ -119637,11 +119658,11 @@ function createRcSessionTracker(deps) {
119637
119658
  };
119638
119659
  const observeExchange = (request7) => {
119639
119660
  const method = (request7.method ?? "").toUpperCase();
119640
- const path68 = new URL(request7.url ?? "/", "http://127.0.0.1").pathname;
119641
- if (!path68.startsWith(RC_SESSIONS_PATH_PREFIX)) {
119661
+ const path71 = new URL(request7.url ?? "/", "http://127.0.0.1").pathname;
119662
+ if (!path71.startsWith(RC_SESSIONS_PATH_PREFIX)) {
119642
119663
  return void 0;
119643
119664
  }
119644
- const tail = path68.slice(RC_SESSIONS_PATH_PREFIX.length);
119665
+ const tail = path71.slice(RC_SESSIONS_PATH_PREFIX.length);
119645
119666
  const facts = {
119646
119667
  oauthAuthorization: oauthAuthorizationOf(request7.headers),
119647
119668
  anthropicVersion: singleHeader(request7.headers, "anthropic-version"),
@@ -120010,8 +120031,8 @@ var RC_READ_FILE_ENCODINGS = ["utf-8", "base64"];
120010
120031
  function isRcReadFileEncoding(value2) {
120011
120032
  return RC_READ_FILE_ENCODINGS.some((encoding) => encoding === value2);
120012
120033
  }
120013
- function buildRcReadFilePayload(requestId, path68, options) {
120014
- return buildRcControlRequestPayload(requestId, { subtype: "read_file", path: path68, ...options?.maxBytes === void 0 ? {} : { max_bytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } });
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 } });
120015
120036
  }
120016
120037
  function buildRcFileSuggestionsPayload(requestId, query) {
120017
120038
  return buildRcControlRequestPayload(requestId, { subtype: "file_suggestions", query });
@@ -120113,15 +120134,15 @@ async function getRcSessionContextUsage(deps, sessionId, detail) {
120113
120134
  const result = await deliverRcClientPayload(deps, sessionId, buildRcGetContextUsagePayload(requestId, detail), `request the context usage of session ${sessionId}`);
120114
120135
  return result.ok ? { ...result, requestId } : result;
120115
120136
  }
120116
- async function readRcSessionFile(deps, sessionId, path68, options) {
120117
- if (path68 === "") {
120137
+ async function readRcSessionFile(deps, sessionId, path71, options) {
120138
+ if (path71 === "") {
120118
120139
  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" };
120119
120140
  }
120120
120141
  if (options?.maxBytes !== void 0 && (!Number.isInteger(options.maxBytes) || options.maxBytes <= 0)) {
120121
120142
  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" };
120122
120143
  }
120123
120144
  const requestId = deps.newUuid();
120124
- const result = await deliverRcClientPayload(deps, sessionId, buildRcReadFilePayload(requestId, path68, options), `read ${path68} from session ${sessionId}`);
120145
+ const result = await deliverRcClientPayload(deps, sessionId, buildRcReadFilePayload(requestId, path71, options), `read ${path71} from session ${sessionId}`);
120125
120146
  return result.ok ? { ...result, requestId } : result;
120126
120147
  }
120127
120148
  async function suggestRcSessionFiles(deps, sessionId, query) {
@@ -120292,11 +120313,11 @@ function createRcControlHandler(deps) {
120292
120313
  path: "read-file",
120293
120314
  read: (body) => {
120294
120315
  const session = bodyString(body, "session");
120295
- const path68 = bodyString(body, "path");
120316
+ const path71 = bodyString(body, "path");
120296
120317
  const maxBytes = "maxBytes" in body ? bodyPositiveInteger(body, "maxBytes") : void 0;
120297
120318
  const encoding = "encoding" in body && isRcReadFileEncoding(body.encoding) ? body.encoding : void 0;
120298
- const refused2 = session === void 0 || path68 === void 0 || "maxBytes" in body && maxBytes === void 0 || "encoding" in body && encoding === void 0;
120299
- 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, path68, { ...maxBytes === void 0 ? {} : { maxBytes }, ...encoding === void 0 ? {} : { encoding } }) };
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 } }) };
120300
120321
  }
120301
120322
  },
120302
120323
  {
@@ -120606,9 +120627,9 @@ function requestIdOfBody(body) {
120606
120627
  }
120607
120628
  function frontDoorRcControl(transport, token) {
120608
120629
  const headers = { authorization: `Bearer ${token}` };
120609
- const listAnswerOf = async (path68, what) => {
120630
+ const listAnswerOf = async (path71, what) => {
120610
120631
  try {
120611
- return await transport.request({ method: "GET", path: path68, headers });
120632
+ return await transport.request({ method: "GET", path: path71, headers });
120612
120633
  } catch (error63) {
120613
120634
  throw new Error(`${what}: could not reach the front door's control listener: ${error63 instanceof Error ? error63.message : String(error63)}`, { cause: error63 });
120614
120635
  }
@@ -120680,10 +120701,10 @@ function frontDoorRcControl(transport, token) {
120680
120701
  }
120681
120702
  return pending;
120682
120703
  };
120683
- const writeOf = async (path68, body, describeFailure2) => {
120704
+ const writeOf = async (path71, body, describeFailure2) => {
120684
120705
  let answer;
120685
120706
  try {
120686
- answer = await transport.request({ method: "POST", path: path68, headers: { ...headers, "content-type": "application/json" }, body });
120707
+ answer = await transport.request({ method: "POST", path: path71, headers: { ...headers, "content-type": "application/json" }, body });
120687
120708
  } catch (error63) {
120688
120709
  return { ok: false, message: `could not reach the front door's control listener: ${error63 instanceof Error ? error63.message : String(error63)}` };
120689
120710
  }
@@ -120714,10 +120735,10 @@ function frontDoorRcControl(transport, token) {
120714
120735
  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}`),
120715
120736
  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}`),
120716
120737
  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}`),
120717
- readFile: async (sessionId, path68, options) => await writeOf(
120738
+ readFile: async (sessionId, path71, options) => await writeOf(
120718
120739
  `${CONTROL_PATH_PREFIX}/read-file`,
120719
- JSON.stringify({ session: sessionId, path: path68, ...options?.maxBytes === void 0 ? {} : { maxBytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } }),
120720
- (status, message) => `reading ${path68} from ${sessionId} failed (HTTP ${String(status)}): ${message}`
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}`
120721
120742
  ),
120722
120743
  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}`),
120723
120744
  keepAlive: async (sessionId) => await writeOf(`${CONTROL_PATH_PREFIX}/keep-alive`, JSON.stringify({ session: sessionId }), (status, message) => `keeping ${sessionId} alive failed (HTTP ${String(status)}): ${message}`),
@@ -121030,12 +121051,12 @@ function tlsFacts(options) {
121030
121051
  }
121031
121052
  function realRcEventDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_PORT }) {
121032
121053
  const agent = new ExemptTlsAgent();
121033
- const post = async (path68, headers, body) => await new Promise((resolve2, reject) => {
121054
+ const post = async (path71, headers, body) => await new Promise((resolve2, reject) => {
121034
121055
  const options = {
121035
121056
  host: target.host,
121036
121057
  port: target.port,
121037
121058
  method: "POST",
121038
- path: path68,
121059
+ path: path71,
121039
121060
  // 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.
121040
121061
  headers: { ...headers, host: target.servername ?? target.host, "content-length": String(Buffer.byteLength(body, "utf8")) },
121041
121062
  agent
@@ -121100,12 +121121,12 @@ function lateRcStreamDial(resolve2) {
121100
121121
  }
121101
121122
  function realRcStreamDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_PORT }) {
121102
121123
  const agent = new ExemptTlsAgent();
121103
- const request7 = async (method, path68, headers, body, signal) => await new Promise((resolve2, reject) => {
121124
+ const request7 = async (method, path71, headers, body, signal) => await new Promise((resolve2, reject) => {
121104
121125
  const options = {
121105
121126
  host: target.host,
121106
121127
  port: target.port,
121107
121128
  method,
121108
- path: path68,
121129
+ path: path71,
121109
121130
  // 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.
121110
121131
  headers: { ...headers, host: target.servername ?? target.host, ...body === void 0 ? {} : { "content-length": String(Buffer.byteLength(body, "utf8")) } },
121111
121132
  agent,
@@ -121147,9 +121168,9 @@ function realRcStreamDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_P
121147
121168
  return { status, body: await readAll(response) };
121148
121169
  },
121149
121170
  openStream: async (sessionId, headers, resume, signal) => {
121150
- const path68 = resume === void 0 ? `/v1/code/sessions/${encodeURIComponent(sessionId)}/events/stream` : `/v1/code/sessions/${encodeURIComponent(sessionId)}/events/stream?from_sequence_num=${String(resume.fromSequenceNum)}`;
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)}`;
121151
121172
  const streamHeaders = resume === void 0 ? headers : { ...headers, "last-event-id": String(resume.fromSequenceNum) };
121152
- const { status, response } = await request7("GET", path68, streamHeaders, void 0, signal);
121173
+ const { status, response } = await request7("GET", path71, streamHeaders, void 0, signal);
121153
121174
  if (!isSuccessful2(status)) {
121154
121175
  await readAll(response);
121155
121176
  return { status, chunks: NO_CHUNKS };
@@ -122550,11 +122571,11 @@ function tryOrUndefined(fn2) {
122550
122571
  return void 0;
122551
122572
  }
122552
122573
  }
122553
- function pathToHttpPath(path68) {
122554
- return `/${path68.map(safeEncodeURIComponent).join("/")}`;
122574
+ function pathToHttpPath(path71) {
122575
+ return `/${path71.map(safeEncodeURIComponent).join("/")}`;
122555
122576
  }
122556
- function normalizeHttpPath(path68) {
122557
- const paths = path68.split("/");
122577
+ function normalizeHttpPath(path71) {
122578
+ const paths = path71.split("/");
122558
122579
  if (paths.at(0) === "") {
122559
122580
  paths.shift();
122560
122581
  }
@@ -122739,9 +122760,9 @@ function isPlainObject3(value2) {
122739
122760
  function getOwn(object3, key) {
122740
122761
  return Object.hasOwn(object3, key) ? object3[key] : void 0;
122741
122762
  }
122742
- function get(object3, path68) {
122763
+ function get(object3, path71) {
122743
122764
  let current = object3;
122744
- for (const key of path68) {
122765
+ for (const key of path71) {
122745
122766
  if (!isTypescriptObject(current)) {
122746
122767
  return void 0;
122747
122768
  }
@@ -123964,7 +123985,7 @@ function resolveClientRest(rest) {
123964
123985
  // rest[1] can be undefined if all fields of FriendlyClientOptions are optional
123965
123986
  ];
123966
123987
  }
123967
- function createORPCClient(link, { path: path68 = [], ...options } = {}) {
123988
+ function createORPCClient(link, { path: path71 = [], ...options } = {}) {
123968
123989
  const procedureClient = (...rest) => {
123969
123990
  const [input2, callOptions] = resolveClientRest(rest);
123970
123991
  const interceptors = [
@@ -123973,7 +123994,7 @@ function createORPCClient(link, { path: path68 = [], ...options } = {}) {
123973
123994
  ];
123974
123995
  return intercept(
123975
123996
  interceptors,
123976
- { ...callOptions, input: input2, path: path68 },
123997
+ { ...callOptions, input: input2, path: path71 },
123977
123998
  ({ path: path210, input: input22, ...callOptions2 }) => link.call(path210, input22, callOptions2)
123978
123999
  );
123979
124000
  };
@@ -123987,7 +124008,7 @@ function createORPCClient(link, { path: path68 = [], ...options } = {}) {
123987
124008
  if (client === void 0) {
123988
124009
  client = createORPCClient(link, {
123989
124010
  ...options,
123990
- path: [...path68, key],
124011
+ path: [...path71, key],
123991
124012
  scoped: options.scoped?.[key]
123992
124013
  });
123993
124014
  cache.set(key, client);
@@ -124009,24 +124030,24 @@ var BracketNotationSerializer = class {
124009
124030
  this.internalSerialize(data, "", true, result);
124010
124031
  return result;
124011
124032
  }
124012
- internalSerialize(data, path68, isRoot, result) {
124033
+ internalSerialize(data, path71, isRoot, result) {
124013
124034
  if (Array.isArray(data)) {
124014
124035
  data.forEach((item, i10) => {
124015
- this.internalSerialize(item, isRoot ? i10.toString() : `${path68}[${i10}]`, false, result);
124036
+ this.internalSerialize(item, isRoot ? i10.toString() : `${path71}[${i10}]`, false, result);
124016
124037
  });
124017
124038
  } else if (isPlainObject3(data)) {
124018
124039
  for (const key of Object.keys(data)) {
124019
- this.internalSerialize(data[key], isRoot ? key : `${path68}[${key}]`, false, result);
124040
+ this.internalSerialize(data[key], isRoot ? key : `${path71}[${key}]`, false, result);
124020
124041
  }
124021
124042
  } else {
124022
- result.push([path68, data]);
124043
+ result.push([path71, data]);
124023
124044
  }
124024
124045
  }
124025
124046
  deserialize(serialized) {
124026
124047
  const arrayPushStyles = /* @__PURE__ */ new WeakSet();
124027
124048
  const root = new NullProtoObj();
124028
- for (const [path68, value2] of serialized) {
124029
- const segments = this.parsePath(path68);
124049
+ for (const [path71, value2] of serialized) {
124050
+ const segments = this.parsePath(path71);
124030
124051
  let currentRef = root;
124031
124052
  let nextSegment = segments[0];
124032
124053
  for (let i10 = 1; i10 < segments.length; i10++) {
@@ -124077,13 +124098,13 @@ var BracketNotationSerializer = class {
124077
124098
  }
124078
124099
  return result;
124079
124100
  }
124080
- parsePath(path68) {
124101
+ parsePath(path71) {
124081
124102
  const segments = [];
124082
124103
  let inBrackets = false;
124083
124104
  let currentSegment = "";
124084
- for (let i10 = 0; i10 < path68.length; i10++) {
124085
- const char = path68[i10];
124086
- const nextChar = path68[i10 + 1];
124105
+ for (let i10 = 0; i10 < path71.length; i10++) {
124106
+ const char = path71[i10];
124107
+ const nextChar = path71[i10 + 1];
124087
124108
  if (inBrackets && char === "]" && (nextChar === void 0 || nextChar === "[")) {
124088
124109
  if (nextChar === void 0) {
124089
124110
  inBrackets = false;
@@ -124099,7 +124120,7 @@ var BracketNotationSerializer = class {
124099
124120
  currentSegment += char;
124100
124121
  }
124101
124122
  }
124102
- return inBrackets || segments.length === 0 ? [path68] : segments;
124123
+ return inBrackets || segments.length === 0 ? [path71] : segments;
124103
124124
  }
124104
124125
  };
124105
124126
  var INTEGER_PATTERN = /^0$|^[1-9]\d*$/;
@@ -124672,11 +124693,11 @@ var OpenAPISerializer = class {
124672
124693
  return json2;
124673
124694
  }
124674
124695
  const form = new FormData();
124675
- for (const [path68, value22] of this.bracketNotation.serialize(json2)) {
124696
+ for (const [path71, value22] of this.bracketNotation.serialize(json2)) {
124676
124697
  if (value22 instanceof Blob) {
124677
- form.append(path68, value22);
124698
+ form.append(path71, value22);
124678
124699
  } else if (value22 !== void 0 && value22 !== null) {
124679
- form.append(path68, String(value22));
124700
+ form.append(path71, String(value22));
124680
124701
  }
124681
124702
  }
124682
124703
  return form;
@@ -124714,30 +124735,30 @@ function isBodylessMethod(method) {
124714
124735
  return method === "GET" || method === "HEAD";
124715
124736
  }
124716
124737
  var PARAMETER_NAME_REGEX = /^[\w-]+$/;
124717
- function getDynamicPathParams(path68) {
124718
- if (!path68.includes("{")) {
124738
+ function getDynamicPathParams(path71) {
124739
+ if (!path71.includes("{")) {
124719
124740
  return void 0;
124720
124741
  }
124721
- const len = path68.length;
124742
+ const len = path71.length;
124722
124743
  let params;
124723
124744
  let index = 1;
124724
124745
  while (index < len) {
124725
124746
  const segmentStart = index;
124726
- const slashPos = path68.indexOf("/", index);
124747
+ const slashPos = path71.indexOf("/", index);
124727
124748
  const segmentEnd = slashPos === -1 ? len : slashPos;
124728
- if (segmentEnd > segmentStart && path68.charCodeAt(segmentStart) === 123 && path68.charCodeAt(segmentEnd - 1) === 125) {
124749
+ if (segmentEnd > segmentStart && path71.charCodeAt(segmentStart) === 123 && path71.charCodeAt(segmentEnd - 1) === 125) {
124729
124750
  let parameterStart = segmentStart + 1;
124730
124751
  let allowsSlash = false;
124731
- const operator = path68.charCodeAt(parameterStart);
124752
+ const operator = path71.charCodeAt(parameterStart);
124732
124753
  if (operator === 43) {
124733
124754
  allowsSlash = true;
124734
124755
  parameterStart++;
124735
124756
  }
124736
- const parameterName = path68.slice(parameterStart, segmentEnd - 1);
124757
+ const parameterName = path71.slice(parameterStart, segmentEnd - 1);
124737
124758
  if (PARAMETER_NAME_REGEX.test(parameterName)) {
124738
124759
  params ??= [];
124739
124760
  params.push({
124740
- segment: path68.slice(segmentStart, segmentEnd),
124761
+ segment: path71.slice(segmentStart, segmentEnd),
124741
124762
  startIndex: segmentStart,
124742
124763
  parameterName,
124743
124764
  allowsSlash
@@ -124780,8 +124801,8 @@ openapi.method = (method) => ({
124780
124801
  ...openapi({ method }),
124781
124802
  name: "~openapi/method"
124782
124803
  });
124783
- openapi.path = (path68) => ({
124784
- ...openapi({ path: path68 }),
124804
+ openapi.path = (path71) => ({
124805
+ ...openapi({ path: path71 }),
124785
124806
  name: "~openapi/path"
124786
124807
  });
124787
124808
  openapi.spec = (spec) => ({
@@ -125642,22 +125663,22 @@ function visitJsonSchemaRefs(value2, visit2, schemaLevel = true, seen = /* @__PU
125642
125663
  }
125643
125664
  }
125644
125665
  }
125645
- function mapJsonSchemaRefs(value2, map2, schemaLevel = true, path68 = []) {
125666
+ function mapJsonSchemaRefs(value2, map2, schemaLevel = true, path71 = []) {
125646
125667
  if (!value2 || typeof value2 !== "object") {
125647
125668
  return value2;
125648
125669
  }
125649
125670
  if (Array.isArray(value2)) {
125650
- return value2.map((item, index) => mapJsonSchemaRefs(item, map2, schemaLevel, [...path68, index]));
125671
+ return value2.map((item, index) => mapJsonSchemaRefs(item, map2, schemaLevel, [...path71, index]));
125651
125672
  }
125652
125673
  const result = {};
125653
125674
  for (const key of Object.keys(value2)) {
125654
125675
  const val = value2[key];
125655
125676
  if (key === "$ref" && typeof val === "string") {
125656
- setOwn(result, key, map2(val, [...path68, key]));
125677
+ setOwn(result, key, map2(val, [...path71, key]));
125657
125678
  } else if (!schemaLevel) {
125658
- setOwn(result, key, mapJsonSchemaRefs(val, map2, true, [...path68, key]));
125679
+ setOwn(result, key, mapJsonSchemaRefs(val, map2, true, [...path71, key]));
125659
125680
  } else if (JSON_SCHEMA_LOGIC_KEYWORDS.has(key) || JSON_SCHEMA_RECORD_KEYWORDS.has(key)) {
125660
- setOwn(result, key, mapJsonSchemaRefs(val, map2, !JSON_SCHEMA_RECORD_KEYWORDS.has(key), [...path68, key]));
125681
+ setOwn(result, key, mapJsonSchemaRefs(val, map2, !JSON_SCHEMA_RECORD_KEYWORDS.has(key), [...path71, key]));
125661
125682
  } else {
125662
125683
  setOwn(result, key, val);
125663
125684
  }
@@ -126187,7 +126208,7 @@ function unlazy(maybeLazy) {
126187
126208
  function createProcedureClient(lazyableProcedure, ...rest) {
126188
126209
  const options = resolveMaybeOptionalOptions(rest);
126189
126210
  return async (...[input2, callerOptions]) => {
126190
- const path68 = toArray(options.path);
126211
+ const path71 = toArray(options.path);
126191
126212
  const { default: procedure } = await unlazy(lazyableProcedure);
126192
126213
  const clientContext = callerOptions?.context ?? {};
126193
126214
  const context = await value(options.context, clientContext) ?? {};
@@ -126200,7 +126221,7 @@ function createProcedureClient(lazyableProcedure, ...rest) {
126200
126221
  };
126201
126222
  try {
126202
126223
  const output2 = await runWithSpan("call_procedure", (span) => {
126203
- span?.setAttribute("procedure.path", path68);
126224
+ span?.setAttribute("procedure.path", path71);
126204
126225
  return intercept(
126205
126226
  options.interceptors,
126206
126227
  {
@@ -126208,7 +126229,7 @@ function createProcedureClient(lazyableProcedure, ...rest) {
126208
126229
  // input can be optional if it is undefinable
126209
126230
  input: input2,
126210
126231
  errors,
126211
- path: path68,
126232
+ path: path71,
126212
126233
  procedure,
126213
126234
  signal: callerOptions?.signal,
126214
126235
  lastEventId: callerOptions?.lastEventId
@@ -126459,10 +126480,10 @@ function augmentRouter(router, options) {
126459
126480
  }
126460
126481
  return enhanced;
126461
126482
  }
126462
- function getRouter(router, path68) {
126483
+ function getRouter(router, path71) {
126463
126484
  let current = router;
126464
- for (let i10 = 0; i10 < path68.length; i10++) {
126465
- const segment = path68[i10];
126485
+ for (let i10 = 0; i10 < path71.length; i10++) {
126486
+ const segment = path71[i10];
126466
126487
  if (!isTypescriptObject(current)) {
126467
126488
  return void 0;
126468
126489
  }
@@ -126474,7 +126495,7 @@ function getRouter(router, path68) {
126474
126495
  continue;
126475
126496
  }
126476
126497
  const lazied = current;
126477
- const rest = path68.slice(i10);
126498
+ const rest = path71.slice(i10);
126478
126499
  return new Lazy({
126479
126500
  ...lazied["~orpc"],
126480
126501
  async loader() {
@@ -126489,40 +126510,40 @@ function getRouter(router, path68) {
126489
126510
  }
126490
126511
  return current;
126491
126512
  }
126492
- function walkProcedureContractsSync(router, callback, path68 = []) {
126513
+ function walkProcedureContractsSync(router, callback, path71 = []) {
126493
126514
  const lazyResults = [];
126494
- walkProcedureContractsSyncInternal(router, callback, path68.slice(), lazyResults);
126515
+ walkProcedureContractsSyncInternal(router, callback, path71.slice(), lazyResults);
126495
126516
  return lazyResults;
126496
126517
  }
126497
- function walkProcedureContractsSyncInternal(router, callback, path68, lazyResults) {
126518
+ function walkProcedureContractsSyncInternal(router, callback, path71, lazyResults) {
126498
126519
  const hiddenContract = getHiddenRouterContract(router);
126499
126520
  if (hiddenContract !== void 0) {
126500
126521
  router = hiddenContract;
126501
126522
  }
126502
126523
  if (router instanceof ProcedureContract) {
126503
- callback(router, path68.slice());
126524
+ callback(router, path71.slice());
126504
126525
  return;
126505
126526
  }
126506
126527
  if (!isTypescriptObject(router)) {
126507
126528
  return;
126508
126529
  }
126509
126530
  for (const [key, value2] of Object.entries(router)) {
126510
- path68.push(key);
126531
+ path71.push(key);
126511
126532
  if (value2 instanceof Lazy) {
126512
- lazyResults.push({ router: value2, path: path68.slice() });
126533
+ lazyResults.push({ router: value2, path: path71.slice() });
126513
126534
  } else {
126514
- walkProcedureContractsSyncInternal(value2, callback, path68, lazyResults);
126535
+ walkProcedureContractsSyncInternal(value2, callback, path71, lazyResults);
126515
126536
  }
126516
- path68.pop();
126537
+ path71.pop();
126517
126538
  }
126518
126539
  }
126519
- async function walkProcedureContractsAsync(router, callback, path68 = []) {
126540
+ async function walkProcedureContractsAsync(router, callback, path71 = []) {
126520
126541
  const hiddenContract = getHiddenRouterContract(router);
126521
126542
  if (hiddenContract !== void 0) {
126522
126543
  router = hiddenContract;
126523
126544
  }
126524
126545
  if (router instanceof ProcedureContract) {
126525
- await callback(router, path68);
126546
+ await callback(router, path71);
126526
126547
  return;
126527
126548
  }
126528
126549
  if (!isTypescriptObject(router)) {
@@ -126531,9 +126552,9 @@ async function walkProcedureContractsAsync(router, callback, path68 = []) {
126531
126552
  for (const [key, value2] of Object.entries(router)) {
126532
126553
  if (value2 instanceof Lazy) {
126533
126554
  const { default: router2 } = await unlazy(value2);
126534
- await walkProcedureContractsAsync(router2, callback, [...path68, key]);
126555
+ await walkProcedureContractsAsync(router2, callback, [...path71, key]);
126535
126556
  } else {
126536
- await walkProcedureContractsAsync(value2, callback, [...path68, key]);
126557
+ await walkProcedureContractsAsync(value2, callback, [...path71, key]);
126537
126558
  }
126538
126559
  }
126539
126560
  }
@@ -127019,18 +127040,18 @@ function rewriteComponentSchemaRefs(schema, renameMap) {
127019
127040
  }
127020
127041
  var OpenAPIGeneratorError = class extends TypeError {
127021
127042
  };
127022
- function toOpenAPIPath(path68, dynamicPathParams) {
127043
+ function toOpenAPIPath(path71, dynamicPathParams) {
127023
127044
  if (!dynamicPathParams?.length) {
127024
- return path68;
127045
+ return path71;
127025
127046
  }
127026
127047
  let normalized = "";
127027
127048
  let currentIndex = 0;
127028
127049
  for (const param of dynamicPathParams) {
127029
- normalized += path68.slice(currentIndex, param.startIndex);
127050
+ normalized += path71.slice(currentIndex, param.startIndex);
127030
127051
  normalized += `{${param.parameterName}}`;
127031
127052
  currentIndex = param.startIndex + param.segment.length;
127032
127053
  }
127033
- normalized += path68.slice(currentIndex);
127054
+ normalized += path71.slice(currentIndex);
127034
127055
  return normalized;
127035
127056
  }
127036
127057
  function buildRequest(ctx, operation, def, meta3, dynamicPathParams) {
@@ -127464,8 +127485,8 @@ var OpenAPIGenerator = class {
127464
127485
  customErrorResponseBodySchema: options.customErrorResponseBodySchema
127465
127486
  };
127466
127487
  const errors = [];
127467
- await walkProcedureContractsAsync(router, (contract, path68) => {
127468
- if (value(options.filter, contract, path68) === false) {
127488
+ await walkProcedureContractsAsync(router, (contract, path71) => {
127489
+ if (value(options.filter, contract, path71) === false) {
127469
127490
  return;
127470
127491
  }
127471
127492
  try {
@@ -127477,7 +127498,7 @@ var OpenAPIGenerator = class {
127477
127498
  `QUERY operations require OpenAPI 3.2, but version "${version2}" was requested.`
127478
127499
  );
127479
127500
  }
127480
- const postPath = meta3?.path ?? pathToHttpPath(path68);
127501
+ const postPath = meta3?.path ?? pathToHttpPath(path71);
127481
127502
  const httpPath = meta3?.prefix ? mergeHttpPath(meta3.prefix, postPath) : postPath;
127482
127503
  const dynamicPathParams = getDynamicPathParams(httpPath);
127483
127504
  const openApiPath = toOpenAPIPath(httpPath, dynamicPathParams);
@@ -127486,7 +127507,7 @@ var OpenAPIGenerator = class {
127486
127507
  operation = meta3.spec;
127487
127508
  } else {
127488
127509
  operation = {
127489
- operationId: meta3?.operationId ?? path68.join("."),
127510
+ operationId: meta3?.operationId ?? path71.join("."),
127490
127511
  summary: meta3?.summary,
127491
127512
  description: meta3?.description,
127492
127513
  deprecated: meta3?.deprecated,
@@ -127506,7 +127527,7 @@ var OpenAPIGenerator = class {
127506
127527
  if (!(e14 instanceof OpenAPIGeneratorError)) {
127507
127528
  throw e14;
127508
127529
  }
127509
- errors.push(`Procedure at ${path68.join(".") || "(root)"}: ${e14.message}`);
127530
+ errors.push(`Procedure at ${path71.join(".") || "(root)"}: ${e14.message}`);
127510
127531
  }
127511
127532
  });
127512
127533
  if (errors.length) {
@@ -128353,16 +128374,16 @@ var StandardLink = class {
128353
128374
  /**
128354
128375
  * @throws ORPCError, transport-level errors (network failures, timeouts, etc.)
128355
128376
  */
128356
- call(path68, input2, options) {
128357
- return runWithSpan(`${ORPC_NAME}.${path68.join("/")}`, (span) => {
128377
+ call(path71, input2, options) {
128378
+ return runWithSpan(`${ORPC_NAME}.${path71.join("/")}`, (span) => {
128358
128379
  span?.setAttribute("rpc.system", ORPC_NAME);
128359
- span?.setAttribute("rpc.method", path68.join("."));
128380
+ span?.setAttribute("rpc.method", path71.join("."));
128360
128381
  if (getTracer() && isAsyncIteratorObject(input2)) {
128361
128382
  input2 = override(input2, traceAsyncIterator("consume_async_iterator_object_input", input2));
128362
128383
  } else if (getTracer() && input2 instanceof ReadableStream) {
128363
128384
  input2 = override(input2, traceReadableStream("consume_octet_stream_input", input2));
128364
128385
  }
128365
- return intercept(this.interceptors, { ...options, path: path68, input: input2 }, async ({ path: path210, input: input22, ...options2 }) => {
128386
+ return intercept(this.interceptors, { ...options, path: path71, input: input2 }, async ({ path: path210, input: input22, ...options2 }) => {
128366
128387
  const tracer = getTracer();
128367
128388
  const activeSpan = tracer?.getActiveSpan() ?? span;
128368
128389
  let request7 = await runWithSpan(
@@ -128419,18 +128440,18 @@ var RPCLinkCodec = class {
128419
128440
  this.headers = options.headers ?? {};
128420
128441
  this.serializer = options.serializer ?? new RPCSerializer();
128421
128442
  }
128422
- async encodeInput(input2, path68, options) {
128423
- let headers = toResolvedStandardHeaders(await value(this.headers, options, path68, input2));
128443
+ async encodeInput(input2, path71, options) {
128444
+ let headers = toResolvedStandardHeaders(await value(this.headers, options, path71, input2));
128424
128445
  if (options.lastEventId !== void 0) {
128425
128446
  headers = mergeStandardHeaders(headers, { "last-event-id": options.lastEventId });
128426
128447
  }
128427
- const expectedMethod = await value(this.expectedMethod, options, path68, input2);
128428
- const baseUrl = await value(this.baseUrl, options, path68, input2);
128448
+ const expectedMethod = await value(this.expectedMethod, options, path71, input2);
128449
+ const baseUrl = await value(this.baseUrl, options, path71, input2);
128429
128450
  const [pathname, search, hash2] = parseStandardUrl(baseUrl);
128430
- const newPathname = `${pathname.replace(END_SLASH_REGEX, "")}${pathToHttpPath(path68)}`;
128451
+ const newPathname = `${pathname.replace(END_SLASH_REGEX, "")}${pathToHttpPath(path71)}`;
128431
128452
  const serialized = this.serializer.serialize(input2);
128432
128453
  if (expectedMethod === "GET" && !(serialized instanceof Blob) && !(serialized instanceof ReadableStream) && !(serialized instanceof FormData) && !isAsyncIteratorObject(serialized)) {
128433
- const maxUrlLength = await value(this.maxUrlLength, options, path68, input2);
128454
+ const maxUrlLength = await value(this.maxUrlLength, options, path71, input2);
128434
128455
  const mergedSearch = new URLSearchParams(search);
128435
128456
  mergedSearch.append("data", stringifyJSON(serialized) ?? "");
128436
128457
  const url22 = `${newPathname}?${mergedSearch}${hash2 ?? ""}`;
@@ -128515,8 +128536,8 @@ var FetchLinkTransport = class {
128515
128536
  this.fetch = options.fetch ?? ((url2, init) => globalThis.fetch(url2, init));
128516
128537
  this.toFetchRequestOptions = options.toFetchRequest;
128517
128538
  }
128518
- async send(standardRequest, path68, options) {
128519
- let origin = await value(this.origin, options, path68);
128539
+ async send(standardRequest, path71, options) {
128540
+ let origin = await value(this.origin, options, path71);
128520
128541
  if (origin?.endsWith("/")) {
128521
128542
  origin = origin.slice(0, -1);
128522
128543
  }
@@ -128536,7 +128557,7 @@ var FetchLinkTransport = class {
128536
128557
  }
128537
128558
  }
128538
128559
  const fetch3 = this.fetch;
128539
- const response = await fetch3(url2, init, options, path68);
128560
+ const response = await fetch3(url2, init, options, path71);
128540
128561
  const standardResponse = toStandardLazyResponse(response);
128541
128562
  return standardResponse;
128542
128563
  }
@@ -128927,14 +128948,14 @@ var StandardHandler = class {
128927
128948
  span?.setAttribute("url.path", request22.url);
128928
128949
  return { matched: false };
128929
128950
  }
128930
- const { path: path68, procedure, decodeInput } = matchedOrNot;
128931
- span?.updateName(`${ORPC_NAME}.${path68.join("/")}`);
128951
+ const { path: path71, procedure, decodeInput } = matchedOrNot;
128952
+ span?.updateName(`${ORPC_NAME}.${path71.join("/")}`);
128932
128953
  span?.setAttribute("rpc.system", ORPC_NAME);
128933
- span?.setAttribute("rpc.method", path68.join("."));
128954
+ span?.setAttribute("rpc.method", path71.join("."));
128934
128955
  try {
128935
128956
  const response = await intercept(
128936
128957
  this.interceptors,
128937
- { context: context2, prefix: prefix2, request: request22, path: path68, procedure, decodeInput },
128958
+ { context: context2, prefix: prefix2, request: request22, path: path71, procedure, decodeInput },
128938
128959
  async ({ context: context3, prefix: prefix3, request: request32, path: path210, procedure: procedure2, decodeInput: decodeInput2 }) => {
128939
128960
  step2 = "decode_input";
128940
128961
  let input2 = await runWithSpan("decode_input", decodeInput2);
@@ -128968,7 +128989,7 @@ var StandardHandler = class {
128968
128989
  message: `Malformed request. Ensure the request body is properly formatted and the 'Content-Type' header is set correctly.`,
128969
128990
  cause: e14
128970
128991
  }) : toORPCError(e14);
128971
- const response = await this.codec.encodeError(error63, procedure, path68, { context: context2, prefix: prefix2 });
128992
+ const response = await this.codec.encodeError(error63, procedure, path71, { context: context2, prefix: prefix2 });
128972
128993
  return { matched: true, response };
128973
128994
  }
128974
128995
  }
@@ -129074,7 +129095,7 @@ var RPCMatcher = class {
129074
129095
  this.rootRouter = router;
129075
129096
  this.index(router);
129076
129097
  }
129077
- index(router, path68 = []) {
129098
+ index(router, path71 = []) {
129078
129099
  const lazyResults = walkProcedureContractsSync(router, (procedure, procedurePath) => {
129079
129100
  if (!value(this.filter, procedure, procedurePath)) {
129080
129101
  return;
@@ -129085,7 +129106,7 @@ var RPCMatcher = class {
129085
129106
  // contract-first entries have no implementation yet, resolveProcedure fills it in on demand
129086
129107
  procedure: procedure instanceof Procedure ? procedure : void 0
129087
129108
  });
129088
- }, path68);
129109
+ }, path71);
129089
129110
  for (const result of lazyResults) {
129090
129111
  this.pendingLazyRouters.set(pathToHttpPath(result.path), result);
129091
129112
  }
@@ -129217,10 +129238,10 @@ var RPCHandlerCodec = class {
129217
129238
  }
129218
129239
  };
129219
129240
  }
129220
- encodeOutput(output2, procedure, path68, options) {
129241
+ encodeOutput(output2, procedure, path71, options) {
129221
129242
  return {
129222
129243
  headers: {},
129223
- status: value(this.outputStatus, output2, procedure, path68, options) ?? DEFAULT_SUCCESS_STATUS,
129244
+ status: value(this.outputStatus, output2, procedure, path71, options) ?? DEFAULT_SUCCESS_STATUS,
129224
129245
  body: this.serializer.serialize(output2)
129225
129246
  };
129226
129247
  }
@@ -129274,39 +129295,39 @@ function createRouter() {
129274
129295
  static: new NullProtoObj2()
129275
129296
  };
129276
129297
  }
129277
- function scanFirstGroup(path68) {
129298
+ function scanFirstGroup(path71) {
129278
129299
  let i10 = 0;
129279
129300
  let depth = 0;
129280
- for (; i10 < path68.length; i10++) {
129281
- const c10 = path68.charCodeAt(i10);
129301
+ for (; i10 < path71.length; i10++) {
129302
+ const c10 = path71.charCodeAt(i10);
129282
129303
  if (c10 === 92) i10++;
129283
129304
  else if (c10 === 40) depth++;
129284
129305
  else if (c10 === 41 && depth > 0) depth--;
129285
129306
  else if (c10 === 123 && depth === 0) break;
129286
129307
  }
129287
- if (i10 >= path68.length) return;
129308
+ if (i10 >= path71.length) return;
129288
129309
  let j10 = i10 + 1;
129289
129310
  depth = 0;
129290
- for (; j10 < path68.length; j10++) {
129291
- const c10 = path68.charCodeAt(j10);
129311
+ for (; j10 < path71.length; j10++) {
129312
+ const c10 = path71.charCodeAt(j10);
129292
129313
  if (c10 === 92) j10++;
129293
129314
  else if (c10 === 40) depth++;
129294
129315
  else if (c10 === 41 && depth > 0) depth--;
129295
129316
  else if (c10 === 125 && depth === 0) break;
129296
129317
  }
129297
- if (j10 >= path68.length) return;
129298
- const mod = path68[j10 + 1];
129318
+ if (j10 >= path71.length) return;
129319
+ const mod = path71[j10 + 1];
129299
129320
  const hasMod = mod === "?" || mod === "+" || mod === "*";
129300
129321
  return [
129301
- path68.slice(0, i10),
129302
- path68.slice(i10 + 1, j10),
129303
- path68.slice(j10 + (hasMod ? 2 : 1)),
129322
+ path71.slice(0, i10),
129323
+ path71.slice(i10 + 1, j10),
129324
+ path71.slice(j10 + (hasMod ? 2 : 1)),
129304
129325
  hasMod ? mod : void 0
129305
129326
  ];
129306
129327
  }
129307
- function expandGroupDelimiters(path68) {
129308
- if (!path68.includes("{")) return;
129309
- const group = scanFirstGroup(path68);
129328
+ function expandGroupDelimiters(path71) {
129329
+ if (!path71.includes("{")) return;
129330
+ const group = scanFirstGroup(path71);
129310
129331
  if (!group) return;
129311
129332
  const [pre2, body, suf, mod] = group;
129312
129333
  if (!mod) return [pre2 + body + suf];
@@ -129376,9 +129397,9 @@ function replaceSegmentWildcards(segment, unnamedStart, toGroupKey = toUnnamedGr
129376
129397
  }
129377
129398
  return [replaced, nextIndex];
129378
129399
  }
129379
- function encodeEscapes(path68) {
129380
- if (!path68.includes("\\")) return path68;
129381
- return path68.replace(/\\([:(){}])/g, (_, c10) => "\uFFFD" + "ABCDE"[":(){}".indexOf(c10)]);
129400
+ function encodeEscapes(path71) {
129401
+ if (!path71.includes("\\")) return path71;
129402
+ return path71.replace(/\\([:(){}])/g, (_, c10) => "\uFFFD" + "ABCDE"[":(){}".indexOf(c10)]);
129382
129403
  }
129383
129404
  function segmentKey(segment) {
129384
129405
  if (segment.startsWith("**")) return 2;
@@ -129407,22 +129428,22 @@ function expandModifiers(segments) {
129407
129428
  return m10[2] === "+" ? [wc2] : [wc2, without];
129408
129429
  }
129409
129430
  }
129410
- function normalizePath(path68) {
129411
- if (!path68.includes("/.")) return path68;
129431
+ function normalizePath(path71) {
129432
+ if (!path71.includes("/.")) return path71;
129412
129433
  const r10 = [];
129413
- for (const s of path68.split("/")) if (s === ".") continue;
129434
+ for (const s of path71.split("/")) if (s === ".") continue;
129414
129435
  else if (s === ".." && r10.length > 1) r10.pop();
129415
129436
  else r10.push(s);
129416
129437
  return r10.join("/") || "/";
129417
129438
  }
129418
- function splitPath(path68) {
129419
- const s = path68.split("/");
129439
+ function splitPath(path71) {
129440
+ const s = path71.split("/");
129420
129441
  s.shift();
129421
129442
  if (s[s.length - 1] === "") s.pop();
129422
129443
  return s;
129423
129444
  }
129424
- function splitRoute(path68) {
129425
- const s = splitPath(path68);
129445
+ function splitRoute(path71) {
129446
+ const s = splitPath(path71);
129426
129447
  while (s[s.length - 1] === "") s.pop();
129427
129448
  return s;
129428
129449
  }
@@ -129438,16 +129459,16 @@ function getMatchParams(segments, paramsMap) {
129438
129459
  }
129439
129460
  return params;
129440
129461
  }
129441
- function addRoute(ctx, method = "", path68, data) {
129462
+ function addRoute(ctx, method = "", path71, data) {
129442
129463
  method = method.toUpperCase();
129443
- if (path68.charCodeAt(0) !== 47) path68 = `/${path68}`;
129444
- const groupExpanded = expandGroupDelimiters(path68);
129464
+ if (path71.charCodeAt(0) !== 47) path71 = `/${path71}`;
129465
+ const groupExpanded = expandGroupDelimiters(path71);
129445
129466
  if (groupExpanded) {
129446
129467
  for (const expandedPath of groupExpanded) addRoute(ctx, method, expandedPath, data);
129447
129468
  return;
129448
129469
  }
129449
- path68 = encodeEscapes(path68);
129450
- const segments = splitRoute(path68);
129470
+ path71 = encodeEscapes(path71);
129471
+ const segments = splitRoute(path71);
129451
129472
  const expanded = expandModifiers(segments);
129452
129473
  if (expanded) {
129453
129474
  for (const p of expanded) addRoute(ctx, method, p, data);
@@ -129538,15 +129559,15 @@ function getParamRegexp(segment, unnamedStart = 0) {
129538
129559
  const regex2 = _s2.replace(/:([\w-]+)(?:\(([^)]*)\))?/g, (_, id2, p) => `(?<${toGroupName(id2)}>${p || "[^/]+"})`).replace(/\((?![?<])/g, () => `(?<${toUnnamedGroupKey(_i2++)}>`).replace(/\uFFFE(.)/g, (_, c10) => /[.*+?^${}()|[\]\\]/.test(c10) ? `\\${c10}` : c10);
129539
129560
  return [new RegExp(`^${regex2}$`), _i2];
129540
129561
  }
129541
- function findRoute(ctx, method = "", path68, opts) {
129542
- if (opts?.normalize) path68 = normalizePath(path68);
129543
- if (path68.charCodeAt(path68.length - 1) === 47) path68 = path68.slice(0, -1);
129544
- const staticNode = ctx.static[path68];
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];
129545
129566
  if (staticNode && staticNode.methods) {
129546
129567
  const staticMatch = staticNode.methods[method] || staticNode.methods[""];
129547
129568
  if (staticMatch !== void 0) return staticMatch[0];
129548
129569
  }
129549
- const segments = splitPath(path68);
129570
+ const segments = splitPath(path71);
129550
129571
  const match = _lookupTree(ctx.root, method, segments, 0);
129551
129572
  if (match === void 0) return;
129552
129573
  if (opts?.params === false) return match;
@@ -129746,7 +129767,7 @@ var OpenAPIMatcher = class {
129746
129767
  this.rootRouter = router;
129747
129768
  this.index(router);
129748
129769
  }
129749
- index(router, path68 = []) {
129770
+ index(router, path71 = []) {
129750
129771
  const lazyResults = walkProcedureContractsSync(router, (contract, path210) => {
129751
129772
  if (!value(this.filter, contract, path210)) {
129752
129773
  return;
@@ -129761,7 +129782,7 @@ var OpenAPIMatcher = class {
129761
129782
  contract,
129762
129783
  procedure: contract instanceof Procedure ? contract : void 0
129763
129784
  });
129764
- }, path68);
129785
+ }, path71);
129765
129786
  for (const result of lazyResults) {
129766
129787
  const prefix = getOpenAPIMeta(result.router)?.prefix;
129767
129788
  this.pendingLazyRouters.add({
@@ -129848,20 +129869,20 @@ var OpenAPIMatcher = class {
129848
129869
  return entry.procedure;
129849
129870
  }
129850
129871
  };
129851
- function toRou3Pattern(path68) {
129852
- const params = getDynamicPathParams(path68);
129872
+ function toRou3Pattern(path71) {
129873
+ const params = getDynamicPathParams(path71);
129853
129874
  if (!params?.length) {
129854
- return path68;
129875
+ return path71;
129855
129876
  }
129856
129877
  for (let i10 = params.length - 1; i10 >= 0; i10--) {
129857
129878
  const param = params[i10];
129858
129879
  const pattern = param.allowsSlash ? `**:${param.parameterName}` : `:${param.parameterName}`;
129859
- path68 = path68.slice(0, param.startIndex) + pattern + path68.slice(param.startIndex + param.segment.length);
129880
+ path71 = path71.slice(0, param.startIndex) + pattern + path71.slice(param.startIndex + param.segment.length);
129860
129881
  }
129861
- return path68;
129882
+ return path71;
129862
129883
  }
129863
- function toRou3PrefixMatcher(path68) {
129864
- const pattern = toRou3Pattern(path68);
129884
+ function toRou3PrefixMatcher(path71) {
129885
+ const pattern = toRou3Pattern(path71);
129865
129886
  return routeToRegExp(pattern === "/" ? "/**" : `${pattern}/**`);
129866
129887
  }
129867
129888
  function decodeParams(params) {
@@ -129940,7 +129961,7 @@ var OpenAPIHandlerCodecCore = class {
129940
129961
  /**
129941
129962
  * @throws {TypeError} If `outputStructure` is "detailed" and the output doesn't match the expected structure.
129942
129963
  */
129943
- encodeOutput(output2, procedure, path68) {
129964
+ encodeOutput(output2, procedure, path71) {
129944
129965
  const meta3 = getOpenAPIMeta(procedure);
129945
129966
  const successStatus = meta3?.successStatus ?? DEFAULT_SUCCESS_STATUS;
129946
129967
  const outputStructure = meta3?.outputStructure ?? DEFAULT_OPENAPI_OUTPUT_STRUCTURE;
@@ -129953,7 +129974,7 @@ var OpenAPIHandlerCodecCore = class {
129953
129974
  }
129954
129975
  if (!isValidDetailedOutput(output2)) {
129955
129976
  throw new TypeError(`
129956
- Invalid "detailed" output structure returned by procedure (${path68.join(".")}):
129977
+ Invalid "detailed" output structure returned by procedure (${path71.join(".")}):
129957
129978
  \u2022 Expected an object with optional properties:
129958
129979
  - status (number <400)
129959
129980
  - headers (object)
@@ -130521,7 +130542,7 @@ function profileValue(name, paths) {
130521
130542
  function createConfigApiRouter(deps) {
130522
130543
  const authed = doorApiAuth(deps.expectedToken);
130523
130544
  const { paths } = deps;
130524
- const route = (path68, summary) => authed.meta(openapi({ method: "POST", path: path68, summary, tags: [CONFIG_API_TAG] }));
130545
+ const route = (path71, summary) => authed.meta(openapi({ method: "POST", path: path71, summary, tags: [CONFIG_API_TAG] }));
130525
130546
  return {
130526
130547
  config: {
130527
130548
  identity: {
@@ -131326,6 +131347,9 @@ function createLaunchEventPublisher(hub, now) {
131326
131347
  };
131327
131348
  }
131328
131349
 
131350
+ // src/frontdoor/pipeline.ts
131351
+ init_schema2();
131352
+
131329
131353
  // src/frontdoor/headroomHop.ts
131330
131354
  var http4 = __toESM(require("node:http"), 1);
131331
131355
  var import_consumers = require("node:stream/consumers");
@@ -131526,11 +131550,11 @@ function lineageOf(body) {
131526
131550
  if (body.length > LINEAGE_BODY_BYTES_LIMIT) {
131527
131551
  return void 0;
131528
131552
  }
131529
- const counted = walk2(body, false, void 0);
131530
- if (counted.abandoned || !counted.sawMessages) {
131553
+ const counted2 = walk2(body, false, void 0);
131554
+ if (counted2.abandoned || !counted2.sawMessages) {
131531
131555
  return void 0;
131532
131556
  }
131533
- const parentAfter = counted.elements > MESSAGES_PER_TURN ? counted.elements - MESSAGES_PER_TURN : void 0;
131557
+ const parentAfter = counted2.elements > MESSAGES_PER_TURN ? counted2.elements - MESSAGES_PER_TURN : void 0;
131534
131558
  const hashed = walk2(body, true, parentAfter);
131535
131559
  const combine = (messagesDigest) => (0, import_node_crypto22.createHash)("sha256").update(hashed.threadDigest).update(messagesDigest).digest("hex");
131536
131560
  return { ownKey: combine(hashed.messagesDigest), parentKey: hashed.parentDigest === void 0 ? void 0 : combine(hashed.parentDigest) };
@@ -131776,6 +131800,10 @@ function errorTypeFor(status) {
131776
131800
  function errorBody(status, message) {
131777
131801
  return JSON.stringify({ type: "error", error: { type: errorTypeFor(status), message } });
131778
131802
  }
131803
+ function clientSessionIdOf(headers) {
131804
+ const value2 = headers[CLIENT_SESSION_HEADER];
131805
+ return typeof value2 === "string" && CLIENT_SESSION_ID_PATTERN.test(value2) ? value2 : void 0;
131806
+ }
131779
131807
  function pathOf(url2) {
131780
131808
  const query = url2.indexOf("?");
131781
131809
  return query === -1 ? url2 : url2.slice(0, query);
@@ -131830,7 +131858,7 @@ function createRoutedResponse(response, context) {
131830
131858
  start: (status, headers) => {
131831
131859
  for (const observe of deps.responseObservers) {
131832
131860
  try {
131833
- const body = observe({ session, route, method: request7.method, path: request7.path, servedPath: context.servedPath, receivedAt: request7.receivedAt, viaHeadroom: request7.viaHeadroom, lineage: request7.thread.lineage, modelChoice: request7.modelChoice.value, requestedModel: request7.requestedModel.value, status, headers });
131861
+ const body = observe({ session, route, method: request7.method, path: request7.path, servedPath: context.servedPath, receivedAt: request7.receivedAt, viaHeadroom: request7.viaHeadroom, lineage: request7.thread.lineage, modelChoice: request7.modelChoice.value, requestedModel: request7.requestedModel.value, clientSessionId: request7.clientSessionId, status, headers });
131834
131862
  if (body !== void 0) {
131835
131863
  bodyObservers.push(body);
131836
131864
  }
@@ -131875,7 +131903,7 @@ function createRoutedResponse(response, context) {
131875
131903
  }
131876
131904
  async function serveRouted(incoming, deps) {
131877
131905
  const request7 = { ...incoming, url: withCanonicalProviderTarget(incoming.url, deps.canonicalProvider) };
131878
- const observed = { method: request7.method, path: pathOf(request7.url), receivedAt: deps.now(), viaHeadroom: false, thread: { lineage: void 0 }, modelChoice: { value: void 0 }, requestedModel: { value: void 0 } };
131906
+ const observed = { method: request7.method, path: pathOf(request7.url), receivedAt: deps.now(), viaHeadroom: false, thread: { lineage: void 0 }, modelChoice: { value: void 0 }, requestedModel: { value: void 0 }, clientSessionId: clientSessionIdOf(incoming.headers) };
131879
131907
  const identity = identifyRequest(request7.headers);
131880
131908
  const identified = { ...identity, session: { ...identity.session, provider: identity.session.provider === void 0 ? void 0 : deps.canonicalProvider(identity.session.provider) } };
131881
131909
  const admission = deps.admit({ url: request7.url, headers: request7.headers, forwardable: identified.forwardableHeaders });
@@ -132541,8 +132569,8 @@ function createCodexRouteMount(ports, upstreamBase, provider) {
132541
132569
  request7.body.resume();
132542
132570
  return;
132543
132571
  }
132544
- const path68 = new URL(request7.url, "http://127.0.0.1").pathname;
132545
- const translated = { method: request7.method, path: path68, body, signal: request7.signal };
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 };
132546
132574
  const routed = await route(translated);
132547
132575
  if (request7.signal.aborted) {
132548
132576
  return;
@@ -133163,8 +133191,8 @@ function createAntigravityRouteMount(ports, upstreamBase, provider) {
133163
133191
  request7.body.resume();
133164
133192
  return;
133165
133193
  }
133166
- const path68 = new URL(request7.url, "http://127.0.0.1").pathname;
133167
- const translated = { method: request7.method, path: path68, body, signal: request7.signal };
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 };
133168
133196
  const routed = await route(translated);
133169
133197
  if (request7.signal.aborted) {
133170
133198
  return;
@@ -133205,7 +133233,7 @@ function createPassthroughRoute(name, target) {
133205
133233
  headroomUpstream: target.headroomUpstream,
133206
133234
  serve: async (request7, response) => {
133207
133235
  const incoming = new URL(request7.url, "http://127.0.0.1");
133208
- const path68 = target.stripPrefix !== void 0 && incoming.pathname.startsWith(target.stripPrefix) ? incoming.pathname.slice(target.stripPrefix.length) : incoming.pathname;
133236
+ const path71 = target.stripPrefix !== void 0 && incoming.pathname.startsWith(target.stripPrefix) ? incoming.pathname.slice(target.stripPrefix.length) : incoming.pathname;
133209
133237
  const headers = forwardableHeaders(request7.headers);
133210
133238
  delete headers.host;
133211
133239
  await new Promise((resolve2) => {
@@ -133213,7 +133241,7 @@ function createPassthroughRoute(name, target) {
133213
133241
  host: base.hostname,
133214
133242
  port: base.port === "" ? void 0 : Number(base.port),
133215
133243
  method: request7.method,
133216
- path: `${basePath}${path68}${incoming.search}`,
133244
+ path: `${basePath}${path71}${incoming.search}`,
133217
133245
  headers,
133218
133246
  agent
133219
133247
  };
@@ -133385,13 +133413,13 @@ async function scanRequestHead(request7, wholeBody = false) {
133385
133413
  }
133386
133414
 
133387
133415
  // src/frontdoor/providerRoute.ts
133388
- var isRcSelfHostPath = (path68) => path68 === "/v1/code/sessions" || path68.startsWith("/v1/code/sessions/") || path68 === "/v1/sessions" || path68.startsWith("/v1/sessions/");
133416
+ var isRcSelfHostPath = (path71) => path71 === "/v1/code/sessions" || path71.startsWith("/v1/code/sessions/") || path71 === "/v1/sessions" || path71.startsWith("/v1/sessions/");
133389
133417
  function scopeSessionProviderPath(request7) {
133390
133418
  if (request7.session.provider === void 0) {
133391
133419
  return request7;
133392
133420
  }
133393
- const path68 = new URL(request7.url, "http://127.0.0.1").pathname;
133394
- if (!path68.startsWith("/v1/") || isRcSelfHostPath(path68)) {
133421
+ const path71 = new URL(request7.url, "http://127.0.0.1").pathname;
133422
+ if (!path71.startsWith("/v1/") || isRcSelfHostPath(path71)) {
133395
133423
  return request7;
133396
133424
  }
133397
133425
  return { ...request7, url: `${PROVIDER_PATH_PREFIX}${encodeURIComponent(request7.session.provider)}${request7.url}` };
@@ -133515,13 +133543,13 @@ function createProviderRouteResolver(deps) {
133515
133543
  return route;
133516
133544
  };
133517
133545
  const resolve2 = (request7) => {
133518
- const path68 = new URL(request7.url, "http://127.0.0.1").pathname;
133519
- const scoped = parseProviderPath(path68);
133546
+ const path71 = new URL(request7.url, "http://127.0.0.1").pathname;
133547
+ const scoped = parseProviderPath(path71);
133520
133548
  if (scoped === void 0) {
133521
- if (deps.rcSelfHostRoute !== void 0 && isRcSelfHostPath(path68)) {
133549
+ if (deps.rcSelfHostRoute !== void 0 && isRcSelfHostPath(path71)) {
133522
133550
  return { ok: true, route: deps.rcSelfHostRoute };
133523
133551
  }
133524
- return path68.startsWith("/v1/") ? { ok: true, route: oauthRoute } : { ok: false, status: HTTP_STATUS.notFound, message: `no such endpoint: ${path68}` };
133552
+ return path71.startsWith("/v1/") ? { ok: true, route: oauthRoute } : { ok: false, status: HTTP_STATUS.notFound, message: `no such endpoint: ${path71}` };
133525
133553
  }
133526
133554
  const { provider } = scoped;
133527
133555
  let definition;
@@ -133613,8 +133641,8 @@ function createProviderRouteResolver(deps) {
133613
133641
  let modelChoice;
133614
133642
  const visited = /* @__PURE__ */ new Set();
133615
133643
  for (; ; ) {
133616
- const path68 = new URL(current.url, "http://127.0.0.1").pathname;
133617
- const scoped = parseProviderPath(path68);
133644
+ const path71 = new URL(current.url, "http://127.0.0.1").pathname;
133645
+ const scoped = parseProviderPath(path71);
133618
133646
  const providerName = scoped?.provider ?? current.session.provider;
133619
133647
  if (providerName !== void 0 && visited.has(providerName)) {
133620
133648
  return { ok: false, status: HTTP_STATUS.internalServerError, message: `provider routing cycle: ${[...visited, providerName].join(" -> ")}` };
@@ -133629,7 +133657,7 @@ function createProviderRouteResolver(deps) {
133629
133657
  } catch {
133630
133658
  routes = void 0;
133631
133659
  }
133632
- const resolvesNames = !nameResolved && !isRcSelfHostPath(path68);
133660
+ const resolvesNames = !nameResolved && !isRcSelfHostPath(path71);
133633
133661
  if (resolvesNames) {
133634
133662
  const scan2 = await scanRequestHead(current, true);
133635
133663
  if (scan2.replayed === void 0) {
@@ -133668,7 +133696,7 @@ function createProviderRouteResolver(deps) {
133668
133696
  }
133669
133697
  if (routed.provider !== providerName) {
133670
133698
  const scopedPrefix = providerName === void 0 ? void 0 : `${PROVIDER_PATH_PREFIX}${encodeURIComponent(providerName)}`;
133671
- const rest2 = scopedPrefix !== void 0 && path68.startsWith(scopedPrefix) ? path68.slice(scopedPrefix.length) : path68;
133699
+ const rest2 = scopedPrefix !== void 0 && path71.startsWith(scopedPrefix) ? path71.slice(scopedPrefix.length) : path71;
133672
133700
  const query2 = current.url.includes("?") ? current.url.slice(current.url.indexOf("?")) : "";
133673
133701
  const carried = replay;
133674
133702
  current = { ...current, url: `${PROVIDER_PATH_PREFIX}${encodeURIComponent(routed.provider)}${rest2}${query2}`, body: carried.body, headers: carried.headers };
@@ -133722,7 +133750,7 @@ function createProviderRouteResolver(deps) {
133722
133750
  const headers = Object.fromEntries(Object.entries(replay.headers).filter(([name]) => name.toLowerCase() !== "content-length"));
133723
133751
  replay = { ...replay, headers, body: import_node_stream3.Readable.from([Buffer.from(rewritten, "utf8")]) };
133724
133752
  }
133725
- const rest = scoped === void 0 ? path68 : path68.slice(`${PROVIDER_PATH_PREFIX}${encodeURIComponent(scoped.provider)}`.length);
133753
+ const rest = scoped === void 0 ? path71 : path71.slice(`${PROVIDER_PATH_PREFIX}${encodeURIComponent(scoped.provider)}`.length);
133726
133754
  const query = current.url.includes("?") ? current.url.slice(current.url.indexOf("?")) : "";
133727
133755
  current = { ...current, url: `${PROVIDER_PATH_PREFIX}${encodeURIComponent(matched.provider)}${rest}${query}`, body: replay.body, headers: replay.headers };
133728
133756
  }
@@ -137357,7 +137385,7 @@ function registerFrontDoorCommand(program2, deps) {
137357
137385
  // src/statusline/commands.ts
137358
137386
  var import_node_child_process8 = require("node:child_process");
137359
137387
  var import_node_os13 = __toESM(require("node:os"), 1);
137360
- var import_node_path58 = __toESM(require("node:path"), 1);
137388
+ var import_node_path61 = __toESM(require("node:path"), 1);
137361
137389
  init_commandDeps();
137362
137390
  init_statusline();
137363
137391
  init_providersStore();
@@ -137599,7 +137627,8 @@ function enrichStatuslinePayload(params) {
137599
137627
  quotaFamilies: [],
137600
137628
  headroom: params.headroom,
137601
137629
  routedTarget: params.routedTarget,
137602
- ...params.modelChoice === void 0 ? {} : { modelChoice: params.modelChoice }
137630
+ ...params.modelChoice === void 0 ? {} : { modelChoice: params.modelChoice },
137631
+ ...params.doorCostUsd === void 0 ? {} : { doorCostUsd: params.doorCostUsd }
137603
137632
  };
137604
137633
  if (params.snapshot !== void 0) {
137605
137634
  const scopedName = providerScopedState(params.snapshot, params.providerName, params.env.AGENT_SHIM_PROVIDER);
@@ -137675,6 +137704,77 @@ function providerScopedState(snapshot, providerName, providerDisplayName) {
137675
137704
 
137676
137705
  // src/statusline/commands.ts
137677
137706
  init_read();
137707
+ init_modelsStore();
137708
+
137709
+ // src/statusline/doorCost.ts
137710
+ init_read();
137711
+
137712
+ // src/statusline/cost.ts
137713
+ var TOKENS_PER_MILLION = 1e6;
137714
+ var CACHE_WRITE_PRICE_RATIO = 1.25;
137715
+ var CACHE_READ_PRICE_RATIO = 0.1;
137716
+ function doorCostUsdOf(records, prices) {
137717
+ let totalUsd = 0;
137718
+ let costed = 0;
137719
+ for (const record2 of records) {
137720
+ const { usage } = record2;
137721
+ if (usage === void 0) {
137722
+ continue;
137723
+ }
137724
+ const price = record2.model === void 0 ? void 0 : prices[`${record2.provider}/${record2.model}`];
137725
+ if (price === void 0) {
137726
+ return void 0;
137727
+ }
137728
+ const inputUsd = ((usage.inputTokens ?? 0) + (usage.cacheCreationInputTokens ?? 0) * CACHE_WRITE_PRICE_RATIO + (usage.cacheReadInputTokens ?? 0) * CACHE_READ_PRICE_RATIO) * price.input;
137729
+ totalUsd += (inputUsd + (usage.outputTokens ?? 0) * price.output) / TOKENS_PER_MILLION;
137730
+ costed += 1;
137731
+ }
137732
+ return costed === 0 ? void 0 : totalUsd;
137733
+ }
137734
+ function isCloudModelId(modelId) {
137735
+ return modelId !== void 0 && (modelId.toLowerCase().includes("anthropic.claude-") || modelId.includes("@"));
137736
+ }
137737
+ function isRoutedSession(summary, payload) {
137738
+ return summary.provider !== void 0 || isCloudModelId(payload.model?.id);
137739
+ }
137740
+ function resolveSessionCost({ summary, payload, settings: settings2 }) {
137741
+ const native = payload.cost?.total_cost_usd;
137742
+ const door = summary.doorCostUsd;
137743
+ if (!isRoutedSession(summary, payload)) {
137744
+ if (native !== void 0) {
137745
+ return { usd: native, source: "native" };
137746
+ }
137747
+ return door === void 0 ? void 0 : { usd: door, source: "estimate" };
137748
+ }
137749
+ if (!settings2.cost.routed) {
137750
+ return void 0;
137751
+ }
137752
+ if (door !== void 0) {
137753
+ return { usd: door, source: "estimate" };
137754
+ }
137755
+ return native !== void 0 && native > 0 ? { usd: native, source: "native" } : void 0;
137756
+ }
137757
+ var CENTS_FROM_USD = 1;
137758
+ var MILLS_FROM_USD = 0.1;
137759
+ var MILL_PLACES = 3;
137760
+ var FINE_PLACES = 4;
137761
+ function formatUsd(usd2) {
137762
+ if (usd2 >= CENTS_FROM_USD) {
137763
+ return `$${usd2.toFixed(2)}`;
137764
+ }
137765
+ return usd2 >= MILLS_FROM_USD ? `$${usd2.toFixed(MILL_PLACES)}` : `$${usd2.toFixed(FINE_PLACES)}`;
137766
+ }
137767
+
137768
+ // src/statusline/doorCost.ts
137769
+ function readDoorCostUsd(params) {
137770
+ const { nowMs, sessionDurationMs } = params;
137771
+ const sinceMs = sessionDurationMs === void 0 ? void 0 : Date.parse(`${segmentDay(nowMs - sessionDurationMs)}T00:00:00.000Z`);
137772
+ const { records } = readUsageLog(params.fs, params.logDir, sinceMs === void 0 ? {} : { sinceMs });
137773
+ return doorCostUsdOf(
137774
+ records.filter((record2) => record2.clientSessionId === params.conversationId),
137775
+ params.prices
137776
+ );
137777
+ }
137678
137778
 
137679
137779
  // src/statusline/payload.ts
137680
137780
  init_zod();
@@ -137730,21 +137830,90 @@ function viewOf(payload) {
137730
137830
  var import_node_child_process7 = require("node:child_process");
137731
137831
  var import_node_fs22 = __toESM(require("node:fs"), 1);
137732
137832
  var import_node_os12 = __toESM(require("node:os"), 1);
137833
+ var import_node_path56 = __toESM(require("node:path"), 1);
137834
+
137835
+ // src/statusline/memoryUse.ts
137836
+ var BYTES_PER_KIBIBYTE = 1024;
137837
+ var SMALLER_UNITS = ["B", "KB", "MB", "GB"];
137838
+ var LARGEST_UNIT = "TB";
137839
+ function formatBytes(bytes) {
137840
+ const firstWholeDigits = 10;
137841
+ let value2 = Math.max(0, bytes);
137842
+ for (const unit of SMALLER_UNITS) {
137843
+ if (value2 < BYTES_PER_KIBIBYTE) {
137844
+ return `${value2.toFixed(value2 >= firstWholeDigits || unit === "B" ? 0 : 1)} ${unit}`;
137845
+ }
137846
+ value2 /= BYTES_PER_KIBIBYTE;
137847
+ }
137848
+ return `${value2.toFixed(value2 >= firstWholeDigits ? 0 : 1)} ${LARGEST_UNIT}`;
137849
+ }
137850
+ function usedBytesFromVmStat(output2) {
137851
+ const pageSize = /page size of (\d+) bytes/.exec(output2)?.[1];
137852
+ const active = /Pages active:\s+(\d+)/.exec(output2)?.[1];
137853
+ const wired = /Pages wired down:\s+(\d+)/.exec(output2)?.[1];
137854
+ const compressed = /Pages occupied by compressor:\s+(\d+)/.exec(output2)?.[1];
137855
+ if (pageSize === void 0 || active === void 0 || wired === void 0 || compressed === void 0) {
137856
+ return void 0;
137857
+ }
137858
+ return (Number(active) + Number(wired) + Number(compressed)) * Number(pageSize);
137859
+ }
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];
137863
+ if (totalKibibytes === void 0 || availableKibibytes === void 0) {
137864
+ return void 0;
137865
+ }
137866
+ const totalBytes = Number(totalKibibytes) * BYTES_PER_KIBIBYTE;
137867
+ return { totalBytes, usedBytes: totalBytes - Number(availableKibibytes) * BYTES_PER_KIBIBYTE };
137868
+ }
137869
+
137870
+ // src/statusline/ports.ts
137733
137871
  var RUN_TIMEOUT_MS = 2e3;
137734
137872
  var RUN_MAX_BUFFER_BYTES = 1048576;
137735
- function realStatuslinePorts(env) {
137873
+ function runProgram(file2, args, cwd) {
137874
+ 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 });
137876
+ } catch {
137877
+ return void 0;
137878
+ }
137879
+ }
137880
+ function readText(file2) {
137881
+ try {
137882
+ return import_node_fs22.default.readFileSync(file2, "utf8");
137883
+ } catch {
137884
+ return void 0;
137885
+ }
137886
+ }
137887
+ var STATE_FILE_MODE = 384;
137888
+ var STATE_DIRECTORY_MODE = 448;
137889
+ function discard(target) {
137890
+ try {
137891
+ import_node_fs22.default.rmSync(target, { force: true, recursive: true });
137892
+ } catch {
137893
+ return;
137894
+ }
137895
+ }
137896
+ function readMemoryUse() {
137897
+ const totalBytes = import_node_os12.default.totalmem();
137898
+ if (process.platform === "darwin") {
137899
+ const output2 = runProgram("/usr/bin/vm_stat", [], process.cwd());
137900
+ const usedBytes = output2 === void 0 ? void 0 : usedBytesFromVmStat(output2);
137901
+ return usedBytes === void 0 ? void 0 : { usedBytes, totalBytes };
137902
+ }
137903
+ if (process.platform === "linux") {
137904
+ const meminfo = readText("/proc/meminfo");
137905
+ return meminfo === void 0 ? void 0 : memoryUseFromMeminfo(meminfo);
137906
+ }
137907
+ return { usedBytes: totalBytes - import_node_os12.default.freemem(), totalBytes };
137908
+ }
137909
+ function realStatuslinePorts(env, stateDirectory) {
137736
137910
  const { locale, timeZone } = Intl.DateTimeFormat().resolvedOptions();
137737
137911
  return {
137738
137912
  env,
137739
137913
  homeDirectory: import_node_os12.default.homedir(),
137914
+ stateDirectory,
137740
137915
  clock: { locale, timeZone },
137741
- readText: (path68) => {
137742
- try {
137743
- return import_node_fs22.default.readFileSync(path68, "utf8");
137744
- } catch {
137745
- return void 0;
137746
- }
137747
- },
137916
+ readText,
137748
137917
  readRange: (file2, start, length) => {
137749
137918
  try {
137750
137919
  const descriptor = import_node_fs22.default.openSync(file2, "r");
@@ -137760,34 +137929,47 @@ function realStatuslinePorts(env) {
137760
137929
  return void 0;
137761
137930
  }
137762
137931
  },
137763
- run: (file2, args, cwd) => {
137932
+ run: runProgram,
137933
+ entryKind: (target) => {
137764
137934
  try {
137765
- 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 });
137935
+ return import_node_fs22.default.lstatSync(target).isDirectory() ? "directory" : "other";
137766
137936
  } catch {
137767
137937
  return void 0;
137768
137938
  }
137769
137939
  },
137770
- entryKind: (path68) => {
137940
+ realPath: (target) => {
137771
137941
  try {
137772
- return import_node_fs22.default.lstatSync(path68).isDirectory() ? "directory" : "other";
137942
+ return import_node_fs22.default.realpathSync(target);
137773
137943
  } catch {
137774
137944
  return void 0;
137775
137945
  }
137776
137946
  },
137777
- realPath: (path68) => {
137947
+ modifiedAtMs: (target) => {
137778
137948
  try {
137779
- return import_node_fs22.default.realpathSync(path68);
137949
+ return import_node_fs22.default.statSync(target).mtimeMs;
137780
137950
  } catch {
137781
137951
  return void 0;
137782
137952
  }
137783
137953
  },
137784
- modifiedAtMs: (path68) => {
137954
+ listDirectory: (target) => {
137785
137955
  try {
137786
- return import_node_fs22.default.statSync(path68).mtimeMs;
137956
+ return import_node_fs22.default.readdirSync(target);
137787
137957
  } catch {
137788
137958
  return void 0;
137789
137959
  }
137790
- }
137960
+ },
137961
+ writeText: (target, text4) => {
137962
+ const temporary = import_node_path56.default.join(import_node_path56.default.dirname(target), `.${import_node_path56.default.basename(target)}.${String(process.pid)}.tmp`);
137963
+ try {
137964
+ 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 });
137966
+ import_node_fs22.default.renameSync(temporary, target);
137967
+ } catch {
137968
+ discard(temporary);
137969
+ }
137970
+ },
137971
+ removePath: discard,
137972
+ memoryUse: readMemoryUse
137791
137973
  };
137792
137974
  }
137793
137975
 
@@ -138033,6 +138215,90 @@ function effortSegment({ payload, settings: settings2 }) {
138033
138215
  return level === void 0 ? void 0 : formatEffort(level, settings2.effort.format);
138034
138216
  }
138035
138217
 
138218
+ // src/statusline/dailyLedger.ts
138219
+ var import_node_path57 = __toESM(require("node:path"), 1);
138220
+ init_zod();
138221
+ init_schema2();
138222
+ var DAILY_LEDGER_DIRECTORY = "daily-cost";
138223
+ var HOURS_PER_DAY8 = 24;
138224
+ var MS_PER_HOUR5 = 36e5;
138225
+ var SESSION_MAX_AGE_MS = HOURS_PER_DAY8 * MS_PER_HOUR5;
138226
+ var LAST_SEEN_REFRESH_MS = SESSION_MAX_AGE_MS / HOURS_PER_DAY8;
138227
+ var ENTRY_FILE = new RegExp(`^${CLIENT_SESSION_ID_PATTERN.source.slice(1, -1)}\\.json$`);
138228
+ var DAY_NAME = /^\d{4}-\d{2}-\d{2}$/;
138229
+ var usd = external_exports.number().nonnegative();
138230
+ var EntrySchema = external_exports.strictObject({ baselineUsd: usd, totalUsd: usd, source: external_exports.enum(["native", "estimate"]), seenAtMs: external_exports.number().int().positive() });
138231
+ function localDay(nowMs) {
138232
+ const date5 = new Date(nowMs);
138233
+ return `${String(date5.getFullYear())}-${String(date5.getMonth() + 1).padStart(2, "0")}-${String(date5.getDate()).padStart(2, "0")}`;
138234
+ }
138235
+ function parseEntry3(text4) {
138236
+ if (text4 === void 0) {
138237
+ return void 0;
138238
+ }
138239
+ let raw;
138240
+ try {
138241
+ raw = JSON.parse(text4);
138242
+ } catch {
138243
+ return void 0;
138244
+ }
138245
+ const parsed = EntrySchema.safeParse(raw);
138246
+ return parsed.success ? parsed.data : void 0;
138247
+ }
138248
+ function advance(existing, carried, cost, nowMs) {
138249
+ if (existing === void 0) {
138250
+ const carry = carried?.source === cost.source && nowMs - carried.seenAtMs <= SESSION_MAX_AGE_MS ? carried.totalUsd : void 0;
138251
+ const baselineUsd = carry ?? cost.usd;
138252
+ return { entry: { baselineUsd, totalUsd: Math.max(baselineUsd, cost.usd), source: cost.source, seenAtMs: nowMs }, changed: true };
138253
+ }
138254
+ if (existing.source !== cost.source) {
138255
+ return void 0;
138256
+ }
138257
+ if (cost.usd > existing.totalUsd || nowMs - existing.seenAtMs >= LAST_SEEN_REFRESH_MS) {
138258
+ return { entry: { ...existing, totalUsd: Math.max(existing.totalUsd, cost.usd), seenAtMs: nowMs }, changed: true };
138259
+ }
138260
+ return { entry: existing, changed: false };
138261
+ }
138262
+ function recordDailySpend(ports, nowMs, sessionId, cost) {
138263
+ const root = import_node_path57.default.join(ports.stateDirectory, DAILY_LEDGER_DIRECTORY);
138264
+ const today = localDay(nowMs);
138265
+ const days = (ports.listDirectory(root) ?? []).filter((name) => DAY_NAME.test(name));
138266
+ const previous = days.filter((day) => day < today).sort().at(-1);
138267
+ for (const day of days) {
138268
+ if (day < today && day !== previous) {
138269
+ ports.removePath(import_node_path57.default.join(root, day));
138270
+ }
138271
+ }
138272
+ const todayDirectory = import_node_path57.default.join(root, today);
138273
+ if (sessionId !== void 0 && cost !== void 0 && CLIENT_SESSION_ID_PATTERN.test(sessionId)) {
138274
+ const file2 = import_node_path57.default.join(todayDirectory, `${sessionId}.json`);
138275
+ const carried = previous === void 0 ? void 0 : parseEntry3(ports.readText(import_node_path57.default.join(root, previous, `${sessionId}.json`)));
138276
+ const next = advance(parseEntry3(ports.readText(file2)), carried, cost, nowMs);
138277
+ if (next?.changed === true) {
138278
+ ports.writeText(file2, `${JSON.stringify(next.entry)}
138279
+ `);
138280
+ }
138281
+ }
138282
+ const entries = (ports.listDirectory(todayDirectory) ?? []).filter((name) => ENTRY_FILE.test(name)).flatMap((name) => {
138283
+ const entry = parseEntry3(ports.readText(import_node_path57.default.join(todayDirectory, name)));
138284
+ return entry === void 0 ? [] : [entry];
138285
+ });
138286
+ return entries.length === 0 ? void 0 : entries.reduce((sum, entry) => sum + (entry.totalUsd - entry.baselineUsd), 0);
138287
+ }
138288
+
138289
+ // src/statusline/elements/header/cost.ts
138290
+ function costSegment(context) {
138291
+ const cost = resolveSessionCost(context);
138292
+ if (cost === void 0) {
138293
+ return void 0;
138294
+ }
138295
+ return `${cost.source === "native" ? "Cost" : "Est."} ${formatUsd(cost.usd)}`;
138296
+ }
138297
+ function dailyCostSegment(context) {
138298
+ const spend = recordDailySpend(context.ports, context.nowMs, context.payload.session_id, resolveSessionCost(context));
138299
+ return spend === void 0 ? void 0 : `Today ${formatUsd(spend)}`;
138300
+ }
138301
+
138036
138302
  // src/statusline/palette.ts
138037
138303
  init_statusline();
138038
138304
  var RESET = `${ESCAPE}[0m`;
@@ -138235,11 +138501,11 @@ function modelSegment(context) {
138235
138501
  }
138236
138502
 
138237
138503
  // src/statusline/elements/header/outputStyle.ts
138238
- var import_node_path56 = __toESM(require("node:path"), 1);
138504
+ var import_node_path58 = __toESM(require("node:path"), 1);
138239
138505
  init_zod();
138240
138506
  var SettingsFileSchema = external_exports.looseObject({ outputStyle: external_exports.string().optional().catch(void 0) });
138241
- function outputStyleIn(file2, readText) {
138242
- const text4 = readText(file2);
138507
+ function outputStyleIn(file2, readText2) {
138508
+ const text4 = readText2(file2);
138243
138509
  if (text4 === void 0) {
138244
138510
  return void 0;
138245
138511
  }
@@ -138255,12 +138521,12 @@ function outputStyleIn(file2, readText) {
138255
138521
  }
138256
138522
  function outputStyleSegment({ payload, ports }) {
138257
138523
  const pinned = ports.env.CLAUDE_CONFIG_DIR;
138258
- const configDirectory = pinned === void 0 || pinned === "" ? import_node_path56.default.join(ports.homeDirectory, ".claude") : pinned;
138524
+ const configDirectory = pinned === void 0 || pinned === "" ? import_node_path58.default.join(ports.homeDirectory, ".claude") : pinned;
138259
138525
  const projectDirectory = payload.cwd ?? payload.workspace?.current_dir;
138260
138526
  const files = [
138261
- import_node_path56.default.join(configDirectory, "settings.json"),
138262
- import_node_path56.default.join(configDirectory, "settings.local.json"),
138263
- ...projectDirectory === void 0 ? [] : [import_node_path56.default.join(projectDirectory, ".claude", "settings.json"), import_node_path56.default.join(projectDirectory, ".claude", "settings.local.json")]
138527
+ import_node_path58.default.join(configDirectory, "settings.json"),
138528
+ import_node_path58.default.join(configDirectory, "settings.local.json"),
138529
+ ...projectDirectory === void 0 ? [] : [import_node_path58.default.join(projectDirectory, ".claude", "settings.json"), import_node_path58.default.join(projectDirectory, ".claude", "settings.local.json")]
138264
138530
  ];
138265
138531
  const style = files.map((file2) => outputStyleIn(file2, ports.readText)).findLast((name) => name !== void 0);
138266
138532
  return style === void 0 ? void 0 : `style: ${style}`;
@@ -138416,15 +138682,15 @@ function parseNumstat(output2) {
138416
138682
  if (addedText === void 0 || deletedText === void 0 || pathText === void 0) {
138417
138683
  continue;
138418
138684
  }
138419
- const path68 = pathText === "" ? fields[index + 2] : pathText;
138685
+ const path71 = pathText === "" ? fields[index + 2] : pathText;
138420
138686
  if (pathText === "") {
138421
138687
  index += 2;
138422
138688
  }
138423
138689
  const lines = { added: Number(addedText), deleted: Number(deletedText) };
138424
- if (path68 !== void 0 && Number.isInteger(lines.added) && Number.isInteger(lines.deleted)) {
138690
+ if (path71 !== void 0 && Number.isInteger(lines.added) && Number.isInteger(lines.deleted)) {
138425
138691
  added += lines.added;
138426
138692
  deleted += lines.deleted;
138427
- byPath.set(path68, lines);
138693
+ byPath.set(path71, lines);
138428
138694
  }
138429
138695
  }
138430
138696
  return { total: { added, deleted }, byPath };
@@ -138479,7 +138745,7 @@ function readGitStatus(ports, cwd, query) {
138479
138745
  }
138480
138746
 
138481
138747
  // src/statusline/vcs/jj.ts
138482
- var import_node_path57 = __toESM(require("node:path"), 1);
138748
+ var import_node_path59 = __toESM(require("node:path"), 1);
138483
138749
  var JJ2 = "jj";
138484
138750
  var MAX_WALK_DEPTH = 64;
138485
138751
  var MAX_LABEL_CODE_POINTS = 64;
@@ -138492,13 +138758,13 @@ function isJjRepository(ports, cwd) {
138492
138758
  return false;
138493
138759
  }
138494
138760
  for (let depth = 0; depth < MAX_WALK_DEPTH; depth += 1) {
138495
- if (ports.entryKind(import_node_path57.default.join(directory, ".jj")) === "directory") {
138761
+ if (ports.entryKind(import_node_path59.default.join(directory, ".jj")) === "directory") {
138496
138762
  return true;
138497
138763
  }
138498
- if (ports.entryKind(import_node_path57.default.join(directory, ".git")) !== void 0) {
138764
+ if (ports.entryKind(import_node_path59.default.join(directory, ".git")) !== void 0) {
138499
138765
  return false;
138500
138766
  }
138501
- const parent = import_node_path57.default.dirname(directory);
138767
+ const parent = import_node_path59.default.dirname(directory);
138502
138768
  if (parent === directory) {
138503
138769
  return false;
138504
138770
  }
@@ -138693,9 +138959,137 @@ function gitFilesRow(context) {
138693
138959
  return { kind: "text", lines: [entries.join(" ")] };
138694
138960
  }
138695
138961
 
138696
- // src/statusline/elements/rows/quota.ts
138697
- init_statusline();
138698
- init_pick();
138962
+ // src/statusline/configCounts.ts
138963
+ var import_node_path60 = __toESM(require("node:path"), 1);
138964
+ init_zod();
138965
+ var nameList = external_exports.array(external_exports.unknown()).catch([]).transform((items) => items.filter((item) => typeof item === "string"));
138966
+ var ConfigFileSchema = external_exports.looseObject({
138967
+ mcpServers: external_exports.record(external_exports.string(), external_exports.unknown()).optional().catch(void 0),
138968
+ hooks: external_exports.record(external_exports.string(), external_exports.unknown()).optional().catch(void 0),
138969
+ disabledMcpServers: nameList.optional(),
138970
+ disabledMcpjsonServers: nameList.optional()
138971
+ });
138972
+ var MAX_RULE_DIRECTORIES = 1e3;
138973
+ var MAX_RULE_ENTRIES = 1e4;
138974
+ var BYTES_PER_MEBIBYTE = 1048576;
138975
+ var MAX_CONFIG_FILE_MEBIBYTES = 8;
138976
+ var MAX_CONFIG_FILE_BYTES = MAX_CONFIG_FILE_MEBIBYTES * BYTES_PER_MEBIBYTE;
138977
+ function readConfigFile(ports, file2) {
138978
+ const size = ports.readRange(file2, 0, 0)?.size;
138979
+ if (size === void 0 || size > MAX_CONFIG_FILE_BYTES) {
138980
+ return void 0;
138981
+ }
138982
+ const text4 = ports.readText(file2);
138983
+ if (text4 === void 0) {
138984
+ return void 0;
138985
+ }
138986
+ let raw;
138987
+ try {
138988
+ raw = JSON.parse(text4);
138989
+ } catch {
138990
+ return void 0;
138991
+ }
138992
+ const parsed = ConfigFileSchema.safeParse(raw);
138993
+ return parsed.success ? parsed.data : void 0;
138994
+ }
138995
+ function namesOf(file2) {
138996
+ return new Set(file2?.mcpServers === void 0 ? [] : Object.keys(file2.mcpServers));
138997
+ }
138998
+ function hookEventsOf(file2) {
138999
+ return file2?.hooks === void 0 ? 0 : Object.keys(file2.hooks).length;
139000
+ }
139001
+ function removeNames(servers, names) {
139002
+ if (names === void 0) {
139003
+ return;
139004
+ }
139005
+ for (const name of names) {
139006
+ servers.delete(name);
139007
+ }
139008
+ }
139009
+ function followedKind(ports, target) {
139010
+ const real = ports.realPath(target);
139011
+ return real === void 0 ? void 0 : ports.entryKind(real);
139012
+ }
139013
+ function isFile(ports, file2) {
139014
+ return followedKind(ports, file2) === "other";
139015
+ }
139016
+ function countRules(ports, root) {
139017
+ const visited = /* @__PURE__ */ new Set();
139018
+ let entries = 0;
139019
+ let directories = 0;
139020
+ const walk3 = (directory) => {
139021
+ const real = ports.realPath(directory);
139022
+ if (real === void 0 || visited.has(real) || directories >= MAX_RULE_DIRECTORIES) {
139023
+ return 0;
139024
+ }
139025
+ visited.add(real);
139026
+ directories += 1;
139027
+ const names = ports.listDirectory(real);
139028
+ if (names === void 0) {
139029
+ return 0;
139030
+ }
139031
+ let count = 0;
139032
+ for (const name of names) {
139033
+ if (entries >= MAX_RULE_ENTRIES) {
139034
+ break;
139035
+ }
139036
+ entries += 1;
139037
+ const entry = import_node_path60.default.join(real, name);
139038
+ const kind = followedKind(ports, entry);
139039
+ if (kind === "directory") {
139040
+ count += walk3(entry);
139041
+ } else if (kind === "other" && name.endsWith(".md")) {
139042
+ const target = ports.realPath(entry);
139043
+ if (target !== void 0 && !visited.has(target)) {
139044
+ visited.add(target);
139045
+ count += 1;
139046
+ }
139047
+ }
139048
+ }
139049
+ return count;
139050
+ };
139051
+ return walk3(root);
139052
+ }
139053
+ 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));
139055
+ }
139056
+ function configDirectoryOf(ports) {
139057
+ const pinned = ports.env.CLAUDE_CONFIG_DIR;
139058
+ return pinned === void 0 || pinned === "" ? import_node_path60.default.join(ports.homeDirectory, ".claude") : pinned;
139059
+ }
139060
+ function countConfiguration(ports, projectDirectory) {
139061
+ 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");
139064
+ const global2 = readConfigFile(ports, globalFile);
139065
+ const userServers = /* @__PURE__ */ new Set([...namesOf(userSettings), ...namesOf(global2)]);
139066
+ removeNames(userServers, global2?.disabledMcpServers);
139067
+ 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"));
139070
+ let hookEvents = hookEventsOf(userSettings);
139071
+ if (projectDirectory !== void 0) {
139072
+ const projectClaude = import_node_path60.default.join(projectDirectory, ".claude");
139073
+ 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")]];
139075
+ claudeMd += claudeMdFiles.filter((file2) => isFile(ports, file2)).length;
139076
+ const mcpJson = namesOf(readConfigFile(ports, import_node_path60.default.join(projectDirectory, ".mcp.json")));
139077
+ 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"));
139081
+ hookEvents += hookEventsOf(settings2) + hookEventsOf(local);
139082
+ for (const name of [...namesOf(settings2), ...namesOf(local)]) {
139083
+ projectServers.add(name);
139084
+ }
139085
+ removeNames(mcpJson, local?.disabledMcpjsonServers);
139086
+ }
139087
+ for (const name of mcpJson) {
139088
+ projectServers.add(name);
139089
+ }
139090
+ }
139091
+ return { claudeMd, rules, mcpServers: userServers.size + projectServers.size, hookEvents };
139092
+ }
138699
139093
 
138700
139094
  // src/statusline/headerLayout.ts
138701
139095
  var SEPARATOR2 = " | ";
@@ -138764,6 +139158,38 @@ function layoutHeader(texts, maxWidth, separator) {
138764
139158
  return packLines(texts, maxWidth, separator).map((line) => justify(line, maxWidth, separator)).join("\n");
138765
139159
  }
138766
139160
 
139161
+ // src/statusline/elements/rows/environment.ts
139162
+ function counted(count, singular, plural2) {
139163
+ return count === 0 ? void 0 : `${String(count)} ${count === 1 ? singular : plural2}`;
139164
+ }
139165
+ function environmentRow(context) {
139166
+ const { payload, settings: settings2, palette, ports } = context;
139167
+ const counts = countConfiguration(ports, payload.cwd ?? payload.workspace?.current_dir);
139168
+ const total = counts.claudeMd + counts.rules + counts.mcpServers + counts.hookEvents;
139169
+ if (total === 0 || total < settings2.environment.threshold) {
139170
+ return { kind: "text", lines: [] };
139171
+ }
139172
+ const parts = [counted(counts.claudeMd, "CLAUDE.md", "CLAUDE.md"), counted(counts.rules, "rule", "rules"), counted(counts.mcpServers, "MCP", "MCPs"), counted(counts.hookEvents, "hook", "hooks")].filter((part) => part !== void 0);
139173
+ return { kind: "text", lines: packLines(parts.map((part) => palette.paint("label", part)), context.width, SEPARATOR2).map((line) => line.join(SEPARATOR2)) };
139174
+ }
139175
+
139176
+ // src/statusline/elements/rows/memory.ts
139177
+ function memoryRow(context) {
139178
+ const use2 = context.ports.memoryUse();
139179
+ const cells = [];
139180
+ if (use2 !== void 0 && use2.totalBytes > 0) {
139181
+ const style = barStyleOf(context, "usage");
139182
+ const fraction = Math.max(0, Math.min(1, use2.usedBytes / use2.totalBytes));
139183
+ const percent2 = withColor(statusColor(fraction, true, style), `${(fraction * FULL_PERCENT3).toFixed(1)}%`);
139184
+ cells.push(barCell(context.palette.paint("label", "RAM "), ` ${percent2} (${formatBytes(use2.usedBytes)} / ${formatBytes(use2.totalBytes)})`, fraction, style));
139185
+ }
139186
+ return { kind: "bars", cells };
139187
+ }
139188
+
139189
+ // src/statusline/elements/rows/quota.ts
139190
+ init_statusline();
139191
+ init_pick();
139192
+
138767
139193
  // src/statusline/wallClock.ts
138768
139194
  var DAY_KEY_LOCALE = "en-CA";
138769
139195
  var FORMATTERS = /* @__PURE__ */ new Map();
@@ -138921,11 +139347,13 @@ var HEADER_ROLES = {
138921
139347
  effort: "model",
138922
139348
  advisor: "label",
138923
139349
  version: "label",
138924
- outputStyle: "label"
139350
+ outputStyle: "label",
139351
+ cost: "label",
139352
+ dailyCost: "label"
138925
139353
  };
138926
139354
  var ELEMENTS = {
138927
- 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 },
138928
- rows: { context: contextRow, quota: quotaRow, addedDirs: addedDirsRow, gitFiles: gitFilesRow }
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 }
138929
139357
  };
138930
139358
 
138931
139359
  // src/statusline/identityTranscript.ts
@@ -139125,7 +139553,7 @@ function registerStatuslineCommand(program2, deps) {
139125
139553
  } else {
139126
139554
  const configDir = process.env.CLAUDE_CONFIG_DIR;
139127
139555
  try {
139128
- account = readAccountMetadataFile(realFarmFs, configDir === void 0 || configDir === "" ? import_node_path58.default.join(import_node_os13.default.homedir(), ".claude.json") : import_node_path58.default.join(configDir, ".claude.json"));
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"));
139129
139557
  } catch {
139130
139558
  account = void 0;
139131
139559
  }
@@ -139162,17 +139590,24 @@ function registerStatuslineCommand(program2, deps) {
139162
139590
  routedTarget = void 0;
139163
139591
  }
139164
139592
  }
139165
- const { payload: enriched, summary } = enrichStatuslinePayload({ payload, env: process.env, snapshot, account, providerName, nowMs, headroom, routedTarget, ...modelChoice === void 0 ? {} : { modelChoice } });
139593
+ const clientPayload = parseClientPayload(payload);
139594
+ const enrichParams = { payload, env: process.env, snapshot, account, providerName, nowMs, headroom, routedTarget, ...modelChoice === void 0 ? {} : { modelChoice } };
139166
139595
  const renderer = process.env.AGENT_SHIM_STATUSLINE_CMD;
139167
139596
  if (renderer !== void 0 && renderer !== "") {
139168
139597
  const child = (0, import_node_child_process8.spawn)("/bin/sh", ["-c", renderer], { stdio: ["pipe", "inherit", "inherit"] });
139169
- child.stdin.end(`${JSON.stringify(enriched)}
139598
+ child.stdin.end(`${JSON.stringify(enrichStatuslinePayload(enrichParams).payload)}
139170
139599
  `);
139171
139600
  child.on("close", (code) => {
139172
139601
  process.exit(code ?? 0);
139173
139602
  });
139174
139603
  return;
139175
139604
  }
139605
+ const rawSettings = process.env[STATUSLINE_ENV];
139606
+ const settings2 = resolveStatusline(rawSettings === void 0 || rawSettings === "" ? void 0 : statuslineSettingsFromEnv(rawSettings, STATUSLINE_ENV));
139607
+ const conversationId = clientPayload.session_id;
139608
+ const prices = settings2.layout.header.some((name) => name === "cost" || name === "dailyCost") ? readModels(deps.paths)?.prices : void 0;
139609
+ const doorCostUsd = prices === void 0 || conversationId === void 0 ? void 0 : readDoorCostUsd({ fs: realFarmFs, logDir: deps.paths.usageLogDir, prices, conversationId, nowMs, sessionDurationMs: clientPayload.cost?.total_duration_ms });
139610
+ const { summary } = enrichStatuslinePayload({ ...enrichParams, ...doorCostUsd === void 0 ? {} : { doorCostUsd } });
139176
139611
  let stackedUnderDefault = false;
139177
139612
  if (isAntigravityPayload(payload)) {
139178
139613
  try {
@@ -139181,11 +139616,8 @@ function registerStatuslineCommand(program2, deps) {
139181
139616
  stackedUnderDefault = false;
139182
139617
  }
139183
139618
  }
139184
- const clientPayload = parseClientPayload(payload);
139185
139619
  const view = { ...viewOf(clientPayload), ...stackedUnderDefault ? { modelDisplayName: void 0 } : {} };
139186
- const rawSettings = process.env[STATUSLINE_ENV];
139187
- const settings2 = resolveStatusline(rawSettings === void 0 || rawSettings === "" ? void 0 : statuslineSettingsFromEnv(rawSettings, STATUSLINE_ENV));
139188
- console.log(renderStatuslineBlock({ summary, view, payload: clientPayload, terminalWidth: terminalWidthOf(payload, process.env), nowMs, settings: settings2, ports: realStatuslinePorts(process.env) }));
139620
+ console.log(renderStatuslineBlock({ summary, view, payload: clientPayload, terminalWidth: terminalWidthOf(payload, process.env), nowMs, settings: settings2, ports: realStatuslinePorts(process.env, deps.paths.statuslineDir) }));
139189
139621
  }),
139190
139622
  ["$ agent-shim statusline # a client's statusline setting names this; it renders or delegates"]
139191
139623
  );
@@ -141222,8 +141654,8 @@ function getErrorMap2() {
141222
141654
 
141223
141655
  // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v3/helpers/parseUtil.js
141224
141656
  var makeIssue = (params) => {
141225
- const { data, path: path68, errorMaps, issueData } = params;
141226
- const fullPath = [...path68, ...issueData.path || []];
141657
+ const { data, path: path71, errorMaps, issueData } = params;
141658
+ const fullPath = [...path71, ...issueData.path || []];
141227
141659
  const fullIssue = {
141228
141660
  ...issueData,
141229
141661
  path: fullPath
@@ -141338,11 +141770,11 @@ var errorUtil;
141338
141770
 
141339
141771
  // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v3/types.js
141340
141772
  var ParseInputLazyPath = class {
141341
- constructor(parent, value2, path68, key) {
141773
+ constructor(parent, value2, path71, key) {
141342
141774
  this._cachedPath = [];
141343
141775
  this.parent = parent;
141344
141776
  this.data = value2;
141345
- this._path = path68;
141777
+ this._path = path71;
141346
141778
  this._key = key;
141347
141779
  }
141348
141780
  get path() {
@@ -144905,11 +145337,11 @@ function normalizeObjectSchema(schema) {
144905
145337
  }
144906
145338
  return void 0;
144907
145339
  }
144908
- function getDotPath(path68) {
144909
- if (path68.length === 0) {
145340
+ function getDotPath(path71) {
145341
+ if (path71.length === 0) {
144910
145342
  return "object root";
144911
145343
  }
144912
- return path68.reduce((acc, seg, index) => {
145344
+ return path71.reduce((acc, seg, index) => {
144913
145345
  if (index === 0) {
144914
145346
  return String(seg);
144915
145347
  }
@@ -148952,7 +149384,7 @@ async function serveMcp(mcp, transport, options = {}) {
148952
149384
 
148953
149385
  // src/mcp/permissions.ts
148954
149386
  var import_node_fs23 = __toESM(require("node:fs"), 1);
148955
- var import_node_path59 = __toESM(require("node:path"), 1);
149387
+ var import_node_path62 = __toESM(require("node:path"), 1);
148956
149388
  init_zod();
148957
149389
  init_store();
148958
149390
  var StoredMcpPermissionsSchema = external_exports.strictObject({
@@ -148974,10 +149406,10 @@ function effectiveMcpPermissions(flags, stored) {
148974
149406
  return { writes: flags.writes || stored.writes, remoteControl: flags.remoteControl || stored.remoteControl, history: flags.history || stored.history };
148975
149407
  }
148976
149408
  function watchMcpPermissions(paths, onChange) {
148977
- const directory = import_node_path59.default.dirname(paths.mcpPermissionsFile);
149409
+ const directory = import_node_path62.default.dirname(paths.mcpPermissionsFile);
148978
149410
  import_node_fs23.default.mkdirSync(directory, { recursive: true });
148979
149411
  const watcher = import_node_fs23.default.watch(directory, (_event, filename) => {
148980
- if (filename === null || filename === import_node_path59.default.basename(paths.mcpPermissionsFile)) {
149412
+ if (filename === null || filename === import_node_path62.default.basename(paths.mcpPermissionsFile)) {
148981
149413
  onChange();
148982
149414
  }
148983
149415
  });
@@ -149291,16 +149723,16 @@ init_credentialCache();
149291
149723
 
149292
149724
  // src/identityToken.ts
149293
149725
  var import_node_fs24 = __toESM(require("node:fs"), 1);
149294
- var import_node_path60 = __toESM(require("node:path"), 1);
149726
+ var import_node_path63 = __toESM(require("node:path"), 1);
149295
149727
  init_cliError();
149296
149728
  var TOKEN_FILE_MODE = 384;
149297
149729
  var TOKEN_DIR_MODE = 448;
149298
149730
  var OAUTH_TOKEN_RE = /^sk-ant-oat\d+-[A-Za-z0-9_-]+$/;
149299
149731
  function identityTokenDir(paths) {
149300
- return import_node_path60.default.join(paths.root, "credentials");
149732
+ return import_node_path63.default.join(paths.root, "credentials");
149301
149733
  }
149302
149734
  function identityTokenPath(paths, identityName) {
149303
- return import_node_path60.default.join(identityTokenDir(paths), `${identityName}.token`);
149735
+ return import_node_path63.default.join(identityTokenDir(paths), `${identityName}.token`);
149304
149736
  }
149305
149737
  function storeIdentityToken(paths, identityName, raw) {
149306
149738
  const token = raw.trim();
@@ -149311,7 +149743,7 @@ function storeIdentityToken(paths, identityName, raw) {
149311
149743
  import_node_fs24.default.mkdirSync(dir, { recursive: true, mode: TOKEN_DIR_MODE });
149312
149744
  import_node_fs24.default.chmodSync(dir, TOKEN_DIR_MODE);
149313
149745
  const target = identityTokenPath(paths, identityName);
149314
- const temp = import_node_path60.default.join(dir, `.${identityName}.${String(process.pid)}.tmp`);
149746
+ const temp = import_node_path63.default.join(dir, `.${identityName}.${String(process.pid)}.tmp`);
149315
149747
  import_node_fs24.default.writeFileSync(temp, `${token}
149316
149748
  `, { mode: TOKEN_FILE_MODE });
149317
149749
  import_node_fs24.default.renameSync(temp, target);
@@ -149482,7 +149914,7 @@ function registerDoctorCommand(program2, deps) {
149482
149914
  // src/headroom/commands.ts
149483
149915
  var import_node_fs25 = __toESM(require("node:fs"), 1);
149484
149916
  var import_node_http5 = __toESM(require("node:http"), 1);
149485
- var import_node_path61 = __toESM(require("node:path"), 1);
149917
+ var import_node_path64 = __toESM(require("node:path"), 1);
149486
149918
  var import_node_child_process10 = require("node:child_process");
149487
149919
  init_commandDeps();
149488
149920
  init_configProfilesStore();
@@ -149672,12 +150104,12 @@ function readInstalledHeadroomCommit() {
149672
150104
  if (toolDir.status !== 0) {
149673
150105
  return void 0;
149674
150106
  }
149675
- const libDir = import_node_path61.default.join(toolDir.stdout.trim(), HEADROOM_TOOL_NAME, "lib");
150107
+ const libDir = import_node_path64.default.join(toolDir.stdout.trim(), HEADROOM_TOOL_NAME, "lib");
149676
150108
  for (const python of realFarmFs.readdir(libDir)) {
149677
- const sitePackages = import_node_path61.default.join(libDir, python, "site-packages");
150109
+ const sitePackages = import_node_path64.default.join(libDir, python, "site-packages");
149678
150110
  for (const entry of realFarmFs.readdir(sitePackages)) {
149679
150111
  if (entry.startsWith("headroom_ai-") && entry.endsWith(".dist-info")) {
149680
- const directUrl = realFarmFs.readFileUtf8(import_node_path61.default.join(sitePackages, entry, "direct_url.json"));
150112
+ const directUrl = realFarmFs.readFileUtf8(import_node_path64.default.join(sitePackages, entry, "direct_url.json"));
149681
150113
  return directUrl === void 0 ? void 0 : parseInstalledCommit(directUrl);
149682
150114
  }
149683
150115
  }
@@ -149933,7 +150365,7 @@ async function refreshCatalogueForReal(paths, name, env) {
149933
150365
  init_realPorts();
149934
150366
 
149935
150367
  // src/usage/realJobRunner.ts
149936
- var import_node_path62 = __toESM(require("node:path"), 1);
150368
+ var import_node_path65 = __toESM(require("node:path"), 1);
149937
150369
  init_conditions();
149938
150370
  init_identityClaude();
149939
150371
  var JOB_LAUNCH_FLAGS = ["--no-headroom", "--no-remote-control", "--track-usage"];
@@ -149946,7 +150378,7 @@ ${outcome.trimEnd()}
149946
150378
  }
149947
150379
  function createRealJobRunner(params) {
149948
150380
  return async (name, identity, job) => {
149949
- const logFile = import_node_path62.default.join(params.paths.jobLogsDir, `${name}.log`);
150381
+ const logFile = import_node_path65.default.join(params.paths.jobLogsDir, `${name}.log`);
149950
150382
  const append = (outcome) => {
149951
150383
  params.fs.mkdirPrivate(params.paths.jobLogsDir);
149952
150384
  params.fs.appendFilePrivate(logFile, logEntry(name, identity, params.now(), outcome));
@@ -150003,7 +150435,7 @@ function registerHeadlessCommands(program2, deps) {
150003
150435
  }
150004
150436
 
150005
150437
  // src/jobs.ts
150006
- var import_node_path63 = __toESM(require("node:path"), 1);
150438
+ var import_node_path66 = __toESM(require("node:path"), 1);
150007
150439
  init_commandDeps();
150008
150440
  init_cliError();
150009
150441
  init_schema();
@@ -150028,7 +150460,7 @@ function jobOf(options) {
150028
150460
  target: options.identity === void 0 ? { pool: options.pool ?? "" } : { identity: options.identity },
150029
150461
  trigger: options.at === void 0 ? { beforeReset: options.beforeReset ?? "fiveHour", lead: options.lead ?? "" } : { at: options.at },
150030
150462
  prompt: options.prompt,
150031
- cwd: import_node_path63.default.resolve(options.cwd ?? process.cwd()),
150463
+ cwd: import_node_path66.default.resolve(options.cwd ?? process.cwd()),
150032
150464
  timeout: options.timeout,
150033
150465
  ...options.model === void 0 ? {} : { model: options.model },
150034
150466
  ...options.allowedTool === void 0 ? {} : { allowedTools: options.allowedTool }
@@ -150101,7 +150533,7 @@ function registerJobCommand(program2, deps) {
150101
150533
  console.log(`Allowed tools: ${entry.allowedTools.join(", ")}`);
150102
150534
  }
150103
150535
  console.log(`Prompt: ${entry.prompt}`);
150104
- console.log(`Results: ${import_node_path63.default.join(paths.jobLogsDir, `${name}.log`)}`);
150536
+ console.log(`Results: ${import_node_path66.default.join(paths.jobLogsDir, `${name}.log`)}`);
150105
150537
  }),
150106
150538
  ["agent-shim job show digest"]
150107
150539
  );
@@ -150124,7 +150556,7 @@ function registerJobCommand(program2, deps) {
150124
150556
  throw new UsageError(`No member of the job's pool can be picked right now.`);
150125
150557
  }
150126
150558
  await createRealJobRunner({ paths, spawnDaemon: spawnDetachedSupervisor, fs: realFarmFs, now: () => /* @__PURE__ */ new Date() })(name, identity, entry);
150127
- console.log(`Ran job "${name}" as ${identity}; the result is in ${import_node_path63.default.join(paths.jobLogsDir, `${name}.log`)}.`);
150559
+ console.log(`Ran job "${name}" as ${identity}; the result is in ${import_node_path66.default.join(paths.jobLogsDir, `${name}.log`)}.`);
150128
150560
  }),
150129
150561
  ["agent-shim job run digest"]
150130
150562
  );
@@ -150288,7 +150720,7 @@ init_providerAliases();
150288
150720
 
150289
150721
  // src/providerRename.ts
150290
150722
  var import_node_fs26 = __toESM(require("node:fs"), 1);
150291
- var import_node_path64 = __toESM(require("node:path"), 1);
150723
+ var import_node_path67 = __toESM(require("node:path"), 1);
150292
150724
  init_schema();
150293
150725
  init_store();
150294
150726
  init_load();
@@ -150405,7 +150837,7 @@ function rewriteReferences(paths, from, to2) {
150405
150837
  const launch = renamedLaunch(profile.launch, from, to2);
150406
150838
  const models = profile.models === void 0 ? void 0 : renamedModels(profile.models, from, to2);
150407
150839
  if (launch !== void 0 || models !== void 0) {
150408
- applyPatch(import_node_path64.default.join(paths.configProfilesDir, `${name}.json`), ConfigProfileSchema, { ...launch === void 0 ? {} : { launch }, ...models === void 0 ? {} : { models } });
150840
+ applyPatch(import_node_path67.default.join(paths.configProfilesDir, `${name}.json`), ConfigProfileSchema, { ...launch === void 0 ? {} : { launch }, ...models === void 0 ? {} : { models } });
150409
150841
  rewritten.push(`profile ${name}`);
150410
150842
  }
150411
150843
  }
@@ -151232,7 +151664,7 @@ function registerSessionCommands(program2, deps) {
151232
151664
  }
151233
151665
 
151234
151666
  // src/usage/commands.ts
151235
- var import_node_path65 = __toESM(require("node:path"), 1);
151667
+ var import_node_path68 = __toESM(require("node:path"), 1);
151236
151668
  init_commandDeps();
151237
151669
  init_realPorts();
151238
151670
  init_account();
@@ -151371,7 +151803,7 @@ function collectAccounts(fs30, paths, identity, probe) {
151371
151803
  return names.map((name) => ({
151372
151804
  identity: name,
151373
151805
  account: readAccountMetadata(fs30, paths.identitiesDir, name),
151374
- signIn: identitySignIn(fs30, probe, { farmRoot: import_node_path65.default.join(paths.identitiesDir, name), hasCredentialBlock: readIdentity(paths, name)?.credential !== void 0 }),
151806
+ signIn: identitySignIn(fs30, probe, { farmRoot: import_node_path68.default.join(paths.identitiesDir, name), hasCredentialBlock: readIdentity(paths, name)?.credential !== void 0 }),
151375
151807
  usage: readUsageSnapshot(fs30, paths.usageSnapshotsDir, name)
151376
151808
  }));
151377
151809
  }
@@ -151778,7 +152210,7 @@ function quotaHitOf(fs30, paths, identity, sessionId, sinceMs, nowMs) {
151778
152210
  }
151779
152211
 
151780
152212
  // src/supervise/move.ts
151781
- var import_node_path66 = __toESM(require("node:path"), 1);
152213
+ var import_node_path69 = __toESM(require("node:path"), 1);
151782
152214
  init_lock();
151783
152215
  init_poolPick();
151784
152216
  init_read();
@@ -151824,7 +152256,7 @@ function createMover(deps) {
151824
152256
  if (resolution.identity === request7.from) {
151825
152257
  return { kind: "stay", reason: `no other member of pool "${pool}" can take it` };
151826
152258
  }
151827
- const transcript = import_node_path66.default.join(paths.identitiesDir, resolution.identity, "projects", projectDirNameOf(deps.cwd), `${request7.sessionId}.jsonl`);
152259
+ const transcript = import_node_path69.default.join(paths.identitiesDir, resolution.identity, "projects", projectDirNameOf(deps.cwd), `${request7.sessionId}.jsonl`);
151828
152260
  if (farmFs.lstat(transcript)?.kind !== "file") {
151829
152261
  return { kind: "stay", reason: `${resolution.identity} does not share this conversation's history, so it could not resume it` };
151830
152262
  }
@@ -151858,13 +152290,13 @@ function createIdentityMover(deps) {
151858
152290
  throw error63;
151859
152291
  }
151860
152292
  try {
151861
- if (farmFs.readFileUtf8(import_node_path66.default.join(paths.identitiesDir, request7.to, "identity.json")) === void 0) {
152293
+ if (farmFs.readFileUtf8(import_node_path69.default.join(paths.identitiesDir, request7.to, "identity.json")) === void 0) {
151862
152294
  return { kind: "stay", reason: `no identity "${request7.to}"` };
151863
152295
  }
151864
152296
  if (request7.to === request7.from) {
151865
152297
  return { kind: "stay", reason: `the model already runs under this session's identity` };
151866
152298
  }
151867
- const transcript = import_node_path66.default.join(paths.identitiesDir, request7.to, "projects", projectDirNameOf(deps.cwd), `${request7.sessionId}.jsonl`);
152299
+ const transcript = import_node_path69.default.join(paths.identitiesDir, request7.to, "projects", projectDirNameOf(deps.cwd), `${request7.sessionId}.jsonl`);
151868
152300
  if (farmFs.lstat(transcript)?.kind !== "file") {
151869
152301
  return { kind: "stay", reason: `${request7.to} does not share this conversation's history, so it could not resume it` };
151870
152302
  }
@@ -152442,7 +152874,7 @@ async function runClaude(argvOverride) {
152442
152874
  // src/cli.ts
152443
152875
  async function main() {
152444
152876
  aliasLegacyEnv(process.env);
152445
- const invokedName = import_node_path67.default.basename(process.argv[1] ?? "agent-shim");
152877
+ const invokedName = import_node_path70.default.basename(process.argv[1] ?? "agent-shim");
152446
152878
  if (isInvokedAsClaude(invokedName)) {
152447
152879
  await runClaude();
152448
152880
  return;