agent-shim 7.3.0 → 7.5.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/README.md CHANGED
@@ -226,6 +226,7 @@ Issues and pull requests are welcome. Please keep the tool itself free of assump
226
226
  - [docs/architecture.md](docs/architecture.md): the source layout file by file, error reporting design, schema rationale, and resolver mechanics.
227
227
  - [docs/release-process.md](docs/release-process.md): the semantic-release pipeline, the Node SEA build, its macOS x64 limitation, and npm/GitHub Packages publishing.
228
228
  - [docs/testing.md](docs/testing.md): the full list of cases the test suites cover.
229
+ - [docs/library.md](docs/library.md): using agent-shim in process: what the library exposes, and what stays CLI-only.
229
230
  - [docs/installation.md](docs/installation.md): every install channel in full, with the platform support matrix.
230
231
  - [docs/development.md](docs/development.md): test isolation, commit hooks, and the secret-redaction filter rationale.
231
232
 
package/dist/cli.cjs CHANGED
@@ -61051,7 +61051,7 @@ function resolveLaunchIdentity(paths, cwd) {
61051
61051
  // package.json
61052
61052
  var package_default = {
61053
61053
  name: "agent-shim",
61054
- version: "7.3.0",
61054
+ version: "7.5.0",
61055
61055
  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.",
61056
61056
  license: "MIT",
61057
61057
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -64859,6 +64859,7 @@ async function runFrontDoorSupervisor(idleShutdownMinutes, ports, options = {})
64859
64859
 
64860
64860
  // src/frontdoor/connect.ts
64861
64861
  var CONNECT_INTERCEPT_HOST = "api.anthropic.com";
64862
+ var CONNECT_INTERCEPT_HOSTS = [CONNECT_INTERCEPT_HOST, "platform.claude.com"];
64862
64863
  var ROUTED_PATH_PREFIX = "/v1/";
64863
64864
  var HTTPS_PORT = 443;
64864
64865
  var MAX_PORT = 65535;
@@ -64898,9 +64899,6 @@ function parseConnectTarget(authority) {
64898
64899
  }
64899
64900
  return { host, port };
64900
64901
  }
64901
- function isInterceptedHost(host, interceptHost) {
64902
- return host === interceptHost;
64903
- }
64904
64902
  function servedByPipeline(path38) {
64905
64903
  return path38?.startsWith(ROUTED_PATH_PREFIX) === true;
64906
64904
  }
@@ -64970,28 +64968,34 @@ function caParses(ca) {
64970
64968
  }
64971
64969
  }
64972
64970
  async function startConnectServer(config2, effects, preferredPort) {
64973
- const handler = (request6, response) => {
64974
- if (servedByPipeline(request6.url)) {
64975
- config2.serveRouted(request6, response);
64976
- return;
64977
- }
64978
- effects.forwardHttp(config2.upstream, request6, response, config2.capture?.observePassthrough(request6));
64979
- };
64980
- const httpSession = effects.createHttpSession(handler, config2.capture === void 0 ? void 0 : (request6) => config2.capture?.upgrade(request6));
64981
- const tlsAcceptor = effects.createTlsAcceptor(config2.leafFor(config2.interceptHost), (secure) => {
64982
- httpSession.serve(secure);
64971
+ const onUpgrade = config2.capture === void 0 ? void 0 : (request6) => config2.capture?.upgrade(request6);
64972
+ const sessions = config2.interceptHosts.map((host) => {
64973
+ const handler = (request6, response) => {
64974
+ if (host === config2.routedHost && servedByPipeline(request6.url)) {
64975
+ config2.serveRouted(request6, response);
64976
+ return;
64977
+ }
64978
+ effects.forwardHttp(config2.upstreamFor(host), request6, response, config2.capture?.observePassthrough(request6));
64979
+ };
64980
+ const httpSession = effects.createHttpSession(handler, onUpgrade);
64981
+ const tlsAcceptor = effects.createTlsAcceptor(config2.leafFor(host), (secure) => {
64982
+ httpSession.serve(secure);
64983
+ });
64984
+ return { host, httpSession, tlsAcceptor };
64983
64985
  });
64984
64986
  const ledger = createConnectionLedger(config2.limits, config2.isLiveCapability);
64985
64987
  const listener = await effects.listenLoopback(preferredPort, (socket) => {
64986
- handleConnect(socket, { config: config2, effects, tlsAcceptor, ledger });
64988
+ handleConnect(socket, { config: config2, effects, sessions, ledger });
64987
64989
  });
64988
64990
  return {
64989
64991
  port: listener.port,
64990
64992
  close: async () => {
64991
64993
  ledger.close();
64992
64994
  await listener.close();
64993
- tlsAcceptor.close();
64994
- httpSession.close();
64995
+ for (const { httpSession, tlsAcceptor } of sessions) {
64996
+ tlsAcceptor.close();
64997
+ httpSession.close();
64998
+ }
64995
64999
  }
64996
65000
  };
64997
65001
  }
@@ -65111,7 +65115,7 @@ function proxyAuthorizationOf(head) {
65111
65115
  return values.length === 1 ? value : void 0;
65112
65116
  }
65113
65117
  function routeConnect(socket, head, context) {
65114
- const { config: config2, effects, tlsAcceptor, ledger } = context;
65118
+ const { config: config2, effects, sessions, ledger } = context;
65115
65119
  const credential = proxyAuthorizationOf(head);
65116
65120
  const capability = credential === void 0 ? void 0 : capabilityFromProxyAuthorization(credential);
65117
65121
  if (capability === void 0 || !config2.isLiveCapability(capability)) {
@@ -65130,10 +65134,11 @@ function routeConnect(socket, head, context) {
65130
65134
  refuse(socket, REFUSAL.serviceUnavailable);
65131
65135
  return;
65132
65136
  }
65133
- config2.capture?.connect(target, isInterceptedHost(target.host, config2.interceptHost));
65137
+ const session = sessions.find((entry) => entry.host === target.host);
65138
+ config2.capture?.connect(target, session !== void 0);
65134
65139
  socket.write(CONNECT_ESTABLISHED);
65135
- if (isInterceptedHost(target.host, config2.interceptHost)) {
65136
- tlsAcceptor.accept(socket);
65140
+ if (session !== void 0) {
65141
+ session.tlsAcceptor.accept(socket);
65137
65142
  return;
65138
65143
  }
65139
65144
  void blindTunnel(socket, target, effects);
@@ -66967,7 +66972,8 @@ function realFrontDoorSupervisorPorts(paths) {
66967
66972
  }
66968
66973
  const server = await startConnectServer(
66969
66974
  {
66970
- interceptHost: CONNECT_INTERCEPT_HOST,
66975
+ interceptHosts: CONNECT_INTERCEPT_HOSTS,
66976
+ routedHost: CONNECT_INTERCEPT_HOST,
66971
66977
  serveRouted: (request6, response) => {
66972
66978
  const abort = new AbortController();
66973
66979
  response.on("close", () => {
@@ -66988,7 +66994,7 @@ function realFrontDoorSupervisorPorts(paths) {
66988
66994
  );
66989
66995
  },
66990
66996
  leafFor,
66991
- upstream: { host: CONNECT_INTERCEPT_HOST, port: HTTPS_PORT, tls: true },
66997
+ upstreamFor: (host) => ({ host, port: HTTPS_PORT, tls: true }),
66992
66998
  isLiveCapability: isLiveToken,
66993
66999
  limits: CONNECT_LIMITS,
66994
67000
  ...capture === void 0 ? {} : { capture }