agent-shim 14.17.2 → 14.19.1

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
@@ -40493,7 +40493,7 @@ ${request7.rawHeaders.reduce((accumulated, value3, index) => index % 2 === 0 ? `
40493
40493
  answerAndClose(response, REQUEST_STATUS.notFound);
40494
40494
  return;
40495
40495
  }
40496
- const rewritten = config2.rewriteForwardedAuthorization?.(host, request7, tunnelTokens.get(request7.socket));
40496
+ const rewritten = await config2.rewriteForwardedAuthorization?.(host, request7, tunnelTokens.get(request7.socket));
40497
40497
  if (rewritten !== void 0) {
40498
40498
  request7.headers.authorization = rewritten.authorization;
40499
40499
  request7.url = rewritten.url;
@@ -76542,6 +76542,23 @@ function ensureFrontDoor(params) {
76542
76542
  ports.sleep(FRONTDOOR_LAUNCHER_POLL_MS);
76543
76543
  }
76544
76544
  }
76545
+ function startFrontDoor(params) {
76546
+ const { paths, ports } = params;
76547
+ const previousPid = readFrontDoorState(ports.fs, paths.frontdoorStateFile)?.supervisorPid;
76548
+ if (previousPid !== void 0 && ports.isRunning(previousPid)) {
76549
+ return { action: "already-running", pid: previousPid };
76550
+ }
76551
+ try {
76552
+ ensureFrontDoor({ paths, launcherPid: params.pid, ports });
76553
+ } finally {
76554
+ removeFrontDoorSession(ports.fs, paths.frontdoorSessionsDir, params.pid);
76555
+ }
76556
+ const pid = readFrontDoorState(ports.fs, paths.frontdoorStateFile)?.supervisorPid;
76557
+ if (pid === void 0) {
76558
+ throw new FrontDoorStartError(`the front door was started but its state records no supervisor. Daemon log: ${paths.frontdoorLogPath}`);
76559
+ }
76560
+ return { action: "started", pid };
76561
+ }
76545
76562
  function restartFrontDoor(params) {
76546
76563
  const { paths, ports } = params;
76547
76564
  const previousPid = readFrontDoorState(ports.fs, paths.frontdoorStateFile)?.supervisorPid;
@@ -76679,6 +76696,9 @@ function realEnsurePorts(paths, spawnDaemon) {
76679
76696
  function realRestartFrontDoor(paths, spawnDaemon, reason) {
76680
76697
  return restartFrontDoor({ paths, pid: process.pid, reason, ports: realEnsurePorts(paths, spawnDaemon) });
76681
76698
  }
76699
+ function realStartFrontDoor(paths, spawnDaemon) {
76700
+ return startFrontDoor({ paths, pid: process.pid, ports: realEnsurePorts(paths, spawnDaemon) });
76701
+ }
76682
76702
  function realFrontDoorPort(paths, spawnDaemon) {
76683
76703
  return {
76684
76704
  waitForCatalogues: (supervisorPid) => {
@@ -76801,7 +76821,7 @@ var init_package = __esm({
76801
76821
  "package.json"() {
76802
76822
  package_default = {
76803
76823
  name: "agent-shim",
76804
- version: "14.17.2",
76824
+ version: "14.19.1",
76805
76825
  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.",
76806
76826
  license: "MIT",
76807
76827
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -154371,6 +154391,25 @@ function predecessorOfThisProcess() {
154371
154391
  // src/frontdoor/commands.ts
154372
154392
  init_realFrontDoorPort();
154373
154393
 
154394
+ // src/frontdoor/frontdoorStartCommand.ts
154395
+ init_commandDeps();
154396
+ init_realFrontDoorPort();
154397
+ function registerFrontdoorStartCommand(frontdoor, paths, spawnDetachedSupervisor2) {
154398
+ withExamples(
154399
+ frontdoor.command("start").description(
154400
+ "Start a front door when none is serving, the way a launch's own lazy start would, without spawning claude; attaches to an existing door rather than starting a second one. A watchdog uses this, never `restart`, which is a deliberate no-op with nothing already running."
154401
+ ).option("--json", "Print the result as JSON.").action((options) => {
154402
+ const result = realStartFrontDoor(paths, spawnDetachedSupervisor2);
154403
+ if (options.json === true) {
154404
+ printJson(result);
154405
+ return;
154406
+ }
154407
+ console.log(result.action === "already-running" ? `front door already running: pid ${String(result.pid)}` : `front door started: pid ${String(result.pid)}`);
154408
+ }),
154409
+ ["agent-shim frontdoor start", "agent-shim frontdoor start --json"]
154410
+ );
154411
+ }
154412
+
154374
154413
  // src/frontdoor/rcCommands.ts
154375
154414
  var import_node_crypto33 = require("node:crypto");
154376
154415
  init_commandDeps();
@@ -158869,6 +158908,7 @@ function registerFrontDoorCommand(program2, deps) {
158869
158908
  }),
158870
158909
  ["agent-shim frontdoor restart", "agent-shim frontdoor restart --json"]
158871
158910
  );
158911
+ registerFrontdoorStartCommand(frontdoor, paths, spawnDetachedSupervisor);
158872
158912
  registerRcCommand(frontdoor, paths);
158873
158913
  program2.command("__frontdoor-supervisor", { hidden: true }).description("Internal: serve the front-door routing listeners. Started by the launcher; never run by hand.").allowUnknownOption().action(async () => {
158874
158914
  const idleShutdownMinutes = readGlobalConfig(paths)?.frontdoor?.idleShutdownMinutes ?? FRONTDOOR_DEFAULT_IDLE_SHUTDOWN_MINUTES;
package/dist/index.cjs CHANGED
@@ -6243,7 +6243,7 @@ ${request4.rawHeaders.reduce((accumulated, value, index) => index % 2 === 0 ? `$
6243
6243
  answerAndClose(response, REQUEST_STATUS.notFound);
6244
6244
  return;
6245
6245
  }
6246
- const rewritten = config.rewriteForwardedAuthorization?.(host, request4, tunnelTokens.get(request4.socket));
6246
+ const rewritten = await config.rewriteForwardedAuthorization?.(host, request4, tunnelTokens.get(request4.socket));
6247
6247
  if (rewritten !== void 0) {
6248
6248
  request4.headers.authorization = rewritten.authorization;
6249
6249
  request4.url = rewritten.url;
@@ -15369,7 +15369,7 @@ var init_package = __esm({
15369
15369
  "package.json"() {
15370
15370
  package_default = {
15371
15371
  name: "agent-shim",
15372
- version: "14.17.2",
15372
+ version: "14.19.1",
15373
15373
  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.",
15374
15374
  license: "MIT",
15375
15375
  author: "Joseph Mearman <joseph@mearman.co.uk>",
package/dist/index.mjs CHANGED
@@ -6219,7 +6219,7 @@ ${request4.rawHeaders.reduce((accumulated, value, index) => index % 2 === 0 ? `$
6219
6219
  answerAndClose(response, REQUEST_STATUS.notFound);
6220
6220
  return;
6221
6221
  }
6222
- const rewritten = config.rewriteForwardedAuthorization?.(host, request4, tunnelTokens.get(request4.socket));
6222
+ const rewritten = await config.rewriteForwardedAuthorization?.(host, request4, tunnelTokens.get(request4.socket));
6223
6223
  if (rewritten !== void 0) {
6224
6224
  request4.headers.authorization = rewritten.authorization;
6225
6225
  request4.url = rewritten.url;
@@ -15340,7 +15340,7 @@ var init_package = __esm({
15340
15340
  "package.json"() {
15341
15341
  package_default = {
15342
15342
  name: "agent-shim",
15343
- version: "14.17.2",
15343
+ version: "14.19.1",
15344
15344
  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.",
15345
15345
  license: "MIT",
15346
15346
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -6679,12 +6679,15 @@ interface ConnectServerConfig {
6679
6679
  /** Where non-routed paths on one host's terminated session are piped: that host's own real upstream over TLS. */
6680
6680
  readonly upstreamFor: (host: string) => ConnectForwardTarget;
6681
6681
  /**
6682
- * Rewrites a non-routed request's `authorization` header and, since the lender's own connector carries a different id than the one this swap decodes it from, its URL, before it is piped to `host`'s real upstream: the one host (`CONNECT_CONNECTOR_PROXY_HOST`) and reason this surface edits a request at all, a connector call whose id names a lender the session's identity currently holds a `connectors` grant from. Undefined, or no call at all, leaves the request exactly as the client sent it; `tunnelToken` is the CONNECT capability this session presented (absent on the transparent surface, which resolves no identity).
6682
+ * Rewrites a non-routed request's `authorization` header and, since a lender's own connector or artifact carries a different id or needs a different slug lookup than the one this swap decodes it from, its URL, before it is piped to `host`'s real upstream: a connector call whose id names a lender the session's identity currently holds a `connectors` grant from (`CONNECT_CONNECTOR_PROXY_HOST` only), or an artifact path naming a slug a `artifacts`-granted lender owns (any intercepted host, since artifacts share the API host with everything else). Undefined, or no call at all, leaves the request exactly as the client sent it; `tunnelToken` is the CONNECT capability this session presented (absent on the transparent surface, which resolves no identity). May return a promise: the caller already awaits other effects before this one runs, and the request stays paused until it is piped, so awaiting here loses no body.
6683
6683
  */
6684
6684
  readonly rewriteForwardedAuthorization?: (host: string, request: IncomingMessage, tunnelToken: string | undefined) => {
6685
6685
  readonly authorization: string;
6686
6686
  readonly url: string;
6687
- } | undefined;
6687
+ } | undefined | Promise<{
6688
+ readonly authorization: string;
6689
+ readonly url: string;
6690
+ } | undefined>;
6688
6691
  /** Whether a capability presented as a CONNECT request's proxy credential belongs to a live launch: the same constant-time check against the same registry the routed pipeline's admission makes, read fresh on every call because launches come and go. */
6689
6692
  readonly isLiveCapability: (token: string) => boolean;
6690
6693
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-shim",
3
- "version": "14.17.2",
3
+ "version": "14.19.1",
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>",