claude-use 9.16.0 → 9.18.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, path54) {
322
- if (!path54)
321
+ function getElementAtPath(obj, path56) {
322
+ if (!path56)
323
323
  return obj;
324
- return path54.reduce((acc, key) => acc?.[key], obj);
324
+ return path56.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(path54, issues) {
583
+ function prefixIssues(path56, issues) {
584
584
  return issues.map((iss) => {
585
585
  var _a4;
586
586
  (_a4 = iss).path ?? (_a4.path = []);
587
- iss.path.unshift(path54);
587
+ iss.path.unshift(path56);
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, path54 = []) => {
1108
+ const processError = (error64, path56 = []) => {
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 }, [...path54, ...issue2.path]));
1111
+ issue2.errors.map((issues) => processError({ issues }, [...path56, ...issue2.path]));
1112
1112
  } else if (issue2.code === "invalid_key") {
1113
- processError({ issues: issue2.issues }, [...path54, ...issue2.path]);
1113
+ processError({ issues: issue2.issues }, [...path56, ...issue2.path]);
1114
1114
  } else if (issue2.code === "invalid_element") {
1115
- processError({ issues: issue2.issues }, [...path54, ...issue2.path]);
1115
+ processError({ issues: issue2.issues }, [...path56, ...issue2.path]);
1116
1116
  } else {
1117
- const fullpath = [...path54, ...issue2.path];
1117
+ const fullpath = [...path56, ...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, path54 = []) => {
1156
+ const processError = (error64, path56 = []) => {
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 }, [...path54, ...issue2.path]));
1160
+ issue2.errors.map((issues) => processError({ issues }, [...path56, ...issue2.path]));
1161
1161
  } else if (issue2.code === "invalid_key") {
1162
- processError({ issues: issue2.issues }, [...path54, ...issue2.path]);
1162
+ processError({ issues: issue2.issues }, [...path56, ...issue2.path]);
1163
1163
  } else if (issue2.code === "invalid_element") {
1164
- processError({ issues: issue2.issues }, [...path54, ...issue2.path]);
1164
+ processError({ issues: issue2.issues }, [...path56, ...issue2.path]);
1165
1165
  } else {
1166
- const fullpath = [...path54, ...issue2.path];
1166
+ const fullpath = [...path56, ...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 path54 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1206
- for (const seg of path54) {
1205
+ const path56 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1206
+ for (const seg of path56) {
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 path54 = ref.slice(1).split("/").filter(Boolean);
19203
- if (path54.length === 0) {
19202
+ const path56 = ref.slice(1).split("/").filter(Boolean);
19203
+ if (path56.length === 0) {
19204
19204
  return ctx.rootSchema;
19205
19205
  }
19206
19206
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
19207
- if (path54[0] === defsKey) {
19208
- const key = path54[1] === void 0 ? void 0 : decodeJSONPointerSegment(path54[1]);
19207
+ if (path56[0] === defsKey) {
19208
+ const key = path56[1] === void 0 ? void 0 : decodeJSONPointerSegment(path56[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 path54 = require("path");
23715
+ var path56 = require("path");
23716
23716
  var os12 = require("os");
23717
23717
  var homedir = os12.homedir();
23718
23718
  var tmpdir = os12.tmpdir();
23719
23719
  var { env } = process;
23720
23720
  var macos = (name) => {
23721
- const library = path54.join(homedir, "Library");
23721
+ const library = path56.join(homedir, "Library");
23722
23722
  return {
23723
- data: path54.join(library, "Application Support", name),
23724
- config: path54.join(library, "Preferences", name),
23725
- cache: path54.join(library, "Caches", name),
23726
- log: path54.join(library, "Logs", name),
23727
- temp: path54.join(tmpdir, name)
23723
+ data: path56.join(library, "Application Support", name),
23724
+ config: path56.join(library, "Preferences", name),
23725
+ cache: path56.join(library, "Caches", name),
23726
+ log: path56.join(library, "Logs", name),
23727
+ temp: path56.join(tmpdir, name)
23728
23728
  };
23729
23729
  };
23730
23730
  var windows = (name) => {
23731
- const appData = env.APPDATA || path54.join(homedir, "AppData", "Roaming");
23732
- const localAppData = env.LOCALAPPDATA || path54.join(homedir, "AppData", "Local");
23731
+ const appData = env.APPDATA || path56.join(homedir, "AppData", "Roaming");
23732
+ const localAppData = env.LOCALAPPDATA || path56.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: path54.join(localAppData, name, "Data"),
23736
- config: path54.join(appData, name, "Config"),
23737
- cache: path54.join(localAppData, name, "Cache"),
23738
- log: path54.join(localAppData, name, "Log"),
23739
- temp: path54.join(tmpdir, name)
23735
+ data: path56.join(localAppData, name, "Data"),
23736
+ config: path56.join(appData, name, "Config"),
23737
+ cache: path56.join(localAppData, name, "Cache"),
23738
+ log: path56.join(localAppData, name, "Log"),
23739
+ temp: path56.join(tmpdir, name)
23740
23740
  };
23741
23741
  };
23742
23742
  var linux = (name) => {
23743
- const username = path54.basename(homedir);
23743
+ const username = path56.basename(homedir);
23744
23744
  return {
23745
- data: path54.join(env.XDG_DATA_HOME || path54.join(homedir, ".local", "share"), name),
23746
- config: path54.join(env.XDG_CONFIG_HOME || path54.join(homedir, ".config"), name),
23747
- cache: path54.join(env.XDG_CACHE_HOME || path54.join(homedir, ".cache"), name),
23745
+ data: path56.join(env.XDG_DATA_HOME || path56.join(homedir, ".local", "share"), name),
23746
+ config: path56.join(env.XDG_CONFIG_HOME || path56.join(homedir, ".config"), name),
23747
+ cache: path56.join(env.XDG_CACHE_HOME || path56.join(homedir, ".cache"), name),
23748
23748
  // https://wiki.debian.org/XDGBaseDirectorySpecification#state
23749
- log: path54.join(env.XDG_STATE_HOME || path54.join(homedir, ".local", "state"), name),
23750
- temp: path54.join(tmpdir, username, name)
23749
+ log: path56.join(env.XDG_STATE_HOME || path56.join(homedir, ".local", "state"), name),
23750
+ temp: path56.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, path54) {
23819
- if (typeof path54 === "string" && Object.prototype.hasOwnProperty.call(source, path54)) {
23820
- return source[path54];
23818
+ function getPropertyByPath(source, path56) {
23819
+ if (typeof path56 === "string" && Object.prototype.hasOwnProperty.call(source, path56)) {
23820
+ return source[path56];
23821
23821
  }
23822
- const parsedPath = typeof path54 === "string" ? path54.split(".") : path54;
23822
+ const parsedPath = typeof path56 === "string" ? path56.split(".") : path56;
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(path54) {
23845
+ async function isDirectory(path56) {
23846
23846
  try {
23847
- const stat = await fs_1.promises.stat(path54);
23847
+ const stat = await fs_1.promises.stat(path56);
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(path54) {
23857
+ function isDirectorySync(path56) {
23858
23858
  try {
23859
- const stat = fs_1.default.statSync(path54);
23859
+ const stat = fs_1.default.statSync(path56);
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((path54, i10) => `${i10 + 1}. ${path54}`).join("\n")} (same as ${idx + 1}.)`);
23957
+ ${[...importStack, fullPath].map((path56, i10) => `${i10 + 1}. ${path56}`).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(path54) {
24145
+ async #fileExists(path56) {
24146
24146
  try {
24147
- await promises_1.default.stat(path54);
24147
+ await promises_1.default.stat(path56);
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(path54) {
24307
+ #fileExists(path56) {
24308
24308
  try {
24309
- fs_1.default.statSync(path54);
24309
+ fs_1.default.statSync(path56);
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((path54) => path54.replace("{name}", moduleName));
24433
+ const userConfiguredSearchPlaces = userConfiguredOptions.searchPlaces?.map((path56) => path56.replace("{name}", moduleName));
24434
24434
  if (userConfiguredOptions.mergeSearchPlaces) {
24435
24435
  return [...userConfiguredSearchPlaces ?? [], ...toolDefinedSearchPlaces];
24436
24436
  }
@@ -28941,8 +28941,8 @@ var require_utils = __commonJS({
28941
28941
  }
28942
28942
  return output2;
28943
28943
  };
28944
- exports2.basename = (path54, { windows } = {}) => {
28945
- const segs = path54.split(windows ? /[\\/]/ : "/");
28944
+ exports2.basename = (path56, { windows } = {}) => {
28945
+ const segs = path56.split(windows ? /[\\/]/ : "/");
28946
28946
  const last = segs[segs.length - 1];
28947
28947
  if (last === "") {
28948
28948
  return segs[segs.length - 2];
@@ -33317,7 +33317,7 @@ var init_package = __esm({
33317
33317
  "package.json"() {
33318
33318
  package_default = {
33319
33319
  name: "claude-use",
33320
- version: "9.16.0",
33320
+ version: "9.18.0",
33321
33321
  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.",
33322
33322
  license: "MIT",
33323
33323
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -33588,11 +33588,11 @@ function identifyRequest(headers) {
33588
33588
  function directOrigin(port) {
33589
33589
  return `http://127.0.0.1:${String(port)}`;
33590
33590
  }
33591
- function parseProviderPath(path54) {
33592
- if (!path54.startsWith(PROVIDER_PATH_PREFIX)) {
33591
+ function parseProviderPath(path56) {
33592
+ if (!path56.startsWith(PROVIDER_PATH_PREFIX)) {
33593
33593
  return void 0;
33594
33594
  }
33595
- const tail = path54.slice(PROVIDER_PATH_PREFIX.length);
33595
+ const tail = path56.slice(PROVIDER_PATH_PREFIX.length);
33596
33596
  const slash = tail.indexOf("/");
33597
33597
  if (slash <= 0) {
33598
33598
  return void 0;
@@ -33918,9 +33918,9 @@ function decoderFor(encoding) {
33918
33918
  return void 0;
33919
33919
  }
33920
33920
  }
33921
- function destinationOf(path54) {
33922
- const scoped = parseProviderPath(path54);
33923
- return scoped === void 0 ? { provider: ANTHROPIC_PROVIDER, endpoint: path54 } : { provider: scoped.provider, endpoint: scoped.rest };
33921
+ function destinationOf(path56) {
33922
+ const scoped = parseProviderPath(path56);
33923
+ return scoped === void 0 ? { provider: ANTHROPIC_PROVIDER, endpoint: path56 } : { provider: scoped.provider, endpoint: scoped.rest };
33924
33924
  }
33925
33925
  function buildRecord(event, context) {
33926
33926
  const { scan } = context;
@@ -34262,22 +34262,25 @@ function rankPool(input2) {
34262
34262
  return { ...candidate, feasible: true };
34263
34263
  }
34264
34264
  const drySpots = [];
34265
+ const dryAfterMs = [];
34265
34266
  if (fiveHour !== void 0 && pace !== void 0) {
34266
34267
  const runsDryInMs = fiveHour.remaining / pace;
34267
34268
  if (runsDryInMs < fiveHour.untilResetMs) {
34269
+ dryAfterMs.push(runsDryInMs);
34268
34270
  drySpots.push(`5h window would run dry in ${formatAge(runsDryInMs)}, before it resets in ${formatAge(fiveHour.untilResetMs)}`);
34269
34271
  }
34270
34272
  }
34271
34273
  if (sevenDay !== void 0 && sevenDayBurn !== void 0) {
34272
34274
  const runsDryInMs = sevenDay.remaining / sevenDayBurn;
34273
34275
  if (runsDryInMs < sevenDay.untilResetMs) {
34276
+ dryAfterMs.push(runsDryInMs);
34274
34277
  drySpots.push(`7d window would run dry in ${formatAge(runsDryInMs)}, before it resets in ${formatAge(sevenDay.untilResetMs)}`);
34275
34278
  }
34276
34279
  }
34277
34280
  if (drySpots.length === 0) {
34278
34281
  return { ...candidate, feasible: true };
34279
34282
  }
34280
- return { ...candidate, feasible: false, reasons: [...drySpots, ...candidate.reasons] };
34283
+ return { ...candidate, feasible: false, runsDryAtMs: nowMs + Math.min(...dryAfterMs), reasons: [...drySpots, ...candidate.reasons] };
34281
34284
  });
34282
34285
  const ordered = input2.preference === "listed" ? [...candidates] : [...candidates].sort(
34283
34286
  (left, right) => CLASS_ORDER[left.class] - CLASS_ORDER[right.class] || Number(left.policyDemoted ?? false) - Number(right.policyDemoted ?? false) || Number(right.feasible) - Number(left.feasible) || (right.headroom ?? 1) - (left.headroom ?? 1) || (right.score ?? 0) - (left.score ?? 0) || left.identity.localeCompare(right.identity)
@@ -34299,11 +34302,13 @@ function rankPool(input2) {
34299
34302
  const pick2 = ordered.find((candidate) => candidate.class !== "ineligible");
34300
34303
  const returns = ordered.flatMap((candidate) => candidate.blockedUntilMs === void 0 ? [] : [{ identity: candidate.identity, atMs: candidate.blockedUntilMs }]);
34301
34304
  const earliestReturn = returns.length === 0 ? void 0 : returns.reduce((soonest, entry) => entry.atMs < soonest.atMs ? entry : soonest);
34305
+ const holdForReturn = pick2?.runsDryAtMs === void 0 ? void 0 : returns.filter((entry) => entry.atMs < (pick2.runsDryAtMs ?? 0)).reduce((soonest, entry) => soonest === void 0 || entry.atMs < soonest.atMs ? entry : soonest, void 0);
34302
34306
  return {
34303
34307
  candidates: ordered,
34304
34308
  ...pick2 === void 0 ? { ...earliestReturn === void 0 ? {} : { earliestReturn } } : { pick: pick2 },
34305
34309
  ...movedOff === void 0 || pick2 === void 0 ? {} : { movedOff },
34306
- ...pick2?.planReturnsAtMs === void 0 ? {} : { planReturn: { identity: pick2.identity, atMs: pick2.planReturnsAtMs } }
34310
+ ...pick2?.planReturnsAtMs === void 0 ? {} : { planReturn: { identity: pick2.identity, atMs: pick2.planReturnsAtMs } },
34311
+ ...holdForReturn === void 0 ? {} : { holdForReturn }
34307
34312
  };
34308
34313
  }
34309
34314
  var MS_PER_SECOND4, MS_PER_HOUR2, HOURS_PER_DAY2, FIVE_HOURS, PROMPT_CACHE_TTL_HOURS, PERCENT, SEVEN_DAYS, FIVE_HOUR_WINDOW_MS, SEVEN_DAY_WINDOW_MS, PROMPT_CACHE_TTL_MS, CLASS_ORDER;
@@ -36356,14 +36361,14 @@ var require_util2 = __commonJS({
36356
36361
  }
36357
36362
  const port = url2.port != null ? url2.port : url2.protocol === "https:" ? 443 : 80;
36358
36363
  let origin = url2.origin != null ? url2.origin : `${url2.protocol || ""}//${url2.hostname || ""}:${port}`;
36359
- let path54 = url2.path != null ? url2.path : `${url2.pathname || ""}${url2.search || ""}`;
36364
+ let path56 = url2.path != null ? url2.path : `${url2.pathname || ""}${url2.search || ""}`;
36360
36365
  if (origin[origin.length - 1] === "/") {
36361
36366
  origin = origin.slice(0, origin.length - 1);
36362
36367
  }
36363
- if (path54 && path54[0] !== "/") {
36364
- path54 = `/${path54}`;
36368
+ if (path56 && path56[0] !== "/") {
36369
+ path56 = `/${path56}`;
36365
36370
  }
36366
- return new URL(`${origin}${path54}`);
36371
+ return new URL(`${origin}${path56}`);
36367
36372
  }
36368
36373
  if (!isHttpOrHttpsPrefixed(url2.origin || url2.protocol)) {
36369
36374
  throw new InvalidArgumentError2("Invalid URL protocol: the URL must start with `http:` or `https:`.");
@@ -37184,9 +37189,9 @@ var require_diagnostics = __commonJS({
37184
37189
  "undici:client:sendHeaders",
37185
37190
  (evt) => {
37186
37191
  const {
37187
- request: { method, path: path54, origin }
37192
+ request: { method, path: path56, origin }
37188
37193
  } = evt;
37189
- debugLog("sending request to %s %s%s", method, origin, path54);
37194
+ debugLog("sending request to %s %s%s", method, origin, path56);
37190
37195
  }
37191
37196
  );
37192
37197
  }
@@ -37204,14 +37209,14 @@ var require_diagnostics = __commonJS({
37204
37209
  "undici:request:headers",
37205
37210
  (evt) => {
37206
37211
  const {
37207
- request: { method, path: path54, origin },
37212
+ request: { method, path: path56, origin },
37208
37213
  response: { statusCode }
37209
37214
  } = evt;
37210
37215
  debugLog(
37211
37216
  "received response to %s %s%s - HTTP %d",
37212
37217
  method,
37213
37218
  origin,
37214
- path54,
37219
+ path56,
37215
37220
  statusCode
37216
37221
  );
37217
37222
  }
@@ -37220,23 +37225,23 @@ var require_diagnostics = __commonJS({
37220
37225
  "undici:request:trailers",
37221
37226
  (evt) => {
37222
37227
  const {
37223
- request: { method, path: path54, origin }
37228
+ request: { method, path: path56, origin }
37224
37229
  } = evt;
37225
- debugLog("trailers received from %s %s%s", method, origin, path54);
37230
+ debugLog("trailers received from %s %s%s", method, origin, path56);
37226
37231
  }
37227
37232
  );
37228
37233
  diagnosticsChannel.subscribe(
37229
37234
  "undici:request:error",
37230
37235
  (evt) => {
37231
37236
  const {
37232
- request: { method, path: path54, origin },
37237
+ request: { method, path: path56, origin },
37233
37238
  error: error63
37234
37239
  } = evt;
37235
37240
  debugLog(
37236
37241
  "request to %s %s%s errored - %s",
37237
37242
  method,
37238
37243
  origin,
37239
- path54,
37244
+ path56,
37240
37245
  error63.message
37241
37246
  );
37242
37247
  }
@@ -37351,7 +37356,7 @@ var require_request = __commonJS({
37351
37356
  var kHandler = /* @__PURE__ */ Symbol("handler");
37352
37357
  var Request2 = class {
37353
37358
  constructor(origin, {
37354
- path: path54,
37359
+ path: path56,
37355
37360
  method,
37356
37361
  body,
37357
37362
  headers,
@@ -37368,11 +37373,11 @@ var require_request = __commonJS({
37368
37373
  maxRedirections,
37369
37374
  typeOfService
37370
37375
  }, handler) {
37371
- if (typeof path54 !== "string") {
37376
+ if (typeof path56 !== "string") {
37372
37377
  throw new InvalidArgumentError2("path must be a string");
37373
- } else if (path54[0] !== "/" && !(path54.startsWith("http://") || path54.startsWith("https://")) && method !== "CONNECT") {
37378
+ } else if (path56[0] !== "/" && !(path56.startsWith("http://") || path56.startsWith("https://")) && method !== "CONNECT") {
37374
37379
  throw new InvalidArgumentError2("path must be an absolute URL or start with a slash");
37375
- } else if (invalidPathRegex.test(path54)) {
37380
+ } else if (invalidPathRegex.test(path56)) {
37376
37381
  throw new InvalidArgumentError2("invalid request path");
37377
37382
  }
37378
37383
  if (typeof method !== "string") {
@@ -37447,7 +37452,7 @@ var require_request = __commonJS({
37447
37452
  this.completed = false;
37448
37453
  this.aborted = false;
37449
37454
  this.upgrade = upgrade || null;
37450
- this.path = query ? serializePathWithQuery(path54, query) : path54;
37455
+ this.path = query ? serializePathWithQuery(path56, query) : path56;
37451
37456
  this.origin = origin;
37452
37457
  this.protocol = getProtocolFromUrlString(origin);
37453
37458
  this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent;
@@ -42629,7 +42634,7 @@ var require_client_h1 = __commonJS({
42629
42634
  return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT";
42630
42635
  }
42631
42636
  function writeH1(client, request7) {
42632
- const { method, path: path54, host, upgrade, blocking, reset } = request7;
42637
+ const { method, path: path56, host, upgrade, blocking, reset } = request7;
42633
42638
  let { body, headers, contentLength } = request7;
42634
42639
  const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH";
42635
42640
  if (util2.isFormDataLike(body)) {
@@ -42707,7 +42712,7 @@ var require_client_h1 = __commonJS({
42707
42712
  if (socket.setTypeOfService) {
42708
42713
  socket.setTypeOfService(request7.typeOfService);
42709
42714
  }
42710
- let header = `${method} ${path54} HTTP/1.1\r
42715
+ let header = `${method} ${path56} HTTP/1.1\r
42711
42716
  `;
42712
42717
  if (typeof host === "string") {
42713
42718
  header += `host: ${host}\r
@@ -43386,7 +43391,7 @@ var require_client_h2 = __commonJS({
43386
43391
  const headersTimeout = request7.headersTimeout ?? client[kHeadersTimeout];
43387
43392
  const bodyTimeout = request7.bodyTimeout ?? client[kBodyTimeout];
43388
43393
  const session = client[kHTTP2Session];
43389
- const { method, path: path54, host, upgrade, expectContinue, signal, protocol, headers: reqHeaders } = request7;
43394
+ const { method, path: path56, host, upgrade, expectContinue, signal, protocol, headers: reqHeaders } = request7;
43390
43395
  let { body } = request7;
43391
43396
  if (upgrade != null && upgrade !== "websocket") {
43392
43397
  util2.errorRequest(client, request7, new InvalidArgumentError2(`Custom upgrade "${upgrade}" not supported over HTTP/2`));
@@ -43455,7 +43460,7 @@ var require_client_h2 = __commonJS({
43455
43460
  }
43456
43461
  headers[HTTP2_HEADER_METHOD] = "CONNECT";
43457
43462
  headers[HTTP2_HEADER_PROTOCOL] = "websocket";
43458
- headers[HTTP2_HEADER_PATH] = path54;
43463
+ headers[HTTP2_HEADER_PATH] = path56;
43459
43464
  if (protocol === "ws:" || protocol === "wss:") {
43460
43465
  headers[HTTP2_HEADER_SCHEME] = protocol === "ws:" ? "http" : "https";
43461
43466
  } else {
@@ -43497,7 +43502,7 @@ var require_client_h2 = __commonJS({
43497
43502
  stream.setTimeout(headersTimeout);
43498
43503
  return true;
43499
43504
  }
43500
- headers[HTTP2_HEADER_PATH] = path54;
43505
+ headers[HTTP2_HEADER_PATH] = path56;
43501
43506
  headers[HTTP2_HEADER_SCHEME] = protocol === "http:" ? "http" : "https";
43502
43507
  const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH";
43503
43508
  if (body && typeof body.read === "function") {
@@ -45849,10 +45854,10 @@ var require_proxy_agent = __commonJS({
45849
45854
  };
45850
45855
  const {
45851
45856
  origin,
45852
- path: path54 = "/",
45857
+ path: path56 = "/",
45853
45858
  headers = {}
45854
45859
  } = opts;
45855
- opts.path = origin + path54;
45860
+ opts.path = origin + path56;
45856
45861
  if (!("host" in headers) && !("Host" in headers)) {
45857
45862
  const { host } = new URL(origin);
45858
45863
  headers.host = host;
@@ -47961,20 +47966,20 @@ var require_mock_utils = __commonJS({
47961
47966
  }
47962
47967
  return normalizedQp;
47963
47968
  }
47964
- function safeUrl(path54) {
47965
- if (typeof path54 !== "string") {
47966
- return path54;
47969
+ function safeUrl(path56) {
47970
+ if (typeof path56 !== "string") {
47971
+ return path56;
47967
47972
  }
47968
- const pathSegments = path54.split("?", 3);
47973
+ const pathSegments = path56.split("?", 3);
47969
47974
  if (pathSegments.length !== 2) {
47970
- return path54;
47975
+ return path56;
47971
47976
  }
47972
47977
  const qp2 = new URLSearchParams(pathSegments.pop());
47973
47978
  qp2.sort();
47974
47979
  return [...pathSegments, qp2.toString()].join("?");
47975
47980
  }
47976
- function matchKey(mockDispatch2, { path: path54, method, body, headers }) {
47977
- const pathMatch = matchValue(mockDispatch2.path, path54);
47981
+ function matchKey(mockDispatch2, { path: path56, method, body, headers }) {
47982
+ const pathMatch = matchValue(mockDispatch2.path, path56);
47978
47983
  const methodMatch = matchValue(mockDispatch2.method, method);
47979
47984
  const bodyMatch = typeof mockDispatch2.body !== "undefined" ? matchValue(mockDispatch2.body, body) : true;
47980
47985
  const headersMatch = matchHeaders(mockDispatch2, headers);
@@ -47999,8 +48004,8 @@ var require_mock_utils = __commonJS({
47999
48004
  const basePath = key.query ? serializePathWithQuery(key.path, key.query) : key.path;
48000
48005
  const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath;
48001
48006
  const resolvedPathWithoutTrailingSlash = removeTrailingSlash(resolvedPath);
48002
- let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path54, ignoreTrailingSlash }) => {
48003
- return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(path54)), resolvedPathWithoutTrailingSlash) : matchValue(safeUrl(path54), resolvedPath);
48007
+ let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path56, ignoreTrailingSlash }) => {
48008
+ return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(path56)), resolvedPathWithoutTrailingSlash) : matchValue(safeUrl(path56), resolvedPath);
48004
48009
  });
48005
48010
  if (matchedMockDispatches.length === 0) {
48006
48011
  throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`);
@@ -48039,19 +48044,19 @@ var require_mock_utils = __commonJS({
48039
48044
  mockDispatches.splice(index, 1);
48040
48045
  }
48041
48046
  }
48042
- function removeTrailingSlash(path54) {
48043
- while (path54.endsWith("/")) {
48044
- path54 = path54.slice(0, -1);
48047
+ function removeTrailingSlash(path56) {
48048
+ while (path56.endsWith("/")) {
48049
+ path56 = path56.slice(0, -1);
48045
48050
  }
48046
- if (path54.length === 0) {
48047
- path54 = "/";
48051
+ if (path56.length === 0) {
48052
+ path56 = "/";
48048
48053
  }
48049
- return path54;
48054
+ return path56;
48050
48055
  }
48051
48056
  function buildKey(opts) {
48052
- const { path: path54, method, body, headers, query } = opts;
48057
+ const { path: path56, method, body, headers, query } = opts;
48053
48058
  return {
48054
- path: path54,
48059
+ path: path56,
48055
48060
  method,
48056
48061
  body,
48057
48062
  headers,
@@ -48741,10 +48746,10 @@ var require_pending_interceptors_formatter = __commonJS({
48741
48746
  }
48742
48747
  format(pendingInterceptors) {
48743
48748
  const withPrettyHeaders = pendingInterceptors.map(
48744
- ({ method, path: path54, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
48749
+ ({ method, path: path56, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
48745
48750
  Method: method,
48746
48751
  Origin: origin,
48747
- Path: path54,
48752
+ Path: path56,
48748
48753
  "Status code": statusCode,
48749
48754
  Persistent: persist ? PERSISTENT : NOT_PERSISTENT,
48750
48755
  Invocations: timesInvoked,
@@ -48826,9 +48831,9 @@ var require_mock_agent = __commonJS({
48826
48831
  const acceptNonStandardSearchParameters = this[kMockAgentAcceptsNonStandardSearchParameters];
48827
48832
  const dispatchOpts = { ...opts };
48828
48833
  if (acceptNonStandardSearchParameters && dispatchOpts.path) {
48829
- const [path54, searchParams] = dispatchOpts.path.split("?");
48834
+ const [path56, searchParams] = dispatchOpts.path.split("?");
48830
48835
  const normalizedSearchParams = normalizeSearchParams(searchParams, acceptNonStandardSearchParameters);
48831
- dispatchOpts.path = `${path54}?${normalizedSearchParams}`;
48836
+ dispatchOpts.path = `${path56}?${normalizedSearchParams}`;
48832
48837
  }
48833
48838
  return this[kAgent].dispatch(dispatchOpts, handler);
48834
48839
  }
@@ -49229,12 +49234,12 @@ var require_snapshot_recorder = __commonJS({
49229
49234
  * @return {Promise<void>} - Resolves when snapshots are loaded
49230
49235
  */
49231
49236
  async loadSnapshots(filePath) {
49232
- const path54 = filePath || this.#snapshotPath;
49233
- if (!path54) {
49237
+ const path56 = filePath || this.#snapshotPath;
49238
+ if (!path56) {
49234
49239
  throw new InvalidArgumentError2("Snapshot path is required");
49235
49240
  }
49236
49241
  try {
49237
- const data = await readFile(resolve2(path54), "utf8");
49242
+ const data = await readFile(resolve2(path56), "utf8");
49238
49243
  const parsed = JSON.parse(data);
49239
49244
  if (Array.isArray(parsed)) {
49240
49245
  this.#snapshots.clear();
@@ -49248,7 +49253,7 @@ var require_snapshot_recorder = __commonJS({
49248
49253
  if (error63.code === "ENOENT") {
49249
49254
  this.#snapshots.clear();
49250
49255
  } else {
49251
- throw new UndiciError(`Failed to load snapshots from ${path54}`, { cause: error63 });
49256
+ throw new UndiciError(`Failed to load snapshots from ${path56}`, { cause: error63 });
49252
49257
  }
49253
49258
  }
49254
49259
  }
@@ -49259,11 +49264,11 @@ var require_snapshot_recorder = __commonJS({
49259
49264
  * @returns {Promise<void>} - Resolves when snapshots are saved
49260
49265
  */
49261
49266
  async saveSnapshots(filePath) {
49262
- const path54 = filePath || this.#snapshotPath;
49263
- if (!path54) {
49267
+ const path56 = filePath || this.#snapshotPath;
49268
+ if (!path56) {
49264
49269
  throw new InvalidArgumentError2("Snapshot path is required");
49265
49270
  }
49266
- const resolvedPath = resolve2(path54);
49271
+ const resolvedPath = resolve2(path56);
49267
49272
  await mkdir(dirname3(resolvedPath), { recursive: true });
49268
49273
  const data = Array.from(this.#snapshots.entries()).map(([hash2, snapshot]) => ({
49269
49274
  hash: hash2,
@@ -49895,15 +49900,15 @@ var require_redirect_handler = __commonJS({
49895
49900
  return;
49896
49901
  }
49897
49902
  const { origin, pathname, search } = util2.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)));
49898
- const path54 = search ? `${pathname}${search}` : pathname;
49899
- const redirectUrlString = `${origin}${path54}`;
49903
+ const path56 = search ? `${pathname}${search}` : pathname;
49904
+ const redirectUrlString = `${origin}${path56}`;
49900
49905
  for (const historyUrl of this.history) {
49901
49906
  if (historyUrl.toString() === redirectUrlString) {
49902
49907
  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.`);
49903
49908
  }
49904
49909
  }
49905
49910
  this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin);
49906
- this.opts.path = path54;
49911
+ this.opts.path = path56;
49907
49912
  this.opts.origin = origin;
49908
49913
  this.opts.query = null;
49909
49914
  }
@@ -51663,10 +51668,10 @@ var require_cache_handler = __commonJS({
51663
51668
  }
51664
51669
  return locationUrl.pathname + locationUrl.search;
51665
51670
  }
51666
- function deleteCachedUri(store, cacheKey, path54) {
51671
+ function deleteCachedUri(store, cacheKey, path56) {
51667
51672
  deleteCachedValue(store, {
51668
51673
  ...cacheKey,
51669
- path: path54
51674
+ path: path56
51670
51675
  });
51671
51676
  for (let i10 = 0; i10 < util2.safeHTTPMethods.length; i10++) {
51672
51677
  const method = util2.safeHTTPMethods[i10];
@@ -51674,7 +51679,7 @@ var require_cache_handler = __commonJS({
51674
51679
  deleteCachedValue(store, {
51675
51680
  ...cacheKey,
51676
51681
  method,
51677
- path: path54
51682
+ path: path56
51678
51683
  });
51679
51684
  }
51680
51685
  }
@@ -51685,9 +51690,9 @@ var require_cache_handler = __commonJS({
51685
51690
  }
51686
51691
  const values = Array.isArray(headerValue2) ? headerValue2 : [headerValue2];
51687
51692
  for (let i10 = 0; i10 < values.length; i10++) {
51688
- const path54 = getSameOriginPath(cacheKey, values[i10]);
51689
- if (path54 !== void 0) {
51690
- deleteCachedUri(store, cacheKey, path54);
51693
+ const path56 = getSameOriginPath(cacheKey, values[i10]);
51694
+ if (path56 !== void 0) {
51695
+ deleteCachedUri(store, cacheKey, path56);
51691
51696
  }
51692
51697
  }
51693
51698
  }
@@ -56687,11 +56692,11 @@ var require_fetch = __commonJS({
56687
56692
  function dispatch({ body }) {
56688
56693
  const url2 = requestCurrentURL(request7);
56689
56694
  const agent = fetchParams.controller.dispatcher;
56690
- const path54 = url2.pathname + url2.search;
56695
+ const path56 = url2.pathname + url2.search;
56691
56696
  const hasTrailingQuestionMark = url2.search.length === 0 && url2.href[url2.href.length - url2.hash.length - 1] === "?";
56692
56697
  return new Promise((resolve2, reject) => agent.dispatch(
56693
56698
  {
56694
- path: hasTrailingQuestionMark ? `${path54}?` : path54,
56699
+ path: hasTrailingQuestionMark ? `${path56}?` : path56,
56695
56700
  origin: url2.origin,
56696
56701
  method: request7.method,
56697
56702
  body: agent.isMockActive ? request7.body && (request7.body.source || request7.body.stream) : body,
@@ -57638,9 +57643,9 @@ var require_util5 = __commonJS({
57638
57643
  }
57639
57644
  }
57640
57645
  }
57641
- function validateCookiePath(path54) {
57642
- for (let i10 = 0; i10 < path54.length; ++i10) {
57643
- const code = path54.charCodeAt(i10);
57646
+ function validateCookiePath(path56) {
57647
+ for (let i10 = 0; i10 < path56.length; ++i10) {
57648
+ const code = path56.charCodeAt(i10);
57644
57649
  if (code < 32 || // exclude CTLs (0-31)
57645
57650
  code > 126 || // exclude DEL and non-ascii
57646
57651
  code === 59) {
@@ -60988,11 +60993,11 @@ var require_undici = __commonJS({
60988
60993
  if (typeof opts.path !== "string") {
60989
60994
  throw new InvalidArgumentError2("invalid opts.path");
60990
60995
  }
60991
- let path54 = opts.path;
60996
+ let path56 = opts.path;
60992
60997
  if (!opts.path.startsWith("/")) {
60993
- path54 = `/${path54}`;
60998
+ path56 = `/${path56}`;
60994
60999
  }
60995
- url2 = new URL(util2.parseOrigin(url2).origin + path54);
61000
+ url2 = new URL(util2.parseOrigin(url2).origin + path56);
60996
61001
  } else {
60997
61002
  if (!opts) {
60998
61003
  opts = typeof url2 === "object" ? url2 : {};
@@ -61293,7 +61298,7 @@ request.on("error", (error) => finish(failed, (error.code ? error.code + ": " :
61293
61298
  // src/frontdoor/trust.ts
61294
61299
  function resolveTrustBundle(params) {
61295
61300
  const { caCertFile, bundlesDir, variable, inherited, fs: fs22 } = params;
61296
- if (inherited === void 0 || inherited === "" || import_node_path32.default.resolve(inherited) === import_node_path32.default.resolve(caCertFile)) {
61301
+ if (inherited === void 0 || inherited === "" || import_node_path34.default.resolve(inherited) === import_node_path34.default.resolve(caCertFile)) {
61297
61302
  return { path: caCertFile };
61298
61303
  }
61299
61304
  const caPem = fs22.readFileUtf8(caCertFile);
@@ -61311,19 +61316,19 @@ function resolveTrustBundle(params) {
61311
61316
  }
61312
61317
  const combined = `${inheritedPem.trimEnd()}
61313
61318
  ${caPem}`;
61314
- const bundle = import_node_path32.default.join(bundlesDir, `${(0, import_node_crypto11.createHash)("sha256").update(combined).digest("hex").slice(0, BUNDLE_NAME_HEX_DIGITS)}.pem`);
61319
+ const bundle = import_node_path34.default.join(bundlesDir, `${(0, import_node_crypto11.createHash)("sha256").update(combined).digest("hex").slice(0, BUNDLE_NAME_HEX_DIGITS)}.pem`);
61315
61320
  if (!fs22.exists(bundle)) {
61316
61321
  fs22.mkdirp(bundlesDir);
61317
61322
  fs22.writeFileAtomic(bundle, combined);
61318
61323
  }
61319
61324
  return { path: bundle };
61320
61325
  }
61321
- var import_node_crypto11, import_node_path32, BUNDLE_NAME_HEX_DIGITS;
61326
+ var import_node_crypto11, import_node_path34, BUNDLE_NAME_HEX_DIGITS;
61322
61327
  var init_trust = __esm({
61323
61328
  "src/frontdoor/trust.ts"() {
61324
61329
  "use strict";
61325
61330
  import_node_crypto11 = require("node:crypto");
61326
- import_node_path32 = __toESM(require("node:path"), 1);
61331
+ import_node_path34 = __toESM(require("node:path"), 1);
61327
61332
  BUNDLE_NAME_HEX_DIGITS = 16;
61328
61333
  }
61329
61334
  });
@@ -61341,7 +61346,7 @@ function realEnsurePorts(paths, spawnDaemon) {
61341
61346
  process.kill(pid, "SIGTERM");
61342
61347
  },
61343
61348
  // Read fresh for each probe: a replacement supervisor may have regenerated an unparseable CA, and the probe must trust exactly what the serving door's leaf chains to.
61344
- verifyListener: (port) => probeFrontDoorSync(port, import_node_fs12.default.readFileSync(paths.frontdoorCaCertFile, "utf8"))
61349
+ verifyListener: (port) => probeFrontDoorSync(port, import_node_fs13.default.readFileSync(paths.frontdoorCaCertFile, "utf8"))
61345
61350
  };
61346
61351
  }
61347
61352
  function realRestartFrontDoor(paths, spawnDaemon) {
@@ -61365,21 +61370,21 @@ function realFrontDoorPort(paths, spawnDaemon) {
61365
61370
  }
61366
61371
  };
61367
61372
  }
61368
- var import_node_fs12, realTrustBundleFs;
61373
+ var import_node_fs13, realTrustBundleFs;
61369
61374
  var init_realFrontDoorPort = __esm({
61370
61375
  "src/frontdoor/realFrontDoorPort.ts"() {
61371
61376
  "use strict";
61372
- import_node_fs12 = __toESM(require("node:fs"), 1);
61377
+ import_node_fs13 = __toESM(require("node:fs"), 1);
61373
61378
  init_realPorts();
61374
61379
  init_ensure2();
61375
61380
  init_state2();
61376
61381
  init_probe();
61377
61382
  init_trust();
61378
61383
  realTrustBundleFs = {
61379
- readFileUtf8: (file2) => import_node_fs12.default.readFileSync(file2, "utf8"),
61380
- exists: (file2) => import_node_fs12.default.existsSync(file2),
61384
+ readFileUtf8: (file2) => import_node_fs13.default.readFileSync(file2, "utf8"),
61385
+ exists: (file2) => import_node_fs13.default.existsSync(file2),
61381
61386
  mkdirp: (dir) => {
61382
- import_node_fs12.default.mkdirSync(dir, { recursive: true });
61387
+ import_node_fs13.default.mkdirSync(dir, { recursive: true });
61383
61388
  },
61384
61389
  writeFileAtomic: (file2, contents) => {
61385
61390
  realFarmFs.writeFilePrivate(file2, contents);
@@ -61511,10 +61516,10 @@ async function downloadAndInstall(ports, asset, target) {
61511
61516
  const tempDir = ports.fs.mkdtemp();
61512
61517
  try {
61513
61518
  const assetUrl = `${DOWNLOAD_BASE_URL}/${asset}`;
61514
- ports.fs.writeFileBytes(import_node_path33.default.join(tempDir, asset), await mustDownload(ports.http, assetUrl));
61515
- ports.fs.writeFileUtf8(import_node_path33.default.join(tempDir, `${asset}.sha256`), Buffer.from(await mustDownload(ports.http, `${assetUrl}.sha256`)).toString("utf8"));
61516
- const downloaded = ports.fs.readFileBytes(import_node_path33.default.join(tempDir, asset));
61517
- const sidecar = ports.fs.readFileUtf8(import_node_path33.default.join(tempDir, `${asset}.sha256`));
61519
+ ports.fs.writeFileBytes(import_node_path35.default.join(tempDir, asset), await mustDownload(ports.http, assetUrl));
61520
+ ports.fs.writeFileUtf8(import_node_path35.default.join(tempDir, `${asset}.sha256`), Buffer.from(await mustDownload(ports.http, `${assetUrl}.sha256`)).toString("utf8"));
61521
+ const downloaded = ports.fs.readFileBytes(import_node_path35.default.join(tempDir, asset));
61522
+ const sidecar = ports.fs.readFileUtf8(import_node_path35.default.join(tempDir, `${asset}.sha256`));
61518
61523
  if (downloaded === void 0 || sidecar === void 0) {
61519
61524
  throw new UpdateDownloadError(`the downloaded files for ${asset} are missing from ${tempDir}`);
61520
61525
  }
@@ -61523,7 +61528,7 @@ async function downloadAndInstall(ports, asset, target) {
61523
61528
  if (expected === void 0 || expected !== actual) {
61524
61529
  throw new UpdateDownloadError(`checksum mismatch for ${asset} (expected ${expected ?? "(none)"}, got ${actual})`);
61525
61530
  }
61526
- const tempBinary = import_node_path33.default.join(import_node_path33.default.dirname(target), `.${import_node_path33.default.basename(target)}.${String(process.pid)}.${(0, import_node_crypto12.randomUUID)()}.tmp`);
61531
+ const tempBinary = import_node_path35.default.join(import_node_path35.default.dirname(target), `.${import_node_path35.default.basename(target)}.${String(process.pid)}.${(0, import_node_crypto12.randomUUID)()}.tmp`);
61527
61532
  ports.fs.writeFileBytes(tempBinary, downloaded);
61528
61533
  try {
61529
61534
  ports.fs.chmod(tempBinary, EXECUTABLE_MODE);
@@ -61570,12 +61575,12 @@ async function runSelfUpdate(ports, options) {
61570
61575
  }
61571
61576
  return { current: options.currentVersion, latest, action: "updated" };
61572
61577
  }
61573
- var import_node_crypto12, import_node_path33, LATEST_RELEASE_URL, DOWNLOAD_BASE_URL, MACOS_X64_NOTE, BREW_PREFIXES, EXECUTABLE_MODE, UpdateChannelError, UpdateConflictError, UpdateDownloadError;
61578
+ var import_node_crypto12, import_node_path35, LATEST_RELEASE_URL, DOWNLOAD_BASE_URL, MACOS_X64_NOTE, BREW_PREFIXES, EXECUTABLE_MODE, UpdateChannelError, UpdateConflictError, UpdateDownloadError;
61574
61579
  var init_update = __esm({
61575
61580
  "src/update/update.ts"() {
61576
61581
  "use strict";
61577
61582
  import_node_crypto12 = require("node:crypto");
61578
- import_node_path33 = __toESM(require("node:path"), 1);
61583
+ import_node_path35 = __toESM(require("node:path"), 1);
61579
61584
  init_cliError();
61580
61585
  LATEST_RELEASE_URL = "https://github.com/ExaDev/agent-shim/releases/latest";
61581
61586
  DOWNLOAD_BASE_URL = "https://github.com/ExaDev/agent-shim/releases/latest/download";
@@ -62101,7 +62106,7 @@ function buildEnv(params) {
62101
62106
  const parentCustomHeaders = params.baseEnv.ANTHROPIC_CUSTOM_HEADERS;
62102
62107
  let providerCustomHeaders;
62103
62108
  if (!params.configDirEscapeHatch && params.resolvedIdentityName !== void 0) {
62104
- env.CLAUDE_CONFIG_DIR = import_node_path35.default.join(params.identitiesDir, params.resolvedIdentityName);
62109
+ env.CLAUDE_CONFIG_DIR = import_node_path37.default.join(params.identitiesDir, params.resolvedIdentityName);
62105
62110
  }
62106
62111
  if (params.provider !== void 0) {
62107
62112
  const providerEnv = params.provider.definition.env ?? {};
@@ -62145,11 +62150,11 @@ function buildEnv(params) {
62145
62150
  }
62146
62151
  return env;
62147
62152
  }
62148
- var import_node_path35, LOOPBACK_HOSTS;
62153
+ var import_node_path37, LOOPBACK_HOSTS;
62149
62154
  var init_flags = __esm({
62150
62155
  "src/launcher/flags.ts"() {
62151
62156
  "use strict";
62152
- import_node_path35 = __toESM(require("node:path"), 1);
62157
+ import_node_path37 = __toESM(require("node:path"), 1);
62153
62158
  init_envBool();
62154
62159
  init_credential();
62155
62160
  init_headers();
@@ -62223,12 +62228,17 @@ function resolvePoolLaunch(params) {
62223
62228
  if (graph.ranking.candidates.length === 0) {
62224
62229
  return { ok: false, message: `agent-shim: no member of pool "${poolName}" is an existing identity.` };
62225
62230
  }
62226
- const { pick: pick2, earliestReturn, movedOff, planReturn } = graph.ranking;
62231
+ const { pick: pick2, earliestReturn, movedOff, planReturn, holdForReturn } = graph.ranking;
62227
62232
  if (pick2 !== void 0 && params.wait && planReturn !== void 0) {
62228
62233
  log.info(`agent-shim: pool "${poolName}" would continue ${planReturn.identity} on extra usage; waiting until ${new Date(planReturn.atMs).toISOString()} for its plan window`);
62229
62234
  params.sleep(Math.max(planReturn.atMs - nowMs, 0));
62230
62235
  continue;
62231
62236
  }
62237
+ if (pick2 !== void 0 && params.wait && holdForReturn !== void 0) {
62238
+ log.info(`agent-shim: pool "${poolName}" pick ${pick2.identity} would run dry before its window resets; waiting until ${new Date(holdForReturn.atMs).toISOString()} for ${holdForReturn.identity}`);
62239
+ params.sleep(Math.max(holdForReturn.atMs - nowMs, 0));
62240
+ continue;
62241
+ }
62232
62242
  if (pick2 !== void 0) {
62233
62243
  if (params.recordPick) {
62234
62244
  recordStickyPick(params.usageFs, params.paths.usagePicksFile, params.cwd, pick2.identity, nowMs);
@@ -62477,7 +62487,7 @@ function decideLaunch(params, readOnly) {
62477
62487
  identityDefaultConfigProfile: loadedIdentity?.config.defaultConfigProfile,
62478
62488
  globalDefaultConfigProfile: params.globalDefaultConfigProfile
62479
62489
  });
62480
- if (configProfileDecision.name !== void 0 && params.allowMissingConfigProfile !== true && fs22.readConfigFile(import_node_path36.default.join(paths.configProfilesDir, `${configProfileDecision.name}.json`)) === void 0) {
62490
+ if (configProfileDecision.name !== void 0 && params.allowMissingConfigProfile !== true && fs22.readConfigFile(import_node_path38.default.join(paths.configProfilesDir, `${configProfileDecision.name}.json`)) === void 0) {
62481
62491
  log.error(
62482
62492
  `agent-shim: no configuration profile named "${configProfileDecision.name}" (selected via ${configProfileDecision.source}). Run \`agent-shim profile add ${configProfileDecision.name}\` first.`
62483
62493
  );
@@ -62589,7 +62599,7 @@ function decideLaunch(params, readOnly) {
62589
62599
  extraFlags: splitExtraFlags(env.CLAUDE_EXTRA_FLAGS),
62590
62600
  passthrough: parsedArgv.rest
62591
62601
  });
62592
- const configDir = configDirEscapeHatchApplies || identityDecision.name === void 0 ? env.CLAUDE_CONFIG_DIR : import_node_path36.default.join(paths.identitiesDir, identityDecision.name);
62602
+ const configDir = configDirEscapeHatchApplies || identityDecision.name === void 0 ? env.CLAUDE_CONFIG_DIR : import_node_path38.default.join(paths.identitiesDir, identityDecision.name);
62593
62603
  const decision = {
62594
62604
  identitySource: identityDecision.source,
62595
62605
  configDirEscapeHatch: identityDecision.configDirEscapeHatch,
@@ -62630,7 +62640,7 @@ function prepareLaunch(params) {
62630
62640
  );
62631
62641
  const updateCheck = runLaunchUpdateCheck({
62632
62642
  mode: params.updateMode ?? "off",
62633
- checkPath: import_node_path36.default.join(paths.root, "update.check"),
62643
+ checkPath: import_node_path38.default.join(paths.root, "update.check"),
62634
62644
  currentVersion: package_default.version,
62635
62645
  port: params.update
62636
62646
  });
@@ -62761,12 +62771,12 @@ function runLaunchPlan(plan, spawn4) {
62761
62771
  function runLauncher(params) {
62762
62772
  params.proc.exit(runLaunchPlan(prepareLaunch(params), params.spawn));
62763
62773
  }
62764
- var import_node_crypto14, import_node_path36;
62774
+ var import_node_crypto14, import_node_path38;
62765
62775
  var init_launcher = __esm({
62766
62776
  "src/launcher.ts"() {
62767
62777
  "use strict";
62768
62778
  import_node_crypto14 = require("node:crypto");
62769
- import_node_path36 = __toESM(require("node:path"), 1);
62779
+ import_node_path38 = __toESM(require("node:path"), 1);
62770
62780
  init_package();
62771
62781
  init_envBool();
62772
62782
  init_argv();
@@ -63778,10 +63788,10 @@ function Ww(e14) {
63778
63788
  }
63779
63789
  function M_() {
63780
63790
  let e14 = "";
63781
- if (typeof process < "u" && typeof process.cwd === "function" && typeof import_node_fs14.realpathSync === "function") try {
63791
+ if (typeof process < "u" && typeof process.cwd === "function" && typeof import_node_fs15.realpathSync === "function") try {
63782
63792
  let t10 = (0, import_node_process4.cwd)();
63783
63793
  try {
63784
- e14 = Ww((0, import_node_fs14.realpathSync)(t10));
63794
+ e14 = Ww((0, import_node_fs15.realpathSync)(t10));
63785
63795
  } catch {
63786
63796
  e14 = Ww(t10);
63787
63797
  }
@@ -77445,14 +77455,14 @@ async function jGe(e14, t10, n10, r10) {
77445
77455
  if (d.length === 0) return [];
77446
77456
  return iv(Buffer.from(gZ(d)), { limit: r10.limit, offset: r10.offset }, l, c10);
77447
77457
  }
77448
- var import_node_module, import_crypto, import_crypto2, import_path, import_node_fs14, import_node_process4, import_fs, import_os, import_path2, yy, import_fs2, import_promises, import_path3, import_readline, import_promises2, import_path4, import_os2, import_path5, Se, import_promises3, xe, import_promises4, import_fs3, import_promises5, import_os3, import_path6, import_promises6, import_os4, import_node_path37, import_node_os10, import_node_process5, import_path7, import_events, import_fs4, import_promises7, import_path8, import_child_process, import_util9, import_child_process2, import_fs5, import_path9, import_path10, import_crypto3, import_fs6, import_path11, import_promises8, import_path12, import_path13, import_promises9, import_path14, import_path15, import_fs7, import_promises10, import_path16, import_crypto4, import_path17, import_async_hooks, import_fs8, import_promises11, import_crypto5, import_fs9, import_promises12, import_path18, import_promises13, import_path19, import_crypto6, import_path20, import_path21, import_path22, import_path23, import_promises14, import_fs10, import_promises15, import_path24, import_util10, import_path25, import_os5, import_path26, import_path27, import_path28, import_path29, import_path30, import_net, import_os6, import_child_process3, import_fs11, import_child_process4, import_crypto7, import_promises16, import_module, import_os7, import_path31, import_url, import_events2, import_child_process5, import_fs12, import_readline2, import_string_decoder, import_fs13, import_promises17, import_os8, import_path32, import_crypto8, import_os9, import_fs14, import_path33, import_crypto9, import_fs15, import_promises18, import_path34, IZ, DZ, v_, LZ, OT, NZ, UZ, kT, X, FZ, dr, HZ, jZ, BZ, ot, st, ed, Kv, Te, Me, Oo, nd, hF, Xv, Qv, rd, LF, or, WF, ZF, sA, XF, od, sd, hg, id, Sg, Oz, fA, $z, Wz, Zz, s$, a$, d$, f$, g$, _$, E$, v$, T$, O$, I$, L$, wg, z$, j$, G$, V$, yA, SA, rH, lH, uH, _H, EH, EA, RH, TH, kH, DH, NH, zH, jH, GH, VH, ZH, JH, ej, nj, ij, cj, uj, CA, bj, Aj, wj, PT, KZ, GZ, VGe, VZ, MT, wr, jo, JZ, XZ, NT, UT, FT, zT, Bo, $T, HT, jT, BT, a4, sp, l4, c4, vt, u4, Nt, KT, d4, p4, uc, GT, m4, g4, WT, _4, y4, VT, Dn, Et, b4, C4, v4, A4, ra, x4, ip, qT, ZT, w4, O4, ro, P4, I4, D4, L4, M4, N4, U4, YT, JT, Sn, H4, Ko, j4, oo, XT, QT, G4, W4, V4, ew, Z4, Y4, tw, X4, nw, R_, rw, ow, Go, sw, iw, aw, lw, ei, aY, cw, Or, cY, uw, dw, lp, pw, cp, mY, gY, up, _Y, aa, fw, la, EY, bY, CY, vY, AY, RY, xY, TY, wY, OY, kY, PY, IY, mw, x_, gw, ca, MY, et, dp, hw, pp, zY, $Y, _w, HY, ua, yw, wt, KY, T_, Sw, WY, VY, qY, so, mp, Ew, vw, bw, YY, Cw, JY, XY, kr, QY, e9, Wo, n9, da, o9, s9, i9, a9, l9, c9, u9, d9, p9, f9, m9, g9, h9, _9, y9, S9, E9, b9, C9, v9, A9, R9, x9, T9, Qe, Aw, pa, hp, Rw, dc, k9, w_, P9, Pr, xw, I9, fa, D9, L9, _p, N9, ma, yp, z9, Tw, $9, H9, ww, Vo, Ir, pc, W9, V9, q9, Ow, Y9, Sp, J9, Ep, X9, qo, Q9, bp, kw, eJ, Pw, Iw, Dw, Lw, tJ, nJ, rJ, oJ, sJ, ti, io, iJ, Mw, Nw, Cp, aJ, Uw, Fw, ga, pr, uJ, Fe, $w, O_, k_, I_, ha, Bw, D_, qw, Vw, N_, U_, yJ, _a3, Yo, Zw, bJ, Rp, Yw, vJ, AJ, Jw, xp, Xw, Tp, Qw, kJ, ya, IJ, DJ, Sa, MJ, fc, NJ, eO, FJ, zJ, $J, tO, Ea, jJ, nO, rO, sO, iO, Vn, GJ, Ln, Jo, aO, lO, cO, wp, XJ, QJ, uO, ba, dO, pO, fO, Dr, ao, mO, Ca, gO, z_, $_, H_, j_, B_, K_, G_, W_, V_, q_, Z_, _O, Y_, J_, yO, X_, c3, Q_, ey, ty, ny, ry, oy, sy, iy, ay, ly, cy, we, SO, en, d3, Pp, vO, g3, gy, wO, S3, BO, KO, Ip, Dp, v3, GO, WO, F9e, IO, A3, hy, x3, NO, I3, Ay, Ry, D3, xy, L3, bc, xa, Ty, wy, Oy, ky, XO, Py, Iy, Dy, Ly, My, Ny, Uy, Fy, zy, nk, rk, d3e, p3e, f3e, m3e, g3e, U3, jp, jy, ik, By, Ky, lk, $3, uk, ck, G3, W3, V3, it, Y3, J3, hk, tXe, Q3, kt, We, gX, Ta, SX, mr, Yp, Jp, eS, nS, yXe, IX, DX, rS, ka, oS, Ok, kk, HX, jX, ef, bXe, Uk, Mr, wc, Fk, Pa, OXe, kXe, iS, PXe, IXe, DXe, GX, YX, JX, XX, QX, e6, t6, Yk, n6, r6, o6, s6, i6, a6, l6, c6, Vk, uS, lf, dS, Qk, eP, uf, os10, qXe, ZXe, h6, tP, df, _6, y6, S6, E6, b6, Jn, gr, nP, rP, Dc, pS, oP, gS, lP, C6, mS, lS, sP, w6, O6, dP, k6, YXe, JXe, P6, I6, pf, L6, fP, XXe, QXe, M6, SS, z6, $6, j6, bP, CP, G6, Lc, si, Z6, ES, bS, X6, Q6, e5, t5, n5, u5, r5, o5, s5, i5, a5, l5, c5, u52, d5, p5, f5, m5, g5, h5, _5, y5, S5, E5, b5, C5, v5, A5, R5, x5, T5, w5, O5, k5, P5, I5, D5, L5, M5, N5, U5, F5, z5, $5, H5, j5, B5, K5, G5, W5, V5, q5, Z5, Y5, J5, X5, Q5, e8, t8, n8, r8, o8, s8, i8, a8, l8, c8, u8, d8, CS, p8, f8, m8, g8, h8, _8, y8, S8, E8, b8, C8, v8, A8, R8, x8, T8, w8, O8, k8, P8, I8, D8, L8, M8, N8, U8, F8, z8, $8, H8, j8, B8, K8, G8, W8, V8, q8, Z8, Y8, J8, X8, Q8, e7, t7, n7, r7, o7, s7, i7, a7, l7, c7, u7, d7, p7, f7, m7, g7, h7, _7, y7, S7, E7, b7, C7, TP, v7, L6e, RP, A7, x7, kP, ff, U6e, F6e, Ua, z6e, $6e, H6e, j6e, PP, IP, vS, DP, w7, LP, O7, k7, P7, AS, RS, xS, I7, MP, NP, D7, G6e, L7, W6e, M7, N7, UP, V6e, U7, F7, z7, $7, H7, j7, B7, q6e, is, wS, Fa, K7, G7, W7, i5e, X7, Q7, HP, $P, BP, tQ, WP, VP, JP, _Q, QP, eI, xQ, Uc, DS, $a, wQ, OQ, kQ, PQ, IQ, DQ, LQ, MQ, NQ, UQ, FQ, zQ, $Q, HQ, jQ, BQ, KQ, GQ, WQ, VQ, qQ, ZQ, YQ, JQ, XQ, QQ, eee, tee, nee, ree, oee, see, iee, aee, lee, cee, uee, dee, pee, fee, mee, gee, hee, _ee, yee, See, Eee, bee, Cee, vee, Aee, Ree, xee, Tee, wee, Oee, kee, Pee, Iee, Dee, Lee, Mee, Nee, Uee, Fee, zee, $ee, Hee, jee, Bee, Kee, Gee, Wee, Vee, qee, Zee, Yee, Jee, Xee, Qee, ete, tte, nte, rte, ote, ste, ite, ate, lte, cte, ute, dte, pte, fte, mte, gte, hte, _te, yte, Ste, Ete, bte, Cte, vte, Ate, Rte, xte, Tte, wte, Ote, kte, Pte, Ite, Dte, Lte, Mte, Nte, Ute, Fte, zte, $te, Hte, jte, Bte, Kte, Gte, Wte, Vte, qte, Zte, Yte, Jte, Xte, Qte, ene, tne, nne, rne, one, sne, ine, ane, lne, cne, une, dne, pne, fne, mne, gne, hne, _ne, yne, Sne, Ene, bne, Cne, vne, Ane, Rne, xne, Tne, wne, One, kne, Pne, Ine, Dne, Lne, Mne, Nne, Une, Fne, zne, $ne, Hne, jne, Bne, Kne, Gne, Wne, Vne, qne, Zne, Yne, Jne, Xne, Qne, ere, tre, nre, rre, ore, sre, ire, are, lre, cre, ure, dre, pre, fre, mre, gre, hre, _re, yre, Sre, Ere, bre, Cre, vre, Are, Rre, xre, Tre, wre, Ore, kre, Pre, Ire, Dre, Lre, Mre, Nre, Ure, Fre, zre, $re, Hre, jre, Bre, Kre, Gre, Wre, Vre, qre, Zre, Yre, Jre, Xre, Qre, eoe, toe, noe, roe, ooe, soe, ioe, aoe, loe, coe, uoe, doe, poe, foe, moe, goe, hoe, _oe, yoe, Soe, Eoe, boe, Coe, voe, Aoe, Roe, xoe, Toe, woe, Ooe, koe, Poe, Ioe, Doe, Loe, Moe, Noe, Uoe, Foe, zoe, $oe, Hoe, joe, Boe, Koe, Goe, Woe, Voe, qoe, Zoe, Yoe, Joe, Xoe, Qoe, ese, tse, nse, rse, ose, sse, ise, ase, lse, cse, use, dse, pse, fse, mse, gse, hse, _se, yse, Sse, Ese, LS, bse, Cse, vse, Ase, Rse, xse, Tse, wse, Ose, kse, Pse, Ise, Dse, Lse, Mse, Nse, Use, Fse, zse, $se, Hse, jse, Bse, Kse, Gse, Wse, Vse, qse, Zse, Yse, Jse, Xse, Qse, eie, tie, nie, rie, oie, sie, iie, aie, lie, cie, uie, die, pie, fie, mie, gie, hie, _ie, yie, Sie, Eie, bie, Cie, vie, Aie, Rie, xie, Tie, wie, Oie, kie, Pie, Iie, Die, Lie, Mie, Nie, Uie, Fie, zie, $ie, Hie, jie, Bie, Kie, Gie, Wie, Vie, qie, Zie, Yie, Jie, Xie, Qie, eae, tae, nae, rae, oae, sae, iae, aae, lae, cae, uae, dae, pae, fae, mae, gae, hae, _ae, yae, Sae, Eae, bae, Cae, vae, Aae, Rae, xae, Tae, wae, Oae, kae, Pae, Iae, Dae, Lae, Mae, Nae, Uae, Fae, zae, $ae, Hae, jae, Bae, Kae, Gae, Wae, Vae, qae, Zae, Yae, Jae, Xae, Qae, ele, tle, nle, rle, ole, sle, ile, ale, lle, cle, ule, dle, ple, fle, mle, gle, hle, _le, yle, Sle, Ele, ble, Cle, vle, Ale, Rle, xle, Tle, wle, Ole, kle, Ple, Ile, Dle, Lle, Mle, Nle, Ule, Fle, zle, $le, Hle, jle, Ble, Kle, Gle, Wle, Vle, qle, Zle, Yle, Jle, MS, Xle, Qle, ece, tce, nce, rce, oce, sce, ice, ace, lce, cce, uce, dce, pce, fce, mce, gce, hce, _ce, yce, Sce, Ece, bce, Cce, vce, Ace, Rce, xce, Tce, wce, Oce, kce, Pce, Ice, Dce, Lce, Mce, Nce, Uce, Fce, zce, $ce, Hce, jce, Bce, Kce, Gce, Wce, Vce, qce, Zce, Yce, Jce, Xce, Qce, eue, tue, nue, rue, oue, sue, iue, aue, lue, cue, uue, due, pue, fue, mue, gue, hue, _ue, yue, Sue, Eue, bue, Cue, vue, Aue, Rue, xue, Tue, wue, Oue, kue, Pue, Iue, Due, Lue, Mue, Nue, Uue, Fue, zue, $ue, Hue, jue, Bue, Kue, Gue, Wue, Vue, que, Zue, Yue, Jue, Xue, Que, ede, tde, nde, rde, ode, sde, ide, ade, lde, cde, ude, dde, pde, fde, mde, gde, hde, _de, yde, Sde, Ede, bde, Cde, vde, Ade, Rde, xde, Tde, wde, Ode, kde, Pde, Ide, Dde, Lde, Mde, Nde, Ude, Fde, zde, $de, Hde, jde, Bde, Kde, Gde, Wde, Vde, qde, Zde, Yde, Jde, Xde, Qde, epe, tpe, npe, rpe, ope, spe, ipe, ape, lpe, cpe, upe, dpe, ppe, fpe, mpe, gpe, hpe, _pe, ype, Spe, Epe, bpe, Cpe, vpe, Ape, Rpe, xpe, Tpe, wpe, Ope, kpe, Ppe, Ipe, Dpe, Lpe, Mpe, Npe, Upe, Fpe, zpe, $pe, Hpe, jpe, Bpe, Kpe, Gpe, Wpe, Vpe, qpe, Zpe, Ype, Jpe, Xpe, Qpe, efe, tfe, nfe, rfe, ofe, sfe, ife, afe, lfe, cfe, ufe, dfe, pfe, ffe, mfe, gfe, hfe, _fe, yfe, Sfe, Efe, bfe, Cfe, vfe, Afe, Rfe, xfe, Tfe, wfe, Ofe, kfe, Pfe, Ife, Dfe, Lfe, Mfe, Nfe, Ufe, Ffe, zfe, $fe, Hfe, jfe, Bfe, Kfe, Gfe, Wfe, Vfe, qfe, Zfe, Yfe, Jfe, Xfe, Qfe, eme, tme, nme, rme, ome, sme, ime, ame, lme, cme, ume, dme, pme, fme, mme, gme, hme, _me, yme, Sme, Eme, bme, Cme, vme, Ame, Rme, xme, Tme, wme, Ome, kme, Pme, Ime, Dme, Lme, Mme, Nme, Ume, Fme, zme, $me, Hme, jme, Bme, Kme, Gme, Wme, Vme, qme, Zme, Yme, Jme, NS, Xme, Qme, ege, tge, nge, rge, oge, sge, ige, age, lge, cge, uge, dge, pge, fge, mge, gge, hge, _ge, yge, Sge, Ege, bge, Cge, vge, Age, Rge, xge, Tge, wge, Oge, kge, Pge, Ige, Dge, Lge, Mge, Nge, Uge, Fge, zge, $ge, Hge, US, jge, Bge, Kge, Gge, Wge, Vge, qge, Zge, Yge, Jge, Xge, Qge, ehe, the, nhe, rhe, ohe, she, ihe, ahe, lhe, che, uhe, dhe, phe, fhe, mhe, ghe, hhe, _he, yhe, She, Ehe, bhe, Che, vhe, Ahe, Rhe, xhe, The, whe, Ohe, khe, Phe, Ihe, Dhe, Lhe, Mhe, Nhe, FS, rI, oI, Uhe, Fhe, zhe, $he, Hhe, jhe, Bhe, Khe, Ghe, Whe, Vhe, qhe, Zhe, Yhe, Jhe, Xhe, Qhe, e_e, t_e, n_e, r_e, o_e, s_e, i_e, a_e, l_e, c_e, u_e, d_e, p_e, f_e, m_e, g_e, h_e, __e, y_e, S_e, E_e, b_e, C_e, v_e, A_e, R_e, x_e, T_e, w_e, O_e, k_e, P_e, I_e, D_e, L_e, M_e, N_e, U_e, F_e, z_e, $_e, H_e, j_e, B_e, K_e, G_e, W_e, V_e, q_e, Z_e, Y_e, J_e, Q_e, Xn, eye, F8e, tye, z8e, nye, iI, rye, oye, lI, cye, uye, dye, _ye, on, vye, Aye, dI, C7e, v7e, ho, kI, PI, Dye, Sf, Lye, jc, Mye, Nye, LI, NI, Fye, VS, zye, $ye, x7e, zI, YS, KI, GI, VI, Hye, qS, ls, Kye, Gye, oD, nE, sD, So, Yc, vn, Zye, oE, sE, iD, aD, wf, Jc, Xc, kf, Qc, Pf, eu, fi, tu, mi, lD, cD, uD, dD, pD, fD, mD, gD, hD, _D, yD, SD, ED, bD, vD, AD, cE, RD, Xye, TD, wD, OD, kD, PD, uE, ID, DD, LD, MD, FD, If, nu, zD, $D, HD, jD, BD, zt, dE, Df, pE, fE, KD, GD, WD, VD, qD, ru, ZD, YD, JD, XD, QD, eL, tL, mE, yr, He, rL, ou, Je, yE, SE, EE, fL, mL, tSe, bE, CE, vE, AE, RE, xE, TE, wE, gL, hL, _L, yL, OE, sSe, kE, PE, IE, DE, LE, ME, NE, Nf, UE, FE, zE, $E, HE, jE, BE, cSe, gE, KE, vL, Uf, GE, WE, VE, qE, ZE, YE, Ff, JE, XE, QE, eb, tb, nb, zf, AL, rb, ob, sb, TL, ab, RL, xL, $f, Hf, dSe, fSe, OL, kL, Sr, FL, ML, zL, lu, hSe, iC, aC, lC, HL, jL, cC, uC, BL, dC, KL, pC, GL, fC, mC, WL, VL, qL, ZL, gC, YL, hC, JL, XL, _C, yC, SC, EC, QL, sC, bC, CC, vC, AC, RC, xC, TC, wC, OC, tM, qf, kC, $L, rM, ASe, Fn, oM, sM, iM, aM, lM, cM, uM, dM, pM, fM, mM, gM, Be, SM, LC, ct, MC, EM, bM, CM, pEe, fEe, Yf, mEe, gEe, hEe, _Ee, yEe, SEe, EEe, bEe, CEe, vEe, AEe, REe, xEe, TEe, wEe, OEe, NC, kEe, vM, PEe, IEe, DEe, LEe, MEe, fu, AM, NEe, UEe, IC, DC, FEe, zEe, qa, TM, HEe, jEe, KEe, wM, em, mu, qEe, ZEe, JEe, OM, Qn, kM, LM, nbe, rbe, abe, lbe, cbe, rm, pbe, At, hbe, BC, BM, Zet, WM, VM, qM, ZM, Cbe, vbe, YM, Abe, Rbe, JM, xbe, Tbe, QM, Ibe, eN, Lbe, nN, Mbe, Nbe, sm, rN, iN, Fbe, aN, $be, jbe, Kbe, Gbe, yu, lN, uN, dN, Xbe, KM, Qbe, eCe, tCe, oCe, iCe, _N, yN, wN, Ytt, ON, OCe, DCe, LN, $Ce, HCe, Cu, BCe, MN, VCe, QCe, ive, uve, VN, pve, fve, _rt, gve, Sve, nv, tv, GN, tU, Fve, Hve, iU, tAe, sAe, iAe, aAe, cAe, Ie, bU, Q, vo, F, zn, fAe, ms, mAe, _m, nn, he, Xa, an, lv, cv, Si, wu, se, br, CU, Oe, gAe, hAe, _Ae, yAe, SAe, EAe, bAe, CAe, vAe, uv, AAe, RAe, xAe, TAe, wAe, OAe, vU, kAe, Ro, el, tl, ym, ku, Sm, Pu, Iu, Em, Ei, xo, bm, Fr, ft, Du, Ao, pv, Lu, To, Cm, vm, nl, Ou, Mu, Nu, bi, Uu, rl, $r, zr, gs, Fu, zu, Am, fv, Rm, $u, wot, H, Oot, kot, Pot, Iot, Dot, Lot, Mot, Not, Uot, Fot, zot, $ot, Hot, jot, xU, Bot, Kot, Got, Wot, Vot, qot, Zot, Yot, Jot, Xot, Qot, est, tst, nst, rst, ost, sst, ist, ast, FAe, zAe, gv, OU, Ss, km, Mt, kU, PU, kst, HAe, jAe, hv, $n, Hu, IU, Yt, tr, nr, Jt, Pm, DU, _v, LU, MU, yv, ju, le, Sv, NU, Pst, Ist, Im, BAe, Dm, KAe, Bu, ol, UU, GAe, WAe, VAe, qAe, ZAe, YAe, Ev, JAe, XAe, bv, Lm, QAe, eRe, Mm, tRe, Ku, Gu, nRe, Wu, sl, rRe, Vu, Nm, Um, Fm, Dst, zm, $m, Hm, FU, zU, $U, Cv, HU, qu, il, jU, oRe, jm, sRe, Bm, iRe, vv, aRe, Km, lRe, cRe, uRe, dRe, pRe, fRe, mRe, gRe, hRe, _Re, Gm, yRe, SRe, Wm, Av, Rv, xv, ERe, bRe, CRe, Tv, vRe, ARe, RRe, xRe, TRe, BU, Vm, wRe, qm, Lst, ORe, al, kRe, Mst, Zu, PRe, wv, IRe, DRe, LRe, MRe, NRe, URe, FRe, Om, zRe, $Re, HRe, Yu, Ov, jRe, BRe, KRe, GRe, WRe, VRe, qRe, ZRe, YRe, JRe, XRe, QRe, exe, txe, nxe, rxe, oxe, sxe, ll, ixe, axe, lxe, Zm, cxe, uxe, dxe, kv, pxe, Nst, Ust, Fst, zst, $st, Hst, ae, WU, qU, VU, ZU, YU, Ym, e0, fxe, mxe, Dv, Cr, gxe, Ju, d0, h0, _0, v0, A0, Sxe, Exe, Mv, Cxe, Fv, Oj, kj, PA, IA, DA, Lj, Dj, aLe, NA, FA, uLe, dd, fLe, Po, SLe, ELe, zA, bLe, xLe, TLe, wLe, OLe, kLe, $j, qj, ILe, DLe, LLe, MLe, Ce, NLe, Wg, Oi, VA, Do, Jj, Xj, Qj, eB, tB, nB, qA, ZA, jA, Bj, jLe, BLe, GLe, rB, BA, Gg, GA, WA, VLe, qLe, Kj, Hs, sB, QLe, YA, iB, uB, eMe, dB, pB, fB, mB, tMe, XA, aB, QA, gB, hB, _B, yB, jn, lMe, SB, dMe, bB, mMe, fd, RB, hMe, Rr, TB, SMe, EMe, Pl, wB, Vg, AMe, Il, RMe, xMe, qg, OB, wMe, OMe, kB, eo, Dl, Zg, DB, NMe, FB, WMe, VMe, $B, HB, jB, BB, Ml, GB, nR, WB, Jg, KB, eNe, Bs, VB, gd, Nl, Xg, tNe, YB, qB, Pi, rK, iK, pNe, hd, _d, to, yd, nh, uK, aK, _Ne, lK, cK, Sd, Ul, rh, oh, dK, CNe, pK, sh, fK, RNe, xNe, TNe, mK, wNe, ONe, ih, Ed, lr, gK, hK, yK, SK, EK, ah, bK, FNe, CK, zNe, $Ne, HNe, vK, BNe, lh, AK, RK, xK, VNe, dn, TK, wK, OK, kK, PK, QNe, eUe, IK, DK, rUe, LK, MK, NK, UK, iUe, aUe, lUe, cUe, uUe, dUe, pUe, fUe, mUe, gUe, hUe, _Ue, yUe, SUe, EUe, bUe, CUe, vUe, AUe, FK, xUe, zK, $K, wUe, HK, OUe, jK, BK, PUe, KK, IUe, DUe, LUe, GK, MUe, NUe, UUe, FUe, WK, zUe, $Ue, HUe, VK, jUe, BUe, KUe, GUe, WUe, VUe, qUe, ZUe, YUe, JUe, XUe, QUe, e0e, t0e, n0e, r0e, Xe, qK, ZK, YK, JK, a0e, l0e, uh, XK, QK, e1, n1, r1, dh, m0e, g0e, h0e, _0e, bd, o1, S0e, Fl, s1, b0e, i1, Di, a1, l1, c1, u1, d1, p1, f1, P0e, I0e, m1, D0e, g1, h1, _1, vyt, U0e, y1, Ayt, iR, F0e, z0e, $0e, Gs, zl, fh, E1, b1, H0e, j0e, B0e, K0e, mh, $l, gh, Ws, aR, hh, _h, G0e, W0e, lR, R1, x1, V0e, uR, k1, P1, I1, D1, L1, Y0e, dR, J0e, Fyt, pR, X0e, fR, mR, Q0e, zyt, eFe, gR, hR, _R, $yt, M1, yR, N1, U1, tFe, nFe, rFe, oFe, iFe, Mi, cFe, $1, Wyt, Vyt, H1, j1, B1, K1, uFe, G1, W1, V1, q1, dFe, pFe, SR, fFe, eSt, tSt, mFe, jl, Vs, gFe, Y1, hFe, _Fe, X1, Q1, eG, yFe, SFe, tG, EFe, bFe, CFe, vFe, bR, CR, RFe, xFe, vR, TFe, Eh, nSt, Cd, wFe, OFe, aSt, rG, PFe, IFe, _St, oG, sG, bSt, CSt, HFe, jFe, $St, BFe, KFe, HSt, JSt, XSt, lG, OR, VFe, YFe, uG, eze, nze, gG, vd, vh, kR, zi, sze, yG, ize, yEt, Ad, $i, bG, Kn, AEt, REt, xEt, aze, AG, wG, $R, dze, $G, pze, fze, mze, gze, hze, BR, HG, jG, fbt, yze, Sze, Eze, Gn, ji, kG, PG, NR, UR, KR, GG, Cze, vze, Rze, GR, xze, Tze, xh, WR, Oze, kze, mbt, Pze, Ize, Dze, Lze, Mze, Nze, qG, Uze, Fze, zze, $ze, ZG, Hze, IG, jze, Bze, YG, Kze, Gze, DG, Wze, Vze, JG, qze, Zze, Yze, Jze, QG, Xze, Qze, e$e, t$e, r$e, o$e, s$e, i$e, a$e, eW, nW, c$e, m$e, xd, VR, gbt, hbt, _bt, h$e, qR, Th, MR, aW, _$e, S$e, lW, E$e, b$e, C$e, v$e, A$e, x$e, w$e, O$e, k$e, P$e, I$e, N$e, ybt, FR, Sbt, U$e, MG, Td, Ebt, bbt, uW, z$e, $$e, H$e, Cbt, j$e, B$e, vbt, Abt, K$e, Rbt, Oh, kh, G$e, YR, Ph, W$e, Ih, Mbt, Nbt, Ubt, Dh, V$e, Z$e, tx, EW, Id, Fh, X$e, xCt, Q$e, eHe, ix, ax, lx, cx, zh, $h, MW, tHe, nHe, aHe, uHe, dHe, Zs, pHe, CW, vW, AW, Nh, UW, fHe, mHe, gHe, hHe, _He, yHe, SHe, EHe, pn, dx, nx, Mh, Bi, AHe, TCt, xHe, Pd, RW, THe, xW, wHe, OHe, Hh, kHe, TW, fx, Bh, Ki, KW, Gl, PHe, Kh, kW, Wl, NHe, Ld, UHe, tV, rV, jHe, XHe, cvt, tje, fV, mV, sje, aje, _V, yV, pje, zvt, $vt, gje, yje, Sje, Kvt, Gvt, eAt, RV, Eje, bje, mAt, Cje, gAt, xV, wV, OV, Js, Lje, FV, Yh, Jh, Md, Tx, zV, $V, HV, Xh, jV, cr, KV, Mo, Fje, zje, yRt, jje, Gje, Vje, sBe, YV, e22, o_, gBe, t2, s_, kx, o2, LBe, UBe, $x, Vi, R2, KBe, GBe, Dx, ZBe, k2, n_, l2, sKe, lKe, z2, bKe, RKe, ec, W2, H2, xKe, wKe, PKe, IKe, $Ke, X2, HKe, jKe, BKe, KKe, VKe, eTt, qKe, tTt, nTt, ZKe, rTt, YKe, oTt, JKe, Wx, XKe, iTt, eq, tq, QKe, nq, rq, e1e, t1e, oq, sq, n1e, r1e, aTt, lTt, c1e, Zx, cq, u1e, uq, a_, d1e, Xx, nc, S1e, c_, mq, gq, Qx, hq, _q, E1e, Sq, u_, rc, d_, b1e, bq, Uo, Cq, vq, A1e, Yd, Jd, R1e, x1e, Aq, gn, T1e, w1e, O1e, Xs, k1e, P1e, xq, Pwt, I1e, Oq, kq, Pq, D1e, L1e, Iq, M1e, N1e, nT, U1e, p_, rT, Dq, oT, iT, F1e, Uq, aT, jq, K1e, Gq, yOt, sGe, cGe, uGe, yGe;
77458
+ var import_node_module, import_crypto, import_crypto2, import_path, import_node_fs15, import_node_process4, import_fs, import_os, import_path2, yy, import_fs2, import_promises, import_path3, import_readline, import_promises2, import_path4, import_os2, import_path5, Se, import_promises3, xe, import_promises4, import_fs3, import_promises5, import_os3, import_path6, import_promises6, import_os4, import_node_path39, import_node_os10, import_node_process5, import_path7, import_events, import_fs4, import_promises7, import_path8, import_child_process, import_util9, import_child_process2, import_fs5, import_path9, import_path10, import_crypto3, import_fs6, import_path11, import_promises8, import_path12, import_path13, import_promises9, import_path14, import_path15, import_fs7, import_promises10, import_path16, import_crypto4, import_path17, import_async_hooks, import_fs8, import_promises11, import_crypto5, import_fs9, import_promises12, import_path18, import_promises13, import_path19, import_crypto6, import_path20, import_path21, import_path22, import_path23, import_promises14, import_fs10, import_promises15, import_path24, import_util10, import_path25, import_os5, import_path26, import_path27, import_path28, import_path29, import_path30, import_net, import_os6, import_child_process3, import_fs11, import_child_process4, import_crypto7, import_promises16, import_module, import_os7, import_path31, import_url, import_events2, import_child_process5, import_fs12, import_readline2, import_string_decoder, import_fs13, import_promises17, import_os8, import_path32, import_crypto8, import_os9, import_fs14, import_path33, import_crypto9, import_fs15, import_promises18, import_path34, IZ, DZ, v_, LZ, OT, NZ, UZ, kT, X, FZ, dr, HZ, jZ, BZ, ot, st, ed, Kv, Te, Me, Oo, nd, hF, Xv, Qv, rd, LF, or, WF, ZF, sA, XF, od, sd, hg, id, Sg, Oz, fA, $z, Wz, Zz, s$, a$, d$, f$, g$, _$, E$, v$, T$, O$, I$, L$, wg, z$, j$, G$, V$, yA, SA, rH, lH, uH, _H, EH, EA, RH, TH, kH, DH, NH, zH, jH, GH, VH, ZH, JH, ej, nj, ij, cj, uj, CA, bj, Aj, wj, PT, KZ, GZ, VGe, VZ, MT, wr, jo, JZ, XZ, NT, UT, FT, zT, Bo, $T, HT, jT, BT, a4, sp, l4, c4, vt, u4, Nt, KT, d4, p4, uc, GT, m4, g4, WT, _4, y4, VT, Dn, Et, b4, C4, v4, A4, ra, x4, ip, qT, ZT, w4, O4, ro, P4, I4, D4, L4, M4, N4, U4, YT, JT, Sn, H4, Ko, j4, oo, XT, QT, G4, W4, V4, ew, Z4, Y4, tw, X4, nw, R_, rw, ow, Go, sw, iw, aw, lw, ei, aY, cw, Or, cY, uw, dw, lp, pw, cp, mY, gY, up, _Y, aa, fw, la, EY, bY, CY, vY, AY, RY, xY, TY, wY, OY, kY, PY, IY, mw, x_, gw, ca, MY, et, dp, hw, pp, zY, $Y, _w, HY, ua, yw, wt, KY, T_, Sw, WY, VY, qY, so, mp, Ew, vw, bw, YY, Cw, JY, XY, kr, QY, e9, Wo, n9, da, o9, s9, i9, a9, l9, c9, u9, d9, p9, f9, m9, g9, h9, _9, y9, S9, E9, b9, C9, v9, A9, R9, x9, T9, Qe, Aw, pa, hp, Rw, dc, k9, w_, P9, Pr, xw, I9, fa, D9, L9, _p, N9, ma, yp, z9, Tw, $9, H9, ww, Vo, Ir, pc, W9, V9, q9, Ow, Y9, Sp, J9, Ep, X9, qo, Q9, bp, kw, eJ, Pw, Iw, Dw, Lw, tJ, nJ, rJ, oJ, sJ, ti, io, iJ, Mw, Nw, Cp, aJ, Uw, Fw, ga, pr, uJ, Fe, $w, O_, k_, I_, ha, Bw, D_, qw, Vw, N_, U_, yJ, _a3, Yo, Zw, bJ, Rp, Yw, vJ, AJ, Jw, xp, Xw, Tp, Qw, kJ, ya, IJ, DJ, Sa, MJ, fc, NJ, eO, FJ, zJ, $J, tO, Ea, jJ, nO, rO, sO, iO, Vn, GJ, Ln, Jo, aO, lO, cO, wp, XJ, QJ, uO, ba, dO, pO, fO, Dr, ao, mO, Ca, gO, z_, $_, H_, j_, B_, K_, G_, W_, V_, q_, Z_, _O, Y_, J_, yO, X_, c3, Q_, ey, ty, ny, ry, oy, sy, iy, ay, ly, cy, we, SO, en, d3, Pp, vO, g3, gy, wO, S3, BO, KO, Ip, Dp, v3, GO, WO, F9e, IO, A3, hy, x3, NO, I3, Ay, Ry, D3, xy, L3, bc, xa, Ty, wy, Oy, ky, XO, Py, Iy, Dy, Ly, My, Ny, Uy, Fy, zy, nk, rk, d3e, p3e, f3e, m3e, g3e, U3, jp, jy, ik, By, Ky, lk, $3, uk, ck, G3, W3, V3, it, Y3, J3, hk, tXe, Q3, kt, We, gX, Ta, SX, mr, Yp, Jp, eS, nS, yXe, IX, DX, rS, ka, oS, Ok, kk, HX, jX, ef, bXe, Uk, Mr, wc, Fk, Pa, OXe, kXe, iS, PXe, IXe, DXe, GX, YX, JX, XX, QX, e6, t6, Yk, n6, r6, o6, s6, i6, a6, l6, c6, Vk, uS, lf, dS, Qk, eP, uf, os10, qXe, ZXe, h6, tP, df, _6, y6, S6, E6, b6, Jn, gr, nP, rP, Dc, pS, oP, gS, lP, C6, mS, lS, sP, w6, O6, dP, k6, YXe, JXe, P6, I6, pf, L6, fP, XXe, QXe, M6, SS, z6, $6, j6, bP, CP, G6, Lc, si, Z6, ES, bS, X6, Q6, e5, t5, n5, u5, r5, o5, s5, i5, a5, l5, c5, u52, d5, p5, f5, m5, g5, h5, _5, y5, S5, E5, b5, C5, v5, A5, R5, x5, T5, w5, O5, k5, P5, I5, D5, L5, M5, N5, U5, F5, z5, $5, H5, j5, B5, K5, G5, W5, V5, q5, Z5, Y5, J5, X5, Q5, e8, t8, n8, r8, o8, s8, i8, a8, l8, c8, u8, d8, CS, p8, f8, m8, g8, h8, _8, y8, S8, E8, b8, C8, v8, A8, R8, x8, T8, w8, O8, k8, P8, I8, D8, L8, M8, N8, U8, F8, z8, $8, H8, j8, B8, K8, G8, W8, V8, q8, Z8, Y8, J8, X8, Q8, e7, t7, n7, r7, o7, s7, i7, a7, l7, c7, u7, d7, p7, f7, m7, g7, h7, _7, y7, S7, E7, b7, C7, TP, v7, L6e, RP, A7, x7, kP, ff, U6e, F6e, Ua, z6e, $6e, H6e, j6e, PP, IP, vS, DP, w7, LP, O7, k7, P7, AS, RS, xS, I7, MP, NP, D7, G6e, L7, W6e, M7, N7, UP, V6e, U7, F7, z7, $7, H7, j7, B7, q6e, is, wS, Fa, K7, G7, W7, i5e, X7, Q7, HP, $P, BP, tQ, WP, VP, JP, _Q, QP, eI, xQ, Uc, DS, $a, wQ, OQ, kQ, PQ, IQ, DQ, LQ, MQ, NQ, UQ, FQ, zQ, $Q, HQ, jQ, BQ, KQ, GQ, WQ, VQ, qQ, ZQ, YQ, JQ, XQ, QQ, eee, tee, nee, ree, oee, see, iee, aee, lee, cee, uee, dee, pee, fee, mee, gee, hee, _ee, yee, See, Eee, bee, Cee, vee, Aee, Ree, xee, Tee, wee, Oee, kee, Pee, Iee, Dee, Lee, Mee, Nee, Uee, Fee, zee, $ee, Hee, jee, Bee, Kee, Gee, Wee, Vee, qee, Zee, Yee, Jee, Xee, Qee, ete, tte, nte, rte, ote, ste, ite, ate, lte, cte, ute, dte, pte, fte, mte, gte, hte, _te, yte, Ste, Ete, bte, Cte, vte, Ate, Rte, xte, Tte, wte, Ote, kte, Pte, Ite, Dte, Lte, Mte, Nte, Ute, Fte, zte, $te, Hte, jte, Bte, Kte, Gte, Wte, Vte, qte, Zte, Yte, Jte, Xte, Qte, ene, tne, nne, rne, one, sne, ine, ane, lne, cne, une, dne, pne, fne, mne, gne, hne, _ne, yne, Sne, Ene, bne, Cne, vne, Ane, Rne, xne, Tne, wne, One, kne, Pne, Ine, Dne, Lne, Mne, Nne, Une, Fne, zne, $ne, Hne, jne, Bne, Kne, Gne, Wne, Vne, qne, Zne, Yne, Jne, Xne, Qne, ere, tre, nre, rre, ore, sre, ire, are, lre, cre, ure, dre, pre, fre, mre, gre, hre, _re, yre, Sre, Ere, bre, Cre, vre, Are, Rre, xre, Tre, wre, Ore, kre, Pre, Ire, Dre, Lre, Mre, Nre, Ure, Fre, zre, $re, Hre, jre, Bre, Kre, Gre, Wre, Vre, qre, Zre, Yre, Jre, Xre, Qre, eoe, toe, noe, roe, ooe, soe, ioe, aoe, loe, coe, uoe, doe, poe, foe, moe, goe, hoe, _oe, yoe, Soe, Eoe, boe, Coe, voe, Aoe, Roe, xoe, Toe, woe, Ooe, koe, Poe, Ioe, Doe, Loe, Moe, Noe, Uoe, Foe, zoe, $oe, Hoe, joe, Boe, Koe, Goe, Woe, Voe, qoe, Zoe, Yoe, Joe, Xoe, Qoe, ese, tse, nse, rse, ose, sse, ise, ase, lse, cse, use, dse, pse, fse, mse, gse, hse, _se, yse, Sse, Ese, LS, bse, Cse, vse, Ase, Rse, xse, Tse, wse, Ose, kse, Pse, Ise, Dse, Lse, Mse, Nse, Use, Fse, zse, $se, Hse, jse, Bse, Kse, Gse, Wse, Vse, qse, Zse, Yse, Jse, Xse, Qse, eie, tie, nie, rie, oie, sie, iie, aie, lie, cie, uie, die, pie, fie, mie, gie, hie, _ie, yie, Sie, Eie, bie, Cie, vie, Aie, Rie, xie, Tie, wie, Oie, kie, Pie, Iie, Die, Lie, Mie, Nie, Uie, Fie, zie, $ie, Hie, jie, Bie, Kie, Gie, Wie, Vie, qie, Zie, Yie, Jie, Xie, Qie, eae, tae, nae, rae, oae, sae, iae, aae, lae, cae, uae, dae, pae, fae, mae, gae, hae, _ae, yae, Sae, Eae, bae, Cae, vae, Aae, Rae, xae, Tae, wae, Oae, kae, Pae, Iae, Dae, Lae, Mae, Nae, Uae, Fae, zae, $ae, Hae, jae, Bae, Kae, Gae, Wae, Vae, qae, Zae, Yae, Jae, Xae, Qae, ele, tle, nle, rle, ole, sle, ile, ale, lle, cle, ule, dle, ple, fle, mle, gle, hle, _le, yle, Sle, Ele, ble, Cle, vle, Ale, Rle, xle, Tle, wle, Ole, kle, Ple, Ile, Dle, Lle, Mle, Nle, Ule, Fle, zle, $le, Hle, jle, Ble, Kle, Gle, Wle, Vle, qle, Zle, Yle, Jle, MS, Xle, Qle, ece, tce, nce, rce, oce, sce, ice, ace, lce, cce, uce, dce, pce, fce, mce, gce, hce, _ce, yce, Sce, Ece, bce, Cce, vce, Ace, Rce, xce, Tce, wce, Oce, kce, Pce, Ice, Dce, Lce, Mce, Nce, Uce, Fce, zce, $ce, Hce, jce, Bce, Kce, Gce, Wce, Vce, qce, Zce, Yce, Jce, Xce, Qce, eue, tue, nue, rue, oue, sue, iue, aue, lue, cue, uue, due, pue, fue, mue, gue, hue, _ue, yue, Sue, Eue, bue, Cue, vue, Aue, Rue, xue, Tue, wue, Oue, kue, Pue, Iue, Due, Lue, Mue, Nue, Uue, Fue, zue, $ue, Hue, jue, Bue, Kue, Gue, Wue, Vue, que, Zue, Yue, Jue, Xue, Que, ede, tde, nde, rde, ode, sde, ide, ade, lde, cde, ude, dde, pde, fde, mde, gde, hde, _de, yde, Sde, Ede, bde, Cde, vde, Ade, Rde, xde, Tde, wde, Ode, kde, Pde, Ide, Dde, Lde, Mde, Nde, Ude, Fde, zde, $de, Hde, jde, Bde, Kde, Gde, Wde, Vde, qde, Zde, Yde, Jde, Xde, Qde, epe, tpe, npe, rpe, ope, spe, ipe, ape, lpe, cpe, upe, dpe, ppe, fpe, mpe, gpe, hpe, _pe, ype, Spe, Epe, bpe, Cpe, vpe, Ape, Rpe, xpe, Tpe, wpe, Ope, kpe, Ppe, Ipe, Dpe, Lpe, Mpe, Npe, Upe, Fpe, zpe, $pe, Hpe, jpe, Bpe, Kpe, Gpe, Wpe, Vpe, qpe, Zpe, Ype, Jpe, Xpe, Qpe, efe, tfe, nfe, rfe, ofe, sfe, ife, afe, lfe, cfe, ufe, dfe, pfe, ffe, mfe, gfe, hfe, _fe, yfe, Sfe, Efe, bfe, Cfe, vfe, Afe, Rfe, xfe, Tfe, wfe, Ofe, kfe, Pfe, Ife, Dfe, Lfe, Mfe, Nfe, Ufe, Ffe, zfe, $fe, Hfe, jfe, Bfe, Kfe, Gfe, Wfe, Vfe, qfe, Zfe, Yfe, Jfe, Xfe, Qfe, eme, tme, nme, rme, ome, sme, ime, ame, lme, cme, ume, dme, pme, fme, mme, gme, hme, _me, yme, Sme, Eme, bme, Cme, vme, Ame, Rme, xme, Tme, wme, Ome, kme, Pme, Ime, Dme, Lme, Mme, Nme, Ume, Fme, zme, $me, Hme, jme, Bme, Kme, Gme, Wme, Vme, qme, Zme, Yme, Jme, NS, Xme, Qme, ege, tge, nge, rge, oge, sge, ige, age, lge, cge, uge, dge, pge, fge, mge, gge, hge, _ge, yge, Sge, Ege, bge, Cge, vge, Age, Rge, xge, Tge, wge, Oge, kge, Pge, Ige, Dge, Lge, Mge, Nge, Uge, Fge, zge, $ge, Hge, US, jge, Bge, Kge, Gge, Wge, Vge, qge, Zge, Yge, Jge, Xge, Qge, ehe, the, nhe, rhe, ohe, she, ihe, ahe, lhe, che, uhe, dhe, phe, fhe, mhe, ghe, hhe, _he, yhe, She, Ehe, bhe, Che, vhe, Ahe, Rhe, xhe, The, whe, Ohe, khe, Phe, Ihe, Dhe, Lhe, Mhe, Nhe, FS, rI, oI, Uhe, Fhe, zhe, $he, Hhe, jhe, Bhe, Khe, Ghe, Whe, Vhe, qhe, Zhe, Yhe, Jhe, Xhe, Qhe, e_e, t_e, n_e, r_e, o_e, s_e, i_e, a_e, l_e, c_e, u_e, d_e, p_e, f_e, m_e, g_e, h_e, __e, y_e, S_e, E_e, b_e, C_e, v_e, A_e, R_e, x_e, T_e, w_e, O_e, k_e, P_e, I_e, D_e, L_e, M_e, N_e, U_e, F_e, z_e, $_e, H_e, j_e, B_e, K_e, G_e, W_e, V_e, q_e, Z_e, Y_e, J_e, Q_e, Xn, eye, F8e, tye, z8e, nye, iI, rye, oye, lI, cye, uye, dye, _ye, on, vye, Aye, dI, C7e, v7e, ho, kI, PI, Dye, Sf, Lye, jc, Mye, Nye, LI, NI, Fye, VS, zye, $ye, x7e, zI, YS, KI, GI, VI, Hye, qS, ls, Kye, Gye, oD, nE, sD, So, Yc, vn, Zye, oE, sE, iD, aD, wf, Jc, Xc, kf, Qc, Pf, eu, fi, tu, mi, lD, cD, uD, dD, pD, fD, mD, gD, hD, _D, yD, SD, ED, bD, vD, AD, cE, RD, Xye, TD, wD, OD, kD, PD, uE, ID, DD, LD, MD, FD, If, nu, zD, $D, HD, jD, BD, zt, dE, Df, pE, fE, KD, GD, WD, VD, qD, ru, ZD, YD, JD, XD, QD, eL, tL, mE, yr, He, rL, ou, Je, yE, SE, EE, fL, mL, tSe, bE, CE, vE, AE, RE, xE, TE, wE, gL, hL, _L, yL, OE, sSe, kE, PE, IE, DE, LE, ME, NE, Nf, UE, FE, zE, $E, HE, jE, BE, cSe, gE, KE, vL, Uf, GE, WE, VE, qE, ZE, YE, Ff, JE, XE, QE, eb, tb, nb, zf, AL, rb, ob, sb, TL, ab, RL, xL, $f, Hf, dSe, fSe, OL, kL, Sr, FL, ML, zL, lu, hSe, iC, aC, lC, HL, jL, cC, uC, BL, dC, KL, pC, GL, fC, mC, WL, VL, qL, ZL, gC, YL, hC, JL, XL, _C, yC, SC, EC, QL, sC, bC, CC, vC, AC, RC, xC, TC, wC, OC, tM, qf, kC, $L, rM, ASe, Fn, oM, sM, iM, aM, lM, cM, uM, dM, pM, fM, mM, gM, Be, SM, LC, ct, MC, EM, bM, CM, pEe, fEe, Yf, mEe, gEe, hEe, _Ee, yEe, SEe, EEe, bEe, CEe, vEe, AEe, REe, xEe, TEe, wEe, OEe, NC, kEe, vM, PEe, IEe, DEe, LEe, MEe, fu, AM, NEe, UEe, IC, DC, FEe, zEe, qa, TM, HEe, jEe, KEe, wM, em, mu, qEe, ZEe, JEe, OM, Qn, kM, LM, nbe, rbe, abe, lbe, cbe, rm, pbe, At, hbe, BC, BM, Zet, WM, VM, qM, ZM, Cbe, vbe, YM, Abe, Rbe, JM, xbe, Tbe, QM, Ibe, eN, Lbe, nN, Mbe, Nbe, sm, rN, iN, Fbe, aN, $be, jbe, Kbe, Gbe, yu, lN, uN, dN, Xbe, KM, Qbe, eCe, tCe, oCe, iCe, _N, yN, wN, Ytt, ON, OCe, DCe, LN, $Ce, HCe, Cu, BCe, MN, VCe, QCe, ive, uve, VN, pve, fve, _rt, gve, Sve, nv, tv, GN, tU, Fve, Hve, iU, tAe, sAe, iAe, aAe, cAe, Ie, bU, Q, vo, F, zn, fAe, ms, mAe, _m, nn, he, Xa, an, lv, cv, Si, wu, se, br, CU, Oe, gAe, hAe, _Ae, yAe, SAe, EAe, bAe, CAe, vAe, uv, AAe, RAe, xAe, TAe, wAe, OAe, vU, kAe, Ro, el, tl, ym, ku, Sm, Pu, Iu, Em, Ei, xo, bm, Fr, ft, Du, Ao, pv, Lu, To, Cm, vm, nl, Ou, Mu, Nu, bi, Uu, rl, $r, zr, gs, Fu, zu, Am, fv, Rm, $u, wot, H, Oot, kot, Pot, Iot, Dot, Lot, Mot, Not, Uot, Fot, zot, $ot, Hot, jot, xU, Bot, Kot, Got, Wot, Vot, qot, Zot, Yot, Jot, Xot, Qot, est, tst, nst, rst, ost, sst, ist, ast, FAe, zAe, gv, OU, Ss, km, Mt, kU, PU, kst, HAe, jAe, hv, $n, Hu, IU, Yt, tr, nr, Jt, Pm, DU, _v, LU, MU, yv, ju, le, Sv, NU, Pst, Ist, Im, BAe, Dm, KAe, Bu, ol, UU, GAe, WAe, VAe, qAe, ZAe, YAe, Ev, JAe, XAe, bv, Lm, QAe, eRe, Mm, tRe, Ku, Gu, nRe, Wu, sl, rRe, Vu, Nm, Um, Fm, Dst, zm, $m, Hm, FU, zU, $U, Cv, HU, qu, il, jU, oRe, jm, sRe, Bm, iRe, vv, aRe, Km, lRe, cRe, uRe, dRe, pRe, fRe, mRe, gRe, hRe, _Re, Gm, yRe, SRe, Wm, Av, Rv, xv, ERe, bRe, CRe, Tv, vRe, ARe, RRe, xRe, TRe, BU, Vm, wRe, qm, Lst, ORe, al, kRe, Mst, Zu, PRe, wv, IRe, DRe, LRe, MRe, NRe, URe, FRe, Om, zRe, $Re, HRe, Yu, Ov, jRe, BRe, KRe, GRe, WRe, VRe, qRe, ZRe, YRe, JRe, XRe, QRe, exe, txe, nxe, rxe, oxe, sxe, ll, ixe, axe, lxe, Zm, cxe, uxe, dxe, kv, pxe, Nst, Ust, Fst, zst, $st, Hst, ae, WU, qU, VU, ZU, YU, Ym, e0, fxe, mxe, Dv, Cr, gxe, Ju, d0, h0, _0, v0, A0, Sxe, Exe, Mv, Cxe, Fv, Oj, kj, PA, IA, DA, Lj, Dj, aLe, NA, FA, uLe, dd, fLe, Po, SLe, ELe, zA, bLe, xLe, TLe, wLe, OLe, kLe, $j, qj, ILe, DLe, LLe, MLe, Ce, NLe, Wg, Oi, VA, Do, Jj, Xj, Qj, eB, tB, nB, qA, ZA, jA, Bj, jLe, BLe, GLe, rB, BA, Gg, GA, WA, VLe, qLe, Kj, Hs, sB, QLe, YA, iB, uB, eMe, dB, pB, fB, mB, tMe, XA, aB, QA, gB, hB, _B, yB, jn, lMe, SB, dMe, bB, mMe, fd, RB, hMe, Rr, TB, SMe, EMe, Pl, wB, Vg, AMe, Il, RMe, xMe, qg, OB, wMe, OMe, kB, eo, Dl, Zg, DB, NMe, FB, WMe, VMe, $B, HB, jB, BB, Ml, GB, nR, WB, Jg, KB, eNe, Bs, VB, gd, Nl, Xg, tNe, YB, qB, Pi, rK, iK, pNe, hd, _d, to, yd, nh, uK, aK, _Ne, lK, cK, Sd, Ul, rh, oh, dK, CNe, pK, sh, fK, RNe, xNe, TNe, mK, wNe, ONe, ih, Ed, lr, gK, hK, yK, SK, EK, ah, bK, FNe, CK, zNe, $Ne, HNe, vK, BNe, lh, AK, RK, xK, VNe, dn, TK, wK, OK, kK, PK, QNe, eUe, IK, DK, rUe, LK, MK, NK, UK, iUe, aUe, lUe, cUe, uUe, dUe, pUe, fUe, mUe, gUe, hUe, _Ue, yUe, SUe, EUe, bUe, CUe, vUe, AUe, FK, xUe, zK, $K, wUe, HK, OUe, jK, BK, PUe, KK, IUe, DUe, LUe, GK, MUe, NUe, UUe, FUe, WK, zUe, $Ue, HUe, VK, jUe, BUe, KUe, GUe, WUe, VUe, qUe, ZUe, YUe, JUe, XUe, QUe, e0e, t0e, n0e, r0e, Xe, qK, ZK, YK, JK, a0e, l0e, uh, XK, QK, e1, n1, r1, dh, m0e, g0e, h0e, _0e, bd, o1, S0e, Fl, s1, b0e, i1, Di, a1, l1, c1, u1, d1, p1, f1, P0e, I0e, m1, D0e, g1, h1, _1, vyt, U0e, y1, Ayt, iR, F0e, z0e, $0e, Gs, zl, fh, E1, b1, H0e, j0e, B0e, K0e, mh, $l, gh, Ws, aR, hh, _h, G0e, W0e, lR, R1, x1, V0e, uR, k1, P1, I1, D1, L1, Y0e, dR, J0e, Fyt, pR, X0e, fR, mR, Q0e, zyt, eFe, gR, hR, _R, $yt, M1, yR, N1, U1, tFe, nFe, rFe, oFe, iFe, Mi, cFe, $1, Wyt, Vyt, H1, j1, B1, K1, uFe, G1, W1, V1, q1, dFe, pFe, SR, fFe, eSt, tSt, mFe, jl, Vs, gFe, Y1, hFe, _Fe, X1, Q1, eG, yFe, SFe, tG, EFe, bFe, CFe, vFe, bR, CR, RFe, xFe, vR, TFe, Eh, nSt, Cd, wFe, OFe, aSt, rG, PFe, IFe, _St, oG, sG, bSt, CSt, HFe, jFe, $St, BFe, KFe, HSt, JSt, XSt, lG, OR, VFe, YFe, uG, eze, nze, gG, vd, vh, kR, zi, sze, yG, ize, yEt, Ad, $i, bG, Kn, AEt, REt, xEt, aze, AG, wG, $R, dze, $G, pze, fze, mze, gze, hze, BR, HG, jG, fbt, yze, Sze, Eze, Gn, ji, kG, PG, NR, UR, KR, GG, Cze, vze, Rze, GR, xze, Tze, xh, WR, Oze, kze, mbt, Pze, Ize, Dze, Lze, Mze, Nze, qG, Uze, Fze, zze, $ze, ZG, Hze, IG, jze, Bze, YG, Kze, Gze, DG, Wze, Vze, JG, qze, Zze, Yze, Jze, QG, Xze, Qze, e$e, t$e, r$e, o$e, s$e, i$e, a$e, eW, nW, c$e, m$e, xd, VR, gbt, hbt, _bt, h$e, qR, Th, MR, aW, _$e, S$e, lW, E$e, b$e, C$e, v$e, A$e, x$e, w$e, O$e, k$e, P$e, I$e, N$e, ybt, FR, Sbt, U$e, MG, Td, Ebt, bbt, uW, z$e, $$e, H$e, Cbt, j$e, B$e, vbt, Abt, K$e, Rbt, Oh, kh, G$e, YR, Ph, W$e, Ih, Mbt, Nbt, Ubt, Dh, V$e, Z$e, tx, EW, Id, Fh, X$e, xCt, Q$e, eHe, ix, ax, lx, cx, zh, $h, MW, tHe, nHe, aHe, uHe, dHe, Zs, pHe, CW, vW, AW, Nh, UW, fHe, mHe, gHe, hHe, _He, yHe, SHe, EHe, pn, dx, nx, Mh, Bi, AHe, TCt, xHe, Pd, RW, THe, xW, wHe, OHe, Hh, kHe, TW, fx, Bh, Ki, KW, Gl, PHe, Kh, kW, Wl, NHe, Ld, UHe, tV, rV, jHe, XHe, cvt, tje, fV, mV, sje, aje, _V, yV, pje, zvt, $vt, gje, yje, Sje, Kvt, Gvt, eAt, RV, Eje, bje, mAt, Cje, gAt, xV, wV, OV, Js, Lje, FV, Yh, Jh, Md, Tx, zV, $V, HV, Xh, jV, cr, KV, Mo, Fje, zje, yRt, jje, Gje, Vje, sBe, YV, e22, o_, gBe, t2, s_, kx, o2, LBe, UBe, $x, Vi, R2, KBe, GBe, Dx, ZBe, k2, n_, l2, sKe, lKe, z2, bKe, RKe, ec, W2, H2, xKe, wKe, PKe, IKe, $Ke, X2, HKe, jKe, BKe, KKe, VKe, eTt, qKe, tTt, nTt, ZKe, rTt, YKe, oTt, JKe, Wx, XKe, iTt, eq, tq, QKe, nq, rq, e1e, t1e, oq, sq, n1e, r1e, aTt, lTt, c1e, Zx, cq, u1e, uq, a_, d1e, Xx, nc, S1e, c_, mq, gq, Qx, hq, _q, E1e, Sq, u_, rc, d_, b1e, bq, Uo, Cq, vq, A1e, Yd, Jd, R1e, x1e, Aq, gn, T1e, w1e, O1e, Xs, k1e, P1e, xq, Pwt, I1e, Oq, kq, Pq, D1e, L1e, Iq, M1e, N1e, nT, U1e, p_, rT, Dq, oT, iT, F1e, Uq, aT, jq, K1e, Gq, yOt, sGe, cGe, uGe, yGe;
77449
77459
  var init_sdk = __esm({
77450
77460
  "node_modules/.pnpm/@anthropic-ai+claude-agent-sdk@0.3.292_@anthropic-ai+sdk@0.131.0_zod@4.6.5__@modelconte_9caa915130557974815a7ac66b010e49/node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs"() {
77451
77461
  import_node_module = require("node:module");
77452
77462
  import_crypto = require("crypto");
77453
77463
  import_crypto2 = require("crypto");
77454
77464
  import_path = require("path");
77455
- import_node_fs14 = require("node:fs");
77465
+ import_node_fs15 = require("node:fs");
77456
77466
  import_node_process4 = require("node:process");
77457
77467
  import_fs = require("fs");
77458
77468
  import_os = require("os");
@@ -77476,7 +77486,7 @@ var init_sdk = __esm({
77476
77486
  import_path6 = require("path");
77477
77487
  import_promises6 = require("fs/promises");
77478
77488
  import_os4 = require("os");
77479
- import_node_path37 = __toESM(require("node:path"), 1);
77489
+ import_node_path39 = __toESM(require("node:path"), 1);
77480
77490
  import_node_os10 = __toESM(require("node:os"), 1);
77481
77491
  import_node_process5 = __toESM(require("node:process"), 1);
77482
77492
  import_path7 = require("path");
@@ -85927,16 +85937,16 @@ var init_sdk = __esm({
85927
85937
  wS = import_node_os10.default.tmpdir();
85928
85938
  ({ env: Fa } = import_node_process5.default);
85929
85939
  K7 = (e14) => {
85930
- let t10 = import_node_path37.default.join(is, "Library");
85931
- return { data: import_node_path37.default.join(t10, "Application Support", e14), config: import_node_path37.default.join(t10, "Preferences", e14), cache: import_node_path37.default.join(t10, "Caches", e14), log: import_node_path37.default.join(t10, "Logs", e14), temp: import_node_path37.default.join(wS, e14) };
85940
+ let t10 = import_node_path39.default.join(is, "Library");
85941
+ return { data: import_node_path39.default.join(t10, "Application Support", e14), config: import_node_path39.default.join(t10, "Preferences", e14), cache: import_node_path39.default.join(t10, "Caches", e14), log: import_node_path39.default.join(t10, "Logs", e14), temp: import_node_path39.default.join(wS, e14) };
85932
85942
  };
85933
85943
  G7 = (e14) => {
85934
- let t10 = Fa.APPDATA || import_node_path37.default.join(is, "AppData", "Roaming"), n10 = Fa.LOCALAPPDATA || import_node_path37.default.join(is, "AppData", "Local");
85935
- return { data: import_node_path37.default.join(n10, e14, "Data"), config: import_node_path37.default.join(t10, e14, "Config"), cache: import_node_path37.default.join(n10, e14, "Cache"), log: import_node_path37.default.join(n10, e14, "Log"), temp: import_node_path37.default.join(wS, e14) };
85944
+ let t10 = Fa.APPDATA || import_node_path39.default.join(is, "AppData", "Roaming"), n10 = Fa.LOCALAPPDATA || import_node_path39.default.join(is, "AppData", "Local");
85945
+ return { data: import_node_path39.default.join(n10, e14, "Data"), config: import_node_path39.default.join(t10, e14, "Config"), cache: import_node_path39.default.join(n10, e14, "Cache"), log: import_node_path39.default.join(n10, e14, "Log"), temp: import_node_path39.default.join(wS, e14) };
85936
85946
  };
85937
85947
  W7 = (e14) => {
85938
- let t10 = import_node_path37.default.basename(is);
85939
- return { data: import_node_path37.default.join(Fa.XDG_DATA_HOME || import_node_path37.default.join(is, ".local", "share"), e14), config: import_node_path37.default.join(Fa.XDG_CONFIG_HOME || import_node_path37.default.join(is, ".config"), e14), cache: import_node_path37.default.join(Fa.XDG_CACHE_HOME || import_node_path37.default.join(is, ".cache"), e14), log: import_node_path37.default.join(Fa.XDG_STATE_HOME || import_node_path37.default.join(is, ".local", "state"), e14), temp: import_node_path37.default.join(wS, t10, e14) };
85948
+ let t10 = import_node_path39.default.basename(is);
85949
+ return { data: import_node_path39.default.join(Fa.XDG_DATA_HOME || import_node_path39.default.join(is, ".local", "share"), e14), config: import_node_path39.default.join(Fa.XDG_CONFIG_HOME || import_node_path39.default.join(is, ".config"), e14), cache: import_node_path39.default.join(Fa.XDG_CACHE_HOME || import_node_path39.default.join(is, ".cache"), e14), log: import_node_path39.default.join(Fa.XDG_STATE_HOME || import_node_path39.default.join(is, ".local", "state"), e14), temp: import_node_path39.default.join(wS, t10, e14) };
85940
85950
  };
85941
85951
  i5e = OS("claude-cli");
85942
85952
  X7 = 100;
@@ -99989,8 +99999,8 @@ var require_utils3 = __commonJS({
99989
99999
  }
99990
100000
  return ind;
99991
100001
  }
99992
- function removeDotSegments(path54) {
99993
- let input2 = path54;
100002
+ function removeDotSegments(path56) {
100003
+ let input2 = path56;
99994
100004
  const output2 = [];
99995
100005
  let nextSlash = -1;
99996
100006
  let len = 0;
@@ -100399,8 +100409,8 @@ var require_schemes = __commonJS({
100399
100409
  }
100400
100410
  if (wsComponent.resourceName) {
100401
100411
  const queryIndex = wsComponent.resourceName.indexOf("?");
100402
- const path54 = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
100403
- wsComponent.path = path54 && path54 !== "/" ? path54 : void 0;
100412
+ const path56 = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
100413
+ wsComponent.path = path56 && path56 !== "/" ? path56 : void 0;
100404
100414
  wsComponent.query = queryIndex === -1 ? void 0 : wsComponent.resourceName.slice(queryIndex + 1);
100405
100415
  wsComponent.resourceName = void 0;
100406
100416
  }
@@ -103927,7 +103937,7 @@ var require_dist2 = __commonJS({
103927
103937
  });
103928
103938
 
103929
103939
  // src/cli.ts
103930
- var import_node_path53 = __toESM(require("node:path"), 1);
103940
+ var import_node_path55 = __toESM(require("node:path"), 1);
103931
103941
 
103932
103942
  // node_modules/.pnpm/commander@15.0.0/node_modules/commander/lib/error.js
103933
103943
  var CommanderError = class extends Error {
@@ -107040,9 +107050,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
107040
107050
  * @param {string} [path]
107041
107051
  * @return {(string|null|Command)}
107042
107052
  */
107043
- executableDir(path54) {
107044
- if (path54 === void 0) return this._executableDir;
107045
- this._executableDir = path54;
107053
+ executableDir(path56) {
107054
+ if (path56 === void 0) return this._executableDir;
107055
+ this._executableDir = path56;
107046
107056
  return this;
107047
107057
  }
107048
107058
  /**
@@ -108691,19 +108701,19 @@ function writePools(paths, pools) {
108691
108701
  applyPatch(paths.globalConfigFile, GlobalConfigSchema, { pools }, { defaults: {} });
108692
108702
  }
108693
108703
  function poolCycleOf(pools, name) {
108694
- const walk = (current, path54) => {
108704
+ const walk = (current, path56) => {
108695
108705
  for (const entry of pools[current]?.identities ?? []) {
108696
108706
  const nested = poolNameOf(poolMemberIdentity(entry));
108697
108707
  if (nested === void 0) {
108698
108708
  continue;
108699
108709
  }
108700
108710
  if (nested === name) {
108701
- return [...path54, nested];
108711
+ return [...path56, nested];
108702
108712
  }
108703
- if (path54.includes(nested)) {
108713
+ if (path56.includes(nested)) {
108704
108714
  continue;
108705
108715
  }
108706
- const found = walk(nested, [...path54, nested]);
108716
+ const found = walk(nested, [...path56, nested]);
108707
108717
  if (found !== void 0) {
108708
108718
  return found;
108709
108719
  }
@@ -111645,16 +111655,503 @@ function registerCodexCommand(program2, deps) {
111645
111655
 
111646
111656
  // src/frontdoor/commands.ts
111647
111657
  var import_node_crypto20 = require("node:crypto");
111648
- var import_node_path47 = __toESM(require("node:path"), 1);
111649
- var import_node_fs16 = __toESM(require("node:fs"), 1);
111658
+ var import_node_path49 = __toESM(require("node:path"), 1);
111659
+ var import_node_fs17 = __toESM(require("node:fs"), 1);
111650
111660
  init_commandDeps();
111651
111661
  init_schema();
111662
+
111663
+ // src/agents/realFs.ts
111664
+ var import_node_fs12 = __toESM(require("node:fs"), 1);
111665
+ init_realPorts();
111666
+ var realSessionFs = {
111667
+ ...realFarmFs,
111668
+ realpath: (candidate) => {
111669
+ try {
111670
+ return import_node_fs12.default.realpathSync(candidate);
111671
+ } catch {
111672
+ return void 0;
111673
+ }
111674
+ }
111675
+ };
111676
+
111677
+ // src/agents/sessions.ts
111678
+ var import_node_path33 = __toESM(require("node:path"), 1);
111679
+ init_cliError();
111680
+
111681
+ // src/agents/read.ts
111682
+ var import_node_path32 = __toESM(require("node:path"), 1);
111683
+ init_zod();
111684
+
111685
+ // src/agents/schema.ts
111686
+ init_zod();
111687
+ var AgentMetaSchema = external_exports.looseObject({
111688
+ agentType: external_exports.string(),
111689
+ isFork: external_exports.boolean().optional(),
111690
+ description: external_exports.string().optional(),
111691
+ name: external_exports.string().optional(),
111692
+ toolUseId: external_exports.string().optional(),
111693
+ spawnDepth: external_exports.number().int().nonnegative().optional(),
111694
+ parentAgentId: external_exports.string().optional(),
111695
+ model: external_exports.string().optional(),
111696
+ requestShape: external_exports.string().optional(),
111697
+ requestNonInteractive: external_exports.boolean().optional(),
111698
+ workflowPhase: external_exports.string().optional(),
111699
+ taskKind: external_exports.string().optional(),
111700
+ teamName: external_exports.string().optional(),
111701
+ worktreePath: external_exports.string().optional(),
111702
+ worktreeBranch: external_exports.string().optional(),
111703
+ stoppedByUser: external_exports.boolean().optional()
111704
+ });
111705
+ var AgentKindSchema = external_exports.enum(["subagent", "fork", "workflow-agent", "teammate"]);
111706
+ var AgentNodeSchema = external_exports.lazy(
111707
+ () => external_exports.strictObject({
111708
+ id: external_exports.string(),
111709
+ kind: AgentKindSchema,
111710
+ agentType: external_exports.string(),
111711
+ description: external_exports.string().optional(),
111712
+ name: external_exports.string().optional(),
111713
+ toolUseId: external_exports.string().optional(),
111714
+ spawnDepth: external_exports.number().int().nonnegative().optional(),
111715
+ model: external_exports.string().optional(),
111716
+ background: external_exports.boolean().optional(),
111717
+ workflowRunId: external_exports.string().optional(),
111718
+ workflowPhase: external_exports.string().optional(),
111719
+ teamName: external_exports.string().optional(),
111720
+ stoppedByUser: external_exports.boolean().optional(),
111721
+ transcript: external_exports.string(),
111722
+ children: external_exports.array(AgentNodeSchema)
111723
+ })
111724
+ );
111725
+ var TaskItemSchema = external_exports.strictObject({
111726
+ id: external_exports.string(),
111727
+ subject: external_exports.string(),
111728
+ description: external_exports.string().optional(),
111729
+ status: external_exports.string(),
111730
+ /** What a spinner shows while the task runs. */
111731
+ activeForm: external_exports.string().optional(),
111732
+ /** The teammate or agent name the task is assigned to, as Agent Teams writes it. */
111733
+ owner: external_exports.string().optional(),
111734
+ /** Free-form data the harness attaches to a task, kept as written. */
111735
+ metadata: external_exports.record(external_exports.string(), external_exports.unknown()).optional(),
111736
+ blocks: external_exports.array(external_exports.string()),
111737
+ blockedBy: external_exports.array(external_exports.string()),
111738
+ /** The id of the shared task list this task belongs to (a team's name, or a custom list id), absent for the session's own list. */
111739
+ taskList: external_exports.string().optional()
111740
+ });
111741
+ var WorkflowRunSchema = external_exports.strictObject({
111742
+ runId: external_exports.string(),
111743
+ workflowName: external_exports.string().optional(),
111744
+ status: external_exports.string().optional(),
111745
+ startTime: external_exports.number().optional(),
111746
+ phases: external_exports.array(external_exports.string()),
111747
+ summary: external_exports.string().optional()
111748
+ });
111749
+ var AgentTreeProblemSchema = external_exports.strictObject({
111750
+ /** Relative to the identity's configuration directory. */
111751
+ path: external_exports.string(),
111752
+ reason: external_exports.string()
111753
+ });
111754
+ var SessionSummarySchema = external_exports.strictObject({
111755
+ project: external_exports.string(),
111756
+ sessionId: external_exports.string(),
111757
+ superseded: external_exports.boolean(),
111758
+ /** The directory and transcript stem exactly as on disk, which differs from `sessionId` for a superseded session. */
111759
+ entry: external_exports.string(),
111760
+ agentCount: external_exports.number().int().nonnegative(),
111761
+ workflowRunCount: external_exports.number().int().nonnegative(),
111762
+ /** When the transcript was last written, as an ISO instant; absent when there is no transcript file. */
111763
+ updatedAt: external_exports.iso.datetime().optional(),
111764
+ identities: external_exports.array(external_exports.string())
111765
+ });
111766
+ var SessionAgentTreeSchema = external_exports.strictObject({
111767
+ project: external_exports.string(),
111768
+ sessionId: external_exports.string(),
111769
+ /** True for a session directory a resume superseded (`<session-id>.superseded-<epoch-ms>`). */
111770
+ superseded: external_exports.boolean(),
111771
+ /** The agents the session itself spawned, each with its descendants. */
111772
+ agents: external_exports.array(AgentNodeSchema),
111773
+ tasks: external_exports.array(TaskItemSchema),
111774
+ workflowRuns: external_exports.array(WorkflowRunSchema),
111775
+ problems: external_exports.array(AgentTreeProblemSchema)
111776
+ });
111777
+
111778
+ // src/agents/read.ts
111779
+ var PROJECTS_DIR = "projects";
111780
+ var TASKS_DIR = "tasks";
111781
+ var SUBAGENTS_DIR = "subagents";
111782
+ var WORKFLOWS_DIR = "workflows";
111783
+ var AGENT_FILE_PREFIX = "agent-";
111784
+ var META_SUFFIX = ".meta.json";
111785
+ var TRANSCRIPT_SUFFIX = ".jsonl";
111786
+ var SHORT_SESSION_ID_LENGTH = 8;
111787
+ var SHORT_SESSION_LIST_PREFIX = "session-";
111788
+ var JSON_SUFFIX = ".json";
111789
+ var WORKFLOW_RUN_PREFIX = "wf_";
111790
+ var ARCHIVED_RE = /^(.+)\.(?:superseded|orphaned)-.+$/;
111791
+ var FORK_AGENT_TYPE = "fork";
111792
+ var WORKFLOW_AGENT_TYPE = "workflow-subagent";
111793
+ var TEAMMATE_TASK_KIND = "in_process_teammate";
111794
+ var BACKGROUND_REQUEST_SHAPE = "background";
111795
+ var SESSION_SPAWN_DEPTH = 1;
111796
+ function parseEntry2(project, entry) {
111797
+ const match = ARCHIVED_RE.exec(entry);
111798
+ const base = match?.[1];
111799
+ return base === void 0 ? { project, sessionId: entry, superseded: false, entry } : { project, sessionId: base, superseded: true, entry };
111800
+ }
111801
+ function listSessions2(fs22, configDir) {
111802
+ const found = [];
111803
+ for (const project of fs22.readdir(import_node_path32.default.join(configDir, PROJECTS_DIR))) {
111804
+ const projectDir = import_node_path32.default.join(configDir, PROJECTS_DIR, project);
111805
+ const entries = /* @__PURE__ */ new Set();
111806
+ for (const name of fs22.readdir(projectDir)) {
111807
+ if (name.endsWith(TRANSCRIPT_SUFFIX)) {
111808
+ entries.add(name.slice(0, -TRANSCRIPT_SUFFIX.length));
111809
+ continue;
111810
+ }
111811
+ const children = fs22.readdir(import_node_path32.default.join(projectDir, name));
111812
+ if (children.includes(SUBAGENTS_DIR) || children.includes(WORKFLOWS_DIR)) {
111813
+ entries.add(name);
111814
+ }
111815
+ }
111816
+ for (const entry of entries) {
111817
+ found.push(parseEntry2(project, entry));
111818
+ }
111819
+ }
111820
+ return found.sort((left, right) => left.project.localeCompare(right.project) || left.entry.localeCompare(right.entry));
111821
+ }
111822
+ function locateAgents(fs22, configDir, relativeDir, workflowRunId, report) {
111823
+ const located = [];
111824
+ for (const name of listDirOrReport(fs22, configDir, relativeDir, report)) {
111825
+ if (!name.startsWith(AGENT_FILE_PREFIX) || !name.endsWith(META_SUFFIX)) {
111826
+ continue;
111827
+ }
111828
+ const id2 = name.slice(AGENT_FILE_PREFIX.length, -META_SUFFIX.length);
111829
+ located.push({
111830
+ id: id2,
111831
+ metaPath: import_node_path32.default.join(relativeDir, name),
111832
+ transcriptPath: import_node_path32.default.join(relativeDir, `${AGENT_FILE_PREFIX}${id2}${TRANSCRIPT_SUFFIX}`),
111833
+ workflowRunId
111834
+ });
111835
+ }
111836
+ return located;
111837
+ }
111838
+ function kindOf(meta3, workflowRunId) {
111839
+ if (meta3.isFork === true || meta3.agentType === FORK_AGENT_TYPE) {
111840
+ return "fork";
111841
+ }
111842
+ if (workflowRunId !== void 0 || meta3.agentType === WORKFLOW_AGENT_TYPE) {
111843
+ return "workflow-agent";
111844
+ }
111845
+ if (meta3.taskKind === TEAMMATE_TASK_KIND || meta3.teamName !== void 0) {
111846
+ return "teammate";
111847
+ }
111848
+ return "subagent";
111849
+ }
111850
+ function toNode(read, children) {
111851
+ const { located, meta: meta3 } = read;
111852
+ return {
111853
+ id: located.id,
111854
+ kind: kindOf(meta3, located.workflowRunId),
111855
+ agentType: meta3.agentType,
111856
+ ...meta3.description === void 0 ? {} : { description: meta3.description },
111857
+ ...meta3.name === void 0 ? {} : { name: meta3.name },
111858
+ ...meta3.toolUseId === void 0 ? {} : { toolUseId: meta3.toolUseId },
111859
+ ...meta3.spawnDepth === void 0 ? {} : { spawnDepth: meta3.spawnDepth },
111860
+ ...meta3.model === void 0 ? {} : { model: meta3.model },
111861
+ ...meta3.requestShape === void 0 ? {} : { background: meta3.requestShape === BACKGROUND_REQUEST_SHAPE },
111862
+ ...located.workflowRunId === void 0 ? {} : { workflowRunId: located.workflowRunId },
111863
+ ...meta3.workflowPhase === void 0 ? {} : { workflowPhase: meta3.workflowPhase },
111864
+ ...meta3.teamName === void 0 ? {} : { teamName: meta3.teamName },
111865
+ ...meta3.stoppedByUser === void 0 ? {} : { stoppedByUser: meta3.stoppedByUser },
111866
+ transcript: located.transcriptPath,
111867
+ children
111868
+ };
111869
+ }
111870
+ function describeFailure(error63) {
111871
+ return error63 instanceof Error ? error63.message : String(error63);
111872
+ }
111873
+ function readFileOrReport(fs22, configDir, relative, report) {
111874
+ try {
111875
+ return fs22.readFileUtf8(import_node_path32.default.join(configDir, relative));
111876
+ } catch (error63) {
111877
+ report({ path: relative, reason: `could not be read: ${describeFailure(error63)}` });
111878
+ return void 0;
111879
+ }
111880
+ }
111881
+ function listDirOrReport(fs22, configDir, relative, report) {
111882
+ try {
111883
+ return fs22.readdir(import_node_path32.default.join(configDir, relative));
111884
+ } catch (error63) {
111885
+ report({ path: relative, reason: `could not be listed: ${describeFailure(error63)}` });
111886
+ return [];
111887
+ }
111888
+ }
111889
+ function parseJson3(text2) {
111890
+ try {
111891
+ const value2 = JSON.parse(text2);
111892
+ return value2;
111893
+ } catch {
111894
+ return void 0;
111895
+ }
111896
+ }
111897
+ var TaskFileSchema = external_exports.object({ ...TaskItemSchema.omit({ taskList: true }).shape, blocks: external_exports.array(external_exports.string()).default([]), blockedBy: external_exports.array(external_exports.string()).default([]) });
111898
+ var WorkflowRunFileSchema = external_exports.object({
111899
+ runId: external_exports.string(),
111900
+ workflowName: external_exports.string().optional(),
111901
+ status: external_exports.string().optional(),
111902
+ startTime: external_exports.number().optional(),
111903
+ phases: external_exports.array(external_exports.object({ title: external_exports.string() })).default([]),
111904
+ summary: external_exports.string().optional()
111905
+ });
111906
+ function summariseSession(fs22, configDir, ref) {
111907
+ const sessionRelative = import_node_path32.default.join(PROJECTS_DIR, ref.project, ref.entry);
111908
+ const subagentsRelative = import_node_path32.default.join(sessionRelative, SUBAGENTS_DIR);
111909
+ const workflowsUnderSubagents = import_node_path32.default.join(subagentsRelative, WORKFLOWS_DIR);
111910
+ const isMeta = (name) => name.startsWith(AGENT_FILE_PREFIX) && name.endsWith(META_SUFFIX);
111911
+ let agentCount = fs22.readdir(import_node_path32.default.join(configDir, subagentsRelative)).filter(isMeta).length;
111912
+ for (const runDir of fs22.readdir(import_node_path32.default.join(configDir, workflowsUnderSubagents))) {
111913
+ if (runDir.startsWith(WORKFLOW_RUN_PREFIX)) {
111914
+ agentCount += fs22.readdir(import_node_path32.default.join(configDir, workflowsUnderSubagents, runDir)).filter(isMeta).length;
111915
+ }
111916
+ }
111917
+ const workflowRunCount = fs22.readdir(import_node_path32.default.join(configDir, sessionRelative, WORKFLOWS_DIR)).filter((name) => name.startsWith(WORKFLOW_RUN_PREFIX) && name.endsWith(JSON_SUFFIX)).length;
111918
+ const transcript = fs22.lstat(import_node_path32.default.join(configDir, PROJECTS_DIR, ref.project, `${ref.entry}${TRANSCRIPT_SUFFIX}`));
111919
+ return { ...ref, agentCount, workflowRunCount, ...transcript === void 0 ? {} : { updatedAt: new Date(transcript.mtimeMs).toISOString() } };
111920
+ }
111921
+ function readSessionAgentTree(fs22, configDir, ref, options = {}) {
111922
+ const problems = [];
111923
+ const report = (problem) => {
111924
+ problems.push(problem);
111925
+ };
111926
+ const sessionRelative = import_node_path32.default.join(PROJECTS_DIR, ref.project, ref.entry);
111927
+ const subagentsRelative = import_node_path32.default.join(sessionRelative, SUBAGENTS_DIR);
111928
+ const workflowsUnderSubagents = import_node_path32.default.join(subagentsRelative, WORKFLOWS_DIR);
111929
+ const located = locateAgents(fs22, configDir, subagentsRelative, void 0, report);
111930
+ for (const runDir of listDirOrReport(fs22, configDir, workflowsUnderSubagents, report)) {
111931
+ if (runDir.startsWith(WORKFLOW_RUN_PREFIX)) {
111932
+ located.push(...locateAgents(fs22, configDir, import_node_path32.default.join(workflowsUnderSubagents, runDir), runDir, report));
111933
+ }
111934
+ }
111935
+ const agents = /* @__PURE__ */ new Map();
111936
+ for (const candidate of located) {
111937
+ const text2 = readFileOrReport(fs22, configDir, candidate.metaPath, report);
111938
+ if (text2 === void 0) {
111939
+ continue;
111940
+ }
111941
+ const parsed = AgentMetaSchema.safeParse(parseJson3(text2));
111942
+ if (!parsed.success) {
111943
+ report({ path: candidate.metaPath, reason: "meta file is not a JSON object with an agentType" });
111944
+ continue;
111945
+ }
111946
+ agents.set(candidate.id, { located: candidate, meta: parsed.data });
111947
+ }
111948
+ const teamNames = [...new Set([...agents.values()].flatMap((agent) => agent.meta.teamName === void 0 ? [] : [agent.meta.teamName]))].sort();
111949
+ const parentOf4 = resolveParents(fs22, configDir, agents, report);
111950
+ const childrenOf = /* @__PURE__ */ new Map();
111951
+ const roots = [];
111952
+ for (const id2 of agents.keys()) {
111953
+ const parent = parentOf4.get(id2);
111954
+ if (parent === void 0) {
111955
+ roots.push(id2);
111956
+ } else {
111957
+ childrenOf.set(parent, [...childrenOf.get(parent) ?? [], id2]);
111958
+ }
111959
+ }
111960
+ const build = (id2) => {
111961
+ const read = agents.get(id2);
111962
+ if (read === void 0) {
111963
+ throw new Error(`agent ${id2} is in the tree but was never read`);
111964
+ }
111965
+ return toNode(read, (childrenOf.get(id2) ?? []).sort().map(build));
111966
+ };
111967
+ return {
111968
+ project: ref.project,
111969
+ sessionId: ref.sessionId,
111970
+ superseded: ref.superseded,
111971
+ agents: roots.sort().map(build),
111972
+ tasks: readTasks(fs22, configDir, ownTaskLists(ref.sessionId), [.../* @__PURE__ */ new Set([...teamNames, ...options.taskListIds ?? []])].filter((id2) => !ownTaskLists(ref.sessionId).includes(id2)), report),
111973
+ workflowRuns: readWorkflowRuns(fs22, configDir, import_node_path32.default.join(sessionRelative, WORKFLOWS_DIR), report),
111974
+ problems
111975
+ };
111976
+ }
111977
+ function resolveParents(fs22, configDir, agents, report) {
111978
+ const parentOf4 = /* @__PURE__ */ new Map();
111979
+ const transcriptCache = /* @__PURE__ */ new Map();
111980
+ const transcriptOf = (agent) => {
111981
+ const cached2 = transcriptCache.get(agent.located.id);
111982
+ if (cached2 !== void 0) {
111983
+ return cached2;
111984
+ }
111985
+ const text2 = readFileOrReport(fs22, configDir, agent.located.transcriptPath, report) ?? "";
111986
+ transcriptCache.set(agent.located.id, text2);
111987
+ return text2;
111988
+ };
111989
+ const wouldCycle = (child, parent) => {
111990
+ for (let cursor3 = parent; cursor3 !== void 0; cursor3 = parentOf4.get(cursor3)) {
111991
+ if (cursor3 === child) {
111992
+ return true;
111993
+ }
111994
+ }
111995
+ return false;
111996
+ };
111997
+ const attach = (child, parent) => {
111998
+ if (wouldCycle(child.located.id, parent)) {
111999
+ report({ path: child.located.metaPath, reason: `parent ${parent} would make a cycle` });
112000
+ return;
112001
+ }
112002
+ parentOf4.set(child.located.id, parent);
112003
+ };
112004
+ for (const agent of agents.values()) {
112005
+ const { meta: meta3, located } = agent;
112006
+ if (meta3.parentAgentId !== void 0 && agents.has(meta3.parentAgentId)) {
112007
+ attach(agent, meta3.parentAgentId);
112008
+ continue;
112009
+ }
112010
+ const depth = meta3.spawnDepth;
112011
+ if (depth !== void 0 && depth <= SESSION_SPAWN_DEPTH || meta3.toolUseId === void 0) {
112012
+ if (meta3.parentAgentId !== void 0) {
112013
+ report({ path: located.metaPath, reason: `parentAgentId ${meta3.parentAgentId} names no agent in this session` });
112014
+ }
112015
+ continue;
112016
+ }
112017
+ const toolUseId = meta3.toolUseId;
112018
+ const owners = [...agents.values()].filter(
112019
+ (candidate) => candidate.located.id !== located.id && (depth === void 0 || candidate.meta.spawnDepth === void 0 || candidate.meta.spawnDepth === depth - 1) && candidate.located.workflowRunId === located.workflowRunId && transcriptOf(candidate).includes(toolUseId)
112020
+ );
112021
+ const owner = owners[0];
112022
+ if (owners.length === 1 && owner !== void 0) {
112023
+ attach(agent, owner.located.id);
112024
+ } else if (owners.length > 1) {
112025
+ report({ path: located.metaPath, reason: "more than one agent transcript records the call that spawned it" });
112026
+ } else if (depth !== void 0) {
112027
+ report({ path: located.metaPath, reason: "no agent transcript records the call that spawned it" });
112028
+ }
112029
+ }
112030
+ return parentOf4;
112031
+ }
112032
+ function ownTaskLists(sessionId) {
112033
+ return [sessionId, `${SHORT_SESSION_LIST_PREFIX}${sessionId.slice(0, SHORT_SESSION_ID_LENGTH)}`];
112034
+ }
112035
+ function readTasks(fs22, configDir, ownLists, sharedLists, report) {
112036
+ const tasks = [];
112037
+ [...ownLists, ...sharedLists].forEach((scope, index) => {
112038
+ const relativeDir = import_node_path32.default.join(TASKS_DIR, scope);
112039
+ for (const name of [...listDirOrReport(fs22, configDir, relativeDir, report)].sort()) {
112040
+ if (name.startsWith(".") || !name.endsWith(JSON_SUFFIX)) {
112041
+ continue;
112042
+ }
112043
+ const relative = import_node_path32.default.join(relativeDir, name);
112044
+ const text2 = readFileOrReport(fs22, configDir, relative, report);
112045
+ const parsed = TaskFileSchema.safeParse(text2 === void 0 ? void 0 : parseJson3(text2));
112046
+ if (parsed.success) {
112047
+ tasks.push(index < ownLists.length ? parsed.data : { ...parsed.data, taskList: scope });
112048
+ } else if (text2 !== void 0) {
112049
+ report({ path: relative, reason: "task file is not a task" });
112050
+ }
112051
+ }
112052
+ });
112053
+ return tasks;
112054
+ }
112055
+ function readWorkflowRuns(fs22, configDir, relativeDir, report) {
112056
+ const runs = [];
112057
+ for (const name of [...listDirOrReport(fs22, configDir, relativeDir, report)].sort()) {
112058
+ if (!name.startsWith(WORKFLOW_RUN_PREFIX) || !name.endsWith(JSON_SUFFIX)) {
112059
+ continue;
112060
+ }
112061
+ const relative = import_node_path32.default.join(relativeDir, name);
112062
+ const text2 = readFileOrReport(fs22, configDir, relative, report);
112063
+ const parsed = WorkflowRunFileSchema.safeParse(text2 === void 0 ? void 0 : parseJson3(text2));
112064
+ if (!parsed.success) {
112065
+ if (text2 !== void 0) {
112066
+ report({ path: relative, reason: "workflow run file is not a run record" });
112067
+ }
112068
+ continue;
112069
+ }
112070
+ const { phases, ...rest } = parsed.data;
112071
+ runs.push({ ...rest, phases: phases.map((phase) => phase.title) });
112072
+ }
112073
+ return runs;
112074
+ }
112075
+
112076
+ // src/agents/sessions.ts
112077
+ var SessionLookupError = class extends CliError {
112078
+ constructor(message) {
112079
+ super(message);
112080
+ this.name = "SessionLookupError";
112081
+ }
112082
+ };
112083
+ function identityConfigDir(identitiesDir, identity) {
112084
+ return import_node_path33.default.join(identitiesDir, identity);
112085
+ }
112086
+ function historyStores(fs22, identitiesDir, identities) {
112087
+ const byRealPath = /* @__PURE__ */ new Map();
112088
+ for (const identity of identities) {
112089
+ const configDir = identityConfigDir(identitiesDir, identity);
112090
+ const real = fs22.realpath(import_node_path33.default.join(configDir, "projects"));
112091
+ if (real === void 0) {
112092
+ continue;
112093
+ }
112094
+ const store = byRealPath.get(real);
112095
+ if (store === void 0) {
112096
+ byRealPath.set(real, { configDir, identities: [identity] });
112097
+ } else {
112098
+ store.identities.push(identity);
112099
+ }
112100
+ }
112101
+ return [...byRealPath.values()];
112102
+ }
112103
+ function collectSessionList(fs22, identitiesDir, identities, filters) {
112104
+ const names = filters.identity === void 0 ? identities : identities.filter((name) => name === filters.identity);
112105
+ if (filters.identity !== void 0 && names.length === 0) {
112106
+ throw new SessionLookupError(`no identity named "${filters.identity}"`);
112107
+ }
112108
+ const sessions = [];
112109
+ for (const store of historyStores(fs22, identitiesDir, names)) {
112110
+ for (const ref of listSessions2(fs22, store.configDir)) {
112111
+ const summary = summariseSession(fs22, store.configDir, ref);
112112
+ if (filters.all === true || summary.agentCount > 0 || summary.workflowRunCount > 0) {
112113
+ sessions.push({ ...summary, identities: store.identities });
112114
+ }
112115
+ }
112116
+ }
112117
+ return sessions.sort((left, right) => (right.updatedAt ?? "").localeCompare(left.updatedAt ?? "") || left.sessionId.localeCompare(right.sessionId));
112118
+ }
112119
+ function locateSession(fs22, identitiesDir, identities, query, onlyIdentity) {
112120
+ const names = onlyIdentity === void 0 ? identities : identities.filter((name) => name === onlyIdentity);
112121
+ if (onlyIdentity !== void 0 && names.length === 0) {
112122
+ throw new SessionLookupError(`no identity named "${onlyIdentity}"`);
112123
+ }
112124
+ const matches = [];
112125
+ for (const store of historyStores(fs22, identitiesDir, names)) {
112126
+ for (const ref of listSessions2(fs22, store.configDir)) {
112127
+ if (ref.sessionId.startsWith(query)) {
112128
+ matches.push({ identities: store.identities, configDir: store.configDir, ref });
112129
+ }
112130
+ }
112131
+ }
112132
+ const exact = matches.filter((match) => match.ref.sessionId === query);
112133
+ const candidates = exact.length > 0 ? exact : matches;
112134
+ const only = candidates[0];
112135
+ if (candidates.length === 1 && only !== void 0) {
112136
+ return only;
112137
+ }
112138
+ if (candidates.length === 0) {
112139
+ throw new SessionLookupError(`no session matches "${query}"`);
112140
+ }
112141
+ throw new SessionLookupError(`"${query}" matches ${String(candidates.length)} sessions: ${candidates.map((match) => `${match.ref.sessionId} (${match.identities.join(", ")})`).join("; ")}; give more of the id or pass --identity`);
112142
+ }
112143
+ function showSession(fs22, identitiesDir, identities, query, onlyIdentity) {
112144
+ const located = locateSession(fs22, identitiesDir, identities, query, onlyIdentity);
112145
+ return { identities: located.identities, tree: readSessionAgentTree(fs22, located.configDir, located.ref) };
112146
+ }
112147
+
112148
+ // src/frontdoor/commands.ts
111652
112149
  init_realPorts();
111653
112150
 
111654
112151
  // src/update/commands.ts
111655
- var import_node_fs13 = __toESM(require("node:fs"), 1);
112152
+ var import_node_fs14 = __toESM(require("node:fs"), 1);
111656
112153
  var import_node_os7 = __toESM(require("node:os"), 1);
111657
- var import_node_path34 = __toESM(require("node:path"), 1);
112154
+ var import_node_path36 = __toESM(require("node:path"), 1);
111658
112155
  init_package();
111659
112156
  init_commandDeps();
111660
112157
  init_store();
@@ -111686,10 +112183,10 @@ var realUpdatePorts = {
111686
112183
  }
111687
112184
  },
111688
112185
  fs: {
111689
- realpath: (target) => import_node_fs13.default.realpathSync(target),
112186
+ realpath: (target) => import_node_fs14.default.realpathSync(target),
111690
112187
  readFileUtf8: (filePath) => {
111691
112188
  try {
111692
- return import_node_fs13.default.readFileSync(filePath, "utf8");
112189
+ return import_node_fs14.default.readFileSync(filePath, "utf8");
111693
112190
  } catch (error63) {
111694
112191
  if (isEnoent5(error63)) {
111695
112192
  return void 0;
@@ -111699,7 +112196,7 @@ var realUpdatePorts = {
111699
112196
  },
111700
112197
  readFileBytes: (filePath) => {
111701
112198
  try {
111702
- return new Uint8Array(import_node_fs13.default.readFileSync(filePath));
112199
+ return new Uint8Array(import_node_fs14.default.readFileSync(filePath));
111703
112200
  } catch (error63) {
111704
112201
  if (isEnoent5(error63)) {
111705
112202
  return void 0;
@@ -111710,7 +112207,7 @@ var realUpdatePorts = {
111710
112207
  readFileHead: (filePath, length) => {
111711
112208
  let descriptor;
111712
112209
  try {
111713
- descriptor = import_node_fs13.default.openSync(filePath, "r");
112210
+ descriptor = import_node_fs14.default.openSync(filePath, "r");
111714
112211
  } catch (error63) {
111715
112212
  if (isEnoent5(error63)) {
111716
112213
  return void 0;
@@ -111719,21 +112216,21 @@ var realUpdatePorts = {
111719
112216
  }
111720
112217
  try {
111721
112218
  const buffer2 = Buffer.alloc(length);
111722
- const read = import_node_fs13.default.readSync(descriptor, buffer2, 0, length, 0);
112219
+ const read = import_node_fs14.default.readSync(descriptor, buffer2, 0, length, 0);
111723
112220
  return read === 0 ? "" : buffer2.toString("latin1", 0, read);
111724
112221
  } finally {
111725
- import_node_fs13.default.closeSync(descriptor);
112222
+ import_node_fs14.default.closeSync(descriptor);
111726
112223
  }
111727
112224
  },
111728
112225
  writeFileUtf8: (filePath, contents) => {
111729
- import_node_fs13.default.writeFileSync(filePath, contents, "utf8");
112226
+ import_node_fs14.default.writeFileSync(filePath, contents, "utf8");
111730
112227
  },
111731
112228
  writeFileBytes: (filePath, contents) => {
111732
- import_node_fs13.default.writeFileSync(filePath, contents);
112229
+ import_node_fs14.default.writeFileSync(filePath, contents);
111733
112230
  },
111734
112231
  writeFileExclusive: (filePath, contents) => {
111735
112232
  try {
111736
- import_node_fs13.default.writeFileSync(filePath, contents, { encoding: "utf8", flag: "wx" });
112233
+ import_node_fs14.default.writeFileSync(filePath, contents, { encoding: "utf8", flag: "wx" });
111737
112234
  return true;
111738
112235
  } catch (error63) {
111739
112236
  if (isErrorWithCode2(error63, "EEXIST")) {
@@ -111744,7 +112241,7 @@ var realUpdatePorts = {
111744
112241
  },
111745
112242
  unlink: (filePath) => {
111746
112243
  try {
111747
- import_node_fs13.default.unlinkSync(filePath);
112244
+ import_node_fs14.default.unlinkSync(filePath);
111748
112245
  } catch (error63) {
111749
112246
  if (!isEnoent5(error63)) {
111750
112247
  throw error63;
@@ -111752,14 +112249,14 @@ var realUpdatePorts = {
111752
112249
  }
111753
112250
  },
111754
112251
  rename: (from, to2) => {
111755
- import_node_fs13.default.renameSync(from, to2);
112252
+ import_node_fs14.default.renameSync(from, to2);
111756
112253
  },
111757
112254
  chmod: (filePath, mode) => {
111758
- import_node_fs13.default.chmodSync(filePath, mode);
112255
+ import_node_fs14.default.chmodSync(filePath, mode);
111759
112256
  },
111760
- mkdtemp: () => import_node_fs13.default.mkdtempSync(import_node_path34.default.join(import_node_os7.default.tmpdir(), "agent-shim-update-")),
112257
+ mkdtemp: () => import_node_fs14.default.mkdtempSync(import_node_path36.default.join(import_node_os7.default.tmpdir(), "agent-shim-update-")),
111761
112258
  rmRecursive: (targetPath) => {
111762
- import_node_fs13.default.rmSync(targetPath, { recursive: true, force: true });
112259
+ import_node_fs14.default.rmSync(targetPath, { recursive: true, force: true });
111763
112260
  }
111764
112261
  },
111765
112262
  // Signal 0 performs the permission and existence checks without delivering anything; EPERM means the process exists but belongs to another user.
@@ -111778,7 +112275,7 @@ function selfUpdateOptions(paths, checkOnly) {
111778
112275
  platform: process.platform,
111779
112276
  arch: process.arch,
111780
112277
  executablePath: realOwnExecutablePath(),
111781
- lockPath: import_node_path34.default.join(paths.root, "update.lock"),
112278
+ lockPath: import_node_path36.default.join(paths.root, "update.lock"),
111782
112279
  checkOnly,
111783
112280
  pid: process.pid
111784
112281
  };
@@ -111919,7 +112416,7 @@ init_poolPick();
111919
112416
  init_realAnthropicUsageProbe();
111920
112417
 
111921
112418
  // src/usage/realJobRunner.ts
111922
- var import_node_path38 = __toESM(require("node:path"), 1);
112419
+ var import_node_path40 = __toESM(require("node:path"), 1);
111923
112420
  init_conditions();
111924
112421
  init_identityClaude();
111925
112422
 
@@ -111945,7 +112442,7 @@ ${outcome.trimEnd()}
111945
112442
  }
111946
112443
  function createRealJobRunner(params) {
111947
112444
  return async (name, identity, job) => {
111948
- const logFile = import_node_path38.default.join(params.paths.jobLogsDir, `${name}.log`);
112445
+ const logFile = import_node_path40.default.join(params.paths.jobLogsDir, `${name}.log`);
111949
112446
  const append = (outcome) => {
111950
112447
  params.fs.mkdirPrivate(params.paths.jobLogsDir);
111951
112448
  params.fs.appendFilePrivate(logFile, logEntry(name, identity, params.now(), outcome));
@@ -112035,7 +112532,7 @@ function createRealWindowOpener(params) {
112035
112532
  init_conditions();
112036
112533
 
112037
112534
  // src/usage/handledStamps.ts
112038
- var import_node_path39 = __toESM(require("node:path"), 1);
112535
+ var import_node_path41 = __toESM(require("node:path"), 1);
112039
112536
  init_zod();
112040
112537
  var STAMPS_SCHEMA_VERSION = 1;
112041
112538
  var StampsFileSchema = external_exports.strictObject({
@@ -112058,7 +112555,7 @@ function readHandled(fs22, file2) {
112058
112555
  }
112059
112556
  function writeHandled(fs22, file2, handled) {
112060
112557
  const next = { schemaVersion: STAMPS_SCHEMA_VERSION, handled: Object.fromEntries(Object.entries(handled).map(([key, at2]) => [key, new Date(at2).toISOString()])) };
112061
- fs22.mkdirPrivate(import_node_path39.default.dirname(file2));
112558
+ fs22.mkdirPrivate(import_node_path41.default.dirname(file2));
112062
112559
  fs22.writeFilePrivate(file2, `${JSON.stringify(next, null, 2)}
112063
112560
  `);
112064
112561
  }
@@ -112349,7 +112846,7 @@ init_capability();
112349
112846
 
112350
112847
  // src/frontdoor/capture.ts
112351
112848
  var fs15 = __toESM(require("node:fs"), 1);
112352
- var path39 = __toESM(require("node:path"), 1);
112849
+ var path41 = __toESM(require("node:path"), 1);
112353
112850
  var SECRET_HEADER_NAME = /authorization|cookie|token|secret|credential|api[-_]key/i;
112354
112851
  var SECRET_JSON_KEY = /token|secret|password|credential|authorization|api[-_]key/i;
112355
112852
  var SECRET_BODY_PATTERNS = [
@@ -112393,10 +112890,10 @@ function redactBody(chunk) {
112393
112890
  }
112394
112891
  var CAPTURE_ENV = "AGENT_SHIM_FRONTDOOR_CAPTURE";
112395
112892
  function captureFromEnv(env, logsDir) {
112396
- return env[CAPTURE_ENV] === "1" ? createFileCapture(path39.join(logsDir, "frontdoor-capture.jsonl")) : void 0;
112893
+ return env[CAPTURE_ENV] === "1" ? createFileCapture(path41.join(logsDir, "frontdoor-capture.jsonl")) : void 0;
112397
112894
  }
112398
112895
  function createFileCapture(file2, now = () => /* @__PURE__ */ new Date()) {
112399
- fs15.mkdirSync(path39.dirname(file2), { recursive: true });
112896
+ fs15.mkdirSync(path41.dirname(file2), { recursive: true });
112400
112897
  let nextId = 0;
112401
112898
  const append = (record2) => {
112402
112899
  fs15.appendFileSync(file2, `${JSON.stringify({ ts: now().toISOString(), ...record2 })}
@@ -112815,14 +113312,14 @@ init_capability();
112815
113312
  init_route();
112816
113313
 
112817
113314
  // src/frontdoor/supervisor.ts
112818
- var import_node_path40 = __toESM(require("node:path"), 1);
113315
+ var import_node_path42 = __toESM(require("node:path"), 1);
112819
113316
  init_state2();
112820
113317
  function watchedInstallEntry(resolvedOwnExecutablePath, siblingExists) {
112821
- const parsed = import_node_path40.default.parse(resolvedOwnExecutablePath);
113318
+ const parsed = import_node_path42.default.parse(resolvedOwnExecutablePath);
112822
113319
  if (parsed.name === "agent-shim") {
112823
113320
  return resolvedOwnExecutablePath;
112824
113321
  }
112825
- const sibling = import_node_path40.default.join(parsed.dir, `agent-shim${parsed.ext}`);
113322
+ const sibling = import_node_path42.default.join(parsed.dir, `agent-shim${parsed.ext}`);
112826
113323
  return siblingExists(sibling) ? sibling : resolvedOwnExecutablePath;
112827
113324
  }
112828
113325
  var FRONTDOOR_SUPERVISOR_STILL_RUNNING = -1;
@@ -113009,8 +113506,8 @@ function parseConnectTarget(authority) {
113009
113506
  }
113010
113507
  return { host, port };
113011
113508
  }
113012
- function servedByPipeline(path54) {
113013
- return path54?.startsWith(ROUTED_PATH_PREFIX) === true;
113509
+ function servedByPipeline(path56) {
113510
+ return path56?.startsWith(ROUTED_PATH_PREFIX) === true;
113014
113511
  }
113015
113512
  var HOP_BY_HOP_HEADERS = /* @__PURE__ */ new Set([
113016
113513
  "connection",
@@ -113529,11 +114026,11 @@ function createRcSessionTracker(deps) {
113529
114026
  };
113530
114027
  const observeExchange = (request7) => {
113531
114028
  const method = (request7.method ?? "").toUpperCase();
113532
- const path54 = new URL(request7.url ?? "/", "http://127.0.0.1").pathname;
113533
- if (!path54.startsWith(RC_SESSIONS_PATH_PREFIX)) {
114029
+ const path56 = new URL(request7.url ?? "/", "http://127.0.0.1").pathname;
114030
+ if (!path56.startsWith(RC_SESSIONS_PATH_PREFIX)) {
113534
114031
  return void 0;
113535
114032
  }
113536
- const tail = path54.slice(RC_SESSIONS_PATH_PREFIX.length);
114033
+ const tail = path56.slice(RC_SESSIONS_PATH_PREFIX.length);
113537
114034
  const facts = {
113538
114035
  oauthAuthorization: oauthAuthorizationOf(request7.headers),
113539
114036
  anthropicVersion: singleHeader(request7.headers, "anthropic-version"),
@@ -113894,8 +114391,8 @@ var RC_READ_FILE_ENCODINGS = ["utf-8", "base64"];
113894
114391
  function isRcReadFileEncoding(value2) {
113895
114392
  return RC_READ_FILE_ENCODINGS.some((encoding) => encoding === value2);
113896
114393
  }
113897
- function buildRcReadFilePayload(requestId, path54, options) {
113898
- return buildRcControlRequestPayload(requestId, { subtype: "read_file", path: path54, ...options?.maxBytes === void 0 ? {} : { max_bytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } });
114394
+ function buildRcReadFilePayload(requestId, path56, options) {
114395
+ return buildRcControlRequestPayload(requestId, { subtype: "read_file", path: path56, ...options?.maxBytes === void 0 ? {} : { max_bytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } });
113899
114396
  }
113900
114397
  function buildRcFileSuggestionsPayload(requestId, query) {
113901
114398
  return buildRcControlRequestPayload(requestId, { subtype: "file_suggestions", query });
@@ -113997,15 +114494,15 @@ async function getRcSessionContextUsage(deps, sessionId, detail) {
113997
114494
  const result = await deliverRcClientPayload(deps, sessionId, buildRcGetContextUsagePayload(requestId, detail), `request the context usage of session ${sessionId}`);
113998
114495
  return result.ok ? { ...result, requestId } : result;
113999
114496
  }
114000
- async function readRcSessionFile(deps, sessionId, path54, options) {
114001
- if (path54 === "") {
114497
+ async function readRcSessionFile(deps, sessionId, path56, options) {
114498
+ if (path56 === "") {
114002
114499
  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" };
114003
114500
  }
114004
114501
  if (options?.maxBytes !== void 0 && (!Number.isInteger(options.maxBytes) || options.maxBytes <= 0)) {
114005
114502
  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" };
114006
114503
  }
114007
114504
  const requestId = deps.newUuid();
114008
- const result = await deliverRcClientPayload(deps, sessionId, buildRcReadFilePayload(requestId, path54, options), `read ${path54} from session ${sessionId}`);
114505
+ const result = await deliverRcClientPayload(deps, sessionId, buildRcReadFilePayload(requestId, path56, options), `read ${path56} from session ${sessionId}`);
114009
114506
  return result.ok ? { ...result, requestId } : result;
114010
114507
  }
114011
114508
  async function suggestRcSessionFiles(deps, sessionId, query) {
@@ -114176,11 +114673,11 @@ function createRcControlHandler(deps) {
114176
114673
  path: "read-file",
114177
114674
  read: (body) => {
114178
114675
  const session = bodyString(body, "session");
114179
- const path54 = bodyString(body, "path");
114676
+ const path56 = bodyString(body, "path");
114180
114677
  const maxBytes = "maxBytes" in body ? bodyPositiveInteger(body, "maxBytes") : void 0;
114181
114678
  const encoding = "encoding" in body && isRcReadFileEncoding(body.encoding) ? body.encoding : void 0;
114182
- const refused2 = session === void 0 || path54 === void 0 || "maxBytes" in body && maxBytes === void 0 || "encoding" in body && encoding === void 0;
114183
- 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, path54, { ...maxBytes === void 0 ? {} : { maxBytes }, ...encoding === void 0 ? {} : { encoding } }) };
114679
+ const refused2 = session === void 0 || path56 === void 0 || "maxBytes" in body && maxBytes === void 0 || "encoding" in body && encoding === void 0;
114680
+ 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, path56, { ...maxBytes === void 0 ? {} : { maxBytes }, ...encoding === void 0 ? {} : { encoding } }) };
114184
114681
  }
114185
114682
  },
114186
114683
  {
@@ -114490,9 +114987,9 @@ function requestIdOfBody(body) {
114490
114987
  }
114491
114988
  function frontDoorRcControl(transport, token) {
114492
114989
  const headers = { authorization: `Bearer ${token}` };
114493
- const listAnswerOf = async (path54, what) => {
114990
+ const listAnswerOf = async (path56, what) => {
114494
114991
  try {
114495
- return await transport.request({ method: "GET", path: path54, headers });
114992
+ return await transport.request({ method: "GET", path: path56, headers });
114496
114993
  } catch (error63) {
114497
114994
  throw new Error(`${what}: could not reach the front door's control listener: ${error63 instanceof Error ? error63.message : String(error63)}`, { cause: error63 });
114498
114995
  }
@@ -114564,10 +115061,10 @@ function frontDoorRcControl(transport, token) {
114564
115061
  }
114565
115062
  return pending;
114566
115063
  };
114567
- const writeOf = async (path54, body, describeFailure) => {
115064
+ const writeOf = async (path56, body, describeFailure2) => {
114568
115065
  let answer;
114569
115066
  try {
114570
- answer = await transport.request({ method: "POST", path: path54, headers: { ...headers, "content-type": "application/json" }, body });
115067
+ answer = await transport.request({ method: "POST", path: path56, headers: { ...headers, "content-type": "application/json" }, body });
114571
115068
  } catch (error63) {
114572
115069
  return { ok: false, message: `could not reach the front door's control listener: ${error63 instanceof Error ? error63.message : String(error63)}` };
114573
115070
  }
@@ -114579,7 +115076,7 @@ function frontDoorRcControl(transport, token) {
114579
115076
  const requestId = requestIdOfBody(answer.body);
114580
115077
  return requestId === void 0 ? { ok: true, sequenceNums } : { ok: true, sequenceNums, requestId };
114581
115078
  }
114582
- return { ok: false, message: describeFailure(answer.status, controlErrorOf(answer.body) ?? answer.body) };
115079
+ return { ok: false, message: describeFailure2(answer.status, controlErrorOf(answer.body) ?? answer.body) };
114583
115080
  };
114584
115081
  const sessionQuery = (sessionId) => sessionId === void 0 ? "" : `?session=${encodeURIComponent(sessionId)}`;
114585
115082
  return {
@@ -114598,10 +115095,10 @@ function frontDoorRcControl(transport, token) {
114598
115095
  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}`),
114599
115096
  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}`),
114600
115097
  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}`),
114601
- readFile: async (sessionId, path54, options) => await writeOf(
115098
+ readFile: async (sessionId, path56, options) => await writeOf(
114602
115099
  `${CONTROL_PATH_PREFIX}/read-file`,
114603
- JSON.stringify({ session: sessionId, path: path54, ...options?.maxBytes === void 0 ? {} : { maxBytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } }),
114604
- (status, message) => `reading ${path54} from ${sessionId} failed (HTTP ${String(status)}): ${message}`
115100
+ JSON.stringify({ session: sessionId, path: path56, ...options?.maxBytes === void 0 ? {} : { maxBytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } }),
115101
+ (status, message) => `reading ${path56} from ${sessionId} failed (HTTP ${String(status)}): ${message}`
114605
115102
  ),
114606
115103
  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}`),
114607
115104
  keepAlive: async (sessionId) => await writeOf(`${CONTROL_PATH_PREFIX}/keep-alive`, JSON.stringify({ session: sessionId }), (status, message) => `keeping ${sessionId} alive failed (HTTP ${String(status)}): ${message}`),
@@ -114895,12 +115392,12 @@ function tlsFacts(options) {
114895
115392
  }
114896
115393
  function realRcEventDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_PORT }) {
114897
115394
  const agent = new ExemptTlsAgent();
114898
- const post = async (path54, headers, body) => await new Promise((resolve2, reject) => {
115395
+ const post = async (path56, headers, body) => await new Promise((resolve2, reject) => {
114899
115396
  const options = {
114900
115397
  host: target.host,
114901
115398
  port: target.port,
114902
115399
  method: "POST",
114903
- path: path54,
115400
+ path: path56,
114904
115401
  // 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.
114905
115402
  headers: { ...headers, host: target.servername ?? target.host, "content-length": String(Buffer.byteLength(body, "utf8")) },
114906
115403
  agent
@@ -114965,12 +115462,12 @@ function lateRcStreamDial(resolve2) {
114965
115462
  }
114966
115463
  function realRcStreamDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_PORT }) {
114967
115464
  const agent = new ExemptTlsAgent();
114968
- const request7 = async (method, path54, headers, body, signal) => await new Promise((resolve2, reject) => {
115465
+ const request7 = async (method, path56, headers, body, signal) => await new Promise((resolve2, reject) => {
114969
115466
  const options = {
114970
115467
  host: target.host,
114971
115468
  port: target.port,
114972
115469
  method,
114973
- path: path54,
115470
+ path: path56,
114974
115471
  // 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.
114975
115472
  headers: { ...headers, host: target.servername ?? target.host, ...body === void 0 ? {} : { "content-length": String(Buffer.byteLength(body, "utf8")) } },
114976
115473
  agent,
@@ -115012,9 +115509,9 @@ function realRcStreamDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_P
115012
115509
  return { status, body: await readAll(response) };
115013
115510
  },
115014
115511
  openStream: async (sessionId, headers, resume, signal) => {
115015
- const path54 = resume === void 0 ? `/v1/code/sessions/${encodeURIComponent(sessionId)}/events/stream` : `/v1/code/sessions/${encodeURIComponent(sessionId)}/events/stream?from_sequence_num=${String(resume.fromSequenceNum)}`;
115512
+ const path56 = resume === void 0 ? `/v1/code/sessions/${encodeURIComponent(sessionId)}/events/stream` : `/v1/code/sessions/${encodeURIComponent(sessionId)}/events/stream?from_sequence_num=${String(resume.fromSequenceNum)}`;
115016
115513
  const streamHeaders = resume === void 0 ? headers : { ...headers, "last-event-id": String(resume.fromSequenceNum) };
115017
- const { status, response } = await request7("GET", path54, streamHeaders, void 0, signal);
115514
+ const { status, response } = await request7("GET", path56, streamHeaders, void 0, signal);
115018
115515
  if (!isSuccessful2(status)) {
115019
115516
  await readAll(response);
115020
115517
  return { status, chunks: NO_CHUNKS };
@@ -115229,11 +115726,11 @@ function realConnectEffects(ports = DOOR_SOURCE_PORTS) {
115229
115726
  init_claudeShim();
115230
115727
  init_store();
115231
115728
  init_realPorts();
115232
- var import_node_fs15 = __toESM(require("node:fs"), 1);
115233
- var import_node_path42 = __toESM(require("node:path"), 1);
115729
+ var import_node_fs16 = __toESM(require("node:fs"), 1);
115730
+ var import_node_path44 = __toESM(require("node:path"), 1);
115234
115731
 
115235
115732
  // src/usage/signIn.ts
115236
- var import_node_path41 = __toESM(require("node:path"), 1);
115733
+ var import_node_path43 = __toESM(require("node:path"), 1);
115237
115734
  var CREDENTIALS_FILE = ".credentials.json";
115238
115735
  function keychainHasItem(run, account) {
115239
115736
  return run.run("security", ["find-generic-password", "-a", account]).status === 0;
@@ -115251,7 +115748,7 @@ function decideSignIn(facts) {
115251
115748
  return { state: "signed-out", detail: facts.platform === "darwin" ? `no Keychain item and no ${CREDENTIALS_FILE}` : `no ${CREDENTIALS_FILE}` };
115252
115749
  }
115253
115750
  function credentialsFilePath(farmRoot) {
115254
- return import_node_path41.default.join(farmRoot, CREDENTIALS_FILE);
115751
+ return import_node_path43.default.join(farmRoot, CREDENTIALS_FILE);
115255
115752
  }
115256
115753
  function identitySignIn(fs22, probe, identity) {
115257
115754
  const probing = !identity.hasCredentialBlock;
@@ -115377,7 +115874,7 @@ function tcpPortEraRecord(raw) {
115377
115874
  return (has("port") || has("lastPort")) && !has("socketPath");
115378
115875
  }
115379
115876
  function pushPathResolution(push, resolution) {
115380
- const ownDir = import_node_path42.default.dirname(resolution.ownExecutablePath);
115877
+ const ownDir = import_node_path44.default.dirname(resolution.ownExecutablePath);
115381
115878
  switch (resolution.agentShim.status) {
115382
115879
  case "ok":
115383
115880
  push("path-resolution", "pass", `\`agent-shim\` on PATH resolves to this running executable, ${resolution.ownExecutablePath}.`, "agent-shim");
@@ -115476,14 +115973,14 @@ function pushProvider(push, entry, cacheEnv, signIn) {
115476
115973
  }
115477
115974
  function pushLegacyName(push, params) {
115478
115975
  const legacyVariables = Object.keys(params.env).filter((name) => name.startsWith(LEGACY_ENV_PREFIX) && params.env[name] !== void 0).sort();
115479
- if (legacyVariables.length === 0 && import_node_path42.default.basename(params.rootPath) !== LEGACY_HOME_DIRNAME) {
115976
+ if (legacyVariables.length === 0 && import_node_path44.default.basename(params.rootPath) !== LEGACY_HOME_DIRNAME) {
115480
115977
  push("legacy-name", "pass", "Nothing here still uses the former `claude-use` name.");
115481
115978
  return;
115482
115979
  }
115483
115980
  for (const name of legacyVariables) {
115484
115981
  push("legacy-name", "warn", `${name} is the former name of ${name.replace(LEGACY_ENV_PREFIX, ENV_PREFIX)}. Rename it; the old name still works but is only a fallback.`, name);
115485
115982
  }
115486
- if (import_node_path42.default.basename(params.rootPath) === LEGACY_HOME_DIRNAME) {
115983
+ if (import_node_path44.default.basename(params.rootPath) === LEGACY_HOME_DIRNAME) {
115487
115984
  push(
115488
115985
  "legacy-name",
115489
115986
  "warn",
@@ -115847,27 +116344,27 @@ function formatDoctorReport(report) {
115847
116344
  }
115848
116345
  function realpathOrSelf(target) {
115849
116346
  try {
115850
- return import_node_fs15.default.realpathSync(target);
116347
+ return import_node_fs16.default.realpathSync(target);
115851
116348
  } catch {
115852
116349
  return target;
115853
116350
  }
115854
116351
  }
115855
116352
  function collectDoctorReport(params) {
115856
116353
  const { paths } = params;
115857
- const identityNames = import_node_fs15.default.existsSync(paths.identitiesDir) ? import_node_fs15.default.readdirSync(paths.identitiesDir, { withFileTypes: true }).filter((entry) => entry.isDirectory() && isIdentityDirectoryName(entry.name)).map((entry) => entry.name).sort() : [];
116354
+ const identityNames = import_node_fs16.default.existsSync(paths.identitiesDir) ? import_node_fs16.default.readdirSync(paths.identitiesDir, { withFileTypes: true }).filter((entry) => entry.isDirectory() && isIdentityDirectoryName(entry.name)).map((entry) => entry.name).sort() : [];
115858
116355
  const identities = identityNames.map((name) => {
115859
- const farmRoot = import_node_path42.default.join(paths.identitiesDir, name);
115860
- const identityPath = import_node_path42.default.join(farmRoot, "identity.json");
115861
- return { name, path: identityPath, raw: realFsPort.readFileUtf8(identityPath), farmRoot, credentialsFilePresent: import_node_fs15.default.existsSync(credentialsFilePath(farmRoot)) };
116356
+ const farmRoot = import_node_path44.default.join(paths.identitiesDir, name);
116357
+ const identityPath = import_node_path44.default.join(farmRoot, "identity.json");
116358
+ return { name, path: identityPath, raw: realFsPort.readFileUtf8(identityPath), farmRoot, credentialsFilePresent: import_node_fs16.default.existsSync(credentialsFilePath(farmRoot)) };
115862
116359
  });
115863
- const profileNames = import_node_fs15.default.existsSync(paths.configProfilesDir) ? import_node_fs15.default.readdirSync(paths.configProfilesDir, { withFileTypes: true }).filter((entry) => entry.isFile() && entry.name.endsWith(".json")).map((entry) => entry.name.slice(0, -".json".length)).sort() : [];
116360
+ const profileNames = import_node_fs16.default.existsSync(paths.configProfilesDir) ? import_node_fs16.default.readdirSync(paths.configProfilesDir, { withFileTypes: true }).filter((entry) => entry.isFile() && entry.name.endsWith(".json")).map((entry) => entry.name.slice(0, -".json".length)).sort() : [];
115864
116361
  const configProfiles = profileNames.map((name) => {
115865
- const profilePath = import_node_path42.default.join(paths.configProfilesDir, `${name}.json`);
116362
+ const profilePath = import_node_path44.default.join(paths.configProfilesDir, `${name}.json`);
115866
116363
  return { name, path: profilePath, raw: realFsPort.readFileUtf8(profilePath) };
115867
116364
  });
115868
- const providerNames = import_node_fs15.default.existsSync(paths.providersDir) ? import_node_fs15.default.readdirSync(paths.providersDir, { withFileTypes: true }).filter((entry) => entry.isFile() && entry.name.endsWith(".json")).map((entry) => entry.name.slice(0, -".json".length)).sort() : [];
116365
+ const providerNames = import_node_fs16.default.existsSync(paths.providersDir) ? import_node_fs16.default.readdirSync(paths.providersDir, { withFileTypes: true }).filter((entry) => entry.isFile() && entry.name.endsWith(".json")).map((entry) => entry.name.slice(0, -".json".length)).sort() : [];
115869
116366
  const providers = providerNames.map((name) => {
115870
- const providerPath = import_node_path42.default.join(paths.providersDir, `${name}.json`);
116367
+ const providerPath = import_node_path44.default.join(paths.providersDir, `${name}.json`);
115871
116368
  return { name, path: providerPath, raw: realFsPort.readFileUtf8(providerPath) };
115872
116369
  });
115873
116370
  const ownExecutablePath = realOwnExecutablePath();
@@ -115879,12 +116376,12 @@ function collectDoctorReport(params) {
115879
116376
  binaryDiscovery = { ok: false, message: error63 instanceof Error ? error63.message : String(error63) };
115880
116377
  }
115881
116378
  const shimState = readJson(paths.claudeShimFile, ClaudeShimStateSchema);
115882
- const pathDirs = (params.env.PATH ?? "").split(import_node_path42.default.delimiter).filter((dir) => dir !== "");
116379
+ const pathDirs = (params.env.PATH ?? "").split(import_node_path44.default.delimiter).filter((dir) => dir !== "");
115883
116380
  const claudeShimShadow = shimState === void 0 ? void 0 : refinePathShadow(
115884
116381
  findPathShadow({
115885
116382
  pathDirs,
115886
- targetDir: import_node_path42.default.dirname(shimState.targetPath),
115887
- targetFilename: import_node_path42.default.basename(shimState.targetPath),
116383
+ targetDir: import_node_path44.default.dirname(shimState.targetPath),
116384
+ targetFilename: import_node_path44.default.basename(shimState.targetPath),
115888
116385
  findExecutableInDir
115889
116386
  }),
115890
116387
  shimState.targetPath,
@@ -115906,14 +116403,14 @@ function collectDoctorReport(params) {
115906
116403
  categoriesLocal: { path: paths.categoriesLocalFile, raw: realFsPort.readFileUtf8(paths.categoriesLocalFile) },
115907
116404
  activeIdentity: { path: paths.activeIdentityFile, raw: realFsPort.readFileUtf8(paths.activeIdentityFile) },
115908
116405
  binaryDiscovery,
115909
- claudeShim: { state: shimState, targetExists: shimState !== void 0 && import_node_fs15.default.existsSync(shimState.targetPath) },
116406
+ claudeShim: { state: shimState, targetExists: shimState !== void 0 && import_node_fs16.default.existsSync(shimState.targetPath) },
115910
116407
  rootPath: paths.root,
115911
116408
  pathResolution: {
115912
116409
  ownExecutablePath,
115913
116410
  agentShim: refinePathShadow(
115914
116411
  findPathShadow({
115915
116412
  pathDirs,
115916
- targetDir: import_node_path42.default.dirname(ownExecutablePath),
116413
+ targetDir: import_node_path44.default.dirname(ownExecutablePath),
115917
116414
  targetFilename: commandFilename(ownExecutablePath, "agent-shim"),
115918
116415
  findExecutableInDir
115919
116416
  }),
@@ -116176,11 +116673,11 @@ function tryOrUndefined(fn2) {
116176
116673
  return void 0;
116177
116674
  }
116178
116675
  }
116179
- function pathToHttpPath(path54) {
116180
- return `/${path54.map(safeEncodeURIComponent).join("/")}`;
116676
+ function pathToHttpPath(path56) {
116677
+ return `/${path56.map(safeEncodeURIComponent).join("/")}`;
116181
116678
  }
116182
- function normalizeHttpPath(path54) {
116183
- const paths = path54.split("/");
116679
+ function normalizeHttpPath(path56) {
116680
+ const paths = path56.split("/");
116184
116681
  if (paths.at(0) === "") {
116185
116682
  paths.shift();
116186
116683
  }
@@ -116365,9 +116862,9 @@ function isPlainObject2(value2) {
116365
116862
  function getOwn(object3, key) {
116366
116863
  return Object.hasOwn(object3, key) ? object3[key] : void 0;
116367
116864
  }
116368
- function get(object3, path54) {
116865
+ function get(object3, path56) {
116369
116866
  let current = object3;
116370
- for (const key of path54) {
116867
+ for (const key of path56) {
116371
116868
  if (!isTypescriptObject(current)) {
116372
116869
  return void 0;
116373
116870
  }
@@ -117590,7 +118087,7 @@ function resolveClientRest(rest) {
117590
118087
  // rest[1] can be undefined if all fields of FriendlyClientOptions are optional
117591
118088
  ];
117592
118089
  }
117593
- function createORPCClient(link, { path: path54 = [], ...options } = {}) {
118090
+ function createORPCClient(link, { path: path56 = [], ...options } = {}) {
117594
118091
  const procedureClient = (...rest) => {
117595
118092
  const [input2, callOptions] = resolveClientRest(rest);
117596
118093
  const interceptors = [
@@ -117599,7 +118096,7 @@ function createORPCClient(link, { path: path54 = [], ...options } = {}) {
117599
118096
  ];
117600
118097
  return intercept(
117601
118098
  interceptors,
117602
- { ...callOptions, input: input2, path: path54 },
118099
+ { ...callOptions, input: input2, path: path56 },
117603
118100
  ({ path: path210, input: input22, ...callOptions2 }) => link.call(path210, input22, callOptions2)
117604
118101
  );
117605
118102
  };
@@ -117613,7 +118110,7 @@ function createORPCClient(link, { path: path54 = [], ...options } = {}) {
117613
118110
  if (client === void 0) {
117614
118111
  client = createORPCClient(link, {
117615
118112
  ...options,
117616
- path: [...path54, key],
118113
+ path: [...path56, key],
117617
118114
  scoped: options.scoped?.[key]
117618
118115
  });
117619
118116
  cache.set(key, client);
@@ -117635,24 +118132,24 @@ var BracketNotationSerializer = class {
117635
118132
  this.internalSerialize(data, "", true, result);
117636
118133
  return result;
117637
118134
  }
117638
- internalSerialize(data, path54, isRoot, result) {
118135
+ internalSerialize(data, path56, isRoot, result) {
117639
118136
  if (Array.isArray(data)) {
117640
118137
  data.forEach((item, i10) => {
117641
- this.internalSerialize(item, isRoot ? i10.toString() : `${path54}[${i10}]`, false, result);
118138
+ this.internalSerialize(item, isRoot ? i10.toString() : `${path56}[${i10}]`, false, result);
117642
118139
  });
117643
118140
  } else if (isPlainObject2(data)) {
117644
118141
  for (const key of Object.keys(data)) {
117645
- this.internalSerialize(data[key], isRoot ? key : `${path54}[${key}]`, false, result);
118142
+ this.internalSerialize(data[key], isRoot ? key : `${path56}[${key}]`, false, result);
117646
118143
  }
117647
118144
  } else {
117648
- result.push([path54, data]);
118145
+ result.push([path56, data]);
117649
118146
  }
117650
118147
  }
117651
118148
  deserialize(serialized) {
117652
118149
  const arrayPushStyles = /* @__PURE__ */ new WeakSet();
117653
118150
  const root = new NullProtoObj();
117654
- for (const [path54, value2] of serialized) {
117655
- const segments = this.parsePath(path54);
118151
+ for (const [path56, value2] of serialized) {
118152
+ const segments = this.parsePath(path56);
117656
118153
  let currentRef = root;
117657
118154
  let nextSegment = segments[0];
117658
118155
  for (let i10 = 1; i10 < segments.length; i10++) {
@@ -117703,13 +118200,13 @@ var BracketNotationSerializer = class {
117703
118200
  }
117704
118201
  return result;
117705
118202
  }
117706
- parsePath(path54) {
118203
+ parsePath(path56) {
117707
118204
  const segments = [];
117708
118205
  let inBrackets = false;
117709
118206
  let currentSegment = "";
117710
- for (let i10 = 0; i10 < path54.length; i10++) {
117711
- const char = path54[i10];
117712
- const nextChar = path54[i10 + 1];
118207
+ for (let i10 = 0; i10 < path56.length; i10++) {
118208
+ const char = path56[i10];
118209
+ const nextChar = path56[i10 + 1];
117713
118210
  if (inBrackets && char === "]" && (nextChar === void 0 || nextChar === "[")) {
117714
118211
  if (nextChar === void 0) {
117715
118212
  inBrackets = false;
@@ -117725,7 +118222,7 @@ var BracketNotationSerializer = class {
117725
118222
  currentSegment += char;
117726
118223
  }
117727
118224
  }
117728
- return inBrackets || segments.length === 0 ? [path54] : segments;
118225
+ return inBrackets || segments.length === 0 ? [path56] : segments;
117729
118226
  }
117730
118227
  };
117731
118228
  var INTEGER_PATTERN = /^0$|^[1-9]\d*$/;
@@ -118298,11 +118795,11 @@ var OpenAPISerializer = class {
118298
118795
  return json2;
118299
118796
  }
118300
118797
  const form = new FormData();
118301
- for (const [path54, value22] of this.bracketNotation.serialize(json2)) {
118798
+ for (const [path56, value22] of this.bracketNotation.serialize(json2)) {
118302
118799
  if (value22 instanceof Blob) {
118303
- form.append(path54, value22);
118800
+ form.append(path56, value22);
118304
118801
  } else if (value22 !== void 0 && value22 !== null) {
118305
- form.append(path54, String(value22));
118802
+ form.append(path56, String(value22));
118306
118803
  }
118307
118804
  }
118308
118805
  return form;
@@ -118340,30 +118837,30 @@ function isBodylessMethod(method) {
118340
118837
  return method === "GET" || method === "HEAD";
118341
118838
  }
118342
118839
  var PARAMETER_NAME_REGEX = /^[\w-]+$/;
118343
- function getDynamicPathParams(path54) {
118344
- if (!path54.includes("{")) {
118840
+ function getDynamicPathParams(path56) {
118841
+ if (!path56.includes("{")) {
118345
118842
  return void 0;
118346
118843
  }
118347
- const len = path54.length;
118844
+ const len = path56.length;
118348
118845
  let params;
118349
118846
  let index = 1;
118350
118847
  while (index < len) {
118351
118848
  const segmentStart = index;
118352
- const slashPos = path54.indexOf("/", index);
118849
+ const slashPos = path56.indexOf("/", index);
118353
118850
  const segmentEnd = slashPos === -1 ? len : slashPos;
118354
- if (segmentEnd > segmentStart && path54.charCodeAt(segmentStart) === 123 && path54.charCodeAt(segmentEnd - 1) === 125) {
118851
+ if (segmentEnd > segmentStart && path56.charCodeAt(segmentStart) === 123 && path56.charCodeAt(segmentEnd - 1) === 125) {
118355
118852
  let parameterStart = segmentStart + 1;
118356
118853
  let allowsSlash = false;
118357
- const operator = path54.charCodeAt(parameterStart);
118854
+ const operator = path56.charCodeAt(parameterStart);
118358
118855
  if (operator === 43) {
118359
118856
  allowsSlash = true;
118360
118857
  parameterStart++;
118361
118858
  }
118362
- const parameterName = path54.slice(parameterStart, segmentEnd - 1);
118859
+ const parameterName = path56.slice(parameterStart, segmentEnd - 1);
118363
118860
  if (PARAMETER_NAME_REGEX.test(parameterName)) {
118364
118861
  params ??= [];
118365
118862
  params.push({
118366
- segment: path54.slice(segmentStart, segmentEnd),
118863
+ segment: path56.slice(segmentStart, segmentEnd),
118367
118864
  startIndex: segmentStart,
118368
118865
  parameterName,
118369
118866
  allowsSlash
@@ -118406,8 +118903,8 @@ openapi.method = (method) => ({
118406
118903
  ...openapi({ method }),
118407
118904
  name: "~openapi/method"
118408
118905
  });
118409
- openapi.path = (path54) => ({
118410
- ...openapi({ path: path54 }),
118906
+ openapi.path = (path56) => ({
118907
+ ...openapi({ path: path56 }),
118411
118908
  name: "~openapi/path"
118412
118909
  });
118413
118910
  openapi.spec = (spec) => ({
@@ -119268,22 +119765,22 @@ function visitJsonSchemaRefs(value2, visit2, schemaLevel = true, seen = /* @__PU
119268
119765
  }
119269
119766
  }
119270
119767
  }
119271
- function mapJsonSchemaRefs(value2, map2, schemaLevel = true, path54 = []) {
119768
+ function mapJsonSchemaRefs(value2, map2, schemaLevel = true, path56 = []) {
119272
119769
  if (!value2 || typeof value2 !== "object") {
119273
119770
  return value2;
119274
119771
  }
119275
119772
  if (Array.isArray(value2)) {
119276
- return value2.map((item, index) => mapJsonSchemaRefs(item, map2, schemaLevel, [...path54, index]));
119773
+ return value2.map((item, index) => mapJsonSchemaRefs(item, map2, schemaLevel, [...path56, index]));
119277
119774
  }
119278
119775
  const result = {};
119279
119776
  for (const key of Object.keys(value2)) {
119280
119777
  const val = value2[key];
119281
119778
  if (key === "$ref" && typeof val === "string") {
119282
- setOwn(result, key, map2(val, [...path54, key]));
119779
+ setOwn(result, key, map2(val, [...path56, key]));
119283
119780
  } else if (!schemaLevel) {
119284
- setOwn(result, key, mapJsonSchemaRefs(val, map2, true, [...path54, key]));
119781
+ setOwn(result, key, mapJsonSchemaRefs(val, map2, true, [...path56, key]));
119285
119782
  } else if (JSON_SCHEMA_LOGIC_KEYWORDS.has(key) || JSON_SCHEMA_RECORD_KEYWORDS.has(key)) {
119286
- setOwn(result, key, mapJsonSchemaRefs(val, map2, !JSON_SCHEMA_RECORD_KEYWORDS.has(key), [...path54, key]));
119783
+ setOwn(result, key, mapJsonSchemaRefs(val, map2, !JSON_SCHEMA_RECORD_KEYWORDS.has(key), [...path56, key]));
119287
119784
  } else {
119288
119785
  setOwn(result, key, val);
119289
119786
  }
@@ -119813,7 +120310,7 @@ function unlazy(maybeLazy) {
119813
120310
  function createProcedureClient(lazyableProcedure, ...rest) {
119814
120311
  const options = resolveMaybeOptionalOptions(rest);
119815
120312
  return async (...[input2, callerOptions]) => {
119816
- const path54 = toArray(options.path);
120313
+ const path56 = toArray(options.path);
119817
120314
  const { default: procedure } = await unlazy(lazyableProcedure);
119818
120315
  const clientContext = callerOptions?.context ?? {};
119819
120316
  const context = await value(options.context, clientContext) ?? {};
@@ -119826,7 +120323,7 @@ function createProcedureClient(lazyableProcedure, ...rest) {
119826
120323
  };
119827
120324
  try {
119828
120325
  const output2 = await runWithSpan("call_procedure", (span) => {
119829
- span?.setAttribute("procedure.path", path54);
120326
+ span?.setAttribute("procedure.path", path56);
119830
120327
  return intercept(
119831
120328
  options.interceptors,
119832
120329
  {
@@ -119834,7 +120331,7 @@ function createProcedureClient(lazyableProcedure, ...rest) {
119834
120331
  // input can be optional if it is undefinable
119835
120332
  input: input2,
119836
120333
  errors,
119837
- path: path54,
120334
+ path: path56,
119838
120335
  procedure,
119839
120336
  signal: callerOptions?.signal,
119840
120337
  lastEventId: callerOptions?.lastEventId
@@ -120085,10 +120582,10 @@ function augmentRouter(router, options) {
120085
120582
  }
120086
120583
  return enhanced;
120087
120584
  }
120088
- function getRouter(router, path54) {
120585
+ function getRouter(router, path56) {
120089
120586
  let current = router;
120090
- for (let i10 = 0; i10 < path54.length; i10++) {
120091
- const segment = path54[i10];
120587
+ for (let i10 = 0; i10 < path56.length; i10++) {
120588
+ const segment = path56[i10];
120092
120589
  if (!isTypescriptObject(current)) {
120093
120590
  return void 0;
120094
120591
  }
@@ -120100,7 +120597,7 @@ function getRouter(router, path54) {
120100
120597
  continue;
120101
120598
  }
120102
120599
  const lazied = current;
120103
- const rest = path54.slice(i10);
120600
+ const rest = path56.slice(i10);
120104
120601
  return new Lazy({
120105
120602
  ...lazied["~orpc"],
120106
120603
  async loader() {
@@ -120115,40 +120612,40 @@ function getRouter(router, path54) {
120115
120612
  }
120116
120613
  return current;
120117
120614
  }
120118
- function walkProcedureContractsSync(router, callback, path54 = []) {
120615
+ function walkProcedureContractsSync(router, callback, path56 = []) {
120119
120616
  const lazyResults = [];
120120
- walkProcedureContractsSyncInternal(router, callback, path54.slice(), lazyResults);
120617
+ walkProcedureContractsSyncInternal(router, callback, path56.slice(), lazyResults);
120121
120618
  return lazyResults;
120122
120619
  }
120123
- function walkProcedureContractsSyncInternal(router, callback, path54, lazyResults) {
120620
+ function walkProcedureContractsSyncInternal(router, callback, path56, lazyResults) {
120124
120621
  const hiddenContract = getHiddenRouterContract(router);
120125
120622
  if (hiddenContract !== void 0) {
120126
120623
  router = hiddenContract;
120127
120624
  }
120128
120625
  if (router instanceof ProcedureContract) {
120129
- callback(router, path54.slice());
120626
+ callback(router, path56.slice());
120130
120627
  return;
120131
120628
  }
120132
120629
  if (!isTypescriptObject(router)) {
120133
120630
  return;
120134
120631
  }
120135
120632
  for (const [key, value2] of Object.entries(router)) {
120136
- path54.push(key);
120633
+ path56.push(key);
120137
120634
  if (value2 instanceof Lazy) {
120138
- lazyResults.push({ router: value2, path: path54.slice() });
120635
+ lazyResults.push({ router: value2, path: path56.slice() });
120139
120636
  } else {
120140
- walkProcedureContractsSyncInternal(value2, callback, path54, lazyResults);
120637
+ walkProcedureContractsSyncInternal(value2, callback, path56, lazyResults);
120141
120638
  }
120142
- path54.pop();
120639
+ path56.pop();
120143
120640
  }
120144
120641
  }
120145
- async function walkProcedureContractsAsync(router, callback, path54 = []) {
120642
+ async function walkProcedureContractsAsync(router, callback, path56 = []) {
120146
120643
  const hiddenContract = getHiddenRouterContract(router);
120147
120644
  if (hiddenContract !== void 0) {
120148
120645
  router = hiddenContract;
120149
120646
  }
120150
120647
  if (router instanceof ProcedureContract) {
120151
- await callback(router, path54);
120648
+ await callback(router, path56);
120152
120649
  return;
120153
120650
  }
120154
120651
  if (!isTypescriptObject(router)) {
@@ -120157,9 +120654,9 @@ async function walkProcedureContractsAsync(router, callback, path54 = []) {
120157
120654
  for (const [key, value2] of Object.entries(router)) {
120158
120655
  if (value2 instanceof Lazy) {
120159
120656
  const { default: router2 } = await unlazy(value2);
120160
- await walkProcedureContractsAsync(router2, callback, [...path54, key]);
120657
+ await walkProcedureContractsAsync(router2, callback, [...path56, key]);
120161
120658
  } else {
120162
- await walkProcedureContractsAsync(value2, callback, [...path54, key]);
120659
+ await walkProcedureContractsAsync(value2, callback, [...path56, key]);
120163
120660
  }
120164
120661
  }
120165
120662
  }
@@ -120645,18 +121142,18 @@ function rewriteComponentSchemaRefs(schema, renameMap) {
120645
121142
  }
120646
121143
  var OpenAPIGeneratorError = class extends TypeError {
120647
121144
  };
120648
- function toOpenAPIPath(path54, dynamicPathParams) {
121145
+ function toOpenAPIPath(path56, dynamicPathParams) {
120649
121146
  if (!dynamicPathParams?.length) {
120650
- return path54;
121147
+ return path56;
120651
121148
  }
120652
121149
  let normalized = "";
120653
121150
  let currentIndex = 0;
120654
121151
  for (const param of dynamicPathParams) {
120655
- normalized += path54.slice(currentIndex, param.startIndex);
121152
+ normalized += path56.slice(currentIndex, param.startIndex);
120656
121153
  normalized += `{${param.parameterName}}`;
120657
121154
  currentIndex = param.startIndex + param.segment.length;
120658
121155
  }
120659
- normalized += path54.slice(currentIndex);
121156
+ normalized += path56.slice(currentIndex);
120660
121157
  return normalized;
120661
121158
  }
120662
121159
  function buildRequest(ctx, operation, def, meta3, dynamicPathParams) {
@@ -121090,8 +121587,8 @@ var OpenAPIGenerator = class {
121090
121587
  customErrorResponseBodySchema: options.customErrorResponseBodySchema
121091
121588
  };
121092
121589
  const errors = [];
121093
- await walkProcedureContractsAsync(router, (contract, path54) => {
121094
- if (value(options.filter, contract, path54) === false) {
121590
+ await walkProcedureContractsAsync(router, (contract, path56) => {
121591
+ if (value(options.filter, contract, path56) === false) {
121095
121592
  return;
121096
121593
  }
121097
121594
  try {
@@ -121103,7 +121600,7 @@ var OpenAPIGenerator = class {
121103
121600
  `QUERY operations require OpenAPI 3.2, but version "${version2}" was requested.`
121104
121601
  );
121105
121602
  }
121106
- const postPath = meta3?.path ?? pathToHttpPath(path54);
121603
+ const postPath = meta3?.path ?? pathToHttpPath(path56);
121107
121604
  const httpPath = meta3?.prefix ? mergeHttpPath(meta3.prefix, postPath) : postPath;
121108
121605
  const dynamicPathParams = getDynamicPathParams(httpPath);
121109
121606
  const openApiPath = toOpenAPIPath(httpPath, dynamicPathParams);
@@ -121112,7 +121609,7 @@ var OpenAPIGenerator = class {
121112
121609
  operation = meta3.spec;
121113
121610
  } else {
121114
121611
  operation = {
121115
- operationId: meta3?.operationId ?? path54.join("."),
121612
+ operationId: meta3?.operationId ?? path56.join("."),
121116
121613
  summary: meta3?.summary,
121117
121614
  description: meta3?.description,
121118
121615
  deprecated: meta3?.deprecated,
@@ -121132,7 +121629,7 @@ var OpenAPIGenerator = class {
121132
121629
  if (!(e14 instanceof OpenAPIGeneratorError)) {
121133
121630
  throw e14;
121134
121631
  }
121135
- errors.push(`Procedure at ${path54.join(".") || "(root)"}: ${e14.message}`);
121632
+ errors.push(`Procedure at ${path56.join(".") || "(root)"}: ${e14.message}`);
121136
121633
  }
121137
121634
  });
121138
121635
  if (errors.length) {
@@ -121440,7 +121937,7 @@ var ResetRowSchema = external_exports.strictObject({
121440
121937
  var ResetScheduleSchema = external_exports.strictObject({ resets: external_exports.readonly(external_exports.array(ResetRowSchema)) });
121441
121938
 
121442
121939
  // src/frontdoor/controlSchemas.ts
121443
- var import_node_path43 = __toESM(require("node:path"), 1);
121940
+ var import_node_path45 = __toESM(require("node:path"), 1);
121444
121941
  init_zod();
121445
121942
  init_schema2();
121446
121943
 
@@ -121652,11 +122149,11 @@ var FrontDoorSessionsOutputSchema = external_exports.strictObject({ sessions: ex
121652
122149
  var CheckRunInputSchema = external_exports.strictObject({
121653
122150
  path: external_exports.string().min(1),
121654
122151
  identity: external_exports.string().min(1).optional()
121655
- }).refine((input2) => import_node_path43.default.isAbsolute(input2.path), { message: "path must be absolute: the door cannot resolve a relative path against the caller's working directory" });
122152
+ }).refine((input2) => import_node_path45.default.isAbsolute(input2.path), { message: "path must be absolute: the door cannot resolve a relative path against the caller's working directory" });
121656
122153
  var PoolPickInputSchema = external_exports.strictObject({
121657
122154
  pool: external_exports.string().min(1),
121658
122155
  path: external_exports.string().min(1)
121659
- }).refine((input2) => import_node_path43.default.isAbsolute(input2.path), { message: "path must be absolute: the door cannot resolve a relative path against the caller's working directory" });
122156
+ }).refine((input2) => import_node_path45.default.isAbsolute(input2.path), { message: "path must be absolute: the door cannot resolve a relative path against the caller's working directory" });
121660
122157
  var DoctorFindingSchema = external_exports.strictObject({
121661
122158
  section: external_exports.enum(DOCTOR_SECTIONS),
121662
122159
  subject: external_exports.string().optional(),
@@ -121977,16 +122474,16 @@ var StandardLink = class {
121977
122474
  /**
121978
122475
  * @throws ORPCError, transport-level errors (network failures, timeouts, etc.)
121979
122476
  */
121980
- call(path54, input2, options) {
121981
- return runWithSpan(`${ORPC_NAME}.${path54.join("/")}`, (span) => {
122477
+ call(path56, input2, options) {
122478
+ return runWithSpan(`${ORPC_NAME}.${path56.join("/")}`, (span) => {
121982
122479
  span?.setAttribute("rpc.system", ORPC_NAME);
121983
- span?.setAttribute("rpc.method", path54.join("."));
122480
+ span?.setAttribute("rpc.method", path56.join("."));
121984
122481
  if (getTracer() && isAsyncIteratorObject(input2)) {
121985
122482
  input2 = override(input2, traceAsyncIterator("consume_async_iterator_object_input", input2));
121986
122483
  } else if (getTracer() && input2 instanceof ReadableStream) {
121987
122484
  input2 = override(input2, traceReadableStream("consume_octet_stream_input", input2));
121988
122485
  }
121989
- return intercept(this.interceptors, { ...options, path: path54, input: input2 }, async ({ path: path210, input: input22, ...options2 }) => {
122486
+ return intercept(this.interceptors, { ...options, path: path56, input: input2 }, async ({ path: path210, input: input22, ...options2 }) => {
121990
122487
  const tracer = getTracer();
121991
122488
  const activeSpan = tracer?.getActiveSpan() ?? span;
121992
122489
  let request7 = await runWithSpan(
@@ -122043,18 +122540,18 @@ var RPCLinkCodec = class {
122043
122540
  this.headers = options.headers ?? {};
122044
122541
  this.serializer = options.serializer ?? new RPCSerializer();
122045
122542
  }
122046
- async encodeInput(input2, path54, options) {
122047
- let headers = toResolvedStandardHeaders(await value(this.headers, options, path54, input2));
122543
+ async encodeInput(input2, path56, options) {
122544
+ let headers = toResolvedStandardHeaders(await value(this.headers, options, path56, input2));
122048
122545
  if (options.lastEventId !== void 0) {
122049
122546
  headers = mergeStandardHeaders(headers, { "last-event-id": options.lastEventId });
122050
122547
  }
122051
- const expectedMethod = await value(this.expectedMethod, options, path54, input2);
122052
- const baseUrl = await value(this.baseUrl, options, path54, input2);
122548
+ const expectedMethod = await value(this.expectedMethod, options, path56, input2);
122549
+ const baseUrl = await value(this.baseUrl, options, path56, input2);
122053
122550
  const [pathname, search, hash2] = parseStandardUrl(baseUrl);
122054
- const newPathname = `${pathname.replace(END_SLASH_REGEX, "")}${pathToHttpPath(path54)}`;
122551
+ const newPathname = `${pathname.replace(END_SLASH_REGEX, "")}${pathToHttpPath(path56)}`;
122055
122552
  const serialized = this.serializer.serialize(input2);
122056
122553
  if (expectedMethod === "GET" && !(serialized instanceof Blob) && !(serialized instanceof ReadableStream) && !(serialized instanceof FormData) && !isAsyncIteratorObject(serialized)) {
122057
- const maxUrlLength = await value(this.maxUrlLength, options, path54, input2);
122554
+ const maxUrlLength = await value(this.maxUrlLength, options, path56, input2);
122058
122555
  const mergedSearch = new URLSearchParams(search);
122059
122556
  mergedSearch.append("data", stringifyJSON(serialized) ?? "");
122060
122557
  const url22 = `${newPathname}?${mergedSearch}${hash2 ?? ""}`;
@@ -122139,8 +122636,8 @@ var FetchLinkTransport = class {
122139
122636
  this.fetch = options.fetch ?? ((url2, init) => globalThis.fetch(url2, init));
122140
122637
  this.toFetchRequestOptions = options.toFetchRequest;
122141
122638
  }
122142
- async send(standardRequest, path54, options) {
122143
- let origin = await value(this.origin, options, path54);
122639
+ async send(standardRequest, path56, options) {
122640
+ let origin = await value(this.origin, options, path56);
122144
122641
  if (origin?.endsWith("/")) {
122145
122642
  origin = origin.slice(0, -1);
122146
122643
  }
@@ -122160,7 +122657,7 @@ var FetchLinkTransport = class {
122160
122657
  }
122161
122658
  }
122162
122659
  const fetch3 = this.fetch;
122163
- const response = await fetch3(url2, init, options, path54);
122660
+ const response = await fetch3(url2, init, options, path56);
122164
122661
  const standardResponse = toStandardLazyResponse(response);
122165
122662
  return standardResponse;
122166
122663
  }
@@ -122551,14 +123048,14 @@ var StandardHandler = class {
122551
123048
  span?.setAttribute("url.path", request22.url);
122552
123049
  return { matched: false };
122553
123050
  }
122554
- const { path: path54, procedure, decodeInput } = matchedOrNot;
122555
- span?.updateName(`${ORPC_NAME}.${path54.join("/")}`);
123051
+ const { path: path56, procedure, decodeInput } = matchedOrNot;
123052
+ span?.updateName(`${ORPC_NAME}.${path56.join("/")}`);
122556
123053
  span?.setAttribute("rpc.system", ORPC_NAME);
122557
- span?.setAttribute("rpc.method", path54.join("."));
123054
+ span?.setAttribute("rpc.method", path56.join("."));
122558
123055
  try {
122559
123056
  const response = await intercept(
122560
123057
  this.interceptors,
122561
- { context: context2, prefix: prefix2, request: request22, path: path54, procedure, decodeInput },
123058
+ { context: context2, prefix: prefix2, request: request22, path: path56, procedure, decodeInput },
122562
123059
  async ({ context: context3, prefix: prefix3, request: request32, path: path210, procedure: procedure2, decodeInput: decodeInput2 }) => {
122563
123060
  step2 = "decode_input";
122564
123061
  let input2 = await runWithSpan("decode_input", decodeInput2);
@@ -122592,7 +123089,7 @@ var StandardHandler = class {
122592
123089
  message: `Malformed request. Ensure the request body is properly formatted and the 'Content-Type' header is set correctly.`,
122593
123090
  cause: e14
122594
123091
  }) : toORPCError(e14);
122595
- const response = await this.codec.encodeError(error63, procedure, path54, { context: context2, prefix: prefix2 });
123092
+ const response = await this.codec.encodeError(error63, procedure, path56, { context: context2, prefix: prefix2 });
122596
123093
  return { matched: true, response };
122597
123094
  }
122598
123095
  }
@@ -122698,7 +123195,7 @@ var RPCMatcher = class {
122698
123195
  this.rootRouter = router;
122699
123196
  this.index(router);
122700
123197
  }
122701
- index(router, path54 = []) {
123198
+ index(router, path56 = []) {
122702
123199
  const lazyResults = walkProcedureContractsSync(router, (procedure, procedurePath) => {
122703
123200
  if (!value(this.filter, procedure, procedurePath)) {
122704
123201
  return;
@@ -122709,7 +123206,7 @@ var RPCMatcher = class {
122709
123206
  // contract-first entries have no implementation yet, resolveProcedure fills it in on demand
122710
123207
  procedure: procedure instanceof Procedure ? procedure : void 0
122711
123208
  });
122712
- }, path54);
123209
+ }, path56);
122713
123210
  for (const result of lazyResults) {
122714
123211
  this.pendingLazyRouters.set(pathToHttpPath(result.path), result);
122715
123212
  }
@@ -122841,10 +123338,10 @@ var RPCHandlerCodec = class {
122841
123338
  }
122842
123339
  };
122843
123340
  }
122844
- encodeOutput(output2, procedure, path54, options) {
123341
+ encodeOutput(output2, procedure, path56, options) {
122845
123342
  return {
122846
123343
  headers: {},
122847
- status: value(this.outputStatus, output2, procedure, path54, options) ?? DEFAULT_SUCCESS_STATUS,
123344
+ status: value(this.outputStatus, output2, procedure, path56, options) ?? DEFAULT_SUCCESS_STATUS,
122848
123345
  body: this.serializer.serialize(output2)
122849
123346
  };
122850
123347
  }
@@ -122898,39 +123395,39 @@ function createRouter() {
122898
123395
  static: new NullProtoObj2()
122899
123396
  };
122900
123397
  }
122901
- function scanFirstGroup(path54) {
123398
+ function scanFirstGroup(path56) {
122902
123399
  let i10 = 0;
122903
123400
  let depth = 0;
122904
- for (; i10 < path54.length; i10++) {
122905
- const c10 = path54.charCodeAt(i10);
123401
+ for (; i10 < path56.length; i10++) {
123402
+ const c10 = path56.charCodeAt(i10);
122906
123403
  if (c10 === 92) i10++;
122907
123404
  else if (c10 === 40) depth++;
122908
123405
  else if (c10 === 41 && depth > 0) depth--;
122909
123406
  else if (c10 === 123 && depth === 0) break;
122910
123407
  }
122911
- if (i10 >= path54.length) return;
123408
+ if (i10 >= path56.length) return;
122912
123409
  let j10 = i10 + 1;
122913
123410
  depth = 0;
122914
- for (; j10 < path54.length; j10++) {
122915
- const c10 = path54.charCodeAt(j10);
123411
+ for (; j10 < path56.length; j10++) {
123412
+ const c10 = path56.charCodeAt(j10);
122916
123413
  if (c10 === 92) j10++;
122917
123414
  else if (c10 === 40) depth++;
122918
123415
  else if (c10 === 41 && depth > 0) depth--;
122919
123416
  else if (c10 === 125 && depth === 0) break;
122920
123417
  }
122921
- if (j10 >= path54.length) return;
122922
- const mod = path54[j10 + 1];
123418
+ if (j10 >= path56.length) return;
123419
+ const mod = path56[j10 + 1];
122923
123420
  const hasMod = mod === "?" || mod === "+" || mod === "*";
122924
123421
  return [
122925
- path54.slice(0, i10),
122926
- path54.slice(i10 + 1, j10),
122927
- path54.slice(j10 + (hasMod ? 2 : 1)),
123422
+ path56.slice(0, i10),
123423
+ path56.slice(i10 + 1, j10),
123424
+ path56.slice(j10 + (hasMod ? 2 : 1)),
122928
123425
  hasMod ? mod : void 0
122929
123426
  ];
122930
123427
  }
122931
- function expandGroupDelimiters(path54) {
122932
- if (!path54.includes("{")) return;
122933
- const group = scanFirstGroup(path54);
123428
+ function expandGroupDelimiters(path56) {
123429
+ if (!path56.includes("{")) return;
123430
+ const group = scanFirstGroup(path56);
122934
123431
  if (!group) return;
122935
123432
  const [pre2, body, suf, mod] = group;
122936
123433
  if (!mod) return [pre2 + body + suf];
@@ -123000,9 +123497,9 @@ function replaceSegmentWildcards(segment, unnamedStart, toGroupKey = toUnnamedGr
123000
123497
  }
123001
123498
  return [replaced, nextIndex];
123002
123499
  }
123003
- function encodeEscapes(path54) {
123004
- if (!path54.includes("\\")) return path54;
123005
- return path54.replace(/\\([:(){}])/g, (_, c10) => "\uFFFD" + "ABCDE"[":(){}".indexOf(c10)]);
123500
+ function encodeEscapes(path56) {
123501
+ if (!path56.includes("\\")) return path56;
123502
+ return path56.replace(/\\([:(){}])/g, (_, c10) => "\uFFFD" + "ABCDE"[":(){}".indexOf(c10)]);
123006
123503
  }
123007
123504
  function segmentKey(segment) {
123008
123505
  if (segment.startsWith("**")) return 2;
@@ -123031,22 +123528,22 @@ function expandModifiers(segments) {
123031
123528
  return m10[2] === "+" ? [wc2] : [wc2, without];
123032
123529
  }
123033
123530
  }
123034
- function normalizePath(path54) {
123035
- if (!path54.includes("/.")) return path54;
123531
+ function normalizePath(path56) {
123532
+ if (!path56.includes("/.")) return path56;
123036
123533
  const r10 = [];
123037
- for (const s of path54.split("/")) if (s === ".") continue;
123534
+ for (const s of path56.split("/")) if (s === ".") continue;
123038
123535
  else if (s === ".." && r10.length > 1) r10.pop();
123039
123536
  else r10.push(s);
123040
123537
  return r10.join("/") || "/";
123041
123538
  }
123042
- function splitPath(path54) {
123043
- const s = path54.split("/");
123539
+ function splitPath(path56) {
123540
+ const s = path56.split("/");
123044
123541
  s.shift();
123045
123542
  if (s[s.length - 1] === "") s.pop();
123046
123543
  return s;
123047
123544
  }
123048
- function splitRoute(path54) {
123049
- const s = splitPath(path54);
123545
+ function splitRoute(path56) {
123546
+ const s = splitPath(path56);
123050
123547
  while (s[s.length - 1] === "") s.pop();
123051
123548
  return s;
123052
123549
  }
@@ -123062,16 +123559,16 @@ function getMatchParams(segments, paramsMap) {
123062
123559
  }
123063
123560
  return params;
123064
123561
  }
123065
- function addRoute(ctx, method = "", path54, data) {
123562
+ function addRoute(ctx, method = "", path56, data) {
123066
123563
  method = method.toUpperCase();
123067
- if (path54.charCodeAt(0) !== 47) path54 = `/${path54}`;
123068
- const groupExpanded = expandGroupDelimiters(path54);
123564
+ if (path56.charCodeAt(0) !== 47) path56 = `/${path56}`;
123565
+ const groupExpanded = expandGroupDelimiters(path56);
123069
123566
  if (groupExpanded) {
123070
123567
  for (const expandedPath of groupExpanded) addRoute(ctx, method, expandedPath, data);
123071
123568
  return;
123072
123569
  }
123073
- path54 = encodeEscapes(path54);
123074
- const segments = splitRoute(path54);
123570
+ path56 = encodeEscapes(path56);
123571
+ const segments = splitRoute(path56);
123075
123572
  const expanded = expandModifiers(segments);
123076
123573
  if (expanded) {
123077
123574
  for (const p of expanded) addRoute(ctx, method, p, data);
@@ -123162,15 +123659,15 @@ function getParamRegexp(segment, unnamedStart = 0) {
123162
123659
  const regex = _s2.replace(/:([\w-]+)(?:\(([^)]*)\))?/g, (_, id2, p) => `(?<${toGroupName(id2)}>${p || "[^/]+"})`).replace(/\((?![?<])/g, () => `(?<${toUnnamedGroupKey(_i2++)}>`).replace(/\uFFFE(.)/g, (_, c10) => /[.*+?^${}()|[\]\\]/.test(c10) ? `\\${c10}` : c10);
123163
123660
  return [new RegExp(`^${regex}$`), _i2];
123164
123661
  }
123165
- function findRoute(ctx, method = "", path54, opts) {
123166
- if (opts?.normalize) path54 = normalizePath(path54);
123167
- if (path54.charCodeAt(path54.length - 1) === 47) path54 = path54.slice(0, -1);
123168
- const staticNode = ctx.static[path54];
123662
+ function findRoute(ctx, method = "", path56, opts) {
123663
+ if (opts?.normalize) path56 = normalizePath(path56);
123664
+ if (path56.charCodeAt(path56.length - 1) === 47) path56 = path56.slice(0, -1);
123665
+ const staticNode = ctx.static[path56];
123169
123666
  if (staticNode && staticNode.methods) {
123170
123667
  const staticMatch = staticNode.methods[method] || staticNode.methods[""];
123171
123668
  if (staticMatch !== void 0) return staticMatch[0];
123172
123669
  }
123173
- const segments = splitPath(path54);
123670
+ const segments = splitPath(path56);
123174
123671
  const match = _lookupTree(ctx.root, method, segments, 0);
123175
123672
  if (match === void 0) return;
123176
123673
  if (opts?.params === false) return match;
@@ -123370,7 +123867,7 @@ var OpenAPIMatcher = class {
123370
123867
  this.rootRouter = router;
123371
123868
  this.index(router);
123372
123869
  }
123373
- index(router, path54 = []) {
123870
+ index(router, path56 = []) {
123374
123871
  const lazyResults = walkProcedureContractsSync(router, (contract, path210) => {
123375
123872
  if (!value(this.filter, contract, path210)) {
123376
123873
  return;
@@ -123385,7 +123882,7 @@ var OpenAPIMatcher = class {
123385
123882
  contract,
123386
123883
  procedure: contract instanceof Procedure ? contract : void 0
123387
123884
  });
123388
- }, path54);
123885
+ }, path56);
123389
123886
  for (const result of lazyResults) {
123390
123887
  const prefix = getOpenAPIMeta(result.router)?.prefix;
123391
123888
  this.pendingLazyRouters.add({
@@ -123472,20 +123969,20 @@ var OpenAPIMatcher = class {
123472
123969
  return entry.procedure;
123473
123970
  }
123474
123971
  };
123475
- function toRou3Pattern(path54) {
123476
- const params = getDynamicPathParams(path54);
123972
+ function toRou3Pattern(path56) {
123973
+ const params = getDynamicPathParams(path56);
123477
123974
  if (!params?.length) {
123478
- return path54;
123975
+ return path56;
123479
123976
  }
123480
123977
  for (let i10 = params.length - 1; i10 >= 0; i10--) {
123481
123978
  const param = params[i10];
123482
123979
  const pattern = param.allowsSlash ? `**:${param.parameterName}` : `:${param.parameterName}`;
123483
- path54 = path54.slice(0, param.startIndex) + pattern + path54.slice(param.startIndex + param.segment.length);
123980
+ path56 = path56.slice(0, param.startIndex) + pattern + path56.slice(param.startIndex + param.segment.length);
123484
123981
  }
123485
- return path54;
123982
+ return path56;
123486
123983
  }
123487
- function toRou3PrefixMatcher(path54) {
123488
- const pattern = toRou3Pattern(path54);
123984
+ function toRou3PrefixMatcher(path56) {
123985
+ const pattern = toRou3Pattern(path56);
123489
123986
  return routeToRegExp(pattern === "/" ? "/**" : `${pattern}/**`);
123490
123987
  }
123491
123988
  function decodeParams(params) {
@@ -123564,7 +124061,7 @@ var OpenAPIHandlerCodecCore = class {
123564
124061
  /**
123565
124062
  * @throws {TypeError} If `outputStructure` is "detailed" and the output doesn't match the expected structure.
123566
124063
  */
123567
- encodeOutput(output2, procedure, path54) {
124064
+ encodeOutput(output2, procedure, path56) {
123568
124065
  const meta3 = getOpenAPIMeta(procedure);
123569
124066
  const successStatus = meta3?.successStatus ?? DEFAULT_SUCCESS_STATUS;
123570
124067
  const outputStructure = meta3?.outputStructure ?? DEFAULT_OPENAPI_OUTPUT_STRUCTURE;
@@ -123577,7 +124074,7 @@ var OpenAPIHandlerCodecCore = class {
123577
124074
  }
123578
124075
  if (!isValidDetailedOutput(output2)) {
123579
124076
  throw new TypeError(`
123580
- Invalid "detailed" output structure returned by procedure (${path54.join(".")}):
124077
+ Invalid "detailed" output structure returned by procedure (${path56.join(".")}):
123581
124078
  \u2022 Expected an object with optional properties:
123582
124079
  - status (number <400)
123583
124080
  - headers (object)
@@ -123732,6 +124229,7 @@ var RC_ORPC_PATH_PREFIX = "/__agent-shim/orpc";
123732
124229
  var RC_OPENAPI_DOC_PATH = "/openapi.json";
123733
124230
  var RC_SUBSCRIBER_BUFFER_EVENTS = 100;
123734
124231
  var READ_ONLY_OPERATION_EXTENSION = "x-agent-shim-read-only";
124232
+ var SESSION_HISTORY_TAG = "agent-trees";
123735
124233
  function doorApiBearer(headers) {
123736
124234
  const presented = headers.authorization;
123737
124235
  const bearerPrefix = "bearer ".length;
@@ -124129,7 +124627,7 @@ function profileValue(name, paths) {
124129
124627
  function createConfigApiRouter(deps) {
124130
124628
  const authed = doorApiAuth(deps.expectedToken);
124131
124629
  const { paths } = deps;
124132
- const route = (path54, summary) => authed.meta(openapi({ method: "POST", path: path54, summary, tags: [CONFIG_API_TAG] }));
124630
+ const route = (path56, summary) => authed.meta(openapi({ method: "POST", path: path56, summary, tags: [CONFIG_API_TAG] }));
124133
124631
  return {
124134
124632
  config: {
124135
124633
  identity: {
@@ -124484,7 +124982,7 @@ function createLifecycleApiRouter(deps) {
124484
124982
  init_cliError();
124485
124983
 
124486
124984
  // src/frontdoor/launchSchemas.ts
124487
- var import_node_path44 = __toESM(require("node:path"), 1);
124985
+ var import_node_path46 = __toESM(require("node:path"), 1);
124488
124986
  init_zod();
124489
124987
  init_claudeVersion();
124490
124988
  init_identity();
@@ -124494,7 +124992,7 @@ var LaunchResolveInputSchema = external_exports.strictObject({
124494
124992
  argv: external_exports.readonly(external_exports.array(external_exports.string())).optional(),
124495
124993
  /** The launch's inherited environment. Absent means an empty one: the door's own environment is never a substitute for the caller's, so a caller that wants `AGENT_SHIM_*` switches or a `CLAUDE_CONFIG_DIR` considered names them here. Values are read, never reported. */
124496
124994
  env: external_exports.record(external_exports.string(), external_exports.string()).optional()
124497
- }).refine((input2) => import_node_path44.default.isAbsolute(input2.path), { message: "path must be absolute: the door cannot resolve a relative path against the caller's working directory" });
124995
+ }).refine((input2) => import_node_path46.default.isAbsolute(input2.path), { message: "path must be absolute: the door cannot resolve a relative path against the caller's working directory" });
124498
124996
  var LaunchPoolDecisionSchema = external_exports.strictObject({
124499
124997
  name: external_exports.string(),
124500
124998
  reasons: external_exports.readonly(external_exports.array(external_exports.string())),
@@ -124562,6 +125060,69 @@ function createLaunchApiRouter(deps) {
124562
125060
  };
124563
125061
  }
124564
125062
 
125063
+ // src/frontdoor/agentTreesApi.ts
125064
+ init_zod();
125065
+ init_cliError();
125066
+ var AgentTreesListInputSchema = external_exports.strictObject({
125067
+ /** Only this identity's sessions. */
125068
+ identity: external_exports.string().optional(),
125069
+ /** Include sessions that spawned no agent and ran no workflow. */
125070
+ all: external_exports.boolean().optional()
125071
+ });
125072
+ var AgentTreesListOutputSchema = external_exports.array(SessionSummarySchema);
125073
+ var AgentTreesShowInputSchema = external_exports.strictObject({
125074
+ /** A session id, or an unambiguous prefix of one. */
125075
+ session: external_exports.string().min(1),
125076
+ /** Look only in this identity. */
125077
+ identity: external_exports.string().optional()
125078
+ });
125079
+ var AgentTreesShowOutputSchema = external_exports.strictObject({ identities: external_exports.array(external_exports.string()), ...SessionAgentTreeSchema.shape });
125080
+ function asBadRequest(error63) {
125081
+ if (error63 instanceof CliError) {
125082
+ throw new ORPCError("BAD_REQUEST", { message: error63.message });
125083
+ }
125084
+ throw error63;
125085
+ }
125086
+ function createAgentTreesApiRouter(deps) {
125087
+ const authed = doorApiAuth(deps.expectedToken);
125088
+ return {
125089
+ agentTrees: {
125090
+ list: authed.meta(
125091
+ openapi({
125092
+ method: "POST",
125093
+ path: "/rest/agent-trees/list",
125094
+ summary: "List the sessions that spawned agents or ran workflows, newest transcript first",
125095
+ tags: [SESSION_HISTORY_TAG],
125096
+ // A POST because the filters are a body, but the answer changes nothing.
125097
+ spec: (current) => ({ ...current, [READ_ONLY_OPERATION_EXTENSION]: true })
125098
+ })
125099
+ ).input(AgentTreesListInputSchema).output(AgentTreesListOutputSchema).handler(({ input: input2 }) => {
125100
+ try {
125101
+ return deps.sessionList(input2).map((session) => ({ ...session, identities: [...session.identities] }));
125102
+ } catch (error63) {
125103
+ return asBadRequest(error63);
125104
+ }
125105
+ }),
125106
+ show: authed.meta(
125107
+ openapi({
125108
+ method: "POST",
125109
+ path: "/rest/agent-trees/show",
125110
+ summary: "Show one session's agent tree, task list and workflow runs",
125111
+ tags: [SESSION_HISTORY_TAG],
125112
+ spec: (current) => ({ ...current, [READ_ONLY_OPERATION_EXTENSION]: true })
125113
+ })
125114
+ ).input(AgentTreesShowInputSchema).output(AgentTreesShowOutputSchema).handler(({ input: input2 }) => {
125115
+ try {
125116
+ const view = deps.sessionShow(input2.session, input2.identity);
125117
+ return { identities: [...view.identities], ...view.tree };
125118
+ } catch (error63) {
125119
+ return asBadRequest(error63);
125120
+ }
125121
+ })
125122
+ }
125123
+ };
125124
+ }
125125
+
124565
125126
  // src/frontdoor/controlApi.ts
124566
125127
  var USAGE_API_TAG = "usage";
124567
125128
  var FRONTDOOR_API_TAG2 = "frontdoor";
@@ -124630,7 +125191,7 @@ function createControlApiRouter(deps) {
124630
125191
  function createDoorApiRouter(deps) {
124631
125192
  const control = createControlApiRouter(deps);
124632
125193
  const lifecycle = createLifecycleApiRouter(deps);
124633
- return { ...createRcApiRouter(deps), ...control, ...lifecycle, ...createConfigApiRouter(deps), ...createCodexApiRouter(deps), ...createLaunchApiRouter(deps), ...createEventsApiRouter(deps), frontdoor: { ...control.frontdoor, ...lifecycle.frontdoor } };
125194
+ return { ...createRcApiRouter(deps), ...control, ...lifecycle, ...createConfigApiRouter(deps), ...createCodexApiRouter(deps), ...createLaunchApiRouter(deps), ...createAgentTreesApiRouter(deps), ...createEventsApiRouter(deps), frontdoor: { ...control.frontdoor, ...lifecycle.frontdoor } };
124634
125195
  }
124635
125196
  function createDoorApiNodeHandler(deps) {
124636
125197
  return doorApiNodeHandlerOf(createDoorApiRouter(deps), deps.expectedToken);
@@ -125780,7 +126341,7 @@ data: ${errorBody2(status, message)}
125780
126341
  var UPSTREAM_DETAIL_CHARS = 2e3;
125781
126342
  var UPSTREAM_LOG_DETAIL_CHARS = 300;
125782
126343
  var CHARS_PER_TOKEN = 4;
125783
- function parseJson3(body) {
126344
+ function parseJson4(body) {
125784
126345
  try {
125785
126346
  const value2 = JSON.parse(body);
125786
126347
  return { ok: true, value: value2 };
@@ -125925,7 +126486,7 @@ function createCodexRoute(ports) {
125925
126486
  if (!provider.ok) {
125926
126487
  return errorResponse(provider.status, provider.message);
125927
126488
  }
125928
- const json2 = parseJson3(request7.body);
126489
+ const json2 = parseJson4(request7.body);
125929
126490
  if (!json2.ok) {
125930
126491
  return errorResponse(HTTP_STATUS.badRequest, json2.message);
125931
126492
  }
@@ -125991,8 +126552,8 @@ function createCodexRouteMount(ports, upstreamBase, provider) {
125991
126552
  request7.body.resume();
125992
126553
  return;
125993
126554
  }
125994
- const path54 = new URL(request7.url, "http://127.0.0.1").pathname;
125995
- const translated = { method: request7.method, path: path54, body, signal: request7.signal };
126555
+ const path56 = new URL(request7.url, "http://127.0.0.1").pathname;
126556
+ const translated = { method: request7.method, path: path56, body, signal: request7.signal };
125996
126557
  const routed = await route(translated);
125997
126558
  if (request7.signal.aborted) {
125998
126559
  return;
@@ -126026,7 +126587,7 @@ function createPassthroughRoute(name, target) {
126026
126587
  headroomUpstream: target.headroomUpstream,
126027
126588
  serve: async (request7, response) => {
126028
126589
  const incoming = new URL(request7.url, "http://127.0.0.1");
126029
- const path54 = target.stripPrefix !== void 0 && incoming.pathname.startsWith(target.stripPrefix) ? incoming.pathname.slice(target.stripPrefix.length) : incoming.pathname;
126590
+ const path56 = target.stripPrefix !== void 0 && incoming.pathname.startsWith(target.stripPrefix) ? incoming.pathname.slice(target.stripPrefix.length) : incoming.pathname;
126030
126591
  const headers = forwardableHeaders(request7.headers);
126031
126592
  delete headers.host;
126032
126593
  await new Promise((resolve2) => {
@@ -126034,7 +126595,7 @@ function createPassthroughRoute(name, target) {
126034
126595
  host: base.hostname,
126035
126596
  port: base.port === "" ? void 0 : Number(base.port),
126036
126597
  method: request7.method,
126037
- path: `${basePath}${path54}${incoming.search}`,
126598
+ path: `${basePath}${path56}${incoming.search}`,
126038
126599
  headers,
126039
126600
  agent
126040
126601
  };
@@ -126167,7 +126728,7 @@ async function scanRequestHead(request7, wholeBody = false) {
126167
126728
 
126168
126729
  // src/frontdoor/providerRoute.ts
126169
126730
  function createProviderRouteResolver(deps) {
126170
- const isRcSelfHostPath = (path54) => path54 === "/v1/code/sessions" || path54.startsWith("/v1/code/sessions/") || path54 === "/v1/sessions" || path54.startsWith("/v1/sessions/");
126731
+ const isRcSelfHostPath = (path56) => path56 === "/v1/code/sessions" || path56.startsWith("/v1/code/sessions/") || path56 === "/v1/sessions" || path56.startsWith("/v1/sessions/");
126171
126732
  const oauthRoute = createPassthroughRoute("anthropic", { baseUrl: `https://${CONNECT_INTERCEPT_HOST}:${String(HTTPS_PORT)}`, stripPrefix: void 0, headroomUpstream: void 0 });
126172
126733
  const passthroughByTarget = /* @__PURE__ */ new Map();
126173
126734
  const passthroughFor = (name, target) => {
@@ -126181,16 +126742,16 @@ function createProviderRouteResolver(deps) {
126181
126742
  return route;
126182
126743
  };
126183
126744
  const resolve2 = (request7) => {
126184
- const path54 = new URL(request7.url, "http://127.0.0.1").pathname;
126185
- const scoped = parseProviderPath(path54);
126745
+ const path56 = new URL(request7.url, "http://127.0.0.1").pathname;
126746
+ const scoped = parseProviderPath(path56);
126186
126747
  if (scoped === void 0) {
126187
- if (deps.rcSelfHostRoute !== void 0 && isRcSelfHostPath(path54)) {
126748
+ if (deps.rcSelfHostRoute !== void 0 && isRcSelfHostPath(path56)) {
126188
126749
  return { ok: true, route: deps.rcSelfHostRoute };
126189
126750
  }
126190
- if (request7.session.provider !== void 0 && path54.startsWith("/v1/") && !isRcSelfHostPath(path54)) {
126751
+ if (request7.session.provider !== void 0 && path56.startsWith("/v1/") && !isRcSelfHostPath(path56)) {
126191
126752
  return resolve2({ ...request7, url: `${PROVIDER_PATH_PREFIX}${encodeURIComponent(request7.session.provider)}${request7.url}` });
126192
126753
  }
126193
- return path54.startsWith("/v1/") ? { ok: true, route: oauthRoute } : { ok: false, status: HTTP_STATUS.notFound, message: `no such endpoint: ${path54}` };
126754
+ return path56.startsWith("/v1/") ? { ok: true, route: oauthRoute } : { ok: false, status: HTTP_STATUS.notFound, message: `no such endpoint: ${path56}` };
126194
126755
  }
126195
126756
  const { provider } = scoped;
126196
126757
  let definition;
@@ -126243,8 +126804,8 @@ function createProviderRouteResolver(deps) {
126243
126804
  let replay;
126244
126805
  const visited = /* @__PURE__ */ new Set();
126245
126806
  for (; ; ) {
126246
- const path54 = new URL(current.url, "http://127.0.0.1").pathname;
126247
- const scoped = parseProviderPath(path54);
126807
+ const path56 = new URL(current.url, "http://127.0.0.1").pathname;
126808
+ const scoped = parseProviderPath(path56);
126248
126809
  const providerName = scoped?.provider ?? current.session.provider;
126249
126810
  if (providerName !== void 0 && visited.has(providerName)) {
126250
126811
  return { ok: false, status: HTTP_STATUS.internalServerError, message: `provider routing cycle: ${[...visited, providerName].join(" -> ")}` };
@@ -126302,7 +126863,7 @@ function createProviderRouteResolver(deps) {
126302
126863
  const headers = Object.fromEntries(Object.entries(replay.headers).filter(([name]) => name.toLowerCase() !== "content-length"));
126303
126864
  replay = { ...replay, headers, body: import_node_stream3.Readable.from([Buffer.from(rewritten, "utf8")]) };
126304
126865
  }
126305
- const rest = scoped === void 0 ? path54 : path54.slice(`${PROVIDER_PATH_PREFIX}${encodeURIComponent(scoped.provider)}`.length);
126866
+ const rest = scoped === void 0 ? path56 : path56.slice(`${PROVIDER_PATH_PREFIX}${encodeURIComponent(scoped.provider)}`.length);
126306
126867
  const query = current.url.includes("?") ? current.url.slice(current.url.indexOf("?")) : "";
126307
126868
  current = { ...current, url: `${PROVIDER_PATH_PREFIX}${encodeURIComponent(matched.provider)}${rest}${query}`, body: replay.body, headers: replay.headers };
126308
126869
  }
@@ -126409,7 +126970,7 @@ function createRcLiveUsage(deps) {
126409
126970
  }
126410
126971
 
126411
126972
  // src/frontdoor/rcSelfHostMint.ts
126412
- var import_node_path45 = __toESM(require("node:path"), 1);
126973
+ var import_node_path47 = __toESM(require("node:path"), 1);
126413
126974
  init_account();
126414
126975
 
126415
126976
  // src/frontdoor/rcSelfHostLocal.ts
@@ -126539,7 +127100,7 @@ function readJsonObject(fs22, file2) {
126539
127100
  return isRecord7(parsed) ? parsed : void 0;
126540
127101
  }
126541
127102
  function readRcSelfHostRecord(fs22, frontdoorDir) {
126542
- const parsed = readJsonObject(fs22, import_node_path45.default.join(frontdoorDir, RC_SELF_HOST_RECORD_DIR, RC_SELF_HOST_RECORD_FILE));
127103
+ const parsed = readJsonObject(fs22, import_node_path47.default.join(frontdoorDir, RC_SELF_HOST_RECORD_DIR, RC_SELF_HOST_RECORD_FILE));
126543
127104
  if (parsed === void 0) {
126544
127105
  return void 0;
126545
127106
  }
@@ -126553,11 +127114,11 @@ function mintRcSelfHostCredential(deps) {
126553
127114
  if (!isIdentityName(deps.identity)) {
126554
127115
  throw new Error(`"${deps.identity}" is not a valid identity name.`);
126555
127116
  }
126556
- const identityDir = import_node_path45.default.join(deps.identitiesDir, deps.identity);
126557
- const credentialsFile = import_node_path45.default.join(identityDir, CREDENTIALS_FILE2);
126558
- const claudeJsonFile = import_node_path45.default.join(identityDir, CLAUDE_JSON2);
126559
- const recordDir = import_node_path45.default.join(deps.frontdoorDir, RC_SELF_HOST_RECORD_DIR);
126560
- const recordFile = import_node_path45.default.join(recordDir, RC_SELF_HOST_RECORD_FILE);
127117
+ const identityDir = import_node_path47.default.join(deps.identitiesDir, deps.identity);
127118
+ const credentialsFile = import_node_path47.default.join(identityDir, CREDENTIALS_FILE2);
127119
+ const claudeJsonFile = import_node_path47.default.join(identityDir, CLAUDE_JSON2);
127120
+ const recordDir = import_node_path47.default.join(deps.frontdoorDir, RC_SELF_HOST_RECORD_DIR);
127121
+ const recordFile = import_node_path47.default.join(recordDir, RC_SELF_HOST_RECORD_FILE);
126561
127122
  const previousRecord = readRcSelfHostRecord(deps.fs, deps.frontdoorDir);
126562
127123
  const existingCredentials = readJsonObject(deps.fs, credentialsFile);
126563
127124
  const existingOauth = isRecord7(existingCredentials?.claudeAiOauth) ? existingCredentials.claudeAiOauth : void 0;
@@ -126573,7 +127134,7 @@ function mintRcSelfHostCredential(deps) {
126573
127134
  const organizationUuid = deps.newUuid();
126574
127135
  const accountUuid = deps.newUuid();
126575
127136
  const mintedAt = new Date(deps.now()).toISOString();
126576
- deps.fs.mkdirPrivate(import_node_path45.default.dirname(credentialsFile));
127137
+ deps.fs.mkdirPrivate(import_node_path47.default.dirname(credentialsFile));
126577
127138
  deps.fs.writeFilePrivate(credentialsFile, `${JSON.stringify({ ...existingCredentials, claudeAiOauth: { accessToken, refreshToken, expiresAt: null, scopes: [...RC_SELF_HOST_SCOPE_LIST], subscriptionType: SELF_HOST_SUBSCRIPTION_TYPE, rateLimitTier: null } }, null, 2)}
126578
127139
  `);
126579
127140
  const claudeJson = readJsonObject(deps.fs, claudeJsonFile) ?? {};
@@ -126960,7 +127521,7 @@ function registerRcCommand(frontdoor, paths) {
126960
127521
  }
126961
127522
 
126962
127523
  // src/frontdoor/rcCredentialStore.ts
126963
- var import_node_path46 = __toESM(require("node:path"), 1);
127524
+ var import_node_path48 = __toESM(require("node:path"), 1);
126964
127525
  function isSafeSessionId(sessionId) {
126965
127526
  return /^[A-Za-z0-9_-]+$/.test(sessionId);
126966
127527
  }
@@ -126986,7 +127547,7 @@ function sequenceNumOfJson(value2) {
126986
127547
  }
126987
127548
  function createRcCredentialStore(fs22, dir) {
126988
127549
  fs22.mkdirPrivate(dir);
126989
- const fileFor = (sessionId) => import_node_path46.default.join(dir, `${sessionId}.json`);
127550
+ const fileFor = (sessionId) => import_node_path48.default.join(dir, `${sessionId}.json`);
126990
127551
  const readParsed = (sessionId) => {
126991
127552
  const raw = fs22.readFileUtf8(fileFor(sessionId));
126992
127553
  if (raw === void 0) {
@@ -129155,8 +129716,8 @@ function createRealQuotaRefresher(params) {
129155
129716
  // src/frontdoor/commands.ts
129156
129717
  init_store2();
129157
129718
  function appendLog(paths, line) {
129158
- import_node_fs16.default.mkdirSync(paths.logsDir, { recursive: true });
129159
- import_node_fs16.default.appendFileSync(paths.frontdoorLogPath, `${(/* @__PURE__ */ new Date()).toISOString()} ${line}
129719
+ import_node_fs17.default.mkdirSync(paths.logsDir, { recursive: true });
129720
+ import_node_fs17.default.appendFileSync(paths.frontdoorLogPath, `${(/* @__PURE__ */ new Date()).toISOString()} ${line}
129160
129721
  `);
129161
129722
  }
129162
129723
  function rcObservingResolver(resolve2, tracker, hub) {
@@ -129169,7 +129730,7 @@ function rcObservingResolver(resolve2, tracker, hub) {
129169
129730
  }
129170
129731
  function realStatOwnExecutable(watchPath) {
129171
129732
  return () => {
129172
- const st2 = import_node_fs16.default.statSync(watchPath, { throwIfNoEntry: false });
129733
+ const st2 = import_node_fs17.default.statSync(watchPath, { throwIfNoEntry: false });
129173
129734
  return st2?.isFile() !== true ? void 0 : { dev: st2.dev, ino: st2.ino, size: st2.size, mtimeMs: st2.mtimeMs };
129174
129735
  };
129175
129736
  }
@@ -129350,7 +129911,7 @@ function realFrontDoorSupervisorPorts(paths) {
129350
129911
  },
129351
129912
  isRunning: realIsProcessRunning,
129352
129913
  // The turnover check's file identity, over the installed entry resolved once at door start: re-resolving per tick would re-run the PATH scan every second and could theoretically flip between two files, while the entry itself is fixed for as long as this door lives. The existence check prefers the agent-shim sibling only when it is really there (see watchedInstallEntry).
129353
- statOwnExecutable: realStatOwnExecutable(watchedInstallEntry(realOwnExecutablePath(), (candidate) => import_node_fs16.default.existsSync(candidate))),
129914
+ statOwnExecutable: realStatOwnExecutable(watchedInstallEntry(realOwnExecutablePath(), (candidate) => import_node_fs17.default.existsSync(candidate))),
129354
129915
  startProviderListener: async (preferredPort) => {
129355
129916
  const authority = loadCa();
129356
129917
  const rcDial = rcSelfHost ? lateRcEventDial(rcSelfHostDialTarget) : realRcEventDial();
@@ -129388,7 +129949,10 @@ function realFrontDoorSupervisorPorts(paths) {
129388
129949
  },
129389
129950
  poolNames: () => Object.keys(readPools(paths)).sort(),
129390
129951
  // A read-only resolution of what a launch from one directory would do: the launcher's own decision with its effects left out, so a read never recovers or resyncs a farm, starts a daemon, records a pool pick or runs a credential command.
129391
- resolveLaunch: (request7) => resolveClaudeLaunch({ argv: request7.argv, cwd: request7.path, env: request7.env, paths })
129952
+ resolveLaunch: (request7) => resolveClaudeLaunch({ argv: request7.argv, cwd: request7.path, env: request7.env, paths }),
129953
+ // The identities are read per call, like the pool table, so an identity added after the door started is listed the moment the CLI would see it.
129954
+ sessionList: (filters) => collectSessionList(realSessionFs, paths.identitiesDir, listIdentities(paths).map((entry) => entry.name), { ...filters.identity === void 0 ? {} : { identity: filters.identity }, ...filters.all === void 0 ? {} : { all: filters.all } }),
129955
+ sessionShow: (query, identity) => showSession(realSessionFs, paths.identitiesDir, listIdentities(paths).map((entry) => entry.name), query, identity)
129392
129956
  };
129393
129957
  const lifecycleAndCodexDeps = {
129394
129958
  doorPid: process.pid,
@@ -129458,7 +130022,7 @@ function realFrontDoorSupervisorPorts(paths) {
129458
130022
  const leafFor = createLeafCache(loadCa(), () => /* @__PURE__ */ new Date());
129459
130023
  const capture = captureFromEnv(process.env, paths.logsDir);
129460
130024
  if (capture !== void 0) {
129461
- log(`capture enabled, recording CONNECT targets and piped exchanges to ${import_node_path47.default.join(paths.logsDir, "frontdoor-capture.jsonl")}`);
130025
+ log(`capture enabled, recording CONNECT targets and piped exchanges to ${import_node_path49.default.join(paths.logsDir, "frontdoor-capture.jsonl")}`);
129462
130026
  }
129463
130027
  if (rcSelfHostSurface !== void 0) {
129464
130028
  log("self-hosted Remote Control surface on: the door serves the CCR session family itself, and its own client-half dials its own transparent surface");
@@ -131595,8 +132159,8 @@ function getErrorMap2() {
131595
132159
 
131596
132160
  // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v3/helpers/parseUtil.js
131597
132161
  var makeIssue = (params) => {
131598
- const { data, path: path54, errorMaps, issueData } = params;
131599
- const fullPath = [...path54, ...issueData.path || []];
132162
+ const { data, path: path56, errorMaps, issueData } = params;
132163
+ const fullPath = [...path56, ...issueData.path || []];
131600
132164
  const fullIssue = {
131601
132165
  ...issueData,
131602
132166
  path: fullPath
@@ -131711,11 +132275,11 @@ var errorUtil;
131711
132275
 
131712
132276
  // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v3/types.js
131713
132277
  var ParseInputLazyPath = class {
131714
- constructor(parent, value2, path54, key) {
132278
+ constructor(parent, value2, path56, key) {
131715
132279
  this._cachedPath = [];
131716
132280
  this.parent = parent;
131717
132281
  this.data = value2;
131718
- this._path = path54;
132282
+ this._path = path56;
131719
132283
  this._key = key;
131720
132284
  }
131721
132285
  get path() {
@@ -135278,11 +135842,11 @@ function normalizeObjectSchema(schema) {
135278
135842
  }
135279
135843
  return void 0;
135280
135844
  }
135281
- function getDotPath(path54) {
135282
- if (path54.length === 0) {
135845
+ function getDotPath(path56) {
135846
+ if (path56.length === 0) {
135283
135847
  return "object root";
135284
135848
  }
135285
- return path54.reduce((acc, seg, index) => {
135849
+ return path56.reduce((acc, seg, index) => {
135286
135850
  if (index === 0) {
135287
135851
  return String(seg);
135288
135852
  }
@@ -139324,31 +139888,33 @@ async function serveMcp(mcp, transport, options = {}) {
139324
139888
  }
139325
139889
 
139326
139890
  // src/mcp/permissions.ts
139327
- var import_node_fs17 = __toESM(require("node:fs"), 1);
139328
- var import_node_path48 = __toESM(require("node:path"), 1);
139891
+ var import_node_fs18 = __toESM(require("node:fs"), 1);
139892
+ var import_node_path50 = __toESM(require("node:path"), 1);
139329
139893
  init_zod();
139330
139894
  init_store();
139331
139895
  var StoredMcpPermissionsSchema = external_exports.strictObject({
139332
139896
  writes: external_exports.boolean(),
139333
- remoteControl: external_exports.boolean()
139897
+ remoteControl: external_exports.boolean(),
139898
+ // Absent from a file written before the grant existed, which meant not allowed.
139899
+ history: external_exports.boolean().default(false)
139334
139900
  });
139335
139901
  var OWNER_ONLY_MODE = 384;
139336
- var NONE2 = { writes: false, remoteControl: false };
139902
+ var NONE2 = { writes: false, remoteControl: false, history: false };
139337
139903
  function readStoredMcpPermissions(paths) {
139338
139904
  return readJson(paths.mcpPermissionsFile, StoredMcpPermissionsSchema) ?? NONE2;
139339
139905
  }
139340
139906
  function writeStoredMcpPermissions(paths, permissions) {
139341
- writeJsonAtomic(paths.mcpPermissionsFile, { writes: permissions.writes, remoteControl: permissions.remoteControl });
139342
- import_node_fs17.default.chmodSync(paths.mcpPermissionsFile, OWNER_ONLY_MODE);
139907
+ writeJsonAtomic(paths.mcpPermissionsFile, { writes: permissions.writes, remoteControl: permissions.remoteControl, history: permissions.history });
139908
+ import_node_fs18.default.chmodSync(paths.mcpPermissionsFile, OWNER_ONLY_MODE);
139343
139909
  }
139344
139910
  function effectiveMcpPermissions(flags, stored) {
139345
- return { writes: flags.writes || stored.writes, remoteControl: flags.remoteControl || stored.remoteControl };
139911
+ return { writes: flags.writes || stored.writes, remoteControl: flags.remoteControl || stored.remoteControl, history: flags.history || stored.history };
139346
139912
  }
139347
139913
  function watchMcpPermissions(paths, onChange) {
139348
- const directory = import_node_path48.default.dirname(paths.mcpPermissionsFile);
139349
- import_node_fs17.default.mkdirSync(directory, { recursive: true });
139350
- const watcher = import_node_fs17.default.watch(directory, (_event, filename) => {
139351
- if (filename === null || filename === import_node_path48.default.basename(paths.mcpPermissionsFile)) {
139914
+ const directory = import_node_path50.default.dirname(paths.mcpPermissionsFile);
139915
+ import_node_fs18.default.mkdirSync(directory, { recursive: true });
139916
+ const watcher = import_node_fs18.default.watch(directory, (_event, filename) => {
139917
+ if (filename === null || filename === import_node_path50.default.basename(paths.mcpPermissionsFile)) {
139352
139918
  onChange();
139353
139919
  }
139354
139920
  });
@@ -139395,6 +139961,9 @@ function isStream(operation) {
139395
139961
  return Object.values(operation.responses ?? {}).some((response) => response.content !== void 0 && "text/event-stream" in response.content);
139396
139962
  }
139397
139963
  function permitted(tag, readOnly, permissions) {
139964
+ if (tag === SESSION_HISTORY_TAG) {
139965
+ return permissions.history;
139966
+ }
139398
139967
  if (readOnly) {
139399
139968
  return true;
139400
139969
  }
@@ -139456,16 +140025,16 @@ function doorMcpPorts(paths, permissions) {
139456
140025
  }
139457
140026
  };
139458
140027
  }
139459
- var PERMISSION_FIELDS = { writes: "writes", "remote-control": "remoteControl" };
140028
+ var PERMISSION_FIELDS = { writes: "writes", "remote-control": "remoteControl", history: "history" };
139460
140029
  function permissionName(value2) {
139461
- if (value2 !== "writes" && value2 !== "remote-control") {
139462
- throw new UsageError(`unknown permission "${value2}": expected writes or remote-control`);
140030
+ if (value2 !== "writes" && value2 !== "remote-control" && value2 !== "history") {
140031
+ throw new UsageError(`unknown permission "${value2}": expected writes, remote-control or history`);
139463
140032
  }
139464
140033
  return value2;
139465
140034
  }
139466
140035
  function registerMcpCommand(program2, deps) {
139467
- const mcp = program2.command("mcp").description("Serve the front door's typed API as MCP tools on standard input and output, so an agent can read quota and door state and, when allowed, act on it.").option("--allow-writes", "Also expose the operations that change the door's configuration and lifecycle, whatever `mcp permissions` says. Read-only without it or a stored permission.").option("--allow-remote-control", "Also expose the Remote Control operations that send into, answer for and end other sessions, whatever `mcp permissions` says.").action(async (options) => {
139468
- const flags = { writes: options.allowWrites === true, remoteControl: options.allowRemoteControl === true };
140036
+ const mcp = program2.command("mcp").description("Serve the front door's typed API as MCP tools on standard input and output, so an agent can read quota and door state and, when allowed, act on it.").option("--allow-writes", "Also expose the operations that change the door's configuration and lifecycle, whatever `mcp permissions` says. Read-only without it or a stored permission.").option("--allow-remote-control", "Also expose the Remote Control operations that send into, answer for and end other sessions, whatever `mcp permissions` says.").option("--allow-history", "Also expose the reads of session history (agents, tasks and workflow runs across every identity), whatever `mcp permissions` says.").action(async (options) => {
140037
+ const flags = { writes: options.allowWrites === true, remoteControl: options.allowRemoteControl === true, history: options.allowHistory === true };
139469
140038
  const inForce = () => effectiveMcpPermissions(flags, readStoredMcpPermissions(deps.paths));
139470
140039
  const server = createMcpServer({ name: "agent-shim", version: package_default.version }, doorMcpPorts(deps.paths, inForce));
139471
140040
  await serveMcp(server, new StdioServerTransport(), {
@@ -139489,12 +140058,13 @@ function registerMcpCommand(program2, deps) {
139489
140058
  }
139490
140059
  console.log(`writes: ${stored.writes ? "allowed" : "not allowed"}`);
139491
140060
  console.log(`remote-control: ${stored.remoteControl ? "allowed" : "not allowed"}`);
140061
+ console.log(`history: ${stored.history ? "allowed" : "not allowed"}`);
139492
140062
  }),
139493
140063
  ["agent-shim mcp permissions show"]
139494
140064
  );
139495
140065
  for (const [verb, granted] of [["allow", true], ["deny", false]]) {
139496
140066
  withExamples(
139497
- permissions.command(`${verb} <permission>`).description(`${verb === "allow" ? "Allow" : "Stop allowing"} \`writes\` (configuration and lifecycle operations) or \`remote-control\` (operations on other sessions) for the MCP server's agents.`).action((permission) => {
140067
+ permissions.command(`${verb} <permission>`).description(`${verb === "allow" ? "Allow" : "Stop allowing"} \`writes\` (configuration and lifecycle operations), \`remote-control\` (operations on other sessions) or \`history\` (reads of session history across identities) for the MCP server's agents.`).action((permission) => {
139498
140068
  const field = PERMISSION_FIELDS[permissionName(permission)];
139499
140069
  writeStoredMcpPermissions(deps.paths, { ...readStoredMcpPermissions(deps.paths), [field]: granted });
139500
140070
  console.log(`${permission}: ${granted ? "allowed" : "not allowed"}`);
@@ -139656,17 +140226,17 @@ init_credential();
139656
140226
  init_credentialCache();
139657
140227
 
139658
140228
  // src/identityToken.ts
139659
- var import_node_fs18 = __toESM(require("node:fs"), 1);
139660
- var import_node_path49 = __toESM(require("node:path"), 1);
140229
+ var import_node_fs19 = __toESM(require("node:fs"), 1);
140230
+ var import_node_path51 = __toESM(require("node:path"), 1);
139661
140231
  init_cliError();
139662
140232
  var TOKEN_FILE_MODE = 384;
139663
140233
  var TOKEN_DIR_MODE = 448;
139664
140234
  var OAUTH_TOKEN_RE = /^sk-ant-oat\d+-[A-Za-z0-9_-]+$/;
139665
140235
  function identityTokenDir(paths) {
139666
- return import_node_path49.default.join(paths.root, "credentials");
140236
+ return import_node_path51.default.join(paths.root, "credentials");
139667
140237
  }
139668
140238
  function identityTokenPath(paths, identityName) {
139669
- return import_node_path49.default.join(identityTokenDir(paths), `${identityName}.token`);
140239
+ return import_node_path51.default.join(identityTokenDir(paths), `${identityName}.token`);
139670
140240
  }
139671
140241
  function storeIdentityToken(paths, identityName, raw) {
139672
140242
  const token = raw.trim();
@@ -139674,13 +140244,13 @@ function storeIdentityToken(paths, identityName, raw) {
139674
140244
  throw new UsageError("That is not a claude setup-token token (expected it to start with sk-ant-oat). Run `claude setup-token` and pass its token on standard input.");
139675
140245
  }
139676
140246
  const dir = identityTokenDir(paths);
139677
- import_node_fs18.default.mkdirSync(dir, { recursive: true, mode: TOKEN_DIR_MODE });
139678
- import_node_fs18.default.chmodSync(dir, TOKEN_DIR_MODE);
140247
+ import_node_fs19.default.mkdirSync(dir, { recursive: true, mode: TOKEN_DIR_MODE });
140248
+ import_node_fs19.default.chmodSync(dir, TOKEN_DIR_MODE);
139679
140249
  const target = identityTokenPath(paths, identityName);
139680
- const temp = import_node_path49.default.join(dir, `.${identityName}.${String(process.pid)}.tmp`);
139681
- import_node_fs18.default.writeFileSync(temp, `${token}
140250
+ const temp = import_node_path51.default.join(dir, `.${identityName}.${String(process.pid)}.tmp`);
140251
+ import_node_fs19.default.writeFileSync(temp, `${token}
139682
140252
  `, { mode: TOKEN_FILE_MODE });
139683
- import_node_fs18.default.renameSync(temp, target);
140253
+ import_node_fs19.default.renameSync(temp, target);
139684
140254
  return target;
139685
140255
  }
139686
140256
 
@@ -139843,9 +140413,9 @@ function registerDoctorCommand(program2, deps) {
139843
140413
  }
139844
140414
 
139845
140415
  // src/headroom/commands.ts
139846
- var import_node_fs19 = __toESM(require("node:fs"), 1);
140416
+ var import_node_fs20 = __toESM(require("node:fs"), 1);
139847
140417
  var import_node_http4 = __toESM(require("node:http"), 1);
139848
- var import_node_path50 = __toESM(require("node:path"), 1);
140418
+ var import_node_path52 = __toESM(require("node:path"), 1);
139849
140419
  var import_node_child_process6 = require("node:child_process");
139850
140420
  init_commandDeps();
139851
140421
  init_realFrontDoorPort();
@@ -139975,12 +140545,12 @@ function readInstalledHeadroomCommit() {
139975
140545
  if (toolDir.status !== 0) {
139976
140546
  return void 0;
139977
140547
  }
139978
- const libDir = import_node_path50.default.join(toolDir.stdout.trim(), HEADROOM_TOOL_NAME, "lib");
140548
+ const libDir = import_node_path52.default.join(toolDir.stdout.trim(), HEADROOM_TOOL_NAME, "lib");
139979
140549
  for (const python of realFarmFs.readdir(libDir)) {
139980
- const sitePackages = import_node_path50.default.join(libDir, python, "site-packages");
140550
+ const sitePackages = import_node_path52.default.join(libDir, python, "site-packages");
139981
140551
  for (const entry of realFarmFs.readdir(sitePackages)) {
139982
140552
  if (entry.startsWith("headroom_ai-") && entry.endsWith(".dist-info")) {
139983
- const directUrl = realFarmFs.readFileUtf8(import_node_path50.default.join(sitePackages, entry, "direct_url.json"));
140553
+ const directUrl = realFarmFs.readFileUtf8(import_node_path52.default.join(sitePackages, entry, "direct_url.json"));
139984
140554
  return directUrl === void 0 ? void 0 : parseInstalledCommit(directUrl);
139985
140555
  }
139986
140556
  }
@@ -140004,12 +140574,12 @@ function realSupervisorPorts(paths) {
140004
140574
  readConfig: () => resolveSupervisorConfig(readGlobalConfig(paths)?.headroom ?? {}),
140005
140575
  spawnHeadroom: (socketPath, allowlist, settings2) => {
140006
140576
  const trust = resolveHeadroomTrustBundle({ caCertFile: paths.frontdoorCaCertFile, bundlesDir: paths.frontdoorCaBundlesDir, inherited: process.env[HEADROOM_CA_BUNDLE], fs: realTrustBundleFs });
140007
- import_node_fs19.default.mkdirSync(paths.logsDir, { recursive: true });
140577
+ import_node_fs20.default.mkdirSync(paths.logsDir, { recursive: true });
140008
140578
  if (trust?.warning !== void 0) {
140009
- import_node_fs19.default.appendFileSync(paths.headroomLogPath, `${(/* @__PURE__ */ new Date()).toISOString()} ${trust.warning}
140579
+ import_node_fs20.default.appendFileSync(paths.headroomLogPath, `${(/* @__PURE__ */ new Date()).toISOString()} ${trust.warning}
140010
140580
  `);
140011
140581
  }
140012
- const logFd = import_node_fs19.default.openSync(paths.headroomLogPath, "a");
140582
+ const logFd = import_node_fs20.default.openSync(paths.headroomLogPath, "a");
140013
140583
  try {
140014
140584
  const child = (0, import_node_child_process6.spawn)("headroom", headroomProxyArgs(socketPath, settings2), {
140015
140585
  detached: true,
@@ -140024,12 +140594,12 @@ function realSupervisorPorts(paths) {
140024
140594
  child.once("exit", (code, signal) => {
140025
140595
  ownedHeadroom.delete(pid);
140026
140596
  exitedHeadroom.add(pid);
140027
- import_node_fs19.default.appendFileSync(paths.headroomLogPath, `${(/* @__PURE__ */ new Date()).toISOString()} agent-shim headroom supervisor: headroom exited (${signal ?? `code ${String(code)}`})
140597
+ import_node_fs20.default.appendFileSync(paths.headroomLogPath, `${(/* @__PURE__ */ new Date()).toISOString()} agent-shim headroom supervisor: headroom exited (${signal ?? `code ${String(code)}`})
140028
140598
  `);
140029
140599
  });
140030
140600
  return pid;
140031
140601
  } finally {
140032
- import_node_fs19.default.closeSync(logFd);
140602
+ import_node_fs20.default.closeSync(logFd);
140033
140603
  }
140034
140604
  },
140035
140605
  stopProcess: (pid) => {
@@ -140042,7 +140612,7 @@ function realSupervisorPorts(paths) {
140042
140612
  now: () => Date.now()
140043
140613
  });
140044
140614
  if (outcome === "still-running") {
140045
- import_node_fs19.default.appendFileSync(
140615
+ import_node_fs20.default.appendFileSync(
140046
140616
  paths.headroomLogPath,
140047
140617
  `${(/* @__PURE__ */ new Date()).toISOString()} agent-shim headroom supervisor: pid ${String(pid)} survived SIGKILL within its grace; it is stuck uninterruptibly
140048
140618
  `
@@ -140056,10 +140626,10 @@ function realSupervisorPorts(paths) {
140056
140626
  return { ok: false, error: `uv is not installed or not on PATH (${result.error.message})` };
140057
140627
  }
140058
140628
  if (result.stdout !== "") {
140059
- import_node_fs19.default.appendFileSync(paths.headroomLogPath, result.stdout);
140629
+ import_node_fs20.default.appendFileSync(paths.headroomLogPath, result.stdout);
140060
140630
  }
140061
140631
  if (result.stderr !== "") {
140062
- import_node_fs19.default.appendFileSync(paths.headroomLogPath, result.stderr);
140632
+ import_node_fs20.default.appendFileSync(paths.headroomLogPath, result.stderr);
140063
140633
  }
140064
140634
  return result.status === 0 ? { ok: true } : { ok: false, error: `uv tool install exited ${String(result.status)}` };
140065
140635
  },
@@ -140069,8 +140639,8 @@ function realSupervisorPorts(paths) {
140069
140639
  },
140070
140640
  installedCommit: readInstalledHeadroomCommit,
140071
140641
  log: (line) => {
140072
- import_node_fs19.default.mkdirSync(paths.logsDir, { recursive: true });
140073
- import_node_fs19.default.appendFileSync(paths.headroomLogPath, `${(/* @__PURE__ */ new Date()).toISOString()} ${line}
140642
+ import_node_fs20.default.mkdirSync(paths.logsDir, { recursive: true });
140643
+ import_node_fs20.default.appendFileSync(paths.headroomLogPath, `${(/* @__PURE__ */ new Date()).toISOString()} ${line}
140074
140644
  `);
140075
140645
  }
140076
140646
  };
@@ -140116,7 +140686,7 @@ function registerHeadroomCommand(program2, deps) {
140116
140686
  }
140117
140687
 
140118
140688
  // src/jobs.ts
140119
- var import_node_path51 = __toESM(require("node:path"), 1);
140689
+ var import_node_path53 = __toESM(require("node:path"), 1);
140120
140690
  init_commandDeps();
140121
140691
  init_cliError();
140122
140692
  init_schema();
@@ -140141,7 +140711,7 @@ function jobOf(options) {
140141
140711
  target: options.identity === void 0 ? { pool: options.pool ?? "" } : { identity: options.identity },
140142
140712
  trigger: options.at === void 0 ? { beforeReset: options.beforeReset ?? "fiveHour", lead: options.lead ?? "" } : { at: options.at },
140143
140713
  prompt: options.prompt,
140144
- cwd: import_node_path51.default.resolve(options.cwd ?? process.cwd()),
140714
+ cwd: import_node_path53.default.resolve(options.cwd ?? process.cwd()),
140145
140715
  timeout: options.timeout,
140146
140716
  ...options.model === void 0 ? {} : { model: options.model },
140147
140717
  ...options.allowedTool === void 0 ? {} : { allowedTools: options.allowedTool }
@@ -140214,7 +140784,7 @@ function registerJobCommand(program2, deps) {
140214
140784
  console.log(`Allowed tools: ${entry.allowedTools.join(", ")}`);
140215
140785
  }
140216
140786
  console.log(`Prompt: ${entry.prompt}`);
140217
- console.log(`Results: ${import_node_path51.default.join(paths.jobLogsDir, `${name}.log`)}`);
140787
+ console.log(`Results: ${import_node_path53.default.join(paths.jobLogsDir, `${name}.log`)}`);
140218
140788
  }),
140219
140789
  ["agent-shim job show digest"]
140220
140790
  );
@@ -140237,7 +140807,7 @@ function registerJobCommand(program2, deps) {
140237
140807
  throw new UsageError(`No member of the job's pool can be picked right now.`);
140238
140808
  }
140239
140809
  await createRealJobRunner({ paths, spawnDaemon: spawnDetachedSupervisor, fs: realFarmFs, now: () => /* @__PURE__ */ new Date() })(name, identity, entry);
140240
- console.log(`Ran job "${name}" as ${identity}; the result is in ${import_node_path51.default.join(paths.jobLogsDir, `${name}.log`)}.`);
140810
+ console.log(`Ran job "${name}" as ${identity}; the result is in ${import_node_path53.default.join(paths.jobLogsDir, `${name}.log`)}.`);
140241
140811
  }),
140242
140812
  ["agent-shim job run digest"]
140243
140813
  );
@@ -140647,8 +141217,83 @@ function registerRunCommand(program2, handler) {
140647
141217
  });
140648
141218
  }
140649
141219
 
141220
+ // src/agents/commands.ts
141221
+ init_commandDeps();
141222
+ function identityColumn(identities) {
141223
+ const [first, ...rest] = identities;
141224
+ return rest.length === 0 ? first ?? "-" : `${first ?? "-"} +${String(rest.length)}`;
141225
+ }
141226
+ function formatSessionList(sessions) {
141227
+ if (sessions.length === 0) {
141228
+ return ["no sessions with agents or workflow runs found"];
141229
+ }
141230
+ return sessions.map((session) => {
141231
+ const when = session.updatedAt ?? "-";
141232
+ const state = session.superseded ? " superseded" : "";
141233
+ return `${identityColumn(session.identities)} ${session.sessionId} ${when} agents=${String(session.agentCount)} runs=${String(session.workflowRunCount)}${state} ${session.project}`;
141234
+ });
141235
+ }
141236
+ function formatNode(node2, depth) {
141237
+ const indent = " ".repeat(depth);
141238
+ const label = node2.description ?? node2.name ?? "";
141239
+ const extras = [node2.background === true ? "background" : void 0, node2.workflowRunId, node2.workflowPhase, node2.teamName, node2.stoppedByUser === true ? "stopped" : void 0].filter((value2) => value2 !== void 0);
141240
+ const line = `${indent}- [${node2.kind}] ${node2.agentType} ${node2.id}${label === "" ? "" : ` ${label}`}${extras.length === 0 ? "" : ` (${extras.join(", ")})`}`;
141241
+ return [line, ...node2.children.flatMap((child) => formatNode(child, depth + 1))];
141242
+ }
141243
+ function formatSessionTree(identities, tree) {
141244
+ const lines = [`session ${tree.sessionId}${tree.superseded ? " (superseded)" : ""} identities ${identities.join(",")} project ${tree.project}`];
141245
+ lines.push(tree.agents.length === 0 ? "agents: none" : "agents:", ...tree.agents.flatMap((node2) => formatNode(node2, 1)));
141246
+ if (tree.workflowRuns.length > 0) {
141247
+ lines.push("workflow runs:", ...tree.workflowRuns.map((run) => ` ${run.runId} ${run.workflowName ?? "-"} ${run.status ?? "-"} phases: ${run.phases.join(" > ") || "-"}`));
141248
+ }
141249
+ if (tree.tasks.length > 0) {
141250
+ lines.push("tasks:", ...tree.tasks.map((task) => ` [${task.status}] ${task.id} ${task.subject}`));
141251
+ }
141252
+ if (tree.problems.length > 0) {
141253
+ lines.push("problems:", ...tree.problems.map((problem) => ` ${problem.path}: ${problem.reason}`));
141254
+ }
141255
+ return lines;
141256
+ }
141257
+ function registerSessionCommands(program2, deps) {
141258
+ const { paths } = deps;
141259
+ const identityNames = () => listIdentities(paths).map((entry) => entry.name);
141260
+ const session = withExamples(program2.command("session").description("Inspect a session's agents: its subagents, forks, workflow agents, task list and workflow runs, read from the transcripts on disk."), [
141261
+ "agent-shim session list",
141262
+ "agent-shim session show 3164d246"
141263
+ ]);
141264
+ withExamples(
141265
+ session.command("list").description("List sessions that spawned agents or ran workflows, newest transcript first, with their agent and workflow-run counts. Read-only.").option("--identity <name>", "Only this identity's sessions.").option("--all", "Include sessions that spawned no agent and ran no workflow.").option("--json", "Print the sessions as JSON.").action((options) => {
141266
+ const sessions = collectSessionList(realSessionFs, paths.identitiesDir, identityNames(), {
141267
+ ...options.identity === void 0 ? {} : { identity: options.identity },
141268
+ ...options.all === void 0 ? {} : { all: options.all }
141269
+ });
141270
+ if (options.json === true) {
141271
+ printJson(sessions);
141272
+ return;
141273
+ }
141274
+ for (const line of formatSessionList(sessions)) {
141275
+ console.log(line);
141276
+ }
141277
+ }),
141278
+ ["agent-shim session list", "agent-shim session list --identity work --json"]
141279
+ );
141280
+ withExamples(
141281
+ session.command("show <session>").description("Show one session's agent tree, task list and workflow runs. Takes the session id or an unambiguous prefix of it. Read-only.").option("--identity <name>", "Look only in this identity.").option("--json", "Print the tree as JSON.").action((query, options) => {
141282
+ const view = showSession(realSessionFs, paths.identitiesDir, identityNames(), query, options.identity);
141283
+ if (options.json === true) {
141284
+ printJson({ identities: view.identities, ...view.tree });
141285
+ return;
141286
+ }
141287
+ for (const line of formatSessionTree(view.identities, view.tree)) {
141288
+ console.log(line);
141289
+ }
141290
+ }),
141291
+ ["agent-shim session show 3164d246", "agent-shim session show 3164d246 --identity work --json"]
141292
+ );
141293
+ }
141294
+
140650
141295
  // src/usage/commands.ts
140651
- var import_node_path52 = __toESM(require("node:path"), 1);
141296
+ var import_node_path54 = __toESM(require("node:path"), 1);
140652
141297
  init_commandDeps();
140653
141298
  init_realPorts();
140654
141299
  init_account();
@@ -140786,7 +141431,7 @@ function collectAccounts(fs22, paths, identity, probe) {
140786
141431
  return names.map((name) => ({
140787
141432
  identity: name,
140788
141433
  account: readAccountMetadata(fs22, paths.identitiesDir, name),
140789
- signIn: identitySignIn(fs22, probe, { farmRoot: import_node_path52.default.join(paths.identitiesDir, name), hasCredentialBlock: readIdentity(paths, name)?.credential !== void 0 }),
141434
+ signIn: identitySignIn(fs22, probe, { farmRoot: import_node_path54.default.join(paths.identitiesDir, name), hasCredentialBlock: readIdentity(paths, name)?.credential !== void 0 }),
140790
141435
  usage: readUsageSnapshot(fs22, paths.usageSnapshotsDir, name)
140791
141436
  }));
140792
141437
  }
@@ -140970,6 +141615,7 @@ function buildProgram(deps) {
140970
141615
  registerFrontDoorCommand(program2, deps);
140971
141616
  registerMcpCommand(program2, deps);
140972
141617
  registerUsageCommands(program2, deps);
141618
+ registerSessionCommands(program2, deps);
140973
141619
  registerRunCommand(program2, deps.runClaude);
140974
141620
  registerUpdateCommand(program2, deps, deps.updatePorts);
140975
141621
  registerCompletionCommand(program2);
@@ -141132,7 +141778,7 @@ async function runClaude(argvOverride) {
141132
141778
  // src/cli.ts
141133
141779
  async function main() {
141134
141780
  aliasLegacyEnv(process.env);
141135
- const invokedName = import_node_path53.default.basename(process.argv[1] ?? "agent-shim");
141781
+ const invokedName = import_node_path55.default.basename(process.argv[1] ?? "agent-shim");
141136
141782
  if (isInvokedAsClaude(invokedName)) {
141137
141783
  await runClaude();
141138
141784
  return;