agent-shim 8.38.0 → 8.39.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
@@ -63708,7 +63708,7 @@ function registerIdentityCommand(program2, deps) {
63708
63708
  // package.json
63709
63709
  var package_default = {
63710
63710
  name: "agent-shim",
63711
- version: "8.38.0",
63711
+ version: "8.39.0",
63712
63712
  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.",
63713
63713
  license: "MIT",
63714
63714
  author: "Joseph Mearman <joseph@mearman.co.uk>",
package/dist/index.cjs CHANGED
@@ -1,3 +1,4 @@
1
+ const __AGENT_SHIM_DIST_DIR__ = __dirname;
1
2
  "use strict";
2
3
  var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
@@ -82,6 +83,7 @@ __export(index_exports, {
82
83
  LaunchLifecycleEventSchema: () => LaunchLifecycleEventSchema,
83
84
  LaunchRefusedError: () => LaunchRefusedError,
84
85
  LegacyProviderFileError: () => LegacyProviderFileError,
86
+ OWN_CLI_FILE_NAME: () => OWN_CLI_FILE_NAME,
85
87
  PROMPT_CACHE_TTL_MS: () => PROMPT_CACHE_TTL_MS,
86
88
  PlanClassSchema: () => PlanClassSchema,
87
89
  PoolNameSchema: () => PoolNameSchema,
@@ -137,6 +139,7 @@ __export(index_exports, {
137
139
  addIdentity: () => addIdentity,
138
140
  addPool: () => addPool,
139
141
  addProvider: () => addProvider,
142
+ agentShimCliPath: () => agentShimCliPath,
140
143
  answerRcControlRequest: () => answerRcControlRequest,
141
144
  authenticateRcSessionMcpServer: () => authenticateRcSessionMcpServer,
142
145
  buildEntryFacts: () => buildEntryFacts,
@@ -3223,8 +3226,8 @@ function parseConnectTarget(authority) {
3223
3226
  function isInterceptedHost(host, interceptHosts) {
3224
3227
  return interceptHosts.includes(host);
3225
3228
  }
3226
- function servedByPipeline(path32) {
3227
- return path32?.startsWith(ROUTED_PATH_PREFIX) === true;
3229
+ function servedByPipeline(path33) {
3230
+ return path33?.startsWith(ROUTED_PATH_PREFIX) === true;
3228
3231
  }
3229
3232
  var HOP_BY_HOP_HEADERS = /* @__PURE__ */ new Set([
3230
3233
  "connection",
@@ -3758,11 +3761,11 @@ function createRcSessionTracker(deps) {
3758
3761
  };
3759
3762
  const observeExchange = (request4) => {
3760
3763
  const method = (request4.method ?? "").toUpperCase();
3761
- const path32 = new URL(request4.url ?? "/", "http://127.0.0.1").pathname;
3762
- if (!path32.startsWith(RC_SESSIONS_PATH_PREFIX)) {
3764
+ const path33 = new URL(request4.url ?? "/", "http://127.0.0.1").pathname;
3765
+ if (!path33.startsWith(RC_SESSIONS_PATH_PREFIX)) {
3763
3766
  return void 0;
3764
3767
  }
3765
- const tail = path32.slice(RC_SESSIONS_PATH_PREFIX.length);
3768
+ const tail = path33.slice(RC_SESSIONS_PATH_PREFIX.length);
3766
3769
  const facts = {
3767
3770
  oauthAuthorization: oauthAuthorizationOf(request4.headers),
3768
3771
  anthropicVersion: singleHeader(request4.headers, "anthropic-version"),
@@ -4144,8 +4147,8 @@ var RC_READ_FILE_ENCODINGS = ["utf-8", "base64"];
4144
4147
  function isRcReadFileEncoding(value) {
4145
4148
  return RC_READ_FILE_ENCODINGS.some((encoding) => encoding === value);
4146
4149
  }
4147
- function buildRcReadFilePayload(requestId, path32, options) {
4148
- return buildRcControlRequestPayload(requestId, { subtype: "read_file", path: path32, ...options?.maxBytes === void 0 ? {} : { max_bytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } });
4150
+ function buildRcReadFilePayload(requestId, path33, options) {
4151
+ return buildRcControlRequestPayload(requestId, { subtype: "read_file", path: path33, ...options?.maxBytes === void 0 ? {} : { max_bytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } });
4149
4152
  }
4150
4153
  function buildRcFileSuggestionsPayload(requestId, query) {
4151
4154
  return buildRcControlRequestPayload(requestId, { subtype: "file_suggestions", query });
@@ -4247,15 +4250,15 @@ async function getRcSessionContextUsage(deps, sessionId, detail) {
4247
4250
  const result = await deliverRcClientPayload(deps, sessionId, buildRcGetContextUsagePayload(requestId, detail), `request the context usage of session ${sessionId}`);
4248
4251
  return result.ok ? { ...result, requestId } : result;
4249
4252
  }
4250
- async function readRcSessionFile(deps, sessionId, path32, options) {
4251
- if (path32 === "") {
4253
+ async function readRcSessionFile(deps, sessionId, path33, options) {
4254
+ if (path33 === "") {
4252
4255
  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" };
4253
4256
  }
4254
4257
  if (options?.maxBytes !== void 0 && (!Number.isInteger(options.maxBytes) || options.maxBytes <= 0)) {
4255
4258
  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" };
4256
4259
  }
4257
4260
  const requestId = deps.newUuid();
4258
- const result = await deliverRcClientPayload(deps, sessionId, buildRcReadFilePayload(requestId, path32, options), `read ${path32} from session ${sessionId}`);
4261
+ const result = await deliverRcClientPayload(deps, sessionId, buildRcReadFilePayload(requestId, path33, options), `read ${path33} from session ${sessionId}`);
4259
4262
  return result.ok ? { ...result, requestId } : result;
4260
4263
  }
4261
4264
  async function suggestRcSessionFiles(deps, sessionId, query) {
@@ -4420,11 +4423,11 @@ function createRcControlHandler(deps) {
4420
4423
  path: "read-file",
4421
4424
  read: (body) => {
4422
4425
  const session = bodyString(body, "session");
4423
- const path32 = bodyString(body, "path");
4426
+ const path33 = bodyString(body, "path");
4424
4427
  const maxBytes = "maxBytes" in body ? bodyPositiveInteger(body, "maxBytes") : void 0;
4425
4428
  const encoding = "encoding" in body && isRcReadFileEncoding(body.encoding) ? body.encoding : void 0;
4426
- const refused2 = session === void 0 || path32 === void 0 || "maxBytes" in body && maxBytes === void 0 || "encoding" in body && encoding === void 0;
4427
- 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, path32, { ...maxBytes === void 0 ? {} : { maxBytes }, ...encoding === void 0 ? {} : { encoding } }) };
4429
+ const refused2 = session === void 0 || path33 === void 0 || "maxBytes" in body && maxBytes === void 0 || "encoding" in body && encoding === void 0;
4430
+ 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, path33, { ...maxBytes === void 0 ? {} : { maxBytes }, ...encoding === void 0 ? {} : { encoding } }) };
4428
4431
  }
4429
4432
  },
4430
4433
  {
@@ -4734,9 +4737,9 @@ function requestIdOfBody(body) {
4734
4737
  }
4735
4738
  function frontDoorRcControl(transport, token) {
4736
4739
  const headers = { authorization: `Bearer ${token}` };
4737
- const listAnswerOf = async (path32, what) => {
4740
+ const listAnswerOf = async (path33, what) => {
4738
4741
  try {
4739
- return await transport.request({ method: "GET", path: path32, headers });
4742
+ return await transport.request({ method: "GET", path: path33, headers });
4740
4743
  } catch (error) {
4741
4744
  throw new Error(`${what}: could not reach the front door's control listener: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
4742
4745
  }
@@ -4808,10 +4811,10 @@ function frontDoorRcControl(transport, token) {
4808
4811
  }
4809
4812
  return pending;
4810
4813
  };
4811
- const writeOf = async (path32, body, describeFailure) => {
4814
+ const writeOf = async (path33, body, describeFailure) => {
4812
4815
  let answer;
4813
4816
  try {
4814
- answer = await transport.request({ method: "POST", path: path32, headers: { ...headers, "content-type": "application/json" }, body });
4817
+ answer = await transport.request({ method: "POST", path: path33, headers: { ...headers, "content-type": "application/json" }, body });
4815
4818
  } catch (error) {
4816
4819
  return { ok: false, message: `could not reach the front door's control listener: ${error instanceof Error ? error.message : String(error)}` };
4817
4820
  }
@@ -4842,10 +4845,10 @@ function frontDoorRcControl(transport, token) {
4842
4845
  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}`),
4843
4846
  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}`),
4844
4847
  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}`),
4845
- readFile: async (sessionId, path32, options) => await writeOf(
4848
+ readFile: async (sessionId, path33, options) => await writeOf(
4846
4849
  `${CONTROL_PATH_PREFIX}/read-file`,
4847
- JSON.stringify({ session: sessionId, path: path32, ...options?.maxBytes === void 0 ? {} : { maxBytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } }),
4848
- (status, message) => `reading ${path32} from ${sessionId} failed (HTTP ${String(status)}): ${message}`
4850
+ JSON.stringify({ session: sessionId, path: path33, ...options?.maxBytes === void 0 ? {} : { maxBytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } }),
4851
+ (status, message) => `reading ${path33} from ${sessionId} failed (HTTP ${String(status)}): ${message}`
4849
4852
  ),
4850
4853
  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}`),
4851
4854
  keepAlive: async (sessionId) => await writeOf(`${CONTROL_PATH_PREFIX}/keep-alive`, JSON.stringify({ session: sessionId }), (status, message) => `keeping ${sessionId} alive failed (HTTP ${String(status)}): ${message}`),
@@ -5000,12 +5003,12 @@ function tlsFacts(options) {
5000
5003
  }
5001
5004
  function realRcEventDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_PORT }) {
5002
5005
  const agent = new ExemptTlsAgent();
5003
- const post = async (path32, headers, body) => await new Promise((resolve, reject) => {
5006
+ const post = async (path33, headers, body) => await new Promise((resolve, reject) => {
5004
5007
  const options = {
5005
5008
  host: target.host,
5006
5009
  port: target.port,
5007
5010
  method: "POST",
5008
- path: path32,
5011
+ path: path33,
5009
5012
  // 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.
5010
5013
  headers: { ...headers, host: target.servername ?? target.host, "content-length": String(Buffer.byteLength(body, "utf8")) },
5011
5014
  agent
@@ -5070,12 +5073,12 @@ function lateRcStreamDial(resolve) {
5070
5073
  }
5071
5074
  function realRcStreamDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_PORT }) {
5072
5075
  const agent = new ExemptTlsAgent();
5073
- const request4 = async (method, path32, headers, body, signal) => await new Promise((resolve, reject) => {
5076
+ const request4 = async (method, path33, headers, body, signal) => await new Promise((resolve, reject) => {
5074
5077
  const options = {
5075
5078
  host: target.host,
5076
5079
  port: target.port,
5077
5080
  method,
5078
- path: path32,
5081
+ path: path33,
5079
5082
  // 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.
5080
5083
  headers: { ...headers, host: target.servername ?? target.host, ...body === void 0 ? {} : { "content-length": String(Buffer.byteLength(body, "utf8")) } },
5081
5084
  agent,
@@ -5117,9 +5120,9 @@ function realRcStreamDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_P
5117
5120
  return { status, body: await readAll(response) };
5118
5121
  },
5119
5122
  openStream: async (sessionId, headers, resume, signal) => {
5120
- const path32 = resume === void 0 ? `/v1/code/sessions/${encodeURIComponent(sessionId)}/events/stream` : `/v1/code/sessions/${encodeURIComponent(sessionId)}/events/stream?from_sequence_num=${String(resume.fromSequenceNum)}`;
5123
+ const path33 = resume === void 0 ? `/v1/code/sessions/${encodeURIComponent(sessionId)}/events/stream` : `/v1/code/sessions/${encodeURIComponent(sessionId)}/events/stream?from_sequence_num=${String(resume.fromSequenceNum)}`;
5121
5124
  const streamHeaders = resume === void 0 ? headers : { ...headers, "last-event-id": String(resume.fromSequenceNum) };
5122
- const { status, response } = await request4("GET", path32, streamHeaders, void 0, signal);
5125
+ const { status, response } = await request4("GET", path33, streamHeaders, void 0, signal);
5123
5126
  if (!isSuccessful2(status)) {
5124
5127
  await readAll(response);
5125
5128
  return { status, chunks: NO_CHUNKS };
@@ -5423,7 +5426,7 @@ var import_undici = require("undici");
5423
5426
  // package.json
5424
5427
  var package_default = {
5425
5428
  name: "agent-shim",
5426
- version: "8.38.0",
5429
+ version: "8.39.0",
5427
5430
  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.",
5428
5431
  license: "MIT",
5429
5432
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -7234,19 +7237,19 @@ function writePools(paths, pools) {
7234
7237
  applyPatch(paths.globalConfigFile, GlobalConfigSchema, { pools }, { defaults: {} });
7235
7238
  }
7236
7239
  function poolCycleOf(pools, name) {
7237
- const walk = (current, path32) => {
7240
+ const walk = (current, path33) => {
7238
7241
  for (const entry of pools[current]?.identities ?? []) {
7239
7242
  const nested = poolNameOf(poolMemberIdentity(entry));
7240
7243
  if (nested === void 0) {
7241
7244
  continue;
7242
7245
  }
7243
7246
  if (nested === name) {
7244
- return [...path32, nested];
7247
+ return [...path33, nested];
7245
7248
  }
7246
- if (path32.includes(nested)) {
7249
+ if (path33.includes(nested)) {
7247
7250
  continue;
7248
7251
  }
7249
- const found = walk(nested, [...path32, nested]);
7252
+ const found = walk(nested, [...path33, nested]);
7250
7253
  if (found !== void 0) {
7251
7254
  return found;
7252
7255
  }
@@ -8553,6 +8556,9 @@ function detachedDaemonSpawnOptions(logFd, env) {
8553
8556
  function spawnDaemonThrough(executable) {
8554
8557
  return (paths, subcommand, logPath) => spawnDetachedDaemon({ command: executable, args: [subcommand] }, paths, subcommand, logPath);
8555
8558
  }
8559
+ function spawnDaemonThroughScript(script) {
8560
+ return (paths, subcommand, logPath) => spawnDetachedDaemon({ command: process.execPath, args: [script, subcommand] }, paths, subcommand, logPath);
8561
+ }
8556
8562
  function spawnDetachedDaemon(invocation, paths, subcommand, logPath) {
8557
8563
  import_node_fs6.default.mkdirSync(import_node_path22.default.dirname(logPath), { recursive: true });
8558
8564
  const logFd = import_node_fs6.default.openSync(logPath, "a");
@@ -13503,6 +13509,22 @@ function runLauncher(params) {
13503
13509
  var import_node_os6 = __toESM(require("node:os"), 1);
13504
13510
  var import_node_crypto12 = require("node:crypto");
13505
13511
 
13512
+ // src/ownCli.ts
13513
+ var import_node_path31 = __toESM(require("node:path"), 1);
13514
+ var OWN_CLI_FILE_NAME = "cli.cjs";
13515
+ var OwnCliPathUnknownError = class extends CliError {
13516
+ constructor() {
13517
+ super("this agent-shim build does not record where it was loaded from, so the path of its command line bundle is unknown: pass the path of the agent-shim executable explicitly");
13518
+ this.name = "OwnCliPathUnknownError";
13519
+ }
13520
+ };
13521
+ function agentShimCliPath(distDir = typeof __AGENT_SHIM_DIST_DIR__ === "string" ? __AGENT_SHIM_DIST_DIR__ : void 0) {
13522
+ if (distDir === void 0) {
13523
+ throw new OwnCliPathUnknownError();
13524
+ }
13525
+ return import_node_path31.default.join(distDir, OWN_CLI_FILE_NAME);
13526
+ }
13527
+
13506
13528
  // src/frontdoor/realFrontDoorPort.ts
13507
13529
  var import_node_fs10 = __toESM(require("node:fs"), 1);
13508
13530
 
@@ -13572,11 +13594,11 @@ function probeFrontDoorSync(port, caPem) {
13572
13594
 
13573
13595
  // src/frontdoor/trust.ts
13574
13596
  var import_node_crypto11 = require("node:crypto");
13575
- var import_node_path31 = __toESM(require("node:path"), 1);
13597
+ var import_node_path32 = __toESM(require("node:path"), 1);
13576
13598
  var BUNDLE_NAME_HEX_DIGITS = 16;
13577
13599
  function resolveTrustBundle(params) {
13578
13600
  const { caCertFile, bundlesDir, variable, inherited, fs: fs12 } = params;
13579
- if (inherited === void 0 || inherited === "" || import_node_path31.default.resolve(inherited) === import_node_path31.default.resolve(caCertFile)) {
13601
+ if (inherited === void 0 || inherited === "" || import_node_path32.default.resolve(inherited) === import_node_path32.default.resolve(caCertFile)) {
13580
13602
  return { path: caCertFile };
13581
13603
  }
13582
13604
  const caPem = fs12.readFileUtf8(caCertFile);
@@ -13594,7 +13616,7 @@ function resolveTrustBundle(params) {
13594
13616
  }
13595
13617
  const combined = `${inheritedPem.trimEnd()}
13596
13618
  ${caPem}`;
13597
- const bundle = import_node_path31.default.join(bundlesDir, `${(0, import_node_crypto11.createHash)("sha256").update(combined).digest("hex").slice(0, BUNDLE_NAME_HEX_DIGITS)}.pem`);
13619
+ const bundle = import_node_path32.default.join(bundlesDir, `${(0, import_node_crypto11.createHash)("sha256").update(combined).digest("hex").slice(0, BUNDLE_NAME_HEX_DIGITS)}.pem`);
13598
13620
  if (!fs12.exists(bundle)) {
13599
13621
  fs12.mkdirp(bundlesDir);
13600
13622
  fs12.writeFileAtomic(bundle, combined);
@@ -13733,9 +13755,7 @@ function prepareClaudeLaunch(options) {
13733
13755
  throw new LaunchRefusedError(refusals.join("\n") || `the launch was refused (exit ${String(code)})`, code);
13734
13756
  }
13735
13757
  };
13736
- const spawnDaemon = options.agentShim === void 0 ? () => {
13737
- throw new LaunchRefusedError("this launch routes through the front door or headroom, which need `agentShim`, the path of the agent-shim executable, to start their daemons", 1);
13738
- } : spawnDaemonThrough(options.agentShim);
13758
+ const spawnDaemon = options.agentShim === void 0 ? (spawnPaths, subcommand, logPath) => spawnDaemonThroughScript(agentShimCliPath())(spawnPaths, subcommand, logPath) : spawnDaemonThrough(options.agentShim);
13739
13759
  return prepareLaunch(realPrepareLaunchParams(paths, { proc, log, spawnDaemon, farm: buildFarmRuntime(paths, options.cwd) }));
13740
13760
  }
13741
13761
  // Annotate the CommonJS export names for ESM import in node:
@@ -13792,6 +13812,7 @@ function prepareClaudeLaunch(options) {
13792
13812
  LaunchLifecycleEventSchema,
13793
13813
  LaunchRefusedError,
13794
13814
  LegacyProviderFileError,
13815
+ OWN_CLI_FILE_NAME,
13795
13816
  PROMPT_CACHE_TTL_MS,
13796
13817
  PlanClassSchema,
13797
13818
  PoolNameSchema,
@@ -13847,6 +13868,7 @@ function prepareClaudeLaunch(options) {
13847
13868
  addIdentity,
13848
13869
  addPool,
13849
13870
  addProvider,
13871
+ agentShimCliPath,
13850
13872
  answerRcControlRequest,
13851
13873
  authenticateRcSessionMcpServer,
13852
13874
  buildEntryFacts,
package/dist/index.mjs CHANGED
@@ -1,3 +1,5 @@
1
+ const __AGENT_SHIM_DIST_DIR__ = import.meta.dirname;
2
+
1
3
  // src/config/classify.ts
2
4
  import picomatch from "picomatch";
3
5
 
@@ -2911,8 +2913,8 @@ function parseConnectTarget(authority) {
2911
2913
  function isInterceptedHost(host, interceptHosts) {
2912
2914
  return interceptHosts.includes(host);
2913
2915
  }
2914
- function servedByPipeline(path32) {
2915
- return path32?.startsWith(ROUTED_PATH_PREFIX) === true;
2916
+ function servedByPipeline(path33) {
2917
+ return path33?.startsWith(ROUTED_PATH_PREFIX) === true;
2916
2918
  }
2917
2919
  var HOP_BY_HOP_HEADERS = /* @__PURE__ */ new Set([
2918
2920
  "connection",
@@ -3446,11 +3448,11 @@ function createRcSessionTracker(deps) {
3446
3448
  };
3447
3449
  const observeExchange = (request4) => {
3448
3450
  const method = (request4.method ?? "").toUpperCase();
3449
- const path32 = new URL(request4.url ?? "/", "http://127.0.0.1").pathname;
3450
- if (!path32.startsWith(RC_SESSIONS_PATH_PREFIX)) {
3451
+ const path33 = new URL(request4.url ?? "/", "http://127.0.0.1").pathname;
3452
+ if (!path33.startsWith(RC_SESSIONS_PATH_PREFIX)) {
3451
3453
  return void 0;
3452
3454
  }
3453
- const tail = path32.slice(RC_SESSIONS_PATH_PREFIX.length);
3455
+ const tail = path33.slice(RC_SESSIONS_PATH_PREFIX.length);
3454
3456
  const facts = {
3455
3457
  oauthAuthorization: oauthAuthorizationOf(request4.headers),
3456
3458
  anthropicVersion: singleHeader(request4.headers, "anthropic-version"),
@@ -3832,8 +3834,8 @@ var RC_READ_FILE_ENCODINGS = ["utf-8", "base64"];
3832
3834
  function isRcReadFileEncoding(value) {
3833
3835
  return RC_READ_FILE_ENCODINGS.some((encoding) => encoding === value);
3834
3836
  }
3835
- function buildRcReadFilePayload(requestId, path32, options) {
3836
- return buildRcControlRequestPayload(requestId, { subtype: "read_file", path: path32, ...options?.maxBytes === void 0 ? {} : { max_bytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } });
3837
+ function buildRcReadFilePayload(requestId, path33, options) {
3838
+ return buildRcControlRequestPayload(requestId, { subtype: "read_file", path: path33, ...options?.maxBytes === void 0 ? {} : { max_bytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } });
3837
3839
  }
3838
3840
  function buildRcFileSuggestionsPayload(requestId, query) {
3839
3841
  return buildRcControlRequestPayload(requestId, { subtype: "file_suggestions", query });
@@ -3935,15 +3937,15 @@ async function getRcSessionContextUsage(deps, sessionId, detail) {
3935
3937
  const result = await deliverRcClientPayload(deps, sessionId, buildRcGetContextUsagePayload(requestId, detail), `request the context usage of session ${sessionId}`);
3936
3938
  return result.ok ? { ...result, requestId } : result;
3937
3939
  }
3938
- async function readRcSessionFile(deps, sessionId, path32, options) {
3939
- if (path32 === "") {
3940
+ async function readRcSessionFile(deps, sessionId, path33, options) {
3941
+ if (path33 === "") {
3940
3942
  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" };
3941
3943
  }
3942
3944
  if (options?.maxBytes !== void 0 && (!Number.isInteger(options.maxBytes) || options.maxBytes <= 0)) {
3943
3945
  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" };
3944
3946
  }
3945
3947
  const requestId = deps.newUuid();
3946
- const result = await deliverRcClientPayload(deps, sessionId, buildRcReadFilePayload(requestId, path32, options), `read ${path32} from session ${sessionId}`);
3948
+ const result = await deliverRcClientPayload(deps, sessionId, buildRcReadFilePayload(requestId, path33, options), `read ${path33} from session ${sessionId}`);
3947
3949
  return result.ok ? { ...result, requestId } : result;
3948
3950
  }
3949
3951
  async function suggestRcSessionFiles(deps, sessionId, query) {
@@ -4108,11 +4110,11 @@ function createRcControlHandler(deps) {
4108
4110
  path: "read-file",
4109
4111
  read: (body) => {
4110
4112
  const session = bodyString(body, "session");
4111
- const path32 = bodyString(body, "path");
4113
+ const path33 = bodyString(body, "path");
4112
4114
  const maxBytes = "maxBytes" in body ? bodyPositiveInteger(body, "maxBytes") : void 0;
4113
4115
  const encoding = "encoding" in body && isRcReadFileEncoding(body.encoding) ? body.encoding : void 0;
4114
- const refused2 = session === void 0 || path32 === void 0 || "maxBytes" in body && maxBytes === void 0 || "encoding" in body && encoding === void 0;
4115
- 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, path32, { ...maxBytes === void 0 ? {} : { maxBytes }, ...encoding === void 0 ? {} : { encoding } }) };
4116
+ const refused2 = session === void 0 || path33 === void 0 || "maxBytes" in body && maxBytes === void 0 || "encoding" in body && encoding === void 0;
4117
+ 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, path33, { ...maxBytes === void 0 ? {} : { maxBytes }, ...encoding === void 0 ? {} : { encoding } }) };
4116
4118
  }
4117
4119
  },
4118
4120
  {
@@ -4422,9 +4424,9 @@ function requestIdOfBody(body) {
4422
4424
  }
4423
4425
  function frontDoorRcControl(transport, token) {
4424
4426
  const headers = { authorization: `Bearer ${token}` };
4425
- const listAnswerOf = async (path32, what) => {
4427
+ const listAnswerOf = async (path33, what) => {
4426
4428
  try {
4427
- return await transport.request({ method: "GET", path: path32, headers });
4429
+ return await transport.request({ method: "GET", path: path33, headers });
4428
4430
  } catch (error) {
4429
4431
  throw new Error(`${what}: could not reach the front door's control listener: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
4430
4432
  }
@@ -4496,10 +4498,10 @@ function frontDoorRcControl(transport, token) {
4496
4498
  }
4497
4499
  return pending;
4498
4500
  };
4499
- const writeOf = async (path32, body, describeFailure) => {
4501
+ const writeOf = async (path33, body, describeFailure) => {
4500
4502
  let answer;
4501
4503
  try {
4502
- answer = await transport.request({ method: "POST", path: path32, headers: { ...headers, "content-type": "application/json" }, body });
4504
+ answer = await transport.request({ method: "POST", path: path33, headers: { ...headers, "content-type": "application/json" }, body });
4503
4505
  } catch (error) {
4504
4506
  return { ok: false, message: `could not reach the front door's control listener: ${error instanceof Error ? error.message : String(error)}` };
4505
4507
  }
@@ -4530,10 +4532,10 @@ function frontDoorRcControl(transport, token) {
4530
4532
  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}`),
4531
4533
  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}`),
4532
4534
  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}`),
4533
- readFile: async (sessionId, path32, options) => await writeOf(
4535
+ readFile: async (sessionId, path33, options) => await writeOf(
4534
4536
  `${CONTROL_PATH_PREFIX}/read-file`,
4535
- JSON.stringify({ session: sessionId, path: path32, ...options?.maxBytes === void 0 ? {} : { maxBytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } }),
4536
- (status, message) => `reading ${path32} from ${sessionId} failed (HTTP ${String(status)}): ${message}`
4537
+ JSON.stringify({ session: sessionId, path: path33, ...options?.maxBytes === void 0 ? {} : { maxBytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } }),
4538
+ (status, message) => `reading ${path33} from ${sessionId} failed (HTTP ${String(status)}): ${message}`
4537
4539
  ),
4538
4540
  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}`),
4539
4541
  keepAlive: async (sessionId) => await writeOf(`${CONTROL_PATH_PREFIX}/keep-alive`, JSON.stringify({ session: sessionId }), (status, message) => `keeping ${sessionId} alive failed (HTTP ${String(status)}): ${message}`),
@@ -4688,12 +4690,12 @@ function tlsFacts(options) {
4688
4690
  }
4689
4691
  function realRcEventDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_PORT }) {
4690
4692
  const agent = new ExemptTlsAgent();
4691
- const post = async (path32, headers, body) => await new Promise((resolve, reject) => {
4693
+ const post = async (path33, headers, body) => await new Promise((resolve, reject) => {
4692
4694
  const options = {
4693
4695
  host: target.host,
4694
4696
  port: target.port,
4695
4697
  method: "POST",
4696
- path: path32,
4698
+ path: path33,
4697
4699
  // 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.
4698
4700
  headers: { ...headers, host: target.servername ?? target.host, "content-length": String(Buffer.byteLength(body, "utf8")) },
4699
4701
  agent
@@ -4758,12 +4760,12 @@ function lateRcStreamDial(resolve) {
4758
4760
  }
4759
4761
  function realRcStreamDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_PORT }) {
4760
4762
  const agent = new ExemptTlsAgent();
4761
- const request4 = async (method, path32, headers, body, signal) => await new Promise((resolve, reject) => {
4763
+ const request4 = async (method, path33, headers, body, signal) => await new Promise((resolve, reject) => {
4762
4764
  const options = {
4763
4765
  host: target.host,
4764
4766
  port: target.port,
4765
4767
  method,
4766
- path: path32,
4768
+ path: path33,
4767
4769
  // 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.
4768
4770
  headers: { ...headers, host: target.servername ?? target.host, ...body === void 0 ? {} : { "content-length": String(Buffer.byteLength(body, "utf8")) } },
4769
4771
  agent,
@@ -4805,9 +4807,9 @@ function realRcStreamDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_P
4805
4807
  return { status, body: await readAll(response) };
4806
4808
  },
4807
4809
  openStream: async (sessionId, headers, resume, signal) => {
4808
- const path32 = resume === void 0 ? `/v1/code/sessions/${encodeURIComponent(sessionId)}/events/stream` : `/v1/code/sessions/${encodeURIComponent(sessionId)}/events/stream?from_sequence_num=${String(resume.fromSequenceNum)}`;
4810
+ const path33 = resume === void 0 ? `/v1/code/sessions/${encodeURIComponent(sessionId)}/events/stream` : `/v1/code/sessions/${encodeURIComponent(sessionId)}/events/stream?from_sequence_num=${String(resume.fromSequenceNum)}`;
4809
4811
  const streamHeaders = resume === void 0 ? headers : { ...headers, "last-event-id": String(resume.fromSequenceNum) };
4810
- const { status, response } = await request4("GET", path32, streamHeaders, void 0, signal);
4812
+ const { status, response } = await request4("GET", path33, streamHeaders, void 0, signal);
4811
4813
  if (!isSuccessful2(status)) {
4812
4814
  await readAll(response);
4813
4815
  return { status, chunks: NO_CHUNKS };
@@ -5111,7 +5113,7 @@ import { Agent as Agent3, fetch as undiciFetch } from "undici";
5111
5113
  // package.json
5112
5114
  var package_default = {
5113
5115
  name: "agent-shim",
5114
- version: "8.38.0",
5116
+ version: "8.39.0",
5115
5117
  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.",
5116
5118
  license: "MIT",
5117
5119
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -6922,19 +6924,19 @@ function writePools(paths, pools) {
6922
6924
  applyPatch(paths.globalConfigFile, GlobalConfigSchema, { pools }, { defaults: {} });
6923
6925
  }
6924
6926
  function poolCycleOf(pools, name) {
6925
- const walk = (current, path32) => {
6927
+ const walk = (current, path33) => {
6926
6928
  for (const entry of pools[current]?.identities ?? []) {
6927
6929
  const nested = poolNameOf(poolMemberIdentity(entry));
6928
6930
  if (nested === void 0) {
6929
6931
  continue;
6930
6932
  }
6931
6933
  if (nested === name) {
6932
- return [...path32, nested];
6934
+ return [...path33, nested];
6933
6935
  }
6934
- if (path32.includes(nested)) {
6936
+ if (path33.includes(nested)) {
6935
6937
  continue;
6936
6938
  }
6937
- const found = walk(nested, [...path32, nested]);
6939
+ const found = walk(nested, [...path33, nested]);
6938
6940
  if (found !== void 0) {
6939
6941
  return found;
6940
6942
  }
@@ -8241,6 +8243,9 @@ function detachedDaemonSpawnOptions(logFd, env) {
8241
8243
  function spawnDaemonThrough(executable) {
8242
8244
  return (paths, subcommand, logPath) => spawnDetachedDaemon({ command: executable, args: [subcommand] }, paths, subcommand, logPath);
8243
8245
  }
8246
+ function spawnDaemonThroughScript(script) {
8247
+ return (paths, subcommand, logPath) => spawnDetachedDaemon({ command: process.execPath, args: [script, subcommand] }, paths, subcommand, logPath);
8248
+ }
8244
8249
  function spawnDetachedDaemon(invocation, paths, subcommand, logPath) {
8245
8250
  fs7.mkdirSync(path22.dirname(logPath), { recursive: true });
8246
8251
  const logFd = fs7.openSync(logPath, "a");
@@ -13191,6 +13196,22 @@ function runLauncher(params) {
13191
13196
  import os7 from "node:os";
13192
13197
  import { randomUUID as randomUUID5 } from "node:crypto";
13193
13198
 
13199
+ // src/ownCli.ts
13200
+ import path31 from "node:path";
13201
+ var OWN_CLI_FILE_NAME = "cli.cjs";
13202
+ var OwnCliPathUnknownError = class extends CliError {
13203
+ constructor() {
13204
+ super("this agent-shim build does not record where it was loaded from, so the path of its command line bundle is unknown: pass the path of the agent-shim executable explicitly");
13205
+ this.name = "OwnCliPathUnknownError";
13206
+ }
13207
+ };
13208
+ function agentShimCliPath(distDir = typeof __AGENT_SHIM_DIST_DIR__ === "string" ? __AGENT_SHIM_DIST_DIR__ : void 0) {
13209
+ if (distDir === void 0) {
13210
+ throw new OwnCliPathUnknownError();
13211
+ }
13212
+ return path31.join(distDir, OWN_CLI_FILE_NAME);
13213
+ }
13214
+
13194
13215
  // src/frontdoor/realFrontDoorPort.ts
13195
13216
  import fs11 from "node:fs";
13196
13217
 
@@ -13260,11 +13281,11 @@ function probeFrontDoorSync(port, caPem) {
13260
13281
 
13261
13282
  // src/frontdoor/trust.ts
13262
13283
  import { createHash as createHash6 } from "node:crypto";
13263
- import path31 from "node:path";
13284
+ import path32 from "node:path";
13264
13285
  var BUNDLE_NAME_HEX_DIGITS = 16;
13265
13286
  function resolveTrustBundle(params) {
13266
13287
  const { caCertFile, bundlesDir, variable, inherited, fs: fs12 } = params;
13267
- if (inherited === void 0 || inherited === "" || path31.resolve(inherited) === path31.resolve(caCertFile)) {
13288
+ if (inherited === void 0 || inherited === "" || path32.resolve(inherited) === path32.resolve(caCertFile)) {
13268
13289
  return { path: caCertFile };
13269
13290
  }
13270
13291
  const caPem = fs12.readFileUtf8(caCertFile);
@@ -13282,7 +13303,7 @@ function resolveTrustBundle(params) {
13282
13303
  }
13283
13304
  const combined = `${inheritedPem.trimEnd()}
13284
13305
  ${caPem}`;
13285
- const bundle = path31.join(bundlesDir, `${createHash6("sha256").update(combined).digest("hex").slice(0, BUNDLE_NAME_HEX_DIGITS)}.pem`);
13306
+ const bundle = path32.join(bundlesDir, `${createHash6("sha256").update(combined).digest("hex").slice(0, BUNDLE_NAME_HEX_DIGITS)}.pem`);
13286
13307
  if (!fs12.exists(bundle)) {
13287
13308
  fs12.mkdirp(bundlesDir);
13288
13309
  fs12.writeFileAtomic(bundle, combined);
@@ -13421,9 +13442,7 @@ function prepareClaudeLaunch(options) {
13421
13442
  throw new LaunchRefusedError(refusals.join("\n") || `the launch was refused (exit ${String(code)})`, code);
13422
13443
  }
13423
13444
  };
13424
- const spawnDaemon = options.agentShim === void 0 ? () => {
13425
- throw new LaunchRefusedError("this launch routes through the front door or headroom, which need `agentShim`, the path of the agent-shim executable, to start their daemons", 1);
13426
- } : spawnDaemonThrough(options.agentShim);
13445
+ const spawnDaemon = options.agentShim === void 0 ? (spawnPaths, subcommand, logPath) => spawnDaemonThroughScript(agentShimCliPath())(spawnPaths, subcommand, logPath) : spawnDaemonThrough(options.agentShim);
13427
13446
  return prepareLaunch(realPrepareLaunchParams(paths, { proc, log, spawnDaemon, farm: buildFarmRuntime(paths, options.cwd) }));
13428
13447
  }
13429
13448
  export {
@@ -13479,6 +13498,7 @@ export {
13479
13498
  LaunchLifecycleEventSchema,
13480
13499
  LaunchRefusedError,
13481
13500
  LegacyProviderFileError,
13501
+ OWN_CLI_FILE_NAME,
13482
13502
  PROMPT_CACHE_TTL_MS,
13483
13503
  PlanClassSchema,
13484
13504
  PoolNameSchema,
@@ -13534,6 +13554,7 @@ export {
13534
13554
  addIdentity,
13535
13555
  addPool,
13536
13556
  addProvider,
13557
+ agentShimCliPath,
13537
13558
  answerRcControlRequest,
13538
13559
  authenticateRcSessionMcpServer,
13539
13560
  buildEntryFacts,
@@ -7698,7 +7698,7 @@ interface PrepareClaudeLaunchOptions {
7698
7698
  readonly env: Readonly<Record<string, string | undefined>>;
7699
7699
  /** The state root; defaults to the one the command line resolves. */
7700
7700
  readonly paths?: LayoutPaths;
7701
- /** The path of the agent-shim executable, used to start the front door and headroom daemons when the launch routes through them. Without it such a launch is refused: this process is not agent-shim, and re-running it would run the host program again. */
7701
+ /** The path of the agent-shim executable, used to start the front door and headroom daemons when the launch routes through them. Without it the daemons start through the command line bundle of this same package (`agentShimCliPath`), run with the Node running this process; pass it to use another build or a compiled binary. */
7702
7702
  readonly agentShim?: string;
7703
7703
  }
7704
7704
  /**
@@ -7708,5 +7708,14 @@ interface PrepareClaudeLaunchOptions {
7708
7708
  */
7709
7709
  declare function prepareClaudeLaunch(options: PrepareClaudeLaunchOptions): LaunchPlan;
7710
7710
 
7711
- export { AMBIENT_CREDENTIAL_VARS, CHECK_CREDENTIAL_APPLIES, CONNECT_INTERCEPT_HOST, CONNECT_INTERCEPT_HOSTS, CONNECT_LIMITS, CONTROL_PATH_PREFIX, CategoryClassificationOverlaySchema, CategoryClassificationSchema, CategoryMapSchema, CheckReportJsonSchema, CheckRunInputSchema, CliError, ConfigProfileSchema, CredentialCacheSchema, CredentialSchema, CredentialSourceSchema, DOOR_EVENT_BUFFER_EVENTS, DOOR_EVENT_SOURCE_RC, DOOR_HEALTH_EVENT_SOURCE, DirectoryRuleAlreadyExistsError, DirectoryRuleMissingTargetError, DirectoryRuleNotFoundError, DirectoryRuleSchema, DirectoryRulesSchema, DoctorFindingSchema, DoctorRunOutputSchema, DoorEventSchema, DoorEventSourceQuerySchema, DoorHealthEventSchema, EXIT_FAILURE, EXIT_USAGE, EffectiveWindowSchema, EntryValueSchema, FARM_MANIFEST_FILENAME, FrontDoorSessionStatusSchema, FrontDoorSessionsOutputSchema, FrontDoorStartError, FrontDoorStateSchema, FrontDoorStatusOutputSchema, GlobalConfigSchema, HeadroomSocketTargetSchema, HeadroomStartError, IdentityAlreadyExistsError, IdentityNotFoundError, IdentitySchema, InvalidCategoryNameError, InvalidIdentityNameError, InvalidProviderNameError, LAUNCH_EVENT_SOURCE, LaunchLifecycleEventSchema, LaunchRefusedError, LegacyProviderFileError, PROMPT_CACHE_TTL_MS, PlanClassSchema, PoolNameSchema, PoolNotFoundError, PoolPickReportSchema, PoolSchema, PortableConfigSchema, ProfileAlreadyExistsError, ProfileNotFoundError, ProviderAlreadyExistsError, ProviderKindMismatchError, ProviderNotFoundError, ProviderSchema, QUOTA_EXPIRING_EVENT_SOURCE, QuotaExpiringEventSchema, RC_CONTEXT_USAGE_DETAILS, RC_IDLE_EXPIRY_MS, RC_ORPC_PATH_PREFIX, RC_PENDING_DEADLINE_MS, RC_PERMISSION_MODES, RC_READ_FILE_ENCODINGS, RC_REQUEST_PARSE_CAP_BYTES, RC_SELF_HOST_ENV, RC_SELF_HOST_KEEPALIVE_MS, RC_SELF_HOST_RECORD_DIR, RC_SELF_HOST_RECORD_FILE, RC_SELF_HOST_RETENTION_MS, RC_SELF_HOST_SCOPE_LIST, RC_SELF_HOST_WORKER_JWT_TTL_SECONDS, RC_SESSIONS_PATH_PREFIX, RC_STREAM_BACKOFF_MS, RC_WEB_FETCH_ALLOW_PRIVATE_ENV, RC_WEB_FETCH_DEADLINE_MS, RC_WEB_FETCH_MAX_BYTES, RC_WEB_FETCH_MAX_REDIRECTS, ROUTED_PATH_PREFIX, RcLiveRateLimitSchema, RcPermissionModeSchema, RcRateLimitInfoSchema, RcRateLimitWindowSchema, RcStreamEnvelopeSchema, RcStreamEventSchema, USAGE_EVENT_SOURCE, UsageError, UsageListOutputSchema, UsageLiveOutputSchema, UsageSnapshotError, UsageSnapshotSchema, UsageWindowsInputSchema, UsageWindowsOutputSchema, WhenSchema, addDirectoryRule, addIdentity, addPool, addProvider, answerRcControlRequest, authenticateRcSessionMcpServer, buildEntryFacts, buildLayoutPaths, buildRcControlRequestPayload, buildRcControlResponsePayload, buildRcEndSessionPayload, buildRcEventWriteBody, buildRcFileSuggestionsPayload, buildRcGetContextUsagePayload, buildRcGetUsagePayload, buildRcInterruptPayload, buildRcKeepAlivePayload, buildRcMarkReadBody, buildRcMcpAuthenticatePayload, buildRcMcpOAuthCallbackUrlPayload, buildRcMcpReconnectPayload, buildRcMcpStatusPayload, buildRcReadFilePayload, buildRcSetModelPayload, buildRcSetPermissionModePayload, buildRcUserMessagePayload, carryOver, checkReportHasWarnings, checkReportToJson, collectCheckReport, collectDoctorReport, collectFrontDoorStatus, collectPoolPick, createControlApiRouter, createDoorApiNodeHandler, createDoorApiRouter, createDoorEventHub, createDoorHealthPublisher, createEventsApiRouter, createLaunchEventPublisher, createLeafCache, createProfile, createQuotaExpiringPublisher, createRcApiNodeHandler, createRcApiRouter, createRcControlHandler, createRcCredentialStore, createRcEventFanout, createRcLiveUsage, createRcSelfHostSurface, createRcSessionTracker, createRcStreamHub, createSseParser, describeProviderEndpoint, detectAmbientCredential, doorApiAuth, doorApiNodeHandlerOf, effectiveWindow, endRcSession, ensureCa, ensureFrontDoor, ensureHeadroom, evaluateAmbientCredentialGuard, evaluateWhen, fetchThroughWebProxy, formatAmbientCredentialGuardMessage, formatCheckReport, formatDoctorReport, formatFrontDoorStatus, forwardableHeaders, frontDoorApiClient, frontDoorApiLink, frontDoorRcApiClient, frontDoorRcControl, generateCa, getRcSessionContextUsage, getRcSessionMcpStatus, getRcSessionUsage, headroomSocketTarget, identityExists, injectRcUserMessage, interruptRcSession, isIdentityDirectoryName, isInterceptedHost, isPrivateAddress, isRcContextUsageDetail, isRcPermissionMode, isRcReadFileEncoding, lateRcEventDial, lateRcStreamDial, listDirectoryRules, listIdentities, listProfiles, listProviders, listUsageSnapshots, matchBranch, mintLeaf, mintRcSelfHostCredential, observingRoutedRoute, parseConnectTarget, parseRcStreamEnvelope, planOf, prepareClaudeLaunch, prepareLaunch, profileExists, providerExists, rankPool, rcEventWriteResultFromAnswer, rcFanoutOnDoorHub, rcObserverAsPassthrough, rcRateLimitInfoOf, rcSelfHostFromEnv, rcWebFetchAllowsPrivateFromEnv, readActiveIdentity, readDirectoryRules, readFarmManifest, readGlobalConfig, readIdentity, readPools, readProfile, readProvider, readRcSelfHostRecord, readRcSessionFile, readUsageSnapshot, realConnectCertStore, realConnectEffects, realRcControlTransport, realRcEventDial, realRcStreamDial, realRcWebFetch, reconnectRcSessionMcpServer, recoverFarm, recoveryDiagnostics, removeDirectoryRule, removeIdentity, removePool, removeProfile, removeProvider, requirePool, resolveAgentShimHome, resolveClaudeHome, resolveDecisions, resolveLayoutPaths, resolveSupervisorConfig, resyncFarm, runCheck, runDoctor, runFrontDoorSupervisor, runLauncher, runSupervisor, sendRcKeepAlive, servedByPipeline, setAllowAmbientCredential, setDefaultConfigProfile, setGlobalDefaultProfile, setIdentityCredential, setPool, setProfileCategories, setProfileEntries, setProfileLaunchFlags, setProfileMetadata, setRcSessionModel, setRcSessionPermissionMode, snapshotPath, spawnClaude, startConnectServer, submitRcSessionMcpOAuthCallbackUrl, suggestRcSessionFiles, teleportRcSession, topLevelNames, updateDirectoryRule, updateProvider, useIdentity, writeDirectoryRules };
7711
+ /** The file name of the command line bundle that ships beside the library files in `dist/`. */
7712
+ declare const OWN_CLI_FILE_NAME = "cli.cjs";
7713
+ /**
7714
+ * The path of the command line bundle (`dist/cli.cjs`) of the installed agent-shim package, found from where the library file itself was loaded, so a host that embeds the library can start the front door and headroom daemons through the same release without resolving the package manifest itself. Run it with Node: `spawn(process.execPath, [agentShimCliPath(), ...])`.
7715
+ *
7716
+ * `distDir` is the directory of the library file and exists for a caller or test that knows better; it defaults to the one the build recorded. Throws an `OwnCliPathUnknownError` when there is none, which is the case only when the sources run unbuilt.
7717
+ */
7718
+ declare function agentShimCliPath(distDir?: string | undefined): string;
7719
+
7720
+ export { AMBIENT_CREDENTIAL_VARS, CHECK_CREDENTIAL_APPLIES, CONNECT_INTERCEPT_HOST, CONNECT_INTERCEPT_HOSTS, CONNECT_LIMITS, CONTROL_PATH_PREFIX, CategoryClassificationOverlaySchema, CategoryClassificationSchema, CategoryMapSchema, CheckReportJsonSchema, CheckRunInputSchema, CliError, ConfigProfileSchema, CredentialCacheSchema, CredentialSchema, CredentialSourceSchema, DOOR_EVENT_BUFFER_EVENTS, DOOR_EVENT_SOURCE_RC, DOOR_HEALTH_EVENT_SOURCE, DirectoryRuleAlreadyExistsError, DirectoryRuleMissingTargetError, DirectoryRuleNotFoundError, DirectoryRuleSchema, DirectoryRulesSchema, DoctorFindingSchema, DoctorRunOutputSchema, DoorEventSchema, DoorEventSourceQuerySchema, DoorHealthEventSchema, EXIT_FAILURE, EXIT_USAGE, EffectiveWindowSchema, EntryValueSchema, FARM_MANIFEST_FILENAME, FrontDoorSessionStatusSchema, FrontDoorSessionsOutputSchema, FrontDoorStartError, FrontDoorStateSchema, FrontDoorStatusOutputSchema, GlobalConfigSchema, HeadroomSocketTargetSchema, HeadroomStartError, IdentityAlreadyExistsError, IdentityNotFoundError, IdentitySchema, InvalidCategoryNameError, InvalidIdentityNameError, InvalidProviderNameError, LAUNCH_EVENT_SOURCE, LaunchLifecycleEventSchema, LaunchRefusedError, LegacyProviderFileError, OWN_CLI_FILE_NAME, PROMPT_CACHE_TTL_MS, PlanClassSchema, PoolNameSchema, PoolNotFoundError, PoolPickReportSchema, PoolSchema, PortableConfigSchema, ProfileAlreadyExistsError, ProfileNotFoundError, ProviderAlreadyExistsError, ProviderKindMismatchError, ProviderNotFoundError, ProviderSchema, QUOTA_EXPIRING_EVENT_SOURCE, QuotaExpiringEventSchema, RC_CONTEXT_USAGE_DETAILS, RC_IDLE_EXPIRY_MS, RC_ORPC_PATH_PREFIX, RC_PENDING_DEADLINE_MS, RC_PERMISSION_MODES, RC_READ_FILE_ENCODINGS, RC_REQUEST_PARSE_CAP_BYTES, RC_SELF_HOST_ENV, RC_SELF_HOST_KEEPALIVE_MS, RC_SELF_HOST_RECORD_DIR, RC_SELF_HOST_RECORD_FILE, RC_SELF_HOST_RETENTION_MS, RC_SELF_HOST_SCOPE_LIST, RC_SELF_HOST_WORKER_JWT_TTL_SECONDS, RC_SESSIONS_PATH_PREFIX, RC_STREAM_BACKOFF_MS, RC_WEB_FETCH_ALLOW_PRIVATE_ENV, RC_WEB_FETCH_DEADLINE_MS, RC_WEB_FETCH_MAX_BYTES, RC_WEB_FETCH_MAX_REDIRECTS, ROUTED_PATH_PREFIX, RcLiveRateLimitSchema, RcPermissionModeSchema, RcRateLimitInfoSchema, RcRateLimitWindowSchema, RcStreamEnvelopeSchema, RcStreamEventSchema, USAGE_EVENT_SOURCE, UsageError, UsageListOutputSchema, UsageLiveOutputSchema, UsageSnapshotError, UsageSnapshotSchema, UsageWindowsInputSchema, UsageWindowsOutputSchema, WhenSchema, addDirectoryRule, addIdentity, addPool, addProvider, agentShimCliPath, answerRcControlRequest, authenticateRcSessionMcpServer, buildEntryFacts, buildLayoutPaths, buildRcControlRequestPayload, buildRcControlResponsePayload, buildRcEndSessionPayload, buildRcEventWriteBody, buildRcFileSuggestionsPayload, buildRcGetContextUsagePayload, buildRcGetUsagePayload, buildRcInterruptPayload, buildRcKeepAlivePayload, buildRcMarkReadBody, buildRcMcpAuthenticatePayload, buildRcMcpOAuthCallbackUrlPayload, buildRcMcpReconnectPayload, buildRcMcpStatusPayload, buildRcReadFilePayload, buildRcSetModelPayload, buildRcSetPermissionModePayload, buildRcUserMessagePayload, carryOver, checkReportHasWarnings, checkReportToJson, collectCheckReport, collectDoctorReport, collectFrontDoorStatus, collectPoolPick, createControlApiRouter, createDoorApiNodeHandler, createDoorApiRouter, createDoorEventHub, createDoorHealthPublisher, createEventsApiRouter, createLaunchEventPublisher, createLeafCache, createProfile, createQuotaExpiringPublisher, createRcApiNodeHandler, createRcApiRouter, createRcControlHandler, createRcCredentialStore, createRcEventFanout, createRcLiveUsage, createRcSelfHostSurface, createRcSessionTracker, createRcStreamHub, createSseParser, describeProviderEndpoint, detectAmbientCredential, doorApiAuth, doorApiNodeHandlerOf, effectiveWindow, endRcSession, ensureCa, ensureFrontDoor, ensureHeadroom, evaluateAmbientCredentialGuard, evaluateWhen, fetchThroughWebProxy, formatAmbientCredentialGuardMessage, formatCheckReport, formatDoctorReport, formatFrontDoorStatus, forwardableHeaders, frontDoorApiClient, frontDoorApiLink, frontDoorRcApiClient, frontDoorRcControl, generateCa, getRcSessionContextUsage, getRcSessionMcpStatus, getRcSessionUsage, headroomSocketTarget, identityExists, injectRcUserMessage, interruptRcSession, isIdentityDirectoryName, isInterceptedHost, isPrivateAddress, isRcContextUsageDetail, isRcPermissionMode, isRcReadFileEncoding, lateRcEventDial, lateRcStreamDial, listDirectoryRules, listIdentities, listProfiles, listProviders, listUsageSnapshots, matchBranch, mintLeaf, mintRcSelfHostCredential, observingRoutedRoute, parseConnectTarget, parseRcStreamEnvelope, planOf, prepareClaudeLaunch, prepareLaunch, profileExists, providerExists, rankPool, rcEventWriteResultFromAnswer, rcFanoutOnDoorHub, rcObserverAsPassthrough, rcRateLimitInfoOf, rcSelfHostFromEnv, rcWebFetchAllowsPrivateFromEnv, readActiveIdentity, readDirectoryRules, readFarmManifest, readGlobalConfig, readIdentity, readPools, readProfile, readProvider, readRcSelfHostRecord, readRcSessionFile, readUsageSnapshot, realConnectCertStore, realConnectEffects, realRcControlTransport, realRcEventDial, realRcStreamDial, realRcWebFetch, reconnectRcSessionMcpServer, recoverFarm, recoveryDiagnostics, removeDirectoryRule, removeIdentity, removePool, removeProfile, removeProvider, requirePool, resolveAgentShimHome, resolveClaudeHome, resolveDecisions, resolveLayoutPaths, resolveSupervisorConfig, resyncFarm, runCheck, runDoctor, runFrontDoorSupervisor, runLauncher, runSupervisor, sendRcKeepAlive, servedByPipeline, setAllowAmbientCredential, setDefaultConfigProfile, setGlobalDefaultProfile, setIdentityCredential, setPool, setProfileCategories, setProfileEntries, setProfileLaunchFlags, setProfileMetadata, setRcSessionModel, setRcSessionPermissionMode, snapshotPath, spawnClaude, startConnectServer, submitRcSessionMcpOAuthCallbackUrl, suggestRcSessionFiles, teleportRcSession, topLevelNames, updateDirectoryRule, updateProvider, useIdentity, writeDirectoryRules };
7712
7721
  export type { AddDirectoryRuleOptions, AddProviderInput, AmbientCredentialDetection, AmbientCredentialGuardResult, AmbientCredentialVar, BuildEntryFactsParams, CaMaterial, Candidate, CarryOverParams, CarryOverResult, CategoryMap, CheckReport, CheckReportJson, CollectCheckReportParams, CollectDoctorReportParams, CompiledRule, ConditionContext, ConfigProfile, ConnectCertStore, ConnectEffects, ConnectLimits, ConnectLocalSurface, ConnectServerConfig, ConnectServerHandle, ConnectTarget, ControlApiClient, ControlApiDeps, ControlApiRouter, Credential, CredentialSource, Decision, Diagnostic, DirectoryRule, DirectoryRules, DoctorReport, DoorApiClient, DoorApiContext, DoorApiDeps, DoorApiRouter, DoorEvent, DoorEventHub, DoorEventPublisher, DoorEventStream, DoorEventsApiDeps, DoorHealthEvent, DoorHealthPublisher, EffectiveWindow, EliminatedRule, EnsureFrontDoorPorts, EnsureHeadroomPorts, EntryFact, EntryFacts, EntryValue, EvaluateAmbientCredentialGuardParams, FlattenedCascade, FrontDoorRcControl, FrontDoorSessionStatus, FrontDoorStatus, FrontDoorSupervisorPorts, GlobalConfig, HeadroomSupervisorConfig, Identity, IdentityCredentialChange, IdentityListEntry, IdentityListing, InjectedCredential, LaunchEventPublisher, LaunchLifecycleEvent, LaunchPlan, Layer, LayerId, LayoutPaths, LeafCert, NestedContribution, PlanClass, Pool, PoolMember, PoolPickReport, PoolRanking, PortableConfig, PrepareClaudeLaunchOptions, PrepareLaunchParams, ProfileListEntry, Provider, ProviderListEntry, QuotaExpiringEvent, QuotaExpiringPublisher, RankPoolInput, RcAnswerDecision, RcAnswerDeps, RcApiClient, RcApiDeps, RcApiRouter, RcContextUsageDetail, RcControlAnswer, RcControlHandlerDeps, RcControlRequestDeps, RcControlTransport, RcCredentialStore, RcDialAnswer, RcDialTarget, RcEventDial, RcEventFanout, RcEventWriteResult, RcExchangeObserver, RcInjectDeps, RcLiveRateLimit, RcLiveUsage, RcLiveUsageDeps, RcObservedCredential, RcObservedRequest, RcPendingRequestSummary, RcPermissionMode, RcPresenceAnswer, RcRateLimitInfo, RcRateLimitWindow, RcReadFileEncoding, RcReadFileOptions, RcSelfHostCredentialRecord, RcSelfHostDeps, RcSelfHostMintResult, RcSelfHostSurface, RcSessionStatus, RcSessionSummary, RcSessionTracker, RcSessionTrackerDeps, RcStreamAnswer, RcStreamDial, RcStreamEnvelope, RcStreamEvent, RcStreamHub, RcStreamHubDeps, RcWebFetchDeps, RcWebFetchHop, RcWebFetchOutcome, RcWebFetcher, RcWorkerFact, RcWriteHeaders, RecoverFarmParams, RecoveryResult, ResolveDecisionsInput, ResolvedState, ResyncFarmParams, ResyncFarmResult, RunCheckParams, RunDoctorParams, RunFrontDoorSupervisorOptions, RunLauncherParams, RunSupervisorOptions, SpawnClaudeParams, SseParsedEvent, StickyPick, SupervisorPorts, UnreadableIdentityListEntry, UpdateDirectoryRuleOptions, UpdateProviderInput, UsageChangeEvent, UsageReadFs, UsageSnapshot, WhenCondition, WhenEvaluation };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-shim",
3
- "version": "8.38.0",
3
+ "version": "8.39.0",
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": "MIT",
6
6
  "author": "Joseph Mearman <joseph@mearman.co.uk>",