agent-shim 14.20.1 → 14.22.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/index.mjs CHANGED
@@ -6206,6 +6206,13 @@ ${request4.rawHeaders.reduce((accumulated, value, index) => index % 2 === 0 ? `$
6206
6206
  return;
6207
6207
  }
6208
6208
  if (host === config.routedHost && servedByPipeline(request4.url)) {
6209
+ const lent = ownedBySurface(request4.socket) ? void 0 : await config.rewriteForwardedAuthorization?.(host, request4, tunnelTokens.get(request4.socket));
6210
+ if (lent !== void 0) {
6211
+ request4.headers.authorization = lent.authorization;
6212
+ request4.url = lent.url;
6213
+ effects.forwardHttp(config.upstreamFor(host), request4, response, config.capture?.observePassthrough(request4));
6214
+ return;
6215
+ }
6209
6216
  const tunnelToken = tunnelTokens.get(request4.socket);
6210
6217
  if (tunnelToken !== void 0 && request4.headers[AUTH_HEADER] === void 0) {
6211
6218
  request4.headers[AUTH_HEADER] = tunnelToken;
@@ -7675,6 +7682,7 @@ var init_rcSessions = __esm({
7675
7682
  });
7676
7683
 
7677
7684
  // src/frontdoor/rcWrites.ts
7685
+ import { z as z12 } from "zod";
7678
7686
  function buildRcUserMessagePayload(uuid, sessionId, text) {
7679
7687
  return {
7680
7688
  type: "user",
@@ -7727,14 +7735,20 @@ function rcEventWriteResultFromAnswer(answer) {
7727
7735
  }
7728
7736
  return { ok: true, sequenceNums };
7729
7737
  }
7738
+ function noOAuthCredentialMessage(sessionId) {
7739
+ 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`;
7740
+ }
7730
7741
  function noOAuthCredentialResult(sessionId) {
7731
- 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" };
7742
+ return { ok: false, message: noOAuthCredentialMessage(sessionId), refusal: "session-state" };
7732
7743
  }
7733
7744
  function rcSessionNotObservedMessage(sessionId) {
7734
7745
  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)`;
7735
7746
  }
7736
7747
  function rcWriteHeaders(credential) {
7737
- const headers = { "content-type": "application/json" };
7748
+ return { "content-type": "application/json", ...rcReadHeaders(credential) };
7749
+ }
7750
+ function rcReadHeaders(credential) {
7751
+ const headers = {};
7738
7752
  if (credential.authorization !== void 0) {
7739
7753
  headers.authorization = credential.authorization;
7740
7754
  }
@@ -7993,7 +8007,7 @@ async function teleportRcSession(deps, sessionId, marker) {
7993
8007
  function buildRcMarkReadBody(eventId) {
7994
8008
  return eventId === void 0 ? {} : { event_id: eventId };
7995
8009
  }
7996
- var RC_SEND_DELIVERY_NOTE, RC_PERMISSION_MODES, RC_CONTEXT_USAGE_DETAILS, RC_READ_FILE_ENCODINGS;
8010
+ var RC_SEND_DELIVERY_NOTE, RC_PERMISSION_MODES, RC_CONTEXT_USAGE_DETAILS, RC_READ_FILE_ENCODINGS, RcSessionRecordSchema, RcSessionAnswerSchema;
7997
8011
  var init_rcWrites = __esm({
7998
8012
  "src/frontdoor/rcWrites.ts"() {
7999
8013
  "use strict";
@@ -8004,6 +8018,8 @@ var init_rcWrites = __esm({
8004
8018
  RC_PERMISSION_MODES = ["default", "acceptEdits", "bypassPermissions", "plan", "dontAsk", "auto"];
8005
8019
  RC_CONTEXT_USAGE_DETAILS = ["summary", "full"];
8006
8020
  RC_READ_FILE_ENCODINGS = ["utf-8", "base64"];
8021
+ RcSessionRecordSchema = z12.looseObject({ status: z12.string(), worker_status: z12.string().optional(), connection_status: z12.string().optional() });
8022
+ RcSessionAnswerSchema = z12.union([z12.looseObject({ response_shape: RcSessionRecordSchema }).transform((answer) => answer.response_shape), RcSessionRecordSchema]);
8007
8023
  }
8008
8024
  });
8009
8025
 
@@ -8015,201 +8031,205 @@ var init_machineLoad = __esm({
8015
8031
  });
8016
8032
 
8017
8033
  // src/frontdoor/rcSchemas.ts
8018
- import { z as z12 } from "zod";
8034
+ import { z as z13 } from "zod";
8019
8035
  function workerFactSchema(value) {
8020
- return z12.strictObject({ value, observedAt: z12.number() });
8036
+ return z13.strictObject({ value, observedAt: z13.number() });
8021
8037
  }
8022
- 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;
8038
+ 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;
8023
8039
  var init_rcSchemas = __esm({
8024
8040
  "src/frontdoor/rcSchemas.ts"() {
8025
8041
  "use strict";
8026
8042
  init_rcWrites();
8027
- RcPermissionModeSchema = z12.enum(RC_PERMISSION_MODES);
8028
- RcSessionSummarySchema = z12.strictObject({
8029
- id: z12.string(),
8030
- createdAt: z12.number(),
8031
- lastSeenAt: z12.number()
8043
+ RcPermissionModeSchema = z13.enum(RC_PERMISSION_MODES);
8044
+ RcSessionSummarySchema = z13.strictObject({
8045
+ id: z13.string(),
8046
+ createdAt: z13.number(),
8047
+ lastSeenAt: z13.number()
8032
8048
  });
8033
- RcQuestionOptionSchema = z12.strictObject({
8034
- label: z12.string(),
8035
- description: z12.string().optional()
8049
+ RcQuestionOptionSchema = z13.strictObject({
8050
+ label: z13.string(),
8051
+ description: z13.string().optional()
8036
8052
  });
8037
- RcPendingQuestionSchema = z12.strictObject({
8038
- question: z12.string(),
8039
- header: z12.string().optional(),
8040
- multiSelect: z12.boolean(),
8041
- options: z12.readonly(z12.array(RcQuestionOptionSchema))
8053
+ RcPendingQuestionSchema = z13.strictObject({
8054
+ question: z13.string(),
8055
+ header: z13.string().optional(),
8056
+ multiSelect: z13.boolean(),
8057
+ options: z13.readonly(z13.array(RcQuestionOptionSchema))
8042
8058
  });
8043
- RcPendingRequestSummarySchema = z12.strictObject({
8044
- sessionId: z12.string(),
8045
- requestId: z12.string(),
8046
- type: z12.string(),
8047
- summary: z12.string(),
8048
- questions: z12.readonly(z12.array(RcPendingQuestionSchema)).optional(),
8049
- oversized: z12.literal(true).optional(),
8050
- unanswerable: z12.string().optional(),
8051
- observedAt: z12.number()
8059
+ RcPendingRequestSummarySchema = z13.strictObject({
8060
+ sessionId: z13.string(),
8061
+ requestId: z13.string(),
8062
+ type: z13.string(),
8063
+ summary: z13.string(),
8064
+ questions: z13.readonly(z13.array(RcPendingQuestionSchema)).optional(),
8065
+ oversized: z13.literal(true).optional(),
8066
+ unanswerable: z13.string().optional(),
8067
+ observedAt: z13.number()
8052
8068
  });
8053
- RcSessionStatusSchema = z12.strictObject({
8069
+ RcServerStateSchema = z13.discriminatedUnion("kind", [
8070
+ z13.strictObject({ kind: z13.literal("read"), status: z13.string(), workerStatus: z13.string().optional(), connectionStatus: z13.string().optional() }),
8071
+ z13.strictObject({ kind: z13.literal("unknown"), reason: z13.string() })
8072
+ ]);
8073
+ RcSessionStatusSchema = z13.strictObject({
8054
8074
  ...RcSessionSummarySchema.shape,
8055
- workerState: workerFactSchema(z12.string()).optional(),
8056
- workerIdleSeconds: workerFactSchema(z12.number()).optional(),
8057
- pending: z12.readonly(z12.array(RcPendingRequestSummarySchema)),
8075
+ workerState: workerFactSchema(z13.string()).optional(),
8076
+ workerIdleSeconds: workerFactSchema(z13.number()).optional(),
8077
+ pending: z13.readonly(z13.array(RcPendingRequestSummarySchema)),
8058
8078
  /** The identity the session runs as, when known; absent otherwise. */
8059
- identity: z12.string().optional(),
8079
+ identity: z13.string().optional(),
8060
8080
  /** The model the session last stated, when the door saw one. */
8061
- model: z12.string().optional(),
8081
+ model: z13.string().optional(),
8062
8082
  /** The session's name from the Claude Code session registry, when the registry holds it. */
8063
- name: z12.string().optional(),
8083
+ name: z13.string().optional(),
8064
8084
  /** The session process's id from the registry. */
8065
- pid: z12.number().optional(),
8085
+ pid: z13.number().optional(),
8066
8086
  /** The session's working directory, from its init event or the registry. */
8067
- cwd: z12.string().optional(),
8068
- pendingDropped: z12.int().positive().optional()
8087
+ cwd: z13.string().optional(),
8088
+ pendingDropped: z13.int().positive().optional()
8069
8089
  });
8070
- RcStreamEnvelopeSchema = z12.looseObject({
8090
+ RcStreamEnvelopeSchema = z13.looseObject({
8071
8091
  /** The envelope's own event id, when the host sent one. */
8072
- event_id: z12.string().optional(),
8092
+ event_id: z13.string().optional(),
8073
8093
  /** The envelope's event type, the discriminator a consumer switches on (`control_request`, `user`, and kin). */
8074
- event_type: z12.string(),
8094
+ event_type: z13.string(),
8075
8095
  /** The sequence number the host assigned, the value a resume continues after. */
8076
- sequence_num: z12.int(),
8096
+ sequence_num: z13.int(),
8077
8097
  /** Who emitted the event (`worker` for the CLI's half, a client id for a client's). */
8078
- source: z12.string(),
8098
+ source: z13.string(),
8079
8099
  /** The event's payload, carried verbatim: its shape is the payload family's, narrowed by whichever consumer needs it. Optional in the schema's own type because the door forwards the host's envelope as it arrived, asserting only the fields it relies on itself. */
8080
- payload: z12.unknown().optional(),
8100
+ payload: z13.unknown().optional(),
8081
8101
  /** When the host created the event; the protocol's own type for this field is not established here, so it is forwarded rather than asserted. */
8082
- created_at: z12.unknown().optional()
8102
+ created_at: z13.unknown().optional()
8083
8103
  });
8084
- RcStreamEventSchema = z12.strictObject({
8085
- session: z12.string(),
8104
+ RcStreamEventSchema = z13.strictObject({
8105
+ session: z13.string(),
8086
8106
  envelope: RcStreamEnvelopeSchema
8087
8107
  });
8088
- RcRateLimitWindowSchema = z12.looseObject({
8108
+ RcRateLimitWindowSchema = z13.looseObject({
8089
8109
  /** The fraction of the window used, usually between 0 and 1, above 1 when usage legitimately runs past the window's cap (the CLI's own field description states both). */
8090
- utilization: z12.number().optional(),
8110
+ utilization: z13.number().optional(),
8091
8111
  /** When the window resets, in unix epoch seconds: the unit is the CLI's own field description, stated in the 2.1.289 bundle's schema. */
8092
- resetsAt: z12.number().optional()
8112
+ resetsAt: z13.number().optional()
8093
8113
  });
8094
- RcRateLimitInfoSchema = z12.looseObject({
8114
+ RcRateLimitInfoSchema = z13.looseObject({
8095
8115
  /** The limiting window's own status (`allowed`, `allowed_warning`, `rejected`), asserted only as a string because the vocabulary grows with the CLI. */
8096
- status: z12.string(),
8116
+ status: z13.string(),
8097
8117
  /** When the limiting window resets, in unix epoch seconds. */
8098
- resetsAt: z12.number().optional(),
8118
+ resetsAt: z13.number().optional(),
8099
8119
  /** Which window the top-level fields describe (`five_hour`, `seven_day`, and kin), the payload's own name for it. */
8100
- rateLimitType: z12.string().optional(),
8120
+ rateLimitType: z13.string().optional(),
8101
8121
  /** The fraction of the limiting window used, on the same scale the per-window utilizations carry. */
8102
- utilization: z12.number().optional(),
8122
+ utilization: z13.number().optional(),
8103
8123
  /** Whether usage beyond the plan (extra usage) is currently covering the overflow, the payload's own flag for it. */
8104
- isUsingOverage: z12.boolean().optional(),
8124
+ isUsingOverage: z13.boolean().optional(),
8105
8125
  /** The overage's own status, the same vocabulary the limiting window's `status` carries. */
8106
- overageStatus: z12.string().optional(),
8126
+ overageStatus: z13.string().optional(),
8107
8127
  /** When the overage window resets, in unix epoch seconds. */
8108
- overageResetsAt: z12.number().optional(),
8128
+ overageResetsAt: z13.number().optional(),
8109
8129
  /** Each subscription window the account's response headers carried: the session (five-hour), weekly (seven-day), and overage-included weekly windows, each present only when the account's responses carry it. */
8110
- unifiedWindows: z12.looseObject({ five_hour: RcRateLimitWindowSchema.optional(), seven_day: RcRateLimitWindowSchema.optional(), seven_day_overage_included: RcRateLimitWindowSchema.optional() }).optional()
8130
+ unifiedWindows: z13.looseObject({ five_hour: RcRateLimitWindowSchema.optional(), seven_day: RcRateLimitWindowSchema.optional(), seven_day_overage_included: RcRateLimitWindowSchema.optional() }).optional()
8111
8131
  });
8112
- RcLiveRateLimitSchema = z12.strictObject({
8113
- session: z12.string(),
8114
- observedAt: z12.number(),
8132
+ RcLiveRateLimitSchema = z13.strictObject({
8133
+ session: z13.string(),
8134
+ observedAt: z13.number(),
8115
8135
  rateLimit: RcRateLimitInfoSchema
8116
8136
  });
8117
- RcSessionQuerySchema = z12.strictObject({
8118
- session: z12.string().min(1).optional()
8137
+ RcSessionQuerySchema = z13.strictObject({
8138
+ session: z13.string().min(1).optional()
8119
8139
  });
8120
- RcSendInputSchema = z12.strictObject({
8121
- session: z12.string().min(1),
8122
- text: z12.string().min(1)
8140
+ RcSendInputSchema = z13.strictObject({
8141
+ session: z13.string().min(1),
8142
+ text: z13.string().min(1)
8123
8143
  });
8124
- RcQuestionSelectionSchema = z12.union([z12.string().min(1), z12.int().positive(), z12.strictObject({ text: z12.string().refine((text) => text.trim() !== "", { message: "free text must not be blank" }) })]);
8125
- RcQuestionChoicesSchema = z12.array(z12.array(RcQuestionSelectionSchema).min(1)).min(1);
8126
- RcAnswerInputSchema = z12.strictObject({
8127
- session: z12.string().min(1),
8128
- request: z12.string().min(1),
8129
- approve: z12.boolean(),
8130
- text: z12.string().optional(),
8144
+ RcQuestionSelectionSchema = z13.union([z13.string().min(1), z13.int().positive(), z13.strictObject({ text: z13.string().refine((text) => text.trim() !== "", { message: "free text must not be blank" }) })]);
8145
+ RcQuestionChoicesSchema = z13.array(z13.array(RcQuestionSelectionSchema).min(1)).min(1);
8146
+ RcAnswerInputSchema = z13.strictObject({
8147
+ session: z13.string().min(1),
8148
+ request: z13.string().min(1),
8149
+ approve: z13.boolean(),
8150
+ text: z13.string().optional(),
8131
8151
  choices: RcQuestionChoicesSchema.optional()
8132
8152
  }).refine((input) => !input.approve || input.text === void 0 || input.text === "", { message: "an approval carries no text (the protocol's allow result has no message field); text is the denial message" }).refine((input) => input.approve || input.choices === void 0, { message: "choices answer a question, so they come with approve: true; a denial dismisses the question" });
8133
- RcInterruptInputSchema = z12.strictObject({
8134
- session: z12.string().min(1)
8153
+ RcInterruptInputSchema = z13.strictObject({
8154
+ session: z13.string().min(1)
8135
8155
  });
8136
- RcSetModelInputSchema = z12.strictObject({
8137
- session: z12.string().min(1),
8138
- model: z12.string().min(1)
8156
+ RcSetModelInputSchema = z13.strictObject({
8157
+ session: z13.string().min(1),
8158
+ model: z13.string().min(1)
8139
8159
  });
8140
- RcSetPermissionModeInputSchema = z12.strictObject({
8141
- session: z12.string().min(1),
8160
+ RcSetPermissionModeInputSchema = z13.strictObject({
8161
+ session: z13.string().min(1),
8142
8162
  mode: RcPermissionModeSchema
8143
8163
  });
8144
- RcEndSessionInputSchema = z12.strictObject({
8145
- session: z12.string().min(1),
8146
- reason: z12.string().min(1).optional()
8164
+ RcEndSessionInputSchema = z13.strictObject({
8165
+ session: z13.string().min(1),
8166
+ reason: z13.string().min(1).optional()
8147
8167
  });
8148
- RcGetUsageInputSchema = z12.strictObject({
8149
- session: z12.string().min(1),
8150
- skipBehaviors: z12.boolean().optional()
8168
+ RcGetUsageInputSchema = z13.strictObject({
8169
+ session: z13.string().min(1),
8170
+ skipBehaviors: z13.boolean().optional()
8151
8171
  });
8152
- RcGetContextUsageInputSchema = z12.strictObject({
8153
- session: z12.string().min(1),
8154
- detail: z12.enum(RC_CONTEXT_USAGE_DETAILS).optional()
8172
+ RcGetContextUsageInputSchema = z13.strictObject({
8173
+ session: z13.string().min(1),
8174
+ detail: z13.enum(RC_CONTEXT_USAGE_DETAILS).optional()
8155
8175
  });
8156
- RcReadFileInputSchema = z12.strictObject({
8157
- session: z12.string().min(1),
8158
- path: z12.string().min(1),
8159
- maxBytes: z12.number().int().positive().optional(),
8160
- encoding: z12.enum(RC_READ_FILE_ENCODINGS).optional()
8176
+ RcReadFileInputSchema = z13.strictObject({
8177
+ session: z13.string().min(1),
8178
+ path: z13.string().min(1),
8179
+ maxBytes: z13.number().int().positive().optional(),
8180
+ encoding: z13.enum(RC_READ_FILE_ENCODINGS).optional()
8161
8181
  });
8162
- RcFileSuggestionsInputSchema = z12.strictObject({
8163
- session: z12.string().min(1),
8164
- query: z12.string()
8182
+ RcFileSuggestionsInputSchema = z13.strictObject({
8183
+ session: z13.string().min(1),
8184
+ query: z13.string()
8165
8185
  });
8166
- RcKeepAliveInputSchema = z12.strictObject({
8167
- session: z12.string().min(1)
8186
+ RcKeepAliveInputSchema = z13.strictObject({
8187
+ session: z13.string().min(1)
8168
8188
  });
8169
- RcMcpStatusInputSchema = z12.strictObject({
8170
- session: z12.string().min(1)
8189
+ RcMcpStatusInputSchema = z13.strictObject({
8190
+ session: z13.string().min(1)
8171
8191
  });
8172
- RcMcpReconnectInputSchema = z12.strictObject({
8173
- session: z12.string().min(1),
8174
- serverName: z12.string().min(1)
8192
+ RcMcpReconnectInputSchema = z13.strictObject({
8193
+ session: z13.string().min(1),
8194
+ serverName: z13.string().min(1)
8175
8195
  });
8176
- RcMcpAuthenticateInputSchema = z12.strictObject({
8177
- session: z12.string().min(1),
8178
- serverName: z12.string().min(1),
8179
- redirectUri: z12.string().min(1)
8196
+ RcMcpAuthenticateInputSchema = z13.strictObject({
8197
+ session: z13.string().min(1),
8198
+ serverName: z13.string().min(1),
8199
+ redirectUri: z13.string().min(1)
8180
8200
  });
8181
- RcMcpOAuthCallbackUrlInputSchema = z12.strictObject({
8182
- session: z12.string().min(1),
8183
- serverName: z12.string().min(1),
8184
- callbackUrl: z12.string().min(1)
8201
+ RcMcpOAuthCallbackUrlInputSchema = z13.strictObject({
8202
+ session: z13.string().min(1),
8203
+ serverName: z13.string().min(1),
8204
+ callbackUrl: z13.string().min(1)
8185
8205
  });
8186
- RcTeleportInputSchema = z12.strictObject({
8187
- session: z12.string().min(1),
8188
- marker: z12.string().min(1)
8206
+ RcTeleportInputSchema = z13.strictObject({
8207
+ session: z13.string().min(1),
8208
+ marker: z13.string().min(1)
8189
8209
  });
8190
- RcListOutputSchema = z12.strictObject({ sessions: z12.readonly(z12.array(RcSessionSummarySchema)) });
8191
- RcSessionCommandRouteSchema = z12.enum(["supervised", "launched", "self-hosted"]);
8192
- RcVersionGateWarningsSchema = z12.readonly(z12.array(z12.string()).min(1)).optional();
8193
- RcSessionRouteSchema = z12.union([z12.strictObject({ route: RcSessionCommandRouteSchema, warnings: RcVersionGateWarningsSchema }), z12.strictObject({ route: z12.null(), refused: z12.string() })]);
8194
- RcStatusOutputSchema = z12.strictObject({ statuses: z12.readonly(z12.array(z12.strictObject({ ...RcSessionStatusSchema.shape, route: RcSessionRouteSchema }))) });
8195
- RcPendingOutputSchema = z12.strictObject({
8196
- pending: z12.readonly(z12.array(RcPendingRequestSummarySchema)),
8210
+ RcListOutputSchema = z13.strictObject({ sessions: z13.readonly(z13.array(RcSessionSummarySchema)) });
8211
+ RcSessionCommandRouteSchema = z13.enum(["supervised", "launched", "self-hosted"]);
8212
+ RcVersionGateWarningsSchema = z13.readonly(z13.array(z13.string()).min(1)).optional();
8213
+ RcSessionRouteSchema = z13.union([z13.strictObject({ route: RcSessionCommandRouteSchema, warnings: RcVersionGateWarningsSchema }), z13.strictObject({ route: z13.null(), refused: z13.string() })]);
8214
+ RcStatusOutputSchema = z13.strictObject({ statuses: z13.readonly(z13.array(z13.strictObject({ ...RcSessionStatusSchema.shape, route: RcSessionRouteSchema, serverState: RcServerStateSchema }))) });
8215
+ RcPendingOutputSchema = z13.strictObject({
8216
+ pending: z13.readonly(z13.array(RcPendingRequestSummarySchema)),
8197
8217
  /** 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. */
8198
- dropped: z12.readonly(z12.array(z12.strictObject({ sessionId: z12.string(), count: z12.int().positive() }))).optional()
8218
+ dropped: z13.readonly(z13.array(z13.strictObject({ sessionId: z13.string(), count: z13.int().positive() }))).optional()
8199
8219
  });
8200
- RcWriteOutputSchema = z12.strictObject({
8201
- session: z12.string(),
8202
- sequenceNums: z12.readonly(z12.array(z12.number()))
8220
+ RcWriteOutputSchema = z13.strictObject({
8221
+ session: z13.string(),
8222
+ sequenceNums: z13.readonly(z13.array(z13.number()))
8203
8223
  });
8204
- RcControlWriteOutputSchema = z12.strictObject({
8205
- session: z12.string(),
8206
- request: z12.string(),
8207
- sequenceNums: z12.readonly(z12.array(z12.number()))
8224
+ RcControlWriteOutputSchema = z13.strictObject({
8225
+ session: z13.string(),
8226
+ request: z13.string(),
8227
+ sequenceNums: z13.readonly(z13.array(z13.number()))
8208
8228
  });
8209
- RcAnswerOutputSchema = z12.strictObject({
8210
- session: z12.string(),
8211
- request: z12.string(),
8212
- sequenceNums: z12.readonly(z12.array(z12.number()))
8229
+ RcAnswerOutputSchema = z13.strictObject({
8230
+ session: z13.string(),
8231
+ request: z13.string(),
8232
+ sequenceNums: z13.readonly(z13.array(z13.number()))
8213
8233
  });
8214
8234
  }
8215
8235
  });
@@ -9007,14 +9027,14 @@ function tlsFacts(options) {
9007
9027
  }
9008
9028
  function realRcEventDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_PORT }) {
9009
9029
  const agent = new ExemptTlsAgent();
9010
- const post = async (path59, headers, body) => await new Promise((resolve, reject) => {
9030
+ const send = async (method, path59, headers, body) => await new Promise((resolve, reject) => {
9011
9031
  const options = {
9012
9032
  host: target.host,
9013
9033
  port: target.port,
9014
- method: "POST",
9034
+ method,
9015
9035
  path: path59,
9016
9036
  // 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.
9017
- headers: { ...headers, host: target.servername ?? target.host, "content-length": String(Buffer.byteLength(body, "utf8")) },
9037
+ headers: { ...headers, host: target.servername ?? target.host, ...body === void 0 ? {} : { "content-length": String(Buffer.byteLength(body, "utf8")) } },
9018
9038
  agent
9019
9039
  };
9020
9040
  options.servername = target.servername ?? target.host;
@@ -9034,9 +9054,15 @@ function realRcEventDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_PO
9034
9054
  });
9035
9055
  });
9036
9056
  request4.once("error", reject);
9037
- request4.end(body);
9057
+ if (body === void 0) {
9058
+ request4.end();
9059
+ } else {
9060
+ request4.end(body);
9061
+ }
9038
9062
  });
9063
+ const post = async (path59, headers, body) => await send("POST", path59, headers, body);
9039
9064
  return {
9065
+ readSession: async (sessionId, headers) => await send("GET", `/v1/code/sessions/${encodeURIComponent(sessionId)}`, headers, void 0),
9040
9066
  writeEvents: async (sessionId, headers, body) => await post(`/v1/code/sessions/${encodeURIComponent(sessionId)}/events`, headers, body),
9041
9067
  writeTeleportEvents: async (sessionId, headers, body) => await post(`/v1/code/sessions/${encodeURIComponent(sessionId)}/teleport-events`, headers, body)
9042
9068
  };
@@ -9052,7 +9078,8 @@ function lateRcEventDial(resolve) {
9052
9078
  };
9053
9079
  return {
9054
9080
  writeEvents: async (sessionId, headers, body) => await dialFor().writeEvents(sessionId, headers, body),
9055
- writeTeleportEvents: async (sessionId, headers, body) => await dialFor().writeTeleportEvents(sessionId, headers, body)
9081
+ writeTeleportEvents: async (sessionId, headers, body) => await dialFor().writeTeleportEvents(sessionId, headers, body),
9082
+ readSession: async (sessionId, headers) => await dialFor().readSession(sessionId, headers)
9056
9083
  };
9057
9084
  }
9058
9085
  function lateRcStreamDial(resolve) {
@@ -9608,7 +9635,7 @@ var init_identity2 = __esm({
9608
9635
  });
9609
9636
 
9610
9637
  // src/statusline/keys.ts
9611
- import { z as z13 } from "zod";
9638
+ import { z as z14 } from "zod";
9612
9639
  function valueAt(source, path59) {
9613
9640
  let current = source;
9614
9641
  for (const part of path59) {
@@ -9624,37 +9651,37 @@ function acceptsNull(path59) {
9624
9651
  return StatuslineSchema.safeParse(layer).success;
9625
9652
  }
9626
9653
  function keyOf(path59, declared) {
9627
- const optional = declared instanceof z13.ZodOptional;
9654
+ const optional = declared instanceof z14.ZodOptional;
9628
9655
  const leaf = optional ? declared.unwrap() : declared;
9629
9656
  const common = { path: path59.join("."), description: declared.description ?? "", defaultValue: valueAt(STATUSLINE_DEFAULTS, path59), optional, unsettable: acceptsNull(path59) };
9630
- if (leaf instanceof z13.ZodNumber) {
9657
+ if (leaf instanceof z14.ZodNumber) {
9631
9658
  return { ...common, kind: "integer", choices: [] };
9632
9659
  }
9633
- if (leaf instanceof z13.ZodBoolean) {
9660
+ if (leaf instanceof z14.ZodBoolean) {
9634
9661
  return { ...common, kind: "boolean", choices: [] };
9635
9662
  }
9636
- if (leaf instanceof z13.ZodString) {
9663
+ if (leaf instanceof z14.ZodString) {
9637
9664
  return { ...common, kind: "text", choices: [] };
9638
9665
  }
9639
- if (leaf instanceof z13.ZodUnion) {
9666
+ if (leaf instanceof z14.ZodUnion) {
9640
9667
  return { ...common, kind: "colour", choices: [...STATUSLINE_COLOUR_NAMES] };
9641
9668
  }
9642
- if (leaf instanceof z13.ZodEnum) {
9669
+ if (leaf instanceof z14.ZodEnum) {
9643
9670
  return { ...common, kind: "choice", choices: Object.values(leaf.enum).map(String) };
9644
9671
  }
9645
- if (leaf instanceof z13.ZodArray && leaf.element instanceof z13.ZodEnum) {
9672
+ if (leaf instanceof z14.ZodArray && leaf.element instanceof z14.ZodEnum) {
9646
9673
  return { ...common, kind: "list", choices: Object.values(leaf.element.enum).map(String) };
9647
9674
  }
9648
- if (leaf instanceof z13.ZodArray && leaf.element instanceof z13.ZodArray && leaf.element.element instanceof z13.ZodEnum) {
9675
+ if (leaf instanceof z14.ZodArray && leaf.element instanceof z14.ZodArray && leaf.element.element instanceof z14.ZodEnum) {
9649
9676
  return { ...common, kind: "groups", choices: Object.values(leaf.element.element.enum).map(String) };
9650
9677
  }
9651
- if (leaf instanceof z13.ZodArray && leaf.element instanceof z13.ZodString) {
9678
+ if (leaf instanceof z14.ZodArray && leaf.element instanceof z14.ZodString) {
9652
9679
  return { ...common, kind: "textList", choices: [] };
9653
9680
  }
9654
9681
  throw new TypeError(`statusline setting ${path59.join(".")} has a kind the key listing does not describe`);
9655
9682
  }
9656
9683
  function walk(shape, prefix) {
9657
- return Object.entries(shape).flatMap(([name, schema]) => schema instanceof z13.ZodObject ? walk(schema.shape, [...prefix, name]) : [keyOf([...prefix, name], schema)]);
9684
+ return Object.entries(shape).flatMap(([name, schema]) => schema instanceof z14.ZodObject ? walk(schema.shape, [...prefix, name]) : [keyOf([...prefix, name], schema)]);
9658
9685
  }
9659
9686
  function statuslineKeys() {
9660
9687
  return walk(ResolvedStatuslineSchema.shape, []);
@@ -10382,7 +10409,7 @@ var init_headers = __esm({
10382
10409
 
10383
10410
  // src/launcher/injected.ts
10384
10411
  import { createHash as createHash5 } from "node:crypto";
10385
- import { z as z14 } from "zod";
10412
+ import { z as z15 } from "zod";
10386
10413
  function listKey(list) {
10387
10414
  return `${list},appended`;
10388
10415
  }
@@ -10476,7 +10503,7 @@ var init_injected = __esm({
10476
10503
  INJECTED_ENV = "AGENT_SHIM_INJECTED";
10477
10504
  CUSTOM_HEADERS_ENV = "ANTHROPIC_CUSTOM_HEADERS";
10478
10505
  HEADER_KEY_PREFIX = `${CUSTOM_HEADERS_ENV}:`;
10479
- InjectedSchema = z14.record(z14.string(), z14.string());
10506
+ InjectedSchema = z15.record(z15.string(), z15.string());
10480
10507
  }
10481
10508
  });
10482
10509
 
@@ -10978,7 +11005,7 @@ var init_supervisorProcesses = __esm({
10978
11005
  // src/headroom/state.ts
10979
11006
  import { createHash as createHash7 } from "node:crypto";
10980
11007
  import path21 from "node:path";
10981
- import { z as z15 } from "zod";
11008
+ import { z as z16 } from "zod";
10982
11009
  function parseJson(raw, schema) {
10983
11010
  if (raw === void 0 || raw.trim() === "") {
10984
11011
  return void 0;
@@ -11135,32 +11162,32 @@ var init_state2 = __esm({
11135
11162
  "src/headroom/state.ts"() {
11136
11163
  "use strict";
11137
11164
  init_schema();
11138
- HeadroomStateSchema = z15.strictObject({
11165
+ HeadroomStateSchema = z16.strictObject({
11139
11166
  /** The supervisor process owning the daemon. Alive means someone is keeping headroom running. */
11140
- supervisorPid: z15.number().int().positive().optional(),
11167
+ supervisorPid: z16.number().int().positive().optional(),
11141
11168
  /** The headroom proxy process itself, recorded as soon as it is spawned (before it is ready, which `socketPath` signals) so a successor can find a daemon whose supervisor died during its start. Absent while the supervisor is between restarts. */
11142
- headroomPid: z15.number().int().positive().optional(),
11169
+ headroomPid: z16.number().int().positive().optional(),
11143
11170
  /**
11144
11171
  * The unix socket the proxy serves on, inside the owner-only socket directory. Absent until the proxy has passed its readiness check, so "socketPath is set" is itself the ready signal a launcher polls for. The front door reads it on every hop, so a restart (which keeps the generation's path) is followed without anything being relaunched.
11145
11172
  */
11146
- socketPath: z15.string().min(1).optional(),
11173
+ socketPath: z16.string().min(1).optional(),
11147
11174
  /** The `headroom --version` output of the running install. */
11148
- version: z15.string().optional(),
11175
+ version: z16.string().optional(),
11149
11176
  /**
11150
11177
  * Hash of the allowlist the running proxy serves. The supervisor records it in the same tick it writes that allowlist to `LayoutPaths.headroomAllowlistFile`, which the proxy re-reads on its next request, so a provider launch, whose requests come back through its front door's direct origin, waits until this names an allowlist holding that origin. A supervisor from an earlier release records here the hash of the allowlist its daemon was started with instead (see `earlierRelease.ts`).
11151
11178
  */
11152
- allowlistHash: z15.string().optional(),
11179
+ allowlistHash: z16.string().optional(),
11153
11180
  /** Hash of the token-saving settings the running proxy was started with, so a settings change is detected as drift. */
11154
- settingsHash: z15.string().optional(),
11181
+ settingsHash: z16.string().optional(),
11155
11182
  /** The install spec the running install was last installed from, so a `source` config change is detected as drift. */
11156
- installedSource: z15.string().optional(),
11183
+ installedSource: z16.string().optional(),
11157
11184
  /** The install spec the supervisor is installing right now, present only while `uv tool install` runs, so a launcher that finds a live supervisor with no daemon yet keeps waiting for the install instead of counting it against its start bound. Cleared by the write that follows the install, whatever its outcome. */
11158
- installing: z15.string().optional(),
11185
+ installing: z16.string().optional(),
11159
11186
  /** The last fatal error, kept across shutdowns so `headroom status` can explain a daemon that is not running. */
11160
- lastError: z15.string().optional()
11187
+ lastError: z16.string().optional()
11161
11188
  });
11162
- HeadroomSessionSchema = z15.strictObject({ pid: z15.number().int().positive(), startedAt: z15.number(), supervisorPid: z15.number().int().positive() });
11163
- HeadroomLockSchema = z15.strictObject({ pid: z15.number().int().positive(), at: z15.number() });
11189
+ HeadroomSessionSchema = z16.strictObject({ pid: z16.number().int().positive(), startedAt: z16.number(), supervisorPid: z16.number().int().positive() });
11190
+ HeadroomLockSchema = z16.strictObject({ pid: z16.number().int().positive(), at: z16.number() });
11164
11191
  HEADROOM_ALLOWLIST_FILE_FLAG = "--allowed-base-urls-file";
11165
11192
  ALLOWLIST_LINE_BREAKS = "\\n\\r\\u000b\\u000c\\u001c\\u001d\\u001e\\u0085\\u2028\\u2029";
11166
11193
  ALLOWLIST_WHITESPACE = "\\t\\n\\u000b\\u000c\\r\\u001c-\\u001f \\u0085\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000";
@@ -11586,7 +11613,7 @@ var init_socket = __esm({
11586
11613
  });
11587
11614
 
11588
11615
  // src/headroom/source.ts
11589
- import { z as z16 } from "zod";
11616
+ import { z as z17 } from "zod";
11590
11617
  function isMovingGitSource(spec) {
11591
11618
  const match = GIT_SPEC_RE.exec(spec);
11592
11619
  if (match === null) {
@@ -11605,7 +11632,7 @@ var init_source = __esm({
11605
11632
  "use strict";
11606
11633
  GIT_SPEC_RE = /git\+[^@\s]+(?:@([^\s#]+))?/;
11607
11634
  COMMIT_SHA_RE = /^[0-9a-f]{40}$/i;
11608
- DirectUrlSchema = z16.object({ vcs_info: z16.object({ commit_id: z16.string() }) });
11635
+ DirectUrlSchema = z17.object({ vcs_info: z17.object({ commit_id: z17.string() }) });
11609
11636
  }
11610
11637
  });
11611
11638
 
@@ -13267,32 +13294,32 @@ var init_storedCatalogue = __esm({
13267
13294
  });
13268
13295
 
13269
13296
  // src/routeOverridesSchema.ts
13270
- import { z as z17 } from "zod";
13297
+ import { z as z18 } from "zod";
13271
13298
  var OverrideTableSchema, RouteOverridesSchema, RepairableTableSchema, RepairableRouteOverridesSchema;
13272
13299
  var init_routeOverridesSchema = __esm({
13273
13300
  "src/routeOverridesSchema.ts"() {
13274
13301
  "use strict";
13275
- OverrideTableSchema = z17.record(z17.string().min(1), z17.string().min(1));
13276
- RouteOverridesSchema = z17.strictObject({
13277
- $schema: z17.string().optional(),
13278
- schemaVersion: z17.literal(1),
13302
+ OverrideTableSchema = z18.record(z18.string().min(1), z18.string().min(1));
13303
+ RouteOverridesSchema = z18.strictObject({
13304
+ $schema: z18.string().optional(),
13305
+ schemaVersion: z18.literal(1),
13279
13306
  /** Every session with no entry of its own for the name. */
13280
13307
  global: OverrideTableSchema.optional(),
13281
13308
  /** By provider name: the sessions whose request would reach that provider. */
13282
- providers: z17.record(z17.string().min(1), OverrideTableSchema).optional(),
13309
+ providers: z18.record(z18.string().min(1), OverrideTableSchema).optional(),
13283
13310
  /** By identity name: the sessions running as that identity. */
13284
- identities: z17.record(z17.string().min(1), OverrideTableSchema).optional(),
13311
+ identities: z18.record(z18.string().min(1), OverrideTableSchema).optional(),
13285
13312
  /** By launch session id: one session. */
13286
- sessions: z17.record(z17.string().min(1), OverrideTableSchema).optional()
13313
+ sessions: z18.record(z18.string().min(1), OverrideTableSchema).optional()
13287
13314
  });
13288
- RepairableTableSchema = z17.record(z17.string(), z17.string());
13289
- RepairableRouteOverridesSchema = z17.strictObject({
13290
- $schema: z17.string().optional(),
13291
- schemaVersion: z17.literal(1),
13315
+ RepairableTableSchema = z18.record(z18.string(), z18.string());
13316
+ RepairableRouteOverridesSchema = z18.strictObject({
13317
+ $schema: z18.string().optional(),
13318
+ schemaVersion: z18.literal(1),
13292
13319
  global: RepairableTableSchema.optional(),
13293
- providers: z17.record(z17.string(), RepairableTableSchema).optional(),
13294
- identities: z17.record(z17.string(), RepairableTableSchema).optional(),
13295
- sessions: z17.record(z17.string(), RepairableTableSchema).optional()
13320
+ providers: z18.record(z18.string(), RepairableTableSchema).optional(),
13321
+ identities: z18.record(z18.string(), RepairableTableSchema).optional(),
13322
+ sessions: z18.record(z18.string(), RepairableTableSchema).optional()
13296
13323
  });
13297
13324
  }
13298
13325
  });
@@ -13663,7 +13690,7 @@ var init_candidateText = __esm({
13663
13690
  });
13664
13691
 
13665
13692
  // src/usage/plan.ts
13666
- import { z as z18 } from "zod";
13693
+ import { z as z19 } from "zod";
13667
13694
  function planOf(account) {
13668
13695
  const userTier = account?.userRateLimitTier;
13669
13696
  if (userTier !== void 0 && ZERO_TIER.test(userTier)) {
@@ -13690,19 +13717,19 @@ var PlanClassSchema, TIER_MULTIPLIER, ZERO_TIER, BASE_TIER;
13690
13717
  var init_plan2 = __esm({
13691
13718
  "src/usage/plan.ts"() {
13692
13719
  "use strict";
13693
- PlanClassSchema = z18.union([
13694
- z18.strictObject({
13695
- kind: z18.literal("subscription"),
13720
+ PlanClassSchema = z19.union([
13721
+ z19.strictObject({
13722
+ kind: z19.literal("subscription"),
13696
13723
  /** The plan's size as a multiple of the smallest subscription tier (Max is 5, Ultra is 20). */
13697
- capacity: z18.number().positive(),
13724
+ capacity: z19.number().positive(),
13698
13725
  /** False when the tier string named no multiplier and no tier this project knows, so `capacity` is the neutral 1 rather than a reading. */
13699
- recognised: z18.boolean(),
13726
+ recognised: z19.boolean(),
13700
13727
  /** The tier string the classification rests on, when the account had one. */
13701
- tier: z18.string().optional()
13728
+ tier: z19.string().optional()
13702
13729
  }),
13703
- z18.strictObject({
13704
- kind: z18.literal("pay-per-use"),
13705
- tier: z18.string().optional()
13730
+ z19.strictObject({
13731
+ kind: z19.literal("pay-per-use"),
13732
+ tier: z19.string().optional()
13706
13733
  })
13707
13734
  ]);
13708
13735
  TIER_MULTIPLIER = /(?:^|_)(\d+)x$/;
@@ -13712,21 +13739,21 @@ var init_plan2 = __esm({
13712
13739
  });
13713
13740
 
13714
13741
  // src/usage/scan.ts
13715
- import { z as z19 } from "zod";
13742
+ import { z as z20 } from "zod";
13716
13743
  var AnthropicUsageSchema, ErrorObjectSchema;
13717
13744
  var init_scan = __esm({
13718
13745
  "src/usage/scan.ts"() {
13719
13746
  "use strict";
13720
- AnthropicUsageSchema = z19.looseObject({
13721
- input_tokens: z19.number().int().nonnegative().nullish(),
13722
- output_tokens: z19.number().int().nonnegative().nullish(),
13723
- cache_creation_input_tokens: z19.number().int().nonnegative().nullish(),
13724
- cache_read_input_tokens: z19.number().int().nonnegative().nullish()
13747
+ AnthropicUsageSchema = z20.looseObject({
13748
+ input_tokens: z20.number().int().nonnegative().nullish(),
13749
+ output_tokens: z20.number().int().nonnegative().nullish(),
13750
+ cache_creation_input_tokens: z20.number().int().nonnegative().nullish(),
13751
+ cache_read_input_tokens: z20.number().int().nonnegative().nullish()
13725
13752
  });
13726
- ErrorObjectSchema = z19.looseObject({
13727
- type: z19.string().optional(),
13728
- code: z19.union([z19.string(), z19.number()]).optional(),
13729
- message: z19.string().optional()
13753
+ ErrorObjectSchema = z20.looseObject({
13754
+ type: z20.string().optional(),
13755
+ code: z20.union([z20.string(), z20.number()]).optional(),
13756
+ message: z20.string().optional()
13730
13757
  });
13731
13758
  }
13732
13759
  });
@@ -14272,7 +14299,7 @@ var init_store2 = __esm({
14272
14299
 
14273
14300
  // src/usage/poolPick.ts
14274
14301
  import path27 from "node:path";
14275
- import { z as z20 } from "zod";
14302
+ import { z as z21 } from "zod";
14276
14303
  function errorMessage(error) {
14277
14304
  return error instanceof Error ? error.message : String(error);
14278
14305
  }
@@ -14482,10 +14509,10 @@ var init_poolPick = __esm({
14482
14509
  }
14483
14510
  };
14484
14511
  SCHEMA_VERSION = 1;
14485
- PickEntrySchema = z20.strictObject({ identity: z20.string().min(1), at: z20.iso.datetime() });
14486
- PicksFileSchema = z20.strictObject({
14487
- schemaVersion: z20.literal(SCHEMA_VERSION),
14488
- picks: z20.record(z20.string().min(1), PickEntrySchema)
14512
+ PickEntrySchema = z21.strictObject({ identity: z21.string().min(1), at: z21.iso.datetime() });
14513
+ PicksFileSchema = z21.strictObject({
14514
+ schemaVersion: z21.literal(SCHEMA_VERSION),
14515
+ picks: z21.record(z21.string().min(1), PickEntrySchema)
14489
14516
  });
14490
14517
  }
14491
14518
  });
@@ -14493,7 +14520,7 @@ var init_poolPick = __esm({
14493
14520
  // src/identityRenameJournal.ts
14494
14521
  import { createHash as createHash10 } from "node:crypto";
14495
14522
  import path28 from "node:path";
14496
- import { z as z21 } from "zod";
14523
+ import { z as z22 } from "zod";
14497
14524
  function renamePairFileName(from, to, suffix) {
14498
14525
  return `${createHash10("sha256").update(`${from}\0${to}`).digest("hex").slice(0, FILE_NAME_HASH_DIGITS)}${suffix}`;
14499
14526
  }
@@ -14581,20 +14608,20 @@ var init_identityRenameJournal = __esm({
14581
14608
  init_cliError();
14582
14609
  init_load();
14583
14610
  init_readableConfig();
14584
- RenameJournalSchema = z21.strictObject({
14585
- version: z21.literal(1),
14586
- from: z21.string().min(1),
14587
- to: z21.string().min(1),
14588
- startedAt: z21.iso.datetime(),
14611
+ RenameJournalSchema = z22.strictObject({
14612
+ version: z22.literal(1),
14613
+ from: z22.string().min(1),
14614
+ to: z22.string().min(1),
14615
+ startedAt: z22.iso.datetime(),
14589
14616
  /** The process that began the rename, for a person reading the file. Whether it is still running is told by the locks, not by this. */
14590
- pid: z21.number().int().positive(),
14591
- steps: z21.array(
14592
- z21.strictObject({
14593
- description: z21.string().min(1),
14617
+ pid: z22.number().int().positive(),
14618
+ steps: z22.array(
14619
+ z22.strictObject({
14620
+ description: z22.string().min(1),
14594
14621
  /** Whether the step has been applied and marked so. */
14595
- done: z21.boolean(),
14622
+ done: z22.boolean(),
14596
14623
  /** Whether the step was begun: written ahead of the step, before it runs, so a process that dies after the step took effect and before `done` was written still leaves a record that it may have. */
14597
- started: z21.boolean()
14624
+ started: z22.boolean()
14598
14625
  })
14599
14626
  )
14600
14627
  });
@@ -14620,7 +14647,7 @@ var init_identityRenameJournal = __esm({
14620
14647
  // src/identityNameRenameRecord.ts
14621
14648
  import fs8 from "node:fs";
14622
14649
  import path29 from "node:path";
14623
- import { z as z22 } from "zod";
14650
+ import { z as z23 } from "zod";
14624
14651
  function readRecordFiles(paths) {
14625
14652
  if (!fs8.existsSync(paths.identityNameRenamesDir)) {
14626
14653
  return [];
@@ -14718,12 +14745,12 @@ var init_identityNameRenameRecord = __esm({
14718
14745
  init_poolPick();
14719
14746
  init_identityRecords();
14720
14747
  init_identityRenameJournal();
14721
- NameRenameRecordSchema = z22.strictObject({
14722
- version: z22.literal(1),
14723
- id: z22.string().min(1),
14724
- from: z22.string().min(1),
14725
- to: z22.string().min(1),
14726
- startedAt: z22.iso.datetime()
14748
+ NameRenameRecordSchema = z23.strictObject({
14749
+ version: z23.literal(1),
14750
+ id: z23.string().min(1),
14751
+ from: z23.string().min(1),
14752
+ to: z23.string().min(1),
14753
+ startedAt: z23.iso.datetime()
14727
14754
  });
14728
14755
  RECORD_SUFFIX = ".json";
14729
14756
  InterruptedNameRenameError = class extends CliError {
@@ -14738,7 +14765,7 @@ var init_identityNameRenameRecord = __esm({
14738
14765
  // src/launcher/launchRecords.ts
14739
14766
  import path30 from "node:path";
14740
14767
  import { randomUUID as randomUUID4 } from "node:crypto";
14741
- import { z as z23 } from "zod";
14768
+ import { z as z24 } from "zod";
14742
14769
  function recordFile(directory, pid) {
14743
14770
  return path30.join(directory, `${String(pid)}.${randomUUID4()}${RECORD_SUFFIX2}`);
14744
14771
  }
@@ -14785,11 +14812,11 @@ var LaunchRecordSchema, RECORD_SUFFIX2;
14785
14812
  var init_launchRecords = __esm({
14786
14813
  "src/launcher/launchRecords.ts"() {
14787
14814
  "use strict";
14788
- LaunchRecordSchema = z23.strictObject({
14815
+ LaunchRecordSchema = z24.strictObject({
14789
14816
  /** The launcher's process id, which is what tells a launch in progress from a record a crashed launcher left behind. */
14790
- pid: z23.number().int().positive(),
14791
- identity: z23.string().min(1),
14792
- startedAt: z23.iso.datetime()
14817
+ pid: z24.number().int().positive(),
14818
+ identity: z24.string().min(1),
14819
+ startedAt: z24.iso.datetime()
14793
14820
  });
14794
14821
  RECORD_SUFFIX2 = ".json";
14795
14822
  }
@@ -14821,6 +14848,15 @@ var init_connectorProxyAuth = __esm({
14821
14848
  }
14822
14849
  });
14823
14850
 
14851
+ // src/toolSurfaceAuth.ts
14852
+ var init_toolSurfaceAuth = __esm({
14853
+ "src/toolSurfaceAuth.ts"() {
14854
+ "use strict";
14855
+ init_connect();
14856
+ init_lenderLogin();
14857
+ }
14858
+ });
14859
+
14824
14860
  // src/connectorListMerge.ts
14825
14861
  var init_connectorListMerge = __esm({
14826
14862
  "src/connectorListMerge.ts"() {
@@ -15290,6 +15326,7 @@ var init_identityStore = __esm({
15290
15326
  init_launchRecords();
15291
15327
  init_identityGrants();
15292
15328
  init_connectorProxyAuth();
15329
+ init_toolSurfaceAuth();
15293
15330
  init_connectorListMerge();
15294
15331
  init_lenderLogin();
15295
15332
  init_quotaHttp();
@@ -15354,7 +15391,7 @@ var init_package = __esm({
15354
15391
  "package.json"() {
15355
15392
  package_default = {
15356
15393
  name: "agent-shim",
15357
- version: "14.20.1",
15394
+ version: "14.22.0",
15358
15395
  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.",
15359
15396
  license: "MIT",
15360
15397
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -15464,13 +15501,13 @@ var init_package = __esm({
15464
15501
 
15465
15502
  // src/supervise/sessionControl.ts
15466
15503
  import path34 from "node:path";
15467
- import { z as z25 } from "zod";
15504
+ import { z as z26 } from "zod";
15468
15505
  var RESULT_POLL_MS, SessionControlConversationSchema, REQUEST_INSTANT_DIGITS;
15469
15506
  var init_sessionControl = __esm({
15470
15507
  "src/supervise/sessionControl.ts"() {
15471
15508
  "use strict";
15472
15509
  RESULT_POLL_MS = 250;
15473
- SessionControlConversationSchema = z25.object({ conversationId: z25.string().min(1), transcriptPath: z25.string().refine(path34.isAbsolute) });
15510
+ SessionControlConversationSchema = z26.object({ conversationId: z26.string().min(1), transcriptPath: z26.string().refine(path34.isAbsolute) });
15474
15511
  REQUEST_INSTANT_DIGITS = String(Number.MAX_SAFE_INTEGER).length;
15475
15512
  }
15476
15513
  });
@@ -15621,7 +15658,7 @@ var init_commandDeps = __esm({
15621
15658
  // src/claudeShim.ts
15622
15659
  import fs10 from "node:fs";
15623
15660
  import path35 from "node:path";
15624
- import { z as z31 } from "zod";
15661
+ import { z as z32 } from "zod";
15625
15662
  function commandFilename(ownExecutablePath, commandName) {
15626
15663
  return ownExecutablePath.toLowerCase().endsWith(".exe") ? `${commandName}.exe` : commandName;
15627
15664
  }
@@ -15691,10 +15728,10 @@ var init_claudeShim = __esm({
15691
15728
  init_realPorts();
15692
15729
  init_cliError();
15693
15730
  init_fileFaults();
15694
- ClaudeShimStateSchema = z31.strictObject({
15695
- targetPath: z31.string().min(1),
15696
- method: z31.enum(["hardlink", "copy"]),
15697
- installedAtMs: z31.number()
15731
+ ClaudeShimStateSchema = z32.strictObject({
15732
+ targetPath: z32.string().min(1),
15733
+ method: z32.enum(["hardlink", "copy"]),
15734
+ installedAtMs: z32.number()
15698
15735
  });
15699
15736
  SCRIPT_HEAD_BYTES = 4096;
15700
15737
  LAUNCHER_NAME = /\b(agent-shim|claude-use)\b/;
@@ -16029,7 +16066,7 @@ var init_providerReachability = __esm({
16029
16066
  });
16030
16067
 
16031
16068
  // src/providerAliases.ts
16032
- import { z as z32 } from "zod";
16069
+ import { z as z33 } from "zod";
16033
16070
  function parseAliases(file, raw) {
16034
16071
  const parsed = ProviderAliasesSchema.safeParse(raw);
16035
16072
  if (!parsed.success) {
@@ -16069,7 +16106,7 @@ var init_providerAliases = __esm({
16069
16106
  init_load();
16070
16107
  init_store();
16071
16108
  init_ownEntry();
16072
- ProviderAliasesSchema = z32.record(z32.string().min(1), z32.string().min(1));
16109
+ ProviderAliasesSchema = z33.record(z33.string().min(1), z33.string().min(1));
16073
16110
  }
16074
16111
  });
16075
16112
 
@@ -16846,12 +16883,12 @@ var init_tolerantReaders = __esm({
16846
16883
  });
16847
16884
 
16848
16885
  // src/frontdoor/catalogueState.ts
16849
- import { z as z34 } from "zod";
16886
+ import { z as z35 } from "zod";
16850
16887
  function readCatalogueFailure(fs17, paths, pid, generation, name) {
16851
16888
  const raw = new StoredCatalogue(paths, skippingReader(fs17)).failureText({ pid, generation }, name);
16852
16889
  if (raw === void 0) return void 0;
16853
16890
  try {
16854
- const value = z34.strictObject({ reason: z34.string().max(CATALOGUE_FAILURE_REASON_MAX_CHARS), redirected: z34.literal(true).optional(), settings: z34.string().optional() }).safeParse(JSON.parse(raw));
16891
+ const value = z35.strictObject({ reason: z35.string().max(CATALOGUE_FAILURE_REASON_MAX_CHARS), redirected: z35.literal(true).optional(), settings: z35.string().optional() }).safeParse(JSON.parse(raw));
16855
16892
  return value.success ? { reason: value.data.reason, redirected: value.data.redirected === true, settings: value.data.settings } : void 0;
16856
16893
  } catch {
16857
16894
  return void 0;
@@ -16861,7 +16898,7 @@ function readCatalogueStatus(fs17, paths, pid, generation, name) {
16861
16898
  const raw = new StoredCatalogue(paths, skippingReader(fs17)).statusText({ pid, generation }, name);
16862
16899
  if (raw === void 0) return void 0;
16863
16900
  try {
16864
- const value = z34.strictObject({ status: z34.enum(["running", "ready", "failed"]), fingerprint: z34.string().min(1).optional(), recordedAt: z34.number().optional() }).safeParse(JSON.parse(raw));
16901
+ const value = z35.strictObject({ status: z35.enum(["running", "ready", "failed"]), fingerprint: z35.string().min(1).optional(), recordedAt: z35.number().optional() }).safeParse(JSON.parse(raw));
16865
16902
  return value.success ? value.data : void 0;
16866
16903
  } catch {
16867
16904
  return void 0;
@@ -16878,25 +16915,25 @@ var init_catalogueState = __esm({
16878
16915
  });
16879
16916
 
16880
16917
  // src/codex/auth.ts
16881
- import { z as z35 } from "zod";
16918
+ import { z as z36 } from "zod";
16882
16919
  var AuthFileSchema, TokenGrantSchema, CodexAuthError;
16883
16920
  var init_auth = __esm({
16884
16921
  "src/codex/auth.ts"() {
16885
16922
  "use strict";
16886
- AuthFileSchema = z35.looseObject({
16887
- tokens: z35.looseObject({
16888
- access_token: z35.string().optional(),
16889
- refresh_token: z35.string().optional(),
16890
- id_token: z35.string().optional(),
16891
- account_id: z35.string().optional()
16923
+ AuthFileSchema = z36.looseObject({
16924
+ tokens: z36.looseObject({
16925
+ access_token: z36.string().optional(),
16926
+ refresh_token: z36.string().optional(),
16927
+ id_token: z36.string().optional(),
16928
+ account_id: z36.string().optional()
16892
16929
  }).nullish(),
16893
- last_refresh: z35.string().optional()
16930
+ last_refresh: z36.string().optional()
16894
16931
  });
16895
- TokenGrantSchema = z35.looseObject({
16896
- access_token: z35.string().min(1).optional(),
16897
- refresh_token: z35.string().min(1).optional(),
16898
- id_token: z35.string().min(1).optional(),
16899
- account_id: z35.string().min(1).optional()
16932
+ TokenGrantSchema = z36.looseObject({
16933
+ access_token: z36.string().min(1).optional(),
16934
+ refresh_token: z36.string().min(1).optional(),
16935
+ id_token: z36.string().min(1).optional(),
16936
+ account_id: z36.string().min(1).optional()
16900
16937
  });
16901
16938
  CodexAuthError = class extends Error {
16902
16939
  constructor(message) {
@@ -16908,7 +16945,7 @@ var init_auth = __esm({
16908
16945
  });
16909
16946
 
16910
16947
  // src/codex/siwc.ts
16911
- import { z as z36 } from "zod";
16948
+ import { z as z37 } from "zod";
16912
16949
  var SIWC_RESOURCE, SIWC_RESPONSES_URL, SIWC_PLAN_SCOPE, TokenResponseSchema, JwtHeaderSchema, IdTokenClaimsSchema, JwksSchema;
16913
16950
  var init_siwc = __esm({
16914
16951
  "src/codex/siwc.ts"() {
@@ -16916,28 +16953,28 @@ var init_siwc = __esm({
16916
16953
  SIWC_RESOURCE = "https://api.openai.com/v1";
16917
16954
  SIWC_RESPONSES_URL = `${SIWC_RESOURCE}/responses`;
16918
16955
  SIWC_PLAN_SCOPE = "chatgpt.tokens.use.direct";
16919
- TokenResponseSchema = z36.looseObject({
16920
- access_token: z36.string().min(1),
16921
- refresh_token: z36.string().min(1).optional(),
16922
- id_token: z36.string().min(1).optional(),
16923
- expires_in: z36.number().positive(),
16924
- scope: z36.string().optional()
16956
+ TokenResponseSchema = z37.looseObject({
16957
+ access_token: z37.string().min(1),
16958
+ refresh_token: z37.string().min(1).optional(),
16959
+ id_token: z37.string().min(1).optional(),
16960
+ expires_in: z37.number().positive(),
16961
+ scope: z37.string().optional()
16925
16962
  });
16926
- JwtHeaderSchema = z36.looseObject({ alg: z36.string(), kid: z36.string().optional() });
16927
- IdTokenClaimsSchema = z36.looseObject({
16928
- iss: z36.string(),
16929
- sub: z36.string().min(1),
16930
- aud: z36.union([z36.string(), z36.array(z36.string())]),
16931
- exp: z36.number(),
16932
- nonce: z36.string().optional(),
16933
- email: z36.string().optional()
16963
+ JwtHeaderSchema = z37.looseObject({ alg: z37.string(), kid: z37.string().optional() });
16964
+ IdTokenClaimsSchema = z37.looseObject({
16965
+ iss: z37.string(),
16966
+ sub: z37.string().min(1),
16967
+ aud: z37.union([z37.string(), z37.array(z37.string())]),
16968
+ exp: z37.number(),
16969
+ nonce: z37.string().optional(),
16970
+ email: z37.string().optional()
16934
16971
  });
16935
- JwksSchema = z36.object({ keys: z36.array(z36.looseObject({ kid: z36.string().optional(), kty: z36.string() })) });
16972
+ JwksSchema = z37.object({ keys: z37.array(z37.looseObject({ kid: z37.string().optional(), kty: z37.string() })) });
16936
16973
  }
16937
16974
  });
16938
16975
 
16939
16976
  // src/codex/siwcStore.ts
16940
- import { z as z37 } from "zod";
16977
+ import { z as z38 } from "zod";
16941
16978
  function parseSiwcFile(raw, filePath) {
16942
16979
  let json;
16943
16980
  try {
@@ -16957,18 +16994,18 @@ var init_siwcStore = __esm({
16957
16994
  "use strict";
16958
16995
  init_auth();
16959
16996
  init_siwc();
16960
- SiwcGrantSchema = z37.strictObject({
16961
- clientId: z37.string().min(1),
16962
- sub: z37.string().min(1),
16963
- email: z37.string().optional(),
16964
- idToken: z37.string().min(1),
16965
- accessToken: z37.string().min(1),
16966
- refreshToken: z37.string().min(1),
16967
- scopes: z37.array(z37.string()).readonly(),
16997
+ SiwcGrantSchema = z38.strictObject({
16998
+ clientId: z38.string().min(1),
16999
+ sub: z38.string().min(1),
17000
+ email: z38.string().optional(),
17001
+ idToken: z38.string().min(1),
17002
+ accessToken: z38.string().min(1),
17003
+ refreshToken: z38.string().min(1),
17004
+ scopes: z38.array(z38.string()).readonly(),
16968
17005
  /** When the access token stops working, in milliseconds since the epoch. */
16969
- expiresAt: z37.number()
17006
+ expiresAt: z38.number()
16970
17007
  });
16971
- SiwcFileSchema = z37.strictObject({ registeredClientId: z37.string().min(1).optional(), grant: SiwcGrantSchema.optional() });
17008
+ SiwcFileSchema = z38.strictObject({ registeredClientId: z38.string().min(1).optional(), grant: SiwcGrantSchema.optional() });
16972
17009
  }
16973
17010
  });
16974
17011
 
@@ -17034,7 +17071,7 @@ var init_modelsStore = __esm({
17034
17071
  // src/codex/catalogueCredential.ts
17035
17072
  import { createHash as createHash11 } from "node:crypto";
17036
17073
  import path43 from "node:path";
17037
- import { z as z38 } from "zod";
17074
+ import { z as z39 } from "zod";
17038
17075
  function parseCatalogueBinding(raw) {
17039
17076
  if (raw === void 0) return void 0;
17040
17077
  try {
@@ -17075,7 +17112,7 @@ var init_catalogueCredential = __esm({
17075
17112
  "src/codex/catalogueCredential.ts"() {
17076
17113
  "use strict";
17077
17114
  init_siwcStore();
17078
- CatalogueBindingSchema = z38.strictObject({ fingerprint: z38.string().min(1), source: z38.string().min(1), revision: z38.string().min(1) });
17115
+ CatalogueBindingSchema = z39.strictObject({ fingerprint: z39.string().min(1), source: z39.string().min(1), revision: z39.string().min(1) });
17079
17116
  }
17080
17117
  });
17081
17118
 
@@ -17127,64 +17164,64 @@ var init_signatures = __esm({
17127
17164
  });
17128
17165
 
17129
17166
  // src/codex/anthropic.ts
17130
- import { z as z39 } from "zod";
17167
+ import { z as z40 } from "zod";
17131
17168
  var TextBlockSchema, Base64ImageSourceSchema, UrlImageSourceSchema, ImageBlockSchema, ToolUseBlockSchema, ToolResultContentBlockSchema, ToolResultBlockSchema, OtherBlockSchema, ContentBlockSchema, MessageSchema, ToolSchema, ToolChoiceSchema, SystemSchema, MessagesRequestSchema, CountTokensRequestSchema;
17132
17169
  var init_anthropic = __esm({
17133
17170
  "src/codex/anthropic.ts"() {
17134
17171
  "use strict";
17135
- TextBlockSchema = z39.looseObject({ type: z39.literal("text"), text: z39.string() });
17136
- Base64ImageSourceSchema = z39.looseObject({ type: z39.literal("base64"), media_type: z39.string().min(1), data: z39.string() });
17137
- UrlImageSourceSchema = z39.looseObject({ type: z39.literal("url"), url: z39.string().min(1) });
17138
- ImageBlockSchema = z39.looseObject({
17139
- type: z39.literal("image"),
17140
- source: z39.union([Base64ImageSourceSchema, UrlImageSourceSchema])
17172
+ TextBlockSchema = z40.looseObject({ type: z40.literal("text"), text: z40.string() });
17173
+ Base64ImageSourceSchema = z40.looseObject({ type: z40.literal("base64"), media_type: z40.string().min(1), data: z40.string() });
17174
+ UrlImageSourceSchema = z40.looseObject({ type: z40.literal("url"), url: z40.string().min(1) });
17175
+ ImageBlockSchema = z40.looseObject({
17176
+ type: z40.literal("image"),
17177
+ source: z40.union([Base64ImageSourceSchema, UrlImageSourceSchema])
17141
17178
  });
17142
- ToolUseBlockSchema = z39.looseObject({
17143
- type: z39.literal("tool_use"),
17144
- id: z39.string().min(1),
17145
- name: z39.string().min(1),
17146
- input: z39.unknown()
17179
+ ToolUseBlockSchema = z40.looseObject({
17180
+ type: z40.literal("tool_use"),
17181
+ id: z40.string().min(1),
17182
+ name: z40.string().min(1),
17183
+ input: z40.unknown()
17147
17184
  });
17148
- ToolResultContentBlockSchema = z39.union([TextBlockSchema, z39.looseObject({ type: z39.string() })]);
17149
- ToolResultBlockSchema = z39.looseObject({
17150
- type: z39.literal("tool_result"),
17151
- tool_use_id: z39.string().min(1),
17152
- content: z39.union([z39.string(), z39.array(ToolResultContentBlockSchema)]).optional()
17185
+ ToolResultContentBlockSchema = z40.union([TextBlockSchema, z40.looseObject({ type: z40.string() })]);
17186
+ ToolResultBlockSchema = z40.looseObject({
17187
+ type: z40.literal("tool_result"),
17188
+ tool_use_id: z40.string().min(1),
17189
+ content: z40.union([z40.string(), z40.array(ToolResultContentBlockSchema)]).optional()
17153
17190
  });
17154
- OtherBlockSchema = z39.looseObject({ type: z39.string() });
17155
- ContentBlockSchema = z39.union([TextBlockSchema, ImageBlockSchema, ToolUseBlockSchema, ToolResultBlockSchema, OtherBlockSchema]);
17156
- MessageSchema = z39.looseObject({
17157
- role: z39.enum(["user", "assistant", "system"]),
17158
- content: z39.union([z39.string(), z39.array(ContentBlockSchema)])
17191
+ OtherBlockSchema = z40.looseObject({ type: z40.string() });
17192
+ ContentBlockSchema = z40.union([TextBlockSchema, ImageBlockSchema, ToolUseBlockSchema, ToolResultBlockSchema, OtherBlockSchema]);
17193
+ MessageSchema = z40.looseObject({
17194
+ role: z40.enum(["user", "assistant", "system"]),
17195
+ content: z40.union([z40.string(), z40.array(ContentBlockSchema)])
17159
17196
  });
17160
- ToolSchema = z39.looseObject({
17161
- name: z39.string().min(1),
17162
- description: z39.string().optional(),
17163
- input_schema: z39.record(z39.string(), z39.unknown()).optional(),
17164
- allowed_domains: z39.array(z39.string()).optional(),
17165
- blocked_domains: z39.array(z39.string()).optional()
17197
+ ToolSchema = z40.looseObject({
17198
+ name: z40.string().min(1),
17199
+ description: z40.string().optional(),
17200
+ input_schema: z40.record(z40.string(), z40.unknown()).optional(),
17201
+ allowed_domains: z40.array(z40.string()).optional(),
17202
+ blocked_domains: z40.array(z40.string()).optional()
17166
17203
  });
17167
- ToolChoiceSchema = z39.union([
17168
- z39.looseObject({ type: z39.enum(["auto", "none", "any"]) }),
17169
- z39.looseObject({ type: z39.literal("tool"), name: z39.string().min(1) })
17204
+ ToolChoiceSchema = z40.union([
17205
+ z40.looseObject({ type: z40.enum(["auto", "none", "any"]) }),
17206
+ z40.looseObject({ type: z40.literal("tool"), name: z40.string().min(1) })
17170
17207
  ]);
17171
- SystemSchema = z39.union([z39.string(), z39.array(z39.union([TextBlockSchema, OtherBlockSchema]))]);
17172
- MessagesRequestSchema = z39.looseObject({
17173
- model: z39.string().optional(),
17208
+ SystemSchema = z40.union([z40.string(), z40.array(z40.union([TextBlockSchema, OtherBlockSchema]))]);
17209
+ MessagesRequestSchema = z40.looseObject({
17210
+ model: z40.string().optional(),
17174
17211
  system: SystemSchema.optional(),
17175
- messages: z39.array(MessageSchema),
17176
- tools: z39.array(ToolSchema).optional(),
17212
+ messages: z40.array(MessageSchema),
17213
+ tools: z40.array(ToolSchema).optional(),
17177
17214
  tool_choice: ToolChoiceSchema.optional(),
17178
- stream: z39.boolean().optional(),
17215
+ stream: z40.boolean().optional(),
17179
17216
  /** `user_id` is stable for one Claude Code session and differs between sessions, which is what makes it the right key for both the backend's prompt cache and its session header. */
17180
- metadata: z39.looseObject({ user_id: z39.string().optional() }).optional(),
17217
+ metadata: z40.looseObject({ user_id: z40.string().optional() }).optional(),
17181
17218
  /** Claude Code's effort setting. Any string is accepted; the translator honours only the levels the backend understands. */
17182
- output_config: z39.looseObject({ effort: z39.string().optional(), format: z39.object({ type: z39.literal("json_schema"), schema: z39.record(z39.string(), z39.unknown()) }).optional() }).optional()
17219
+ output_config: z40.looseObject({ effort: z40.string().optional(), format: z40.object({ type: z40.literal("json_schema"), schema: z40.record(z40.string(), z40.unknown()) }).optional() }).optional()
17183
17220
  });
17184
- CountTokensRequestSchema = z39.looseObject({
17185
- system: z39.unknown().optional(),
17186
- messages: z39.unknown().optional(),
17187
- tools: z39.unknown().optional()
17221
+ CountTokensRequestSchema = z40.looseObject({
17222
+ system: z40.unknown().optional(),
17223
+ messages: z40.unknown().optional(),
17224
+ tools: z40.unknown().optional()
17188
17225
  });
17189
17226
  }
17190
17227
  });
@@ -19056,7 +19093,7 @@ var init_sessionControlPlugin = __esm({
19056
19093
  // src/supervise/launchControl.ts
19057
19094
  import path54 from "node:path";
19058
19095
  import { randomUUID as randomUUID6 } from "node:crypto";
19059
- import { z as z50 } from "zod";
19096
+ import { z as z51 } from "zod";
19060
19097
  function readRecord2(fs17, directory, name) {
19061
19098
  if (!name.endsWith(RECORD_SUFFIX3)) {
19062
19099
  return void 0;
@@ -19136,11 +19173,11 @@ var init_launchControl = __esm({
19136
19173
  init_sessionControl();
19137
19174
  init_sessionControlPlugin();
19138
19175
  init_verifiedVersions();
19139
- LaunchControlSchema = z50.strictObject({
19176
+ LaunchControlSchema = z51.strictObject({
19140
19177
  /** The launcher's process id, which tells a live channel from one a killed launcher left. */
19141
- pid: z50.number().int().positive(),
19178
+ pid: z51.number().int().positive(),
19142
19179
  /** The plugin's directory, its request and result files beneath it. */
19143
- directory: z50.string().min(1)
19180
+ directory: z51.string().min(1)
19144
19181
  });
19145
19182
  RECORD_SUFFIX3 = ".json";
19146
19183
  }
@@ -20460,7 +20497,7 @@ var init_identityClaude = __esm({
20460
20497
  });
20461
20498
 
20462
20499
  // src/usage/providerQuota.ts
20463
- import { z as z51 } from "zod";
20500
+ import { z as z52 } from "zod";
20464
20501
  var MS_PER_SECOND9, SECONDS_PER_HOUR3, HOURS_PER_DAY6, DAYS_PER_MONTH, ZAI_HOST, ZAI_QUOTA_URL, ZAI_UNIT_HOURS, ZAI_UNIT_MONTHS, ZAI_UNIT_MS, ZaiLimitSchema, ZaiResponseSchema, OPENROUTER_HOST, OPENROUTER_KEY_URL, OPENROUTER_CREDITS_URL, MS_PER_DAY2, OpenRouterKeySchema, OpenRouterCreditsSchema, ANTIGRAVITY_HOST, ANTIGRAVITY_QUOTA_URL, ANTIGRAVITY_USER_URL, FIVE_HOURS2, DAYS_PER_WEEK2, FIVE_HOURS_MS, WEEK_MS, AntigravityBucketSchema, AntigravitySummarySchema, GoogleTokenInfoSchema, AntigravityUserSchema;
20465
20502
  var init_providerQuota = __esm({
20466
20503
  "src/usage/providerQuota.ts"() {
@@ -20480,35 +20517,35 @@ var init_providerQuota = __esm({
20480
20517
  [ZAI_UNIT_HOURS, SECONDS_PER_HOUR3 * MS_PER_SECOND9],
20481
20518
  [ZAI_UNIT_MONTHS, DAYS_PER_MONTH * HOURS_PER_DAY6 * SECONDS_PER_HOUR3 * MS_PER_SECOND9]
20482
20519
  ]);
20483
- ZaiLimitSchema = z51.object({
20484
- type: z51.string(),
20485
- unit: z51.number().int(),
20486
- number: z51.number().int().positive(),
20487
- percentage: z51.number().nonnegative(),
20488
- nextResetTime: z51.number().positive().optional(),
20489
- usage: z51.number().nonnegative().optional(),
20490
- currentValue: z51.number().nonnegative().optional(),
20491
- remaining: z51.number().nonnegative().optional()
20520
+ ZaiLimitSchema = z52.object({
20521
+ type: z52.string(),
20522
+ unit: z52.number().int(),
20523
+ number: z52.number().int().positive(),
20524
+ percentage: z52.number().nonnegative(),
20525
+ nextResetTime: z52.number().positive().optional(),
20526
+ usage: z52.number().nonnegative().optional(),
20527
+ currentValue: z52.number().nonnegative().optional(),
20528
+ remaining: z52.number().nonnegative().optional()
20492
20529
  });
20493
- ZaiResponseSchema = z51.object({
20494
- success: z51.boolean(),
20495
- msg: z51.string().optional(),
20496
- data: z51.object({ level: z51.string().optional(), limits: z51.array(ZaiLimitSchema) })
20530
+ ZaiResponseSchema = z52.object({
20531
+ success: z52.boolean(),
20532
+ msg: z52.string().optional(),
20533
+ data: z52.object({ level: z52.string().optional(), limits: z52.array(ZaiLimitSchema) })
20497
20534
  });
20498
20535
  OPENROUTER_HOST = "openrouter.ai";
20499
20536
  OPENROUTER_KEY_URL = `https://${OPENROUTER_HOST}/api/v1/key`;
20500
20537
  OPENROUTER_CREDITS_URL = `https://${OPENROUTER_HOST}/api/v1/credits`;
20501
20538
  MS_PER_DAY2 = HOURS_PER_DAY6 * SECONDS_PER_HOUR3 * MS_PER_SECOND9;
20502
- OpenRouterKeySchema = z51.object({
20503
- data: z51.object({
20504
- limit: z51.number().nonnegative().nullable(),
20505
- limit_remaining: z51.number().nullable(),
20506
- limit_reset: z51.string().nullable(),
20507
- is_free_tier: z51.boolean().optional(),
20508
- free_model_daily_requests: z51.object({ used: z51.number().nonnegative(), limit: z51.number().nonnegative(), remaining: z51.number() }).optional()
20539
+ OpenRouterKeySchema = z52.object({
20540
+ data: z52.object({
20541
+ limit: z52.number().nonnegative().nullable(),
20542
+ limit_remaining: z52.number().nullable(),
20543
+ limit_reset: z52.string().nullable(),
20544
+ is_free_tier: z52.boolean().optional(),
20545
+ free_model_daily_requests: z52.object({ used: z52.number().nonnegative(), limit: z52.number().nonnegative(), remaining: z52.number() }).optional()
20509
20546
  })
20510
20547
  });
20511
- OpenRouterCreditsSchema = z51.object({ data: z51.object({ total_credits: z51.number().nonnegative(), total_usage: z51.number().nonnegative() }) });
20548
+ OpenRouterCreditsSchema = z52.object({ data: z52.object({ total_credits: z52.number().nonnegative(), total_usage: z52.number().nonnegative() }) });
20512
20549
  ANTIGRAVITY_HOST = "daily-cloudcode-pa.googleapis.com";
20513
20550
  ANTIGRAVITY_QUOTA_URL = `https://${ANTIGRAVITY_HOST}/v1internal:retrieveUserQuotaSummary`;
20514
20551
  ANTIGRAVITY_USER_URL = `https://${ANTIGRAVITY_HOST}/v1internal:loadCodeAssist`;
@@ -20516,21 +20553,21 @@ var init_providerQuota = __esm({
20516
20553
  DAYS_PER_WEEK2 = 7;
20517
20554
  FIVE_HOURS_MS = FIVE_HOURS2 * SECONDS_PER_HOUR3 * MS_PER_SECOND9;
20518
20555
  WEEK_MS = DAYS_PER_WEEK2 * HOURS_PER_DAY6 * SECONDS_PER_HOUR3 * MS_PER_SECOND9;
20519
- AntigravityBucketSchema = z51.object({
20520
- bucketId: z51.string(),
20521
- remainingFraction: z51.number().optional(),
20522
- resetTime: z51.string().optional()
20556
+ AntigravityBucketSchema = z52.object({
20557
+ bucketId: z52.string(),
20558
+ remainingFraction: z52.number().optional(),
20559
+ resetTime: z52.string().optional()
20523
20560
  });
20524
- AntigravitySummarySchema = z51.object({ groups: z51.array(z51.object({ buckets: z51.array(AntigravityBucketSchema) })) });
20525
- GoogleTokenInfoSchema = z51.object({
20526
- email: z51.string().optional(),
20527
- sub: z51.string().optional()
20561
+ AntigravitySummarySchema = z52.object({ groups: z52.array(z52.object({ buckets: z52.array(AntigravityBucketSchema) })) });
20562
+ GoogleTokenInfoSchema = z52.object({
20563
+ email: z52.string().optional(),
20564
+ sub: z52.string().optional()
20528
20565
  });
20529
- AntigravityUserSchema = z51.object({
20566
+ AntigravityUserSchema = z52.object({
20530
20567
  /** The code-assist tier context, which defaults to the free tier for every account. */
20531
- currentTier: z51.object({ name: z51.string().optional(), id: z51.string().optional() }).optional(),
20568
+ currentTier: z52.object({ name: z52.string().optional(), id: z52.string().optional() }).optional(),
20532
20569
  /** The account's paid subscription; absent when the account has none. */
20533
- paidTier: z51.object({ name: z51.string().optional(), id: z51.string().optional() }).optional()
20570
+ paidTier: z52.object({ name: z52.string().optional(), id: z52.string().optional() }).optional()
20534
20571
  });
20535
20572
  }
20536
20573
  });
@@ -20625,19 +20662,19 @@ init_rcSessions();
20625
20662
  // src/frontdoor/rcSessionRegistry.ts
20626
20663
  init_identityStore();
20627
20664
  import path32 from "node:path";
20628
- import { z as z24 } from "zod";
20665
+ import { z as z25 } from "zod";
20629
20666
  var REGISTRY_BRIDGE_PREFIX = "session_";
20630
20667
  var DOOR_SESSION_PREFIX = "cse_";
20631
20668
  var REGISTRY_DIR = "sessions";
20632
20669
  var ENTRY_SUFFIX = ".json";
20633
20670
  var RC_REGISTRY_ENTRY_MAX_BYTES = 8192;
20634
- var RegistryEntrySchema = z24.looseObject({
20635
- sessionId: z24.string().min(1),
20636
- pid: z24.int().positive(),
20637
- bridgeSessionId: z24.union([z24.string().startsWith(REGISTRY_BRIDGE_PREFIX), z24.string().startsWith(DOOR_SESSION_PREFIX)]),
20638
- cwd: z24.string().optional(),
20639
- name: z24.string().optional(),
20640
- updatedAt: z24.number().optional()
20671
+ var RegistryEntrySchema = z25.looseObject({
20672
+ sessionId: z25.string().min(1),
20673
+ pid: z25.int().positive(),
20674
+ bridgeSessionId: z25.union([z25.string().startsWith(REGISTRY_BRIDGE_PREFIX), z25.string().startsWith(DOOR_SESSION_PREFIX)]),
20675
+ cwd: z25.string().optional(),
20676
+ name: z25.string().optional(),
20677
+ updatedAt: z25.number().optional()
20641
20678
  });
20642
20679
  function supersedes(candidate, kept) {
20643
20680
  return candidate.updatedAt > kept.updatedAt || candidate.updatedAt === kept.updatedAt && candidate.session.pid > kept.session.pid;
@@ -20855,7 +20892,7 @@ init_rcSchemas();
20855
20892
 
20856
20893
  // src/frontdoor/rcSlashCommandSchemas.ts
20857
20894
  init_rcSchemas();
20858
- import { z as z26 } from "zod";
20895
+ import { z as z27 } from "zod";
20859
20896
 
20860
20897
  // src/frontdoor/rcSessionCommands.ts
20861
20898
  import { setTimeout as sleep } from "node:timers/promises";
@@ -21363,57 +21400,57 @@ function createRcSessionCommands(deps) {
21363
21400
  }
21364
21401
 
21365
21402
  // src/frontdoor/rcSlashCommandSchemas.ts
21366
- var WaitMsSchema = z26.int().positive().max(RC_SESSION_COMMAND_MAX_WAIT_MS).optional();
21367
- var RcGoalSessionInputSchema = z26.strictObject({
21368
- session: z26.string().min(1),
21403
+ var WaitMsSchema = z27.int().positive().max(RC_SESSION_COMMAND_MAX_WAIT_MS).optional();
21404
+ var RcGoalSessionInputSchema = z27.strictObject({
21405
+ session: z27.string().min(1),
21369
21406
  waitMs: WaitMsSchema
21370
21407
  });
21371
- var RcGoalSetInputSchema = z26.strictObject({
21372
- session: z26.string().min(1),
21373
- condition: z26.string().trim().min(1).max(RC_GOAL_CONDITION_MAX_CHARS).regex(/^[^\r\n]*$/u, "a goal condition is one line"),
21408
+ var RcGoalSetInputSchema = z27.strictObject({
21409
+ session: z27.string().min(1),
21410
+ condition: z27.string().trim().min(1).max(RC_GOAL_CONDITION_MAX_CHARS).regex(/^[^\r\n]*$/u, "a goal condition is one line"),
21374
21411
  waitMs: WaitMsSchema
21375
21412
  });
21376
- var RcCompactInputSchema = z26.strictObject({
21377
- session: z26.string().min(1),
21413
+ var RcCompactInputSchema = z27.strictObject({
21414
+ session: z27.string().min(1),
21378
21415
  waitMs: WaitMsSchema
21379
21416
  });
21380
- var RcCompactWithInstructionsInputSchema = z26.strictObject({
21381
- session: z26.string().min(1),
21382
- instructions: z26.string().trim().min(1).max(RC_COMPACT_INSTRUCTIONS_MAX_CHARS),
21417
+ var RcCompactWithInstructionsInputSchema = z27.strictObject({
21418
+ session: z27.string().min(1),
21419
+ instructions: z27.string().trim().min(1).max(RC_COMPACT_INSTRUCTIONS_MAX_CHARS),
21383
21420
  waitMs: WaitMsSchema
21384
21421
  });
21385
- var RcTurnInputSchema = z26.strictObject({
21386
- session: z26.string().min(1),
21387
- text: z26.string().min(1).max(RC_TURN_TEXT_MAX_CHARS),
21422
+ var RcTurnInputSchema = z27.strictObject({
21423
+ session: z27.string().min(1),
21424
+ text: z27.string().min(1).max(RC_TURN_TEXT_MAX_CHARS),
21388
21425
  waitMs: WaitMsSchema
21389
21426
  });
21390
21427
  var commandAnswerShape = {
21391
- session: z26.string(),
21428
+ session: z27.string(),
21392
21429
  route: RcSessionCommandRouteSchema,
21393
21430
  warnings: RcVersionGateWarningsSchema
21394
21431
  };
21395
- var RcGoalGetOutputSchema = z26.strictObject({
21432
+ var RcGoalGetOutputSchema = z27.strictObject({
21396
21433
  ...commandAnswerShape,
21397
- goal: z26.strictObject({ condition: z26.string(), iterations: z26.int().nonnegative(), lastCheck: z26.string().optional() }).nullable()
21434
+ goal: z27.strictObject({ condition: z27.string(), iterations: z27.int().nonnegative(), lastCheck: z27.string().optional() }).nullable()
21398
21435
  });
21399
- var RcGoalSetOutputSchema = z26.strictObject({
21436
+ var RcGoalSetOutputSchema = z27.strictObject({
21400
21437
  ...commandAnswerShape,
21401
- condition: z26.string(),
21402
- superseded: z26.string().nullable()
21438
+ condition: z27.string(),
21439
+ superseded: z27.string().nullable()
21403
21440
  });
21404
- var RcGoalClearOutputSchema = z26.strictObject({
21441
+ var RcGoalClearOutputSchema = z27.strictObject({
21405
21442
  ...commandAnswerShape,
21406
- cleared: z26.string().nullable()
21443
+ cleared: z27.string().nullable()
21407
21444
  });
21408
- var RcTurnOutputSchema = z26.strictObject({
21445
+ var RcTurnOutputSchema = z27.strictObject({
21409
21446
  ...commandAnswerShape,
21410
- uuid: z26.string()
21447
+ uuid: z27.string()
21411
21448
  });
21412
- var RcCompactOutputSchema = z26.strictObject({
21449
+ var RcCompactOutputSchema = z27.strictObject({
21413
21450
  ...commandAnswerShape,
21414
- trigger: z26.string(),
21415
- preTokens: z26.number().optional(),
21416
- postTokens: z26.number().optional()
21451
+ trigger: z27.string(),
21452
+ preTokens: z27.number().optional(),
21453
+ postTokens: z27.number().optional()
21417
21454
  });
21418
21455
 
21419
21456
  // src/frontdoor/rcApi.ts
@@ -21478,7 +21515,7 @@ function createRcApiRouter(deps) {
21478
21515
  if (input.session !== void 0 && !statuses.some((entry) => entry.id === input.session)) {
21479
21516
  throw new ORPCError("NOT_FOUND", { message: rcSessionNotObservedMessage(input.session) });
21480
21517
  }
21481
- return { statuses: await Promise.all(statuses.map(async (status) => ({ ...status, route: await deps.routeOf(status.id) }))) };
21518
+ return { statuses: await Promise.all(statuses.map(async (status) => ({ ...status, route: await deps.routeOf(status.id), serverState: await deps.serverStateOf(status.id) }))) };
21482
21519
  }),
21483
21520
  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 }) => {
21484
21521
  const pending = deps.pendingOf(input.session);
@@ -21643,48 +21680,48 @@ init_cliError();
21643
21680
  init_package();
21644
21681
 
21645
21682
  // src/codex/appServerSchemas.ts
21646
- import { z as z27 } from "zod";
21683
+ import { z as z28 } from "zod";
21647
21684
  var CODEX_APP_SERVER_GENERATED_AGAINST = "0.160.0";
21648
- var RateLimitWindowSchema = z27.object({
21649
- usedPercent: z27.number(),
21650
- resetsAt: z27.number().nullish(),
21651
- windowDurationMins: z27.number().nullish()
21652
- });
21653
- var RateLimitSnapshotSchema = z27.object({
21654
- limitId: z27.string().nullish(),
21655
- limitName: z27.string().nullish(),
21656
- planType: z27.string().nullish(),
21685
+ var RateLimitWindowSchema = z28.object({
21686
+ usedPercent: z28.number(),
21687
+ resetsAt: z28.number().nullish(),
21688
+ windowDurationMins: z28.number().nullish()
21689
+ });
21690
+ var RateLimitSnapshotSchema = z28.object({
21691
+ limitId: z28.string().nullish(),
21692
+ limitName: z28.string().nullish(),
21693
+ planType: z28.string().nullish(),
21657
21694
  primary: RateLimitWindowSchema.nullish(),
21658
21695
  secondary: RateLimitWindowSchema.nullish(),
21659
- rateLimitReachedType: z27.string().nullish(),
21660
- spendControlReached: z27.boolean().nullish()
21661
- });
21662
- var RateLimitResetCreditSchema = z27.object({
21663
- id: z27.string(),
21664
- grantedAt: z27.number(),
21665
- expiresAt: z27.number().nullish(),
21666
- resetType: z27.string(),
21667
- status: z27.string(),
21668
- title: z27.string().nullish(),
21669
- description: z27.string().nullish()
21670
- });
21671
- var CodexAccountSchema = z27.discriminatedUnion("type", [
21672
- z27.object({ type: z27.literal("apiKey") }),
21673
- z27.object({ type: z27.literal("chatgpt"), email: z27.string().nullable(), planType: z27.string() }),
21674
- z27.object({ type: z27.literal("amazonBedrock"), usesCodexManagedCredentials: z27.boolean().default(false) })
21696
+ rateLimitReachedType: z28.string().nullish(),
21697
+ spendControlReached: z28.boolean().nullish()
21698
+ });
21699
+ var RateLimitResetCreditSchema = z28.object({
21700
+ id: z28.string(),
21701
+ grantedAt: z28.number(),
21702
+ expiresAt: z28.number().nullish(),
21703
+ resetType: z28.string(),
21704
+ status: z28.string(),
21705
+ title: z28.string().nullish(),
21706
+ description: z28.string().nullish()
21707
+ });
21708
+ var CodexAccountSchema = z28.discriminatedUnion("type", [
21709
+ z28.object({ type: z28.literal("apiKey") }),
21710
+ z28.object({ type: z28.literal("chatgpt"), email: z28.string().nullable(), planType: z28.string() }),
21711
+ z28.object({ type: z28.literal("amazonBedrock"), usesCodexManagedCredentials: z28.boolean().default(false) })
21675
21712
  ]);
21676
- var CodexAccountReadSchema = z27.object({
21713
+ var CodexAccountReadSchema = z28.object({
21677
21714
  account: CodexAccountSchema.nullable(),
21678
- requiresOpenaiAuth: z27.boolean()
21715
+ requiresOpenaiAuth: z28.boolean()
21679
21716
  });
21680
- var CodexRateLimitsReadSchema = z27.object({
21717
+ var CodexRateLimitsReadSchema = z28.object({
21681
21718
  rateLimits: RateLimitSnapshotSchema,
21682
- rateLimitsByLimitId: z27.record(z27.string(), RateLimitSnapshotSchema).nullish(),
21683
- rateLimitResetCredits: z27.object({ availableCount: z27.number(), credits: z27.array(RateLimitResetCreditSchema).nullish() }).nullish(),
21684
- accountId: z27.string().nullish(),
21685
- ordinaryUsageAllowed: z27.boolean().nullish()
21719
+ rateLimitsByLimitId: z28.record(z28.string(), RateLimitSnapshotSchema).nullish(),
21720
+ rateLimitResetCredits: z28.object({ availableCount: z28.number(), credits: z28.array(RateLimitResetCreditSchema).nullish() }).nullish(),
21721
+ accountId: z28.string().nullish(),
21722
+ ordinaryUsageAllowed: z28.boolean().nullish()
21686
21723
  });
21687
- var CodexInitializeResultSchema = z27.object({ userAgent: z27.string() });
21724
+ var CodexInitializeResultSchema = z28.object({ userAgent: z28.string() });
21688
21725
 
21689
21726
  // src/codex/appServer.ts
21690
21727
  var CodexAppServerUnavailableError = class extends CliError {
@@ -21887,7 +21924,7 @@ init_schema();
21887
21924
  init_claudeVersion();
21888
21925
  init_identity2();
21889
21926
  init_projects();
21890
- import { z as z29 } from "zod";
21927
+ import { z as z30 } from "zod";
21891
21928
 
21892
21929
  // src/resolve/types.ts
21893
21930
  var LAYER_KINDS = [
@@ -21950,139 +21987,139 @@ var DIAGNOSTIC_SEVERITIES = ["error", "warning", "info"];
21950
21987
 
21951
21988
  // src/usage/pickReportSchema.ts
21952
21989
  init_plan2();
21953
- import { z as z28 } from "zod";
21954
- var PoolPickCandidateViewSchema = z28.strictObject({
21955
- identity: z28.string(),
21990
+ import { z as z29 } from "zod";
21991
+ var PoolPickCandidateViewSchema = z29.strictObject({
21992
+ identity: z29.string(),
21956
21993
  /** In pick order: `scored` has usable quota data, `unknown` has none and no plan known to bill by use, `pay-per-use` bills by use whether or not usage is recorded, `ineligible` is refused right now. */
21957
- class: z28.enum(["scored", "unknown", "pay-per-use", "ineligible"]),
21994
+ class: z29.enum(["scored", "unknown", "pay-per-use", "ineligible"]),
21958
21995
  /** Plan-size-weighted remaining quota per hour until its reset; present for `scored` only. */
21959
- score: z28.number().optional(),
21996
+ score: z29.number().optional(),
21960
21997
  /** Which window's reset divides the score: the seven-day window, or the five-hour one when the member reports no seven-day utilisation or its measured-ratio five-hour term outranks the weekly one; present with `score`. */
21961
- scoreWindow: z28.enum(["sevenDay", "fiveHour"]).optional(),
21998
+ scoreWindow: z29.enum(["sevenDay", "fiveHour"]).optional(),
21962
21999
  /** False when the five-hour window would run dry, at the observed pace, before it resets. */
21963
- feasible: z28.boolean(),
22000
+ feasible: z29.boolean(),
21964
22001
  /** When an `ineligible` member can be used again, as an ISO instant. */
21965
- blockedUntil: z28.iso.datetime().optional(),
22002
+ blockedUntil: z29.iso.datetime().optional(),
21966
22003
  plan: PlanClassSchema,
21967
22004
  /** The provider the member was ranked on, when its launch spends one in place of its Claude account: its windows, refusals and plan are the provider's own. Absent when ranked on the Claude account. */
21968
- provider: z28.string().optional(),
22005
+ provider: z29.string().optional(),
21969
22006
  /** The facts behind the class and score, in the order they matter. */
21970
- reasons: z28.array(z28.string())
22007
+ reasons: z29.array(z29.string())
21971
22008
  });
21972
- var PoolPickReportSchema = z28.strictObject({
21973
- pool: z28.string(),
21974
- directory: z28.string(),
22009
+ var PoolPickReportSchema = z29.strictObject({
22010
+ pool: z29.string(),
22011
+ directory: z29.string(),
21975
22012
  /** The member a launch would run as, absent when every member is refused. */
21976
- pick: z28.string().optional(),
21977
- candidates: z28.array(PoolPickCandidateViewSchema),
22013
+ pick: z29.string().optional(),
22014
+ candidates: z29.array(PoolPickCandidateViewSchema),
21978
22015
  /** Identity members anywhere in the pool's graph that do not exist; a launch skips them. */
21979
- missing: z28.array(z28.string()),
22016
+ missing: z29.array(z29.string()),
21980
22017
  /** When nothing can be picked, the soonest any member returns. */
21981
- earliestReturn: z28.strictObject({ identity: z28.string(), at: z28.iso.datetime() }).optional(),
22018
+ earliestReturn: z29.strictObject({ identity: z29.string(), at: z29.iso.datetime() }).optional(),
21982
22019
  /** The member a resumed conversation started on but moved off, and why, when the ranking could not keep it. */
21983
- movedOff: z28.strictObject({ identity: z28.string(), reason: z28.string() }).optional(),
22020
+ movedOff: z29.strictObject({ identity: z29.string(), reason: z29.string() }).optional(),
21984
22021
  /** Why the last-pick record could not be read, when that is the case. */
21985
- stickyProblem: z28.string().optional()
22022
+ stickyProblem: z29.string().optional()
21986
22023
  });
21987
22024
 
21988
22025
  // src/checkReportSchema.ts
21989
22026
  init_identityGrants();
21990
22027
  var CHECK_CREDENTIAL_APPLIES = ["provider", "identity", "stored-login"];
21991
- var CheckLayerViewSchema = z29.strictObject({
21992
- id: z29.int(),
21993
- kind: z29.enum(LAYER_KINDS),
21994
- source: z29.string()
21995
- });
21996
- var CheckEntryViewSchema = z29.strictObject({
21997
- path: z29.string(),
21998
- shared: z29.boolean(),
21999
- via: z29.enum(DECISION_VIAS),
22028
+ var CheckLayerViewSchema = z30.strictObject({
22029
+ id: z30.int(),
22030
+ kind: z30.enum(LAYER_KINDS),
22031
+ source: z30.string()
22032
+ });
22033
+ var CheckEntryViewSchema = z30.strictObject({
22034
+ path: z30.string(),
22035
+ shared: z30.boolean(),
22036
+ via: z30.enum(DECISION_VIAS),
22000
22037
  /** The entry's real category, or null when nothing classifies it. */
22001
- category: z29.enum(CATEGORY_NAMES).nullable(),
22002
- rule: z29.strictObject({ key: z29.string(), layer: z29.int() }).optional(),
22038
+ category: z30.enum(CATEGORY_NAMES).nullable(),
22039
+ rule: z30.strictObject({ key: z30.string(), layer: z30.int() }).optional(),
22003
22040
  /** Rules that matched but whose `when` condition failed, each with the conditions that failed. */
22004
- eliminated: z29.readonly(z29.array(z29.strictObject({ key: z29.string(), failed: z29.readonly(z29.array(z29.string())) }))).optional()
22005
- });
22006
- var CheckDiagnosticSchema = z29.strictObject({
22007
- code: z29.enum(DIAGNOSTIC_CODES),
22008
- severity: z29.enum(DIAGNOSTIC_SEVERITIES),
22009
- message: z29.string(),
22010
- subject: z29.string().optional(),
22011
- layer: z29.int().optional()
22012
- });
22013
- var CheckAmbientCredentialSchema = z29.union([z29.strictObject({ ok: z29.literal(true) }), z29.strictObject({ ok: z29.literal(false), variable: z29.string(), message: z29.string() })]);
22014
- var CheckKeychainSchema = z29.strictObject({
22015
- checked: z29.literal(true),
22016
- found: z29.boolean(),
22017
- serviceName: z29.string().optional(),
22018
- note: z29.string()
22019
- });
22020
- var CheckSettingsExposureSchema = z29.strictObject({
22021
- file: z29.string(),
22022
- envKeyNames: z29.readonly(z29.array(z29.string())),
22023
- hookEventNames: z29.readonly(z29.array(z29.string())),
22024
- hookCommandCount: z29.int().nonnegative()
22025
- });
22026
- var CredentialSourceSummarySchema = z29.union([
22027
- z29.strictObject({ kind: z29.literal("env"), variable: z29.string() }),
22028
- z29.strictObject({ kind: z29.literal("file"), path: z29.string() }),
22029
- z29.strictObject({ kind: z29.literal("command"), program: z29.string() }),
22030
- z29.strictObject({ kind: z29.literal("op"), reference: z29.string() }),
22031
- z29.strictObject({ kind: z29.literal("keychain"), service: z29.string(), account: z29.string().optional() }),
22032
- z29.strictObject({ kind: z29.literal("literal") })
22041
+ eliminated: z30.readonly(z30.array(z30.strictObject({ key: z30.string(), failed: z30.readonly(z30.array(z30.string())) }))).optional()
22042
+ });
22043
+ var CheckDiagnosticSchema = z30.strictObject({
22044
+ code: z30.enum(DIAGNOSTIC_CODES),
22045
+ severity: z30.enum(DIAGNOSTIC_SEVERITIES),
22046
+ message: z30.string(),
22047
+ subject: z30.string().optional(),
22048
+ layer: z30.int().optional()
22049
+ });
22050
+ var CheckAmbientCredentialSchema = z30.union([z30.strictObject({ ok: z30.literal(true) }), z30.strictObject({ ok: z30.literal(false), variable: z30.string(), message: z30.string() })]);
22051
+ var CheckKeychainSchema = z30.strictObject({
22052
+ checked: z30.literal(true),
22053
+ found: z30.boolean(),
22054
+ serviceName: z30.string().optional(),
22055
+ note: z30.string()
22056
+ });
22057
+ var CheckSettingsExposureSchema = z30.strictObject({
22058
+ file: z30.string(),
22059
+ envKeyNames: z30.readonly(z30.array(z30.string())),
22060
+ hookEventNames: z30.readonly(z30.array(z30.string())),
22061
+ hookCommandCount: z30.int().nonnegative()
22062
+ });
22063
+ var CredentialSourceSummarySchema = z30.union([
22064
+ z30.strictObject({ kind: z30.literal("env"), variable: z30.string() }),
22065
+ z30.strictObject({ kind: z30.literal("file"), path: z30.string() }),
22066
+ z30.strictObject({ kind: z30.literal("command"), program: z30.string() }),
22067
+ z30.strictObject({ kind: z30.literal("op"), reference: z30.string() }),
22068
+ z30.strictObject({ kind: z30.literal("keychain"), service: z30.string(), account: z30.string().optional() }),
22069
+ z30.strictObject({ kind: z30.literal("literal") })
22033
22070
  ]);
22034
- var CredentialSummarySchema = z29.strictObject({
22035
- target: z29.enum(CREDENTIAL_TARGETS),
22036
- sources: z29.readonly(z29.array(CredentialSourceSummarySchema)),
22071
+ var CredentialSummarySchema = z30.strictObject({
22072
+ target: z30.enum(CREDENTIAL_TARGETS),
22073
+ sources: z30.readonly(z30.array(CredentialSourceSummarySchema)),
22037
22074
  cache: CredentialCacheSchema.optional()
22038
22075
  });
22039
- var CachedCredentialStateSchema = z29.union([
22040
- z29.strictObject({ store: z29.enum(CREDENTIAL_CACHE_STORES), status: z29.literal("empty") }),
22041
- z29.strictObject({ store: z29.enum(CREDENTIAL_CACHE_STORES), status: z29.literal("unreadable"), reason: z29.string() }),
22042
- z29.strictObject({ store: z29.enum(CREDENTIAL_CACHE_STORES), status: z29.enum(["fresh", "expired"]), ageMs: z29.number(), expiresInMs: z29.number().optional() })
22076
+ var CachedCredentialStateSchema = z30.union([
22077
+ z30.strictObject({ store: z30.enum(CREDENTIAL_CACHE_STORES), status: z30.literal("empty") }),
22078
+ z30.strictObject({ store: z30.enum(CREDENTIAL_CACHE_STORES), status: z30.literal("unreadable"), reason: z30.string() }),
22079
+ z30.strictObject({ store: z30.enum(CREDENTIAL_CACHE_STORES), status: z30.enum(["fresh", "expired"]), ageMs: z30.number(), expiresInMs: z30.number().optional() })
22043
22080
  ]);
22044
- var CheckCredentialProviderSchema = z29.union([
22045
- z29.strictObject({ name: z29.string(), credential: CredentialSummarySchema.optional(), cached: CachedCredentialStateSchema.optional() }),
22046
- z29.strictObject({ name: z29.string(), problem: z29.string() })
22081
+ var CheckCredentialProviderSchema = z30.union([
22082
+ z30.strictObject({ name: z30.string(), credential: CredentialSummarySchema.optional(), cached: CachedCredentialStateSchema.optional() }),
22083
+ z30.strictObject({ name: z30.string(), problem: z30.string() })
22047
22084
  ]);
22048
- var CheckProviderReachabilitySchema = z29.union([
22049
- z29.strictObject({ name: z29.string(), baseUrl: z29.string(), ok: z29.literal(true) }),
22050
- z29.strictObject({ name: z29.string(), baseUrl: z29.string(), ok: z29.literal(false), message: z29.string() })
22085
+ var CheckProviderReachabilitySchema = z30.union([
22086
+ z30.strictObject({ name: z30.string(), baseUrl: z30.string(), ok: z30.literal(true) }),
22087
+ z30.strictObject({ name: z30.string(), baseUrl: z30.string(), ok: z30.literal(false), message: z30.string() })
22051
22088
  ]);
22052
- var CheckCredentialSchema = z29.strictObject({
22053
- applies: z29.enum(CHECK_CREDENTIAL_APPLIES),
22089
+ var CheckCredentialSchema = z30.strictObject({
22090
+ applies: z30.enum(CHECK_CREDENTIAL_APPLIES),
22054
22091
  provider: CheckCredentialProviderSchema.optional(),
22055
22092
  identity: CredentialSummarySchema.optional(),
22056
22093
  identityCached: CachedCredentialStateSchema.optional()
22057
22094
  });
22058
- var CheckClaudeVersionSchema = z29.strictObject({
22059
- pinned: z29.strictObject({ version: z29.string(), source: z29.enum(CLAUDE_VERSION_SOURCES), installed: z29.boolean() }).optional(),
22060
- highestInstalled: z29.string().optional(),
22061
- installed: z29.readonly(z29.array(z29.string()))
22095
+ var CheckClaudeVersionSchema = z30.strictObject({
22096
+ pinned: z30.strictObject({ version: z30.string(), source: z30.enum(CLAUDE_VERSION_SOURCES), installed: z30.boolean() }).optional(),
22097
+ highestInstalled: z30.string().optional(),
22098
+ installed: z30.readonly(z30.array(z30.string()))
22062
22099
  });
22063
- var CheckReportJsonSchema = z29.strictObject({
22064
- identity: z29.strictObject({ name: z29.string().nullable(), source: z29.enum(IDENTITY_DECISION_SOURCES) }),
22100
+ var CheckReportJsonSchema = z30.strictObject({
22101
+ identity: z30.strictObject({ name: z30.string().nullable(), source: z30.enum(IDENTITY_DECISION_SOURCES) }),
22065
22102
  /** The logins other identities lend this one through the front door; absent when none does. */
22066
- borrowedLogins: z29.readonly(z29.array(z29.strictObject({ from: z29.string(), features: z29.readonly(z29.array(z29.enum(GRANT_FEATURES))) }))).optional(),
22103
+ borrowedLogins: z30.readonly(z30.array(z30.strictObject({ from: z30.string(), features: z30.readonly(z30.array(z30.enum(GRANT_FEATURES))) }))).optional(),
22067
22104
  /** The pool ranking, when the launch named a pool instead of an identity. */
22068
22105
  pool: PoolPickReportSchema.optional(),
22069
- configProfile: z29.strictObject({ name: z29.string().nullable(), source: z29.enum(CONFIG_PROFILE_DECISION_SOURCES) }),
22070
- layers: z29.readonly(z29.array(CheckLayerViewSchema)),
22071
- entries: z29.readonly(z29.array(CheckEntryViewSchema)),
22072
- projectEncodingAmbiguities: z29.readonly(
22073
- z29.array(z29.strictObject({ fragment: z29.string(), encoded: z29.string(), reason: z29.enum(ENCODING_AMBIGUITY_REASONS), detail: z29.string() }))
22106
+ configProfile: z30.strictObject({ name: z30.string().nullable(), source: z30.enum(CONFIG_PROFILE_DECISION_SOURCES) }),
22107
+ layers: z30.readonly(z30.array(CheckLayerViewSchema)),
22108
+ entries: z30.readonly(z30.array(CheckEntryViewSchema)),
22109
+ projectEncodingAmbiguities: z30.readonly(
22110
+ z30.array(z30.strictObject({ fragment: z30.string(), encoded: z30.string(), reason: z30.enum(ENCODING_AMBIGUITY_REASONS), detail: z30.string() }))
22074
22111
  ),
22075
- diagnostics: z29.readonly(z29.array(CheckDiagnosticSchema)),
22112
+ diagnostics: z30.readonly(z30.array(CheckDiagnosticSchema)),
22076
22113
  ambientCredential: CheckAmbientCredentialSchema,
22077
22114
  keychain: CheckKeychainSchema.optional(),
22078
- settingsExposure: z29.readonly(z29.array(CheckSettingsExposureSchema)),
22115
+ settingsExposure: z30.readonly(z30.array(CheckSettingsExposureSchema)),
22079
22116
  credential: CheckCredentialSchema,
22080
22117
  claudeVersion: CheckClaudeVersionSchema.optional(),
22081
22118
  providerReachability: CheckProviderReachabilitySchema.optional(),
22082
22119
  /** The route overrides that apply to a launch here (its identity's, its provider's and the global ones), each with the entries it outranks, or why the file cannot be used. */
22083
- routeOverrides: z29.union([
22084
- z29.strictObject({ applying: z29.readonly(z29.array(z29.strictObject({ model: z29.string(), target: z29.string(), scope: z29.string(), outranks: z29.readonly(z29.array(z29.strictObject({ scope: z29.string(), target: z29.string() }))) }))) }),
22085
- z29.strictObject({ fault: z29.string() })
22120
+ routeOverrides: z30.union([
22121
+ z30.strictObject({ applying: z30.readonly(z30.array(z30.strictObject({ model: z30.string(), target: z30.string(), scope: z30.string(), outranks: z30.readonly(z30.array(z30.strictObject({ scope: z30.string(), target: z30.string() }))) }))) }),
22122
+ z30.strictObject({ fault: z30.string() })
22086
22123
  ]).optional()
22087
22124
  });
22088
22125
 
@@ -22092,28 +22129,28 @@ init_preflight();
22092
22129
  init_resets();
22093
22130
 
22094
22131
  // src/usage/resetsSchema.ts
22095
- import { z as z30 } from "zod";
22096
- var ResetRowSchema = z30.strictObject({
22097
- identity: z30.string(),
22098
- provider: z30.string(),
22132
+ import { z as z31 } from "zod";
22133
+ var ResetRowSchema = z31.strictObject({
22134
+ identity: z31.string(),
22135
+ provider: z31.string(),
22099
22136
  /** What the window is: `5h`, `7d` or `extra usage` for an Anthropic account, or the provider's own measure and period (`tokens 5h`). */
22100
- window: z30.string(),
22137
+ window: z31.string(),
22101
22138
  /** When the state the window comes from was observed, as an ISO instant. */
22102
- observedAt: z30.iso.datetime(),
22139
+ observedAt: z31.iso.datetime(),
22103
22140
  /** When the window resets, as an ISO instant; absent when the upstream reported none. */
22104
- resetsAt: z30.iso.datetime().optional(),
22141
+ resetsAt: z31.iso.datetime().optional(),
22105
22142
  /** True when the reset time has passed, so the recorded observation describes a window that no longer exists and its utilisation reads as 0. */
22106
- reset: z30.boolean(),
22143
+ reset: z31.boolean(),
22107
22144
  /** The fraction used, as `effectiveWindow` reads it at the report's own clock. */
22108
- utilization: z30.number().optional(),
22145
+ utilization: z31.number().optional(),
22109
22146
  /** The window's own status, for a window that has not reset yet. */
22110
- status: z30.string().optional()
22147
+ status: z31.string().optional()
22111
22148
  });
22112
- var ResetScheduleSchema = z30.strictObject({ resets: z30.readonly(z30.array(ResetRowSchema)) });
22149
+ var ResetScheduleSchema = z31.strictObject({ resets: z31.readonly(z31.array(ResetRowSchema)) });
22113
22150
 
22114
22151
  // src/frontdoor/controlSchemas.ts
22115
22152
  import path46 from "node:path";
22116
- import { z as z40 } from "zod";
22153
+ import { z as z41 } from "zod";
22117
22154
 
22118
22155
  // src/codex/doctor.ts
22119
22156
  function codexIdentityFindings(entry, identity) {
@@ -22425,7 +22462,7 @@ init_projects();
22425
22462
  init_injected();
22426
22463
  init_pipeline();
22427
22464
  import path42 from "node:path";
22428
- import { z as z33 } from "zod";
22465
+ import { z as z34 } from "zod";
22429
22466
  var HISTORY_PROJECTS_KEY_PREFIX = "history/projects/";
22430
22467
  function projectFragmentOf(rawKey) {
22431
22468
  return rawKey.startsWith(HISTORY_PROJECTS_KEY_PREFIX) ? rawKey.slice(HISTORY_PROJECTS_KEY_PREFIX.length) : void 0;
@@ -22494,9 +22531,9 @@ function lookupKeychainService(run, farmRoot) {
22494
22531
  }
22495
22532
  return { checked: true, found: true, serviceName, note: `Keychain service name for this identity: "${serviceName}".` };
22496
22533
  }
22497
- var SettingsSecretsShapeSchema = z33.looseObject({
22498
- env: z33.record(z33.string(), z33.unknown()).optional(),
22499
- hooks: z33.record(z33.string(), z33.array(z33.unknown())).optional()
22534
+ var SettingsSecretsShapeSchema = z34.looseObject({
22535
+ env: z34.record(z34.string(), z34.unknown()).optional(),
22536
+ hooks: z34.record(z34.string(), z34.array(z34.unknown())).optional()
22500
22537
  });
22501
22538
  function hookCommandCountOf(group) {
22502
22539
  if (typeof group !== "object" || group === null) {
@@ -24964,93 +25001,93 @@ function collectDoctorReport(params) {
24964
25001
  init_schema2();
24965
25002
  init_rcSchemas();
24966
25003
  init_state();
24967
- var UsageListOutputSchema = z40.strictObject({ snapshots: z40.readonly(z40.array(UsageSnapshotSchema)) });
24968
- var UsageWindowsInputSchema = z40.strictObject({
24969
- identity: z40.string().min(1),
24970
- provider: z40.string().min(1).optional()
25004
+ var UsageListOutputSchema = z41.strictObject({ snapshots: z41.readonly(z41.array(UsageSnapshotSchema)) });
25005
+ var UsageWindowsInputSchema = z41.strictObject({
25006
+ identity: z41.string().min(1),
25007
+ provider: z41.string().min(1).optional()
24971
25008
  });
24972
- var EffectiveWindowSchema = z40.strictObject({
25009
+ var EffectiveWindowSchema = z41.strictObject({
24973
25010
  /** True when the window's reset time has passed, so the recorded observation describes a window that no longer exists. */
24974
- reset: z40.boolean(),
25011
+ reset: z41.boolean(),
24975
25012
  /** The fraction used: 0 for a reset window, otherwise what was last observed, absent when none was reported. */
24976
- utilization: z40.number().optional(),
25013
+ utilization: z41.number().optional(),
24977
25014
  /** The reset instant, for a window that has not reset yet and reported one. */
24978
- resetsAtMs: z40.number().optional(),
25015
+ resetsAtMs: z41.number().optional(),
24979
25016
  /** The window's own status, for a window that has not reset yet. */
24980
- status: z40.string().optional()
25017
+ status: z41.string().optional()
24981
25018
  });
24982
- var UsageWindowsOutputSchema = z40.strictObject({
24983
- identity: z40.string(),
24984
- provider: z40.string(),
25019
+ var UsageWindowsOutputSchema = z41.strictObject({
25020
+ identity: z41.string(),
25021
+ provider: z41.string(),
24985
25022
  /** When the rate-limit state the windows come from was observed. */
24986
- observedAt: z40.iso.datetime().optional(),
25023
+ observedAt: z41.iso.datetime().optional(),
24987
25024
  fiveHour: EffectiveWindowSchema.optional(),
24988
25025
  sevenDay: EffectiveWindowSchema.optional()
24989
25026
  });
24990
- var UsageLiveOutputSchema = z40.strictObject({
25027
+ var UsageLiveOutputSchema = z41.strictObject({
24991
25028
  /** The freshest observation the door holds, never narrowed by the read's session filter because it is the door's single latest statement of the account's quota; absent while no rate_limit_event has been filed at all. */
24992
25029
  latest: RcLiveRateLimitSchema.optional(),
24993
25030
  /** One observation per session whose stream has filed a rate_limit_event this door generation. */
24994
- sessions: z40.readonly(z40.array(RcLiveRateLimitSchema))
25031
+ sessions: z41.readonly(z41.array(RcLiveRateLimitSchema))
24995
25032
  });
24996
- var FrontDoorSessionStatusSchema = z40.strictObject({
24997
- pid: z40.int().positive(),
24998
- startedAt: z40.number(),
24999
- alive: z40.boolean()
25033
+ var FrontDoorSessionStatusSchema = z41.strictObject({
25034
+ pid: z41.int().positive(),
25035
+ startedAt: z41.number(),
25036
+ alive: z41.boolean()
25000
25037
  });
25001
- var HeadroomSocketTargetSchema = z40.union([z40.strictObject({ socketPath: z40.string() }), z40.strictObject({ refused: z40.string() })]);
25002
- var FrontDoorStatusOutputSchema = z40.strictObject({
25038
+ var HeadroomSocketTargetSchema = z41.union([z41.strictObject({ socketPath: z41.string() }), z41.strictObject({ refused: z41.string() })]);
25039
+ var FrontDoorStatusOutputSchema = z41.strictObject({
25003
25040
  state: FrontDoorStateSchema,
25004
- supervisorAlive: z40.boolean(),
25041
+ supervisorAlive: z41.boolean(),
25005
25042
  /** The pids of earlier doors that released their addresses and are finishing the connections they carried: running, but not serving anything new. */
25006
- draining: z40.readonly(z40.array(z40.number().int().positive())),
25007
- sessions: z40.readonly(z40.array(FrontDoorSessionStatusSchema)),
25043
+ draining: z41.readonly(z41.array(z41.number().int().positive())),
25044
+ sessions: z41.readonly(z41.array(FrontDoorSessionStatusSchema)),
25008
25045
  headroomSocket: HeadroomSocketTargetSchema.optional(),
25009
- logPath: z40.string(),
25010
- logExists: z40.boolean()
25046
+ logPath: z41.string(),
25047
+ logExists: z41.boolean()
25011
25048
  });
25012
- var FrontDoorSessionsOutputSchema = z40.strictObject({ sessions: z40.readonly(z40.array(FrontDoorSessionStatusSchema)) });
25049
+ var FrontDoorSessionsOutputSchema = z41.strictObject({ sessions: z41.readonly(z41.array(FrontDoorSessionStatusSchema)) });
25013
25050
  var DOOR_REPORT_ENVIRONMENT_NOTE = "The report is collected in a worker thread of the door under the door's own environment and PATH, as a launch the door plans for itself would inherit them, not under the caller's shell: the identity is the caller's to name, the cascade is read from files at the path, and the environment-driven findings (AGENT_SHIM_IDENTITY, AGENT_SHIM_CONFIG_PROFILE, the Claude Code version pin, the ambient-credential check, and for doctor the PATH and shim findings) describe the door's launch. Run agent-shim check or agent-shim doctor from a shell for the caller's own reading.";
25014
- var CheckRunInputSchema = z40.strictObject({
25015
- path: z40.string().min(1),
25016
- identity: z40.string().min(1).optional()
25051
+ var CheckRunInputSchema = z41.strictObject({
25052
+ path: z41.string().min(1),
25053
+ identity: z41.string().min(1).optional()
25017
25054
  }).refine((input) => path46.isAbsolute(input.path), { message: "path must be absolute: the door cannot resolve a relative path against the caller's working directory" });
25018
- var PoolPickInputSchema = z40.strictObject({
25019
- pool: z40.string().min(1),
25020
- path: z40.string().min(1)
25055
+ var PoolPickInputSchema = z41.strictObject({
25056
+ pool: z41.string().min(1),
25057
+ path: z41.string().min(1)
25021
25058
  }).refine((input) => path46.isAbsolute(input.path), { message: "path must be absolute: the door cannot resolve a relative path against the caller's working directory" });
25022
- var DoctorFindingSchema = z40.strictObject({
25023
- section: z40.enum(DOCTOR_SECTIONS),
25024
- subject: z40.string().optional(),
25025
- severity: z40.enum(DOCTOR_SEVERITIES),
25026
- message: z40.string()
25059
+ var DoctorFindingSchema = z41.strictObject({
25060
+ section: z41.enum(DOCTOR_SECTIONS),
25061
+ subject: z41.string().optional(),
25062
+ severity: z41.enum(DOCTOR_SEVERITIES),
25063
+ message: z41.string()
25027
25064
  });
25028
- var DoctorRunOutputSchema = z40.strictObject({
25065
+ var DoctorRunOutputSchema = z41.strictObject({
25029
25066
  /** False exactly when any finding is a `fail`; a `warn` never fails the report on its own. */
25030
- ok: z40.boolean(),
25031
- findings: z40.readonly(z40.array(DoctorFindingSchema))
25032
- });
25033
- var FrontDoorRestartOutputSchema = z40.strictObject({
25034
- action: z40.literal("restarting"),
25035
- previousPid: z40.int().positive()
25036
- });
25037
- var UpdateCheckOutputSchema = z40.strictObject({
25038
- current: z40.string(),
25039
- latest: z40.string(),
25040
- action: z40.enum(["current", "available", "updated"])
25041
- });
25042
- var CodexSignInSchema = z40.discriminatedUnion("state", [
25043
- z40.strictObject({ state: z40.literal("none") }),
25044
- z40.strictObject({ state: z40.literal("signed-in"), email: z40.string().optional(), planScope: z40.boolean(), accessTokenExpiresAt: z40.number() }),
25045
- z40.strictObject({ state: z40.literal("unreadable"), message: z40.string() })
25067
+ ok: z41.boolean(),
25068
+ findings: z41.readonly(z41.array(DoctorFindingSchema))
25069
+ });
25070
+ var FrontDoorRestartOutputSchema = z41.strictObject({
25071
+ action: z41.literal("restarting"),
25072
+ previousPid: z41.int().positive()
25073
+ });
25074
+ var UpdateCheckOutputSchema = z41.strictObject({
25075
+ current: z41.string(),
25076
+ latest: z41.string(),
25077
+ action: z41.enum(["current", "available", "updated"])
25078
+ });
25079
+ var CodexSignInSchema = z41.discriminatedUnion("state", [
25080
+ z41.strictObject({ state: z41.literal("none") }),
25081
+ z41.strictObject({ state: z41.literal("signed-in"), email: z41.string().optional(), planScope: z41.boolean(), accessTokenExpiresAt: z41.number() }),
25082
+ z41.strictObject({ state: z41.literal("unreadable"), message: z41.string() })
25046
25083
  ]);
25047
- var CodexStatusOutputSchema = z40.strictObject({
25084
+ var CodexStatusOutputSchema = z41.strictObject({
25048
25085
  signIn: CodexSignInSchema,
25049
- codexProviders: z40.readonly(z40.array(z40.string()))
25086
+ codexProviders: z41.readonly(z41.array(z41.string()))
25050
25087
  });
25051
- var CodexLogoutOutputSchema = z40.strictObject({
25052
- hadGrant: z40.boolean(),
25053
- revoked: z40.boolean()
25088
+ var CodexLogoutOutputSchema = z41.strictObject({
25089
+ hadGrant: z41.boolean(),
25090
+ revoked: z41.boolean()
25054
25091
  });
25055
25092
 
25056
25093
  // src/frontdoor/codexApi.ts
@@ -25071,21 +25108,21 @@ function createCodexApiRouter(deps) {
25071
25108
 
25072
25109
  // src/frontdoor/doorWorker.ts
25073
25110
  import { getAsset, isSea as isSea2 } from "node:sea";
25074
- import { z as z42 } from "zod";
25111
+ import { z as z43 } from "zod";
25075
25112
  init_cliError();
25076
25113
  init_doorBounds();
25077
25114
  init_providerCatalogue();
25078
25115
 
25079
25116
  // src/frontdoor/doorWorkerProtocol.ts
25080
25117
  init_providerCatalogue();
25081
- import { z as z41 } from "zod";
25118
+ import { z as z42 } from "zod";
25082
25119
  var doorWorkerInputSchemas = {
25083
25120
  /** `agent-shim check` for `path` as `identity` (the identity a launch there would resolve when absent). */
25084
- check: z41.strictObject({ root: z41.string().min(1), path: z41.string().min(1), identity: z41.string().min(1).optional() }),
25121
+ check: z42.strictObject({ root: z42.string().min(1), path: z42.string().min(1), identity: z42.string().min(1).optional() }),
25085
25122
  /** `agent-shim doctor`. */
25086
- doctor: z41.strictObject({ root: z41.string().min(1) }),
25123
+ doctor: z42.strictObject({ root: z42.string().min(1) }),
25087
25124
  /** Fetch and store one provider's model catalogue for the door generation that asked. */
25088
- "refresh-catalogue": z41.strictObject({ root: z41.string().min(1), name: z41.string().min(1), supervisorPid: z41.int().positive(), generation: z41.uuid() })
25125
+ "refresh-catalogue": z42.strictObject({ root: z42.string().min(1), name: z42.string().min(1), supervisorPid: z42.int().positive(), generation: z42.uuid() })
25089
25126
  };
25090
25127
 
25091
25128
  // src/frontdoor/doorWorker.ts
@@ -25183,75 +25220,75 @@ init_names();
25183
25220
  init_keychainLogin();
25184
25221
  init_statusline();
25185
25222
  init_toolLogins();
25186
- import { z as z43 } from "zod";
25187
- var RemovalConfirmationSchema = z43.boolean();
25188
- var CredentialWriteSchema = (targets) => z43.strictObject({
25189
- sources: z43.array(RemoteCredentialSourceSchema).min(1).optional(),
25190
- target: z43.enum(targets).optional(),
25191
- cache: z43.union([z43.literal(false), CredentialCacheSchema]).optional()
25192
- });
25193
- var CredentialSummarySchema2 = z43.strictObject({
25194
- target: z43.enum(CREDENTIAL_TARGETS),
25195
- sources: z43.readonly(z43.array(
25196
- z43.discriminatedUnion("kind", [
25197
- z43.strictObject({ kind: z43.literal("env"), variable: z43.string() }),
25198
- z43.strictObject({ kind: z43.literal("file"), path: z43.string() }),
25199
- z43.strictObject({ kind: z43.literal("command"), program: z43.string() }),
25200
- z43.strictObject({ kind: z43.literal("op"), reference: z43.string() }),
25201
- z43.strictObject({ kind: z43.literal("keychain"), service: z43.string(), account: z43.string().optional() }),
25202
- z43.strictObject({ kind: z43.literal("literal") })
25223
+ import { z as z44 } from "zod";
25224
+ var RemovalConfirmationSchema = z44.boolean();
25225
+ var CredentialWriteSchema = (targets) => z44.strictObject({
25226
+ sources: z44.array(RemoteCredentialSourceSchema).min(1).optional(),
25227
+ target: z44.enum(targets).optional(),
25228
+ cache: z44.union([z44.literal(false), CredentialCacheSchema]).optional()
25229
+ });
25230
+ var CredentialSummarySchema2 = z44.strictObject({
25231
+ target: z44.enum(CREDENTIAL_TARGETS),
25232
+ sources: z44.readonly(z44.array(
25233
+ z44.discriminatedUnion("kind", [
25234
+ z44.strictObject({ kind: z44.literal("env"), variable: z44.string() }),
25235
+ z44.strictObject({ kind: z44.literal("file"), path: z44.string() }),
25236
+ z44.strictObject({ kind: z44.literal("command"), program: z44.string() }),
25237
+ z44.strictObject({ kind: z44.literal("op"), reference: z44.string() }),
25238
+ z44.strictObject({ kind: z44.literal("keychain"), service: z44.string(), account: z44.string().optional() }),
25239
+ z44.strictObject({ kind: z44.literal("literal") })
25203
25240
  ])
25204
25241
  )),
25205
25242
  cache: CredentialCacheSchema.optional()
25206
25243
  });
25207
- var mutationOutput = (kind, action) => z43.strictObject({ action: z43.literal(action), kind: z43.literal(kind), name: z43.string() });
25208
- var storedMutationOutput = (kind, action, value) => z43.strictObject({ action: z43.literal(action), kind: z43.literal(kind), name: z43.string(), value });
25209
- var IdentityValueSchema = z43.strictObject({
25210
- agent: z43.enum(["claude", "codex"]).optional(),
25211
- name: z43.string(),
25212
- label: z43.string().optional(),
25213
- defaultConfigProfile: z43.string().optional(),
25214
- provider: z43.string().optional(),
25215
- allowAmbientCredential: z43.boolean(),
25244
+ var mutationOutput = (kind, action) => z44.strictObject({ action: z44.literal(action), kind: z44.literal(kind), name: z44.string() });
25245
+ var storedMutationOutput = (kind, action, value) => z44.strictObject({ action: z44.literal(action), kind: z44.literal(kind), name: z44.string(), value });
25246
+ var IdentityValueSchema = z44.strictObject({
25247
+ agent: z44.enum(["claude", "codex"]).optional(),
25248
+ name: z44.string(),
25249
+ label: z44.string().optional(),
25250
+ defaultConfigProfile: z44.string().optional(),
25251
+ provider: z44.string().optional(),
25252
+ allowAmbientCredential: z44.boolean(),
25216
25253
  credential: CredentialSummarySchema2.optional(),
25217
- anchors: z43.array(AnchorSchema).optional(),
25254
+ anchors: z44.array(AnchorSchema).optional(),
25218
25255
  /** Read only here: a grant is made and revoked from the command line alone, so a program driving the door cannot widen what it may reach. */
25219
- grants: z43.array(IdentityGrantSchema).optional(),
25256
+ grants: z44.array(IdentityGrantSchema).optional(),
25220
25257
  toolLogins: ToolLoginsSchema.optional()
25221
25258
  });
25222
25259
  var ProfileValueSchema = ConfigProfileSchema.omit({ $schema: true });
25223
- var ProviderValueSchema = z43.strictObject({
25224
- name: z43.string(),
25225
- kind: z43.enum(PROVIDER_KINDS),
25226
- displayName: z43.string(),
25227
- baseUrl: z43.string().optional(),
25260
+ var ProviderValueSchema = z44.strictObject({
25261
+ name: z44.string(),
25262
+ kind: z44.enum(PROVIDER_KINDS),
25263
+ displayName: z44.string(),
25264
+ baseUrl: z44.string().optional(),
25228
25265
  codex: CodexProviderConfigSchema.optional(),
25229
25266
  credential: CredentialSummarySchema2.optional(),
25230
- env: z43.record(z43.string(), z43.string()).optional()
25267
+ env: z44.record(z44.string(), z44.string()).optional()
25231
25268
  });
25232
- var ConfigNameInputSchema = z43.strictObject({ name: z43.string().min(1) });
25233
- var ConfigIdentityAddInputSchema = z43.strictObject({ name: z43.string().min(1), keepKeychainLogin: z43.boolean().optional().describe(KEEP_KEYCHAIN_LOGIN_DESCRIPTION) });
25269
+ var ConfigNameInputSchema = z44.strictObject({ name: z44.string().min(1) });
25270
+ var ConfigIdentityAddInputSchema = z44.strictObject({ name: z44.string().min(1), keepKeychainLogin: z44.boolean().optional().describe(KEEP_KEYCHAIN_LOGIN_DESCRIPTION) });
25234
25271
  var ConfigIdentityAddOutputSchema = storedMutationOutput("identity", "created", IdentityValueSchema);
25235
- var ConfigIdentitySetInputSchema = z43.strictObject({
25236
- name: z43.string().min(1),
25272
+ var ConfigIdentitySetInputSchema = z44.strictObject({
25273
+ name: z44.string().min(1),
25237
25274
  /** The identity's display label; `false` clears it. */
25238
- label: z43.union([IdentityLabelSchema, z43.literal(false)]).optional(),
25239
- defaultConfigProfile: z43.union([z43.string().min(1), z43.literal(false)]).optional(),
25275
+ label: z44.union([IdentityLabelSchema, z44.literal(false)]).optional(),
25276
+ defaultConfigProfile: z44.union([z44.string().min(1), z44.literal(false)]).optional(),
25240
25277
  /** The provider the identity exists for; `false` clears it. */
25241
- provider: z43.union([z43.string().min(1), z43.literal(false)]).optional(),
25242
- allowAmbientCredential: z43.boolean().optional(),
25243
- credential: z43.union([z43.literal(false), CredentialWriteSchema(CREDENTIAL_TARGETS)]).optional(),
25278
+ provider: z44.union([z44.string().min(1), z44.literal(false)]).optional(),
25279
+ allowAmbientCredential: z44.boolean().optional(),
25280
+ credential: z44.union([z44.literal(false), CredentialWriteSchema(CREDENTIAL_TARGETS)]).optional(),
25244
25281
  /** `false` removes the anchors; a list replaces them. */
25245
- anchors: z43.union([z43.literal(false), z43.array(AnchorSchema).min(1)]).optional(),
25282
+ anchors: z44.union([z44.literal(false), z44.array(AnchorSchema).min(1)]).optional(),
25246
25283
  /** Each assignment replaces whatever that surface already named. */
25247
- toolLogin: z43.array(z43.strictObject({ surface: z43.enum(TOOL_SURFACES), lender: z43.string().min(1) })).optional(),
25284
+ toolLogin: z44.array(z44.strictObject({ surface: z44.enum(TOOL_SURFACES), lender: z44.string().min(1) })).optional(),
25248
25285
  /** Surfaces to return to the identity's own login. */
25249
- clearToolLogin: z43.array(z43.enum(TOOL_SURFACES)).optional()
25286
+ clearToolLogin: z44.array(z44.enum(TOOL_SURFACES)).optional()
25250
25287
  });
25251
25288
  var ConfigIdentitySetOutputSchema = storedMutationOutput("identity", "updated", IdentityValueSchema);
25252
- var ConfigIdentityRemoveInputSchema = z43.strictObject({ name: z43.string().min(1), confirm: RemovalConfirmationSchema });
25289
+ var ConfigIdentityRemoveInputSchema = z44.strictObject({ name: z44.string().min(1), confirm: RemovalConfirmationSchema });
25253
25290
  var ConfigIdentityRemoveOutputSchema = mutationOutput("identity", "removed");
25254
- var ConfigStatuslineSetSchema = z43.record(z43.string(), z43.unknown()).superRefine((settings, context) => {
25291
+ var ConfigStatuslineSetSchema = z44.record(z44.string(), z44.unknown()).superRefine((settings, context) => {
25255
25292
  for (const key of Object.keys(settings)) {
25256
25293
  if (key === STATUSLINE_EXTRA_GROUP || key.startsWith(`${STATUSLINE_EXTRA_GROUP}.`)) {
25257
25294
  context.addIssue({ code: "custom", path: [key], message: `a config write through the API cannot set "${key}": the extra segment's command runs a program, so only your own configuration (the global config, a profile you edit yourself, a directory rule or a command-line assignment) may set it` });
@@ -25259,102 +25296,102 @@ var ConfigStatuslineSetSchema = z43.record(z43.string(), z43.unknown()).superRef
25259
25296
  }
25260
25297
  });
25261
25298
  var ConfigIdentityUseOutputSchema = mutationOutput("identity", "selected");
25262
- var ConfigProfileAddInputSchema = z43.strictObject({
25263
- name: z43.string().min(1),
25264
- extends: z43.array(z43.string().min(1)).optional(),
25265
- description: z43.string().optional()
25299
+ var ConfigProfileAddInputSchema = z44.strictObject({
25300
+ name: z44.string().min(1),
25301
+ extends: z44.array(z44.string().min(1)).optional(),
25302
+ description: z44.string().optional()
25266
25303
  });
25267
25304
  var ConfigProfileAddOutputSchema = storedMutationOutput("profile", "created", ProfileValueSchema);
25268
- var ConfigProfileSetInputSchema = z43.strictObject({
25269
- name: z43.string().min(1),
25270
- category: z43.record(z43.string(), z43.boolean()).optional(),
25271
- entry: z43.record(z43.string(), z43.boolean()).optional(),
25272
- extends: z43.union([z43.array(z43.string().min(1)), z43.literal(false)]).optional(),
25273
- description: z43.union([z43.string(), z43.literal(false)]).optional(),
25274
- launch: z43.strictObject({
25275
- skipPermissions: z43.boolean().optional(),
25276
- remoteControl: z43.boolean().optional(),
25277
- headroom: z43.boolean().optional(),
25278
- trackUsage: z43.boolean().optional(),
25279
- provider: z43.union([z43.string().min(1), z43.literal(false)]).optional(),
25280
- claudeVersion: z43.union([z43.string().min(1), z43.literal(false)]).optional(),
25281
- delay: z43.union([z43.string().regex(DURATION_RE), z43.literal(false)]).optional(),
25282
- pause: z43.boolean().optional(),
25283
- explain: z43.boolean().optional(),
25284
- proxyBypass: z43.union([z43.array(z43.string().min(1)), z43.literal(false)]).optional(),
25285
- statusline: z43.strictObject({
25305
+ var ConfigProfileSetInputSchema = z44.strictObject({
25306
+ name: z44.string().min(1),
25307
+ category: z44.record(z44.string(), z44.boolean()).optional(),
25308
+ entry: z44.record(z44.string(), z44.boolean()).optional(),
25309
+ extends: z44.union([z44.array(z44.string().min(1)), z44.literal(false)]).optional(),
25310
+ description: z44.union([z44.string(), z44.literal(false)]).optional(),
25311
+ launch: z44.strictObject({
25312
+ skipPermissions: z44.boolean().optional(),
25313
+ remoteControl: z44.boolean().optional(),
25314
+ headroom: z44.boolean().optional(),
25315
+ trackUsage: z44.boolean().optional(),
25316
+ provider: z44.union([z44.string().min(1), z44.literal(false)]).optional(),
25317
+ claudeVersion: z44.union([z44.string().min(1), z44.literal(false)]).optional(),
25318
+ delay: z44.union([z44.string().regex(DURATION_RE), z44.literal(false)]).optional(),
25319
+ pause: z44.boolean().optional(),
25320
+ explain: z44.boolean().optional(),
25321
+ proxyBypass: z44.union([z44.array(z44.string().min(1)), z44.literal(false)]).optional(),
25322
+ statusline: z44.strictObject({
25286
25323
  set: ConfigStatuslineSetSchema.optional(),
25287
- unset: z43.array(z43.string()).optional()
25324
+ unset: z44.array(z44.string()).optional()
25288
25325
  }).optional()
25289
25326
  }).optional()
25290
25327
  });
25291
25328
  var ConfigProfileSetOutputSchema = storedMutationOutput("profile", "updated", ProfileValueSchema);
25292
- var ConfigProfileRemoveInputSchema = z43.strictObject({ name: z43.string().min(1), confirm: RemovalConfirmationSchema });
25329
+ var ConfigProfileRemoveInputSchema = z44.strictObject({ name: z44.string().min(1), confirm: RemovalConfirmationSchema });
25293
25330
  var ConfigProfileRemoveOutputSchema = mutationOutput("profile", "removed");
25294
25331
  var ConfigProfileUseOutputSchema = mutationOutput("profile", "selected");
25295
- var PoolMembersInputSchema = z43.array(z43.string().min(1)).min(1);
25296
- var ConfigPoolAddInputSchema = z43.strictObject({
25297
- name: z43.string().min(1),
25332
+ var PoolMembersInputSchema = z44.array(z44.string().min(1)).min(1);
25333
+ var ConfigPoolAddInputSchema = z44.strictObject({
25334
+ name: z44.string().min(1),
25298
25335
  identities: PoolMembersInputSchema,
25299
- preference: z43.enum(POOL_PREFERENCES).optional(),
25300
- resumeOnLimit: z43.boolean().optional(),
25301
- compactBeforeLimit: z43.boolean().optional(),
25336
+ preference: z44.enum(POOL_PREFERENCES).optional(),
25337
+ resumeOnLimit: z44.boolean().optional(),
25338
+ compactBeforeLimit: z44.boolean().optional(),
25302
25339
  compactAtUtilisation: CompactAtUtilisationSchema.optional()
25303
25340
  });
25304
25341
  var ConfigPoolAddOutputSchema = storedMutationOutput("pool", "created", PoolSchema);
25305
- var ConfigPoolSetInputSchema = z43.strictObject({
25306
- name: z43.string().min(1),
25342
+ var ConfigPoolSetInputSchema = z44.strictObject({
25343
+ name: z44.string().min(1),
25307
25344
  identities: PoolMembersInputSchema.optional(),
25308
- preference: z43.union([z43.enum(POOL_PREFERENCES), z43.literal(false)]).optional(),
25309
- resumeOnLimit: z43.boolean().optional(),
25310
- compactBeforeLimit: z43.boolean().optional(),
25311
- compactAtUtilisation: z43.union([CompactAtUtilisationSchema, z43.literal(false)]).optional()
25345
+ preference: z44.union([z44.enum(POOL_PREFERENCES), z44.literal(false)]).optional(),
25346
+ resumeOnLimit: z44.boolean().optional(),
25347
+ compactBeforeLimit: z44.boolean().optional(),
25348
+ compactAtUtilisation: z44.union([CompactAtUtilisationSchema, z44.literal(false)]).optional()
25312
25349
  });
25313
25350
  var ConfigPoolSetOutputSchema = storedMutationOutput("pool", "updated", PoolSchema);
25314
- var ConfigPoolRemoveInputSchema = z43.strictObject({ name: z43.string().min(1), confirm: RemovalConfirmationSchema });
25351
+ var ConfigPoolRemoveInputSchema = z44.strictObject({ name: z44.string().min(1), confirm: RemovalConfirmationSchema });
25315
25352
  var ConfigPoolRemoveOutputSchema = mutationOutput("pool", "removed");
25316
25353
  var ConfigPoolUseOutputSchema = mutationOutput("pool", "selected");
25317
- var ConfigProviderAddInputSchema = z43.strictObject({
25318
- name: z43.string().min(1),
25319
- kind: z43.enum(PROVIDER_KINDS).optional(),
25320
- displayName: z43.string().min(1),
25321
- baseUrl: z43.string().min(1).optional(),
25354
+ var ConfigProviderAddInputSchema = z44.strictObject({
25355
+ name: z44.string().min(1),
25356
+ kind: z44.enum(PROVIDER_KINDS).optional(),
25357
+ displayName: z44.string().min(1),
25358
+ baseUrl: z44.string().min(1).optional(),
25322
25359
  credential: CredentialWriteSchema(PROVIDER_CREDENTIAL_TARGETS).required({ sources: true }),
25323
25360
  codex: CodexProviderConfigSchema.optional()
25324
25361
  });
25325
25362
  var ConfigProviderAddOutputSchema = storedMutationOutput("provider", "created", ProviderValueSchema);
25326
- var ConfigProviderSetInputSchema = z43.strictObject({
25327
- name: z43.string().min(1),
25328
- displayName: z43.string().min(1).optional(),
25329
- baseUrl: z43.string().min(1).optional(),
25363
+ var ConfigProviderSetInputSchema = z44.strictObject({
25364
+ name: z44.string().min(1),
25365
+ displayName: z44.string().min(1).optional(),
25366
+ baseUrl: z44.string().min(1).optional(),
25330
25367
  credential: CredentialWriteSchema(PROVIDER_CREDENTIAL_TARGETS).optional(),
25331
25368
  codex: CodexProviderConfigSchema.optional()
25332
25369
  });
25333
25370
  var ConfigProviderSetOutputSchema = storedMutationOutput("provider", "updated", ProviderValueSchema);
25334
- var ConfigProviderRemoveInputSchema = z43.strictObject({ name: z43.string().min(1), confirm: RemovalConfirmationSchema });
25371
+ var ConfigProviderRemoveInputSchema = z44.strictObject({ name: z44.string().min(1), confirm: RemovalConfirmationSchema });
25335
25372
  var ConfigProviderRemoveOutputSchema = mutationOutput("provider", "removed");
25336
- var ConfigRuleAddInputSchema = z43.strictObject({
25337
- path: z43.string().min(1),
25338
- configProfile: z43.string().min(1).optional(),
25339
- identity: z43.string().min(1).optional()
25373
+ var ConfigRuleAddInputSchema = z44.strictObject({
25374
+ path: z44.string().min(1),
25375
+ configProfile: z44.string().min(1).optional(),
25376
+ identity: z44.string().min(1).optional()
25340
25377
  });
25341
25378
  var ConfigRuleAddOutputSchema = storedMutationOutput("rule", "created", DirectoryRuleSchema);
25342
- var ConfigRuleSetInputSchema = z43.strictObject({
25343
- path: z43.string().min(1),
25344
- configProfile: z43.union([z43.string().min(1), z43.literal(false)]).optional(),
25345
- identity: z43.union([z43.string().min(1), z43.literal(false)]).optional()
25379
+ var ConfigRuleSetInputSchema = z44.strictObject({
25380
+ path: z44.string().min(1),
25381
+ configProfile: z44.union([z44.string().min(1), z44.literal(false)]).optional(),
25382
+ identity: z44.union([z44.string().min(1), z44.literal(false)]).optional()
25346
25383
  });
25347
25384
  var ConfigRuleSetOutputSchema = storedMutationOutput("rule", "updated", DirectoryRuleSchema);
25348
- var ConfigRuleRemoveInputSchema = z43.strictObject({ path: z43.string().min(1), confirm: RemovalConfirmationSchema });
25385
+ var ConfigRuleRemoveInputSchema = z44.strictObject({ path: z44.string().min(1), confirm: RemovalConfirmationSchema });
25349
25386
  var ConfigRuleRemoveOutputSchema = mutationOutput("rule", "removed");
25350
- var RouteScopeInputSchema = z43.union([
25351
- z43.strictObject({ kind: z43.literal("global") }),
25352
- z43.strictObject({ kind: z43.enum(["session", "identity", "provider"]), name: z43.string().min(1) })
25387
+ var RouteScopeInputSchema = z44.union([
25388
+ z44.strictObject({ kind: z44.literal("global") }),
25389
+ z44.strictObject({ kind: z44.enum(["session", "identity", "provider"]), name: z44.string().min(1) })
25353
25390
  ]);
25354
- var ConfigRouteSetInputSchema = z43.strictObject({ scope: RouteScopeInputSchema, model: z43.string().min(1), target: z43.string().min(1) });
25355
- var ConfigRouteSetOutputSchema = storedMutationOutput("route", "updated", z43.strictObject({ scope: z43.string(), model: z43.string(), target: z43.string() }));
25356
- var ConfigRouteRemoveInputSchema = z43.strictObject({ scope: RouteScopeInputSchema, model: z43.string().min(1), confirm: RemovalConfirmationSchema });
25357
- var ConfigRouteRemoveOutputSchema = z43.strictObject({ action: z43.literal("removed"), kind: z43.literal("route"), name: z43.string(), removed: z43.array(z43.string()) });
25391
+ var ConfigRouteSetInputSchema = z44.strictObject({ scope: RouteScopeInputSchema, model: z44.string().min(1), target: z44.string().min(1) });
25392
+ var ConfigRouteSetOutputSchema = storedMutationOutput("route", "updated", z44.strictObject({ scope: z44.string(), model: z44.string(), target: z44.string() }));
25393
+ var ConfigRouteRemoveInputSchema = z44.strictObject({ scope: RouteScopeInputSchema, model: z44.string().min(1), confirm: RemovalConfirmationSchema });
25394
+ var ConfigRouteRemoveOutputSchema = z44.strictObject({ action: z44.literal("removed"), kind: z44.literal("route"), name: z44.string(), removed: z44.array(z44.string()) });
25358
25395
 
25359
25396
  // src/routeOverrides.ts
25360
25397
  init_commandDeps();
@@ -25750,50 +25787,50 @@ import { eventIterator as eventIterator2, withEventMeta as withEventMeta2 } from
25750
25787
 
25751
25788
  // src/frontdoor/eventSchemas.ts
25752
25789
  init_schema2();
25753
- import { z as z44 } from "zod";
25790
+ import { z as z45 } from "zod";
25754
25791
  var DOOR_EVENT_SOURCE_RC = "rc";
25755
25792
  var LAUNCH_EVENT_SOURCE = "launch";
25756
25793
  var USAGE_EVENT_SOURCE = "usage";
25757
25794
  var DOOR_HEALTH_EVENT_SOURCE = "door";
25758
25795
  var QUOTA_EXPIRING_EVENT_SOURCE = "quota-expiring";
25759
- var DoorEventSchema = z44.strictObject({
25760
- source: z44.string().min(1),
25796
+ var DoorEventSchema = z45.strictObject({
25797
+ source: z45.string().min(1),
25761
25798
  /** A positive integer because the backbone's counters start at one and only ever increase. */
25762
- sequence: z44.number().int().positive(),
25763
- payload: z44.unknown()
25764
- });
25765
- var DoorEventSourceQuerySchema = z44.strictObject({
25766
- sources: z44.array(z44.string().min(1)).min(1).optional()
25767
- });
25768
- var LaunchLifecycleEventSchema = z44.strictObject({
25769
- kind: z44.enum(["registered", "pruned", "ended"]),
25770
- pid: z44.number().int().positive(),
25771
- startedAt: z44.number(),
25772
- observedAt: z44.number()
25773
- });
25774
- var DoorHealthEventSchema = z44.discriminatedUnion("kind", [
25775
- z44.strictObject({ kind: z44.literal("generation"), pid: z44.number().int().positive(), providerPort: z44.number().int().positive(), connectPort: z44.number().int().positive(), directPort: z44.number().int().positive(), observedAt: z44.number() }),
25776
- z44.strictObject({ kind: z44.literal("listenerFailed"), pid: z44.number().int().positive(), listener: z44.enum(["provider", "connect", "direct"]), message: z44.string(), observedAt: z44.number() }),
25777
- z44.strictObject({ kind: z44.literal("binaryTurnover"), pid: z44.number().int().positive(), observedAt: z44.number() }),
25778
- z44.strictObject({ kind: z44.literal("idleShutdown"), pid: z44.number().int().positive(), observedAt: z44.number() }),
25779
- z44.strictObject({ kind: z44.literal("superseded"), pid: z44.number().int().positive(), ownerPid: z44.number().int().positive(), observedAt: z44.number() }),
25780
- z44.strictObject({ kind: z44.literal("drained"), pid: z44.number().int().positive(), observedAt: z44.number() })
25799
+ sequence: z45.number().int().positive(),
25800
+ payload: z45.unknown()
25801
+ });
25802
+ var DoorEventSourceQuerySchema = z45.strictObject({
25803
+ sources: z45.array(z45.string().min(1)).min(1).optional()
25804
+ });
25805
+ var LaunchLifecycleEventSchema = z45.strictObject({
25806
+ kind: z45.enum(["registered", "pruned", "ended"]),
25807
+ pid: z45.number().int().positive(),
25808
+ startedAt: z45.number(),
25809
+ observedAt: z45.number()
25810
+ });
25811
+ var DoorHealthEventSchema = z45.discriminatedUnion("kind", [
25812
+ z45.strictObject({ kind: z45.literal("generation"), pid: z45.number().int().positive(), providerPort: z45.number().int().positive(), connectPort: z45.number().int().positive(), directPort: z45.number().int().positive(), observedAt: z45.number() }),
25813
+ z45.strictObject({ kind: z45.literal("listenerFailed"), pid: z45.number().int().positive(), listener: z45.enum(["provider", "connect", "direct"]), message: z45.string(), observedAt: z45.number() }),
25814
+ z45.strictObject({ kind: z45.literal("binaryTurnover"), pid: z45.number().int().positive(), observedAt: z45.number() }),
25815
+ z45.strictObject({ kind: z45.literal("idleShutdown"), pid: z45.number().int().positive(), observedAt: z45.number() }),
25816
+ z45.strictObject({ kind: z45.literal("superseded"), pid: z45.number().int().positive(), ownerPid: z45.number().int().positive(), observedAt: z45.number() }),
25817
+ z45.strictObject({ kind: z45.literal("drained"), pid: z45.number().int().positive(), observedAt: z45.number() })
25781
25818
  ]);
25782
- var QuotaExpiringEventSchema = z44.strictObject({
25819
+ var QuotaExpiringEventSchema = z45.strictObject({
25783
25820
  /** The id of the identity whose window it is: what its usage is filed under, which a rename keeps. */
25784
- id: z44.string().min(1),
25821
+ id: z45.string().min(1),
25785
25822
  /** The identity's name when the event was published, absent for an identity no longer stored under the id. */
25786
- name: z44.string().min(1).optional(),
25787
- provider: z44.string().min(1),
25788
- window: z44.enum(["fiveHour", "sevenDay"]),
25823
+ name: z45.string().min(1).optional(),
25824
+ provider: z45.string().min(1),
25825
+ window: z45.enum(["fiveHour", "sevenDay"]),
25789
25826
  /** The fraction of the window already used when it was seen expiring, always below one because a fully used window has nothing left to spend. */
25790
- utilization: z44.number().min(0).max(1),
25791
- resetsAt: z44.iso.datetime(),
25792
- observedAt: z44.number()
25827
+ utilization: z45.number().min(0).max(1),
25828
+ resetsAt: z45.iso.datetime(),
25829
+ observedAt: z45.number()
25793
25830
  });
25794
25831
  var UsageChangeEventSchema = UsageSnapshotSchema.extend({
25795
- id: z44.string().min(1),
25796
- name: z44.string().min(1).optional()
25832
+ id: z45.string().min(1),
25833
+ name: z45.string().min(1).optional()
25797
25834
  });
25798
25835
 
25799
25836
  // src/frontdoor/eventsApi.ts
@@ -25838,14 +25875,14 @@ function createEventsApiRouter(deps) {
25838
25875
  init_update();
25839
25876
  import { ORPCError as ORPCError4 } from "@orpc/client";
25840
25877
  import { openapi as openapi5 } from "@orpc/openapi";
25841
- import { z as z45 } from "zod";
25878
+ import { z as z46 } from "zod";
25842
25879
  var FRONTDOOR_API_TAG = "frontdoor";
25843
25880
  var UPDATE_API_TAG = "update";
25844
25881
  function createLifecycleApiRouter(deps) {
25845
25882
  const authed = doorApiAuth(deps.expectedToken);
25846
25883
  return {
25847
25884
  frontdoor: {
25848
- refreshCatalogues: authed.meta(openapi5({ method: "POST", path: "/rest/frontdoor/catalogues/refresh", summary: "Request a catalogue refresh tick", tags: [FRONTDOOR_API_TAG] })).output(z45.strictObject({ requested: z45.literal(true) })).handler(() => {
25885
+ refreshCatalogues: authed.meta(openapi5({ method: "POST", path: "/rest/frontdoor/catalogues/refresh", summary: "Request a catalogue refresh tick", tags: [FRONTDOOR_API_TAG] })).output(z46.strictObject({ requested: z46.literal(true) })).handler(() => {
25849
25886
  deps.refreshCatalogues();
25850
25887
  return { requested: true };
25851
25888
  }),
@@ -25882,64 +25919,64 @@ import { openapi as openapi6 } from "@orpc/openapi";
25882
25919
 
25883
25920
  // src/frontdoor/launchSchemas.ts
25884
25921
  import path47 from "node:path";
25885
- import { z as z46 } from "zod";
25922
+ import { z as z47 } from "zod";
25886
25923
  init_statusline();
25887
25924
  init_claudeVersion();
25888
25925
  init_identity2();
25889
- var LaunchResolveInputSchema = z46.strictObject({
25890
- path: z46.string().min(1),
25926
+ var LaunchResolveInputSchema = z47.strictObject({
25927
+ path: z47.string().min(1),
25891
25928
  /** `@name`, launch flags, then the arguments for `claude`; empty for a bare launch. */
25892
- argv: z46.readonly(z46.array(z46.string())).optional(),
25929
+ argv: z47.readonly(z47.array(z47.string())).optional(),
25893
25930
  /** The launch's inherited environment. Absent means an empty one: the door's own environment is never a substitute for the caller's, so a caller that wants `AGENT_SHIM_*` switches or a `CLAUDE_CONFIG_DIR` considered names them here. Values are read, never reported. */
25894
- env: z46.record(z46.string(), z46.string()).optional()
25931
+ env: z47.record(z47.string(), z47.string()).optional()
25895
25932
  }).refine((input) => path47.isAbsolute(input.path), { message: "path must be absolute: the door cannot resolve a relative path against the caller's working directory" });
25896
- var LaunchPoolDecisionSchema = z46.strictObject({
25897
- name: z46.string(),
25898
- reasons: z46.readonly(z46.array(z46.string())),
25933
+ var LaunchPoolDecisionSchema = z47.strictObject({
25934
+ name: z47.string(),
25935
+ reasons: z47.readonly(z47.array(z47.string())),
25899
25936
  /** The provider the ranking read for the chosen member, when the launch spends one in place of the member's Claude account. */
25900
- provider: z46.string().optional(),
25901
- movedOff: z46.strictObject({ identity: z46.string(), reason: z46.string() }).optional()
25937
+ provider: z47.string().optional(),
25938
+ movedOff: z47.strictObject({ identity: z47.string(), reason: z47.string() }).optional()
25902
25939
  });
25903
- var LaunchDecisionSchema = z46.strictObject({
25904
- identity: z46.string().optional(),
25905
- identityId: z46.string().optional(),
25906
- identitySource: z46.enum(IDENTITY_DECISION_SOURCES),
25940
+ var LaunchDecisionSchema = z47.strictObject({
25941
+ identity: z47.string().optional(),
25942
+ identityId: z47.string().optional(),
25943
+ identitySource: z47.enum(IDENTITY_DECISION_SOURCES),
25907
25944
  pool: LaunchPoolDecisionSchema.optional(),
25908
25945
  /** True when `CLAUDE_CONFIG_DIR` was already set and nothing on the command line named an identity; an identity named there outranks the variable and leaves it false. */
25909
- configDirEscapeHatch: z46.boolean(),
25910
- configDir: z46.string().optional(),
25911
- configProfile: z46.string().optional(),
25912
- configProfileSource: z46.enum(CONFIG_PROFILE_DECISION_SOURCES),
25913
- provider: z46.string().optional()
25914
- });
25915
- var LaunchFlagsSchema = z46.strictObject({
25916
- skipPermissions: z46.boolean(),
25917
- remoteControl: z46.boolean(),
25918
- headroom: z46.boolean(),
25919
- trackUsage: z46.boolean(),
25920
- pause: z46.boolean(),
25921
- explain: z46.boolean(),
25946
+ configDirEscapeHatch: z47.boolean(),
25947
+ configDir: z47.string().optional(),
25948
+ configProfile: z47.string().optional(),
25949
+ configProfileSource: z47.enum(CONFIG_PROFILE_DECISION_SOURCES),
25950
+ provider: z47.string().optional()
25951
+ });
25952
+ var LaunchFlagsSchema = z47.strictObject({
25953
+ skipPermissions: z47.boolean(),
25954
+ remoteControl: z47.boolean(),
25955
+ headroom: z47.boolean(),
25956
+ trackUsage: z47.boolean(),
25957
+ pause: z47.boolean(),
25958
+ explain: z47.boolean(),
25922
25959
  /** How long the launch waits after its own output before it starts claude, in milliseconds. */
25923
- delayMs: z46.number(),
25960
+ delayMs: z47.number(),
25924
25961
  /** The hosts the launch keeps off the front door by adding them to the child's `NO_PROXY`. */
25925
- proxyBypass: z46.array(z46.string()).readonly(),
25962
+ proxyBypass: z47.array(z47.string()).readonly(),
25926
25963
  /** How the session's built-in statusline looks, when the launch configures any of it. */
25927
25964
  statusline: StatuslineSchema.optional()
25928
25965
  });
25929
- var LaunchResolveOutputSchema = z46.strictObject({
25966
+ var LaunchResolveOutputSchema = z47.strictObject({
25930
25967
  decision: LaunchDecisionSchema,
25931
25968
  flags: LaunchFlagsSchema,
25932
- claudeVersion: z46.strictObject({ version: z46.string(), source: z46.enum(CLAUDE_VERSION_SOURCES) }).optional(),
25969
+ claudeVersion: z47.strictObject({ version: z47.string(), source: z47.enum(CLAUDE_VERSION_SOURCES) }).optional(),
25933
25970
  /** The real `claude` binary the launch would spawn, on the door's host. */
25934
- bin: z46.string(),
25971
+ bin: z47.string(),
25935
25972
  /** The arguments the launch would pass it: the tool's own flags, then `CLAUDE_EXTRA_FLAGS`, then the caller's own. */
25936
- args: z46.readonly(z46.array(z46.string())),
25973
+ args: z47.readonly(z47.array(z47.string())),
25937
25974
  /** The credential the launch would authenticate with, by target and source kinds. Absent when none applies. */
25938
- credential: z46.strictObject({ subject: z46.enum(["provider", "identity"]), name: z46.string(), summary: CredentialSummarySchema }).optional(),
25939
- routing: z46.strictObject({ frontDoor: z46.boolean(), headroom: z46.boolean() }),
25975
+ credential: z47.strictObject({ subject: z47.enum(["provider", "identity"]), name: z47.string(), summary: CredentialSummarySchema }).optional(),
25976
+ routing: z47.strictObject({ frontDoor: z47.boolean(), headroom: z47.boolean() }),
25940
25977
  /** The names of the environment variables the launch would set or unset, sorted. Values are not reported. */
25941
- environment: z46.readonly(z46.array(z46.string())),
25942
- warnings: z46.readonly(z46.array(z46.string()))
25978
+ environment: z47.readonly(z47.array(z47.string())),
25979
+ warnings: z47.readonly(z47.array(z47.string()))
25943
25980
  });
25944
25981
 
25945
25982
  // src/frontdoor/launchApi.ts
@@ -25978,21 +26015,21 @@ init_schema3();
25978
26015
  init_cliError();
25979
26016
  import { ORPCError as ORPCError6 } from "@orpc/client";
25980
26017
  import { openapi as openapi7 } from "@orpc/openapi";
25981
- import { z as z47 } from "zod";
25982
- var AgentTreesListInputSchema = z47.strictObject({
26018
+ import { z as z48 } from "zod";
26019
+ var AgentTreesListInputSchema = z48.strictObject({
25983
26020
  /** Only this identity's sessions. */
25984
- identity: z47.string().optional(),
26021
+ identity: z48.string().optional(),
25985
26022
  /** Include sessions that spawned no agent and ran no workflow. */
25986
- all: z47.boolean().optional()
26023
+ all: z48.boolean().optional()
25987
26024
  });
25988
- var AgentTreesListOutputSchema = z47.array(SessionSummarySchema);
25989
- var AgentTreesShowInputSchema = z47.strictObject({
26025
+ var AgentTreesListOutputSchema = z48.array(SessionSummarySchema);
26026
+ var AgentTreesShowInputSchema = z48.strictObject({
25990
26027
  /** A session id, or an unambiguous prefix of one. */
25991
- session: z47.string().min(1),
26028
+ session: z48.string().min(1),
25992
26029
  /** Look only in this identity. */
25993
- identity: z47.string().optional()
26030
+ identity: z48.string().optional()
25994
26031
  });
25995
- var AgentTreesShowOutputSchema = z47.strictObject({ identities: z47.array(z47.string()), ...MergedAgentTreeSchema.shape });
26032
+ var AgentTreesShowOutputSchema = z48.strictObject({ identities: z48.array(z48.string()), ...MergedAgentTreeSchema.shape });
25996
26033
  function asBadRequest(error) {
25997
26034
  if (error instanceof CliError) {
25998
26035
  throw new ORPCError6("BAD_REQUEST", { message: error.message });
@@ -26045,7 +26082,7 @@ import { openapi as openapi8 } from "@orpc/openapi";
26045
26082
  import { eventIterator as eventIterator3, withEventMeta as withEventMeta3 } from "@orpc/server";
26046
26083
 
26047
26084
  // src/frontdoor/rcEventLog.ts
26048
- import { z as z48 } from "zod";
26085
+ import { z as z49 } from "zod";
26049
26086
 
26050
26087
  // src/frontdoor/eventHub.ts
26051
26088
  var DOOR_EVENT_BUFFER_EVENTS = 100;
@@ -26170,46 +26207,46 @@ var NUMBER_FIELDS = ["at", "sequence"].length;
26170
26207
  var BYTES_PER_CODE_UNIT = Uint16Array.BYTES_PER_ELEMENT;
26171
26208
  var RC_SESSION_END_REASONS = ["expired", "archived", "conflict"];
26172
26209
  var RC_PENDING_RETIRE_REASONS = ["answered", "withdrawn", "worker-stopped", "session-ended"];
26173
- var transitionBase = { session: z48.string(), at: z48.number() };
26174
- var cursorFields = { cursor: z48.string(), sequence: z48.int().positive() };
26175
- var sessionAppearedShape = { kind: z48.literal("session-appeared"), ...transitionBase };
26176
- var sessionEndedShape = { kind: z48.literal("session-ended"), reason: z48.enum(RC_SESSION_END_REASONS), ...transitionBase };
26177
- var workerStateShape = { kind: z48.literal("worker-state"), state: z48.string(), previous: z48.string().optional(), ...transitionBase };
26178
- var pendingBornShape = { kind: z48.literal("pending-born"), requestId: z48.string(), type: z48.string(), summary: z48.string(), ...transitionBase };
26179
- var pendingRetiredShape = { kind: z48.literal("pending-retired"), requestId: z48.string(), reason: z48.enum(RC_PENDING_RETIRE_REASONS), ...transitionBase };
26180
- var RcSessionTransitionSchema = z48.discriminatedUnion("kind", [
26181
- z48.strictObject(sessionAppearedShape),
26182
- z48.strictObject(sessionEndedShape),
26183
- z48.strictObject(workerStateShape),
26184
- z48.strictObject(pendingBornShape),
26185
- z48.strictObject(pendingRetiredShape)
26210
+ var transitionBase = { session: z49.string(), at: z49.number() };
26211
+ var cursorFields = { cursor: z49.string(), sequence: z49.int().positive() };
26212
+ var sessionAppearedShape = { kind: z49.literal("session-appeared"), ...transitionBase };
26213
+ var sessionEndedShape = { kind: z49.literal("session-ended"), reason: z49.enum(RC_SESSION_END_REASONS), ...transitionBase };
26214
+ var workerStateShape = { kind: z49.literal("worker-state"), state: z49.string(), previous: z49.string().optional(), ...transitionBase };
26215
+ var pendingBornShape = { kind: z49.literal("pending-born"), requestId: z49.string(), type: z49.string(), summary: z49.string(), ...transitionBase };
26216
+ var pendingRetiredShape = { kind: z49.literal("pending-retired"), requestId: z49.string(), reason: z49.enum(RC_PENDING_RETIRE_REASONS), ...transitionBase };
26217
+ var RcSessionTransitionSchema = z49.discriminatedUnion("kind", [
26218
+ z49.strictObject(sessionAppearedShape),
26219
+ z49.strictObject(sessionEndedShape),
26220
+ z49.strictObject(workerStateShape),
26221
+ z49.strictObject(pendingBornShape),
26222
+ z49.strictObject(pendingRetiredShape)
26186
26223
  ]);
26187
26224
  var KIND_MAX_CHARS = Math.max(...RcSessionTransitionSchema.options.map((option) => option.shape.kind.value.length));
26188
26225
  var RC_SESSION_EVENT_MAX_BYTES = (RC_SESSION_EVENT_GENERATION_MAX_CHARS + ".".length + SEQUENCE_MAX_DIGITS + RC_SESSION_EVENT_TOKEN_MAX_CHARS + KIND_MAX_CHARS + RC_SESSION_EVENT_TOKEN_MAX_CHARS + RC_SESSION_EVENT_TOKEN_MAX_CHARS + RC_SESSION_EVENT_SUMMARY_MAX_CHARS) * BYTES_PER_CODE_UNIT + NUMBER_FIELDS * NUMBER_BYTES;
26189
26226
  var RC_SESSION_EVENT_LOG_CAPACITY = Math.floor(CONTROL_BODY_CAP_BYTES / RC_SESSION_EVENT_MAX_BYTES);
26190
- var RcSessionEventSchema = z48.discriminatedUnion("kind", [
26191
- z48.strictObject({ ...cursorFields, ...sessionAppearedShape }),
26192
- z48.strictObject({ ...cursorFields, ...sessionEndedShape }),
26193
- z48.strictObject({ ...cursorFields, ...workerStateShape }),
26194
- z48.strictObject({ ...cursorFields, ...pendingBornShape }),
26195
- z48.strictObject({ ...cursorFields, ...pendingRetiredShape })
26227
+ var RcSessionEventSchema = z49.discriminatedUnion("kind", [
26228
+ z49.strictObject({ ...cursorFields, ...sessionAppearedShape }),
26229
+ z49.strictObject({ ...cursorFields, ...sessionEndedShape }),
26230
+ z49.strictObject({ ...cursorFields, ...workerStateShape }),
26231
+ z49.strictObject({ ...cursorFields, ...pendingBornShape }),
26232
+ z49.strictObject({ ...cursorFields, ...pendingRetiredShape })
26196
26233
  ]);
26197
- var RcSessionEventsReadInputSchema = z48.strictObject({
26234
+ var RcSessionEventsReadInputSchema = z49.strictObject({
26198
26235
  /** The cursor of the last event the caller saw; every retained event when omitted. */
26199
- since: z48.string().min(1).optional(),
26236
+ since: z49.string().min(1).optional(),
26200
26237
  /** One `cse_` session id; every session when omitted. */
26201
- session: z48.string().min(1).optional(),
26238
+ session: z49.string().min(1).optional(),
26202
26239
  /** The most events one answer carries; every event after `since` when omitted. */
26203
- limit: z48.int().positive().optional()
26240
+ limit: z49.int().positive().optional()
26204
26241
  });
26205
26242
  var RcSessionEventsPageInputSchema = RcSessionEventsReadInputSchema.extend({
26206
26243
  /** The most events this page carries: by default and at most, the bound the door's event backbone already holds per slow consumer (`DOOR_EVENT_BUFFER_EVENTS`, oRPC's own documented default for that case). A page lands whole in its reader, so a reader receives at most one consumer buffer's worth at a time (at worst `DOOR_EVENT_BUFFER_EVENTS` times `RC_SESSION_EVENT_MAX_BYTES`) and pages on with the cursor for more; a maximum of the whole window would let one page carry the log's entire memory budget into an agent's context. */
26207
- limit: z48.int().positive().max(DOOR_EVENT_BUFFER_EVENTS).default(DOOR_EVENT_BUFFER_EVENTS)
26244
+ limit: z49.int().positive().max(DOOR_EVENT_BUFFER_EVENTS).default(DOOR_EVENT_BUFFER_EVENTS)
26208
26245
  });
26209
26246
  var RcSessionEventsStreamInputSchema = RcSessionEventsReadInputSchema.omit({ limit: true });
26210
- var RcSessionEventsReadOutputSchema = z48.discriminatedUnion("status", [
26211
- z48.strictObject({ status: z48.literal("ok"), events: z48.readonly(z48.array(RcSessionEventSchema)), cursor: z48.string(), more: z48.boolean(), head: z48.string() }),
26212
- z48.strictObject({ status: z48.literal("expired"), message: z48.string(), head: z48.string() })
26247
+ var RcSessionEventsReadOutputSchema = z49.discriminatedUnion("status", [
26248
+ z49.strictObject({ status: z49.literal("ok"), events: z49.readonly(z49.array(RcSessionEventSchema)), cursor: z49.string(), more: z49.boolean(), head: z49.string() }),
26249
+ z49.strictObject({ status: z49.literal("expired"), message: z49.string(), head: z49.string() })
26213
26250
  ]);
26214
26251
  var CURSOR_SEPARATOR = ".";
26215
26252
  var RESYNC_ADVICE = "cursor expired, resync from status: read `rc status` for every session's present state, then resume after the head this answer names";
@@ -28422,7 +28459,7 @@ init_liveTasks();
28422
28459
  // src/agents/read.ts
28423
28460
  init_schema3();
28424
28461
  import path49 from "node:path";
28425
- import { z as z49 } from "zod";
28462
+ import { z as z50 } from "zod";
28426
28463
  var PROJECTS_DIR = "projects";
28427
28464
  var TASKS_DIR = "tasks";
28428
28465
  var SUBAGENTS_DIR = "subagents";
@@ -28541,14 +28578,14 @@ function parseJson2(text) {
28541
28578
  return void 0;
28542
28579
  }
28543
28580
  }
28544
- var TaskFileSchema = z49.object({ ...TaskItemSchema.omit({ taskList: true }).shape, blocks: z49.array(z49.string()).default([]), blockedBy: z49.array(z49.string()).default([]) });
28545
- var WorkflowRunFileSchema = z49.object({
28546
- runId: z49.string(),
28547
- workflowName: z49.string().optional(),
28548
- status: z49.string().optional(),
28549
- startTime: z49.number().optional(),
28550
- phases: z49.array(z49.object({ title: z49.string() })).default([]),
28551
- summary: z49.string().optional()
28581
+ var TaskFileSchema = z50.object({ ...TaskItemSchema.omit({ taskList: true }).shape, blocks: z50.array(z50.string()).default([]), blockedBy: z50.array(z50.string()).default([]) });
28582
+ var WorkflowRunFileSchema = z50.object({
28583
+ runId: z50.string(),
28584
+ workflowName: z50.string().optional(),
28585
+ status: z50.string().optional(),
28586
+ startTime: z50.number().optional(),
28587
+ phases: z50.array(z50.object({ title: z50.string() })).default([]),
28588
+ summary: z50.string().optional()
28552
28589
  });
28553
28590
  function summariseSession(fs17, configDir, ref) {
28554
28591
  const sessionRelative = path49.join(PROJECTS_DIR, ref.project, ref.entry);