claude-use 11.2.0 → 11.3.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, path57) {
322
- if (!path57)
321
+ function getElementAtPath(obj, path59) {
322
+ if (!path59)
323
323
  return obj;
324
- return path57.reduce((acc, key) => acc?.[key], obj);
324
+ return path59.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(path57, issues) {
583
+ function prefixIssues(path59, issues) {
584
584
  return issues.map((iss) => {
585
585
  var _a4;
586
586
  (_a4 = iss).path ?? (_a4.path = []);
587
- iss.path.unshift(path57);
587
+ iss.path.unshift(path59);
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, path57 = []) => {
1108
+ const processError = (error64, path59 = []) => {
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 }, [...path57, ...issue2.path]));
1111
+ issue2.errors.map((issues) => processError({ issues }, [...path59, ...issue2.path]));
1112
1112
  } else if (issue2.code === "invalid_key") {
1113
- processError({ issues: issue2.issues }, [...path57, ...issue2.path]);
1113
+ processError({ issues: issue2.issues }, [...path59, ...issue2.path]);
1114
1114
  } else if (issue2.code === "invalid_element") {
1115
- processError({ issues: issue2.issues }, [...path57, ...issue2.path]);
1115
+ processError({ issues: issue2.issues }, [...path59, ...issue2.path]);
1116
1116
  } else {
1117
- const fullpath = [...path57, ...issue2.path];
1117
+ const fullpath = [...path59, ...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, path57 = []) => {
1156
+ const processError = (error64, path59 = []) => {
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 }, [...path57, ...issue2.path]));
1160
+ issue2.errors.map((issues) => processError({ issues }, [...path59, ...issue2.path]));
1161
1161
  } else if (issue2.code === "invalid_key") {
1162
- processError({ issues: issue2.issues }, [...path57, ...issue2.path]);
1162
+ processError({ issues: issue2.issues }, [...path59, ...issue2.path]);
1163
1163
  } else if (issue2.code === "invalid_element") {
1164
- processError({ issues: issue2.issues }, [...path57, ...issue2.path]);
1164
+ processError({ issues: issue2.issues }, [...path59, ...issue2.path]);
1165
1165
  } else {
1166
- const fullpath = [...path57, ...issue2.path];
1166
+ const fullpath = [...path59, ...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 path57 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1206
- for (const seg of path57) {
1205
+ const path59 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1206
+ for (const seg of path59) {
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 path57 = ref.slice(1).split("/").filter(Boolean);
19203
- if (path57.length === 0) {
19202
+ const path59 = ref.slice(1).split("/").filter(Boolean);
19203
+ if (path59.length === 0) {
19204
19204
  return ctx.rootSchema;
19205
19205
  }
19206
19206
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
19207
- if (path57[0] === defsKey) {
19208
- const key = path57[1] === void 0 ? void 0 : decodeJSONPointerSegment(path57[1]);
19207
+ if (path59[0] === defsKey) {
19208
+ const key = path59[1] === void 0 ? void 0 : decodeJSONPointerSegment(path59[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 path57 = require("path");
23715
+ var path59 = 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 = path57.join(homedir, "Library");
23721
+ const library = path59.join(homedir, "Library");
23722
23722
  return {
23723
- data: path57.join(library, "Application Support", name),
23724
- config: path57.join(library, "Preferences", name),
23725
- cache: path57.join(library, "Caches", name),
23726
- log: path57.join(library, "Logs", name),
23727
- temp: path57.join(tmpdir, name)
23723
+ data: path59.join(library, "Application Support", name),
23724
+ config: path59.join(library, "Preferences", name),
23725
+ cache: path59.join(library, "Caches", name),
23726
+ log: path59.join(library, "Logs", name),
23727
+ temp: path59.join(tmpdir, name)
23728
23728
  };
23729
23729
  };
23730
23730
  var windows = (name) => {
23731
- const appData = env.APPDATA || path57.join(homedir, "AppData", "Roaming");
23732
- const localAppData = env.LOCALAPPDATA || path57.join(homedir, "AppData", "Local");
23731
+ const appData = env.APPDATA || path59.join(homedir, "AppData", "Roaming");
23732
+ const localAppData = env.LOCALAPPDATA || path59.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: path57.join(localAppData, name, "Data"),
23736
- config: path57.join(appData, name, "Config"),
23737
- cache: path57.join(localAppData, name, "Cache"),
23738
- log: path57.join(localAppData, name, "Log"),
23739
- temp: path57.join(tmpdir, name)
23735
+ data: path59.join(localAppData, name, "Data"),
23736
+ config: path59.join(appData, name, "Config"),
23737
+ cache: path59.join(localAppData, name, "Cache"),
23738
+ log: path59.join(localAppData, name, "Log"),
23739
+ temp: path59.join(tmpdir, name)
23740
23740
  };
23741
23741
  };
23742
23742
  var linux = (name) => {
23743
- const username = path57.basename(homedir);
23743
+ const username = path59.basename(homedir);
23744
23744
  return {
23745
- data: path57.join(env.XDG_DATA_HOME || path57.join(homedir, ".local", "share"), name),
23746
- config: path57.join(env.XDG_CONFIG_HOME || path57.join(homedir, ".config"), name),
23747
- cache: path57.join(env.XDG_CACHE_HOME || path57.join(homedir, ".cache"), name),
23745
+ data: path59.join(env.XDG_DATA_HOME || path59.join(homedir, ".local", "share"), name),
23746
+ config: path59.join(env.XDG_CONFIG_HOME || path59.join(homedir, ".config"), name),
23747
+ cache: path59.join(env.XDG_CACHE_HOME || path59.join(homedir, ".cache"), name),
23748
23748
  // https://wiki.debian.org/XDGBaseDirectorySpecification#state
23749
- log: path57.join(env.XDG_STATE_HOME || path57.join(homedir, ".local", "state"), name),
23750
- temp: path57.join(tmpdir, username, name)
23749
+ log: path59.join(env.XDG_STATE_HOME || path59.join(homedir, ".local", "state"), name),
23750
+ temp: path59.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, path57) {
23819
- if (typeof path57 === "string" && Object.prototype.hasOwnProperty.call(source, path57)) {
23820
- return source[path57];
23818
+ function getPropertyByPath(source, path59) {
23819
+ if (typeof path59 === "string" && Object.prototype.hasOwnProperty.call(source, path59)) {
23820
+ return source[path59];
23821
23821
  }
23822
- const parsedPath = typeof path57 === "string" ? path57.split(".") : path57;
23822
+ const parsedPath = typeof path59 === "string" ? path59.split(".") : path59;
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(path57) {
23845
+ async function isDirectory(path59) {
23846
23846
  try {
23847
- const stat = await fs_1.promises.stat(path57);
23847
+ const stat = await fs_1.promises.stat(path59);
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(path57) {
23857
+ function isDirectorySync(path59) {
23858
23858
  try {
23859
- const stat = fs_1.default.statSync(path57);
23859
+ const stat = fs_1.default.statSync(path59);
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((path57, i10) => `${i10 + 1}. ${path57}`).join("\n")} (same as ${idx + 1}.)`);
23957
+ ${[...importStack, fullPath].map((path59, i10) => `${i10 + 1}. ${path59}`).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(path57) {
24145
+ async #fileExists(path59) {
24146
24146
  try {
24147
- await promises_1.default.stat(path57);
24147
+ await promises_1.default.stat(path59);
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(path57) {
24307
+ #fileExists(path59) {
24308
24308
  try {
24309
- fs_1.default.statSync(path57);
24309
+ fs_1.default.statSync(path59);
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((path57) => path57.replace("{name}", moduleName));
24433
+ const userConfiguredSearchPlaces = userConfiguredOptions.searchPlaces?.map((path59) => path59.replace("{name}", moduleName));
24434
24434
  if (userConfiguredOptions.mergeSearchPlaces) {
24435
24435
  return [...userConfiguredSearchPlaces ?? [], ...toolDefinedSearchPlaces];
24436
24436
  }
@@ -27172,10 +27172,10 @@ var init_schema = __esm({
27172
27172
  });
27173
27173
 
27174
27174
  // src/frontdoor/state.ts
27175
- function readFrontDoorState(fs22, stateFile) {
27175
+ function readFrontDoorState(fs23, stateFile) {
27176
27176
  let raw;
27177
27177
  try {
27178
- raw = fs22.readFileUtf8(stateFile);
27178
+ raw = fs23.readFileUtf8(stateFile);
27179
27179
  } catch {
27180
27180
  return void 0;
27181
27181
  }
@@ -27189,9 +27189,9 @@ function readFrontDoorState(fs22, stateFile) {
27189
27189
  return void 0;
27190
27190
  }
27191
27191
  }
27192
- function writeFrontDoorState(fs22, stateFile, state) {
27193
- fs22.mkdirp(import_node_path5.default.dirname(stateFile));
27194
- fs22.writeFilePrivate(stateFile, `${JSON.stringify(state, null, 2)}
27192
+ function writeFrontDoorState(fs23, stateFile, state) {
27193
+ fs23.mkdirp(import_node_path5.default.dirname(stateFile));
27194
+ fs23.writeFilePrivate(stateFile, `${JSON.stringify(state, null, 2)}
27195
27195
  `);
27196
27196
  }
27197
27197
  function directOrigin(port) {
@@ -27201,27 +27201,27 @@ function frontDoorOrigin(state) {
27201
27201
  const port = state?.directPort ?? state?.lastDirectPort;
27202
27202
  return port === void 0 ? void 0 : directOrigin(port);
27203
27203
  }
27204
- function writeFrontDoorDirectRecord(fs22, recordsDir, record2) {
27205
- fs22.mkdirp(recordsDir);
27206
- fs22.writeFilePrivate(import_node_path5.default.join(recordsDir, `${String(record2.pid)}.json`), `${JSON.stringify({ directPort: record2.directPort })}
27204
+ function writeFrontDoorDirectRecord(fs23, recordsDir, record2) {
27205
+ fs23.mkdirp(recordsDir);
27206
+ fs23.writeFilePrivate(import_node_path5.default.join(recordsDir, `${String(record2.pid)}.json`), `${JSON.stringify({ directPort: record2.directPort })}
27207
27207
  `);
27208
27208
  }
27209
- function removeFrontDoorDirectRecord(fs22, recordsDir, pid) {
27210
- fs22.removeRecursive(import_node_path5.default.join(recordsDir, `${String(pid)}.json`));
27209
+ function removeFrontDoorDirectRecord(fs23, recordsDir, pid) {
27210
+ fs23.removeRecursive(import_node_path5.default.join(recordsDir, `${String(pid)}.json`));
27211
27211
  }
27212
27212
  function recordPid(file2) {
27213
27213
  const pidText = /^([1-9]\d*)\.json$/.exec(file2)?.[1];
27214
27214
  const pid = pidText === void 0 ? void 0 : Number(pidText);
27215
27215
  return pid !== void 0 && Number.isSafeInteger(pid) ? pid : void 0;
27216
27216
  }
27217
- function readDirectRecordEntry(fs22, recordsDir, file2) {
27217
+ function readDirectRecordEntry(fs23, recordsDir, file2) {
27218
27218
  const pid = recordPid(file2);
27219
27219
  if (pid === void 0) {
27220
27220
  return void 0;
27221
27221
  }
27222
27222
  let raw;
27223
27223
  try {
27224
- raw = fs22.readFileUtf8(import_node_path5.default.join(recordsDir, file2));
27224
+ raw = fs23.readFileUtf8(import_node_path5.default.join(recordsDir, file2));
27225
27225
  } catch {
27226
27226
  return void 0;
27227
27227
  }
@@ -27235,44 +27235,44 @@ function readDirectRecordEntry(fs22, recordsDir, file2) {
27235
27235
  return { malformed: true };
27236
27236
  }
27237
27237
  }
27238
- function listFrontDoorDirectRecords(fs22, recordsDir) {
27239
- return fs22.readdir(recordsDir).flatMap((file2) => {
27240
- const entry = readDirectRecordEntry(fs22, recordsDir, file2);
27238
+ function listFrontDoorDirectRecords(fs23, recordsDir) {
27239
+ return fs23.readdir(recordsDir).flatMap((file2) => {
27240
+ const entry = readDirectRecordEntry(fs23, recordsDir, file2);
27241
27241
  return entry?.record === void 0 ? [] : [entry.record];
27242
27242
  }).sort((a10, b) => a10.pid - b.pid);
27243
27243
  }
27244
- function pruneMalformedFrontDoorDirectFiles(fs22, recordsDir, isRunning) {
27245
- for (const file2 of fs22.readdir(recordsDir)) {
27244
+ function pruneMalformedFrontDoorDirectFiles(fs23, recordsDir, isRunning) {
27245
+ for (const file2 of fs23.readdir(recordsDir)) {
27246
27246
  const writer = RECORD_TEMPORARY_FILE.exec(file2)?.[1];
27247
27247
  const stale = writer !== void 0 && !isRunning(Number(writer));
27248
- if (stale || readDirectRecordEntry(fs22, recordsDir, file2)?.malformed === true) {
27249
- fs22.removeRecursive(import_node_path5.default.join(recordsDir, file2));
27248
+ if (stale || readDirectRecordEntry(fs23, recordsDir, file2)?.malformed === true) {
27249
+ fs23.removeRecursive(import_node_path5.default.join(recordsDir, file2));
27250
27250
  }
27251
27251
  }
27252
27252
  }
27253
27253
  function liveFrontDoorDirectRecords(records, liveness) {
27254
27254
  return records.filter((record2) => liveness.doors.has(record2.pid) || liveness.unknown.has(record2.pid));
27255
27255
  }
27256
- function pruneDeadFrontDoorDirectRecords(fs22, recordsDir, records, liveness) {
27256
+ function pruneDeadFrontDoorDirectRecords(fs23, recordsDir, records, liveness) {
27257
27257
  for (const record2 of records) {
27258
27258
  if (!liveness.doors.has(record2.pid) && !liveness.unknown.has(record2.pid)) {
27259
- removeFrontDoorDirectRecord(fs22, recordsDir, record2.pid);
27259
+ removeFrontDoorDirectRecord(fs23, recordsDir, record2.pid);
27260
27260
  }
27261
27261
  }
27262
27262
  }
27263
- function writeFrontDoorSession(fs22, sessionsDir, session) {
27264
- fs22.mkdirPrivate(sessionsDir);
27265
- fs22.writeFilePrivate(import_node_path5.default.join(sessionsDir, `${String(session.pid)}.json`), `${JSON.stringify(session, null, 2)}
27263
+ function writeFrontDoorSession(fs23, sessionsDir, session) {
27264
+ fs23.mkdirPrivate(sessionsDir);
27265
+ fs23.writeFilePrivate(import_node_path5.default.join(sessionsDir, `${String(session.pid)}.json`), `${JSON.stringify(session, null, 2)}
27266
27266
  `);
27267
27267
  }
27268
- function listFrontDoorSessions(fs22, sessionsDir) {
27268
+ function listFrontDoorSessions(fs23, sessionsDir) {
27269
27269
  const sessions = [];
27270
- for (const name of fs22.readdir(sessionsDir)) {
27270
+ for (const name of fs23.readdir(sessionsDir)) {
27271
27271
  if (!name.endsWith(".json")) {
27272
27272
  continue;
27273
27273
  }
27274
27274
  try {
27275
- const parsed = FrontDoorSessionSchema.safeParse(JSON.parse(fs22.readFileUtf8(import_node_path5.default.join(sessionsDir, name)) ?? ""));
27275
+ const parsed = FrontDoorSessionSchema.safeParse(JSON.parse(fs23.readFileUtf8(import_node_path5.default.join(sessionsDir, name)) ?? ""));
27276
27276
  if (parsed.success) {
27277
27277
  sessions.push({ pid: parsed.data.pid, startedAt: parsed.data.startedAt, ...parsed.data.supervisorPid === void 0 ? {} : { supervisorPid: parsed.data.supervisorPid } });
27278
27278
  }
@@ -27282,27 +27282,27 @@ function listFrontDoorSessions(fs22, sessionsDir) {
27282
27282
  }
27283
27283
  return sessions.sort((a10, b) => a10.pid - b.pid);
27284
27284
  }
27285
- function removeFrontDoorSession(fs22, sessionsDir, pid) {
27286
- fs22.removeRecursive(import_node_path5.default.join(sessionsDir, `${String(pid)}.json`));
27285
+ function removeFrontDoorSession(fs23, sessionsDir, pid) {
27286
+ fs23.removeRecursive(import_node_path5.default.join(sessionsDir, `${String(pid)}.json`));
27287
27287
  }
27288
- function pruneDeadFrontDoorSessions(fs22, sessionsDir, isRunning) {
27288
+ function pruneDeadFrontDoorSessions(fs23, sessionsDir, isRunning) {
27289
27289
  const removed = [];
27290
- for (const session of listFrontDoorSessions(fs22, sessionsDir)) {
27290
+ for (const session of listFrontDoorSessions(fs23, sessionsDir)) {
27291
27291
  if (!isRunning(session.pid)) {
27292
- removeFrontDoorSession(fs22, sessionsDir, session.pid);
27292
+ removeFrontDoorSession(fs23, sessionsDir, session.pid);
27293
27293
  removed.push(session.pid);
27294
27294
  }
27295
27295
  }
27296
27296
  return removed;
27297
27297
  }
27298
- function liveSessionTokens(fs22, sessionsDir) {
27298
+ function liveSessionTokens(fs23, sessionsDir) {
27299
27299
  const tokens = /* @__PURE__ */ new Set();
27300
- for (const name of fs22.readdir(sessionsDir)) {
27300
+ for (const name of fs23.readdir(sessionsDir)) {
27301
27301
  if (!name.endsWith(".json")) {
27302
27302
  continue;
27303
27303
  }
27304
27304
  try {
27305
- const parsed = FrontDoorSessionSchema.safeParse(JSON.parse(fs22.readFileUtf8(import_node_path5.default.join(sessionsDir, name)) ?? ""));
27305
+ const parsed = FrontDoorSessionSchema.safeParse(JSON.parse(fs23.readFileUtf8(import_node_path5.default.join(sessionsDir, name)) ?? ""));
27306
27306
  if (parsed.success) {
27307
27307
  tokens.add(parsed.data.token);
27308
27308
  }
@@ -27364,43 +27364,43 @@ function parseJson(raw, schema) {
27364
27364
  const parsed = schema.safeParse(JSON.parse(raw));
27365
27365
  return parsed.success ? parsed.data : void 0;
27366
27366
  }
27367
- function readHeadroomState(fs22, stateFile) {
27367
+ function readHeadroomState(fs23, stateFile) {
27368
27368
  try {
27369
- return parseJson(fs22.readFileUtf8(stateFile), HeadroomStateSchema);
27369
+ return parseJson(fs23.readFileUtf8(stateFile), HeadroomStateSchema);
27370
27370
  } catch {
27371
27371
  return void 0;
27372
27372
  }
27373
27373
  }
27374
- function writeHeadroomState(fs22, stateFile, state) {
27375
- fs22.mkdirp(import_node_path6.default.dirname(stateFile));
27376
- fs22.writeFilePrivate(stateFile, `${JSON.stringify(state, null, 2)}
27374
+ function writeHeadroomState(fs23, stateFile, state) {
27375
+ fs23.mkdirp(import_node_path6.default.dirname(stateFile));
27376
+ fs23.writeFilePrivate(stateFile, `${JSON.stringify(state, null, 2)}
27377
27377
  `);
27378
27378
  }
27379
- function resolveServingHeadroomState(fs22, files, isRunning) {
27380
- const current = readHeadroomState(fs22, files.stateFile);
27379
+ function resolveServingHeadroomState(fs23, files, isRunning) {
27380
+ const current = readHeadroomState(fs23, files.stateFile);
27381
27381
  if (current !== void 0) {
27382
27382
  return { path: files.stateFile, state: current };
27383
27383
  }
27384
- const legacy = readHeadroomState(fs22, files.legacyStateFile);
27384
+ const legacy = readHeadroomState(fs23, files.legacyStateFile);
27385
27385
  if (legacy?.supervisorPid !== void 0 && isRunning(legacy.supervisorPid)) {
27386
27386
  return { path: files.legacyStateFile, state: legacy };
27387
27387
  }
27388
27388
  return void 0;
27389
27389
  }
27390
- function migrateHeadroomState(fs22, files, isRunning) {
27391
- const legacy = readHeadroomState(fs22, files.legacyStateFile);
27390
+ function migrateHeadroomState(fs23, files, isRunning) {
27391
+ const legacy = readHeadroomState(fs23, files.legacyStateFile);
27392
27392
  const legacyLive = legacy?.supervisorPid !== void 0 && isRunning(legacy.supervisorPid);
27393
- const current = readHeadroomState(fs22, files.stateFile);
27393
+ const current = readHeadroomState(fs23, files.stateFile);
27394
27394
  if (current !== void 0 || legacyLive) {
27395
- if (!legacyLive && fs22.readFileUtf8(files.legacyStateFile) !== void 0) {
27396
- fs22.removeRecursive(files.legacyStateFile);
27395
+ if (!legacyLive && fs23.readFileUtf8(files.legacyStateFile) !== void 0) {
27396
+ fs23.removeRecursive(files.legacyStateFile);
27397
27397
  }
27398
27398
  return;
27399
27399
  }
27400
27400
  if (legacy !== void 0) {
27401
- writeHeadroomState(fs22, files.stateFile, legacy);
27401
+ writeHeadroomState(fs23, files.stateFile, legacy);
27402
27402
  }
27403
- fs22.removeRecursive(files.legacyStateFile);
27403
+ fs23.removeRecursive(files.legacyStateFile);
27404
27404
  }
27405
27405
  function hashAllowlist(allowlist) {
27406
27406
  return (0, import_node_crypto2.createHash)("sha256").update(allowlist.join("\n")).digest("hex");
@@ -27433,27 +27433,27 @@ function isAdmissibleUrl(entry) {
27433
27433
  function parseAllowlistFile(content) {
27434
27434
  return content.replace(/^\uFEFF/, "").replace(ALLOWLIST_FILE_COMMENT, "").split(ALLOWLIST_FILE_SEPARATORS).map((entry) => entry.replace(ALLOWLIST_SURROUNDING_WHITESPACE, "")).filter((entry) => entry !== "" && !ALLOWLIST_ENTRY_WHITESPACE.test(entry) && (entry.includes("://") ? isAdmissibleUrl(entry) : isBareHost(entry)));
27435
27435
  }
27436
- function writeAllowlistFile(fs22, allowlistFile, allowlist) {
27437
- fs22.mkdirPrivate(import_node_path6.default.dirname(allowlistFile));
27438
- fs22.writeFilePrivate(allowlistFile, formatAllowlistFile(allowlist));
27436
+ function writeAllowlistFile(fs23, allowlistFile, allowlist) {
27437
+ fs23.mkdirPrivate(import_node_path6.default.dirname(allowlistFile));
27438
+ fs23.writeFilePrivate(allowlistFile, formatAllowlistFile(allowlist));
27439
27439
  }
27440
- function pruneStaleAllowlistTemporaries(fs22, allowlistFile, isRunning) {
27440
+ function pruneStaleAllowlistTemporaries(fs23, allowlistFile, isRunning) {
27441
27441
  const prefix = `${import_node_path6.default.basename(allowlistFile)}.`;
27442
- for (const name of fs22.readdir(import_node_path6.default.dirname(allowlistFile))) {
27442
+ for (const name of fs23.readdir(import_node_path6.default.dirname(allowlistFile))) {
27443
27443
  const writer = name.startsWith(prefix) ? /^([1-9]\d*)\.tmp$/.exec(name.slice(prefix.length))?.[1] : void 0;
27444
27444
  if (writer !== void 0 && !isRunning(Number(writer))) {
27445
- fs22.removeRecursive(import_node_path6.default.join(import_node_path6.default.dirname(allowlistFile), name));
27445
+ fs23.removeRecursive(import_node_path6.default.join(import_node_path6.default.dirname(allowlistFile), name));
27446
27446
  }
27447
27447
  }
27448
27448
  }
27449
- function readAllProviders(fs22, providersDir) {
27449
+ function readAllProviders(fs23, providersDir) {
27450
27450
  const result = [];
27451
- for (const name of fs22.readdir(providersDir)) {
27451
+ for (const name of fs23.readdir(providersDir)) {
27452
27452
  if (!name.endsWith(".json")) {
27453
27453
  continue;
27454
27454
  }
27455
27455
  try {
27456
- const parsed = parseJson(fs22.readFileUtf8(import_node_path6.default.join(providersDir, name)), ProviderSchema);
27456
+ const parsed = parseJson(fs23.readFileUtf8(import_node_path6.default.join(providersDir, name)), ProviderSchema);
27457
27457
  if (parsed !== void 0) {
27458
27458
  result.push({ name: name.slice(0, -".json".length), provider: parsed });
27459
27459
  }
@@ -27463,22 +27463,22 @@ function readAllProviders(fs22, providersDir) {
27463
27463
  }
27464
27464
  return result;
27465
27465
  }
27466
- function writeSession(fs22, sessionsDir, session) {
27467
- fs22.mkdirp(sessionsDir);
27468
- fs22.writeFileUtf8(import_node_path6.default.join(sessionsDir, `${String(session.pid)}.json`), `${JSON.stringify(session, null, 2)}
27466
+ function writeSession(fs23, sessionsDir, session) {
27467
+ fs23.mkdirp(sessionsDir);
27468
+ fs23.writeFileUtf8(import_node_path6.default.join(sessionsDir, `${String(session.pid)}.json`), `${JSON.stringify(session, null, 2)}
27469
27469
  `);
27470
27470
  }
27471
- function removeSession(fs22, sessionsDir, pid) {
27472
- fs22.removeRecursive(import_node_path6.default.join(sessionsDir, `${String(pid)}.json`));
27471
+ function removeSession(fs23, sessionsDir, pid) {
27472
+ fs23.removeRecursive(import_node_path6.default.join(sessionsDir, `${String(pid)}.json`));
27473
27473
  }
27474
- function listSessions(fs22, sessionsDir) {
27474
+ function listSessions(fs23, sessionsDir) {
27475
27475
  const sessions = [];
27476
- for (const name of fs22.readdir(sessionsDir)) {
27476
+ for (const name of fs23.readdir(sessionsDir)) {
27477
27477
  if (!name.endsWith(".json")) {
27478
27478
  continue;
27479
27479
  }
27480
27480
  try {
27481
- const parsed = parseJson(fs22.readFileUtf8(import_node_path6.default.join(sessionsDir, name)), HeadroomSessionSchema);
27481
+ const parsed = parseJson(fs23.readFileUtf8(import_node_path6.default.join(sessionsDir, name)), HeadroomSessionSchema);
27482
27482
  if (parsed !== void 0) {
27483
27483
  sessions.push(parsed);
27484
27484
  }
@@ -27488,22 +27488,22 @@ function listSessions(fs22, sessionsDir) {
27488
27488
  }
27489
27489
  return sessions.sort((a10, b) => a10.pid - b.pid);
27490
27490
  }
27491
- function sessionsForSupervisor(fs22, sessionsDir, supervisorPid) {
27492
- return listSessions(fs22, sessionsDir).filter((session) => session.supervisorPid === supervisorPid);
27491
+ function sessionsForSupervisor(fs23, sessionsDir, supervisorPid) {
27492
+ return listSessions(fs23, sessionsDir).filter((session) => session.supervisorPid === supervisorPid);
27493
27493
  }
27494
- function pruneDeadSessions(fs22, sessionsDir, isRunning) {
27494
+ function pruneDeadSessions(fs23, sessionsDir, isRunning) {
27495
27495
  const removed = [];
27496
- for (const session of listSessions(fs22, sessionsDir)) {
27496
+ for (const session of listSessions(fs23, sessionsDir)) {
27497
27497
  if (!isRunning(session.pid)) {
27498
- removeSession(fs22, sessionsDir, session.pid);
27498
+ removeSession(fs23, sessionsDir, session.pid);
27499
27499
  removed.push(session.pid);
27500
27500
  }
27501
27501
  }
27502
27502
  return removed;
27503
27503
  }
27504
- function readStartLock(fs22, lockFile) {
27504
+ function readStartLock(fs23, lockFile) {
27505
27505
  try {
27506
- return parseJson(fs22.readFileUtf8(lockFile), HeadroomLockSchema);
27506
+ return parseJson(fs23.readFileUtf8(lockFile), HeadroomLockSchema);
27507
27507
  } catch {
27508
27508
  return void 0;
27509
27509
  }
@@ -27596,12 +27596,12 @@ function earlierReleaseAllowlistHash(providers, doorOrigin) {
27596
27596
  }
27597
27597
  return hashAllowlist([...entries].sort());
27598
27598
  }
27599
- function earlierReleaseDaemon(fs22, paths, daemon) {
27599
+ function earlierReleaseDaemon(fs23, paths, daemon) {
27600
27600
  if (daemonIdentity(daemon.commandLine, daemon.socketPath) !== "earlier-release") {
27601
27601
  return void 0;
27602
27602
  }
27603
- const providers = readAllProviders(fs22, paths.providersDir).map((entry) => entry.provider);
27604
- const expected = earlierReleaseAllowlistHash(providers, frontDoorOrigin(readFrontDoorState(fs22, paths.frontdoorStateFile)));
27603
+ const providers = readAllProviders(fs23, paths.providersDir).map((entry) => entry.provider);
27604
+ const expected = earlierReleaseAllowlistHash(providers, frontDoorOrigin(readFrontDoorState(fs23, paths.frontdoorStateFile)));
27605
27605
  return { admitsServingDoor: daemon.recordedHash === expected };
27606
27606
  }
27607
27607
  var EARLIER_RELEASE_ALLOWLIST, EARLIER_RELEASE_ANTHROPIC_UPSTREAM;
@@ -27626,8 +27626,8 @@ function awaitingCause(daemonPid, identity, allowlistFile) {
27626
27626
  }
27627
27627
  return `the headroom supervisor has not written an allowlist admitting this launch's upstreams to ${allowlistFile} within ${String(HEADROOM_START_TIMEOUT_MS)}ms`;
27628
27628
  }
27629
- function daemonAdmits(fs22, allowlistFile, recordedHash, required2) {
27630
- const content = fs22.readFileUtf8(allowlistFile);
27629
+ function daemonAdmits(fs23, allowlistFile, recordedHash, required2) {
27630
+ const content = fs23.readFileUtf8(allowlistFile);
27631
27631
  if (content === void 0 || recordedHash === void 0) {
27632
27632
  return false;
27633
27633
  }
@@ -28017,7 +28017,7 @@ function verifyAllowlistFile(allowlistFile, ports) {
28017
28017
  const replaceable = fileStat === void 0 || fileStat.kind === "file" || fileStat.kind === "symlink";
28018
28018
  return { message: refusal2, repairable: replaceable };
28019
28019
  }
28020
- function prepareHeadroomSocket(fs22, ports, paths, supervisorPid) {
28020
+ function prepareHeadroomSocket(fs23, ports, paths, supervisorPid) {
28021
28021
  const unsupported = platformRefusal(ports.platform);
28022
28022
  if (unsupported !== void 0) {
28023
28023
  return { refused: unsupported };
@@ -28032,18 +28032,18 @@ function prepareHeadroomSocket(fs22, ports, paths, supervisorPid) {
28032
28032
  if (ports.lstat(paths.headroomSocketDir)?.kind === "symlink") {
28033
28033
  return { refused: `the headroom socket directory ${paths.headroomSocketDir} is a symlink; it must be the real directory` };
28034
28034
  }
28035
- fs22.mkdirPrivate(paths.headroomSocketDir);
28035
+ fs23.mkdirPrivate(paths.headroomSocketDir);
28036
28036
  const refusal2 = ownerOnlyRefusal("socket directory", paths.headroomSocketDir, ports.lstat(paths.headroomSocketDir), "dir", ports.currentUid());
28037
28037
  return refusal2 === void 0 ? { socketPath } : { refused: refusal2 };
28038
28038
  }
28039
- function pruneStaleHeadroomSockets(fs22, paths, isRunning) {
28039
+ function pruneStaleHeadroomSockets(fs23, paths, isRunning) {
28040
28040
  const removed = [];
28041
- for (const name of fs22.readdir(paths.headroomSocketDir)) {
28041
+ for (const name of fs23.readdir(paths.headroomSocketDir)) {
28042
28042
  const pid = HEADROOM_SOCKET_NAME.exec(name)?.[1];
28043
28043
  if (pid === void 0 || isRunning(Number.parseInt(pid, 10))) {
28044
28044
  continue;
28045
28045
  }
28046
- fs22.removeRecursive(import_node_path7.default.join(paths.headroomSocketDir, name));
28046
+ fs23.removeRecursive(import_node_path7.default.join(paths.headroomSocketDir, name));
28047
28047
  removed.push(name);
28048
28048
  }
28049
28049
  return removed;
@@ -28190,37 +28190,37 @@ function compareVersions2(a10, b) {
28190
28190
  return 0;
28191
28191
  }
28192
28192
  async function runSupervisor(initialConfig, ports, options = {}) {
28193
- const { fs: fs22, paths } = ports;
28193
+ const { fs: fs23, paths } = ports;
28194
28194
  let config2 = initialConfig;
28195
- migrateHeadroomState(fs22, { stateFile: paths.headroomStateFile, legacyStateFile: paths.headroomLegacyStateFile }, ports.isRunning);
28196
- const previousState = resolveServingHeadroomState(fs22, { stateFile: paths.headroomStateFile, legacyStateFile: paths.headroomLegacyStateFile }, ports.isRunning)?.state;
28195
+ migrateHeadroomState(fs23, { stateFile: paths.headroomStateFile, legacyStateFile: paths.headroomLegacyStateFile }, ports.isRunning);
28196
+ const previousState = resolveServingHeadroomState(fs23, { stateFile: paths.headroomStateFile, legacyStateFile: paths.headroomLegacyStateFile }, ports.isRunning)?.state;
28197
28197
  if (previousState?.supervisorPid !== void 0 && previousState.supervisorPid !== ports.ownPid && ports.isRunning(previousState.supervisorPid)) {
28198
28198
  ports.log(`agent-shim headroom supervisor ${String(ports.ownPid)}: supervisor ${String(previousState.supervisorPid)} already owns the daemon; exiting`);
28199
28199
  return 0;
28200
28200
  }
28201
28201
  let installedSource = previousState?.installedSource;
28202
28202
  const ownsState = () => {
28203
- const owner = readHeadroomState(fs22, paths.headroomStateFile)?.supervisorPid;
28203
+ const owner = readHeadroomState(fs23, paths.headroomStateFile)?.supervisorPid;
28204
28204
  return owner === void 0 || owner === ports.ownPid || !ports.isRunning(owner);
28205
28205
  };
28206
28206
  const writeOwnState = (state) => {
28207
28207
  if (!ownsState()) {
28208
28208
  return false;
28209
28209
  }
28210
- writeHeadroomState(fs22, paths.headroomStateFile, state);
28210
+ writeHeadroomState(fs23, paths.headroomStateFile, state);
28211
28211
  return true;
28212
28212
  };
28213
28213
  const fail = (message) => {
28214
28214
  if (writeOwnState({ lastError: message })) {
28215
- fs22.removeRecursive(paths.headroomLockFile);
28215
+ fs23.removeRecursive(paths.headroomLockFile);
28216
28216
  }
28217
28217
  ports.log(`agent-shim headroom supervisor: ${message}`);
28218
28218
  return 1;
28219
28219
  };
28220
28220
  const syncAllowlistFile = (allowlist) => {
28221
28221
  try {
28222
- if (fs22.readFileUtf8(paths.headroomAllowlistFile) !== formatAllowlistFile(allowlist)) {
28223
- writeAllowlistFile(fs22, paths.headroomAllowlistFile, allowlist);
28222
+ if (fs23.readFileUtf8(paths.headroomAllowlistFile) !== formatAllowlistFile(allowlist)) {
28223
+ writeAllowlistFile(fs23, paths.headroomAllowlistFile, allowlist);
28224
28224
  ports.log(`agent-shim headroom supervisor: wrote allowlist [${allowlist.join(", ")}] to ${paths.headroomAllowlistFile}`);
28225
28225
  }
28226
28226
  return void 0;
@@ -28238,9 +28238,9 @@ async function runSupervisor(initialConfig, ports, options = {}) {
28238
28238
  }
28239
28239
  ports.log(`agent-shim headroom supervisor: repairing the allowlist file: ${problem.message}`);
28240
28240
  try {
28241
- fs22.mkdirPrivate(paths.headroomDir);
28242
- fs22.mkdirPrivate(import_node_path8.default.dirname(paths.headroomAllowlistFile));
28243
- writeAllowlistFile(fs22, paths.headroomAllowlistFile, allowlist);
28241
+ fs23.mkdirPrivate(paths.headroomDir);
28242
+ fs23.mkdirPrivate(import_node_path8.default.dirname(paths.headroomAllowlistFile));
28243
+ writeAllowlistFile(fs23, paths.headroomAllowlistFile, allowlist);
28244
28244
  } catch (error63) {
28245
28245
  return `could not write the headroom allowlist file ${paths.headroomAllowlistFile}: ${error63 instanceof Error ? error63.message : String(error63)}`;
28246
28246
  }
@@ -28265,20 +28265,20 @@ async function runSupervisor(initialConfig, ports, options = {}) {
28265
28265
  installedSource = config2.source;
28266
28266
  return void 0;
28267
28267
  };
28268
- const socket = prepareHeadroomSocket(fs22, ports.socketTrust, paths, ports.ownPid);
28268
+ const socket = prepareHeadroomSocket(fs23, ports.socketTrust, paths, ports.ownPid);
28269
28269
  if (socket.refused !== void 0) {
28270
28270
  return fail(socket.refused);
28271
28271
  }
28272
28272
  const { socketPath } = socket;
28273
- pruneStaleHeadroomSockets(fs22, paths, ports.isRunning);
28274
- pruneStaleAllowlistTemporaries(fs22, paths.headroomAllowlistFile, ports.isRunning);
28273
+ pruneStaleHeadroomSockets(fs23, paths, ports.isRunning);
28274
+ pruneStaleAllowlistTemporaries(fs23, paths.headroomAllowlistFile, ports.isRunning);
28275
28275
  const installFailure = ensureInstalled();
28276
28276
  if (installFailure !== void 0) {
28277
28277
  return fail(installFailure);
28278
28278
  }
28279
28279
  const version2 = ports.headroomVersion() ?? "unknown";
28280
28280
  writeOwnState({ supervisorPid: ports.ownPid, version: version2, installedSource });
28281
- ports.log(`agent-shim headroom supervisor ${String(ports.ownPid)}: managing headroom on allowlist [${currentHeadroomAllowlistInputs(fs22, paths, ports.frontDoorLiveness).frontDoorOrigins.join(", ")}]`);
28281
+ ports.log(`agent-shim headroom supervisor ${String(ports.ownPid)}: managing headroom on allowlist [${currentHeadroomAllowlistInputs(fs23, paths, ports.frontDoorLiveness).frontDoorOrigins.join(", ")}]`);
28282
28282
  const orphanPid = previousState?.headroomPid;
28283
28283
  const orphanSocket = previousState?.socketPath ?? (previousState?.supervisorPid === void 0 ? void 0 : headroomSocketPath(paths, previousState.supervisorPid));
28284
28284
  const orphanIdentity = orphanPid === void 0 || orphanSocket === void 0 || !ports.isRunning(orphanPid) ? void 0 : daemonIdentity(ports.daemonCommandLine(orphanPid), orphanSocket);
@@ -28313,12 +28313,12 @@ async function runSupervisor(initialConfig, ports, options = {}) {
28313
28313
  ticks += 1;
28314
28314
  config2 = ports.readConfig();
28315
28315
  const settingsHash = hashSettings(config2.settings);
28316
- const inputs = currentHeadroomAllowlistInputs(fs22, paths, ports.frontDoorLiveness);
28317
- pruneDeadFrontDoorDirectRecords(fs22, paths.frontdoorDirectRecordsDir, inputs.frontDoorRecords, inputs.frontDoorLiveness);
28318
- pruneMalformedFrontDoorDirectFiles(fs22, paths.frontdoorDirectRecordsDir, ports.isRunning);
28316
+ const inputs = currentHeadroomAllowlistInputs(fs23, paths, ports.frontDoorLiveness);
28317
+ pruneDeadFrontDoorDirectRecords(fs23, paths.frontdoorDirectRecordsDir, inputs.frontDoorRecords, inputs.frontDoorLiveness);
28318
+ pruneMalformedFrontDoorDirectFiles(fs23, paths.frontdoorDirectRecordsDir, ports.isRunning);
28319
28319
  const allowlist = inputs.frontDoorOrigins;
28320
28320
  const allowlistHash = hashAllowlist(allowlist);
28321
- pruneDeadSessions(fs22, paths.headroomSessionsDir, ports.isRunning);
28321
+ pruneDeadSessions(fs23, paths.headroomSessionsDir, ports.isRunning);
28322
28322
  const ownsNow = ownsState();
28323
28323
  if (!ownsNow && !superseded) {
28324
28324
  ports.log("agent-shim headroom supervisor: another supervisor now owns the state file; serving this daemon's own sessions until they end");
@@ -28365,7 +28365,7 @@ async function runSupervisor(initialConfig, ports, options = {}) {
28365
28365
  runningSettingsHash = settingsHash;
28366
28366
  const recorded = writeOwnState(servingState(pid));
28367
28367
  if (recorded) {
28368
- fs22.removeRecursive(paths.headroomLockFile);
28368
+ fs23.removeRecursive(paths.headroomLockFile);
28369
28369
  }
28370
28370
  idleSince = void 0;
28371
28371
  ports.log(`agent-shim headroom supervisor: headroom pid ${String(pid)} ready on unix socket ${socketPath}`);
@@ -28393,7 +28393,7 @@ async function runSupervisor(initialConfig, ports, options = {}) {
28393
28393
  ports.log(`agent-shim headroom supervisor: headroom pid ${String(headroomPid)} now serves allowlist [${allowlist.join(", ")}]`);
28394
28394
  }
28395
28395
  if (runningSettingsHash !== settingsHash || installedSource !== config2.source) {
28396
- if (sessionsForSupervisor(fs22, paths.headroomSessionsDir, ports.ownPid).length === 0) {
28396
+ if (sessionsForSupervisor(fs23, paths.headroomSessionsDir, ports.ownPid).length === 0) {
28397
28397
  ports.log("agent-shim headroom supervisor: configuration drifted and no sessions are live; restarting headroom");
28398
28398
  ports.stopProcess(headroomPid);
28399
28399
  headroomPid = void 0;
@@ -28402,7 +28402,7 @@ async function runSupervisor(initialConfig, ports, options = {}) {
28402
28402
  continue;
28403
28403
  }
28404
28404
  }
28405
- const sessions = sessionsForSupervisor(fs22, paths.headroomSessionsDir, ports.ownPid);
28405
+ const sessions = sessionsForSupervisor(fs23, paths.headroomSessionsDir, ports.ownPid);
28406
28406
  if (sessions.length === 0) {
28407
28407
  idleSince ??= ports.now();
28408
28408
  const idleMs = ports.now() - idleSince;
@@ -28427,9 +28427,9 @@ function undeterminedFrontDoors(inputs) {
28427
28427
  return reason === void 0 ? [] : [{ pid: record2.pid, origin: directOrigin(record2.directPort), reason }];
28428
28428
  });
28429
28429
  }
28430
- function currentHeadroomAllowlistInputs(fs22, paths, frontDoorLiveness) {
28431
- const named = frontDoorOrigin(readFrontDoorState(fs22, paths.frontdoorStateFile));
28432
- const records = listFrontDoorDirectRecords(fs22, paths.frontdoorDirectRecordsDir);
28430
+ function currentHeadroomAllowlistInputs(fs23, paths, frontDoorLiveness) {
28431
+ const named = frontDoorOrigin(readFrontDoorState(fs23, paths.frontdoorStateFile));
28432
+ const records = listFrontDoorDirectRecords(fs23, paths.frontdoorDirectRecordsDir);
28433
28433
  const liveness = frontDoorLiveness(records.map((record2) => record2.pid));
28434
28434
  const live = liveFrontDoorDirectRecords(records, liveness).map((record2) => directOrigin(record2.directPort));
28435
28435
  return {
@@ -28438,8 +28438,8 @@ function currentHeadroomAllowlistInputs(fs22, paths, frontDoorLiveness) {
28438
28438
  frontDoorOrigins: [.../* @__PURE__ */ new Set([...named === void 0 ? [] : [named], ...live])].sort()
28439
28439
  };
28440
28440
  }
28441
- function launchRequiredUpstreams(fs22, paths) {
28442
- const door = frontDoorOrigin(readFrontDoorState(fs22, paths.frontdoorStateFile));
28441
+ function launchRequiredUpstreams(fs23, paths) {
28442
+ const door = frontDoorOrigin(readFrontDoorState(fs23, paths.frontdoorStateFile));
28443
28443
  return door === void 0 ? [] : [door];
28444
28444
  }
28445
28445
  async function waitUntilReady(ports, socketPath, pid) {
@@ -28622,6 +28622,12 @@ function detachedDaemonSpawnOptions(logFd, env) {
28622
28622
  function spawnDetachedSupervisor(paths, subcommand, logPath) {
28623
28623
  return spawnDetachedDaemon(selfInvocation([subcommand]), paths, subcommand, logPath);
28624
28624
  }
28625
+ function spawnDaemonThrough(executable) {
28626
+ return (paths, subcommand, logPath) => spawnDetachedDaemon({ command: executable, args: [subcommand] }, paths, subcommand, logPath);
28627
+ }
28628
+ function spawnDaemonThroughScript(script) {
28629
+ return (paths, subcommand, logPath) => spawnDetachedDaemon({ command: process.execPath, args: [script, subcommand] }, paths, subcommand, logPath);
28630
+ }
28625
28631
  function spawnDetachedDaemon(invocation, paths, subcommand, logPath) {
28626
28632
  import_node_fs3.default.mkdirSync(import_node_path9.default.dirname(logPath), { recursive: true });
28627
28633
  const logFd = import_node_fs3.default.openSync(logPath, "a");
@@ -28644,7 +28650,7 @@ function realHeadroomPort(paths, options) {
28644
28650
  ensure: ({ routesProvider }) => {
28645
28651
  const up2 = ensureHeadroom({
28646
28652
  paths,
28647
- launcherPid: process.pid,
28653
+ launcherPid: options.registerAs ?? process.pid,
28648
28654
  ...routesProvider ? { requiredUpstreams: () => launchRequiredUpstreams(realFarmFs, paths) } : {},
28649
28655
  ports: {
28650
28656
  fs: realFarmFs,
@@ -28662,7 +28668,7 @@ function realHeadroomPort(paths, options) {
28662
28668
  };
28663
28669
  },
28664
28670
  release: () => {
28665
- removeSession(realFarmFs, paths.headroomSessionsDir, process.pid);
28671
+ removeSession(realFarmFs, paths.headroomSessionsDir, options.registerAs ?? process.pid);
28666
28672
  }
28667
28673
  };
28668
28674
  }
@@ -29589,8 +29595,8 @@ var require_utils = __commonJS({
29589
29595
  }
29590
29596
  return output2;
29591
29597
  };
29592
- exports2.basename = (path57, { windows } = {}) => {
29593
- const segs = path57.split(windows ? /[\\/]/ : "/");
29598
+ exports2.basename = (path59, { windows } = {}) => {
29599
+ const segs = path59.split(windows ? /[\\/]/ : "/");
29594
29600
  const last = segs[segs.length - 1];
29595
29601
  if (last === "") {
29596
29602
  return segs[segs.length - 2];
@@ -31262,8 +31268,8 @@ var init_classify = __esm({
31262
31268
  function poolNameOf(selector) {
31263
31269
  return selector.startsWith(POOL_SELECTOR_PREFIX) ? selector.slice(POOL_SELECTOR_PREFIX.length) : void 0;
31264
31270
  }
31265
- function readActiveIdentity(fs22, activeIdentityFile) {
31266
- const trimmed = fs22.readFileUtf8(activeIdentityFile)?.trim();
31271
+ function readActiveIdentity(fs23, activeIdentityFile) {
31272
+ const trimmed = fs23.readFileUtf8(activeIdentityFile)?.trim();
31267
31273
  return trimmed === void 0 || trimmed === "" ? void 0 : trimmed;
31268
31274
  }
31269
31275
  function isNonEmpty(value2) {
@@ -31310,8 +31316,8 @@ function decideConfigProfile(params) {
31310
31316
  }
31311
31317
  return { source: "none" };
31312
31318
  }
31313
- function loadIdentity(identitiesDir, name, fs22) {
31314
- return loadConfigFile(import_node_path11.default.join(identitiesDir, name, "identity.json"), IdentitySchema, fs22.readConfigFile);
31319
+ function loadIdentity(identitiesDir, name, fs23) {
31320
+ return loadConfigFile(import_node_path11.default.join(identitiesDir, name, "identity.json"), IdentitySchema, fs23.readConfigFile);
31315
31321
  }
31316
31322
  var import_node_path11, IDENTITY_DECISION_SOURCES, CONFIG_PROFILE_DECISION_SOURCES;
31317
31323
  var init_identity = __esm({
@@ -32715,8 +32721,8 @@ var init_pipeline = __esm({
32715
32721
  });
32716
32722
 
32717
32723
  // src/launcher/farm.ts
32718
- function readFarmManifest(fs22, farmRoot) {
32719
- const raw = fs22.readFileUtf8(import_node_path19.default.join(farmRoot, FARM_MANIFEST_FILENAME)) ?? fs22.readFileUtf8(import_node_path19.default.join(farmRoot, LEGACY_FARM_MANIFEST_FILENAME));
32724
+ function readFarmManifest(fs23, farmRoot) {
32725
+ const raw = fs23.readFileUtf8(import_node_path19.default.join(farmRoot, FARM_MANIFEST_FILENAME)) ?? fs23.readFileUtf8(import_node_path19.default.join(farmRoot, LEGACY_FARM_MANIFEST_FILENAME));
32720
32726
  if (raw === void 0) {
32721
32727
  return void 0;
32722
32728
  }
@@ -32774,9 +32780,9 @@ function buildEntryFacts(params) {
32774
32780
  entries
32775
32781
  };
32776
32782
  }
32777
- function listSubtree(fs22, root, rel) {
32783
+ function listSubtree(fs23, root, rel) {
32778
32784
  const absolute = import_node_path19.default.join(root, rel);
32779
- const stat = fs22.lstat(absolute);
32785
+ const stat = fs23.lstat(absolute);
32780
32786
  if (stat === void 0) {
32781
32787
  return [];
32782
32788
  }
@@ -32784,10 +32790,10 @@ function listSubtree(fs22, root, rel) {
32784
32790
  return [{ rel, kind: "symlink" }];
32785
32791
  }
32786
32792
  if (stat.kind === "dir") {
32787
- const children = [...fs22.readdir(absolute)].sort().flatMap((name) => listSubtree(fs22, root, `${rel}/${name}`));
32793
+ const children = [...fs23.readdir(absolute)].sort().flatMap((name) => listSubtree(fs23, root, `${rel}/${name}`));
32788
32794
  return [{ rel, kind: "dir" }, ...children];
32789
32795
  }
32790
- const contentHash = fs22.hashFile(absolute);
32796
+ const contentHash = fs23.hashFile(absolute);
32791
32797
  return [{ rel, kind: "file", ...contentHash === void 0 ? {} : { contentHash } }];
32792
32798
  }
32793
32799
  function topLevelScopeRoots(roots) {
@@ -32801,25 +32807,25 @@ function topLevelScopeRoots(roots) {
32801
32807
  }
32802
32808
  return kept;
32803
32809
  }
32804
- function reconciliationScope(fs22, farmRoot, manifest) {
32810
+ function reconciliationScope(fs23, farmRoot, manifest) {
32805
32811
  if (manifest !== void 0) {
32806
32812
  return topLevelScopeRoots(manifest.materialised);
32807
32813
  }
32808
- return [...fs22.readdir(farmRoot)].filter((name) => name !== FARM_MANIFEST_FILENAME && name !== LEGACY_FARM_MANIFEST_FILENAME && fs22.lstat(import_node_path19.default.join(farmRoot, name))?.kind === "dir").sort();
32814
+ return [...fs23.readdir(farmRoot)].filter((name) => name !== FARM_MANIFEST_FILENAME && name !== LEGACY_FARM_MANIFEST_FILENAME && fs23.lstat(import_node_path19.default.join(farmRoot, name))?.kind === "dir").sort();
32809
32815
  }
32810
- function collectFarmListing(fs22, farmRoot, scopeRoots) {
32811
- return scopeRoots.flatMap((root) => listSubtree(fs22, farmRoot, root));
32816
+ function collectFarmListing(fs23, farmRoot, scopeRoots) {
32817
+ return scopeRoots.flatMap((root) => listSubtree(fs23, farmRoot, root));
32812
32818
  }
32813
- function collectCanonicalCounterparts(fs22, claudeHome, farmListing) {
32819
+ function collectCanonicalCounterparts(fs23, claudeHome, farmListing) {
32814
32820
  const out = [];
32815
32821
  for (const entry of farmListing) {
32816
32822
  const absolute = import_node_path19.default.join(claudeHome, entry.rel);
32817
- const stat = fs22.lstat(absolute);
32823
+ const stat = fs23.lstat(absolute);
32818
32824
  if (stat === void 0) {
32819
32825
  continue;
32820
32826
  }
32821
32827
  if (stat.kind === "file") {
32822
- const contentHash = fs22.hashFile(absolute);
32828
+ const contentHash = fs23.hashFile(absolute);
32823
32829
  out.push({ rel: entry.rel, kind: "file", ...contentHash === void 0 ? {} : { contentHash } });
32824
32830
  continue;
32825
32831
  }
@@ -33234,6 +33240,7 @@ function buildLayoutPaths(root) {
33234
33240
  claudeShimFile: import_node_path20.default.join(root, "claude-shim.json"),
33235
33241
  headroomDir: import_node_path20.default.join(root, "headroom"),
33236
33242
  headroomStateFile: import_node_path20.default.join(root, "headroom", "state.json"),
33243
+ headroomRoutingFile: import_node_path20.default.join(root, "headroom", "routing.json"),
33237
33244
  headroomLegacyStateFile: import_node_path20.default.join(root, "headroom", "state.v2.json"),
33238
33245
  headroomAllowlistFile: import_node_path20.default.join(root, "headroom", "run", "allowlist.txt"),
33239
33246
  headroomSocketDir: import_node_path20.default.join(root, "headroom", "run"),
@@ -33969,7 +33976,7 @@ var init_package = __esm({
33969
33976
  "package.json"() {
33970
33977
  package_default = {
33971
33978
  name: "claude-use",
33972
- version: "11.2.0",
33979
+ version: "11.3.0",
33973
33980
  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.",
33974
33981
  license: "MIT",
33975
33982
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -34082,12 +34089,12 @@ function isIdentityName(name) {
34082
34089
  function claudeJsonPath(identitiesDir, identity) {
34083
34090
  return import_node_path24.default.join(identitiesDir, identity, CLAUDE_JSON);
34084
34091
  }
34085
- function readAccountMetadata(fs22, identitiesDir, identity) {
34092
+ function readAccountMetadata(fs23, identitiesDir, identity) {
34086
34093
  if (!isIdentityName(identity)) {
34087
34094
  throw new Error(`"${identity}" is not a valid identity name.`);
34088
34095
  }
34089
34096
  const file2 = claudeJsonPath(identitiesDir, identity);
34090
- const raw = fs22.readFileUtf8(file2);
34097
+ const raw = fs23.readFileUtf8(file2);
34091
34098
  if (raw === void 0) {
34092
34099
  return void 0;
34093
34100
  }
@@ -34117,19 +34124,19 @@ function readAccountMetadata(fs22, identitiesDir, identity) {
34117
34124
  }
34118
34125
  return account.data;
34119
34126
  }
34120
- function createAccountReader(fs22, identitiesDir) {
34127
+ function createAccountReader(fs23, identitiesDir) {
34121
34128
  const cache = /* @__PURE__ */ new Map();
34122
34129
  return (identity) => {
34123
34130
  if (!isIdentityName(identity)) {
34124
34131
  throw new Error(`"${identity}" is not a valid identity name.`);
34125
34132
  }
34126
- const stat = fs22.lstat(claudeJsonPath(identitiesDir, identity));
34133
+ const stat = fs23.lstat(claudeJsonPath(identitiesDir, identity));
34127
34134
  const stamp = stat === void 0 ? "absent" : `${String(stat.mtimeMs)}:${String(stat.sizeBytes)}`;
34128
34135
  const cached2 = cache.get(identity);
34129
34136
  if (cached2?.stamp === stamp) {
34130
34137
  return cached2.account;
34131
34138
  }
34132
- const account = readAccountMetadata(fs22, identitiesDir, identity);
34139
+ const account = readAccountMetadata(fs23, identitiesDir, identity);
34133
34140
  cache.set(identity, { stamp, account });
34134
34141
  return account;
34135
34142
  };
@@ -34240,11 +34247,11 @@ function identifyRequest(headers) {
34240
34247
  function directOrigin2(port) {
34241
34248
  return `http://127.0.0.1:${String(port)}`;
34242
34249
  }
34243
- function parseProviderPath(path57) {
34244
- if (!path57.startsWith(PROVIDER_PATH_PREFIX)) {
34250
+ function parseProviderPath(path59) {
34251
+ if (!path59.startsWith(PROVIDER_PATH_PREFIX)) {
34245
34252
  return void 0;
34246
34253
  }
34247
- const tail = path57.slice(PROVIDER_PATH_PREFIX.length);
34254
+ const tail = path59.slice(PROVIDER_PATH_PREFIX.length);
34248
34255
  const slash = tail.indexOf("/");
34249
34256
  if (slash <= 0) {
34250
34257
  return void 0;
@@ -34570,9 +34577,9 @@ function decoderFor(encoding) {
34570
34577
  return void 0;
34571
34578
  }
34572
34579
  }
34573
- function destinationOf(path57) {
34574
- const scoped = parseProviderPath(path57);
34575
- return scoped === void 0 ? { provider: ANTHROPIC_PROVIDER, endpoint: path57 } : { provider: scoped.provider, endpoint: scoped.rest };
34580
+ function destinationOf(path59) {
34581
+ const scoped = parseProviderPath(path59);
34582
+ return scoped === void 0 ? { provider: ANTHROPIC_PROVIDER, endpoint: path59 } : { provider: scoped.provider, endpoint: scoped.rest };
34576
34583
  }
34577
34584
  function buildRecord(event, context) {
34578
34585
  const { scan } = context;
@@ -34754,6 +34761,28 @@ function windowBurn(records, which) {
34754
34761
  }
34755
34762
  return (last.utilization - first.utilization) / (last.atMs - first.atMs);
34756
34763
  }
34764
+ function billedTokensOf(record2) {
34765
+ const usage = record2.usage;
34766
+ return (usage?.inputTokens ?? 0) + (usage?.cacheCreationInputTokens ?? 0) + (usage?.outputTokens ?? 0);
34767
+ }
34768
+ function utilisationPerBilledToken(records) {
34769
+ const points = [];
34770
+ for (const record2 of records) {
34771
+ const window = record2.rateLimitHeaders === void 0 ? void 0 : parseUnifiedRateLimit(record2.rateLimitHeaders)?.fiveHour;
34772
+ if (window?.utilization !== void 0 && window.resetsAt !== void 0) {
34773
+ points.push({ resetsAt: window.resetsAt, utilization: window.utilization, billed: billedTokensOf(record2) });
34774
+ }
34775
+ }
34776
+ const latest = points.at(-1)?.resetsAt;
34777
+ const current = points.filter((point) => point.resetsAt === latest);
34778
+ const first = current.at(0);
34779
+ const last = current.at(-1);
34780
+ if (first === void 0 || last === void 0 || last.utilization <= first.utilization) {
34781
+ return void 0;
34782
+ }
34783
+ const billed = current.slice(1).reduce((sum, point) => sum + point.billed, 0);
34784
+ return billed > 0 ? (last.utilization - first.utilization) / billed : void 0;
34785
+ }
34757
34786
  function windowRatio(records) {
34758
34787
  const points = [];
34759
34788
  for (const record2 of records) {
@@ -34930,6 +34959,16 @@ function rankPool(input2) {
34930
34959
  drySpots.push(`7d window would run dry in ${formatAge(runsDryInMs)}, before it resets in ${formatAge(sevenDay.untilResetMs)}`);
34931
34960
  }
34932
34961
  }
34962
+ const { sticky: sticky2 } = input2;
34963
+ const warmHere = sticky2?.identity === candidate.identity && nowMs - Date.parse(sticky2.at) <= PROMPT_CACHE_TTL_MS;
34964
+ if (input2.resuming && input2.resumeContextTokens !== void 0 && fiveHour !== void 0 && !warmHere) {
34965
+ const perToken = utilisationPerBilledToken(assessment.member.records);
34966
+ const cost = perToken === void 0 ? void 0 : input2.resumeContextTokens * perToken;
34967
+ if (cost !== void 0 && cost > fiveHour.remaining) {
34968
+ dryAfterMs.push(0);
34969
+ drySpots.push(`resuming a ${String(input2.resumeContextTokens)}-token conversation here would cost about ${percent(cost)} of the 5h window, which has ${percent(fiveHour.remaining)} left`);
34970
+ }
34971
+ }
34933
34972
  if (drySpots.length === 0) {
34934
34973
  return { ...candidate, feasible: true };
34935
34974
  }
@@ -34995,8 +35034,8 @@ function segmentDay(epochMs) {
34995
35034
  function segmentName(day, pid) {
34996
35035
  return `${day}.${String(pid)}.jsonl`;
34997
35036
  }
34998
- function listLogSegments(fs22, logDir) {
34999
- return fs22.readdir(logDir).flatMap((name) => {
35037
+ function listLogSegments(fs23, logDir) {
35038
+ return fs23.readdir(logDir).flatMap((name) => {
35000
35039
  const match = SEGMENT_RE.exec(name);
35001
35040
  const day = match?.[1];
35002
35041
  if (day === void 0) {
@@ -35005,15 +35044,15 @@ function listLogSegments(fs22, logDir) {
35005
35044
  return [{ name, day, endsAt: Date.parse(`${day}T00:00:00.000Z`) + DAY_MS }];
35006
35045
  }).sort((left, right) => left.day.localeCompare(right.day) || left.name.localeCompare(right.name));
35007
35046
  }
35008
- function readUsageLog(fs22, logDir, options = {}) {
35047
+ function readUsageLog(fs23, logDir, options = {}) {
35009
35048
  const { sinceMs } = options;
35010
35049
  const records = [];
35011
35050
  let invalidLines = 0;
35012
- for (const segment of listLogSegments(fs22, logDir)) {
35051
+ for (const segment of listLogSegments(fs23, logDir)) {
35013
35052
  if (sinceMs !== void 0 && segment.endsAt <= sinceMs) {
35014
35053
  continue;
35015
35054
  }
35016
- const contents = fs22.readFileUtf8(import_node_path25.default.join(logDir, segment.name));
35055
+ const contents = fs23.readFileUtf8(import_node_path25.default.join(logDir, segment.name));
35017
35056
  if (contents === void 0) {
35018
35057
  continue;
35019
35058
  }
@@ -35049,9 +35088,9 @@ function snapshotPath(snapshotsDir, identity) {
35049
35088
  }
35050
35089
  return import_node_path25.default.join(snapshotsDir, `${identity}.json`);
35051
35090
  }
35052
- function readUsageSnapshot(fs22, snapshotsDir, identity) {
35091
+ function readUsageSnapshot(fs23, snapshotsDir, identity) {
35053
35092
  const file2 = snapshotPath(snapshotsDir, identity);
35054
- const raw = fs22.readFileUtf8(file2);
35093
+ const raw = fs23.readFileUtf8(file2);
35055
35094
  if (raw === void 0) {
35056
35095
  return void 0;
35057
35096
  }
@@ -35067,8 +35106,8 @@ function readUsageSnapshot(fs22, snapshotsDir, identity) {
35067
35106
  }
35068
35107
  return snapshot.data;
35069
35108
  }
35070
- function listUsageSnapshots(fs22, snapshotsDir) {
35071
- return fs22.readdir(snapshotsDir).flatMap((name) => {
35109
+ function listUsageSnapshots(fs23, snapshotsDir) {
35110
+ return fs23.readdir(snapshotsDir).flatMap((name) => {
35072
35111
  if (!name.endsWith(".json")) {
35073
35112
  return [];
35074
35113
  }
@@ -35076,7 +35115,7 @@ function listUsageSnapshots(fs22, snapshotsDir) {
35076
35115
  if (!isIdentityName(identity)) {
35077
35116
  return [];
35078
35117
  }
35079
- const snapshot = readUsageSnapshot(fs22, snapshotsDir, identity);
35118
+ const snapshot = readUsageSnapshot(fs23, snapshotsDir, identity);
35080
35119
  return snapshot === void 0 ? [] : [snapshot];
35081
35120
  }).sort((left, right) => left.identity.localeCompare(right.identity));
35082
35121
  }
@@ -35150,11 +35189,11 @@ var init_read = __esm({
35150
35189
  });
35151
35190
 
35152
35191
  // src/usage/store.ts
35153
- function pruneUsageLog(fs22, logDir, nowMs) {
35192
+ function pruneUsageLog(fs23, logDir, nowMs) {
35154
35193
  const cutoff = nowMs - USAGE_RETENTION_MS;
35155
- for (const segment of listLogSegments(fs22, logDir)) {
35194
+ for (const segment of listLogSegments(fs23, logDir)) {
35156
35195
  if (segment.endsAt <= cutoff) {
35157
- fs22.removeRecursive(import_node_path26.default.join(logDir, segment.name));
35196
+ fs23.removeRecursive(import_node_path26.default.join(logDir, segment.name));
35158
35197
  }
35159
35198
  }
35160
35199
  }
@@ -35183,7 +35222,7 @@ function foldProviderState(current, record2) {
35183
35222
  };
35184
35223
  }
35185
35224
  function createUsageStore(deps) {
35186
- const { fs: fs22, paths } = deps;
35225
+ const { fs: fs23, paths } = deps;
35187
35226
  let prunedDay;
35188
35227
  const rewriteSnapshot = (identity, fold) => {
35189
35228
  if (!isIdentityName(identity)) {
@@ -35192,7 +35231,7 @@ function createUsageStore(deps) {
35192
35231
  }
35193
35232
  let current;
35194
35233
  try {
35195
- current = readUsageSnapshot(fs22, paths.usageSnapshotsDir, identity);
35234
+ current = readUsageSnapshot(fs23, paths.usageSnapshotsDir, identity);
35196
35235
  } catch (error63) {
35197
35236
  if (!(error63 instanceof UsageSnapshotError)) {
35198
35237
  throw error63;
@@ -35219,8 +35258,8 @@ function createUsageStore(deps) {
35219
35258
  ...account === void 0 ? {} : { account },
35220
35259
  providers
35221
35260
  });
35222
- fs22.mkdirPrivate(paths.usageSnapshotsDir);
35223
- fs22.writeFilePrivate(snapshotPath(paths.usageSnapshotsDir, identity), `${JSON.stringify(snapshot, null, 2)}
35261
+ fs23.mkdirPrivate(paths.usageSnapshotsDir);
35262
+ fs23.writeFilePrivate(snapshotPath(paths.usageSnapshotsDir, identity), `${JSON.stringify(snapshot, null, 2)}
35224
35263
  `);
35225
35264
  deps.publish?.(snapshot);
35226
35265
  return true;
@@ -35229,14 +35268,14 @@ function createUsageStore(deps) {
35229
35268
  record: (input2) => {
35230
35269
  const record2 = UsageRecordSchema.parse(input2);
35231
35270
  const nowMs = deps.now();
35232
- fs22.mkdirPrivate(paths.usageDir);
35233
- fs22.mkdirPrivate(paths.usageLogDir);
35271
+ fs23.mkdirPrivate(paths.usageDir);
35272
+ fs23.mkdirPrivate(paths.usageLogDir);
35234
35273
  const day = segmentDay(nowMs);
35235
35274
  if (prunedDay !== day) {
35236
- pruneUsageLog(fs22, paths.usageLogDir, nowMs);
35275
+ pruneUsageLog(fs23, paths.usageLogDir, nowMs);
35237
35276
  prunedDay = day;
35238
35277
  }
35239
- fs22.appendFilePrivate(import_node_path26.default.join(paths.usageLogDir, segmentName(day, deps.pid)), `${JSON.stringify(record2)}
35278
+ fs23.appendFilePrivate(import_node_path26.default.join(paths.usageLogDir, segmentName(day, deps.pid)), `${JSON.stringify(record2)}
35240
35279
  `);
35241
35280
  if (record2.identity !== void 0) {
35242
35281
  rewriteSnapshot(record2.identity, (current) => ({ ...current?.providers, [record2.provider]: foldProviderState(current?.providers[record2.provider], record2) }));
@@ -35278,14 +35317,14 @@ var init_store2 = __esm({
35278
35317
  function errorMessage(error63) {
35279
35318
  return error63 instanceof Error ? error63.message : String(error63);
35280
35319
  }
35281
- function loadPoolMembers(fs22, paths, identities, nowMs) {
35320
+ function loadPoolMembers(fs23, paths, identities, nowMs) {
35282
35321
  const windowStartMs = nowMs - FIVE_HOUR_WINDOW_MS;
35283
- const log = readUsageLog(fs22, paths.usageLogDir, { sinceMs: windowStartMs });
35322
+ const log = readUsageLog(fs23, paths.usageLogDir, { sinceMs: windowStartMs });
35284
35323
  return identities.map((identity) => {
35285
35324
  const records = log.records.filter((record2) => record2.identity === identity && record2.provider === ANTHROPIC_PROVIDER && Date.parse(record2.at) >= windowStartMs);
35286
35325
  try {
35287
- const snapshot = readUsageSnapshot(fs22, paths.usageSnapshotsDir, identity);
35288
- const account = readAccountMetadata(fs22, paths.identitiesDir, identity) ?? snapshot?.account;
35326
+ const snapshot = readUsageSnapshot(fs23, paths.usageSnapshotsDir, identity);
35327
+ const account = readAccountMetadata(fs23, paths.identitiesDir, identity) ?? snapshot?.account;
35289
35328
  return { identity, records, ...snapshot === void 0 ? {} : { snapshot }, ...account === void 0 ? {} : { account } };
35290
35329
  } catch (error63) {
35291
35330
  if (error63 instanceof UsageSnapshotError || error63 instanceof AccountMetadataError) {
@@ -35326,6 +35365,7 @@ function rankNamedPool(input2, poolName, stack, sticky) {
35326
35365
  members: members2,
35327
35366
  nowMs: input2.nowMs,
35328
35367
  resuming: input2.resuming,
35368
+ ...input2.resumeContextTokens === void 0 ? {} : { resumeContextTokens: input2.resumeContextTokens },
35329
35369
  ...sticky === void 0 ? {} : { sticky },
35330
35370
  ...pool.preference === void 0 ? {} : { preference: pool.preference }
35331
35371
  });
@@ -35356,9 +35396,9 @@ function nestedMember(input2, nestedName, childStack, sticky) {
35356
35396
  missing: nested.missing
35357
35397
  };
35358
35398
  }
35359
- function readPicksFile(fs22, file2) {
35399
+ function readPicksFile(fs23, file2) {
35360
35400
  const empty = { schemaVersion: SCHEMA_VERSION, picks: {} };
35361
- const raw = fs22.readFileUtf8(file2);
35401
+ const raw = fs23.readFileUtf8(file2);
35362
35402
  if (raw === void 0) {
35363
35403
  return { file: empty };
35364
35404
  }
@@ -35371,17 +35411,17 @@ function readPicksFile(fs22, file2) {
35371
35411
  const result = PicksFileSchema.safeParse(parsed);
35372
35412
  return result.success ? { file: result.data } : { file: empty, problem: `${file2} is not a picks file this agent-shim can read` };
35373
35413
  }
35374
- function readStickyPick(fs22, picksFile, directory) {
35375
- const read = readPicksFile(fs22, picksFile);
35414
+ function readStickyPick(fs23, picksFile, directory) {
35415
+ const read = readPicksFile(fs23, picksFile);
35376
35416
  const entry = read.file.picks[directory];
35377
35417
  return { ...entry === void 0 ? {} : { sticky: entry }, ...read.problem === void 0 ? {} : { problem: read.problem } };
35378
35418
  }
35379
- function recordStickyPick(fs22, picksFile, directory, identity, nowMs) {
35380
- const current = readPicksFile(fs22, picksFile).file.picks;
35419
+ function recordStickyPick(fs23, picksFile, directory, identity, nowMs) {
35420
+ const current = readPicksFile(fs23, picksFile).file.picks;
35381
35421
  const kept = Object.entries(current).filter(([, entry]) => nowMs - Date.parse(entry.at) <= USAGE_RETENTION_MS);
35382
35422
  const next = { schemaVersion: SCHEMA_VERSION, picks: { ...Object.fromEntries(kept), [directory]: { identity, at: new Date(nowMs).toISOString() } } };
35383
- fs22.mkdirPrivate(import_node_path27.default.dirname(picksFile));
35384
- fs22.writeFilePrivate(picksFile, `${JSON.stringify(next, null, 2)}
35423
+ fs23.mkdirPrivate(import_node_path27.default.dirname(picksFile));
35424
+ fs23.writeFilePrivate(picksFile, `${JSON.stringify(next, null, 2)}
35385
35425
  `);
35386
35426
  }
35387
35427
  var import_node_path27, PoolGraphError, SCHEMA_VERSION, PickEntrySchema, PicksFileSchema;
@@ -37014,14 +37054,14 @@ var require_util2 = __commonJS({
37014
37054
  }
37015
37055
  const port = url2.port != null ? url2.port : url2.protocol === "https:" ? 443 : 80;
37016
37056
  let origin = url2.origin != null ? url2.origin : `${url2.protocol || ""}//${url2.hostname || ""}:${port}`;
37017
- let path57 = url2.path != null ? url2.path : `${url2.pathname || ""}${url2.search || ""}`;
37057
+ let path59 = url2.path != null ? url2.path : `${url2.pathname || ""}${url2.search || ""}`;
37018
37058
  if (origin[origin.length - 1] === "/") {
37019
37059
  origin = origin.slice(0, origin.length - 1);
37020
37060
  }
37021
- if (path57 && path57[0] !== "/") {
37022
- path57 = `/${path57}`;
37061
+ if (path59 && path59[0] !== "/") {
37062
+ path59 = `/${path59}`;
37023
37063
  }
37024
- return new URL(`${origin}${path57}`);
37064
+ return new URL(`${origin}${path59}`);
37025
37065
  }
37026
37066
  if (!isHttpOrHttpsPrefixed(url2.origin || url2.protocol)) {
37027
37067
  throw new InvalidArgumentError2("Invalid URL protocol: the URL must start with `http:` or `https:`.");
@@ -37842,9 +37882,9 @@ var require_diagnostics = __commonJS({
37842
37882
  "undici:client:sendHeaders",
37843
37883
  (evt) => {
37844
37884
  const {
37845
- request: { method, path: path57, origin }
37885
+ request: { method, path: path59, origin }
37846
37886
  } = evt;
37847
- debugLog("sending request to %s %s%s", method, origin, path57);
37887
+ debugLog("sending request to %s %s%s", method, origin, path59);
37848
37888
  }
37849
37889
  );
37850
37890
  }
@@ -37862,14 +37902,14 @@ var require_diagnostics = __commonJS({
37862
37902
  "undici:request:headers",
37863
37903
  (evt) => {
37864
37904
  const {
37865
- request: { method, path: path57, origin },
37905
+ request: { method, path: path59, origin },
37866
37906
  response: { statusCode }
37867
37907
  } = evt;
37868
37908
  debugLog(
37869
37909
  "received response to %s %s%s - HTTP %d",
37870
37910
  method,
37871
37911
  origin,
37872
- path57,
37912
+ path59,
37873
37913
  statusCode
37874
37914
  );
37875
37915
  }
@@ -37878,23 +37918,23 @@ var require_diagnostics = __commonJS({
37878
37918
  "undici:request:trailers",
37879
37919
  (evt) => {
37880
37920
  const {
37881
- request: { method, path: path57, origin }
37921
+ request: { method, path: path59, origin }
37882
37922
  } = evt;
37883
- debugLog("trailers received from %s %s%s", method, origin, path57);
37923
+ debugLog("trailers received from %s %s%s", method, origin, path59);
37884
37924
  }
37885
37925
  );
37886
37926
  diagnosticsChannel.subscribe(
37887
37927
  "undici:request:error",
37888
37928
  (evt) => {
37889
37929
  const {
37890
- request: { method, path: path57, origin },
37930
+ request: { method, path: path59, origin },
37891
37931
  error: error63
37892
37932
  } = evt;
37893
37933
  debugLog(
37894
37934
  "request to %s %s%s errored - %s",
37895
37935
  method,
37896
37936
  origin,
37897
- path57,
37937
+ path59,
37898
37938
  error63.message
37899
37939
  );
37900
37940
  }
@@ -38009,7 +38049,7 @@ var require_request = __commonJS({
38009
38049
  var kHandler = /* @__PURE__ */ Symbol("handler");
38010
38050
  var Request2 = class {
38011
38051
  constructor(origin, {
38012
- path: path57,
38052
+ path: path59,
38013
38053
  method,
38014
38054
  body,
38015
38055
  headers,
@@ -38026,11 +38066,11 @@ var require_request = __commonJS({
38026
38066
  maxRedirections,
38027
38067
  typeOfService
38028
38068
  }, handler) {
38029
- if (typeof path57 !== "string") {
38069
+ if (typeof path59 !== "string") {
38030
38070
  throw new InvalidArgumentError2("path must be a string");
38031
- } else if (path57[0] !== "/" && !(path57.startsWith("http://") || path57.startsWith("https://")) && method !== "CONNECT") {
38071
+ } else if (path59[0] !== "/" && !(path59.startsWith("http://") || path59.startsWith("https://")) && method !== "CONNECT") {
38032
38072
  throw new InvalidArgumentError2("path must be an absolute URL or start with a slash");
38033
- } else if (invalidPathRegex.test(path57)) {
38073
+ } else if (invalidPathRegex.test(path59)) {
38034
38074
  throw new InvalidArgumentError2("invalid request path");
38035
38075
  }
38036
38076
  if (typeof method !== "string") {
@@ -38105,7 +38145,7 @@ var require_request = __commonJS({
38105
38145
  this.completed = false;
38106
38146
  this.aborted = false;
38107
38147
  this.upgrade = upgrade || null;
38108
- this.path = query ? serializePathWithQuery(path57, query) : path57;
38148
+ this.path = query ? serializePathWithQuery(path59, query) : path59;
38109
38149
  this.origin = origin;
38110
38150
  this.protocol = getProtocolFromUrlString(origin);
38111
38151
  this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent;
@@ -43287,7 +43327,7 @@ var require_client_h1 = __commonJS({
43287
43327
  return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT";
43288
43328
  }
43289
43329
  function writeH1(client, request7) {
43290
- const { method, path: path57, host, upgrade, blocking, reset } = request7;
43330
+ const { method, path: path59, host, upgrade, blocking, reset } = request7;
43291
43331
  let { body, headers, contentLength } = request7;
43292
43332
  const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH";
43293
43333
  if (util2.isFormDataLike(body)) {
@@ -43365,7 +43405,7 @@ var require_client_h1 = __commonJS({
43365
43405
  if (socket.setTypeOfService) {
43366
43406
  socket.setTypeOfService(request7.typeOfService);
43367
43407
  }
43368
- let header = `${method} ${path57} HTTP/1.1\r
43408
+ let header = `${method} ${path59} HTTP/1.1\r
43369
43409
  `;
43370
43410
  if (typeof host === "string") {
43371
43411
  header += `host: ${host}\r
@@ -44044,7 +44084,7 @@ var require_client_h2 = __commonJS({
44044
44084
  const headersTimeout = request7.headersTimeout ?? client[kHeadersTimeout];
44045
44085
  const bodyTimeout = request7.bodyTimeout ?? client[kBodyTimeout];
44046
44086
  const session = client[kHTTP2Session];
44047
- const { method, path: path57, host, upgrade, expectContinue, signal, protocol, headers: reqHeaders } = request7;
44087
+ const { method, path: path59, host, upgrade, expectContinue, signal, protocol, headers: reqHeaders } = request7;
44048
44088
  let { body } = request7;
44049
44089
  if (upgrade != null && upgrade !== "websocket") {
44050
44090
  util2.errorRequest(client, request7, new InvalidArgumentError2(`Custom upgrade "${upgrade}" not supported over HTTP/2`));
@@ -44113,7 +44153,7 @@ var require_client_h2 = __commonJS({
44113
44153
  }
44114
44154
  headers[HTTP2_HEADER_METHOD] = "CONNECT";
44115
44155
  headers[HTTP2_HEADER_PROTOCOL] = "websocket";
44116
- headers[HTTP2_HEADER_PATH] = path57;
44156
+ headers[HTTP2_HEADER_PATH] = path59;
44117
44157
  if (protocol === "ws:" || protocol === "wss:") {
44118
44158
  headers[HTTP2_HEADER_SCHEME] = protocol === "ws:" ? "http" : "https";
44119
44159
  } else {
@@ -44155,7 +44195,7 @@ var require_client_h2 = __commonJS({
44155
44195
  stream.setTimeout(headersTimeout);
44156
44196
  return true;
44157
44197
  }
44158
- headers[HTTP2_HEADER_PATH] = path57;
44198
+ headers[HTTP2_HEADER_PATH] = path59;
44159
44199
  headers[HTTP2_HEADER_SCHEME] = protocol === "http:" ? "http" : "https";
44160
44200
  const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH";
44161
44201
  if (body && typeof body.read === "function") {
@@ -46507,10 +46547,10 @@ var require_proxy_agent = __commonJS({
46507
46547
  };
46508
46548
  const {
46509
46549
  origin,
46510
- path: path57 = "/",
46550
+ path: path59 = "/",
46511
46551
  headers = {}
46512
46552
  } = opts;
46513
- opts.path = origin + path57;
46553
+ opts.path = origin + path59;
46514
46554
  if (!("host" in headers) && !("Host" in headers)) {
46515
46555
  const { host } = new URL(origin);
46516
46556
  headers.host = host;
@@ -48619,20 +48659,20 @@ var require_mock_utils = __commonJS({
48619
48659
  }
48620
48660
  return normalizedQp;
48621
48661
  }
48622
- function safeUrl(path57) {
48623
- if (typeof path57 !== "string") {
48624
- return path57;
48662
+ function safeUrl(path59) {
48663
+ if (typeof path59 !== "string") {
48664
+ return path59;
48625
48665
  }
48626
- const pathSegments = path57.split("?", 3);
48666
+ const pathSegments = path59.split("?", 3);
48627
48667
  if (pathSegments.length !== 2) {
48628
- return path57;
48668
+ return path59;
48629
48669
  }
48630
48670
  const qp2 = new URLSearchParams(pathSegments.pop());
48631
48671
  qp2.sort();
48632
48672
  return [...pathSegments, qp2.toString()].join("?");
48633
48673
  }
48634
- function matchKey(mockDispatch2, { path: path57, method, body, headers }) {
48635
- const pathMatch = matchValue(mockDispatch2.path, path57);
48674
+ function matchKey(mockDispatch2, { path: path59, method, body, headers }) {
48675
+ const pathMatch = matchValue(mockDispatch2.path, path59);
48636
48676
  const methodMatch = matchValue(mockDispatch2.method, method);
48637
48677
  const bodyMatch = typeof mockDispatch2.body !== "undefined" ? matchValue(mockDispatch2.body, body) : true;
48638
48678
  const headersMatch = matchHeaders(mockDispatch2, headers);
@@ -48657,8 +48697,8 @@ var require_mock_utils = __commonJS({
48657
48697
  const basePath = key.query ? serializePathWithQuery(key.path, key.query) : key.path;
48658
48698
  const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath;
48659
48699
  const resolvedPathWithoutTrailingSlash = removeTrailingSlash(resolvedPath);
48660
- let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path57, ignoreTrailingSlash }) => {
48661
- return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(path57)), resolvedPathWithoutTrailingSlash) : matchValue(safeUrl(path57), resolvedPath);
48700
+ let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path59, ignoreTrailingSlash }) => {
48701
+ return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(path59)), resolvedPathWithoutTrailingSlash) : matchValue(safeUrl(path59), resolvedPath);
48662
48702
  });
48663
48703
  if (matchedMockDispatches.length === 0) {
48664
48704
  throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`);
@@ -48697,19 +48737,19 @@ var require_mock_utils = __commonJS({
48697
48737
  mockDispatches.splice(index, 1);
48698
48738
  }
48699
48739
  }
48700
- function removeTrailingSlash(path57) {
48701
- while (path57.endsWith("/")) {
48702
- path57 = path57.slice(0, -1);
48740
+ function removeTrailingSlash(path59) {
48741
+ while (path59.endsWith("/")) {
48742
+ path59 = path59.slice(0, -1);
48703
48743
  }
48704
- if (path57.length === 0) {
48705
- path57 = "/";
48744
+ if (path59.length === 0) {
48745
+ path59 = "/";
48706
48746
  }
48707
- return path57;
48747
+ return path59;
48708
48748
  }
48709
48749
  function buildKey(opts) {
48710
- const { path: path57, method, body, headers, query } = opts;
48750
+ const { path: path59, method, body, headers, query } = opts;
48711
48751
  return {
48712
- path: path57,
48752
+ path: path59,
48713
48753
  method,
48714
48754
  body,
48715
48755
  headers,
@@ -49399,10 +49439,10 @@ var require_pending_interceptors_formatter = __commonJS({
49399
49439
  }
49400
49440
  format(pendingInterceptors) {
49401
49441
  const withPrettyHeaders = pendingInterceptors.map(
49402
- ({ method, path: path57, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
49442
+ ({ method, path: path59, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
49403
49443
  Method: method,
49404
49444
  Origin: origin,
49405
- Path: path57,
49445
+ Path: path59,
49406
49446
  "Status code": statusCode,
49407
49447
  Persistent: persist ? PERSISTENT : NOT_PERSISTENT,
49408
49448
  Invocations: timesInvoked,
@@ -49484,9 +49524,9 @@ var require_mock_agent = __commonJS({
49484
49524
  const acceptNonStandardSearchParameters = this[kMockAgentAcceptsNonStandardSearchParameters];
49485
49525
  const dispatchOpts = { ...opts };
49486
49526
  if (acceptNonStandardSearchParameters && dispatchOpts.path) {
49487
- const [path57, searchParams] = dispatchOpts.path.split("?");
49527
+ const [path59, searchParams] = dispatchOpts.path.split("?");
49488
49528
  const normalizedSearchParams = normalizeSearchParams(searchParams, acceptNonStandardSearchParameters);
49489
- dispatchOpts.path = `${path57}?${normalizedSearchParams}`;
49529
+ dispatchOpts.path = `${path59}?${normalizedSearchParams}`;
49490
49530
  }
49491
49531
  return this[kAgent].dispatch(dispatchOpts, handler);
49492
49532
  }
@@ -49887,12 +49927,12 @@ var require_snapshot_recorder = __commonJS({
49887
49927
  * @return {Promise<void>} - Resolves when snapshots are loaded
49888
49928
  */
49889
49929
  async loadSnapshots(filePath) {
49890
- const path57 = filePath || this.#snapshotPath;
49891
- if (!path57) {
49930
+ const path59 = filePath || this.#snapshotPath;
49931
+ if (!path59) {
49892
49932
  throw new InvalidArgumentError2("Snapshot path is required");
49893
49933
  }
49894
49934
  try {
49895
- const data = await readFile(resolve2(path57), "utf8");
49935
+ const data = await readFile(resolve2(path59), "utf8");
49896
49936
  const parsed = JSON.parse(data);
49897
49937
  if (Array.isArray(parsed)) {
49898
49938
  this.#snapshots.clear();
@@ -49906,7 +49946,7 @@ var require_snapshot_recorder = __commonJS({
49906
49946
  if (error63.code === "ENOENT") {
49907
49947
  this.#snapshots.clear();
49908
49948
  } else {
49909
- throw new UndiciError(`Failed to load snapshots from ${path57}`, { cause: error63 });
49949
+ throw new UndiciError(`Failed to load snapshots from ${path59}`, { cause: error63 });
49910
49950
  }
49911
49951
  }
49912
49952
  }
@@ -49917,11 +49957,11 @@ var require_snapshot_recorder = __commonJS({
49917
49957
  * @returns {Promise<void>} - Resolves when snapshots are saved
49918
49958
  */
49919
49959
  async saveSnapshots(filePath) {
49920
- const path57 = filePath || this.#snapshotPath;
49921
- if (!path57) {
49960
+ const path59 = filePath || this.#snapshotPath;
49961
+ if (!path59) {
49922
49962
  throw new InvalidArgumentError2("Snapshot path is required");
49923
49963
  }
49924
- const resolvedPath = resolve2(path57);
49964
+ const resolvedPath = resolve2(path59);
49925
49965
  await mkdir(dirname3(resolvedPath), { recursive: true });
49926
49966
  const data = Array.from(this.#snapshots.entries()).map(([hash2, snapshot]) => ({
49927
49967
  hash: hash2,
@@ -50553,15 +50593,15 @@ var require_redirect_handler = __commonJS({
50553
50593
  return;
50554
50594
  }
50555
50595
  const { origin, pathname, search } = util2.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)));
50556
- const path57 = search ? `${pathname}${search}` : pathname;
50557
- const redirectUrlString = `${origin}${path57}`;
50596
+ const path59 = search ? `${pathname}${search}` : pathname;
50597
+ const redirectUrlString = `${origin}${path59}`;
50558
50598
  for (const historyUrl of this.history) {
50559
50599
  if (historyUrl.toString() === redirectUrlString) {
50560
50600
  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.`);
50561
50601
  }
50562
50602
  }
50563
50603
  this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin);
50564
- this.opts.path = path57;
50604
+ this.opts.path = path59;
50565
50605
  this.opts.origin = origin;
50566
50606
  this.opts.query = null;
50567
50607
  }
@@ -52321,10 +52361,10 @@ var require_cache_handler = __commonJS({
52321
52361
  }
52322
52362
  return locationUrl.pathname + locationUrl.search;
52323
52363
  }
52324
- function deleteCachedUri(store, cacheKey, path57) {
52364
+ function deleteCachedUri(store, cacheKey, path59) {
52325
52365
  deleteCachedValue(store, {
52326
52366
  ...cacheKey,
52327
- path: path57
52367
+ path: path59
52328
52368
  });
52329
52369
  for (let i10 = 0; i10 < util2.safeHTTPMethods.length; i10++) {
52330
52370
  const method = util2.safeHTTPMethods[i10];
@@ -52332,7 +52372,7 @@ var require_cache_handler = __commonJS({
52332
52372
  deleteCachedValue(store, {
52333
52373
  ...cacheKey,
52334
52374
  method,
52335
- path: path57
52375
+ path: path59
52336
52376
  });
52337
52377
  }
52338
52378
  }
@@ -52343,9 +52383,9 @@ var require_cache_handler = __commonJS({
52343
52383
  }
52344
52384
  const values = Array.isArray(headerValue2) ? headerValue2 : [headerValue2];
52345
52385
  for (let i10 = 0; i10 < values.length; i10++) {
52346
- const path57 = getSameOriginPath(cacheKey, values[i10]);
52347
- if (path57 !== void 0) {
52348
- deleteCachedUri(store, cacheKey, path57);
52386
+ const path59 = getSameOriginPath(cacheKey, values[i10]);
52387
+ if (path59 !== void 0) {
52388
+ deleteCachedUri(store, cacheKey, path59);
52349
52389
  }
52350
52390
  }
52351
52391
  }
@@ -57345,11 +57385,11 @@ var require_fetch = __commonJS({
57345
57385
  function dispatch({ body }) {
57346
57386
  const url2 = requestCurrentURL(request7);
57347
57387
  const agent = fetchParams.controller.dispatcher;
57348
- const path57 = url2.pathname + url2.search;
57388
+ const path59 = url2.pathname + url2.search;
57349
57389
  const hasTrailingQuestionMark = url2.search.length === 0 && url2.href[url2.href.length - url2.hash.length - 1] === "?";
57350
57390
  return new Promise((resolve2, reject) => agent.dispatch(
57351
57391
  {
57352
- path: hasTrailingQuestionMark ? `${path57}?` : path57,
57392
+ path: hasTrailingQuestionMark ? `${path59}?` : path59,
57353
57393
  origin: url2.origin,
57354
57394
  method: request7.method,
57355
57395
  body: agent.isMockActive ? request7.body && (request7.body.source || request7.body.stream) : body,
@@ -58296,9 +58336,9 @@ var require_util5 = __commonJS({
58296
58336
  }
58297
58337
  }
58298
58338
  }
58299
- function validateCookiePath(path57) {
58300
- for (let i10 = 0; i10 < path57.length; ++i10) {
58301
- const code = path57.charCodeAt(i10);
58339
+ function validateCookiePath(path59) {
58340
+ for (let i10 = 0; i10 < path59.length; ++i10) {
58341
+ const code = path59.charCodeAt(i10);
58302
58342
  if (code < 32 || // exclude CTLs (0-31)
58303
58343
  code > 126 || // exclude DEL and non-ascii
58304
58344
  code === 59) {
@@ -61646,11 +61686,11 @@ var require_undici = __commonJS({
61646
61686
  if (typeof opts.path !== "string") {
61647
61687
  throw new InvalidArgumentError2("invalid opts.path");
61648
61688
  }
61649
- let path57 = opts.path;
61689
+ let path59 = opts.path;
61650
61690
  if (!opts.path.startsWith("/")) {
61651
- path57 = `/${path57}`;
61691
+ path59 = `/${path59}`;
61652
61692
  }
61653
- url2 = new URL(util2.parseOrigin(url2).origin + path57);
61693
+ url2 = new URL(util2.parseOrigin(url2).origin + path59);
61654
61694
  } else {
61655
61695
  if (!opts) {
61656
61696
  opts = typeof url2 === "object" ? url2 : {};
@@ -61950,14 +61990,14 @@ request.on("error", (error) => finish(failed, (error.code ? error.code + ": " :
61950
61990
 
61951
61991
  // src/frontdoor/trust.ts
61952
61992
  function resolveTrustBundle(params) {
61953
- const { caCertFile, bundlesDir, variable, inherited, fs: fs22 } = params;
61993
+ const { caCertFile, bundlesDir, variable, inherited, fs: fs23 } = params;
61954
61994
  if (inherited === void 0 || inherited === "" || import_node_path35.default.resolve(inherited) === import_node_path35.default.resolve(caCertFile)) {
61955
61995
  return { path: caCertFile };
61956
61996
  }
61957
- const caPem = fs22.readFileUtf8(caCertFile);
61997
+ const caPem = fs23.readFileUtf8(caCertFile);
61958
61998
  let inheritedPem;
61959
61999
  try {
61960
- inheritedPem = fs22.readFileUtf8(inherited);
62000
+ inheritedPem = fs23.readFileUtf8(inherited);
61961
62001
  } catch (error63) {
61962
62002
  return {
61963
62003
  path: caCertFile,
@@ -61970,9 +62010,9 @@ function resolveTrustBundle(params) {
61970
62010
  const combined = `${inheritedPem.trimEnd()}
61971
62011
  ${caPem}`;
61972
62012
  const bundle = import_node_path35.default.join(bundlesDir, `${(0, import_node_crypto11.createHash)("sha256").update(combined).digest("hex").slice(0, BUNDLE_NAME_HEX_DIGITS)}.pem`);
61973
- if (!fs22.exists(bundle)) {
61974
- fs22.mkdirp(bundlesDir);
61975
- fs22.writeFileAtomic(bundle, combined);
62013
+ if (!fs23.exists(bundle)) {
62014
+ fs23.mkdirp(bundlesDir);
62015
+ fs23.writeFileAtomic(bundle, combined);
61976
62016
  }
61977
62017
  return { path: bundle };
61978
62018
  }
@@ -62135,20 +62175,20 @@ function lockHolder(contents) {
62135
62175
  const pid = Number((contents ?? "").trim());
62136
62176
  return Number.isInteger(pid) && pid > 0 ? pid : void 0;
62137
62177
  }
62138
- function acquireUpdateLock(fs22, isProcessAlive, pid, lockPath) {
62139
- const take = () => fs22.writeFileExclusive(lockPath, `${String(pid)}
62178
+ function acquireUpdateLock(fs23, isProcessAlive, pid, lockPath) {
62179
+ const take = () => fs23.writeFileExclusive(lockPath, `${String(pid)}
62140
62180
  `);
62141
62181
  const release = () => {
62142
- fs22.unlink(lockPath);
62182
+ fs23.unlink(lockPath);
62143
62183
  };
62144
62184
  if (take()) {
62145
62185
  return release;
62146
62186
  }
62147
- const holder = lockHolder(fs22.readFileUtf8(lockPath));
62187
+ const holder = lockHolder(fs23.readFileUtf8(lockPath));
62148
62188
  if (holder !== void 0 && holder !== pid && isProcessAlive(holder)) {
62149
62189
  throw new UpdateConflictError(`another agent-shim update (pid ${String(holder)}) is already running`);
62150
62190
  }
62151
- fs22.unlink(lockPath);
62191
+ fs23.unlink(lockPath);
62152
62192
  if (!take()) {
62153
62193
  throw new UpdateConflictError("another agent-shim update took the lock while it was being replaced");
62154
62194
  }
@@ -62400,10 +62440,25 @@ var init_anthropicUsageRefresh = __esm({
62400
62440
  });
62401
62441
 
62402
62442
  // src/ownCli.ts
62443
+ function agentShimCliPath(distDir = typeof __AGENT_SHIM_DIST_DIR__ === "string" ? __AGENT_SHIM_DIST_DIR__ : void 0) {
62444
+ if (distDir === void 0) {
62445
+ throw new OwnCliPathUnknownError();
62446
+ }
62447
+ return import_node_path38.default.join(distDir, OWN_CLI_FILE_NAME);
62448
+ }
62449
+ var import_node_path38, OWN_CLI_FILE_NAME, OwnCliPathUnknownError;
62403
62450
  var init_ownCli = __esm({
62404
62451
  "src/ownCli.ts"() {
62405
62452
  "use strict";
62453
+ import_node_path38 = __toESM(require("node:path"), 1);
62406
62454
  init_cliError();
62455
+ OWN_CLI_FILE_NAME = "cli.cjs";
62456
+ OwnCliPathUnknownError = class extends CliError {
62457
+ constructor() {
62458
+ super("this agent-shim build does not record where it was loaded from, so the path of its command line bundle is unknown: pass the path of the agent-shim executable explicitly");
62459
+ this.name = "OwnCliPathUnknownError";
62460
+ }
62461
+ };
62407
62462
  }
62408
62463
  });
62409
62464
 
@@ -62759,7 +62814,7 @@ function buildEnv(params) {
62759
62814
  const parentCustomHeaders = params.baseEnv.ANTHROPIC_CUSTOM_HEADERS;
62760
62815
  let providerCustomHeaders;
62761
62816
  if (!params.configDirEscapeHatch && params.resolvedIdentityName !== void 0) {
62762
- env.CLAUDE_CONFIG_DIR = import_node_path38.default.join(params.identitiesDir, params.resolvedIdentityName);
62817
+ env.CLAUDE_CONFIG_DIR = import_node_path39.default.join(params.identitiesDir, params.resolvedIdentityName);
62763
62818
  }
62764
62819
  if (params.provider !== void 0) {
62765
62820
  const providerEnv = params.provider.definition.env ?? {};
@@ -62803,11 +62858,11 @@ function buildEnv(params) {
62803
62858
  }
62804
62859
  return env;
62805
62860
  }
62806
- var import_node_path38, LOOPBACK_HOSTS;
62861
+ var import_node_path39, LOOPBACK_HOSTS;
62807
62862
  var init_flags = __esm({
62808
62863
  "src/launcher/flags.ts"() {
62809
62864
  "use strict";
62810
- import_node_path38 = __toESM(require("node:path"), 1);
62865
+ import_node_path39 = __toESM(require("node:path"), 1);
62811
62866
  init_envBool();
62812
62867
  init_credential();
62813
62868
  init_headers();
@@ -62862,6 +62917,7 @@ function resolvePoolLaunch(params) {
62862
62917
  poolName,
62863
62918
  nowMs,
62864
62919
  resuming,
62920
+ ...params.resumeContextTokens === void 0 ? {} : { resumeContextTokens: params.resumeContextTokens },
62865
62921
  identityExists: (name) => loadIdentity(params.paths.identitiesDir, name, params.fs) !== void 0,
62866
62922
  ...stickyRead.sticky === void 0 ? {} : { sticky: stickyRead.sticky }
62867
62923
  });
@@ -62932,6 +62988,91 @@ var init_pool = __esm({
62932
62988
  }
62933
62989
  });
62934
62990
 
62991
+ // src/usage/resumeContext.ts
62992
+ function projectDirNameOf(cwd) {
62993
+ return cwd.replace(/[^A-Za-z0-9]/g, "-");
62994
+ }
62995
+ function resumeTargetOf(passthrough) {
62996
+ const end = passthrough.indexOf("--");
62997
+ const tokens = end === -1 ? passthrough : passthrough.slice(0, end);
62998
+ for (const [index, token] of tokens.entries()) {
62999
+ if (token === "--continue" || token === "-c") {
63000
+ return { kind: "latest" };
63001
+ }
63002
+ if (token === "--resume" || token === "-r") {
63003
+ const next = tokens[index + 1];
63004
+ return next === void 0 || next.startsWith("-") ? void 0 : { kind: "id", id: next };
63005
+ }
63006
+ if (token.startsWith("--resume=")) {
63007
+ const id2 = token.slice("--resume=".length);
63008
+ return id2 === "" ? void 0 : { kind: "id", id: id2 };
63009
+ }
63010
+ }
63011
+ return void 0;
63012
+ }
63013
+ function countOf(usage, key) {
63014
+ const value2 = key in usage ? Reflect.get(usage, key) : void 0;
63015
+ return typeof value2 === "number" && Number.isFinite(value2) && value2 >= 0 ? value2 : 0;
63016
+ }
63017
+ function contextTokensOfTranscript(text2) {
63018
+ const lines = text2.split("\n");
63019
+ for (let index = lines.length - 1; index >= 0; index -= 1) {
63020
+ const line = lines[index];
63021
+ if (line === void 0 || line === "") {
63022
+ continue;
63023
+ }
63024
+ let parsed;
63025
+ try {
63026
+ parsed = JSON.parse(line);
63027
+ } catch {
63028
+ continue;
63029
+ }
63030
+ if (typeof parsed !== "object" || parsed === null || !("type" in parsed) || parsed.type !== "assistant" || !("message" in parsed)) {
63031
+ continue;
63032
+ }
63033
+ const { message } = parsed;
63034
+ if (typeof message !== "object" || message === null || !("usage" in message) || typeof message.usage !== "object" || message.usage === null) {
63035
+ continue;
63036
+ }
63037
+ const { usage } = message;
63038
+ return countOf(usage, "input_tokens") + countOf(usage, "cache_read_input_tokens") + countOf(usage, "cache_creation_input_tokens");
63039
+ }
63040
+ return void 0;
63041
+ }
63042
+ function resumedContextTokens(fs23, params) {
63043
+ const target = resumeTargetOf(params.passthrough);
63044
+ if (target === void 0) {
63045
+ return void 0;
63046
+ }
63047
+ const projectDir = import_node_path40.default.join(params.claudeHome, "projects", projectDirNameOf(params.cwd));
63048
+ let file2;
63049
+ if (target.kind === "id") {
63050
+ file2 = import_node_path40.default.join(projectDir, `${target.id}.jsonl`);
63051
+ } else {
63052
+ let newestMs = -Infinity;
63053
+ for (const name of fs23.readdir(projectDir)) {
63054
+ if (!name.endsWith(".jsonl")) {
63055
+ continue;
63056
+ }
63057
+ const candidate = import_node_path40.default.join(projectDir, name);
63058
+ const stat = fs23.lstat(candidate);
63059
+ if (stat?.kind === "file" && stat.mtimeMs > newestMs) {
63060
+ newestMs = stat.mtimeMs;
63061
+ file2 = candidate;
63062
+ }
63063
+ }
63064
+ }
63065
+ const text2 = file2 === void 0 ? void 0 : fs23.readFileUtf8(file2);
63066
+ return text2 === void 0 ? void 0 : contextTokensOfTranscript(text2);
63067
+ }
63068
+ var import_node_path40;
63069
+ var init_resumeContext = __esm({
63070
+ "src/usage/resumeContext.ts"() {
63071
+ "use strict";
63072
+ import_node_path40 = __toESM(require("node:path"), 1);
63073
+ }
63074
+ });
63075
+
62935
63076
  // src/launcher/spawn.ts
62936
63077
  function childExitCode(result) {
62937
63078
  if (result.status !== null) {
@@ -63039,7 +63180,7 @@ function resolveIdentityCredential(identity, credential, env, port) {
63039
63180
  return resolution.ok ? resolution : { ok: false, status: CREDENTIAL_UNAVAILABLE_EXIT, message: resolution.message };
63040
63181
  }
63041
63182
  function pickFromPool(decided, params, parsedArgv, readOnly) {
63042
- const { paths, fs: fs22, proc, log } = params;
63183
+ const { paths, fs: fs23, proc, log } = params;
63043
63184
  if (decided.pool === void 0) {
63044
63185
  return { identityDecision: decided };
63045
63186
  }
@@ -63048,17 +63189,19 @@ function pickFromPool(decided, params, parsedArgv, readOnly) {
63048
63189
  log.error(`agent-shim: pool "${decided.pool}" was selected, but this launcher has no farm wired to read usage and pick a member with.`);
63049
63190
  return proc.exit(1);
63050
63191
  }
63192
+ const resumeContextTokens = resumedContextTokens(farmRuntime.fs, { claudeHome: farmRuntime.claudeHome, cwd: farmRuntime.cwd, passthrough: parsedArgv.rest });
63051
63193
  const resolution = resolvePoolLaunch({
63052
63194
  poolName: decided.pool,
63053
63195
  selectedVia: decided.source,
63054
63196
  pools: params.pools,
63055
63197
  paths,
63056
- fs: fs22,
63198
+ fs: fs23,
63057
63199
  usageFs: farmRuntime.fs,
63058
63200
  cwd: farmRuntime.cwd,
63059
63201
  now: farmRuntime.now,
63060
63202
  sleep: farmRuntime.lock.sleep,
63061
63203
  passthrough: parsedArgv.rest,
63204
+ ...resumeContextTokens === void 0 ? {} : { resumeContextTokens },
63062
63205
  // A read-only decision never sleeps for a refused pool and never records its pick, so asking what a launch would pick leaves the next real launch's keep-warm preference as it was.
63063
63206
  wait: !readOnly && parsedArgv.wait === true,
63064
63207
  recordPick: !readOnly,
@@ -63075,7 +63218,7 @@ function pickFromPool(decided, params, parsedArgv, readOnly) {
63075
63218
  };
63076
63219
  }
63077
63220
  function decideLaunch(params, readOnly) {
63078
- const { paths, fs: fs22, proc, log } = params;
63221
+ const { paths, fs: fs23, proc, log } = params;
63079
63222
  const { env, argv } = proc;
63080
63223
  const parsedArgv = parseLauncherArgv(argv);
63081
63224
  const cliOverride = buildCliOverride({
@@ -63090,7 +63233,7 @@ function decideLaunch(params, readOnly) {
63090
63233
  argv0Identity: parsedArgv.identity,
63091
63234
  directoryPinnedIdentity: params.directoryPinnedIdentity,
63092
63235
  readActiveIdentityFile: () => {
63093
- const raw = fs22.readFileUtf8(paths.activeIdentityFile);
63236
+ const raw = fs23.readFileUtf8(paths.activeIdentityFile);
63094
63237
  if (raw === void 0) {
63095
63238
  return void 0;
63096
63239
  }
@@ -63125,7 +63268,7 @@ function decideLaunch(params, readOnly) {
63125
63268
  }
63126
63269
  let loadedIdentity;
63127
63270
  if (identityDecision.name !== void 0) {
63128
- loadedIdentity = loadIdentity(paths.identitiesDir, identityDecision.name, fs22);
63271
+ loadedIdentity = loadIdentity(paths.identitiesDir, identityDecision.name, fs23);
63129
63272
  if (loadedIdentity === void 0) {
63130
63273
  log.error(
63131
63274
  `agent-shim: no identity named "${identityDecision.name}" (selected via ${identityDecision.source}). Run \`agent-shim identity add ${identityDecision.name}\` first.`
@@ -63140,7 +63283,7 @@ function decideLaunch(params, readOnly) {
63140
63283
  identityDefaultConfigProfile: loadedIdentity?.config.defaultConfigProfile,
63141
63284
  globalDefaultConfigProfile: params.globalDefaultConfigProfile
63142
63285
  });
63143
- if (configProfileDecision.name !== void 0 && params.allowMissingConfigProfile !== true && fs22.readConfigFile(import_node_path39.default.join(paths.configProfilesDir, `${configProfileDecision.name}.json`)) === void 0) {
63286
+ if (configProfileDecision.name !== void 0 && params.allowMissingConfigProfile !== true && fs23.readConfigFile(import_node_path41.default.join(paths.configProfilesDir, `${configProfileDecision.name}.json`)) === void 0) {
63144
63287
  log.error(
63145
63288
  `agent-shim: no configuration profile named "${configProfileDecision.name}" (selected via ${configProfileDecision.source}). Run \`agent-shim profile add ${configProfileDecision.name}\` first.`
63146
63289
  );
@@ -63149,7 +63292,7 @@ function decideLaunch(params, readOnly) {
63149
63292
  const farmContext = farm !== void 0 && farmIdentity !== void 0 ? { farm, identity: farmIdentity, cascade: farm.loadCascade(configProfileDecision.name, cliOverride) } : void 0;
63150
63293
  const providerParams = {
63151
63294
  paths,
63152
- port: fs22,
63295
+ port: fs23,
63153
63296
  ...parsedArgv.provider === void 0 || parsedArgv.provider === false ? {} : { cliProvider: parsedArgv.provider },
63154
63297
  ...farmContext === void 0 ? {} : { cascade: farmContext.cascade }
63155
63298
  };
@@ -63250,7 +63393,7 @@ function decideLaunch(params, readOnly) {
63250
63393
  extraFlags: splitExtraFlags(env.CLAUDE_EXTRA_FLAGS),
63251
63394
  passthrough: parsedArgv.rest
63252
63395
  });
63253
- const configDir = configDirEscapeHatchApplies || identityDecision.name === void 0 ? env.CLAUDE_CONFIG_DIR : import_node_path39.default.join(paths.identitiesDir, identityDecision.name);
63396
+ const configDir = configDirEscapeHatchApplies || identityDecision.name === void 0 ? env.CLAUDE_CONFIG_DIR : import_node_path41.default.join(paths.identitiesDir, identityDecision.name);
63254
63397
  const decision = {
63255
63398
  identitySource: identityDecision.source,
63256
63399
  configDirEscapeHatch: identityDecision.configDirEscapeHatch,
@@ -63291,7 +63434,7 @@ function prepareLaunch(params) {
63291
63434
  );
63292
63435
  const updateCheck = runLaunchUpdateCheck({
63293
63436
  mode: params.updateMode ?? "off",
63294
- checkPath: import_node_path39.default.join(paths.root, "update.check"),
63437
+ checkPath: import_node_path41.default.join(paths.root, "update.check"),
63295
63438
  currentVersion: package_default.version,
63296
63439
  port: params.update
63297
63440
  });
@@ -63422,12 +63565,12 @@ function runLaunchPlan(plan, spawn5) {
63422
63565
  function runLauncher(params) {
63423
63566
  params.proc.exit(runLaunchPlan(prepareLaunch(params), params.spawn));
63424
63567
  }
63425
- var import_node_crypto14, import_node_path39;
63568
+ var import_node_crypto14, import_node_path41;
63426
63569
  var init_launcher = __esm({
63427
63570
  "src/launcher.ts"() {
63428
63571
  "use strict";
63429
63572
  import_node_crypto14 = require("node:crypto");
63430
- import_node_path39 = __toESM(require("node:path"), 1);
63573
+ import_node_path41 = __toESM(require("node:path"), 1);
63431
63574
  init_package();
63432
63575
  init_envBool();
63433
63576
  init_argv();
@@ -63438,6 +63581,7 @@ var init_launcher = __esm({
63438
63581
  init_flags();
63439
63582
  init_extraFlags();
63440
63583
  init_pool();
63584
+ init_resumeContext();
63441
63585
  init_lock();
63442
63586
  init_spawn();
63443
63587
  init_providersStore();
@@ -63514,6 +63658,9 @@ function realPrepareLaunchParams(paths, options) {
63514
63658
  ...options.allowMissingConfigProfile === void 0 ? {} : { allowMissingConfigProfile: options.allowMissingConfigProfile }
63515
63659
  };
63516
63660
  }
63661
+ function daemonSpawnerFor(agentShim) {
63662
+ return agentShim === void 0 ? (spawnPaths, subcommand, logPath) => spawnDaemonThroughScript(agentShimCliPath())(spawnPaths, subcommand, logPath) : spawnDaemonThrough(agentShim);
63663
+ }
63517
63664
  function resolveClaudeLaunch(options) {
63518
63665
  const paths = options.paths ?? resolveLayoutPaths();
63519
63666
  const refusals = [];
@@ -78106,7 +78253,7 @@ async function jGe(e14, t10, n10, r10) {
78106
78253
  if (d.length === 0) return [];
78107
78254
  return iv(Buffer.from(gZ(d)), { limit: r10.limit, offset: r10.offset }, l, c10);
78108
78255
  }
78109
- 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_path40, 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;
78256
+ 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_path42, 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;
78110
78257
  var init_sdk = __esm({
78111
78258
  "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"() {
78112
78259
  import_node_module = require("node:module");
@@ -78137,7 +78284,7 @@ var init_sdk = __esm({
78137
78284
  import_path6 = require("path");
78138
78285
  import_promises6 = require("fs/promises");
78139
78286
  import_os4 = require("os");
78140
- import_node_path40 = __toESM(require("node:path"), 1);
78287
+ import_node_path42 = __toESM(require("node:path"), 1);
78141
78288
  import_node_os10 = __toESM(require("node:os"), 1);
78142
78289
  import_node_process5 = __toESM(require("node:process"), 1);
78143
78290
  import_path7 = require("path");
@@ -86588,16 +86735,16 @@ var init_sdk = __esm({
86588
86735
  wS = import_node_os10.default.tmpdir();
86589
86736
  ({ env: Fa } = import_node_process5.default);
86590
86737
  K7 = (e14) => {
86591
- let t10 = import_node_path40.default.join(is, "Library");
86592
- return { data: import_node_path40.default.join(t10, "Application Support", e14), config: import_node_path40.default.join(t10, "Preferences", e14), cache: import_node_path40.default.join(t10, "Caches", e14), log: import_node_path40.default.join(t10, "Logs", e14), temp: import_node_path40.default.join(wS, e14) };
86738
+ let t10 = import_node_path42.default.join(is, "Library");
86739
+ return { data: import_node_path42.default.join(t10, "Application Support", e14), config: import_node_path42.default.join(t10, "Preferences", e14), cache: import_node_path42.default.join(t10, "Caches", e14), log: import_node_path42.default.join(t10, "Logs", e14), temp: import_node_path42.default.join(wS, e14) };
86593
86740
  };
86594
86741
  G7 = (e14) => {
86595
- let t10 = Fa.APPDATA || import_node_path40.default.join(is, "AppData", "Roaming"), n10 = Fa.LOCALAPPDATA || import_node_path40.default.join(is, "AppData", "Local");
86596
- return { data: import_node_path40.default.join(n10, e14, "Data"), config: import_node_path40.default.join(t10, e14, "Config"), cache: import_node_path40.default.join(n10, e14, "Cache"), log: import_node_path40.default.join(n10, e14, "Log"), temp: import_node_path40.default.join(wS, e14) };
86742
+ let t10 = Fa.APPDATA || import_node_path42.default.join(is, "AppData", "Roaming"), n10 = Fa.LOCALAPPDATA || import_node_path42.default.join(is, "AppData", "Local");
86743
+ return { data: import_node_path42.default.join(n10, e14, "Data"), config: import_node_path42.default.join(t10, e14, "Config"), cache: import_node_path42.default.join(n10, e14, "Cache"), log: import_node_path42.default.join(n10, e14, "Log"), temp: import_node_path42.default.join(wS, e14) };
86597
86744
  };
86598
86745
  W7 = (e14) => {
86599
- let t10 = import_node_path40.default.basename(is);
86600
- return { data: import_node_path40.default.join(Fa.XDG_DATA_HOME || import_node_path40.default.join(is, ".local", "share"), e14), config: import_node_path40.default.join(Fa.XDG_CONFIG_HOME || import_node_path40.default.join(is, ".config"), e14), cache: import_node_path40.default.join(Fa.XDG_CACHE_HOME || import_node_path40.default.join(is, ".cache"), e14), log: import_node_path40.default.join(Fa.XDG_STATE_HOME || import_node_path40.default.join(is, ".local", "state"), e14), temp: import_node_path40.default.join(wS, t10, e14) };
86746
+ let t10 = import_node_path42.default.basename(is);
86747
+ return { data: import_node_path42.default.join(Fa.XDG_DATA_HOME || import_node_path42.default.join(is, ".local", "share"), e14), config: import_node_path42.default.join(Fa.XDG_CONFIG_HOME || import_node_path42.default.join(is, ".config"), e14), cache: import_node_path42.default.join(Fa.XDG_CACHE_HOME || import_node_path42.default.join(is, ".cache"), e14), log: import_node_path42.default.join(Fa.XDG_STATE_HOME || import_node_path42.default.join(is, ".local", "state"), e14), temp: import_node_path42.default.join(wS, t10, e14) };
86601
86748
  };
86602
86749
  i5e = OS("claude-cli");
86603
86750
  X7 = 100;
@@ -100650,8 +100797,8 @@ var require_utils3 = __commonJS({
100650
100797
  }
100651
100798
  return ind;
100652
100799
  }
100653
- function removeDotSegments(path57) {
100654
- let input2 = path57;
100800
+ function removeDotSegments(path59) {
100801
+ let input2 = path59;
100655
100802
  const output2 = [];
100656
100803
  let nextSlash = -1;
100657
100804
  let len = 0;
@@ -101060,8 +101207,8 @@ var require_schemes = __commonJS({
101060
101207
  }
101061
101208
  if (wsComponent.resourceName) {
101062
101209
  const queryIndex = wsComponent.resourceName.indexOf("?");
101063
- const path57 = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
101064
- wsComponent.path = path57 && path57 !== "/" ? path57 : void 0;
101210
+ const path59 = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
101211
+ wsComponent.path = path59 && path59 !== "/" ? path59 : void 0;
101065
101212
  wsComponent.query = queryIndex === -1 ? void 0 : wsComponent.resourceName.slice(queryIndex + 1);
101066
101213
  wsComponent.resourceName = void 0;
101067
101214
  }
@@ -104574,12 +104721,12 @@ var require_dist2 = __commonJS({
104574
104721
  throw new Error(`Unknown format "${name}"`);
104575
104722
  return f;
104576
104723
  };
104577
- function addFormats(ajv, list, fs22, exportName) {
104724
+ function addFormats(ajv, list, fs23, exportName) {
104578
104725
  var _a4;
104579
104726
  var _b2;
104580
104727
  (_a4 = (_b2 = ajv.opts.code).formats) !== null && _a4 !== void 0 ? _a4 : _b2.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
104581
104728
  for (const f of list)
104582
- ajv.addFormat(f, fs22[f]);
104729
+ ajv.addFormat(f, fs23[f]);
104583
104730
  }
104584
104731
  module2.exports = exports2 = formatsPlugin;
104585
104732
  Object.defineProperty(exports2, "__esModule", { value: true });
@@ -104588,7 +104735,7 @@ var require_dist2 = __commonJS({
104588
104735
  });
104589
104736
 
104590
104737
  // src/cli.ts
104591
- var import_node_path56 = __toESM(require("node:path"), 1);
104738
+ var import_node_path58 = __toESM(require("node:path"), 1);
104592
104739
 
104593
104740
  // node_modules/.pnpm/commander@15.0.0/node_modules/commander/lib/error.js
104594
104741
  var CommanderError = class extends Error {
@@ -107701,9 +107848,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
107701
107848
  * @param {string} [path]
107702
107849
  * @return {(string|null|Command)}
107703
107850
  */
107704
- executableDir(path57) {
107705
- if (path57 === void 0) return this._executableDir;
107706
- this._executableDir = path57;
107851
+ executableDir(path59) {
107852
+ if (path59 === void 0) return this._executableDir;
107853
+ this._executableDir = path59;
107707
107854
  return this;
107708
107855
  }
107709
107856
  /**
@@ -109352,19 +109499,19 @@ function writePools(paths, pools) {
109352
109499
  applyPatch(paths.globalConfigFile, GlobalConfigSchema, { pools }, { defaults: {} });
109353
109500
  }
109354
109501
  function poolCycleOf(pools, name) {
109355
- const walk = (current, path57) => {
109502
+ const walk = (current, path59) => {
109356
109503
  for (const entry of pools[current]?.identities ?? []) {
109357
109504
  const nested = poolNameOf(poolMemberIdentity(entry));
109358
109505
  if (nested === void 0) {
109359
109506
  continue;
109360
109507
  }
109361
109508
  if (nested === name) {
109362
- return [...path57, nested];
109509
+ return [...path59, nested];
109363
109510
  }
109364
- if (path57.includes(nested)) {
109511
+ if (path59.includes(nested)) {
109365
109512
  continue;
109366
109513
  }
109367
- const found = walk(nested, [...path57, nested]);
109514
+ const found = walk(nested, [...path59, nested]);
109368
109515
  if (found !== void 0) {
109369
109516
  return found;
109370
109517
  }
@@ -112306,8 +112453,8 @@ function registerCodexCommand(program2, deps) {
112306
112453
 
112307
112454
  // src/frontdoor/commands.ts
112308
112455
  var import_node_crypto20 = require("node:crypto");
112309
- var import_node_path49 = __toESM(require("node:path"), 1);
112310
- var import_node_fs17 = __toESM(require("node:fs"), 1);
112456
+ var import_node_path51 = __toESM(require("node:path"), 1);
112457
+ var import_node_fs18 = __toESM(require("node:fs"), 1);
112311
112458
  init_commandDeps();
112312
112459
  init_schema();
112313
112460
  init_conditions();
@@ -112448,17 +112595,17 @@ function parseEntry2(project, entry) {
112448
112595
  const base = match?.[1];
112449
112596
  return base === void 0 ? { project, sessionId: entry, superseded: false, entry } : { project, sessionId: base, superseded: true, entry };
112450
112597
  }
112451
- function listSessions2(fs22, configDir) {
112598
+ function listSessions2(fs23, configDir) {
112452
112599
  const found = [];
112453
- for (const project of fs22.readdir(import_node_path33.default.join(configDir, PROJECTS_DIR))) {
112600
+ for (const project of fs23.readdir(import_node_path33.default.join(configDir, PROJECTS_DIR))) {
112454
112601
  const projectDir = import_node_path33.default.join(configDir, PROJECTS_DIR, project);
112455
112602
  const entries = /* @__PURE__ */ new Set();
112456
- for (const name of fs22.readdir(projectDir)) {
112603
+ for (const name of fs23.readdir(projectDir)) {
112457
112604
  if (name.endsWith(TRANSCRIPT_SUFFIX)) {
112458
112605
  entries.add(name.slice(0, -TRANSCRIPT_SUFFIX.length));
112459
112606
  continue;
112460
112607
  }
112461
- const children = fs22.readdir(import_node_path33.default.join(projectDir, name));
112608
+ const children = fs23.readdir(import_node_path33.default.join(projectDir, name));
112462
112609
  if (children.includes(SUBAGENTS_DIR) || children.includes(WORKFLOWS_DIR)) {
112463
112610
  entries.add(name);
112464
112611
  }
@@ -112469,9 +112616,9 @@ function listSessions2(fs22, configDir) {
112469
112616
  }
112470
112617
  return found.sort((left, right) => left.project.localeCompare(right.project) || left.entry.localeCompare(right.entry));
112471
112618
  }
112472
- function locateAgents(fs22, configDir, relativeDir, workflowRunId, report) {
112619
+ function locateAgents(fs23, configDir, relativeDir, workflowRunId, report) {
112473
112620
  const located = [];
112474
- for (const name of listDirOrReport(fs22, configDir, relativeDir, report)) {
112621
+ for (const name of listDirOrReport(fs23, configDir, relativeDir, report)) {
112475
112622
  if (!name.startsWith(AGENT_FILE_PREFIX) || !name.endsWith(META_SUFFIX)) {
112476
112623
  continue;
112477
112624
  }
@@ -112520,17 +112667,17 @@ function toNode(read, children) {
112520
112667
  function describeFailure(error63) {
112521
112668
  return error63 instanceof Error ? error63.message : String(error63);
112522
112669
  }
112523
- function readFileOrReport(fs22, configDir, relative, report) {
112670
+ function readFileOrReport(fs23, configDir, relative, report) {
112524
112671
  try {
112525
- return fs22.readFileUtf8(import_node_path33.default.join(configDir, relative));
112672
+ return fs23.readFileUtf8(import_node_path33.default.join(configDir, relative));
112526
112673
  } catch (error63) {
112527
112674
  report({ path: relative, reason: `could not be read: ${describeFailure(error63)}` });
112528
112675
  return void 0;
112529
112676
  }
112530
112677
  }
112531
- function listDirOrReport(fs22, configDir, relative, report) {
112678
+ function listDirOrReport(fs23, configDir, relative, report) {
112532
112679
  try {
112533
- return fs22.readdir(import_node_path33.default.join(configDir, relative));
112680
+ return fs23.readdir(import_node_path33.default.join(configDir, relative));
112534
112681
  } catch (error63) {
112535
112682
  report({ path: relative, reason: `could not be listed: ${describeFailure(error63)}` });
112536
112683
  return [];
@@ -112553,22 +112700,22 @@ var WorkflowRunFileSchema = external_exports.object({
112553
112700
  phases: external_exports.array(external_exports.object({ title: external_exports.string() })).default([]),
112554
112701
  summary: external_exports.string().optional()
112555
112702
  });
112556
- function summariseSession(fs22, configDir, ref) {
112703
+ function summariseSession(fs23, configDir, ref) {
112557
112704
  const sessionRelative = import_node_path33.default.join(PROJECTS_DIR, ref.project, ref.entry);
112558
112705
  const subagentsRelative = import_node_path33.default.join(sessionRelative, SUBAGENTS_DIR);
112559
112706
  const workflowsUnderSubagents = import_node_path33.default.join(subagentsRelative, WORKFLOWS_DIR);
112560
112707
  const isMeta = (name) => name.startsWith(AGENT_FILE_PREFIX) && name.endsWith(META_SUFFIX);
112561
- let agentCount = fs22.readdir(import_node_path33.default.join(configDir, subagentsRelative)).filter(isMeta).length;
112562
- for (const runDir of fs22.readdir(import_node_path33.default.join(configDir, workflowsUnderSubagents))) {
112708
+ let agentCount = fs23.readdir(import_node_path33.default.join(configDir, subagentsRelative)).filter(isMeta).length;
112709
+ for (const runDir of fs23.readdir(import_node_path33.default.join(configDir, workflowsUnderSubagents))) {
112563
112710
  if (runDir.startsWith(WORKFLOW_RUN_PREFIX)) {
112564
- agentCount += fs22.readdir(import_node_path33.default.join(configDir, workflowsUnderSubagents, runDir)).filter(isMeta).length;
112711
+ agentCount += fs23.readdir(import_node_path33.default.join(configDir, workflowsUnderSubagents, runDir)).filter(isMeta).length;
112565
112712
  }
112566
112713
  }
112567
- const workflowRunCount = fs22.readdir(import_node_path33.default.join(configDir, sessionRelative, WORKFLOWS_DIR)).filter((name) => name.startsWith(WORKFLOW_RUN_PREFIX) && name.endsWith(JSON_SUFFIX)).length;
112568
- const transcript = fs22.lstat(import_node_path33.default.join(configDir, PROJECTS_DIR, ref.project, `${ref.entry}${TRANSCRIPT_SUFFIX}`));
112714
+ const workflowRunCount = fs23.readdir(import_node_path33.default.join(configDir, sessionRelative, WORKFLOWS_DIR)).filter((name) => name.startsWith(WORKFLOW_RUN_PREFIX) && name.endsWith(JSON_SUFFIX)).length;
112715
+ const transcript = fs23.lstat(import_node_path33.default.join(configDir, PROJECTS_DIR, ref.project, `${ref.entry}${TRANSCRIPT_SUFFIX}`));
112569
112716
  return { ...ref, agentCount, workflowRunCount, ...transcript === void 0 ? {} : { updatedAt: new Date(transcript.mtimeMs).toISOString() } };
112570
112717
  }
112571
- function readSessionAgentTree(fs22, configDir, ref, options = {}) {
112718
+ function readSessionAgentTree(fs23, configDir, ref, options = {}) {
112572
112719
  const problems = [];
112573
112720
  const report = (problem) => {
112574
112721
  problems.push(problem);
@@ -112576,15 +112723,15 @@ function readSessionAgentTree(fs22, configDir, ref, options = {}) {
112576
112723
  const sessionRelative = import_node_path33.default.join(PROJECTS_DIR, ref.project, ref.entry);
112577
112724
  const subagentsRelative = import_node_path33.default.join(sessionRelative, SUBAGENTS_DIR);
112578
112725
  const workflowsUnderSubagents = import_node_path33.default.join(subagentsRelative, WORKFLOWS_DIR);
112579
- const located = locateAgents(fs22, configDir, subagentsRelative, void 0, report);
112580
- for (const runDir of listDirOrReport(fs22, configDir, workflowsUnderSubagents, report)) {
112726
+ const located = locateAgents(fs23, configDir, subagentsRelative, void 0, report);
112727
+ for (const runDir of listDirOrReport(fs23, configDir, workflowsUnderSubagents, report)) {
112581
112728
  if (runDir.startsWith(WORKFLOW_RUN_PREFIX)) {
112582
- located.push(...locateAgents(fs22, configDir, import_node_path33.default.join(workflowsUnderSubagents, runDir), runDir, report));
112729
+ located.push(...locateAgents(fs23, configDir, import_node_path33.default.join(workflowsUnderSubagents, runDir), runDir, report));
112583
112730
  }
112584
112731
  }
112585
112732
  const agents = /* @__PURE__ */ new Map();
112586
112733
  for (const candidate of located) {
112587
- const text2 = readFileOrReport(fs22, configDir, candidate.metaPath, report);
112734
+ const text2 = readFileOrReport(fs23, configDir, candidate.metaPath, report);
112588
112735
  if (text2 === void 0) {
112589
112736
  continue;
112590
112737
  }
@@ -112596,7 +112743,7 @@ function readSessionAgentTree(fs22, configDir, ref, options = {}) {
112596
112743
  agents.set(candidate.id, { located: candidate, meta: parsed.data });
112597
112744
  }
112598
112745
  const teamNames = [...new Set([...agents.values()].flatMap((agent) => agent.meta.teamName === void 0 ? [] : [agent.meta.teamName]))].sort();
112599
- const parentOf4 = resolveParents(fs22, configDir, agents, report);
112746
+ const parentOf4 = resolveParents(fs23, configDir, agents, report);
112600
112747
  const childrenOf = /* @__PURE__ */ new Map();
112601
112748
  const roots = [];
112602
112749
  for (const id2 of agents.keys()) {
@@ -112619,12 +112766,12 @@ function readSessionAgentTree(fs22, configDir, ref, options = {}) {
112619
112766
  sessionId: ref.sessionId,
112620
112767
  superseded: ref.superseded,
112621
112768
  agents: roots.sort().map(build),
112622
- tasks: readTasks(fs22, configDir, ownTaskLists(ref.sessionId), [.../* @__PURE__ */ new Set([...teamNames, ...options.taskListIds ?? []])].filter((id2) => !ownTaskLists(ref.sessionId).includes(id2)), report),
112623
- workflowRuns: readWorkflowRuns(fs22, configDir, import_node_path33.default.join(sessionRelative, WORKFLOWS_DIR), report),
112769
+ tasks: readTasks(fs23, configDir, ownTaskLists(ref.sessionId), [.../* @__PURE__ */ new Set([...teamNames, ...options.taskListIds ?? []])].filter((id2) => !ownTaskLists(ref.sessionId).includes(id2)), report),
112770
+ workflowRuns: readWorkflowRuns(fs23, configDir, import_node_path33.default.join(sessionRelative, WORKFLOWS_DIR), report),
112624
112771
  problems
112625
112772
  };
112626
112773
  }
112627
- function resolveParents(fs22, configDir, agents, report) {
112774
+ function resolveParents(fs23, configDir, agents, report) {
112628
112775
  const parentOf4 = /* @__PURE__ */ new Map();
112629
112776
  const transcriptCache = /* @__PURE__ */ new Map();
112630
112777
  const transcriptOf = (agent) => {
@@ -112632,7 +112779,7 @@ function resolveParents(fs22, configDir, agents, report) {
112632
112779
  if (cached2 !== void 0) {
112633
112780
  return cached2;
112634
112781
  }
112635
- const text2 = readFileOrReport(fs22, configDir, agent.located.transcriptPath, report) ?? "";
112782
+ const text2 = readFileOrReport(fs23, configDir, agent.located.transcriptPath, report) ?? "";
112636
112783
  transcriptCache.set(agent.located.id, text2);
112637
112784
  return text2;
112638
112785
  };
@@ -112682,16 +112829,16 @@ function resolveParents(fs22, configDir, agents, report) {
112682
112829
  function ownTaskLists(sessionId) {
112683
112830
  return [sessionId, `${SHORT_SESSION_LIST_PREFIX}${sessionId.slice(0, SHORT_SESSION_ID_LENGTH)}`];
112684
112831
  }
112685
- function readTasks(fs22, configDir, ownLists, sharedLists, report) {
112832
+ function readTasks(fs23, configDir, ownLists, sharedLists, report) {
112686
112833
  const tasks = [];
112687
112834
  [...ownLists, ...sharedLists].forEach((scope, index) => {
112688
112835
  const relativeDir = import_node_path33.default.join(TASKS_DIR, scope);
112689
- for (const name of [...listDirOrReport(fs22, configDir, relativeDir, report)].sort()) {
112836
+ for (const name of [...listDirOrReport(fs23, configDir, relativeDir, report)].sort()) {
112690
112837
  if (name.startsWith(".") || !name.endsWith(JSON_SUFFIX)) {
112691
112838
  continue;
112692
112839
  }
112693
112840
  const relative = import_node_path33.default.join(relativeDir, name);
112694
- const text2 = readFileOrReport(fs22, configDir, relative, report);
112841
+ const text2 = readFileOrReport(fs23, configDir, relative, report);
112695
112842
  const parsed = TaskFileSchema.safeParse(text2 === void 0 ? void 0 : parseJson3(text2));
112696
112843
  if (parsed.success) {
112697
112844
  tasks.push(index < ownLists.length ? parsed.data : { ...parsed.data, taskList: scope });
@@ -112702,14 +112849,14 @@ function readTasks(fs22, configDir, ownLists, sharedLists, report) {
112702
112849
  });
112703
112850
  return tasks;
112704
112851
  }
112705
- function readWorkflowRuns(fs22, configDir, relativeDir, report) {
112852
+ function readWorkflowRuns(fs23, configDir, relativeDir, report) {
112706
112853
  const runs = [];
112707
- for (const name of [...listDirOrReport(fs22, configDir, relativeDir, report)].sort()) {
112854
+ for (const name of [...listDirOrReport(fs23, configDir, relativeDir, report)].sort()) {
112708
112855
  if (!name.startsWith(WORKFLOW_RUN_PREFIX) || !name.endsWith(JSON_SUFFIX)) {
112709
112856
  continue;
112710
112857
  }
112711
112858
  const relative = import_node_path33.default.join(relativeDir, name);
112712
- const text2 = readFileOrReport(fs22, configDir, relative, report);
112859
+ const text2 = readFileOrReport(fs23, configDir, relative, report);
112713
112860
  const parsed = WorkflowRunFileSchema.safeParse(text2 === void 0 ? void 0 : parseJson3(text2));
112714
112861
  if (!parsed.success) {
112715
112862
  if (text2 !== void 0) {
@@ -112733,11 +112880,11 @@ var SessionLookupError = class extends CliError {
112733
112880
  function identityConfigDir(identitiesDir, identity) {
112734
112881
  return import_node_path34.default.join(identitiesDir, identity);
112735
112882
  }
112736
- function historyStores(fs22, identitiesDir, identities) {
112883
+ function historyStores(fs23, identitiesDir, identities) {
112737
112884
  const byRealPath = /* @__PURE__ */ new Map();
112738
112885
  for (const identity of identities) {
112739
112886
  const configDir = identityConfigDir(identitiesDir, identity);
112740
- const real = fs22.realpath(import_node_path34.default.join(configDir, "projects"));
112887
+ const real = fs23.realpath(import_node_path34.default.join(configDir, "projects"));
112741
112888
  if (real === void 0) {
112742
112889
  continue;
112743
112890
  }
@@ -112750,15 +112897,15 @@ function historyStores(fs22, identitiesDir, identities) {
112750
112897
  }
112751
112898
  return [...byRealPath.values()];
112752
112899
  }
112753
- function collectSessionList(fs22, identitiesDir, identities, filters) {
112900
+ function collectSessionList(fs23, identitiesDir, identities, filters) {
112754
112901
  const names = filters.identity === void 0 ? identities : identities.filter((name) => name === filters.identity);
112755
112902
  if (filters.identity !== void 0 && names.length === 0) {
112756
112903
  throw new SessionLookupError(`no identity named "${filters.identity}"`);
112757
112904
  }
112758
112905
  const sessions = [];
112759
- for (const store of historyStores(fs22, identitiesDir, names)) {
112760
- for (const ref of listSessions2(fs22, store.configDir)) {
112761
- const summary = summariseSession(fs22, store.configDir, ref);
112906
+ for (const store of historyStores(fs23, identitiesDir, names)) {
112907
+ for (const ref of listSessions2(fs23, store.configDir)) {
112908
+ const summary = summariseSession(fs23, store.configDir, ref);
112762
112909
  if (filters.all === true || summary.agentCount > 0 || summary.workflowRunCount > 0) {
112763
112910
  sessions.push({ ...summary, identities: store.identities });
112764
112911
  }
@@ -112766,14 +112913,14 @@ function collectSessionList(fs22, identitiesDir, identities, filters) {
112766
112913
  }
112767
112914
  return sessions.sort((left, right) => (right.updatedAt ?? "").localeCompare(left.updatedAt ?? "") || left.sessionId.localeCompare(right.sessionId));
112768
112915
  }
112769
- function locateSession(fs22, identitiesDir, identities, query, onlyIdentity) {
112916
+ function locateSession(fs23, identitiesDir, identities, query, onlyIdentity) {
112770
112917
  const names = onlyIdentity === void 0 ? identities : identities.filter((name) => name === onlyIdentity);
112771
112918
  if (onlyIdentity !== void 0 && names.length === 0) {
112772
112919
  throw new SessionLookupError(`no identity named "${onlyIdentity}"`);
112773
112920
  }
112774
112921
  const matches = [];
112775
- for (const store of historyStores(fs22, identitiesDir, names)) {
112776
- for (const ref of listSessions2(fs22, store.configDir)) {
112922
+ for (const store of historyStores(fs23, identitiesDir, names)) {
112923
+ for (const ref of listSessions2(fs23, store.configDir)) {
112777
112924
  if (ref.sessionId.startsWith(query)) {
112778
112925
  matches.push({ identities: store.identities, configDir: store.configDir, ref });
112779
112926
  }
@@ -112790,9 +112937,9 @@ function locateSession(fs22, identitiesDir, identities, query, onlyIdentity) {
112790
112937
  }
112791
112938
  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`);
112792
112939
  }
112793
- function showSession(fs22, identitiesDir, identities, query, onlyIdentity) {
112794
- const located = locateSession(fs22, identitiesDir, identities, query, onlyIdentity);
112795
- return { identities: located.identities, tree: readSessionAgentTree(fs22, located.configDir, located.ref) };
112940
+ function showSession(fs23, identitiesDir, identities, query, onlyIdentity) {
112941
+ const located = locateSession(fs23, identitiesDir, identities, query, onlyIdentity);
112942
+ return { identities: located.identities, tree: readSessionAgentTree(fs23, located.configDir, located.ref) };
112796
112943
  }
112797
112944
 
112798
112945
  // src/frontdoor/commands.ts
@@ -113157,15 +113304,15 @@ function createRealWindowOpener(params) {
113157
113304
  init_conditions();
113158
113305
 
113159
113306
  // src/usage/handledStamps.ts
113160
- var import_node_path41 = __toESM(require("node:path"), 1);
113307
+ var import_node_path43 = __toESM(require("node:path"), 1);
113161
113308
  init_zod();
113162
113309
  var STAMPS_SCHEMA_VERSION = 1;
113163
113310
  var StampsFileSchema = external_exports.strictObject({
113164
113311
  schemaVersion: external_exports.literal(STAMPS_SCHEMA_VERSION),
113165
113312
  handled: external_exports.record(external_exports.string().min(1), external_exports.iso.datetime())
113166
113313
  });
113167
- function readHandled(fs22, file2) {
113168
- const raw = fs22.readFileUtf8(file2);
113314
+ function readHandled(fs23, file2) {
113315
+ const raw = fs23.readFileUtf8(file2);
113169
113316
  if (raw === void 0) {
113170
113317
  return {};
113171
113318
  }
@@ -113178,10 +113325,10 @@ function readHandled(fs22, file2) {
113178
113325
  const result = StampsFileSchema.safeParse(parsed);
113179
113326
  return result.success ? Object.fromEntries(Object.entries(result.data.handled).map(([key, at2]) => [key, Date.parse(at2)])) : {};
113180
113327
  }
113181
- function writeHandled(fs22, file2, handled) {
113328
+ function writeHandled(fs23, file2, handled) {
113182
113329
  const next = { schemaVersion: STAMPS_SCHEMA_VERSION, handled: Object.fromEntries(Object.entries(handled).map(([key, at2]) => [key, new Date(at2).toISOString()])) };
113183
- fs22.mkdirPrivate(import_node_path41.default.dirname(file2));
113184
- fs22.writeFilePrivate(file2, `${JSON.stringify(next, null, 2)}
113330
+ fs23.mkdirPrivate(import_node_path43.default.dirname(file2));
113331
+ fs23.writeFilePrivate(file2, `${JSON.stringify(next, null, 2)}
113185
113332
  `);
113186
113333
  }
113187
113334
 
@@ -113468,19 +113615,81 @@ function createDoorPipelines(deps) {
113468
113615
  };
113469
113616
  }
113470
113617
 
113618
+ // src/headroom/routingSetting.ts
113619
+ var import_node_fs16 = __toESM(require("node:fs"), 1);
113620
+ init_zod();
113621
+ init_store();
113622
+ var RoutingChoiceSchema = external_exports.strictObject({
113623
+ viaHeadroom: external_exports.boolean(),
113624
+ /** A token that changes with every `--now` request (the moment it was made). A session applies it once, immediately, and then goes back to waiting for a boundary. */
113625
+ force: external_exports.number().optional()
113626
+ });
113627
+ var RoutingSettingSchema = external_exports.strictObject({
113628
+ schemaVersion: external_exports.literal(1),
113629
+ /** Every session with no setting of its own. Absent means each session's launch flag decides. */
113630
+ global: RoutingChoiceSchema.optional(),
113631
+ /** One session's own setting, by launch session id, outranking the global one. */
113632
+ sessions: external_exports.record(external_exports.string(), RoutingChoiceSchema)
113633
+ });
113634
+ var NO_ROUTING_SETTING = { schemaVersion: 1, sessions: {} };
113635
+ function readRoutingSetting(paths) {
113636
+ return readJson(paths.headroomRoutingFile, RoutingSettingSchema) ?? NO_ROUTING_SETTING;
113637
+ }
113638
+ function writeRoutingSetting(paths, setting) {
113639
+ writeJsonAtomic(paths.headroomRoutingFile, setting);
113640
+ }
113641
+ function withRoutingChoice(setting, scope, change) {
113642
+ const choice = { viaHeadroom: change.viaHeadroom, ...change.immediately ? { force: change.nowMs } : {} };
113643
+ return scope.kind === "global" ? { ...setting, global: choice } : { ...setting, sessions: { ...setting.sessions, [scope.sessionId]: choice } };
113644
+ }
113645
+ function choiceFor(setting, sessionId) {
113646
+ return (sessionId === void 0 ? void 0 : setting.sessions[sessionId]) ?? setting.global;
113647
+ }
113648
+ function asksForHeadroom(setting) {
113649
+ return setting.global?.viaHeadroom === true || Object.values(setting.sessions).some((choice) => choice.viaHeadroom);
113650
+ }
113651
+ function createRoutingSettingReader(paths) {
113652
+ let cachedKey;
113653
+ let cached2 = NO_ROUTING_SETTING;
113654
+ return () => {
113655
+ let key;
113656
+ try {
113657
+ const stat = import_node_fs16.default.statSync(paths.headroomRoutingFile);
113658
+ key = `${String(stat.mtimeMs)}:${String(stat.size)}`;
113659
+ } catch {
113660
+ cachedKey = void 0;
113661
+ cached2 = NO_ROUTING_SETTING;
113662
+ return cached2;
113663
+ }
113664
+ if (key !== cachedKey) {
113665
+ cached2 = readRoutingSetting(paths);
113666
+ cachedKey = key;
113667
+ }
113668
+ return cached2;
113669
+ };
113670
+ }
113671
+
113471
113672
  // src/frontdoor/headroomDecision.ts
113472
113673
  init_pick();
113473
- function createHeadroomDecision() {
113674
+ function createHeadroomDecision(setting) {
113474
113675
  const sessions = /* @__PURE__ */ new Map();
113475
113676
  return {
113476
- decide: async (sessionId, wanted, nowMs, available) => {
113677
+ decide: async (sessionId, launchFlag, nowMs, available) => {
113678
+ const choice = choiceFor(setting(), sessionId);
113679
+ const wanted = choice?.viaHeadroom ?? launchFlag;
113477
113680
  if (sessionId === void 0) {
113478
113681
  return wanted && await available();
113479
113682
  }
113480
113683
  const state = sessions.get(sessionId);
113481
- const atBoundary = state === void 0 || nowMs - state.lastEndedAtMs > PROMPT_CACHE_TTL_MS || state.cacheReadInputTokens === 0;
113684
+ const forced = choice?.force !== void 0 && choice.force !== state?.appliedForce;
113685
+ const atBoundary = forced || state === void 0 || nowMs - state.lastEndedAtMs > PROMPT_CACHE_TTL_MS || state.cacheReadInputTokens === 0;
113482
113686
  const viaHeadroom = atBoundary ? wanted && await available() : state.viaHeadroom;
113483
- sessions.set(sessionId, { viaHeadroom, lastEndedAtMs: state?.lastEndedAtMs ?? nowMs, cacheReadInputTokens: state?.cacheReadInputTokens ?? 0 });
113687
+ sessions.set(sessionId, {
113688
+ viaHeadroom,
113689
+ lastEndedAtMs: state?.lastEndedAtMs ?? nowMs,
113690
+ cacheReadInputTokens: state?.cacheReadInputTokens ?? 0,
113691
+ appliedForce: choice?.force ?? state?.appliedForce
113692
+ });
113484
113693
  return viaHeadroom;
113485
113694
  },
113486
113695
  observe: ({ sessionId, endedAtMs, cacheReadInputTokens }) => {
@@ -113506,7 +113715,7 @@ init_capture();
113506
113715
 
113507
113716
  // src/frontdoor/connect.ts
113508
113717
  var import_node_crypto17 = require("node:crypto");
113509
- var fs16 = __toESM(require("node:fs"), 1);
113718
+ var fs17 = __toESM(require("node:fs"), 1);
113510
113719
 
113511
113720
  // src/frontdoor/x509.ts
113512
113721
  var import_node_crypto16 = require("node:crypto");
@@ -113836,23 +114045,23 @@ init_route();
113836
114045
  init_state();
113837
114046
 
113838
114047
  // src/frontdoor/supervisor.ts
113839
- var import_node_path42 = __toESM(require("node:path"), 1);
114048
+ var import_node_path44 = __toESM(require("node:path"), 1);
113840
114049
  init_state();
113841
114050
  function watchedInstallEntry(resolvedOwnExecutablePath, siblingExists) {
113842
- const parsed = import_node_path42.default.parse(resolvedOwnExecutablePath);
114051
+ const parsed = import_node_path44.default.parse(resolvedOwnExecutablePath);
113843
114052
  if (parsed.name === "agent-shim") {
113844
114053
  return resolvedOwnExecutablePath;
113845
114054
  }
113846
- const sibling = import_node_path42.default.join(parsed.dir, `agent-shim${parsed.ext}`);
114055
+ const sibling = import_node_path44.default.join(parsed.dir, `agent-shim${parsed.ext}`);
113847
114056
  return siblingExists(sibling) ? sibling : resolvedOwnExecutablePath;
113848
114057
  }
113849
114058
  var FRONTDOOR_SUPERVISOR_STILL_RUNNING = -1;
113850
114059
  var FRONTDOOR_POLL_MS = 1e3;
113851
114060
  var MS_PER_MINUTE3 = 6e4;
113852
114061
  async function runFrontDoorSupervisor(idleShutdownMinutes, ports, options = {}) {
113853
- const { fs: fs22, paths } = ports;
114062
+ const { fs: fs23, paths } = ports;
113854
114063
  const servingBinary = ports.statOwnExecutable();
113855
- const previous = readFrontDoorState(fs22, paths.frontdoorStateFile);
114064
+ const previous = readFrontDoorState(fs23, paths.frontdoorStateFile);
113856
114065
  let lastPort = previous?.lastPort;
113857
114066
  let lastConnectPort = previous?.lastConnectPort;
113858
114067
  let lastDirectPort = previous?.lastDirectPort;
@@ -113863,12 +114072,12 @@ async function runFrontDoorSupervisor(idleShutdownMinutes, ports, options = {})
113863
114072
  });
113864
114073
  const fail = (message) => {
113865
114074
  ports.closeRcStreamHub();
113866
- writeFrontDoorState(fs22, paths.frontdoorStateFile, { lastError: message, ...sticky() });
113867
- fs22.removeRecursive(paths.frontdoorLockFile);
114075
+ writeFrontDoorState(fs23, paths.frontdoorStateFile, { lastError: message, ...sticky() });
114076
+ fs23.removeRecursive(paths.frontdoorLockFile);
113868
114077
  ports.log(`agent-shim frontdoor supervisor: ${message}`);
113869
114078
  return 1;
113870
114079
  };
113871
- writeFrontDoorState(fs22, paths.frontdoorStateFile, { supervisorPid: ports.ownPid, ...sticky() });
114080
+ writeFrontDoorState(fs23, paths.frontdoorStateFile, { supervisorPid: ports.ownPid, ...sticky() });
113872
114081
  const previousSticky = lastPort;
113873
114082
  let http8;
113874
114083
  try {
@@ -113908,15 +114117,15 @@ async function runFrontDoorSupervisor(idleShutdownMinutes, ports, options = {})
113908
114117
  ports.log(`agent-shim frontdoor supervisor: sticky direct port ${String(previousStickyDirect)} was occupied; moving to ${String(direct.port)} (headroom admits the new address once its supervisor rewrites the allowlist file)`);
113909
114118
  }
113910
114119
  lastDirectPort = direct.port;
113911
- writeFrontDoorDirectRecord(fs22, paths.frontdoorDirectRecordsDir, { pid: ports.ownPid, directPort: direct.port });
113912
- writeFrontDoorState(fs22, paths.frontdoorStateFile, { protocol: FRONT_DOOR_PROTOCOL, supervisorPid: ports.ownPid, port: http8.port, connectPort: connect3.port, directPort: direct.port, ...sticky() });
114120
+ writeFrontDoorDirectRecord(fs23, paths.frontdoorDirectRecordsDir, { pid: ports.ownPid, directPort: direct.port });
114121
+ writeFrontDoorState(fs23, paths.frontdoorStateFile, { protocol: FRONT_DOOR_PROTOCOL, supervisorPid: ports.ownPid, port: http8.port, connectPort: connect3.port, directPort: direct.port, ...sticky() });
113913
114122
  ports.doorHealth.generation({ providerPort: http8.port, connectPort: connect3.port, directPort: direct.port });
113914
- fs22.removeRecursive(paths.frontdoorLockFile);
114123
+ fs23.removeRecursive(paths.frontdoorLockFile);
113915
114124
  ports.log(`agent-shim frontdoor supervisor ${String(ports.ownPid)}: front door on 127.0.0.1:${String(http8.port)}, CONNECT surface on 127.0.0.1:${String(connect3.port)}`);
113916
114125
  let idleSince;
113917
114126
  let ticks = 0;
113918
114127
  const supersedingOwner = () => {
113919
- const owner = readFrontDoorState(fs22, paths.frontdoorStateFile)?.supervisorPid;
114128
+ const owner = readFrontDoorState(fs23, paths.frontdoorStateFile)?.supervisorPid;
113920
114129
  return owner !== void 0 && owner !== ports.ownPid && ports.isRunning(owner) ? owner : void 0;
113921
114130
  };
113922
114131
  let supersededBy;
@@ -113930,12 +114139,12 @@ async function runFrontDoorSupervisor(idleShutdownMinutes, ports, options = {})
113930
114139
  await connect3.close();
113931
114140
  await http8.close();
113932
114141
  ports.closeRcStreamHub();
113933
- removeFrontDoorDirectRecord(fs22, paths.frontdoorDirectRecordsDir, ports.ownPid);
114142
+ removeFrontDoorDirectRecord(fs23, paths.frontdoorDirectRecordsDir, ports.ownPid);
113934
114143
  };
113935
114144
  const shutdown = async () => {
113936
114145
  await closeServing();
113937
114146
  if (supersedingOwner() === void 0) {
113938
- writeFrontDoorState(fs22, paths.frontdoorStateFile, sticky());
114147
+ writeFrontDoorState(fs23, paths.frontdoorStateFile, sticky());
113939
114148
  }
113940
114149
  return 0;
113941
114150
  };
@@ -113944,8 +114153,8 @@ async function runFrontDoorSupervisor(idleShutdownMinutes, ports, options = {})
113944
114153
  return FRONTDOOR_SUPERVISOR_STILL_RUNNING;
113945
114154
  }
113946
114155
  ticks += 1;
113947
- const listed = listFrontDoorSessions(fs22, paths.frontdoorSessionsDir);
113948
- const pruned = pruneDeadFrontDoorSessions(fs22, paths.frontdoorSessionsDir, ports.isRunning);
114156
+ const listed = listFrontDoorSessions(fs23, paths.frontdoorSessionsDir);
114157
+ const pruned = pruneDeadFrontDoorSessions(fs23, paths.frontdoorSessionsDir, ports.isRunning);
113949
114158
  ports.observeLaunchRegistry(listed, pruned);
113950
114159
  ports.checkQuotaExpiry();
113951
114160
  const prunedPids = new Set(pruned);
@@ -114031,8 +114240,8 @@ function parseConnectTarget(authority) {
114031
114240
  }
114032
114241
  return { host, port };
114033
114242
  }
114034
- function servedByPipeline(path57) {
114035
- return path57?.startsWith(ROUTED_PATH_PREFIX) === true;
114243
+ function servedByPipeline(path59) {
114244
+ return path59?.startsWith(ROUTED_PATH_PREFIX) === true;
114036
114245
  }
114037
114246
  var HOP_BY_HOP_HEADERS = /* @__PURE__ */ new Set([
114038
114247
  "connection",
@@ -114356,7 +114565,7 @@ function isEnoent6(error63) {
114356
114565
  function realConnectCertStore(paths) {
114357
114566
  const read = (file2) => {
114358
114567
  try {
114359
- return fs16.readFileSync(file2, "utf8");
114568
+ return fs17.readFileSync(file2, "utf8");
114360
114569
  } catch (error63) {
114361
114570
  if (isEnoent6(error63)) {
114362
114571
  return void 0;
@@ -114371,10 +114580,10 @@ function realConnectCertStore(paths) {
114371
114580
  return certPem === void 0 || keyPem2 === void 0 ? void 0 : { certPem, keyPem: keyPem2 };
114372
114581
  },
114373
114582
  writeCa: (ca2) => {
114374
- fs16.mkdirSync(paths.frontdoorCaDir, { recursive: true });
114375
- fs16.writeFileSync(paths.frontdoorCaCertFile, ca2.certPem, "utf8");
114376
- fs16.writeFileSync(paths.frontdoorCaKeyFile, ca2.keyPem, { encoding: "utf8", mode: CA_KEY_FILE_MODE });
114377
- fs16.chmodSync(paths.frontdoorCaKeyFile, CA_KEY_FILE_MODE);
114583
+ fs17.mkdirSync(paths.frontdoorCaDir, { recursive: true });
114584
+ fs17.writeFileSync(paths.frontdoorCaCertFile, ca2.certPem, "utf8");
114585
+ fs17.writeFileSync(paths.frontdoorCaKeyFile, ca2.keyPem, { encoding: "utf8", mode: CA_KEY_FILE_MODE });
114586
+ fs17.chmodSync(paths.frontdoorCaKeyFile, CA_KEY_FILE_MODE);
114378
114587
  }
114379
114588
  };
114380
114589
  }
@@ -114717,11 +114926,11 @@ function createRcSessionTracker(deps) {
114717
114926
  };
114718
114927
  const observeExchange = (request7) => {
114719
114928
  const method = (request7.method ?? "").toUpperCase();
114720
- const path57 = new URL(request7.url ?? "/", "http://127.0.0.1").pathname;
114721
- if (!path57.startsWith(RC_SESSIONS_PATH_PREFIX)) {
114929
+ const path59 = new URL(request7.url ?? "/", "http://127.0.0.1").pathname;
114930
+ if (!path59.startsWith(RC_SESSIONS_PATH_PREFIX)) {
114722
114931
  return void 0;
114723
114932
  }
114724
- const tail = path57.slice(RC_SESSIONS_PATH_PREFIX.length);
114933
+ const tail = path59.slice(RC_SESSIONS_PATH_PREFIX.length);
114725
114934
  const facts = {
114726
114935
  oauthAuthorization: oauthAuthorizationOf(request7.headers),
114727
114936
  anthropicVersion: singleHeader(request7.headers, "anthropic-version"),
@@ -115090,8 +115299,8 @@ var RC_READ_FILE_ENCODINGS = ["utf-8", "base64"];
115090
115299
  function isRcReadFileEncoding(value2) {
115091
115300
  return RC_READ_FILE_ENCODINGS.some((encoding) => encoding === value2);
115092
115301
  }
115093
- function buildRcReadFilePayload(requestId, path57, options) {
115094
- return buildRcControlRequestPayload(requestId, { subtype: "read_file", path: path57, ...options?.maxBytes === void 0 ? {} : { max_bytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } });
115302
+ function buildRcReadFilePayload(requestId, path59, options) {
115303
+ return buildRcControlRequestPayload(requestId, { subtype: "read_file", path: path59, ...options?.maxBytes === void 0 ? {} : { max_bytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } });
115095
115304
  }
115096
115305
  function buildRcFileSuggestionsPayload(requestId, query) {
115097
115306
  return buildRcControlRequestPayload(requestId, { subtype: "file_suggestions", query });
@@ -115193,15 +115402,15 @@ async function getRcSessionContextUsage(deps, sessionId, detail) {
115193
115402
  const result = await deliverRcClientPayload(deps, sessionId, buildRcGetContextUsagePayload(requestId, detail), `request the context usage of session ${sessionId}`);
115194
115403
  return result.ok ? { ...result, requestId } : result;
115195
115404
  }
115196
- async function readRcSessionFile(deps, sessionId, path57, options) {
115197
- if (path57 === "") {
115405
+ async function readRcSessionFile(deps, sessionId, path59, options) {
115406
+ if (path59 === "") {
115198
115407
  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" };
115199
115408
  }
115200
115409
  if (options?.maxBytes !== void 0 && (!Number.isInteger(options.maxBytes) || options.maxBytes <= 0)) {
115201
115410
  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" };
115202
115411
  }
115203
115412
  const requestId = deps.newUuid();
115204
- const result = await deliverRcClientPayload(deps, sessionId, buildRcReadFilePayload(requestId, path57, options), `read ${path57} from session ${sessionId}`);
115413
+ const result = await deliverRcClientPayload(deps, sessionId, buildRcReadFilePayload(requestId, path59, options), `read ${path59} from session ${sessionId}`);
115205
115414
  return result.ok ? { ...result, requestId } : result;
115206
115415
  }
115207
115416
  async function suggestRcSessionFiles(deps, sessionId, query) {
@@ -115372,11 +115581,11 @@ function createRcControlHandler(deps) {
115372
115581
  path: "read-file",
115373
115582
  read: (body) => {
115374
115583
  const session = bodyString(body, "session");
115375
- const path57 = bodyString(body, "path");
115584
+ const path59 = bodyString(body, "path");
115376
115585
  const maxBytes = "maxBytes" in body ? bodyPositiveInteger(body, "maxBytes") : void 0;
115377
115586
  const encoding = "encoding" in body && isRcReadFileEncoding(body.encoding) ? body.encoding : void 0;
115378
- const refused2 = session === void 0 || path57 === void 0 || "maxBytes" in body && maxBytes === void 0 || "encoding" in body && encoding === void 0;
115379
- 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, path57, { ...maxBytes === void 0 ? {} : { maxBytes }, ...encoding === void 0 ? {} : { encoding } }) };
115587
+ const refused2 = session === void 0 || path59 === void 0 || "maxBytes" in body && maxBytes === void 0 || "encoding" in body && encoding === void 0;
115588
+ return refused2 ? { error: `the read-file body must be JSON naming a non-empty session id and path, maxBytes only as a positive whole number or absent, and an encoding the SDK's own type permits (${RC_READ_FILE_ENCODINGS.join(", ")}) or none` } : { session, run: async () => await deps.readFile(session, path59, { ...maxBytes === void 0 ? {} : { maxBytes }, ...encoding === void 0 ? {} : { encoding } }) };
115380
115589
  }
115381
115590
  },
115382
115591
  {
@@ -115686,9 +115895,9 @@ function requestIdOfBody(body) {
115686
115895
  }
115687
115896
  function frontDoorRcControl(transport, token) {
115688
115897
  const headers = { authorization: `Bearer ${token}` };
115689
- const listAnswerOf = async (path57, what) => {
115898
+ const listAnswerOf = async (path59, what) => {
115690
115899
  try {
115691
- return await transport.request({ method: "GET", path: path57, headers });
115900
+ return await transport.request({ method: "GET", path: path59, headers });
115692
115901
  } catch (error63) {
115693
115902
  throw new Error(`${what}: could not reach the front door's control listener: ${error63 instanceof Error ? error63.message : String(error63)}`, { cause: error63 });
115694
115903
  }
@@ -115760,10 +115969,10 @@ function frontDoorRcControl(transport, token) {
115760
115969
  }
115761
115970
  return pending;
115762
115971
  };
115763
- const writeOf = async (path57, body, describeFailure2) => {
115972
+ const writeOf = async (path59, body, describeFailure2) => {
115764
115973
  let answer;
115765
115974
  try {
115766
- answer = await transport.request({ method: "POST", path: path57, headers: { ...headers, "content-type": "application/json" }, body });
115975
+ answer = await transport.request({ method: "POST", path: path59, headers: { ...headers, "content-type": "application/json" }, body });
115767
115976
  } catch (error63) {
115768
115977
  return { ok: false, message: `could not reach the front door's control listener: ${error63 instanceof Error ? error63.message : String(error63)}` };
115769
115978
  }
@@ -115794,10 +116003,10 @@ function frontDoorRcControl(transport, token) {
115794
116003
  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}`),
115795
116004
  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}`),
115796
116005
  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}`),
115797
- readFile: async (sessionId, path57, options) => await writeOf(
116006
+ readFile: async (sessionId, path59, options) => await writeOf(
115798
116007
  `${CONTROL_PATH_PREFIX}/read-file`,
115799
- JSON.stringify({ session: sessionId, path: path57, ...options?.maxBytes === void 0 ? {} : { maxBytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } }),
115800
- (status, message) => `reading ${path57} from ${sessionId} failed (HTTP ${String(status)}): ${message}`
116008
+ JSON.stringify({ session: sessionId, path: path59, ...options?.maxBytes === void 0 ? {} : { maxBytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } }),
116009
+ (status, message) => `reading ${path59} from ${sessionId} failed (HTTP ${String(status)}): ${message}`
115801
116010
  ),
115802
116011
  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}`),
115803
116012
  keepAlive: async (sessionId) => await writeOf(`${CONTROL_PATH_PREFIX}/keep-alive`, JSON.stringify({ session: sessionId }), (status, message) => `keeping ${sessionId} alive failed (HTTP ${String(status)}): ${message}`),
@@ -116091,12 +116300,12 @@ function tlsFacts(options) {
116091
116300
  }
116092
116301
  function realRcEventDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_PORT }) {
116093
116302
  const agent = new ExemptTlsAgent();
116094
- const post = async (path57, headers, body) => await new Promise((resolve2, reject) => {
116303
+ const post = async (path59, headers, body) => await new Promise((resolve2, reject) => {
116095
116304
  const options = {
116096
116305
  host: target.host,
116097
116306
  port: target.port,
116098
116307
  method: "POST",
116099
- path: path57,
116308
+ path: path59,
116100
116309
  // 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.
116101
116310
  headers: { ...headers, host: target.servername ?? target.host, "content-length": String(Buffer.byteLength(body, "utf8")) },
116102
116311
  agent
@@ -116161,12 +116370,12 @@ function lateRcStreamDial(resolve2) {
116161
116370
  }
116162
116371
  function realRcStreamDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_PORT }) {
116163
116372
  const agent = new ExemptTlsAgent();
116164
- const request7 = async (method, path57, headers, body, signal) => await new Promise((resolve2, reject) => {
116373
+ const request7 = async (method, path59, headers, body, signal) => await new Promise((resolve2, reject) => {
116165
116374
  const options = {
116166
116375
  host: target.host,
116167
116376
  port: target.port,
116168
116377
  method,
116169
- path: path57,
116378
+ path: path59,
116170
116379
  // 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.
116171
116380
  headers: { ...headers, host: target.servername ?? target.host, ...body === void 0 ? {} : { "content-length": String(Buffer.byteLength(body, "utf8")) } },
116172
116381
  agent,
@@ -116208,9 +116417,9 @@ function realRcStreamDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_P
116208
116417
  return { status, body: await readAll(response) };
116209
116418
  },
116210
116419
  openStream: async (sessionId, headers, resume, signal) => {
116211
- const path57 = resume === void 0 ? `/v1/code/sessions/${encodeURIComponent(sessionId)}/events/stream` : `/v1/code/sessions/${encodeURIComponent(sessionId)}/events/stream?from_sequence_num=${String(resume.fromSequenceNum)}`;
116420
+ const path59 = resume === void 0 ? `/v1/code/sessions/${encodeURIComponent(sessionId)}/events/stream` : `/v1/code/sessions/${encodeURIComponent(sessionId)}/events/stream?from_sequence_num=${String(resume.fromSequenceNum)}`;
116212
116421
  const streamHeaders = resume === void 0 ? headers : { ...headers, "last-event-id": String(resume.fromSequenceNum) };
116213
- const { status, response } = await request7("GET", path57, streamHeaders, void 0, signal);
116422
+ const { status, response } = await request7("GET", path59, streamHeaders, void 0, signal);
116214
116423
  if (!isSuccessful2(status)) {
116215
116424
  await readAll(response);
116216
116425
  return { status, chunks: NO_CHUNKS };
@@ -116425,11 +116634,11 @@ function realConnectEffects(ports = DOOR_SOURCE_PORTS) {
116425
116634
  init_claudeShim();
116426
116635
  init_store();
116427
116636
  init_realPorts();
116428
- var import_node_fs16 = __toESM(require("node:fs"), 1);
116429
- var import_node_path44 = __toESM(require("node:path"), 1);
116637
+ var import_node_fs17 = __toESM(require("node:fs"), 1);
116638
+ var import_node_path46 = __toESM(require("node:path"), 1);
116430
116639
 
116431
116640
  // src/usage/signIn.ts
116432
- var import_node_path43 = __toESM(require("node:path"), 1);
116641
+ var import_node_path45 = __toESM(require("node:path"), 1);
116433
116642
  var CREDENTIALS_FILE = ".credentials.json";
116434
116643
  function keychainHasItem(run, account) {
116435
116644
  return run.run("security", ["find-generic-password", "-a", account]).status === 0;
@@ -116447,14 +116656,14 @@ function decideSignIn(facts) {
116447
116656
  return { state: "signed-out", detail: facts.platform === "darwin" ? `no Keychain item and no ${CREDENTIALS_FILE}` : `no ${CREDENTIALS_FILE}` };
116448
116657
  }
116449
116658
  function credentialsFilePath(farmRoot) {
116450
- return import_node_path43.default.join(farmRoot, CREDENTIALS_FILE);
116659
+ return import_node_path45.default.join(farmRoot, CREDENTIALS_FILE);
116451
116660
  }
116452
- function identitySignIn(fs22, probe, identity) {
116661
+ function identitySignIn(fs23, probe, identity) {
116453
116662
  const probing = !identity.hasCredentialBlock;
116454
116663
  return decideSignIn({
116455
116664
  hasCredentialBlock: identity.hasCredentialBlock,
116456
116665
  keychainItem: probing && probe.platform === "darwin" && probe.run !== void 0 ? keychainHasItem(probe.run, identity.farmRoot) : void 0,
116457
- credentialsFile: probing && fs22.lstat(credentialsFilePath(identity.farmRoot)) !== void 0,
116666
+ credentialsFile: probing && fs23.lstat(credentialsFilePath(identity.farmRoot)) !== void 0,
116458
116667
  platform: probe.platform
116459
116668
  });
116460
116669
  }
@@ -116641,7 +116850,7 @@ function tcpPortEraRecord(raw) {
116641
116850
  return (has("port") || has("lastPort")) && !has("socketPath");
116642
116851
  }
116643
116852
  function pushPathResolution(push, resolution) {
116644
- const ownDir = import_node_path44.default.dirname(resolution.ownExecutablePath);
116853
+ const ownDir = import_node_path46.default.dirname(resolution.ownExecutablePath);
116645
116854
  switch (resolution.agentShim.status) {
116646
116855
  case "ok":
116647
116856
  push("path-resolution", "pass", `\`agent-shim\` on PATH resolves to this running executable, ${resolution.ownExecutablePath}.`, "agent-shim");
@@ -116740,14 +116949,14 @@ function pushProvider(push, entry, cacheEnv, signIn) {
116740
116949
  }
116741
116950
  function pushLegacyName(push, params) {
116742
116951
  const legacyVariables = Object.keys(params.env).filter((name) => name.startsWith(LEGACY_ENV_PREFIX) && params.env[name] !== void 0).sort();
116743
- if (legacyVariables.length === 0 && import_node_path44.default.basename(params.rootPath) !== LEGACY_HOME_DIRNAME) {
116952
+ if (legacyVariables.length === 0 && import_node_path46.default.basename(params.rootPath) !== LEGACY_HOME_DIRNAME) {
116744
116953
  push("legacy-name", "pass", "Nothing here still uses the former `claude-use` name.");
116745
116954
  return;
116746
116955
  }
116747
116956
  for (const name of legacyVariables) {
116748
116957
  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);
116749
116958
  }
116750
- if (import_node_path44.default.basename(params.rootPath) === LEGACY_HOME_DIRNAME) {
116959
+ if (import_node_path46.default.basename(params.rootPath) === LEGACY_HOME_DIRNAME) {
116751
116960
  push(
116752
116961
  "legacy-name",
116753
116962
  "warn",
@@ -117107,27 +117316,27 @@ function formatDoctorReport(report) {
117107
117316
  }
117108
117317
  function realpathOrSelf(target) {
117109
117318
  try {
117110
- return import_node_fs16.default.realpathSync(target);
117319
+ return import_node_fs17.default.realpathSync(target);
117111
117320
  } catch {
117112
117321
  return target;
117113
117322
  }
117114
117323
  }
117115
117324
  function collectDoctorReport(params) {
117116
117325
  const { paths } = params;
117117
- 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() : [];
117326
+ const identityNames = import_node_fs17.default.existsSync(paths.identitiesDir) ? import_node_fs17.default.readdirSync(paths.identitiesDir, { withFileTypes: true }).filter((entry) => entry.isDirectory() && isIdentityDirectoryName(entry.name)).map((entry) => entry.name).sort() : [];
117118
117327
  const identities = identityNames.map((name) => {
117119
- const farmRoot = import_node_path44.default.join(paths.identitiesDir, name);
117120
- const identityPath = import_node_path44.default.join(farmRoot, "identity.json");
117121
- return { name, path: identityPath, raw: realFsPort.readFileUtf8(identityPath), farmRoot, credentialsFilePresent: import_node_fs16.default.existsSync(credentialsFilePath(farmRoot)) };
117328
+ const farmRoot = import_node_path46.default.join(paths.identitiesDir, name);
117329
+ const identityPath = import_node_path46.default.join(farmRoot, "identity.json");
117330
+ return { name, path: identityPath, raw: realFsPort.readFileUtf8(identityPath), farmRoot, credentialsFilePresent: import_node_fs17.default.existsSync(credentialsFilePath(farmRoot)) };
117122
117331
  });
117123
- 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() : [];
117332
+ const profileNames = import_node_fs17.default.existsSync(paths.configProfilesDir) ? import_node_fs17.default.readdirSync(paths.configProfilesDir, { withFileTypes: true }).filter((entry) => entry.isFile() && entry.name.endsWith(".json")).map((entry) => entry.name.slice(0, -".json".length)).sort() : [];
117124
117333
  const configProfiles = profileNames.map((name) => {
117125
- const profilePath = import_node_path44.default.join(paths.configProfilesDir, `${name}.json`);
117334
+ const profilePath = import_node_path46.default.join(paths.configProfilesDir, `${name}.json`);
117126
117335
  return { name, path: profilePath, raw: realFsPort.readFileUtf8(profilePath) };
117127
117336
  });
117128
- 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() : [];
117337
+ const providerNames = import_node_fs17.default.existsSync(paths.providersDir) ? import_node_fs17.default.readdirSync(paths.providersDir, { withFileTypes: true }).filter((entry) => entry.isFile() && entry.name.endsWith(".json")).map((entry) => entry.name.slice(0, -".json".length)).sort() : [];
117129
117338
  const providers = providerNames.map((name) => {
117130
- const providerPath = import_node_path44.default.join(paths.providersDir, `${name}.json`);
117339
+ const providerPath = import_node_path46.default.join(paths.providersDir, `${name}.json`);
117131
117340
  return { name, path: providerPath, raw: realFsPort.readFileUtf8(providerPath) };
117132
117341
  });
117133
117342
  const ownExecutablePath = realOwnExecutablePath();
@@ -117139,12 +117348,12 @@ function collectDoctorReport(params) {
117139
117348
  binaryDiscovery = { ok: false, message: error63 instanceof Error ? error63.message : String(error63) };
117140
117349
  }
117141
117350
  const shimState = readJson(paths.claudeShimFile, ClaudeShimStateSchema);
117142
- const pathDirs = (params.env.PATH ?? "").split(import_node_path44.default.delimiter).filter((dir) => dir !== "");
117351
+ const pathDirs = (params.env.PATH ?? "").split(import_node_path46.default.delimiter).filter((dir) => dir !== "");
117143
117352
  const claudeShimShadow = shimState === void 0 ? void 0 : refinePathShadow(
117144
117353
  findPathShadow({
117145
117354
  pathDirs,
117146
- targetDir: import_node_path44.default.dirname(shimState.targetPath),
117147
- targetFilename: import_node_path44.default.basename(shimState.targetPath),
117355
+ targetDir: import_node_path46.default.dirname(shimState.targetPath),
117356
+ targetFilename: import_node_path46.default.basename(shimState.targetPath),
117148
117357
  findExecutableInDir
117149
117358
  }),
117150
117359
  shimState.targetPath,
@@ -117170,14 +117379,14 @@ function collectDoctorReport(params) {
117170
117379
  categoriesLocal: { path: paths.categoriesLocalFile, raw: realFsPort.readFileUtf8(paths.categoriesLocalFile) },
117171
117380
  activeIdentity: { path: paths.activeIdentityFile, raw: realFsPort.readFileUtf8(paths.activeIdentityFile) },
117172
117381
  binaryDiscovery,
117173
- claudeShim: { state: shimState, targetExists: shimState !== void 0 && import_node_fs16.default.existsSync(shimState.targetPath) },
117382
+ claudeShim: { state: shimState, targetExists: shimState !== void 0 && import_node_fs17.default.existsSync(shimState.targetPath) },
117174
117383
  rootPath: paths.root,
117175
117384
  pathResolution: {
117176
117385
  ownExecutablePath,
117177
117386
  agentShim: refinePathShadow(
117178
117387
  findPathShadow({
117179
117388
  pathDirs,
117180
- targetDir: import_node_path44.default.dirname(ownExecutablePath),
117389
+ targetDir: import_node_path46.default.dirname(ownExecutablePath),
117181
117390
  targetFilename: commandFilename(ownExecutablePath, "agent-shim"),
117182
117391
  findExecutableInDir
117183
117392
  }),
@@ -117449,11 +117658,11 @@ function tryOrUndefined(fn2) {
117449
117658
  return void 0;
117450
117659
  }
117451
117660
  }
117452
- function pathToHttpPath(path57) {
117453
- return `/${path57.map(safeEncodeURIComponent).join("/")}`;
117661
+ function pathToHttpPath(path59) {
117662
+ return `/${path59.map(safeEncodeURIComponent).join("/")}`;
117454
117663
  }
117455
- function normalizeHttpPath(path57) {
117456
- const paths = path57.split("/");
117664
+ function normalizeHttpPath(path59) {
117665
+ const paths = path59.split("/");
117457
117666
  if (paths.at(0) === "") {
117458
117667
  paths.shift();
117459
117668
  }
@@ -117638,9 +117847,9 @@ function isPlainObject2(value2) {
117638
117847
  function getOwn(object3, key) {
117639
117848
  return Object.hasOwn(object3, key) ? object3[key] : void 0;
117640
117849
  }
117641
- function get(object3, path57) {
117850
+ function get(object3, path59) {
117642
117851
  let current = object3;
117643
- for (const key of path57) {
117852
+ for (const key of path59) {
117644
117853
  if (!isTypescriptObject(current)) {
117645
117854
  return void 0;
117646
117855
  }
@@ -118863,7 +119072,7 @@ function resolveClientRest(rest) {
118863
119072
  // rest[1] can be undefined if all fields of FriendlyClientOptions are optional
118864
119073
  ];
118865
119074
  }
118866
- function createORPCClient(link, { path: path57 = [], ...options } = {}) {
119075
+ function createORPCClient(link, { path: path59 = [], ...options } = {}) {
118867
119076
  const procedureClient = (...rest) => {
118868
119077
  const [input2, callOptions] = resolveClientRest(rest);
118869
119078
  const interceptors = [
@@ -118872,7 +119081,7 @@ function createORPCClient(link, { path: path57 = [], ...options } = {}) {
118872
119081
  ];
118873
119082
  return intercept(
118874
119083
  interceptors,
118875
- { ...callOptions, input: input2, path: path57 },
119084
+ { ...callOptions, input: input2, path: path59 },
118876
119085
  ({ path: path210, input: input22, ...callOptions2 }) => link.call(path210, input22, callOptions2)
118877
119086
  );
118878
119087
  };
@@ -118886,7 +119095,7 @@ function createORPCClient(link, { path: path57 = [], ...options } = {}) {
118886
119095
  if (client === void 0) {
118887
119096
  client = createORPCClient(link, {
118888
119097
  ...options,
118889
- path: [...path57, key],
119098
+ path: [...path59, key],
118890
119099
  scoped: options.scoped?.[key]
118891
119100
  });
118892
119101
  cache.set(key, client);
@@ -118908,24 +119117,24 @@ var BracketNotationSerializer = class {
118908
119117
  this.internalSerialize(data, "", true, result);
118909
119118
  return result;
118910
119119
  }
118911
- internalSerialize(data, path57, isRoot, result) {
119120
+ internalSerialize(data, path59, isRoot, result) {
118912
119121
  if (Array.isArray(data)) {
118913
119122
  data.forEach((item, i10) => {
118914
- this.internalSerialize(item, isRoot ? i10.toString() : `${path57}[${i10}]`, false, result);
119123
+ this.internalSerialize(item, isRoot ? i10.toString() : `${path59}[${i10}]`, false, result);
118915
119124
  });
118916
119125
  } else if (isPlainObject2(data)) {
118917
119126
  for (const key of Object.keys(data)) {
118918
- this.internalSerialize(data[key], isRoot ? key : `${path57}[${key}]`, false, result);
119127
+ this.internalSerialize(data[key], isRoot ? key : `${path59}[${key}]`, false, result);
118919
119128
  }
118920
119129
  } else {
118921
- result.push([path57, data]);
119130
+ result.push([path59, data]);
118922
119131
  }
118923
119132
  }
118924
119133
  deserialize(serialized) {
118925
119134
  const arrayPushStyles = /* @__PURE__ */ new WeakSet();
118926
119135
  const root = new NullProtoObj();
118927
- for (const [path57, value2] of serialized) {
118928
- const segments = this.parsePath(path57);
119136
+ for (const [path59, value2] of serialized) {
119137
+ const segments = this.parsePath(path59);
118929
119138
  let currentRef = root;
118930
119139
  let nextSegment = segments[0];
118931
119140
  for (let i10 = 1; i10 < segments.length; i10++) {
@@ -118976,13 +119185,13 @@ var BracketNotationSerializer = class {
118976
119185
  }
118977
119186
  return result;
118978
119187
  }
118979
- parsePath(path57) {
119188
+ parsePath(path59) {
118980
119189
  const segments = [];
118981
119190
  let inBrackets = false;
118982
119191
  let currentSegment = "";
118983
- for (let i10 = 0; i10 < path57.length; i10++) {
118984
- const char = path57[i10];
118985
- const nextChar = path57[i10 + 1];
119192
+ for (let i10 = 0; i10 < path59.length; i10++) {
119193
+ const char = path59[i10];
119194
+ const nextChar = path59[i10 + 1];
118986
119195
  if (inBrackets && char === "]" && (nextChar === void 0 || nextChar === "[")) {
118987
119196
  if (nextChar === void 0) {
118988
119197
  inBrackets = false;
@@ -118998,7 +119207,7 @@ var BracketNotationSerializer = class {
118998
119207
  currentSegment += char;
118999
119208
  }
119000
119209
  }
119001
- return inBrackets || segments.length === 0 ? [path57] : segments;
119210
+ return inBrackets || segments.length === 0 ? [path59] : segments;
119002
119211
  }
119003
119212
  };
119004
119213
  var INTEGER_PATTERN = /^0$|^[1-9]\d*$/;
@@ -119571,11 +119780,11 @@ var OpenAPISerializer = class {
119571
119780
  return json2;
119572
119781
  }
119573
119782
  const form = new FormData();
119574
- for (const [path57, value22] of this.bracketNotation.serialize(json2)) {
119783
+ for (const [path59, value22] of this.bracketNotation.serialize(json2)) {
119575
119784
  if (value22 instanceof Blob) {
119576
- form.append(path57, value22);
119785
+ form.append(path59, value22);
119577
119786
  } else if (value22 !== void 0 && value22 !== null) {
119578
- form.append(path57, String(value22));
119787
+ form.append(path59, String(value22));
119579
119788
  }
119580
119789
  }
119581
119790
  return form;
@@ -119613,30 +119822,30 @@ function isBodylessMethod(method) {
119613
119822
  return method === "GET" || method === "HEAD";
119614
119823
  }
119615
119824
  var PARAMETER_NAME_REGEX = /^[\w-]+$/;
119616
- function getDynamicPathParams(path57) {
119617
- if (!path57.includes("{")) {
119825
+ function getDynamicPathParams(path59) {
119826
+ if (!path59.includes("{")) {
119618
119827
  return void 0;
119619
119828
  }
119620
- const len = path57.length;
119829
+ const len = path59.length;
119621
119830
  let params;
119622
119831
  let index = 1;
119623
119832
  while (index < len) {
119624
119833
  const segmentStart = index;
119625
- const slashPos = path57.indexOf("/", index);
119834
+ const slashPos = path59.indexOf("/", index);
119626
119835
  const segmentEnd = slashPos === -1 ? len : slashPos;
119627
- if (segmentEnd > segmentStart && path57.charCodeAt(segmentStart) === 123 && path57.charCodeAt(segmentEnd - 1) === 125) {
119836
+ if (segmentEnd > segmentStart && path59.charCodeAt(segmentStart) === 123 && path59.charCodeAt(segmentEnd - 1) === 125) {
119628
119837
  let parameterStart = segmentStart + 1;
119629
119838
  let allowsSlash = false;
119630
- const operator = path57.charCodeAt(parameterStart);
119839
+ const operator = path59.charCodeAt(parameterStart);
119631
119840
  if (operator === 43) {
119632
119841
  allowsSlash = true;
119633
119842
  parameterStart++;
119634
119843
  }
119635
- const parameterName = path57.slice(parameterStart, segmentEnd - 1);
119844
+ const parameterName = path59.slice(parameterStart, segmentEnd - 1);
119636
119845
  if (PARAMETER_NAME_REGEX.test(parameterName)) {
119637
119846
  params ??= [];
119638
119847
  params.push({
119639
- segment: path57.slice(segmentStart, segmentEnd),
119848
+ segment: path59.slice(segmentStart, segmentEnd),
119640
119849
  startIndex: segmentStart,
119641
119850
  parameterName,
119642
119851
  allowsSlash
@@ -119679,8 +119888,8 @@ openapi.method = (method) => ({
119679
119888
  ...openapi({ method }),
119680
119889
  name: "~openapi/method"
119681
119890
  });
119682
- openapi.path = (path57) => ({
119683
- ...openapi({ path: path57 }),
119891
+ openapi.path = (path59) => ({
119892
+ ...openapi({ path: path59 }),
119684
119893
  name: "~openapi/path"
119685
119894
  });
119686
119895
  openapi.spec = (spec) => ({
@@ -120541,22 +120750,22 @@ function visitJsonSchemaRefs(value2, visit2, schemaLevel = true, seen = /* @__PU
120541
120750
  }
120542
120751
  }
120543
120752
  }
120544
- function mapJsonSchemaRefs(value2, map2, schemaLevel = true, path57 = []) {
120753
+ function mapJsonSchemaRefs(value2, map2, schemaLevel = true, path59 = []) {
120545
120754
  if (!value2 || typeof value2 !== "object") {
120546
120755
  return value2;
120547
120756
  }
120548
120757
  if (Array.isArray(value2)) {
120549
- return value2.map((item, index) => mapJsonSchemaRefs(item, map2, schemaLevel, [...path57, index]));
120758
+ return value2.map((item, index) => mapJsonSchemaRefs(item, map2, schemaLevel, [...path59, index]));
120550
120759
  }
120551
120760
  const result = {};
120552
120761
  for (const key of Object.keys(value2)) {
120553
120762
  const val = value2[key];
120554
120763
  if (key === "$ref" && typeof val === "string") {
120555
- setOwn(result, key, map2(val, [...path57, key]));
120764
+ setOwn(result, key, map2(val, [...path59, key]));
120556
120765
  } else if (!schemaLevel) {
120557
- setOwn(result, key, mapJsonSchemaRefs(val, map2, true, [...path57, key]));
120766
+ setOwn(result, key, mapJsonSchemaRefs(val, map2, true, [...path59, key]));
120558
120767
  } else if (JSON_SCHEMA_LOGIC_KEYWORDS.has(key) || JSON_SCHEMA_RECORD_KEYWORDS.has(key)) {
120559
- setOwn(result, key, mapJsonSchemaRefs(val, map2, !JSON_SCHEMA_RECORD_KEYWORDS.has(key), [...path57, key]));
120768
+ setOwn(result, key, mapJsonSchemaRefs(val, map2, !JSON_SCHEMA_RECORD_KEYWORDS.has(key), [...path59, key]));
120560
120769
  } else {
120561
120770
  setOwn(result, key, val);
120562
120771
  }
@@ -121086,7 +121295,7 @@ function unlazy(maybeLazy) {
121086
121295
  function createProcedureClient(lazyableProcedure, ...rest) {
121087
121296
  const options = resolveMaybeOptionalOptions(rest);
121088
121297
  return async (...[input2, callerOptions]) => {
121089
- const path57 = toArray(options.path);
121298
+ const path59 = toArray(options.path);
121090
121299
  const { default: procedure } = await unlazy(lazyableProcedure);
121091
121300
  const clientContext = callerOptions?.context ?? {};
121092
121301
  const context = await value(options.context, clientContext) ?? {};
@@ -121099,7 +121308,7 @@ function createProcedureClient(lazyableProcedure, ...rest) {
121099
121308
  };
121100
121309
  try {
121101
121310
  const output2 = await runWithSpan("call_procedure", (span) => {
121102
- span?.setAttribute("procedure.path", path57);
121311
+ span?.setAttribute("procedure.path", path59);
121103
121312
  return intercept(
121104
121313
  options.interceptors,
121105
121314
  {
@@ -121107,7 +121316,7 @@ function createProcedureClient(lazyableProcedure, ...rest) {
121107
121316
  // input can be optional if it is undefinable
121108
121317
  input: input2,
121109
121318
  errors,
121110
- path: path57,
121319
+ path: path59,
121111
121320
  procedure,
121112
121321
  signal: callerOptions?.signal,
121113
121322
  lastEventId: callerOptions?.lastEventId
@@ -121358,10 +121567,10 @@ function augmentRouter(router, options) {
121358
121567
  }
121359
121568
  return enhanced;
121360
121569
  }
121361
- function getRouter(router, path57) {
121570
+ function getRouter(router, path59) {
121362
121571
  let current = router;
121363
- for (let i10 = 0; i10 < path57.length; i10++) {
121364
- const segment = path57[i10];
121572
+ for (let i10 = 0; i10 < path59.length; i10++) {
121573
+ const segment = path59[i10];
121365
121574
  if (!isTypescriptObject(current)) {
121366
121575
  return void 0;
121367
121576
  }
@@ -121373,7 +121582,7 @@ function getRouter(router, path57) {
121373
121582
  continue;
121374
121583
  }
121375
121584
  const lazied = current;
121376
- const rest = path57.slice(i10);
121585
+ const rest = path59.slice(i10);
121377
121586
  return new Lazy({
121378
121587
  ...lazied["~orpc"],
121379
121588
  async loader() {
@@ -121388,40 +121597,40 @@ function getRouter(router, path57) {
121388
121597
  }
121389
121598
  return current;
121390
121599
  }
121391
- function walkProcedureContractsSync(router, callback, path57 = []) {
121600
+ function walkProcedureContractsSync(router, callback, path59 = []) {
121392
121601
  const lazyResults = [];
121393
- walkProcedureContractsSyncInternal(router, callback, path57.slice(), lazyResults);
121602
+ walkProcedureContractsSyncInternal(router, callback, path59.slice(), lazyResults);
121394
121603
  return lazyResults;
121395
121604
  }
121396
- function walkProcedureContractsSyncInternal(router, callback, path57, lazyResults) {
121605
+ function walkProcedureContractsSyncInternal(router, callback, path59, lazyResults) {
121397
121606
  const hiddenContract = getHiddenRouterContract(router);
121398
121607
  if (hiddenContract !== void 0) {
121399
121608
  router = hiddenContract;
121400
121609
  }
121401
121610
  if (router instanceof ProcedureContract) {
121402
- callback(router, path57.slice());
121611
+ callback(router, path59.slice());
121403
121612
  return;
121404
121613
  }
121405
121614
  if (!isTypescriptObject(router)) {
121406
121615
  return;
121407
121616
  }
121408
121617
  for (const [key, value2] of Object.entries(router)) {
121409
- path57.push(key);
121618
+ path59.push(key);
121410
121619
  if (value2 instanceof Lazy) {
121411
- lazyResults.push({ router: value2, path: path57.slice() });
121620
+ lazyResults.push({ router: value2, path: path59.slice() });
121412
121621
  } else {
121413
- walkProcedureContractsSyncInternal(value2, callback, path57, lazyResults);
121622
+ walkProcedureContractsSyncInternal(value2, callback, path59, lazyResults);
121414
121623
  }
121415
- path57.pop();
121624
+ path59.pop();
121416
121625
  }
121417
121626
  }
121418
- async function walkProcedureContractsAsync(router, callback, path57 = []) {
121627
+ async function walkProcedureContractsAsync(router, callback, path59 = []) {
121419
121628
  const hiddenContract = getHiddenRouterContract(router);
121420
121629
  if (hiddenContract !== void 0) {
121421
121630
  router = hiddenContract;
121422
121631
  }
121423
121632
  if (router instanceof ProcedureContract) {
121424
- await callback(router, path57);
121633
+ await callback(router, path59);
121425
121634
  return;
121426
121635
  }
121427
121636
  if (!isTypescriptObject(router)) {
@@ -121430,9 +121639,9 @@ async function walkProcedureContractsAsync(router, callback, path57 = []) {
121430
121639
  for (const [key, value2] of Object.entries(router)) {
121431
121640
  if (value2 instanceof Lazy) {
121432
121641
  const { default: router2 } = await unlazy(value2);
121433
- await walkProcedureContractsAsync(router2, callback, [...path57, key]);
121642
+ await walkProcedureContractsAsync(router2, callback, [...path59, key]);
121434
121643
  } else {
121435
- await walkProcedureContractsAsync(value2, callback, [...path57, key]);
121644
+ await walkProcedureContractsAsync(value2, callback, [...path59, key]);
121436
121645
  }
121437
121646
  }
121438
121647
  }
@@ -121918,18 +122127,18 @@ function rewriteComponentSchemaRefs(schema, renameMap) {
121918
122127
  }
121919
122128
  var OpenAPIGeneratorError = class extends TypeError {
121920
122129
  };
121921
- function toOpenAPIPath(path57, dynamicPathParams) {
122130
+ function toOpenAPIPath(path59, dynamicPathParams) {
121922
122131
  if (!dynamicPathParams?.length) {
121923
- return path57;
122132
+ return path59;
121924
122133
  }
121925
122134
  let normalized = "";
121926
122135
  let currentIndex = 0;
121927
122136
  for (const param of dynamicPathParams) {
121928
- normalized += path57.slice(currentIndex, param.startIndex);
122137
+ normalized += path59.slice(currentIndex, param.startIndex);
121929
122138
  normalized += `{${param.parameterName}}`;
121930
122139
  currentIndex = param.startIndex + param.segment.length;
121931
122140
  }
121932
- normalized += path57.slice(currentIndex);
122141
+ normalized += path59.slice(currentIndex);
121933
122142
  return normalized;
121934
122143
  }
121935
122144
  function buildRequest(ctx, operation, def, meta3, dynamicPathParams) {
@@ -122363,8 +122572,8 @@ var OpenAPIGenerator = class {
122363
122572
  customErrorResponseBodySchema: options.customErrorResponseBodySchema
122364
122573
  };
122365
122574
  const errors = [];
122366
- await walkProcedureContractsAsync(router, (contract, path57) => {
122367
- if (value(options.filter, contract, path57) === false) {
122575
+ await walkProcedureContractsAsync(router, (contract, path59) => {
122576
+ if (value(options.filter, contract, path59) === false) {
122368
122577
  return;
122369
122578
  }
122370
122579
  try {
@@ -122376,7 +122585,7 @@ var OpenAPIGenerator = class {
122376
122585
  `QUERY operations require OpenAPI 3.2, but version "${version2}" was requested.`
122377
122586
  );
122378
122587
  }
122379
- const postPath = meta3?.path ?? pathToHttpPath(path57);
122588
+ const postPath = meta3?.path ?? pathToHttpPath(path59);
122380
122589
  const httpPath = meta3?.prefix ? mergeHttpPath(meta3.prefix, postPath) : postPath;
122381
122590
  const dynamicPathParams = getDynamicPathParams(httpPath);
122382
122591
  const openApiPath = toOpenAPIPath(httpPath, dynamicPathParams);
@@ -122385,7 +122594,7 @@ var OpenAPIGenerator = class {
122385
122594
  operation = meta3.spec;
122386
122595
  } else {
122387
122596
  operation = {
122388
- operationId: meta3?.operationId ?? path57.join("."),
122597
+ operationId: meta3?.operationId ?? path59.join("."),
122389
122598
  summary: meta3?.summary,
122390
122599
  description: meta3?.description,
122391
122600
  deprecated: meta3?.deprecated,
@@ -122405,7 +122614,7 @@ var OpenAPIGenerator = class {
122405
122614
  if (!(e14 instanceof OpenAPIGeneratorError)) {
122406
122615
  throw e14;
122407
122616
  }
122408
- errors.push(`Procedure at ${path57.join(".") || "(root)"}: ${e14.message}`);
122617
+ errors.push(`Procedure at ${path59.join(".") || "(root)"}: ${e14.message}`);
122409
122618
  }
122410
122619
  });
122411
122620
  if (errors.length) {
@@ -122713,7 +122922,7 @@ var ResetRowSchema = external_exports.strictObject({
122713
122922
  var ResetScheduleSchema = external_exports.strictObject({ resets: external_exports.readonly(external_exports.array(ResetRowSchema)) });
122714
122923
 
122715
122924
  // src/frontdoor/controlSchemas.ts
122716
- var import_node_path45 = __toESM(require("node:path"), 1);
122925
+ var import_node_path47 = __toESM(require("node:path"), 1);
122717
122926
  init_zod();
122718
122927
  init_schema2();
122719
122928
 
@@ -122925,11 +123134,11 @@ var FrontDoorSessionsOutputSchema = external_exports.strictObject({ sessions: ex
122925
123134
  var CheckRunInputSchema = external_exports.strictObject({
122926
123135
  path: external_exports.string().min(1),
122927
123136
  identity: external_exports.string().min(1).optional()
122928
- }).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" });
123137
+ }).refine((input2) => import_node_path47.default.isAbsolute(input2.path), { message: "path must be absolute: the door cannot resolve a relative path against the caller's working directory" });
122929
123138
  var PoolPickInputSchema = external_exports.strictObject({
122930
123139
  pool: external_exports.string().min(1),
122931
123140
  path: external_exports.string().min(1)
122932
- }).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" });
123141
+ }).refine((input2) => import_node_path47.default.isAbsolute(input2.path), { message: "path must be absolute: the door cannot resolve a relative path against the caller's working directory" });
122933
123142
  var DoctorFindingSchema = external_exports.strictObject({
122934
123143
  section: external_exports.enum(DOCTOR_SECTIONS),
122935
123144
  subject: external_exports.string().optional(),
@@ -123250,16 +123459,16 @@ var StandardLink = class {
123250
123459
  /**
123251
123460
  * @throws ORPCError, transport-level errors (network failures, timeouts, etc.)
123252
123461
  */
123253
- call(path57, input2, options) {
123254
- return runWithSpan(`${ORPC_NAME}.${path57.join("/")}`, (span) => {
123462
+ call(path59, input2, options) {
123463
+ return runWithSpan(`${ORPC_NAME}.${path59.join("/")}`, (span) => {
123255
123464
  span?.setAttribute("rpc.system", ORPC_NAME);
123256
- span?.setAttribute("rpc.method", path57.join("."));
123465
+ span?.setAttribute("rpc.method", path59.join("."));
123257
123466
  if (getTracer() && isAsyncIteratorObject(input2)) {
123258
123467
  input2 = override(input2, traceAsyncIterator("consume_async_iterator_object_input", input2));
123259
123468
  } else if (getTracer() && input2 instanceof ReadableStream) {
123260
123469
  input2 = override(input2, traceReadableStream("consume_octet_stream_input", input2));
123261
123470
  }
123262
- return intercept(this.interceptors, { ...options, path: path57, input: input2 }, async ({ path: path210, input: input22, ...options2 }) => {
123471
+ return intercept(this.interceptors, { ...options, path: path59, input: input2 }, async ({ path: path210, input: input22, ...options2 }) => {
123263
123472
  const tracer = getTracer();
123264
123473
  const activeSpan = tracer?.getActiveSpan() ?? span;
123265
123474
  let request7 = await runWithSpan(
@@ -123316,18 +123525,18 @@ var RPCLinkCodec = class {
123316
123525
  this.headers = options.headers ?? {};
123317
123526
  this.serializer = options.serializer ?? new RPCSerializer();
123318
123527
  }
123319
- async encodeInput(input2, path57, options) {
123320
- let headers = toResolvedStandardHeaders(await value(this.headers, options, path57, input2));
123528
+ async encodeInput(input2, path59, options) {
123529
+ let headers = toResolvedStandardHeaders(await value(this.headers, options, path59, input2));
123321
123530
  if (options.lastEventId !== void 0) {
123322
123531
  headers = mergeStandardHeaders(headers, { "last-event-id": options.lastEventId });
123323
123532
  }
123324
- const expectedMethod = await value(this.expectedMethod, options, path57, input2);
123325
- const baseUrl = await value(this.baseUrl, options, path57, input2);
123533
+ const expectedMethod = await value(this.expectedMethod, options, path59, input2);
123534
+ const baseUrl = await value(this.baseUrl, options, path59, input2);
123326
123535
  const [pathname, search, hash2] = parseStandardUrl(baseUrl);
123327
- const newPathname = `${pathname.replace(END_SLASH_REGEX, "")}${pathToHttpPath(path57)}`;
123536
+ const newPathname = `${pathname.replace(END_SLASH_REGEX, "")}${pathToHttpPath(path59)}`;
123328
123537
  const serialized = this.serializer.serialize(input2);
123329
123538
  if (expectedMethod === "GET" && !(serialized instanceof Blob) && !(serialized instanceof ReadableStream) && !(serialized instanceof FormData) && !isAsyncIteratorObject(serialized)) {
123330
- const maxUrlLength = await value(this.maxUrlLength, options, path57, input2);
123539
+ const maxUrlLength = await value(this.maxUrlLength, options, path59, input2);
123331
123540
  const mergedSearch = new URLSearchParams(search);
123332
123541
  mergedSearch.append("data", stringifyJSON(serialized) ?? "");
123333
123542
  const url22 = `${newPathname}?${mergedSearch}${hash2 ?? ""}`;
@@ -123412,8 +123621,8 @@ var FetchLinkTransport = class {
123412
123621
  this.fetch = options.fetch ?? ((url2, init) => globalThis.fetch(url2, init));
123413
123622
  this.toFetchRequestOptions = options.toFetchRequest;
123414
123623
  }
123415
- async send(standardRequest, path57, options) {
123416
- let origin = await value(this.origin, options, path57);
123624
+ async send(standardRequest, path59, options) {
123625
+ let origin = await value(this.origin, options, path59);
123417
123626
  if (origin?.endsWith("/")) {
123418
123627
  origin = origin.slice(0, -1);
123419
123628
  }
@@ -123433,7 +123642,7 @@ var FetchLinkTransport = class {
123433
123642
  }
123434
123643
  }
123435
123644
  const fetch3 = this.fetch;
123436
- const response = await fetch3(url2, init, options, path57);
123645
+ const response = await fetch3(url2, init, options, path59);
123437
123646
  const standardResponse = toStandardLazyResponse(response);
123438
123647
  return standardResponse;
123439
123648
  }
@@ -123824,14 +124033,14 @@ var StandardHandler = class {
123824
124033
  span?.setAttribute("url.path", request22.url);
123825
124034
  return { matched: false };
123826
124035
  }
123827
- const { path: path57, procedure, decodeInput } = matchedOrNot;
123828
- span?.updateName(`${ORPC_NAME}.${path57.join("/")}`);
124036
+ const { path: path59, procedure, decodeInput } = matchedOrNot;
124037
+ span?.updateName(`${ORPC_NAME}.${path59.join("/")}`);
123829
124038
  span?.setAttribute("rpc.system", ORPC_NAME);
123830
- span?.setAttribute("rpc.method", path57.join("."));
124039
+ span?.setAttribute("rpc.method", path59.join("."));
123831
124040
  try {
123832
124041
  const response = await intercept(
123833
124042
  this.interceptors,
123834
- { context: context2, prefix: prefix2, request: request22, path: path57, procedure, decodeInput },
124043
+ { context: context2, prefix: prefix2, request: request22, path: path59, procedure, decodeInput },
123835
124044
  async ({ context: context3, prefix: prefix3, request: request32, path: path210, procedure: procedure2, decodeInput: decodeInput2 }) => {
123836
124045
  step2 = "decode_input";
123837
124046
  let input2 = await runWithSpan("decode_input", decodeInput2);
@@ -123865,7 +124074,7 @@ var StandardHandler = class {
123865
124074
  message: `Malformed request. Ensure the request body is properly formatted and the 'Content-Type' header is set correctly.`,
123866
124075
  cause: e14
123867
124076
  }) : toORPCError(e14);
123868
- const response = await this.codec.encodeError(error63, procedure, path57, { context: context2, prefix: prefix2 });
124077
+ const response = await this.codec.encodeError(error63, procedure, path59, { context: context2, prefix: prefix2 });
123869
124078
  return { matched: true, response };
123870
124079
  }
123871
124080
  }
@@ -123971,7 +124180,7 @@ var RPCMatcher = class {
123971
124180
  this.rootRouter = router;
123972
124181
  this.index(router);
123973
124182
  }
123974
- index(router, path57 = []) {
124183
+ index(router, path59 = []) {
123975
124184
  const lazyResults = walkProcedureContractsSync(router, (procedure, procedurePath) => {
123976
124185
  if (!value(this.filter, procedure, procedurePath)) {
123977
124186
  return;
@@ -123982,7 +124191,7 @@ var RPCMatcher = class {
123982
124191
  // contract-first entries have no implementation yet, resolveProcedure fills it in on demand
123983
124192
  procedure: procedure instanceof Procedure ? procedure : void 0
123984
124193
  });
123985
- }, path57);
124194
+ }, path59);
123986
124195
  for (const result of lazyResults) {
123987
124196
  this.pendingLazyRouters.set(pathToHttpPath(result.path), result);
123988
124197
  }
@@ -124114,10 +124323,10 @@ var RPCHandlerCodec = class {
124114
124323
  }
124115
124324
  };
124116
124325
  }
124117
- encodeOutput(output2, procedure, path57, options) {
124326
+ encodeOutput(output2, procedure, path59, options) {
124118
124327
  return {
124119
124328
  headers: {},
124120
- status: value(this.outputStatus, output2, procedure, path57, options) ?? DEFAULT_SUCCESS_STATUS,
124329
+ status: value(this.outputStatus, output2, procedure, path59, options) ?? DEFAULT_SUCCESS_STATUS,
124121
124330
  body: this.serializer.serialize(output2)
124122
124331
  };
124123
124332
  }
@@ -124171,39 +124380,39 @@ function createRouter() {
124171
124380
  static: new NullProtoObj2()
124172
124381
  };
124173
124382
  }
124174
- function scanFirstGroup(path57) {
124383
+ function scanFirstGroup(path59) {
124175
124384
  let i10 = 0;
124176
124385
  let depth = 0;
124177
- for (; i10 < path57.length; i10++) {
124178
- const c10 = path57.charCodeAt(i10);
124386
+ for (; i10 < path59.length; i10++) {
124387
+ const c10 = path59.charCodeAt(i10);
124179
124388
  if (c10 === 92) i10++;
124180
124389
  else if (c10 === 40) depth++;
124181
124390
  else if (c10 === 41 && depth > 0) depth--;
124182
124391
  else if (c10 === 123 && depth === 0) break;
124183
124392
  }
124184
- if (i10 >= path57.length) return;
124393
+ if (i10 >= path59.length) return;
124185
124394
  let j10 = i10 + 1;
124186
124395
  depth = 0;
124187
- for (; j10 < path57.length; j10++) {
124188
- const c10 = path57.charCodeAt(j10);
124396
+ for (; j10 < path59.length; j10++) {
124397
+ const c10 = path59.charCodeAt(j10);
124189
124398
  if (c10 === 92) j10++;
124190
124399
  else if (c10 === 40) depth++;
124191
124400
  else if (c10 === 41 && depth > 0) depth--;
124192
124401
  else if (c10 === 125 && depth === 0) break;
124193
124402
  }
124194
- if (j10 >= path57.length) return;
124195
- const mod = path57[j10 + 1];
124403
+ if (j10 >= path59.length) return;
124404
+ const mod = path59[j10 + 1];
124196
124405
  const hasMod = mod === "?" || mod === "+" || mod === "*";
124197
124406
  return [
124198
- path57.slice(0, i10),
124199
- path57.slice(i10 + 1, j10),
124200
- path57.slice(j10 + (hasMod ? 2 : 1)),
124407
+ path59.slice(0, i10),
124408
+ path59.slice(i10 + 1, j10),
124409
+ path59.slice(j10 + (hasMod ? 2 : 1)),
124201
124410
  hasMod ? mod : void 0
124202
124411
  ];
124203
124412
  }
124204
- function expandGroupDelimiters(path57) {
124205
- if (!path57.includes("{")) return;
124206
- const group = scanFirstGroup(path57);
124413
+ function expandGroupDelimiters(path59) {
124414
+ if (!path59.includes("{")) return;
124415
+ const group = scanFirstGroup(path59);
124207
124416
  if (!group) return;
124208
124417
  const [pre2, body, suf, mod] = group;
124209
124418
  if (!mod) return [pre2 + body + suf];
@@ -124273,9 +124482,9 @@ function replaceSegmentWildcards(segment, unnamedStart, toGroupKey = toUnnamedGr
124273
124482
  }
124274
124483
  return [replaced, nextIndex];
124275
124484
  }
124276
- function encodeEscapes(path57) {
124277
- if (!path57.includes("\\")) return path57;
124278
- return path57.replace(/\\([:(){}])/g, (_, c10) => "\uFFFD" + "ABCDE"[":(){}".indexOf(c10)]);
124485
+ function encodeEscapes(path59) {
124486
+ if (!path59.includes("\\")) return path59;
124487
+ return path59.replace(/\\([:(){}])/g, (_, c10) => "\uFFFD" + "ABCDE"[":(){}".indexOf(c10)]);
124279
124488
  }
124280
124489
  function segmentKey(segment) {
124281
124490
  if (segment.startsWith("**")) return 2;
@@ -124304,22 +124513,22 @@ function expandModifiers(segments) {
124304
124513
  return m10[2] === "+" ? [wc2] : [wc2, without];
124305
124514
  }
124306
124515
  }
124307
- function normalizePath(path57) {
124308
- if (!path57.includes("/.")) return path57;
124516
+ function normalizePath(path59) {
124517
+ if (!path59.includes("/.")) return path59;
124309
124518
  const r10 = [];
124310
- for (const s of path57.split("/")) if (s === ".") continue;
124519
+ for (const s of path59.split("/")) if (s === ".") continue;
124311
124520
  else if (s === ".." && r10.length > 1) r10.pop();
124312
124521
  else r10.push(s);
124313
124522
  return r10.join("/") || "/";
124314
124523
  }
124315
- function splitPath(path57) {
124316
- const s = path57.split("/");
124524
+ function splitPath(path59) {
124525
+ const s = path59.split("/");
124317
124526
  s.shift();
124318
124527
  if (s[s.length - 1] === "") s.pop();
124319
124528
  return s;
124320
124529
  }
124321
- function splitRoute(path57) {
124322
- const s = splitPath(path57);
124530
+ function splitRoute(path59) {
124531
+ const s = splitPath(path59);
124323
124532
  while (s[s.length - 1] === "") s.pop();
124324
124533
  return s;
124325
124534
  }
@@ -124335,16 +124544,16 @@ function getMatchParams(segments, paramsMap) {
124335
124544
  }
124336
124545
  return params;
124337
124546
  }
124338
- function addRoute(ctx, method = "", path57, data) {
124547
+ function addRoute(ctx, method = "", path59, data) {
124339
124548
  method = method.toUpperCase();
124340
- if (path57.charCodeAt(0) !== 47) path57 = `/${path57}`;
124341
- const groupExpanded = expandGroupDelimiters(path57);
124549
+ if (path59.charCodeAt(0) !== 47) path59 = `/${path59}`;
124550
+ const groupExpanded = expandGroupDelimiters(path59);
124342
124551
  if (groupExpanded) {
124343
124552
  for (const expandedPath of groupExpanded) addRoute(ctx, method, expandedPath, data);
124344
124553
  return;
124345
124554
  }
124346
- path57 = encodeEscapes(path57);
124347
- const segments = splitRoute(path57);
124555
+ path59 = encodeEscapes(path59);
124556
+ const segments = splitRoute(path59);
124348
124557
  const expanded = expandModifiers(segments);
124349
124558
  if (expanded) {
124350
124559
  for (const p of expanded) addRoute(ctx, method, p, data);
@@ -124435,15 +124644,15 @@ function getParamRegexp(segment, unnamedStart = 0) {
124435
124644
  const regex = _s2.replace(/:([\w-]+)(?:\(([^)]*)\))?/g, (_, id2, p) => `(?<${toGroupName(id2)}>${p || "[^/]+"})`).replace(/\((?![?<])/g, () => `(?<${toUnnamedGroupKey(_i2++)}>`).replace(/\uFFFE(.)/g, (_, c10) => /[.*+?^${}()|[\]\\]/.test(c10) ? `\\${c10}` : c10);
124436
124645
  return [new RegExp(`^${regex}$`), _i2];
124437
124646
  }
124438
- function findRoute(ctx, method = "", path57, opts) {
124439
- if (opts?.normalize) path57 = normalizePath(path57);
124440
- if (path57.charCodeAt(path57.length - 1) === 47) path57 = path57.slice(0, -1);
124441
- const staticNode = ctx.static[path57];
124647
+ function findRoute(ctx, method = "", path59, opts) {
124648
+ if (opts?.normalize) path59 = normalizePath(path59);
124649
+ if (path59.charCodeAt(path59.length - 1) === 47) path59 = path59.slice(0, -1);
124650
+ const staticNode = ctx.static[path59];
124442
124651
  if (staticNode && staticNode.methods) {
124443
124652
  const staticMatch = staticNode.methods[method] || staticNode.methods[""];
124444
124653
  if (staticMatch !== void 0) return staticMatch[0];
124445
124654
  }
124446
- const segments = splitPath(path57);
124655
+ const segments = splitPath(path59);
124447
124656
  const match = _lookupTree(ctx.root, method, segments, 0);
124448
124657
  if (match === void 0) return;
124449
124658
  if (opts?.params === false) return match;
@@ -124643,7 +124852,7 @@ var OpenAPIMatcher = class {
124643
124852
  this.rootRouter = router;
124644
124853
  this.index(router);
124645
124854
  }
124646
- index(router, path57 = []) {
124855
+ index(router, path59 = []) {
124647
124856
  const lazyResults = walkProcedureContractsSync(router, (contract, path210) => {
124648
124857
  if (!value(this.filter, contract, path210)) {
124649
124858
  return;
@@ -124658,7 +124867,7 @@ var OpenAPIMatcher = class {
124658
124867
  contract,
124659
124868
  procedure: contract instanceof Procedure ? contract : void 0
124660
124869
  });
124661
- }, path57);
124870
+ }, path59);
124662
124871
  for (const result of lazyResults) {
124663
124872
  const prefix = getOpenAPIMeta(result.router)?.prefix;
124664
124873
  this.pendingLazyRouters.add({
@@ -124745,20 +124954,20 @@ var OpenAPIMatcher = class {
124745
124954
  return entry.procedure;
124746
124955
  }
124747
124956
  };
124748
- function toRou3Pattern(path57) {
124749
- const params = getDynamicPathParams(path57);
124957
+ function toRou3Pattern(path59) {
124958
+ const params = getDynamicPathParams(path59);
124750
124959
  if (!params?.length) {
124751
- return path57;
124960
+ return path59;
124752
124961
  }
124753
124962
  for (let i10 = params.length - 1; i10 >= 0; i10--) {
124754
124963
  const param = params[i10];
124755
124964
  const pattern = param.allowsSlash ? `**:${param.parameterName}` : `:${param.parameterName}`;
124756
- path57 = path57.slice(0, param.startIndex) + pattern + path57.slice(param.startIndex + param.segment.length);
124965
+ path59 = path59.slice(0, param.startIndex) + pattern + path59.slice(param.startIndex + param.segment.length);
124757
124966
  }
124758
- return path57;
124967
+ return path59;
124759
124968
  }
124760
- function toRou3PrefixMatcher(path57) {
124761
- const pattern = toRou3Pattern(path57);
124969
+ function toRou3PrefixMatcher(path59) {
124970
+ const pattern = toRou3Pattern(path59);
124762
124971
  return routeToRegExp(pattern === "/" ? "/**" : `${pattern}/**`);
124763
124972
  }
124764
124973
  function decodeParams(params) {
@@ -124837,7 +125046,7 @@ var OpenAPIHandlerCodecCore = class {
124837
125046
  /**
124838
125047
  * @throws {TypeError} If `outputStructure` is "detailed" and the output doesn't match the expected structure.
124839
125048
  */
124840
- encodeOutput(output2, procedure, path57) {
125049
+ encodeOutput(output2, procedure, path59) {
124841
125050
  const meta3 = getOpenAPIMeta(procedure);
124842
125051
  const successStatus = meta3?.successStatus ?? DEFAULT_SUCCESS_STATUS;
124843
125052
  const outputStructure = meta3?.outputStructure ?? DEFAULT_OPENAPI_OUTPUT_STRUCTURE;
@@ -124850,7 +125059,7 @@ var OpenAPIHandlerCodecCore = class {
124850
125059
  }
124851
125060
  if (!isValidDetailedOutput(output2)) {
124852
125061
  throw new TypeError(`
124853
- Invalid "detailed" output structure returned by procedure (${path57.join(".")}):
125062
+ Invalid "detailed" output structure returned by procedure (${path59.join(".")}):
124854
125063
  \u2022 Expected an object with optional properties:
124855
125064
  - status (number <400)
124856
125065
  - headers (object)
@@ -125403,7 +125612,7 @@ function profileValue(name, paths) {
125403
125612
  function createConfigApiRouter(deps) {
125404
125613
  const authed = doorApiAuth(deps.expectedToken);
125405
125614
  const { paths } = deps;
125406
- const route = (path57, summary) => authed.meta(openapi({ method: "POST", path: path57, summary, tags: [CONFIG_API_TAG] }));
125615
+ const route = (path59, summary) => authed.meta(openapi({ method: "POST", path: path59, summary, tags: [CONFIG_API_TAG] }));
125407
125616
  return {
125408
125617
  config: {
125409
125618
  identity: {
@@ -125758,7 +125967,7 @@ function createLifecycleApiRouter(deps) {
125758
125967
  init_cliError();
125759
125968
 
125760
125969
  // src/frontdoor/launchSchemas.ts
125761
- var import_node_path46 = __toESM(require("node:path"), 1);
125970
+ var import_node_path48 = __toESM(require("node:path"), 1);
125762
125971
  init_zod();
125763
125972
  init_claudeVersion();
125764
125973
  init_identity();
@@ -125768,7 +125977,7 @@ var LaunchResolveInputSchema = external_exports.strictObject({
125768
125977
  argv: external_exports.readonly(external_exports.array(external_exports.string())).optional(),
125769
125978
  /** 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. */
125770
125979
  env: external_exports.record(external_exports.string(), external_exports.string()).optional()
125771
- }).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" });
125980
+ }).refine((input2) => import_node_path48.default.isAbsolute(input2.path), { message: "path must be absolute: the door cannot resolve a relative path against the caller's working directory" });
125772
125981
  var LaunchPoolDecisionSchema = external_exports.strictObject({
125773
125982
  name: external_exports.string(),
125774
125983
  reasons: external_exports.readonly(external_exports.array(external_exports.string())),
@@ -127360,8 +127569,8 @@ function createCodexRouteMount(ports, upstreamBase, provider) {
127360
127569
  request7.body.resume();
127361
127570
  return;
127362
127571
  }
127363
- const path57 = new URL(request7.url, "http://127.0.0.1").pathname;
127364
- const translated = { method: request7.method, path: path57, body, signal: request7.signal };
127572
+ const path59 = new URL(request7.url, "http://127.0.0.1").pathname;
127573
+ const translated = { method: request7.method, path: path59, body, signal: request7.signal };
127365
127574
  const routed = await route(translated);
127366
127575
  if (request7.signal.aborted) {
127367
127576
  return;
@@ -127395,7 +127604,7 @@ function createPassthroughRoute(name, target) {
127395
127604
  headroomUpstream: target.headroomUpstream,
127396
127605
  serve: async (request7, response) => {
127397
127606
  const incoming = new URL(request7.url, "http://127.0.0.1");
127398
- const path57 = target.stripPrefix !== void 0 && incoming.pathname.startsWith(target.stripPrefix) ? incoming.pathname.slice(target.stripPrefix.length) : incoming.pathname;
127607
+ const path59 = target.stripPrefix !== void 0 && incoming.pathname.startsWith(target.stripPrefix) ? incoming.pathname.slice(target.stripPrefix.length) : incoming.pathname;
127399
127608
  const headers = forwardableHeaders(request7.headers);
127400
127609
  delete headers.host;
127401
127610
  await new Promise((resolve2) => {
@@ -127403,7 +127612,7 @@ function createPassthroughRoute(name, target) {
127403
127612
  host: base.hostname,
127404
127613
  port: base.port === "" ? void 0 : Number(base.port),
127405
127614
  method: request7.method,
127406
- path: `${basePath}${path57}${incoming.search}`,
127615
+ path: `${basePath}${path59}${incoming.search}`,
127407
127616
  headers,
127408
127617
  agent
127409
127618
  };
@@ -127536,7 +127745,7 @@ async function scanRequestHead(request7, wholeBody = false) {
127536
127745
 
127537
127746
  // src/frontdoor/providerRoute.ts
127538
127747
  function createProviderRouteResolver(deps) {
127539
- const isRcSelfHostPath = (path57) => path57 === "/v1/code/sessions" || path57.startsWith("/v1/code/sessions/") || path57 === "/v1/sessions" || path57.startsWith("/v1/sessions/");
127748
+ const isRcSelfHostPath = (path59) => path59 === "/v1/code/sessions" || path59.startsWith("/v1/code/sessions/") || path59 === "/v1/sessions" || path59.startsWith("/v1/sessions/");
127540
127749
  const oauthRoute = createPassthroughRoute("anthropic", { baseUrl: `https://${CONNECT_INTERCEPT_HOST}:${String(HTTPS_PORT)}`, stripPrefix: void 0, headroomUpstream: void 0 });
127541
127750
  const passthroughByTarget = /* @__PURE__ */ new Map();
127542
127751
  const passthroughFor = (name, target) => {
@@ -127550,16 +127759,16 @@ function createProviderRouteResolver(deps) {
127550
127759
  return route;
127551
127760
  };
127552
127761
  const resolve2 = (request7) => {
127553
- const path57 = new URL(request7.url, "http://127.0.0.1").pathname;
127554
- const scoped = parseProviderPath(path57);
127762
+ const path59 = new URL(request7.url, "http://127.0.0.1").pathname;
127763
+ const scoped = parseProviderPath(path59);
127555
127764
  if (scoped === void 0) {
127556
- if (deps.rcSelfHostRoute !== void 0 && isRcSelfHostPath(path57)) {
127765
+ if (deps.rcSelfHostRoute !== void 0 && isRcSelfHostPath(path59)) {
127557
127766
  return { ok: true, route: deps.rcSelfHostRoute };
127558
127767
  }
127559
- if (request7.session.provider !== void 0 && path57.startsWith("/v1/") && !isRcSelfHostPath(path57)) {
127768
+ if (request7.session.provider !== void 0 && path59.startsWith("/v1/") && !isRcSelfHostPath(path59)) {
127560
127769
  return resolve2({ ...request7, url: `${PROVIDER_PATH_PREFIX}${encodeURIComponent(request7.session.provider)}${request7.url}` });
127561
127770
  }
127562
- return path57.startsWith("/v1/") ? { ok: true, route: oauthRoute } : { ok: false, status: HTTP_STATUS.notFound, message: `no such endpoint: ${path57}` };
127771
+ return path59.startsWith("/v1/") ? { ok: true, route: oauthRoute } : { ok: false, status: HTTP_STATUS.notFound, message: `no such endpoint: ${path59}` };
127563
127772
  }
127564
127773
  const { provider } = scoped;
127565
127774
  let definition;
@@ -127612,8 +127821,8 @@ function createProviderRouteResolver(deps) {
127612
127821
  let replay;
127613
127822
  const visited = /* @__PURE__ */ new Set();
127614
127823
  for (; ; ) {
127615
- const path57 = new URL(current.url, "http://127.0.0.1").pathname;
127616
- const scoped = parseProviderPath(path57);
127824
+ const path59 = new URL(current.url, "http://127.0.0.1").pathname;
127825
+ const scoped = parseProviderPath(path59);
127617
127826
  const providerName = scoped?.provider ?? current.session.provider;
127618
127827
  if (providerName !== void 0 && visited.has(providerName)) {
127619
127828
  return { ok: false, status: HTTP_STATUS.internalServerError, message: `provider routing cycle: ${[...visited, providerName].join(" -> ")}` };
@@ -127671,7 +127880,7 @@ function createProviderRouteResolver(deps) {
127671
127880
  const headers = Object.fromEntries(Object.entries(replay.headers).filter(([name]) => name.toLowerCase() !== "content-length"));
127672
127881
  replay = { ...replay, headers, body: import_node_stream3.Readable.from([Buffer.from(rewritten, "utf8")]) };
127673
127882
  }
127674
- const rest = scoped === void 0 ? path57 : path57.slice(`${PROVIDER_PATH_PREFIX}${encodeURIComponent(scoped.provider)}`.length);
127883
+ const rest = scoped === void 0 ? path59 : path59.slice(`${PROVIDER_PATH_PREFIX}${encodeURIComponent(scoped.provider)}`.length);
127675
127884
  const query = current.url.includes("?") ? current.url.slice(current.url.indexOf("?")) : "";
127676
127885
  current = { ...current, url: `${PROVIDER_PATH_PREFIX}${encodeURIComponent(matched.provider)}${rest}${query}`, body: replay.body, headers: replay.headers };
127677
127886
  }
@@ -127778,7 +127987,7 @@ function createRcLiveUsage(deps) {
127778
127987
  }
127779
127988
 
127780
127989
  // src/frontdoor/rcSelfHostMint.ts
127781
- var import_node_path47 = __toESM(require("node:path"), 1);
127990
+ var import_node_path49 = __toESM(require("node:path"), 1);
127782
127991
  init_account();
127783
127992
 
127784
127993
  // src/frontdoor/rcSelfHostLocal.ts
@@ -127894,8 +128103,8 @@ var SELF_HOST_SUBSCRIPTION_TYPE = "max";
127894
128103
  function isRecord8(value2) {
127895
128104
  return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
127896
128105
  }
127897
- function readJsonObject(fs22, file2) {
127898
- const raw = fs22.readFileUtf8(file2);
128106
+ function readJsonObject(fs23, file2) {
128107
+ const raw = fs23.readFileUtf8(file2);
127899
128108
  if (raw === void 0) {
127900
128109
  return void 0;
127901
128110
  }
@@ -127907,8 +128116,8 @@ function readJsonObject(fs22, file2) {
127907
128116
  }
127908
128117
  return isRecord8(parsed) ? parsed : void 0;
127909
128118
  }
127910
- function readRcSelfHostRecord(fs22, frontdoorDir) {
127911
- const parsed = readJsonObject(fs22, import_node_path47.default.join(frontdoorDir, RC_SELF_HOST_RECORD_DIR, RC_SELF_HOST_RECORD_FILE));
128119
+ function readRcSelfHostRecord(fs23, frontdoorDir) {
128120
+ const parsed = readJsonObject(fs23, import_node_path49.default.join(frontdoorDir, RC_SELF_HOST_RECORD_DIR, RC_SELF_HOST_RECORD_FILE));
127912
128121
  if (parsed === void 0) {
127913
128122
  return void 0;
127914
128123
  }
@@ -127922,11 +128131,11 @@ function mintRcSelfHostCredential(deps) {
127922
128131
  if (!isIdentityName(deps.identity)) {
127923
128132
  throw new Error(`"${deps.identity}" is not a valid identity name.`);
127924
128133
  }
127925
- const identityDir = import_node_path47.default.join(deps.identitiesDir, deps.identity);
127926
- const credentialsFile = import_node_path47.default.join(identityDir, CREDENTIALS_FILE2);
127927
- const claudeJsonFile = import_node_path47.default.join(identityDir, CLAUDE_JSON2);
127928
- const recordDir = import_node_path47.default.join(deps.frontdoorDir, RC_SELF_HOST_RECORD_DIR);
127929
- const recordFile = import_node_path47.default.join(recordDir, RC_SELF_HOST_RECORD_FILE);
128134
+ const identityDir = import_node_path49.default.join(deps.identitiesDir, deps.identity);
128135
+ const credentialsFile = import_node_path49.default.join(identityDir, CREDENTIALS_FILE2);
128136
+ const claudeJsonFile = import_node_path49.default.join(identityDir, CLAUDE_JSON2);
128137
+ const recordDir = import_node_path49.default.join(deps.frontdoorDir, RC_SELF_HOST_RECORD_DIR);
128138
+ const recordFile = import_node_path49.default.join(recordDir, RC_SELF_HOST_RECORD_FILE);
127930
128139
  const previousRecord = readRcSelfHostRecord(deps.fs, deps.frontdoorDir);
127931
128140
  const existingCredentials = readJsonObject(deps.fs, credentialsFile);
127932
128141
  const existingOauth = isRecord8(existingCredentials?.claudeAiOauth) ? existingCredentials.claudeAiOauth : void 0;
@@ -127942,7 +128151,7 @@ function mintRcSelfHostCredential(deps) {
127942
128151
  const organizationUuid = deps.newUuid();
127943
128152
  const accountUuid = deps.newUuid();
127944
128153
  const mintedAt = new Date(deps.now()).toISOString();
127945
- deps.fs.mkdirPrivate(import_node_path47.default.dirname(credentialsFile));
128154
+ deps.fs.mkdirPrivate(import_node_path49.default.dirname(credentialsFile));
127946
128155
  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)}
127947
128156
  `);
127948
128157
  const claudeJson = readJsonObject(deps.fs, claudeJsonFile) ?? {};
@@ -128329,7 +128538,7 @@ function registerRcCommand(frontdoor, paths) {
128329
128538
  }
128330
128539
 
128331
128540
  // src/frontdoor/rcCredentialStore.ts
128332
- var import_node_path48 = __toESM(require("node:path"), 1);
128541
+ var import_node_path50 = __toESM(require("node:path"), 1);
128333
128542
  function isSafeSessionId(sessionId) {
128334
128543
  return /^[A-Za-z0-9_-]+$/.test(sessionId);
128335
128544
  }
@@ -128353,11 +128562,11 @@ function credentialOfJson(parsed) {
128353
128562
  function sequenceNumOfJson(value2) {
128354
128563
  return typeof value2 === "number" && Number.isInteger(value2) && value2 >= 0 ? value2 : void 0;
128355
128564
  }
128356
- function createRcCredentialStore(fs22, dir) {
128357
- fs22.mkdirPrivate(dir);
128358
- const fileFor = (sessionId) => import_node_path48.default.join(dir, `${sessionId}.json`);
128565
+ function createRcCredentialStore(fs23, dir) {
128566
+ fs23.mkdirPrivate(dir);
128567
+ const fileFor = (sessionId) => import_node_path50.default.join(dir, `${sessionId}.json`);
128359
128568
  const readParsed = (sessionId) => {
128360
- const raw = fs22.readFileUtf8(fileFor(sessionId));
128569
+ const raw = fs23.readFileUtf8(fileFor(sessionId));
128361
128570
  if (raw === void 0) {
128362
128571
  return void 0;
128363
128572
  }
@@ -128382,7 +128591,7 @@ function createRcCredentialStore(fs22, dir) {
128382
128591
  }
128383
128592
  const cursor3 = sequenceNumOfJson(readParsed(sessionId)?.highestSequenceNum);
128384
128593
  const record2 = { ...credential, ...cursor3 === void 0 ? {} : { highestSequenceNum: cursor3 } };
128385
- fs22.writeFilePrivate(fileFor(sessionId), `${JSON.stringify(record2, null, 2)}
128594
+ fs23.writeFilePrivate(fileFor(sessionId), `${JSON.stringify(record2, null, 2)}
128386
128595
  `);
128387
128596
  },
128388
128597
  readCursor: (sessionId) => {
@@ -128397,14 +128606,14 @@ function createRcCredentialStore(fs22, dir) {
128397
128606
  }
128398
128607
  const credential = credentialOfJson(readParsed(sessionId));
128399
128608
  const record2 = credential === void 0 ? { highestSequenceNum } : { ...credential, highestSequenceNum };
128400
- fs22.writeFilePrivate(fileFor(sessionId), `${JSON.stringify(record2, null, 2)}
128609
+ fs23.writeFilePrivate(fileFor(sessionId), `${JSON.stringify(record2, null, 2)}
128401
128610
  `);
128402
128611
  },
128403
128612
  remove: (sessionId) => {
128404
128613
  if (!isSafeSessionId(sessionId)) {
128405
128614
  return;
128406
128615
  }
128407
- fs22.removeRecursive(fileFor(sessionId));
128616
+ fs23.removeRecursive(fileFor(sessionId));
128408
128617
  }
128409
128618
  };
128410
128619
  }
@@ -130524,8 +130733,8 @@ function createRealQuotaRefresher(params) {
130524
130733
  // src/frontdoor/commands.ts
130525
130734
  init_store2();
130526
130735
  function appendLog(paths, line) {
130527
- import_node_fs17.default.mkdirSync(paths.logsDir, { recursive: true });
130528
- import_node_fs17.default.appendFileSync(paths.frontdoorLogPath, `${(/* @__PURE__ */ new Date()).toISOString()} ${line}
130736
+ import_node_fs18.default.mkdirSync(paths.logsDir, { recursive: true });
130737
+ import_node_fs18.default.appendFileSync(paths.frontdoorLogPath, `${(/* @__PURE__ */ new Date()).toISOString()} ${line}
130529
130738
  `);
130530
130739
  }
130531
130740
  function rcObservingResolver(resolve2, tracker, hub) {
@@ -130538,7 +130747,7 @@ function rcObservingResolver(resolve2, tracker, hub) {
130538
130747
  }
130539
130748
  function realStatOwnExecutable(watchPath) {
130540
130749
  return () => {
130541
- const st2 = import_node_fs17.default.statSync(watchPath, { throwIfNoEntry: false });
130750
+ const st2 = import_node_fs18.default.statSync(watchPath, { throwIfNoEntry: false });
130542
130751
  return st2?.isFile() !== true ? void 0 : { dev: st2.dev, ino: st2.ino, size: st2.size, mtimeMs: st2.mtimeMs };
130543
130752
  };
130544
130753
  }
@@ -130688,7 +130897,7 @@ function realFrontDoorSupervisorPorts(paths) {
130688
130897
  log(`job keeper failed: ${error63 instanceof Error ? error63.message : String(error63)}`);
130689
130898
  }
130690
130899
  }, ANTHROPIC_USAGE_FRESHNESS_MS).unref();
130691
- const headroomDecision = createHeadroomDecision();
130900
+ const headroomDecision = createHeadroomDecision(createRoutingSettingReader(paths));
130692
130901
  const recordUsage = withQuotaRefresh(usageStore.record, quotaRefresher);
130693
130902
  const usageMiddleware = createUsageMiddleware({
130694
130903
  // Each finished response also tells the per-session headroom decision when the session's cache was last touched and whether it read from it.
@@ -130730,7 +130939,7 @@ function realFrontDoorSupervisorPorts(paths) {
130730
130939
  },
130731
130940
  isRunning: realIsProcessRunning,
130732
130941
  // 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).
130733
- statOwnExecutable: realStatOwnExecutable(watchedInstallEntry(realOwnExecutablePath(), (candidate) => import_node_fs17.default.existsSync(candidate))),
130942
+ statOwnExecutable: realStatOwnExecutable(watchedInstallEntry(realOwnExecutablePath(), (candidate) => import_node_fs18.default.existsSync(candidate))),
130734
130943
  startProviderListener: async (preferredPort) => {
130735
130944
  const authority = loadCa();
130736
130945
  const rcDial = rcSelfHost ? lateRcEventDial(rcSelfHostDialTarget) : realRcEventDial();
@@ -130842,7 +131051,7 @@ function realFrontDoorSupervisorPorts(paths) {
130842
131051
  const leafFor = createLeafCache(loadCa(), () => /* @__PURE__ */ new Date());
130843
131052
  const capture = captureFromEnv(process.env, paths.logsDir);
130844
131053
  if (capture !== void 0) {
130845
- log(`capture enabled, recording CONNECT targets and piped exchanges to ${import_node_path49.default.join(paths.logsDir, "frontdoor-capture.jsonl")}`);
131054
+ log(`capture enabled, recording CONNECT targets and piped exchanges to ${import_node_path51.default.join(paths.logsDir, "frontdoor-capture.jsonl")}`);
130846
131055
  }
130847
131056
  if (rcSelfHostSurface !== void 0) {
130848
131057
  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");
@@ -132979,8 +133188,8 @@ function getErrorMap2() {
132979
133188
 
132980
133189
  // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v3/helpers/parseUtil.js
132981
133190
  var makeIssue = (params) => {
132982
- const { data, path: path57, errorMaps, issueData } = params;
132983
- const fullPath = [...path57, ...issueData.path || []];
133191
+ const { data, path: path59, errorMaps, issueData } = params;
133192
+ const fullPath = [...path59, ...issueData.path || []];
132984
133193
  const fullIssue = {
132985
133194
  ...issueData,
132986
133195
  path: fullPath
@@ -133095,11 +133304,11 @@ var errorUtil;
133095
133304
 
133096
133305
  // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v3/types.js
133097
133306
  var ParseInputLazyPath = class {
133098
- constructor(parent, value2, path57, key) {
133307
+ constructor(parent, value2, path59, key) {
133099
133308
  this._cachedPath = [];
133100
133309
  this.parent = parent;
133101
133310
  this.data = value2;
133102
- this._path = path57;
133311
+ this._path = path59;
133103
133312
  this._key = key;
133104
133313
  }
133105
133314
  get path() {
@@ -136662,11 +136871,11 @@ function normalizeObjectSchema(schema) {
136662
136871
  }
136663
136872
  return void 0;
136664
136873
  }
136665
- function getDotPath(path57) {
136666
- if (path57.length === 0) {
136874
+ function getDotPath(path59) {
136875
+ if (path59.length === 0) {
136667
136876
  return "object root";
136668
136877
  }
136669
- return path57.reduce((acc, seg, index) => {
136878
+ return path59.reduce((acc, seg, index) => {
136670
136879
  if (index === 0) {
136671
136880
  return String(seg);
136672
136881
  }
@@ -140708,8 +140917,8 @@ async function serveMcp(mcp, transport, options = {}) {
140708
140917
  }
140709
140918
 
140710
140919
  // src/mcp/permissions.ts
140711
- var import_node_fs18 = __toESM(require("node:fs"), 1);
140712
- var import_node_path50 = __toESM(require("node:path"), 1);
140920
+ var import_node_fs19 = __toESM(require("node:fs"), 1);
140921
+ var import_node_path52 = __toESM(require("node:path"), 1);
140713
140922
  init_zod();
140714
140923
  init_store();
140715
140924
  var StoredMcpPermissionsSchema = external_exports.strictObject({
@@ -140725,16 +140934,16 @@ function readStoredMcpPermissions(paths) {
140725
140934
  }
140726
140935
  function writeStoredMcpPermissions(paths, permissions) {
140727
140936
  writeJsonAtomic(paths.mcpPermissionsFile, { writes: permissions.writes, remoteControl: permissions.remoteControl, history: permissions.history });
140728
- import_node_fs18.default.chmodSync(paths.mcpPermissionsFile, OWNER_ONLY_MODE);
140937
+ import_node_fs19.default.chmodSync(paths.mcpPermissionsFile, OWNER_ONLY_MODE);
140729
140938
  }
140730
140939
  function effectiveMcpPermissions(flags, stored) {
140731
140940
  return { writes: flags.writes || stored.writes, remoteControl: flags.remoteControl || stored.remoteControl, history: flags.history || stored.history };
140732
140941
  }
140733
140942
  function watchMcpPermissions(paths, onChange) {
140734
- const directory = import_node_path50.default.dirname(paths.mcpPermissionsFile);
140735
- import_node_fs18.default.mkdirSync(directory, { recursive: true });
140736
- const watcher = import_node_fs18.default.watch(directory, (_event, filename) => {
140737
- if (filename === null || filename === import_node_path50.default.basename(paths.mcpPermissionsFile)) {
140943
+ const directory = import_node_path52.default.dirname(paths.mcpPermissionsFile);
140944
+ import_node_fs19.default.mkdirSync(directory, { recursive: true });
140945
+ const watcher = import_node_fs19.default.watch(directory, (_event, filename) => {
140946
+ if (filename === null || filename === import_node_path52.default.basename(paths.mcpPermissionsFile)) {
140738
140947
  onChange();
140739
140948
  }
140740
140949
  });
@@ -141046,17 +141255,17 @@ init_credential();
141046
141255
  init_credentialCache();
141047
141256
 
141048
141257
  // src/identityToken.ts
141049
- var import_node_fs19 = __toESM(require("node:fs"), 1);
141050
- var import_node_path51 = __toESM(require("node:path"), 1);
141258
+ var import_node_fs20 = __toESM(require("node:fs"), 1);
141259
+ var import_node_path53 = __toESM(require("node:path"), 1);
141051
141260
  init_cliError();
141052
141261
  var TOKEN_FILE_MODE = 384;
141053
141262
  var TOKEN_DIR_MODE = 448;
141054
141263
  var OAUTH_TOKEN_RE = /^sk-ant-oat\d+-[A-Za-z0-9_-]+$/;
141055
141264
  function identityTokenDir(paths) {
141056
- return import_node_path51.default.join(paths.root, "credentials");
141265
+ return import_node_path53.default.join(paths.root, "credentials");
141057
141266
  }
141058
141267
  function identityTokenPath(paths, identityName) {
141059
- return import_node_path51.default.join(identityTokenDir(paths), `${identityName}.token`);
141268
+ return import_node_path53.default.join(identityTokenDir(paths), `${identityName}.token`);
141060
141269
  }
141061
141270
  function storeIdentityToken(paths, identityName, raw) {
141062
141271
  const token = raw.trim();
@@ -141064,13 +141273,13 @@ function storeIdentityToken(paths, identityName, raw) {
141064
141273
  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.");
141065
141274
  }
141066
141275
  const dir = identityTokenDir(paths);
141067
- import_node_fs19.default.mkdirSync(dir, { recursive: true, mode: TOKEN_DIR_MODE });
141068
- import_node_fs19.default.chmodSync(dir, TOKEN_DIR_MODE);
141276
+ import_node_fs20.default.mkdirSync(dir, { recursive: true, mode: TOKEN_DIR_MODE });
141277
+ import_node_fs20.default.chmodSync(dir, TOKEN_DIR_MODE);
141069
141278
  const target = identityTokenPath(paths, identityName);
141070
- const temp = import_node_path51.default.join(dir, `.${identityName}.${String(process.pid)}.tmp`);
141071
- import_node_fs19.default.writeFileSync(temp, `${token}
141279
+ const temp = import_node_path53.default.join(dir, `.${identityName}.${String(process.pid)}.tmp`);
141280
+ import_node_fs20.default.writeFileSync(temp, `${token}
141072
141281
  `, { mode: TOKEN_FILE_MODE });
141073
- import_node_fs19.default.renameSync(temp, target);
141282
+ import_node_fs20.default.renameSync(temp, target);
141074
141283
  return target;
141075
141284
  }
141076
141285
 
@@ -141233,13 +141442,61 @@ function registerDoctorCommand(program2, deps) {
141233
141442
  }
141234
141443
 
141235
141444
  // src/headroom/commands.ts
141236
- var import_node_fs20 = __toESM(require("node:fs"), 1);
141445
+ var import_node_fs21 = __toESM(require("node:fs"), 1);
141237
141446
  var import_node_http4 = __toESM(require("node:http"), 1);
141238
- var import_node_path52 = __toESM(require("node:path"), 1);
141447
+ var import_node_path54 = __toESM(require("node:path"), 1);
141239
141448
  var import_node_child_process7 = require("node:child_process");
141240
141449
  init_commandDeps();
141241
141450
  init_realFrontDoorPort();
141242
141451
  init_trust();
141452
+
141453
+ // src/headroom/routingCommands.ts
141454
+ init_commandDeps();
141455
+ init_cliError();
141456
+ init_state();
141457
+ init_launchWiring();
141458
+ init_realPorts();
141459
+ init_state2();
141460
+ function servingDoorPid(deps) {
141461
+ const pid = readFrontDoorState(realFarmFs, deps.paths.frontdoorStateFile)?.supervisorPid;
141462
+ return pid !== void 0 && realIsProcessRunning(pid) ? pid : void 0;
141463
+ }
141464
+ function registerHeadroomRoutingCommands(headroom, deps) {
141465
+ const { paths } = deps;
141466
+ const change = (viaHeadroom) => (options2) => {
141467
+ const scope = options2.session === void 0 ? { kind: "global" } : { kind: "session", sessionId: options2.session };
141468
+ const doorPid = servingDoorPid(deps);
141469
+ if (viaHeadroom && doorPid === void 0) {
141470
+ throw new UsageError("no front door is serving, so nothing is routed yet; start a launch, then enable headroom for its sessions.");
141471
+ }
141472
+ const setting = withRoutingChoice(readRoutingSetting(paths), scope, { viaHeadroom, immediately: options2.now === true, nowMs: Date.now() });
141473
+ if (viaHeadroom && doorPid !== void 0) {
141474
+ realHeadroomPort(paths, { spawnDaemon: daemonSpawnerFor(void 0), cwd: process.cwd(), registerAs: doorPid }).ensure({ routesProvider: false });
141475
+ }
141476
+ writeRoutingSetting(paths, setting);
141477
+ if (!asksForHeadroom(setting) && doorPid !== void 0) {
141478
+ removeSession(realFarmFs, paths.headroomSessionsDir, doorPid);
141479
+ }
141480
+ const covers = scope.kind === "global" ? "every session without its own setting" : `session ${scope.sessionId}`;
141481
+ const when = options2.now === true ? "from its next request, rewriting its prompt cache once" : "at each session's next cache boundary";
141482
+ if (options2.json === true) {
141483
+ printJson({ action: viaHeadroom ? "enabled" : "disabled", scope, immediately: options2.now === true });
141484
+ return;
141485
+ }
141486
+ console.log(`headroom ${viaHeadroom ? "enabled" : "disabled"} for ${covers}, ${when}`);
141487
+ };
141488
+ const options = (command) => command.option("--session <id>", "Cover one launch session instead of every session.").option("--now", "Apply on the session's next request instead of at its next cache boundary. The session's prompt cache is rewritten once.").option("--json", "Print the result as JSON.");
141489
+ withExamples(
141490
+ options(headroom.command("enable").description("Route sessions through headroom, whatever their launch asked for.")).action(change(true)),
141491
+ ["agent-shim headroom enable", "agent-shim headroom enable --session <id> --now"]
141492
+ );
141493
+ withExamples(
141494
+ options(headroom.command("disable").description("Stop routing sessions through headroom, whatever their launch asked for.")).action(change(false)),
141495
+ ["agent-shim headroom disable", "agent-shim headroom disable --session <id>"]
141496
+ );
141497
+ }
141498
+
141499
+ // src/headroom/commands.ts
141243
141500
  init_settings();
141244
141501
  init_source();
141245
141502
  init_realPorts();
@@ -141376,12 +141633,12 @@ function readInstalledHeadroomCommit() {
141376
141633
  if (toolDir.status !== 0) {
141377
141634
  return void 0;
141378
141635
  }
141379
- const libDir = import_node_path52.default.join(toolDir.stdout.trim(), HEADROOM_TOOL_NAME, "lib");
141636
+ const libDir = import_node_path54.default.join(toolDir.stdout.trim(), HEADROOM_TOOL_NAME, "lib");
141380
141637
  for (const python of realFarmFs.readdir(libDir)) {
141381
- const sitePackages = import_node_path52.default.join(libDir, python, "site-packages");
141638
+ const sitePackages = import_node_path54.default.join(libDir, python, "site-packages");
141382
141639
  for (const entry of realFarmFs.readdir(sitePackages)) {
141383
141640
  if (entry.startsWith("headroom_ai-") && entry.endsWith(".dist-info")) {
141384
- const directUrl = realFarmFs.readFileUtf8(import_node_path52.default.join(sitePackages, entry, "direct_url.json"));
141641
+ const directUrl = realFarmFs.readFileUtf8(import_node_path54.default.join(sitePackages, entry, "direct_url.json"));
141385
141642
  return directUrl === void 0 ? void 0 : parseInstalledCommit(directUrl);
141386
141643
  }
141387
141644
  }
@@ -141409,12 +141666,12 @@ function realSupervisorPorts(paths) {
141409
141666
  readConfig: () => resolveSupervisorConfig(readGlobalConfig(paths)?.headroom ?? {}),
141410
141667
  spawnHeadroom: (socketPath, allowlistFile, settings2) => {
141411
141668
  const trust = resolveHeadroomTrustBundle({ caCertFile: paths.frontdoorCaCertFile, bundlesDir: paths.frontdoorCaBundlesDir, inherited: process.env[HEADROOM_CA_BUNDLE], fs: realTrustBundleFs });
141412
- import_node_fs20.default.mkdirSync(paths.logsDir, { recursive: true });
141669
+ import_node_fs21.default.mkdirSync(paths.logsDir, { recursive: true });
141413
141670
  if (trust?.warning !== void 0) {
141414
- import_node_fs20.default.appendFileSync(paths.headroomLogPath, `${(/* @__PURE__ */ new Date()).toISOString()} ${trust.warning}
141671
+ import_node_fs21.default.appendFileSync(paths.headroomLogPath, `${(/* @__PURE__ */ new Date()).toISOString()} ${trust.warning}
141415
141672
  `);
141416
141673
  }
141417
- const logFd = import_node_fs20.default.openSync(paths.headroomLogPath, "a");
141674
+ const logFd = import_node_fs21.default.openSync(paths.headroomLogPath, "a");
141418
141675
  try {
141419
141676
  const child = (0, import_node_child_process7.spawn)("headroom", headroomProxyArgs(socketPath, allowlistFile, settings2), {
141420
141677
  detached: true,
@@ -141429,12 +141686,12 @@ function realSupervisorPorts(paths) {
141429
141686
  child.once("exit", (code, signal) => {
141430
141687
  ownedHeadroom.delete(pid);
141431
141688
  exitedHeadroom.add(pid);
141432
- import_node_fs20.default.appendFileSync(paths.headroomLogPath, `${(/* @__PURE__ */ new Date()).toISOString()} agent-shim headroom supervisor: headroom exited (${signal ?? `code ${String(code)}`})
141689
+ import_node_fs21.default.appendFileSync(paths.headroomLogPath, `${(/* @__PURE__ */ new Date()).toISOString()} agent-shim headroom supervisor: headroom exited (${signal ?? `code ${String(code)}`})
141433
141690
  `);
141434
141691
  });
141435
141692
  return pid;
141436
141693
  } finally {
141437
- import_node_fs20.default.closeSync(logFd);
141694
+ import_node_fs21.default.closeSync(logFd);
141438
141695
  }
141439
141696
  },
141440
141697
  stopProcess: (pid) => {
@@ -141447,7 +141704,7 @@ function realSupervisorPorts(paths) {
141447
141704
  now: () => Date.now()
141448
141705
  });
141449
141706
  if (outcome === "still-running") {
141450
- import_node_fs20.default.appendFileSync(
141707
+ import_node_fs21.default.appendFileSync(
141451
141708
  paths.headroomLogPath,
141452
141709
  `${(/* @__PURE__ */ new Date()).toISOString()} agent-shim headroom supervisor: pid ${String(pid)} survived SIGKILL within its grace; it is stuck uninterruptibly
141453
141710
  `
@@ -141465,10 +141722,10 @@ function realSupervisorPorts(paths) {
141465
141722
  };
141466
141723
  }
141467
141724
  if (result.stdout !== "") {
141468
- import_node_fs20.default.appendFileSync(paths.headroomLogPath, result.stdout);
141725
+ import_node_fs21.default.appendFileSync(paths.headroomLogPath, result.stdout);
141469
141726
  }
141470
141727
  if (result.stderr !== "") {
141471
- import_node_fs20.default.appendFileSync(paths.headroomLogPath, result.stderr);
141728
+ import_node_fs21.default.appendFileSync(paths.headroomLogPath, result.stderr);
141472
141729
  }
141473
141730
  return result.status === 0 ? { ok: true } : { ok: false, error: `uv tool install exited ${String(result.status)}` };
141474
141731
  },
@@ -141478,16 +141735,17 @@ function realSupervisorPorts(paths) {
141478
141735
  },
141479
141736
  installedCommit: readInstalledHeadroomCommit,
141480
141737
  log: (line) => {
141481
- import_node_fs20.default.mkdirSync(paths.logsDir, { recursive: true });
141482
- import_node_fs20.default.appendFileSync(paths.headroomLogPath, `${(/* @__PURE__ */ new Date()).toISOString()} ${line}
141738
+ import_node_fs21.default.mkdirSync(paths.logsDir, { recursive: true });
141739
+ import_node_fs21.default.appendFileSync(paths.headroomLogPath, `${(/* @__PURE__ */ new Date()).toISOString()} ${line}
141483
141740
  `);
141484
141741
  }
141485
141742
  };
141486
141743
  }
141487
141744
  function registerHeadroomCommand(program2, deps) {
141488
141745
  const { paths } = deps;
141489
- const headroom = withExamples(program2.command("headroom").description("Inspect the headroom routing daemon."), [
141490
- "agent-shim headroom status"
141746
+ const headroom = withExamples(program2.command("headroom").description("Inspect the headroom routing daemon and choose which sessions use it."), [
141747
+ "agent-shim headroom status",
141748
+ "agent-shim headroom enable"
141491
141749
  ]);
141492
141750
  withExamples(
141493
141751
  headroom.command("status").description("Report the headroom daemon's supervisor, process, socket, sessions, and last error. Read-only.").option("--json", "Print the status as JSON.").action((options) => {
@@ -141502,6 +141760,7 @@ function registerHeadroomCommand(program2, deps) {
141502
141760
  }),
141503
141761
  ["agent-shim headroom status", "agent-shim headroom status --json"]
141504
141762
  );
141763
+ registerHeadroomRoutingCommands(headroom, deps);
141505
141764
  program2.command("__headroom-supervisor", { hidden: true }).description("Internal: supervise the headroom daemon. Started by the launcher; never run by hand.").allowUnknownOption().action(async () => {
141506
141765
  const globalConfig2 = readGlobalConfig(paths);
141507
141766
  const config2 = resolveSupervisorConfig(globalConfig2?.headroom ?? {});
@@ -141528,7 +141787,7 @@ function registerHeadroomCommand(program2, deps) {
141528
141787
  init_realPorts();
141529
141788
 
141530
141789
  // src/usage/realJobRunner.ts
141531
- var import_node_path53 = __toESM(require("node:path"), 1);
141790
+ var import_node_path55 = __toESM(require("node:path"), 1);
141532
141791
  init_conditions();
141533
141792
  init_identityClaude();
141534
141793
  var JOB_LAUNCH_FLAGS = ["--no-headroom", "--no-remote-control", "--track-usage"];
@@ -141541,7 +141800,7 @@ ${outcome.trimEnd()}
141541
141800
  }
141542
141801
  function createRealJobRunner(params) {
141543
141802
  return async (name, identity, job) => {
141544
- const logFile = import_node_path53.default.join(params.paths.jobLogsDir, `${name}.log`);
141803
+ const logFile = import_node_path55.default.join(params.paths.jobLogsDir, `${name}.log`);
141545
141804
  const append = (outcome) => {
141546
141805
  params.fs.mkdirPrivate(params.paths.jobLogsDir);
141547
141806
  params.fs.appendFilePrivate(logFile, logEntry(name, identity, params.now(), outcome));
@@ -141595,7 +141854,7 @@ function registerHeadlessCommands(program2, deps) {
141595
141854
  }
141596
141855
 
141597
141856
  // src/jobs.ts
141598
- var import_node_path54 = __toESM(require("node:path"), 1);
141857
+ var import_node_path56 = __toESM(require("node:path"), 1);
141599
141858
  init_commandDeps();
141600
141859
  init_cliError();
141601
141860
  init_schema();
@@ -141620,7 +141879,7 @@ function jobOf(options) {
141620
141879
  target: options.identity === void 0 ? { pool: options.pool ?? "" } : { identity: options.identity },
141621
141880
  trigger: options.at === void 0 ? { beforeReset: options.beforeReset ?? "fiveHour", lead: options.lead ?? "" } : { at: options.at },
141622
141881
  prompt: options.prompt,
141623
- cwd: import_node_path54.default.resolve(options.cwd ?? process.cwd()),
141882
+ cwd: import_node_path56.default.resolve(options.cwd ?? process.cwd()),
141624
141883
  timeout: options.timeout,
141625
141884
  ...options.model === void 0 ? {} : { model: options.model },
141626
141885
  ...options.allowedTool === void 0 ? {} : { allowedTools: options.allowedTool }
@@ -141693,7 +141952,7 @@ function registerJobCommand(program2, deps) {
141693
141952
  console.log(`Allowed tools: ${entry.allowedTools.join(", ")}`);
141694
141953
  }
141695
141954
  console.log(`Prompt: ${entry.prompt}`);
141696
- console.log(`Results: ${import_node_path54.default.join(paths.jobLogsDir, `${name}.log`)}`);
141955
+ console.log(`Results: ${import_node_path56.default.join(paths.jobLogsDir, `${name}.log`)}`);
141697
141956
  }),
141698
141957
  ["agent-shim job show digest"]
141699
141958
  );
@@ -141716,7 +141975,7 @@ function registerJobCommand(program2, deps) {
141716
141975
  throw new UsageError(`No member of the job's pool can be picked right now.`);
141717
141976
  }
141718
141977
  await createRealJobRunner({ paths, spawnDaemon: spawnDetachedSupervisor, fs: realFarmFs, now: () => /* @__PURE__ */ new Date() })(name, identity, entry);
141719
- console.log(`Ran job "${name}" as ${identity}; the result is in ${import_node_path54.default.join(paths.jobLogsDir, `${name}.log`)}.`);
141978
+ console.log(`Ran job "${name}" as ${identity}; the result is in ${import_node_path56.default.join(paths.jobLogsDir, `${name}.log`)}.`);
141720
141979
  }),
141721
141980
  ["agent-shim job run digest"]
141722
141981
  );
@@ -142202,7 +142461,7 @@ function registerSessionCommands(program2, deps) {
142202
142461
  }
142203
142462
 
142204
142463
  // src/usage/commands.ts
142205
- var import_node_path55 = __toESM(require("node:path"), 1);
142464
+ var import_node_path57 = __toESM(require("node:path"), 1);
142206
142465
  init_commandDeps();
142207
142466
  init_realPorts();
142208
142467
  init_account();
@@ -142218,14 +142477,14 @@ function requireIdentity(paths, name) {
142218
142477
  throw new IdentityNotFoundError(name);
142219
142478
  }
142220
142479
  }
142221
- function collectUsageReport(fs22, paths, filters) {
142480
+ function collectUsageReport(fs23, paths, filters) {
142222
142481
  const { identity, provider, sinceMs } = filters;
142223
142482
  if (identity !== void 0) {
142224
142483
  requireIdentity(paths, identity);
142225
142484
  }
142226
- const log = readUsageLog(fs22, paths.usageLogDir, sinceMs === void 0 ? {} : { sinceMs });
142485
+ const log = readUsageLog(fs23, paths.usageLogDir, sinceMs === void 0 ? {} : { sinceMs });
142227
142486
  const records = log.records.filter((record2) => (identity === void 0 || record2.identity === identity) && (provider === void 0 || record2.provider === provider));
142228
- const snapshots = (identity === void 0 ? listUsageSnapshots(fs22, paths.usageSnapshotsDir) : [readUsageSnapshot(fs22, paths.usageSnapshotsDir, identity)].flatMap((snapshot) => snapshot === void 0 ? [] : [snapshot])).map((snapshot) => provider === void 0 ? snapshot : { ...snapshot, providers: Object.fromEntries(Object.entries(snapshot.providers).filter(([name]) => name === provider)) }).filter((snapshot) => Object.keys(snapshot.providers).length > 0);
142487
+ const snapshots = (identity === void 0 ? listUsageSnapshots(fs23, paths.usageSnapshotsDir) : [readUsageSnapshot(fs23, paths.usageSnapshotsDir, identity)].flatMap((snapshot) => snapshot === void 0 ? [] : [snapshot])).map((snapshot) => provider === void 0 ? snapshot : { ...snapshot, providers: Object.fromEntries(Object.entries(snapshot.providers).filter(([name]) => name === provider)) }).filter((snapshot) => Object.keys(snapshot.providers).length > 0);
142229
142488
  return {
142230
142489
  since: sinceMs === void 0 ? void 0 : new Date(sinceMs).toISOString(),
142231
142490
  logDir: paths.usageLogDir,
@@ -142332,16 +142591,16 @@ function formatUsageReport(report) {
142332
142591
  }
142333
142592
  return lines;
142334
142593
  }
142335
- function collectAccounts(fs22, paths, identity, probe) {
142594
+ function collectAccounts(fs23, paths, identity, probe) {
142336
142595
  if (identity !== void 0) {
142337
142596
  requireIdentity(paths, identity);
142338
142597
  }
142339
142598
  const names = identity === void 0 ? listIdentities(paths).map((entry) => entry.name) : [identity];
142340
142599
  return names.map((name) => ({
142341
142600
  identity: name,
142342
- account: readAccountMetadata(fs22, paths.identitiesDir, name),
142343
- signIn: identitySignIn(fs22, probe, { farmRoot: import_node_path55.default.join(paths.identitiesDir, name), hasCredentialBlock: readIdentity(paths, name)?.credential !== void 0 }),
142344
- usage: readUsageSnapshot(fs22, paths.usageSnapshotsDir, name)
142601
+ account: readAccountMetadata(fs23, paths.identitiesDir, name),
142602
+ signIn: identitySignIn(fs23, probe, { farmRoot: import_node_path57.default.join(paths.identitiesDir, name), hasCredentialBlock: readIdentity(paths, name)?.credential !== void 0 }),
142603
+ usage: readUsageSnapshot(fs23, paths.usageSnapshotsDir, name)
142345
142604
  }));
142346
142605
  }
142347
142606
  function formatAccounts(views) {
@@ -142688,7 +142947,7 @@ async function runClaude(argvOverride) {
142688
142947
  // src/cli.ts
142689
142948
  async function main() {
142690
142949
  aliasLegacyEnv(process.env);
142691
- const invokedName = import_node_path56.default.basename(process.argv[1] ?? "agent-shim");
142950
+ const invokedName = import_node_path58.default.basename(process.argv[1] ?? "agent-shim");
142692
142951
  if (isInvokedAsClaude(invokedName)) {
142693
142952
  await runClaude();
142694
142953
  return;