claude-use 6.2.2 → 6.2.3

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
@@ -3248,42 +3248,42 @@ var require_defaults = __commonJS({
3248
3248
  var require_env_paths = __commonJS({
3249
3249
  "node_modules/.pnpm/env-paths@2.2.1/node_modules/env-paths/index.js"(exports2, module2) {
3250
3250
  "use strict";
3251
- var path35 = require("path");
3251
+ var path36 = require("path");
3252
3252
  var os9 = require("os");
3253
3253
  var homedir = os9.homedir();
3254
3254
  var tmpdir = os9.tmpdir();
3255
3255
  var { env } = process;
3256
3256
  var macos = (name) => {
3257
- const library = path35.join(homedir, "Library");
3257
+ const library = path36.join(homedir, "Library");
3258
3258
  return {
3259
- data: path35.join(library, "Application Support", name),
3260
- config: path35.join(library, "Preferences", name),
3261
- cache: path35.join(library, "Caches", name),
3262
- log: path35.join(library, "Logs", name),
3263
- temp: path35.join(tmpdir, name)
3259
+ data: path36.join(library, "Application Support", name),
3260
+ config: path36.join(library, "Preferences", name),
3261
+ cache: path36.join(library, "Caches", name),
3262
+ log: path36.join(library, "Logs", name),
3263
+ temp: path36.join(tmpdir, name)
3264
3264
  };
3265
3265
  };
3266
3266
  var windows = (name) => {
3267
- const appData = env.APPDATA || path35.join(homedir, "AppData", "Roaming");
3268
- const localAppData = env.LOCALAPPDATA || path35.join(homedir, "AppData", "Local");
3267
+ const appData = env.APPDATA || path36.join(homedir, "AppData", "Roaming");
3268
+ const localAppData = env.LOCALAPPDATA || path36.join(homedir, "AppData", "Local");
3269
3269
  return {
3270
3270
  // Data/config/cache/log are invented by me as Windows isn't opinionated about this
3271
- data: path35.join(localAppData, name, "Data"),
3272
- config: path35.join(appData, name, "Config"),
3273
- cache: path35.join(localAppData, name, "Cache"),
3274
- log: path35.join(localAppData, name, "Log"),
3275
- temp: path35.join(tmpdir, name)
3271
+ data: path36.join(localAppData, name, "Data"),
3272
+ config: path36.join(appData, name, "Config"),
3273
+ cache: path36.join(localAppData, name, "Cache"),
3274
+ log: path36.join(localAppData, name, "Log"),
3275
+ temp: path36.join(tmpdir, name)
3276
3276
  };
3277
3277
  };
3278
3278
  var linux = (name) => {
3279
- const username = path35.basename(homedir);
3279
+ const username = path36.basename(homedir);
3280
3280
  return {
3281
- data: path35.join(env.XDG_DATA_HOME || path35.join(homedir, ".local", "share"), name),
3282
- config: path35.join(env.XDG_CONFIG_HOME || path35.join(homedir, ".config"), name),
3283
- cache: path35.join(env.XDG_CACHE_HOME || path35.join(homedir, ".cache"), name),
3281
+ data: path36.join(env.XDG_DATA_HOME || path36.join(homedir, ".local", "share"), name),
3282
+ config: path36.join(env.XDG_CONFIG_HOME || path36.join(homedir, ".config"), name),
3283
+ cache: path36.join(env.XDG_CACHE_HOME || path36.join(homedir, ".cache"), name),
3284
3284
  // https://wiki.debian.org/XDGBaseDirectorySpecification#state
3285
- log: path35.join(env.XDG_STATE_HOME || path35.join(homedir, ".local", "state"), name),
3286
- temp: path35.join(tmpdir, username, name)
3285
+ log: path36.join(env.XDG_STATE_HOME || path36.join(homedir, ".local", "state"), name),
3286
+ temp: path36.join(tmpdir, username, name)
3287
3287
  };
3288
3288
  };
3289
3289
  var envPaths = (name, options) => {
@@ -3351,11 +3351,11 @@ var require_util = __commonJS({
3351
3351
  return result;
3352
3352
  }
3353
3353
  exports2.emplace = emplace;
3354
- function getPropertyByPath(source, path35) {
3355
- if (typeof path35 === "string" && Object.prototype.hasOwnProperty.call(source, path35)) {
3356
- return source[path35];
3354
+ function getPropertyByPath(source, path36) {
3355
+ if (typeof path36 === "string" && Object.prototype.hasOwnProperty.call(source, path36)) {
3356
+ return source[path36];
3357
3357
  }
3358
- const parsedPath = typeof path35 === "string" ? path35.split(".") : path35;
3358
+ const parsedPath = typeof path36 === "string" ? path36.split(".") : path36;
3359
3359
  return parsedPath.reduce((previous, key) => {
3360
3360
  if (previous === void 0) {
3361
3361
  return previous;
@@ -3378,9 +3378,9 @@ var require_util = __commonJS({
3378
3378
  return Object.fromEntries(Object.entries(options).filter(([, value]) => value !== void 0));
3379
3379
  }
3380
3380
  exports2.removeUndefinedValuesFromObject = removeUndefinedValuesFromObject;
3381
- async function isDirectory(path35) {
3381
+ async function isDirectory(path36) {
3382
3382
  try {
3383
- const stat = await fs_1.promises.stat(path35);
3383
+ const stat = await fs_1.promises.stat(path36);
3384
3384
  return stat.isDirectory();
3385
3385
  } catch (e) {
3386
3386
  if (e.code === "ENOENT") {
@@ -3390,9 +3390,9 @@ var require_util = __commonJS({
3390
3390
  }
3391
3391
  }
3392
3392
  exports2.isDirectory = isDirectory;
3393
- function isDirectorySync(path35) {
3393
+ function isDirectorySync(path36) {
3394
3394
  try {
3395
- const stat = fs_1.default.statSync(path35);
3395
+ const stat = fs_1.default.statSync(path36);
3396
3396
  return stat.isDirectory();
3397
3397
  } catch (e) {
3398
3398
  if (e.code === "ENOENT") {
@@ -3490,7 +3490,7 @@ var require_ExplorerBase = __commonJS({
3490
3490
  const idx = importStack.indexOf(fullPath);
3491
3491
  if (idx !== -1) {
3492
3492
  throw new Error(`Circular import detected:
3493
- ${[...importStack, fullPath].map((path35, i2) => `${i2 + 1}. ${path35}`).join("\n")} (same as ${idx + 1}.)`);
3493
+ ${[...importStack, fullPath].map((path36, i2) => `${i2 + 1}. ${path36}`).join("\n")} (same as ${idx + 1}.)`);
3494
3494
  }
3495
3495
  }
3496
3496
  }
@@ -3678,9 +3678,9 @@ var require_Explorer = __commonJS({
3678
3678
  throw error62;
3679
3679
  }
3680
3680
  }
3681
- async #fileExists(path35) {
3681
+ async #fileExists(path36) {
3682
3682
  try {
3683
- await promises_1.default.stat(path35);
3683
+ await promises_1.default.stat(path36);
3684
3684
  return true;
3685
3685
  } catch (e) {
3686
3686
  return false;
@@ -3840,9 +3840,9 @@ var require_ExplorerSync = __commonJS({
3840
3840
  throw error62;
3841
3841
  }
3842
3842
  }
3843
- #fileExists(path35) {
3843
+ #fileExists(path36) {
3844
3844
  try {
3845
- fs_1.default.statSync(path35);
3845
+ fs_1.default.statSync(path36);
3846
3846
  return true;
3847
3847
  } catch (e) {
3848
3848
  return false;
@@ -3966,7 +3966,7 @@ var require_dist = __commonJS({
3966
3966
  };
3967
3967
  }
3968
3968
  function getResolvedSearchPlaces(moduleName, toolDefinedSearchPlaces, userConfiguredOptions) {
3969
- const userConfiguredSearchPlaces = userConfiguredOptions.searchPlaces?.map((path35) => path35.replace("{name}", moduleName));
3969
+ const userConfiguredSearchPlaces = userConfiguredOptions.searchPlaces?.map((path36) => path36.replace("{name}", moduleName));
3970
3970
  if (userConfiguredOptions.mergeSearchPlaces) {
3971
3971
  return [...userConfiguredSearchPlaces ?? [], ...toolDefinedSearchPlaces];
3972
3972
  }
@@ -4374,8 +4374,8 @@ var require_utils = __commonJS({
4374
4374
  }
4375
4375
  return output2;
4376
4376
  };
4377
- exports2.basename = (path35, { windows } = {}) => {
4378
- const segs = path35.split(windows ? /[\\/]/ : "/");
4377
+ exports2.basename = (path36, { windows } = {}) => {
4378
+ const segs = path36.split(windows ? /[\\/]/ : "/");
4379
4379
  const last = segs[segs.length - 1];
4380
4380
  if (last === "") {
4381
4381
  return segs[segs.length - 2];
@@ -7003,14 +7003,14 @@ var require_util2 = __commonJS({
7003
7003
  }
7004
7004
  const port = url2.port != null ? url2.port : url2.protocol === "https:" ? 443 : 80;
7005
7005
  let origin = url2.origin != null ? url2.origin : `${url2.protocol || ""}//${url2.hostname || ""}:${port}`;
7006
- let path35 = url2.path != null ? url2.path : `${url2.pathname || ""}${url2.search || ""}`;
7006
+ let path36 = url2.path != null ? url2.path : `${url2.pathname || ""}${url2.search || ""}`;
7007
7007
  if (origin[origin.length - 1] === "/") {
7008
7008
  origin = origin.slice(0, origin.length - 1);
7009
7009
  }
7010
- if (path35 && path35[0] !== "/") {
7011
- path35 = `/${path35}`;
7010
+ if (path36 && path36[0] !== "/") {
7011
+ path36 = `/${path36}`;
7012
7012
  }
7013
- return new URL(`${origin}${path35}`);
7013
+ return new URL(`${origin}${path36}`);
7014
7014
  }
7015
7015
  if (!isHttpOrHttpsPrefixed(url2.origin || url2.protocol)) {
7016
7016
  throw new InvalidArgumentError2("Invalid URL protocol: the URL must start with `http:` or `https:`.");
@@ -7831,9 +7831,9 @@ var require_diagnostics = __commonJS({
7831
7831
  "undici:client:sendHeaders",
7832
7832
  (evt) => {
7833
7833
  const {
7834
- request: { method, path: path35, origin }
7834
+ request: { method, path: path36, origin }
7835
7835
  } = evt;
7836
- debugLog("sending request to %s %s%s", method, origin, path35);
7836
+ debugLog("sending request to %s %s%s", method, origin, path36);
7837
7837
  }
7838
7838
  );
7839
7839
  }
@@ -7851,14 +7851,14 @@ var require_diagnostics = __commonJS({
7851
7851
  "undici:request:headers",
7852
7852
  (evt) => {
7853
7853
  const {
7854
- request: { method, path: path35, origin },
7854
+ request: { method, path: path36, origin },
7855
7855
  response: { statusCode }
7856
7856
  } = evt;
7857
7857
  debugLog(
7858
7858
  "received response to %s %s%s - HTTP %d",
7859
7859
  method,
7860
7860
  origin,
7861
- path35,
7861
+ path36,
7862
7862
  statusCode
7863
7863
  );
7864
7864
  }
@@ -7867,23 +7867,23 @@ var require_diagnostics = __commonJS({
7867
7867
  "undici:request:trailers",
7868
7868
  (evt) => {
7869
7869
  const {
7870
- request: { method, path: path35, origin }
7870
+ request: { method, path: path36, origin }
7871
7871
  } = evt;
7872
- debugLog("trailers received from %s %s%s", method, origin, path35);
7872
+ debugLog("trailers received from %s %s%s", method, origin, path36);
7873
7873
  }
7874
7874
  );
7875
7875
  diagnosticsChannel.subscribe(
7876
7876
  "undici:request:error",
7877
7877
  (evt) => {
7878
7878
  const {
7879
- request: { method, path: path35, origin },
7879
+ request: { method, path: path36, origin },
7880
7880
  error: error62
7881
7881
  } = evt;
7882
7882
  debugLog(
7883
7883
  "request to %s %s%s errored - %s",
7884
7884
  method,
7885
7885
  origin,
7886
- path35,
7886
+ path36,
7887
7887
  error62.message
7888
7888
  );
7889
7889
  }
@@ -7998,7 +7998,7 @@ var require_request = __commonJS({
7998
7998
  var kHandler = /* @__PURE__ */ Symbol("handler");
7999
7999
  var Request = class {
8000
8000
  constructor(origin, {
8001
- path: path35,
8001
+ path: path36,
8002
8002
  method,
8003
8003
  body,
8004
8004
  headers,
@@ -8015,11 +8015,11 @@ var require_request = __commonJS({
8015
8015
  maxRedirections,
8016
8016
  typeOfService
8017
8017
  }, handler) {
8018
- if (typeof path35 !== "string") {
8018
+ if (typeof path36 !== "string") {
8019
8019
  throw new InvalidArgumentError2("path must be a string");
8020
- } else if (path35[0] !== "/" && !(path35.startsWith("http://") || path35.startsWith("https://")) && method !== "CONNECT") {
8020
+ } else if (path36[0] !== "/" && !(path36.startsWith("http://") || path36.startsWith("https://")) && method !== "CONNECT") {
8021
8021
  throw new InvalidArgumentError2("path must be an absolute URL or start with a slash");
8022
- } else if (invalidPathRegex.test(path35)) {
8022
+ } else if (invalidPathRegex.test(path36)) {
8023
8023
  throw new InvalidArgumentError2("invalid request path");
8024
8024
  }
8025
8025
  if (typeof method !== "string") {
@@ -8094,7 +8094,7 @@ var require_request = __commonJS({
8094
8094
  this.completed = false;
8095
8095
  this.aborted = false;
8096
8096
  this.upgrade = upgrade || null;
8097
- this.path = query ? serializePathWithQuery(path35, query) : path35;
8097
+ this.path = query ? serializePathWithQuery(path36, query) : path36;
8098
8098
  this.origin = origin;
8099
8099
  this.protocol = getProtocolFromUrlString(origin);
8100
8100
  this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent;
@@ -13276,7 +13276,7 @@ var require_client_h1 = __commonJS({
13276
13276
  return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT";
13277
13277
  }
13278
13278
  function writeH1(client, request6) {
13279
- const { method, path: path35, host, upgrade, blocking, reset } = request6;
13279
+ const { method, path: path36, host, upgrade, blocking, reset } = request6;
13280
13280
  let { body, headers, contentLength } = request6;
13281
13281
  const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH";
13282
13282
  if (util.isFormDataLike(body)) {
@@ -13354,7 +13354,7 @@ var require_client_h1 = __commonJS({
13354
13354
  if (socket.setTypeOfService) {
13355
13355
  socket.setTypeOfService(request6.typeOfService);
13356
13356
  }
13357
- let header = `${method} ${path35} HTTP/1.1\r
13357
+ let header = `${method} ${path36} HTTP/1.1\r
13358
13358
  `;
13359
13359
  if (typeof host === "string") {
13360
13360
  header += `host: ${host}\r
@@ -14033,7 +14033,7 @@ var require_client_h2 = __commonJS({
14033
14033
  const headersTimeout = request6.headersTimeout ?? client[kHeadersTimeout];
14034
14034
  const bodyTimeout = request6.bodyTimeout ?? client[kBodyTimeout];
14035
14035
  const session = client[kHTTP2Session];
14036
- const { method, path: path35, host, upgrade, expectContinue, signal, protocol, headers: reqHeaders } = request6;
14036
+ const { method, path: path36, host, upgrade, expectContinue, signal, protocol, headers: reqHeaders } = request6;
14037
14037
  let { body } = request6;
14038
14038
  if (upgrade != null && upgrade !== "websocket") {
14039
14039
  util.errorRequest(client, request6, new InvalidArgumentError2(`Custom upgrade "${upgrade}" not supported over HTTP/2`));
@@ -14102,7 +14102,7 @@ var require_client_h2 = __commonJS({
14102
14102
  }
14103
14103
  headers[HTTP2_HEADER_METHOD] = "CONNECT";
14104
14104
  headers[HTTP2_HEADER_PROTOCOL] = "websocket";
14105
- headers[HTTP2_HEADER_PATH] = path35;
14105
+ headers[HTTP2_HEADER_PATH] = path36;
14106
14106
  if (protocol === "ws:" || protocol === "wss:") {
14107
14107
  headers[HTTP2_HEADER_SCHEME] = protocol === "ws:" ? "http" : "https";
14108
14108
  } else {
@@ -14144,7 +14144,7 @@ var require_client_h2 = __commonJS({
14144
14144
  stream.setTimeout(headersTimeout);
14145
14145
  return true;
14146
14146
  }
14147
- headers[HTTP2_HEADER_PATH] = path35;
14147
+ headers[HTTP2_HEADER_PATH] = path36;
14148
14148
  headers[HTTP2_HEADER_SCHEME] = protocol === "http:" ? "http" : "https";
14149
14149
  const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH";
14150
14150
  if (body && typeof body.read === "function") {
@@ -16496,10 +16496,10 @@ var require_proxy_agent = __commonJS({
16496
16496
  };
16497
16497
  const {
16498
16498
  origin,
16499
- path: path35 = "/",
16499
+ path: path36 = "/",
16500
16500
  headers = {}
16501
16501
  } = opts;
16502
- opts.path = origin + path35;
16502
+ opts.path = origin + path36;
16503
16503
  if (!("host" in headers) && !("Host" in headers)) {
16504
16504
  const { host } = new URL(origin);
16505
16505
  headers.host = host;
@@ -18608,20 +18608,20 @@ var require_mock_utils = __commonJS({
18608
18608
  }
18609
18609
  return normalizedQp;
18610
18610
  }
18611
- function safeUrl(path35) {
18612
- if (typeof path35 !== "string") {
18613
- return path35;
18611
+ function safeUrl(path36) {
18612
+ if (typeof path36 !== "string") {
18613
+ return path36;
18614
18614
  }
18615
- const pathSegments = path35.split("?", 3);
18615
+ const pathSegments = path36.split("?", 3);
18616
18616
  if (pathSegments.length !== 2) {
18617
- return path35;
18617
+ return path36;
18618
18618
  }
18619
18619
  const qp = new URLSearchParams(pathSegments.pop());
18620
18620
  qp.sort();
18621
18621
  return [...pathSegments, qp.toString()].join("?");
18622
18622
  }
18623
- function matchKey(mockDispatch2, { path: path35, method, body, headers }) {
18624
- const pathMatch = matchValue(mockDispatch2.path, path35);
18623
+ function matchKey(mockDispatch2, { path: path36, method, body, headers }) {
18624
+ const pathMatch = matchValue(mockDispatch2.path, path36);
18625
18625
  const methodMatch = matchValue(mockDispatch2.method, method);
18626
18626
  const bodyMatch = typeof mockDispatch2.body !== "undefined" ? matchValue(mockDispatch2.body, body) : true;
18627
18627
  const headersMatch = matchHeaders(mockDispatch2, headers);
@@ -18646,8 +18646,8 @@ var require_mock_utils = __commonJS({
18646
18646
  const basePath = key.query ? serializePathWithQuery(key.path, key.query) : key.path;
18647
18647
  const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath;
18648
18648
  const resolvedPathWithoutTrailingSlash = removeTrailingSlash(resolvedPath);
18649
- let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path35, ignoreTrailingSlash }) => {
18650
- return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(path35)), resolvedPathWithoutTrailingSlash) : matchValue(safeUrl(path35), resolvedPath);
18649
+ let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path36, ignoreTrailingSlash }) => {
18650
+ return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(path36)), resolvedPathWithoutTrailingSlash) : matchValue(safeUrl(path36), resolvedPath);
18651
18651
  });
18652
18652
  if (matchedMockDispatches.length === 0) {
18653
18653
  throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`);
@@ -18686,19 +18686,19 @@ var require_mock_utils = __commonJS({
18686
18686
  mockDispatches.splice(index, 1);
18687
18687
  }
18688
18688
  }
18689
- function removeTrailingSlash(path35) {
18690
- while (path35.endsWith("/")) {
18691
- path35 = path35.slice(0, -1);
18689
+ function removeTrailingSlash(path36) {
18690
+ while (path36.endsWith("/")) {
18691
+ path36 = path36.slice(0, -1);
18692
18692
  }
18693
- if (path35.length === 0) {
18694
- path35 = "/";
18693
+ if (path36.length === 0) {
18694
+ path36 = "/";
18695
18695
  }
18696
- return path35;
18696
+ return path36;
18697
18697
  }
18698
18698
  function buildKey(opts) {
18699
- const { path: path35, method, body, headers, query } = opts;
18699
+ const { path: path36, method, body, headers, query } = opts;
18700
18700
  return {
18701
- path: path35,
18701
+ path: path36,
18702
18702
  method,
18703
18703
  body,
18704
18704
  headers,
@@ -19388,10 +19388,10 @@ var require_pending_interceptors_formatter = __commonJS({
19388
19388
  }
19389
19389
  format(pendingInterceptors) {
19390
19390
  const withPrettyHeaders = pendingInterceptors.map(
19391
- ({ method, path: path35, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
19391
+ ({ method, path: path36, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
19392
19392
  Method: method,
19393
19393
  Origin: origin,
19394
- Path: path35,
19394
+ Path: path36,
19395
19395
  "Status code": statusCode,
19396
19396
  Persistent: persist ? PERSISTENT : NOT_PERSISTENT,
19397
19397
  Invocations: timesInvoked,
@@ -19473,9 +19473,9 @@ var require_mock_agent = __commonJS({
19473
19473
  const acceptNonStandardSearchParameters = this[kMockAgentAcceptsNonStandardSearchParameters];
19474
19474
  const dispatchOpts = { ...opts };
19475
19475
  if (acceptNonStandardSearchParameters && dispatchOpts.path) {
19476
- const [path35, searchParams] = dispatchOpts.path.split("?");
19476
+ const [path36, searchParams] = dispatchOpts.path.split("?");
19477
19477
  const normalizedSearchParams = normalizeSearchParams(searchParams, acceptNonStandardSearchParameters);
19478
- dispatchOpts.path = `${path35}?${normalizedSearchParams}`;
19478
+ dispatchOpts.path = `${path36}?${normalizedSearchParams}`;
19479
19479
  }
19480
19480
  return this[kAgent].dispatch(dispatchOpts, handler);
19481
19481
  }
@@ -19876,12 +19876,12 @@ var require_snapshot_recorder = __commonJS({
19876
19876
  * @return {Promise<void>} - Resolves when snapshots are loaded
19877
19877
  */
19878
19878
  async loadSnapshots(filePath) {
19879
- const path35 = filePath || this.#snapshotPath;
19880
- if (!path35) {
19879
+ const path36 = filePath || this.#snapshotPath;
19880
+ if (!path36) {
19881
19881
  throw new InvalidArgumentError2("Snapshot path is required");
19882
19882
  }
19883
19883
  try {
19884
- const data = await readFile(resolve(path35), "utf8");
19884
+ const data = await readFile(resolve(path36), "utf8");
19885
19885
  const parsed = JSON.parse(data);
19886
19886
  if (Array.isArray(parsed)) {
19887
19887
  this.#snapshots.clear();
@@ -19895,7 +19895,7 @@ var require_snapshot_recorder = __commonJS({
19895
19895
  if (error62.code === "ENOENT") {
19896
19896
  this.#snapshots.clear();
19897
19897
  } else {
19898
- throw new UndiciError(`Failed to load snapshots from ${path35}`, { cause: error62 });
19898
+ throw new UndiciError(`Failed to load snapshots from ${path36}`, { cause: error62 });
19899
19899
  }
19900
19900
  }
19901
19901
  }
@@ -19906,11 +19906,11 @@ var require_snapshot_recorder = __commonJS({
19906
19906
  * @returns {Promise<void>} - Resolves when snapshots are saved
19907
19907
  */
19908
19908
  async saveSnapshots(filePath) {
19909
- const path35 = filePath || this.#snapshotPath;
19910
- if (!path35) {
19909
+ const path36 = filePath || this.#snapshotPath;
19910
+ if (!path36) {
19911
19911
  throw new InvalidArgumentError2("Snapshot path is required");
19912
19912
  }
19913
- const resolvedPath = resolve(path35);
19913
+ const resolvedPath = resolve(path36);
19914
19914
  await mkdir(dirname(resolvedPath), { recursive: true });
19915
19915
  const data = Array.from(this.#snapshots.entries()).map(([hash2, snapshot]) => ({
19916
19916
  hash: hash2,
@@ -20542,15 +20542,15 @@ var require_redirect_handler = __commonJS({
20542
20542
  return;
20543
20543
  }
20544
20544
  const { origin, pathname, search } = util.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)));
20545
- const path35 = search ? `${pathname}${search}` : pathname;
20546
- const redirectUrlString = `${origin}${path35}`;
20545
+ const path36 = search ? `${pathname}${search}` : pathname;
20546
+ const redirectUrlString = `${origin}${path36}`;
20547
20547
  for (const historyUrl of this.history) {
20548
20548
  if (historyUrl.toString() === redirectUrlString) {
20549
20549
  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.`);
20550
20550
  }
20551
20551
  }
20552
20552
  this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin);
20553
- this.opts.path = path35;
20553
+ this.opts.path = path36;
20554
20554
  this.opts.origin = origin;
20555
20555
  this.opts.query = null;
20556
20556
  }
@@ -22310,10 +22310,10 @@ var require_cache_handler = __commonJS({
22310
22310
  }
22311
22311
  return locationUrl.pathname + locationUrl.search;
22312
22312
  }
22313
- function deleteCachedUri(store, cacheKey, path35) {
22313
+ function deleteCachedUri(store, cacheKey, path36) {
22314
22314
  deleteCachedValue(store, {
22315
22315
  ...cacheKey,
22316
- path: path35
22316
+ path: path36
22317
22317
  });
22318
22318
  for (let i2 = 0; i2 < util.safeHTTPMethods.length; i2++) {
22319
22319
  const method = util.safeHTTPMethods[i2];
@@ -22321,7 +22321,7 @@ var require_cache_handler = __commonJS({
22321
22321
  deleteCachedValue(store, {
22322
22322
  ...cacheKey,
22323
22323
  method,
22324
- path: path35
22324
+ path: path36
22325
22325
  });
22326
22326
  }
22327
22327
  }
@@ -22332,9 +22332,9 @@ var require_cache_handler = __commonJS({
22332
22332
  }
22333
22333
  const values = Array.isArray(headerValue2) ? headerValue2 : [headerValue2];
22334
22334
  for (let i2 = 0; i2 < values.length; i2++) {
22335
- const path35 = getSameOriginPath(cacheKey, values[i2]);
22336
- if (path35 !== void 0) {
22337
- deleteCachedUri(store, cacheKey, path35);
22335
+ const path36 = getSameOriginPath(cacheKey, values[i2]);
22336
+ if (path36 !== void 0) {
22337
+ deleteCachedUri(store, cacheKey, path36);
22338
22338
  }
22339
22339
  }
22340
22340
  }
@@ -27334,11 +27334,11 @@ var require_fetch = __commonJS({
27334
27334
  function dispatch({ body }) {
27335
27335
  const url2 = requestCurrentURL(request6);
27336
27336
  const agent = fetchParams.controller.dispatcher;
27337
- const path35 = url2.pathname + url2.search;
27337
+ const path36 = url2.pathname + url2.search;
27338
27338
  const hasTrailingQuestionMark = url2.search.length === 0 && url2.href[url2.href.length - url2.hash.length - 1] === "?";
27339
27339
  return new Promise((resolve, reject) => agent.dispatch(
27340
27340
  {
27341
- path: hasTrailingQuestionMark ? `${path35}?` : path35,
27341
+ path: hasTrailingQuestionMark ? `${path36}?` : path36,
27342
27342
  origin: url2.origin,
27343
27343
  method: request6.method,
27344
27344
  body: agent.isMockActive ? request6.body && (request6.body.source || request6.body.stream) : body,
@@ -28285,9 +28285,9 @@ var require_util5 = __commonJS({
28285
28285
  }
28286
28286
  }
28287
28287
  }
28288
- function validateCookiePath(path35) {
28289
- for (let i2 = 0; i2 < path35.length; ++i2) {
28290
- const code = path35.charCodeAt(i2);
28288
+ function validateCookiePath(path36) {
28289
+ for (let i2 = 0; i2 < path36.length; ++i2) {
28290
+ const code = path36.charCodeAt(i2);
28291
28291
  if (code < 32 || // exclude CTLs (0-31)
28292
28292
  code > 126 || // exclude DEL and non-ascii
28293
28293
  code === 59) {
@@ -31635,11 +31635,11 @@ var require_undici = __commonJS({
31635
31635
  if (typeof opts.path !== "string") {
31636
31636
  throw new InvalidArgumentError2("invalid opts.path");
31637
31637
  }
31638
- let path35 = opts.path;
31638
+ let path36 = opts.path;
31639
31639
  if (!opts.path.startsWith("/")) {
31640
- path35 = `/${path35}`;
31640
+ path36 = `/${path36}`;
31641
31641
  }
31642
- url2 = new URL(util.parseOrigin(url2).origin + path35);
31642
+ url2 = new URL(util.parseOrigin(url2).origin + path36);
31643
31643
  } else {
31644
31644
  if (!opts) {
31645
31645
  opts = typeof url2 === "object" ? url2 : {};
@@ -31749,7 +31749,7 @@ ${captureLines}` : capture.stack;
31749
31749
  });
31750
31750
 
31751
31751
  // src/cli.ts
31752
- var import_node_path34 = __toESM(require("node:path"), 1);
31752
+ var import_node_path35 = __toESM(require("node:path"), 1);
31753
31753
 
31754
31754
  // node_modules/.pnpm/commander@15.0.0/node_modules/commander/lib/error.js
31755
31755
  var CommanderError = class extends Error {
@@ -34862,9 +34862,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
34862
34862
  * @param {string} [path]
34863
34863
  * @return {(string|null|Command)}
34864
34864
  */
34865
- executableDir(path35) {
34866
- if (path35 === void 0) return this._executableDir;
34867
- this._executableDir = path35;
34865
+ executableDir(path36) {
34866
+ if (path36 === void 0) return this._executableDir;
34867
+ this._executableDir = path36;
34868
34868
  return this;
34869
34869
  }
34870
34870
  /**
@@ -36002,10 +36002,10 @@ function mergeDefs(...defs) {
36002
36002
  function cloneDef(schema) {
36003
36003
  return mergeDefs(schema._zod.def);
36004
36004
  }
36005
- function getElementAtPath(obj, path35) {
36006
- if (!path35)
36005
+ function getElementAtPath(obj, path36) {
36006
+ if (!path36)
36007
36007
  return obj;
36008
- return path35.reduce((acc, key) => acc?.[key], obj);
36008
+ return path36.reduce((acc, key) => acc?.[key], obj);
36009
36009
  }
36010
36010
  function promiseAllObject(promisesObj) {
36011
36011
  const keys = Object.keys(promisesObj);
@@ -36345,11 +36345,11 @@ function explicitlyAborted(x, startIndex = 0) {
36345
36345
  }
36346
36346
  return false;
36347
36347
  }
36348
- function prefixIssues(path35, issues) {
36348
+ function prefixIssues(path36, issues) {
36349
36349
  return issues.map((iss) => {
36350
36350
  var _a3;
36351
36351
  (_a3 = iss).path ?? (_a3.path = []);
36352
- iss.path.unshift(path35);
36352
+ iss.path.unshift(path36);
36353
36353
  return iss;
36354
36354
  });
36355
36355
  }
@@ -36799,16 +36799,16 @@ function flattenError(error62, mapper = (issue2) => issue2.message) {
36799
36799
  }
36800
36800
  function formatError(error62, mapper = (issue2) => issue2.message) {
36801
36801
  const fieldErrors = { _errors: [] };
36802
- const processError = (error63, path35 = []) => {
36802
+ const processError = (error63, path36 = []) => {
36803
36803
  for (const issue2 of error63.issues) {
36804
36804
  if (issue2.code === "invalid_union" && issue2.errors.length) {
36805
- issue2.errors.map((issues) => processError({ issues }, [...path35, ...issue2.path]));
36805
+ issue2.errors.map((issues) => processError({ issues }, [...path36, ...issue2.path]));
36806
36806
  } else if (issue2.code === "invalid_key") {
36807
- processError({ issues: issue2.issues }, [...path35, ...issue2.path]);
36807
+ processError({ issues: issue2.issues }, [...path36, ...issue2.path]);
36808
36808
  } else if (issue2.code === "invalid_element") {
36809
- processError({ issues: issue2.issues }, [...path35, ...issue2.path]);
36809
+ processError({ issues: issue2.issues }, [...path36, ...issue2.path]);
36810
36810
  } else {
36811
- const fullpath = [...path35, ...issue2.path];
36811
+ const fullpath = [...path36, ...issue2.path];
36812
36812
  if (fullpath.length === 0) {
36813
36813
  fieldErrors._errors.push(mapper(issue2));
36814
36814
  } else {
@@ -36847,17 +36847,17 @@ function formatError(error62, mapper = (issue2) => issue2.message) {
36847
36847
  }
36848
36848
  function treeifyError(error62, mapper = (issue2) => issue2.message) {
36849
36849
  const result = { errors: [] };
36850
- const processError = (error63, path35 = []) => {
36850
+ const processError = (error63, path36 = []) => {
36851
36851
  var _a3;
36852
36852
  for (const issue2 of error63.issues) {
36853
36853
  if (issue2.code === "invalid_union" && issue2.errors.length) {
36854
- issue2.errors.map((issues) => processError({ issues }, [...path35, ...issue2.path]));
36854
+ issue2.errors.map((issues) => processError({ issues }, [...path36, ...issue2.path]));
36855
36855
  } else if (issue2.code === "invalid_key") {
36856
- processError({ issues: issue2.issues }, [...path35, ...issue2.path]);
36856
+ processError({ issues: issue2.issues }, [...path36, ...issue2.path]);
36857
36857
  } else if (issue2.code === "invalid_element") {
36858
- processError({ issues: issue2.issues }, [...path35, ...issue2.path]);
36858
+ processError({ issues: issue2.issues }, [...path36, ...issue2.path]);
36859
36859
  } else {
36860
- const fullpath = [...path35, ...issue2.path];
36860
+ const fullpath = [...path36, ...issue2.path];
36861
36861
  if (fullpath.length === 0) {
36862
36862
  result.errors.push(mapper(issue2));
36863
36863
  continue;
@@ -36896,8 +36896,8 @@ function treeifyError(error62, mapper = (issue2) => issue2.message) {
36896
36896
  }
36897
36897
  function toDotPath(_path) {
36898
36898
  const segs = [];
36899
- const path35 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
36900
- for (const seg of path35) {
36899
+ const path36 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
36900
+ for (const seg of path36) {
36901
36901
  if (typeof seg === "number")
36902
36902
  segs.push(`[${seg}]`);
36903
36903
  else if (typeof seg === "symbol")
@@ -53999,13 +53999,13 @@ function resolveRef(ref, ctx) {
53999
53999
  if (!ref.startsWith("#")) {
54000
54000
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
54001
54001
  }
54002
- const path35 = ref.slice(1).split("/").filter(Boolean);
54003
- if (path35.length === 0) {
54002
+ const path36 = ref.slice(1).split("/").filter(Boolean);
54003
+ if (path36.length === 0) {
54004
54004
  return ctx.rootSchema;
54005
54005
  }
54006
54006
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
54007
- if (path35[0] === defsKey) {
54008
- const key = path35[1] === void 0 ? void 0 : decodeJSONPointerSegment(path35[1]);
54007
+ if (path36[0] === defsKey) {
54008
+ const key = path36[1] === void 0 ? void 0 : decodeJSONPointerSegment(path36[1]);
54009
54009
  if (!key || !ctx.defs[key]) {
54010
54010
  throw new Error(`Reference not found: ${ref}`);
54011
54011
  }
@@ -55408,7 +55408,7 @@ function readHeadroomState(fs16, stateFile) {
55408
55408
  }
55409
55409
  function writeHeadroomState(fs16, stateFile, state) {
55410
55410
  fs16.mkdirp(import_node_path5.default.dirname(stateFile));
55411
- fs16.writeFileUtf8(stateFile, `${JSON.stringify(state, null, 2)}
55411
+ fs16.writeFilePrivate(stateFile, `${JSON.stringify(state, null, 2)}
55412
55412
  `);
55413
55413
  }
55414
55414
  function headroomAllowlist(providers) {
@@ -60997,7 +60997,7 @@ function resolveLaunchIdentity(paths, cwd) {
60997
60997
  // package.json
60998
60998
  var package_default = {
60999
60999
  name: "claude-use",
61000
- version: "6.2.2",
61000
+ version: "6.2.3",
61001
61001
  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.",
61002
61002
  license: "Apache-2.0",
61003
61003
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -61500,11 +61500,11 @@ function providerBaseUrl(port, provider) {
61500
61500
  function directOrigin(port) {
61501
61501
  return `http://127.0.0.1:${String(port)}`;
61502
61502
  }
61503
- function parseProviderPath(path35) {
61504
- if (!path35.startsWith(PROVIDER_PATH_PREFIX)) {
61503
+ function parseProviderPath(path36) {
61504
+ if (!path36.startsWith(PROVIDER_PATH_PREFIX)) {
61505
61505
  return void 0;
61506
61506
  }
61507
- const tail = path35.slice(PROVIDER_PATH_PREFIX.length);
61507
+ const tail = path36.slice(PROVIDER_PATH_PREFIX.length);
61508
61508
  const slash = tail.indexOf("/");
61509
61509
  if (slash <= 0) {
61510
61510
  return void 0;
@@ -61904,9 +61904,9 @@ function decoderFor(encoding) {
61904
61904
  return void 0;
61905
61905
  }
61906
61906
  }
61907
- function destinationOf(path35) {
61908
- const scoped = parseProviderPath(path35);
61909
- return scoped === void 0 ? { provider: ANTHROPIC_PROVIDER, endpoint: path35 } : { provider: scoped.provider, endpoint: scoped.rest };
61907
+ function destinationOf(path36) {
61908
+ const scoped = parseProviderPath(path36);
61909
+ return scoped === void 0 ? { provider: ANTHROPIC_PROVIDER, endpoint: path36 } : { provider: scoped.provider, endpoint: scoped.rest };
61910
61910
  }
61911
61911
  function buildRecord(event, context) {
61912
61912
  const { scan } = context;
@@ -64741,8 +64741,8 @@ function parseConnectTarget(authority) {
64741
64741
  function isInterceptedHost(host, interceptHost) {
64742
64742
  return host === interceptHost;
64743
64743
  }
64744
- function servedByPipeline(path35) {
64745
- return path35?.startsWith(ROUTED_PATH_PREFIX) === true;
64744
+ function servedByPipeline(path36) {
64745
+ return path36?.startsWith(ROUTED_PATH_PREFIX) === true;
64746
64746
  }
64747
64747
  var HOP_BY_HOP_HEADERS = /* @__PURE__ */ new Set([
64748
64748
  "connection",
@@ -66241,8 +66241,8 @@ function createCodexRouteMount(ports, upstreamBase, provider) {
66241
66241
  request6.body.resume();
66242
66242
  return;
66243
66243
  }
66244
- const path35 = new URL(request6.url, "http://127.0.0.1").pathname;
66245
- const translated = { method: request6.method, path: path35, body, signal: request6.signal };
66244
+ const path36 = new URL(request6.url, "http://127.0.0.1").pathname;
66245
+ const translated = { method: request6.method, path: path36, body, signal: request6.signal };
66246
66246
  const routed = await route(translated);
66247
66247
  if (request6.signal.aborted) {
66248
66248
  return;
@@ -66275,7 +66275,7 @@ function createPassthroughRoute(name, target) {
66275
66275
  headroomUpstream: target.headroomUpstream,
66276
66276
  serve: async (request6, response) => {
66277
66277
  const incoming = new URL(request6.url, "http://127.0.0.1");
66278
- const path35 = target.stripPrefix !== void 0 && incoming.pathname.startsWith(target.stripPrefix) ? incoming.pathname.slice(target.stripPrefix.length) : incoming.pathname;
66278
+ const path36 = target.stripPrefix !== void 0 && incoming.pathname.startsWith(target.stripPrefix) ? incoming.pathname.slice(target.stripPrefix.length) : incoming.pathname;
66279
66279
  const headers = forwardableHeaders(request6.headers);
66280
66280
  delete headers.host;
66281
66281
  await new Promise((resolve) => {
@@ -66283,7 +66283,7 @@ function createPassthroughRoute(name, target) {
66283
66283
  host: base.hostname,
66284
66284
  port: base.port === "" ? void 0 : Number(base.port),
66285
66285
  method: request6.method,
66286
- path: `${path35}${incoming.search}`,
66286
+ path: `${path36}${incoming.search}`,
66287
66287
  headers,
66288
66288
  agent
66289
66289
  };
@@ -66345,10 +66345,10 @@ function createProviderRouteResolver(deps) {
66345
66345
  return route;
66346
66346
  };
66347
66347
  const resolve = (request6) => {
66348
- const path35 = new URL(request6.url, "http://127.0.0.1").pathname;
66349
- const scoped = parseProviderPath(path35);
66348
+ const path36 = new URL(request6.url, "http://127.0.0.1").pathname;
66349
+ const scoped = parseProviderPath(path36);
66350
66350
  if (scoped === void 0) {
66351
- return path35.startsWith("/v1/") ? { ok: true, route: oauthRoute } : { ok: false, status: HTTP_STATUS.notFound, message: `no such endpoint: ${path35}` };
66351
+ return path36.startsWith("/v1/") ? { ok: true, route: oauthRoute } : { ok: false, status: HTTP_STATUS.notFound, message: `no such endpoint: ${path36}` };
66352
66352
  }
66353
66353
  const { provider } = scoped;
66354
66354
  let definition;
@@ -67461,6 +67461,7 @@ var import_node_path31 = __toESM(require("node:path"), 1);
67461
67461
  // src/headroom/source.ts
67462
67462
  var GIT_SPEC_RE = /git\+[^@\s]+(?:@([^\s#]+))?/;
67463
67463
  var COMMIT_SHA_RE = /^[0-9a-f]{40}$/i;
67464
+ var DirectUrlSchema = external_exports.object({ vcs_info: external_exports.object({ commit_id: external_exports.string() }) });
67464
67465
  function isMovingGitSource(spec) {
67465
67466
  const match = GIT_SPEC_RE.exec(spec);
67466
67467
  if (match === null) {
@@ -67469,6 +67470,18 @@ function isMovingGitSource(spec) {
67469
67470
  const ref = match[1];
67470
67471
  return ref === void 0 || !COMMIT_SHA_RE.test(ref);
67471
67472
  }
67473
+ function pinnedGitCommit(spec) {
67474
+ const ref = GIT_SPEC_RE.exec(spec)?.[1];
67475
+ return ref !== void 0 && COMMIT_SHA_RE.test(ref) ? ref.toLowerCase() : void 0;
67476
+ }
67477
+ function parseInstalledCommit(directUrlJson) {
67478
+ try {
67479
+ const parsed = DirectUrlSchema.safeParse(JSON.parse(directUrlJson));
67480
+ return parsed.success ? parsed.data.vcs_info.commit_id.toLowerCase() : void 0;
67481
+ } catch {
67482
+ return void 0;
67483
+ }
67484
+ }
67472
67485
 
67473
67486
  // src/doctor.ts
67474
67487
  function refinePathShadow(status, ownExecutablePath, realpath) {
@@ -67944,6 +67957,7 @@ function registerDoctorCommand(program2, deps) {
67944
67957
  // src/headroom/commands.ts
67945
67958
  var import_node_fs14 = __toESM(require("node:fs"), 1);
67946
67959
  var import_node_net3 = __toESM(require("node:net"), 1);
67960
+ var import_node_path32 = __toESM(require("node:path"), 1);
67947
67961
  var import_node_child_process5 = require("node:child_process");
67948
67962
 
67949
67963
  // src/headroom/settings.ts
@@ -68105,7 +68119,9 @@ async function runSupervisor(initialConfig, ports, options = {}) {
68105
68119
  const ensureInstalled = () => {
68106
68120
  const version3 = ports.headroomVersion();
68107
68121
  const versionOk = version3 !== void 0 && versionSatisfies(version3, config2.source);
68108
- if (versionOk && (installedSource === void 0 || installedSource === config2.source)) {
68122
+ const pinned = pinnedGitCommit(config2.source);
68123
+ const commitOk = pinned === void 0 || ports.installedCommit() === pinned;
68124
+ if (versionOk && commitOk && (installedSource === void 0 || installedSource === config2.source)) {
68109
68125
  installedSource = config2.source;
68110
68126
  return true;
68111
68127
  }
@@ -68350,6 +68366,24 @@ function headroomSpawnEnv(parentEnv, allowlist, settings2) {
68350
68366
  ...settingsEnv(settings2)
68351
68367
  };
68352
68368
  }
68369
+ var HEADROOM_TOOL_NAME = "headroom-ai";
68370
+ function readInstalledHeadroomCommit() {
68371
+ const toolDir = (0, import_node_child_process5.spawnSync)("uv", ["tool", "dir"], { encoding: "utf8" });
68372
+ if (toolDir.status !== 0) {
68373
+ return void 0;
68374
+ }
68375
+ const libDir = import_node_path32.default.join(toolDir.stdout.trim(), HEADROOM_TOOL_NAME, "lib");
68376
+ for (const python of realFarmFs.readdir(libDir)) {
68377
+ const sitePackages = import_node_path32.default.join(libDir, python, "site-packages");
68378
+ for (const entry of realFarmFs.readdir(sitePackages)) {
68379
+ if (entry.startsWith("headroom_ai-") && entry.endsWith(".dist-info")) {
68380
+ const directUrl = realFarmFs.readFileUtf8(import_node_path32.default.join(sitePackages, entry, "direct_url.json"));
68381
+ return directUrl === void 0 ? void 0 : parseInstalledCommit(directUrl);
68382
+ }
68383
+ }
68384
+ }
68385
+ return void 0;
68386
+ }
68353
68387
  function realSupervisorPorts(paths) {
68354
68388
  return {
68355
68389
  fs: realFarmFs,
@@ -68433,6 +68467,7 @@ function realSupervisorPorts(paths) {
68433
68467
  const result = (0, import_node_child_process5.spawnSync)("headroom", ["--version"], { encoding: "utf8" });
68434
68468
  return result.status === 0 ? result.stdout.trim() : void 0;
68435
68469
  },
68470
+ installedCommit: readInstalledHeadroomCommit,
68436
68471
  log: (line) => {
68437
68472
  import_node_fs14.default.mkdirSync(paths.logsDir, { recursive: true });
68438
68473
  import_node_fs14.default.appendFileSync(paths.headroomLogPath, `${(/* @__PURE__ */ new Date()).toISOString()} ${line}
@@ -68774,7 +68809,7 @@ var import_node_crypto16 = require("node:crypto");
68774
68809
 
68775
68810
  // src/launcher.ts
68776
68811
  var import_node_crypto15 = require("node:crypto");
68777
- var import_node_path33 = __toESM(require("node:path"), 1);
68812
+ var import_node_path34 = __toESM(require("node:path"), 1);
68778
68813
 
68779
68814
  // src/launcher/cliOverride.ts
68780
68815
  var InvalidCliCategoryError = class extends CliError {
@@ -68858,7 +68893,7 @@ function buildCliOverride(params) {
68858
68893
  }
68859
68894
 
68860
68895
  // src/launcher/flags.ts
68861
- var import_node_path32 = __toESM(require("node:path"), 1);
68896
+ var import_node_path33 = __toESM(require("node:path"), 1);
68862
68897
 
68863
68898
  // src/headroom/headers.ts
68864
68899
  function mergeAnthropicCustomHeaders(existing, additions) {
@@ -68928,7 +68963,7 @@ function buildEnv(params) {
68928
68963
  const parentCustomHeaders = params.baseEnv.ANTHROPIC_CUSTOM_HEADERS;
68929
68964
  let providerCustomHeaders;
68930
68965
  if (!params.configDirEscapeHatch && params.resolvedIdentityName !== void 0) {
68931
- env.CLAUDE_CONFIG_DIR = import_node_path32.default.join(params.identitiesDir, params.resolvedIdentityName);
68966
+ env.CLAUDE_CONFIG_DIR = import_node_path33.default.join(params.identitiesDir, params.resolvedIdentityName);
68932
68967
  }
68933
68968
  if (params.provider !== void 0) {
68934
68969
  const providerEnv = params.provider.definition.env ?? {};
@@ -69115,7 +69150,7 @@ function runLauncher(params) {
69115
69150
  identityDefaultConfigProfile: loadedIdentity?.config.defaultConfigProfile,
69116
69151
  globalDefaultConfigProfile: params.globalDefaultConfigProfile
69117
69152
  });
69118
- if (configProfileDecision.name !== void 0 && params.allowMissingConfigProfile !== true && fs16.readConfigFile(import_node_path33.default.join(paths.configProfilesDir, `${configProfileDecision.name}.json`)) === void 0) {
69153
+ if (configProfileDecision.name !== void 0 && params.allowMissingConfigProfile !== true && fs16.readConfigFile(import_node_path34.default.join(paths.configProfilesDir, `${configProfileDecision.name}.json`)) === void 0) {
69119
69154
  log.error(
69120
69155
  `claude-use: no configuration profile named "${configProfileDecision.name}" (selected via ${configProfileDecision.source}). Run \`claude-use profile add ${configProfileDecision.name}\` first.`
69121
69156
  );
@@ -69407,7 +69442,7 @@ async function runClaude(argvOverride) {
69407
69442
 
69408
69443
  // src/cli.ts
69409
69444
  async function main() {
69410
- const invokedName = import_node_path34.default.basename(process.argv[1] ?? "claude-use");
69445
+ const invokedName = import_node_path35.default.basename(process.argv[1] ?? "claude-use");
69411
69446
  if (isInvokedAsClaude(invokedName)) {
69412
69447
  await runClaude();
69413
69448
  return;
package/dist/index.cjs CHANGED
@@ -2829,7 +2829,7 @@ function readHeadroomState(fs2, stateFile) {
2829
2829
  }
2830
2830
  function writeHeadroomState(fs2, stateFile, state) {
2831
2831
  fs2.mkdirp(import_node_path6.default.dirname(stateFile));
2832
- fs2.writeFileUtf8(stateFile, `${JSON.stringify(state, null, 2)}
2832
+ fs2.writeFilePrivate(stateFile, `${JSON.stringify(state, null, 2)}
2833
2833
  `);
2834
2834
  }
2835
2835
  function headroomAllowlist(providers) {
@@ -3258,6 +3258,16 @@ function hashSettings(settings) {
3258
3258
  return (0, import_node_crypto6.createHash)("sha256").update(JSON.stringify([...settingsArgs(settings), JSON.stringify(settingsEnv(settings))])).digest("hex");
3259
3259
  }
3260
3260
 
3261
+ // src/headroom/source.ts
3262
+ var import_zod6 = require("zod");
3263
+ var GIT_SPEC_RE = /git\+[^@\s]+(?:@([^\s#]+))?/;
3264
+ var COMMIT_SHA_RE = /^[0-9a-f]{40}$/i;
3265
+ var DirectUrlSchema = import_zod6.z.object({ vcs_info: import_zod6.z.object({ commit_id: import_zod6.z.string() }) });
3266
+ function pinnedGitCommit(spec) {
3267
+ const ref = GIT_SPEC_RE.exec(spec)?.[1];
3268
+ return ref !== void 0 && COMMIT_SHA_RE.test(ref) ? ref.toLowerCase() : void 0;
3269
+ }
3270
+
3261
3271
  // src/headroom/supervisor.ts
3262
3272
  function resolveSupervisorConfig(configured) {
3263
3273
  return {
@@ -3358,7 +3368,9 @@ async function runSupervisor(initialConfig, ports, options = {}) {
3358
3368
  const ensureInstalled = () => {
3359
3369
  const version2 = ports.headroomVersion();
3360
3370
  const versionOk = version2 !== void 0 && versionSatisfies(version2, config.source);
3361
- if (versionOk && (installedSource === void 0 || installedSource === config.source)) {
3371
+ const pinned = pinnedGitCommit(config.source);
3372
+ const commitOk = pinned === void 0 || ports.installedCommit() === pinned;
3373
+ if (versionOk && commitOk && (installedSource === void 0 || installedSource === config.source)) {
3362
3374
  installedSource = config.source;
3363
3375
  return true;
3364
3376
  }
package/dist/index.mjs CHANGED
@@ -2755,7 +2755,7 @@ function readHeadroomState(fs2, stateFile) {
2755
2755
  }
2756
2756
  function writeHeadroomState(fs2, stateFile, state) {
2757
2757
  fs2.mkdirp(path6.dirname(stateFile));
2758
- fs2.writeFileUtf8(stateFile, `${JSON.stringify(state, null, 2)}
2758
+ fs2.writeFilePrivate(stateFile, `${JSON.stringify(state, null, 2)}
2759
2759
  `);
2760
2760
  }
2761
2761
  function headroomAllowlist(providers) {
@@ -3184,6 +3184,16 @@ function hashSettings(settings) {
3184
3184
  return createHash3("sha256").update(JSON.stringify([...settingsArgs(settings), JSON.stringify(settingsEnv(settings))])).digest("hex");
3185
3185
  }
3186
3186
 
3187
+ // src/headroom/source.ts
3188
+ import { z as z6 } from "zod";
3189
+ var GIT_SPEC_RE = /git\+[^@\s]+(?:@([^\s#]+))?/;
3190
+ var COMMIT_SHA_RE = /^[0-9a-f]{40}$/i;
3191
+ var DirectUrlSchema = z6.object({ vcs_info: z6.object({ commit_id: z6.string() }) });
3192
+ function pinnedGitCommit(spec) {
3193
+ const ref = GIT_SPEC_RE.exec(spec)?.[1];
3194
+ return ref !== void 0 && COMMIT_SHA_RE.test(ref) ? ref.toLowerCase() : void 0;
3195
+ }
3196
+
3187
3197
  // src/headroom/supervisor.ts
3188
3198
  function resolveSupervisorConfig(configured) {
3189
3199
  return {
@@ -3284,7 +3294,9 @@ async function runSupervisor(initialConfig, ports, options = {}) {
3284
3294
  const ensureInstalled = () => {
3285
3295
  const version2 = ports.headroomVersion();
3286
3296
  const versionOk = version2 !== void 0 && versionSatisfies(version2, config.source);
3287
- if (versionOk && (installedSource === void 0 || installedSource === config.source)) {
3297
+ const pinned = pinnedGitCommit(config.source);
3298
+ const commitOk = pinned === void 0 || ports.installedCommit() === pinned;
3299
+ if (versionOk && commitOk && (installedSource === void 0 || installedSource === config.source)) {
3288
3300
  installedSource = config.source;
3289
3301
  return true;
3290
3302
  }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Whether an install spec resolves through a git ref that can move underneath it. A full commit SHA never moves; a branch name, a tag a maintainer can re-point, or no ref at all (the remote's default branch) can, and a rebased, renamed or deleted branch changes or breaks every fresh install. A registry requirement is not a git source.
3
+ */
4
+ export declare function isMovingGitSource(spec: string): boolean;
5
+ /** The full commit SHA an install spec pins, lowercased, or undefined when the spec is a registry requirement or follows a moving ref. */
6
+ export declare function pinnedGitCommit(spec: string): string | undefined;
7
+ /** The commit an install was built from, read from the text of its `direct_url.json`, or undefined when the file records no VCS commit (a registry install) or is not valid JSON. */
8
+ export declare function parseInstalledCommit(directUrlJson: string): string | undefined;
@@ -38,7 +38,7 @@ export type HeadroomLock = z.infer<typeof HeadroomLockSchema>;
38
38
  /** Reads state.json, or undefined when absent. A malformed file is treated as absent: the lock-and-spawn flow below overwrites it with a fresh supervisor's state rather than crashing every future launch over one bad write. */
39
39
  export declare function readHeadroomState(fs: HeadroomFs, stateFile: string): HeadroomState | undefined;
40
40
  /**
41
- * Writes state.json. A plain write rather than the write-then-rename most config files get: state.json is advisory coordination, read tolerantly (`readHeadroomState` treats a malformed file as absent) and rewritten constantly by the supervisor, and the exclusive-create start lock below, not this file, is the actual mutual exclusion.
41
+ * Writes state.json atomically (a temporary sibling renamed into place), so a concurrent reader never sees a partial file. A reader treats a malformed file as absent, and a launcher that finds no supervisor in state spawns one, so a torn write read mid-flight started a redundant supervisor and daemon.
42
42
  */
43
43
  export declare function writeHeadroomState(fs: HeadroomFs, stateFile: string, state: Readonly<HeadroomState>): void;
44
44
  /** The allowlist the daemon is started with: every provider's base URL plus Claude Code's own API, so a session with no provider selected reaches the real Anthropic upstream through the same proxy. */
@@ -50,6 +50,8 @@ export interface SupervisorPorts {
50
50
  };
51
51
  /** The installed `headroom --version` output, or undefined when the binary is not on PATH. */
52
52
  readonly headroomVersion: () => string | undefined;
53
+ /** The commit the installed headroom was built from, as the install itself records it (`direct_url.json`), or undefined when it was not installed from a git source. */
54
+ readonly installedCommit: () => string | undefined;
53
55
  readonly log: (line: string) => void;
54
56
  }
55
57
  /** First retry delay after a failed start. Half a second keeps a transient blip invisible to the next launch. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-use",
3
- "version": "6.2.2",
3
+ "version": "6.2.3",
4
4
  "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.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Joseph Mearman <joseph@mearman.co.uk>",