agent-shim 14.20.1 → 14.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.cjs +125 -15
- package/dist/index.cjs +899 -862
- package/dist/index.mjs +877 -840
- package/dist/types/index.d.ts +139 -105
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -6230,6 +6230,13 @@ ${request4.rawHeaders.reduce((accumulated, value, index) => index % 2 === 0 ? `$
|
|
|
6230
6230
|
return;
|
|
6231
6231
|
}
|
|
6232
6232
|
if (host === config.routedHost && servedByPipeline(request4.url)) {
|
|
6233
|
+
const lent = ownedBySurface(request4.socket) ? void 0 : await config.rewriteForwardedAuthorization?.(host, request4, tunnelTokens.get(request4.socket));
|
|
6234
|
+
if (lent !== void 0) {
|
|
6235
|
+
request4.headers.authorization = lent.authorization;
|
|
6236
|
+
request4.url = lent.url;
|
|
6237
|
+
effects.forwardHttp(config.upstreamFor(host), request4, response, config.capture?.observePassthrough(request4));
|
|
6238
|
+
return;
|
|
6239
|
+
}
|
|
6233
6240
|
const tunnelToken = tunnelTokens.get(request4.socket);
|
|
6234
6241
|
if (tunnelToken !== void 0 && request4.headers[AUTH_HEADER] === void 0) {
|
|
6235
6242
|
request4.headers[AUTH_HEADER] = tunnelToken;
|
|
@@ -7753,14 +7760,20 @@ function rcEventWriteResultFromAnswer(answer) {
|
|
|
7753
7760
|
}
|
|
7754
7761
|
return { ok: true, sequenceNums };
|
|
7755
7762
|
}
|
|
7763
|
+
function noOAuthCredentialMessage(sessionId) {
|
|
7764
|
+
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`;
|
|
7765
|
+
}
|
|
7756
7766
|
function noOAuthCredentialResult(sessionId) {
|
|
7757
|
-
return { ok: false, message:
|
|
7767
|
+
return { ok: false, message: noOAuthCredentialMessage(sessionId), refusal: "session-state" };
|
|
7758
7768
|
}
|
|
7759
7769
|
function rcSessionNotObservedMessage(sessionId) {
|
|
7760
7770
|
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)`;
|
|
7761
7771
|
}
|
|
7762
7772
|
function rcWriteHeaders(credential) {
|
|
7763
|
-
|
|
7773
|
+
return { "content-type": "application/json", ...rcReadHeaders(credential) };
|
|
7774
|
+
}
|
|
7775
|
+
function rcReadHeaders(credential) {
|
|
7776
|
+
const headers = {};
|
|
7764
7777
|
if (credential.authorization !== void 0) {
|
|
7765
7778
|
headers.authorization = credential.authorization;
|
|
7766
7779
|
}
|
|
@@ -8019,10 +8032,11 @@ async function teleportRcSession(deps, sessionId, marker) {
|
|
|
8019
8032
|
function buildRcMarkReadBody(eventId) {
|
|
8020
8033
|
return eventId === void 0 ? {} : { event_id: eventId };
|
|
8021
8034
|
}
|
|
8022
|
-
var RC_SEND_DELIVERY_NOTE, RC_PERMISSION_MODES, RC_CONTEXT_USAGE_DETAILS, RC_READ_FILE_ENCODINGS;
|
|
8035
|
+
var import_zod12, RC_SEND_DELIVERY_NOTE, RC_PERMISSION_MODES, RC_CONTEXT_USAGE_DETAILS, RC_READ_FILE_ENCODINGS, RcSessionRecordSchema, RcSessionAnswerSchema;
|
|
8023
8036
|
var init_rcWrites = __esm({
|
|
8024
8037
|
"src/frontdoor/rcWrites.ts"() {
|
|
8025
8038
|
"use strict";
|
|
8039
|
+
import_zod12 = require("zod");
|
|
8026
8040
|
init_http();
|
|
8027
8041
|
init_rcSessions();
|
|
8028
8042
|
init_rcQuestions();
|
|
@@ -8030,6 +8044,8 @@ var init_rcWrites = __esm({
|
|
|
8030
8044
|
RC_PERMISSION_MODES = ["default", "acceptEdits", "bypassPermissions", "plan", "dontAsk", "auto"];
|
|
8031
8045
|
RC_CONTEXT_USAGE_DETAILS = ["summary", "full"];
|
|
8032
8046
|
RC_READ_FILE_ENCODINGS = ["utf-8", "base64"];
|
|
8047
|
+
RcSessionRecordSchema = import_zod12.z.looseObject({ status: import_zod12.z.string(), worker_status: import_zod12.z.string().optional(), connection_status: import_zod12.z.string().optional() });
|
|
8048
|
+
RcSessionAnswerSchema = import_zod12.z.union([import_zod12.z.looseObject({ response_shape: RcSessionRecordSchema }).transform((answer) => answer.response_shape), RcSessionRecordSchema]);
|
|
8033
8049
|
}
|
|
8034
8050
|
});
|
|
8035
8051
|
|
|
@@ -8042,200 +8058,204 @@ var init_machineLoad = __esm({
|
|
|
8042
8058
|
|
|
8043
8059
|
// src/frontdoor/rcSchemas.ts
|
|
8044
8060
|
function workerFactSchema(value) {
|
|
8045
|
-
return
|
|
8061
|
+
return import_zod13.z.strictObject({ value, observedAt: import_zod13.z.number() });
|
|
8046
8062
|
}
|
|
8047
|
-
var
|
|
8063
|
+
var import_zod13, 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;
|
|
8048
8064
|
var init_rcSchemas = __esm({
|
|
8049
8065
|
"src/frontdoor/rcSchemas.ts"() {
|
|
8050
8066
|
"use strict";
|
|
8051
|
-
|
|
8067
|
+
import_zod13 = require("zod");
|
|
8052
8068
|
init_rcWrites();
|
|
8053
|
-
RcPermissionModeSchema =
|
|
8054
|
-
RcSessionSummarySchema =
|
|
8055
|
-
id:
|
|
8056
|
-
createdAt:
|
|
8057
|
-
lastSeenAt:
|
|
8069
|
+
RcPermissionModeSchema = import_zod13.z.enum(RC_PERMISSION_MODES);
|
|
8070
|
+
RcSessionSummarySchema = import_zod13.z.strictObject({
|
|
8071
|
+
id: import_zod13.z.string(),
|
|
8072
|
+
createdAt: import_zod13.z.number(),
|
|
8073
|
+
lastSeenAt: import_zod13.z.number()
|
|
8058
8074
|
});
|
|
8059
|
-
RcQuestionOptionSchema =
|
|
8060
|
-
label:
|
|
8061
|
-
description:
|
|
8075
|
+
RcQuestionOptionSchema = import_zod13.z.strictObject({
|
|
8076
|
+
label: import_zod13.z.string(),
|
|
8077
|
+
description: import_zod13.z.string().optional()
|
|
8062
8078
|
});
|
|
8063
|
-
RcPendingQuestionSchema =
|
|
8064
|
-
question:
|
|
8065
|
-
header:
|
|
8066
|
-
multiSelect:
|
|
8067
|
-
options:
|
|
8079
|
+
RcPendingQuestionSchema = import_zod13.z.strictObject({
|
|
8080
|
+
question: import_zod13.z.string(),
|
|
8081
|
+
header: import_zod13.z.string().optional(),
|
|
8082
|
+
multiSelect: import_zod13.z.boolean(),
|
|
8083
|
+
options: import_zod13.z.readonly(import_zod13.z.array(RcQuestionOptionSchema))
|
|
8068
8084
|
});
|
|
8069
|
-
RcPendingRequestSummarySchema =
|
|
8070
|
-
sessionId:
|
|
8071
|
-
requestId:
|
|
8072
|
-
type:
|
|
8073
|
-
summary:
|
|
8074
|
-
questions:
|
|
8075
|
-
oversized:
|
|
8076
|
-
unanswerable:
|
|
8077
|
-
observedAt:
|
|
8085
|
+
RcPendingRequestSummarySchema = import_zod13.z.strictObject({
|
|
8086
|
+
sessionId: import_zod13.z.string(),
|
|
8087
|
+
requestId: import_zod13.z.string(),
|
|
8088
|
+
type: import_zod13.z.string(),
|
|
8089
|
+
summary: import_zod13.z.string(),
|
|
8090
|
+
questions: import_zod13.z.readonly(import_zod13.z.array(RcPendingQuestionSchema)).optional(),
|
|
8091
|
+
oversized: import_zod13.z.literal(true).optional(),
|
|
8092
|
+
unanswerable: import_zod13.z.string().optional(),
|
|
8093
|
+
observedAt: import_zod13.z.number()
|
|
8078
8094
|
});
|
|
8079
|
-
|
|
8095
|
+
RcServerStateSchema = import_zod13.z.discriminatedUnion("kind", [
|
|
8096
|
+
import_zod13.z.strictObject({ kind: import_zod13.z.literal("read"), status: import_zod13.z.string(), workerStatus: import_zod13.z.string().optional(), connectionStatus: import_zod13.z.string().optional() }),
|
|
8097
|
+
import_zod13.z.strictObject({ kind: import_zod13.z.literal("unknown"), reason: import_zod13.z.string() })
|
|
8098
|
+
]);
|
|
8099
|
+
RcSessionStatusSchema = import_zod13.z.strictObject({
|
|
8080
8100
|
...RcSessionSummarySchema.shape,
|
|
8081
|
-
workerState: workerFactSchema(
|
|
8082
|
-
workerIdleSeconds: workerFactSchema(
|
|
8083
|
-
pending:
|
|
8101
|
+
workerState: workerFactSchema(import_zod13.z.string()).optional(),
|
|
8102
|
+
workerIdleSeconds: workerFactSchema(import_zod13.z.number()).optional(),
|
|
8103
|
+
pending: import_zod13.z.readonly(import_zod13.z.array(RcPendingRequestSummarySchema)),
|
|
8084
8104
|
/** The identity the session runs as, when known; absent otherwise. */
|
|
8085
|
-
identity:
|
|
8105
|
+
identity: import_zod13.z.string().optional(),
|
|
8086
8106
|
/** The model the session last stated, when the door saw one. */
|
|
8087
|
-
model:
|
|
8107
|
+
model: import_zod13.z.string().optional(),
|
|
8088
8108
|
/** The session's name from the Claude Code session registry, when the registry holds it. */
|
|
8089
|
-
name:
|
|
8109
|
+
name: import_zod13.z.string().optional(),
|
|
8090
8110
|
/** The session process's id from the registry. */
|
|
8091
|
-
pid:
|
|
8111
|
+
pid: import_zod13.z.number().optional(),
|
|
8092
8112
|
/** The session's working directory, from its init event or the registry. */
|
|
8093
|
-
cwd:
|
|
8094
|
-
pendingDropped:
|
|
8113
|
+
cwd: import_zod13.z.string().optional(),
|
|
8114
|
+
pendingDropped: import_zod13.z.int().positive().optional()
|
|
8095
8115
|
});
|
|
8096
|
-
RcStreamEnvelopeSchema =
|
|
8116
|
+
RcStreamEnvelopeSchema = import_zod13.z.looseObject({
|
|
8097
8117
|
/** The envelope's own event id, when the host sent one. */
|
|
8098
|
-
event_id:
|
|
8118
|
+
event_id: import_zod13.z.string().optional(),
|
|
8099
8119
|
/** The envelope's event type, the discriminator a consumer switches on (`control_request`, `user`, and kin). */
|
|
8100
|
-
event_type:
|
|
8120
|
+
event_type: import_zod13.z.string(),
|
|
8101
8121
|
/** The sequence number the host assigned, the value a resume continues after. */
|
|
8102
|
-
sequence_num:
|
|
8122
|
+
sequence_num: import_zod13.z.int(),
|
|
8103
8123
|
/** Who emitted the event (`worker` for the CLI's half, a client id for a client's). */
|
|
8104
|
-
source:
|
|
8124
|
+
source: import_zod13.z.string(),
|
|
8105
8125
|
/** 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. */
|
|
8106
|
-
payload:
|
|
8126
|
+
payload: import_zod13.z.unknown().optional(),
|
|
8107
8127
|
/** 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. */
|
|
8108
|
-
created_at:
|
|
8128
|
+
created_at: import_zod13.z.unknown().optional()
|
|
8109
8129
|
});
|
|
8110
|
-
RcStreamEventSchema =
|
|
8111
|
-
session:
|
|
8130
|
+
RcStreamEventSchema = import_zod13.z.strictObject({
|
|
8131
|
+
session: import_zod13.z.string(),
|
|
8112
8132
|
envelope: RcStreamEnvelopeSchema
|
|
8113
8133
|
});
|
|
8114
|
-
RcRateLimitWindowSchema =
|
|
8134
|
+
RcRateLimitWindowSchema = import_zod13.z.looseObject({
|
|
8115
8135
|
/** 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). */
|
|
8116
|
-
utilization:
|
|
8136
|
+
utilization: import_zod13.z.number().optional(),
|
|
8117
8137
|
/** 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. */
|
|
8118
|
-
resetsAt:
|
|
8138
|
+
resetsAt: import_zod13.z.number().optional()
|
|
8119
8139
|
});
|
|
8120
|
-
RcRateLimitInfoSchema =
|
|
8140
|
+
RcRateLimitInfoSchema = import_zod13.z.looseObject({
|
|
8121
8141
|
/** The limiting window's own status (`allowed`, `allowed_warning`, `rejected`), asserted only as a string because the vocabulary grows with the CLI. */
|
|
8122
|
-
status:
|
|
8142
|
+
status: import_zod13.z.string(),
|
|
8123
8143
|
/** When the limiting window resets, in unix epoch seconds. */
|
|
8124
|
-
resetsAt:
|
|
8144
|
+
resetsAt: import_zod13.z.number().optional(),
|
|
8125
8145
|
/** Which window the top-level fields describe (`five_hour`, `seven_day`, and kin), the payload's own name for it. */
|
|
8126
|
-
rateLimitType:
|
|
8146
|
+
rateLimitType: import_zod13.z.string().optional(),
|
|
8127
8147
|
/** The fraction of the limiting window used, on the same scale the per-window utilizations carry. */
|
|
8128
|
-
utilization:
|
|
8148
|
+
utilization: import_zod13.z.number().optional(),
|
|
8129
8149
|
/** Whether usage beyond the plan (extra usage) is currently covering the overflow, the payload's own flag for it. */
|
|
8130
|
-
isUsingOverage:
|
|
8150
|
+
isUsingOverage: import_zod13.z.boolean().optional(),
|
|
8131
8151
|
/** The overage's own status, the same vocabulary the limiting window's `status` carries. */
|
|
8132
|
-
overageStatus:
|
|
8152
|
+
overageStatus: import_zod13.z.string().optional(),
|
|
8133
8153
|
/** When the overage window resets, in unix epoch seconds. */
|
|
8134
|
-
overageResetsAt:
|
|
8154
|
+
overageResetsAt: import_zod13.z.number().optional(),
|
|
8135
8155
|
/** 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. */
|
|
8136
|
-
unifiedWindows:
|
|
8156
|
+
unifiedWindows: import_zod13.z.looseObject({ five_hour: RcRateLimitWindowSchema.optional(), seven_day: RcRateLimitWindowSchema.optional(), seven_day_overage_included: RcRateLimitWindowSchema.optional() }).optional()
|
|
8137
8157
|
});
|
|
8138
|
-
RcLiveRateLimitSchema =
|
|
8139
|
-
session:
|
|
8140
|
-
observedAt:
|
|
8158
|
+
RcLiveRateLimitSchema = import_zod13.z.strictObject({
|
|
8159
|
+
session: import_zod13.z.string(),
|
|
8160
|
+
observedAt: import_zod13.z.number(),
|
|
8141
8161
|
rateLimit: RcRateLimitInfoSchema
|
|
8142
8162
|
});
|
|
8143
|
-
RcSessionQuerySchema =
|
|
8144
|
-
session:
|
|
8163
|
+
RcSessionQuerySchema = import_zod13.z.strictObject({
|
|
8164
|
+
session: import_zod13.z.string().min(1).optional()
|
|
8145
8165
|
});
|
|
8146
|
-
RcSendInputSchema =
|
|
8147
|
-
session:
|
|
8148
|
-
text:
|
|
8166
|
+
RcSendInputSchema = import_zod13.z.strictObject({
|
|
8167
|
+
session: import_zod13.z.string().min(1),
|
|
8168
|
+
text: import_zod13.z.string().min(1)
|
|
8149
8169
|
});
|
|
8150
|
-
RcQuestionSelectionSchema =
|
|
8151
|
-
RcQuestionChoicesSchema =
|
|
8152
|
-
RcAnswerInputSchema =
|
|
8153
|
-
session:
|
|
8154
|
-
request:
|
|
8155
|
-
approve:
|
|
8156
|
-
text:
|
|
8170
|
+
RcQuestionSelectionSchema = import_zod13.z.union([import_zod13.z.string().min(1), import_zod13.z.int().positive(), import_zod13.z.strictObject({ text: import_zod13.z.string().refine((text) => text.trim() !== "", { message: "free text must not be blank" }) })]);
|
|
8171
|
+
RcQuestionChoicesSchema = import_zod13.z.array(import_zod13.z.array(RcQuestionSelectionSchema).min(1)).min(1);
|
|
8172
|
+
RcAnswerInputSchema = import_zod13.z.strictObject({
|
|
8173
|
+
session: import_zod13.z.string().min(1),
|
|
8174
|
+
request: import_zod13.z.string().min(1),
|
|
8175
|
+
approve: import_zod13.z.boolean(),
|
|
8176
|
+
text: import_zod13.z.string().optional(),
|
|
8157
8177
|
choices: RcQuestionChoicesSchema.optional()
|
|
8158
8178
|
}).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" });
|
|
8159
|
-
RcInterruptInputSchema =
|
|
8160
|
-
session:
|
|
8179
|
+
RcInterruptInputSchema = import_zod13.z.strictObject({
|
|
8180
|
+
session: import_zod13.z.string().min(1)
|
|
8161
8181
|
});
|
|
8162
|
-
RcSetModelInputSchema =
|
|
8163
|
-
session:
|
|
8164
|
-
model:
|
|
8182
|
+
RcSetModelInputSchema = import_zod13.z.strictObject({
|
|
8183
|
+
session: import_zod13.z.string().min(1),
|
|
8184
|
+
model: import_zod13.z.string().min(1)
|
|
8165
8185
|
});
|
|
8166
|
-
RcSetPermissionModeInputSchema =
|
|
8167
|
-
session:
|
|
8186
|
+
RcSetPermissionModeInputSchema = import_zod13.z.strictObject({
|
|
8187
|
+
session: import_zod13.z.string().min(1),
|
|
8168
8188
|
mode: RcPermissionModeSchema
|
|
8169
8189
|
});
|
|
8170
|
-
RcEndSessionInputSchema =
|
|
8171
|
-
session:
|
|
8172
|
-
reason:
|
|
8190
|
+
RcEndSessionInputSchema = import_zod13.z.strictObject({
|
|
8191
|
+
session: import_zod13.z.string().min(1),
|
|
8192
|
+
reason: import_zod13.z.string().min(1).optional()
|
|
8173
8193
|
});
|
|
8174
|
-
RcGetUsageInputSchema =
|
|
8175
|
-
session:
|
|
8176
|
-
skipBehaviors:
|
|
8194
|
+
RcGetUsageInputSchema = import_zod13.z.strictObject({
|
|
8195
|
+
session: import_zod13.z.string().min(1),
|
|
8196
|
+
skipBehaviors: import_zod13.z.boolean().optional()
|
|
8177
8197
|
});
|
|
8178
|
-
RcGetContextUsageInputSchema =
|
|
8179
|
-
session:
|
|
8180
|
-
detail:
|
|
8198
|
+
RcGetContextUsageInputSchema = import_zod13.z.strictObject({
|
|
8199
|
+
session: import_zod13.z.string().min(1),
|
|
8200
|
+
detail: import_zod13.z.enum(RC_CONTEXT_USAGE_DETAILS).optional()
|
|
8181
8201
|
});
|
|
8182
|
-
RcReadFileInputSchema =
|
|
8183
|
-
session:
|
|
8184
|
-
path:
|
|
8185
|
-
maxBytes:
|
|
8186
|
-
encoding:
|
|
8202
|
+
RcReadFileInputSchema = import_zod13.z.strictObject({
|
|
8203
|
+
session: import_zod13.z.string().min(1),
|
|
8204
|
+
path: import_zod13.z.string().min(1),
|
|
8205
|
+
maxBytes: import_zod13.z.number().int().positive().optional(),
|
|
8206
|
+
encoding: import_zod13.z.enum(RC_READ_FILE_ENCODINGS).optional()
|
|
8187
8207
|
});
|
|
8188
|
-
RcFileSuggestionsInputSchema =
|
|
8189
|
-
session:
|
|
8190
|
-
query:
|
|
8208
|
+
RcFileSuggestionsInputSchema = import_zod13.z.strictObject({
|
|
8209
|
+
session: import_zod13.z.string().min(1),
|
|
8210
|
+
query: import_zod13.z.string()
|
|
8191
8211
|
});
|
|
8192
|
-
RcKeepAliveInputSchema =
|
|
8193
|
-
session:
|
|
8212
|
+
RcKeepAliveInputSchema = import_zod13.z.strictObject({
|
|
8213
|
+
session: import_zod13.z.string().min(1)
|
|
8194
8214
|
});
|
|
8195
|
-
RcMcpStatusInputSchema =
|
|
8196
|
-
session:
|
|
8215
|
+
RcMcpStatusInputSchema = import_zod13.z.strictObject({
|
|
8216
|
+
session: import_zod13.z.string().min(1)
|
|
8197
8217
|
});
|
|
8198
|
-
RcMcpReconnectInputSchema =
|
|
8199
|
-
session:
|
|
8200
|
-
serverName:
|
|
8218
|
+
RcMcpReconnectInputSchema = import_zod13.z.strictObject({
|
|
8219
|
+
session: import_zod13.z.string().min(1),
|
|
8220
|
+
serverName: import_zod13.z.string().min(1)
|
|
8201
8221
|
});
|
|
8202
|
-
RcMcpAuthenticateInputSchema =
|
|
8203
|
-
session:
|
|
8204
|
-
serverName:
|
|
8205
|
-
redirectUri:
|
|
8222
|
+
RcMcpAuthenticateInputSchema = import_zod13.z.strictObject({
|
|
8223
|
+
session: import_zod13.z.string().min(1),
|
|
8224
|
+
serverName: import_zod13.z.string().min(1),
|
|
8225
|
+
redirectUri: import_zod13.z.string().min(1)
|
|
8206
8226
|
});
|
|
8207
|
-
RcMcpOAuthCallbackUrlInputSchema =
|
|
8208
|
-
session:
|
|
8209
|
-
serverName:
|
|
8210
|
-
callbackUrl:
|
|
8227
|
+
RcMcpOAuthCallbackUrlInputSchema = import_zod13.z.strictObject({
|
|
8228
|
+
session: import_zod13.z.string().min(1),
|
|
8229
|
+
serverName: import_zod13.z.string().min(1),
|
|
8230
|
+
callbackUrl: import_zod13.z.string().min(1)
|
|
8211
8231
|
});
|
|
8212
|
-
RcTeleportInputSchema =
|
|
8213
|
-
session:
|
|
8214
|
-
marker:
|
|
8232
|
+
RcTeleportInputSchema = import_zod13.z.strictObject({
|
|
8233
|
+
session: import_zod13.z.string().min(1),
|
|
8234
|
+
marker: import_zod13.z.string().min(1)
|
|
8215
8235
|
});
|
|
8216
|
-
RcListOutputSchema =
|
|
8217
|
-
RcSessionCommandRouteSchema =
|
|
8218
|
-
RcVersionGateWarningsSchema =
|
|
8219
|
-
RcSessionRouteSchema =
|
|
8220
|
-
RcStatusOutputSchema =
|
|
8221
|
-
RcPendingOutputSchema =
|
|
8222
|
-
pending:
|
|
8236
|
+
RcListOutputSchema = import_zod13.z.strictObject({ sessions: import_zod13.z.readonly(import_zod13.z.array(RcSessionSummarySchema)) });
|
|
8237
|
+
RcSessionCommandRouteSchema = import_zod13.z.enum(["supervised", "launched", "self-hosted"]);
|
|
8238
|
+
RcVersionGateWarningsSchema = import_zod13.z.readonly(import_zod13.z.array(import_zod13.z.string()).min(1)).optional();
|
|
8239
|
+
RcSessionRouteSchema = import_zod13.z.union([import_zod13.z.strictObject({ route: RcSessionCommandRouteSchema, warnings: RcVersionGateWarningsSchema }), import_zod13.z.strictObject({ route: import_zod13.z.null(), refused: import_zod13.z.string() })]);
|
|
8240
|
+
RcStatusOutputSchema = import_zod13.z.strictObject({ statuses: import_zod13.z.readonly(import_zod13.z.array(import_zod13.z.strictObject({ ...RcSessionStatusSchema.shape, route: RcSessionRouteSchema, serverState: RcServerStateSchema }))) });
|
|
8241
|
+
RcPendingOutputSchema = import_zod13.z.strictObject({
|
|
8242
|
+
pending: import_zod13.z.readonly(import_zod13.z.array(RcPendingRequestSummarySchema)),
|
|
8223
8243
|
/** 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. */
|
|
8224
|
-
dropped:
|
|
8244
|
+
dropped: import_zod13.z.readonly(import_zod13.z.array(import_zod13.z.strictObject({ sessionId: import_zod13.z.string(), count: import_zod13.z.int().positive() }))).optional()
|
|
8225
8245
|
});
|
|
8226
|
-
RcWriteOutputSchema =
|
|
8227
|
-
session:
|
|
8228
|
-
sequenceNums:
|
|
8246
|
+
RcWriteOutputSchema = import_zod13.z.strictObject({
|
|
8247
|
+
session: import_zod13.z.string(),
|
|
8248
|
+
sequenceNums: import_zod13.z.readonly(import_zod13.z.array(import_zod13.z.number()))
|
|
8229
8249
|
});
|
|
8230
|
-
RcControlWriteOutputSchema =
|
|
8231
|
-
session:
|
|
8232
|
-
request:
|
|
8233
|
-
sequenceNums:
|
|
8250
|
+
RcControlWriteOutputSchema = import_zod13.z.strictObject({
|
|
8251
|
+
session: import_zod13.z.string(),
|
|
8252
|
+
request: import_zod13.z.string(),
|
|
8253
|
+
sequenceNums: import_zod13.z.readonly(import_zod13.z.array(import_zod13.z.number()))
|
|
8234
8254
|
});
|
|
8235
|
-
RcAnswerOutputSchema =
|
|
8236
|
-
session:
|
|
8237
|
-
request:
|
|
8238
|
-
sequenceNums:
|
|
8255
|
+
RcAnswerOutputSchema = import_zod13.z.strictObject({
|
|
8256
|
+
session: import_zod13.z.string(),
|
|
8257
|
+
request: import_zod13.z.string(),
|
|
8258
|
+
sequenceNums: import_zod13.z.readonly(import_zod13.z.array(import_zod13.z.number()))
|
|
8239
8259
|
});
|
|
8240
8260
|
}
|
|
8241
8261
|
});
|
|
@@ -9028,14 +9048,14 @@ function tlsFacts(options) {
|
|
|
9028
9048
|
}
|
|
9029
9049
|
function realRcEventDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_PORT }) {
|
|
9030
9050
|
const agent = new ExemptTlsAgent();
|
|
9031
|
-
const
|
|
9051
|
+
const send = async (method, path59, headers, body) => await new Promise((resolve, reject) => {
|
|
9032
9052
|
const options = {
|
|
9033
9053
|
host: target.host,
|
|
9034
9054
|
port: target.port,
|
|
9035
|
-
method
|
|
9055
|
+
method,
|
|
9036
9056
|
path: path59,
|
|
9037
9057
|
// 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.
|
|
9038
|
-
headers: { ...headers, host: target.servername ?? target.host, "content-length": String(Buffer.byteLength(body, "utf8")) },
|
|
9058
|
+
headers: { ...headers, host: target.servername ?? target.host, ...body === void 0 ? {} : { "content-length": String(Buffer.byteLength(body, "utf8")) } },
|
|
9039
9059
|
agent
|
|
9040
9060
|
};
|
|
9041
9061
|
options.servername = target.servername ?? target.host;
|
|
@@ -9055,9 +9075,15 @@ function realRcEventDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_PO
|
|
|
9055
9075
|
});
|
|
9056
9076
|
});
|
|
9057
9077
|
request4.once("error", reject);
|
|
9058
|
-
|
|
9078
|
+
if (body === void 0) {
|
|
9079
|
+
request4.end();
|
|
9080
|
+
} else {
|
|
9081
|
+
request4.end(body);
|
|
9082
|
+
}
|
|
9059
9083
|
});
|
|
9084
|
+
const post = async (path59, headers, body) => await send("POST", path59, headers, body);
|
|
9060
9085
|
return {
|
|
9086
|
+
readSession: async (sessionId, headers) => await send("GET", `/v1/code/sessions/${encodeURIComponent(sessionId)}`, headers, void 0),
|
|
9061
9087
|
writeEvents: async (sessionId, headers, body) => await post(`/v1/code/sessions/${encodeURIComponent(sessionId)}/events`, headers, body),
|
|
9062
9088
|
writeTeleportEvents: async (sessionId, headers, body) => await post(`/v1/code/sessions/${encodeURIComponent(sessionId)}/teleport-events`, headers, body)
|
|
9063
9089
|
};
|
|
@@ -9073,7 +9099,8 @@ function lateRcEventDial(resolve) {
|
|
|
9073
9099
|
};
|
|
9074
9100
|
return {
|
|
9075
9101
|
writeEvents: async (sessionId, headers, body) => await dialFor().writeEvents(sessionId, headers, body),
|
|
9076
|
-
writeTeleportEvents: async (sessionId, headers, body) => await dialFor().writeTeleportEvents(sessionId, headers, body)
|
|
9102
|
+
writeTeleportEvents: async (sessionId, headers, body) => await dialFor().writeTeleportEvents(sessionId, headers, body),
|
|
9103
|
+
readSession: async (sessionId, headers) => await dialFor().readSession(sessionId, headers)
|
|
9077
9104
|
};
|
|
9078
9105
|
}
|
|
9079
9106
|
function lateRcStreamDial(resolve) {
|
|
@@ -9649,46 +9676,46 @@ function acceptsNull(path59) {
|
|
|
9649
9676
|
return StatuslineSchema.safeParse(layer).success;
|
|
9650
9677
|
}
|
|
9651
9678
|
function keyOf(path59, declared) {
|
|
9652
|
-
const optional = declared instanceof
|
|
9679
|
+
const optional = declared instanceof import_zod14.z.ZodOptional;
|
|
9653
9680
|
const leaf = optional ? declared.unwrap() : declared;
|
|
9654
9681
|
const common = { path: path59.join("."), description: declared.description ?? "", defaultValue: valueAt(STATUSLINE_DEFAULTS, path59), optional, unsettable: acceptsNull(path59) };
|
|
9655
|
-
if (leaf instanceof
|
|
9682
|
+
if (leaf instanceof import_zod14.z.ZodNumber) {
|
|
9656
9683
|
return { ...common, kind: "integer", choices: [] };
|
|
9657
9684
|
}
|
|
9658
|
-
if (leaf instanceof
|
|
9685
|
+
if (leaf instanceof import_zod14.z.ZodBoolean) {
|
|
9659
9686
|
return { ...common, kind: "boolean", choices: [] };
|
|
9660
9687
|
}
|
|
9661
|
-
if (leaf instanceof
|
|
9688
|
+
if (leaf instanceof import_zod14.z.ZodString) {
|
|
9662
9689
|
return { ...common, kind: "text", choices: [] };
|
|
9663
9690
|
}
|
|
9664
|
-
if (leaf instanceof
|
|
9691
|
+
if (leaf instanceof import_zod14.z.ZodUnion) {
|
|
9665
9692
|
return { ...common, kind: "colour", choices: [...STATUSLINE_COLOUR_NAMES] };
|
|
9666
9693
|
}
|
|
9667
|
-
if (leaf instanceof
|
|
9694
|
+
if (leaf instanceof import_zod14.z.ZodEnum) {
|
|
9668
9695
|
return { ...common, kind: "choice", choices: Object.values(leaf.enum).map(String) };
|
|
9669
9696
|
}
|
|
9670
|
-
if (leaf instanceof
|
|
9697
|
+
if (leaf instanceof import_zod14.z.ZodArray && leaf.element instanceof import_zod14.z.ZodEnum) {
|
|
9671
9698
|
return { ...common, kind: "list", choices: Object.values(leaf.element.enum).map(String) };
|
|
9672
9699
|
}
|
|
9673
|
-
if (leaf instanceof
|
|
9700
|
+
if (leaf instanceof import_zod14.z.ZodArray && leaf.element instanceof import_zod14.z.ZodArray && leaf.element.element instanceof import_zod14.z.ZodEnum) {
|
|
9674
9701
|
return { ...common, kind: "groups", choices: Object.values(leaf.element.element.enum).map(String) };
|
|
9675
9702
|
}
|
|
9676
|
-
if (leaf instanceof
|
|
9703
|
+
if (leaf instanceof import_zod14.z.ZodArray && leaf.element instanceof import_zod14.z.ZodString) {
|
|
9677
9704
|
return { ...common, kind: "textList", choices: [] };
|
|
9678
9705
|
}
|
|
9679
9706
|
throw new TypeError(`statusline setting ${path59.join(".")} has a kind the key listing does not describe`);
|
|
9680
9707
|
}
|
|
9681
9708
|
function walk(shape, prefix) {
|
|
9682
|
-
return Object.entries(shape).flatMap(([name, schema]) => schema instanceof
|
|
9709
|
+
return Object.entries(shape).flatMap(([name, schema]) => schema instanceof import_zod14.z.ZodObject ? walk(schema.shape, [...prefix, name]) : [keyOf([...prefix, name], schema)]);
|
|
9683
9710
|
}
|
|
9684
9711
|
function statuslineKeys() {
|
|
9685
9712
|
return walk(ResolvedStatuslineSchema.shape, []);
|
|
9686
9713
|
}
|
|
9687
|
-
var
|
|
9714
|
+
var import_zod14;
|
|
9688
9715
|
var init_keys = __esm({
|
|
9689
9716
|
"src/statusline/keys.ts"() {
|
|
9690
9717
|
"use strict";
|
|
9691
|
-
|
|
9718
|
+
import_zod14 = require("zod");
|
|
9692
9719
|
init_statusline();
|
|
9693
9720
|
init_ownEntry();
|
|
9694
9721
|
}
|
|
@@ -10492,18 +10519,18 @@ function withoutInjected(env) {
|
|
|
10492
10519
|
});
|
|
10493
10520
|
return Object.fromEntries(entries);
|
|
10494
10521
|
}
|
|
10495
|
-
var import_node_crypto8,
|
|
10522
|
+
var import_node_crypto8, import_zod15, INJECTED_ENV, CUSTOM_HEADERS_ENV, HEADER_KEY_PREFIX, InjectedSchema;
|
|
10496
10523
|
var init_injected = __esm({
|
|
10497
10524
|
"src/launcher/injected.ts"() {
|
|
10498
10525
|
"use strict";
|
|
10499
10526
|
import_node_crypto8 = require("node:crypto");
|
|
10500
|
-
|
|
10527
|
+
import_zod15 = require("zod");
|
|
10501
10528
|
init_headers();
|
|
10502
10529
|
init_ownEntry();
|
|
10503
10530
|
INJECTED_ENV = "AGENT_SHIM_INJECTED";
|
|
10504
10531
|
CUSTOM_HEADERS_ENV = "ANTHROPIC_CUSTOM_HEADERS";
|
|
10505
10532
|
HEADER_KEY_PREFIX = `${CUSTOM_HEADERS_ENV}:`;
|
|
10506
|
-
InjectedSchema =
|
|
10533
|
+
InjectedSchema = import_zod15.z.record(import_zod15.z.string(), import_zod15.z.string());
|
|
10507
10534
|
}
|
|
10508
10535
|
});
|
|
10509
10536
|
|
|
@@ -11154,40 +11181,40 @@ function readStartLock(fs17, lockFile) {
|
|
|
11154
11181
|
return void 0;
|
|
11155
11182
|
}
|
|
11156
11183
|
}
|
|
11157
|
-
var import_node_crypto11, import_node_path21,
|
|
11184
|
+
var import_node_crypto11, import_node_path21, import_zod16, HeadroomStateSchema, HeadroomSessionSchema, HeadroomLockSchema, HEADROOM_ALLOWLIST_FILE_FLAG, ALLOWLIST_LINE_BREAKS, ALLOWLIST_WHITESPACE, ALLOWLIST_FILE_SEPARATORS, ALLOWLIST_FILE_COMMENT, ALLOWLIST_ENTRY_WHITESPACE, ALLOWLIST_SURROUNDING_WHITESPACE, ALLOWLIST_SAFE_SCHEMES;
|
|
11158
11185
|
var init_state2 = __esm({
|
|
11159
11186
|
"src/headroom/state.ts"() {
|
|
11160
11187
|
"use strict";
|
|
11161
11188
|
import_node_crypto11 = require("node:crypto");
|
|
11162
11189
|
import_node_path21 = __toESM(require("node:path"), 1);
|
|
11163
|
-
|
|
11190
|
+
import_zod16 = require("zod");
|
|
11164
11191
|
init_schema();
|
|
11165
|
-
HeadroomStateSchema =
|
|
11192
|
+
HeadroomStateSchema = import_zod16.z.strictObject({
|
|
11166
11193
|
/** The supervisor process owning the daemon. Alive means someone is keeping headroom running. */
|
|
11167
|
-
supervisorPid:
|
|
11194
|
+
supervisorPid: import_zod16.z.number().int().positive().optional(),
|
|
11168
11195
|
/** 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. */
|
|
11169
|
-
headroomPid:
|
|
11196
|
+
headroomPid: import_zod16.z.number().int().positive().optional(),
|
|
11170
11197
|
/**
|
|
11171
11198
|
* 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.
|
|
11172
11199
|
*/
|
|
11173
|
-
socketPath:
|
|
11200
|
+
socketPath: import_zod16.z.string().min(1).optional(),
|
|
11174
11201
|
/** The `headroom --version` output of the running install. */
|
|
11175
|
-
version:
|
|
11202
|
+
version: import_zod16.z.string().optional(),
|
|
11176
11203
|
/**
|
|
11177
11204
|
* 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`).
|
|
11178
11205
|
*/
|
|
11179
|
-
allowlistHash:
|
|
11206
|
+
allowlistHash: import_zod16.z.string().optional(),
|
|
11180
11207
|
/** Hash of the token-saving settings the running proxy was started with, so a settings change is detected as drift. */
|
|
11181
|
-
settingsHash:
|
|
11208
|
+
settingsHash: import_zod16.z.string().optional(),
|
|
11182
11209
|
/** The install spec the running install was last installed from, so a `source` config change is detected as drift. */
|
|
11183
|
-
installedSource:
|
|
11210
|
+
installedSource: import_zod16.z.string().optional(),
|
|
11184
11211
|
/** 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. */
|
|
11185
|
-
installing:
|
|
11212
|
+
installing: import_zod16.z.string().optional(),
|
|
11186
11213
|
/** The last fatal error, kept across shutdowns so `headroom status` can explain a daemon that is not running. */
|
|
11187
|
-
lastError:
|
|
11214
|
+
lastError: import_zod16.z.string().optional()
|
|
11188
11215
|
});
|
|
11189
|
-
HeadroomSessionSchema =
|
|
11190
|
-
HeadroomLockSchema =
|
|
11216
|
+
HeadroomSessionSchema = import_zod16.z.strictObject({ pid: import_zod16.z.number().int().positive(), startedAt: import_zod16.z.number(), supervisorPid: import_zod16.z.number().int().positive() });
|
|
11217
|
+
HeadroomLockSchema = import_zod16.z.strictObject({ pid: import_zod16.z.number().int().positive(), at: import_zod16.z.number() });
|
|
11191
11218
|
HEADROOM_ALLOWLIST_FILE_FLAG = "--allowed-base-urls-file";
|
|
11192
11219
|
ALLOWLIST_LINE_BREAKS = "\\n\\r\\u000b\\u000c\\u001c\\u001d\\u001e\\u0085\\u2028\\u2029";
|
|
11193
11220
|
ALLOWLIST_WHITESPACE = "\\t\\n\\u000b\\u000c\\r\\u001c-\\u001f \\u0085\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000";
|
|
@@ -11627,14 +11654,14 @@ function pinnedGitCommit(spec) {
|
|
|
11627
11654
|
const ref = GIT_SPEC_RE.exec(spec)?.[1];
|
|
11628
11655
|
return ref !== void 0 && COMMIT_SHA_RE.test(ref) ? ref.toLowerCase() : void 0;
|
|
11629
11656
|
}
|
|
11630
|
-
var
|
|
11657
|
+
var import_zod17, GIT_SPEC_RE, COMMIT_SHA_RE, DirectUrlSchema;
|
|
11631
11658
|
var init_source = __esm({
|
|
11632
11659
|
"src/headroom/source.ts"() {
|
|
11633
11660
|
"use strict";
|
|
11634
|
-
|
|
11661
|
+
import_zod17 = require("zod");
|
|
11635
11662
|
GIT_SPEC_RE = /git\+[^@\s]+(?:@([^\s#]+))?/;
|
|
11636
11663
|
COMMIT_SHA_RE = /^[0-9a-f]{40}$/i;
|
|
11637
|
-
DirectUrlSchema =
|
|
11664
|
+
DirectUrlSchema = import_zod17.z.object({ vcs_info: import_zod17.z.object({ commit_id: import_zod17.z.string() }) });
|
|
11638
11665
|
}
|
|
11639
11666
|
});
|
|
11640
11667
|
|
|
@@ -13296,32 +13323,32 @@ var init_storedCatalogue = __esm({
|
|
|
13296
13323
|
});
|
|
13297
13324
|
|
|
13298
13325
|
// src/routeOverridesSchema.ts
|
|
13299
|
-
var
|
|
13326
|
+
var import_zod18, OverrideTableSchema, RouteOverridesSchema, RepairableTableSchema, RepairableRouteOverridesSchema;
|
|
13300
13327
|
var init_routeOverridesSchema = __esm({
|
|
13301
13328
|
"src/routeOverridesSchema.ts"() {
|
|
13302
13329
|
"use strict";
|
|
13303
|
-
|
|
13304
|
-
OverrideTableSchema =
|
|
13305
|
-
RouteOverridesSchema =
|
|
13306
|
-
$schema:
|
|
13307
|
-
schemaVersion:
|
|
13330
|
+
import_zod18 = require("zod");
|
|
13331
|
+
OverrideTableSchema = import_zod18.z.record(import_zod18.z.string().min(1), import_zod18.z.string().min(1));
|
|
13332
|
+
RouteOverridesSchema = import_zod18.z.strictObject({
|
|
13333
|
+
$schema: import_zod18.z.string().optional(),
|
|
13334
|
+
schemaVersion: import_zod18.z.literal(1),
|
|
13308
13335
|
/** Every session with no entry of its own for the name. */
|
|
13309
13336
|
global: OverrideTableSchema.optional(),
|
|
13310
13337
|
/** By provider name: the sessions whose request would reach that provider. */
|
|
13311
|
-
providers:
|
|
13338
|
+
providers: import_zod18.z.record(import_zod18.z.string().min(1), OverrideTableSchema).optional(),
|
|
13312
13339
|
/** By identity name: the sessions running as that identity. */
|
|
13313
|
-
identities:
|
|
13340
|
+
identities: import_zod18.z.record(import_zod18.z.string().min(1), OverrideTableSchema).optional(),
|
|
13314
13341
|
/** By launch session id: one session. */
|
|
13315
|
-
sessions:
|
|
13342
|
+
sessions: import_zod18.z.record(import_zod18.z.string().min(1), OverrideTableSchema).optional()
|
|
13316
13343
|
});
|
|
13317
|
-
RepairableTableSchema =
|
|
13318
|
-
RepairableRouteOverridesSchema =
|
|
13319
|
-
$schema:
|
|
13320
|
-
schemaVersion:
|
|
13344
|
+
RepairableTableSchema = import_zod18.z.record(import_zod18.z.string(), import_zod18.z.string());
|
|
13345
|
+
RepairableRouteOverridesSchema = import_zod18.z.strictObject({
|
|
13346
|
+
$schema: import_zod18.z.string().optional(),
|
|
13347
|
+
schemaVersion: import_zod18.z.literal(1),
|
|
13321
13348
|
global: RepairableTableSchema.optional(),
|
|
13322
|
-
providers:
|
|
13323
|
-
identities:
|
|
13324
|
-
sessions:
|
|
13349
|
+
providers: import_zod18.z.record(import_zod18.z.string(), RepairableTableSchema).optional(),
|
|
13350
|
+
identities: import_zod18.z.record(import_zod18.z.string(), RepairableTableSchema).optional(),
|
|
13351
|
+
sessions: import_zod18.z.record(import_zod18.z.string(), RepairableTableSchema).optional()
|
|
13325
13352
|
});
|
|
13326
13353
|
}
|
|
13327
13354
|
});
|
|
@@ -13714,24 +13741,24 @@ function planOf(account) {
|
|
|
13714
13741
|
function planOfProviderQuota(quota) {
|
|
13715
13742
|
return planOf(quota?.level === void 0 ? void 0 : { organizationRateLimitTier: quota.level });
|
|
13716
13743
|
}
|
|
13717
|
-
var
|
|
13744
|
+
var import_zod19, PlanClassSchema, TIER_MULTIPLIER, ZERO_TIER, BASE_TIER;
|
|
13718
13745
|
var init_plan2 = __esm({
|
|
13719
13746
|
"src/usage/plan.ts"() {
|
|
13720
13747
|
"use strict";
|
|
13721
|
-
|
|
13722
|
-
PlanClassSchema =
|
|
13723
|
-
|
|
13724
|
-
kind:
|
|
13748
|
+
import_zod19 = require("zod");
|
|
13749
|
+
PlanClassSchema = import_zod19.z.union([
|
|
13750
|
+
import_zod19.z.strictObject({
|
|
13751
|
+
kind: import_zod19.z.literal("subscription"),
|
|
13725
13752
|
/** The plan's size as a multiple of the smallest subscription tier (Max is 5, Ultra is 20). */
|
|
13726
|
-
capacity:
|
|
13753
|
+
capacity: import_zod19.z.number().positive(),
|
|
13727
13754
|
/** False when the tier string named no multiplier and no tier this project knows, so `capacity` is the neutral 1 rather than a reading. */
|
|
13728
|
-
recognised:
|
|
13755
|
+
recognised: import_zod19.z.boolean(),
|
|
13729
13756
|
/** The tier string the classification rests on, when the account had one. */
|
|
13730
|
-
tier:
|
|
13757
|
+
tier: import_zod19.z.string().optional()
|
|
13731
13758
|
}),
|
|
13732
|
-
|
|
13733
|
-
kind:
|
|
13734
|
-
tier:
|
|
13759
|
+
import_zod19.z.strictObject({
|
|
13760
|
+
kind: import_zod19.z.literal("pay-per-use"),
|
|
13761
|
+
tier: import_zod19.z.string().optional()
|
|
13735
13762
|
})
|
|
13736
13763
|
]);
|
|
13737
13764
|
TIER_MULTIPLIER = /(?:^|_)(\d+)x$/;
|
|
@@ -13741,21 +13768,21 @@ var init_plan2 = __esm({
|
|
|
13741
13768
|
});
|
|
13742
13769
|
|
|
13743
13770
|
// src/usage/scan.ts
|
|
13744
|
-
var
|
|
13771
|
+
var import_zod20, AnthropicUsageSchema, ErrorObjectSchema;
|
|
13745
13772
|
var init_scan = __esm({
|
|
13746
13773
|
"src/usage/scan.ts"() {
|
|
13747
13774
|
"use strict";
|
|
13748
|
-
|
|
13749
|
-
AnthropicUsageSchema =
|
|
13750
|
-
input_tokens:
|
|
13751
|
-
output_tokens:
|
|
13752
|
-
cache_creation_input_tokens:
|
|
13753
|
-
cache_read_input_tokens:
|
|
13775
|
+
import_zod20 = require("zod");
|
|
13776
|
+
AnthropicUsageSchema = import_zod20.z.looseObject({
|
|
13777
|
+
input_tokens: import_zod20.z.number().int().nonnegative().nullish(),
|
|
13778
|
+
output_tokens: import_zod20.z.number().int().nonnegative().nullish(),
|
|
13779
|
+
cache_creation_input_tokens: import_zod20.z.number().int().nonnegative().nullish(),
|
|
13780
|
+
cache_read_input_tokens: import_zod20.z.number().int().nonnegative().nullish()
|
|
13754
13781
|
});
|
|
13755
|
-
ErrorObjectSchema =
|
|
13756
|
-
type:
|
|
13757
|
-
code:
|
|
13758
|
-
message:
|
|
13782
|
+
ErrorObjectSchema = import_zod20.z.looseObject({
|
|
13783
|
+
type: import_zod20.z.string().optional(),
|
|
13784
|
+
code: import_zod20.z.union([import_zod20.z.string(), import_zod20.z.number()]).optional(),
|
|
13785
|
+
message: import_zod20.z.string().optional()
|
|
13759
13786
|
});
|
|
13760
13787
|
}
|
|
13761
13788
|
});
|
|
@@ -14487,12 +14514,12 @@ function recordStickyPick(fs17, picksFile, directory, identity, nowMs) {
|
|
|
14487
14514
|
fs17.writeFilePrivate(picksFile, `${JSON.stringify(next, null, 2)}
|
|
14488
14515
|
`);
|
|
14489
14516
|
}
|
|
14490
|
-
var import_node_path27,
|
|
14517
|
+
var import_node_path27, import_zod21, PoolGraphError, SCHEMA_VERSION, PickEntrySchema, PicksFileSchema;
|
|
14491
14518
|
var init_poolPick = __esm({
|
|
14492
14519
|
"src/usage/poolPick.ts"() {
|
|
14493
14520
|
"use strict";
|
|
14494
14521
|
import_node_path27 = __toESM(require("node:path"), 1);
|
|
14495
|
-
|
|
14522
|
+
import_zod21 = require("zod");
|
|
14496
14523
|
init_cliError();
|
|
14497
14524
|
init_identity2();
|
|
14498
14525
|
init_schema();
|
|
@@ -14511,10 +14538,10 @@ var init_poolPick = __esm({
|
|
|
14511
14538
|
}
|
|
14512
14539
|
};
|
|
14513
14540
|
SCHEMA_VERSION = 1;
|
|
14514
|
-
PickEntrySchema =
|
|
14515
|
-
PicksFileSchema =
|
|
14516
|
-
schemaVersion:
|
|
14517
|
-
picks:
|
|
14541
|
+
PickEntrySchema = import_zod21.z.strictObject({ identity: import_zod21.z.string().min(1), at: import_zod21.z.iso.datetime() });
|
|
14542
|
+
PicksFileSchema = import_zod21.z.strictObject({
|
|
14543
|
+
schemaVersion: import_zod21.z.literal(SCHEMA_VERSION),
|
|
14544
|
+
picks: import_zod21.z.record(import_zod21.z.string().min(1), PickEntrySchema)
|
|
14518
14545
|
});
|
|
14519
14546
|
}
|
|
14520
14547
|
});
|
|
@@ -14600,30 +14627,30 @@ function requireNameFreeOfUnfinishedRename(fs17, directory, name, action, sameNa
|
|
|
14600
14627
|
throw new NameHeldByUnfinishedRenameError(action, name, held, finishabilityOf(held, exists));
|
|
14601
14628
|
}
|
|
14602
14629
|
}
|
|
14603
|
-
var import_node_crypto14, import_node_path28,
|
|
14630
|
+
var import_node_crypto14, import_node_path28, import_zod22, RenameJournalSchema, FILE_NAME_HASH_DIGITS, JOURNAL_SUFFIX, RenameJournalUnreadableError, NameHeldByUnfinishedRenameError;
|
|
14604
14631
|
var init_identityRenameJournal = __esm({
|
|
14605
14632
|
"src/identityRenameJournal.ts"() {
|
|
14606
14633
|
"use strict";
|
|
14607
14634
|
import_node_crypto14 = require("node:crypto");
|
|
14608
14635
|
import_node_path28 = __toESM(require("node:path"), 1);
|
|
14609
|
-
|
|
14636
|
+
import_zod22 = require("zod");
|
|
14610
14637
|
init_cliError();
|
|
14611
14638
|
init_load();
|
|
14612
14639
|
init_readableConfig();
|
|
14613
|
-
RenameJournalSchema =
|
|
14614
|
-
version:
|
|
14615
|
-
from:
|
|
14616
|
-
to:
|
|
14617
|
-
startedAt:
|
|
14640
|
+
RenameJournalSchema = import_zod22.z.strictObject({
|
|
14641
|
+
version: import_zod22.z.literal(1),
|
|
14642
|
+
from: import_zod22.z.string().min(1),
|
|
14643
|
+
to: import_zod22.z.string().min(1),
|
|
14644
|
+
startedAt: import_zod22.z.iso.datetime(),
|
|
14618
14645
|
/** 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. */
|
|
14619
|
-
pid:
|
|
14620
|
-
steps:
|
|
14621
|
-
|
|
14622
|
-
description:
|
|
14646
|
+
pid: import_zod22.z.number().int().positive(),
|
|
14647
|
+
steps: import_zod22.z.array(
|
|
14648
|
+
import_zod22.z.strictObject({
|
|
14649
|
+
description: import_zod22.z.string().min(1),
|
|
14623
14650
|
/** Whether the step has been applied and marked so. */
|
|
14624
|
-
done:
|
|
14651
|
+
done: import_zod22.z.boolean(),
|
|
14625
14652
|
/** 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. */
|
|
14626
|
-
started:
|
|
14653
|
+
started: import_zod22.z.boolean()
|
|
14627
14654
|
})
|
|
14628
14655
|
)
|
|
14629
14656
|
});
|
|
@@ -14730,13 +14757,13 @@ function requireNoInterruptedNameRename(paths, name, action, except) {
|
|
|
14730
14757
|
throw new InterruptedNameRenameError(action, describeInterruptedNameRename(paths, held));
|
|
14731
14758
|
}
|
|
14732
14759
|
}
|
|
14733
|
-
var import_node_fs8, import_node_path29,
|
|
14760
|
+
var import_node_fs8, import_node_path29, import_zod23, NameRenameRecordSchema, RECORD_SUFFIX, InterruptedNameRenameError;
|
|
14734
14761
|
var init_identityNameRenameRecord = __esm({
|
|
14735
14762
|
"src/identityNameRenameRecord.ts"() {
|
|
14736
14763
|
"use strict";
|
|
14737
14764
|
import_node_fs8 = __toESM(require("node:fs"), 1);
|
|
14738
14765
|
import_node_path29 = __toESM(require("node:path"), 1);
|
|
14739
|
-
|
|
14766
|
+
import_zod23 = require("zod");
|
|
14740
14767
|
init_cliError();
|
|
14741
14768
|
init_configProfilesStore();
|
|
14742
14769
|
init_directoryRulesStore();
|
|
@@ -14747,12 +14774,12 @@ var init_identityNameRenameRecord = __esm({
|
|
|
14747
14774
|
init_poolPick();
|
|
14748
14775
|
init_identityRecords();
|
|
14749
14776
|
init_identityRenameJournal();
|
|
14750
|
-
NameRenameRecordSchema =
|
|
14751
|
-
version:
|
|
14752
|
-
id:
|
|
14753
|
-
from:
|
|
14754
|
-
to:
|
|
14755
|
-
startedAt:
|
|
14777
|
+
NameRenameRecordSchema = import_zod23.z.strictObject({
|
|
14778
|
+
version: import_zod23.z.literal(1),
|
|
14779
|
+
id: import_zod23.z.string().min(1),
|
|
14780
|
+
from: import_zod23.z.string().min(1),
|
|
14781
|
+
to: import_zod23.z.string().min(1),
|
|
14782
|
+
startedAt: import_zod23.z.iso.datetime()
|
|
14756
14783
|
});
|
|
14757
14784
|
RECORD_SUFFIX = ".json";
|
|
14758
14785
|
InterruptedNameRenameError = class extends CliError {
|
|
@@ -14807,18 +14834,18 @@ function liveLaunchesOn(fs17, directory, identity, isRunning) {
|
|
|
14807
14834
|
return record?.identity === identity && isRunning(record.pid) ? [record.pid] : [];
|
|
14808
14835
|
}).sort((left, right) => left - right);
|
|
14809
14836
|
}
|
|
14810
|
-
var import_node_path30, import_node_crypto15,
|
|
14837
|
+
var import_node_path30, import_node_crypto15, import_zod24, LaunchRecordSchema, RECORD_SUFFIX2;
|
|
14811
14838
|
var init_launchRecords = __esm({
|
|
14812
14839
|
"src/launcher/launchRecords.ts"() {
|
|
14813
14840
|
"use strict";
|
|
14814
14841
|
import_node_path30 = __toESM(require("node:path"), 1);
|
|
14815
14842
|
import_node_crypto15 = require("node:crypto");
|
|
14816
|
-
|
|
14817
|
-
LaunchRecordSchema =
|
|
14843
|
+
import_zod24 = require("zod");
|
|
14844
|
+
LaunchRecordSchema = import_zod24.z.strictObject({
|
|
14818
14845
|
/** The launcher's process id, which is what tells a launch in progress from a record a crashed launcher left behind. */
|
|
14819
|
-
pid:
|
|
14820
|
-
identity:
|
|
14821
|
-
startedAt:
|
|
14846
|
+
pid: import_zod24.z.number().int().positive(),
|
|
14847
|
+
identity: import_zod24.z.string().min(1),
|
|
14848
|
+
startedAt: import_zod24.z.iso.datetime()
|
|
14822
14849
|
});
|
|
14823
14850
|
RECORD_SUFFIX2 = ".json";
|
|
14824
14851
|
}
|
|
@@ -14850,6 +14877,15 @@ var init_connectorProxyAuth = __esm({
|
|
|
14850
14877
|
}
|
|
14851
14878
|
});
|
|
14852
14879
|
|
|
14880
|
+
// src/toolSurfaceAuth.ts
|
|
14881
|
+
var init_toolSurfaceAuth = __esm({
|
|
14882
|
+
"src/toolSurfaceAuth.ts"() {
|
|
14883
|
+
"use strict";
|
|
14884
|
+
init_connect();
|
|
14885
|
+
init_lenderLogin();
|
|
14886
|
+
}
|
|
14887
|
+
});
|
|
14888
|
+
|
|
14853
14889
|
// src/connectorListMerge.ts
|
|
14854
14890
|
var init_connectorListMerge = __esm({
|
|
14855
14891
|
"src/connectorListMerge.ts"() {
|
|
@@ -15319,6 +15355,7 @@ var init_identityStore = __esm({
|
|
|
15319
15355
|
init_launchRecords();
|
|
15320
15356
|
init_identityGrants();
|
|
15321
15357
|
init_connectorProxyAuth();
|
|
15358
|
+
init_toolSurfaceAuth();
|
|
15322
15359
|
init_connectorListMerge();
|
|
15323
15360
|
init_lenderLogin();
|
|
15324
15361
|
init_quotaHttp();
|
|
@@ -15383,7 +15420,7 @@ var init_package = __esm({
|
|
|
15383
15420
|
"package.json"() {
|
|
15384
15421
|
package_default = {
|
|
15385
15422
|
name: "agent-shim",
|
|
15386
|
-
version: "14.
|
|
15423
|
+
version: "14.21.0",
|
|
15387
15424
|
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.",
|
|
15388
15425
|
license: "MIT",
|
|
15389
15426
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -15492,14 +15529,14 @@ var init_package = __esm({
|
|
|
15492
15529
|
});
|
|
15493
15530
|
|
|
15494
15531
|
// src/supervise/sessionControl.ts
|
|
15495
|
-
var import_node_path34,
|
|
15532
|
+
var import_node_path34, import_zod26, RESULT_POLL_MS, SessionControlConversationSchema, REQUEST_INSTANT_DIGITS;
|
|
15496
15533
|
var init_sessionControl = __esm({
|
|
15497
15534
|
"src/supervise/sessionControl.ts"() {
|
|
15498
15535
|
"use strict";
|
|
15499
15536
|
import_node_path34 = __toESM(require("node:path"), 1);
|
|
15500
|
-
|
|
15537
|
+
import_zod26 = require("zod");
|
|
15501
15538
|
RESULT_POLL_MS = 250;
|
|
15502
|
-
SessionControlConversationSchema =
|
|
15539
|
+
SessionControlConversationSchema = import_zod26.z.object({ conversationId: import_zod26.z.string().min(1), transcriptPath: import_zod26.z.string().refine(import_node_path34.default.isAbsolute) });
|
|
15503
15540
|
REQUEST_INSTANT_DIGITS = String(Number.MAX_SAFE_INTEGER).length;
|
|
15504
15541
|
}
|
|
15505
15542
|
});
|
|
@@ -15708,22 +15745,22 @@ function findPathShadow(params) {
|
|
|
15708
15745
|
}
|
|
15709
15746
|
return params.pathDirs.some((dir) => import_node_path35.default.resolve(dir) === resolvedTargetDir) ? { status: "ok" } : { status: "not-on-path" };
|
|
15710
15747
|
}
|
|
15711
|
-
var import_node_fs10, import_node_path35,
|
|
15748
|
+
var import_node_fs10, import_node_path35, import_zod32, ClaudeShimStateSchema, SCRIPT_HEAD_BYTES, LAUNCHER_NAME, EXEC_RUN, nodeLinkFs;
|
|
15712
15749
|
var init_claudeShim = __esm({
|
|
15713
15750
|
"src/claudeShim.ts"() {
|
|
15714
15751
|
"use strict";
|
|
15715
15752
|
import_node_fs10 = __toESM(require("node:fs"), 1);
|
|
15716
15753
|
import_node_path35 = __toESM(require("node:path"), 1);
|
|
15717
|
-
|
|
15754
|
+
import_zod32 = require("zod");
|
|
15718
15755
|
init_commandDeps();
|
|
15719
15756
|
init_store();
|
|
15720
15757
|
init_realPorts();
|
|
15721
15758
|
init_cliError();
|
|
15722
15759
|
init_fileFaults();
|
|
15723
|
-
ClaudeShimStateSchema =
|
|
15724
|
-
targetPath:
|
|
15725
|
-
method:
|
|
15726
|
-
installedAtMs:
|
|
15760
|
+
ClaudeShimStateSchema = import_zod32.z.strictObject({
|
|
15761
|
+
targetPath: import_zod32.z.string().min(1),
|
|
15762
|
+
method: import_zod32.z.enum(["hardlink", "copy"]),
|
|
15763
|
+
installedAtMs: import_zod32.z.number()
|
|
15727
15764
|
});
|
|
15728
15765
|
SCRIPT_HEAD_BYTES = 4096;
|
|
15729
15766
|
LAUNCHER_NAME = /\b(agent-shim|claude-use)\b/;
|
|
@@ -16089,16 +16126,16 @@ function aliasFindings(aliases, providerNames) {
|
|
|
16089
16126
|
return { level: "pass", alias, message: `${alias} is a former name of ${target}, still honoured for sessions launched under it. Run \`agent-shim provider unalias ${alias}\` once none is running.` };
|
|
16090
16127
|
});
|
|
16091
16128
|
}
|
|
16092
|
-
var
|
|
16129
|
+
var import_zod33, ProviderAliasesSchema;
|
|
16093
16130
|
var init_providerAliases = __esm({
|
|
16094
16131
|
"src/providerAliases.ts"() {
|
|
16095
16132
|
"use strict";
|
|
16096
|
-
|
|
16133
|
+
import_zod33 = require("zod");
|
|
16097
16134
|
init_cliError();
|
|
16098
16135
|
init_load();
|
|
16099
16136
|
init_store();
|
|
16100
16137
|
init_ownEntry();
|
|
16101
|
-
ProviderAliasesSchema =
|
|
16138
|
+
ProviderAliasesSchema = import_zod33.z.record(import_zod33.z.string().min(1), import_zod33.z.string().min(1));
|
|
16102
16139
|
}
|
|
16103
16140
|
});
|
|
16104
16141
|
|
|
@@ -16881,7 +16918,7 @@ function readCatalogueFailure(fs17, paths, pid, generation, name) {
|
|
|
16881
16918
|
const raw = new StoredCatalogue(paths, skippingReader(fs17)).failureText({ pid, generation }, name);
|
|
16882
16919
|
if (raw === void 0) return void 0;
|
|
16883
16920
|
try {
|
|
16884
|
-
const value =
|
|
16921
|
+
const value = import_zod35.z.strictObject({ reason: import_zod35.z.string().max(CATALOGUE_FAILURE_REASON_MAX_CHARS), redirected: import_zod35.z.literal(true).optional(), settings: import_zod35.z.string().optional() }).safeParse(JSON.parse(raw));
|
|
16885
16922
|
return value.success ? { reason: value.data.reason, redirected: value.data.redirected === true, settings: value.data.settings } : void 0;
|
|
16886
16923
|
} catch {
|
|
16887
16924
|
return void 0;
|
|
@@ -16891,17 +16928,17 @@ function readCatalogueStatus(fs17, paths, pid, generation, name) {
|
|
|
16891
16928
|
const raw = new StoredCatalogue(paths, skippingReader(fs17)).statusText({ pid, generation }, name);
|
|
16892
16929
|
if (raw === void 0) return void 0;
|
|
16893
16930
|
try {
|
|
16894
|
-
const value =
|
|
16931
|
+
const value = import_zod35.z.strictObject({ status: import_zod35.z.enum(["running", "ready", "failed"]), fingerprint: import_zod35.z.string().min(1).optional(), recordedAt: import_zod35.z.number().optional() }).safeParse(JSON.parse(raw));
|
|
16895
16932
|
return value.success ? value.data : void 0;
|
|
16896
16933
|
} catch {
|
|
16897
16934
|
return void 0;
|
|
16898
16935
|
}
|
|
16899
16936
|
}
|
|
16900
|
-
var
|
|
16937
|
+
var import_zod35, CATALOGUE_FAILURE_REASON_MAX_CHARS;
|
|
16901
16938
|
var init_catalogueState = __esm({
|
|
16902
16939
|
"src/frontdoor/catalogueState.ts"() {
|
|
16903
16940
|
"use strict";
|
|
16904
|
-
|
|
16941
|
+
import_zod35 = require("zod");
|
|
16905
16942
|
init_storedCatalogue();
|
|
16906
16943
|
init_tolerantReaders();
|
|
16907
16944
|
CATALOGUE_FAILURE_REASON_MAX_CHARS = 600;
|
|
@@ -16909,25 +16946,25 @@ var init_catalogueState = __esm({
|
|
|
16909
16946
|
});
|
|
16910
16947
|
|
|
16911
16948
|
// src/codex/auth.ts
|
|
16912
|
-
var
|
|
16949
|
+
var import_zod36, AuthFileSchema, TokenGrantSchema, CodexAuthError;
|
|
16913
16950
|
var init_auth = __esm({
|
|
16914
16951
|
"src/codex/auth.ts"() {
|
|
16915
16952
|
"use strict";
|
|
16916
|
-
|
|
16917
|
-
AuthFileSchema =
|
|
16918
|
-
tokens:
|
|
16919
|
-
access_token:
|
|
16920
|
-
refresh_token:
|
|
16921
|
-
id_token:
|
|
16922
|
-
account_id:
|
|
16953
|
+
import_zod36 = require("zod");
|
|
16954
|
+
AuthFileSchema = import_zod36.z.looseObject({
|
|
16955
|
+
tokens: import_zod36.z.looseObject({
|
|
16956
|
+
access_token: import_zod36.z.string().optional(),
|
|
16957
|
+
refresh_token: import_zod36.z.string().optional(),
|
|
16958
|
+
id_token: import_zod36.z.string().optional(),
|
|
16959
|
+
account_id: import_zod36.z.string().optional()
|
|
16923
16960
|
}).nullish(),
|
|
16924
|
-
last_refresh:
|
|
16961
|
+
last_refresh: import_zod36.z.string().optional()
|
|
16925
16962
|
});
|
|
16926
|
-
TokenGrantSchema =
|
|
16927
|
-
access_token:
|
|
16928
|
-
refresh_token:
|
|
16929
|
-
id_token:
|
|
16930
|
-
account_id:
|
|
16963
|
+
TokenGrantSchema = import_zod36.z.looseObject({
|
|
16964
|
+
access_token: import_zod36.z.string().min(1).optional(),
|
|
16965
|
+
refresh_token: import_zod36.z.string().min(1).optional(),
|
|
16966
|
+
id_token: import_zod36.z.string().min(1).optional(),
|
|
16967
|
+
account_id: import_zod36.z.string().min(1).optional()
|
|
16931
16968
|
});
|
|
16932
16969
|
CodexAuthError = class extends Error {
|
|
16933
16970
|
constructor(message) {
|
|
@@ -16939,31 +16976,31 @@ var init_auth = __esm({
|
|
|
16939
16976
|
});
|
|
16940
16977
|
|
|
16941
16978
|
// src/codex/siwc.ts
|
|
16942
|
-
var
|
|
16979
|
+
var import_zod37, SIWC_RESOURCE, SIWC_RESPONSES_URL, SIWC_PLAN_SCOPE, TokenResponseSchema, JwtHeaderSchema, IdTokenClaimsSchema, JwksSchema;
|
|
16943
16980
|
var init_siwc = __esm({
|
|
16944
16981
|
"src/codex/siwc.ts"() {
|
|
16945
16982
|
"use strict";
|
|
16946
|
-
|
|
16983
|
+
import_zod37 = require("zod");
|
|
16947
16984
|
SIWC_RESOURCE = "https://api.openai.com/v1";
|
|
16948
16985
|
SIWC_RESPONSES_URL = `${SIWC_RESOURCE}/responses`;
|
|
16949
16986
|
SIWC_PLAN_SCOPE = "chatgpt.tokens.use.direct";
|
|
16950
|
-
TokenResponseSchema =
|
|
16951
|
-
access_token:
|
|
16952
|
-
refresh_token:
|
|
16953
|
-
id_token:
|
|
16954
|
-
expires_in:
|
|
16955
|
-
scope:
|
|
16987
|
+
TokenResponseSchema = import_zod37.z.looseObject({
|
|
16988
|
+
access_token: import_zod37.z.string().min(1),
|
|
16989
|
+
refresh_token: import_zod37.z.string().min(1).optional(),
|
|
16990
|
+
id_token: import_zod37.z.string().min(1).optional(),
|
|
16991
|
+
expires_in: import_zod37.z.number().positive(),
|
|
16992
|
+
scope: import_zod37.z.string().optional()
|
|
16956
16993
|
});
|
|
16957
|
-
JwtHeaderSchema =
|
|
16958
|
-
IdTokenClaimsSchema =
|
|
16959
|
-
iss:
|
|
16960
|
-
sub:
|
|
16961
|
-
aud:
|
|
16962
|
-
exp:
|
|
16963
|
-
nonce:
|
|
16964
|
-
email:
|
|
16994
|
+
JwtHeaderSchema = import_zod37.z.looseObject({ alg: import_zod37.z.string(), kid: import_zod37.z.string().optional() });
|
|
16995
|
+
IdTokenClaimsSchema = import_zod37.z.looseObject({
|
|
16996
|
+
iss: import_zod37.z.string(),
|
|
16997
|
+
sub: import_zod37.z.string().min(1),
|
|
16998
|
+
aud: import_zod37.z.union([import_zod37.z.string(), import_zod37.z.array(import_zod37.z.string())]),
|
|
16999
|
+
exp: import_zod37.z.number(),
|
|
17000
|
+
nonce: import_zod37.z.string().optional(),
|
|
17001
|
+
email: import_zod37.z.string().optional()
|
|
16965
17002
|
});
|
|
16966
|
-
JwksSchema =
|
|
17003
|
+
JwksSchema = import_zod37.z.object({ keys: import_zod37.z.array(import_zod37.z.looseObject({ kid: import_zod37.z.string().optional(), kty: import_zod37.z.string() })) });
|
|
16967
17004
|
}
|
|
16968
17005
|
});
|
|
16969
17006
|
|
|
@@ -16981,25 +17018,25 @@ function parseSiwcFile(raw, filePath) {
|
|
|
16981
17018
|
}
|
|
16982
17019
|
return parsed.data;
|
|
16983
17020
|
}
|
|
16984
|
-
var
|
|
17021
|
+
var import_zod38, SiwcGrantSchema, SiwcFileSchema;
|
|
16985
17022
|
var init_siwcStore = __esm({
|
|
16986
17023
|
"src/codex/siwcStore.ts"() {
|
|
16987
17024
|
"use strict";
|
|
16988
|
-
|
|
17025
|
+
import_zod38 = require("zod");
|
|
16989
17026
|
init_auth();
|
|
16990
17027
|
init_siwc();
|
|
16991
|
-
SiwcGrantSchema =
|
|
16992
|
-
clientId:
|
|
16993
|
-
sub:
|
|
16994
|
-
email:
|
|
16995
|
-
idToken:
|
|
16996
|
-
accessToken:
|
|
16997
|
-
refreshToken:
|
|
16998
|
-
scopes:
|
|
17028
|
+
SiwcGrantSchema = import_zod38.z.strictObject({
|
|
17029
|
+
clientId: import_zod38.z.string().min(1),
|
|
17030
|
+
sub: import_zod38.z.string().min(1),
|
|
17031
|
+
email: import_zod38.z.string().optional(),
|
|
17032
|
+
idToken: import_zod38.z.string().min(1),
|
|
17033
|
+
accessToken: import_zod38.z.string().min(1),
|
|
17034
|
+
refreshToken: import_zod38.z.string().min(1),
|
|
17035
|
+
scopes: import_zod38.z.array(import_zod38.z.string()).readonly(),
|
|
16999
17036
|
/** When the access token stops working, in milliseconds since the epoch. */
|
|
17000
|
-
expiresAt:
|
|
17037
|
+
expiresAt: import_zod38.z.number()
|
|
17001
17038
|
});
|
|
17002
|
-
SiwcFileSchema =
|
|
17039
|
+
SiwcFileSchema = import_zod38.z.strictObject({ registeredClientId: import_zod38.z.string().min(1).optional(), grant: SiwcGrantSchema.optional() });
|
|
17003
17040
|
}
|
|
17004
17041
|
});
|
|
17005
17042
|
|
|
@@ -17098,15 +17135,15 @@ function savedCatalogueFingerprint(provider, paths, env, home, reader) {
|
|
|
17098
17135
|
const codexHome = configuredHome === void 0 || configuredHome === "" ? import_node_path43.default.join(home, ".codex") : configuredHome;
|
|
17099
17136
|
return cliCatalogueFingerprint(reader.read(import_node_path43.default.join(codexHome, "auth.json")));
|
|
17100
17137
|
}
|
|
17101
|
-
var import_node_crypto16, import_node_path43,
|
|
17138
|
+
var import_node_crypto16, import_node_path43, import_zod39, CatalogueBindingSchema;
|
|
17102
17139
|
var init_catalogueCredential = __esm({
|
|
17103
17140
|
"src/codex/catalogueCredential.ts"() {
|
|
17104
17141
|
"use strict";
|
|
17105
17142
|
import_node_crypto16 = require("node:crypto");
|
|
17106
17143
|
import_node_path43 = __toESM(require("node:path"), 1);
|
|
17107
|
-
|
|
17144
|
+
import_zod39 = require("zod");
|
|
17108
17145
|
init_siwcStore();
|
|
17109
|
-
CatalogueBindingSchema =
|
|
17146
|
+
CatalogueBindingSchema = import_zod39.z.strictObject({ fingerprint: import_zod39.z.string().min(1), source: import_zod39.z.string().min(1), revision: import_zod39.z.string().min(1) });
|
|
17110
17147
|
}
|
|
17111
17148
|
});
|
|
17112
17149
|
|
|
@@ -17158,64 +17195,64 @@ var init_signatures = __esm({
|
|
|
17158
17195
|
});
|
|
17159
17196
|
|
|
17160
17197
|
// src/codex/anthropic.ts
|
|
17161
|
-
var
|
|
17198
|
+
var import_zod40, TextBlockSchema, Base64ImageSourceSchema, UrlImageSourceSchema, ImageBlockSchema, ToolUseBlockSchema, ToolResultContentBlockSchema, ToolResultBlockSchema, OtherBlockSchema, ContentBlockSchema, MessageSchema, ToolSchema, ToolChoiceSchema, SystemSchema, MessagesRequestSchema, CountTokensRequestSchema;
|
|
17162
17199
|
var init_anthropic = __esm({
|
|
17163
17200
|
"src/codex/anthropic.ts"() {
|
|
17164
17201
|
"use strict";
|
|
17165
|
-
|
|
17166
|
-
TextBlockSchema =
|
|
17167
|
-
Base64ImageSourceSchema =
|
|
17168
|
-
UrlImageSourceSchema =
|
|
17169
|
-
ImageBlockSchema =
|
|
17170
|
-
type:
|
|
17171
|
-
source:
|
|
17202
|
+
import_zod40 = require("zod");
|
|
17203
|
+
TextBlockSchema = import_zod40.z.looseObject({ type: import_zod40.z.literal("text"), text: import_zod40.z.string() });
|
|
17204
|
+
Base64ImageSourceSchema = import_zod40.z.looseObject({ type: import_zod40.z.literal("base64"), media_type: import_zod40.z.string().min(1), data: import_zod40.z.string() });
|
|
17205
|
+
UrlImageSourceSchema = import_zod40.z.looseObject({ type: import_zod40.z.literal("url"), url: import_zod40.z.string().min(1) });
|
|
17206
|
+
ImageBlockSchema = import_zod40.z.looseObject({
|
|
17207
|
+
type: import_zod40.z.literal("image"),
|
|
17208
|
+
source: import_zod40.z.union([Base64ImageSourceSchema, UrlImageSourceSchema])
|
|
17172
17209
|
});
|
|
17173
|
-
ToolUseBlockSchema =
|
|
17174
|
-
type:
|
|
17175
|
-
id:
|
|
17176
|
-
name:
|
|
17177
|
-
input:
|
|
17210
|
+
ToolUseBlockSchema = import_zod40.z.looseObject({
|
|
17211
|
+
type: import_zod40.z.literal("tool_use"),
|
|
17212
|
+
id: import_zod40.z.string().min(1),
|
|
17213
|
+
name: import_zod40.z.string().min(1),
|
|
17214
|
+
input: import_zod40.z.unknown()
|
|
17178
17215
|
});
|
|
17179
|
-
ToolResultContentBlockSchema =
|
|
17180
|
-
ToolResultBlockSchema =
|
|
17181
|
-
type:
|
|
17182
|
-
tool_use_id:
|
|
17183
|
-
content:
|
|
17216
|
+
ToolResultContentBlockSchema = import_zod40.z.union([TextBlockSchema, import_zod40.z.looseObject({ type: import_zod40.z.string() })]);
|
|
17217
|
+
ToolResultBlockSchema = import_zod40.z.looseObject({
|
|
17218
|
+
type: import_zod40.z.literal("tool_result"),
|
|
17219
|
+
tool_use_id: import_zod40.z.string().min(1),
|
|
17220
|
+
content: import_zod40.z.union([import_zod40.z.string(), import_zod40.z.array(ToolResultContentBlockSchema)]).optional()
|
|
17184
17221
|
});
|
|
17185
|
-
OtherBlockSchema =
|
|
17186
|
-
ContentBlockSchema =
|
|
17187
|
-
MessageSchema =
|
|
17188
|
-
role:
|
|
17189
|
-
content:
|
|
17222
|
+
OtherBlockSchema = import_zod40.z.looseObject({ type: import_zod40.z.string() });
|
|
17223
|
+
ContentBlockSchema = import_zod40.z.union([TextBlockSchema, ImageBlockSchema, ToolUseBlockSchema, ToolResultBlockSchema, OtherBlockSchema]);
|
|
17224
|
+
MessageSchema = import_zod40.z.looseObject({
|
|
17225
|
+
role: import_zod40.z.enum(["user", "assistant", "system"]),
|
|
17226
|
+
content: import_zod40.z.union([import_zod40.z.string(), import_zod40.z.array(ContentBlockSchema)])
|
|
17190
17227
|
});
|
|
17191
|
-
ToolSchema =
|
|
17192
|
-
name:
|
|
17193
|
-
description:
|
|
17194
|
-
input_schema:
|
|
17195
|
-
allowed_domains:
|
|
17196
|
-
blocked_domains:
|
|
17228
|
+
ToolSchema = import_zod40.z.looseObject({
|
|
17229
|
+
name: import_zod40.z.string().min(1),
|
|
17230
|
+
description: import_zod40.z.string().optional(),
|
|
17231
|
+
input_schema: import_zod40.z.record(import_zod40.z.string(), import_zod40.z.unknown()).optional(),
|
|
17232
|
+
allowed_domains: import_zod40.z.array(import_zod40.z.string()).optional(),
|
|
17233
|
+
blocked_domains: import_zod40.z.array(import_zod40.z.string()).optional()
|
|
17197
17234
|
});
|
|
17198
|
-
ToolChoiceSchema =
|
|
17199
|
-
|
|
17200
|
-
|
|
17235
|
+
ToolChoiceSchema = import_zod40.z.union([
|
|
17236
|
+
import_zod40.z.looseObject({ type: import_zod40.z.enum(["auto", "none", "any"]) }),
|
|
17237
|
+
import_zod40.z.looseObject({ type: import_zod40.z.literal("tool"), name: import_zod40.z.string().min(1) })
|
|
17201
17238
|
]);
|
|
17202
|
-
SystemSchema =
|
|
17203
|
-
MessagesRequestSchema =
|
|
17204
|
-
model:
|
|
17239
|
+
SystemSchema = import_zod40.z.union([import_zod40.z.string(), import_zod40.z.array(import_zod40.z.union([TextBlockSchema, OtherBlockSchema]))]);
|
|
17240
|
+
MessagesRequestSchema = import_zod40.z.looseObject({
|
|
17241
|
+
model: import_zod40.z.string().optional(),
|
|
17205
17242
|
system: SystemSchema.optional(),
|
|
17206
|
-
messages:
|
|
17207
|
-
tools:
|
|
17243
|
+
messages: import_zod40.z.array(MessageSchema),
|
|
17244
|
+
tools: import_zod40.z.array(ToolSchema).optional(),
|
|
17208
17245
|
tool_choice: ToolChoiceSchema.optional(),
|
|
17209
|
-
stream:
|
|
17246
|
+
stream: import_zod40.z.boolean().optional(),
|
|
17210
17247
|
/** `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. */
|
|
17211
|
-
metadata:
|
|
17248
|
+
metadata: import_zod40.z.looseObject({ user_id: import_zod40.z.string().optional() }).optional(),
|
|
17212
17249
|
/** Claude Code's effort setting. Any string is accepted; the translator honours only the levels the backend understands. */
|
|
17213
|
-
output_config:
|
|
17250
|
+
output_config: import_zod40.z.looseObject({ effort: import_zod40.z.string().optional(), format: import_zod40.z.object({ type: import_zod40.z.literal("json_schema"), schema: import_zod40.z.record(import_zod40.z.string(), import_zod40.z.unknown()) }).optional() }).optional()
|
|
17214
17251
|
});
|
|
17215
|
-
CountTokensRequestSchema =
|
|
17216
|
-
system:
|
|
17217
|
-
messages:
|
|
17218
|
-
tools:
|
|
17252
|
+
CountTokensRequestSchema = import_zod40.z.looseObject({
|
|
17253
|
+
system: import_zod40.z.unknown().optional(),
|
|
17254
|
+
messages: import_zod40.z.unknown().optional(),
|
|
17255
|
+
tools: import_zod40.z.unknown().optional()
|
|
17219
17256
|
});
|
|
17220
17257
|
}
|
|
17221
17258
|
});
|
|
@@ -19159,21 +19196,21 @@ function stageLaunchControl(params) {
|
|
|
19159
19196
|
}
|
|
19160
19197
|
};
|
|
19161
19198
|
}
|
|
19162
|
-
var import_node_path54, import_node_crypto18,
|
|
19199
|
+
var import_node_path54, import_node_crypto18, import_zod51, LaunchControlSchema, RECORD_SUFFIX3;
|
|
19163
19200
|
var init_launchControl = __esm({
|
|
19164
19201
|
"src/supervise/launchControl.ts"() {
|
|
19165
19202
|
"use strict";
|
|
19166
19203
|
import_node_path54 = __toESM(require("node:path"), 1);
|
|
19167
19204
|
import_node_crypto18 = require("node:crypto");
|
|
19168
|
-
|
|
19205
|
+
import_zod51 = require("zod");
|
|
19169
19206
|
init_sessionControl();
|
|
19170
19207
|
init_sessionControlPlugin();
|
|
19171
19208
|
init_verifiedVersions();
|
|
19172
|
-
LaunchControlSchema =
|
|
19209
|
+
LaunchControlSchema = import_zod51.z.strictObject({
|
|
19173
19210
|
/** The launcher's process id, which tells a live channel from one a killed launcher left. */
|
|
19174
|
-
pid:
|
|
19211
|
+
pid: import_zod51.z.number().int().positive(),
|
|
19175
19212
|
/** The plugin's directory, its request and result files beneath it. */
|
|
19176
|
-
directory:
|
|
19213
|
+
directory: import_zod51.z.string().min(1)
|
|
19177
19214
|
});
|
|
19178
19215
|
RECORD_SUFFIX3 = ".json";
|
|
19179
19216
|
}
|
|
@@ -20494,11 +20531,11 @@ var init_identityClaude = __esm({
|
|
|
20494
20531
|
});
|
|
20495
20532
|
|
|
20496
20533
|
// src/usage/providerQuota.ts
|
|
20497
|
-
var
|
|
20534
|
+
var import_zod52, 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;
|
|
20498
20535
|
var init_providerQuota = __esm({
|
|
20499
20536
|
"src/usage/providerQuota.ts"() {
|
|
20500
20537
|
"use strict";
|
|
20501
|
-
|
|
20538
|
+
import_zod52 = require("zod");
|
|
20502
20539
|
init_cloudUpstream();
|
|
20503
20540
|
init_schema2();
|
|
20504
20541
|
init_ownEntry();
|
|
@@ -20514,35 +20551,35 @@ var init_providerQuota = __esm({
|
|
|
20514
20551
|
[ZAI_UNIT_HOURS, SECONDS_PER_HOUR3 * MS_PER_SECOND9],
|
|
20515
20552
|
[ZAI_UNIT_MONTHS, DAYS_PER_MONTH * HOURS_PER_DAY6 * SECONDS_PER_HOUR3 * MS_PER_SECOND9]
|
|
20516
20553
|
]);
|
|
20517
|
-
ZaiLimitSchema =
|
|
20518
|
-
type:
|
|
20519
|
-
unit:
|
|
20520
|
-
number:
|
|
20521
|
-
percentage:
|
|
20522
|
-
nextResetTime:
|
|
20523
|
-
usage:
|
|
20524
|
-
currentValue:
|
|
20525
|
-
remaining:
|
|
20554
|
+
ZaiLimitSchema = import_zod52.z.object({
|
|
20555
|
+
type: import_zod52.z.string(),
|
|
20556
|
+
unit: import_zod52.z.number().int(),
|
|
20557
|
+
number: import_zod52.z.number().int().positive(),
|
|
20558
|
+
percentage: import_zod52.z.number().nonnegative(),
|
|
20559
|
+
nextResetTime: import_zod52.z.number().positive().optional(),
|
|
20560
|
+
usage: import_zod52.z.number().nonnegative().optional(),
|
|
20561
|
+
currentValue: import_zod52.z.number().nonnegative().optional(),
|
|
20562
|
+
remaining: import_zod52.z.number().nonnegative().optional()
|
|
20526
20563
|
});
|
|
20527
|
-
ZaiResponseSchema =
|
|
20528
|
-
success:
|
|
20529
|
-
msg:
|
|
20530
|
-
data:
|
|
20564
|
+
ZaiResponseSchema = import_zod52.z.object({
|
|
20565
|
+
success: import_zod52.z.boolean(),
|
|
20566
|
+
msg: import_zod52.z.string().optional(),
|
|
20567
|
+
data: import_zod52.z.object({ level: import_zod52.z.string().optional(), limits: import_zod52.z.array(ZaiLimitSchema) })
|
|
20531
20568
|
});
|
|
20532
20569
|
OPENROUTER_HOST = "openrouter.ai";
|
|
20533
20570
|
OPENROUTER_KEY_URL = `https://${OPENROUTER_HOST}/api/v1/key`;
|
|
20534
20571
|
OPENROUTER_CREDITS_URL = `https://${OPENROUTER_HOST}/api/v1/credits`;
|
|
20535
20572
|
MS_PER_DAY2 = HOURS_PER_DAY6 * SECONDS_PER_HOUR3 * MS_PER_SECOND9;
|
|
20536
|
-
OpenRouterKeySchema =
|
|
20537
|
-
data:
|
|
20538
|
-
limit:
|
|
20539
|
-
limit_remaining:
|
|
20540
|
-
limit_reset:
|
|
20541
|
-
is_free_tier:
|
|
20542
|
-
free_model_daily_requests:
|
|
20573
|
+
OpenRouterKeySchema = import_zod52.z.object({
|
|
20574
|
+
data: import_zod52.z.object({
|
|
20575
|
+
limit: import_zod52.z.number().nonnegative().nullable(),
|
|
20576
|
+
limit_remaining: import_zod52.z.number().nullable(),
|
|
20577
|
+
limit_reset: import_zod52.z.string().nullable(),
|
|
20578
|
+
is_free_tier: import_zod52.z.boolean().optional(),
|
|
20579
|
+
free_model_daily_requests: import_zod52.z.object({ used: import_zod52.z.number().nonnegative(), limit: import_zod52.z.number().nonnegative(), remaining: import_zod52.z.number() }).optional()
|
|
20543
20580
|
})
|
|
20544
20581
|
});
|
|
20545
|
-
OpenRouterCreditsSchema =
|
|
20582
|
+
OpenRouterCreditsSchema = import_zod52.z.object({ data: import_zod52.z.object({ total_credits: import_zod52.z.number().nonnegative(), total_usage: import_zod52.z.number().nonnegative() }) });
|
|
20546
20583
|
ANTIGRAVITY_HOST = "daily-cloudcode-pa.googleapis.com";
|
|
20547
20584
|
ANTIGRAVITY_QUOTA_URL = `https://${ANTIGRAVITY_HOST}/v1internal:retrieveUserQuotaSummary`;
|
|
20548
20585
|
ANTIGRAVITY_USER_URL = `https://${ANTIGRAVITY_HOST}/v1internal:loadCodeAssist`;
|
|
@@ -20550,21 +20587,21 @@ var init_providerQuota = __esm({
|
|
|
20550
20587
|
DAYS_PER_WEEK2 = 7;
|
|
20551
20588
|
FIVE_HOURS_MS = FIVE_HOURS2 * SECONDS_PER_HOUR3 * MS_PER_SECOND9;
|
|
20552
20589
|
WEEK_MS = DAYS_PER_WEEK2 * HOURS_PER_DAY6 * SECONDS_PER_HOUR3 * MS_PER_SECOND9;
|
|
20553
|
-
AntigravityBucketSchema =
|
|
20554
|
-
bucketId:
|
|
20555
|
-
remainingFraction:
|
|
20556
|
-
resetTime:
|
|
20590
|
+
AntigravityBucketSchema = import_zod52.z.object({
|
|
20591
|
+
bucketId: import_zod52.z.string(),
|
|
20592
|
+
remainingFraction: import_zod52.z.number().optional(),
|
|
20593
|
+
resetTime: import_zod52.z.string().optional()
|
|
20557
20594
|
});
|
|
20558
|
-
AntigravitySummarySchema =
|
|
20559
|
-
GoogleTokenInfoSchema =
|
|
20560
|
-
email:
|
|
20561
|
-
sub:
|
|
20595
|
+
AntigravitySummarySchema = import_zod52.z.object({ groups: import_zod52.z.array(import_zod52.z.object({ buckets: import_zod52.z.array(AntigravityBucketSchema) })) });
|
|
20596
|
+
GoogleTokenInfoSchema = import_zod52.z.object({
|
|
20597
|
+
email: import_zod52.z.string().optional(),
|
|
20598
|
+
sub: import_zod52.z.string().optional()
|
|
20562
20599
|
});
|
|
20563
|
-
AntigravityUserSchema =
|
|
20600
|
+
AntigravityUserSchema = import_zod52.z.object({
|
|
20564
20601
|
/** The code-assist tier context, which defaults to the free tier for every account. */
|
|
20565
|
-
currentTier:
|
|
20602
|
+
currentTier: import_zod52.z.object({ name: import_zod52.z.string().optional(), id: import_zod52.z.string().optional() }).optional(),
|
|
20566
20603
|
/** The account's paid subscription; absent when the account has none. */
|
|
20567
|
-
paidTier:
|
|
20604
|
+
paidTier: import_zod52.z.object({ name: import_zod52.z.string().optional(), id: import_zod52.z.string().optional() }).optional()
|
|
20568
20605
|
});
|
|
20569
20606
|
}
|
|
20570
20607
|
});
|
|
@@ -21079,20 +21116,20 @@ init_rcSessions();
|
|
|
21079
21116
|
|
|
21080
21117
|
// src/frontdoor/rcSessionRegistry.ts
|
|
21081
21118
|
var import_node_path32 = __toESM(require("node:path"), 1);
|
|
21082
|
-
var
|
|
21119
|
+
var import_zod25 = require("zod");
|
|
21083
21120
|
init_identityStore();
|
|
21084
21121
|
var REGISTRY_BRIDGE_PREFIX = "session_";
|
|
21085
21122
|
var DOOR_SESSION_PREFIX = "cse_";
|
|
21086
21123
|
var REGISTRY_DIR = "sessions";
|
|
21087
21124
|
var ENTRY_SUFFIX = ".json";
|
|
21088
21125
|
var RC_REGISTRY_ENTRY_MAX_BYTES = 8192;
|
|
21089
|
-
var RegistryEntrySchema =
|
|
21090
|
-
sessionId:
|
|
21091
|
-
pid:
|
|
21092
|
-
bridgeSessionId:
|
|
21093
|
-
cwd:
|
|
21094
|
-
name:
|
|
21095
|
-
updatedAt:
|
|
21126
|
+
var RegistryEntrySchema = import_zod25.z.looseObject({
|
|
21127
|
+
sessionId: import_zod25.z.string().min(1),
|
|
21128
|
+
pid: import_zod25.z.int().positive(),
|
|
21129
|
+
bridgeSessionId: import_zod25.z.union([import_zod25.z.string().startsWith(REGISTRY_BRIDGE_PREFIX), import_zod25.z.string().startsWith(DOOR_SESSION_PREFIX)]),
|
|
21130
|
+
cwd: import_zod25.z.string().optional(),
|
|
21131
|
+
name: import_zod25.z.string().optional(),
|
|
21132
|
+
updatedAt: import_zod25.z.number().optional()
|
|
21096
21133
|
});
|
|
21097
21134
|
function supersedes(candidate, kept) {
|
|
21098
21135
|
return candidate.updatedAt > kept.updatedAt || candidate.updatedAt === kept.updatedAt && candidate.session.pid > kept.session.pid;
|
|
@@ -21309,7 +21346,7 @@ init_rcWrites();
|
|
|
21309
21346
|
init_rcSchemas();
|
|
21310
21347
|
|
|
21311
21348
|
// src/frontdoor/rcSlashCommandSchemas.ts
|
|
21312
|
-
var
|
|
21349
|
+
var import_zod27 = require("zod");
|
|
21313
21350
|
init_rcSchemas();
|
|
21314
21351
|
|
|
21315
21352
|
// src/frontdoor/rcSessionCommands.ts
|
|
@@ -21818,57 +21855,57 @@ function createRcSessionCommands(deps) {
|
|
|
21818
21855
|
}
|
|
21819
21856
|
|
|
21820
21857
|
// src/frontdoor/rcSlashCommandSchemas.ts
|
|
21821
|
-
var WaitMsSchema =
|
|
21822
|
-
var RcGoalSessionInputSchema =
|
|
21823
|
-
session:
|
|
21858
|
+
var WaitMsSchema = import_zod27.z.int().positive().max(RC_SESSION_COMMAND_MAX_WAIT_MS).optional();
|
|
21859
|
+
var RcGoalSessionInputSchema = import_zod27.z.strictObject({
|
|
21860
|
+
session: import_zod27.z.string().min(1),
|
|
21824
21861
|
waitMs: WaitMsSchema
|
|
21825
21862
|
});
|
|
21826
|
-
var RcGoalSetInputSchema =
|
|
21827
|
-
session:
|
|
21828
|
-
condition:
|
|
21863
|
+
var RcGoalSetInputSchema = import_zod27.z.strictObject({
|
|
21864
|
+
session: import_zod27.z.string().min(1),
|
|
21865
|
+
condition: import_zod27.z.string().trim().min(1).max(RC_GOAL_CONDITION_MAX_CHARS).regex(/^[^\r\n]*$/u, "a goal condition is one line"),
|
|
21829
21866
|
waitMs: WaitMsSchema
|
|
21830
21867
|
});
|
|
21831
|
-
var RcCompactInputSchema =
|
|
21832
|
-
session:
|
|
21868
|
+
var RcCompactInputSchema = import_zod27.z.strictObject({
|
|
21869
|
+
session: import_zod27.z.string().min(1),
|
|
21833
21870
|
waitMs: WaitMsSchema
|
|
21834
21871
|
});
|
|
21835
|
-
var RcCompactWithInstructionsInputSchema =
|
|
21836
|
-
session:
|
|
21837
|
-
instructions:
|
|
21872
|
+
var RcCompactWithInstructionsInputSchema = import_zod27.z.strictObject({
|
|
21873
|
+
session: import_zod27.z.string().min(1),
|
|
21874
|
+
instructions: import_zod27.z.string().trim().min(1).max(RC_COMPACT_INSTRUCTIONS_MAX_CHARS),
|
|
21838
21875
|
waitMs: WaitMsSchema
|
|
21839
21876
|
});
|
|
21840
|
-
var RcTurnInputSchema =
|
|
21841
|
-
session:
|
|
21842
|
-
text:
|
|
21877
|
+
var RcTurnInputSchema = import_zod27.z.strictObject({
|
|
21878
|
+
session: import_zod27.z.string().min(1),
|
|
21879
|
+
text: import_zod27.z.string().min(1).max(RC_TURN_TEXT_MAX_CHARS),
|
|
21843
21880
|
waitMs: WaitMsSchema
|
|
21844
21881
|
});
|
|
21845
21882
|
var commandAnswerShape = {
|
|
21846
|
-
session:
|
|
21883
|
+
session: import_zod27.z.string(),
|
|
21847
21884
|
route: RcSessionCommandRouteSchema,
|
|
21848
21885
|
warnings: RcVersionGateWarningsSchema
|
|
21849
21886
|
};
|
|
21850
|
-
var RcGoalGetOutputSchema =
|
|
21887
|
+
var RcGoalGetOutputSchema = import_zod27.z.strictObject({
|
|
21851
21888
|
...commandAnswerShape,
|
|
21852
|
-
goal:
|
|
21889
|
+
goal: import_zod27.z.strictObject({ condition: import_zod27.z.string(), iterations: import_zod27.z.int().nonnegative(), lastCheck: import_zod27.z.string().optional() }).nullable()
|
|
21853
21890
|
});
|
|
21854
|
-
var RcGoalSetOutputSchema =
|
|
21891
|
+
var RcGoalSetOutputSchema = import_zod27.z.strictObject({
|
|
21855
21892
|
...commandAnswerShape,
|
|
21856
|
-
condition:
|
|
21857
|
-
superseded:
|
|
21893
|
+
condition: import_zod27.z.string(),
|
|
21894
|
+
superseded: import_zod27.z.string().nullable()
|
|
21858
21895
|
});
|
|
21859
|
-
var RcGoalClearOutputSchema =
|
|
21896
|
+
var RcGoalClearOutputSchema = import_zod27.z.strictObject({
|
|
21860
21897
|
...commandAnswerShape,
|
|
21861
|
-
cleared:
|
|
21898
|
+
cleared: import_zod27.z.string().nullable()
|
|
21862
21899
|
});
|
|
21863
|
-
var RcTurnOutputSchema =
|
|
21900
|
+
var RcTurnOutputSchema = import_zod27.z.strictObject({
|
|
21864
21901
|
...commandAnswerShape,
|
|
21865
|
-
uuid:
|
|
21902
|
+
uuid: import_zod27.z.string()
|
|
21866
21903
|
});
|
|
21867
|
-
var RcCompactOutputSchema =
|
|
21904
|
+
var RcCompactOutputSchema = import_zod27.z.strictObject({
|
|
21868
21905
|
...commandAnswerShape,
|
|
21869
|
-
trigger:
|
|
21870
|
-
preTokens:
|
|
21871
|
-
postTokens:
|
|
21906
|
+
trigger: import_zod27.z.string(),
|
|
21907
|
+
preTokens: import_zod27.z.number().optional(),
|
|
21908
|
+
postTokens: import_zod27.z.number().optional()
|
|
21872
21909
|
});
|
|
21873
21910
|
|
|
21874
21911
|
// src/frontdoor/rcApi.ts
|
|
@@ -21933,7 +21970,7 @@ function createRcApiRouter(deps) {
|
|
|
21933
21970
|
if (input.session !== void 0 && !statuses.some((entry) => entry.id === input.session)) {
|
|
21934
21971
|
throw new import_client.ORPCError("NOT_FOUND", { message: rcSessionNotObservedMessage(input.session) });
|
|
21935
21972
|
}
|
|
21936
|
-
return { statuses: await Promise.all(statuses.map(async (status) => ({ ...status, route: await deps.routeOf(status.id) }))) };
|
|
21973
|
+
return { statuses: await Promise.all(statuses.map(async (status) => ({ ...status, route: await deps.routeOf(status.id), serverState: await deps.serverStateOf(status.id) }))) };
|
|
21937
21974
|
}),
|
|
21938
21975
|
pending: authed.meta((0, import_openapi.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 }) => {
|
|
21939
21976
|
const pending = deps.pendingOf(input.session);
|
|
@@ -22098,48 +22135,48 @@ init_cliError();
|
|
|
22098
22135
|
init_package();
|
|
22099
22136
|
|
|
22100
22137
|
// src/codex/appServerSchemas.ts
|
|
22101
|
-
var
|
|
22138
|
+
var import_zod28 = require("zod");
|
|
22102
22139
|
var CODEX_APP_SERVER_GENERATED_AGAINST = "0.160.0";
|
|
22103
|
-
var RateLimitWindowSchema =
|
|
22104
|
-
usedPercent:
|
|
22105
|
-
resetsAt:
|
|
22106
|
-
windowDurationMins:
|
|
22107
|
-
});
|
|
22108
|
-
var RateLimitSnapshotSchema =
|
|
22109
|
-
limitId:
|
|
22110
|
-
limitName:
|
|
22111
|
-
planType:
|
|
22140
|
+
var RateLimitWindowSchema = import_zod28.z.object({
|
|
22141
|
+
usedPercent: import_zod28.z.number(),
|
|
22142
|
+
resetsAt: import_zod28.z.number().nullish(),
|
|
22143
|
+
windowDurationMins: import_zod28.z.number().nullish()
|
|
22144
|
+
});
|
|
22145
|
+
var RateLimitSnapshotSchema = import_zod28.z.object({
|
|
22146
|
+
limitId: import_zod28.z.string().nullish(),
|
|
22147
|
+
limitName: import_zod28.z.string().nullish(),
|
|
22148
|
+
planType: import_zod28.z.string().nullish(),
|
|
22112
22149
|
primary: RateLimitWindowSchema.nullish(),
|
|
22113
22150
|
secondary: RateLimitWindowSchema.nullish(),
|
|
22114
|
-
rateLimitReachedType:
|
|
22115
|
-
spendControlReached:
|
|
22116
|
-
});
|
|
22117
|
-
var RateLimitResetCreditSchema =
|
|
22118
|
-
id:
|
|
22119
|
-
grantedAt:
|
|
22120
|
-
expiresAt:
|
|
22121
|
-
resetType:
|
|
22122
|
-
status:
|
|
22123
|
-
title:
|
|
22124
|
-
description:
|
|
22125
|
-
});
|
|
22126
|
-
var CodexAccountSchema =
|
|
22127
|
-
|
|
22128
|
-
|
|
22129
|
-
|
|
22151
|
+
rateLimitReachedType: import_zod28.z.string().nullish(),
|
|
22152
|
+
spendControlReached: import_zod28.z.boolean().nullish()
|
|
22153
|
+
});
|
|
22154
|
+
var RateLimitResetCreditSchema = import_zod28.z.object({
|
|
22155
|
+
id: import_zod28.z.string(),
|
|
22156
|
+
grantedAt: import_zod28.z.number(),
|
|
22157
|
+
expiresAt: import_zod28.z.number().nullish(),
|
|
22158
|
+
resetType: import_zod28.z.string(),
|
|
22159
|
+
status: import_zod28.z.string(),
|
|
22160
|
+
title: import_zod28.z.string().nullish(),
|
|
22161
|
+
description: import_zod28.z.string().nullish()
|
|
22162
|
+
});
|
|
22163
|
+
var CodexAccountSchema = import_zod28.z.discriminatedUnion("type", [
|
|
22164
|
+
import_zod28.z.object({ type: import_zod28.z.literal("apiKey") }),
|
|
22165
|
+
import_zod28.z.object({ type: import_zod28.z.literal("chatgpt"), email: import_zod28.z.string().nullable(), planType: import_zod28.z.string() }),
|
|
22166
|
+
import_zod28.z.object({ type: import_zod28.z.literal("amazonBedrock"), usesCodexManagedCredentials: import_zod28.z.boolean().default(false) })
|
|
22130
22167
|
]);
|
|
22131
|
-
var CodexAccountReadSchema =
|
|
22168
|
+
var CodexAccountReadSchema = import_zod28.z.object({
|
|
22132
22169
|
account: CodexAccountSchema.nullable(),
|
|
22133
|
-
requiresOpenaiAuth:
|
|
22170
|
+
requiresOpenaiAuth: import_zod28.z.boolean()
|
|
22134
22171
|
});
|
|
22135
|
-
var CodexRateLimitsReadSchema =
|
|
22172
|
+
var CodexRateLimitsReadSchema = import_zod28.z.object({
|
|
22136
22173
|
rateLimits: RateLimitSnapshotSchema,
|
|
22137
|
-
rateLimitsByLimitId:
|
|
22138
|
-
rateLimitResetCredits:
|
|
22139
|
-
accountId:
|
|
22140
|
-
ordinaryUsageAllowed:
|
|
22174
|
+
rateLimitsByLimitId: import_zod28.z.record(import_zod28.z.string(), RateLimitSnapshotSchema).nullish(),
|
|
22175
|
+
rateLimitResetCredits: import_zod28.z.object({ availableCount: import_zod28.z.number(), credits: import_zod28.z.array(RateLimitResetCreditSchema).nullish() }).nullish(),
|
|
22176
|
+
accountId: import_zod28.z.string().nullish(),
|
|
22177
|
+
ordinaryUsageAllowed: import_zod28.z.boolean().nullish()
|
|
22141
22178
|
});
|
|
22142
|
-
var CodexInitializeResultSchema =
|
|
22179
|
+
var CodexInitializeResultSchema = import_zod28.z.object({ userAgent: import_zod28.z.string() });
|
|
22143
22180
|
|
|
22144
22181
|
// src/codex/appServer.ts
|
|
22145
22182
|
var CodexAppServerUnavailableError = class extends CliError {
|
|
@@ -22338,7 +22375,7 @@ var import_client8 = require("@orpc/client");
|
|
|
22338
22375
|
var import_openapi9 = require("@orpc/openapi");
|
|
22339
22376
|
|
|
22340
22377
|
// src/checkReportSchema.ts
|
|
22341
|
-
var
|
|
22378
|
+
var import_zod30 = require("zod");
|
|
22342
22379
|
init_schema();
|
|
22343
22380
|
init_claudeVersion();
|
|
22344
22381
|
init_identity2();
|
|
@@ -22404,140 +22441,140 @@ var DIAGNOSTIC_CODES = [
|
|
|
22404
22441
|
var DIAGNOSTIC_SEVERITIES = ["error", "warning", "info"];
|
|
22405
22442
|
|
|
22406
22443
|
// src/usage/pickReportSchema.ts
|
|
22407
|
-
var
|
|
22444
|
+
var import_zod29 = require("zod");
|
|
22408
22445
|
init_plan2();
|
|
22409
|
-
var PoolPickCandidateViewSchema =
|
|
22410
|
-
identity:
|
|
22446
|
+
var PoolPickCandidateViewSchema = import_zod29.z.strictObject({
|
|
22447
|
+
identity: import_zod29.z.string(),
|
|
22411
22448
|
/** 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. */
|
|
22412
|
-
class:
|
|
22449
|
+
class: import_zod29.z.enum(["scored", "unknown", "pay-per-use", "ineligible"]),
|
|
22413
22450
|
/** Plan-size-weighted remaining quota per hour until its reset; present for `scored` only. */
|
|
22414
|
-
score:
|
|
22451
|
+
score: import_zod29.z.number().optional(),
|
|
22415
22452
|
/** 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`. */
|
|
22416
|
-
scoreWindow:
|
|
22453
|
+
scoreWindow: import_zod29.z.enum(["sevenDay", "fiveHour"]).optional(),
|
|
22417
22454
|
/** False when the five-hour window would run dry, at the observed pace, before it resets. */
|
|
22418
|
-
feasible:
|
|
22455
|
+
feasible: import_zod29.z.boolean(),
|
|
22419
22456
|
/** When an `ineligible` member can be used again, as an ISO instant. */
|
|
22420
|
-
blockedUntil:
|
|
22457
|
+
blockedUntil: import_zod29.z.iso.datetime().optional(),
|
|
22421
22458
|
plan: PlanClassSchema,
|
|
22422
22459
|
/** 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. */
|
|
22423
|
-
provider:
|
|
22460
|
+
provider: import_zod29.z.string().optional(),
|
|
22424
22461
|
/** The facts behind the class and score, in the order they matter. */
|
|
22425
|
-
reasons:
|
|
22462
|
+
reasons: import_zod29.z.array(import_zod29.z.string())
|
|
22426
22463
|
});
|
|
22427
|
-
var PoolPickReportSchema =
|
|
22428
|
-
pool:
|
|
22429
|
-
directory:
|
|
22464
|
+
var PoolPickReportSchema = import_zod29.z.strictObject({
|
|
22465
|
+
pool: import_zod29.z.string(),
|
|
22466
|
+
directory: import_zod29.z.string(),
|
|
22430
22467
|
/** The member a launch would run as, absent when every member is refused. */
|
|
22431
|
-
pick:
|
|
22432
|
-
candidates:
|
|
22468
|
+
pick: import_zod29.z.string().optional(),
|
|
22469
|
+
candidates: import_zod29.z.array(PoolPickCandidateViewSchema),
|
|
22433
22470
|
/** Identity members anywhere in the pool's graph that do not exist; a launch skips them. */
|
|
22434
|
-
missing:
|
|
22471
|
+
missing: import_zod29.z.array(import_zod29.z.string()),
|
|
22435
22472
|
/** When nothing can be picked, the soonest any member returns. */
|
|
22436
|
-
earliestReturn:
|
|
22473
|
+
earliestReturn: import_zod29.z.strictObject({ identity: import_zod29.z.string(), at: import_zod29.z.iso.datetime() }).optional(),
|
|
22437
22474
|
/** The member a resumed conversation started on but moved off, and why, when the ranking could not keep it. */
|
|
22438
|
-
movedOff:
|
|
22475
|
+
movedOff: import_zod29.z.strictObject({ identity: import_zod29.z.string(), reason: import_zod29.z.string() }).optional(),
|
|
22439
22476
|
/** Why the last-pick record could not be read, when that is the case. */
|
|
22440
|
-
stickyProblem:
|
|
22477
|
+
stickyProblem: import_zod29.z.string().optional()
|
|
22441
22478
|
});
|
|
22442
22479
|
|
|
22443
22480
|
// src/checkReportSchema.ts
|
|
22444
22481
|
init_identityGrants();
|
|
22445
22482
|
var CHECK_CREDENTIAL_APPLIES = ["provider", "identity", "stored-login"];
|
|
22446
|
-
var CheckLayerViewSchema =
|
|
22447
|
-
id:
|
|
22448
|
-
kind:
|
|
22449
|
-
source:
|
|
22450
|
-
});
|
|
22451
|
-
var CheckEntryViewSchema =
|
|
22452
|
-
path:
|
|
22453
|
-
shared:
|
|
22454
|
-
via:
|
|
22483
|
+
var CheckLayerViewSchema = import_zod30.z.strictObject({
|
|
22484
|
+
id: import_zod30.z.int(),
|
|
22485
|
+
kind: import_zod30.z.enum(LAYER_KINDS),
|
|
22486
|
+
source: import_zod30.z.string()
|
|
22487
|
+
});
|
|
22488
|
+
var CheckEntryViewSchema = import_zod30.z.strictObject({
|
|
22489
|
+
path: import_zod30.z.string(),
|
|
22490
|
+
shared: import_zod30.z.boolean(),
|
|
22491
|
+
via: import_zod30.z.enum(DECISION_VIAS),
|
|
22455
22492
|
/** The entry's real category, or null when nothing classifies it. */
|
|
22456
|
-
category:
|
|
22457
|
-
rule:
|
|
22493
|
+
category: import_zod30.z.enum(CATEGORY_NAMES).nullable(),
|
|
22494
|
+
rule: import_zod30.z.strictObject({ key: import_zod30.z.string(), layer: import_zod30.z.int() }).optional(),
|
|
22458
22495
|
/** Rules that matched but whose `when` condition failed, each with the conditions that failed. */
|
|
22459
|
-
eliminated:
|
|
22460
|
-
});
|
|
22461
|
-
var CheckDiagnosticSchema =
|
|
22462
|
-
code:
|
|
22463
|
-
severity:
|
|
22464
|
-
message:
|
|
22465
|
-
subject:
|
|
22466
|
-
layer:
|
|
22467
|
-
});
|
|
22468
|
-
var CheckAmbientCredentialSchema =
|
|
22469
|
-
var CheckKeychainSchema =
|
|
22470
|
-
checked:
|
|
22471
|
-
found:
|
|
22472
|
-
serviceName:
|
|
22473
|
-
note:
|
|
22474
|
-
});
|
|
22475
|
-
var CheckSettingsExposureSchema =
|
|
22476
|
-
file:
|
|
22477
|
-
envKeyNames:
|
|
22478
|
-
hookEventNames:
|
|
22479
|
-
hookCommandCount:
|
|
22480
|
-
});
|
|
22481
|
-
var CredentialSourceSummarySchema =
|
|
22482
|
-
|
|
22483
|
-
|
|
22484
|
-
|
|
22485
|
-
|
|
22486
|
-
|
|
22487
|
-
|
|
22496
|
+
eliminated: import_zod30.z.readonly(import_zod30.z.array(import_zod30.z.strictObject({ key: import_zod30.z.string(), failed: import_zod30.z.readonly(import_zod30.z.array(import_zod30.z.string())) }))).optional()
|
|
22497
|
+
});
|
|
22498
|
+
var CheckDiagnosticSchema = import_zod30.z.strictObject({
|
|
22499
|
+
code: import_zod30.z.enum(DIAGNOSTIC_CODES),
|
|
22500
|
+
severity: import_zod30.z.enum(DIAGNOSTIC_SEVERITIES),
|
|
22501
|
+
message: import_zod30.z.string(),
|
|
22502
|
+
subject: import_zod30.z.string().optional(),
|
|
22503
|
+
layer: import_zod30.z.int().optional()
|
|
22504
|
+
});
|
|
22505
|
+
var CheckAmbientCredentialSchema = import_zod30.z.union([import_zod30.z.strictObject({ ok: import_zod30.z.literal(true) }), import_zod30.z.strictObject({ ok: import_zod30.z.literal(false), variable: import_zod30.z.string(), message: import_zod30.z.string() })]);
|
|
22506
|
+
var CheckKeychainSchema = import_zod30.z.strictObject({
|
|
22507
|
+
checked: import_zod30.z.literal(true),
|
|
22508
|
+
found: import_zod30.z.boolean(),
|
|
22509
|
+
serviceName: import_zod30.z.string().optional(),
|
|
22510
|
+
note: import_zod30.z.string()
|
|
22511
|
+
});
|
|
22512
|
+
var CheckSettingsExposureSchema = import_zod30.z.strictObject({
|
|
22513
|
+
file: import_zod30.z.string(),
|
|
22514
|
+
envKeyNames: import_zod30.z.readonly(import_zod30.z.array(import_zod30.z.string())),
|
|
22515
|
+
hookEventNames: import_zod30.z.readonly(import_zod30.z.array(import_zod30.z.string())),
|
|
22516
|
+
hookCommandCount: import_zod30.z.int().nonnegative()
|
|
22517
|
+
});
|
|
22518
|
+
var CredentialSourceSummarySchema = import_zod30.z.union([
|
|
22519
|
+
import_zod30.z.strictObject({ kind: import_zod30.z.literal("env"), variable: import_zod30.z.string() }),
|
|
22520
|
+
import_zod30.z.strictObject({ kind: import_zod30.z.literal("file"), path: import_zod30.z.string() }),
|
|
22521
|
+
import_zod30.z.strictObject({ kind: import_zod30.z.literal("command"), program: import_zod30.z.string() }),
|
|
22522
|
+
import_zod30.z.strictObject({ kind: import_zod30.z.literal("op"), reference: import_zod30.z.string() }),
|
|
22523
|
+
import_zod30.z.strictObject({ kind: import_zod30.z.literal("keychain"), service: import_zod30.z.string(), account: import_zod30.z.string().optional() }),
|
|
22524
|
+
import_zod30.z.strictObject({ kind: import_zod30.z.literal("literal") })
|
|
22488
22525
|
]);
|
|
22489
|
-
var CredentialSummarySchema =
|
|
22490
|
-
target:
|
|
22491
|
-
sources:
|
|
22526
|
+
var CredentialSummarySchema = import_zod30.z.strictObject({
|
|
22527
|
+
target: import_zod30.z.enum(CREDENTIAL_TARGETS),
|
|
22528
|
+
sources: import_zod30.z.readonly(import_zod30.z.array(CredentialSourceSummarySchema)),
|
|
22492
22529
|
cache: CredentialCacheSchema.optional()
|
|
22493
22530
|
});
|
|
22494
|
-
var CachedCredentialStateSchema =
|
|
22495
|
-
|
|
22496
|
-
|
|
22497
|
-
|
|
22531
|
+
var CachedCredentialStateSchema = import_zod30.z.union([
|
|
22532
|
+
import_zod30.z.strictObject({ store: import_zod30.z.enum(CREDENTIAL_CACHE_STORES), status: import_zod30.z.literal("empty") }),
|
|
22533
|
+
import_zod30.z.strictObject({ store: import_zod30.z.enum(CREDENTIAL_CACHE_STORES), status: import_zod30.z.literal("unreadable"), reason: import_zod30.z.string() }),
|
|
22534
|
+
import_zod30.z.strictObject({ store: import_zod30.z.enum(CREDENTIAL_CACHE_STORES), status: import_zod30.z.enum(["fresh", "expired"]), ageMs: import_zod30.z.number(), expiresInMs: import_zod30.z.number().optional() })
|
|
22498
22535
|
]);
|
|
22499
|
-
var CheckCredentialProviderSchema =
|
|
22500
|
-
|
|
22501
|
-
|
|
22536
|
+
var CheckCredentialProviderSchema = import_zod30.z.union([
|
|
22537
|
+
import_zod30.z.strictObject({ name: import_zod30.z.string(), credential: CredentialSummarySchema.optional(), cached: CachedCredentialStateSchema.optional() }),
|
|
22538
|
+
import_zod30.z.strictObject({ name: import_zod30.z.string(), problem: import_zod30.z.string() })
|
|
22502
22539
|
]);
|
|
22503
|
-
var CheckProviderReachabilitySchema =
|
|
22504
|
-
|
|
22505
|
-
|
|
22540
|
+
var CheckProviderReachabilitySchema = import_zod30.z.union([
|
|
22541
|
+
import_zod30.z.strictObject({ name: import_zod30.z.string(), baseUrl: import_zod30.z.string(), ok: import_zod30.z.literal(true) }),
|
|
22542
|
+
import_zod30.z.strictObject({ name: import_zod30.z.string(), baseUrl: import_zod30.z.string(), ok: import_zod30.z.literal(false), message: import_zod30.z.string() })
|
|
22506
22543
|
]);
|
|
22507
|
-
var CheckCredentialSchema =
|
|
22508
|
-
applies:
|
|
22544
|
+
var CheckCredentialSchema = import_zod30.z.strictObject({
|
|
22545
|
+
applies: import_zod30.z.enum(CHECK_CREDENTIAL_APPLIES),
|
|
22509
22546
|
provider: CheckCredentialProviderSchema.optional(),
|
|
22510
22547
|
identity: CredentialSummarySchema.optional(),
|
|
22511
22548
|
identityCached: CachedCredentialStateSchema.optional()
|
|
22512
22549
|
});
|
|
22513
|
-
var CheckClaudeVersionSchema =
|
|
22514
|
-
pinned:
|
|
22515
|
-
highestInstalled:
|
|
22516
|
-
installed:
|
|
22550
|
+
var CheckClaudeVersionSchema = import_zod30.z.strictObject({
|
|
22551
|
+
pinned: import_zod30.z.strictObject({ version: import_zod30.z.string(), source: import_zod30.z.enum(CLAUDE_VERSION_SOURCES), installed: import_zod30.z.boolean() }).optional(),
|
|
22552
|
+
highestInstalled: import_zod30.z.string().optional(),
|
|
22553
|
+
installed: import_zod30.z.readonly(import_zod30.z.array(import_zod30.z.string()))
|
|
22517
22554
|
});
|
|
22518
|
-
var CheckReportJsonSchema =
|
|
22519
|
-
identity:
|
|
22555
|
+
var CheckReportJsonSchema = import_zod30.z.strictObject({
|
|
22556
|
+
identity: import_zod30.z.strictObject({ name: import_zod30.z.string().nullable(), source: import_zod30.z.enum(IDENTITY_DECISION_SOURCES) }),
|
|
22520
22557
|
/** The logins other identities lend this one through the front door; absent when none does. */
|
|
22521
|
-
borrowedLogins:
|
|
22558
|
+
borrowedLogins: import_zod30.z.readonly(import_zod30.z.array(import_zod30.z.strictObject({ from: import_zod30.z.string(), features: import_zod30.z.readonly(import_zod30.z.array(import_zod30.z.enum(GRANT_FEATURES))) }))).optional(),
|
|
22522
22559
|
/** The pool ranking, when the launch named a pool instead of an identity. */
|
|
22523
22560
|
pool: PoolPickReportSchema.optional(),
|
|
22524
|
-
configProfile:
|
|
22525
|
-
layers:
|
|
22526
|
-
entries:
|
|
22527
|
-
projectEncodingAmbiguities:
|
|
22528
|
-
|
|
22561
|
+
configProfile: import_zod30.z.strictObject({ name: import_zod30.z.string().nullable(), source: import_zod30.z.enum(CONFIG_PROFILE_DECISION_SOURCES) }),
|
|
22562
|
+
layers: import_zod30.z.readonly(import_zod30.z.array(CheckLayerViewSchema)),
|
|
22563
|
+
entries: import_zod30.z.readonly(import_zod30.z.array(CheckEntryViewSchema)),
|
|
22564
|
+
projectEncodingAmbiguities: import_zod30.z.readonly(
|
|
22565
|
+
import_zod30.z.array(import_zod30.z.strictObject({ fragment: import_zod30.z.string(), encoded: import_zod30.z.string(), reason: import_zod30.z.enum(ENCODING_AMBIGUITY_REASONS), detail: import_zod30.z.string() }))
|
|
22529
22566
|
),
|
|
22530
|
-
diagnostics:
|
|
22567
|
+
diagnostics: import_zod30.z.readonly(import_zod30.z.array(CheckDiagnosticSchema)),
|
|
22531
22568
|
ambientCredential: CheckAmbientCredentialSchema,
|
|
22532
22569
|
keychain: CheckKeychainSchema.optional(),
|
|
22533
|
-
settingsExposure:
|
|
22570
|
+
settingsExposure: import_zod30.z.readonly(import_zod30.z.array(CheckSettingsExposureSchema)),
|
|
22534
22571
|
credential: CheckCredentialSchema,
|
|
22535
22572
|
claudeVersion: CheckClaudeVersionSchema.optional(),
|
|
22536
22573
|
providerReachability: CheckProviderReachabilitySchema.optional(),
|
|
22537
22574
|
/** 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. */
|
|
22538
|
-
routeOverrides:
|
|
22539
|
-
|
|
22540
|
-
|
|
22575
|
+
routeOverrides: import_zod30.z.union([
|
|
22576
|
+
import_zod30.z.strictObject({ applying: import_zod30.z.readonly(import_zod30.z.array(import_zod30.z.strictObject({ model: import_zod30.z.string(), target: import_zod30.z.string(), scope: import_zod30.z.string(), outranks: import_zod30.z.readonly(import_zod30.z.array(import_zod30.z.strictObject({ scope: import_zod30.z.string(), target: import_zod30.z.string() }))) }))) }),
|
|
22577
|
+
import_zod30.z.strictObject({ fault: import_zod30.z.string() })
|
|
22541
22578
|
]).optional()
|
|
22542
22579
|
});
|
|
22543
22580
|
|
|
@@ -22547,28 +22584,28 @@ init_preflight();
|
|
|
22547
22584
|
init_resets();
|
|
22548
22585
|
|
|
22549
22586
|
// src/usage/resetsSchema.ts
|
|
22550
|
-
var
|
|
22551
|
-
var ResetRowSchema =
|
|
22552
|
-
identity:
|
|
22553
|
-
provider:
|
|
22587
|
+
var import_zod31 = require("zod");
|
|
22588
|
+
var ResetRowSchema = import_zod31.z.strictObject({
|
|
22589
|
+
identity: import_zod31.z.string(),
|
|
22590
|
+
provider: import_zod31.z.string(),
|
|
22554
22591
|
/** What the window is: `5h`, `7d` or `extra usage` for an Anthropic account, or the provider's own measure and period (`tokens 5h`). */
|
|
22555
|
-
window:
|
|
22592
|
+
window: import_zod31.z.string(),
|
|
22556
22593
|
/** When the state the window comes from was observed, as an ISO instant. */
|
|
22557
|
-
observedAt:
|
|
22594
|
+
observedAt: import_zod31.z.iso.datetime(),
|
|
22558
22595
|
/** When the window resets, as an ISO instant; absent when the upstream reported none. */
|
|
22559
|
-
resetsAt:
|
|
22596
|
+
resetsAt: import_zod31.z.iso.datetime().optional(),
|
|
22560
22597
|
/** True when the reset time has passed, so the recorded observation describes a window that no longer exists and its utilisation reads as 0. */
|
|
22561
|
-
reset:
|
|
22598
|
+
reset: import_zod31.z.boolean(),
|
|
22562
22599
|
/** The fraction used, as `effectiveWindow` reads it at the report's own clock. */
|
|
22563
|
-
utilization:
|
|
22600
|
+
utilization: import_zod31.z.number().optional(),
|
|
22564
22601
|
/** The window's own status, for a window that has not reset yet. */
|
|
22565
|
-
status:
|
|
22602
|
+
status: import_zod31.z.string().optional()
|
|
22566
22603
|
});
|
|
22567
|
-
var ResetScheduleSchema =
|
|
22604
|
+
var ResetScheduleSchema = import_zod31.z.strictObject({ resets: import_zod31.z.readonly(import_zod31.z.array(ResetRowSchema)) });
|
|
22568
22605
|
|
|
22569
22606
|
// src/frontdoor/controlSchemas.ts
|
|
22570
22607
|
var import_node_path46 = __toESM(require("node:path"), 1);
|
|
22571
|
-
var
|
|
22608
|
+
var import_zod41 = require("zod");
|
|
22572
22609
|
|
|
22573
22610
|
// src/codex/doctor.ts
|
|
22574
22611
|
function codexIdentityFindings(entry, identity) {
|
|
@@ -22864,7 +22901,7 @@ init_providersStore();
|
|
|
22864
22901
|
init_signIn();
|
|
22865
22902
|
init_realPorts();
|
|
22866
22903
|
var import_node_path42 = __toESM(require("node:path"), 1);
|
|
22867
|
-
var
|
|
22904
|
+
var import_zod34 = require("zod");
|
|
22868
22905
|
init_envBool();
|
|
22869
22906
|
init_load();
|
|
22870
22907
|
init_schema();
|
|
@@ -22949,9 +22986,9 @@ function lookupKeychainService(run, farmRoot) {
|
|
|
22949
22986
|
}
|
|
22950
22987
|
return { checked: true, found: true, serviceName, note: `Keychain service name for this identity: "${serviceName}".` };
|
|
22951
22988
|
}
|
|
22952
|
-
var SettingsSecretsShapeSchema =
|
|
22953
|
-
env:
|
|
22954
|
-
hooks:
|
|
22989
|
+
var SettingsSecretsShapeSchema = import_zod34.z.looseObject({
|
|
22990
|
+
env: import_zod34.z.record(import_zod34.z.string(), import_zod34.z.unknown()).optional(),
|
|
22991
|
+
hooks: import_zod34.z.record(import_zod34.z.string(), import_zod34.z.array(import_zod34.z.unknown())).optional()
|
|
22955
22992
|
});
|
|
22956
22993
|
function hookCommandCountOf(group) {
|
|
22957
22994
|
if (typeof group !== "object" || group === null) {
|
|
@@ -25419,93 +25456,93 @@ function collectDoctorReport(params) {
|
|
|
25419
25456
|
init_schema2();
|
|
25420
25457
|
init_rcSchemas();
|
|
25421
25458
|
init_state();
|
|
25422
|
-
var UsageListOutputSchema =
|
|
25423
|
-
var UsageWindowsInputSchema =
|
|
25424
|
-
identity:
|
|
25425
|
-
provider:
|
|
25459
|
+
var UsageListOutputSchema = import_zod41.z.strictObject({ snapshots: import_zod41.z.readonly(import_zod41.z.array(UsageSnapshotSchema)) });
|
|
25460
|
+
var UsageWindowsInputSchema = import_zod41.z.strictObject({
|
|
25461
|
+
identity: import_zod41.z.string().min(1),
|
|
25462
|
+
provider: import_zod41.z.string().min(1).optional()
|
|
25426
25463
|
});
|
|
25427
|
-
var EffectiveWindowSchema =
|
|
25464
|
+
var EffectiveWindowSchema = import_zod41.z.strictObject({
|
|
25428
25465
|
/** True when the window's reset time has passed, so the recorded observation describes a window that no longer exists. */
|
|
25429
|
-
reset:
|
|
25466
|
+
reset: import_zod41.z.boolean(),
|
|
25430
25467
|
/** The fraction used: 0 for a reset window, otherwise what was last observed, absent when none was reported. */
|
|
25431
|
-
utilization:
|
|
25468
|
+
utilization: import_zod41.z.number().optional(),
|
|
25432
25469
|
/** The reset instant, for a window that has not reset yet and reported one. */
|
|
25433
|
-
resetsAtMs:
|
|
25470
|
+
resetsAtMs: import_zod41.z.number().optional(),
|
|
25434
25471
|
/** The window's own status, for a window that has not reset yet. */
|
|
25435
|
-
status:
|
|
25472
|
+
status: import_zod41.z.string().optional()
|
|
25436
25473
|
});
|
|
25437
|
-
var UsageWindowsOutputSchema =
|
|
25438
|
-
identity:
|
|
25439
|
-
provider:
|
|
25474
|
+
var UsageWindowsOutputSchema = import_zod41.z.strictObject({
|
|
25475
|
+
identity: import_zod41.z.string(),
|
|
25476
|
+
provider: import_zod41.z.string(),
|
|
25440
25477
|
/** When the rate-limit state the windows come from was observed. */
|
|
25441
|
-
observedAt:
|
|
25478
|
+
observedAt: import_zod41.z.iso.datetime().optional(),
|
|
25442
25479
|
fiveHour: EffectiveWindowSchema.optional(),
|
|
25443
25480
|
sevenDay: EffectiveWindowSchema.optional()
|
|
25444
25481
|
});
|
|
25445
|
-
var UsageLiveOutputSchema =
|
|
25482
|
+
var UsageLiveOutputSchema = import_zod41.z.strictObject({
|
|
25446
25483
|
/** 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. */
|
|
25447
25484
|
latest: RcLiveRateLimitSchema.optional(),
|
|
25448
25485
|
/** One observation per session whose stream has filed a rate_limit_event this door generation. */
|
|
25449
|
-
sessions:
|
|
25486
|
+
sessions: import_zod41.z.readonly(import_zod41.z.array(RcLiveRateLimitSchema))
|
|
25450
25487
|
});
|
|
25451
|
-
var FrontDoorSessionStatusSchema =
|
|
25452
|
-
pid:
|
|
25453
|
-
startedAt:
|
|
25454
|
-
alive:
|
|
25488
|
+
var FrontDoorSessionStatusSchema = import_zod41.z.strictObject({
|
|
25489
|
+
pid: import_zod41.z.int().positive(),
|
|
25490
|
+
startedAt: import_zod41.z.number(),
|
|
25491
|
+
alive: import_zod41.z.boolean()
|
|
25455
25492
|
});
|
|
25456
|
-
var HeadroomSocketTargetSchema =
|
|
25457
|
-
var FrontDoorStatusOutputSchema =
|
|
25493
|
+
var HeadroomSocketTargetSchema = import_zod41.z.union([import_zod41.z.strictObject({ socketPath: import_zod41.z.string() }), import_zod41.z.strictObject({ refused: import_zod41.z.string() })]);
|
|
25494
|
+
var FrontDoorStatusOutputSchema = import_zod41.z.strictObject({
|
|
25458
25495
|
state: FrontDoorStateSchema,
|
|
25459
|
-
supervisorAlive:
|
|
25496
|
+
supervisorAlive: import_zod41.z.boolean(),
|
|
25460
25497
|
/** The pids of earlier doors that released their addresses and are finishing the connections they carried: running, but not serving anything new. */
|
|
25461
|
-
draining:
|
|
25462
|
-
sessions:
|
|
25498
|
+
draining: import_zod41.z.readonly(import_zod41.z.array(import_zod41.z.number().int().positive())),
|
|
25499
|
+
sessions: import_zod41.z.readonly(import_zod41.z.array(FrontDoorSessionStatusSchema)),
|
|
25463
25500
|
headroomSocket: HeadroomSocketTargetSchema.optional(),
|
|
25464
|
-
logPath:
|
|
25465
|
-
logExists:
|
|
25501
|
+
logPath: import_zod41.z.string(),
|
|
25502
|
+
logExists: import_zod41.z.boolean()
|
|
25466
25503
|
});
|
|
25467
|
-
var FrontDoorSessionsOutputSchema =
|
|
25504
|
+
var FrontDoorSessionsOutputSchema = import_zod41.z.strictObject({ sessions: import_zod41.z.readonly(import_zod41.z.array(FrontDoorSessionStatusSchema)) });
|
|
25468
25505
|
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.";
|
|
25469
|
-
var CheckRunInputSchema =
|
|
25470
|
-
path:
|
|
25471
|
-
identity:
|
|
25506
|
+
var CheckRunInputSchema = import_zod41.z.strictObject({
|
|
25507
|
+
path: import_zod41.z.string().min(1),
|
|
25508
|
+
identity: import_zod41.z.string().min(1).optional()
|
|
25472
25509
|
}).refine((input) => import_node_path46.default.isAbsolute(input.path), { message: "path must be absolute: the door cannot resolve a relative path against the caller's working directory" });
|
|
25473
|
-
var PoolPickInputSchema =
|
|
25474
|
-
pool:
|
|
25475
|
-
path:
|
|
25510
|
+
var PoolPickInputSchema = import_zod41.z.strictObject({
|
|
25511
|
+
pool: import_zod41.z.string().min(1),
|
|
25512
|
+
path: import_zod41.z.string().min(1)
|
|
25476
25513
|
}).refine((input) => import_node_path46.default.isAbsolute(input.path), { message: "path must be absolute: the door cannot resolve a relative path against the caller's working directory" });
|
|
25477
|
-
var DoctorFindingSchema =
|
|
25478
|
-
section:
|
|
25479
|
-
subject:
|
|
25480
|
-
severity:
|
|
25481
|
-
message:
|
|
25514
|
+
var DoctorFindingSchema = import_zod41.z.strictObject({
|
|
25515
|
+
section: import_zod41.z.enum(DOCTOR_SECTIONS),
|
|
25516
|
+
subject: import_zod41.z.string().optional(),
|
|
25517
|
+
severity: import_zod41.z.enum(DOCTOR_SEVERITIES),
|
|
25518
|
+
message: import_zod41.z.string()
|
|
25482
25519
|
});
|
|
25483
|
-
var DoctorRunOutputSchema =
|
|
25520
|
+
var DoctorRunOutputSchema = import_zod41.z.strictObject({
|
|
25484
25521
|
/** False exactly when any finding is a `fail`; a `warn` never fails the report on its own. */
|
|
25485
|
-
ok:
|
|
25486
|
-
findings:
|
|
25487
|
-
});
|
|
25488
|
-
var FrontDoorRestartOutputSchema =
|
|
25489
|
-
action:
|
|
25490
|
-
previousPid:
|
|
25491
|
-
});
|
|
25492
|
-
var UpdateCheckOutputSchema =
|
|
25493
|
-
current:
|
|
25494
|
-
latest:
|
|
25495
|
-
action:
|
|
25496
|
-
});
|
|
25497
|
-
var CodexSignInSchema =
|
|
25498
|
-
|
|
25499
|
-
|
|
25500
|
-
|
|
25522
|
+
ok: import_zod41.z.boolean(),
|
|
25523
|
+
findings: import_zod41.z.readonly(import_zod41.z.array(DoctorFindingSchema))
|
|
25524
|
+
});
|
|
25525
|
+
var FrontDoorRestartOutputSchema = import_zod41.z.strictObject({
|
|
25526
|
+
action: import_zod41.z.literal("restarting"),
|
|
25527
|
+
previousPid: import_zod41.z.int().positive()
|
|
25528
|
+
});
|
|
25529
|
+
var UpdateCheckOutputSchema = import_zod41.z.strictObject({
|
|
25530
|
+
current: import_zod41.z.string(),
|
|
25531
|
+
latest: import_zod41.z.string(),
|
|
25532
|
+
action: import_zod41.z.enum(["current", "available", "updated"])
|
|
25533
|
+
});
|
|
25534
|
+
var CodexSignInSchema = import_zod41.z.discriminatedUnion("state", [
|
|
25535
|
+
import_zod41.z.strictObject({ state: import_zod41.z.literal("none") }),
|
|
25536
|
+
import_zod41.z.strictObject({ state: import_zod41.z.literal("signed-in"), email: import_zod41.z.string().optional(), planScope: import_zod41.z.boolean(), accessTokenExpiresAt: import_zod41.z.number() }),
|
|
25537
|
+
import_zod41.z.strictObject({ state: import_zod41.z.literal("unreadable"), message: import_zod41.z.string() })
|
|
25501
25538
|
]);
|
|
25502
|
-
var CodexStatusOutputSchema =
|
|
25539
|
+
var CodexStatusOutputSchema = import_zod41.z.strictObject({
|
|
25503
25540
|
signIn: CodexSignInSchema,
|
|
25504
|
-
codexProviders:
|
|
25541
|
+
codexProviders: import_zod41.z.readonly(import_zod41.z.array(import_zod41.z.string()))
|
|
25505
25542
|
});
|
|
25506
|
-
var CodexLogoutOutputSchema =
|
|
25507
|
-
hadGrant:
|
|
25508
|
-
revoked:
|
|
25543
|
+
var CodexLogoutOutputSchema = import_zod41.z.strictObject({
|
|
25544
|
+
hadGrant: import_zod41.z.boolean(),
|
|
25545
|
+
revoked: import_zod41.z.boolean()
|
|
25509
25546
|
});
|
|
25510
25547
|
|
|
25511
25548
|
// src/frontdoor/codexApi.ts
|
|
@@ -25526,21 +25563,21 @@ function createCodexApiRouter(deps) {
|
|
|
25526
25563
|
|
|
25527
25564
|
// src/frontdoor/doorWorker.ts
|
|
25528
25565
|
var import_node_sea2 = require("node:sea");
|
|
25529
|
-
var
|
|
25566
|
+
var import_zod43 = require("zod");
|
|
25530
25567
|
init_cliError();
|
|
25531
25568
|
init_doorBounds();
|
|
25532
25569
|
init_providerCatalogue();
|
|
25533
25570
|
|
|
25534
25571
|
// src/frontdoor/doorWorkerProtocol.ts
|
|
25535
|
-
var
|
|
25572
|
+
var import_zod42 = require("zod");
|
|
25536
25573
|
init_providerCatalogue();
|
|
25537
25574
|
var doorWorkerInputSchemas = {
|
|
25538
25575
|
/** `agent-shim check` for `path` as `identity` (the identity a launch there would resolve when absent). */
|
|
25539
|
-
check:
|
|
25576
|
+
check: import_zod42.z.strictObject({ root: import_zod42.z.string().min(1), path: import_zod42.z.string().min(1), identity: import_zod42.z.string().min(1).optional() }),
|
|
25540
25577
|
/** `agent-shim doctor`. */
|
|
25541
|
-
doctor:
|
|
25578
|
+
doctor: import_zod42.z.strictObject({ root: import_zod42.z.string().min(1) }),
|
|
25542
25579
|
/** Fetch and store one provider's model catalogue for the door generation that asked. */
|
|
25543
|
-
"refresh-catalogue":
|
|
25580
|
+
"refresh-catalogue": import_zod42.z.strictObject({ root: import_zod42.z.string().min(1), name: import_zod42.z.string().min(1), supervisorPid: import_zod42.z.int().positive(), generation: import_zod42.z.uuid() })
|
|
25544
25581
|
};
|
|
25545
25582
|
|
|
25546
25583
|
// src/frontdoor/doorWorker.ts
|
|
@@ -25633,80 +25670,80 @@ init_baseUrlDisplay();
|
|
|
25633
25670
|
init_providersStore();
|
|
25634
25671
|
|
|
25635
25672
|
// src/frontdoor/configSchemas.ts
|
|
25636
|
-
var
|
|
25673
|
+
var import_zod44 = require("zod");
|
|
25637
25674
|
init_schema();
|
|
25638
25675
|
init_names();
|
|
25639
25676
|
init_keychainLogin();
|
|
25640
25677
|
init_statusline();
|
|
25641
25678
|
init_toolLogins();
|
|
25642
|
-
var RemovalConfirmationSchema =
|
|
25643
|
-
var CredentialWriteSchema = (targets) =>
|
|
25644
|
-
sources:
|
|
25645
|
-
target:
|
|
25646
|
-
cache:
|
|
25647
|
-
});
|
|
25648
|
-
var CredentialSummarySchema2 =
|
|
25649
|
-
target:
|
|
25650
|
-
sources:
|
|
25651
|
-
|
|
25652
|
-
|
|
25653
|
-
|
|
25654
|
-
|
|
25655
|
-
|
|
25656
|
-
|
|
25657
|
-
|
|
25679
|
+
var RemovalConfirmationSchema = import_zod44.z.boolean();
|
|
25680
|
+
var CredentialWriteSchema = (targets) => import_zod44.z.strictObject({
|
|
25681
|
+
sources: import_zod44.z.array(RemoteCredentialSourceSchema).min(1).optional(),
|
|
25682
|
+
target: import_zod44.z.enum(targets).optional(),
|
|
25683
|
+
cache: import_zod44.z.union([import_zod44.z.literal(false), CredentialCacheSchema]).optional()
|
|
25684
|
+
});
|
|
25685
|
+
var CredentialSummarySchema2 = import_zod44.z.strictObject({
|
|
25686
|
+
target: import_zod44.z.enum(CREDENTIAL_TARGETS),
|
|
25687
|
+
sources: import_zod44.z.readonly(import_zod44.z.array(
|
|
25688
|
+
import_zod44.z.discriminatedUnion("kind", [
|
|
25689
|
+
import_zod44.z.strictObject({ kind: import_zod44.z.literal("env"), variable: import_zod44.z.string() }),
|
|
25690
|
+
import_zod44.z.strictObject({ kind: import_zod44.z.literal("file"), path: import_zod44.z.string() }),
|
|
25691
|
+
import_zod44.z.strictObject({ kind: import_zod44.z.literal("command"), program: import_zod44.z.string() }),
|
|
25692
|
+
import_zod44.z.strictObject({ kind: import_zod44.z.literal("op"), reference: import_zod44.z.string() }),
|
|
25693
|
+
import_zod44.z.strictObject({ kind: import_zod44.z.literal("keychain"), service: import_zod44.z.string(), account: import_zod44.z.string().optional() }),
|
|
25694
|
+
import_zod44.z.strictObject({ kind: import_zod44.z.literal("literal") })
|
|
25658
25695
|
])
|
|
25659
25696
|
)),
|
|
25660
25697
|
cache: CredentialCacheSchema.optional()
|
|
25661
25698
|
});
|
|
25662
|
-
var mutationOutput = (kind, action) =>
|
|
25663
|
-
var storedMutationOutput = (kind, action, value) =>
|
|
25664
|
-
var IdentityValueSchema =
|
|
25665
|
-
agent:
|
|
25666
|
-
name:
|
|
25667
|
-
label:
|
|
25668
|
-
defaultConfigProfile:
|
|
25669
|
-
provider:
|
|
25670
|
-
allowAmbientCredential:
|
|
25699
|
+
var mutationOutput = (kind, action) => import_zod44.z.strictObject({ action: import_zod44.z.literal(action), kind: import_zod44.z.literal(kind), name: import_zod44.z.string() });
|
|
25700
|
+
var storedMutationOutput = (kind, action, value) => import_zod44.z.strictObject({ action: import_zod44.z.literal(action), kind: import_zod44.z.literal(kind), name: import_zod44.z.string(), value });
|
|
25701
|
+
var IdentityValueSchema = import_zod44.z.strictObject({
|
|
25702
|
+
agent: import_zod44.z.enum(["claude", "codex"]).optional(),
|
|
25703
|
+
name: import_zod44.z.string(),
|
|
25704
|
+
label: import_zod44.z.string().optional(),
|
|
25705
|
+
defaultConfigProfile: import_zod44.z.string().optional(),
|
|
25706
|
+
provider: import_zod44.z.string().optional(),
|
|
25707
|
+
allowAmbientCredential: import_zod44.z.boolean(),
|
|
25671
25708
|
credential: CredentialSummarySchema2.optional(),
|
|
25672
|
-
anchors:
|
|
25709
|
+
anchors: import_zod44.z.array(AnchorSchema).optional(),
|
|
25673
25710
|
/** 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. */
|
|
25674
|
-
grants:
|
|
25711
|
+
grants: import_zod44.z.array(IdentityGrantSchema).optional(),
|
|
25675
25712
|
toolLogins: ToolLoginsSchema.optional()
|
|
25676
25713
|
});
|
|
25677
25714
|
var ProfileValueSchema = ConfigProfileSchema.omit({ $schema: true });
|
|
25678
|
-
var ProviderValueSchema =
|
|
25679
|
-
name:
|
|
25680
|
-
kind:
|
|
25681
|
-
displayName:
|
|
25682
|
-
baseUrl:
|
|
25715
|
+
var ProviderValueSchema = import_zod44.z.strictObject({
|
|
25716
|
+
name: import_zod44.z.string(),
|
|
25717
|
+
kind: import_zod44.z.enum(PROVIDER_KINDS),
|
|
25718
|
+
displayName: import_zod44.z.string(),
|
|
25719
|
+
baseUrl: import_zod44.z.string().optional(),
|
|
25683
25720
|
codex: CodexProviderConfigSchema.optional(),
|
|
25684
25721
|
credential: CredentialSummarySchema2.optional(),
|
|
25685
|
-
env:
|
|
25722
|
+
env: import_zod44.z.record(import_zod44.z.string(), import_zod44.z.string()).optional()
|
|
25686
25723
|
});
|
|
25687
|
-
var ConfigNameInputSchema =
|
|
25688
|
-
var ConfigIdentityAddInputSchema =
|
|
25724
|
+
var ConfigNameInputSchema = import_zod44.z.strictObject({ name: import_zod44.z.string().min(1) });
|
|
25725
|
+
var ConfigIdentityAddInputSchema = import_zod44.z.strictObject({ name: import_zod44.z.string().min(1), keepKeychainLogin: import_zod44.z.boolean().optional().describe(KEEP_KEYCHAIN_LOGIN_DESCRIPTION) });
|
|
25689
25726
|
var ConfigIdentityAddOutputSchema = storedMutationOutput("identity", "created", IdentityValueSchema);
|
|
25690
|
-
var ConfigIdentitySetInputSchema =
|
|
25691
|
-
name:
|
|
25727
|
+
var ConfigIdentitySetInputSchema = import_zod44.z.strictObject({
|
|
25728
|
+
name: import_zod44.z.string().min(1),
|
|
25692
25729
|
/** The identity's display label; `false` clears it. */
|
|
25693
|
-
label:
|
|
25694
|
-
defaultConfigProfile:
|
|
25730
|
+
label: import_zod44.z.union([IdentityLabelSchema, import_zod44.z.literal(false)]).optional(),
|
|
25731
|
+
defaultConfigProfile: import_zod44.z.union([import_zod44.z.string().min(1), import_zod44.z.literal(false)]).optional(),
|
|
25695
25732
|
/** The provider the identity exists for; `false` clears it. */
|
|
25696
|
-
provider:
|
|
25697
|
-
allowAmbientCredential:
|
|
25698
|
-
credential:
|
|
25733
|
+
provider: import_zod44.z.union([import_zod44.z.string().min(1), import_zod44.z.literal(false)]).optional(),
|
|
25734
|
+
allowAmbientCredential: import_zod44.z.boolean().optional(),
|
|
25735
|
+
credential: import_zod44.z.union([import_zod44.z.literal(false), CredentialWriteSchema(CREDENTIAL_TARGETS)]).optional(),
|
|
25699
25736
|
/** `false` removes the anchors; a list replaces them. */
|
|
25700
|
-
anchors:
|
|
25737
|
+
anchors: import_zod44.z.union([import_zod44.z.literal(false), import_zod44.z.array(AnchorSchema).min(1)]).optional(),
|
|
25701
25738
|
/** Each assignment replaces whatever that surface already named. */
|
|
25702
|
-
toolLogin:
|
|
25739
|
+
toolLogin: import_zod44.z.array(import_zod44.z.strictObject({ surface: import_zod44.z.enum(TOOL_SURFACES), lender: import_zod44.z.string().min(1) })).optional(),
|
|
25703
25740
|
/** Surfaces to return to the identity's own login. */
|
|
25704
|
-
clearToolLogin:
|
|
25741
|
+
clearToolLogin: import_zod44.z.array(import_zod44.z.enum(TOOL_SURFACES)).optional()
|
|
25705
25742
|
});
|
|
25706
25743
|
var ConfigIdentitySetOutputSchema = storedMutationOutput("identity", "updated", IdentityValueSchema);
|
|
25707
|
-
var ConfigIdentityRemoveInputSchema =
|
|
25744
|
+
var ConfigIdentityRemoveInputSchema = import_zod44.z.strictObject({ name: import_zod44.z.string().min(1), confirm: RemovalConfirmationSchema });
|
|
25708
25745
|
var ConfigIdentityRemoveOutputSchema = mutationOutput("identity", "removed");
|
|
25709
|
-
var ConfigStatuslineSetSchema =
|
|
25746
|
+
var ConfigStatuslineSetSchema = import_zod44.z.record(import_zod44.z.string(), import_zod44.z.unknown()).superRefine((settings, context) => {
|
|
25710
25747
|
for (const key of Object.keys(settings)) {
|
|
25711
25748
|
if (key === STATUSLINE_EXTRA_GROUP || key.startsWith(`${STATUSLINE_EXTRA_GROUP}.`)) {
|
|
25712
25749
|
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` });
|
|
@@ -25714,102 +25751,102 @@ var ConfigStatuslineSetSchema = import_zod43.z.record(import_zod43.z.string(), i
|
|
|
25714
25751
|
}
|
|
25715
25752
|
});
|
|
25716
25753
|
var ConfigIdentityUseOutputSchema = mutationOutput("identity", "selected");
|
|
25717
|
-
var ConfigProfileAddInputSchema =
|
|
25718
|
-
name:
|
|
25719
|
-
extends:
|
|
25720
|
-
description:
|
|
25754
|
+
var ConfigProfileAddInputSchema = import_zod44.z.strictObject({
|
|
25755
|
+
name: import_zod44.z.string().min(1),
|
|
25756
|
+
extends: import_zod44.z.array(import_zod44.z.string().min(1)).optional(),
|
|
25757
|
+
description: import_zod44.z.string().optional()
|
|
25721
25758
|
});
|
|
25722
25759
|
var ConfigProfileAddOutputSchema = storedMutationOutput("profile", "created", ProfileValueSchema);
|
|
25723
|
-
var ConfigProfileSetInputSchema =
|
|
25724
|
-
name:
|
|
25725
|
-
category:
|
|
25726
|
-
entry:
|
|
25727
|
-
extends:
|
|
25728
|
-
description:
|
|
25729
|
-
launch:
|
|
25730
|
-
skipPermissions:
|
|
25731
|
-
remoteControl:
|
|
25732
|
-
headroom:
|
|
25733
|
-
trackUsage:
|
|
25734
|
-
provider:
|
|
25735
|
-
claudeVersion:
|
|
25736
|
-
delay:
|
|
25737
|
-
pause:
|
|
25738
|
-
explain:
|
|
25739
|
-
proxyBypass:
|
|
25740
|
-
statusline:
|
|
25760
|
+
var ConfigProfileSetInputSchema = import_zod44.z.strictObject({
|
|
25761
|
+
name: import_zod44.z.string().min(1),
|
|
25762
|
+
category: import_zod44.z.record(import_zod44.z.string(), import_zod44.z.boolean()).optional(),
|
|
25763
|
+
entry: import_zod44.z.record(import_zod44.z.string(), import_zod44.z.boolean()).optional(),
|
|
25764
|
+
extends: import_zod44.z.union([import_zod44.z.array(import_zod44.z.string().min(1)), import_zod44.z.literal(false)]).optional(),
|
|
25765
|
+
description: import_zod44.z.union([import_zod44.z.string(), import_zod44.z.literal(false)]).optional(),
|
|
25766
|
+
launch: import_zod44.z.strictObject({
|
|
25767
|
+
skipPermissions: import_zod44.z.boolean().optional(),
|
|
25768
|
+
remoteControl: import_zod44.z.boolean().optional(),
|
|
25769
|
+
headroom: import_zod44.z.boolean().optional(),
|
|
25770
|
+
trackUsage: import_zod44.z.boolean().optional(),
|
|
25771
|
+
provider: import_zod44.z.union([import_zod44.z.string().min(1), import_zod44.z.literal(false)]).optional(),
|
|
25772
|
+
claudeVersion: import_zod44.z.union([import_zod44.z.string().min(1), import_zod44.z.literal(false)]).optional(),
|
|
25773
|
+
delay: import_zod44.z.union([import_zod44.z.string().regex(DURATION_RE), import_zod44.z.literal(false)]).optional(),
|
|
25774
|
+
pause: import_zod44.z.boolean().optional(),
|
|
25775
|
+
explain: import_zod44.z.boolean().optional(),
|
|
25776
|
+
proxyBypass: import_zod44.z.union([import_zod44.z.array(import_zod44.z.string().min(1)), import_zod44.z.literal(false)]).optional(),
|
|
25777
|
+
statusline: import_zod44.z.strictObject({
|
|
25741
25778
|
set: ConfigStatuslineSetSchema.optional(),
|
|
25742
|
-
unset:
|
|
25779
|
+
unset: import_zod44.z.array(import_zod44.z.string()).optional()
|
|
25743
25780
|
}).optional()
|
|
25744
25781
|
}).optional()
|
|
25745
25782
|
});
|
|
25746
25783
|
var ConfigProfileSetOutputSchema = storedMutationOutput("profile", "updated", ProfileValueSchema);
|
|
25747
|
-
var ConfigProfileRemoveInputSchema =
|
|
25784
|
+
var ConfigProfileRemoveInputSchema = import_zod44.z.strictObject({ name: import_zod44.z.string().min(1), confirm: RemovalConfirmationSchema });
|
|
25748
25785
|
var ConfigProfileRemoveOutputSchema = mutationOutput("profile", "removed");
|
|
25749
25786
|
var ConfigProfileUseOutputSchema = mutationOutput("profile", "selected");
|
|
25750
|
-
var PoolMembersInputSchema =
|
|
25751
|
-
var ConfigPoolAddInputSchema =
|
|
25752
|
-
name:
|
|
25787
|
+
var PoolMembersInputSchema = import_zod44.z.array(import_zod44.z.string().min(1)).min(1);
|
|
25788
|
+
var ConfigPoolAddInputSchema = import_zod44.z.strictObject({
|
|
25789
|
+
name: import_zod44.z.string().min(1),
|
|
25753
25790
|
identities: PoolMembersInputSchema,
|
|
25754
|
-
preference:
|
|
25755
|
-
resumeOnLimit:
|
|
25756
|
-
compactBeforeLimit:
|
|
25791
|
+
preference: import_zod44.z.enum(POOL_PREFERENCES).optional(),
|
|
25792
|
+
resumeOnLimit: import_zod44.z.boolean().optional(),
|
|
25793
|
+
compactBeforeLimit: import_zod44.z.boolean().optional(),
|
|
25757
25794
|
compactAtUtilisation: CompactAtUtilisationSchema.optional()
|
|
25758
25795
|
});
|
|
25759
25796
|
var ConfigPoolAddOutputSchema = storedMutationOutput("pool", "created", PoolSchema);
|
|
25760
|
-
var ConfigPoolSetInputSchema =
|
|
25761
|
-
name:
|
|
25797
|
+
var ConfigPoolSetInputSchema = import_zod44.z.strictObject({
|
|
25798
|
+
name: import_zod44.z.string().min(1),
|
|
25762
25799
|
identities: PoolMembersInputSchema.optional(),
|
|
25763
|
-
preference:
|
|
25764
|
-
resumeOnLimit:
|
|
25765
|
-
compactBeforeLimit:
|
|
25766
|
-
compactAtUtilisation:
|
|
25800
|
+
preference: import_zod44.z.union([import_zod44.z.enum(POOL_PREFERENCES), import_zod44.z.literal(false)]).optional(),
|
|
25801
|
+
resumeOnLimit: import_zod44.z.boolean().optional(),
|
|
25802
|
+
compactBeforeLimit: import_zod44.z.boolean().optional(),
|
|
25803
|
+
compactAtUtilisation: import_zod44.z.union([CompactAtUtilisationSchema, import_zod44.z.literal(false)]).optional()
|
|
25767
25804
|
});
|
|
25768
25805
|
var ConfigPoolSetOutputSchema = storedMutationOutput("pool", "updated", PoolSchema);
|
|
25769
|
-
var ConfigPoolRemoveInputSchema =
|
|
25806
|
+
var ConfigPoolRemoveInputSchema = import_zod44.z.strictObject({ name: import_zod44.z.string().min(1), confirm: RemovalConfirmationSchema });
|
|
25770
25807
|
var ConfigPoolRemoveOutputSchema = mutationOutput("pool", "removed");
|
|
25771
25808
|
var ConfigPoolUseOutputSchema = mutationOutput("pool", "selected");
|
|
25772
|
-
var ConfigProviderAddInputSchema =
|
|
25773
|
-
name:
|
|
25774
|
-
kind:
|
|
25775
|
-
displayName:
|
|
25776
|
-
baseUrl:
|
|
25809
|
+
var ConfigProviderAddInputSchema = import_zod44.z.strictObject({
|
|
25810
|
+
name: import_zod44.z.string().min(1),
|
|
25811
|
+
kind: import_zod44.z.enum(PROVIDER_KINDS).optional(),
|
|
25812
|
+
displayName: import_zod44.z.string().min(1),
|
|
25813
|
+
baseUrl: import_zod44.z.string().min(1).optional(),
|
|
25777
25814
|
credential: CredentialWriteSchema(PROVIDER_CREDENTIAL_TARGETS).required({ sources: true }),
|
|
25778
25815
|
codex: CodexProviderConfigSchema.optional()
|
|
25779
25816
|
});
|
|
25780
25817
|
var ConfigProviderAddOutputSchema = storedMutationOutput("provider", "created", ProviderValueSchema);
|
|
25781
|
-
var ConfigProviderSetInputSchema =
|
|
25782
|
-
name:
|
|
25783
|
-
displayName:
|
|
25784
|
-
baseUrl:
|
|
25818
|
+
var ConfigProviderSetInputSchema = import_zod44.z.strictObject({
|
|
25819
|
+
name: import_zod44.z.string().min(1),
|
|
25820
|
+
displayName: import_zod44.z.string().min(1).optional(),
|
|
25821
|
+
baseUrl: import_zod44.z.string().min(1).optional(),
|
|
25785
25822
|
credential: CredentialWriteSchema(PROVIDER_CREDENTIAL_TARGETS).optional(),
|
|
25786
25823
|
codex: CodexProviderConfigSchema.optional()
|
|
25787
25824
|
});
|
|
25788
25825
|
var ConfigProviderSetOutputSchema = storedMutationOutput("provider", "updated", ProviderValueSchema);
|
|
25789
|
-
var ConfigProviderRemoveInputSchema =
|
|
25826
|
+
var ConfigProviderRemoveInputSchema = import_zod44.z.strictObject({ name: import_zod44.z.string().min(1), confirm: RemovalConfirmationSchema });
|
|
25790
25827
|
var ConfigProviderRemoveOutputSchema = mutationOutput("provider", "removed");
|
|
25791
|
-
var ConfigRuleAddInputSchema =
|
|
25792
|
-
path:
|
|
25793
|
-
configProfile:
|
|
25794
|
-
identity:
|
|
25828
|
+
var ConfigRuleAddInputSchema = import_zod44.z.strictObject({
|
|
25829
|
+
path: import_zod44.z.string().min(1),
|
|
25830
|
+
configProfile: import_zod44.z.string().min(1).optional(),
|
|
25831
|
+
identity: import_zod44.z.string().min(1).optional()
|
|
25795
25832
|
});
|
|
25796
25833
|
var ConfigRuleAddOutputSchema = storedMutationOutput("rule", "created", DirectoryRuleSchema);
|
|
25797
|
-
var ConfigRuleSetInputSchema =
|
|
25798
|
-
path:
|
|
25799
|
-
configProfile:
|
|
25800
|
-
identity:
|
|
25834
|
+
var ConfigRuleSetInputSchema = import_zod44.z.strictObject({
|
|
25835
|
+
path: import_zod44.z.string().min(1),
|
|
25836
|
+
configProfile: import_zod44.z.union([import_zod44.z.string().min(1), import_zod44.z.literal(false)]).optional(),
|
|
25837
|
+
identity: import_zod44.z.union([import_zod44.z.string().min(1), import_zod44.z.literal(false)]).optional()
|
|
25801
25838
|
});
|
|
25802
25839
|
var ConfigRuleSetOutputSchema = storedMutationOutput("rule", "updated", DirectoryRuleSchema);
|
|
25803
|
-
var ConfigRuleRemoveInputSchema =
|
|
25840
|
+
var ConfigRuleRemoveInputSchema = import_zod44.z.strictObject({ path: import_zod44.z.string().min(1), confirm: RemovalConfirmationSchema });
|
|
25804
25841
|
var ConfigRuleRemoveOutputSchema = mutationOutput("rule", "removed");
|
|
25805
|
-
var RouteScopeInputSchema =
|
|
25806
|
-
|
|
25807
|
-
|
|
25842
|
+
var RouteScopeInputSchema = import_zod44.z.union([
|
|
25843
|
+
import_zod44.z.strictObject({ kind: import_zod44.z.literal("global") }),
|
|
25844
|
+
import_zod44.z.strictObject({ kind: import_zod44.z.enum(["session", "identity", "provider"]), name: import_zod44.z.string().min(1) })
|
|
25808
25845
|
]);
|
|
25809
|
-
var ConfigRouteSetInputSchema =
|
|
25810
|
-
var ConfigRouteSetOutputSchema = storedMutationOutput("route", "updated",
|
|
25811
|
-
var ConfigRouteRemoveInputSchema =
|
|
25812
|
-
var ConfigRouteRemoveOutputSchema =
|
|
25846
|
+
var ConfigRouteSetInputSchema = import_zod44.z.strictObject({ scope: RouteScopeInputSchema, model: import_zod44.z.string().min(1), target: import_zod44.z.string().min(1) });
|
|
25847
|
+
var ConfigRouteSetOutputSchema = storedMutationOutput("route", "updated", import_zod44.z.strictObject({ scope: import_zod44.z.string(), model: import_zod44.z.string(), target: import_zod44.z.string() }));
|
|
25848
|
+
var ConfigRouteRemoveInputSchema = import_zod44.z.strictObject({ scope: RouteScopeInputSchema, model: import_zod44.z.string().min(1), confirm: RemovalConfirmationSchema });
|
|
25849
|
+
var ConfigRouteRemoveOutputSchema = import_zod44.z.strictObject({ action: import_zod44.z.literal("removed"), kind: import_zod44.z.literal("route"), name: import_zod44.z.string(), removed: import_zod44.z.array(import_zod44.z.string()) });
|
|
25813
25850
|
|
|
25814
25851
|
// src/routeOverrides.ts
|
|
25815
25852
|
init_commandDeps();
|
|
@@ -26204,51 +26241,51 @@ var import_openapi4 = require("@orpc/openapi");
|
|
|
26204
26241
|
var import_server3 = require("@orpc/server");
|
|
26205
26242
|
|
|
26206
26243
|
// src/frontdoor/eventSchemas.ts
|
|
26207
|
-
var
|
|
26244
|
+
var import_zod45 = require("zod");
|
|
26208
26245
|
init_schema2();
|
|
26209
26246
|
var DOOR_EVENT_SOURCE_RC = "rc";
|
|
26210
26247
|
var LAUNCH_EVENT_SOURCE = "launch";
|
|
26211
26248
|
var USAGE_EVENT_SOURCE = "usage";
|
|
26212
26249
|
var DOOR_HEALTH_EVENT_SOURCE = "door";
|
|
26213
26250
|
var QUOTA_EXPIRING_EVENT_SOURCE = "quota-expiring";
|
|
26214
|
-
var DoorEventSchema =
|
|
26215
|
-
source:
|
|
26251
|
+
var DoorEventSchema = import_zod45.z.strictObject({
|
|
26252
|
+
source: import_zod45.z.string().min(1),
|
|
26216
26253
|
/** A positive integer because the backbone's counters start at one and only ever increase. */
|
|
26217
|
-
sequence:
|
|
26218
|
-
payload:
|
|
26219
|
-
});
|
|
26220
|
-
var DoorEventSourceQuerySchema =
|
|
26221
|
-
sources:
|
|
26222
|
-
});
|
|
26223
|
-
var LaunchLifecycleEventSchema =
|
|
26224
|
-
kind:
|
|
26225
|
-
pid:
|
|
26226
|
-
startedAt:
|
|
26227
|
-
observedAt:
|
|
26228
|
-
});
|
|
26229
|
-
var DoorHealthEventSchema =
|
|
26230
|
-
|
|
26231
|
-
|
|
26232
|
-
|
|
26233
|
-
|
|
26234
|
-
|
|
26235
|
-
|
|
26254
|
+
sequence: import_zod45.z.number().int().positive(),
|
|
26255
|
+
payload: import_zod45.z.unknown()
|
|
26256
|
+
});
|
|
26257
|
+
var DoorEventSourceQuerySchema = import_zod45.z.strictObject({
|
|
26258
|
+
sources: import_zod45.z.array(import_zod45.z.string().min(1)).min(1).optional()
|
|
26259
|
+
});
|
|
26260
|
+
var LaunchLifecycleEventSchema = import_zod45.z.strictObject({
|
|
26261
|
+
kind: import_zod45.z.enum(["registered", "pruned", "ended"]),
|
|
26262
|
+
pid: import_zod45.z.number().int().positive(),
|
|
26263
|
+
startedAt: import_zod45.z.number(),
|
|
26264
|
+
observedAt: import_zod45.z.number()
|
|
26265
|
+
});
|
|
26266
|
+
var DoorHealthEventSchema = import_zod45.z.discriminatedUnion("kind", [
|
|
26267
|
+
import_zod45.z.strictObject({ kind: import_zod45.z.literal("generation"), pid: import_zod45.z.number().int().positive(), providerPort: import_zod45.z.number().int().positive(), connectPort: import_zod45.z.number().int().positive(), directPort: import_zod45.z.number().int().positive(), observedAt: import_zod45.z.number() }),
|
|
26268
|
+
import_zod45.z.strictObject({ kind: import_zod45.z.literal("listenerFailed"), pid: import_zod45.z.number().int().positive(), listener: import_zod45.z.enum(["provider", "connect", "direct"]), message: import_zod45.z.string(), observedAt: import_zod45.z.number() }),
|
|
26269
|
+
import_zod45.z.strictObject({ kind: import_zod45.z.literal("binaryTurnover"), pid: import_zod45.z.number().int().positive(), observedAt: import_zod45.z.number() }),
|
|
26270
|
+
import_zod45.z.strictObject({ kind: import_zod45.z.literal("idleShutdown"), pid: import_zod45.z.number().int().positive(), observedAt: import_zod45.z.number() }),
|
|
26271
|
+
import_zod45.z.strictObject({ kind: import_zod45.z.literal("superseded"), pid: import_zod45.z.number().int().positive(), ownerPid: import_zod45.z.number().int().positive(), observedAt: import_zod45.z.number() }),
|
|
26272
|
+
import_zod45.z.strictObject({ kind: import_zod45.z.literal("drained"), pid: import_zod45.z.number().int().positive(), observedAt: import_zod45.z.number() })
|
|
26236
26273
|
]);
|
|
26237
|
-
var QuotaExpiringEventSchema =
|
|
26274
|
+
var QuotaExpiringEventSchema = import_zod45.z.strictObject({
|
|
26238
26275
|
/** The id of the identity whose window it is: what its usage is filed under, which a rename keeps. */
|
|
26239
|
-
id:
|
|
26276
|
+
id: import_zod45.z.string().min(1),
|
|
26240
26277
|
/** The identity's name when the event was published, absent for an identity no longer stored under the id. */
|
|
26241
|
-
name:
|
|
26242
|
-
provider:
|
|
26243
|
-
window:
|
|
26278
|
+
name: import_zod45.z.string().min(1).optional(),
|
|
26279
|
+
provider: import_zod45.z.string().min(1),
|
|
26280
|
+
window: import_zod45.z.enum(["fiveHour", "sevenDay"]),
|
|
26244
26281
|
/** 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. */
|
|
26245
|
-
utilization:
|
|
26246
|
-
resetsAt:
|
|
26247
|
-
observedAt:
|
|
26282
|
+
utilization: import_zod45.z.number().min(0).max(1),
|
|
26283
|
+
resetsAt: import_zod45.z.iso.datetime(),
|
|
26284
|
+
observedAt: import_zod45.z.number()
|
|
26248
26285
|
});
|
|
26249
26286
|
var UsageChangeEventSchema = UsageSnapshotSchema.extend({
|
|
26250
|
-
id:
|
|
26251
|
-
name:
|
|
26287
|
+
id: import_zod45.z.string().min(1),
|
|
26288
|
+
name: import_zod45.z.string().min(1).optional()
|
|
26252
26289
|
});
|
|
26253
26290
|
|
|
26254
26291
|
// src/frontdoor/eventsApi.ts
|
|
@@ -26292,7 +26329,7 @@ function createEventsApiRouter(deps) {
|
|
|
26292
26329
|
// src/frontdoor/lifecycleApi.ts
|
|
26293
26330
|
var import_client4 = require("@orpc/client");
|
|
26294
26331
|
var import_openapi5 = require("@orpc/openapi");
|
|
26295
|
-
var
|
|
26332
|
+
var import_zod46 = require("zod");
|
|
26296
26333
|
init_update();
|
|
26297
26334
|
var FRONTDOOR_API_TAG = "frontdoor";
|
|
26298
26335
|
var UPDATE_API_TAG = "update";
|
|
@@ -26300,7 +26337,7 @@ function createLifecycleApiRouter(deps) {
|
|
|
26300
26337
|
const authed = doorApiAuth(deps.expectedToken);
|
|
26301
26338
|
return {
|
|
26302
26339
|
frontdoor: {
|
|
26303
|
-
refreshCatalogues: authed.meta((0, import_openapi5.openapi)({ method: "POST", path: "/rest/frontdoor/catalogues/refresh", summary: "Request a catalogue refresh tick", tags: [FRONTDOOR_API_TAG] })).output(
|
|
26340
|
+
refreshCatalogues: authed.meta((0, import_openapi5.openapi)({ method: "POST", path: "/rest/frontdoor/catalogues/refresh", summary: "Request a catalogue refresh tick", tags: [FRONTDOOR_API_TAG] })).output(import_zod46.z.strictObject({ requested: import_zod46.z.literal(true) })).handler(() => {
|
|
26304
26341
|
deps.refreshCatalogues();
|
|
26305
26342
|
return { requested: true };
|
|
26306
26343
|
}),
|
|
@@ -26337,64 +26374,64 @@ init_cliError();
|
|
|
26337
26374
|
|
|
26338
26375
|
// src/frontdoor/launchSchemas.ts
|
|
26339
26376
|
var import_node_path47 = __toESM(require("node:path"), 1);
|
|
26340
|
-
var
|
|
26377
|
+
var import_zod47 = require("zod");
|
|
26341
26378
|
init_statusline();
|
|
26342
26379
|
init_claudeVersion();
|
|
26343
26380
|
init_identity2();
|
|
26344
|
-
var LaunchResolveInputSchema =
|
|
26345
|
-
path:
|
|
26381
|
+
var LaunchResolveInputSchema = import_zod47.z.strictObject({
|
|
26382
|
+
path: import_zod47.z.string().min(1),
|
|
26346
26383
|
/** `@name`, launch flags, then the arguments for `claude`; empty for a bare launch. */
|
|
26347
|
-
argv:
|
|
26384
|
+
argv: import_zod47.z.readonly(import_zod47.z.array(import_zod47.z.string())).optional(),
|
|
26348
26385
|
/** 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. */
|
|
26349
|
-
env:
|
|
26386
|
+
env: import_zod47.z.record(import_zod47.z.string(), import_zod47.z.string()).optional()
|
|
26350
26387
|
}).refine((input) => import_node_path47.default.isAbsolute(input.path), { message: "path must be absolute: the door cannot resolve a relative path against the caller's working directory" });
|
|
26351
|
-
var LaunchPoolDecisionSchema =
|
|
26352
|
-
name:
|
|
26353
|
-
reasons:
|
|
26388
|
+
var LaunchPoolDecisionSchema = import_zod47.z.strictObject({
|
|
26389
|
+
name: import_zod47.z.string(),
|
|
26390
|
+
reasons: import_zod47.z.readonly(import_zod47.z.array(import_zod47.z.string())),
|
|
26354
26391
|
/** The provider the ranking read for the chosen member, when the launch spends one in place of the member's Claude account. */
|
|
26355
|
-
provider:
|
|
26356
|
-
movedOff:
|
|
26392
|
+
provider: import_zod47.z.string().optional(),
|
|
26393
|
+
movedOff: import_zod47.z.strictObject({ identity: import_zod47.z.string(), reason: import_zod47.z.string() }).optional()
|
|
26357
26394
|
});
|
|
26358
|
-
var LaunchDecisionSchema =
|
|
26359
|
-
identity:
|
|
26360
|
-
identityId:
|
|
26361
|
-
identitySource:
|
|
26395
|
+
var LaunchDecisionSchema = import_zod47.z.strictObject({
|
|
26396
|
+
identity: import_zod47.z.string().optional(),
|
|
26397
|
+
identityId: import_zod47.z.string().optional(),
|
|
26398
|
+
identitySource: import_zod47.z.enum(IDENTITY_DECISION_SOURCES),
|
|
26362
26399
|
pool: LaunchPoolDecisionSchema.optional(),
|
|
26363
26400
|
/** 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. */
|
|
26364
|
-
configDirEscapeHatch:
|
|
26365
|
-
configDir:
|
|
26366
|
-
configProfile:
|
|
26367
|
-
configProfileSource:
|
|
26368
|
-
provider:
|
|
26369
|
-
});
|
|
26370
|
-
var LaunchFlagsSchema =
|
|
26371
|
-
skipPermissions:
|
|
26372
|
-
remoteControl:
|
|
26373
|
-
headroom:
|
|
26374
|
-
trackUsage:
|
|
26375
|
-
pause:
|
|
26376
|
-
explain:
|
|
26401
|
+
configDirEscapeHatch: import_zod47.z.boolean(),
|
|
26402
|
+
configDir: import_zod47.z.string().optional(),
|
|
26403
|
+
configProfile: import_zod47.z.string().optional(),
|
|
26404
|
+
configProfileSource: import_zod47.z.enum(CONFIG_PROFILE_DECISION_SOURCES),
|
|
26405
|
+
provider: import_zod47.z.string().optional()
|
|
26406
|
+
});
|
|
26407
|
+
var LaunchFlagsSchema = import_zod47.z.strictObject({
|
|
26408
|
+
skipPermissions: import_zod47.z.boolean(),
|
|
26409
|
+
remoteControl: import_zod47.z.boolean(),
|
|
26410
|
+
headroom: import_zod47.z.boolean(),
|
|
26411
|
+
trackUsage: import_zod47.z.boolean(),
|
|
26412
|
+
pause: import_zod47.z.boolean(),
|
|
26413
|
+
explain: import_zod47.z.boolean(),
|
|
26377
26414
|
/** How long the launch waits after its own output before it starts claude, in milliseconds. */
|
|
26378
|
-
delayMs:
|
|
26415
|
+
delayMs: import_zod47.z.number(),
|
|
26379
26416
|
/** The hosts the launch keeps off the front door by adding them to the child's `NO_PROXY`. */
|
|
26380
|
-
proxyBypass:
|
|
26417
|
+
proxyBypass: import_zod47.z.array(import_zod47.z.string()).readonly(),
|
|
26381
26418
|
/** How the session's built-in statusline looks, when the launch configures any of it. */
|
|
26382
26419
|
statusline: StatuslineSchema.optional()
|
|
26383
26420
|
});
|
|
26384
|
-
var LaunchResolveOutputSchema =
|
|
26421
|
+
var LaunchResolveOutputSchema = import_zod47.z.strictObject({
|
|
26385
26422
|
decision: LaunchDecisionSchema,
|
|
26386
26423
|
flags: LaunchFlagsSchema,
|
|
26387
|
-
claudeVersion:
|
|
26424
|
+
claudeVersion: import_zod47.z.strictObject({ version: import_zod47.z.string(), source: import_zod47.z.enum(CLAUDE_VERSION_SOURCES) }).optional(),
|
|
26388
26425
|
/** The real `claude` binary the launch would spawn, on the door's host. */
|
|
26389
|
-
bin:
|
|
26426
|
+
bin: import_zod47.z.string(),
|
|
26390
26427
|
/** The arguments the launch would pass it: the tool's own flags, then `CLAUDE_EXTRA_FLAGS`, then the caller's own. */
|
|
26391
|
-
args:
|
|
26428
|
+
args: import_zod47.z.readonly(import_zod47.z.array(import_zod47.z.string())),
|
|
26392
26429
|
/** The credential the launch would authenticate with, by target and source kinds. Absent when none applies. */
|
|
26393
|
-
credential:
|
|
26394
|
-
routing:
|
|
26430
|
+
credential: import_zod47.z.strictObject({ subject: import_zod47.z.enum(["provider", "identity"]), name: import_zod47.z.string(), summary: CredentialSummarySchema }).optional(),
|
|
26431
|
+
routing: import_zod47.z.strictObject({ frontDoor: import_zod47.z.boolean(), headroom: import_zod47.z.boolean() }),
|
|
26395
26432
|
/** The names of the environment variables the launch would set or unset, sorted. Values are not reported. */
|
|
26396
|
-
environment:
|
|
26397
|
-
warnings:
|
|
26433
|
+
environment: import_zod47.z.readonly(import_zod47.z.array(import_zod47.z.string())),
|
|
26434
|
+
warnings: import_zod47.z.readonly(import_zod47.z.array(import_zod47.z.string()))
|
|
26398
26435
|
});
|
|
26399
26436
|
|
|
26400
26437
|
// src/frontdoor/launchApi.ts
|
|
@@ -26430,24 +26467,24 @@ function createLaunchApiRouter(deps) {
|
|
|
26430
26467
|
// src/frontdoor/agentTreesApi.ts
|
|
26431
26468
|
var import_client6 = require("@orpc/client");
|
|
26432
26469
|
var import_openapi7 = require("@orpc/openapi");
|
|
26433
|
-
var
|
|
26470
|
+
var import_zod48 = require("zod");
|
|
26434
26471
|
init_liveTasks();
|
|
26435
26472
|
init_schema3();
|
|
26436
26473
|
init_cliError();
|
|
26437
|
-
var AgentTreesListInputSchema =
|
|
26474
|
+
var AgentTreesListInputSchema = import_zod48.z.strictObject({
|
|
26438
26475
|
/** Only this identity's sessions. */
|
|
26439
|
-
identity:
|
|
26476
|
+
identity: import_zod48.z.string().optional(),
|
|
26440
26477
|
/** Include sessions that spawned no agent and ran no workflow. */
|
|
26441
|
-
all:
|
|
26478
|
+
all: import_zod48.z.boolean().optional()
|
|
26442
26479
|
});
|
|
26443
|
-
var AgentTreesListOutputSchema =
|
|
26444
|
-
var AgentTreesShowInputSchema =
|
|
26480
|
+
var AgentTreesListOutputSchema = import_zod48.z.array(SessionSummarySchema);
|
|
26481
|
+
var AgentTreesShowInputSchema = import_zod48.z.strictObject({
|
|
26445
26482
|
/** A session id, or an unambiguous prefix of one. */
|
|
26446
|
-
session:
|
|
26483
|
+
session: import_zod48.z.string().min(1),
|
|
26447
26484
|
/** Look only in this identity. */
|
|
26448
|
-
identity:
|
|
26485
|
+
identity: import_zod48.z.string().optional()
|
|
26449
26486
|
});
|
|
26450
|
-
var AgentTreesShowOutputSchema =
|
|
26487
|
+
var AgentTreesShowOutputSchema = import_zod48.z.strictObject({ identities: import_zod48.z.array(import_zod48.z.string()), ...MergedAgentTreeSchema.shape });
|
|
26451
26488
|
function asBadRequest(error) {
|
|
26452
26489
|
if (error instanceof CliError) {
|
|
26453
26490
|
throw new import_client6.ORPCError("BAD_REQUEST", { message: error.message });
|
|
@@ -26500,7 +26537,7 @@ var import_openapi8 = require("@orpc/openapi");
|
|
|
26500
26537
|
var import_server4 = require("@orpc/server");
|
|
26501
26538
|
|
|
26502
26539
|
// src/frontdoor/rcEventLog.ts
|
|
26503
|
-
var
|
|
26540
|
+
var import_zod49 = require("zod");
|
|
26504
26541
|
|
|
26505
26542
|
// src/frontdoor/eventHub.ts
|
|
26506
26543
|
var DOOR_EVENT_BUFFER_EVENTS = 100;
|
|
@@ -26625,46 +26662,46 @@ var NUMBER_FIELDS = ["at", "sequence"].length;
|
|
|
26625
26662
|
var BYTES_PER_CODE_UNIT = Uint16Array.BYTES_PER_ELEMENT;
|
|
26626
26663
|
var RC_SESSION_END_REASONS = ["expired", "archived", "conflict"];
|
|
26627
26664
|
var RC_PENDING_RETIRE_REASONS = ["answered", "withdrawn", "worker-stopped", "session-ended"];
|
|
26628
|
-
var transitionBase = { session:
|
|
26629
|
-
var cursorFields = { cursor:
|
|
26630
|
-
var sessionAppearedShape = { kind:
|
|
26631
|
-
var sessionEndedShape = { kind:
|
|
26632
|
-
var workerStateShape = { kind:
|
|
26633
|
-
var pendingBornShape = { kind:
|
|
26634
|
-
var pendingRetiredShape = { kind:
|
|
26635
|
-
var RcSessionTransitionSchema =
|
|
26636
|
-
|
|
26637
|
-
|
|
26638
|
-
|
|
26639
|
-
|
|
26640
|
-
|
|
26665
|
+
var transitionBase = { session: import_zod49.z.string(), at: import_zod49.z.number() };
|
|
26666
|
+
var cursorFields = { cursor: import_zod49.z.string(), sequence: import_zod49.z.int().positive() };
|
|
26667
|
+
var sessionAppearedShape = { kind: import_zod49.z.literal("session-appeared"), ...transitionBase };
|
|
26668
|
+
var sessionEndedShape = { kind: import_zod49.z.literal("session-ended"), reason: import_zod49.z.enum(RC_SESSION_END_REASONS), ...transitionBase };
|
|
26669
|
+
var workerStateShape = { kind: import_zod49.z.literal("worker-state"), state: import_zod49.z.string(), previous: import_zod49.z.string().optional(), ...transitionBase };
|
|
26670
|
+
var pendingBornShape = { kind: import_zod49.z.literal("pending-born"), requestId: import_zod49.z.string(), type: import_zod49.z.string(), summary: import_zod49.z.string(), ...transitionBase };
|
|
26671
|
+
var pendingRetiredShape = { kind: import_zod49.z.literal("pending-retired"), requestId: import_zod49.z.string(), reason: import_zod49.z.enum(RC_PENDING_RETIRE_REASONS), ...transitionBase };
|
|
26672
|
+
var RcSessionTransitionSchema = import_zod49.z.discriminatedUnion("kind", [
|
|
26673
|
+
import_zod49.z.strictObject(sessionAppearedShape),
|
|
26674
|
+
import_zod49.z.strictObject(sessionEndedShape),
|
|
26675
|
+
import_zod49.z.strictObject(workerStateShape),
|
|
26676
|
+
import_zod49.z.strictObject(pendingBornShape),
|
|
26677
|
+
import_zod49.z.strictObject(pendingRetiredShape)
|
|
26641
26678
|
]);
|
|
26642
26679
|
var KIND_MAX_CHARS = Math.max(...RcSessionTransitionSchema.options.map((option) => option.shape.kind.value.length));
|
|
26643
26680
|
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;
|
|
26644
26681
|
var RC_SESSION_EVENT_LOG_CAPACITY = Math.floor(CONTROL_BODY_CAP_BYTES / RC_SESSION_EVENT_MAX_BYTES);
|
|
26645
|
-
var RcSessionEventSchema =
|
|
26646
|
-
|
|
26647
|
-
|
|
26648
|
-
|
|
26649
|
-
|
|
26650
|
-
|
|
26682
|
+
var RcSessionEventSchema = import_zod49.z.discriminatedUnion("kind", [
|
|
26683
|
+
import_zod49.z.strictObject({ ...cursorFields, ...sessionAppearedShape }),
|
|
26684
|
+
import_zod49.z.strictObject({ ...cursorFields, ...sessionEndedShape }),
|
|
26685
|
+
import_zod49.z.strictObject({ ...cursorFields, ...workerStateShape }),
|
|
26686
|
+
import_zod49.z.strictObject({ ...cursorFields, ...pendingBornShape }),
|
|
26687
|
+
import_zod49.z.strictObject({ ...cursorFields, ...pendingRetiredShape })
|
|
26651
26688
|
]);
|
|
26652
|
-
var RcSessionEventsReadInputSchema =
|
|
26689
|
+
var RcSessionEventsReadInputSchema = import_zod49.z.strictObject({
|
|
26653
26690
|
/** The cursor of the last event the caller saw; every retained event when omitted. */
|
|
26654
|
-
since:
|
|
26691
|
+
since: import_zod49.z.string().min(1).optional(),
|
|
26655
26692
|
/** One `cse_` session id; every session when omitted. */
|
|
26656
|
-
session:
|
|
26693
|
+
session: import_zod49.z.string().min(1).optional(),
|
|
26657
26694
|
/** The most events one answer carries; every event after `since` when omitted. */
|
|
26658
|
-
limit:
|
|
26695
|
+
limit: import_zod49.z.int().positive().optional()
|
|
26659
26696
|
});
|
|
26660
26697
|
var RcSessionEventsPageInputSchema = RcSessionEventsReadInputSchema.extend({
|
|
26661
26698
|
/** 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. */
|
|
26662
|
-
limit:
|
|
26699
|
+
limit: import_zod49.z.int().positive().max(DOOR_EVENT_BUFFER_EVENTS).default(DOOR_EVENT_BUFFER_EVENTS)
|
|
26663
26700
|
});
|
|
26664
26701
|
var RcSessionEventsStreamInputSchema = RcSessionEventsReadInputSchema.omit({ limit: true });
|
|
26665
|
-
var RcSessionEventsReadOutputSchema =
|
|
26666
|
-
|
|
26667
|
-
|
|
26702
|
+
var RcSessionEventsReadOutputSchema = import_zod49.z.discriminatedUnion("status", [
|
|
26703
|
+
import_zod49.z.strictObject({ status: import_zod49.z.literal("ok"), events: import_zod49.z.readonly(import_zod49.z.array(RcSessionEventSchema)), cursor: import_zod49.z.string(), more: import_zod49.z.boolean(), head: import_zod49.z.string() }),
|
|
26704
|
+
import_zod49.z.strictObject({ status: import_zod49.z.literal("expired"), message: import_zod49.z.string(), head: import_zod49.z.string() })
|
|
26668
26705
|
]);
|
|
26669
26706
|
var CURSOR_SEPARATOR = ".";
|
|
26670
26707
|
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";
|
|
@@ -28876,7 +28913,7 @@ init_liveTasks();
|
|
|
28876
28913
|
|
|
28877
28914
|
// src/agents/read.ts
|
|
28878
28915
|
var import_node_path49 = __toESM(require("node:path"), 1);
|
|
28879
|
-
var
|
|
28916
|
+
var import_zod50 = require("zod");
|
|
28880
28917
|
init_schema3();
|
|
28881
28918
|
var PROJECTS_DIR = "projects";
|
|
28882
28919
|
var TASKS_DIR = "tasks";
|
|
@@ -28996,14 +29033,14 @@ function parseJson2(text) {
|
|
|
28996
29033
|
return void 0;
|
|
28997
29034
|
}
|
|
28998
29035
|
}
|
|
28999
|
-
var TaskFileSchema =
|
|
29000
|
-
var WorkflowRunFileSchema =
|
|
29001
|
-
runId:
|
|
29002
|
-
workflowName:
|
|
29003
|
-
status:
|
|
29004
|
-
startTime:
|
|
29005
|
-
phases:
|
|
29006
|
-
summary:
|
|
29036
|
+
var TaskFileSchema = import_zod50.z.object({ ...TaskItemSchema.omit({ taskList: true }).shape, blocks: import_zod50.z.array(import_zod50.z.string()).default([]), blockedBy: import_zod50.z.array(import_zod50.z.string()).default([]) });
|
|
29037
|
+
var WorkflowRunFileSchema = import_zod50.z.object({
|
|
29038
|
+
runId: import_zod50.z.string(),
|
|
29039
|
+
workflowName: import_zod50.z.string().optional(),
|
|
29040
|
+
status: import_zod50.z.string().optional(),
|
|
29041
|
+
startTime: import_zod50.z.number().optional(),
|
|
29042
|
+
phases: import_zod50.z.array(import_zod50.z.object({ title: import_zod50.z.string() })).default([]),
|
|
29043
|
+
summary: import_zod50.z.string().optional()
|
|
29007
29044
|
});
|
|
29008
29045
|
function summariseSession(fs17, configDir, ref) {
|
|
29009
29046
|
const sessionRelative = import_node_path49.default.join(PROJECTS_DIR, ref.project, ref.entry);
|