agent-shim 14.20.0 → 14.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -2
- package/dist/cli.cjs +159 -17
- package/dist/index.cjs +914 -863
- package/dist/index.mjs +892 -841
- 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
|
|
|
@@ -12016,6 +12043,19 @@ var init_supervisor2 = __esm({
|
|
|
12016
12043
|
}
|
|
12017
12044
|
});
|
|
12018
12045
|
|
|
12046
|
+
// src/launcher/launchLoop.ts
|
|
12047
|
+
function markLaunchedChild(env, launcherPid) {
|
|
12048
|
+
return { ...env, [LAUNCHER_PID_VARIABLE]: String(launcherPid) };
|
|
12049
|
+
}
|
|
12050
|
+
var LAUNCHER_PID_VARIABLE;
|
|
12051
|
+
var init_launchLoop = __esm({
|
|
12052
|
+
"src/launcher/launchLoop.ts"() {
|
|
12053
|
+
"use strict";
|
|
12054
|
+
init_cliError();
|
|
12055
|
+
LAUNCHER_PID_VARIABLE = "AGENT_SHIM_LAUNCHER_PID";
|
|
12056
|
+
}
|
|
12057
|
+
});
|
|
12058
|
+
|
|
12019
12059
|
// src/launcher/report.ts
|
|
12020
12060
|
function renderReport(rows, style) {
|
|
12021
12061
|
if (rows.length === 0) {
|
|
@@ -12388,6 +12428,7 @@ var init_realPorts = __esm({
|
|
|
12388
12428
|
init_supervisor2();
|
|
12389
12429
|
init_state2();
|
|
12390
12430
|
init_sameDirectory();
|
|
12431
|
+
init_launchLoop();
|
|
12391
12432
|
init_logStyle();
|
|
12392
12433
|
realFsPort = {
|
|
12393
12434
|
sameDirectory,
|
|
@@ -12644,7 +12685,7 @@ var init_realPorts = __esm({
|
|
|
12644
12685
|
};
|
|
12645
12686
|
realSpawnPort = {
|
|
12646
12687
|
spawnSync(command, args, options) {
|
|
12647
|
-
const result = spawnSyncUnbounded("a spawned program", command, args, options);
|
|
12688
|
+
const result = spawnSyncUnbounded("a spawned program", command, args, { ...options, env: markLaunchedChild(options.env, process.pid) });
|
|
12648
12689
|
return { status: result.status, signal: result.signal, ...result.error === void 0 ? {} : { error: result.error } };
|
|
12649
12690
|
}
|
|
12650
12691
|
};
|
|
@@ -13282,32 +13323,32 @@ var init_storedCatalogue = __esm({
|
|
|
13282
13323
|
});
|
|
13283
13324
|
|
|
13284
13325
|
// src/routeOverridesSchema.ts
|
|
13285
|
-
var
|
|
13326
|
+
var import_zod18, OverrideTableSchema, RouteOverridesSchema, RepairableTableSchema, RepairableRouteOverridesSchema;
|
|
13286
13327
|
var init_routeOverridesSchema = __esm({
|
|
13287
13328
|
"src/routeOverridesSchema.ts"() {
|
|
13288
13329
|
"use strict";
|
|
13289
|
-
|
|
13290
|
-
OverrideTableSchema =
|
|
13291
|
-
RouteOverridesSchema =
|
|
13292
|
-
$schema:
|
|
13293
|
-
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),
|
|
13294
13335
|
/** Every session with no entry of its own for the name. */
|
|
13295
13336
|
global: OverrideTableSchema.optional(),
|
|
13296
13337
|
/** By provider name: the sessions whose request would reach that provider. */
|
|
13297
|
-
providers:
|
|
13338
|
+
providers: import_zod18.z.record(import_zod18.z.string().min(1), OverrideTableSchema).optional(),
|
|
13298
13339
|
/** By identity name: the sessions running as that identity. */
|
|
13299
|
-
identities:
|
|
13340
|
+
identities: import_zod18.z.record(import_zod18.z.string().min(1), OverrideTableSchema).optional(),
|
|
13300
13341
|
/** By launch session id: one session. */
|
|
13301
|
-
sessions:
|
|
13342
|
+
sessions: import_zod18.z.record(import_zod18.z.string().min(1), OverrideTableSchema).optional()
|
|
13302
13343
|
});
|
|
13303
|
-
RepairableTableSchema =
|
|
13304
|
-
RepairableRouteOverridesSchema =
|
|
13305
|
-
$schema:
|
|
13306
|
-
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),
|
|
13307
13348
|
global: RepairableTableSchema.optional(),
|
|
13308
|
-
providers:
|
|
13309
|
-
identities:
|
|
13310
|
-
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()
|
|
13311
13352
|
});
|
|
13312
13353
|
}
|
|
13313
13354
|
});
|
|
@@ -13700,24 +13741,24 @@ function planOf(account) {
|
|
|
13700
13741
|
function planOfProviderQuota(quota) {
|
|
13701
13742
|
return planOf(quota?.level === void 0 ? void 0 : { organizationRateLimitTier: quota.level });
|
|
13702
13743
|
}
|
|
13703
|
-
var
|
|
13744
|
+
var import_zod19, PlanClassSchema, TIER_MULTIPLIER, ZERO_TIER, BASE_TIER;
|
|
13704
13745
|
var init_plan2 = __esm({
|
|
13705
13746
|
"src/usage/plan.ts"() {
|
|
13706
13747
|
"use strict";
|
|
13707
|
-
|
|
13708
|
-
PlanClassSchema =
|
|
13709
|
-
|
|
13710
|
-
kind:
|
|
13748
|
+
import_zod19 = require("zod");
|
|
13749
|
+
PlanClassSchema = import_zod19.z.union([
|
|
13750
|
+
import_zod19.z.strictObject({
|
|
13751
|
+
kind: import_zod19.z.literal("subscription"),
|
|
13711
13752
|
/** The plan's size as a multiple of the smallest subscription tier (Max is 5, Ultra is 20). */
|
|
13712
|
-
capacity:
|
|
13753
|
+
capacity: import_zod19.z.number().positive(),
|
|
13713
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. */
|
|
13714
|
-
recognised:
|
|
13755
|
+
recognised: import_zod19.z.boolean(),
|
|
13715
13756
|
/** The tier string the classification rests on, when the account had one. */
|
|
13716
|
-
tier:
|
|
13757
|
+
tier: import_zod19.z.string().optional()
|
|
13717
13758
|
}),
|
|
13718
|
-
|
|
13719
|
-
kind:
|
|
13720
|
-
tier:
|
|
13759
|
+
import_zod19.z.strictObject({
|
|
13760
|
+
kind: import_zod19.z.literal("pay-per-use"),
|
|
13761
|
+
tier: import_zod19.z.string().optional()
|
|
13721
13762
|
})
|
|
13722
13763
|
]);
|
|
13723
13764
|
TIER_MULTIPLIER = /(?:^|_)(\d+)x$/;
|
|
@@ -13727,21 +13768,21 @@ var init_plan2 = __esm({
|
|
|
13727
13768
|
});
|
|
13728
13769
|
|
|
13729
13770
|
// src/usage/scan.ts
|
|
13730
|
-
var
|
|
13771
|
+
var import_zod20, AnthropicUsageSchema, ErrorObjectSchema;
|
|
13731
13772
|
var init_scan = __esm({
|
|
13732
13773
|
"src/usage/scan.ts"() {
|
|
13733
13774
|
"use strict";
|
|
13734
|
-
|
|
13735
|
-
AnthropicUsageSchema =
|
|
13736
|
-
input_tokens:
|
|
13737
|
-
output_tokens:
|
|
13738
|
-
cache_creation_input_tokens:
|
|
13739
|
-
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()
|
|
13740
13781
|
});
|
|
13741
|
-
ErrorObjectSchema =
|
|
13742
|
-
type:
|
|
13743
|
-
code:
|
|
13744
|
-
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()
|
|
13745
13786
|
});
|
|
13746
13787
|
}
|
|
13747
13788
|
});
|
|
@@ -14473,12 +14514,12 @@ function recordStickyPick(fs17, picksFile, directory, identity, nowMs) {
|
|
|
14473
14514
|
fs17.writeFilePrivate(picksFile, `${JSON.stringify(next, null, 2)}
|
|
14474
14515
|
`);
|
|
14475
14516
|
}
|
|
14476
|
-
var import_node_path27,
|
|
14517
|
+
var import_node_path27, import_zod21, PoolGraphError, SCHEMA_VERSION, PickEntrySchema, PicksFileSchema;
|
|
14477
14518
|
var init_poolPick = __esm({
|
|
14478
14519
|
"src/usage/poolPick.ts"() {
|
|
14479
14520
|
"use strict";
|
|
14480
14521
|
import_node_path27 = __toESM(require("node:path"), 1);
|
|
14481
|
-
|
|
14522
|
+
import_zod21 = require("zod");
|
|
14482
14523
|
init_cliError();
|
|
14483
14524
|
init_identity2();
|
|
14484
14525
|
init_schema();
|
|
@@ -14497,10 +14538,10 @@ var init_poolPick = __esm({
|
|
|
14497
14538
|
}
|
|
14498
14539
|
};
|
|
14499
14540
|
SCHEMA_VERSION = 1;
|
|
14500
|
-
PickEntrySchema =
|
|
14501
|
-
PicksFileSchema =
|
|
14502
|
-
schemaVersion:
|
|
14503
|
-
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)
|
|
14504
14545
|
});
|
|
14505
14546
|
}
|
|
14506
14547
|
});
|
|
@@ -14586,30 +14627,30 @@ function requireNameFreeOfUnfinishedRename(fs17, directory, name, action, sameNa
|
|
|
14586
14627
|
throw new NameHeldByUnfinishedRenameError(action, name, held, finishabilityOf(held, exists));
|
|
14587
14628
|
}
|
|
14588
14629
|
}
|
|
14589
|
-
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;
|
|
14590
14631
|
var init_identityRenameJournal = __esm({
|
|
14591
14632
|
"src/identityRenameJournal.ts"() {
|
|
14592
14633
|
"use strict";
|
|
14593
14634
|
import_node_crypto14 = require("node:crypto");
|
|
14594
14635
|
import_node_path28 = __toESM(require("node:path"), 1);
|
|
14595
|
-
|
|
14636
|
+
import_zod22 = require("zod");
|
|
14596
14637
|
init_cliError();
|
|
14597
14638
|
init_load();
|
|
14598
14639
|
init_readableConfig();
|
|
14599
|
-
RenameJournalSchema =
|
|
14600
|
-
version:
|
|
14601
|
-
from:
|
|
14602
|
-
to:
|
|
14603
|
-
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(),
|
|
14604
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. */
|
|
14605
|
-
pid:
|
|
14606
|
-
steps:
|
|
14607
|
-
|
|
14608
|
-
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),
|
|
14609
14650
|
/** Whether the step has been applied and marked so. */
|
|
14610
|
-
done:
|
|
14651
|
+
done: import_zod22.z.boolean(),
|
|
14611
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. */
|
|
14612
|
-
started:
|
|
14653
|
+
started: import_zod22.z.boolean()
|
|
14613
14654
|
})
|
|
14614
14655
|
)
|
|
14615
14656
|
});
|
|
@@ -14716,13 +14757,13 @@ function requireNoInterruptedNameRename(paths, name, action, except) {
|
|
|
14716
14757
|
throw new InterruptedNameRenameError(action, describeInterruptedNameRename(paths, held));
|
|
14717
14758
|
}
|
|
14718
14759
|
}
|
|
14719
|
-
var import_node_fs8, import_node_path29,
|
|
14760
|
+
var import_node_fs8, import_node_path29, import_zod23, NameRenameRecordSchema, RECORD_SUFFIX, InterruptedNameRenameError;
|
|
14720
14761
|
var init_identityNameRenameRecord = __esm({
|
|
14721
14762
|
"src/identityNameRenameRecord.ts"() {
|
|
14722
14763
|
"use strict";
|
|
14723
14764
|
import_node_fs8 = __toESM(require("node:fs"), 1);
|
|
14724
14765
|
import_node_path29 = __toESM(require("node:path"), 1);
|
|
14725
|
-
|
|
14766
|
+
import_zod23 = require("zod");
|
|
14726
14767
|
init_cliError();
|
|
14727
14768
|
init_configProfilesStore();
|
|
14728
14769
|
init_directoryRulesStore();
|
|
@@ -14733,12 +14774,12 @@ var init_identityNameRenameRecord = __esm({
|
|
|
14733
14774
|
init_poolPick();
|
|
14734
14775
|
init_identityRecords();
|
|
14735
14776
|
init_identityRenameJournal();
|
|
14736
|
-
NameRenameRecordSchema =
|
|
14737
|
-
version:
|
|
14738
|
-
id:
|
|
14739
|
-
from:
|
|
14740
|
-
to:
|
|
14741
|
-
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()
|
|
14742
14783
|
});
|
|
14743
14784
|
RECORD_SUFFIX = ".json";
|
|
14744
14785
|
InterruptedNameRenameError = class extends CliError {
|
|
@@ -14793,18 +14834,18 @@ function liveLaunchesOn(fs17, directory, identity, isRunning) {
|
|
|
14793
14834
|
return record?.identity === identity && isRunning(record.pid) ? [record.pid] : [];
|
|
14794
14835
|
}).sort((left, right) => left - right);
|
|
14795
14836
|
}
|
|
14796
|
-
var import_node_path30, import_node_crypto15,
|
|
14837
|
+
var import_node_path30, import_node_crypto15, import_zod24, LaunchRecordSchema, RECORD_SUFFIX2;
|
|
14797
14838
|
var init_launchRecords = __esm({
|
|
14798
14839
|
"src/launcher/launchRecords.ts"() {
|
|
14799
14840
|
"use strict";
|
|
14800
14841
|
import_node_path30 = __toESM(require("node:path"), 1);
|
|
14801
14842
|
import_node_crypto15 = require("node:crypto");
|
|
14802
|
-
|
|
14803
|
-
LaunchRecordSchema =
|
|
14843
|
+
import_zod24 = require("zod");
|
|
14844
|
+
LaunchRecordSchema = import_zod24.z.strictObject({
|
|
14804
14845
|
/** The launcher's process id, which is what tells a launch in progress from a record a crashed launcher left behind. */
|
|
14805
|
-
pid:
|
|
14806
|
-
identity:
|
|
14807
|
-
startedAt:
|
|
14846
|
+
pid: import_zod24.z.number().int().positive(),
|
|
14847
|
+
identity: import_zod24.z.string().min(1),
|
|
14848
|
+
startedAt: import_zod24.z.iso.datetime()
|
|
14808
14849
|
});
|
|
14809
14850
|
RECORD_SUFFIX2 = ".json";
|
|
14810
14851
|
}
|
|
@@ -14836,6 +14877,15 @@ var init_connectorProxyAuth = __esm({
|
|
|
14836
14877
|
}
|
|
14837
14878
|
});
|
|
14838
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
|
+
|
|
14839
14889
|
// src/connectorListMerge.ts
|
|
14840
14890
|
var init_connectorListMerge = __esm({
|
|
14841
14891
|
"src/connectorListMerge.ts"() {
|
|
@@ -15305,6 +15355,7 @@ var init_identityStore = __esm({
|
|
|
15305
15355
|
init_launchRecords();
|
|
15306
15356
|
init_identityGrants();
|
|
15307
15357
|
init_connectorProxyAuth();
|
|
15358
|
+
init_toolSurfaceAuth();
|
|
15308
15359
|
init_connectorListMerge();
|
|
15309
15360
|
init_lenderLogin();
|
|
15310
15361
|
init_quotaHttp();
|
|
@@ -15369,7 +15420,7 @@ var init_package = __esm({
|
|
|
15369
15420
|
"package.json"() {
|
|
15370
15421
|
package_default = {
|
|
15371
15422
|
name: "agent-shim",
|
|
15372
|
-
version: "14.
|
|
15423
|
+
version: "14.21.0",
|
|
15373
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.",
|
|
15374
15425
|
license: "MIT",
|
|
15375
15426
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -15478,14 +15529,14 @@ var init_package = __esm({
|
|
|
15478
15529
|
});
|
|
15479
15530
|
|
|
15480
15531
|
// src/supervise/sessionControl.ts
|
|
15481
|
-
var import_node_path34,
|
|
15532
|
+
var import_node_path34, import_zod26, RESULT_POLL_MS, SessionControlConversationSchema, REQUEST_INSTANT_DIGITS;
|
|
15482
15533
|
var init_sessionControl = __esm({
|
|
15483
15534
|
"src/supervise/sessionControl.ts"() {
|
|
15484
15535
|
"use strict";
|
|
15485
15536
|
import_node_path34 = __toESM(require("node:path"), 1);
|
|
15486
|
-
|
|
15537
|
+
import_zod26 = require("zod");
|
|
15487
15538
|
RESULT_POLL_MS = 250;
|
|
15488
|
-
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) });
|
|
15489
15540
|
REQUEST_INSTANT_DIGITS = String(Number.MAX_SAFE_INTEGER).length;
|
|
15490
15541
|
}
|
|
15491
15542
|
});
|
|
@@ -15694,22 +15745,22 @@ function findPathShadow(params) {
|
|
|
15694
15745
|
}
|
|
15695
15746
|
return params.pathDirs.some((dir) => import_node_path35.default.resolve(dir) === resolvedTargetDir) ? { status: "ok" } : { status: "not-on-path" };
|
|
15696
15747
|
}
|
|
15697
|
-
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;
|
|
15698
15749
|
var init_claudeShim = __esm({
|
|
15699
15750
|
"src/claudeShim.ts"() {
|
|
15700
15751
|
"use strict";
|
|
15701
15752
|
import_node_fs10 = __toESM(require("node:fs"), 1);
|
|
15702
15753
|
import_node_path35 = __toESM(require("node:path"), 1);
|
|
15703
|
-
|
|
15754
|
+
import_zod32 = require("zod");
|
|
15704
15755
|
init_commandDeps();
|
|
15705
15756
|
init_store();
|
|
15706
15757
|
init_realPorts();
|
|
15707
15758
|
init_cliError();
|
|
15708
15759
|
init_fileFaults();
|
|
15709
|
-
ClaudeShimStateSchema =
|
|
15710
|
-
targetPath:
|
|
15711
|
-
method:
|
|
15712
|
-
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()
|
|
15713
15764
|
});
|
|
15714
15765
|
SCRIPT_HEAD_BYTES = 4096;
|
|
15715
15766
|
LAUNCHER_NAME = /\b(agent-shim|claude-use)\b/;
|
|
@@ -16075,16 +16126,16 @@ function aliasFindings(aliases, providerNames) {
|
|
|
16075
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.` };
|
|
16076
16127
|
});
|
|
16077
16128
|
}
|
|
16078
|
-
var
|
|
16129
|
+
var import_zod33, ProviderAliasesSchema;
|
|
16079
16130
|
var init_providerAliases = __esm({
|
|
16080
16131
|
"src/providerAliases.ts"() {
|
|
16081
16132
|
"use strict";
|
|
16082
|
-
|
|
16133
|
+
import_zod33 = require("zod");
|
|
16083
16134
|
init_cliError();
|
|
16084
16135
|
init_load();
|
|
16085
16136
|
init_store();
|
|
16086
16137
|
init_ownEntry();
|
|
16087
|
-
ProviderAliasesSchema =
|
|
16138
|
+
ProviderAliasesSchema = import_zod33.z.record(import_zod33.z.string().min(1), import_zod33.z.string().min(1));
|
|
16088
16139
|
}
|
|
16089
16140
|
});
|
|
16090
16141
|
|
|
@@ -16867,7 +16918,7 @@ function readCatalogueFailure(fs17, paths, pid, generation, name) {
|
|
|
16867
16918
|
const raw = new StoredCatalogue(paths, skippingReader(fs17)).failureText({ pid, generation }, name);
|
|
16868
16919
|
if (raw === void 0) return void 0;
|
|
16869
16920
|
try {
|
|
16870
|
-
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));
|
|
16871
16922
|
return value.success ? { reason: value.data.reason, redirected: value.data.redirected === true, settings: value.data.settings } : void 0;
|
|
16872
16923
|
} catch {
|
|
16873
16924
|
return void 0;
|
|
@@ -16877,17 +16928,17 @@ function readCatalogueStatus(fs17, paths, pid, generation, name) {
|
|
|
16877
16928
|
const raw = new StoredCatalogue(paths, skippingReader(fs17)).statusText({ pid, generation }, name);
|
|
16878
16929
|
if (raw === void 0) return void 0;
|
|
16879
16930
|
try {
|
|
16880
|
-
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));
|
|
16881
16932
|
return value.success ? value.data : void 0;
|
|
16882
16933
|
} catch {
|
|
16883
16934
|
return void 0;
|
|
16884
16935
|
}
|
|
16885
16936
|
}
|
|
16886
|
-
var
|
|
16937
|
+
var import_zod35, CATALOGUE_FAILURE_REASON_MAX_CHARS;
|
|
16887
16938
|
var init_catalogueState = __esm({
|
|
16888
16939
|
"src/frontdoor/catalogueState.ts"() {
|
|
16889
16940
|
"use strict";
|
|
16890
|
-
|
|
16941
|
+
import_zod35 = require("zod");
|
|
16891
16942
|
init_storedCatalogue();
|
|
16892
16943
|
init_tolerantReaders();
|
|
16893
16944
|
CATALOGUE_FAILURE_REASON_MAX_CHARS = 600;
|
|
@@ -16895,25 +16946,25 @@ var init_catalogueState = __esm({
|
|
|
16895
16946
|
});
|
|
16896
16947
|
|
|
16897
16948
|
// src/codex/auth.ts
|
|
16898
|
-
var
|
|
16949
|
+
var import_zod36, AuthFileSchema, TokenGrantSchema, CodexAuthError;
|
|
16899
16950
|
var init_auth = __esm({
|
|
16900
16951
|
"src/codex/auth.ts"() {
|
|
16901
16952
|
"use strict";
|
|
16902
|
-
|
|
16903
|
-
AuthFileSchema =
|
|
16904
|
-
tokens:
|
|
16905
|
-
access_token:
|
|
16906
|
-
refresh_token:
|
|
16907
|
-
id_token:
|
|
16908
|
-
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()
|
|
16909
16960
|
}).nullish(),
|
|
16910
|
-
last_refresh:
|
|
16961
|
+
last_refresh: import_zod36.z.string().optional()
|
|
16911
16962
|
});
|
|
16912
|
-
TokenGrantSchema =
|
|
16913
|
-
access_token:
|
|
16914
|
-
refresh_token:
|
|
16915
|
-
id_token:
|
|
16916
|
-
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()
|
|
16917
16968
|
});
|
|
16918
16969
|
CodexAuthError = class extends Error {
|
|
16919
16970
|
constructor(message) {
|
|
@@ -16925,31 +16976,31 @@ var init_auth = __esm({
|
|
|
16925
16976
|
});
|
|
16926
16977
|
|
|
16927
16978
|
// src/codex/siwc.ts
|
|
16928
|
-
var
|
|
16979
|
+
var import_zod37, SIWC_RESOURCE, SIWC_RESPONSES_URL, SIWC_PLAN_SCOPE, TokenResponseSchema, JwtHeaderSchema, IdTokenClaimsSchema, JwksSchema;
|
|
16929
16980
|
var init_siwc = __esm({
|
|
16930
16981
|
"src/codex/siwc.ts"() {
|
|
16931
16982
|
"use strict";
|
|
16932
|
-
|
|
16983
|
+
import_zod37 = require("zod");
|
|
16933
16984
|
SIWC_RESOURCE = "https://api.openai.com/v1";
|
|
16934
16985
|
SIWC_RESPONSES_URL = `${SIWC_RESOURCE}/responses`;
|
|
16935
16986
|
SIWC_PLAN_SCOPE = "chatgpt.tokens.use.direct";
|
|
16936
|
-
TokenResponseSchema =
|
|
16937
|
-
access_token:
|
|
16938
|
-
refresh_token:
|
|
16939
|
-
id_token:
|
|
16940
|
-
expires_in:
|
|
16941
|
-
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()
|
|
16942
16993
|
});
|
|
16943
|
-
JwtHeaderSchema =
|
|
16944
|
-
IdTokenClaimsSchema =
|
|
16945
|
-
iss:
|
|
16946
|
-
sub:
|
|
16947
|
-
aud:
|
|
16948
|
-
exp:
|
|
16949
|
-
nonce:
|
|
16950
|
-
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()
|
|
16951
17002
|
});
|
|
16952
|
-
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() })) });
|
|
16953
17004
|
}
|
|
16954
17005
|
});
|
|
16955
17006
|
|
|
@@ -16967,25 +17018,25 @@ function parseSiwcFile(raw, filePath) {
|
|
|
16967
17018
|
}
|
|
16968
17019
|
return parsed.data;
|
|
16969
17020
|
}
|
|
16970
|
-
var
|
|
17021
|
+
var import_zod38, SiwcGrantSchema, SiwcFileSchema;
|
|
16971
17022
|
var init_siwcStore = __esm({
|
|
16972
17023
|
"src/codex/siwcStore.ts"() {
|
|
16973
17024
|
"use strict";
|
|
16974
|
-
|
|
17025
|
+
import_zod38 = require("zod");
|
|
16975
17026
|
init_auth();
|
|
16976
17027
|
init_siwc();
|
|
16977
|
-
SiwcGrantSchema =
|
|
16978
|
-
clientId:
|
|
16979
|
-
sub:
|
|
16980
|
-
email:
|
|
16981
|
-
idToken:
|
|
16982
|
-
accessToken:
|
|
16983
|
-
refreshToken:
|
|
16984
|
-
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(),
|
|
16985
17036
|
/** When the access token stops working, in milliseconds since the epoch. */
|
|
16986
|
-
expiresAt:
|
|
17037
|
+
expiresAt: import_zod38.z.number()
|
|
16987
17038
|
});
|
|
16988
|
-
SiwcFileSchema =
|
|
17039
|
+
SiwcFileSchema = import_zod38.z.strictObject({ registeredClientId: import_zod38.z.string().min(1).optional(), grant: SiwcGrantSchema.optional() });
|
|
16989
17040
|
}
|
|
16990
17041
|
});
|
|
16991
17042
|
|
|
@@ -17084,15 +17135,15 @@ function savedCatalogueFingerprint(provider, paths, env, home, reader) {
|
|
|
17084
17135
|
const codexHome = configuredHome === void 0 || configuredHome === "" ? import_node_path43.default.join(home, ".codex") : configuredHome;
|
|
17085
17136
|
return cliCatalogueFingerprint(reader.read(import_node_path43.default.join(codexHome, "auth.json")));
|
|
17086
17137
|
}
|
|
17087
|
-
var import_node_crypto16, import_node_path43,
|
|
17138
|
+
var import_node_crypto16, import_node_path43, import_zod39, CatalogueBindingSchema;
|
|
17088
17139
|
var init_catalogueCredential = __esm({
|
|
17089
17140
|
"src/codex/catalogueCredential.ts"() {
|
|
17090
17141
|
"use strict";
|
|
17091
17142
|
import_node_crypto16 = require("node:crypto");
|
|
17092
17143
|
import_node_path43 = __toESM(require("node:path"), 1);
|
|
17093
|
-
|
|
17144
|
+
import_zod39 = require("zod");
|
|
17094
17145
|
init_siwcStore();
|
|
17095
|
-
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) });
|
|
17096
17147
|
}
|
|
17097
17148
|
});
|
|
17098
17149
|
|
|
@@ -17144,64 +17195,64 @@ var init_signatures = __esm({
|
|
|
17144
17195
|
});
|
|
17145
17196
|
|
|
17146
17197
|
// src/codex/anthropic.ts
|
|
17147
|
-
var
|
|
17198
|
+
var import_zod40, TextBlockSchema, Base64ImageSourceSchema, UrlImageSourceSchema, ImageBlockSchema, ToolUseBlockSchema, ToolResultContentBlockSchema, ToolResultBlockSchema, OtherBlockSchema, ContentBlockSchema, MessageSchema, ToolSchema, ToolChoiceSchema, SystemSchema, MessagesRequestSchema, CountTokensRequestSchema;
|
|
17148
17199
|
var init_anthropic = __esm({
|
|
17149
17200
|
"src/codex/anthropic.ts"() {
|
|
17150
17201
|
"use strict";
|
|
17151
|
-
|
|
17152
|
-
TextBlockSchema =
|
|
17153
|
-
Base64ImageSourceSchema =
|
|
17154
|
-
UrlImageSourceSchema =
|
|
17155
|
-
ImageBlockSchema =
|
|
17156
|
-
type:
|
|
17157
|
-
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])
|
|
17158
17209
|
});
|
|
17159
|
-
ToolUseBlockSchema =
|
|
17160
|
-
type:
|
|
17161
|
-
id:
|
|
17162
|
-
name:
|
|
17163
|
-
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()
|
|
17164
17215
|
});
|
|
17165
|
-
ToolResultContentBlockSchema =
|
|
17166
|
-
ToolResultBlockSchema =
|
|
17167
|
-
type:
|
|
17168
|
-
tool_use_id:
|
|
17169
|
-
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()
|
|
17170
17221
|
});
|
|
17171
|
-
OtherBlockSchema =
|
|
17172
|
-
ContentBlockSchema =
|
|
17173
|
-
MessageSchema =
|
|
17174
|
-
role:
|
|
17175
|
-
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)])
|
|
17176
17227
|
});
|
|
17177
|
-
ToolSchema =
|
|
17178
|
-
name:
|
|
17179
|
-
description:
|
|
17180
|
-
input_schema:
|
|
17181
|
-
allowed_domains:
|
|
17182
|
-
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()
|
|
17183
17234
|
});
|
|
17184
|
-
ToolChoiceSchema =
|
|
17185
|
-
|
|
17186
|
-
|
|
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) })
|
|
17187
17238
|
]);
|
|
17188
|
-
SystemSchema =
|
|
17189
|
-
MessagesRequestSchema =
|
|
17190
|
-
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(),
|
|
17191
17242
|
system: SystemSchema.optional(),
|
|
17192
|
-
messages:
|
|
17193
|
-
tools:
|
|
17243
|
+
messages: import_zod40.z.array(MessageSchema),
|
|
17244
|
+
tools: import_zod40.z.array(ToolSchema).optional(),
|
|
17194
17245
|
tool_choice: ToolChoiceSchema.optional(),
|
|
17195
|
-
stream:
|
|
17246
|
+
stream: import_zod40.z.boolean().optional(),
|
|
17196
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. */
|
|
17197
|
-
metadata:
|
|
17248
|
+
metadata: import_zod40.z.looseObject({ user_id: import_zod40.z.string().optional() }).optional(),
|
|
17198
17249
|
/** Claude Code's effort setting. Any string is accepted; the translator honours only the levels the backend understands. */
|
|
17199
|
-
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()
|
|
17200
17251
|
});
|
|
17201
|
-
CountTokensRequestSchema =
|
|
17202
|
-
system:
|
|
17203
|
-
messages:
|
|
17204
|
-
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()
|
|
17205
17256
|
});
|
|
17206
17257
|
}
|
|
17207
17258
|
});
|
|
@@ -19145,21 +19196,21 @@ function stageLaunchControl(params) {
|
|
|
19145
19196
|
}
|
|
19146
19197
|
};
|
|
19147
19198
|
}
|
|
19148
|
-
var import_node_path54, import_node_crypto18,
|
|
19199
|
+
var import_node_path54, import_node_crypto18, import_zod51, LaunchControlSchema, RECORD_SUFFIX3;
|
|
19149
19200
|
var init_launchControl = __esm({
|
|
19150
19201
|
"src/supervise/launchControl.ts"() {
|
|
19151
19202
|
"use strict";
|
|
19152
19203
|
import_node_path54 = __toESM(require("node:path"), 1);
|
|
19153
19204
|
import_node_crypto18 = require("node:crypto");
|
|
19154
|
-
|
|
19205
|
+
import_zod51 = require("zod");
|
|
19155
19206
|
init_sessionControl();
|
|
19156
19207
|
init_sessionControlPlugin();
|
|
19157
19208
|
init_verifiedVersions();
|
|
19158
|
-
LaunchControlSchema =
|
|
19209
|
+
LaunchControlSchema = import_zod51.z.strictObject({
|
|
19159
19210
|
/** The launcher's process id, which tells a live channel from one a killed launcher left. */
|
|
19160
|
-
pid:
|
|
19211
|
+
pid: import_zod51.z.number().int().positive(),
|
|
19161
19212
|
/** The plugin's directory, its request and result files beneath it. */
|
|
19162
|
-
directory:
|
|
19213
|
+
directory: import_zod51.z.string().min(1)
|
|
19163
19214
|
});
|
|
19164
19215
|
RECORD_SUFFIX3 = ".json";
|
|
19165
19216
|
}
|
|
@@ -20480,11 +20531,11 @@ var init_identityClaude = __esm({
|
|
|
20480
20531
|
});
|
|
20481
20532
|
|
|
20482
20533
|
// src/usage/providerQuota.ts
|
|
20483
|
-
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;
|
|
20484
20535
|
var init_providerQuota = __esm({
|
|
20485
20536
|
"src/usage/providerQuota.ts"() {
|
|
20486
20537
|
"use strict";
|
|
20487
|
-
|
|
20538
|
+
import_zod52 = require("zod");
|
|
20488
20539
|
init_cloudUpstream();
|
|
20489
20540
|
init_schema2();
|
|
20490
20541
|
init_ownEntry();
|
|
@@ -20500,35 +20551,35 @@ var init_providerQuota = __esm({
|
|
|
20500
20551
|
[ZAI_UNIT_HOURS, SECONDS_PER_HOUR3 * MS_PER_SECOND9],
|
|
20501
20552
|
[ZAI_UNIT_MONTHS, DAYS_PER_MONTH * HOURS_PER_DAY6 * SECONDS_PER_HOUR3 * MS_PER_SECOND9]
|
|
20502
20553
|
]);
|
|
20503
|
-
ZaiLimitSchema =
|
|
20504
|
-
type:
|
|
20505
|
-
unit:
|
|
20506
|
-
number:
|
|
20507
|
-
percentage:
|
|
20508
|
-
nextResetTime:
|
|
20509
|
-
usage:
|
|
20510
|
-
currentValue:
|
|
20511
|
-
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()
|
|
20512
20563
|
});
|
|
20513
|
-
ZaiResponseSchema =
|
|
20514
|
-
success:
|
|
20515
|
-
msg:
|
|
20516
|
-
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) })
|
|
20517
20568
|
});
|
|
20518
20569
|
OPENROUTER_HOST = "openrouter.ai";
|
|
20519
20570
|
OPENROUTER_KEY_URL = `https://${OPENROUTER_HOST}/api/v1/key`;
|
|
20520
20571
|
OPENROUTER_CREDITS_URL = `https://${OPENROUTER_HOST}/api/v1/credits`;
|
|
20521
20572
|
MS_PER_DAY2 = HOURS_PER_DAY6 * SECONDS_PER_HOUR3 * MS_PER_SECOND9;
|
|
20522
|
-
OpenRouterKeySchema =
|
|
20523
|
-
data:
|
|
20524
|
-
limit:
|
|
20525
|
-
limit_remaining:
|
|
20526
|
-
limit_reset:
|
|
20527
|
-
is_free_tier:
|
|
20528
|
-
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()
|
|
20529
20580
|
})
|
|
20530
20581
|
});
|
|
20531
|
-
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() }) });
|
|
20532
20583
|
ANTIGRAVITY_HOST = "daily-cloudcode-pa.googleapis.com";
|
|
20533
20584
|
ANTIGRAVITY_QUOTA_URL = `https://${ANTIGRAVITY_HOST}/v1internal:retrieveUserQuotaSummary`;
|
|
20534
20585
|
ANTIGRAVITY_USER_URL = `https://${ANTIGRAVITY_HOST}/v1internal:loadCodeAssist`;
|
|
@@ -20536,21 +20587,21 @@ var init_providerQuota = __esm({
|
|
|
20536
20587
|
DAYS_PER_WEEK2 = 7;
|
|
20537
20588
|
FIVE_HOURS_MS = FIVE_HOURS2 * SECONDS_PER_HOUR3 * MS_PER_SECOND9;
|
|
20538
20589
|
WEEK_MS = DAYS_PER_WEEK2 * HOURS_PER_DAY6 * SECONDS_PER_HOUR3 * MS_PER_SECOND9;
|
|
20539
|
-
AntigravityBucketSchema =
|
|
20540
|
-
bucketId:
|
|
20541
|
-
remainingFraction:
|
|
20542
|
-
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()
|
|
20543
20594
|
});
|
|
20544
|
-
AntigravitySummarySchema =
|
|
20545
|
-
GoogleTokenInfoSchema =
|
|
20546
|
-
email:
|
|
20547
|
-
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()
|
|
20548
20599
|
});
|
|
20549
|
-
AntigravityUserSchema =
|
|
20600
|
+
AntigravityUserSchema = import_zod52.z.object({
|
|
20550
20601
|
/** The code-assist tier context, which defaults to the free tier for every account. */
|
|
20551
|
-
currentTier:
|
|
20602
|
+
currentTier: import_zod52.z.object({ name: import_zod52.z.string().optional(), id: import_zod52.z.string().optional() }).optional(),
|
|
20552
20603
|
/** The account's paid subscription; absent when the account has none. */
|
|
20553
|
-
paidTier:
|
|
20604
|
+
paidTier: import_zod52.z.object({ name: import_zod52.z.string().optional(), id: import_zod52.z.string().optional() }).optional()
|
|
20554
20605
|
});
|
|
20555
20606
|
}
|
|
20556
20607
|
});
|
|
@@ -21065,20 +21116,20 @@ init_rcSessions();
|
|
|
21065
21116
|
|
|
21066
21117
|
// src/frontdoor/rcSessionRegistry.ts
|
|
21067
21118
|
var import_node_path32 = __toESM(require("node:path"), 1);
|
|
21068
|
-
var
|
|
21119
|
+
var import_zod25 = require("zod");
|
|
21069
21120
|
init_identityStore();
|
|
21070
21121
|
var REGISTRY_BRIDGE_PREFIX = "session_";
|
|
21071
21122
|
var DOOR_SESSION_PREFIX = "cse_";
|
|
21072
21123
|
var REGISTRY_DIR = "sessions";
|
|
21073
21124
|
var ENTRY_SUFFIX = ".json";
|
|
21074
21125
|
var RC_REGISTRY_ENTRY_MAX_BYTES = 8192;
|
|
21075
|
-
var RegistryEntrySchema =
|
|
21076
|
-
sessionId:
|
|
21077
|
-
pid:
|
|
21078
|
-
bridgeSessionId:
|
|
21079
|
-
cwd:
|
|
21080
|
-
name:
|
|
21081
|
-
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()
|
|
21082
21133
|
});
|
|
21083
21134
|
function supersedes(candidate, kept) {
|
|
21084
21135
|
return candidate.updatedAt > kept.updatedAt || candidate.updatedAt === kept.updatedAt && candidate.session.pid > kept.session.pid;
|
|
@@ -21295,7 +21346,7 @@ init_rcWrites();
|
|
|
21295
21346
|
init_rcSchemas();
|
|
21296
21347
|
|
|
21297
21348
|
// src/frontdoor/rcSlashCommandSchemas.ts
|
|
21298
|
-
var
|
|
21349
|
+
var import_zod27 = require("zod");
|
|
21299
21350
|
init_rcSchemas();
|
|
21300
21351
|
|
|
21301
21352
|
// src/frontdoor/rcSessionCommands.ts
|
|
@@ -21804,57 +21855,57 @@ function createRcSessionCommands(deps) {
|
|
|
21804
21855
|
}
|
|
21805
21856
|
|
|
21806
21857
|
// src/frontdoor/rcSlashCommandSchemas.ts
|
|
21807
|
-
var WaitMsSchema =
|
|
21808
|
-
var RcGoalSessionInputSchema =
|
|
21809
|
-
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),
|
|
21810
21861
|
waitMs: WaitMsSchema
|
|
21811
21862
|
});
|
|
21812
|
-
var RcGoalSetInputSchema =
|
|
21813
|
-
session:
|
|
21814
|
-
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"),
|
|
21815
21866
|
waitMs: WaitMsSchema
|
|
21816
21867
|
});
|
|
21817
|
-
var RcCompactInputSchema =
|
|
21818
|
-
session:
|
|
21868
|
+
var RcCompactInputSchema = import_zod27.z.strictObject({
|
|
21869
|
+
session: import_zod27.z.string().min(1),
|
|
21819
21870
|
waitMs: WaitMsSchema
|
|
21820
21871
|
});
|
|
21821
|
-
var RcCompactWithInstructionsInputSchema =
|
|
21822
|
-
session:
|
|
21823
|
-
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),
|
|
21824
21875
|
waitMs: WaitMsSchema
|
|
21825
21876
|
});
|
|
21826
|
-
var RcTurnInputSchema =
|
|
21827
|
-
session:
|
|
21828
|
-
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),
|
|
21829
21880
|
waitMs: WaitMsSchema
|
|
21830
21881
|
});
|
|
21831
21882
|
var commandAnswerShape = {
|
|
21832
|
-
session:
|
|
21883
|
+
session: import_zod27.z.string(),
|
|
21833
21884
|
route: RcSessionCommandRouteSchema,
|
|
21834
21885
|
warnings: RcVersionGateWarningsSchema
|
|
21835
21886
|
};
|
|
21836
|
-
var RcGoalGetOutputSchema =
|
|
21887
|
+
var RcGoalGetOutputSchema = import_zod27.z.strictObject({
|
|
21837
21888
|
...commandAnswerShape,
|
|
21838
|
-
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()
|
|
21839
21890
|
});
|
|
21840
|
-
var RcGoalSetOutputSchema =
|
|
21891
|
+
var RcGoalSetOutputSchema = import_zod27.z.strictObject({
|
|
21841
21892
|
...commandAnswerShape,
|
|
21842
|
-
condition:
|
|
21843
|
-
superseded:
|
|
21893
|
+
condition: import_zod27.z.string(),
|
|
21894
|
+
superseded: import_zod27.z.string().nullable()
|
|
21844
21895
|
});
|
|
21845
|
-
var RcGoalClearOutputSchema =
|
|
21896
|
+
var RcGoalClearOutputSchema = import_zod27.z.strictObject({
|
|
21846
21897
|
...commandAnswerShape,
|
|
21847
|
-
cleared:
|
|
21898
|
+
cleared: import_zod27.z.string().nullable()
|
|
21848
21899
|
});
|
|
21849
|
-
var RcTurnOutputSchema =
|
|
21900
|
+
var RcTurnOutputSchema = import_zod27.z.strictObject({
|
|
21850
21901
|
...commandAnswerShape,
|
|
21851
|
-
uuid:
|
|
21902
|
+
uuid: import_zod27.z.string()
|
|
21852
21903
|
});
|
|
21853
|
-
var RcCompactOutputSchema =
|
|
21904
|
+
var RcCompactOutputSchema = import_zod27.z.strictObject({
|
|
21854
21905
|
...commandAnswerShape,
|
|
21855
|
-
trigger:
|
|
21856
|
-
preTokens:
|
|
21857
|
-
postTokens:
|
|
21906
|
+
trigger: import_zod27.z.string(),
|
|
21907
|
+
preTokens: import_zod27.z.number().optional(),
|
|
21908
|
+
postTokens: import_zod27.z.number().optional()
|
|
21858
21909
|
});
|
|
21859
21910
|
|
|
21860
21911
|
// src/frontdoor/rcApi.ts
|
|
@@ -21919,7 +21970,7 @@ function createRcApiRouter(deps) {
|
|
|
21919
21970
|
if (input.session !== void 0 && !statuses.some((entry) => entry.id === input.session)) {
|
|
21920
21971
|
throw new import_client.ORPCError("NOT_FOUND", { message: rcSessionNotObservedMessage(input.session) });
|
|
21921
21972
|
}
|
|
21922
|
-
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) }))) };
|
|
21923
21974
|
}),
|
|
21924
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 }) => {
|
|
21925
21976
|
const pending = deps.pendingOf(input.session);
|
|
@@ -22084,48 +22135,48 @@ init_cliError();
|
|
|
22084
22135
|
init_package();
|
|
22085
22136
|
|
|
22086
22137
|
// src/codex/appServerSchemas.ts
|
|
22087
|
-
var
|
|
22138
|
+
var import_zod28 = require("zod");
|
|
22088
22139
|
var CODEX_APP_SERVER_GENERATED_AGAINST = "0.160.0";
|
|
22089
|
-
var RateLimitWindowSchema =
|
|
22090
|
-
usedPercent:
|
|
22091
|
-
resetsAt:
|
|
22092
|
-
windowDurationMins:
|
|
22093
|
-
});
|
|
22094
|
-
var RateLimitSnapshotSchema =
|
|
22095
|
-
limitId:
|
|
22096
|
-
limitName:
|
|
22097
|
-
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(),
|
|
22098
22149
|
primary: RateLimitWindowSchema.nullish(),
|
|
22099
22150
|
secondary: RateLimitWindowSchema.nullish(),
|
|
22100
|
-
rateLimitReachedType:
|
|
22101
|
-
spendControlReached:
|
|
22102
|
-
});
|
|
22103
|
-
var RateLimitResetCreditSchema =
|
|
22104
|
-
id:
|
|
22105
|
-
grantedAt:
|
|
22106
|
-
expiresAt:
|
|
22107
|
-
resetType:
|
|
22108
|
-
status:
|
|
22109
|
-
title:
|
|
22110
|
-
description:
|
|
22111
|
-
});
|
|
22112
|
-
var CodexAccountSchema =
|
|
22113
|
-
|
|
22114
|
-
|
|
22115
|
-
|
|
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) })
|
|
22116
22167
|
]);
|
|
22117
|
-
var CodexAccountReadSchema =
|
|
22168
|
+
var CodexAccountReadSchema = import_zod28.z.object({
|
|
22118
22169
|
account: CodexAccountSchema.nullable(),
|
|
22119
|
-
requiresOpenaiAuth:
|
|
22170
|
+
requiresOpenaiAuth: import_zod28.z.boolean()
|
|
22120
22171
|
});
|
|
22121
|
-
var CodexRateLimitsReadSchema =
|
|
22172
|
+
var CodexRateLimitsReadSchema = import_zod28.z.object({
|
|
22122
22173
|
rateLimits: RateLimitSnapshotSchema,
|
|
22123
|
-
rateLimitsByLimitId:
|
|
22124
|
-
rateLimitResetCredits:
|
|
22125
|
-
accountId:
|
|
22126
|
-
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()
|
|
22127
22178
|
});
|
|
22128
|
-
var CodexInitializeResultSchema =
|
|
22179
|
+
var CodexInitializeResultSchema = import_zod28.z.object({ userAgent: import_zod28.z.string() });
|
|
22129
22180
|
|
|
22130
22181
|
// src/codex/appServer.ts
|
|
22131
22182
|
var CodexAppServerUnavailableError = class extends CliError {
|
|
@@ -22324,7 +22375,7 @@ var import_client8 = require("@orpc/client");
|
|
|
22324
22375
|
var import_openapi9 = require("@orpc/openapi");
|
|
22325
22376
|
|
|
22326
22377
|
// src/checkReportSchema.ts
|
|
22327
|
-
var
|
|
22378
|
+
var import_zod30 = require("zod");
|
|
22328
22379
|
init_schema();
|
|
22329
22380
|
init_claudeVersion();
|
|
22330
22381
|
init_identity2();
|
|
@@ -22390,140 +22441,140 @@ var DIAGNOSTIC_CODES = [
|
|
|
22390
22441
|
var DIAGNOSTIC_SEVERITIES = ["error", "warning", "info"];
|
|
22391
22442
|
|
|
22392
22443
|
// src/usage/pickReportSchema.ts
|
|
22393
|
-
var
|
|
22444
|
+
var import_zod29 = require("zod");
|
|
22394
22445
|
init_plan2();
|
|
22395
|
-
var PoolPickCandidateViewSchema =
|
|
22396
|
-
identity:
|
|
22446
|
+
var PoolPickCandidateViewSchema = import_zod29.z.strictObject({
|
|
22447
|
+
identity: import_zod29.z.string(),
|
|
22397
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. */
|
|
22398
|
-
class:
|
|
22449
|
+
class: import_zod29.z.enum(["scored", "unknown", "pay-per-use", "ineligible"]),
|
|
22399
22450
|
/** Plan-size-weighted remaining quota per hour until its reset; present for `scored` only. */
|
|
22400
|
-
score:
|
|
22451
|
+
score: import_zod29.z.number().optional(),
|
|
22401
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`. */
|
|
22402
|
-
scoreWindow:
|
|
22453
|
+
scoreWindow: import_zod29.z.enum(["sevenDay", "fiveHour"]).optional(),
|
|
22403
22454
|
/** False when the five-hour window would run dry, at the observed pace, before it resets. */
|
|
22404
|
-
feasible:
|
|
22455
|
+
feasible: import_zod29.z.boolean(),
|
|
22405
22456
|
/** When an `ineligible` member can be used again, as an ISO instant. */
|
|
22406
|
-
blockedUntil:
|
|
22457
|
+
blockedUntil: import_zod29.z.iso.datetime().optional(),
|
|
22407
22458
|
plan: PlanClassSchema,
|
|
22408
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. */
|
|
22409
|
-
provider:
|
|
22460
|
+
provider: import_zod29.z.string().optional(),
|
|
22410
22461
|
/** The facts behind the class and score, in the order they matter. */
|
|
22411
|
-
reasons:
|
|
22462
|
+
reasons: import_zod29.z.array(import_zod29.z.string())
|
|
22412
22463
|
});
|
|
22413
|
-
var PoolPickReportSchema =
|
|
22414
|
-
pool:
|
|
22415
|
-
directory:
|
|
22464
|
+
var PoolPickReportSchema = import_zod29.z.strictObject({
|
|
22465
|
+
pool: import_zod29.z.string(),
|
|
22466
|
+
directory: import_zod29.z.string(),
|
|
22416
22467
|
/** The member a launch would run as, absent when every member is refused. */
|
|
22417
|
-
pick:
|
|
22418
|
-
candidates:
|
|
22468
|
+
pick: import_zod29.z.string().optional(),
|
|
22469
|
+
candidates: import_zod29.z.array(PoolPickCandidateViewSchema),
|
|
22419
22470
|
/** Identity members anywhere in the pool's graph that do not exist; a launch skips them. */
|
|
22420
|
-
missing:
|
|
22471
|
+
missing: import_zod29.z.array(import_zod29.z.string()),
|
|
22421
22472
|
/** When nothing can be picked, the soonest any member returns. */
|
|
22422
|
-
earliestReturn:
|
|
22473
|
+
earliestReturn: import_zod29.z.strictObject({ identity: import_zod29.z.string(), at: import_zod29.z.iso.datetime() }).optional(),
|
|
22423
22474
|
/** The member a resumed conversation started on but moved off, and why, when the ranking could not keep it. */
|
|
22424
|
-
movedOff:
|
|
22475
|
+
movedOff: import_zod29.z.strictObject({ identity: import_zod29.z.string(), reason: import_zod29.z.string() }).optional(),
|
|
22425
22476
|
/** Why the last-pick record could not be read, when that is the case. */
|
|
22426
|
-
stickyProblem:
|
|
22477
|
+
stickyProblem: import_zod29.z.string().optional()
|
|
22427
22478
|
});
|
|
22428
22479
|
|
|
22429
22480
|
// src/checkReportSchema.ts
|
|
22430
22481
|
init_identityGrants();
|
|
22431
22482
|
var CHECK_CREDENTIAL_APPLIES = ["provider", "identity", "stored-login"];
|
|
22432
|
-
var CheckLayerViewSchema =
|
|
22433
|
-
id:
|
|
22434
|
-
kind:
|
|
22435
|
-
source:
|
|
22436
|
-
});
|
|
22437
|
-
var CheckEntryViewSchema =
|
|
22438
|
-
path:
|
|
22439
|
-
shared:
|
|
22440
|
-
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),
|
|
22441
22492
|
/** The entry's real category, or null when nothing classifies it. */
|
|
22442
|
-
category:
|
|
22443
|
-
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(),
|
|
22444
22495
|
/** Rules that matched but whose `when` condition failed, each with the conditions that failed. */
|
|
22445
|
-
eliminated:
|
|
22446
|
-
});
|
|
22447
|
-
var CheckDiagnosticSchema =
|
|
22448
|
-
code:
|
|
22449
|
-
severity:
|
|
22450
|
-
message:
|
|
22451
|
-
subject:
|
|
22452
|
-
layer:
|
|
22453
|
-
});
|
|
22454
|
-
var CheckAmbientCredentialSchema =
|
|
22455
|
-
var CheckKeychainSchema =
|
|
22456
|
-
checked:
|
|
22457
|
-
found:
|
|
22458
|
-
serviceName:
|
|
22459
|
-
note:
|
|
22460
|
-
});
|
|
22461
|
-
var CheckSettingsExposureSchema =
|
|
22462
|
-
file:
|
|
22463
|
-
envKeyNames:
|
|
22464
|
-
hookEventNames:
|
|
22465
|
-
hookCommandCount:
|
|
22466
|
-
});
|
|
22467
|
-
var CredentialSourceSummarySchema =
|
|
22468
|
-
|
|
22469
|
-
|
|
22470
|
-
|
|
22471
|
-
|
|
22472
|
-
|
|
22473
|
-
|
|
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") })
|
|
22474
22525
|
]);
|
|
22475
|
-
var CredentialSummarySchema =
|
|
22476
|
-
target:
|
|
22477
|
-
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)),
|
|
22478
22529
|
cache: CredentialCacheSchema.optional()
|
|
22479
22530
|
});
|
|
22480
|
-
var CachedCredentialStateSchema =
|
|
22481
|
-
|
|
22482
|
-
|
|
22483
|
-
|
|
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() })
|
|
22484
22535
|
]);
|
|
22485
|
-
var CheckCredentialProviderSchema =
|
|
22486
|
-
|
|
22487
|
-
|
|
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() })
|
|
22488
22539
|
]);
|
|
22489
|
-
var CheckProviderReachabilitySchema =
|
|
22490
|
-
|
|
22491
|
-
|
|
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() })
|
|
22492
22543
|
]);
|
|
22493
|
-
var CheckCredentialSchema =
|
|
22494
|
-
applies:
|
|
22544
|
+
var CheckCredentialSchema = import_zod30.z.strictObject({
|
|
22545
|
+
applies: import_zod30.z.enum(CHECK_CREDENTIAL_APPLIES),
|
|
22495
22546
|
provider: CheckCredentialProviderSchema.optional(),
|
|
22496
22547
|
identity: CredentialSummarySchema.optional(),
|
|
22497
22548
|
identityCached: CachedCredentialStateSchema.optional()
|
|
22498
22549
|
});
|
|
22499
|
-
var CheckClaudeVersionSchema =
|
|
22500
|
-
pinned:
|
|
22501
|
-
highestInstalled:
|
|
22502
|
-
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()))
|
|
22503
22554
|
});
|
|
22504
|
-
var CheckReportJsonSchema =
|
|
22505
|
-
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) }),
|
|
22506
22557
|
/** The logins other identities lend this one through the front door; absent when none does. */
|
|
22507
|
-
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(),
|
|
22508
22559
|
/** The pool ranking, when the launch named a pool instead of an identity. */
|
|
22509
22560
|
pool: PoolPickReportSchema.optional(),
|
|
22510
|
-
configProfile:
|
|
22511
|
-
layers:
|
|
22512
|
-
entries:
|
|
22513
|
-
projectEncodingAmbiguities:
|
|
22514
|
-
|
|
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() }))
|
|
22515
22566
|
),
|
|
22516
|
-
diagnostics:
|
|
22567
|
+
diagnostics: import_zod30.z.readonly(import_zod30.z.array(CheckDiagnosticSchema)),
|
|
22517
22568
|
ambientCredential: CheckAmbientCredentialSchema,
|
|
22518
22569
|
keychain: CheckKeychainSchema.optional(),
|
|
22519
|
-
settingsExposure:
|
|
22570
|
+
settingsExposure: import_zod30.z.readonly(import_zod30.z.array(CheckSettingsExposureSchema)),
|
|
22520
22571
|
credential: CheckCredentialSchema,
|
|
22521
22572
|
claudeVersion: CheckClaudeVersionSchema.optional(),
|
|
22522
22573
|
providerReachability: CheckProviderReachabilitySchema.optional(),
|
|
22523
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. */
|
|
22524
|
-
routeOverrides:
|
|
22525
|
-
|
|
22526
|
-
|
|
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() })
|
|
22527
22578
|
]).optional()
|
|
22528
22579
|
});
|
|
22529
22580
|
|
|
@@ -22533,28 +22584,28 @@ init_preflight();
|
|
|
22533
22584
|
init_resets();
|
|
22534
22585
|
|
|
22535
22586
|
// src/usage/resetsSchema.ts
|
|
22536
|
-
var
|
|
22537
|
-
var ResetRowSchema =
|
|
22538
|
-
identity:
|
|
22539
|
-
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(),
|
|
22540
22591
|
/** What the window is: `5h`, `7d` or `extra usage` for an Anthropic account, or the provider's own measure and period (`tokens 5h`). */
|
|
22541
|
-
window:
|
|
22592
|
+
window: import_zod31.z.string(),
|
|
22542
22593
|
/** When the state the window comes from was observed, as an ISO instant. */
|
|
22543
|
-
observedAt:
|
|
22594
|
+
observedAt: import_zod31.z.iso.datetime(),
|
|
22544
22595
|
/** When the window resets, as an ISO instant; absent when the upstream reported none. */
|
|
22545
|
-
resetsAt:
|
|
22596
|
+
resetsAt: import_zod31.z.iso.datetime().optional(),
|
|
22546
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. */
|
|
22547
|
-
reset:
|
|
22598
|
+
reset: import_zod31.z.boolean(),
|
|
22548
22599
|
/** The fraction used, as `effectiveWindow` reads it at the report's own clock. */
|
|
22549
|
-
utilization:
|
|
22600
|
+
utilization: import_zod31.z.number().optional(),
|
|
22550
22601
|
/** The window's own status, for a window that has not reset yet. */
|
|
22551
|
-
status:
|
|
22602
|
+
status: import_zod31.z.string().optional()
|
|
22552
22603
|
});
|
|
22553
|
-
var ResetScheduleSchema =
|
|
22604
|
+
var ResetScheduleSchema = import_zod31.z.strictObject({ resets: import_zod31.z.readonly(import_zod31.z.array(ResetRowSchema)) });
|
|
22554
22605
|
|
|
22555
22606
|
// src/frontdoor/controlSchemas.ts
|
|
22556
22607
|
var import_node_path46 = __toESM(require("node:path"), 1);
|
|
22557
|
-
var
|
|
22608
|
+
var import_zod41 = require("zod");
|
|
22558
22609
|
|
|
22559
22610
|
// src/codex/doctor.ts
|
|
22560
22611
|
function codexIdentityFindings(entry, identity) {
|
|
@@ -22850,7 +22901,7 @@ init_providersStore();
|
|
|
22850
22901
|
init_signIn();
|
|
22851
22902
|
init_realPorts();
|
|
22852
22903
|
var import_node_path42 = __toESM(require("node:path"), 1);
|
|
22853
|
-
var
|
|
22904
|
+
var import_zod34 = require("zod");
|
|
22854
22905
|
init_envBool();
|
|
22855
22906
|
init_load();
|
|
22856
22907
|
init_schema();
|
|
@@ -22935,9 +22986,9 @@ function lookupKeychainService(run, farmRoot) {
|
|
|
22935
22986
|
}
|
|
22936
22987
|
return { checked: true, found: true, serviceName, note: `Keychain service name for this identity: "${serviceName}".` };
|
|
22937
22988
|
}
|
|
22938
|
-
var SettingsSecretsShapeSchema =
|
|
22939
|
-
env:
|
|
22940
|
-
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()
|
|
22941
22992
|
});
|
|
22942
22993
|
function hookCommandCountOf(group) {
|
|
22943
22994
|
if (typeof group !== "object" || group === null) {
|
|
@@ -25405,93 +25456,93 @@ function collectDoctorReport(params) {
|
|
|
25405
25456
|
init_schema2();
|
|
25406
25457
|
init_rcSchemas();
|
|
25407
25458
|
init_state();
|
|
25408
|
-
var UsageListOutputSchema =
|
|
25409
|
-
var UsageWindowsInputSchema =
|
|
25410
|
-
identity:
|
|
25411
|
-
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()
|
|
25412
25463
|
});
|
|
25413
|
-
var EffectiveWindowSchema =
|
|
25464
|
+
var EffectiveWindowSchema = import_zod41.z.strictObject({
|
|
25414
25465
|
/** True when the window's reset time has passed, so the recorded observation describes a window that no longer exists. */
|
|
25415
|
-
reset:
|
|
25466
|
+
reset: import_zod41.z.boolean(),
|
|
25416
25467
|
/** The fraction used: 0 for a reset window, otherwise what was last observed, absent when none was reported. */
|
|
25417
|
-
utilization:
|
|
25468
|
+
utilization: import_zod41.z.number().optional(),
|
|
25418
25469
|
/** The reset instant, for a window that has not reset yet and reported one. */
|
|
25419
|
-
resetsAtMs:
|
|
25470
|
+
resetsAtMs: import_zod41.z.number().optional(),
|
|
25420
25471
|
/** The window's own status, for a window that has not reset yet. */
|
|
25421
|
-
status:
|
|
25472
|
+
status: import_zod41.z.string().optional()
|
|
25422
25473
|
});
|
|
25423
|
-
var UsageWindowsOutputSchema =
|
|
25424
|
-
identity:
|
|
25425
|
-
provider:
|
|
25474
|
+
var UsageWindowsOutputSchema = import_zod41.z.strictObject({
|
|
25475
|
+
identity: import_zod41.z.string(),
|
|
25476
|
+
provider: import_zod41.z.string(),
|
|
25426
25477
|
/** When the rate-limit state the windows come from was observed. */
|
|
25427
|
-
observedAt:
|
|
25478
|
+
observedAt: import_zod41.z.iso.datetime().optional(),
|
|
25428
25479
|
fiveHour: EffectiveWindowSchema.optional(),
|
|
25429
25480
|
sevenDay: EffectiveWindowSchema.optional()
|
|
25430
25481
|
});
|
|
25431
|
-
var UsageLiveOutputSchema =
|
|
25482
|
+
var UsageLiveOutputSchema = import_zod41.z.strictObject({
|
|
25432
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. */
|
|
25433
25484
|
latest: RcLiveRateLimitSchema.optional(),
|
|
25434
25485
|
/** One observation per session whose stream has filed a rate_limit_event this door generation. */
|
|
25435
|
-
sessions:
|
|
25486
|
+
sessions: import_zod41.z.readonly(import_zod41.z.array(RcLiveRateLimitSchema))
|
|
25436
25487
|
});
|
|
25437
|
-
var FrontDoorSessionStatusSchema =
|
|
25438
|
-
pid:
|
|
25439
|
-
startedAt:
|
|
25440
|
-
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()
|
|
25441
25492
|
});
|
|
25442
|
-
var HeadroomSocketTargetSchema =
|
|
25443
|
-
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({
|
|
25444
25495
|
state: FrontDoorStateSchema,
|
|
25445
|
-
supervisorAlive:
|
|
25496
|
+
supervisorAlive: import_zod41.z.boolean(),
|
|
25446
25497
|
/** The pids of earlier doors that released their addresses and are finishing the connections they carried: running, but not serving anything new. */
|
|
25447
|
-
draining:
|
|
25448
|
-
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)),
|
|
25449
25500
|
headroomSocket: HeadroomSocketTargetSchema.optional(),
|
|
25450
|
-
logPath:
|
|
25451
|
-
logExists:
|
|
25501
|
+
logPath: import_zod41.z.string(),
|
|
25502
|
+
logExists: import_zod41.z.boolean()
|
|
25452
25503
|
});
|
|
25453
|
-
var FrontDoorSessionsOutputSchema =
|
|
25504
|
+
var FrontDoorSessionsOutputSchema = import_zod41.z.strictObject({ sessions: import_zod41.z.readonly(import_zod41.z.array(FrontDoorSessionStatusSchema)) });
|
|
25454
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.";
|
|
25455
|
-
var CheckRunInputSchema =
|
|
25456
|
-
path:
|
|
25457
|
-
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()
|
|
25458
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" });
|
|
25459
|
-
var PoolPickInputSchema =
|
|
25460
|
-
pool:
|
|
25461
|
-
path:
|
|
25510
|
+
var PoolPickInputSchema = import_zod41.z.strictObject({
|
|
25511
|
+
pool: import_zod41.z.string().min(1),
|
|
25512
|
+
path: import_zod41.z.string().min(1)
|
|
25462
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" });
|
|
25463
|
-
var DoctorFindingSchema =
|
|
25464
|
-
section:
|
|
25465
|
-
subject:
|
|
25466
|
-
severity:
|
|
25467
|
-
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()
|
|
25468
25519
|
});
|
|
25469
|
-
var DoctorRunOutputSchema =
|
|
25520
|
+
var DoctorRunOutputSchema = import_zod41.z.strictObject({
|
|
25470
25521
|
/** False exactly when any finding is a `fail`; a `warn` never fails the report on its own. */
|
|
25471
|
-
ok:
|
|
25472
|
-
findings:
|
|
25473
|
-
});
|
|
25474
|
-
var FrontDoorRestartOutputSchema =
|
|
25475
|
-
action:
|
|
25476
|
-
previousPid:
|
|
25477
|
-
});
|
|
25478
|
-
var UpdateCheckOutputSchema =
|
|
25479
|
-
current:
|
|
25480
|
-
latest:
|
|
25481
|
-
action:
|
|
25482
|
-
});
|
|
25483
|
-
var CodexSignInSchema =
|
|
25484
|
-
|
|
25485
|
-
|
|
25486
|
-
|
|
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() })
|
|
25487
25538
|
]);
|
|
25488
|
-
var CodexStatusOutputSchema =
|
|
25539
|
+
var CodexStatusOutputSchema = import_zod41.z.strictObject({
|
|
25489
25540
|
signIn: CodexSignInSchema,
|
|
25490
|
-
codexProviders:
|
|
25541
|
+
codexProviders: import_zod41.z.readonly(import_zod41.z.array(import_zod41.z.string()))
|
|
25491
25542
|
});
|
|
25492
|
-
var CodexLogoutOutputSchema =
|
|
25493
|
-
hadGrant:
|
|
25494
|
-
revoked:
|
|
25543
|
+
var CodexLogoutOutputSchema = import_zod41.z.strictObject({
|
|
25544
|
+
hadGrant: import_zod41.z.boolean(),
|
|
25545
|
+
revoked: import_zod41.z.boolean()
|
|
25495
25546
|
});
|
|
25496
25547
|
|
|
25497
25548
|
// src/frontdoor/codexApi.ts
|
|
@@ -25512,21 +25563,21 @@ function createCodexApiRouter(deps) {
|
|
|
25512
25563
|
|
|
25513
25564
|
// src/frontdoor/doorWorker.ts
|
|
25514
25565
|
var import_node_sea2 = require("node:sea");
|
|
25515
|
-
var
|
|
25566
|
+
var import_zod43 = require("zod");
|
|
25516
25567
|
init_cliError();
|
|
25517
25568
|
init_doorBounds();
|
|
25518
25569
|
init_providerCatalogue();
|
|
25519
25570
|
|
|
25520
25571
|
// src/frontdoor/doorWorkerProtocol.ts
|
|
25521
|
-
var
|
|
25572
|
+
var import_zod42 = require("zod");
|
|
25522
25573
|
init_providerCatalogue();
|
|
25523
25574
|
var doorWorkerInputSchemas = {
|
|
25524
25575
|
/** `agent-shim check` for `path` as `identity` (the identity a launch there would resolve when absent). */
|
|
25525
|
-
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() }),
|
|
25526
25577
|
/** `agent-shim doctor`. */
|
|
25527
|
-
doctor:
|
|
25578
|
+
doctor: import_zod42.z.strictObject({ root: import_zod42.z.string().min(1) }),
|
|
25528
25579
|
/** Fetch and store one provider's model catalogue for the door generation that asked. */
|
|
25529
|
-
"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() })
|
|
25530
25581
|
};
|
|
25531
25582
|
|
|
25532
25583
|
// src/frontdoor/doorWorker.ts
|
|
@@ -25619,80 +25670,80 @@ init_baseUrlDisplay();
|
|
|
25619
25670
|
init_providersStore();
|
|
25620
25671
|
|
|
25621
25672
|
// src/frontdoor/configSchemas.ts
|
|
25622
|
-
var
|
|
25673
|
+
var import_zod44 = require("zod");
|
|
25623
25674
|
init_schema();
|
|
25624
25675
|
init_names();
|
|
25625
25676
|
init_keychainLogin();
|
|
25626
25677
|
init_statusline();
|
|
25627
25678
|
init_toolLogins();
|
|
25628
|
-
var RemovalConfirmationSchema =
|
|
25629
|
-
var CredentialWriteSchema = (targets) =>
|
|
25630
|
-
sources:
|
|
25631
|
-
target:
|
|
25632
|
-
cache:
|
|
25633
|
-
});
|
|
25634
|
-
var CredentialSummarySchema2 =
|
|
25635
|
-
target:
|
|
25636
|
-
sources:
|
|
25637
|
-
|
|
25638
|
-
|
|
25639
|
-
|
|
25640
|
-
|
|
25641
|
-
|
|
25642
|
-
|
|
25643
|
-
|
|
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") })
|
|
25644
25695
|
])
|
|
25645
25696
|
)),
|
|
25646
25697
|
cache: CredentialCacheSchema.optional()
|
|
25647
25698
|
});
|
|
25648
|
-
var mutationOutput = (kind, action) =>
|
|
25649
|
-
var storedMutationOutput = (kind, action, value) =>
|
|
25650
|
-
var IdentityValueSchema =
|
|
25651
|
-
agent:
|
|
25652
|
-
name:
|
|
25653
|
-
label:
|
|
25654
|
-
defaultConfigProfile:
|
|
25655
|
-
provider:
|
|
25656
|
-
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(),
|
|
25657
25708
|
credential: CredentialSummarySchema2.optional(),
|
|
25658
|
-
anchors:
|
|
25709
|
+
anchors: import_zod44.z.array(AnchorSchema).optional(),
|
|
25659
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. */
|
|
25660
|
-
grants:
|
|
25711
|
+
grants: import_zod44.z.array(IdentityGrantSchema).optional(),
|
|
25661
25712
|
toolLogins: ToolLoginsSchema.optional()
|
|
25662
25713
|
});
|
|
25663
25714
|
var ProfileValueSchema = ConfigProfileSchema.omit({ $schema: true });
|
|
25664
|
-
var ProviderValueSchema =
|
|
25665
|
-
name:
|
|
25666
|
-
kind:
|
|
25667
|
-
displayName:
|
|
25668
|
-
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(),
|
|
25669
25720
|
codex: CodexProviderConfigSchema.optional(),
|
|
25670
25721
|
credential: CredentialSummarySchema2.optional(),
|
|
25671
|
-
env:
|
|
25722
|
+
env: import_zod44.z.record(import_zod44.z.string(), import_zod44.z.string()).optional()
|
|
25672
25723
|
});
|
|
25673
|
-
var ConfigNameInputSchema =
|
|
25674
|
-
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) });
|
|
25675
25726
|
var ConfigIdentityAddOutputSchema = storedMutationOutput("identity", "created", IdentityValueSchema);
|
|
25676
|
-
var ConfigIdentitySetInputSchema =
|
|
25677
|
-
name:
|
|
25727
|
+
var ConfigIdentitySetInputSchema = import_zod44.z.strictObject({
|
|
25728
|
+
name: import_zod44.z.string().min(1),
|
|
25678
25729
|
/** The identity's display label; `false` clears it. */
|
|
25679
|
-
label:
|
|
25680
|
-
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(),
|
|
25681
25732
|
/** The provider the identity exists for; `false` clears it. */
|
|
25682
|
-
provider:
|
|
25683
|
-
allowAmbientCredential:
|
|
25684
|
-
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(),
|
|
25685
25736
|
/** `false` removes the anchors; a list replaces them. */
|
|
25686
|
-
anchors:
|
|
25737
|
+
anchors: import_zod44.z.union([import_zod44.z.literal(false), import_zod44.z.array(AnchorSchema).min(1)]).optional(),
|
|
25687
25738
|
/** Each assignment replaces whatever that surface already named. */
|
|
25688
|
-
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(),
|
|
25689
25740
|
/** Surfaces to return to the identity's own login. */
|
|
25690
|
-
clearToolLogin:
|
|
25741
|
+
clearToolLogin: import_zod44.z.array(import_zod44.z.enum(TOOL_SURFACES)).optional()
|
|
25691
25742
|
});
|
|
25692
25743
|
var ConfigIdentitySetOutputSchema = storedMutationOutput("identity", "updated", IdentityValueSchema);
|
|
25693
|
-
var ConfigIdentityRemoveInputSchema =
|
|
25744
|
+
var ConfigIdentityRemoveInputSchema = import_zod44.z.strictObject({ name: import_zod44.z.string().min(1), confirm: RemovalConfirmationSchema });
|
|
25694
25745
|
var ConfigIdentityRemoveOutputSchema = mutationOutput("identity", "removed");
|
|
25695
|
-
var ConfigStatuslineSetSchema =
|
|
25746
|
+
var ConfigStatuslineSetSchema = import_zod44.z.record(import_zod44.z.string(), import_zod44.z.unknown()).superRefine((settings, context) => {
|
|
25696
25747
|
for (const key of Object.keys(settings)) {
|
|
25697
25748
|
if (key === STATUSLINE_EXTRA_GROUP || key.startsWith(`${STATUSLINE_EXTRA_GROUP}.`)) {
|
|
25698
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` });
|
|
@@ -25700,102 +25751,102 @@ var ConfigStatuslineSetSchema = import_zod43.z.record(import_zod43.z.string(), i
|
|
|
25700
25751
|
}
|
|
25701
25752
|
});
|
|
25702
25753
|
var ConfigIdentityUseOutputSchema = mutationOutput("identity", "selected");
|
|
25703
|
-
var ConfigProfileAddInputSchema =
|
|
25704
|
-
name:
|
|
25705
|
-
extends:
|
|
25706
|
-
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()
|
|
25707
25758
|
});
|
|
25708
25759
|
var ConfigProfileAddOutputSchema = storedMutationOutput("profile", "created", ProfileValueSchema);
|
|
25709
|
-
var ConfigProfileSetInputSchema =
|
|
25710
|
-
name:
|
|
25711
|
-
category:
|
|
25712
|
-
entry:
|
|
25713
|
-
extends:
|
|
25714
|
-
description:
|
|
25715
|
-
launch:
|
|
25716
|
-
skipPermissions:
|
|
25717
|
-
remoteControl:
|
|
25718
|
-
headroom:
|
|
25719
|
-
trackUsage:
|
|
25720
|
-
provider:
|
|
25721
|
-
claudeVersion:
|
|
25722
|
-
delay:
|
|
25723
|
-
pause:
|
|
25724
|
-
explain:
|
|
25725
|
-
proxyBypass:
|
|
25726
|
-
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({
|
|
25727
25778
|
set: ConfigStatuslineSetSchema.optional(),
|
|
25728
|
-
unset:
|
|
25779
|
+
unset: import_zod44.z.array(import_zod44.z.string()).optional()
|
|
25729
25780
|
}).optional()
|
|
25730
25781
|
}).optional()
|
|
25731
25782
|
});
|
|
25732
25783
|
var ConfigProfileSetOutputSchema = storedMutationOutput("profile", "updated", ProfileValueSchema);
|
|
25733
|
-
var ConfigProfileRemoveInputSchema =
|
|
25784
|
+
var ConfigProfileRemoveInputSchema = import_zod44.z.strictObject({ name: import_zod44.z.string().min(1), confirm: RemovalConfirmationSchema });
|
|
25734
25785
|
var ConfigProfileRemoveOutputSchema = mutationOutput("profile", "removed");
|
|
25735
25786
|
var ConfigProfileUseOutputSchema = mutationOutput("profile", "selected");
|
|
25736
|
-
var PoolMembersInputSchema =
|
|
25737
|
-
var ConfigPoolAddInputSchema =
|
|
25738
|
-
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),
|
|
25739
25790
|
identities: PoolMembersInputSchema,
|
|
25740
|
-
preference:
|
|
25741
|
-
resumeOnLimit:
|
|
25742
|
-
compactBeforeLimit:
|
|
25791
|
+
preference: import_zod44.z.enum(POOL_PREFERENCES).optional(),
|
|
25792
|
+
resumeOnLimit: import_zod44.z.boolean().optional(),
|
|
25793
|
+
compactBeforeLimit: import_zod44.z.boolean().optional(),
|
|
25743
25794
|
compactAtUtilisation: CompactAtUtilisationSchema.optional()
|
|
25744
25795
|
});
|
|
25745
25796
|
var ConfigPoolAddOutputSchema = storedMutationOutput("pool", "created", PoolSchema);
|
|
25746
|
-
var ConfigPoolSetInputSchema =
|
|
25747
|
-
name:
|
|
25797
|
+
var ConfigPoolSetInputSchema = import_zod44.z.strictObject({
|
|
25798
|
+
name: import_zod44.z.string().min(1),
|
|
25748
25799
|
identities: PoolMembersInputSchema.optional(),
|
|
25749
|
-
preference:
|
|
25750
|
-
resumeOnLimit:
|
|
25751
|
-
compactBeforeLimit:
|
|
25752
|
-
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()
|
|
25753
25804
|
});
|
|
25754
25805
|
var ConfigPoolSetOutputSchema = storedMutationOutput("pool", "updated", PoolSchema);
|
|
25755
|
-
var ConfigPoolRemoveInputSchema =
|
|
25806
|
+
var ConfigPoolRemoveInputSchema = import_zod44.z.strictObject({ name: import_zod44.z.string().min(1), confirm: RemovalConfirmationSchema });
|
|
25756
25807
|
var ConfigPoolRemoveOutputSchema = mutationOutput("pool", "removed");
|
|
25757
25808
|
var ConfigPoolUseOutputSchema = mutationOutput("pool", "selected");
|
|
25758
|
-
var ConfigProviderAddInputSchema =
|
|
25759
|
-
name:
|
|
25760
|
-
kind:
|
|
25761
|
-
displayName:
|
|
25762
|
-
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(),
|
|
25763
25814
|
credential: CredentialWriteSchema(PROVIDER_CREDENTIAL_TARGETS).required({ sources: true }),
|
|
25764
25815
|
codex: CodexProviderConfigSchema.optional()
|
|
25765
25816
|
});
|
|
25766
25817
|
var ConfigProviderAddOutputSchema = storedMutationOutput("provider", "created", ProviderValueSchema);
|
|
25767
|
-
var ConfigProviderSetInputSchema =
|
|
25768
|
-
name:
|
|
25769
|
-
displayName:
|
|
25770
|
-
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(),
|
|
25771
25822
|
credential: CredentialWriteSchema(PROVIDER_CREDENTIAL_TARGETS).optional(),
|
|
25772
25823
|
codex: CodexProviderConfigSchema.optional()
|
|
25773
25824
|
});
|
|
25774
25825
|
var ConfigProviderSetOutputSchema = storedMutationOutput("provider", "updated", ProviderValueSchema);
|
|
25775
|
-
var ConfigProviderRemoveInputSchema =
|
|
25826
|
+
var ConfigProviderRemoveInputSchema = import_zod44.z.strictObject({ name: import_zod44.z.string().min(1), confirm: RemovalConfirmationSchema });
|
|
25776
25827
|
var ConfigProviderRemoveOutputSchema = mutationOutput("provider", "removed");
|
|
25777
|
-
var ConfigRuleAddInputSchema =
|
|
25778
|
-
path:
|
|
25779
|
-
configProfile:
|
|
25780
|
-
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()
|
|
25781
25832
|
});
|
|
25782
25833
|
var ConfigRuleAddOutputSchema = storedMutationOutput("rule", "created", DirectoryRuleSchema);
|
|
25783
|
-
var ConfigRuleSetInputSchema =
|
|
25784
|
-
path:
|
|
25785
|
-
configProfile:
|
|
25786
|
-
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()
|
|
25787
25838
|
});
|
|
25788
25839
|
var ConfigRuleSetOutputSchema = storedMutationOutput("rule", "updated", DirectoryRuleSchema);
|
|
25789
|
-
var ConfigRuleRemoveInputSchema =
|
|
25840
|
+
var ConfigRuleRemoveInputSchema = import_zod44.z.strictObject({ path: import_zod44.z.string().min(1), confirm: RemovalConfirmationSchema });
|
|
25790
25841
|
var ConfigRuleRemoveOutputSchema = mutationOutput("rule", "removed");
|
|
25791
|
-
var RouteScopeInputSchema =
|
|
25792
|
-
|
|
25793
|
-
|
|
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) })
|
|
25794
25845
|
]);
|
|
25795
|
-
var ConfigRouteSetInputSchema =
|
|
25796
|
-
var ConfigRouteSetOutputSchema = storedMutationOutput("route", "updated",
|
|
25797
|
-
var ConfigRouteRemoveInputSchema =
|
|
25798
|
-
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()) });
|
|
25799
25850
|
|
|
25800
25851
|
// src/routeOverrides.ts
|
|
25801
25852
|
init_commandDeps();
|
|
@@ -26190,51 +26241,51 @@ var import_openapi4 = require("@orpc/openapi");
|
|
|
26190
26241
|
var import_server3 = require("@orpc/server");
|
|
26191
26242
|
|
|
26192
26243
|
// src/frontdoor/eventSchemas.ts
|
|
26193
|
-
var
|
|
26244
|
+
var import_zod45 = require("zod");
|
|
26194
26245
|
init_schema2();
|
|
26195
26246
|
var DOOR_EVENT_SOURCE_RC = "rc";
|
|
26196
26247
|
var LAUNCH_EVENT_SOURCE = "launch";
|
|
26197
26248
|
var USAGE_EVENT_SOURCE = "usage";
|
|
26198
26249
|
var DOOR_HEALTH_EVENT_SOURCE = "door";
|
|
26199
26250
|
var QUOTA_EXPIRING_EVENT_SOURCE = "quota-expiring";
|
|
26200
|
-
var DoorEventSchema =
|
|
26201
|
-
source:
|
|
26251
|
+
var DoorEventSchema = import_zod45.z.strictObject({
|
|
26252
|
+
source: import_zod45.z.string().min(1),
|
|
26202
26253
|
/** A positive integer because the backbone's counters start at one and only ever increase. */
|
|
26203
|
-
sequence:
|
|
26204
|
-
payload:
|
|
26205
|
-
});
|
|
26206
|
-
var DoorEventSourceQuerySchema =
|
|
26207
|
-
sources:
|
|
26208
|
-
});
|
|
26209
|
-
var LaunchLifecycleEventSchema =
|
|
26210
|
-
kind:
|
|
26211
|
-
pid:
|
|
26212
|
-
startedAt:
|
|
26213
|
-
observedAt:
|
|
26214
|
-
});
|
|
26215
|
-
var DoorHealthEventSchema =
|
|
26216
|
-
|
|
26217
|
-
|
|
26218
|
-
|
|
26219
|
-
|
|
26220
|
-
|
|
26221
|
-
|
|
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() })
|
|
26222
26273
|
]);
|
|
26223
|
-
var QuotaExpiringEventSchema =
|
|
26274
|
+
var QuotaExpiringEventSchema = import_zod45.z.strictObject({
|
|
26224
26275
|
/** The id of the identity whose window it is: what its usage is filed under, which a rename keeps. */
|
|
26225
|
-
id:
|
|
26276
|
+
id: import_zod45.z.string().min(1),
|
|
26226
26277
|
/** The identity's name when the event was published, absent for an identity no longer stored under the id. */
|
|
26227
|
-
name:
|
|
26228
|
-
provider:
|
|
26229
|
-
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"]),
|
|
26230
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. */
|
|
26231
|
-
utilization:
|
|
26232
|
-
resetsAt:
|
|
26233
|
-
observedAt:
|
|
26282
|
+
utilization: import_zod45.z.number().min(0).max(1),
|
|
26283
|
+
resetsAt: import_zod45.z.iso.datetime(),
|
|
26284
|
+
observedAt: import_zod45.z.number()
|
|
26234
26285
|
});
|
|
26235
26286
|
var UsageChangeEventSchema = UsageSnapshotSchema.extend({
|
|
26236
|
-
id:
|
|
26237
|
-
name:
|
|
26287
|
+
id: import_zod45.z.string().min(1),
|
|
26288
|
+
name: import_zod45.z.string().min(1).optional()
|
|
26238
26289
|
});
|
|
26239
26290
|
|
|
26240
26291
|
// src/frontdoor/eventsApi.ts
|
|
@@ -26278,7 +26329,7 @@ function createEventsApiRouter(deps) {
|
|
|
26278
26329
|
// src/frontdoor/lifecycleApi.ts
|
|
26279
26330
|
var import_client4 = require("@orpc/client");
|
|
26280
26331
|
var import_openapi5 = require("@orpc/openapi");
|
|
26281
|
-
var
|
|
26332
|
+
var import_zod46 = require("zod");
|
|
26282
26333
|
init_update();
|
|
26283
26334
|
var FRONTDOOR_API_TAG = "frontdoor";
|
|
26284
26335
|
var UPDATE_API_TAG = "update";
|
|
@@ -26286,7 +26337,7 @@ function createLifecycleApiRouter(deps) {
|
|
|
26286
26337
|
const authed = doorApiAuth(deps.expectedToken);
|
|
26287
26338
|
return {
|
|
26288
26339
|
frontdoor: {
|
|
26289
|
-
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(() => {
|
|
26290
26341
|
deps.refreshCatalogues();
|
|
26291
26342
|
return { requested: true };
|
|
26292
26343
|
}),
|
|
@@ -26323,64 +26374,64 @@ init_cliError();
|
|
|
26323
26374
|
|
|
26324
26375
|
// src/frontdoor/launchSchemas.ts
|
|
26325
26376
|
var import_node_path47 = __toESM(require("node:path"), 1);
|
|
26326
|
-
var
|
|
26377
|
+
var import_zod47 = require("zod");
|
|
26327
26378
|
init_statusline();
|
|
26328
26379
|
init_claudeVersion();
|
|
26329
26380
|
init_identity2();
|
|
26330
|
-
var LaunchResolveInputSchema =
|
|
26331
|
-
path:
|
|
26381
|
+
var LaunchResolveInputSchema = import_zod47.z.strictObject({
|
|
26382
|
+
path: import_zod47.z.string().min(1),
|
|
26332
26383
|
/** `@name`, launch flags, then the arguments for `claude`; empty for a bare launch. */
|
|
26333
|
-
argv:
|
|
26384
|
+
argv: import_zod47.z.readonly(import_zod47.z.array(import_zod47.z.string())).optional(),
|
|
26334
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. */
|
|
26335
|
-
env:
|
|
26386
|
+
env: import_zod47.z.record(import_zod47.z.string(), import_zod47.z.string()).optional()
|
|
26336
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" });
|
|
26337
|
-
var LaunchPoolDecisionSchema =
|
|
26338
|
-
name:
|
|
26339
|
-
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())),
|
|
26340
26391
|
/** The provider the ranking read for the chosen member, when the launch spends one in place of the member's Claude account. */
|
|
26341
|
-
provider:
|
|
26342
|
-
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()
|
|
26343
26394
|
});
|
|
26344
|
-
var LaunchDecisionSchema =
|
|
26345
|
-
identity:
|
|
26346
|
-
identityId:
|
|
26347
|
-
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),
|
|
26348
26399
|
pool: LaunchPoolDecisionSchema.optional(),
|
|
26349
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. */
|
|
26350
|
-
configDirEscapeHatch:
|
|
26351
|
-
configDir:
|
|
26352
|
-
configProfile:
|
|
26353
|
-
configProfileSource:
|
|
26354
|
-
provider:
|
|
26355
|
-
});
|
|
26356
|
-
var LaunchFlagsSchema =
|
|
26357
|
-
skipPermissions:
|
|
26358
|
-
remoteControl:
|
|
26359
|
-
headroom:
|
|
26360
|
-
trackUsage:
|
|
26361
|
-
pause:
|
|
26362
|
-
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(),
|
|
26363
26414
|
/** How long the launch waits after its own output before it starts claude, in milliseconds. */
|
|
26364
|
-
delayMs:
|
|
26415
|
+
delayMs: import_zod47.z.number(),
|
|
26365
26416
|
/** The hosts the launch keeps off the front door by adding them to the child's `NO_PROXY`. */
|
|
26366
|
-
proxyBypass:
|
|
26417
|
+
proxyBypass: import_zod47.z.array(import_zod47.z.string()).readonly(),
|
|
26367
26418
|
/** How the session's built-in statusline looks, when the launch configures any of it. */
|
|
26368
26419
|
statusline: StatuslineSchema.optional()
|
|
26369
26420
|
});
|
|
26370
|
-
var LaunchResolveOutputSchema =
|
|
26421
|
+
var LaunchResolveOutputSchema = import_zod47.z.strictObject({
|
|
26371
26422
|
decision: LaunchDecisionSchema,
|
|
26372
26423
|
flags: LaunchFlagsSchema,
|
|
26373
|
-
claudeVersion:
|
|
26424
|
+
claudeVersion: import_zod47.z.strictObject({ version: import_zod47.z.string(), source: import_zod47.z.enum(CLAUDE_VERSION_SOURCES) }).optional(),
|
|
26374
26425
|
/** The real `claude` binary the launch would spawn, on the door's host. */
|
|
26375
|
-
bin:
|
|
26426
|
+
bin: import_zod47.z.string(),
|
|
26376
26427
|
/** The arguments the launch would pass it: the tool's own flags, then `CLAUDE_EXTRA_FLAGS`, then the caller's own. */
|
|
26377
|
-
args:
|
|
26428
|
+
args: import_zod47.z.readonly(import_zod47.z.array(import_zod47.z.string())),
|
|
26378
26429
|
/** The credential the launch would authenticate with, by target and source kinds. Absent when none applies. */
|
|
26379
|
-
credential:
|
|
26380
|
-
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() }),
|
|
26381
26432
|
/** The names of the environment variables the launch would set or unset, sorted. Values are not reported. */
|
|
26382
|
-
environment:
|
|
26383
|
-
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()))
|
|
26384
26435
|
});
|
|
26385
26436
|
|
|
26386
26437
|
// src/frontdoor/launchApi.ts
|
|
@@ -26416,24 +26467,24 @@ function createLaunchApiRouter(deps) {
|
|
|
26416
26467
|
// src/frontdoor/agentTreesApi.ts
|
|
26417
26468
|
var import_client6 = require("@orpc/client");
|
|
26418
26469
|
var import_openapi7 = require("@orpc/openapi");
|
|
26419
|
-
var
|
|
26470
|
+
var import_zod48 = require("zod");
|
|
26420
26471
|
init_liveTasks();
|
|
26421
26472
|
init_schema3();
|
|
26422
26473
|
init_cliError();
|
|
26423
|
-
var AgentTreesListInputSchema =
|
|
26474
|
+
var AgentTreesListInputSchema = import_zod48.z.strictObject({
|
|
26424
26475
|
/** Only this identity's sessions. */
|
|
26425
|
-
identity:
|
|
26476
|
+
identity: import_zod48.z.string().optional(),
|
|
26426
26477
|
/** Include sessions that spawned no agent and ran no workflow. */
|
|
26427
|
-
all:
|
|
26478
|
+
all: import_zod48.z.boolean().optional()
|
|
26428
26479
|
});
|
|
26429
|
-
var AgentTreesListOutputSchema =
|
|
26430
|
-
var AgentTreesShowInputSchema =
|
|
26480
|
+
var AgentTreesListOutputSchema = import_zod48.z.array(SessionSummarySchema);
|
|
26481
|
+
var AgentTreesShowInputSchema = import_zod48.z.strictObject({
|
|
26431
26482
|
/** A session id, or an unambiguous prefix of one. */
|
|
26432
|
-
session:
|
|
26483
|
+
session: import_zod48.z.string().min(1),
|
|
26433
26484
|
/** Look only in this identity. */
|
|
26434
|
-
identity:
|
|
26485
|
+
identity: import_zod48.z.string().optional()
|
|
26435
26486
|
});
|
|
26436
|
-
var AgentTreesShowOutputSchema =
|
|
26487
|
+
var AgentTreesShowOutputSchema = import_zod48.z.strictObject({ identities: import_zod48.z.array(import_zod48.z.string()), ...MergedAgentTreeSchema.shape });
|
|
26437
26488
|
function asBadRequest(error) {
|
|
26438
26489
|
if (error instanceof CliError) {
|
|
26439
26490
|
throw new import_client6.ORPCError("BAD_REQUEST", { message: error.message });
|
|
@@ -26486,7 +26537,7 @@ var import_openapi8 = require("@orpc/openapi");
|
|
|
26486
26537
|
var import_server4 = require("@orpc/server");
|
|
26487
26538
|
|
|
26488
26539
|
// src/frontdoor/rcEventLog.ts
|
|
26489
|
-
var
|
|
26540
|
+
var import_zod49 = require("zod");
|
|
26490
26541
|
|
|
26491
26542
|
// src/frontdoor/eventHub.ts
|
|
26492
26543
|
var DOOR_EVENT_BUFFER_EVENTS = 100;
|
|
@@ -26611,46 +26662,46 @@ var NUMBER_FIELDS = ["at", "sequence"].length;
|
|
|
26611
26662
|
var BYTES_PER_CODE_UNIT = Uint16Array.BYTES_PER_ELEMENT;
|
|
26612
26663
|
var RC_SESSION_END_REASONS = ["expired", "archived", "conflict"];
|
|
26613
26664
|
var RC_PENDING_RETIRE_REASONS = ["answered", "withdrawn", "worker-stopped", "session-ended"];
|
|
26614
|
-
var transitionBase = { session:
|
|
26615
|
-
var cursorFields = { cursor:
|
|
26616
|
-
var sessionAppearedShape = { kind:
|
|
26617
|
-
var sessionEndedShape = { kind:
|
|
26618
|
-
var workerStateShape = { kind:
|
|
26619
|
-
var pendingBornShape = { kind:
|
|
26620
|
-
var pendingRetiredShape = { kind:
|
|
26621
|
-
var RcSessionTransitionSchema =
|
|
26622
|
-
|
|
26623
|
-
|
|
26624
|
-
|
|
26625
|
-
|
|
26626
|
-
|
|
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)
|
|
26627
26678
|
]);
|
|
26628
26679
|
var KIND_MAX_CHARS = Math.max(...RcSessionTransitionSchema.options.map((option) => option.shape.kind.value.length));
|
|
26629
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;
|
|
26630
26681
|
var RC_SESSION_EVENT_LOG_CAPACITY = Math.floor(CONTROL_BODY_CAP_BYTES / RC_SESSION_EVENT_MAX_BYTES);
|
|
26631
|
-
var RcSessionEventSchema =
|
|
26632
|
-
|
|
26633
|
-
|
|
26634
|
-
|
|
26635
|
-
|
|
26636
|
-
|
|
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 })
|
|
26637
26688
|
]);
|
|
26638
|
-
var RcSessionEventsReadInputSchema =
|
|
26689
|
+
var RcSessionEventsReadInputSchema = import_zod49.z.strictObject({
|
|
26639
26690
|
/** The cursor of the last event the caller saw; every retained event when omitted. */
|
|
26640
|
-
since:
|
|
26691
|
+
since: import_zod49.z.string().min(1).optional(),
|
|
26641
26692
|
/** One `cse_` session id; every session when omitted. */
|
|
26642
|
-
session:
|
|
26693
|
+
session: import_zod49.z.string().min(1).optional(),
|
|
26643
26694
|
/** The most events one answer carries; every event after `since` when omitted. */
|
|
26644
|
-
limit:
|
|
26695
|
+
limit: import_zod49.z.int().positive().optional()
|
|
26645
26696
|
});
|
|
26646
26697
|
var RcSessionEventsPageInputSchema = RcSessionEventsReadInputSchema.extend({
|
|
26647
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. */
|
|
26648
|
-
limit:
|
|
26699
|
+
limit: import_zod49.z.int().positive().max(DOOR_EVENT_BUFFER_EVENTS).default(DOOR_EVENT_BUFFER_EVENTS)
|
|
26649
26700
|
});
|
|
26650
26701
|
var RcSessionEventsStreamInputSchema = RcSessionEventsReadInputSchema.omit({ limit: true });
|
|
26651
|
-
var RcSessionEventsReadOutputSchema =
|
|
26652
|
-
|
|
26653
|
-
|
|
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() })
|
|
26654
26705
|
]);
|
|
26655
26706
|
var CURSOR_SEPARATOR = ".";
|
|
26656
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";
|
|
@@ -28862,7 +28913,7 @@ init_liveTasks();
|
|
|
28862
28913
|
|
|
28863
28914
|
// src/agents/read.ts
|
|
28864
28915
|
var import_node_path49 = __toESM(require("node:path"), 1);
|
|
28865
|
-
var
|
|
28916
|
+
var import_zod50 = require("zod");
|
|
28866
28917
|
init_schema3();
|
|
28867
28918
|
var PROJECTS_DIR = "projects";
|
|
28868
28919
|
var TASKS_DIR = "tasks";
|
|
@@ -28982,14 +29033,14 @@ function parseJson2(text) {
|
|
|
28982
29033
|
return void 0;
|
|
28983
29034
|
}
|
|
28984
29035
|
}
|
|
28985
|
-
var TaskFileSchema =
|
|
28986
|
-
var WorkflowRunFileSchema =
|
|
28987
|
-
runId:
|
|
28988
|
-
workflowName:
|
|
28989
|
-
status:
|
|
28990
|
-
startTime:
|
|
28991
|
-
phases:
|
|
28992
|
-
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()
|
|
28993
29044
|
});
|
|
28994
29045
|
function summariseSession(fs17, configDir, ref) {
|
|
28995
29046
|
const sessionRelative = import_node_path49.default.join(PROJECTS_DIR, ref.project, ref.entry);
|