agent-shim 8.43.0 → 8.44.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, path46) {
322
- if (!path46)
321
+ function getElementAtPath(obj, path47) {
322
+ if (!path47)
323
323
  return obj;
324
- return path46.reduce((acc, key) => acc?.[key], obj);
324
+ return path47.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(path46, issues) {
583
+ function prefixIssues(path47, issues) {
584
584
  return issues.map((iss) => {
585
585
  var _a4;
586
586
  (_a4 = iss).path ?? (_a4.path = []);
587
- iss.path.unshift(path46);
587
+ iss.path.unshift(path47);
588
588
  return iss;
589
589
  });
590
590
  }
@@ -1105,16 +1105,16 @@ function flattenError(error62, mapper = (issue2) => issue2.message) {
1105
1105
  }
1106
1106
  function formatError(error62, mapper = (issue2) => issue2.message) {
1107
1107
  const fieldErrors = { _errors: [] };
1108
- const processError = (error63, path46 = []) => {
1108
+ const processError = (error63, path47 = []) => {
1109
1109
  for (const issue2 of error63.issues) {
1110
1110
  if (issue2.code === "invalid_union" && issue2.errors.length) {
1111
- issue2.errors.map((issues) => processError({ issues }, [...path46, ...issue2.path]));
1111
+ issue2.errors.map((issues) => processError({ issues }, [...path47, ...issue2.path]));
1112
1112
  } else if (issue2.code === "invalid_key") {
1113
- processError({ issues: issue2.issues }, [...path46, ...issue2.path]);
1113
+ processError({ issues: issue2.issues }, [...path47, ...issue2.path]);
1114
1114
  } else if (issue2.code === "invalid_element") {
1115
- processError({ issues: issue2.issues }, [...path46, ...issue2.path]);
1115
+ processError({ issues: issue2.issues }, [...path47, ...issue2.path]);
1116
1116
  } else {
1117
- const fullpath = [...path46, ...issue2.path];
1117
+ const fullpath = [...path47, ...issue2.path];
1118
1118
  if (fullpath.length === 0) {
1119
1119
  fieldErrors._errors.push(mapper(issue2));
1120
1120
  } else {
@@ -1153,17 +1153,17 @@ function formatError(error62, mapper = (issue2) => issue2.message) {
1153
1153
  }
1154
1154
  function treeifyError(error62, mapper = (issue2) => issue2.message) {
1155
1155
  const result = { errors: [] };
1156
- const processError = (error63, path46 = []) => {
1156
+ const processError = (error63, path47 = []) => {
1157
1157
  var _a4;
1158
1158
  for (const issue2 of error63.issues) {
1159
1159
  if (issue2.code === "invalid_union" && issue2.errors.length) {
1160
- issue2.errors.map((issues) => processError({ issues }, [...path46, ...issue2.path]));
1160
+ issue2.errors.map((issues) => processError({ issues }, [...path47, ...issue2.path]));
1161
1161
  } else if (issue2.code === "invalid_key") {
1162
- processError({ issues: issue2.issues }, [...path46, ...issue2.path]);
1162
+ processError({ issues: issue2.issues }, [...path47, ...issue2.path]);
1163
1163
  } else if (issue2.code === "invalid_element") {
1164
- processError({ issues: issue2.issues }, [...path46, ...issue2.path]);
1164
+ processError({ issues: issue2.issues }, [...path47, ...issue2.path]);
1165
1165
  } else {
1166
- const fullpath = [...path46, ...issue2.path];
1166
+ const fullpath = [...path47, ...issue2.path];
1167
1167
  if (fullpath.length === 0) {
1168
1168
  result.errors.push(mapper(issue2));
1169
1169
  continue;
@@ -1202,8 +1202,8 @@ function treeifyError(error62, mapper = (issue2) => issue2.message) {
1202
1202
  }
1203
1203
  function toDotPath(_path) {
1204
1204
  const segs = [];
1205
- const path46 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1206
- for (const seg of path46) {
1205
+ const path47 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1206
+ for (const seg of path47) {
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 path46 = ref.slice(1).split("/").filter(Boolean);
19203
- if (path46.length === 0) {
19202
+ const path47 = ref.slice(1).split("/").filter(Boolean);
19203
+ if (path47.length === 0) {
19204
19204
  return ctx.rootSchema;
19205
19205
  }
19206
19206
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
19207
- if (path46[0] === defsKey) {
19208
- const key = path46[1] === void 0 ? void 0 : decodeJSONPointerSegment(path46[1]);
19207
+ if (path47[0] === defsKey) {
19208
+ const key = path47[1] === void 0 ? void 0 : decodeJSONPointerSegment(path47[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 path46 = require("path");
23715
+ var path47 = 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 = path46.join(homedir, "Library");
23721
+ const library = path47.join(homedir, "Library");
23722
23722
  return {
23723
- data: path46.join(library, "Application Support", name),
23724
- config: path46.join(library, "Preferences", name),
23725
- cache: path46.join(library, "Caches", name),
23726
- log: path46.join(library, "Logs", name),
23727
- temp: path46.join(tmpdir, name)
23723
+ data: path47.join(library, "Application Support", name),
23724
+ config: path47.join(library, "Preferences", name),
23725
+ cache: path47.join(library, "Caches", name),
23726
+ log: path47.join(library, "Logs", name),
23727
+ temp: path47.join(tmpdir, name)
23728
23728
  };
23729
23729
  };
23730
23730
  var windows = (name) => {
23731
- const appData = env.APPDATA || path46.join(homedir, "AppData", "Roaming");
23732
- const localAppData = env.LOCALAPPDATA || path46.join(homedir, "AppData", "Local");
23731
+ const appData = env.APPDATA || path47.join(homedir, "AppData", "Roaming");
23732
+ const localAppData = env.LOCALAPPDATA || path47.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: path46.join(localAppData, name, "Data"),
23736
- config: path46.join(appData, name, "Config"),
23737
- cache: path46.join(localAppData, name, "Cache"),
23738
- log: path46.join(localAppData, name, "Log"),
23739
- temp: path46.join(tmpdir, name)
23735
+ data: path47.join(localAppData, name, "Data"),
23736
+ config: path47.join(appData, name, "Config"),
23737
+ cache: path47.join(localAppData, name, "Cache"),
23738
+ log: path47.join(localAppData, name, "Log"),
23739
+ temp: path47.join(tmpdir, name)
23740
23740
  };
23741
23741
  };
23742
23742
  var linux = (name) => {
23743
- const username = path46.basename(homedir);
23743
+ const username = path47.basename(homedir);
23744
23744
  return {
23745
- data: path46.join(env.XDG_DATA_HOME || path46.join(homedir, ".local", "share"), name),
23746
- config: path46.join(env.XDG_CONFIG_HOME || path46.join(homedir, ".config"), name),
23747
- cache: path46.join(env.XDG_CACHE_HOME || path46.join(homedir, ".cache"), name),
23745
+ data: path47.join(env.XDG_DATA_HOME || path47.join(homedir, ".local", "share"), name),
23746
+ config: path47.join(env.XDG_CONFIG_HOME || path47.join(homedir, ".config"), name),
23747
+ cache: path47.join(env.XDG_CACHE_HOME || path47.join(homedir, ".cache"), name),
23748
23748
  // https://wiki.debian.org/XDGBaseDirectorySpecification#state
23749
- log: path46.join(env.XDG_STATE_HOME || path46.join(homedir, ".local", "state"), name),
23750
- temp: path46.join(tmpdir, username, name)
23749
+ log: path47.join(env.XDG_STATE_HOME || path47.join(homedir, ".local", "state"), name),
23750
+ temp: path47.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, path46) {
23819
- if (typeof path46 === "string" && Object.prototype.hasOwnProperty.call(source, path46)) {
23820
- return source[path46];
23818
+ function getPropertyByPath(source, path47) {
23819
+ if (typeof path47 === "string" && Object.prototype.hasOwnProperty.call(source, path47)) {
23820
+ return source[path47];
23821
23821
  }
23822
- const parsedPath = typeof path46 === "string" ? path46.split(".") : path46;
23822
+ const parsedPath = typeof path47 === "string" ? path47.split(".") : path47;
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(path46) {
23845
+ async function isDirectory(path47) {
23846
23846
  try {
23847
- const stat = await fs_1.promises.stat(path46);
23847
+ const stat = await fs_1.promises.stat(path47);
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(path46) {
23857
+ function isDirectorySync(path47) {
23858
23858
  try {
23859
- const stat = fs_1.default.statSync(path46);
23859
+ const stat = fs_1.default.statSync(path47);
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((path46, i10) => `${i10 + 1}. ${path46}`).join("\n")} (same as ${idx + 1}.)`);
23957
+ ${[...importStack, fullPath].map((path47, i10) => `${i10 + 1}. ${path47}`).join("\n")} (same as ${idx + 1}.)`);
23958
23958
  }
23959
23959
  }
23960
23960
  }
@@ -24142,9 +24142,9 @@ var require_Explorer = __commonJS({
24142
24142
  throw error62;
24143
24143
  }
24144
24144
  }
24145
- async #fileExists(path46) {
24145
+ async #fileExists(path47) {
24146
24146
  try {
24147
- await promises_1.default.stat(path46);
24147
+ await promises_1.default.stat(path47);
24148
24148
  return true;
24149
24149
  } catch (e14) {
24150
24150
  return false;
@@ -24304,9 +24304,9 @@ var require_ExplorerSync = __commonJS({
24304
24304
  throw error62;
24305
24305
  }
24306
24306
  }
24307
- #fileExists(path46) {
24307
+ #fileExists(path47) {
24308
24308
  try {
24309
- fs_1.default.statSync(path46);
24309
+ fs_1.default.statSync(path47);
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((path46) => path46.replace("{name}", moduleName));
24433
+ const userConfiguredSearchPlaces = userConfiguredOptions.searchPlaces?.map((path47) => path47.replace("{name}", moduleName));
24434
24434
  if (userConfiguredOptions.mergeSearchPlaces) {
24435
24435
  return [...userConfiguredSearchPlaces ?? [], ...toolDefinedSearchPlaces];
24436
24436
  }
@@ -28825,8 +28825,8 @@ var require_utils = __commonJS({
28825
28825
  }
28826
28826
  return output2;
28827
28827
  };
28828
- exports2.basename = (path46, { windows } = {}) => {
28829
- const segs = path46.split(windows ? /[\\/]/ : "/");
28828
+ exports2.basename = (path47, { windows } = {}) => {
28829
+ const segs = path47.split(windows ? /[\\/]/ : "/");
28830
28830
  const last = segs[segs.length - 1];
28831
28831
  if (last === "") {
28832
28832
  return segs[segs.length - 2];
@@ -32852,7 +32852,7 @@ var init_package = __esm({
32852
32852
  "package.json"() {
32853
32853
  package_default = {
32854
32854
  name: "agent-shim",
32855
- version: "8.43.0",
32855
+ version: "8.44.0",
32856
32856
  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.",
32857
32857
  license: "MIT",
32858
32858
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -33276,11 +33276,11 @@ function identifyRequest(headers) {
33276
33276
  function directOrigin(port) {
33277
33277
  return `http://127.0.0.1:${String(port)}`;
33278
33278
  }
33279
- function parseProviderPath(path46) {
33280
- if (!path46.startsWith(PROVIDER_PATH_PREFIX)) {
33279
+ function parseProviderPath(path47) {
33280
+ if (!path47.startsWith(PROVIDER_PATH_PREFIX)) {
33281
33281
  return void 0;
33282
33282
  }
33283
- const tail = path46.slice(PROVIDER_PATH_PREFIX.length);
33283
+ const tail = path47.slice(PROVIDER_PATH_PREFIX.length);
33284
33284
  const slash = tail.indexOf("/");
33285
33285
  if (slash <= 0) {
33286
33286
  return void 0;
@@ -33721,9 +33721,9 @@ function decoderFor(encoding) {
33721
33721
  return void 0;
33722
33722
  }
33723
33723
  }
33724
- function destinationOf(path46) {
33725
- const scoped = parseProviderPath(path46);
33726
- return scoped === void 0 ? { provider: ANTHROPIC_PROVIDER, endpoint: path46 } : { provider: scoped.provider, endpoint: scoped.rest };
33724
+ function destinationOf(path47) {
33725
+ const scoped = parseProviderPath(path47);
33726
+ return scoped === void 0 ? { provider: ANTHROPIC_PROVIDER, endpoint: path47 } : { provider: scoped.provider, endpoint: scoped.rest };
33727
33727
  }
33728
33728
  function buildRecord(event, context) {
33729
33729
  const { scan } = context;
@@ -36107,14 +36107,14 @@ var require_util2 = __commonJS({
36107
36107
  }
36108
36108
  const port = url2.port != null ? url2.port : url2.protocol === "https:" ? 443 : 80;
36109
36109
  let origin = url2.origin != null ? url2.origin : `${url2.protocol || ""}//${url2.hostname || ""}:${port}`;
36110
- let path46 = url2.path != null ? url2.path : `${url2.pathname || ""}${url2.search || ""}`;
36110
+ let path47 = url2.path != null ? url2.path : `${url2.pathname || ""}${url2.search || ""}`;
36111
36111
  if (origin[origin.length - 1] === "/") {
36112
36112
  origin = origin.slice(0, origin.length - 1);
36113
36113
  }
36114
- if (path46 && path46[0] !== "/") {
36115
- path46 = `/${path46}`;
36114
+ if (path47 && path47[0] !== "/") {
36115
+ path47 = `/${path47}`;
36116
36116
  }
36117
- return new URL(`${origin}${path46}`);
36117
+ return new URL(`${origin}${path47}`);
36118
36118
  }
36119
36119
  if (!isHttpOrHttpsPrefixed(url2.origin || url2.protocol)) {
36120
36120
  throw new InvalidArgumentError2("Invalid URL protocol: the URL must start with `http:` or `https:`.");
@@ -36935,9 +36935,9 @@ var require_diagnostics = __commonJS({
36935
36935
  "undici:client:sendHeaders",
36936
36936
  (evt) => {
36937
36937
  const {
36938
- request: { method, path: path46, origin }
36938
+ request: { method, path: path47, origin }
36939
36939
  } = evt;
36940
- debugLog("sending request to %s %s%s", method, origin, path46);
36940
+ debugLog("sending request to %s %s%s", method, origin, path47);
36941
36941
  }
36942
36942
  );
36943
36943
  }
@@ -36955,14 +36955,14 @@ var require_diagnostics = __commonJS({
36955
36955
  "undici:request:headers",
36956
36956
  (evt) => {
36957
36957
  const {
36958
- request: { method, path: path46, origin },
36958
+ request: { method, path: path47, origin },
36959
36959
  response: { statusCode }
36960
36960
  } = evt;
36961
36961
  debugLog(
36962
36962
  "received response to %s %s%s - HTTP %d",
36963
36963
  method,
36964
36964
  origin,
36965
- path46,
36965
+ path47,
36966
36966
  statusCode
36967
36967
  );
36968
36968
  }
@@ -36971,23 +36971,23 @@ var require_diagnostics = __commonJS({
36971
36971
  "undici:request:trailers",
36972
36972
  (evt) => {
36973
36973
  const {
36974
- request: { method, path: path46, origin }
36974
+ request: { method, path: path47, origin }
36975
36975
  } = evt;
36976
- debugLog("trailers received from %s %s%s", method, origin, path46);
36976
+ debugLog("trailers received from %s %s%s", method, origin, path47);
36977
36977
  }
36978
36978
  );
36979
36979
  diagnosticsChannel.subscribe(
36980
36980
  "undici:request:error",
36981
36981
  (evt) => {
36982
36982
  const {
36983
- request: { method, path: path46, origin },
36983
+ request: { method, path: path47, origin },
36984
36984
  error: error62
36985
36985
  } = evt;
36986
36986
  debugLog(
36987
36987
  "request to %s %s%s errored - %s",
36988
36988
  method,
36989
36989
  origin,
36990
- path46,
36990
+ path47,
36991
36991
  error62.message
36992
36992
  );
36993
36993
  }
@@ -37102,7 +37102,7 @@ var require_request = __commonJS({
37102
37102
  var kHandler = /* @__PURE__ */ Symbol("handler");
37103
37103
  var Request2 = class {
37104
37104
  constructor(origin, {
37105
- path: path46,
37105
+ path: path47,
37106
37106
  method,
37107
37107
  body,
37108
37108
  headers,
@@ -37119,11 +37119,11 @@ var require_request = __commonJS({
37119
37119
  maxRedirections,
37120
37120
  typeOfService
37121
37121
  }, handler) {
37122
- if (typeof path46 !== "string") {
37122
+ if (typeof path47 !== "string") {
37123
37123
  throw new InvalidArgumentError2("path must be a string");
37124
- } else if (path46[0] !== "/" && !(path46.startsWith("http://") || path46.startsWith("https://")) && method !== "CONNECT") {
37124
+ } else if (path47[0] !== "/" && !(path47.startsWith("http://") || path47.startsWith("https://")) && method !== "CONNECT") {
37125
37125
  throw new InvalidArgumentError2("path must be an absolute URL or start with a slash");
37126
- } else if (invalidPathRegex.test(path46)) {
37126
+ } else if (invalidPathRegex.test(path47)) {
37127
37127
  throw new InvalidArgumentError2("invalid request path");
37128
37128
  }
37129
37129
  if (typeof method !== "string") {
@@ -37198,7 +37198,7 @@ var require_request = __commonJS({
37198
37198
  this.completed = false;
37199
37199
  this.aborted = false;
37200
37200
  this.upgrade = upgrade || null;
37201
- this.path = query ? serializePathWithQuery(path46, query) : path46;
37201
+ this.path = query ? serializePathWithQuery(path47, query) : path47;
37202
37202
  this.origin = origin;
37203
37203
  this.protocol = getProtocolFromUrlString(origin);
37204
37204
  this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent;
@@ -42380,7 +42380,7 @@ var require_client_h1 = __commonJS({
42380
42380
  return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT";
42381
42381
  }
42382
42382
  function writeH1(client, request7) {
42383
- const { method, path: path46, host, upgrade, blocking, reset } = request7;
42383
+ const { method, path: path47, host, upgrade, blocking, reset } = request7;
42384
42384
  let { body, headers, contentLength } = request7;
42385
42385
  const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH";
42386
42386
  if (util.isFormDataLike(body)) {
@@ -42458,7 +42458,7 @@ var require_client_h1 = __commonJS({
42458
42458
  if (socket.setTypeOfService) {
42459
42459
  socket.setTypeOfService(request7.typeOfService);
42460
42460
  }
42461
- let header = `${method} ${path46} HTTP/1.1\r
42461
+ let header = `${method} ${path47} HTTP/1.1\r
42462
42462
  `;
42463
42463
  if (typeof host === "string") {
42464
42464
  header += `host: ${host}\r
@@ -43137,7 +43137,7 @@ var require_client_h2 = __commonJS({
43137
43137
  const headersTimeout = request7.headersTimeout ?? client[kHeadersTimeout];
43138
43138
  const bodyTimeout = request7.bodyTimeout ?? client[kBodyTimeout];
43139
43139
  const session = client[kHTTP2Session];
43140
- const { method, path: path46, host, upgrade, expectContinue, signal, protocol, headers: reqHeaders } = request7;
43140
+ const { method, path: path47, host, upgrade, expectContinue, signal, protocol, headers: reqHeaders } = request7;
43141
43141
  let { body } = request7;
43142
43142
  if (upgrade != null && upgrade !== "websocket") {
43143
43143
  util.errorRequest(client, request7, new InvalidArgumentError2(`Custom upgrade "${upgrade}" not supported over HTTP/2`));
@@ -43206,7 +43206,7 @@ var require_client_h2 = __commonJS({
43206
43206
  }
43207
43207
  headers[HTTP2_HEADER_METHOD] = "CONNECT";
43208
43208
  headers[HTTP2_HEADER_PROTOCOL] = "websocket";
43209
- headers[HTTP2_HEADER_PATH] = path46;
43209
+ headers[HTTP2_HEADER_PATH] = path47;
43210
43210
  if (protocol === "ws:" || protocol === "wss:") {
43211
43211
  headers[HTTP2_HEADER_SCHEME] = protocol === "ws:" ? "http" : "https";
43212
43212
  } else {
@@ -43248,7 +43248,7 @@ var require_client_h2 = __commonJS({
43248
43248
  stream.setTimeout(headersTimeout);
43249
43249
  return true;
43250
43250
  }
43251
- headers[HTTP2_HEADER_PATH] = path46;
43251
+ headers[HTTP2_HEADER_PATH] = path47;
43252
43252
  headers[HTTP2_HEADER_SCHEME] = protocol === "http:" ? "http" : "https";
43253
43253
  const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH";
43254
43254
  if (body && typeof body.read === "function") {
@@ -45600,10 +45600,10 @@ var require_proxy_agent = __commonJS({
45600
45600
  };
45601
45601
  const {
45602
45602
  origin,
45603
- path: path46 = "/",
45603
+ path: path47 = "/",
45604
45604
  headers = {}
45605
45605
  } = opts;
45606
- opts.path = origin + path46;
45606
+ opts.path = origin + path47;
45607
45607
  if (!("host" in headers) && !("Host" in headers)) {
45608
45608
  const { host } = new URL(origin);
45609
45609
  headers.host = host;
@@ -47712,20 +47712,20 @@ var require_mock_utils = __commonJS({
47712
47712
  }
47713
47713
  return normalizedQp;
47714
47714
  }
47715
- function safeUrl(path46) {
47716
- if (typeof path46 !== "string") {
47717
- return path46;
47715
+ function safeUrl(path47) {
47716
+ if (typeof path47 !== "string") {
47717
+ return path47;
47718
47718
  }
47719
- const pathSegments = path46.split("?", 3);
47719
+ const pathSegments = path47.split("?", 3);
47720
47720
  if (pathSegments.length !== 2) {
47721
- return path46;
47721
+ return path47;
47722
47722
  }
47723
47723
  const qp2 = new URLSearchParams(pathSegments.pop());
47724
47724
  qp2.sort();
47725
47725
  return [...pathSegments, qp2.toString()].join("?");
47726
47726
  }
47727
- function matchKey(mockDispatch2, { path: path46, method, body, headers }) {
47728
- const pathMatch = matchValue(mockDispatch2.path, path46);
47727
+ function matchKey(mockDispatch2, { path: path47, method, body, headers }) {
47728
+ const pathMatch = matchValue(mockDispatch2.path, path47);
47729
47729
  const methodMatch = matchValue(mockDispatch2.method, method);
47730
47730
  const bodyMatch = typeof mockDispatch2.body !== "undefined" ? matchValue(mockDispatch2.body, body) : true;
47731
47731
  const headersMatch = matchHeaders(mockDispatch2, headers);
@@ -47750,8 +47750,8 @@ var require_mock_utils = __commonJS({
47750
47750
  const basePath = key.query ? serializePathWithQuery(key.path, key.query) : key.path;
47751
47751
  const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath;
47752
47752
  const resolvedPathWithoutTrailingSlash = removeTrailingSlash(resolvedPath);
47753
- let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path46, ignoreTrailingSlash }) => {
47754
- return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(path46)), resolvedPathWithoutTrailingSlash) : matchValue(safeUrl(path46), resolvedPath);
47753
+ let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path47, ignoreTrailingSlash }) => {
47754
+ return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(path47)), resolvedPathWithoutTrailingSlash) : matchValue(safeUrl(path47), resolvedPath);
47755
47755
  });
47756
47756
  if (matchedMockDispatches.length === 0) {
47757
47757
  throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`);
@@ -47790,19 +47790,19 @@ var require_mock_utils = __commonJS({
47790
47790
  mockDispatches.splice(index, 1);
47791
47791
  }
47792
47792
  }
47793
- function removeTrailingSlash(path46) {
47794
- while (path46.endsWith("/")) {
47795
- path46 = path46.slice(0, -1);
47793
+ function removeTrailingSlash(path47) {
47794
+ while (path47.endsWith("/")) {
47795
+ path47 = path47.slice(0, -1);
47796
47796
  }
47797
- if (path46.length === 0) {
47798
- path46 = "/";
47797
+ if (path47.length === 0) {
47798
+ path47 = "/";
47799
47799
  }
47800
- return path46;
47800
+ return path47;
47801
47801
  }
47802
47802
  function buildKey(opts) {
47803
- const { path: path46, method, body, headers, query } = opts;
47803
+ const { path: path47, method, body, headers, query } = opts;
47804
47804
  return {
47805
- path: path46,
47805
+ path: path47,
47806
47806
  method,
47807
47807
  body,
47808
47808
  headers,
@@ -48492,10 +48492,10 @@ var require_pending_interceptors_formatter = __commonJS({
48492
48492
  }
48493
48493
  format(pendingInterceptors) {
48494
48494
  const withPrettyHeaders = pendingInterceptors.map(
48495
- ({ method, path: path46, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
48495
+ ({ method, path: path47, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
48496
48496
  Method: method,
48497
48497
  Origin: origin,
48498
- Path: path46,
48498
+ Path: path47,
48499
48499
  "Status code": statusCode,
48500
48500
  Persistent: persist ? PERSISTENT : NOT_PERSISTENT,
48501
48501
  Invocations: timesInvoked,
@@ -48577,9 +48577,9 @@ var require_mock_agent = __commonJS({
48577
48577
  const acceptNonStandardSearchParameters = this[kMockAgentAcceptsNonStandardSearchParameters];
48578
48578
  const dispatchOpts = { ...opts };
48579
48579
  if (acceptNonStandardSearchParameters && dispatchOpts.path) {
48580
- const [path46, searchParams] = dispatchOpts.path.split("?");
48580
+ const [path47, searchParams] = dispatchOpts.path.split("?");
48581
48581
  const normalizedSearchParams = normalizeSearchParams(searchParams, acceptNonStandardSearchParameters);
48582
- dispatchOpts.path = `${path46}?${normalizedSearchParams}`;
48582
+ dispatchOpts.path = `${path47}?${normalizedSearchParams}`;
48583
48583
  }
48584
48584
  return this[kAgent].dispatch(dispatchOpts, handler);
48585
48585
  }
@@ -48980,12 +48980,12 @@ var require_snapshot_recorder = __commonJS({
48980
48980
  * @return {Promise<void>} - Resolves when snapshots are loaded
48981
48981
  */
48982
48982
  async loadSnapshots(filePath) {
48983
- const path46 = filePath || this.#snapshotPath;
48984
- if (!path46) {
48983
+ const path47 = filePath || this.#snapshotPath;
48984
+ if (!path47) {
48985
48985
  throw new InvalidArgumentError2("Snapshot path is required");
48986
48986
  }
48987
48987
  try {
48988
- const data = await readFile(resolve2(path46), "utf8");
48988
+ const data = await readFile(resolve2(path47), "utf8");
48989
48989
  const parsed = JSON.parse(data);
48990
48990
  if (Array.isArray(parsed)) {
48991
48991
  this.#snapshots.clear();
@@ -48999,7 +48999,7 @@ var require_snapshot_recorder = __commonJS({
48999
48999
  if (error62.code === "ENOENT") {
49000
49000
  this.#snapshots.clear();
49001
49001
  } else {
49002
- throw new UndiciError(`Failed to load snapshots from ${path46}`, { cause: error62 });
49002
+ throw new UndiciError(`Failed to load snapshots from ${path47}`, { cause: error62 });
49003
49003
  }
49004
49004
  }
49005
49005
  }
@@ -49010,11 +49010,11 @@ var require_snapshot_recorder = __commonJS({
49010
49010
  * @returns {Promise<void>} - Resolves when snapshots are saved
49011
49011
  */
49012
49012
  async saveSnapshots(filePath) {
49013
- const path46 = filePath || this.#snapshotPath;
49014
- if (!path46) {
49013
+ const path47 = filePath || this.#snapshotPath;
49014
+ if (!path47) {
49015
49015
  throw new InvalidArgumentError2("Snapshot path is required");
49016
49016
  }
49017
- const resolvedPath = resolve2(path46);
49017
+ const resolvedPath = resolve2(path47);
49018
49018
  await mkdir(dirname3(resolvedPath), { recursive: true });
49019
49019
  const data = Array.from(this.#snapshots.entries()).map(([hash2, snapshot]) => ({
49020
49020
  hash: hash2,
@@ -49646,15 +49646,15 @@ var require_redirect_handler = __commonJS({
49646
49646
  return;
49647
49647
  }
49648
49648
  const { origin, pathname, search } = util.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)));
49649
- const path46 = search ? `${pathname}${search}` : pathname;
49650
- const redirectUrlString = `${origin}${path46}`;
49649
+ const path47 = search ? `${pathname}${search}` : pathname;
49650
+ const redirectUrlString = `${origin}${path47}`;
49651
49651
  for (const historyUrl of this.history) {
49652
49652
  if (historyUrl.toString() === redirectUrlString) {
49653
49653
  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.`);
49654
49654
  }
49655
49655
  }
49656
49656
  this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin);
49657
- this.opts.path = path46;
49657
+ this.opts.path = path47;
49658
49658
  this.opts.origin = origin;
49659
49659
  this.opts.query = null;
49660
49660
  }
@@ -51414,10 +51414,10 @@ var require_cache_handler = __commonJS({
51414
51414
  }
51415
51415
  return locationUrl.pathname + locationUrl.search;
51416
51416
  }
51417
- function deleteCachedUri(store, cacheKey, path46) {
51417
+ function deleteCachedUri(store, cacheKey, path47) {
51418
51418
  deleteCachedValue(store, {
51419
51419
  ...cacheKey,
51420
- path: path46
51420
+ path: path47
51421
51421
  });
51422
51422
  for (let i10 = 0; i10 < util.safeHTTPMethods.length; i10++) {
51423
51423
  const method = util.safeHTTPMethods[i10];
@@ -51425,7 +51425,7 @@ var require_cache_handler = __commonJS({
51425
51425
  deleteCachedValue(store, {
51426
51426
  ...cacheKey,
51427
51427
  method,
51428
- path: path46
51428
+ path: path47
51429
51429
  });
51430
51430
  }
51431
51431
  }
@@ -51436,9 +51436,9 @@ var require_cache_handler = __commonJS({
51436
51436
  }
51437
51437
  const values = Array.isArray(headerValue2) ? headerValue2 : [headerValue2];
51438
51438
  for (let i10 = 0; i10 < values.length; i10++) {
51439
- const path46 = getSameOriginPath(cacheKey, values[i10]);
51440
- if (path46 !== void 0) {
51441
- deleteCachedUri(store, cacheKey, path46);
51439
+ const path47 = getSameOriginPath(cacheKey, values[i10]);
51440
+ if (path47 !== void 0) {
51441
+ deleteCachedUri(store, cacheKey, path47);
51442
51442
  }
51443
51443
  }
51444
51444
  }
@@ -56438,11 +56438,11 @@ var require_fetch = __commonJS({
56438
56438
  function dispatch({ body }) {
56439
56439
  const url2 = requestCurrentURL(request7);
56440
56440
  const agent = fetchParams.controller.dispatcher;
56441
- const path46 = url2.pathname + url2.search;
56441
+ const path47 = url2.pathname + url2.search;
56442
56442
  const hasTrailingQuestionMark = url2.search.length === 0 && url2.href[url2.href.length - url2.hash.length - 1] === "?";
56443
56443
  return new Promise((resolve2, reject) => agent.dispatch(
56444
56444
  {
56445
- path: hasTrailingQuestionMark ? `${path46}?` : path46,
56445
+ path: hasTrailingQuestionMark ? `${path47}?` : path47,
56446
56446
  origin: url2.origin,
56447
56447
  method: request7.method,
56448
56448
  body: agent.isMockActive ? request7.body && (request7.body.source || request7.body.stream) : body,
@@ -57389,9 +57389,9 @@ var require_util5 = __commonJS({
57389
57389
  }
57390
57390
  }
57391
57391
  }
57392
- function validateCookiePath(path46) {
57393
- for (let i10 = 0; i10 < path46.length; ++i10) {
57394
- const code = path46.charCodeAt(i10);
57392
+ function validateCookiePath(path47) {
57393
+ for (let i10 = 0; i10 < path47.length; ++i10) {
57394
+ const code = path47.charCodeAt(i10);
57395
57395
  if (code < 32 || // exclude CTLs (0-31)
57396
57396
  code > 126 || // exclude DEL and non-ascii
57397
57397
  code === 59) {
@@ -60739,11 +60739,11 @@ var require_undici = __commonJS({
60739
60739
  if (typeof opts.path !== "string") {
60740
60740
  throw new InvalidArgumentError2("invalid opts.path");
60741
60741
  }
60742
- let path46 = opts.path;
60742
+ let path47 = opts.path;
60743
60743
  if (!opts.path.startsWith("/")) {
60744
- path46 = `/${path46}`;
60744
+ path47 = `/${path47}`;
60745
60745
  }
60746
- url2 = new URL(util.parseOrigin(url2).origin + path46);
60746
+ url2 = new URL(util.parseOrigin(url2).origin + path47);
60747
60747
  } else {
60748
60748
  if (!opts) {
60749
60749
  opts = typeof url2 === "object" ? url2 : {};
@@ -96322,7 +96322,7 @@ var init_realAnthropicUsageProbe = __esm({
96322
96322
  });
96323
96323
 
96324
96324
  // src/cli.ts
96325
- var import_node_path45 = __toESM(require("node:path"), 1);
96325
+ var import_node_path46 = __toESM(require("node:path"), 1);
96326
96326
 
96327
96327
  // node_modules/.pnpm/commander@15.0.0/node_modules/commander/lib/error.js
96328
96328
  var CommanderError = class extends Error {
@@ -99435,9 +99435,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
99435
99435
  * @param {string} [path]
99436
99436
  * @return {(string|null|Command)}
99437
99437
  */
99438
- executableDir(path46) {
99439
- if (path46 === void 0) return this._executableDir;
99440
- this._executableDir = path46;
99438
+ executableDir(path47) {
99439
+ if (path47 === void 0) return this._executableDir;
99440
+ this._executableDir = path47;
99441
99441
  return this;
99442
99442
  }
99443
99443
  /**
@@ -101044,19 +101044,19 @@ function writePools(paths, pools) {
101044
101044
  applyPatch(paths.globalConfigFile, GlobalConfigSchema, { pools }, { defaults: {} });
101045
101045
  }
101046
101046
  function poolCycleOf(pools, name) {
101047
- const walk = (current, path46) => {
101047
+ const walk = (current, path47) => {
101048
101048
  for (const entry of pools[current]?.identities ?? []) {
101049
101049
  const nested = poolNameOf(poolMemberIdentity(entry));
101050
101050
  if (nested === void 0) {
101051
101051
  continue;
101052
101052
  }
101053
101053
  if (nested === name) {
101054
- return [...path46, nested];
101054
+ return [...path47, nested];
101055
101055
  }
101056
- if (path46.includes(nested)) {
101056
+ if (path47.includes(nested)) {
101057
101057
  continue;
101058
101058
  }
101059
- const found = walk(nested, [...path46, nested]);
101059
+ const found = walk(nested, [...path47, nested]);
101060
101060
  if (found !== void 0) {
101061
101061
  return found;
101062
101062
  }
@@ -103871,7 +103871,7 @@ function registerCodexCommand(program2, deps) {
103871
103871
 
103872
103872
  // src/frontdoor/commands.ts
103873
103873
  var import_node_crypto20 = require("node:crypto");
103874
- var import_node_path41 = __toESM(require("node:path"), 1);
103874
+ var import_node_path42 = __toESM(require("node:path"), 1);
103875
103875
  var import_node_fs15 = __toESM(require("node:fs"), 1);
103876
103876
  init_commandDeps();
103877
103877
  init_schema();
@@ -104465,12 +104465,22 @@ init_capability();
104465
104465
  init_route();
104466
104466
 
104467
104467
  // src/frontdoor/supervisor.ts
104468
+ var import_node_path37 = __toESM(require("node:path"), 1);
104468
104469
  init_state2();
104470
+ function watchedInstallEntry(resolvedOwnExecutablePath, siblingExists) {
104471
+ const parsed = import_node_path37.default.parse(resolvedOwnExecutablePath);
104472
+ if (parsed.name === "agent-shim") {
104473
+ return resolvedOwnExecutablePath;
104474
+ }
104475
+ const sibling = import_node_path37.default.join(parsed.dir, `agent-shim${parsed.ext}`);
104476
+ return siblingExists(sibling) ? sibling : resolvedOwnExecutablePath;
104477
+ }
104469
104478
  var FRONTDOOR_SUPERVISOR_STILL_RUNNING = -1;
104470
104479
  var FRONTDOOR_POLL_MS = 1e3;
104471
104480
  var MS_PER_MINUTE2 = 6e4;
104472
104481
  async function runFrontDoorSupervisor(idleShutdownMinutes, ports, options = {}) {
104473
104482
  const { fs: fs21, paths } = ports;
104483
+ const servingBinary = ports.statOwnExecutable();
104474
104484
  const previous = readFrontDoorState(fs21, paths.frontdoorStateFile);
104475
104485
  let lastPort = previous?.lastPort;
104476
104486
  let lastConnectPort = previous?.lastConnectPort;
@@ -104533,6 +104543,18 @@ async function runFrontDoorSupervisor(idleShutdownMinutes, ports, options = {})
104533
104543
  ports.log(`agent-shim frontdoor supervisor ${String(ports.ownPid)}: front door on 127.0.0.1:${String(http8.port)}, CONNECT surface on 127.0.0.1:${String(connect3.port)}`);
104534
104544
  let idleSince;
104535
104545
  let ticks = 0;
104546
+ const binaryReplaced = () => {
104547
+ const current = ports.statOwnExecutable();
104548
+ return current !== void 0 && servingBinary !== void 0 && (current.dev !== servingBinary.dev || current.ino !== servingBinary.ino || current.size !== servingBinary.size || current.mtimeMs !== servingBinary.mtimeMs);
104549
+ };
104550
+ const shutdown = async () => {
104551
+ await direct.close();
104552
+ await connect3.close();
104553
+ await http8.close();
104554
+ ports.closeRcStreamHub();
104555
+ writeFrontDoorState(fs21, paths.frontdoorStateFile, sticky());
104556
+ return 0;
104557
+ };
104536
104558
  for (; ; ) {
104537
104559
  if (options.tickLimit !== void 0 && ticks >= options.tickLimit) {
104538
104560
  return FRONTDOOR_SUPERVISOR_STILL_RUNNING;
@@ -104544,16 +104566,16 @@ async function runFrontDoorSupervisor(idleShutdownMinutes, ports, options = {})
104544
104566
  ports.checkQuotaExpiry();
104545
104567
  const prunedPids = new Set(pruned);
104546
104568
  if (listed.filter((session) => !prunedPids.has(session.pid)).length === 0) {
104569
+ if (ticks > 1 && binaryReplaced()) {
104570
+ ports.log("agent-shim frontdoor supervisor: the installed binary changed and no sessions are live; turning the door over for the next launch");
104571
+ ports.doorHealth.binaryTurnover();
104572
+ return await shutdown();
104573
+ }
104547
104574
  idleSince ??= ports.now();
104548
104575
  if (ports.now() - idleSince >= idleShutdownMinutes * MS_PER_MINUTE2) {
104549
104576
  ports.log(`agent-shim frontdoor supervisor: no sessions for ${String(idleShutdownMinutes)} minute(s); closing the front door and exiting`);
104550
104577
  ports.doorHealth.idleShutdown();
104551
- await direct.close();
104552
- await connect3.close();
104553
- await http8.close();
104554
- ports.closeRcStreamHub();
104555
- writeFrontDoorState(fs21, paths.frontdoorStateFile, sticky());
104556
- return 0;
104578
+ return await shutdown();
104557
104579
  }
104558
104580
  } else {
104559
104581
  idleSince = void 0;
@@ -104605,8 +104627,8 @@ function parseConnectTarget(authority) {
104605
104627
  }
104606
104628
  return { host, port };
104607
104629
  }
104608
- function servedByPipeline(path46) {
104609
- return path46?.startsWith(ROUTED_PATH_PREFIX) === true;
104630
+ function servedByPipeline(path47) {
104631
+ return path47?.startsWith(ROUTED_PATH_PREFIX) === true;
104610
104632
  }
104611
104633
  var HOP_BY_HOP_HEADERS = /* @__PURE__ */ new Set([
104612
104634
  "connection",
@@ -105125,11 +105147,11 @@ function createRcSessionTracker(deps) {
105125
105147
  };
105126
105148
  const observeExchange = (request7) => {
105127
105149
  const method = (request7.method ?? "").toUpperCase();
105128
- const path46 = new URL(request7.url ?? "/", "http://127.0.0.1").pathname;
105129
- if (!path46.startsWith(RC_SESSIONS_PATH_PREFIX)) {
105150
+ const path47 = new URL(request7.url ?? "/", "http://127.0.0.1").pathname;
105151
+ if (!path47.startsWith(RC_SESSIONS_PATH_PREFIX)) {
105130
105152
  return void 0;
105131
105153
  }
105132
- const tail = path46.slice(RC_SESSIONS_PATH_PREFIX.length);
105154
+ const tail = path47.slice(RC_SESSIONS_PATH_PREFIX.length);
105133
105155
  const facts = {
105134
105156
  oauthAuthorization: oauthAuthorizationOf(request7.headers),
105135
105157
  anthropicVersion: singleHeader(request7.headers, "anthropic-version"),
@@ -105490,8 +105512,8 @@ var RC_READ_FILE_ENCODINGS = ["utf-8", "base64"];
105490
105512
  function isRcReadFileEncoding(value2) {
105491
105513
  return RC_READ_FILE_ENCODINGS.some((encoding) => encoding === value2);
105492
105514
  }
105493
- function buildRcReadFilePayload(requestId, path46, options) {
105494
- return buildRcControlRequestPayload(requestId, { subtype: "read_file", path: path46, ...options?.maxBytes === void 0 ? {} : { max_bytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } });
105515
+ function buildRcReadFilePayload(requestId, path47, options) {
105516
+ return buildRcControlRequestPayload(requestId, { subtype: "read_file", path: path47, ...options?.maxBytes === void 0 ? {} : { max_bytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } });
105495
105517
  }
105496
105518
  function buildRcFileSuggestionsPayload(requestId, query) {
105497
105519
  return buildRcControlRequestPayload(requestId, { subtype: "file_suggestions", query });
@@ -105593,15 +105615,15 @@ async function getRcSessionContextUsage(deps, sessionId, detail) {
105593
105615
  const result = await deliverRcClientPayload(deps, sessionId, buildRcGetContextUsagePayload(requestId, detail), `request the context usage of session ${sessionId}`);
105594
105616
  return result.ok ? { ...result, requestId } : result;
105595
105617
  }
105596
- async function readRcSessionFile(deps, sessionId, path46, options) {
105597
- if (path46 === "") {
105618
+ async function readRcSessionFile(deps, sessionId, path47, options) {
105619
+ if (path47 === "") {
105598
105620
  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" };
105599
105621
  }
105600
105622
  if (options?.maxBytes !== void 0 && (!Number.isInteger(options.maxBytes) || options.maxBytes <= 0)) {
105601
105623
  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" };
105602
105624
  }
105603
105625
  const requestId = deps.newUuid();
105604
- const result = await deliverRcClientPayload(deps, sessionId, buildRcReadFilePayload(requestId, path46, options), `read ${path46} from session ${sessionId}`);
105626
+ const result = await deliverRcClientPayload(deps, sessionId, buildRcReadFilePayload(requestId, path47, options), `read ${path47} from session ${sessionId}`);
105605
105627
  return result.ok ? { ...result, requestId } : result;
105606
105628
  }
105607
105629
  async function suggestRcSessionFiles(deps, sessionId, query) {
@@ -105772,11 +105794,11 @@ function createRcControlHandler(deps) {
105772
105794
  path: "read-file",
105773
105795
  read: (body) => {
105774
105796
  const session = bodyString(body, "session");
105775
- const path46 = bodyString(body, "path");
105797
+ const path47 = bodyString(body, "path");
105776
105798
  const maxBytes = "maxBytes" in body ? bodyPositiveInteger(body, "maxBytes") : void 0;
105777
105799
  const encoding = "encoding" in body && isRcReadFileEncoding(body.encoding) ? body.encoding : void 0;
105778
- const refused2 = session === void 0 || path46 === void 0 || "maxBytes" in body && maxBytes === void 0 || "encoding" in body && encoding === void 0;
105779
- 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, path46, { ...maxBytes === void 0 ? {} : { maxBytes }, ...encoding === void 0 ? {} : { encoding } }) };
105800
+ const refused2 = session === void 0 || path47 === void 0 || "maxBytes" in body && maxBytes === void 0 || "encoding" in body && encoding === void 0;
105801
+ 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, path47, { ...maxBytes === void 0 ? {} : { maxBytes }, ...encoding === void 0 ? {} : { encoding } }) };
105780
105802
  }
105781
105803
  },
105782
105804
  {
@@ -106086,9 +106108,9 @@ function requestIdOfBody(body) {
106086
106108
  }
106087
106109
  function frontDoorRcControl(transport, token) {
106088
106110
  const headers = { authorization: `Bearer ${token}` };
106089
- const listAnswerOf = async (path46, what) => {
106111
+ const listAnswerOf = async (path47, what) => {
106090
106112
  try {
106091
- return await transport.request({ method: "GET", path: path46, headers });
106113
+ return await transport.request({ method: "GET", path: path47, headers });
106092
106114
  } catch (error62) {
106093
106115
  throw new Error(`${what}: could not reach the front door's control listener: ${error62 instanceof Error ? error62.message : String(error62)}`, { cause: error62 });
106094
106116
  }
@@ -106160,10 +106182,10 @@ function frontDoorRcControl(transport, token) {
106160
106182
  }
106161
106183
  return pending;
106162
106184
  };
106163
- const writeOf = async (path46, body, describeFailure) => {
106185
+ const writeOf = async (path47, body, describeFailure) => {
106164
106186
  let answer;
106165
106187
  try {
106166
- answer = await transport.request({ method: "POST", path: path46, headers: { ...headers, "content-type": "application/json" }, body });
106188
+ answer = await transport.request({ method: "POST", path: path47, headers: { ...headers, "content-type": "application/json" }, body });
106167
106189
  } catch (error62) {
106168
106190
  return { ok: false, message: `could not reach the front door's control listener: ${error62 instanceof Error ? error62.message : String(error62)}` };
106169
106191
  }
@@ -106194,10 +106216,10 @@ function frontDoorRcControl(transport, token) {
106194
106216
  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}`),
106195
106217
  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}`),
106196
106218
  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}`),
106197
- readFile: async (sessionId, path46, options) => await writeOf(
106219
+ readFile: async (sessionId, path47, options) => await writeOf(
106198
106220
  `${CONTROL_PATH_PREFIX}/read-file`,
106199
- JSON.stringify({ session: sessionId, path: path46, ...options?.maxBytes === void 0 ? {} : { maxBytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } }),
106200
- (status, message) => `reading ${path46} from ${sessionId} failed (HTTP ${String(status)}): ${message}`
106221
+ JSON.stringify({ session: sessionId, path: path47, ...options?.maxBytes === void 0 ? {} : { maxBytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } }),
106222
+ (status, message) => `reading ${path47} from ${sessionId} failed (HTTP ${String(status)}): ${message}`
106201
106223
  ),
106202
106224
  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}`),
106203
106225
  keepAlive: async (sessionId) => await writeOf(`${CONTROL_PATH_PREFIX}/keep-alive`, JSON.stringify({ session: sessionId }), (status, message) => `keeping ${sessionId} alive failed (HTTP ${String(status)}): ${message}`),
@@ -106487,12 +106509,12 @@ function tlsFacts(options) {
106487
106509
  }
106488
106510
  function realRcEventDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_PORT }) {
106489
106511
  const agent = new ExemptTlsAgent();
106490
- const post = async (path46, headers, body) => await new Promise((resolve2, reject) => {
106512
+ const post = async (path47, headers, body) => await new Promise((resolve2, reject) => {
106491
106513
  const options = {
106492
106514
  host: target.host,
106493
106515
  port: target.port,
106494
106516
  method: "POST",
106495
- path: path46,
106517
+ path: path47,
106496
106518
  // 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.
106497
106519
  headers: { ...headers, host: target.servername ?? target.host, "content-length": String(Buffer.byteLength(body, "utf8")) },
106498
106520
  agent
@@ -106557,12 +106579,12 @@ function lateRcStreamDial(resolve2) {
106557
106579
  }
106558
106580
  function realRcStreamDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_PORT }) {
106559
106581
  const agent = new ExemptTlsAgent();
106560
- const request7 = async (method, path46, headers, body, signal) => await new Promise((resolve2, reject) => {
106582
+ const request7 = async (method, path47, headers, body, signal) => await new Promise((resolve2, reject) => {
106561
106583
  const options = {
106562
106584
  host: target.host,
106563
106585
  port: target.port,
106564
106586
  method,
106565
- path: path46,
106587
+ path: path47,
106566
106588
  // 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.
106567
106589
  headers: { ...headers, host: target.servername ?? target.host, ...body === void 0 ? {} : { "content-length": String(Buffer.byteLength(body, "utf8")) } },
106568
106590
  agent,
@@ -106604,9 +106626,9 @@ function realRcStreamDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_P
106604
106626
  return { status, body: await readAll(response) };
106605
106627
  },
106606
106628
  openStream: async (sessionId, headers, resume, signal) => {
106607
- const path46 = resume === void 0 ? `/v1/code/sessions/${encodeURIComponent(sessionId)}/events/stream` : `/v1/code/sessions/${encodeURIComponent(sessionId)}/events/stream?from_sequence_num=${String(resume.fromSequenceNum)}`;
106629
+ const path47 = resume === void 0 ? `/v1/code/sessions/${encodeURIComponent(sessionId)}/events/stream` : `/v1/code/sessions/${encodeURIComponent(sessionId)}/events/stream?from_sequence_num=${String(resume.fromSequenceNum)}`;
106608
106630
  const streamHeaders = resume === void 0 ? headers : { ...headers, "last-event-id": String(resume.fromSequenceNum) };
106609
- const { status, response } = await request7("GET", path46, streamHeaders, void 0, signal);
106631
+ const { status, response } = await request7("GET", path47, streamHeaders, void 0, signal);
106610
106632
  if (!isSuccessful2(status)) {
106611
106633
  await readAll(response);
106612
106634
  return { status, chunks: NO_CHUNKS };
@@ -106822,7 +106844,7 @@ init_claudeShim();
106822
106844
  init_store();
106823
106845
  init_realPorts();
106824
106846
  var import_node_fs14 = __toESM(require("node:fs"), 1);
106825
- var import_node_path37 = __toESM(require("node:path"), 1);
106847
+ var import_node_path38 = __toESM(require("node:path"), 1);
106826
106848
  init_load();
106827
106849
  init_schema();
106828
106850
  init_credential();
@@ -106876,7 +106898,7 @@ function validateJson(schema, input2) {
106876
106898
  return { ok: true, data: result.data };
106877
106899
  }
106878
106900
  function pushPathResolution(push, resolution) {
106879
- const ownDir = import_node_path37.default.dirname(resolution.ownExecutablePath);
106901
+ const ownDir = import_node_path38.default.dirname(resolution.ownExecutablePath);
106880
106902
  switch (resolution.agentShim.status) {
106881
106903
  case "ok":
106882
106904
  push("path-resolution", "pass", `\`agent-shim\` on PATH resolves to this running executable, ${resolution.ownExecutablePath}.`, "agent-shim");
@@ -106975,14 +106997,14 @@ function pushProvider(push, entry, cacheEnv, signIn) {
106975
106997
  }
106976
106998
  function pushLegacyName(push, params) {
106977
106999
  const legacyVariables = Object.keys(params.env).filter((name) => name.startsWith(LEGACY_ENV_PREFIX) && params.env[name] !== void 0).sort();
106978
- if (legacyVariables.length === 0 && import_node_path37.default.basename(params.rootPath) !== LEGACY_HOME_DIRNAME) {
107000
+ if (legacyVariables.length === 0 && import_node_path38.default.basename(params.rootPath) !== LEGACY_HOME_DIRNAME) {
106979
107001
  push("legacy-name", "pass", "Nothing here still uses the former `claude-use` name.");
106980
107002
  return;
106981
107003
  }
106982
107004
  for (const name of legacyVariables) {
106983
107005
  push("legacy-name", "warn", `${name} is the former name of ${name.replace(LEGACY_ENV_PREFIX, ENV_PREFIX)}. Rename it; the old name still works but is only a fallback.`, name);
106984
107006
  }
106985
- if (import_node_path37.default.basename(params.rootPath) === LEGACY_HOME_DIRNAME) {
107007
+ if (import_node_path38.default.basename(params.rootPath) === LEGACY_HOME_DIRNAME) {
106986
107008
  push(
106987
107009
  "legacy-name",
106988
107010
  "warn",
@@ -107322,18 +107344,18 @@ function collectDoctorReport(params) {
107322
107344
  const { paths } = params;
107323
107345
  const identityNames = import_node_fs14.default.existsSync(paths.identitiesDir) ? import_node_fs14.default.readdirSync(paths.identitiesDir, { withFileTypes: true }).filter((entry) => entry.isDirectory() && isIdentityDirectoryName(entry.name)).map((entry) => entry.name).sort() : [];
107324
107346
  const identities = identityNames.map((name) => {
107325
- const farmRoot = import_node_path37.default.join(paths.identitiesDir, name);
107326
- const identityPath = import_node_path37.default.join(farmRoot, "identity.json");
107347
+ const farmRoot = import_node_path38.default.join(paths.identitiesDir, name);
107348
+ const identityPath = import_node_path38.default.join(farmRoot, "identity.json");
107327
107349
  return { name, path: identityPath, raw: realFsPort.readFileUtf8(identityPath), farmRoot };
107328
107350
  });
107329
107351
  const profileNames = import_node_fs14.default.existsSync(paths.configProfilesDir) ? import_node_fs14.default.readdirSync(paths.configProfilesDir, { withFileTypes: true }).filter((entry) => entry.isFile() && entry.name.endsWith(".json")).map((entry) => entry.name.slice(0, -".json".length)).sort() : [];
107330
107352
  const configProfiles = profileNames.map((name) => {
107331
- const profilePath = import_node_path37.default.join(paths.configProfilesDir, `${name}.json`);
107353
+ const profilePath = import_node_path38.default.join(paths.configProfilesDir, `${name}.json`);
107332
107354
  return { name, path: profilePath, raw: realFsPort.readFileUtf8(profilePath) };
107333
107355
  });
107334
107356
  const providerNames = import_node_fs14.default.existsSync(paths.providersDir) ? import_node_fs14.default.readdirSync(paths.providersDir, { withFileTypes: true }).filter((entry) => entry.isFile() && entry.name.endsWith(".json")).map((entry) => entry.name.slice(0, -".json".length)).sort() : [];
107335
107357
  const providers = providerNames.map((name) => {
107336
- const providerPath = import_node_path37.default.join(paths.providersDir, `${name}.json`);
107358
+ const providerPath = import_node_path38.default.join(paths.providersDir, `${name}.json`);
107337
107359
  return { name, path: providerPath, raw: realFsPort.readFileUtf8(providerPath) };
107338
107360
  });
107339
107361
  const ownExecutablePath = realOwnExecutablePath();
@@ -107345,12 +107367,12 @@ function collectDoctorReport(params) {
107345
107367
  binaryDiscovery = { ok: false, message: error62 instanceof Error ? error62.message : String(error62) };
107346
107368
  }
107347
107369
  const shimState = readJson(paths.claudeShimFile, ClaudeShimStateSchema);
107348
- const pathDirs = (params.env.PATH ?? "").split(import_node_path37.default.delimiter).filter((dir) => dir !== "");
107370
+ const pathDirs = (params.env.PATH ?? "").split(import_node_path38.default.delimiter).filter((dir) => dir !== "");
107349
107371
  const claudeShimShadow = shimState === void 0 ? void 0 : refinePathShadow(
107350
107372
  findPathShadow({
107351
107373
  pathDirs,
107352
- targetDir: import_node_path37.default.dirname(shimState.targetPath),
107353
- targetFilename: import_node_path37.default.basename(shimState.targetPath),
107374
+ targetDir: import_node_path38.default.dirname(shimState.targetPath),
107375
+ targetFilename: import_node_path38.default.basename(shimState.targetPath),
107354
107376
  findExecutableInDir
107355
107377
  }),
107356
107378
  shimState.targetPath,
@@ -107376,7 +107398,7 @@ function collectDoctorReport(params) {
107376
107398
  agentShim: refinePathShadow(
107377
107399
  findPathShadow({
107378
107400
  pathDirs,
107379
- targetDir: import_node_path37.default.dirname(ownExecutablePath),
107401
+ targetDir: import_node_path38.default.dirname(ownExecutablePath),
107380
107402
  targetFilename: commandFilename(ownExecutablePath, "agent-shim"),
107381
107403
  findExecutableInDir
107382
107404
  }),
@@ -108341,9 +108363,9 @@ function resolveFriendlyClientOptions(options) {
108341
108363
  };
108342
108364
  }
108343
108365
  function createORPCClient(link, options = {}) {
108344
- const path46 = options.path ?? [];
108366
+ const path47 = options.path ?? [];
108345
108367
  const procedureClient = async (...[input2, options2 = {}]) => {
108346
- return await link.call(path46, input2, resolveFriendlyClientOptions(options2));
108368
+ return await link.call(path47, input2, resolveFriendlyClientOptions(options2));
108347
108369
  };
108348
108370
  const recursive2 = new Proxy(procedureClient, {
108349
108371
  get(target, key) {
@@ -108352,7 +108374,7 @@ function createORPCClient(link, options = {}) {
108352
108374
  }
108353
108375
  return createORPCClient(link, {
108354
108376
  ...options,
108355
- path: [...path46, key]
108377
+ path: [...path47, key]
108356
108378
  });
108357
108379
  }
108358
108380
  });
@@ -108549,7 +108571,7 @@ init_middleware();
108549
108571
  init_preflight();
108550
108572
 
108551
108573
  // src/frontdoor/controlSchemas.ts
108552
- var import_node_path38 = __toESM(require("node:path"), 1);
108574
+ var import_node_path39 = __toESM(require("node:path"), 1);
108553
108575
  init_zod();
108554
108576
  init_schema2();
108555
108577
 
@@ -108761,11 +108783,11 @@ var FrontDoorSessionsOutputSchema = external_exports.strictObject({ sessions: ex
108761
108783
  var CheckRunInputSchema = external_exports.strictObject({
108762
108784
  path: external_exports.string().min(1),
108763
108785
  identity: external_exports.string().min(1).optional()
108764
- }).refine((input2) => import_node_path38.default.isAbsolute(input2.path), { message: "path must be absolute: the door cannot resolve a relative path against the caller's working directory" });
108786
+ }).refine((input2) => import_node_path39.default.isAbsolute(input2.path), { message: "path must be absolute: the door cannot resolve a relative path against the caller's working directory" });
108765
108787
  var PoolPickInputSchema = external_exports.strictObject({
108766
108788
  pool: external_exports.string().min(1),
108767
108789
  path: external_exports.string().min(1)
108768
- }).refine((input2) => import_node_path38.default.isAbsolute(input2.path), { message: "path must be absolute: the door cannot resolve a relative path against the caller's working directory" });
108790
+ }).refine((input2) => import_node_path39.default.isAbsolute(input2.path), { message: "path must be absolute: the door cannot resolve a relative path against the caller's working directory" });
108769
108791
  var DoctorFindingSchema = external_exports.strictObject({
108770
108792
  section: external_exports.enum(DOCTOR_SECTIONS),
108771
108793
  subject: external_exports.string().optional(),
@@ -109123,19 +109145,19 @@ var StandardLink = class {
109123
109145
  }
109124
109146
  interceptors;
109125
109147
  clientInterceptors;
109126
- call(path46, input2, options) {
109148
+ call(path47, input2, options) {
109127
109149
  return runWithSpan(
109128
- { name: `${ORPC_NAME}.${path46.join("/")}`, signal: options.signal },
109150
+ { name: `${ORPC_NAME}.${path47.join("/")}`, signal: options.signal },
109129
109151
  (span) => {
109130
109152
  span?.setAttribute("rpc.system", ORPC_NAME);
109131
- span?.setAttribute("rpc.method", path46.join("."));
109153
+ span?.setAttribute("rpc.method", path47.join("."));
109132
109154
  if (isAsyncIteratorObject(input2)) {
109133
109155
  input2 = asyncIteratorWithSpan(
109134
109156
  { name: "consume_event_iterator_input", signal: options.signal },
109135
109157
  input2
109136
109158
  );
109137
109159
  }
109138
- return intercept(this.interceptors, { ...options, path: path46, input: input2 }, async ({ path: path210, input: input22, ...options2 }) => {
109160
+ return intercept(this.interceptors, { ...options, path: path47, input: input2 }, async ({ path: path210, input: input22, ...options2 }) => {
109139
109161
  const otelConfig = getGlobalOtelConfig();
109140
109162
  let otelContext;
109141
109163
  const currentSpan = otelConfig?.trace.getActiveSpan() ?? span;
@@ -109370,8 +109392,8 @@ var StandardRPCJsonSerializer = class {
109370
109392
  return ref.data;
109371
109393
  }
109372
109394
  };
109373
- function toHttpPath(path46) {
109374
- return `/${path46.map(encodeURIComponent).join("/")}`;
109395
+ function toHttpPath(path47) {
109396
+ return `/${path47.map(encodeURIComponent).join("/")}`;
109375
109397
  }
109376
109398
  function toStandardHeaders2(headers) {
109377
109399
  if (typeof headers.forEach === "function") {
@@ -109396,18 +109418,18 @@ var StandardRPCLinkCodec = class {
109396
109418
  fallbackMethod;
109397
109419
  expectedMethod;
109398
109420
  headers;
109399
- async encode(path46, input2, options) {
109400
- let headers = toStandardHeaders2(await value(this.headers, options, path46, input2));
109421
+ async encode(path47, input2, options) {
109422
+ let headers = toStandardHeaders2(await value(this.headers, options, path47, input2));
109401
109423
  if (options.lastEventId !== void 0) {
109402
109424
  headers = mergeStandardHeaders(headers, { "last-event-id": options.lastEventId });
109403
109425
  }
109404
- const expectedMethod = await value(this.expectedMethod, options, path46, input2);
109405
- const baseUrl = await value(this.baseUrl, options, path46, input2);
109426
+ const expectedMethod = await value(this.expectedMethod, options, path47, input2);
109427
+ const baseUrl = await value(this.baseUrl, options, path47, input2);
109406
109428
  const url2 = new URL(baseUrl);
109407
- url2.pathname = `${url2.pathname.replace(/\/$/, "")}${toHttpPath(path46)}`;
109429
+ url2.pathname = `${url2.pathname.replace(/\/$/, "")}${toHttpPath(path47)}`;
109408
109430
  const serialized = this.serializer.serialize(input2);
109409
109431
  if (expectedMethod === "GET" && !(serialized instanceof FormData) && !isAsyncIteratorObject(serialized)) {
109410
- const maxUrlLength = await value(this.maxUrlLength, options, path46, input2);
109432
+ const maxUrlLength = await value(this.maxUrlLength, options, path47, input2);
109411
109433
  const getUrl = new URL(url2);
109412
109434
  getUrl.searchParams.append("data", stringifyJSON(serialized));
109413
109435
  if (getUrl.toString().length <= maxUrlLength) {
@@ -109881,7 +109903,7 @@ function middlewareOutputFn(output2) {
109881
109903
  function createProcedureClient(lazyableProcedure, ...rest) {
109882
109904
  const options = resolveMaybeOptionalOptions(rest);
109883
109905
  return async (...[input2, callerOptions]) => {
109884
- const path46 = toArray(options.path);
109906
+ const path47 = toArray(options.path);
109885
109907
  const { default: procedure } = await unlazy(lazyableProcedure);
109886
109908
  const clientContext = callerOptions?.context ?? {};
109887
109909
  const context = await value(options.context ?? {}, clientContext);
@@ -109896,7 +109918,7 @@ function createProcedureClient(lazyableProcedure, ...rest) {
109896
109918
  const output2 = await runWithSpan(
109897
109919
  { name: "call_procedure", signal: callerOptions?.signal },
109898
109920
  (span) => {
109899
- span?.setAttribute("procedure.path", [...path46]);
109921
+ span?.setAttribute("procedure.path", [...path47]);
109900
109922
  return intercept(
109901
109923
  toArray(options.interceptors),
109902
109924
  {
@@ -109904,7 +109926,7 @@ function createProcedureClient(lazyableProcedure, ...rest) {
109904
109926
  input: input2,
109905
109927
  // input only optional when it undefinable so we can safely cast it
109906
109928
  errors,
109907
- path: path46,
109929
+ path: path47,
109908
109930
  procedure,
109909
109931
  signal: callerOptions?.signal,
109910
109932
  lastEventId: callerOptions?.lastEventId
@@ -110026,10 +110048,10 @@ var HIDDEN_ROUTER_CONTRACT_SYMBOL = /* @__PURE__ */ Symbol("ORPC_HIDDEN_ROUTER_C
110026
110048
  function getHiddenRouterContract(router) {
110027
110049
  return router[HIDDEN_ROUTER_CONTRACT_SYMBOL];
110028
110050
  }
110029
- function getRouter(router, path46) {
110051
+ function getRouter(router, path47) {
110030
110052
  let current = router;
110031
- for (let i10 = 0; i10 < path46.length; i10++) {
110032
- const segment = path46[i10];
110053
+ for (let i10 = 0; i10 < path47.length; i10++) {
110054
+ const segment = path47[i10];
110033
110055
  if (!current) {
110034
110056
  return void 0;
110035
110057
  }
@@ -110044,7 +110066,7 @@ function getRouter(router, path46) {
110044
110066
  continue;
110045
110067
  }
110046
110068
  const lazied = current;
110047
- const rest = path46.slice(i10);
110069
+ const rest = path47.slice(i10);
110048
110070
  return lazy2(async () => {
110049
110071
  const unwrapped = await unlazy(lazied);
110050
110072
  const next = getRouter(unwrapped.default, rest);
@@ -110521,11 +110543,11 @@ var LinkFetchClient = class {
110521
110543
  this.toFetchRequestOptions = options;
110522
110544
  this.adapterInterceptors = toArray(options.adapterInterceptors);
110523
110545
  }
110524
- async call(standardRequest, options, path46, input2) {
110546
+ async call(standardRequest, options, path47, input2) {
110525
110547
  const request7 = toFetchRequest(standardRequest, this.toFetchRequestOptions);
110526
110548
  const fetchResponse = await intercept(
110527
110549
  this.adapterInterceptors,
110528
- { ...options, request: request7, path: path46, input: input2, init: { redirect: "manual" } },
110550
+ { ...options, request: request7, path: path47, input: input2, init: { redirect: "manual" } },
110529
110551
  ({ request: request22, path: path210, input: input22, init, ...options2 }) => this.fetch(request22, init, options2, path210, input22)
110530
110552
  );
110531
110553
  const lazyResponse = toStandardLazyResponse(fetchResponse, { signal: request7.signal });
@@ -110565,8 +110587,8 @@ var StandardBracketNotationSerializer = class {
110565
110587
  }
110566
110588
  const arrayPushStyles = /* @__PURE__ */ new WeakSet();
110567
110589
  const ref = { value: [] };
110568
- for (const [path46, value2] of serialized) {
110569
- const segments = this.parsePath(path46);
110590
+ for (const [path47, value2] of serialized) {
110591
+ const segments = this.parsePath(path47);
110570
110592
  let currentRef = ref;
110571
110593
  let nextSegment = "value";
110572
110594
  segments.forEach((segment, i10) => {
@@ -110638,14 +110660,14 @@ var StandardBracketNotationSerializer = class {
110638
110660
  return `${result}[${segment}]`;
110639
110661
  }, "");
110640
110662
  }
110641
- parsePath(path46) {
110663
+ parsePath(path47) {
110642
110664
  const segments = [];
110643
110665
  let inBrackets = false;
110644
110666
  let currentSegment = "";
110645
110667
  let backslashCount = 0;
110646
- for (let i10 = 0; i10 < path46.length; i10++) {
110647
- const char = path46[i10];
110648
- const nextChar = path46[i10 + 1];
110668
+ for (let i10 = 0; i10 < path47.length; i10++) {
110669
+ const char = path47[i10];
110670
+ const nextChar = path47[i10 + 1];
110649
110671
  if (inBrackets && char === "]" && (nextChar === void 0 || nextChar === "[") && backslashCount % 2 === 0) {
110650
110672
  if (nextChar === void 0) {
110651
110673
  inBrackets = false;
@@ -110664,7 +110686,7 @@ var StandardBracketNotationSerializer = class {
110664
110686
  backslashCount = 0;
110665
110687
  }
110666
110688
  }
110667
- return inBrackets || segments.length === 0 ? [path46] : segments;
110689
+ return inBrackets || segments.length === 0 ? [path47] : segments;
110668
110690
  }
110669
110691
  };
110670
110692
  function isValidArrayIndex(value2, maxIndex) {
@@ -110732,11 +110754,11 @@ var StandardOpenAPIJsonSerializer = class {
110732
110754
  return [data, hasBlobRef.value];
110733
110755
  }
110734
110756
  };
110735
- function standardizeHTTPPath(path46) {
110736
- return `/${path46.replace(/\/{2,}/g, "/").replace(/^\/|\/$/g, "")}`;
110757
+ function standardizeHTTPPath(path47) {
110758
+ return `/${path47.replace(/\/{2,}/g, "/").replace(/^\/|\/$/g, "")}`;
110737
110759
  }
110738
- function getDynamicParams(path46) {
110739
- return path46 ? standardizeHTTPPath(path46).match(/\/\{[^}]+\}/g)?.map((v) => ({
110760
+ function getDynamicParams(path47) {
110761
+ return path47 ? standardizeHTTPPath(path47).match(/\/\{[^}]+\}/g)?.map((v) => ({
110740
110762
  raw: v,
110741
110763
  name: v.match(/\{\+?([^}]+)\}/)[1]
110742
110764
  })) : void 0;
@@ -110767,9 +110789,9 @@ var StandardOpenAPISerializer = class {
110767
110789
  }
110768
110790
  if (options.outputFormat === "URLSearchParams") {
110769
110791
  const params = new URLSearchParams();
110770
- for (const [path46, value2] of this.bracketNotation.serialize(json2)) {
110792
+ for (const [path47, value2] of this.bracketNotation.serialize(json2)) {
110771
110793
  if (typeof value2 === "string" || typeof value2 === "number" || typeof value2 === "boolean") {
110772
- params.append(path46, value2.toString());
110794
+ params.append(path47, value2.toString());
110773
110795
  }
110774
110796
  }
110775
110797
  return params;
@@ -110778,11 +110800,11 @@ var StandardOpenAPISerializer = class {
110778
110800
  return json2;
110779
110801
  }
110780
110802
  const form = new FormData();
110781
- for (const [path46, value2] of this.bracketNotation.serialize(json2)) {
110803
+ for (const [path47, value2] of this.bracketNotation.serialize(json2)) {
110782
110804
  if (typeof value2 === "string" || typeof value2 === "number" || typeof value2 === "boolean") {
110783
- form.append(path46, value2.toString());
110805
+ form.append(path47, value2.toString());
110784
110806
  } else if (value2 instanceof Blob) {
110785
- form.append(path46, value2);
110807
+ form.append(path47, value2);
110786
110808
  }
110787
110809
  }
110788
110810
  return form;
@@ -111097,8 +111119,8 @@ function isPrimitiveSchema(schema) {
111097
111119
  return false;
111098
111120
  });
111099
111121
  }
111100
- function toOpenAPIPath(path46) {
111101
- return standardizeHTTPPath(path46).replace(/\/\{\+([^}]+)\}/g, "/{$1}");
111122
+ function toOpenAPIPath(path47) {
111123
+ return standardizeHTTPPath(path47).replace(/\/\{\+([^}]+)\}/g, "/{$1}");
111102
111124
  }
111103
111125
  function toOpenAPIMethod(method) {
111104
111126
  return method.toLocaleLowerCase();
@@ -111345,8 +111367,8 @@ var OpenAPIGenerator = class {
111345
111367
  * @see {@link https://orpc.dev/docs/openapi/openapi-specification OpenAPI Specification Docs}
111346
111368
  */
111347
111369
  async generate(router, { customErrorResponseBodySchema, commonSchemas, filter: baseFilter, exclude, ...baseDoc } = {}) {
111348
- const filter = baseFilter ?? (({ contract, path: path46 }) => {
111349
- return !(exclude?.(contract, path46) ?? false);
111370
+ const filter = baseFilter ?? (({ contract, path: path47 }) => {
111371
+ return !(exclude?.(contract, path47) ?? false);
111350
111372
  });
111351
111373
  const doc = {
111352
111374
  ...clone2(baseDoc),
@@ -111362,12 +111384,12 @@ var OpenAPIGenerator = class {
111362
111384
  contracts.push(traverseOptions);
111363
111385
  });
111364
111386
  const errors = [];
111365
- for (const { contract, path: path46 } of contracts) {
111366
- const stringPath = path46.join(".");
111387
+ for (const { contract, path: path47 } of contracts) {
111388
+ const stringPath = path47.join(".");
111367
111389
  try {
111368
111390
  const def = contract["~orpc"];
111369
111391
  const method = toOpenAPIMethod(fallbackContractConfig("defaultMethod", def.route.method));
111370
- const httpPath = toOpenAPIPath(def.route.path ?? toHttpPath(path46));
111392
+ const httpPath = toOpenAPIPath(def.route.path ?? toHttpPath(path47));
111371
111393
  let operationObjectRef;
111372
111394
  if (def.route.spec !== void 0 && typeof def.route.spec !== "function") {
111373
111395
  operationObjectRef = def.route.spec;
@@ -111839,8 +111861,8 @@ function toAbortSignal(stream) {
111839
111861
  function toStandardUrl(req) {
111840
111862
  const protocol = "encrypted" in req.socket && req.socket.encrypted ? "https:" : "http:";
111841
111863
  const origin = guard(() => new URL(`${protocol}//${req.headers.host ?? "localhost"}`).origin) ?? `${protocol}//localhost`;
111842
- const path46 = req.originalUrl ?? req.url ?? "/";
111843
- return new URL(`${origin}${path46.startsWith("/") ? "" : "/"}${path46}`);
111864
+ const path47 = req.originalUrl ?? req.url ?? "/";
111865
+ return new URL(`${origin}${path47.startsWith("/") ? "" : "/"}${path47}`);
111844
111866
  }
111845
111867
  function toStandardLazyRequest(req, res) {
111846
111868
  const signal = toAbortSignal(res);
@@ -112039,8 +112061,8 @@ var StandardRPCMatcher = class {
112039
112061
  constructor(options = {}) {
112040
112062
  this.filter = options.filter ?? true;
112041
112063
  }
112042
- init(router, path46 = []) {
112043
- const laziedOptions = traverseContractProcedures({ router, path: path46 }, (traverseOptions) => {
112064
+ init(router, path47 = []) {
112065
+ const laziedOptions = traverseContractProcedures({ router, path: path47 }, (traverseOptions) => {
112044
112066
  if (!value(this.filter, traverseOptions)) {
112045
112067
  return;
112046
112068
  }
@@ -112246,8 +112268,8 @@ function createRouter() {
112246
112268
  static: new NullProtoObj2()
112247
112269
  };
112248
112270
  }
112249
- function splitPath(path46) {
112250
- const [_, ...s] = path46.split("/");
112271
+ function splitPath(path47) {
112272
+ const [_, ...s] = path47.split("/");
112251
112273
  return s[s.length - 1] === "" ? s.slice(0, -1) : s;
112252
112274
  }
112253
112275
  function getMatchParams(segments, paramsMap) {
@@ -112262,11 +112284,11 @@ function getMatchParams(segments, paramsMap) {
112262
112284
  }
112263
112285
  return params;
112264
112286
  }
112265
- function addRoute(ctx, method = "", path46, data) {
112287
+ function addRoute(ctx, method = "", path47, data) {
112266
112288
  method = method.toUpperCase();
112267
- if (path46.charCodeAt(0) !== 47) path46 = `/${path46}`;
112268
- path46 = path46.replace(/\\:/g, "%3A");
112269
- const segments = splitPath(path46);
112289
+ if (path47.charCodeAt(0) !== 47) path47 = `/${path47}`;
112290
+ path47 = path47.replace(/\\:/g, "%3A");
112291
+ const segments = splitPath(path47);
112270
112292
  let node2 = ctx.root;
112271
112293
  let _unnamedParamIndex = 0;
112272
112294
  const paramsMap = [];
@@ -112332,14 +112354,14 @@ function getParamRegexp(segment) {
112332
112354
  const regex = segment.replace(/:(\w+)/g, (_, id2) => `(?<${id2}>[^/]+)`).replace(/\./g, "\\.");
112333
112355
  return /* @__PURE__ */ new RegExp(`^${regex}$`);
112334
112356
  }
112335
- function findRoute(ctx, method = "", path46, opts) {
112336
- if (path46.charCodeAt(path46.length - 1) === 47) path46 = path46.slice(0, -1);
112337
- const staticNode = ctx.static[path46];
112357
+ function findRoute(ctx, method = "", path47, opts) {
112358
+ if (path47.charCodeAt(path47.length - 1) === 47) path47 = path47.slice(0, -1);
112359
+ const staticNode = ctx.static[path47];
112338
112360
  if (staticNode && staticNode.methods) {
112339
112361
  const staticMatch = staticNode.methods[method] || staticNode.methods[""];
112340
112362
  if (staticMatch !== void 0) return staticMatch[0];
112341
112363
  }
112342
- const segments = splitPath(path46);
112364
+ const segments = splitPath(path47);
112343
112365
  const match = _lookupTree(ctx, ctx.root, method, segments, 0)?.[0];
112344
112366
  if (match === void 0) return;
112345
112367
  if (opts?.params === false) return match;
@@ -112494,8 +112516,8 @@ var StandardOpenAPICodec = class {
112494
112516
  return true;
112495
112517
  }
112496
112518
  };
112497
- function toRou3Pattern(path46) {
112498
- return standardizeHTTPPath(path46).replace(/\/\{\+([^}]+)\}/g, "/**:$1").replace(/\/\{([^}]+)\}/g, "/:$1");
112519
+ function toRou3Pattern(path47) {
112520
+ return standardizeHTTPPath(path47).replace(/\/\{\+([^}]+)\}/g, "/**:$1").replace(/\/\{([^}]+)\}/g, "/:$1");
112499
112521
  }
112500
112522
  function decodeParams(params) {
112501
112523
  return Object.fromEntries(Object.entries(params).map(([key, value2]) => [key, tryDecodeURIComponent(value2)]));
@@ -112507,8 +112529,8 @@ var StandardOpenAPIMatcher = class {
112507
112529
  constructor(options = {}) {
112508
112530
  this.filter = options.filter ?? true;
112509
112531
  }
112510
- init(router, path46 = []) {
112511
- const laziedOptions = traverseContractProcedures({ router, path: path46 }, (traverseOptions) => {
112532
+ init(router, path47 = []) {
112533
+ const laziedOptions = traverseContractProcedures({ router, path: path47 }, (traverseOptions) => {
112512
112534
  if (!value(this.filter, traverseOptions)) {
112513
112535
  return;
112514
112536
  }
@@ -112790,6 +112812,7 @@ var LaunchLifecycleEventSchema = external_exports.strictObject({
112790
112812
  var DoorHealthEventSchema = external_exports.discriminatedUnion("kind", [
112791
112813
  external_exports.strictObject({ kind: external_exports.literal("generation"), pid: external_exports.number().int().positive(), providerPort: external_exports.number().int().positive(), connectPort: external_exports.number().int().positive(), directPort: external_exports.number().int().positive(), observedAt: external_exports.number() }),
112792
112814
  external_exports.strictObject({ kind: external_exports.literal("listenerFailed"), pid: external_exports.number().int().positive(), listener: external_exports.enum(["provider", "connect", "direct"]), message: external_exports.string(), observedAt: external_exports.number() }),
112815
+ external_exports.strictObject({ kind: external_exports.literal("binaryTurnover"), pid: external_exports.number().int().positive(), observedAt: external_exports.number() }),
112793
112816
  external_exports.strictObject({ kind: external_exports.literal("idleShutdown"), pid: external_exports.number().int().positive(), observedAt: external_exports.number() })
112794
112817
  ]);
112795
112818
  var QuotaExpiringEventSchema = external_exports.strictObject({
@@ -112923,6 +112946,9 @@ function createDoorHealthPublisher(hub, now, pid) {
112923
112946
  },
112924
112947
  idleShutdown: () => {
112925
112948
  publisher.publish({ kind: "idleShutdown", pid, observedAt: now() });
112949
+ },
112950
+ binaryTurnover: () => {
112951
+ publisher.publish({ kind: "binaryTurnover", pid, observedAt: now() });
112926
112952
  }
112927
112953
  };
112928
112954
  }
@@ -114231,8 +114257,8 @@ function createCodexRouteMount(ports, upstreamBase, provider) {
114231
114257
  request7.body.resume();
114232
114258
  return;
114233
114259
  }
114234
- const path46 = new URL(request7.url, "http://127.0.0.1").pathname;
114235
- const translated = { method: request7.method, path: path46, body, signal: request7.signal };
114260
+ const path47 = new URL(request7.url, "http://127.0.0.1").pathname;
114261
+ const translated = { method: request7.method, path: path47, body, signal: request7.signal };
114236
114262
  const routed = await route(translated);
114237
114263
  if (request7.signal.aborted) {
114238
114264
  return;
@@ -114266,7 +114292,7 @@ function createPassthroughRoute(name, target) {
114266
114292
  headroomUpstream: target.headroomUpstream,
114267
114293
  serve: async (request7, response) => {
114268
114294
  const incoming = new URL(request7.url, "http://127.0.0.1");
114269
- const path46 = target.stripPrefix !== void 0 && incoming.pathname.startsWith(target.stripPrefix) ? incoming.pathname.slice(target.stripPrefix.length) : incoming.pathname;
114295
+ const path47 = target.stripPrefix !== void 0 && incoming.pathname.startsWith(target.stripPrefix) ? incoming.pathname.slice(target.stripPrefix.length) : incoming.pathname;
114270
114296
  const headers = forwardableHeaders(request7.headers);
114271
114297
  delete headers.host;
114272
114298
  await new Promise((resolve2) => {
@@ -114274,7 +114300,7 @@ function createPassthroughRoute(name, target) {
114274
114300
  host: base.hostname,
114275
114301
  port: base.port === "" ? void 0 : Number(base.port),
114276
114302
  method: request7.method,
114277
- path: `${basePath}${path46}${incoming.search}`,
114303
+ path: `${basePath}${path47}${incoming.search}`,
114278
114304
  headers,
114279
114305
  agent
114280
114306
  };
@@ -114407,7 +114433,7 @@ async function scanRequestHead(request7, wholeBody = false) {
114407
114433
  // src/frontdoor/providerRoute.ts
114408
114434
  var MS_PER_HOUR3 = 36e5;
114409
114435
  function createProviderRouteResolver(deps) {
114410
- const isRcSelfHostPath = (path46) => path46 === "/v1/code/sessions" || path46.startsWith("/v1/code/sessions/") || path46 === "/v1/sessions" || path46.startsWith("/v1/sessions/");
114436
+ const isRcSelfHostPath = (path47) => path47 === "/v1/code/sessions" || path47.startsWith("/v1/code/sessions/") || path47 === "/v1/sessions" || path47.startsWith("/v1/sessions/");
114411
114437
  const oauthRoute = createPassthroughRoute("anthropic", { baseUrl: `https://${CONNECT_INTERCEPT_HOST}:${String(HTTPS_PORT)}`, stripPrefix: void 0, headroomUpstream: void 0 });
114412
114438
  const passthroughByTarget = /* @__PURE__ */ new Map();
114413
114439
  const passthroughFor = (name, target) => {
@@ -114421,16 +114447,16 @@ function createProviderRouteResolver(deps) {
114421
114447
  return route;
114422
114448
  };
114423
114449
  const resolve2 = (request7) => {
114424
- const path46 = new URL(request7.url, "http://127.0.0.1").pathname;
114425
- const scoped = parseProviderPath(path46);
114450
+ const path47 = new URL(request7.url, "http://127.0.0.1").pathname;
114451
+ const scoped = parseProviderPath(path47);
114426
114452
  if (scoped === void 0) {
114427
- if (deps.rcSelfHostRoute !== void 0 && isRcSelfHostPath(path46)) {
114453
+ if (deps.rcSelfHostRoute !== void 0 && isRcSelfHostPath(path47)) {
114428
114454
  return { ok: true, route: deps.rcSelfHostRoute };
114429
114455
  }
114430
- if (request7.session.provider !== void 0 && path46.startsWith("/v1/") && !isRcSelfHostPath(path46)) {
114456
+ if (request7.session.provider !== void 0 && path47.startsWith("/v1/") && !isRcSelfHostPath(path47)) {
114431
114457
  return resolve2({ ...request7, url: `${PROVIDER_PATH_PREFIX}${encodeURIComponent(request7.session.provider)}${request7.url}` });
114432
114458
  }
114433
- return path46.startsWith("/v1/") ? { ok: true, route: oauthRoute } : { ok: false, status: HTTP_STATUS.notFound, message: `no such endpoint: ${path46}` };
114459
+ return path47.startsWith("/v1/") ? { ok: true, route: oauthRoute } : { ok: false, status: HTTP_STATUS.notFound, message: `no such endpoint: ${path47}` };
114434
114460
  }
114435
114461
  const { provider } = scoped;
114436
114462
  let definition;
@@ -114483,8 +114509,8 @@ function createProviderRouteResolver(deps) {
114483
114509
  let replay;
114484
114510
  const visited = /* @__PURE__ */ new Set();
114485
114511
  for (; ; ) {
114486
- const path46 = new URL(current.url, "http://127.0.0.1").pathname;
114487
- const scoped = parseProviderPath(path46);
114512
+ const path47 = new URL(current.url, "http://127.0.0.1").pathname;
114513
+ const scoped = parseProviderPath(path47);
114488
114514
  const providerName = scoped?.provider ?? current.session.provider;
114489
114515
  if (providerName !== void 0 && visited.has(providerName)) {
114490
114516
  return { ok: false, status: HTTP_STATUS.internalServerError, message: `provider routing cycle: ${[...visited, providerName].join(" -> ")}` };
@@ -114549,7 +114575,7 @@ function createProviderRouteResolver(deps) {
114549
114575
  const headers = Object.fromEntries(Object.entries(replay.headers).filter(([name]) => name.toLowerCase() !== "content-length"));
114550
114576
  replay = { ...replay, headers, body: import_node_stream3.Readable.from([Buffer.from(rewritten, "utf8")]) };
114551
114577
  }
114552
- const rest = scoped === void 0 ? path46 : path46.slice(`${PROVIDER_PATH_PREFIX}${encodeURIComponent(scoped.provider)}`.length);
114578
+ const rest = scoped === void 0 ? path47 : path47.slice(`${PROVIDER_PATH_PREFIX}${encodeURIComponent(scoped.provider)}`.length);
114553
114579
  const query = current.url.includes("?") ? current.url.slice(current.url.indexOf("?")) : "";
114554
114580
  current = { ...current, url: `${PROVIDER_PATH_PREFIX}${encodeURIComponent(matched.provider)}${rest}${query}`, body: replay.body, headers: replay.headers };
114555
114581
  }
@@ -114653,7 +114679,7 @@ function createRcLiveUsage(deps) {
114653
114679
  }
114654
114680
 
114655
114681
  // src/frontdoor/rcSelfHostMint.ts
114656
- var import_node_path39 = __toESM(require("node:path"), 1);
114682
+ var import_node_path40 = __toESM(require("node:path"), 1);
114657
114683
  init_account();
114658
114684
 
114659
114685
  // src/frontdoor/rcSelfHostLocal.ts
@@ -114783,7 +114809,7 @@ function readJsonObject(fs21, file2) {
114783
114809
  return isRecord6(parsed) ? parsed : void 0;
114784
114810
  }
114785
114811
  function readRcSelfHostRecord(fs21, frontdoorDir) {
114786
- const parsed = readJsonObject(fs21, import_node_path39.default.join(frontdoorDir, RC_SELF_HOST_RECORD_DIR, RC_SELF_HOST_RECORD_FILE));
114812
+ const parsed = readJsonObject(fs21, import_node_path40.default.join(frontdoorDir, RC_SELF_HOST_RECORD_DIR, RC_SELF_HOST_RECORD_FILE));
114787
114813
  if (parsed === void 0) {
114788
114814
  return void 0;
114789
114815
  }
@@ -114797,11 +114823,11 @@ function mintRcSelfHostCredential(deps) {
114797
114823
  if (!isIdentityName(deps.identity)) {
114798
114824
  throw new Error(`"${deps.identity}" is not a valid identity name.`);
114799
114825
  }
114800
- const identityDir = import_node_path39.default.join(deps.identitiesDir, deps.identity);
114801
- const credentialsFile = import_node_path39.default.join(identityDir, CREDENTIALS_FILE);
114802
- const claudeJsonFile = import_node_path39.default.join(identityDir, CLAUDE_JSON2);
114803
- const recordDir = import_node_path39.default.join(deps.frontdoorDir, RC_SELF_HOST_RECORD_DIR);
114804
- const recordFile = import_node_path39.default.join(recordDir, RC_SELF_HOST_RECORD_FILE);
114826
+ const identityDir = import_node_path40.default.join(deps.identitiesDir, deps.identity);
114827
+ const credentialsFile = import_node_path40.default.join(identityDir, CREDENTIALS_FILE);
114828
+ const claudeJsonFile = import_node_path40.default.join(identityDir, CLAUDE_JSON2);
114829
+ const recordDir = import_node_path40.default.join(deps.frontdoorDir, RC_SELF_HOST_RECORD_DIR);
114830
+ const recordFile = import_node_path40.default.join(recordDir, RC_SELF_HOST_RECORD_FILE);
114805
114831
  const previousRecord = readRcSelfHostRecord(deps.fs, deps.frontdoorDir);
114806
114832
  const existingCredentials = readJsonObject(deps.fs, credentialsFile);
114807
114833
  const existingOauth = isRecord6(existingCredentials?.claudeAiOauth) ? existingCredentials.claudeAiOauth : void 0;
@@ -114817,7 +114843,7 @@ function mintRcSelfHostCredential(deps) {
114817
114843
  const organizationUuid = deps.newUuid();
114818
114844
  const accountUuid = deps.newUuid();
114819
114845
  const mintedAt = new Date(deps.now()).toISOString();
114820
- deps.fs.mkdirPrivate(import_node_path39.default.dirname(credentialsFile));
114846
+ deps.fs.mkdirPrivate(import_node_path40.default.dirname(credentialsFile));
114821
114847
  deps.fs.writeFilePrivate(credentialsFile, `${JSON.stringify({ ...existingCredentials, claudeAiOauth: { accessToken, refreshToken, expiresAt: null, scopes: [...RC_SELF_HOST_SCOPE_LIST], subscriptionType: SELF_HOST_SUBSCRIPTION_TYPE, rateLimitTier: null } }, null, 2)}
114822
114848
  `);
114823
114849
  const claudeJson = readJsonObject(deps.fs, claudeJsonFile) ?? {};
@@ -115204,7 +115230,7 @@ function registerRcCommand(frontdoor, paths) {
115204
115230
  }
115205
115231
 
115206
115232
  // src/frontdoor/rcCredentialStore.ts
115207
- var import_node_path40 = __toESM(require("node:path"), 1);
115233
+ var import_node_path41 = __toESM(require("node:path"), 1);
115208
115234
  function isSafeSessionId(sessionId) {
115209
115235
  return /^[A-Za-z0-9_-]+$/.test(sessionId);
115210
115236
  }
@@ -115230,7 +115256,7 @@ function sequenceNumOfJson(value2) {
115230
115256
  }
115231
115257
  function createRcCredentialStore(fs21, dir) {
115232
115258
  fs21.mkdirPrivate(dir);
115233
- const fileFor = (sessionId) => import_node_path40.default.join(dir, `${sessionId}.json`);
115259
+ const fileFor = (sessionId) => import_node_path41.default.join(dir, `${sessionId}.json`);
115234
115260
  const readParsed = (sessionId) => {
115235
115261
  const raw = fs21.readFileUtf8(fileFor(sessionId));
115236
115262
  if (raw === void 0) {
@@ -117404,6 +117430,12 @@ function rcObservingResolver(resolve2, tracker, hub) {
117404
117430
  } }) } : resolution;
117405
117431
  };
117406
117432
  }
117433
+ function realStatOwnExecutable(watchPath) {
117434
+ return () => {
117435
+ const st2 = import_node_fs15.default.statSync(watchPath, { throwIfNoEntry: false });
117436
+ return st2?.isFile() !== true ? void 0 : { dev: st2.dev, ino: st2.ino, size: st2.size, mtimeMs: st2.mtimeMs };
117437
+ };
117438
+ }
117407
117439
  function realFrontDoorSupervisorPorts(paths) {
117408
117440
  const log = (line) => {
117409
117441
  appendLog(paths, `frontdoor ${String(process.pid)}: ${line}`);
@@ -117532,6 +117564,8 @@ function realFrontDoorSupervisorPorts(paths) {
117532
117564
  });
117533
117565
  },
117534
117566
  isRunning: realIsProcessRunning,
117567
+ // The turnover check's file identity, over the installed entry resolved once at door start: re-resolving per tick would re-run the PATH scan every second and could theoretically flip between two files, while the entry itself is fixed for as long as this door lives. The existence check prefers the agent-shim sibling only when it is really there (see watchedInstallEntry).
117568
+ statOwnExecutable: realStatOwnExecutable(watchedInstallEntry(realOwnExecutablePath(), (candidate) => import_node_fs15.default.existsSync(candidate))),
117535
117569
  startProviderListener: async (preferredPort) => {
117536
117570
  const authority = loadCa();
117537
117571
  const rcDial = rcSelfHost ? lateRcEventDial(rcSelfHostDialTarget) : realRcEventDial();
@@ -117626,7 +117660,7 @@ function realFrontDoorSupervisorPorts(paths) {
117626
117660
  const leafFor = createLeafCache(loadCa(), () => /* @__PURE__ */ new Date());
117627
117661
  const capture = captureFromEnv(process.env, paths.logsDir);
117628
117662
  if (capture !== void 0) {
117629
- log(`capture enabled, recording CONNECT targets and piped exchanges to ${import_node_path41.default.join(paths.logsDir, "frontdoor-capture.jsonl")}`);
117663
+ log(`capture enabled, recording CONNECT targets and piped exchanges to ${import_node_path42.default.join(paths.logsDir, "frontdoor-capture.jsonl")}`);
117630
117664
  }
117631
117665
  if (rcSelfHostSurface !== void 0) {
117632
117666
  log("self-hosted Remote Control surface on: the door serves the CCR session family itself, and its own client-half dials its own transparent surface");
@@ -117885,16 +117919,16 @@ init_credentialCache();
117885
117919
 
117886
117920
  // src/identityToken.ts
117887
117921
  var import_node_fs16 = __toESM(require("node:fs"), 1);
117888
- var import_node_path42 = __toESM(require("node:path"), 1);
117922
+ var import_node_path43 = __toESM(require("node:path"), 1);
117889
117923
  init_cliError();
117890
117924
  var TOKEN_FILE_MODE = 384;
117891
117925
  var TOKEN_DIR_MODE = 448;
117892
117926
  var OAUTH_TOKEN_RE = /^sk-ant-oat\d+-[A-Za-z0-9_-]+$/;
117893
117927
  function identityTokenDir(paths) {
117894
- return import_node_path42.default.join(paths.root, "credentials");
117928
+ return import_node_path43.default.join(paths.root, "credentials");
117895
117929
  }
117896
117930
  function identityTokenPath(paths, identityName) {
117897
- return import_node_path42.default.join(identityTokenDir(paths), `${identityName}.token`);
117931
+ return import_node_path43.default.join(identityTokenDir(paths), `${identityName}.token`);
117898
117932
  }
117899
117933
  function storeIdentityToken(paths, identityName, raw) {
117900
117934
  const token = raw.trim();
@@ -117905,7 +117939,7 @@ function storeIdentityToken(paths, identityName, raw) {
117905
117939
  import_node_fs16.default.mkdirSync(dir, { recursive: true, mode: TOKEN_DIR_MODE });
117906
117940
  import_node_fs16.default.chmodSync(dir, TOKEN_DIR_MODE);
117907
117941
  const target = identityTokenPath(paths, identityName);
117908
- const temp = import_node_path42.default.join(dir, `.${identityName}.${String(process.pid)}.tmp`);
117942
+ const temp = import_node_path43.default.join(dir, `.${identityName}.${String(process.pid)}.tmp`);
117909
117943
  import_node_fs16.default.writeFileSync(temp, `${token}
117910
117944
  `, { mode: TOKEN_FILE_MODE });
117911
117945
  import_node_fs16.default.renameSync(temp, target);
@@ -118073,7 +118107,7 @@ function registerDoctorCommand(program2, deps) {
118073
118107
  // src/headroom/commands.ts
118074
118108
  var import_node_fs17 = __toESM(require("node:fs"), 1);
118075
118109
  var import_node_http3 = __toESM(require("node:http"), 1);
118076
- var import_node_path43 = __toESM(require("node:path"), 1);
118110
+ var import_node_path44 = __toESM(require("node:path"), 1);
118077
118111
  var import_node_child_process6 = require("node:child_process");
118078
118112
  init_commandDeps();
118079
118113
  init_realFrontDoorPort();
@@ -118187,12 +118221,12 @@ function readInstalledHeadroomCommit() {
118187
118221
  if (toolDir.status !== 0) {
118188
118222
  return void 0;
118189
118223
  }
118190
- const libDir = import_node_path43.default.join(toolDir.stdout.trim(), HEADROOM_TOOL_NAME, "lib");
118224
+ const libDir = import_node_path44.default.join(toolDir.stdout.trim(), HEADROOM_TOOL_NAME, "lib");
118191
118225
  for (const python of realFarmFs.readdir(libDir)) {
118192
- const sitePackages = import_node_path43.default.join(libDir, python, "site-packages");
118226
+ const sitePackages = import_node_path44.default.join(libDir, python, "site-packages");
118193
118227
  for (const entry of realFarmFs.readdir(sitePackages)) {
118194
118228
  if (entry.startsWith("headroom_ai-") && entry.endsWith(".dist-info")) {
118195
- const directUrl = realFarmFs.readFileUtf8(import_node_path43.default.join(sitePackages, entry, "direct_url.json"));
118229
+ const directUrl = realFarmFs.readFileUtf8(import_node_path44.default.join(sitePackages, entry, "direct_url.json"));
118196
118230
  return directUrl === void 0 ? void 0 : parseInstalledCommit(directUrl);
118197
118231
  }
118198
118232
  }
@@ -118752,7 +118786,7 @@ function registerRunCommand(program2, handler) {
118752
118786
  var import_node_child_process7 = require("node:child_process");
118753
118787
  var import_node_fs18 = __toESM(require("node:fs"), 1);
118754
118788
  var import_node_os11 = __toESM(require("node:os"), 1);
118755
- var import_node_path44 = __toESM(require("node:path"), 1);
118789
+ var import_node_path45 = __toESM(require("node:path"), 1);
118756
118790
  init_package();
118757
118791
  init_commandDeps();
118758
118792
  init_store();
@@ -118854,7 +118888,7 @@ var realUpdatePorts = {
118854
118888
  chmod: (filePath, mode) => {
118855
118889
  import_node_fs18.default.chmodSync(filePath, mode);
118856
118890
  },
118857
- mkdtemp: () => import_node_fs18.default.mkdtempSync(import_node_path44.default.join(import_node_os11.default.tmpdir(), "agent-shim-update-")),
118891
+ mkdtemp: () => import_node_fs18.default.mkdtempSync(import_node_path45.default.join(import_node_os11.default.tmpdir(), "agent-shim-update-")),
118858
118892
  rmRecursive: (targetPath) => {
118859
118893
  import_node_fs18.default.rmSync(targetPath, { recursive: true, force: true });
118860
118894
  }
@@ -118921,7 +118955,7 @@ function registerUpdateCommand(program2, deps, ports = realUpdatePorts) {
118921
118955
  platform: process.platform,
118922
118956
  arch: process.arch,
118923
118957
  executablePath: realOwnExecutablePath(),
118924
- lockPath: import_node_path44.default.join(deps.paths.root, "update.lock"),
118958
+ lockPath: import_node_path45.default.join(deps.paths.root, "update.lock"),
118925
118959
  checkOnly: options.check === true,
118926
118960
  pid: process.pid
118927
118961
  });
@@ -119391,7 +119425,7 @@ async function runClaude(argvOverride) {
119391
119425
  // src/cli.ts
119392
119426
  async function main() {
119393
119427
  aliasLegacyEnv(process.env);
119394
- const invokedName = import_node_path45.default.basename(process.argv[1] ?? "agent-shim");
119428
+ const invokedName = import_node_path46.default.basename(process.argv[1] ?? "agent-shim");
119395
119429
  if (isInvokedAsClaude(invokedName)) {
119396
119430
  await runClaude();
119397
119431
  return;