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