claude-use 9.16.0 → 9.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.cjs CHANGED
@@ -318,10 +318,10 @@ function mergeDefs(...defs) {
318
318
  function cloneDef(schema) {
319
319
  return mergeDefs(schema._zod.def);
320
320
  }
321
- function getElementAtPath(obj, path54) {
322
- if (!path54)
321
+ function getElementAtPath(obj, path56) {
322
+ if (!path56)
323
323
  return obj;
324
- return path54.reduce((acc, key) => acc?.[key], obj);
324
+ return path56.reduce((acc, key) => acc?.[key], obj);
325
325
  }
326
326
  function promiseAllObject(promisesObj) {
327
327
  const keys = Object.keys(promisesObj);
@@ -580,11 +580,11 @@ function explicitlyAborted(x, startIndex = 0) {
580
580
  }
581
581
  return false;
582
582
  }
583
- function prefixIssues(path54, issues) {
583
+ function prefixIssues(path56, issues) {
584
584
  return issues.map((iss) => {
585
585
  var _a4;
586
586
  (_a4 = iss).path ?? (_a4.path = []);
587
- iss.path.unshift(path54);
587
+ iss.path.unshift(path56);
588
588
  return iss;
589
589
  });
590
590
  }
@@ -1105,16 +1105,16 @@ function flattenError(error63, mapper = (issue2) => issue2.message) {
1105
1105
  }
1106
1106
  function formatError(error63, mapper = (issue2) => issue2.message) {
1107
1107
  const fieldErrors = { _errors: [] };
1108
- const processError = (error64, path54 = []) => {
1108
+ const processError = (error64, path56 = []) => {
1109
1109
  for (const issue2 of error64.issues) {
1110
1110
  if (issue2.code === "invalid_union" && issue2.errors.length) {
1111
- issue2.errors.map((issues) => processError({ issues }, [...path54, ...issue2.path]));
1111
+ issue2.errors.map((issues) => processError({ issues }, [...path56, ...issue2.path]));
1112
1112
  } else if (issue2.code === "invalid_key") {
1113
- processError({ issues: issue2.issues }, [...path54, ...issue2.path]);
1113
+ processError({ issues: issue2.issues }, [...path56, ...issue2.path]);
1114
1114
  } else if (issue2.code === "invalid_element") {
1115
- processError({ issues: issue2.issues }, [...path54, ...issue2.path]);
1115
+ processError({ issues: issue2.issues }, [...path56, ...issue2.path]);
1116
1116
  } else {
1117
- const fullpath = [...path54, ...issue2.path];
1117
+ const fullpath = [...path56, ...issue2.path];
1118
1118
  if (fullpath.length === 0) {
1119
1119
  fieldErrors._errors.push(mapper(issue2));
1120
1120
  } else {
@@ -1153,17 +1153,17 @@ function formatError(error63, mapper = (issue2) => issue2.message) {
1153
1153
  }
1154
1154
  function treeifyError(error63, mapper = (issue2) => issue2.message) {
1155
1155
  const result = { errors: [] };
1156
- const processError = (error64, path54 = []) => {
1156
+ const processError = (error64, path56 = []) => {
1157
1157
  var _a4;
1158
1158
  for (const issue2 of error64.issues) {
1159
1159
  if (issue2.code === "invalid_union" && issue2.errors.length) {
1160
- issue2.errors.map((issues) => processError({ issues }, [...path54, ...issue2.path]));
1160
+ issue2.errors.map((issues) => processError({ issues }, [...path56, ...issue2.path]));
1161
1161
  } else if (issue2.code === "invalid_key") {
1162
- processError({ issues: issue2.issues }, [...path54, ...issue2.path]);
1162
+ processError({ issues: issue2.issues }, [...path56, ...issue2.path]);
1163
1163
  } else if (issue2.code === "invalid_element") {
1164
- processError({ issues: issue2.issues }, [...path54, ...issue2.path]);
1164
+ processError({ issues: issue2.issues }, [...path56, ...issue2.path]);
1165
1165
  } else {
1166
- const fullpath = [...path54, ...issue2.path];
1166
+ const fullpath = [...path56, ...issue2.path];
1167
1167
  if (fullpath.length === 0) {
1168
1168
  result.errors.push(mapper(issue2));
1169
1169
  continue;
@@ -1202,8 +1202,8 @@ function treeifyError(error63, mapper = (issue2) => issue2.message) {
1202
1202
  }
1203
1203
  function toDotPath(_path) {
1204
1204
  const segs = [];
1205
- const path54 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1206
- for (const seg of path54) {
1205
+ const path56 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1206
+ for (const seg of path56) {
1207
1207
  if (typeof seg === "number")
1208
1208
  segs.push(`[${seg}]`);
1209
1209
  else if (typeof seg === "symbol")
@@ -19199,13 +19199,13 @@ function resolveRef(ref, ctx) {
19199
19199
  if (!ref.startsWith("#")) {
19200
19200
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
19201
19201
  }
19202
- const path54 = ref.slice(1).split("/").filter(Boolean);
19203
- if (path54.length === 0) {
19202
+ const path56 = ref.slice(1).split("/").filter(Boolean);
19203
+ if (path56.length === 0) {
19204
19204
  return ctx.rootSchema;
19205
19205
  }
19206
19206
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
19207
- if (path54[0] === defsKey) {
19208
- const key = path54[1] === void 0 ? void 0 : decodeJSONPointerSegment(path54[1]);
19207
+ if (path56[0] === defsKey) {
19208
+ const key = path56[1] === void 0 ? void 0 : decodeJSONPointerSegment(path56[1]);
19209
19209
  if (!key || !ctx.defs[key]) {
19210
19210
  throw new Error(`Reference not found: ${ref}`);
19211
19211
  }
@@ -23712,42 +23712,42 @@ var require_defaults = __commonJS({
23712
23712
  var require_env_paths = __commonJS({
23713
23713
  "node_modules/.pnpm/env-paths@2.2.1/node_modules/env-paths/index.js"(exports2, module2) {
23714
23714
  "use strict";
23715
- var path54 = require("path");
23715
+ var path56 = require("path");
23716
23716
  var os12 = require("os");
23717
23717
  var homedir = os12.homedir();
23718
23718
  var tmpdir = os12.tmpdir();
23719
23719
  var { env } = process;
23720
23720
  var macos = (name) => {
23721
- const library = path54.join(homedir, "Library");
23721
+ const library = path56.join(homedir, "Library");
23722
23722
  return {
23723
- data: path54.join(library, "Application Support", name),
23724
- config: path54.join(library, "Preferences", name),
23725
- cache: path54.join(library, "Caches", name),
23726
- log: path54.join(library, "Logs", name),
23727
- temp: path54.join(tmpdir, name)
23723
+ data: path56.join(library, "Application Support", name),
23724
+ config: path56.join(library, "Preferences", name),
23725
+ cache: path56.join(library, "Caches", name),
23726
+ log: path56.join(library, "Logs", name),
23727
+ temp: path56.join(tmpdir, name)
23728
23728
  };
23729
23729
  };
23730
23730
  var windows = (name) => {
23731
- const appData = env.APPDATA || path54.join(homedir, "AppData", "Roaming");
23732
- const localAppData = env.LOCALAPPDATA || path54.join(homedir, "AppData", "Local");
23731
+ const appData = env.APPDATA || path56.join(homedir, "AppData", "Roaming");
23732
+ const localAppData = env.LOCALAPPDATA || path56.join(homedir, "AppData", "Local");
23733
23733
  return {
23734
23734
  // Data/config/cache/log are invented by me as Windows isn't opinionated about this
23735
- data: path54.join(localAppData, name, "Data"),
23736
- config: path54.join(appData, name, "Config"),
23737
- cache: path54.join(localAppData, name, "Cache"),
23738
- log: path54.join(localAppData, name, "Log"),
23739
- temp: path54.join(tmpdir, name)
23735
+ data: path56.join(localAppData, name, "Data"),
23736
+ config: path56.join(appData, name, "Config"),
23737
+ cache: path56.join(localAppData, name, "Cache"),
23738
+ log: path56.join(localAppData, name, "Log"),
23739
+ temp: path56.join(tmpdir, name)
23740
23740
  };
23741
23741
  };
23742
23742
  var linux = (name) => {
23743
- const username = path54.basename(homedir);
23743
+ const username = path56.basename(homedir);
23744
23744
  return {
23745
- data: path54.join(env.XDG_DATA_HOME || path54.join(homedir, ".local", "share"), name),
23746
- config: path54.join(env.XDG_CONFIG_HOME || path54.join(homedir, ".config"), name),
23747
- cache: path54.join(env.XDG_CACHE_HOME || path54.join(homedir, ".cache"), name),
23745
+ data: path56.join(env.XDG_DATA_HOME || path56.join(homedir, ".local", "share"), name),
23746
+ config: path56.join(env.XDG_CONFIG_HOME || path56.join(homedir, ".config"), name),
23747
+ cache: path56.join(env.XDG_CACHE_HOME || path56.join(homedir, ".cache"), name),
23748
23748
  // https://wiki.debian.org/XDGBaseDirectorySpecification#state
23749
- log: path54.join(env.XDG_STATE_HOME || path54.join(homedir, ".local", "state"), name),
23750
- temp: path54.join(tmpdir, username, name)
23749
+ log: path56.join(env.XDG_STATE_HOME || path56.join(homedir, ".local", "state"), name),
23750
+ temp: path56.join(tmpdir, username, name)
23751
23751
  };
23752
23752
  };
23753
23753
  var envPaths = (name, options) => {
@@ -23815,11 +23815,11 @@ var require_util = __commonJS({
23815
23815
  return result;
23816
23816
  }
23817
23817
  exports2.emplace = emplace;
23818
- function getPropertyByPath(source, path54) {
23819
- if (typeof path54 === "string" && Object.prototype.hasOwnProperty.call(source, path54)) {
23820
- return source[path54];
23818
+ function getPropertyByPath(source, path56) {
23819
+ if (typeof path56 === "string" && Object.prototype.hasOwnProperty.call(source, path56)) {
23820
+ return source[path56];
23821
23821
  }
23822
- const parsedPath = typeof path54 === "string" ? path54.split(".") : path54;
23822
+ const parsedPath = typeof path56 === "string" ? path56.split(".") : path56;
23823
23823
  return parsedPath.reduce((previous, key) => {
23824
23824
  if (previous === void 0) {
23825
23825
  return previous;
@@ -23842,9 +23842,9 @@ var require_util = __commonJS({
23842
23842
  return Object.fromEntries(Object.entries(options).filter(([, value2]) => value2 !== void 0));
23843
23843
  }
23844
23844
  exports2.removeUndefinedValuesFromObject = removeUndefinedValuesFromObject;
23845
- async function isDirectory(path54) {
23845
+ async function isDirectory(path56) {
23846
23846
  try {
23847
- const stat = await fs_1.promises.stat(path54);
23847
+ const stat = await fs_1.promises.stat(path56);
23848
23848
  return stat.isDirectory();
23849
23849
  } catch (e14) {
23850
23850
  if (e14.code === "ENOENT") {
@@ -23854,9 +23854,9 @@ var require_util = __commonJS({
23854
23854
  }
23855
23855
  }
23856
23856
  exports2.isDirectory = isDirectory;
23857
- function isDirectorySync(path54) {
23857
+ function isDirectorySync(path56) {
23858
23858
  try {
23859
- const stat = fs_1.default.statSync(path54);
23859
+ const stat = fs_1.default.statSync(path56);
23860
23860
  return stat.isDirectory();
23861
23861
  } catch (e14) {
23862
23862
  if (e14.code === "ENOENT") {
@@ -23954,7 +23954,7 @@ var require_ExplorerBase = __commonJS({
23954
23954
  const idx = importStack.indexOf(fullPath);
23955
23955
  if (idx !== -1) {
23956
23956
  throw new Error(`Circular import detected:
23957
- ${[...importStack, fullPath].map((path54, i10) => `${i10 + 1}. ${path54}`).join("\n")} (same as ${idx + 1}.)`);
23957
+ ${[...importStack, fullPath].map((path56, i10) => `${i10 + 1}. ${path56}`).join("\n")} (same as ${idx + 1}.)`);
23958
23958
  }
23959
23959
  }
23960
23960
  }
@@ -24142,9 +24142,9 @@ var require_Explorer = __commonJS({
24142
24142
  throw error63;
24143
24143
  }
24144
24144
  }
24145
- async #fileExists(path54) {
24145
+ async #fileExists(path56) {
24146
24146
  try {
24147
- await promises_1.default.stat(path54);
24147
+ await promises_1.default.stat(path56);
24148
24148
  return true;
24149
24149
  } catch (e14) {
24150
24150
  return false;
@@ -24304,9 +24304,9 @@ var require_ExplorerSync = __commonJS({
24304
24304
  throw error63;
24305
24305
  }
24306
24306
  }
24307
- #fileExists(path54) {
24307
+ #fileExists(path56) {
24308
24308
  try {
24309
- fs_1.default.statSync(path54);
24309
+ fs_1.default.statSync(path56);
24310
24310
  return true;
24311
24311
  } catch (e14) {
24312
24312
  return false;
@@ -24430,7 +24430,7 @@ var require_dist = __commonJS({
24430
24430
  };
24431
24431
  }
24432
24432
  function getResolvedSearchPlaces(moduleName, toolDefinedSearchPlaces, userConfiguredOptions) {
24433
- const userConfiguredSearchPlaces = userConfiguredOptions.searchPlaces?.map((path54) => path54.replace("{name}", moduleName));
24433
+ const userConfiguredSearchPlaces = userConfiguredOptions.searchPlaces?.map((path56) => path56.replace("{name}", moduleName));
24434
24434
  if (userConfiguredOptions.mergeSearchPlaces) {
24435
24435
  return [...userConfiguredSearchPlaces ?? [], ...toolDefinedSearchPlaces];
24436
24436
  }
@@ -28941,8 +28941,8 @@ var require_utils = __commonJS({
28941
28941
  }
28942
28942
  return output2;
28943
28943
  };
28944
- exports2.basename = (path54, { windows } = {}) => {
28945
- const segs = path54.split(windows ? /[\\/]/ : "/");
28944
+ exports2.basename = (path56, { windows } = {}) => {
28945
+ const segs = path56.split(windows ? /[\\/]/ : "/");
28946
28946
  const last = segs[segs.length - 1];
28947
28947
  if (last === "") {
28948
28948
  return segs[segs.length - 2];
@@ -33317,7 +33317,7 @@ var init_package = __esm({
33317
33317
  "package.json"() {
33318
33318
  package_default = {
33319
33319
  name: "claude-use",
33320
- version: "9.16.0",
33320
+ version: "9.17.0",
33321
33321
  description: "A profile manager and launcher for Claude Code that lets one person run multiple logins from one machine while controlling what gets shared between them.",
33322
33322
  license: "MIT",
33323
33323
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -33588,11 +33588,11 @@ function identifyRequest(headers) {
33588
33588
  function directOrigin(port) {
33589
33589
  return `http://127.0.0.1:${String(port)}`;
33590
33590
  }
33591
- function parseProviderPath(path54) {
33592
- if (!path54.startsWith(PROVIDER_PATH_PREFIX)) {
33591
+ function parseProviderPath(path56) {
33592
+ if (!path56.startsWith(PROVIDER_PATH_PREFIX)) {
33593
33593
  return void 0;
33594
33594
  }
33595
- const tail = path54.slice(PROVIDER_PATH_PREFIX.length);
33595
+ const tail = path56.slice(PROVIDER_PATH_PREFIX.length);
33596
33596
  const slash = tail.indexOf("/");
33597
33597
  if (slash <= 0) {
33598
33598
  return void 0;
@@ -33918,9 +33918,9 @@ function decoderFor(encoding) {
33918
33918
  return void 0;
33919
33919
  }
33920
33920
  }
33921
- function destinationOf(path54) {
33922
- const scoped = parseProviderPath(path54);
33923
- return scoped === void 0 ? { provider: ANTHROPIC_PROVIDER, endpoint: path54 } : { provider: scoped.provider, endpoint: scoped.rest };
33921
+ function destinationOf(path56) {
33922
+ const scoped = parseProviderPath(path56);
33923
+ return scoped === void 0 ? { provider: ANTHROPIC_PROVIDER, endpoint: path56 } : { provider: scoped.provider, endpoint: scoped.rest };
33924
33924
  }
33925
33925
  function buildRecord(event, context) {
33926
33926
  const { scan } = context;
@@ -36356,14 +36356,14 @@ var require_util2 = __commonJS({
36356
36356
  }
36357
36357
  const port = url2.port != null ? url2.port : url2.protocol === "https:" ? 443 : 80;
36358
36358
  let origin = url2.origin != null ? url2.origin : `${url2.protocol || ""}//${url2.hostname || ""}:${port}`;
36359
- let path54 = url2.path != null ? url2.path : `${url2.pathname || ""}${url2.search || ""}`;
36359
+ let path56 = url2.path != null ? url2.path : `${url2.pathname || ""}${url2.search || ""}`;
36360
36360
  if (origin[origin.length - 1] === "/") {
36361
36361
  origin = origin.slice(0, origin.length - 1);
36362
36362
  }
36363
- if (path54 && path54[0] !== "/") {
36364
- path54 = `/${path54}`;
36363
+ if (path56 && path56[0] !== "/") {
36364
+ path56 = `/${path56}`;
36365
36365
  }
36366
- return new URL(`${origin}${path54}`);
36366
+ return new URL(`${origin}${path56}`);
36367
36367
  }
36368
36368
  if (!isHttpOrHttpsPrefixed(url2.origin || url2.protocol)) {
36369
36369
  throw new InvalidArgumentError2("Invalid URL protocol: the URL must start with `http:` or `https:`.");
@@ -37184,9 +37184,9 @@ var require_diagnostics = __commonJS({
37184
37184
  "undici:client:sendHeaders",
37185
37185
  (evt) => {
37186
37186
  const {
37187
- request: { method, path: path54, origin }
37187
+ request: { method, path: path56, origin }
37188
37188
  } = evt;
37189
- debugLog("sending request to %s %s%s", method, origin, path54);
37189
+ debugLog("sending request to %s %s%s", method, origin, path56);
37190
37190
  }
37191
37191
  );
37192
37192
  }
@@ -37204,14 +37204,14 @@ var require_diagnostics = __commonJS({
37204
37204
  "undici:request:headers",
37205
37205
  (evt) => {
37206
37206
  const {
37207
- request: { method, path: path54, origin },
37207
+ request: { method, path: path56, origin },
37208
37208
  response: { statusCode }
37209
37209
  } = evt;
37210
37210
  debugLog(
37211
37211
  "received response to %s %s%s - HTTP %d",
37212
37212
  method,
37213
37213
  origin,
37214
- path54,
37214
+ path56,
37215
37215
  statusCode
37216
37216
  );
37217
37217
  }
@@ -37220,23 +37220,23 @@ var require_diagnostics = __commonJS({
37220
37220
  "undici:request:trailers",
37221
37221
  (evt) => {
37222
37222
  const {
37223
- request: { method, path: path54, origin }
37223
+ request: { method, path: path56, origin }
37224
37224
  } = evt;
37225
- debugLog("trailers received from %s %s%s", method, origin, path54);
37225
+ debugLog("trailers received from %s %s%s", method, origin, path56);
37226
37226
  }
37227
37227
  );
37228
37228
  diagnosticsChannel.subscribe(
37229
37229
  "undici:request:error",
37230
37230
  (evt) => {
37231
37231
  const {
37232
- request: { method, path: path54, origin },
37232
+ request: { method, path: path56, origin },
37233
37233
  error: error63
37234
37234
  } = evt;
37235
37235
  debugLog(
37236
37236
  "request to %s %s%s errored - %s",
37237
37237
  method,
37238
37238
  origin,
37239
- path54,
37239
+ path56,
37240
37240
  error63.message
37241
37241
  );
37242
37242
  }
@@ -37351,7 +37351,7 @@ var require_request = __commonJS({
37351
37351
  var kHandler = /* @__PURE__ */ Symbol("handler");
37352
37352
  var Request2 = class {
37353
37353
  constructor(origin, {
37354
- path: path54,
37354
+ path: path56,
37355
37355
  method,
37356
37356
  body,
37357
37357
  headers,
@@ -37368,11 +37368,11 @@ var require_request = __commonJS({
37368
37368
  maxRedirections,
37369
37369
  typeOfService
37370
37370
  }, handler) {
37371
- if (typeof path54 !== "string") {
37371
+ if (typeof path56 !== "string") {
37372
37372
  throw new InvalidArgumentError2("path must be a string");
37373
- } else if (path54[0] !== "/" && !(path54.startsWith("http://") || path54.startsWith("https://")) && method !== "CONNECT") {
37373
+ } else if (path56[0] !== "/" && !(path56.startsWith("http://") || path56.startsWith("https://")) && method !== "CONNECT") {
37374
37374
  throw new InvalidArgumentError2("path must be an absolute URL or start with a slash");
37375
- } else if (invalidPathRegex.test(path54)) {
37375
+ } else if (invalidPathRegex.test(path56)) {
37376
37376
  throw new InvalidArgumentError2("invalid request path");
37377
37377
  }
37378
37378
  if (typeof method !== "string") {
@@ -37447,7 +37447,7 @@ var require_request = __commonJS({
37447
37447
  this.completed = false;
37448
37448
  this.aborted = false;
37449
37449
  this.upgrade = upgrade || null;
37450
- this.path = query ? serializePathWithQuery(path54, query) : path54;
37450
+ this.path = query ? serializePathWithQuery(path56, query) : path56;
37451
37451
  this.origin = origin;
37452
37452
  this.protocol = getProtocolFromUrlString(origin);
37453
37453
  this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent;
@@ -42629,7 +42629,7 @@ var require_client_h1 = __commonJS({
42629
42629
  return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT";
42630
42630
  }
42631
42631
  function writeH1(client, request7) {
42632
- const { method, path: path54, host, upgrade, blocking, reset } = request7;
42632
+ const { method, path: path56, host, upgrade, blocking, reset } = request7;
42633
42633
  let { body, headers, contentLength } = request7;
42634
42634
  const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH";
42635
42635
  if (util2.isFormDataLike(body)) {
@@ -42707,7 +42707,7 @@ var require_client_h1 = __commonJS({
42707
42707
  if (socket.setTypeOfService) {
42708
42708
  socket.setTypeOfService(request7.typeOfService);
42709
42709
  }
42710
- let header = `${method} ${path54} HTTP/1.1\r
42710
+ let header = `${method} ${path56} HTTP/1.1\r
42711
42711
  `;
42712
42712
  if (typeof host === "string") {
42713
42713
  header += `host: ${host}\r
@@ -43386,7 +43386,7 @@ var require_client_h2 = __commonJS({
43386
43386
  const headersTimeout = request7.headersTimeout ?? client[kHeadersTimeout];
43387
43387
  const bodyTimeout = request7.bodyTimeout ?? client[kBodyTimeout];
43388
43388
  const session = client[kHTTP2Session];
43389
- const { method, path: path54, host, upgrade, expectContinue, signal, protocol, headers: reqHeaders } = request7;
43389
+ const { method, path: path56, host, upgrade, expectContinue, signal, protocol, headers: reqHeaders } = request7;
43390
43390
  let { body } = request7;
43391
43391
  if (upgrade != null && upgrade !== "websocket") {
43392
43392
  util2.errorRequest(client, request7, new InvalidArgumentError2(`Custom upgrade "${upgrade}" not supported over HTTP/2`));
@@ -43455,7 +43455,7 @@ var require_client_h2 = __commonJS({
43455
43455
  }
43456
43456
  headers[HTTP2_HEADER_METHOD] = "CONNECT";
43457
43457
  headers[HTTP2_HEADER_PROTOCOL] = "websocket";
43458
- headers[HTTP2_HEADER_PATH] = path54;
43458
+ headers[HTTP2_HEADER_PATH] = path56;
43459
43459
  if (protocol === "ws:" || protocol === "wss:") {
43460
43460
  headers[HTTP2_HEADER_SCHEME] = protocol === "ws:" ? "http" : "https";
43461
43461
  } else {
@@ -43497,7 +43497,7 @@ var require_client_h2 = __commonJS({
43497
43497
  stream.setTimeout(headersTimeout);
43498
43498
  return true;
43499
43499
  }
43500
- headers[HTTP2_HEADER_PATH] = path54;
43500
+ headers[HTTP2_HEADER_PATH] = path56;
43501
43501
  headers[HTTP2_HEADER_SCHEME] = protocol === "http:" ? "http" : "https";
43502
43502
  const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH";
43503
43503
  if (body && typeof body.read === "function") {
@@ -45849,10 +45849,10 @@ var require_proxy_agent = __commonJS({
45849
45849
  };
45850
45850
  const {
45851
45851
  origin,
45852
- path: path54 = "/",
45852
+ path: path56 = "/",
45853
45853
  headers = {}
45854
45854
  } = opts;
45855
- opts.path = origin + path54;
45855
+ opts.path = origin + path56;
45856
45856
  if (!("host" in headers) && !("Host" in headers)) {
45857
45857
  const { host } = new URL(origin);
45858
45858
  headers.host = host;
@@ -47961,20 +47961,20 @@ var require_mock_utils = __commonJS({
47961
47961
  }
47962
47962
  return normalizedQp;
47963
47963
  }
47964
- function safeUrl(path54) {
47965
- if (typeof path54 !== "string") {
47966
- return path54;
47964
+ function safeUrl(path56) {
47965
+ if (typeof path56 !== "string") {
47966
+ return path56;
47967
47967
  }
47968
- const pathSegments = path54.split("?", 3);
47968
+ const pathSegments = path56.split("?", 3);
47969
47969
  if (pathSegments.length !== 2) {
47970
- return path54;
47970
+ return path56;
47971
47971
  }
47972
47972
  const qp2 = new URLSearchParams(pathSegments.pop());
47973
47973
  qp2.sort();
47974
47974
  return [...pathSegments, qp2.toString()].join("?");
47975
47975
  }
47976
- function matchKey(mockDispatch2, { path: path54, method, body, headers }) {
47977
- const pathMatch = matchValue(mockDispatch2.path, path54);
47976
+ function matchKey(mockDispatch2, { path: path56, method, body, headers }) {
47977
+ const pathMatch = matchValue(mockDispatch2.path, path56);
47978
47978
  const methodMatch = matchValue(mockDispatch2.method, method);
47979
47979
  const bodyMatch = typeof mockDispatch2.body !== "undefined" ? matchValue(mockDispatch2.body, body) : true;
47980
47980
  const headersMatch = matchHeaders(mockDispatch2, headers);
@@ -47999,8 +47999,8 @@ var require_mock_utils = __commonJS({
47999
47999
  const basePath = key.query ? serializePathWithQuery(key.path, key.query) : key.path;
48000
48000
  const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath;
48001
48001
  const resolvedPathWithoutTrailingSlash = removeTrailingSlash(resolvedPath);
48002
- let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path54, ignoreTrailingSlash }) => {
48003
- return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(path54)), resolvedPathWithoutTrailingSlash) : matchValue(safeUrl(path54), resolvedPath);
48002
+ let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path56, ignoreTrailingSlash }) => {
48003
+ return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(path56)), resolvedPathWithoutTrailingSlash) : matchValue(safeUrl(path56), resolvedPath);
48004
48004
  });
48005
48005
  if (matchedMockDispatches.length === 0) {
48006
48006
  throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`);
@@ -48039,19 +48039,19 @@ var require_mock_utils = __commonJS({
48039
48039
  mockDispatches.splice(index, 1);
48040
48040
  }
48041
48041
  }
48042
- function removeTrailingSlash(path54) {
48043
- while (path54.endsWith("/")) {
48044
- path54 = path54.slice(0, -1);
48042
+ function removeTrailingSlash(path56) {
48043
+ while (path56.endsWith("/")) {
48044
+ path56 = path56.slice(0, -1);
48045
48045
  }
48046
- if (path54.length === 0) {
48047
- path54 = "/";
48046
+ if (path56.length === 0) {
48047
+ path56 = "/";
48048
48048
  }
48049
- return path54;
48049
+ return path56;
48050
48050
  }
48051
48051
  function buildKey(opts) {
48052
- const { path: path54, method, body, headers, query } = opts;
48052
+ const { path: path56, method, body, headers, query } = opts;
48053
48053
  return {
48054
- path: path54,
48054
+ path: path56,
48055
48055
  method,
48056
48056
  body,
48057
48057
  headers,
@@ -48741,10 +48741,10 @@ var require_pending_interceptors_formatter = __commonJS({
48741
48741
  }
48742
48742
  format(pendingInterceptors) {
48743
48743
  const withPrettyHeaders = pendingInterceptors.map(
48744
- ({ method, path: path54, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
48744
+ ({ method, path: path56, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
48745
48745
  Method: method,
48746
48746
  Origin: origin,
48747
- Path: path54,
48747
+ Path: path56,
48748
48748
  "Status code": statusCode,
48749
48749
  Persistent: persist ? PERSISTENT : NOT_PERSISTENT,
48750
48750
  Invocations: timesInvoked,
@@ -48826,9 +48826,9 @@ var require_mock_agent = __commonJS({
48826
48826
  const acceptNonStandardSearchParameters = this[kMockAgentAcceptsNonStandardSearchParameters];
48827
48827
  const dispatchOpts = { ...opts };
48828
48828
  if (acceptNonStandardSearchParameters && dispatchOpts.path) {
48829
- const [path54, searchParams] = dispatchOpts.path.split("?");
48829
+ const [path56, searchParams] = dispatchOpts.path.split("?");
48830
48830
  const normalizedSearchParams = normalizeSearchParams(searchParams, acceptNonStandardSearchParameters);
48831
- dispatchOpts.path = `${path54}?${normalizedSearchParams}`;
48831
+ dispatchOpts.path = `${path56}?${normalizedSearchParams}`;
48832
48832
  }
48833
48833
  return this[kAgent].dispatch(dispatchOpts, handler);
48834
48834
  }
@@ -49229,12 +49229,12 @@ var require_snapshot_recorder = __commonJS({
49229
49229
  * @return {Promise<void>} - Resolves when snapshots are loaded
49230
49230
  */
49231
49231
  async loadSnapshots(filePath) {
49232
- const path54 = filePath || this.#snapshotPath;
49233
- if (!path54) {
49232
+ const path56 = filePath || this.#snapshotPath;
49233
+ if (!path56) {
49234
49234
  throw new InvalidArgumentError2("Snapshot path is required");
49235
49235
  }
49236
49236
  try {
49237
- const data = await readFile(resolve2(path54), "utf8");
49237
+ const data = await readFile(resolve2(path56), "utf8");
49238
49238
  const parsed = JSON.parse(data);
49239
49239
  if (Array.isArray(parsed)) {
49240
49240
  this.#snapshots.clear();
@@ -49248,7 +49248,7 @@ var require_snapshot_recorder = __commonJS({
49248
49248
  if (error63.code === "ENOENT") {
49249
49249
  this.#snapshots.clear();
49250
49250
  } else {
49251
- throw new UndiciError(`Failed to load snapshots from ${path54}`, { cause: error63 });
49251
+ throw new UndiciError(`Failed to load snapshots from ${path56}`, { cause: error63 });
49252
49252
  }
49253
49253
  }
49254
49254
  }
@@ -49259,11 +49259,11 @@ var require_snapshot_recorder = __commonJS({
49259
49259
  * @returns {Promise<void>} - Resolves when snapshots are saved
49260
49260
  */
49261
49261
  async saveSnapshots(filePath) {
49262
- const path54 = filePath || this.#snapshotPath;
49263
- if (!path54) {
49262
+ const path56 = filePath || this.#snapshotPath;
49263
+ if (!path56) {
49264
49264
  throw new InvalidArgumentError2("Snapshot path is required");
49265
49265
  }
49266
- const resolvedPath = resolve2(path54);
49266
+ const resolvedPath = resolve2(path56);
49267
49267
  await mkdir(dirname3(resolvedPath), { recursive: true });
49268
49268
  const data = Array.from(this.#snapshots.entries()).map(([hash2, snapshot]) => ({
49269
49269
  hash: hash2,
@@ -49895,15 +49895,15 @@ var require_redirect_handler = __commonJS({
49895
49895
  return;
49896
49896
  }
49897
49897
  const { origin, pathname, search } = util2.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)));
49898
- const path54 = search ? `${pathname}${search}` : pathname;
49899
- const redirectUrlString = `${origin}${path54}`;
49898
+ const path56 = search ? `${pathname}${search}` : pathname;
49899
+ const redirectUrlString = `${origin}${path56}`;
49900
49900
  for (const historyUrl of this.history) {
49901
49901
  if (historyUrl.toString() === redirectUrlString) {
49902
49902
  throw new InvalidArgumentError2(`Redirect loop detected. Cannot redirect to ${origin}. This typically happens when using a Client or Pool with cross-origin redirects. Use an Agent for cross-origin redirects.`);
49903
49903
  }
49904
49904
  }
49905
49905
  this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin);
49906
- this.opts.path = path54;
49906
+ this.opts.path = path56;
49907
49907
  this.opts.origin = origin;
49908
49908
  this.opts.query = null;
49909
49909
  }
@@ -51663,10 +51663,10 @@ var require_cache_handler = __commonJS({
51663
51663
  }
51664
51664
  return locationUrl.pathname + locationUrl.search;
51665
51665
  }
51666
- function deleteCachedUri(store, cacheKey, path54) {
51666
+ function deleteCachedUri(store, cacheKey, path56) {
51667
51667
  deleteCachedValue(store, {
51668
51668
  ...cacheKey,
51669
- path: path54
51669
+ path: path56
51670
51670
  });
51671
51671
  for (let i10 = 0; i10 < util2.safeHTTPMethods.length; i10++) {
51672
51672
  const method = util2.safeHTTPMethods[i10];
@@ -51674,7 +51674,7 @@ var require_cache_handler = __commonJS({
51674
51674
  deleteCachedValue(store, {
51675
51675
  ...cacheKey,
51676
51676
  method,
51677
- path: path54
51677
+ path: path56
51678
51678
  });
51679
51679
  }
51680
51680
  }
@@ -51685,9 +51685,9 @@ var require_cache_handler = __commonJS({
51685
51685
  }
51686
51686
  const values = Array.isArray(headerValue2) ? headerValue2 : [headerValue2];
51687
51687
  for (let i10 = 0; i10 < values.length; i10++) {
51688
- const path54 = getSameOriginPath(cacheKey, values[i10]);
51689
- if (path54 !== void 0) {
51690
- deleteCachedUri(store, cacheKey, path54);
51688
+ const path56 = getSameOriginPath(cacheKey, values[i10]);
51689
+ if (path56 !== void 0) {
51690
+ deleteCachedUri(store, cacheKey, path56);
51691
51691
  }
51692
51692
  }
51693
51693
  }
@@ -56687,11 +56687,11 @@ var require_fetch = __commonJS({
56687
56687
  function dispatch({ body }) {
56688
56688
  const url2 = requestCurrentURL(request7);
56689
56689
  const agent = fetchParams.controller.dispatcher;
56690
- const path54 = url2.pathname + url2.search;
56690
+ const path56 = url2.pathname + url2.search;
56691
56691
  const hasTrailingQuestionMark = url2.search.length === 0 && url2.href[url2.href.length - url2.hash.length - 1] === "?";
56692
56692
  return new Promise((resolve2, reject) => agent.dispatch(
56693
56693
  {
56694
- path: hasTrailingQuestionMark ? `${path54}?` : path54,
56694
+ path: hasTrailingQuestionMark ? `${path56}?` : path56,
56695
56695
  origin: url2.origin,
56696
56696
  method: request7.method,
56697
56697
  body: agent.isMockActive ? request7.body && (request7.body.source || request7.body.stream) : body,
@@ -57638,9 +57638,9 @@ var require_util5 = __commonJS({
57638
57638
  }
57639
57639
  }
57640
57640
  }
57641
- function validateCookiePath(path54) {
57642
- for (let i10 = 0; i10 < path54.length; ++i10) {
57643
- const code = path54.charCodeAt(i10);
57641
+ function validateCookiePath(path56) {
57642
+ for (let i10 = 0; i10 < path56.length; ++i10) {
57643
+ const code = path56.charCodeAt(i10);
57644
57644
  if (code < 32 || // exclude CTLs (0-31)
57645
57645
  code > 126 || // exclude DEL and non-ascii
57646
57646
  code === 59) {
@@ -60988,11 +60988,11 @@ var require_undici = __commonJS({
60988
60988
  if (typeof opts.path !== "string") {
60989
60989
  throw new InvalidArgumentError2("invalid opts.path");
60990
60990
  }
60991
- let path54 = opts.path;
60991
+ let path56 = opts.path;
60992
60992
  if (!opts.path.startsWith("/")) {
60993
- path54 = `/${path54}`;
60993
+ path56 = `/${path56}`;
60994
60994
  }
60995
- url2 = new URL(util2.parseOrigin(url2).origin + path54);
60995
+ url2 = new URL(util2.parseOrigin(url2).origin + path56);
60996
60996
  } else {
60997
60997
  if (!opts) {
60998
60998
  opts = typeof url2 === "object" ? url2 : {};
@@ -99989,8 +99989,8 @@ var require_utils3 = __commonJS({
99989
99989
  }
99990
99990
  return ind;
99991
99991
  }
99992
- function removeDotSegments(path54) {
99993
- let input2 = path54;
99992
+ function removeDotSegments(path56) {
99993
+ let input2 = path56;
99994
99994
  const output2 = [];
99995
99995
  let nextSlash = -1;
99996
99996
  let len = 0;
@@ -100399,8 +100399,8 @@ var require_schemes = __commonJS({
100399
100399
  }
100400
100400
  if (wsComponent.resourceName) {
100401
100401
  const queryIndex = wsComponent.resourceName.indexOf("?");
100402
- const path54 = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
100403
- wsComponent.path = path54 && path54 !== "/" ? path54 : void 0;
100402
+ const path56 = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
100403
+ wsComponent.path = path56 && path56 !== "/" ? path56 : void 0;
100404
100404
  wsComponent.query = queryIndex === -1 ? void 0 : wsComponent.resourceName.slice(queryIndex + 1);
100405
100405
  wsComponent.resourceName = void 0;
100406
100406
  }
@@ -103927,7 +103927,7 @@ var require_dist2 = __commonJS({
103927
103927
  });
103928
103928
 
103929
103929
  // src/cli.ts
103930
- var import_node_path53 = __toESM(require("node:path"), 1);
103930
+ var import_node_path55 = __toESM(require("node:path"), 1);
103931
103931
 
103932
103932
  // node_modules/.pnpm/commander@15.0.0/node_modules/commander/lib/error.js
103933
103933
  var CommanderError = class extends Error {
@@ -107040,9 +107040,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
107040
107040
  * @param {string} [path]
107041
107041
  * @return {(string|null|Command)}
107042
107042
  */
107043
- executableDir(path54) {
107044
- if (path54 === void 0) return this._executableDir;
107045
- this._executableDir = path54;
107043
+ executableDir(path56) {
107044
+ if (path56 === void 0) return this._executableDir;
107045
+ this._executableDir = path56;
107046
107046
  return this;
107047
107047
  }
107048
107048
  /**
@@ -108691,19 +108691,19 @@ function writePools(paths, pools) {
108691
108691
  applyPatch(paths.globalConfigFile, GlobalConfigSchema, { pools }, { defaults: {} });
108692
108692
  }
108693
108693
  function poolCycleOf(pools, name) {
108694
- const walk = (current, path54) => {
108694
+ const walk = (current, path56) => {
108695
108695
  for (const entry of pools[current]?.identities ?? []) {
108696
108696
  const nested = poolNameOf(poolMemberIdentity(entry));
108697
108697
  if (nested === void 0) {
108698
108698
  continue;
108699
108699
  }
108700
108700
  if (nested === name) {
108701
- return [...path54, nested];
108701
+ return [...path56, nested];
108702
108702
  }
108703
- if (path54.includes(nested)) {
108703
+ if (path56.includes(nested)) {
108704
108704
  continue;
108705
108705
  }
108706
- const found = walk(nested, [...path54, nested]);
108706
+ const found = walk(nested, [...path56, nested]);
108707
108707
  if (found !== void 0) {
108708
108708
  return found;
108709
108709
  }
@@ -113009,8 +113009,8 @@ function parseConnectTarget(authority) {
113009
113009
  }
113010
113010
  return { host, port };
113011
113011
  }
113012
- function servedByPipeline(path54) {
113013
- return path54?.startsWith(ROUTED_PATH_PREFIX) === true;
113012
+ function servedByPipeline(path56) {
113013
+ return path56?.startsWith(ROUTED_PATH_PREFIX) === true;
113014
113014
  }
113015
113015
  var HOP_BY_HOP_HEADERS = /* @__PURE__ */ new Set([
113016
113016
  "connection",
@@ -113529,11 +113529,11 @@ function createRcSessionTracker(deps) {
113529
113529
  };
113530
113530
  const observeExchange = (request7) => {
113531
113531
  const method = (request7.method ?? "").toUpperCase();
113532
- const path54 = new URL(request7.url ?? "/", "http://127.0.0.1").pathname;
113533
- if (!path54.startsWith(RC_SESSIONS_PATH_PREFIX)) {
113532
+ const path56 = new URL(request7.url ?? "/", "http://127.0.0.1").pathname;
113533
+ if (!path56.startsWith(RC_SESSIONS_PATH_PREFIX)) {
113534
113534
  return void 0;
113535
113535
  }
113536
- const tail = path54.slice(RC_SESSIONS_PATH_PREFIX.length);
113536
+ const tail = path56.slice(RC_SESSIONS_PATH_PREFIX.length);
113537
113537
  const facts = {
113538
113538
  oauthAuthorization: oauthAuthorizationOf(request7.headers),
113539
113539
  anthropicVersion: singleHeader(request7.headers, "anthropic-version"),
@@ -113894,8 +113894,8 @@ var RC_READ_FILE_ENCODINGS = ["utf-8", "base64"];
113894
113894
  function isRcReadFileEncoding(value2) {
113895
113895
  return RC_READ_FILE_ENCODINGS.some((encoding) => encoding === value2);
113896
113896
  }
113897
- function buildRcReadFilePayload(requestId, path54, options) {
113898
- return buildRcControlRequestPayload(requestId, { subtype: "read_file", path: path54, ...options?.maxBytes === void 0 ? {} : { max_bytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } });
113897
+ function buildRcReadFilePayload(requestId, path56, options) {
113898
+ return buildRcControlRequestPayload(requestId, { subtype: "read_file", path: path56, ...options?.maxBytes === void 0 ? {} : { max_bytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } });
113899
113899
  }
113900
113900
  function buildRcFileSuggestionsPayload(requestId, query) {
113901
113901
  return buildRcControlRequestPayload(requestId, { subtype: "file_suggestions", query });
@@ -113997,15 +113997,15 @@ async function getRcSessionContextUsage(deps, sessionId, detail) {
113997
113997
  const result = await deliverRcClientPayload(deps, sessionId, buildRcGetContextUsagePayload(requestId, detail), `request the context usage of session ${sessionId}`);
113998
113998
  return result.ok ? { ...result, requestId } : result;
113999
113999
  }
114000
- async function readRcSessionFile(deps, sessionId, path54, options) {
114001
- if (path54 === "") {
114000
+ async function readRcSessionFile(deps, sessionId, path56, options) {
114001
+ if (path56 === "") {
114002
114002
  return { ok: false, message: "a read-file write needs a non-empty path: the SDK's own field names the file the worker resolves against the session's cwd, and an empty string names none" };
114003
114003
  }
114004
114004
  if (options?.maxBytes !== void 0 && (!Number.isInteger(options.maxBytes) || options.maxBytes <= 0)) {
114005
114005
  return { ok: false, message: "a read-file write's max-bytes is a positive whole number of bytes: the SDK's own field caps the read, and a zero or negative cap reads nothing" };
114006
114006
  }
114007
114007
  const requestId = deps.newUuid();
114008
- const result = await deliverRcClientPayload(deps, sessionId, buildRcReadFilePayload(requestId, path54, options), `read ${path54} from session ${sessionId}`);
114008
+ const result = await deliverRcClientPayload(deps, sessionId, buildRcReadFilePayload(requestId, path56, options), `read ${path56} from session ${sessionId}`);
114009
114009
  return result.ok ? { ...result, requestId } : result;
114010
114010
  }
114011
114011
  async function suggestRcSessionFiles(deps, sessionId, query) {
@@ -114176,11 +114176,11 @@ function createRcControlHandler(deps) {
114176
114176
  path: "read-file",
114177
114177
  read: (body) => {
114178
114178
  const session = bodyString(body, "session");
114179
- const path54 = bodyString(body, "path");
114179
+ const path56 = bodyString(body, "path");
114180
114180
  const maxBytes = "maxBytes" in body ? bodyPositiveInteger(body, "maxBytes") : void 0;
114181
114181
  const encoding = "encoding" in body && isRcReadFileEncoding(body.encoding) ? body.encoding : void 0;
114182
- const refused2 = session === void 0 || path54 === void 0 || "maxBytes" in body && maxBytes === void 0 || "encoding" in body && encoding === void 0;
114183
- return refused2 ? { error: `the read-file body must be JSON naming a non-empty session id and path, maxBytes only as a positive whole number or absent, and an encoding the SDK's own type permits (${RC_READ_FILE_ENCODINGS.join(", ")}) or none` } : { session, run: async () => await deps.readFile(session, path54, { ...maxBytes === void 0 ? {} : { maxBytes }, ...encoding === void 0 ? {} : { encoding } }) };
114182
+ const refused2 = session === void 0 || path56 === void 0 || "maxBytes" in body && maxBytes === void 0 || "encoding" in body && encoding === void 0;
114183
+ return refused2 ? { error: `the read-file body must be JSON naming a non-empty session id and path, maxBytes only as a positive whole number or absent, and an encoding the SDK's own type permits (${RC_READ_FILE_ENCODINGS.join(", ")}) or none` } : { session, run: async () => await deps.readFile(session, path56, { ...maxBytes === void 0 ? {} : { maxBytes }, ...encoding === void 0 ? {} : { encoding } }) };
114184
114184
  }
114185
114185
  },
114186
114186
  {
@@ -114490,9 +114490,9 @@ function requestIdOfBody(body) {
114490
114490
  }
114491
114491
  function frontDoorRcControl(transport, token) {
114492
114492
  const headers = { authorization: `Bearer ${token}` };
114493
- const listAnswerOf = async (path54, what) => {
114493
+ const listAnswerOf = async (path56, what) => {
114494
114494
  try {
114495
- return await transport.request({ method: "GET", path: path54, headers });
114495
+ return await transport.request({ method: "GET", path: path56, headers });
114496
114496
  } catch (error63) {
114497
114497
  throw new Error(`${what}: could not reach the front door's control listener: ${error63 instanceof Error ? error63.message : String(error63)}`, { cause: error63 });
114498
114498
  }
@@ -114564,10 +114564,10 @@ function frontDoorRcControl(transport, token) {
114564
114564
  }
114565
114565
  return pending;
114566
114566
  };
114567
- const writeOf = async (path54, body, describeFailure) => {
114567
+ const writeOf = async (path56, body, describeFailure2) => {
114568
114568
  let answer;
114569
114569
  try {
114570
- answer = await transport.request({ method: "POST", path: path54, headers: { ...headers, "content-type": "application/json" }, body });
114570
+ answer = await transport.request({ method: "POST", path: path56, headers: { ...headers, "content-type": "application/json" }, body });
114571
114571
  } catch (error63) {
114572
114572
  return { ok: false, message: `could not reach the front door's control listener: ${error63 instanceof Error ? error63.message : String(error63)}` };
114573
114573
  }
@@ -114579,7 +114579,7 @@ function frontDoorRcControl(transport, token) {
114579
114579
  const requestId = requestIdOfBody(answer.body);
114580
114580
  return requestId === void 0 ? { ok: true, sequenceNums } : { ok: true, sequenceNums, requestId };
114581
114581
  }
114582
- return { ok: false, message: describeFailure(answer.status, controlErrorOf(answer.body) ?? answer.body) };
114582
+ return { ok: false, message: describeFailure2(answer.status, controlErrorOf(answer.body) ?? answer.body) };
114583
114583
  };
114584
114584
  const sessionQuery = (sessionId) => sessionId === void 0 ? "" : `?session=${encodeURIComponent(sessionId)}`;
114585
114585
  return {
@@ -114598,10 +114598,10 @@ function frontDoorRcControl(transport, token) {
114598
114598
  endSession: async (sessionId, reason) => await writeOf(`${CONTROL_PATH_PREFIX}/end-session`, JSON.stringify({ session: sessionId, ...reason === void 0 ? {} : { reason } }), (status, message) => `ending ${sessionId} failed (HTTP ${String(status)}): ${message}`),
114599
114599
  getUsage: async (sessionId, skipBehaviors) => await writeOf(`${CONTROL_PATH_PREFIX}/get-usage`, JSON.stringify({ session: sessionId, ...skipBehaviors === void 0 ? {} : { skipBehaviors } }), (status, message) => `requesting the usage of ${sessionId} failed (HTTP ${String(status)}): ${message}`),
114600
114600
  getContextUsage: async (sessionId, detail) => await writeOf(`${CONTROL_PATH_PREFIX}/get-context-usage`, JSON.stringify({ session: sessionId, ...detail === void 0 ? {} : { detail } }), (status, message) => `requesting the context usage of ${sessionId} failed (HTTP ${String(status)}): ${message}`),
114601
- readFile: async (sessionId, path54, options) => await writeOf(
114601
+ readFile: async (sessionId, path56, options) => await writeOf(
114602
114602
  `${CONTROL_PATH_PREFIX}/read-file`,
114603
- JSON.stringify({ session: sessionId, path: path54, ...options?.maxBytes === void 0 ? {} : { maxBytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } }),
114604
- (status, message) => `reading ${path54} from ${sessionId} failed (HTTP ${String(status)}): ${message}`
114603
+ JSON.stringify({ session: sessionId, path: path56, ...options?.maxBytes === void 0 ? {} : { maxBytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } }),
114604
+ (status, message) => `reading ${path56} from ${sessionId} failed (HTTP ${String(status)}): ${message}`
114605
114605
  ),
114606
114606
  fileSuggestions: async (sessionId, query) => await writeOf(`${CONTROL_PATH_PREFIX}/file-suggestions`, JSON.stringify({ session: sessionId, query }), (status, message) => `requesting file suggestions from ${sessionId} failed (HTTP ${String(status)}): ${message}`),
114607
114607
  keepAlive: async (sessionId) => await writeOf(`${CONTROL_PATH_PREFIX}/keep-alive`, JSON.stringify({ session: sessionId }), (status, message) => `keeping ${sessionId} alive failed (HTTP ${String(status)}): ${message}`),
@@ -114895,12 +114895,12 @@ function tlsFacts(options) {
114895
114895
  }
114896
114896
  function realRcEventDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_PORT }) {
114897
114897
  const agent = new ExemptTlsAgent();
114898
- const post = async (path54, headers, body) => await new Promise((resolve2, reject) => {
114898
+ const post = async (path56, headers, body) => await new Promise((resolve2, reject) => {
114899
114899
  const options = {
114900
114900
  host: target.host,
114901
114901
  port: target.port,
114902
114902
  method: "POST",
114903
- path: path54,
114903
+ path: path56,
114904
114904
  // The Host header names the host whose API this is, not the address dialled: a redirected test dials a loopback stand-in while still speaking to the API host by name, exactly as the forwarded paths present their SNI.
114905
114905
  headers: { ...headers, host: target.servername ?? target.host, "content-length": String(Buffer.byteLength(body, "utf8")) },
114906
114906
  agent
@@ -114965,12 +114965,12 @@ function lateRcStreamDial(resolve2) {
114965
114965
  }
114966
114966
  function realRcStreamDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_PORT }) {
114967
114967
  const agent = new ExemptTlsAgent();
114968
- const request7 = async (method, path54, headers, body, signal) => await new Promise((resolve2, reject) => {
114968
+ const request7 = async (method, path56, headers, body, signal) => await new Promise((resolve2, reject) => {
114969
114969
  const options = {
114970
114970
  host: target.host,
114971
114971
  port: target.port,
114972
114972
  method,
114973
- path: path54,
114973
+ path: path56,
114974
114974
  // The Host header names the host whose API this is, not the address dialled: a redirected test dials a loopback stand-in while still speaking to the API host by name, exactly as the forwarded paths present their SNI.
114975
114975
  headers: { ...headers, host: target.servername ?? target.host, ...body === void 0 ? {} : { "content-length": String(Buffer.byteLength(body, "utf8")) } },
114976
114976
  agent,
@@ -115012,9 +115012,9 @@ function realRcStreamDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_P
115012
115012
  return { status, body: await readAll(response) };
115013
115013
  },
115014
115014
  openStream: async (sessionId, headers, resume, signal) => {
115015
- const path54 = resume === void 0 ? `/v1/code/sessions/${encodeURIComponent(sessionId)}/events/stream` : `/v1/code/sessions/${encodeURIComponent(sessionId)}/events/stream?from_sequence_num=${String(resume.fromSequenceNum)}`;
115015
+ const path56 = resume === void 0 ? `/v1/code/sessions/${encodeURIComponent(sessionId)}/events/stream` : `/v1/code/sessions/${encodeURIComponent(sessionId)}/events/stream?from_sequence_num=${String(resume.fromSequenceNum)}`;
115016
115016
  const streamHeaders = resume === void 0 ? headers : { ...headers, "last-event-id": String(resume.fromSequenceNum) };
115017
- const { status, response } = await request7("GET", path54, streamHeaders, void 0, signal);
115017
+ const { status, response } = await request7("GET", path56, streamHeaders, void 0, signal);
115018
115018
  if (!isSuccessful2(status)) {
115019
115019
  await readAll(response);
115020
115020
  return { status, chunks: NO_CHUNKS };
@@ -116176,11 +116176,11 @@ function tryOrUndefined(fn2) {
116176
116176
  return void 0;
116177
116177
  }
116178
116178
  }
116179
- function pathToHttpPath(path54) {
116180
- return `/${path54.map(safeEncodeURIComponent).join("/")}`;
116179
+ function pathToHttpPath(path56) {
116180
+ return `/${path56.map(safeEncodeURIComponent).join("/")}`;
116181
116181
  }
116182
- function normalizeHttpPath(path54) {
116183
- const paths = path54.split("/");
116182
+ function normalizeHttpPath(path56) {
116183
+ const paths = path56.split("/");
116184
116184
  if (paths.at(0) === "") {
116185
116185
  paths.shift();
116186
116186
  }
@@ -116365,9 +116365,9 @@ function isPlainObject2(value2) {
116365
116365
  function getOwn(object3, key) {
116366
116366
  return Object.hasOwn(object3, key) ? object3[key] : void 0;
116367
116367
  }
116368
- function get(object3, path54) {
116368
+ function get(object3, path56) {
116369
116369
  let current = object3;
116370
- for (const key of path54) {
116370
+ for (const key of path56) {
116371
116371
  if (!isTypescriptObject(current)) {
116372
116372
  return void 0;
116373
116373
  }
@@ -117590,7 +117590,7 @@ function resolveClientRest(rest) {
117590
117590
  // rest[1] can be undefined if all fields of FriendlyClientOptions are optional
117591
117591
  ];
117592
117592
  }
117593
- function createORPCClient(link, { path: path54 = [], ...options } = {}) {
117593
+ function createORPCClient(link, { path: path56 = [], ...options } = {}) {
117594
117594
  const procedureClient = (...rest) => {
117595
117595
  const [input2, callOptions] = resolveClientRest(rest);
117596
117596
  const interceptors = [
@@ -117599,7 +117599,7 @@ function createORPCClient(link, { path: path54 = [], ...options } = {}) {
117599
117599
  ];
117600
117600
  return intercept(
117601
117601
  interceptors,
117602
- { ...callOptions, input: input2, path: path54 },
117602
+ { ...callOptions, input: input2, path: path56 },
117603
117603
  ({ path: path210, input: input22, ...callOptions2 }) => link.call(path210, input22, callOptions2)
117604
117604
  );
117605
117605
  };
@@ -117613,7 +117613,7 @@ function createORPCClient(link, { path: path54 = [], ...options } = {}) {
117613
117613
  if (client === void 0) {
117614
117614
  client = createORPCClient(link, {
117615
117615
  ...options,
117616
- path: [...path54, key],
117616
+ path: [...path56, key],
117617
117617
  scoped: options.scoped?.[key]
117618
117618
  });
117619
117619
  cache.set(key, client);
@@ -117635,24 +117635,24 @@ var BracketNotationSerializer = class {
117635
117635
  this.internalSerialize(data, "", true, result);
117636
117636
  return result;
117637
117637
  }
117638
- internalSerialize(data, path54, isRoot, result) {
117638
+ internalSerialize(data, path56, isRoot, result) {
117639
117639
  if (Array.isArray(data)) {
117640
117640
  data.forEach((item, i10) => {
117641
- this.internalSerialize(item, isRoot ? i10.toString() : `${path54}[${i10}]`, false, result);
117641
+ this.internalSerialize(item, isRoot ? i10.toString() : `${path56}[${i10}]`, false, result);
117642
117642
  });
117643
117643
  } else if (isPlainObject2(data)) {
117644
117644
  for (const key of Object.keys(data)) {
117645
- this.internalSerialize(data[key], isRoot ? key : `${path54}[${key}]`, false, result);
117645
+ this.internalSerialize(data[key], isRoot ? key : `${path56}[${key}]`, false, result);
117646
117646
  }
117647
117647
  } else {
117648
- result.push([path54, data]);
117648
+ result.push([path56, data]);
117649
117649
  }
117650
117650
  }
117651
117651
  deserialize(serialized) {
117652
117652
  const arrayPushStyles = /* @__PURE__ */ new WeakSet();
117653
117653
  const root = new NullProtoObj();
117654
- for (const [path54, value2] of serialized) {
117655
- const segments = this.parsePath(path54);
117654
+ for (const [path56, value2] of serialized) {
117655
+ const segments = this.parsePath(path56);
117656
117656
  let currentRef = root;
117657
117657
  let nextSegment = segments[0];
117658
117658
  for (let i10 = 1; i10 < segments.length; i10++) {
@@ -117703,13 +117703,13 @@ var BracketNotationSerializer = class {
117703
117703
  }
117704
117704
  return result;
117705
117705
  }
117706
- parsePath(path54) {
117706
+ parsePath(path56) {
117707
117707
  const segments = [];
117708
117708
  let inBrackets = false;
117709
117709
  let currentSegment = "";
117710
- for (let i10 = 0; i10 < path54.length; i10++) {
117711
- const char = path54[i10];
117712
- const nextChar = path54[i10 + 1];
117710
+ for (let i10 = 0; i10 < path56.length; i10++) {
117711
+ const char = path56[i10];
117712
+ const nextChar = path56[i10 + 1];
117713
117713
  if (inBrackets && char === "]" && (nextChar === void 0 || nextChar === "[")) {
117714
117714
  if (nextChar === void 0) {
117715
117715
  inBrackets = false;
@@ -117725,7 +117725,7 @@ var BracketNotationSerializer = class {
117725
117725
  currentSegment += char;
117726
117726
  }
117727
117727
  }
117728
- return inBrackets || segments.length === 0 ? [path54] : segments;
117728
+ return inBrackets || segments.length === 0 ? [path56] : segments;
117729
117729
  }
117730
117730
  };
117731
117731
  var INTEGER_PATTERN = /^0$|^[1-9]\d*$/;
@@ -118298,11 +118298,11 @@ var OpenAPISerializer = class {
118298
118298
  return json2;
118299
118299
  }
118300
118300
  const form = new FormData();
118301
- for (const [path54, value22] of this.bracketNotation.serialize(json2)) {
118301
+ for (const [path56, value22] of this.bracketNotation.serialize(json2)) {
118302
118302
  if (value22 instanceof Blob) {
118303
- form.append(path54, value22);
118303
+ form.append(path56, value22);
118304
118304
  } else if (value22 !== void 0 && value22 !== null) {
118305
- form.append(path54, String(value22));
118305
+ form.append(path56, String(value22));
118306
118306
  }
118307
118307
  }
118308
118308
  return form;
@@ -118340,30 +118340,30 @@ function isBodylessMethod(method) {
118340
118340
  return method === "GET" || method === "HEAD";
118341
118341
  }
118342
118342
  var PARAMETER_NAME_REGEX = /^[\w-]+$/;
118343
- function getDynamicPathParams(path54) {
118344
- if (!path54.includes("{")) {
118343
+ function getDynamicPathParams(path56) {
118344
+ if (!path56.includes("{")) {
118345
118345
  return void 0;
118346
118346
  }
118347
- const len = path54.length;
118347
+ const len = path56.length;
118348
118348
  let params;
118349
118349
  let index = 1;
118350
118350
  while (index < len) {
118351
118351
  const segmentStart = index;
118352
- const slashPos = path54.indexOf("/", index);
118352
+ const slashPos = path56.indexOf("/", index);
118353
118353
  const segmentEnd = slashPos === -1 ? len : slashPos;
118354
- if (segmentEnd > segmentStart && path54.charCodeAt(segmentStart) === 123 && path54.charCodeAt(segmentEnd - 1) === 125) {
118354
+ if (segmentEnd > segmentStart && path56.charCodeAt(segmentStart) === 123 && path56.charCodeAt(segmentEnd - 1) === 125) {
118355
118355
  let parameterStart = segmentStart + 1;
118356
118356
  let allowsSlash = false;
118357
- const operator = path54.charCodeAt(parameterStart);
118357
+ const operator = path56.charCodeAt(parameterStart);
118358
118358
  if (operator === 43) {
118359
118359
  allowsSlash = true;
118360
118360
  parameterStart++;
118361
118361
  }
118362
- const parameterName = path54.slice(parameterStart, segmentEnd - 1);
118362
+ const parameterName = path56.slice(parameterStart, segmentEnd - 1);
118363
118363
  if (PARAMETER_NAME_REGEX.test(parameterName)) {
118364
118364
  params ??= [];
118365
118365
  params.push({
118366
- segment: path54.slice(segmentStart, segmentEnd),
118366
+ segment: path56.slice(segmentStart, segmentEnd),
118367
118367
  startIndex: segmentStart,
118368
118368
  parameterName,
118369
118369
  allowsSlash
@@ -118406,8 +118406,8 @@ openapi.method = (method) => ({
118406
118406
  ...openapi({ method }),
118407
118407
  name: "~openapi/method"
118408
118408
  });
118409
- openapi.path = (path54) => ({
118410
- ...openapi({ path: path54 }),
118409
+ openapi.path = (path56) => ({
118410
+ ...openapi({ path: path56 }),
118411
118411
  name: "~openapi/path"
118412
118412
  });
118413
118413
  openapi.spec = (spec) => ({
@@ -119268,22 +119268,22 @@ function visitJsonSchemaRefs(value2, visit2, schemaLevel = true, seen = /* @__PU
119268
119268
  }
119269
119269
  }
119270
119270
  }
119271
- function mapJsonSchemaRefs(value2, map2, schemaLevel = true, path54 = []) {
119271
+ function mapJsonSchemaRefs(value2, map2, schemaLevel = true, path56 = []) {
119272
119272
  if (!value2 || typeof value2 !== "object") {
119273
119273
  return value2;
119274
119274
  }
119275
119275
  if (Array.isArray(value2)) {
119276
- return value2.map((item, index) => mapJsonSchemaRefs(item, map2, schemaLevel, [...path54, index]));
119276
+ return value2.map((item, index) => mapJsonSchemaRefs(item, map2, schemaLevel, [...path56, index]));
119277
119277
  }
119278
119278
  const result = {};
119279
119279
  for (const key of Object.keys(value2)) {
119280
119280
  const val = value2[key];
119281
119281
  if (key === "$ref" && typeof val === "string") {
119282
- setOwn(result, key, map2(val, [...path54, key]));
119282
+ setOwn(result, key, map2(val, [...path56, key]));
119283
119283
  } else if (!schemaLevel) {
119284
- setOwn(result, key, mapJsonSchemaRefs(val, map2, true, [...path54, key]));
119284
+ setOwn(result, key, mapJsonSchemaRefs(val, map2, true, [...path56, key]));
119285
119285
  } else if (JSON_SCHEMA_LOGIC_KEYWORDS.has(key) || JSON_SCHEMA_RECORD_KEYWORDS.has(key)) {
119286
- setOwn(result, key, mapJsonSchemaRefs(val, map2, !JSON_SCHEMA_RECORD_KEYWORDS.has(key), [...path54, key]));
119286
+ setOwn(result, key, mapJsonSchemaRefs(val, map2, !JSON_SCHEMA_RECORD_KEYWORDS.has(key), [...path56, key]));
119287
119287
  } else {
119288
119288
  setOwn(result, key, val);
119289
119289
  }
@@ -119813,7 +119813,7 @@ function unlazy(maybeLazy) {
119813
119813
  function createProcedureClient(lazyableProcedure, ...rest) {
119814
119814
  const options = resolveMaybeOptionalOptions(rest);
119815
119815
  return async (...[input2, callerOptions]) => {
119816
- const path54 = toArray(options.path);
119816
+ const path56 = toArray(options.path);
119817
119817
  const { default: procedure } = await unlazy(lazyableProcedure);
119818
119818
  const clientContext = callerOptions?.context ?? {};
119819
119819
  const context = await value(options.context, clientContext) ?? {};
@@ -119826,7 +119826,7 @@ function createProcedureClient(lazyableProcedure, ...rest) {
119826
119826
  };
119827
119827
  try {
119828
119828
  const output2 = await runWithSpan("call_procedure", (span) => {
119829
- span?.setAttribute("procedure.path", path54);
119829
+ span?.setAttribute("procedure.path", path56);
119830
119830
  return intercept(
119831
119831
  options.interceptors,
119832
119832
  {
@@ -119834,7 +119834,7 @@ function createProcedureClient(lazyableProcedure, ...rest) {
119834
119834
  // input can be optional if it is undefinable
119835
119835
  input: input2,
119836
119836
  errors,
119837
- path: path54,
119837
+ path: path56,
119838
119838
  procedure,
119839
119839
  signal: callerOptions?.signal,
119840
119840
  lastEventId: callerOptions?.lastEventId
@@ -120085,10 +120085,10 @@ function augmentRouter(router, options) {
120085
120085
  }
120086
120086
  return enhanced;
120087
120087
  }
120088
- function getRouter(router, path54) {
120088
+ function getRouter(router, path56) {
120089
120089
  let current = router;
120090
- for (let i10 = 0; i10 < path54.length; i10++) {
120091
- const segment = path54[i10];
120090
+ for (let i10 = 0; i10 < path56.length; i10++) {
120091
+ const segment = path56[i10];
120092
120092
  if (!isTypescriptObject(current)) {
120093
120093
  return void 0;
120094
120094
  }
@@ -120100,7 +120100,7 @@ function getRouter(router, path54) {
120100
120100
  continue;
120101
120101
  }
120102
120102
  const lazied = current;
120103
- const rest = path54.slice(i10);
120103
+ const rest = path56.slice(i10);
120104
120104
  return new Lazy({
120105
120105
  ...lazied["~orpc"],
120106
120106
  async loader() {
@@ -120115,40 +120115,40 @@ function getRouter(router, path54) {
120115
120115
  }
120116
120116
  return current;
120117
120117
  }
120118
- function walkProcedureContractsSync(router, callback, path54 = []) {
120118
+ function walkProcedureContractsSync(router, callback, path56 = []) {
120119
120119
  const lazyResults = [];
120120
- walkProcedureContractsSyncInternal(router, callback, path54.slice(), lazyResults);
120120
+ walkProcedureContractsSyncInternal(router, callback, path56.slice(), lazyResults);
120121
120121
  return lazyResults;
120122
120122
  }
120123
- function walkProcedureContractsSyncInternal(router, callback, path54, lazyResults) {
120123
+ function walkProcedureContractsSyncInternal(router, callback, path56, lazyResults) {
120124
120124
  const hiddenContract = getHiddenRouterContract(router);
120125
120125
  if (hiddenContract !== void 0) {
120126
120126
  router = hiddenContract;
120127
120127
  }
120128
120128
  if (router instanceof ProcedureContract) {
120129
- callback(router, path54.slice());
120129
+ callback(router, path56.slice());
120130
120130
  return;
120131
120131
  }
120132
120132
  if (!isTypescriptObject(router)) {
120133
120133
  return;
120134
120134
  }
120135
120135
  for (const [key, value2] of Object.entries(router)) {
120136
- path54.push(key);
120136
+ path56.push(key);
120137
120137
  if (value2 instanceof Lazy) {
120138
- lazyResults.push({ router: value2, path: path54.slice() });
120138
+ lazyResults.push({ router: value2, path: path56.slice() });
120139
120139
  } else {
120140
- walkProcedureContractsSyncInternal(value2, callback, path54, lazyResults);
120140
+ walkProcedureContractsSyncInternal(value2, callback, path56, lazyResults);
120141
120141
  }
120142
- path54.pop();
120142
+ path56.pop();
120143
120143
  }
120144
120144
  }
120145
- async function walkProcedureContractsAsync(router, callback, path54 = []) {
120145
+ async function walkProcedureContractsAsync(router, callback, path56 = []) {
120146
120146
  const hiddenContract = getHiddenRouterContract(router);
120147
120147
  if (hiddenContract !== void 0) {
120148
120148
  router = hiddenContract;
120149
120149
  }
120150
120150
  if (router instanceof ProcedureContract) {
120151
- await callback(router, path54);
120151
+ await callback(router, path56);
120152
120152
  return;
120153
120153
  }
120154
120154
  if (!isTypescriptObject(router)) {
@@ -120157,9 +120157,9 @@ async function walkProcedureContractsAsync(router, callback, path54 = []) {
120157
120157
  for (const [key, value2] of Object.entries(router)) {
120158
120158
  if (value2 instanceof Lazy) {
120159
120159
  const { default: router2 } = await unlazy(value2);
120160
- await walkProcedureContractsAsync(router2, callback, [...path54, key]);
120160
+ await walkProcedureContractsAsync(router2, callback, [...path56, key]);
120161
120161
  } else {
120162
- await walkProcedureContractsAsync(value2, callback, [...path54, key]);
120162
+ await walkProcedureContractsAsync(value2, callback, [...path56, key]);
120163
120163
  }
120164
120164
  }
120165
120165
  }
@@ -120645,18 +120645,18 @@ function rewriteComponentSchemaRefs(schema, renameMap) {
120645
120645
  }
120646
120646
  var OpenAPIGeneratorError = class extends TypeError {
120647
120647
  };
120648
- function toOpenAPIPath(path54, dynamicPathParams) {
120648
+ function toOpenAPIPath(path56, dynamicPathParams) {
120649
120649
  if (!dynamicPathParams?.length) {
120650
- return path54;
120650
+ return path56;
120651
120651
  }
120652
120652
  let normalized = "";
120653
120653
  let currentIndex = 0;
120654
120654
  for (const param of dynamicPathParams) {
120655
- normalized += path54.slice(currentIndex, param.startIndex);
120655
+ normalized += path56.slice(currentIndex, param.startIndex);
120656
120656
  normalized += `{${param.parameterName}}`;
120657
120657
  currentIndex = param.startIndex + param.segment.length;
120658
120658
  }
120659
- normalized += path54.slice(currentIndex);
120659
+ normalized += path56.slice(currentIndex);
120660
120660
  return normalized;
120661
120661
  }
120662
120662
  function buildRequest(ctx, operation, def, meta3, dynamicPathParams) {
@@ -121090,8 +121090,8 @@ var OpenAPIGenerator = class {
121090
121090
  customErrorResponseBodySchema: options.customErrorResponseBodySchema
121091
121091
  };
121092
121092
  const errors = [];
121093
- await walkProcedureContractsAsync(router, (contract, path54) => {
121094
- if (value(options.filter, contract, path54) === false) {
121093
+ await walkProcedureContractsAsync(router, (contract, path56) => {
121094
+ if (value(options.filter, contract, path56) === false) {
121095
121095
  return;
121096
121096
  }
121097
121097
  try {
@@ -121103,7 +121103,7 @@ var OpenAPIGenerator = class {
121103
121103
  `QUERY operations require OpenAPI 3.2, but version "${version2}" was requested.`
121104
121104
  );
121105
121105
  }
121106
- const postPath = meta3?.path ?? pathToHttpPath(path54);
121106
+ const postPath = meta3?.path ?? pathToHttpPath(path56);
121107
121107
  const httpPath = meta3?.prefix ? mergeHttpPath(meta3.prefix, postPath) : postPath;
121108
121108
  const dynamicPathParams = getDynamicPathParams(httpPath);
121109
121109
  const openApiPath = toOpenAPIPath(httpPath, dynamicPathParams);
@@ -121112,7 +121112,7 @@ var OpenAPIGenerator = class {
121112
121112
  operation = meta3.spec;
121113
121113
  } else {
121114
121114
  operation = {
121115
- operationId: meta3?.operationId ?? path54.join("."),
121115
+ operationId: meta3?.operationId ?? path56.join("."),
121116
121116
  summary: meta3?.summary,
121117
121117
  description: meta3?.description,
121118
121118
  deprecated: meta3?.deprecated,
@@ -121132,7 +121132,7 @@ var OpenAPIGenerator = class {
121132
121132
  if (!(e14 instanceof OpenAPIGeneratorError)) {
121133
121133
  throw e14;
121134
121134
  }
121135
- errors.push(`Procedure at ${path54.join(".") || "(root)"}: ${e14.message}`);
121135
+ errors.push(`Procedure at ${path56.join(".") || "(root)"}: ${e14.message}`);
121136
121136
  }
121137
121137
  });
121138
121138
  if (errors.length) {
@@ -121977,16 +121977,16 @@ var StandardLink = class {
121977
121977
  /**
121978
121978
  * @throws ORPCError, transport-level errors (network failures, timeouts, etc.)
121979
121979
  */
121980
- call(path54, input2, options) {
121981
- return runWithSpan(`${ORPC_NAME}.${path54.join("/")}`, (span) => {
121980
+ call(path56, input2, options) {
121981
+ return runWithSpan(`${ORPC_NAME}.${path56.join("/")}`, (span) => {
121982
121982
  span?.setAttribute("rpc.system", ORPC_NAME);
121983
- span?.setAttribute("rpc.method", path54.join("."));
121983
+ span?.setAttribute("rpc.method", path56.join("."));
121984
121984
  if (getTracer() && isAsyncIteratorObject(input2)) {
121985
121985
  input2 = override(input2, traceAsyncIterator("consume_async_iterator_object_input", input2));
121986
121986
  } else if (getTracer() && input2 instanceof ReadableStream) {
121987
121987
  input2 = override(input2, traceReadableStream("consume_octet_stream_input", input2));
121988
121988
  }
121989
- return intercept(this.interceptors, { ...options, path: path54, input: input2 }, async ({ path: path210, input: input22, ...options2 }) => {
121989
+ return intercept(this.interceptors, { ...options, path: path56, input: input2 }, async ({ path: path210, input: input22, ...options2 }) => {
121990
121990
  const tracer = getTracer();
121991
121991
  const activeSpan = tracer?.getActiveSpan() ?? span;
121992
121992
  let request7 = await runWithSpan(
@@ -122043,18 +122043,18 @@ var RPCLinkCodec = class {
122043
122043
  this.headers = options.headers ?? {};
122044
122044
  this.serializer = options.serializer ?? new RPCSerializer();
122045
122045
  }
122046
- async encodeInput(input2, path54, options) {
122047
- let headers = toResolvedStandardHeaders(await value(this.headers, options, path54, input2));
122046
+ async encodeInput(input2, path56, options) {
122047
+ let headers = toResolvedStandardHeaders(await value(this.headers, options, path56, input2));
122048
122048
  if (options.lastEventId !== void 0) {
122049
122049
  headers = mergeStandardHeaders(headers, { "last-event-id": options.lastEventId });
122050
122050
  }
122051
- const expectedMethod = await value(this.expectedMethod, options, path54, input2);
122052
- const baseUrl = await value(this.baseUrl, options, path54, input2);
122051
+ const expectedMethod = await value(this.expectedMethod, options, path56, input2);
122052
+ const baseUrl = await value(this.baseUrl, options, path56, input2);
122053
122053
  const [pathname, search, hash2] = parseStandardUrl(baseUrl);
122054
- const newPathname = `${pathname.replace(END_SLASH_REGEX, "")}${pathToHttpPath(path54)}`;
122054
+ const newPathname = `${pathname.replace(END_SLASH_REGEX, "")}${pathToHttpPath(path56)}`;
122055
122055
  const serialized = this.serializer.serialize(input2);
122056
122056
  if (expectedMethod === "GET" && !(serialized instanceof Blob) && !(serialized instanceof ReadableStream) && !(serialized instanceof FormData) && !isAsyncIteratorObject(serialized)) {
122057
- const maxUrlLength = await value(this.maxUrlLength, options, path54, input2);
122057
+ const maxUrlLength = await value(this.maxUrlLength, options, path56, input2);
122058
122058
  const mergedSearch = new URLSearchParams(search);
122059
122059
  mergedSearch.append("data", stringifyJSON(serialized) ?? "");
122060
122060
  const url22 = `${newPathname}?${mergedSearch}${hash2 ?? ""}`;
@@ -122139,8 +122139,8 @@ var FetchLinkTransport = class {
122139
122139
  this.fetch = options.fetch ?? ((url2, init) => globalThis.fetch(url2, init));
122140
122140
  this.toFetchRequestOptions = options.toFetchRequest;
122141
122141
  }
122142
- async send(standardRequest, path54, options) {
122143
- let origin = await value(this.origin, options, path54);
122142
+ async send(standardRequest, path56, options) {
122143
+ let origin = await value(this.origin, options, path56);
122144
122144
  if (origin?.endsWith("/")) {
122145
122145
  origin = origin.slice(0, -1);
122146
122146
  }
@@ -122160,7 +122160,7 @@ var FetchLinkTransport = class {
122160
122160
  }
122161
122161
  }
122162
122162
  const fetch3 = this.fetch;
122163
- const response = await fetch3(url2, init, options, path54);
122163
+ const response = await fetch3(url2, init, options, path56);
122164
122164
  const standardResponse = toStandardLazyResponse(response);
122165
122165
  return standardResponse;
122166
122166
  }
@@ -122551,14 +122551,14 @@ var StandardHandler = class {
122551
122551
  span?.setAttribute("url.path", request22.url);
122552
122552
  return { matched: false };
122553
122553
  }
122554
- const { path: path54, procedure, decodeInput } = matchedOrNot;
122555
- span?.updateName(`${ORPC_NAME}.${path54.join("/")}`);
122554
+ const { path: path56, procedure, decodeInput } = matchedOrNot;
122555
+ span?.updateName(`${ORPC_NAME}.${path56.join("/")}`);
122556
122556
  span?.setAttribute("rpc.system", ORPC_NAME);
122557
- span?.setAttribute("rpc.method", path54.join("."));
122557
+ span?.setAttribute("rpc.method", path56.join("."));
122558
122558
  try {
122559
122559
  const response = await intercept(
122560
122560
  this.interceptors,
122561
- { context: context2, prefix: prefix2, request: request22, path: path54, procedure, decodeInput },
122561
+ { context: context2, prefix: prefix2, request: request22, path: path56, procedure, decodeInput },
122562
122562
  async ({ context: context3, prefix: prefix3, request: request32, path: path210, procedure: procedure2, decodeInput: decodeInput2 }) => {
122563
122563
  step2 = "decode_input";
122564
122564
  let input2 = await runWithSpan("decode_input", decodeInput2);
@@ -122592,7 +122592,7 @@ var StandardHandler = class {
122592
122592
  message: `Malformed request. Ensure the request body is properly formatted and the 'Content-Type' header is set correctly.`,
122593
122593
  cause: e14
122594
122594
  }) : toORPCError(e14);
122595
- const response = await this.codec.encodeError(error63, procedure, path54, { context: context2, prefix: prefix2 });
122595
+ const response = await this.codec.encodeError(error63, procedure, path56, { context: context2, prefix: prefix2 });
122596
122596
  return { matched: true, response };
122597
122597
  }
122598
122598
  }
@@ -122698,7 +122698,7 @@ var RPCMatcher = class {
122698
122698
  this.rootRouter = router;
122699
122699
  this.index(router);
122700
122700
  }
122701
- index(router, path54 = []) {
122701
+ index(router, path56 = []) {
122702
122702
  const lazyResults = walkProcedureContractsSync(router, (procedure, procedurePath) => {
122703
122703
  if (!value(this.filter, procedure, procedurePath)) {
122704
122704
  return;
@@ -122709,7 +122709,7 @@ var RPCMatcher = class {
122709
122709
  // contract-first entries have no implementation yet, resolveProcedure fills it in on demand
122710
122710
  procedure: procedure instanceof Procedure ? procedure : void 0
122711
122711
  });
122712
- }, path54);
122712
+ }, path56);
122713
122713
  for (const result of lazyResults) {
122714
122714
  this.pendingLazyRouters.set(pathToHttpPath(result.path), result);
122715
122715
  }
@@ -122841,10 +122841,10 @@ var RPCHandlerCodec = class {
122841
122841
  }
122842
122842
  };
122843
122843
  }
122844
- encodeOutput(output2, procedure, path54, options) {
122844
+ encodeOutput(output2, procedure, path56, options) {
122845
122845
  return {
122846
122846
  headers: {},
122847
- status: value(this.outputStatus, output2, procedure, path54, options) ?? DEFAULT_SUCCESS_STATUS,
122847
+ status: value(this.outputStatus, output2, procedure, path56, options) ?? DEFAULT_SUCCESS_STATUS,
122848
122848
  body: this.serializer.serialize(output2)
122849
122849
  };
122850
122850
  }
@@ -122898,39 +122898,39 @@ function createRouter() {
122898
122898
  static: new NullProtoObj2()
122899
122899
  };
122900
122900
  }
122901
- function scanFirstGroup(path54) {
122901
+ function scanFirstGroup(path56) {
122902
122902
  let i10 = 0;
122903
122903
  let depth = 0;
122904
- for (; i10 < path54.length; i10++) {
122905
- const c10 = path54.charCodeAt(i10);
122904
+ for (; i10 < path56.length; i10++) {
122905
+ const c10 = path56.charCodeAt(i10);
122906
122906
  if (c10 === 92) i10++;
122907
122907
  else if (c10 === 40) depth++;
122908
122908
  else if (c10 === 41 && depth > 0) depth--;
122909
122909
  else if (c10 === 123 && depth === 0) break;
122910
122910
  }
122911
- if (i10 >= path54.length) return;
122911
+ if (i10 >= path56.length) return;
122912
122912
  let j10 = i10 + 1;
122913
122913
  depth = 0;
122914
- for (; j10 < path54.length; j10++) {
122915
- const c10 = path54.charCodeAt(j10);
122914
+ for (; j10 < path56.length; j10++) {
122915
+ const c10 = path56.charCodeAt(j10);
122916
122916
  if (c10 === 92) j10++;
122917
122917
  else if (c10 === 40) depth++;
122918
122918
  else if (c10 === 41 && depth > 0) depth--;
122919
122919
  else if (c10 === 125 && depth === 0) break;
122920
122920
  }
122921
- if (j10 >= path54.length) return;
122922
- const mod = path54[j10 + 1];
122921
+ if (j10 >= path56.length) return;
122922
+ const mod = path56[j10 + 1];
122923
122923
  const hasMod = mod === "?" || mod === "+" || mod === "*";
122924
122924
  return [
122925
- path54.slice(0, i10),
122926
- path54.slice(i10 + 1, j10),
122927
- path54.slice(j10 + (hasMod ? 2 : 1)),
122925
+ path56.slice(0, i10),
122926
+ path56.slice(i10 + 1, j10),
122927
+ path56.slice(j10 + (hasMod ? 2 : 1)),
122928
122928
  hasMod ? mod : void 0
122929
122929
  ];
122930
122930
  }
122931
- function expandGroupDelimiters(path54) {
122932
- if (!path54.includes("{")) return;
122933
- const group = scanFirstGroup(path54);
122931
+ function expandGroupDelimiters(path56) {
122932
+ if (!path56.includes("{")) return;
122933
+ const group = scanFirstGroup(path56);
122934
122934
  if (!group) return;
122935
122935
  const [pre2, body, suf, mod] = group;
122936
122936
  if (!mod) return [pre2 + body + suf];
@@ -123000,9 +123000,9 @@ function replaceSegmentWildcards(segment, unnamedStart, toGroupKey = toUnnamedGr
123000
123000
  }
123001
123001
  return [replaced, nextIndex];
123002
123002
  }
123003
- function encodeEscapes(path54) {
123004
- if (!path54.includes("\\")) return path54;
123005
- return path54.replace(/\\([:(){}])/g, (_, c10) => "\uFFFD" + "ABCDE"[":(){}".indexOf(c10)]);
123003
+ function encodeEscapes(path56) {
123004
+ if (!path56.includes("\\")) return path56;
123005
+ return path56.replace(/\\([:(){}])/g, (_, c10) => "\uFFFD" + "ABCDE"[":(){}".indexOf(c10)]);
123006
123006
  }
123007
123007
  function segmentKey(segment) {
123008
123008
  if (segment.startsWith("**")) return 2;
@@ -123031,22 +123031,22 @@ function expandModifiers(segments) {
123031
123031
  return m10[2] === "+" ? [wc2] : [wc2, without];
123032
123032
  }
123033
123033
  }
123034
- function normalizePath(path54) {
123035
- if (!path54.includes("/.")) return path54;
123034
+ function normalizePath(path56) {
123035
+ if (!path56.includes("/.")) return path56;
123036
123036
  const r10 = [];
123037
- for (const s of path54.split("/")) if (s === ".") continue;
123037
+ for (const s of path56.split("/")) if (s === ".") continue;
123038
123038
  else if (s === ".." && r10.length > 1) r10.pop();
123039
123039
  else r10.push(s);
123040
123040
  return r10.join("/") || "/";
123041
123041
  }
123042
- function splitPath(path54) {
123043
- const s = path54.split("/");
123042
+ function splitPath(path56) {
123043
+ const s = path56.split("/");
123044
123044
  s.shift();
123045
123045
  if (s[s.length - 1] === "") s.pop();
123046
123046
  return s;
123047
123047
  }
123048
- function splitRoute(path54) {
123049
- const s = splitPath(path54);
123048
+ function splitRoute(path56) {
123049
+ const s = splitPath(path56);
123050
123050
  while (s[s.length - 1] === "") s.pop();
123051
123051
  return s;
123052
123052
  }
@@ -123062,16 +123062,16 @@ function getMatchParams(segments, paramsMap) {
123062
123062
  }
123063
123063
  return params;
123064
123064
  }
123065
- function addRoute(ctx, method = "", path54, data) {
123065
+ function addRoute(ctx, method = "", path56, data) {
123066
123066
  method = method.toUpperCase();
123067
- if (path54.charCodeAt(0) !== 47) path54 = `/${path54}`;
123068
- const groupExpanded = expandGroupDelimiters(path54);
123067
+ if (path56.charCodeAt(0) !== 47) path56 = `/${path56}`;
123068
+ const groupExpanded = expandGroupDelimiters(path56);
123069
123069
  if (groupExpanded) {
123070
123070
  for (const expandedPath of groupExpanded) addRoute(ctx, method, expandedPath, data);
123071
123071
  return;
123072
123072
  }
123073
- path54 = encodeEscapes(path54);
123074
- const segments = splitRoute(path54);
123073
+ path56 = encodeEscapes(path56);
123074
+ const segments = splitRoute(path56);
123075
123075
  const expanded = expandModifiers(segments);
123076
123076
  if (expanded) {
123077
123077
  for (const p of expanded) addRoute(ctx, method, p, data);
@@ -123162,15 +123162,15 @@ function getParamRegexp(segment, unnamedStart = 0) {
123162
123162
  const regex = _s2.replace(/:([\w-]+)(?:\(([^)]*)\))?/g, (_, id2, p) => `(?<${toGroupName(id2)}>${p || "[^/]+"})`).replace(/\((?![?<])/g, () => `(?<${toUnnamedGroupKey(_i2++)}>`).replace(/\uFFFE(.)/g, (_, c10) => /[.*+?^${}()|[\]\\]/.test(c10) ? `\\${c10}` : c10);
123163
123163
  return [new RegExp(`^${regex}$`), _i2];
123164
123164
  }
123165
- function findRoute(ctx, method = "", path54, opts) {
123166
- if (opts?.normalize) path54 = normalizePath(path54);
123167
- if (path54.charCodeAt(path54.length - 1) === 47) path54 = path54.slice(0, -1);
123168
- const staticNode = ctx.static[path54];
123165
+ function findRoute(ctx, method = "", path56, opts) {
123166
+ if (opts?.normalize) path56 = normalizePath(path56);
123167
+ if (path56.charCodeAt(path56.length - 1) === 47) path56 = path56.slice(0, -1);
123168
+ const staticNode = ctx.static[path56];
123169
123169
  if (staticNode && staticNode.methods) {
123170
123170
  const staticMatch = staticNode.methods[method] || staticNode.methods[""];
123171
123171
  if (staticMatch !== void 0) return staticMatch[0];
123172
123172
  }
123173
- const segments = splitPath(path54);
123173
+ const segments = splitPath(path56);
123174
123174
  const match = _lookupTree(ctx.root, method, segments, 0);
123175
123175
  if (match === void 0) return;
123176
123176
  if (opts?.params === false) return match;
@@ -123370,7 +123370,7 @@ var OpenAPIMatcher = class {
123370
123370
  this.rootRouter = router;
123371
123371
  this.index(router);
123372
123372
  }
123373
- index(router, path54 = []) {
123373
+ index(router, path56 = []) {
123374
123374
  const lazyResults = walkProcedureContractsSync(router, (contract, path210) => {
123375
123375
  if (!value(this.filter, contract, path210)) {
123376
123376
  return;
@@ -123385,7 +123385,7 @@ var OpenAPIMatcher = class {
123385
123385
  contract,
123386
123386
  procedure: contract instanceof Procedure ? contract : void 0
123387
123387
  });
123388
- }, path54);
123388
+ }, path56);
123389
123389
  for (const result of lazyResults) {
123390
123390
  const prefix = getOpenAPIMeta(result.router)?.prefix;
123391
123391
  this.pendingLazyRouters.add({
@@ -123472,20 +123472,20 @@ var OpenAPIMatcher = class {
123472
123472
  return entry.procedure;
123473
123473
  }
123474
123474
  };
123475
- function toRou3Pattern(path54) {
123476
- const params = getDynamicPathParams(path54);
123475
+ function toRou3Pattern(path56) {
123476
+ const params = getDynamicPathParams(path56);
123477
123477
  if (!params?.length) {
123478
- return path54;
123478
+ return path56;
123479
123479
  }
123480
123480
  for (let i10 = params.length - 1; i10 >= 0; i10--) {
123481
123481
  const param = params[i10];
123482
123482
  const pattern = param.allowsSlash ? `**:${param.parameterName}` : `:${param.parameterName}`;
123483
- path54 = path54.slice(0, param.startIndex) + pattern + path54.slice(param.startIndex + param.segment.length);
123483
+ path56 = path56.slice(0, param.startIndex) + pattern + path56.slice(param.startIndex + param.segment.length);
123484
123484
  }
123485
- return path54;
123485
+ return path56;
123486
123486
  }
123487
- function toRou3PrefixMatcher(path54) {
123488
- const pattern = toRou3Pattern(path54);
123487
+ function toRou3PrefixMatcher(path56) {
123488
+ const pattern = toRou3Pattern(path56);
123489
123489
  return routeToRegExp(pattern === "/" ? "/**" : `${pattern}/**`);
123490
123490
  }
123491
123491
  function decodeParams(params) {
@@ -123564,7 +123564,7 @@ var OpenAPIHandlerCodecCore = class {
123564
123564
  /**
123565
123565
  * @throws {TypeError} If `outputStructure` is "detailed" and the output doesn't match the expected structure.
123566
123566
  */
123567
- encodeOutput(output2, procedure, path54) {
123567
+ encodeOutput(output2, procedure, path56) {
123568
123568
  const meta3 = getOpenAPIMeta(procedure);
123569
123569
  const successStatus = meta3?.successStatus ?? DEFAULT_SUCCESS_STATUS;
123570
123570
  const outputStructure = meta3?.outputStructure ?? DEFAULT_OPENAPI_OUTPUT_STRUCTURE;
@@ -123577,7 +123577,7 @@ var OpenAPIHandlerCodecCore = class {
123577
123577
  }
123578
123578
  if (!isValidDetailedOutput(output2)) {
123579
123579
  throw new TypeError(`
123580
- Invalid "detailed" output structure returned by procedure (${path54.join(".")}):
123580
+ Invalid "detailed" output structure returned by procedure (${path56.join(".")}):
123581
123581
  \u2022 Expected an object with optional properties:
123582
123582
  - status (number <400)
123583
123583
  - headers (object)
@@ -124129,7 +124129,7 @@ function profileValue(name, paths) {
124129
124129
  function createConfigApiRouter(deps) {
124130
124130
  const authed = doorApiAuth(deps.expectedToken);
124131
124131
  const { paths } = deps;
124132
- const route = (path54, summary) => authed.meta(openapi({ method: "POST", path: path54, summary, tags: [CONFIG_API_TAG] }));
124132
+ const route = (path56, summary) => authed.meta(openapi({ method: "POST", path: path56, summary, tags: [CONFIG_API_TAG] }));
124133
124133
  return {
124134
124134
  config: {
124135
124135
  identity: {
@@ -125991,8 +125991,8 @@ function createCodexRouteMount(ports, upstreamBase, provider) {
125991
125991
  request7.body.resume();
125992
125992
  return;
125993
125993
  }
125994
- const path54 = new URL(request7.url, "http://127.0.0.1").pathname;
125995
- const translated = { method: request7.method, path: path54, body, signal: request7.signal };
125994
+ const path56 = new URL(request7.url, "http://127.0.0.1").pathname;
125995
+ const translated = { method: request7.method, path: path56, body, signal: request7.signal };
125996
125996
  const routed = await route(translated);
125997
125997
  if (request7.signal.aborted) {
125998
125998
  return;
@@ -126026,7 +126026,7 @@ function createPassthroughRoute(name, target) {
126026
126026
  headroomUpstream: target.headroomUpstream,
126027
126027
  serve: async (request7, response) => {
126028
126028
  const incoming = new URL(request7.url, "http://127.0.0.1");
126029
- const path54 = target.stripPrefix !== void 0 && incoming.pathname.startsWith(target.stripPrefix) ? incoming.pathname.slice(target.stripPrefix.length) : incoming.pathname;
126029
+ const path56 = target.stripPrefix !== void 0 && incoming.pathname.startsWith(target.stripPrefix) ? incoming.pathname.slice(target.stripPrefix.length) : incoming.pathname;
126030
126030
  const headers = forwardableHeaders(request7.headers);
126031
126031
  delete headers.host;
126032
126032
  await new Promise((resolve2) => {
@@ -126034,7 +126034,7 @@ function createPassthroughRoute(name, target) {
126034
126034
  host: base.hostname,
126035
126035
  port: base.port === "" ? void 0 : Number(base.port),
126036
126036
  method: request7.method,
126037
- path: `${basePath}${path54}${incoming.search}`,
126037
+ path: `${basePath}${path56}${incoming.search}`,
126038
126038
  headers,
126039
126039
  agent
126040
126040
  };
@@ -126167,7 +126167,7 @@ async function scanRequestHead(request7, wholeBody = false) {
126167
126167
 
126168
126168
  // src/frontdoor/providerRoute.ts
126169
126169
  function createProviderRouteResolver(deps) {
126170
- const isRcSelfHostPath = (path54) => path54 === "/v1/code/sessions" || path54.startsWith("/v1/code/sessions/") || path54 === "/v1/sessions" || path54.startsWith("/v1/sessions/");
126170
+ const isRcSelfHostPath = (path56) => path56 === "/v1/code/sessions" || path56.startsWith("/v1/code/sessions/") || path56 === "/v1/sessions" || path56.startsWith("/v1/sessions/");
126171
126171
  const oauthRoute = createPassthroughRoute("anthropic", { baseUrl: `https://${CONNECT_INTERCEPT_HOST}:${String(HTTPS_PORT)}`, stripPrefix: void 0, headroomUpstream: void 0 });
126172
126172
  const passthroughByTarget = /* @__PURE__ */ new Map();
126173
126173
  const passthroughFor = (name, target) => {
@@ -126181,16 +126181,16 @@ function createProviderRouteResolver(deps) {
126181
126181
  return route;
126182
126182
  };
126183
126183
  const resolve2 = (request7) => {
126184
- const path54 = new URL(request7.url, "http://127.0.0.1").pathname;
126185
- const scoped = parseProviderPath(path54);
126184
+ const path56 = new URL(request7.url, "http://127.0.0.1").pathname;
126185
+ const scoped = parseProviderPath(path56);
126186
126186
  if (scoped === void 0) {
126187
- if (deps.rcSelfHostRoute !== void 0 && isRcSelfHostPath(path54)) {
126187
+ if (deps.rcSelfHostRoute !== void 0 && isRcSelfHostPath(path56)) {
126188
126188
  return { ok: true, route: deps.rcSelfHostRoute };
126189
126189
  }
126190
- if (request7.session.provider !== void 0 && path54.startsWith("/v1/") && !isRcSelfHostPath(path54)) {
126190
+ if (request7.session.provider !== void 0 && path56.startsWith("/v1/") && !isRcSelfHostPath(path56)) {
126191
126191
  return resolve2({ ...request7, url: `${PROVIDER_PATH_PREFIX}${encodeURIComponent(request7.session.provider)}${request7.url}` });
126192
126192
  }
126193
- return path54.startsWith("/v1/") ? { ok: true, route: oauthRoute } : { ok: false, status: HTTP_STATUS.notFound, message: `no such endpoint: ${path54}` };
126193
+ return path56.startsWith("/v1/") ? { ok: true, route: oauthRoute } : { ok: false, status: HTTP_STATUS.notFound, message: `no such endpoint: ${path56}` };
126194
126194
  }
126195
126195
  const { provider } = scoped;
126196
126196
  let definition;
@@ -126243,8 +126243,8 @@ function createProviderRouteResolver(deps) {
126243
126243
  let replay;
126244
126244
  const visited = /* @__PURE__ */ new Set();
126245
126245
  for (; ; ) {
126246
- const path54 = new URL(current.url, "http://127.0.0.1").pathname;
126247
- const scoped = parseProviderPath(path54);
126246
+ const path56 = new URL(current.url, "http://127.0.0.1").pathname;
126247
+ const scoped = parseProviderPath(path56);
126248
126248
  const providerName = scoped?.provider ?? current.session.provider;
126249
126249
  if (providerName !== void 0 && visited.has(providerName)) {
126250
126250
  return { ok: false, status: HTTP_STATUS.internalServerError, message: `provider routing cycle: ${[...visited, providerName].join(" -> ")}` };
@@ -126302,7 +126302,7 @@ function createProviderRouteResolver(deps) {
126302
126302
  const headers = Object.fromEntries(Object.entries(replay.headers).filter(([name]) => name.toLowerCase() !== "content-length"));
126303
126303
  replay = { ...replay, headers, body: import_node_stream3.Readable.from([Buffer.from(rewritten, "utf8")]) };
126304
126304
  }
126305
- const rest = scoped === void 0 ? path54 : path54.slice(`${PROVIDER_PATH_PREFIX}${encodeURIComponent(scoped.provider)}`.length);
126305
+ const rest = scoped === void 0 ? path56 : path56.slice(`${PROVIDER_PATH_PREFIX}${encodeURIComponent(scoped.provider)}`.length);
126306
126306
  const query = current.url.includes("?") ? current.url.slice(current.url.indexOf("?")) : "";
126307
126307
  current = { ...current, url: `${PROVIDER_PATH_PREFIX}${encodeURIComponent(matched.provider)}${rest}${query}`, body: replay.body, headers: replay.headers };
126308
126308
  }
@@ -131595,8 +131595,8 @@ function getErrorMap2() {
131595
131595
 
131596
131596
  // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v3/helpers/parseUtil.js
131597
131597
  var makeIssue = (params) => {
131598
- const { data, path: path54, errorMaps, issueData } = params;
131599
- const fullPath = [...path54, ...issueData.path || []];
131598
+ const { data, path: path56, errorMaps, issueData } = params;
131599
+ const fullPath = [...path56, ...issueData.path || []];
131600
131600
  const fullIssue = {
131601
131601
  ...issueData,
131602
131602
  path: fullPath
@@ -131711,11 +131711,11 @@ var errorUtil;
131711
131711
 
131712
131712
  // node_modules/.pnpm/zod@4.6.5/node_modules/zod/v3/types.js
131713
131713
  var ParseInputLazyPath = class {
131714
- constructor(parent, value2, path54, key) {
131714
+ constructor(parent, value2, path56, key) {
131715
131715
  this._cachedPath = [];
131716
131716
  this.parent = parent;
131717
131717
  this.data = value2;
131718
- this._path = path54;
131718
+ this._path = path56;
131719
131719
  this._key = key;
131720
131720
  }
131721
131721
  get path() {
@@ -135278,11 +135278,11 @@ function normalizeObjectSchema(schema) {
135278
135278
  }
135279
135279
  return void 0;
135280
135280
  }
135281
- function getDotPath(path54) {
135282
- if (path54.length === 0) {
135281
+ function getDotPath(path56) {
135282
+ if (path56.length === 0) {
135283
135283
  return "object root";
135284
135284
  }
135285
- return path54.reduce((acc, seg, index) => {
135285
+ return path56.reduce((acc, seg, index) => {
135286
135286
  if (index === 0) {
135287
135287
  return String(seg);
135288
135288
  }
@@ -140647,8 +140647,549 @@ function registerRunCommand(program2, handler) {
140647
140647
  });
140648
140648
  }
140649
140649
 
140650
- // src/usage/commands.ts
140650
+ // src/agents/commands.ts
140651
+ var import_node_fs20 = __toESM(require("node:fs"), 1);
140652
+ var import_node_path53 = __toESM(require("node:path"), 1);
140653
+ init_commandDeps();
140654
+ init_cliError();
140655
+ init_realPorts();
140656
+
140657
+ // src/agents/read.ts
140651
140658
  var import_node_path52 = __toESM(require("node:path"), 1);
140659
+ init_zod();
140660
+
140661
+ // src/agents/schema.ts
140662
+ init_zod();
140663
+ var AgentMetaSchema = external_exports.looseObject({
140664
+ agentType: external_exports.string(),
140665
+ isFork: external_exports.boolean().optional(),
140666
+ description: external_exports.string().optional(),
140667
+ name: external_exports.string().optional(),
140668
+ toolUseId: external_exports.string().optional(),
140669
+ spawnDepth: external_exports.number().int().nonnegative().optional(),
140670
+ parentAgentId: external_exports.string().optional(),
140671
+ model: external_exports.string().optional(),
140672
+ requestShape: external_exports.string().optional(),
140673
+ requestNonInteractive: external_exports.boolean().optional(),
140674
+ workflowPhase: external_exports.string().optional(),
140675
+ taskKind: external_exports.string().optional(),
140676
+ teamName: external_exports.string().optional(),
140677
+ worktreePath: external_exports.string().optional(),
140678
+ worktreeBranch: external_exports.string().optional(),
140679
+ stoppedByUser: external_exports.boolean().optional()
140680
+ });
140681
+ var AgentKindSchema = external_exports.enum(["subagent", "fork", "workflow-agent", "teammate"]);
140682
+ var AgentNodeSchema = external_exports.lazy(
140683
+ () => external_exports.strictObject({
140684
+ id: external_exports.string(),
140685
+ kind: AgentKindSchema,
140686
+ agentType: external_exports.string(),
140687
+ description: external_exports.string().optional(),
140688
+ name: external_exports.string().optional(),
140689
+ toolUseId: external_exports.string().optional(),
140690
+ spawnDepth: external_exports.number().int().nonnegative().optional(),
140691
+ model: external_exports.string().optional(),
140692
+ background: external_exports.boolean().optional(),
140693
+ workflowRunId: external_exports.string().optional(),
140694
+ workflowPhase: external_exports.string().optional(),
140695
+ teamName: external_exports.string().optional(),
140696
+ stoppedByUser: external_exports.boolean().optional(),
140697
+ transcript: external_exports.string(),
140698
+ children: external_exports.array(AgentNodeSchema)
140699
+ })
140700
+ );
140701
+ var TaskItemSchema = external_exports.strictObject({
140702
+ id: external_exports.string(),
140703
+ subject: external_exports.string(),
140704
+ description: external_exports.string().optional(),
140705
+ status: external_exports.string(),
140706
+ /** What a spinner shows while the task runs. */
140707
+ activeForm: external_exports.string().optional(),
140708
+ /** The teammate or agent name the task is assigned to, as Agent Teams writes it. */
140709
+ owner: external_exports.string().optional(),
140710
+ /** Free-form data the harness attaches to a task, kept as written. */
140711
+ metadata: external_exports.record(external_exports.string(), external_exports.unknown()).optional(),
140712
+ blocks: external_exports.array(external_exports.string()),
140713
+ blockedBy: external_exports.array(external_exports.string()),
140714
+ /** The id of the shared task list this task belongs to (a team's name, or a custom list id), absent for the session's own list. */
140715
+ taskList: external_exports.string().optional()
140716
+ });
140717
+ var WorkflowRunSchema = external_exports.strictObject({
140718
+ runId: external_exports.string(),
140719
+ workflowName: external_exports.string().optional(),
140720
+ status: external_exports.string().optional(),
140721
+ startTime: external_exports.number().optional(),
140722
+ phases: external_exports.array(external_exports.string()),
140723
+ summary: external_exports.string().optional()
140724
+ });
140725
+ var AgentTreeProblemSchema = external_exports.strictObject({
140726
+ /** Relative to the identity's configuration directory. */
140727
+ path: external_exports.string(),
140728
+ reason: external_exports.string()
140729
+ });
140730
+ var SessionAgentTreeSchema = external_exports.strictObject({
140731
+ project: external_exports.string(),
140732
+ sessionId: external_exports.string(),
140733
+ /** True for a session directory a resume superseded (`<session-id>.superseded-<epoch-ms>`). */
140734
+ superseded: external_exports.boolean(),
140735
+ /** The agents the session itself spawned, each with its descendants. */
140736
+ agents: external_exports.array(AgentNodeSchema),
140737
+ tasks: external_exports.array(TaskItemSchema),
140738
+ workflowRuns: external_exports.array(WorkflowRunSchema),
140739
+ problems: external_exports.array(AgentTreeProblemSchema)
140740
+ });
140741
+
140742
+ // src/agents/read.ts
140743
+ var PROJECTS_DIR = "projects";
140744
+ var TASKS_DIR = "tasks";
140745
+ var SUBAGENTS_DIR = "subagents";
140746
+ var WORKFLOWS_DIR = "workflows";
140747
+ var AGENT_FILE_PREFIX = "agent-";
140748
+ var META_SUFFIX = ".meta.json";
140749
+ var TRANSCRIPT_SUFFIX = ".jsonl";
140750
+ var SHORT_SESSION_ID_LENGTH = 8;
140751
+ var SHORT_SESSION_LIST_PREFIX = "session-";
140752
+ var JSON_SUFFIX = ".json";
140753
+ var WORKFLOW_RUN_PREFIX = "wf_";
140754
+ var ARCHIVED_RE = /^(.+)\.(?:superseded|orphaned)-.+$/;
140755
+ var FORK_AGENT_TYPE = "fork";
140756
+ var WORKFLOW_AGENT_TYPE = "workflow-subagent";
140757
+ var TEAMMATE_TASK_KIND = "in_process_teammate";
140758
+ var BACKGROUND_REQUEST_SHAPE = "background";
140759
+ var SESSION_SPAWN_DEPTH = 1;
140760
+ function parseEntry2(project, entry) {
140761
+ const match = ARCHIVED_RE.exec(entry);
140762
+ const base = match?.[1];
140763
+ return base === void 0 ? { project, sessionId: entry, superseded: false, entry } : { project, sessionId: base, superseded: true, entry };
140764
+ }
140765
+ function listSessions2(fs22, configDir) {
140766
+ const found = [];
140767
+ for (const project of fs22.readdir(import_node_path52.default.join(configDir, PROJECTS_DIR))) {
140768
+ const projectDir = import_node_path52.default.join(configDir, PROJECTS_DIR, project);
140769
+ const entries = /* @__PURE__ */ new Set();
140770
+ for (const name of fs22.readdir(projectDir)) {
140771
+ if (name.endsWith(TRANSCRIPT_SUFFIX)) {
140772
+ entries.add(name.slice(0, -TRANSCRIPT_SUFFIX.length));
140773
+ continue;
140774
+ }
140775
+ const children = fs22.readdir(import_node_path52.default.join(projectDir, name));
140776
+ if (children.includes(SUBAGENTS_DIR) || children.includes(WORKFLOWS_DIR)) {
140777
+ entries.add(name);
140778
+ }
140779
+ }
140780
+ for (const entry of entries) {
140781
+ found.push(parseEntry2(project, entry));
140782
+ }
140783
+ }
140784
+ return found.sort((left, right) => left.project.localeCompare(right.project) || left.entry.localeCompare(right.entry));
140785
+ }
140786
+ function locateAgents(fs22, configDir, relativeDir, workflowRunId, report) {
140787
+ const located = [];
140788
+ for (const name of listDirOrReport(fs22, configDir, relativeDir, report)) {
140789
+ if (!name.startsWith(AGENT_FILE_PREFIX) || !name.endsWith(META_SUFFIX)) {
140790
+ continue;
140791
+ }
140792
+ const id2 = name.slice(AGENT_FILE_PREFIX.length, -META_SUFFIX.length);
140793
+ located.push({
140794
+ id: id2,
140795
+ metaPath: import_node_path52.default.join(relativeDir, name),
140796
+ transcriptPath: import_node_path52.default.join(relativeDir, `${AGENT_FILE_PREFIX}${id2}${TRANSCRIPT_SUFFIX}`),
140797
+ workflowRunId
140798
+ });
140799
+ }
140800
+ return located;
140801
+ }
140802
+ function kindOf(meta3, workflowRunId) {
140803
+ if (meta3.isFork === true || meta3.agentType === FORK_AGENT_TYPE) {
140804
+ return "fork";
140805
+ }
140806
+ if (workflowRunId !== void 0 || meta3.agentType === WORKFLOW_AGENT_TYPE) {
140807
+ return "workflow-agent";
140808
+ }
140809
+ if (meta3.taskKind === TEAMMATE_TASK_KIND || meta3.teamName !== void 0) {
140810
+ return "teammate";
140811
+ }
140812
+ return "subagent";
140813
+ }
140814
+ function toNode(read, children) {
140815
+ const { located, meta: meta3 } = read;
140816
+ return {
140817
+ id: located.id,
140818
+ kind: kindOf(meta3, located.workflowRunId),
140819
+ agentType: meta3.agentType,
140820
+ ...meta3.description === void 0 ? {} : { description: meta3.description },
140821
+ ...meta3.name === void 0 ? {} : { name: meta3.name },
140822
+ ...meta3.toolUseId === void 0 ? {} : { toolUseId: meta3.toolUseId },
140823
+ ...meta3.spawnDepth === void 0 ? {} : { spawnDepth: meta3.spawnDepth },
140824
+ ...meta3.model === void 0 ? {} : { model: meta3.model },
140825
+ ...meta3.requestShape === void 0 ? {} : { background: meta3.requestShape === BACKGROUND_REQUEST_SHAPE },
140826
+ ...located.workflowRunId === void 0 ? {} : { workflowRunId: located.workflowRunId },
140827
+ ...meta3.workflowPhase === void 0 ? {} : { workflowPhase: meta3.workflowPhase },
140828
+ ...meta3.teamName === void 0 ? {} : { teamName: meta3.teamName },
140829
+ ...meta3.stoppedByUser === void 0 ? {} : { stoppedByUser: meta3.stoppedByUser },
140830
+ transcript: located.transcriptPath,
140831
+ children
140832
+ };
140833
+ }
140834
+ function describeFailure(error63) {
140835
+ return error63 instanceof Error ? error63.message : String(error63);
140836
+ }
140837
+ function readFileOrReport(fs22, configDir, relative, report) {
140838
+ try {
140839
+ return fs22.readFileUtf8(import_node_path52.default.join(configDir, relative));
140840
+ } catch (error63) {
140841
+ report({ path: relative, reason: `could not be read: ${describeFailure(error63)}` });
140842
+ return void 0;
140843
+ }
140844
+ }
140845
+ function listDirOrReport(fs22, configDir, relative, report) {
140846
+ try {
140847
+ return fs22.readdir(import_node_path52.default.join(configDir, relative));
140848
+ } catch (error63) {
140849
+ report({ path: relative, reason: `could not be listed: ${describeFailure(error63)}` });
140850
+ return [];
140851
+ }
140852
+ }
140853
+ function parseJson4(text2) {
140854
+ try {
140855
+ const value2 = JSON.parse(text2);
140856
+ return value2;
140857
+ } catch {
140858
+ return void 0;
140859
+ }
140860
+ }
140861
+ var TaskFileSchema = external_exports.object({ ...TaskItemSchema.omit({ taskList: true }).shape, blocks: external_exports.array(external_exports.string()).default([]), blockedBy: external_exports.array(external_exports.string()).default([]) });
140862
+ var WorkflowRunFileSchema = external_exports.object({
140863
+ runId: external_exports.string(),
140864
+ workflowName: external_exports.string().optional(),
140865
+ status: external_exports.string().optional(),
140866
+ startTime: external_exports.number().optional(),
140867
+ phases: external_exports.array(external_exports.object({ title: external_exports.string() })).default([]),
140868
+ summary: external_exports.string().optional()
140869
+ });
140870
+ function summariseSession(fs22, configDir, ref) {
140871
+ const sessionRelative = import_node_path52.default.join(PROJECTS_DIR, ref.project, ref.entry);
140872
+ const subagentsRelative = import_node_path52.default.join(sessionRelative, SUBAGENTS_DIR);
140873
+ const workflowsUnderSubagents = import_node_path52.default.join(subagentsRelative, WORKFLOWS_DIR);
140874
+ const isMeta = (name) => name.startsWith(AGENT_FILE_PREFIX) && name.endsWith(META_SUFFIX);
140875
+ let agentCount = fs22.readdir(import_node_path52.default.join(configDir, subagentsRelative)).filter(isMeta).length;
140876
+ for (const runDir of fs22.readdir(import_node_path52.default.join(configDir, workflowsUnderSubagents))) {
140877
+ if (runDir.startsWith(WORKFLOW_RUN_PREFIX)) {
140878
+ agentCount += fs22.readdir(import_node_path52.default.join(configDir, workflowsUnderSubagents, runDir)).filter(isMeta).length;
140879
+ }
140880
+ }
140881
+ const workflowRunCount = fs22.readdir(import_node_path52.default.join(configDir, sessionRelative, WORKFLOWS_DIR)).filter((name) => name.startsWith(WORKFLOW_RUN_PREFIX) && name.endsWith(JSON_SUFFIX)).length;
140882
+ const transcript = fs22.lstat(import_node_path52.default.join(configDir, PROJECTS_DIR, ref.project, `${ref.entry}${TRANSCRIPT_SUFFIX}`));
140883
+ return { ...ref, agentCount, workflowRunCount, ...transcript === void 0 ? {} : { updatedAt: new Date(transcript.mtimeMs).toISOString() } };
140884
+ }
140885
+ function readSessionAgentTree(fs22, configDir, ref, options = {}) {
140886
+ const problems = [];
140887
+ const report = (problem) => {
140888
+ problems.push(problem);
140889
+ };
140890
+ const sessionRelative = import_node_path52.default.join(PROJECTS_DIR, ref.project, ref.entry);
140891
+ const subagentsRelative = import_node_path52.default.join(sessionRelative, SUBAGENTS_DIR);
140892
+ const workflowsUnderSubagents = import_node_path52.default.join(subagentsRelative, WORKFLOWS_DIR);
140893
+ const located = locateAgents(fs22, configDir, subagentsRelative, void 0, report);
140894
+ for (const runDir of listDirOrReport(fs22, configDir, workflowsUnderSubagents, report)) {
140895
+ if (runDir.startsWith(WORKFLOW_RUN_PREFIX)) {
140896
+ located.push(...locateAgents(fs22, configDir, import_node_path52.default.join(workflowsUnderSubagents, runDir), runDir, report));
140897
+ }
140898
+ }
140899
+ const agents = /* @__PURE__ */ new Map();
140900
+ for (const candidate of located) {
140901
+ const text2 = readFileOrReport(fs22, configDir, candidate.metaPath, report);
140902
+ if (text2 === void 0) {
140903
+ continue;
140904
+ }
140905
+ const parsed = AgentMetaSchema.safeParse(parseJson4(text2));
140906
+ if (!parsed.success) {
140907
+ report({ path: candidate.metaPath, reason: "meta file is not a JSON object with an agentType" });
140908
+ continue;
140909
+ }
140910
+ agents.set(candidate.id, { located: candidate, meta: parsed.data });
140911
+ }
140912
+ const teamNames = [...new Set([...agents.values()].flatMap((agent) => agent.meta.teamName === void 0 ? [] : [agent.meta.teamName]))].sort();
140913
+ const parentOf4 = resolveParents(fs22, configDir, agents, report);
140914
+ const childrenOf = /* @__PURE__ */ new Map();
140915
+ const roots = [];
140916
+ for (const id2 of agents.keys()) {
140917
+ const parent = parentOf4.get(id2);
140918
+ if (parent === void 0) {
140919
+ roots.push(id2);
140920
+ } else {
140921
+ childrenOf.set(parent, [...childrenOf.get(parent) ?? [], id2]);
140922
+ }
140923
+ }
140924
+ const build = (id2) => {
140925
+ const read = agents.get(id2);
140926
+ if (read === void 0) {
140927
+ throw new Error(`agent ${id2} is in the tree but was never read`);
140928
+ }
140929
+ return toNode(read, (childrenOf.get(id2) ?? []).sort().map(build));
140930
+ };
140931
+ return {
140932
+ project: ref.project,
140933
+ sessionId: ref.sessionId,
140934
+ superseded: ref.superseded,
140935
+ agents: roots.sort().map(build),
140936
+ tasks: readTasks(fs22, configDir, ownTaskLists(ref.sessionId), [.../* @__PURE__ */ new Set([...teamNames, ...options.taskListIds ?? []])].filter((id2) => !ownTaskLists(ref.sessionId).includes(id2)), report),
140937
+ workflowRuns: readWorkflowRuns(fs22, configDir, import_node_path52.default.join(sessionRelative, WORKFLOWS_DIR), report),
140938
+ problems
140939
+ };
140940
+ }
140941
+ function resolveParents(fs22, configDir, agents, report) {
140942
+ const parentOf4 = /* @__PURE__ */ new Map();
140943
+ const transcriptCache = /* @__PURE__ */ new Map();
140944
+ const transcriptOf = (agent) => {
140945
+ const cached2 = transcriptCache.get(agent.located.id);
140946
+ if (cached2 !== void 0) {
140947
+ return cached2;
140948
+ }
140949
+ const text2 = readFileOrReport(fs22, configDir, agent.located.transcriptPath, report) ?? "";
140950
+ transcriptCache.set(agent.located.id, text2);
140951
+ return text2;
140952
+ };
140953
+ const wouldCycle = (child, parent) => {
140954
+ for (let cursor3 = parent; cursor3 !== void 0; cursor3 = parentOf4.get(cursor3)) {
140955
+ if (cursor3 === child) {
140956
+ return true;
140957
+ }
140958
+ }
140959
+ return false;
140960
+ };
140961
+ const attach = (child, parent) => {
140962
+ if (wouldCycle(child.located.id, parent)) {
140963
+ report({ path: child.located.metaPath, reason: `parent ${parent} would make a cycle` });
140964
+ return;
140965
+ }
140966
+ parentOf4.set(child.located.id, parent);
140967
+ };
140968
+ for (const agent of agents.values()) {
140969
+ const { meta: meta3, located } = agent;
140970
+ if (meta3.parentAgentId !== void 0 && agents.has(meta3.parentAgentId)) {
140971
+ attach(agent, meta3.parentAgentId);
140972
+ continue;
140973
+ }
140974
+ const depth = meta3.spawnDepth;
140975
+ if (depth !== void 0 && depth <= SESSION_SPAWN_DEPTH || meta3.toolUseId === void 0) {
140976
+ if (meta3.parentAgentId !== void 0) {
140977
+ report({ path: located.metaPath, reason: `parentAgentId ${meta3.parentAgentId} names no agent in this session` });
140978
+ }
140979
+ continue;
140980
+ }
140981
+ const toolUseId = meta3.toolUseId;
140982
+ const owners = [...agents.values()].filter(
140983
+ (candidate) => candidate.located.id !== located.id && (depth === void 0 || candidate.meta.spawnDepth === void 0 || candidate.meta.spawnDepth === depth - 1) && candidate.located.workflowRunId === located.workflowRunId && transcriptOf(candidate).includes(toolUseId)
140984
+ );
140985
+ const owner = owners[0];
140986
+ if (owners.length === 1 && owner !== void 0) {
140987
+ attach(agent, owner.located.id);
140988
+ } else if (owners.length > 1) {
140989
+ report({ path: located.metaPath, reason: "more than one agent transcript records the call that spawned it" });
140990
+ } else if (depth !== void 0) {
140991
+ report({ path: located.metaPath, reason: "no agent transcript records the call that spawned it" });
140992
+ }
140993
+ }
140994
+ return parentOf4;
140995
+ }
140996
+ function ownTaskLists(sessionId) {
140997
+ return [sessionId, `${SHORT_SESSION_LIST_PREFIX}${sessionId.slice(0, SHORT_SESSION_ID_LENGTH)}`];
140998
+ }
140999
+ function readTasks(fs22, configDir, ownLists, sharedLists, report) {
141000
+ const tasks = [];
141001
+ [...ownLists, ...sharedLists].forEach((scope, index) => {
141002
+ const relativeDir = import_node_path52.default.join(TASKS_DIR, scope);
141003
+ for (const name of [...listDirOrReport(fs22, configDir, relativeDir, report)].sort()) {
141004
+ if (name.startsWith(".") || !name.endsWith(JSON_SUFFIX)) {
141005
+ continue;
141006
+ }
141007
+ const relative = import_node_path52.default.join(relativeDir, name);
141008
+ const text2 = readFileOrReport(fs22, configDir, relative, report);
141009
+ const parsed = TaskFileSchema.safeParse(text2 === void 0 ? void 0 : parseJson4(text2));
141010
+ if (parsed.success) {
141011
+ tasks.push(index < ownLists.length ? parsed.data : { ...parsed.data, taskList: scope });
141012
+ } else if (text2 !== void 0) {
141013
+ report({ path: relative, reason: "task file is not a task" });
141014
+ }
141015
+ }
141016
+ });
141017
+ return tasks;
141018
+ }
141019
+ function readWorkflowRuns(fs22, configDir, relativeDir, report) {
141020
+ const runs = [];
141021
+ for (const name of [...listDirOrReport(fs22, configDir, relativeDir, report)].sort()) {
141022
+ if (!name.startsWith(WORKFLOW_RUN_PREFIX) || !name.endsWith(JSON_SUFFIX)) {
141023
+ continue;
141024
+ }
141025
+ const relative = import_node_path52.default.join(relativeDir, name);
141026
+ const text2 = readFileOrReport(fs22, configDir, relative, report);
141027
+ const parsed = WorkflowRunFileSchema.safeParse(text2 === void 0 ? void 0 : parseJson4(text2));
141028
+ if (!parsed.success) {
141029
+ if (text2 !== void 0) {
141030
+ report({ path: relative, reason: "workflow run file is not a run record" });
141031
+ }
141032
+ continue;
141033
+ }
141034
+ const { phases, ...rest } = parsed.data;
141035
+ runs.push({ ...rest, phases: phases.map((phase) => phase.title) });
141036
+ }
141037
+ return runs;
141038
+ }
141039
+
141040
+ // src/agents/commands.ts
141041
+ var realSessionFs = {
141042
+ ...realFarmFs,
141043
+ realpath: (candidate) => {
141044
+ try {
141045
+ return import_node_fs20.default.realpathSync(candidate);
141046
+ } catch {
141047
+ return void 0;
141048
+ }
141049
+ }
141050
+ };
141051
+ var SessionLookupError = class extends CliError {
141052
+ constructor(message) {
141053
+ super(message);
141054
+ this.name = "SessionLookupError";
141055
+ }
141056
+ };
141057
+ function identityConfigDir(identitiesDir, identity) {
141058
+ return import_node_path53.default.join(identitiesDir, identity);
141059
+ }
141060
+ function historyStores(fs22, identitiesDir, identities) {
141061
+ const byRealPath = /* @__PURE__ */ new Map();
141062
+ for (const identity of identities) {
141063
+ const configDir = identityConfigDir(identitiesDir, identity);
141064
+ const real = fs22.realpath(import_node_path53.default.join(configDir, "projects"));
141065
+ if (real === void 0) {
141066
+ continue;
141067
+ }
141068
+ const store = byRealPath.get(real);
141069
+ if (store === void 0) {
141070
+ byRealPath.set(real, { configDir, identities: [identity] });
141071
+ } else {
141072
+ store.identities.push(identity);
141073
+ }
141074
+ }
141075
+ return [...byRealPath.values()];
141076
+ }
141077
+ function collectSessionList(fs22, identitiesDir, identities, filters) {
141078
+ const names = filters.identity === void 0 ? identities : identities.filter((name) => name === filters.identity);
141079
+ if (filters.identity !== void 0 && names.length === 0) {
141080
+ throw new SessionLookupError(`no identity named "${filters.identity}"`);
141081
+ }
141082
+ const sessions = [];
141083
+ for (const store of historyStores(fs22, identitiesDir, names)) {
141084
+ for (const ref of listSessions2(fs22, store.configDir)) {
141085
+ const summary = summariseSession(fs22, store.configDir, ref);
141086
+ if (filters.all === true || summary.agentCount > 0 || summary.workflowRunCount > 0) {
141087
+ sessions.push({ ...summary, identities: store.identities });
141088
+ }
141089
+ }
141090
+ }
141091
+ return sessions.sort((left, right) => (right.updatedAt ?? "").localeCompare(left.updatedAt ?? "") || left.sessionId.localeCompare(right.sessionId));
141092
+ }
141093
+ function locateSession(fs22, identitiesDir, identities, query, onlyIdentity) {
141094
+ const names = onlyIdentity === void 0 ? identities : identities.filter((name) => name === onlyIdentity);
141095
+ if (onlyIdentity !== void 0 && names.length === 0) {
141096
+ throw new SessionLookupError(`no identity named "${onlyIdentity}"`);
141097
+ }
141098
+ const matches = [];
141099
+ for (const store of historyStores(fs22, identitiesDir, names)) {
141100
+ for (const ref of listSessions2(fs22, store.configDir)) {
141101
+ if (ref.sessionId.startsWith(query)) {
141102
+ matches.push({ identities: store.identities, configDir: store.configDir, ref });
141103
+ }
141104
+ }
141105
+ }
141106
+ const exact = matches.filter((match) => match.ref.sessionId === query);
141107
+ const candidates = exact.length > 0 ? exact : matches;
141108
+ const only = candidates[0];
141109
+ if (candidates.length === 1 && only !== void 0) {
141110
+ return only;
141111
+ }
141112
+ if (candidates.length === 0) {
141113
+ throw new SessionLookupError(`no session matches "${query}"`);
141114
+ }
141115
+ 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`);
141116
+ }
141117
+ function identityColumn(identities) {
141118
+ const [first, ...rest] = identities;
141119
+ return rest.length === 0 ? first ?? "-" : `${first ?? "-"} +${String(rest.length)}`;
141120
+ }
141121
+ function formatSessionList(sessions) {
141122
+ if (sessions.length === 0) {
141123
+ return ["no sessions with agents or workflow runs found"];
141124
+ }
141125
+ return sessions.map((session) => {
141126
+ const when = session.updatedAt ?? "-";
141127
+ const state = session.superseded ? " superseded" : "";
141128
+ return `${identityColumn(session.identities)} ${session.sessionId} ${when} agents=${String(session.agentCount)} runs=${String(session.workflowRunCount)}${state} ${session.project}`;
141129
+ });
141130
+ }
141131
+ function formatNode(node2, depth) {
141132
+ const indent = " ".repeat(depth);
141133
+ const label = node2.description ?? node2.name ?? "";
141134
+ const extras = [node2.background === true ? "background" : void 0, node2.workflowRunId, node2.workflowPhase, node2.teamName, node2.stoppedByUser === true ? "stopped" : void 0].filter((value2) => value2 !== void 0);
141135
+ const line = `${indent}- [${node2.kind}] ${node2.agentType} ${node2.id}${label === "" ? "" : ` ${label}`}${extras.length === 0 ? "" : ` (${extras.join(", ")})`}`;
141136
+ return [line, ...node2.children.flatMap((child) => formatNode(child, depth + 1))];
141137
+ }
141138
+ function formatSessionTree(identities, tree) {
141139
+ const lines = [`session ${tree.sessionId}${tree.superseded ? " (superseded)" : ""} identities ${identities.join(",")} project ${tree.project}`];
141140
+ lines.push(tree.agents.length === 0 ? "agents: none" : "agents:", ...tree.agents.flatMap((node2) => formatNode(node2, 1)));
141141
+ if (tree.workflowRuns.length > 0) {
141142
+ lines.push("workflow runs:", ...tree.workflowRuns.map((run) => ` ${run.runId} ${run.workflowName ?? "-"} ${run.status ?? "-"} phases: ${run.phases.join(" > ") || "-"}`));
141143
+ }
141144
+ if (tree.tasks.length > 0) {
141145
+ lines.push("tasks:", ...tree.tasks.map((task) => ` [${task.status}] ${task.id} ${task.subject}`));
141146
+ }
141147
+ if (tree.problems.length > 0) {
141148
+ lines.push("problems:", ...tree.problems.map((problem) => ` ${problem.path}: ${problem.reason}`));
141149
+ }
141150
+ return lines;
141151
+ }
141152
+ function registerSessionCommands(program2, deps) {
141153
+ const { paths } = deps;
141154
+ const identityNames = () => listIdentities(paths).map((entry) => entry.name);
141155
+ const session = withExamples(program2.command("session").description("Inspect a session's agents: its subagents, forks, workflow agents, task list and workflow runs, read from the transcripts on disk."), [
141156
+ "agent-shim session list",
141157
+ "agent-shim session show 3164d246"
141158
+ ]);
141159
+ withExamples(
141160
+ session.command("list").description("List sessions that spawned agents or ran workflows, newest transcript first, with their agent and workflow-run counts. Read-only.").option("--identity <name>", "Only this identity's sessions.").option("--all", "Include sessions that spawned no agent and ran no workflow.").option("--json", "Print the sessions as JSON.").action((options) => {
141161
+ const sessions = collectSessionList(realSessionFs, paths.identitiesDir, identityNames(), {
141162
+ ...options.identity === void 0 ? {} : { identity: options.identity },
141163
+ ...options.all === void 0 ? {} : { all: options.all }
141164
+ });
141165
+ if (options.json === true) {
141166
+ printJson(sessions);
141167
+ return;
141168
+ }
141169
+ for (const line of formatSessionList(sessions)) {
141170
+ console.log(line);
141171
+ }
141172
+ }),
141173
+ ["agent-shim session list", "agent-shim session list --identity work --json"]
141174
+ );
141175
+ withExamples(
141176
+ session.command("show <session>").description("Show one session's agent tree, task list and workflow runs. Takes the session id or an unambiguous prefix of it. Read-only.").option("--identity <name>", "Look only in this identity.").option("--json", "Print the tree as JSON.").action((query, options) => {
141177
+ const located = locateSession(realSessionFs, paths.identitiesDir, identityNames(), query, options.identity);
141178
+ const tree = readSessionAgentTree(realSessionFs, located.configDir, located.ref);
141179
+ if (options.json === true) {
141180
+ printJson({ identities: located.identities, ...tree });
141181
+ return;
141182
+ }
141183
+ for (const line of formatSessionTree(located.identities, tree)) {
141184
+ console.log(line);
141185
+ }
141186
+ }),
141187
+ ["agent-shim session show 3164d246", "agent-shim session show 3164d246 --identity work --json"]
141188
+ );
141189
+ }
141190
+
141191
+ // src/usage/commands.ts
141192
+ var import_node_path54 = __toESM(require("node:path"), 1);
140652
141193
  init_commandDeps();
140653
141194
  init_realPorts();
140654
141195
  init_account();
@@ -140786,7 +141327,7 @@ function collectAccounts(fs22, paths, identity, probe) {
140786
141327
  return names.map((name) => ({
140787
141328
  identity: name,
140788
141329
  account: readAccountMetadata(fs22, paths.identitiesDir, name),
140789
- signIn: identitySignIn(fs22, probe, { farmRoot: import_node_path52.default.join(paths.identitiesDir, name), hasCredentialBlock: readIdentity(paths, name)?.credential !== void 0 }),
141330
+ signIn: identitySignIn(fs22, probe, { farmRoot: import_node_path54.default.join(paths.identitiesDir, name), hasCredentialBlock: readIdentity(paths, name)?.credential !== void 0 }),
140790
141331
  usage: readUsageSnapshot(fs22, paths.usageSnapshotsDir, name)
140791
141332
  }));
140792
141333
  }
@@ -140970,6 +141511,7 @@ function buildProgram(deps) {
140970
141511
  registerFrontDoorCommand(program2, deps);
140971
141512
  registerMcpCommand(program2, deps);
140972
141513
  registerUsageCommands(program2, deps);
141514
+ registerSessionCommands(program2, deps);
140973
141515
  registerRunCommand(program2, deps.runClaude);
140974
141516
  registerUpdateCommand(program2, deps, deps.updatePorts);
140975
141517
  registerCompletionCommand(program2);
@@ -141132,7 +141674,7 @@ async function runClaude(argvOverride) {
141132
141674
  // src/cli.ts
141133
141675
  async function main() {
141134
141676
  aliasLegacyEnv(process.env);
141135
- const invokedName = import_node_path53.default.basename(process.argv[1] ?? "agent-shim");
141677
+ const invokedName = import_node_path55.default.basename(process.argv[1] ?? "agent-shim");
141136
141678
  if (isInvokedAsClaude(invokedName)) {
141137
141679
  await runClaude();
141138
141680
  return;