agent-shim 14.20.0 → 14.21.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
@@ -48,8 +48,6 @@ agent-shim identity add personal # create your first identity (a fresh logi
48
48
  agent-shim run @personal # log in and start using it
49
49
  ```
50
50
 
51
- Want the shorter `claude @personal` instead? Run `agent-shim shim enable` once — see [Install](#install).
52
-
53
51
  That's it — with no further configuration, everything in `~/.claude` that isn't credentials or daemon runtime is classified into categories (see below) and shared according to sensible defaults. Add a second identity, add configuration profiles, and add directory rules only once you actually need more control than that.
54
52
 
55
53
  ## Codex CLI
package/dist/cli.cjs CHANGED
@@ -31437,6 +31437,32 @@ var init_sameDirectory = __esm({
31437
31437
  }
31438
31438
  });
31439
31439
 
31440
+ // src/launcher/launchLoop.ts
31441
+ function markLaunchedChild(env, launcherPid) {
31442
+ return { ...env, [LAUNCHER_PID_VARIABLE]: String(launcherPid) };
31443
+ }
31444
+ function refuseLaunchLoop(env, parentPid) {
31445
+ if (env[LAUNCHER_PID_VARIABLE] === String(parentPid)) {
31446
+ throw new LaunchLoopError();
31447
+ }
31448
+ }
31449
+ var LAUNCHER_PID_VARIABLE, LaunchLoopError;
31450
+ var init_launchLoop = __esm({
31451
+ "src/launcher/launchLoop.ts"() {
31452
+ "use strict";
31453
+ init_cliError();
31454
+ LAUNCHER_PID_VARIABLE = "AGENT_SHIM_LAUNCHER_PID";
31455
+ LaunchLoopError = class extends CliError {
31456
+ constructor() {
31457
+ super(
31458
+ "the program agent-shim started as the real binary started agent-shim again, which would repeat without end. It is a script or link that leads back here: remove it from PATH, or point PATH at the real binary ahead of it."
31459
+ );
31460
+ this.name = "LaunchLoopError";
31461
+ }
31462
+ };
31463
+ }
31464
+ });
31465
+
31440
31466
  // src/launcher/report.ts
31441
31467
  function renderReport(rows, style) {
31442
31468
  if (rows.length === 0) {
@@ -31961,6 +31987,7 @@ var init_realPorts = __esm({
31961
31987
  init_supervisor();
31962
31988
  init_state2();
31963
31989
  init_sameDirectory();
31990
+ init_launchLoop();
31964
31991
  init_logStyle();
31965
31992
  realFsPort = {
31966
31993
  sameDirectory,
@@ -32227,7 +32254,7 @@ var init_realPorts = __esm({
32227
32254
  };
32228
32255
  realSpawnPort = {
32229
32256
  spawnSync(command, args, options) {
32230
- const result = spawnSyncUnbounded("a spawned program", command, args, options);
32257
+ const result = spawnSyncUnbounded("a spawned program", command, args, { ...options, env: markLaunchedChild(options.env, process.pid) });
32231
32258
  return { status: result.status, signal: result.signal, ...result.error === void 0 ? {} : { error: result.error } };
32232
32259
  }
32233
32260
  };
@@ -40480,6 +40507,13 @@ ${request7.rawHeaders.reduce((accumulated, value3, index) => index % 2 === 0 ? `
40480
40507
  return;
40481
40508
  }
40482
40509
  if (host === config2.routedHost && servedByPipeline(request7.url)) {
40510
+ const lent = ownedBySurface(request7.socket) ? void 0 : await config2.rewriteForwardedAuthorization?.(host, request7, tunnelTokens.get(request7.socket));
40511
+ if (lent !== void 0) {
40512
+ request7.headers.authorization = lent.authorization;
40513
+ request7.url = lent.url;
40514
+ effects.forwardHttp(config2.upstreamFor(host), request7, response, config2.capture?.observePassthrough(request7));
40515
+ return;
40516
+ }
40483
40517
  const tunnelToken = tunnelTokens.get(request7.socket);
40484
40518
  if (tunnelToken !== void 0 && request7.headers[AUTH_HEADER] === void 0) {
40485
40519
  request7.headers[AUTH_HEADER] = tunnelToken;
@@ -41044,6 +41078,48 @@ var init_connectorProxyAuth = __esm({
41044
41078
  }
41045
41079
  });
41046
41080
 
41081
+ // src/toolSurfaceAuth.ts
41082
+ function toolSurfaceOfPath(url2) {
41083
+ const path107 = url2?.split("?", 1)[0];
41084
+ if (path107 === void 0) {
41085
+ return void 0;
41086
+ }
41087
+ return SURFACE_PATHS.find(([, prefix]) => path107 === prefix || path107.startsWith(`${prefix}/`))?.[0];
41088
+ }
41089
+ function toolSurfaceAuthorizationRewriter(deps) {
41090
+ return (host, request7, tunnelToken) => {
41091
+ const surface = host === CONNECT_INTERCEPT_HOST && tunnelToken !== void 0 ? toolSurfaceOfPath(request7.url) : void 0;
41092
+ const borrowerId = surface === void 0 || tunnelToken === void 0 ? void 0 : deps.identityOfToken(tunnelToken);
41093
+ if (surface === void 0 || borrowerId === void 0 || request7.url === void 0) {
41094
+ return void 0;
41095
+ }
41096
+ const identities = deps.identities();
41097
+ const lenderId = identities.find((identity) => identity.id === borrowerId)?.toolLogins?.[surface];
41098
+ const granted = lenderId !== void 0 && identities.find((identity) => identity.id === lenderId)?.grants?.some((grant) => grant.to === borrowerId && grant.features.includes("server-tools")) === true;
41099
+ const login = granted ? readLenderLogin(deps.loginPorts, deps.identitiesDir, lenderId) : void 0;
41100
+ if (login === void 0 || !lenderLoginUsable(login, deps.now(), LENDER_LOGIN_GRACE_MS2)) {
41101
+ return void 0;
41102
+ }
41103
+ return { authorization: `Bearer ${login.token}`, url: request7.url };
41104
+ };
41105
+ }
41106
+ var LENDER_LOGIN_GRACE_MS2, SURFACE_PATHS;
41107
+ var init_toolSurfaceAuth = __esm({
41108
+ "src/toolSurfaceAuth.ts"() {
41109
+ "use strict";
41110
+ init_connect();
41111
+ init_lenderLogin();
41112
+ LENDER_LOGIN_GRACE_MS2 = 3e4;
41113
+ SURFACE_PATHS = [
41114
+ ["design", "/v1/design"],
41115
+ ["claude-test", "/v1/claude/test"],
41116
+ ["pages", "/v1/pages"],
41117
+ ["triggers", "/v1/code/triggers"],
41118
+ ["triggers", "/v1/code/webhook-triggers"]
41119
+ ];
41120
+ }
41121
+ });
41122
+
41047
41123
  // src/codex/http.ts
41048
41124
  var HTTP_STATUS;
41049
41125
  var init_http = __esm({
@@ -41527,14 +41603,22 @@ function listIdentities(paths) {
41527
41603
  }
41528
41604
  return result.sort((left, right) => left.name < right.name ? -1 : left.name > right.name ? 1 : left.id < right.id ? -1 : left.id > right.id ? 1 : 0);
41529
41605
  }
41530
- function wiredConnectorProxyAuthorizationRewriter(paths, identityOfToken, loginPorts) {
41531
- return connectorProxyAuthorizationRewriter({
41606
+ function wiredAuthorizationRewriter(paths, identityOfToken, loginPorts) {
41607
+ const connector = connectorProxyAuthorizationRewriter({
41532
41608
  identityOfToken,
41533
41609
  identities: () => listIdentities(paths).flatMap((entry) => entry.problem === void 0 ? [{ id: entry.id, name: entry.name, grants: entry.identity.grants }] : []),
41534
41610
  identitiesDir: paths.identitiesDir,
41535
41611
  loginPorts,
41536
41612
  now: Date.now
41537
41613
  });
41614
+ const tools = toolSurfaceAuthorizationRewriter({
41615
+ identityOfToken,
41616
+ identities: () => listIdentities(paths).flatMap((entry) => entry.problem === void 0 ? [{ id: entry.id, name: entry.name, grants: entry.identity.grants, toolLogins: entry.identity.toolLogins }] : []),
41617
+ identitiesDir: paths.identitiesDir,
41618
+ loginPorts,
41619
+ now: Date.now
41620
+ });
41621
+ return (host, request7, tunnelToken) => connector(host, request7, tunnelToken) ?? tools(host, request7, tunnelToken);
41538
41622
  }
41539
41623
  function wiredMergeConnectorList2(paths, apiBase, loginPorts) {
41540
41624
  return wiredMergeConnectorList({
@@ -41751,6 +41835,7 @@ var init_identityStore = __esm({
41751
41835
  init_launchRecords();
41752
41836
  init_identityGrants();
41753
41837
  init_connectorProxyAuth();
41838
+ init_toolSurfaceAuth();
41754
41839
  init_connectorListMerge();
41755
41840
  init_lenderLogin();
41756
41841
  init_quotaHttp();
@@ -45402,14 +45487,20 @@ function rcEventWriteResultFromAnswer(answer) {
45402
45487
  }
45403
45488
  return { ok: true, sequenceNums };
45404
45489
  }
45490
+ function noOAuthCredentialMessage(sessionId) {
45491
+ return `no claude.ai OAuth bearer has been observed for session ${sessionId}: only worker calls crossed this door, and the worker JWT they carry is answered 401 on the client half. Reconnect Remote Control through this door and the create's own bearer will be observed`;
45492
+ }
45405
45493
  function noOAuthCredentialResult(sessionId) {
45406
- return { ok: false, message: `no claude.ai OAuth bearer has been observed for session ${sessionId}: only worker calls crossed this door, and the worker JWT they carry is answered 401 on the client half. Reconnect Remote Control through this door and the create's own bearer will be observed`, refusal: "session-state" };
45494
+ return { ok: false, message: noOAuthCredentialMessage(sessionId), refusal: "session-state" };
45407
45495
  }
45408
45496
  function rcSessionNotObservedMessage(sessionId) {
45409
45497
  return `the front door has not observed Remote Control session ${sessionId}: it may never have passed through this door, or it ended or expired (an entry lives only a bounded idle period past its last observed traffic)`;
45410
45498
  }
45411
45499
  function rcWriteHeaders(credential) {
45412
- const headers = { "content-type": "application/json" };
45500
+ return { "content-type": "application/json", ...rcReadHeaders(credential) };
45501
+ }
45502
+ function rcReadHeaders(credential) {
45503
+ const headers = {};
45413
45504
  if (credential.authorization !== void 0) {
45414
45505
  headers.authorization = credential.authorization;
45415
45506
  }
@@ -45668,10 +45759,40 @@ async function teleportRcSession(deps, sessionId, marker) {
45668
45759
  function buildRcMarkReadBody(eventId) {
45669
45760
  return eventId === void 0 ? {} : { event_id: eventId };
45670
45761
  }
45671
- var RC_SEND_DELIVERY_NOTE, RC_PERMISSION_MODES, RC_CONTEXT_USAGE_DETAILS, RC_READ_FILE_ENCODINGS;
45762
+ async function readRcServerState(deps, sessionId) {
45763
+ const credential = deps.credentialOf(sessionId);
45764
+ if (credential === void 0) {
45765
+ return { kind: "unknown", reason: rcSessionNotObservedMessage(sessionId) };
45766
+ }
45767
+ if (credential.authorization === void 0) {
45768
+ return { kind: "unknown", reason: noOAuthCredentialMessage(sessionId) };
45769
+ }
45770
+ let answer;
45771
+ try {
45772
+ answer = await deps.dial.readSession(sessionId, rcReadHeaders(credential));
45773
+ } catch (error63) {
45774
+ return { kind: "unknown", reason: `the door could not reach the API host to read the session: ${error63 instanceof Error ? error63.message : String(error63)}` };
45775
+ }
45776
+ if (!isSuccessful(answer.status)) {
45777
+ return { kind: "unknown", reason: `the API host answered ${String(answer.status)} to the session read` };
45778
+ }
45779
+ let parsed;
45780
+ try {
45781
+ parsed = JSON.parse(answer.body);
45782
+ } catch {
45783
+ return { kind: "unknown", reason: "the session read answered no status" };
45784
+ }
45785
+ const record3 = RcSessionAnswerSchema.safeParse(parsed);
45786
+ if (!record3.success) {
45787
+ return { kind: "unknown", reason: "the session read answered no status" };
45788
+ }
45789
+ return { kind: "read", status: record3.data.status, ...record3.data.worker_status === void 0 ? {} : { workerStatus: record3.data.worker_status }, ...record3.data.connection_status === void 0 ? {} : { connectionStatus: record3.data.connection_status } };
45790
+ }
45791
+ var RC_SEND_DELIVERY_NOTE, RC_PERMISSION_MODES, RC_CONTEXT_USAGE_DETAILS, RC_READ_FILE_ENCODINGS, RcSessionRecordSchema, RcSessionAnswerSchema;
45672
45792
  var init_rcWrites = __esm({
45673
45793
  "src/frontdoor/rcWrites.ts"() {
45674
45794
  "use strict";
45795
+ init_zod();
45675
45796
  init_http();
45676
45797
  init_rcSessions();
45677
45798
  init_rcQuestions();
@@ -45679,6 +45800,8 @@ var init_rcWrites = __esm({
45679
45800
  RC_PERMISSION_MODES = ["default", "acceptEdits", "bypassPermissions", "plan", "dontAsk", "auto"];
45680
45801
  RC_CONTEXT_USAGE_DETAILS = ["summary", "full"];
45681
45802
  RC_READ_FILE_ENCODINGS = ["utf-8", "base64"];
45803
+ RcSessionRecordSchema = external_exports.looseObject({ status: external_exports.string(), worker_status: external_exports.string().optional(), connection_status: external_exports.string().optional() });
45804
+ RcSessionAnswerSchema = external_exports.union([external_exports.looseObject({ response_shape: RcSessionRecordSchema }).transform((answer) => answer.response_shape), RcSessionRecordSchema]);
45682
45805
  }
45683
45806
  });
45684
45807
 
@@ -45703,7 +45826,7 @@ var init_machineLoad = __esm({
45703
45826
  function workerFactSchema(value3) {
45704
45827
  return external_exports.strictObject({ value: value3, observedAt: external_exports.number() });
45705
45828
  }
45706
- var RcPermissionModeSchema, RcSessionSummarySchema, RcQuestionOptionSchema, RcPendingQuestionSchema, RcPendingRequestSummarySchema, RcSessionStatusSchema, RcStreamEnvelopeSchema, RcStreamEventSchema, RcRateLimitWindowSchema, RcRateLimitInfoSchema, RcLiveRateLimitSchema, RcSessionQuerySchema, RcSendInputSchema, RcQuestionSelectionSchema, RcQuestionChoicesSchema, RcAnswerInputSchema, RcInterruptInputSchema, RcSetModelInputSchema, RcSetPermissionModeInputSchema, RcEndSessionInputSchema, RcGetUsageInputSchema, RcGetContextUsageInputSchema, RcReadFileInputSchema, RcFileSuggestionsInputSchema, RcKeepAliveInputSchema, RcMcpStatusInputSchema, RcMcpReconnectInputSchema, RcMcpAuthenticateInputSchema, RcMcpOAuthCallbackUrlInputSchema, RcTeleportInputSchema, RcListOutputSchema, RcSessionCommandRouteSchema, RcVersionGateWarningsSchema, RcSessionRouteSchema, RcStatusOutputSchema, RcPendingOutputSchema, RcWriteOutputSchema, RcControlWriteOutputSchema, RcAnswerOutputSchema;
45829
+ var RcPermissionModeSchema, RcSessionSummarySchema, RcQuestionOptionSchema, RcPendingQuestionSchema, RcPendingRequestSummarySchema, RcServerStateSchema, RcSessionStatusSchema, RcStreamEnvelopeSchema, RcStreamEventSchema, RcRateLimitWindowSchema, RcRateLimitInfoSchema, RcLiveRateLimitSchema, RcSessionQuerySchema, RcSendInputSchema, RcQuestionSelectionSchema, RcQuestionChoicesSchema, RcAnswerInputSchema, RcInterruptInputSchema, RcSetModelInputSchema, RcSetPermissionModeInputSchema, RcEndSessionInputSchema, RcGetUsageInputSchema, RcGetContextUsageInputSchema, RcReadFileInputSchema, RcFileSuggestionsInputSchema, RcKeepAliveInputSchema, RcMcpStatusInputSchema, RcMcpReconnectInputSchema, RcMcpAuthenticateInputSchema, RcMcpOAuthCallbackUrlInputSchema, RcTeleportInputSchema, RcListOutputSchema, RcSessionCommandRouteSchema, RcVersionGateWarningsSchema, RcSessionRouteSchema, RcStatusOutputSchema, RcPendingOutputSchema, RcWriteOutputSchema, RcControlWriteOutputSchema, RcAnswerOutputSchema;
45707
45830
  var init_rcSchemas = __esm({
45708
45831
  "src/frontdoor/rcSchemas.ts"() {
45709
45832
  "use strict";
@@ -45735,6 +45858,10 @@ var init_rcSchemas = __esm({
45735
45858
  unanswerable: external_exports.string().optional(),
45736
45859
  observedAt: external_exports.number()
45737
45860
  });
45861
+ RcServerStateSchema = external_exports.discriminatedUnion("kind", [
45862
+ external_exports.strictObject({ kind: external_exports.literal("read"), status: external_exports.string(), workerStatus: external_exports.string().optional(), connectionStatus: external_exports.string().optional() }),
45863
+ external_exports.strictObject({ kind: external_exports.literal("unknown"), reason: external_exports.string() })
45864
+ ]);
45738
45865
  RcSessionStatusSchema = external_exports.strictObject({
45739
45866
  ...RcSessionSummarySchema.shape,
45740
45867
  workerState: workerFactSchema(external_exports.string()).optional(),
@@ -45876,7 +46003,7 @@ var init_rcSchemas = __esm({
45876
46003
  RcSessionCommandRouteSchema = external_exports.enum(["supervised", "launched", "self-hosted"]);
45877
46004
  RcVersionGateWarningsSchema = external_exports.readonly(external_exports.array(external_exports.string()).min(1)).optional();
45878
46005
  RcSessionRouteSchema = external_exports.union([external_exports.strictObject({ route: RcSessionCommandRouteSchema, warnings: RcVersionGateWarningsSchema }), external_exports.strictObject({ route: external_exports.null(), refused: external_exports.string() })]);
45879
- RcStatusOutputSchema = external_exports.strictObject({ statuses: external_exports.readonly(external_exports.array(external_exports.strictObject({ ...RcSessionStatusSchema.shape, route: RcSessionRouteSchema }))) });
46006
+ RcStatusOutputSchema = external_exports.strictObject({ statuses: external_exports.readonly(external_exports.array(external_exports.strictObject({ ...RcSessionStatusSchema.shape, route: RcSessionRouteSchema, serverState: RcServerStateSchema }))) });
45880
46007
  RcPendingOutputSchema = external_exports.strictObject({
45881
46008
  pending: external_exports.readonly(external_exports.array(RcPendingRequestSummarySchema)),
45882
46009
  /** The sessions that had requests the door did not list (past the per-session cap, or with an id the protocol does not mint), each with how many: a question the caller expects may be among them. Absent when none did. */
@@ -46939,14 +47066,14 @@ function tlsFacts(options) {
46939
47066
  }
46940
47067
  function realRcEventDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_PORT }) {
46941
47068
  const agent = new ExemptTlsAgent();
46942
- const post = async (path107, headers, body) => await new Promise((resolve3, reject) => {
47069
+ const send = async (method, path107, headers, body) => await new Promise((resolve3, reject) => {
46943
47070
  const options = {
46944
47071
  host: target.host,
46945
47072
  port: target.port,
46946
- method: "POST",
47073
+ method,
46947
47074
  path: path107,
46948
47075
  // 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.
46949
- headers: { ...headers, host: target.servername ?? target.host, "content-length": String(Buffer.byteLength(body, "utf8")) },
47076
+ headers: { ...headers, host: target.servername ?? target.host, ...body === void 0 ? {} : { "content-length": String(Buffer.byteLength(body, "utf8")) } },
46950
47077
  agent
46951
47078
  };
46952
47079
  options.servername = target.servername ?? target.host;
@@ -46966,9 +47093,15 @@ function realRcEventDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_PO
46966
47093
  });
46967
47094
  });
46968
47095
  request7.once("error", reject);
46969
- request7.end(body);
47096
+ if (body === void 0) {
47097
+ request7.end();
47098
+ } else {
47099
+ request7.end(body);
47100
+ }
46970
47101
  });
47102
+ const post = async (path107, headers, body) => await send("POST", path107, headers, body);
46971
47103
  return {
47104
+ readSession: async (sessionId, headers) => await send("GET", `/v1/code/sessions/${encodeURIComponent(sessionId)}`, headers, void 0),
46972
47105
  writeEvents: async (sessionId, headers, body) => await post(`/v1/code/sessions/${encodeURIComponent(sessionId)}/events`, headers, body),
46973
47106
  writeTeleportEvents: async (sessionId, headers, body) => await post(`/v1/code/sessions/${encodeURIComponent(sessionId)}/teleport-events`, headers, body)
46974
47107
  };
@@ -46984,7 +47117,8 @@ function lateRcEventDial(resolve3) {
46984
47117
  };
46985
47118
  return {
46986
47119
  writeEvents: async (sessionId, headers, body) => await dialFor().writeEvents(sessionId, headers, body),
46987
- writeTeleportEvents: async (sessionId, headers, body) => await dialFor().writeTeleportEvents(sessionId, headers, body)
47120
+ writeTeleportEvents: async (sessionId, headers, body) => await dialFor().writeTeleportEvents(sessionId, headers, body),
47121
+ readSession: async (sessionId, headers) => await dialFor().readSession(sessionId, headers)
46988
47122
  };
46989
47123
  }
46990
47124
  function lateRcStreamDial(resolve3) {
@@ -76821,7 +76955,7 @@ var init_package = __esm({
76821
76955
  "package.json"() {
76822
76956
  package_default = {
76823
76957
  name: "agent-shim",
76824
- version: "14.20.0",
76958
+ version: "14.21.0",
76825
76959
  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.",
76826
76960
  license: "MIT",
76827
76961
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -148042,7 +148176,7 @@ function createRcApiRouter(deps) {
148042
148176
  if (input2.session !== void 0 && !statuses.some((entry) => entry.id === input2.session)) {
148043
148177
  throw new ORPCError("NOT_FOUND", { message: rcSessionNotObservedMessage(input2.session) });
148044
148178
  }
148045
- return { statuses: await Promise.all(statuses.map(async (status) => ({ ...status, route: await deps.routeOf(status.id) }))) };
148179
+ return { statuses: await Promise.all(statuses.map(async (status) => ({ ...status, route: await deps.routeOf(status.id), serverState: await deps.serverStateOf(status.id) }))) };
148046
148180
  }),
148047
148181
  pending: authed.meta(openapi({ method: "GET", path: "/rest/rc/pending", summary: "Read the control requests awaiting an answer", tags: [RC_API_TAG] })).input(RcSessionQuerySchema).output(RcPendingOutputSchema).handler(({ input: input2 }) => {
148048
148182
  const pending = deps.pendingOf(input2.session);
@@ -154648,6 +154782,7 @@ function formatRcSessionStatus(statuses) {
154648
154782
  status.workerIdleSeconds === void 0 ? "idle unknown" : `idle ${String(status.workerIdleSeconds.value)} s as of ${new Date(status.workerIdleSeconds.observedAt).toISOString()}`
154649
154783
  ].join(", ");
154650
154784
  lines.push(` worker: ${worker}`);
154785
+ lines.push(status.serverState.kind === "read" ? ` server: ${status.serverState.status}${[status.serverState.workerStatus === void 0 ? void 0 : `worker ${status.serverState.workerStatus}`, status.serverState.connectionStatus === void 0 ? void 0 : `connection ${status.serverState.connectionStatus}`].filter((part) => part !== void 0).map((part) => `, ${part}`).join("")}` : ` server: unknown (${status.serverState.reason})`);
154651
154786
  lines.push(status.route.route === null ? ` goal, compaction and turn verbs: refused: ${status.route.refused}` : ` goal, compaction and turn verbs: ${status.route.route} route`);
154652
154787
  if (status.route.route !== null) {
154653
154788
  lines.push(...(status.route.warnings ?? []).map((warning) => ` warning: ${warning}`));
@@ -158659,6 +158794,7 @@ function realFrontDoorSupervisorPorts(paths, respawnGeneration, lifecycle, track
158659
158794
  const rcMcpReconnect = async (sessionId, serverName) => await reconnectRcSessionMcpServer(rcControlRequestDeps, sessionId, serverName);
158660
158795
  const rcMcpAuthenticate = async (sessionId, serverName, redirectUri) => await authenticateRcSessionMcpServer(rcControlRequestDeps, sessionId, serverName, redirectUri);
158661
158796
  const rcMcpOAuthCallbackUrl = async (sessionId, serverName, callbackUrl) => await submitRcSessionMcpOAuthCallbackUrl(rcControlRequestDeps, sessionId, serverName, callbackUrl);
158797
+ const rcServerStateOf = async (sessionId) => await readRcServerState(rcControlRequestDeps, sessionId);
158662
158798
  const rcTeleport = async (sessionId, marker) => await teleportRcSession(rcControlRequestDeps, sessionId, marker);
158663
158799
  const rcSessionCommands = createDoorRcSessionCommands({
158664
158800
  paths,
@@ -158745,6 +158881,7 @@ function realFrontDoorSupervisorPorts(paths, respawnGeneration, lifecycle, track
158745
158881
  mcpAuthenticate: rcMcpAuthenticate,
158746
158882
  mcpOAuthCallbackUrl: rcMcpOAuthCallbackUrl,
158747
158883
  teleport: rcTeleport,
158884
+ serverStateOf: rcServerStateOf,
158748
158885
  ...rcSessionCommands,
158749
158886
  fanout: rcFanout,
158750
158887
  sessionEvents: rcSessionEvents,
@@ -158813,7 +158950,7 @@ function realFrontDoorSupervisorPorts(paths, respawnGeneration, lifecycle, track
158813
158950
  },
158814
158951
  leafFor,
158815
158952
  upstreamFor: (host) => ({ host, port: HTTPS_PORT, tls: true }),
158816
- rewriteForwardedAuthorization: wiredConnectorProxyAuthorizationRewriter(paths, sessionRegistry.identityOf, { fs: realFarmFs, run: realRunPort, platform: process.platform }),
158953
+ rewriteForwardedAuthorization: wiredAuthorizationRewriter(paths, sessionRegistry.identityOf, { fs: realFarmFs, run: realRunPort, platform: process.platform }),
158817
158954
  isLiveCapability: isLiveToken,
158818
158955
  ...wantedTransparentPort === void 0 || Number.isNaN(wantedTransparentPort) ? {} : { transparentPort: wantedTransparentPort, ...transparentCapability === void 0 ? {} : { transparentCapability } },
158819
158956
  limits: CONNECT_LIMITS,
@@ -176235,6 +176372,7 @@ init_cascade();
176235
176372
  init_cliOverride();
176236
176373
  init_farm();
176237
176374
  init_identity2();
176375
+ init_launchLoop();
176238
176376
  init_spawn();
176239
176377
  init_realPorts();
176240
176378
  init_walk();
@@ -176242,11 +176380,12 @@ init_walk();
176242
176380
  // src/supervise/realPorts.ts
176243
176381
  var import_node_child_process12 = require("node:child_process");
176244
176382
  var import_node_fs40 = __toESM(require("node:fs"), 1);
176383
+ init_launchLoop();
176245
176384
  init_realPorts();
176246
176385
  init_blockingSpawn();
176247
176386
  var realSupervisedSpawnPort = {
176248
176387
  spawn(command, args, options) {
176249
- const child = (0, import_node_child_process12.spawn)(command, [...args], { stdio: options.stdio, env: { ...options.env } });
176388
+ const child = (0, import_node_child_process12.spawn)(command, [...args], { stdio: options.stdio, env: markLaunchedChild(options.env, process.pid) });
176250
176389
  const exit = new Promise((resolve3) => {
176251
176390
  child.once("error", (error63) => {
176252
176391
  resolve3({ status: null, signal: null, error: error63 });
@@ -176416,6 +176555,7 @@ async function runCodexChild(plan, spawn10, signals) {
176416
176555
  }
176417
176556
  }
176418
176557
  async function runCodex(paths, argv) {
176558
+ refuseLaunchLoop(process.env, process.ppid);
176419
176559
  const own2 = resolveOwnBinaryCheck(paths, realContentSourcePath());
176420
176560
  const resolveBinary = () => {
176421
176561
  const explicit = process.env.AGENT_SHIM_CODEX_BIN;
@@ -178126,6 +178266,7 @@ async function runSupervised(params) {
178126
178266
  // src/runClaude.ts
178127
178267
  init_launcher();
178128
178268
  init_argv();
178269
+ init_launchLoop();
178129
178270
  init_extraFlags();
178130
178271
 
178131
178272
  // src/launcher/native.ts
@@ -178173,6 +178314,7 @@ init_identity2();
178173
178314
  init_realPorts();
178174
178315
  init_ownEntry();
178175
178316
  async function runClaude(argvOverride) {
178317
+ refuseLaunchLoop(process.env, process.ppid);
178176
178318
  const paths = resolveLayoutPaths();
178177
178319
  const launchProc = argvOverride === void 0 ? realProcPort : { ...realProcPort, argv: argvOverride };
178178
178320
  const nativeArgv = parseLauncherArgv(launchProc.argv);