agent-shim 14.20.1 → 14.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.cjs +166 -18
- package/dist/index.cjs +899 -862
- package/dist/index.mjs +877 -840
- package/dist/types/index.d.ts +139 -105
- package/package.json +1 -1
package/dist/index.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
|
|
|
@@ -13267,32 +13294,32 @@ var init_storedCatalogue = __esm({
|
|
|
13267
13294
|
});
|
|
13268
13295
|
|
|
13269
13296
|
// src/routeOverridesSchema.ts
|
|
13270
|
-
import { z as
|
|
13297
|
+
import { z as z18 } from "zod";
|
|
13271
13298
|
var OverrideTableSchema, RouteOverridesSchema, RepairableTableSchema, RepairableRouteOverridesSchema;
|
|
13272
13299
|
var init_routeOverridesSchema = __esm({
|
|
13273
13300
|
"src/routeOverridesSchema.ts"() {
|
|
13274
13301
|
"use strict";
|
|
13275
|
-
OverrideTableSchema =
|
|
13276
|
-
RouteOverridesSchema =
|
|
13277
|
-
$schema:
|
|
13278
|
-
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),
|
|
13279
13306
|
/** Every session with no entry of its own for the name. */
|
|
13280
13307
|
global: OverrideTableSchema.optional(),
|
|
13281
13308
|
/** By provider name: the sessions whose request would reach that provider. */
|
|
13282
|
-
providers:
|
|
13309
|
+
providers: z18.record(z18.string().min(1), OverrideTableSchema).optional(),
|
|
13283
13310
|
/** By identity name: the sessions running as that identity. */
|
|
13284
|
-
identities:
|
|
13311
|
+
identities: z18.record(z18.string().min(1), OverrideTableSchema).optional(),
|
|
13285
13312
|
/** By launch session id: one session. */
|
|
13286
|
-
sessions:
|
|
13313
|
+
sessions: z18.record(z18.string().min(1), OverrideTableSchema).optional()
|
|
13287
13314
|
});
|
|
13288
|
-
RepairableTableSchema =
|
|
13289
|
-
RepairableRouteOverridesSchema =
|
|
13290
|
-
$schema:
|
|
13291
|
-
schemaVersion:
|
|
13315
|
+
RepairableTableSchema = z18.record(z18.string(), z18.string());
|
|
13316
|
+
RepairableRouteOverridesSchema = z18.strictObject({
|
|
13317
|
+
$schema: z18.string().optional(),
|
|
13318
|
+
schemaVersion: z18.literal(1),
|
|
13292
13319
|
global: RepairableTableSchema.optional(),
|
|
13293
|
-
providers:
|
|
13294
|
-
identities:
|
|
13295
|
-
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()
|
|
13296
13323
|
});
|
|
13297
13324
|
}
|
|
13298
13325
|
});
|
|
@@ -13663,7 +13690,7 @@ var init_candidateText = __esm({
|
|
|
13663
13690
|
});
|
|
13664
13691
|
|
|
13665
13692
|
// src/usage/plan.ts
|
|
13666
|
-
import { z as
|
|
13693
|
+
import { z as z19 } from "zod";
|
|
13667
13694
|
function planOf(account) {
|
|
13668
13695
|
const userTier = account?.userRateLimitTier;
|
|
13669
13696
|
if (userTier !== void 0 && ZERO_TIER.test(userTier)) {
|
|
@@ -13690,19 +13717,19 @@ var PlanClassSchema, TIER_MULTIPLIER, ZERO_TIER, BASE_TIER;
|
|
|
13690
13717
|
var init_plan2 = __esm({
|
|
13691
13718
|
"src/usage/plan.ts"() {
|
|
13692
13719
|
"use strict";
|
|
13693
|
-
PlanClassSchema =
|
|
13694
|
-
|
|
13695
|
-
kind:
|
|
13720
|
+
PlanClassSchema = z19.union([
|
|
13721
|
+
z19.strictObject({
|
|
13722
|
+
kind: z19.literal("subscription"),
|
|
13696
13723
|
/** The plan's size as a multiple of the smallest subscription tier (Max is 5, Ultra is 20). */
|
|
13697
|
-
capacity:
|
|
13724
|
+
capacity: z19.number().positive(),
|
|
13698
13725
|
/** False when the tier string named no multiplier and no tier this project knows, so `capacity` is the neutral 1 rather than a reading. */
|
|
13699
|
-
recognised:
|
|
13726
|
+
recognised: z19.boolean(),
|
|
13700
13727
|
/** The tier string the classification rests on, when the account had one. */
|
|
13701
|
-
tier:
|
|
13728
|
+
tier: z19.string().optional()
|
|
13702
13729
|
}),
|
|
13703
|
-
|
|
13704
|
-
kind:
|
|
13705
|
-
tier:
|
|
13730
|
+
z19.strictObject({
|
|
13731
|
+
kind: z19.literal("pay-per-use"),
|
|
13732
|
+
tier: z19.string().optional()
|
|
13706
13733
|
})
|
|
13707
13734
|
]);
|
|
13708
13735
|
TIER_MULTIPLIER = /(?:^|_)(\d+)x$/;
|
|
@@ -13712,21 +13739,21 @@ var init_plan2 = __esm({
|
|
|
13712
13739
|
});
|
|
13713
13740
|
|
|
13714
13741
|
// src/usage/scan.ts
|
|
13715
|
-
import { z as
|
|
13742
|
+
import { z as z20 } from "zod";
|
|
13716
13743
|
var AnthropicUsageSchema, ErrorObjectSchema;
|
|
13717
13744
|
var init_scan = __esm({
|
|
13718
13745
|
"src/usage/scan.ts"() {
|
|
13719
13746
|
"use strict";
|
|
13720
|
-
AnthropicUsageSchema =
|
|
13721
|
-
input_tokens:
|
|
13722
|
-
output_tokens:
|
|
13723
|
-
cache_creation_input_tokens:
|
|
13724
|
-
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()
|
|
13725
13752
|
});
|
|
13726
|
-
ErrorObjectSchema =
|
|
13727
|
-
type:
|
|
13728
|
-
code:
|
|
13729
|
-
message:
|
|
13753
|
+
ErrorObjectSchema = z20.looseObject({
|
|
13754
|
+
type: z20.string().optional(),
|
|
13755
|
+
code: z20.union([z20.string(), z20.number()]).optional(),
|
|
13756
|
+
message: z20.string().optional()
|
|
13730
13757
|
});
|
|
13731
13758
|
}
|
|
13732
13759
|
});
|
|
@@ -14272,7 +14299,7 @@ var init_store2 = __esm({
|
|
|
14272
14299
|
|
|
14273
14300
|
// src/usage/poolPick.ts
|
|
14274
14301
|
import path27 from "node:path";
|
|
14275
|
-
import { z as
|
|
14302
|
+
import { z as z21 } from "zod";
|
|
14276
14303
|
function errorMessage(error) {
|
|
14277
14304
|
return error instanceof Error ? error.message : String(error);
|
|
14278
14305
|
}
|
|
@@ -14482,10 +14509,10 @@ var init_poolPick = __esm({
|
|
|
14482
14509
|
}
|
|
14483
14510
|
};
|
|
14484
14511
|
SCHEMA_VERSION = 1;
|
|
14485
|
-
PickEntrySchema =
|
|
14486
|
-
PicksFileSchema =
|
|
14487
|
-
schemaVersion:
|
|
14488
|
-
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)
|
|
14489
14516
|
});
|
|
14490
14517
|
}
|
|
14491
14518
|
});
|
|
@@ -14493,7 +14520,7 @@ var init_poolPick = __esm({
|
|
|
14493
14520
|
// src/identityRenameJournal.ts
|
|
14494
14521
|
import { createHash as createHash10 } from "node:crypto";
|
|
14495
14522
|
import path28 from "node:path";
|
|
14496
|
-
import { z as
|
|
14523
|
+
import { z as z22 } from "zod";
|
|
14497
14524
|
function renamePairFileName(from, to, suffix) {
|
|
14498
14525
|
return `${createHash10("sha256").update(`${from}\0${to}`).digest("hex").slice(0, FILE_NAME_HASH_DIGITS)}${suffix}`;
|
|
14499
14526
|
}
|
|
@@ -14581,20 +14608,20 @@ var init_identityRenameJournal = __esm({
|
|
|
14581
14608
|
init_cliError();
|
|
14582
14609
|
init_load();
|
|
14583
14610
|
init_readableConfig();
|
|
14584
|
-
RenameJournalSchema =
|
|
14585
|
-
version:
|
|
14586
|
-
from:
|
|
14587
|
-
to:
|
|
14588
|
-
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(),
|
|
14589
14616
|
/** The process that began the rename, for a person reading the file. Whether it is still running is told by the locks, not by this. */
|
|
14590
|
-
pid:
|
|
14591
|
-
steps:
|
|
14592
|
-
|
|
14593
|
-
description:
|
|
14617
|
+
pid: z22.number().int().positive(),
|
|
14618
|
+
steps: z22.array(
|
|
14619
|
+
z22.strictObject({
|
|
14620
|
+
description: z22.string().min(1),
|
|
14594
14621
|
/** Whether the step has been applied and marked so. */
|
|
14595
|
-
done:
|
|
14622
|
+
done: z22.boolean(),
|
|
14596
14623
|
/** Whether the step was begun: written ahead of the step, before it runs, so a process that dies after the step took effect and before `done` was written still leaves a record that it may have. */
|
|
14597
|
-
started:
|
|
14624
|
+
started: z22.boolean()
|
|
14598
14625
|
})
|
|
14599
14626
|
)
|
|
14600
14627
|
});
|
|
@@ -14620,7 +14647,7 @@ var init_identityRenameJournal = __esm({
|
|
|
14620
14647
|
// src/identityNameRenameRecord.ts
|
|
14621
14648
|
import fs8 from "node:fs";
|
|
14622
14649
|
import path29 from "node:path";
|
|
14623
|
-
import { z as
|
|
14650
|
+
import { z as z23 } from "zod";
|
|
14624
14651
|
function readRecordFiles(paths) {
|
|
14625
14652
|
if (!fs8.existsSync(paths.identityNameRenamesDir)) {
|
|
14626
14653
|
return [];
|
|
@@ -14718,12 +14745,12 @@ var init_identityNameRenameRecord = __esm({
|
|
|
14718
14745
|
init_poolPick();
|
|
14719
14746
|
init_identityRecords();
|
|
14720
14747
|
init_identityRenameJournal();
|
|
14721
|
-
NameRenameRecordSchema =
|
|
14722
|
-
version:
|
|
14723
|
-
id:
|
|
14724
|
-
from:
|
|
14725
|
-
to:
|
|
14726
|
-
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()
|
|
14727
14754
|
});
|
|
14728
14755
|
RECORD_SUFFIX = ".json";
|
|
14729
14756
|
InterruptedNameRenameError = class extends CliError {
|
|
@@ -14738,7 +14765,7 @@ var init_identityNameRenameRecord = __esm({
|
|
|
14738
14765
|
// src/launcher/launchRecords.ts
|
|
14739
14766
|
import path30 from "node:path";
|
|
14740
14767
|
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
14741
|
-
import { z as
|
|
14768
|
+
import { z as z24 } from "zod";
|
|
14742
14769
|
function recordFile(directory, pid) {
|
|
14743
14770
|
return path30.join(directory, `${String(pid)}.${randomUUID4()}${RECORD_SUFFIX2}`);
|
|
14744
14771
|
}
|
|
@@ -14785,11 +14812,11 @@ var LaunchRecordSchema, RECORD_SUFFIX2;
|
|
|
14785
14812
|
var init_launchRecords = __esm({
|
|
14786
14813
|
"src/launcher/launchRecords.ts"() {
|
|
14787
14814
|
"use strict";
|
|
14788
|
-
LaunchRecordSchema =
|
|
14815
|
+
LaunchRecordSchema = z24.strictObject({
|
|
14789
14816
|
/** The launcher's process id, which is what tells a launch in progress from a record a crashed launcher left behind. */
|
|
14790
|
-
pid:
|
|
14791
|
-
identity:
|
|
14792
|
-
startedAt:
|
|
14817
|
+
pid: z24.number().int().positive(),
|
|
14818
|
+
identity: z24.string().min(1),
|
|
14819
|
+
startedAt: z24.iso.datetime()
|
|
14793
14820
|
});
|
|
14794
14821
|
RECORD_SUFFIX2 = ".json";
|
|
14795
14822
|
}
|
|
@@ -14821,6 +14848,15 @@ var init_connectorProxyAuth = __esm({
|
|
|
14821
14848
|
}
|
|
14822
14849
|
});
|
|
14823
14850
|
|
|
14851
|
+
// src/toolSurfaceAuth.ts
|
|
14852
|
+
var init_toolSurfaceAuth = __esm({
|
|
14853
|
+
"src/toolSurfaceAuth.ts"() {
|
|
14854
|
+
"use strict";
|
|
14855
|
+
init_connect();
|
|
14856
|
+
init_lenderLogin();
|
|
14857
|
+
}
|
|
14858
|
+
});
|
|
14859
|
+
|
|
14824
14860
|
// src/connectorListMerge.ts
|
|
14825
14861
|
var init_connectorListMerge = __esm({
|
|
14826
14862
|
"src/connectorListMerge.ts"() {
|
|
@@ -15290,6 +15326,7 @@ var init_identityStore = __esm({
|
|
|
15290
15326
|
init_launchRecords();
|
|
15291
15327
|
init_identityGrants();
|
|
15292
15328
|
init_connectorProxyAuth();
|
|
15329
|
+
init_toolSurfaceAuth();
|
|
15293
15330
|
init_connectorListMerge();
|
|
15294
15331
|
init_lenderLogin();
|
|
15295
15332
|
init_quotaHttp();
|
|
@@ -15354,7 +15391,7 @@ var init_package = __esm({
|
|
|
15354
15391
|
"package.json"() {
|
|
15355
15392
|
package_default = {
|
|
15356
15393
|
name: "agent-shim",
|
|
15357
|
-
version: "14.
|
|
15394
|
+
version: "14.22.0",
|
|
15358
15395
|
description: "A profile manager and launcher for Claude Code that lets one person run multiple logins from one machine while controlling what gets shared between them.",
|
|
15359
15396
|
license: "MIT",
|
|
15360
15397
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -15464,13 +15501,13 @@ var init_package = __esm({
|
|
|
15464
15501
|
|
|
15465
15502
|
// src/supervise/sessionControl.ts
|
|
15466
15503
|
import path34 from "node:path";
|
|
15467
|
-
import { z as
|
|
15504
|
+
import { z as z26 } from "zod";
|
|
15468
15505
|
var RESULT_POLL_MS, SessionControlConversationSchema, REQUEST_INSTANT_DIGITS;
|
|
15469
15506
|
var init_sessionControl = __esm({
|
|
15470
15507
|
"src/supervise/sessionControl.ts"() {
|
|
15471
15508
|
"use strict";
|
|
15472
15509
|
RESULT_POLL_MS = 250;
|
|
15473
|
-
SessionControlConversationSchema =
|
|
15510
|
+
SessionControlConversationSchema = z26.object({ conversationId: z26.string().min(1), transcriptPath: z26.string().refine(path34.isAbsolute) });
|
|
15474
15511
|
REQUEST_INSTANT_DIGITS = String(Number.MAX_SAFE_INTEGER).length;
|
|
15475
15512
|
}
|
|
15476
15513
|
});
|
|
@@ -15621,7 +15658,7 @@ var init_commandDeps = __esm({
|
|
|
15621
15658
|
// src/claudeShim.ts
|
|
15622
15659
|
import fs10 from "node:fs";
|
|
15623
15660
|
import path35 from "node:path";
|
|
15624
|
-
import { z as
|
|
15661
|
+
import { z as z32 } from "zod";
|
|
15625
15662
|
function commandFilename(ownExecutablePath, commandName) {
|
|
15626
15663
|
return ownExecutablePath.toLowerCase().endsWith(".exe") ? `${commandName}.exe` : commandName;
|
|
15627
15664
|
}
|
|
@@ -15691,10 +15728,10 @@ var init_claudeShim = __esm({
|
|
|
15691
15728
|
init_realPorts();
|
|
15692
15729
|
init_cliError();
|
|
15693
15730
|
init_fileFaults();
|
|
15694
|
-
ClaudeShimStateSchema =
|
|
15695
|
-
targetPath:
|
|
15696
|
-
method:
|
|
15697
|
-
installedAtMs:
|
|
15731
|
+
ClaudeShimStateSchema = z32.strictObject({
|
|
15732
|
+
targetPath: z32.string().min(1),
|
|
15733
|
+
method: z32.enum(["hardlink", "copy"]),
|
|
15734
|
+
installedAtMs: z32.number()
|
|
15698
15735
|
});
|
|
15699
15736
|
SCRIPT_HEAD_BYTES = 4096;
|
|
15700
15737
|
LAUNCHER_NAME = /\b(agent-shim|claude-use)\b/;
|
|
@@ -16029,7 +16066,7 @@ var init_providerReachability = __esm({
|
|
|
16029
16066
|
});
|
|
16030
16067
|
|
|
16031
16068
|
// src/providerAliases.ts
|
|
16032
|
-
import { z as
|
|
16069
|
+
import { z as z33 } from "zod";
|
|
16033
16070
|
function parseAliases(file, raw) {
|
|
16034
16071
|
const parsed = ProviderAliasesSchema.safeParse(raw);
|
|
16035
16072
|
if (!parsed.success) {
|
|
@@ -16069,7 +16106,7 @@ var init_providerAliases = __esm({
|
|
|
16069
16106
|
init_load();
|
|
16070
16107
|
init_store();
|
|
16071
16108
|
init_ownEntry();
|
|
16072
|
-
ProviderAliasesSchema =
|
|
16109
|
+
ProviderAliasesSchema = z33.record(z33.string().min(1), z33.string().min(1));
|
|
16073
16110
|
}
|
|
16074
16111
|
});
|
|
16075
16112
|
|
|
@@ -16846,12 +16883,12 @@ var init_tolerantReaders = __esm({
|
|
|
16846
16883
|
});
|
|
16847
16884
|
|
|
16848
16885
|
// src/frontdoor/catalogueState.ts
|
|
16849
|
-
import { z as
|
|
16886
|
+
import { z as z35 } from "zod";
|
|
16850
16887
|
function readCatalogueFailure(fs17, paths, pid, generation, name) {
|
|
16851
16888
|
const raw = new StoredCatalogue(paths, skippingReader(fs17)).failureText({ pid, generation }, name);
|
|
16852
16889
|
if (raw === void 0) return void 0;
|
|
16853
16890
|
try {
|
|
16854
|
-
const value =
|
|
16891
|
+
const value = z35.strictObject({ reason: z35.string().max(CATALOGUE_FAILURE_REASON_MAX_CHARS), redirected: z35.literal(true).optional(), settings: z35.string().optional() }).safeParse(JSON.parse(raw));
|
|
16855
16892
|
return value.success ? { reason: value.data.reason, redirected: value.data.redirected === true, settings: value.data.settings } : void 0;
|
|
16856
16893
|
} catch {
|
|
16857
16894
|
return void 0;
|
|
@@ -16861,7 +16898,7 @@ function readCatalogueStatus(fs17, paths, pid, generation, name) {
|
|
|
16861
16898
|
const raw = new StoredCatalogue(paths, skippingReader(fs17)).statusText({ pid, generation }, name);
|
|
16862
16899
|
if (raw === void 0) return void 0;
|
|
16863
16900
|
try {
|
|
16864
|
-
const value =
|
|
16901
|
+
const value = z35.strictObject({ status: z35.enum(["running", "ready", "failed"]), fingerprint: z35.string().min(1).optional(), recordedAt: z35.number().optional() }).safeParse(JSON.parse(raw));
|
|
16865
16902
|
return value.success ? value.data : void 0;
|
|
16866
16903
|
} catch {
|
|
16867
16904
|
return void 0;
|
|
@@ -16878,25 +16915,25 @@ var init_catalogueState = __esm({
|
|
|
16878
16915
|
});
|
|
16879
16916
|
|
|
16880
16917
|
// src/codex/auth.ts
|
|
16881
|
-
import { z as
|
|
16918
|
+
import { z as z36 } from "zod";
|
|
16882
16919
|
var AuthFileSchema, TokenGrantSchema, CodexAuthError;
|
|
16883
16920
|
var init_auth = __esm({
|
|
16884
16921
|
"src/codex/auth.ts"() {
|
|
16885
16922
|
"use strict";
|
|
16886
|
-
AuthFileSchema =
|
|
16887
|
-
tokens:
|
|
16888
|
-
access_token:
|
|
16889
|
-
refresh_token:
|
|
16890
|
-
id_token:
|
|
16891
|
-
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()
|
|
16892
16929
|
}).nullish(),
|
|
16893
|
-
last_refresh:
|
|
16930
|
+
last_refresh: z36.string().optional()
|
|
16894
16931
|
});
|
|
16895
|
-
TokenGrantSchema =
|
|
16896
|
-
access_token:
|
|
16897
|
-
refresh_token:
|
|
16898
|
-
id_token:
|
|
16899
|
-
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()
|
|
16900
16937
|
});
|
|
16901
16938
|
CodexAuthError = class extends Error {
|
|
16902
16939
|
constructor(message) {
|
|
@@ -16908,7 +16945,7 @@ var init_auth = __esm({
|
|
|
16908
16945
|
});
|
|
16909
16946
|
|
|
16910
16947
|
// src/codex/siwc.ts
|
|
16911
|
-
import { z as
|
|
16948
|
+
import { z as z37 } from "zod";
|
|
16912
16949
|
var SIWC_RESOURCE, SIWC_RESPONSES_URL, SIWC_PLAN_SCOPE, TokenResponseSchema, JwtHeaderSchema, IdTokenClaimsSchema, JwksSchema;
|
|
16913
16950
|
var init_siwc = __esm({
|
|
16914
16951
|
"src/codex/siwc.ts"() {
|
|
@@ -16916,28 +16953,28 @@ var init_siwc = __esm({
|
|
|
16916
16953
|
SIWC_RESOURCE = "https://api.openai.com/v1";
|
|
16917
16954
|
SIWC_RESPONSES_URL = `${SIWC_RESOURCE}/responses`;
|
|
16918
16955
|
SIWC_PLAN_SCOPE = "chatgpt.tokens.use.direct";
|
|
16919
|
-
TokenResponseSchema =
|
|
16920
|
-
access_token:
|
|
16921
|
-
refresh_token:
|
|
16922
|
-
id_token:
|
|
16923
|
-
expires_in:
|
|
16924
|
-
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()
|
|
16925
16962
|
});
|
|
16926
|
-
JwtHeaderSchema =
|
|
16927
|
-
IdTokenClaimsSchema =
|
|
16928
|
-
iss:
|
|
16929
|
-
sub:
|
|
16930
|
-
aud:
|
|
16931
|
-
exp:
|
|
16932
|
-
nonce:
|
|
16933
|
-
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()
|
|
16934
16971
|
});
|
|
16935
|
-
JwksSchema =
|
|
16972
|
+
JwksSchema = z37.object({ keys: z37.array(z37.looseObject({ kid: z37.string().optional(), kty: z37.string() })) });
|
|
16936
16973
|
}
|
|
16937
16974
|
});
|
|
16938
16975
|
|
|
16939
16976
|
// src/codex/siwcStore.ts
|
|
16940
|
-
import { z as
|
|
16977
|
+
import { z as z38 } from "zod";
|
|
16941
16978
|
function parseSiwcFile(raw, filePath) {
|
|
16942
16979
|
let json;
|
|
16943
16980
|
try {
|
|
@@ -16957,18 +16994,18 @@ var init_siwcStore = __esm({
|
|
|
16957
16994
|
"use strict";
|
|
16958
16995
|
init_auth();
|
|
16959
16996
|
init_siwc();
|
|
16960
|
-
SiwcGrantSchema =
|
|
16961
|
-
clientId:
|
|
16962
|
-
sub:
|
|
16963
|
-
email:
|
|
16964
|
-
idToken:
|
|
16965
|
-
accessToken:
|
|
16966
|
-
refreshToken:
|
|
16967
|
-
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(),
|
|
16968
17005
|
/** When the access token stops working, in milliseconds since the epoch. */
|
|
16969
|
-
expiresAt:
|
|
17006
|
+
expiresAt: z38.number()
|
|
16970
17007
|
});
|
|
16971
|
-
SiwcFileSchema =
|
|
17008
|
+
SiwcFileSchema = z38.strictObject({ registeredClientId: z38.string().min(1).optional(), grant: SiwcGrantSchema.optional() });
|
|
16972
17009
|
}
|
|
16973
17010
|
});
|
|
16974
17011
|
|
|
@@ -17034,7 +17071,7 @@ var init_modelsStore = __esm({
|
|
|
17034
17071
|
// src/codex/catalogueCredential.ts
|
|
17035
17072
|
import { createHash as createHash11 } from "node:crypto";
|
|
17036
17073
|
import path43 from "node:path";
|
|
17037
|
-
import { z as
|
|
17074
|
+
import { z as z39 } from "zod";
|
|
17038
17075
|
function parseCatalogueBinding(raw) {
|
|
17039
17076
|
if (raw === void 0) return void 0;
|
|
17040
17077
|
try {
|
|
@@ -17075,7 +17112,7 @@ var init_catalogueCredential = __esm({
|
|
|
17075
17112
|
"src/codex/catalogueCredential.ts"() {
|
|
17076
17113
|
"use strict";
|
|
17077
17114
|
init_siwcStore();
|
|
17078
|
-
CatalogueBindingSchema =
|
|
17115
|
+
CatalogueBindingSchema = z39.strictObject({ fingerprint: z39.string().min(1), source: z39.string().min(1), revision: z39.string().min(1) });
|
|
17079
17116
|
}
|
|
17080
17117
|
});
|
|
17081
17118
|
|
|
@@ -17127,64 +17164,64 @@ var init_signatures = __esm({
|
|
|
17127
17164
|
});
|
|
17128
17165
|
|
|
17129
17166
|
// src/codex/anthropic.ts
|
|
17130
|
-
import { z as
|
|
17167
|
+
import { z as z40 } from "zod";
|
|
17131
17168
|
var TextBlockSchema, Base64ImageSourceSchema, UrlImageSourceSchema, ImageBlockSchema, ToolUseBlockSchema, ToolResultContentBlockSchema, ToolResultBlockSchema, OtherBlockSchema, ContentBlockSchema, MessageSchema, ToolSchema, ToolChoiceSchema, SystemSchema, MessagesRequestSchema, CountTokensRequestSchema;
|
|
17132
17169
|
var init_anthropic = __esm({
|
|
17133
17170
|
"src/codex/anthropic.ts"() {
|
|
17134
17171
|
"use strict";
|
|
17135
|
-
TextBlockSchema =
|
|
17136
|
-
Base64ImageSourceSchema =
|
|
17137
|
-
UrlImageSourceSchema =
|
|
17138
|
-
ImageBlockSchema =
|
|
17139
|
-
type:
|
|
17140
|
-
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])
|
|
17141
17178
|
});
|
|
17142
|
-
ToolUseBlockSchema =
|
|
17143
|
-
type:
|
|
17144
|
-
id:
|
|
17145
|
-
name:
|
|
17146
|
-
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()
|
|
17147
17184
|
});
|
|
17148
|
-
ToolResultContentBlockSchema =
|
|
17149
|
-
ToolResultBlockSchema =
|
|
17150
|
-
type:
|
|
17151
|
-
tool_use_id:
|
|
17152
|
-
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()
|
|
17153
17190
|
});
|
|
17154
|
-
OtherBlockSchema =
|
|
17155
|
-
ContentBlockSchema =
|
|
17156
|
-
MessageSchema =
|
|
17157
|
-
role:
|
|
17158
|
-
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)])
|
|
17159
17196
|
});
|
|
17160
|
-
ToolSchema =
|
|
17161
|
-
name:
|
|
17162
|
-
description:
|
|
17163
|
-
input_schema:
|
|
17164
|
-
allowed_domains:
|
|
17165
|
-
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()
|
|
17166
17203
|
});
|
|
17167
|
-
ToolChoiceSchema =
|
|
17168
|
-
|
|
17169
|
-
|
|
17204
|
+
ToolChoiceSchema = z40.union([
|
|
17205
|
+
z40.looseObject({ type: z40.enum(["auto", "none", "any"]) }),
|
|
17206
|
+
z40.looseObject({ type: z40.literal("tool"), name: z40.string().min(1) })
|
|
17170
17207
|
]);
|
|
17171
|
-
SystemSchema =
|
|
17172
|
-
MessagesRequestSchema =
|
|
17173
|
-
model:
|
|
17208
|
+
SystemSchema = z40.union([z40.string(), z40.array(z40.union([TextBlockSchema, OtherBlockSchema]))]);
|
|
17209
|
+
MessagesRequestSchema = z40.looseObject({
|
|
17210
|
+
model: z40.string().optional(),
|
|
17174
17211
|
system: SystemSchema.optional(),
|
|
17175
|
-
messages:
|
|
17176
|
-
tools:
|
|
17212
|
+
messages: z40.array(MessageSchema),
|
|
17213
|
+
tools: z40.array(ToolSchema).optional(),
|
|
17177
17214
|
tool_choice: ToolChoiceSchema.optional(),
|
|
17178
|
-
stream:
|
|
17215
|
+
stream: z40.boolean().optional(),
|
|
17179
17216
|
/** `user_id` is stable for one Claude Code session and differs between sessions, which is what makes it the right key for both the backend's prompt cache and its session header. */
|
|
17180
|
-
metadata:
|
|
17217
|
+
metadata: z40.looseObject({ user_id: z40.string().optional() }).optional(),
|
|
17181
17218
|
/** Claude Code's effort setting. Any string is accepted; the translator honours only the levels the backend understands. */
|
|
17182
|
-
output_config:
|
|
17219
|
+
output_config: z40.looseObject({ effort: z40.string().optional(), format: z40.object({ type: z40.literal("json_schema"), schema: z40.record(z40.string(), z40.unknown()) }).optional() }).optional()
|
|
17183
17220
|
});
|
|
17184
|
-
CountTokensRequestSchema =
|
|
17185
|
-
system:
|
|
17186
|
-
messages:
|
|
17187
|
-
tools:
|
|
17221
|
+
CountTokensRequestSchema = z40.looseObject({
|
|
17222
|
+
system: z40.unknown().optional(),
|
|
17223
|
+
messages: z40.unknown().optional(),
|
|
17224
|
+
tools: z40.unknown().optional()
|
|
17188
17225
|
});
|
|
17189
17226
|
}
|
|
17190
17227
|
});
|
|
@@ -19056,7 +19093,7 @@ var init_sessionControlPlugin = __esm({
|
|
|
19056
19093
|
// src/supervise/launchControl.ts
|
|
19057
19094
|
import path54 from "node:path";
|
|
19058
19095
|
import { randomUUID as randomUUID6 } from "node:crypto";
|
|
19059
|
-
import { z as
|
|
19096
|
+
import { z as z51 } from "zod";
|
|
19060
19097
|
function readRecord2(fs17, directory, name) {
|
|
19061
19098
|
if (!name.endsWith(RECORD_SUFFIX3)) {
|
|
19062
19099
|
return void 0;
|
|
@@ -19136,11 +19173,11 @@ var init_launchControl = __esm({
|
|
|
19136
19173
|
init_sessionControl();
|
|
19137
19174
|
init_sessionControlPlugin();
|
|
19138
19175
|
init_verifiedVersions();
|
|
19139
|
-
LaunchControlSchema =
|
|
19176
|
+
LaunchControlSchema = z51.strictObject({
|
|
19140
19177
|
/** The launcher's process id, which tells a live channel from one a killed launcher left. */
|
|
19141
|
-
pid:
|
|
19178
|
+
pid: z51.number().int().positive(),
|
|
19142
19179
|
/** The plugin's directory, its request and result files beneath it. */
|
|
19143
|
-
directory:
|
|
19180
|
+
directory: z51.string().min(1)
|
|
19144
19181
|
});
|
|
19145
19182
|
RECORD_SUFFIX3 = ".json";
|
|
19146
19183
|
}
|
|
@@ -20460,7 +20497,7 @@ var init_identityClaude = __esm({
|
|
|
20460
20497
|
});
|
|
20461
20498
|
|
|
20462
20499
|
// src/usage/providerQuota.ts
|
|
20463
|
-
import { z as
|
|
20500
|
+
import { z as z52 } from "zod";
|
|
20464
20501
|
var MS_PER_SECOND9, SECONDS_PER_HOUR3, HOURS_PER_DAY6, DAYS_PER_MONTH, ZAI_HOST, ZAI_QUOTA_URL, ZAI_UNIT_HOURS, ZAI_UNIT_MONTHS, ZAI_UNIT_MS, ZaiLimitSchema, ZaiResponseSchema, OPENROUTER_HOST, OPENROUTER_KEY_URL, OPENROUTER_CREDITS_URL, MS_PER_DAY2, OpenRouterKeySchema, OpenRouterCreditsSchema, ANTIGRAVITY_HOST, ANTIGRAVITY_QUOTA_URL, ANTIGRAVITY_USER_URL, FIVE_HOURS2, DAYS_PER_WEEK2, FIVE_HOURS_MS, WEEK_MS, AntigravityBucketSchema, AntigravitySummarySchema, GoogleTokenInfoSchema, AntigravityUserSchema;
|
|
20465
20502
|
var init_providerQuota = __esm({
|
|
20466
20503
|
"src/usage/providerQuota.ts"() {
|
|
@@ -20480,35 +20517,35 @@ var init_providerQuota = __esm({
|
|
|
20480
20517
|
[ZAI_UNIT_HOURS, SECONDS_PER_HOUR3 * MS_PER_SECOND9],
|
|
20481
20518
|
[ZAI_UNIT_MONTHS, DAYS_PER_MONTH * HOURS_PER_DAY6 * SECONDS_PER_HOUR3 * MS_PER_SECOND9]
|
|
20482
20519
|
]);
|
|
20483
|
-
ZaiLimitSchema =
|
|
20484
|
-
type:
|
|
20485
|
-
unit:
|
|
20486
|
-
number:
|
|
20487
|
-
percentage:
|
|
20488
|
-
nextResetTime:
|
|
20489
|
-
usage:
|
|
20490
|
-
currentValue:
|
|
20491
|
-
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()
|
|
20492
20529
|
});
|
|
20493
|
-
ZaiResponseSchema =
|
|
20494
|
-
success:
|
|
20495
|
-
msg:
|
|
20496
|
-
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) })
|
|
20497
20534
|
});
|
|
20498
20535
|
OPENROUTER_HOST = "openrouter.ai";
|
|
20499
20536
|
OPENROUTER_KEY_URL = `https://${OPENROUTER_HOST}/api/v1/key`;
|
|
20500
20537
|
OPENROUTER_CREDITS_URL = `https://${OPENROUTER_HOST}/api/v1/credits`;
|
|
20501
20538
|
MS_PER_DAY2 = HOURS_PER_DAY6 * SECONDS_PER_HOUR3 * MS_PER_SECOND9;
|
|
20502
|
-
OpenRouterKeySchema =
|
|
20503
|
-
data:
|
|
20504
|
-
limit:
|
|
20505
|
-
limit_remaining:
|
|
20506
|
-
limit_reset:
|
|
20507
|
-
is_free_tier:
|
|
20508
|
-
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()
|
|
20509
20546
|
})
|
|
20510
20547
|
});
|
|
20511
|
-
OpenRouterCreditsSchema =
|
|
20548
|
+
OpenRouterCreditsSchema = z52.object({ data: z52.object({ total_credits: z52.number().nonnegative(), total_usage: z52.number().nonnegative() }) });
|
|
20512
20549
|
ANTIGRAVITY_HOST = "daily-cloudcode-pa.googleapis.com";
|
|
20513
20550
|
ANTIGRAVITY_QUOTA_URL = `https://${ANTIGRAVITY_HOST}/v1internal:retrieveUserQuotaSummary`;
|
|
20514
20551
|
ANTIGRAVITY_USER_URL = `https://${ANTIGRAVITY_HOST}/v1internal:loadCodeAssist`;
|
|
@@ -20516,21 +20553,21 @@ var init_providerQuota = __esm({
|
|
|
20516
20553
|
DAYS_PER_WEEK2 = 7;
|
|
20517
20554
|
FIVE_HOURS_MS = FIVE_HOURS2 * SECONDS_PER_HOUR3 * MS_PER_SECOND9;
|
|
20518
20555
|
WEEK_MS = DAYS_PER_WEEK2 * HOURS_PER_DAY6 * SECONDS_PER_HOUR3 * MS_PER_SECOND9;
|
|
20519
|
-
AntigravityBucketSchema =
|
|
20520
|
-
bucketId:
|
|
20521
|
-
remainingFraction:
|
|
20522
|
-
resetTime:
|
|
20556
|
+
AntigravityBucketSchema = z52.object({
|
|
20557
|
+
bucketId: z52.string(),
|
|
20558
|
+
remainingFraction: z52.number().optional(),
|
|
20559
|
+
resetTime: z52.string().optional()
|
|
20523
20560
|
});
|
|
20524
|
-
AntigravitySummarySchema =
|
|
20525
|
-
GoogleTokenInfoSchema =
|
|
20526
|
-
email:
|
|
20527
|
-
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()
|
|
20528
20565
|
});
|
|
20529
|
-
AntigravityUserSchema =
|
|
20566
|
+
AntigravityUserSchema = z52.object({
|
|
20530
20567
|
/** The code-assist tier context, which defaults to the free tier for every account. */
|
|
20531
|
-
currentTier:
|
|
20568
|
+
currentTier: z52.object({ name: z52.string().optional(), id: z52.string().optional() }).optional(),
|
|
20532
20569
|
/** The account's paid subscription; absent when the account has none. */
|
|
20533
|
-
paidTier:
|
|
20570
|
+
paidTier: z52.object({ name: z52.string().optional(), id: z52.string().optional() }).optional()
|
|
20534
20571
|
});
|
|
20535
20572
|
}
|
|
20536
20573
|
});
|
|
@@ -20625,19 +20662,19 @@ init_rcSessions();
|
|
|
20625
20662
|
// src/frontdoor/rcSessionRegistry.ts
|
|
20626
20663
|
init_identityStore();
|
|
20627
20664
|
import path32 from "node:path";
|
|
20628
|
-
import { z as
|
|
20665
|
+
import { z as z25 } from "zod";
|
|
20629
20666
|
var REGISTRY_BRIDGE_PREFIX = "session_";
|
|
20630
20667
|
var DOOR_SESSION_PREFIX = "cse_";
|
|
20631
20668
|
var REGISTRY_DIR = "sessions";
|
|
20632
20669
|
var ENTRY_SUFFIX = ".json";
|
|
20633
20670
|
var RC_REGISTRY_ENTRY_MAX_BYTES = 8192;
|
|
20634
|
-
var RegistryEntrySchema =
|
|
20635
|
-
sessionId:
|
|
20636
|
-
pid:
|
|
20637
|
-
bridgeSessionId:
|
|
20638
|
-
cwd:
|
|
20639
|
-
name:
|
|
20640
|
-
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()
|
|
20641
20678
|
});
|
|
20642
20679
|
function supersedes(candidate, kept) {
|
|
20643
20680
|
return candidate.updatedAt > kept.updatedAt || candidate.updatedAt === kept.updatedAt && candidate.session.pid > kept.session.pid;
|
|
@@ -20855,7 +20892,7 @@ init_rcSchemas();
|
|
|
20855
20892
|
|
|
20856
20893
|
// src/frontdoor/rcSlashCommandSchemas.ts
|
|
20857
20894
|
init_rcSchemas();
|
|
20858
|
-
import { z as
|
|
20895
|
+
import { z as z27 } from "zod";
|
|
20859
20896
|
|
|
20860
20897
|
// src/frontdoor/rcSessionCommands.ts
|
|
20861
20898
|
import { setTimeout as sleep } from "node:timers/promises";
|
|
@@ -21363,57 +21400,57 @@ function createRcSessionCommands(deps) {
|
|
|
21363
21400
|
}
|
|
21364
21401
|
|
|
21365
21402
|
// src/frontdoor/rcSlashCommandSchemas.ts
|
|
21366
|
-
var WaitMsSchema =
|
|
21367
|
-
var RcGoalSessionInputSchema =
|
|
21368
|
-
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),
|
|
21369
21406
|
waitMs: WaitMsSchema
|
|
21370
21407
|
});
|
|
21371
|
-
var RcGoalSetInputSchema =
|
|
21372
|
-
session:
|
|
21373
|
-
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"),
|
|
21374
21411
|
waitMs: WaitMsSchema
|
|
21375
21412
|
});
|
|
21376
|
-
var RcCompactInputSchema =
|
|
21377
|
-
session:
|
|
21413
|
+
var RcCompactInputSchema = z27.strictObject({
|
|
21414
|
+
session: z27.string().min(1),
|
|
21378
21415
|
waitMs: WaitMsSchema
|
|
21379
21416
|
});
|
|
21380
|
-
var RcCompactWithInstructionsInputSchema =
|
|
21381
|
-
session:
|
|
21382
|
-
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),
|
|
21383
21420
|
waitMs: WaitMsSchema
|
|
21384
21421
|
});
|
|
21385
|
-
var RcTurnInputSchema =
|
|
21386
|
-
session:
|
|
21387
|
-
text:
|
|
21422
|
+
var RcTurnInputSchema = z27.strictObject({
|
|
21423
|
+
session: z27.string().min(1),
|
|
21424
|
+
text: z27.string().min(1).max(RC_TURN_TEXT_MAX_CHARS),
|
|
21388
21425
|
waitMs: WaitMsSchema
|
|
21389
21426
|
});
|
|
21390
21427
|
var commandAnswerShape = {
|
|
21391
|
-
session:
|
|
21428
|
+
session: z27.string(),
|
|
21392
21429
|
route: RcSessionCommandRouteSchema,
|
|
21393
21430
|
warnings: RcVersionGateWarningsSchema
|
|
21394
21431
|
};
|
|
21395
|
-
var RcGoalGetOutputSchema =
|
|
21432
|
+
var RcGoalGetOutputSchema = z27.strictObject({
|
|
21396
21433
|
...commandAnswerShape,
|
|
21397
|
-
goal:
|
|
21434
|
+
goal: z27.strictObject({ condition: z27.string(), iterations: z27.int().nonnegative(), lastCheck: z27.string().optional() }).nullable()
|
|
21398
21435
|
});
|
|
21399
|
-
var RcGoalSetOutputSchema =
|
|
21436
|
+
var RcGoalSetOutputSchema = z27.strictObject({
|
|
21400
21437
|
...commandAnswerShape,
|
|
21401
|
-
condition:
|
|
21402
|
-
superseded:
|
|
21438
|
+
condition: z27.string(),
|
|
21439
|
+
superseded: z27.string().nullable()
|
|
21403
21440
|
});
|
|
21404
|
-
var RcGoalClearOutputSchema =
|
|
21441
|
+
var RcGoalClearOutputSchema = z27.strictObject({
|
|
21405
21442
|
...commandAnswerShape,
|
|
21406
|
-
cleared:
|
|
21443
|
+
cleared: z27.string().nullable()
|
|
21407
21444
|
});
|
|
21408
|
-
var RcTurnOutputSchema =
|
|
21445
|
+
var RcTurnOutputSchema = z27.strictObject({
|
|
21409
21446
|
...commandAnswerShape,
|
|
21410
|
-
uuid:
|
|
21447
|
+
uuid: z27.string()
|
|
21411
21448
|
});
|
|
21412
|
-
var RcCompactOutputSchema =
|
|
21449
|
+
var RcCompactOutputSchema = z27.strictObject({
|
|
21413
21450
|
...commandAnswerShape,
|
|
21414
|
-
trigger:
|
|
21415
|
-
preTokens:
|
|
21416
|
-
postTokens:
|
|
21451
|
+
trigger: z27.string(),
|
|
21452
|
+
preTokens: z27.number().optional(),
|
|
21453
|
+
postTokens: z27.number().optional()
|
|
21417
21454
|
});
|
|
21418
21455
|
|
|
21419
21456
|
// src/frontdoor/rcApi.ts
|
|
@@ -21478,7 +21515,7 @@ function createRcApiRouter(deps) {
|
|
|
21478
21515
|
if (input.session !== void 0 && !statuses.some((entry) => entry.id === input.session)) {
|
|
21479
21516
|
throw new ORPCError("NOT_FOUND", { message: rcSessionNotObservedMessage(input.session) });
|
|
21480
21517
|
}
|
|
21481
|
-
return { statuses: await Promise.all(statuses.map(async (status) => ({ ...status, route: await deps.routeOf(status.id) }))) };
|
|
21518
|
+
return { statuses: await Promise.all(statuses.map(async (status) => ({ ...status, route: await deps.routeOf(status.id), serverState: await deps.serverStateOf(status.id) }))) };
|
|
21482
21519
|
}),
|
|
21483
21520
|
pending: authed.meta(openapi({ method: "GET", path: "/rest/rc/pending", summary: "Read the control requests awaiting an answer", tags: [RC_API_TAG] })).input(RcSessionQuerySchema).output(RcPendingOutputSchema).handler(({ input }) => {
|
|
21484
21521
|
const pending = deps.pendingOf(input.session);
|
|
@@ -21643,48 +21680,48 @@ init_cliError();
|
|
|
21643
21680
|
init_package();
|
|
21644
21681
|
|
|
21645
21682
|
// src/codex/appServerSchemas.ts
|
|
21646
|
-
import { z as
|
|
21683
|
+
import { z as z28 } from "zod";
|
|
21647
21684
|
var CODEX_APP_SERVER_GENERATED_AGAINST = "0.160.0";
|
|
21648
|
-
var RateLimitWindowSchema =
|
|
21649
|
-
usedPercent:
|
|
21650
|
-
resetsAt:
|
|
21651
|
-
windowDurationMins:
|
|
21652
|
-
});
|
|
21653
|
-
var RateLimitSnapshotSchema =
|
|
21654
|
-
limitId:
|
|
21655
|
-
limitName:
|
|
21656
|
-
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(),
|
|
21657
21694
|
primary: RateLimitWindowSchema.nullish(),
|
|
21658
21695
|
secondary: RateLimitWindowSchema.nullish(),
|
|
21659
|
-
rateLimitReachedType:
|
|
21660
|
-
spendControlReached:
|
|
21661
|
-
});
|
|
21662
|
-
var RateLimitResetCreditSchema =
|
|
21663
|
-
id:
|
|
21664
|
-
grantedAt:
|
|
21665
|
-
expiresAt:
|
|
21666
|
-
resetType:
|
|
21667
|
-
status:
|
|
21668
|
-
title:
|
|
21669
|
-
description:
|
|
21670
|
-
});
|
|
21671
|
-
var CodexAccountSchema =
|
|
21672
|
-
|
|
21673
|
-
|
|
21674
|
-
|
|
21696
|
+
rateLimitReachedType: z28.string().nullish(),
|
|
21697
|
+
spendControlReached: z28.boolean().nullish()
|
|
21698
|
+
});
|
|
21699
|
+
var RateLimitResetCreditSchema = z28.object({
|
|
21700
|
+
id: z28.string(),
|
|
21701
|
+
grantedAt: z28.number(),
|
|
21702
|
+
expiresAt: z28.number().nullish(),
|
|
21703
|
+
resetType: z28.string(),
|
|
21704
|
+
status: z28.string(),
|
|
21705
|
+
title: z28.string().nullish(),
|
|
21706
|
+
description: z28.string().nullish()
|
|
21707
|
+
});
|
|
21708
|
+
var CodexAccountSchema = z28.discriminatedUnion("type", [
|
|
21709
|
+
z28.object({ type: z28.literal("apiKey") }),
|
|
21710
|
+
z28.object({ type: z28.literal("chatgpt"), email: z28.string().nullable(), planType: z28.string() }),
|
|
21711
|
+
z28.object({ type: z28.literal("amazonBedrock"), usesCodexManagedCredentials: z28.boolean().default(false) })
|
|
21675
21712
|
]);
|
|
21676
|
-
var CodexAccountReadSchema =
|
|
21713
|
+
var CodexAccountReadSchema = z28.object({
|
|
21677
21714
|
account: CodexAccountSchema.nullable(),
|
|
21678
|
-
requiresOpenaiAuth:
|
|
21715
|
+
requiresOpenaiAuth: z28.boolean()
|
|
21679
21716
|
});
|
|
21680
|
-
var CodexRateLimitsReadSchema =
|
|
21717
|
+
var CodexRateLimitsReadSchema = z28.object({
|
|
21681
21718
|
rateLimits: RateLimitSnapshotSchema,
|
|
21682
|
-
rateLimitsByLimitId:
|
|
21683
|
-
rateLimitResetCredits:
|
|
21684
|
-
accountId:
|
|
21685
|
-
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()
|
|
21686
21723
|
});
|
|
21687
|
-
var CodexInitializeResultSchema =
|
|
21724
|
+
var CodexInitializeResultSchema = z28.object({ userAgent: z28.string() });
|
|
21688
21725
|
|
|
21689
21726
|
// src/codex/appServer.ts
|
|
21690
21727
|
var CodexAppServerUnavailableError = class extends CliError {
|
|
@@ -21887,7 +21924,7 @@ init_schema();
|
|
|
21887
21924
|
init_claudeVersion();
|
|
21888
21925
|
init_identity2();
|
|
21889
21926
|
init_projects();
|
|
21890
|
-
import { z as
|
|
21927
|
+
import { z as z30 } from "zod";
|
|
21891
21928
|
|
|
21892
21929
|
// src/resolve/types.ts
|
|
21893
21930
|
var LAYER_KINDS = [
|
|
@@ -21950,139 +21987,139 @@ var DIAGNOSTIC_SEVERITIES = ["error", "warning", "info"];
|
|
|
21950
21987
|
|
|
21951
21988
|
// src/usage/pickReportSchema.ts
|
|
21952
21989
|
init_plan2();
|
|
21953
|
-
import { z as
|
|
21954
|
-
var PoolPickCandidateViewSchema =
|
|
21955
|
-
identity:
|
|
21990
|
+
import { z as z29 } from "zod";
|
|
21991
|
+
var PoolPickCandidateViewSchema = z29.strictObject({
|
|
21992
|
+
identity: z29.string(),
|
|
21956
21993
|
/** In pick order: `scored` has usable quota data, `unknown` has none and no plan known to bill by use, `pay-per-use` bills by use whether or not usage is recorded, `ineligible` is refused right now. */
|
|
21957
|
-
class:
|
|
21994
|
+
class: z29.enum(["scored", "unknown", "pay-per-use", "ineligible"]),
|
|
21958
21995
|
/** Plan-size-weighted remaining quota per hour until its reset; present for `scored` only. */
|
|
21959
|
-
score:
|
|
21996
|
+
score: z29.number().optional(),
|
|
21960
21997
|
/** Which window's reset divides the score: the seven-day window, or the five-hour one when the member reports no seven-day utilisation or its measured-ratio five-hour term outranks the weekly one; present with `score`. */
|
|
21961
|
-
scoreWindow:
|
|
21998
|
+
scoreWindow: z29.enum(["sevenDay", "fiveHour"]).optional(),
|
|
21962
21999
|
/** False when the five-hour window would run dry, at the observed pace, before it resets. */
|
|
21963
|
-
feasible:
|
|
22000
|
+
feasible: z29.boolean(),
|
|
21964
22001
|
/** When an `ineligible` member can be used again, as an ISO instant. */
|
|
21965
|
-
blockedUntil:
|
|
22002
|
+
blockedUntil: z29.iso.datetime().optional(),
|
|
21966
22003
|
plan: PlanClassSchema,
|
|
21967
22004
|
/** The provider the member was ranked on, when its launch spends one in place of its Claude account: its windows, refusals and plan are the provider's own. Absent when ranked on the Claude account. */
|
|
21968
|
-
provider:
|
|
22005
|
+
provider: z29.string().optional(),
|
|
21969
22006
|
/** The facts behind the class and score, in the order they matter. */
|
|
21970
|
-
reasons:
|
|
22007
|
+
reasons: z29.array(z29.string())
|
|
21971
22008
|
});
|
|
21972
|
-
var PoolPickReportSchema =
|
|
21973
|
-
pool:
|
|
21974
|
-
directory:
|
|
22009
|
+
var PoolPickReportSchema = z29.strictObject({
|
|
22010
|
+
pool: z29.string(),
|
|
22011
|
+
directory: z29.string(),
|
|
21975
22012
|
/** The member a launch would run as, absent when every member is refused. */
|
|
21976
|
-
pick:
|
|
21977
|
-
candidates:
|
|
22013
|
+
pick: z29.string().optional(),
|
|
22014
|
+
candidates: z29.array(PoolPickCandidateViewSchema),
|
|
21978
22015
|
/** Identity members anywhere in the pool's graph that do not exist; a launch skips them. */
|
|
21979
|
-
missing:
|
|
22016
|
+
missing: z29.array(z29.string()),
|
|
21980
22017
|
/** When nothing can be picked, the soonest any member returns. */
|
|
21981
|
-
earliestReturn:
|
|
22018
|
+
earliestReturn: z29.strictObject({ identity: z29.string(), at: z29.iso.datetime() }).optional(),
|
|
21982
22019
|
/** The member a resumed conversation started on but moved off, and why, when the ranking could not keep it. */
|
|
21983
|
-
movedOff:
|
|
22020
|
+
movedOff: z29.strictObject({ identity: z29.string(), reason: z29.string() }).optional(),
|
|
21984
22021
|
/** Why the last-pick record could not be read, when that is the case. */
|
|
21985
|
-
stickyProblem:
|
|
22022
|
+
stickyProblem: z29.string().optional()
|
|
21986
22023
|
});
|
|
21987
22024
|
|
|
21988
22025
|
// src/checkReportSchema.ts
|
|
21989
22026
|
init_identityGrants();
|
|
21990
22027
|
var CHECK_CREDENTIAL_APPLIES = ["provider", "identity", "stored-login"];
|
|
21991
|
-
var CheckLayerViewSchema =
|
|
21992
|
-
id:
|
|
21993
|
-
kind:
|
|
21994
|
-
source:
|
|
21995
|
-
});
|
|
21996
|
-
var CheckEntryViewSchema =
|
|
21997
|
-
path:
|
|
21998
|
-
shared:
|
|
21999
|
-
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),
|
|
22000
22037
|
/** The entry's real category, or null when nothing classifies it. */
|
|
22001
|
-
category:
|
|
22002
|
-
rule:
|
|
22038
|
+
category: z30.enum(CATEGORY_NAMES).nullable(),
|
|
22039
|
+
rule: z30.strictObject({ key: z30.string(), layer: z30.int() }).optional(),
|
|
22003
22040
|
/** Rules that matched but whose `when` condition failed, each with the conditions that failed. */
|
|
22004
|
-
eliminated:
|
|
22005
|
-
});
|
|
22006
|
-
var CheckDiagnosticSchema =
|
|
22007
|
-
code:
|
|
22008
|
-
severity:
|
|
22009
|
-
message:
|
|
22010
|
-
subject:
|
|
22011
|
-
layer:
|
|
22012
|
-
});
|
|
22013
|
-
var CheckAmbientCredentialSchema =
|
|
22014
|
-
var CheckKeychainSchema =
|
|
22015
|
-
checked:
|
|
22016
|
-
found:
|
|
22017
|
-
serviceName:
|
|
22018
|
-
note:
|
|
22019
|
-
});
|
|
22020
|
-
var CheckSettingsExposureSchema =
|
|
22021
|
-
file:
|
|
22022
|
-
envKeyNames:
|
|
22023
|
-
hookEventNames:
|
|
22024
|
-
hookCommandCount:
|
|
22025
|
-
});
|
|
22026
|
-
var CredentialSourceSummarySchema =
|
|
22027
|
-
|
|
22028
|
-
|
|
22029
|
-
|
|
22030
|
-
|
|
22031
|
-
|
|
22032
|
-
|
|
22041
|
+
eliminated: z30.readonly(z30.array(z30.strictObject({ key: z30.string(), failed: z30.readonly(z30.array(z30.string())) }))).optional()
|
|
22042
|
+
});
|
|
22043
|
+
var CheckDiagnosticSchema = z30.strictObject({
|
|
22044
|
+
code: z30.enum(DIAGNOSTIC_CODES),
|
|
22045
|
+
severity: z30.enum(DIAGNOSTIC_SEVERITIES),
|
|
22046
|
+
message: z30.string(),
|
|
22047
|
+
subject: z30.string().optional(),
|
|
22048
|
+
layer: z30.int().optional()
|
|
22049
|
+
});
|
|
22050
|
+
var CheckAmbientCredentialSchema = z30.union([z30.strictObject({ ok: z30.literal(true) }), z30.strictObject({ ok: z30.literal(false), variable: z30.string(), message: z30.string() })]);
|
|
22051
|
+
var CheckKeychainSchema = z30.strictObject({
|
|
22052
|
+
checked: z30.literal(true),
|
|
22053
|
+
found: z30.boolean(),
|
|
22054
|
+
serviceName: z30.string().optional(),
|
|
22055
|
+
note: z30.string()
|
|
22056
|
+
});
|
|
22057
|
+
var CheckSettingsExposureSchema = z30.strictObject({
|
|
22058
|
+
file: z30.string(),
|
|
22059
|
+
envKeyNames: z30.readonly(z30.array(z30.string())),
|
|
22060
|
+
hookEventNames: z30.readonly(z30.array(z30.string())),
|
|
22061
|
+
hookCommandCount: z30.int().nonnegative()
|
|
22062
|
+
});
|
|
22063
|
+
var CredentialSourceSummarySchema = z30.union([
|
|
22064
|
+
z30.strictObject({ kind: z30.literal("env"), variable: z30.string() }),
|
|
22065
|
+
z30.strictObject({ kind: z30.literal("file"), path: z30.string() }),
|
|
22066
|
+
z30.strictObject({ kind: z30.literal("command"), program: z30.string() }),
|
|
22067
|
+
z30.strictObject({ kind: z30.literal("op"), reference: z30.string() }),
|
|
22068
|
+
z30.strictObject({ kind: z30.literal("keychain"), service: z30.string(), account: z30.string().optional() }),
|
|
22069
|
+
z30.strictObject({ kind: z30.literal("literal") })
|
|
22033
22070
|
]);
|
|
22034
|
-
var CredentialSummarySchema =
|
|
22035
|
-
target:
|
|
22036
|
-
sources:
|
|
22071
|
+
var CredentialSummarySchema = z30.strictObject({
|
|
22072
|
+
target: z30.enum(CREDENTIAL_TARGETS),
|
|
22073
|
+
sources: z30.readonly(z30.array(CredentialSourceSummarySchema)),
|
|
22037
22074
|
cache: CredentialCacheSchema.optional()
|
|
22038
22075
|
});
|
|
22039
|
-
var CachedCredentialStateSchema =
|
|
22040
|
-
|
|
22041
|
-
|
|
22042
|
-
|
|
22076
|
+
var CachedCredentialStateSchema = z30.union([
|
|
22077
|
+
z30.strictObject({ store: z30.enum(CREDENTIAL_CACHE_STORES), status: z30.literal("empty") }),
|
|
22078
|
+
z30.strictObject({ store: z30.enum(CREDENTIAL_CACHE_STORES), status: z30.literal("unreadable"), reason: z30.string() }),
|
|
22079
|
+
z30.strictObject({ store: z30.enum(CREDENTIAL_CACHE_STORES), status: z30.enum(["fresh", "expired"]), ageMs: z30.number(), expiresInMs: z30.number().optional() })
|
|
22043
22080
|
]);
|
|
22044
|
-
var CheckCredentialProviderSchema =
|
|
22045
|
-
|
|
22046
|
-
|
|
22081
|
+
var CheckCredentialProviderSchema = z30.union([
|
|
22082
|
+
z30.strictObject({ name: z30.string(), credential: CredentialSummarySchema.optional(), cached: CachedCredentialStateSchema.optional() }),
|
|
22083
|
+
z30.strictObject({ name: z30.string(), problem: z30.string() })
|
|
22047
22084
|
]);
|
|
22048
|
-
var CheckProviderReachabilitySchema =
|
|
22049
|
-
|
|
22050
|
-
|
|
22085
|
+
var CheckProviderReachabilitySchema = z30.union([
|
|
22086
|
+
z30.strictObject({ name: z30.string(), baseUrl: z30.string(), ok: z30.literal(true) }),
|
|
22087
|
+
z30.strictObject({ name: z30.string(), baseUrl: z30.string(), ok: z30.literal(false), message: z30.string() })
|
|
22051
22088
|
]);
|
|
22052
|
-
var CheckCredentialSchema =
|
|
22053
|
-
applies:
|
|
22089
|
+
var CheckCredentialSchema = z30.strictObject({
|
|
22090
|
+
applies: z30.enum(CHECK_CREDENTIAL_APPLIES),
|
|
22054
22091
|
provider: CheckCredentialProviderSchema.optional(),
|
|
22055
22092
|
identity: CredentialSummarySchema.optional(),
|
|
22056
22093
|
identityCached: CachedCredentialStateSchema.optional()
|
|
22057
22094
|
});
|
|
22058
|
-
var CheckClaudeVersionSchema =
|
|
22059
|
-
pinned:
|
|
22060
|
-
highestInstalled:
|
|
22061
|
-
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()))
|
|
22062
22099
|
});
|
|
22063
|
-
var CheckReportJsonSchema =
|
|
22064
|
-
identity:
|
|
22100
|
+
var CheckReportJsonSchema = z30.strictObject({
|
|
22101
|
+
identity: z30.strictObject({ name: z30.string().nullable(), source: z30.enum(IDENTITY_DECISION_SOURCES) }),
|
|
22065
22102
|
/** The logins other identities lend this one through the front door; absent when none does. */
|
|
22066
|
-
borrowedLogins:
|
|
22103
|
+
borrowedLogins: z30.readonly(z30.array(z30.strictObject({ from: z30.string(), features: z30.readonly(z30.array(z30.enum(GRANT_FEATURES))) }))).optional(),
|
|
22067
22104
|
/** The pool ranking, when the launch named a pool instead of an identity. */
|
|
22068
22105
|
pool: PoolPickReportSchema.optional(),
|
|
22069
|
-
configProfile:
|
|
22070
|
-
layers:
|
|
22071
|
-
entries:
|
|
22072
|
-
projectEncodingAmbiguities:
|
|
22073
|
-
|
|
22106
|
+
configProfile: z30.strictObject({ name: z30.string().nullable(), source: z30.enum(CONFIG_PROFILE_DECISION_SOURCES) }),
|
|
22107
|
+
layers: z30.readonly(z30.array(CheckLayerViewSchema)),
|
|
22108
|
+
entries: z30.readonly(z30.array(CheckEntryViewSchema)),
|
|
22109
|
+
projectEncodingAmbiguities: z30.readonly(
|
|
22110
|
+
z30.array(z30.strictObject({ fragment: z30.string(), encoded: z30.string(), reason: z30.enum(ENCODING_AMBIGUITY_REASONS), detail: z30.string() }))
|
|
22074
22111
|
),
|
|
22075
|
-
diagnostics:
|
|
22112
|
+
diagnostics: z30.readonly(z30.array(CheckDiagnosticSchema)),
|
|
22076
22113
|
ambientCredential: CheckAmbientCredentialSchema,
|
|
22077
22114
|
keychain: CheckKeychainSchema.optional(),
|
|
22078
|
-
settingsExposure:
|
|
22115
|
+
settingsExposure: z30.readonly(z30.array(CheckSettingsExposureSchema)),
|
|
22079
22116
|
credential: CheckCredentialSchema,
|
|
22080
22117
|
claudeVersion: CheckClaudeVersionSchema.optional(),
|
|
22081
22118
|
providerReachability: CheckProviderReachabilitySchema.optional(),
|
|
22082
22119
|
/** The route overrides that apply to a launch here (its identity's, its provider's and the global ones), each with the entries it outranks, or why the file cannot be used. */
|
|
22083
|
-
routeOverrides:
|
|
22084
|
-
|
|
22085
|
-
|
|
22120
|
+
routeOverrides: z30.union([
|
|
22121
|
+
z30.strictObject({ applying: z30.readonly(z30.array(z30.strictObject({ model: z30.string(), target: z30.string(), scope: z30.string(), outranks: z30.readonly(z30.array(z30.strictObject({ scope: z30.string(), target: z30.string() }))) }))) }),
|
|
22122
|
+
z30.strictObject({ fault: z30.string() })
|
|
22086
22123
|
]).optional()
|
|
22087
22124
|
});
|
|
22088
22125
|
|
|
@@ -22092,28 +22129,28 @@ init_preflight();
|
|
|
22092
22129
|
init_resets();
|
|
22093
22130
|
|
|
22094
22131
|
// src/usage/resetsSchema.ts
|
|
22095
|
-
import { z as
|
|
22096
|
-
var ResetRowSchema =
|
|
22097
|
-
identity:
|
|
22098
|
-
provider:
|
|
22132
|
+
import { z as z31 } from "zod";
|
|
22133
|
+
var ResetRowSchema = z31.strictObject({
|
|
22134
|
+
identity: z31.string(),
|
|
22135
|
+
provider: z31.string(),
|
|
22099
22136
|
/** What the window is: `5h`, `7d` or `extra usage` for an Anthropic account, or the provider's own measure and period (`tokens 5h`). */
|
|
22100
|
-
window:
|
|
22137
|
+
window: z31.string(),
|
|
22101
22138
|
/** When the state the window comes from was observed, as an ISO instant. */
|
|
22102
|
-
observedAt:
|
|
22139
|
+
observedAt: z31.iso.datetime(),
|
|
22103
22140
|
/** When the window resets, as an ISO instant; absent when the upstream reported none. */
|
|
22104
|
-
resetsAt:
|
|
22141
|
+
resetsAt: z31.iso.datetime().optional(),
|
|
22105
22142
|
/** True when the reset time has passed, so the recorded observation describes a window that no longer exists and its utilisation reads as 0. */
|
|
22106
|
-
reset:
|
|
22143
|
+
reset: z31.boolean(),
|
|
22107
22144
|
/** The fraction used, as `effectiveWindow` reads it at the report's own clock. */
|
|
22108
|
-
utilization:
|
|
22145
|
+
utilization: z31.number().optional(),
|
|
22109
22146
|
/** The window's own status, for a window that has not reset yet. */
|
|
22110
|
-
status:
|
|
22147
|
+
status: z31.string().optional()
|
|
22111
22148
|
});
|
|
22112
|
-
var ResetScheduleSchema =
|
|
22149
|
+
var ResetScheduleSchema = z31.strictObject({ resets: z31.readonly(z31.array(ResetRowSchema)) });
|
|
22113
22150
|
|
|
22114
22151
|
// src/frontdoor/controlSchemas.ts
|
|
22115
22152
|
import path46 from "node:path";
|
|
22116
|
-
import { z as
|
|
22153
|
+
import { z as z41 } from "zod";
|
|
22117
22154
|
|
|
22118
22155
|
// src/codex/doctor.ts
|
|
22119
22156
|
function codexIdentityFindings(entry, identity) {
|
|
@@ -22425,7 +22462,7 @@ init_projects();
|
|
|
22425
22462
|
init_injected();
|
|
22426
22463
|
init_pipeline();
|
|
22427
22464
|
import path42 from "node:path";
|
|
22428
|
-
import { z as
|
|
22465
|
+
import { z as z34 } from "zod";
|
|
22429
22466
|
var HISTORY_PROJECTS_KEY_PREFIX = "history/projects/";
|
|
22430
22467
|
function projectFragmentOf(rawKey) {
|
|
22431
22468
|
return rawKey.startsWith(HISTORY_PROJECTS_KEY_PREFIX) ? rawKey.slice(HISTORY_PROJECTS_KEY_PREFIX.length) : void 0;
|
|
@@ -22494,9 +22531,9 @@ function lookupKeychainService(run, farmRoot) {
|
|
|
22494
22531
|
}
|
|
22495
22532
|
return { checked: true, found: true, serviceName, note: `Keychain service name for this identity: "${serviceName}".` };
|
|
22496
22533
|
}
|
|
22497
|
-
var SettingsSecretsShapeSchema =
|
|
22498
|
-
env:
|
|
22499
|
-
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()
|
|
22500
22537
|
});
|
|
22501
22538
|
function hookCommandCountOf(group) {
|
|
22502
22539
|
if (typeof group !== "object" || group === null) {
|
|
@@ -24964,93 +25001,93 @@ function collectDoctorReport(params) {
|
|
|
24964
25001
|
init_schema2();
|
|
24965
25002
|
init_rcSchemas();
|
|
24966
25003
|
init_state();
|
|
24967
|
-
var UsageListOutputSchema =
|
|
24968
|
-
var UsageWindowsInputSchema =
|
|
24969
|
-
identity:
|
|
24970
|
-
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()
|
|
24971
25008
|
});
|
|
24972
|
-
var EffectiveWindowSchema =
|
|
25009
|
+
var EffectiveWindowSchema = z41.strictObject({
|
|
24973
25010
|
/** True when the window's reset time has passed, so the recorded observation describes a window that no longer exists. */
|
|
24974
|
-
reset:
|
|
25011
|
+
reset: z41.boolean(),
|
|
24975
25012
|
/** The fraction used: 0 for a reset window, otherwise what was last observed, absent when none was reported. */
|
|
24976
|
-
utilization:
|
|
25013
|
+
utilization: z41.number().optional(),
|
|
24977
25014
|
/** The reset instant, for a window that has not reset yet and reported one. */
|
|
24978
|
-
resetsAtMs:
|
|
25015
|
+
resetsAtMs: z41.number().optional(),
|
|
24979
25016
|
/** The window's own status, for a window that has not reset yet. */
|
|
24980
|
-
status:
|
|
25017
|
+
status: z41.string().optional()
|
|
24981
25018
|
});
|
|
24982
|
-
var UsageWindowsOutputSchema =
|
|
24983
|
-
identity:
|
|
24984
|
-
provider:
|
|
25019
|
+
var UsageWindowsOutputSchema = z41.strictObject({
|
|
25020
|
+
identity: z41.string(),
|
|
25021
|
+
provider: z41.string(),
|
|
24985
25022
|
/** When the rate-limit state the windows come from was observed. */
|
|
24986
|
-
observedAt:
|
|
25023
|
+
observedAt: z41.iso.datetime().optional(),
|
|
24987
25024
|
fiveHour: EffectiveWindowSchema.optional(),
|
|
24988
25025
|
sevenDay: EffectiveWindowSchema.optional()
|
|
24989
25026
|
});
|
|
24990
|
-
var UsageLiveOutputSchema =
|
|
25027
|
+
var UsageLiveOutputSchema = z41.strictObject({
|
|
24991
25028
|
/** The freshest observation the door holds, never narrowed by the read's session filter because it is the door's single latest statement of the account's quota; absent while no rate_limit_event has been filed at all. */
|
|
24992
25029
|
latest: RcLiveRateLimitSchema.optional(),
|
|
24993
25030
|
/** One observation per session whose stream has filed a rate_limit_event this door generation. */
|
|
24994
|
-
sessions:
|
|
25031
|
+
sessions: z41.readonly(z41.array(RcLiveRateLimitSchema))
|
|
24995
25032
|
});
|
|
24996
|
-
var FrontDoorSessionStatusSchema =
|
|
24997
|
-
pid:
|
|
24998
|
-
startedAt:
|
|
24999
|
-
alive:
|
|
25033
|
+
var FrontDoorSessionStatusSchema = z41.strictObject({
|
|
25034
|
+
pid: z41.int().positive(),
|
|
25035
|
+
startedAt: z41.number(),
|
|
25036
|
+
alive: z41.boolean()
|
|
25000
25037
|
});
|
|
25001
|
-
var HeadroomSocketTargetSchema =
|
|
25002
|
-
var FrontDoorStatusOutputSchema =
|
|
25038
|
+
var HeadroomSocketTargetSchema = z41.union([z41.strictObject({ socketPath: z41.string() }), z41.strictObject({ refused: z41.string() })]);
|
|
25039
|
+
var FrontDoorStatusOutputSchema = z41.strictObject({
|
|
25003
25040
|
state: FrontDoorStateSchema,
|
|
25004
|
-
supervisorAlive:
|
|
25041
|
+
supervisorAlive: z41.boolean(),
|
|
25005
25042
|
/** The pids of earlier doors that released their addresses and are finishing the connections they carried: running, but not serving anything new. */
|
|
25006
|
-
draining:
|
|
25007
|
-
sessions:
|
|
25043
|
+
draining: z41.readonly(z41.array(z41.number().int().positive())),
|
|
25044
|
+
sessions: z41.readonly(z41.array(FrontDoorSessionStatusSchema)),
|
|
25008
25045
|
headroomSocket: HeadroomSocketTargetSchema.optional(),
|
|
25009
|
-
logPath:
|
|
25010
|
-
logExists:
|
|
25046
|
+
logPath: z41.string(),
|
|
25047
|
+
logExists: z41.boolean()
|
|
25011
25048
|
});
|
|
25012
|
-
var FrontDoorSessionsOutputSchema =
|
|
25049
|
+
var FrontDoorSessionsOutputSchema = z41.strictObject({ sessions: z41.readonly(z41.array(FrontDoorSessionStatusSchema)) });
|
|
25013
25050
|
var DOOR_REPORT_ENVIRONMENT_NOTE = "The report is collected in a worker thread of the door under the door's own environment and PATH, as a launch the door plans for itself would inherit them, not under the caller's shell: the identity is the caller's to name, the cascade is read from files at the path, and the environment-driven findings (AGENT_SHIM_IDENTITY, AGENT_SHIM_CONFIG_PROFILE, the Claude Code version pin, the ambient-credential check, and for doctor the PATH and shim findings) describe the door's launch. Run agent-shim check or agent-shim doctor from a shell for the caller's own reading.";
|
|
25014
|
-
var CheckRunInputSchema =
|
|
25015
|
-
path:
|
|
25016
|
-
identity:
|
|
25051
|
+
var CheckRunInputSchema = z41.strictObject({
|
|
25052
|
+
path: z41.string().min(1),
|
|
25053
|
+
identity: z41.string().min(1).optional()
|
|
25017
25054
|
}).refine((input) => path46.isAbsolute(input.path), { message: "path must be absolute: the door cannot resolve a relative path against the caller's working directory" });
|
|
25018
|
-
var PoolPickInputSchema =
|
|
25019
|
-
pool:
|
|
25020
|
-
path:
|
|
25055
|
+
var PoolPickInputSchema = z41.strictObject({
|
|
25056
|
+
pool: z41.string().min(1),
|
|
25057
|
+
path: z41.string().min(1)
|
|
25021
25058
|
}).refine((input) => path46.isAbsolute(input.path), { message: "path must be absolute: the door cannot resolve a relative path against the caller's working directory" });
|
|
25022
|
-
var DoctorFindingSchema =
|
|
25023
|
-
section:
|
|
25024
|
-
subject:
|
|
25025
|
-
severity:
|
|
25026
|
-
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()
|
|
25027
25064
|
});
|
|
25028
|
-
var DoctorRunOutputSchema =
|
|
25065
|
+
var DoctorRunOutputSchema = z41.strictObject({
|
|
25029
25066
|
/** False exactly when any finding is a `fail`; a `warn` never fails the report on its own. */
|
|
25030
|
-
ok:
|
|
25031
|
-
findings:
|
|
25032
|
-
});
|
|
25033
|
-
var FrontDoorRestartOutputSchema =
|
|
25034
|
-
action:
|
|
25035
|
-
previousPid:
|
|
25036
|
-
});
|
|
25037
|
-
var UpdateCheckOutputSchema =
|
|
25038
|
-
current:
|
|
25039
|
-
latest:
|
|
25040
|
-
action:
|
|
25041
|
-
});
|
|
25042
|
-
var CodexSignInSchema =
|
|
25043
|
-
|
|
25044
|
-
|
|
25045
|
-
|
|
25067
|
+
ok: z41.boolean(),
|
|
25068
|
+
findings: z41.readonly(z41.array(DoctorFindingSchema))
|
|
25069
|
+
});
|
|
25070
|
+
var FrontDoorRestartOutputSchema = z41.strictObject({
|
|
25071
|
+
action: z41.literal("restarting"),
|
|
25072
|
+
previousPid: z41.int().positive()
|
|
25073
|
+
});
|
|
25074
|
+
var UpdateCheckOutputSchema = z41.strictObject({
|
|
25075
|
+
current: z41.string(),
|
|
25076
|
+
latest: z41.string(),
|
|
25077
|
+
action: z41.enum(["current", "available", "updated"])
|
|
25078
|
+
});
|
|
25079
|
+
var CodexSignInSchema = z41.discriminatedUnion("state", [
|
|
25080
|
+
z41.strictObject({ state: z41.literal("none") }),
|
|
25081
|
+
z41.strictObject({ state: z41.literal("signed-in"), email: z41.string().optional(), planScope: z41.boolean(), accessTokenExpiresAt: z41.number() }),
|
|
25082
|
+
z41.strictObject({ state: z41.literal("unreadable"), message: z41.string() })
|
|
25046
25083
|
]);
|
|
25047
|
-
var CodexStatusOutputSchema =
|
|
25084
|
+
var CodexStatusOutputSchema = z41.strictObject({
|
|
25048
25085
|
signIn: CodexSignInSchema,
|
|
25049
|
-
codexProviders:
|
|
25086
|
+
codexProviders: z41.readonly(z41.array(z41.string()))
|
|
25050
25087
|
});
|
|
25051
|
-
var CodexLogoutOutputSchema =
|
|
25052
|
-
hadGrant:
|
|
25053
|
-
revoked:
|
|
25088
|
+
var CodexLogoutOutputSchema = z41.strictObject({
|
|
25089
|
+
hadGrant: z41.boolean(),
|
|
25090
|
+
revoked: z41.boolean()
|
|
25054
25091
|
});
|
|
25055
25092
|
|
|
25056
25093
|
// src/frontdoor/codexApi.ts
|
|
@@ -25071,21 +25108,21 @@ function createCodexApiRouter(deps) {
|
|
|
25071
25108
|
|
|
25072
25109
|
// src/frontdoor/doorWorker.ts
|
|
25073
25110
|
import { getAsset, isSea as isSea2 } from "node:sea";
|
|
25074
|
-
import { z as
|
|
25111
|
+
import { z as z43 } from "zod";
|
|
25075
25112
|
init_cliError();
|
|
25076
25113
|
init_doorBounds();
|
|
25077
25114
|
init_providerCatalogue();
|
|
25078
25115
|
|
|
25079
25116
|
// src/frontdoor/doorWorkerProtocol.ts
|
|
25080
25117
|
init_providerCatalogue();
|
|
25081
|
-
import { z as
|
|
25118
|
+
import { z as z42 } from "zod";
|
|
25082
25119
|
var doorWorkerInputSchemas = {
|
|
25083
25120
|
/** `agent-shim check` for `path` as `identity` (the identity a launch there would resolve when absent). */
|
|
25084
|
-
check:
|
|
25121
|
+
check: z42.strictObject({ root: z42.string().min(1), path: z42.string().min(1), identity: z42.string().min(1).optional() }),
|
|
25085
25122
|
/** `agent-shim doctor`. */
|
|
25086
|
-
doctor:
|
|
25123
|
+
doctor: z42.strictObject({ root: z42.string().min(1) }),
|
|
25087
25124
|
/** Fetch and store one provider's model catalogue for the door generation that asked. */
|
|
25088
|
-
"refresh-catalogue":
|
|
25125
|
+
"refresh-catalogue": z42.strictObject({ root: z42.string().min(1), name: z42.string().min(1), supervisorPid: z42.int().positive(), generation: z42.uuid() })
|
|
25089
25126
|
};
|
|
25090
25127
|
|
|
25091
25128
|
// src/frontdoor/doorWorker.ts
|
|
@@ -25183,75 +25220,75 @@ init_names();
|
|
|
25183
25220
|
init_keychainLogin();
|
|
25184
25221
|
init_statusline();
|
|
25185
25222
|
init_toolLogins();
|
|
25186
|
-
import { z as
|
|
25187
|
-
var RemovalConfirmationSchema =
|
|
25188
|
-
var CredentialWriteSchema = (targets) =>
|
|
25189
|
-
sources:
|
|
25190
|
-
target:
|
|
25191
|
-
cache:
|
|
25192
|
-
});
|
|
25193
|
-
var CredentialSummarySchema2 =
|
|
25194
|
-
target:
|
|
25195
|
-
sources:
|
|
25196
|
-
|
|
25197
|
-
|
|
25198
|
-
|
|
25199
|
-
|
|
25200
|
-
|
|
25201
|
-
|
|
25202
|
-
|
|
25223
|
+
import { z as z44 } from "zod";
|
|
25224
|
+
var RemovalConfirmationSchema = z44.boolean();
|
|
25225
|
+
var CredentialWriteSchema = (targets) => z44.strictObject({
|
|
25226
|
+
sources: z44.array(RemoteCredentialSourceSchema).min(1).optional(),
|
|
25227
|
+
target: z44.enum(targets).optional(),
|
|
25228
|
+
cache: z44.union([z44.literal(false), CredentialCacheSchema]).optional()
|
|
25229
|
+
});
|
|
25230
|
+
var CredentialSummarySchema2 = z44.strictObject({
|
|
25231
|
+
target: z44.enum(CREDENTIAL_TARGETS),
|
|
25232
|
+
sources: z44.readonly(z44.array(
|
|
25233
|
+
z44.discriminatedUnion("kind", [
|
|
25234
|
+
z44.strictObject({ kind: z44.literal("env"), variable: z44.string() }),
|
|
25235
|
+
z44.strictObject({ kind: z44.literal("file"), path: z44.string() }),
|
|
25236
|
+
z44.strictObject({ kind: z44.literal("command"), program: z44.string() }),
|
|
25237
|
+
z44.strictObject({ kind: z44.literal("op"), reference: z44.string() }),
|
|
25238
|
+
z44.strictObject({ kind: z44.literal("keychain"), service: z44.string(), account: z44.string().optional() }),
|
|
25239
|
+
z44.strictObject({ kind: z44.literal("literal") })
|
|
25203
25240
|
])
|
|
25204
25241
|
)),
|
|
25205
25242
|
cache: CredentialCacheSchema.optional()
|
|
25206
25243
|
});
|
|
25207
|
-
var mutationOutput = (kind, action) =>
|
|
25208
|
-
var storedMutationOutput = (kind, action, value) =>
|
|
25209
|
-
var IdentityValueSchema =
|
|
25210
|
-
agent:
|
|
25211
|
-
name:
|
|
25212
|
-
label:
|
|
25213
|
-
defaultConfigProfile:
|
|
25214
|
-
provider:
|
|
25215
|
-
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(),
|
|
25216
25253
|
credential: CredentialSummarySchema2.optional(),
|
|
25217
|
-
anchors:
|
|
25254
|
+
anchors: z44.array(AnchorSchema).optional(),
|
|
25218
25255
|
/** Read only here: a grant is made and revoked from the command line alone, so a program driving the door cannot widen what it may reach. */
|
|
25219
|
-
grants:
|
|
25256
|
+
grants: z44.array(IdentityGrantSchema).optional(),
|
|
25220
25257
|
toolLogins: ToolLoginsSchema.optional()
|
|
25221
25258
|
});
|
|
25222
25259
|
var ProfileValueSchema = ConfigProfileSchema.omit({ $schema: true });
|
|
25223
|
-
var ProviderValueSchema =
|
|
25224
|
-
name:
|
|
25225
|
-
kind:
|
|
25226
|
-
displayName:
|
|
25227
|
-
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(),
|
|
25228
25265
|
codex: CodexProviderConfigSchema.optional(),
|
|
25229
25266
|
credential: CredentialSummarySchema2.optional(),
|
|
25230
|
-
env:
|
|
25267
|
+
env: z44.record(z44.string(), z44.string()).optional()
|
|
25231
25268
|
});
|
|
25232
|
-
var ConfigNameInputSchema =
|
|
25233
|
-
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) });
|
|
25234
25271
|
var ConfigIdentityAddOutputSchema = storedMutationOutput("identity", "created", IdentityValueSchema);
|
|
25235
|
-
var ConfigIdentitySetInputSchema =
|
|
25236
|
-
name:
|
|
25272
|
+
var ConfigIdentitySetInputSchema = z44.strictObject({
|
|
25273
|
+
name: z44.string().min(1),
|
|
25237
25274
|
/** The identity's display label; `false` clears it. */
|
|
25238
|
-
label:
|
|
25239
|
-
defaultConfigProfile:
|
|
25275
|
+
label: z44.union([IdentityLabelSchema, z44.literal(false)]).optional(),
|
|
25276
|
+
defaultConfigProfile: z44.union([z44.string().min(1), z44.literal(false)]).optional(),
|
|
25240
25277
|
/** The provider the identity exists for; `false` clears it. */
|
|
25241
|
-
provider:
|
|
25242
|
-
allowAmbientCredential:
|
|
25243
|
-
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(),
|
|
25244
25281
|
/** `false` removes the anchors; a list replaces them. */
|
|
25245
|
-
anchors:
|
|
25282
|
+
anchors: z44.union([z44.literal(false), z44.array(AnchorSchema).min(1)]).optional(),
|
|
25246
25283
|
/** Each assignment replaces whatever that surface already named. */
|
|
25247
|
-
toolLogin:
|
|
25284
|
+
toolLogin: z44.array(z44.strictObject({ surface: z44.enum(TOOL_SURFACES), lender: z44.string().min(1) })).optional(),
|
|
25248
25285
|
/** Surfaces to return to the identity's own login. */
|
|
25249
|
-
clearToolLogin:
|
|
25286
|
+
clearToolLogin: z44.array(z44.enum(TOOL_SURFACES)).optional()
|
|
25250
25287
|
});
|
|
25251
25288
|
var ConfigIdentitySetOutputSchema = storedMutationOutput("identity", "updated", IdentityValueSchema);
|
|
25252
|
-
var ConfigIdentityRemoveInputSchema =
|
|
25289
|
+
var ConfigIdentityRemoveInputSchema = z44.strictObject({ name: z44.string().min(1), confirm: RemovalConfirmationSchema });
|
|
25253
25290
|
var ConfigIdentityRemoveOutputSchema = mutationOutput("identity", "removed");
|
|
25254
|
-
var ConfigStatuslineSetSchema =
|
|
25291
|
+
var ConfigStatuslineSetSchema = z44.record(z44.string(), z44.unknown()).superRefine((settings, context) => {
|
|
25255
25292
|
for (const key of Object.keys(settings)) {
|
|
25256
25293
|
if (key === STATUSLINE_EXTRA_GROUP || key.startsWith(`${STATUSLINE_EXTRA_GROUP}.`)) {
|
|
25257
25294
|
context.addIssue({ code: "custom", path: [key], message: `a config write through the API cannot set "${key}": the extra segment's command runs a program, so only your own configuration (the global config, a profile you edit yourself, a directory rule or a command-line assignment) may set it` });
|
|
@@ -25259,102 +25296,102 @@ var ConfigStatuslineSetSchema = z43.record(z43.string(), z43.unknown()).superRef
|
|
|
25259
25296
|
}
|
|
25260
25297
|
});
|
|
25261
25298
|
var ConfigIdentityUseOutputSchema = mutationOutput("identity", "selected");
|
|
25262
|
-
var ConfigProfileAddInputSchema =
|
|
25263
|
-
name:
|
|
25264
|
-
extends:
|
|
25265
|
-
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()
|
|
25266
25303
|
});
|
|
25267
25304
|
var ConfigProfileAddOutputSchema = storedMutationOutput("profile", "created", ProfileValueSchema);
|
|
25268
|
-
var ConfigProfileSetInputSchema =
|
|
25269
|
-
name:
|
|
25270
|
-
category:
|
|
25271
|
-
entry:
|
|
25272
|
-
extends:
|
|
25273
|
-
description:
|
|
25274
|
-
launch:
|
|
25275
|
-
skipPermissions:
|
|
25276
|
-
remoteControl:
|
|
25277
|
-
headroom:
|
|
25278
|
-
trackUsage:
|
|
25279
|
-
provider:
|
|
25280
|
-
claudeVersion:
|
|
25281
|
-
delay:
|
|
25282
|
-
pause:
|
|
25283
|
-
explain:
|
|
25284
|
-
proxyBypass:
|
|
25285
|
-
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({
|
|
25286
25323
|
set: ConfigStatuslineSetSchema.optional(),
|
|
25287
|
-
unset:
|
|
25324
|
+
unset: z44.array(z44.string()).optional()
|
|
25288
25325
|
}).optional()
|
|
25289
25326
|
}).optional()
|
|
25290
25327
|
});
|
|
25291
25328
|
var ConfigProfileSetOutputSchema = storedMutationOutput("profile", "updated", ProfileValueSchema);
|
|
25292
|
-
var ConfigProfileRemoveInputSchema =
|
|
25329
|
+
var ConfigProfileRemoveInputSchema = z44.strictObject({ name: z44.string().min(1), confirm: RemovalConfirmationSchema });
|
|
25293
25330
|
var ConfigProfileRemoveOutputSchema = mutationOutput("profile", "removed");
|
|
25294
25331
|
var ConfigProfileUseOutputSchema = mutationOutput("profile", "selected");
|
|
25295
|
-
var PoolMembersInputSchema =
|
|
25296
|
-
var ConfigPoolAddInputSchema =
|
|
25297
|
-
name:
|
|
25332
|
+
var PoolMembersInputSchema = z44.array(z44.string().min(1)).min(1);
|
|
25333
|
+
var ConfigPoolAddInputSchema = z44.strictObject({
|
|
25334
|
+
name: z44.string().min(1),
|
|
25298
25335
|
identities: PoolMembersInputSchema,
|
|
25299
|
-
preference:
|
|
25300
|
-
resumeOnLimit:
|
|
25301
|
-
compactBeforeLimit:
|
|
25336
|
+
preference: z44.enum(POOL_PREFERENCES).optional(),
|
|
25337
|
+
resumeOnLimit: z44.boolean().optional(),
|
|
25338
|
+
compactBeforeLimit: z44.boolean().optional(),
|
|
25302
25339
|
compactAtUtilisation: CompactAtUtilisationSchema.optional()
|
|
25303
25340
|
});
|
|
25304
25341
|
var ConfigPoolAddOutputSchema = storedMutationOutput("pool", "created", PoolSchema);
|
|
25305
|
-
var ConfigPoolSetInputSchema =
|
|
25306
|
-
name:
|
|
25342
|
+
var ConfigPoolSetInputSchema = z44.strictObject({
|
|
25343
|
+
name: z44.string().min(1),
|
|
25307
25344
|
identities: PoolMembersInputSchema.optional(),
|
|
25308
|
-
preference:
|
|
25309
|
-
resumeOnLimit:
|
|
25310
|
-
compactBeforeLimit:
|
|
25311
|
-
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()
|
|
25312
25349
|
});
|
|
25313
25350
|
var ConfigPoolSetOutputSchema = storedMutationOutput("pool", "updated", PoolSchema);
|
|
25314
|
-
var ConfigPoolRemoveInputSchema =
|
|
25351
|
+
var ConfigPoolRemoveInputSchema = z44.strictObject({ name: z44.string().min(1), confirm: RemovalConfirmationSchema });
|
|
25315
25352
|
var ConfigPoolRemoveOutputSchema = mutationOutput("pool", "removed");
|
|
25316
25353
|
var ConfigPoolUseOutputSchema = mutationOutput("pool", "selected");
|
|
25317
|
-
var ConfigProviderAddInputSchema =
|
|
25318
|
-
name:
|
|
25319
|
-
kind:
|
|
25320
|
-
displayName:
|
|
25321
|
-
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(),
|
|
25322
25359
|
credential: CredentialWriteSchema(PROVIDER_CREDENTIAL_TARGETS).required({ sources: true }),
|
|
25323
25360
|
codex: CodexProviderConfigSchema.optional()
|
|
25324
25361
|
});
|
|
25325
25362
|
var ConfigProviderAddOutputSchema = storedMutationOutput("provider", "created", ProviderValueSchema);
|
|
25326
|
-
var ConfigProviderSetInputSchema =
|
|
25327
|
-
name:
|
|
25328
|
-
displayName:
|
|
25329
|
-
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(),
|
|
25330
25367
|
credential: CredentialWriteSchema(PROVIDER_CREDENTIAL_TARGETS).optional(),
|
|
25331
25368
|
codex: CodexProviderConfigSchema.optional()
|
|
25332
25369
|
});
|
|
25333
25370
|
var ConfigProviderSetOutputSchema = storedMutationOutput("provider", "updated", ProviderValueSchema);
|
|
25334
|
-
var ConfigProviderRemoveInputSchema =
|
|
25371
|
+
var ConfigProviderRemoveInputSchema = z44.strictObject({ name: z44.string().min(1), confirm: RemovalConfirmationSchema });
|
|
25335
25372
|
var ConfigProviderRemoveOutputSchema = mutationOutput("provider", "removed");
|
|
25336
|
-
var ConfigRuleAddInputSchema =
|
|
25337
|
-
path:
|
|
25338
|
-
configProfile:
|
|
25339
|
-
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()
|
|
25340
25377
|
});
|
|
25341
25378
|
var ConfigRuleAddOutputSchema = storedMutationOutput("rule", "created", DirectoryRuleSchema);
|
|
25342
|
-
var ConfigRuleSetInputSchema =
|
|
25343
|
-
path:
|
|
25344
|
-
configProfile:
|
|
25345
|
-
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()
|
|
25346
25383
|
});
|
|
25347
25384
|
var ConfigRuleSetOutputSchema = storedMutationOutput("rule", "updated", DirectoryRuleSchema);
|
|
25348
|
-
var ConfigRuleRemoveInputSchema =
|
|
25385
|
+
var ConfigRuleRemoveInputSchema = z44.strictObject({ path: z44.string().min(1), confirm: RemovalConfirmationSchema });
|
|
25349
25386
|
var ConfigRuleRemoveOutputSchema = mutationOutput("rule", "removed");
|
|
25350
|
-
var RouteScopeInputSchema =
|
|
25351
|
-
|
|
25352
|
-
|
|
25387
|
+
var RouteScopeInputSchema = z44.union([
|
|
25388
|
+
z44.strictObject({ kind: z44.literal("global") }),
|
|
25389
|
+
z44.strictObject({ kind: z44.enum(["session", "identity", "provider"]), name: z44.string().min(1) })
|
|
25353
25390
|
]);
|
|
25354
|
-
var ConfigRouteSetInputSchema =
|
|
25355
|
-
var ConfigRouteSetOutputSchema = storedMutationOutput("route", "updated",
|
|
25356
|
-
var ConfigRouteRemoveInputSchema =
|
|
25357
|
-
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()) });
|
|
25358
25395
|
|
|
25359
25396
|
// src/routeOverrides.ts
|
|
25360
25397
|
init_commandDeps();
|
|
@@ -25750,50 +25787,50 @@ import { eventIterator as eventIterator2, withEventMeta as withEventMeta2 } from
|
|
|
25750
25787
|
|
|
25751
25788
|
// src/frontdoor/eventSchemas.ts
|
|
25752
25789
|
init_schema2();
|
|
25753
|
-
import { z as
|
|
25790
|
+
import { z as z45 } from "zod";
|
|
25754
25791
|
var DOOR_EVENT_SOURCE_RC = "rc";
|
|
25755
25792
|
var LAUNCH_EVENT_SOURCE = "launch";
|
|
25756
25793
|
var USAGE_EVENT_SOURCE = "usage";
|
|
25757
25794
|
var DOOR_HEALTH_EVENT_SOURCE = "door";
|
|
25758
25795
|
var QUOTA_EXPIRING_EVENT_SOURCE = "quota-expiring";
|
|
25759
|
-
var DoorEventSchema =
|
|
25760
|
-
source:
|
|
25796
|
+
var DoorEventSchema = z45.strictObject({
|
|
25797
|
+
source: z45.string().min(1),
|
|
25761
25798
|
/** A positive integer because the backbone's counters start at one and only ever increase. */
|
|
25762
|
-
sequence:
|
|
25763
|
-
payload:
|
|
25764
|
-
});
|
|
25765
|
-
var DoorEventSourceQuerySchema =
|
|
25766
|
-
sources:
|
|
25767
|
-
});
|
|
25768
|
-
var LaunchLifecycleEventSchema =
|
|
25769
|
-
kind:
|
|
25770
|
-
pid:
|
|
25771
|
-
startedAt:
|
|
25772
|
-
observedAt:
|
|
25773
|
-
});
|
|
25774
|
-
var DoorHealthEventSchema =
|
|
25775
|
-
|
|
25776
|
-
|
|
25777
|
-
|
|
25778
|
-
|
|
25779
|
-
|
|
25780
|
-
|
|
25799
|
+
sequence: z45.number().int().positive(),
|
|
25800
|
+
payload: z45.unknown()
|
|
25801
|
+
});
|
|
25802
|
+
var DoorEventSourceQuerySchema = z45.strictObject({
|
|
25803
|
+
sources: z45.array(z45.string().min(1)).min(1).optional()
|
|
25804
|
+
});
|
|
25805
|
+
var LaunchLifecycleEventSchema = z45.strictObject({
|
|
25806
|
+
kind: z45.enum(["registered", "pruned", "ended"]),
|
|
25807
|
+
pid: z45.number().int().positive(),
|
|
25808
|
+
startedAt: z45.number(),
|
|
25809
|
+
observedAt: z45.number()
|
|
25810
|
+
});
|
|
25811
|
+
var DoorHealthEventSchema = z45.discriminatedUnion("kind", [
|
|
25812
|
+
z45.strictObject({ kind: z45.literal("generation"), pid: z45.number().int().positive(), providerPort: z45.number().int().positive(), connectPort: z45.number().int().positive(), directPort: z45.number().int().positive(), observedAt: z45.number() }),
|
|
25813
|
+
z45.strictObject({ kind: z45.literal("listenerFailed"), pid: z45.number().int().positive(), listener: z45.enum(["provider", "connect", "direct"]), message: z45.string(), observedAt: z45.number() }),
|
|
25814
|
+
z45.strictObject({ kind: z45.literal("binaryTurnover"), pid: z45.number().int().positive(), observedAt: z45.number() }),
|
|
25815
|
+
z45.strictObject({ kind: z45.literal("idleShutdown"), pid: z45.number().int().positive(), observedAt: z45.number() }),
|
|
25816
|
+
z45.strictObject({ kind: z45.literal("superseded"), pid: z45.number().int().positive(), ownerPid: z45.number().int().positive(), observedAt: z45.number() }),
|
|
25817
|
+
z45.strictObject({ kind: z45.literal("drained"), pid: z45.number().int().positive(), observedAt: z45.number() })
|
|
25781
25818
|
]);
|
|
25782
|
-
var QuotaExpiringEventSchema =
|
|
25819
|
+
var QuotaExpiringEventSchema = z45.strictObject({
|
|
25783
25820
|
/** The id of the identity whose window it is: what its usage is filed under, which a rename keeps. */
|
|
25784
|
-
id:
|
|
25821
|
+
id: z45.string().min(1),
|
|
25785
25822
|
/** The identity's name when the event was published, absent for an identity no longer stored under the id. */
|
|
25786
|
-
name:
|
|
25787
|
-
provider:
|
|
25788
|
-
window:
|
|
25823
|
+
name: z45.string().min(1).optional(),
|
|
25824
|
+
provider: z45.string().min(1),
|
|
25825
|
+
window: z45.enum(["fiveHour", "sevenDay"]),
|
|
25789
25826
|
/** The fraction of the window already used when it was seen expiring, always below one because a fully used window has nothing left to spend. */
|
|
25790
|
-
utilization:
|
|
25791
|
-
resetsAt:
|
|
25792
|
-
observedAt:
|
|
25827
|
+
utilization: z45.number().min(0).max(1),
|
|
25828
|
+
resetsAt: z45.iso.datetime(),
|
|
25829
|
+
observedAt: z45.number()
|
|
25793
25830
|
});
|
|
25794
25831
|
var UsageChangeEventSchema = UsageSnapshotSchema.extend({
|
|
25795
|
-
id:
|
|
25796
|
-
name:
|
|
25832
|
+
id: z45.string().min(1),
|
|
25833
|
+
name: z45.string().min(1).optional()
|
|
25797
25834
|
});
|
|
25798
25835
|
|
|
25799
25836
|
// src/frontdoor/eventsApi.ts
|
|
@@ -25838,14 +25875,14 @@ function createEventsApiRouter(deps) {
|
|
|
25838
25875
|
init_update();
|
|
25839
25876
|
import { ORPCError as ORPCError4 } from "@orpc/client";
|
|
25840
25877
|
import { openapi as openapi5 } from "@orpc/openapi";
|
|
25841
|
-
import { z as
|
|
25878
|
+
import { z as z46 } from "zod";
|
|
25842
25879
|
var FRONTDOOR_API_TAG = "frontdoor";
|
|
25843
25880
|
var UPDATE_API_TAG = "update";
|
|
25844
25881
|
function createLifecycleApiRouter(deps) {
|
|
25845
25882
|
const authed = doorApiAuth(deps.expectedToken);
|
|
25846
25883
|
return {
|
|
25847
25884
|
frontdoor: {
|
|
25848
|
-
refreshCatalogues: authed.meta(openapi5({ method: "POST", path: "/rest/frontdoor/catalogues/refresh", summary: "Request a catalogue refresh tick", tags: [FRONTDOOR_API_TAG] })).output(
|
|
25885
|
+
refreshCatalogues: authed.meta(openapi5({ method: "POST", path: "/rest/frontdoor/catalogues/refresh", summary: "Request a catalogue refresh tick", tags: [FRONTDOOR_API_TAG] })).output(z46.strictObject({ requested: z46.literal(true) })).handler(() => {
|
|
25849
25886
|
deps.refreshCatalogues();
|
|
25850
25887
|
return { requested: true };
|
|
25851
25888
|
}),
|
|
@@ -25882,64 +25919,64 @@ import { openapi as openapi6 } from "@orpc/openapi";
|
|
|
25882
25919
|
|
|
25883
25920
|
// src/frontdoor/launchSchemas.ts
|
|
25884
25921
|
import path47 from "node:path";
|
|
25885
|
-
import { z as
|
|
25922
|
+
import { z as z47 } from "zod";
|
|
25886
25923
|
init_statusline();
|
|
25887
25924
|
init_claudeVersion();
|
|
25888
25925
|
init_identity2();
|
|
25889
|
-
var LaunchResolveInputSchema =
|
|
25890
|
-
path:
|
|
25926
|
+
var LaunchResolveInputSchema = z47.strictObject({
|
|
25927
|
+
path: z47.string().min(1),
|
|
25891
25928
|
/** `@name`, launch flags, then the arguments for `claude`; empty for a bare launch. */
|
|
25892
|
-
argv:
|
|
25929
|
+
argv: z47.readonly(z47.array(z47.string())).optional(),
|
|
25893
25930
|
/** The launch's inherited environment. Absent means an empty one: the door's own environment is never a substitute for the caller's, so a caller that wants `AGENT_SHIM_*` switches or a `CLAUDE_CONFIG_DIR` considered names them here. Values are read, never reported. */
|
|
25894
|
-
env:
|
|
25931
|
+
env: z47.record(z47.string(), z47.string()).optional()
|
|
25895
25932
|
}).refine((input) => path47.isAbsolute(input.path), { message: "path must be absolute: the door cannot resolve a relative path against the caller's working directory" });
|
|
25896
|
-
var LaunchPoolDecisionSchema =
|
|
25897
|
-
name:
|
|
25898
|
-
reasons:
|
|
25933
|
+
var LaunchPoolDecisionSchema = z47.strictObject({
|
|
25934
|
+
name: z47.string(),
|
|
25935
|
+
reasons: z47.readonly(z47.array(z47.string())),
|
|
25899
25936
|
/** The provider the ranking read for the chosen member, when the launch spends one in place of the member's Claude account. */
|
|
25900
|
-
provider:
|
|
25901
|
-
movedOff:
|
|
25937
|
+
provider: z47.string().optional(),
|
|
25938
|
+
movedOff: z47.strictObject({ identity: z47.string(), reason: z47.string() }).optional()
|
|
25902
25939
|
});
|
|
25903
|
-
var LaunchDecisionSchema =
|
|
25904
|
-
identity:
|
|
25905
|
-
identityId:
|
|
25906
|
-
identitySource:
|
|
25940
|
+
var LaunchDecisionSchema = z47.strictObject({
|
|
25941
|
+
identity: z47.string().optional(),
|
|
25942
|
+
identityId: z47.string().optional(),
|
|
25943
|
+
identitySource: z47.enum(IDENTITY_DECISION_SOURCES),
|
|
25907
25944
|
pool: LaunchPoolDecisionSchema.optional(),
|
|
25908
25945
|
/** True when `CLAUDE_CONFIG_DIR` was already set and nothing on the command line named an identity; an identity named there outranks the variable and leaves it false. */
|
|
25909
|
-
configDirEscapeHatch:
|
|
25910
|
-
configDir:
|
|
25911
|
-
configProfile:
|
|
25912
|
-
configProfileSource:
|
|
25913
|
-
provider:
|
|
25914
|
-
});
|
|
25915
|
-
var LaunchFlagsSchema =
|
|
25916
|
-
skipPermissions:
|
|
25917
|
-
remoteControl:
|
|
25918
|
-
headroom:
|
|
25919
|
-
trackUsage:
|
|
25920
|
-
pause:
|
|
25921
|
-
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(),
|
|
25922
25959
|
/** How long the launch waits after its own output before it starts claude, in milliseconds. */
|
|
25923
|
-
delayMs:
|
|
25960
|
+
delayMs: z47.number(),
|
|
25924
25961
|
/** The hosts the launch keeps off the front door by adding them to the child's `NO_PROXY`. */
|
|
25925
|
-
proxyBypass:
|
|
25962
|
+
proxyBypass: z47.array(z47.string()).readonly(),
|
|
25926
25963
|
/** How the session's built-in statusline looks, when the launch configures any of it. */
|
|
25927
25964
|
statusline: StatuslineSchema.optional()
|
|
25928
25965
|
});
|
|
25929
|
-
var LaunchResolveOutputSchema =
|
|
25966
|
+
var LaunchResolveOutputSchema = z47.strictObject({
|
|
25930
25967
|
decision: LaunchDecisionSchema,
|
|
25931
25968
|
flags: LaunchFlagsSchema,
|
|
25932
|
-
claudeVersion:
|
|
25969
|
+
claudeVersion: z47.strictObject({ version: z47.string(), source: z47.enum(CLAUDE_VERSION_SOURCES) }).optional(),
|
|
25933
25970
|
/** The real `claude` binary the launch would spawn, on the door's host. */
|
|
25934
|
-
bin:
|
|
25971
|
+
bin: z47.string(),
|
|
25935
25972
|
/** The arguments the launch would pass it: the tool's own flags, then `CLAUDE_EXTRA_FLAGS`, then the caller's own. */
|
|
25936
|
-
args:
|
|
25973
|
+
args: z47.readonly(z47.array(z47.string())),
|
|
25937
25974
|
/** The credential the launch would authenticate with, by target and source kinds. Absent when none applies. */
|
|
25938
|
-
credential:
|
|
25939
|
-
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() }),
|
|
25940
25977
|
/** The names of the environment variables the launch would set or unset, sorted. Values are not reported. */
|
|
25941
|
-
environment:
|
|
25942
|
-
warnings:
|
|
25978
|
+
environment: z47.readonly(z47.array(z47.string())),
|
|
25979
|
+
warnings: z47.readonly(z47.array(z47.string()))
|
|
25943
25980
|
});
|
|
25944
25981
|
|
|
25945
25982
|
// src/frontdoor/launchApi.ts
|
|
@@ -25978,21 +26015,21 @@ init_schema3();
|
|
|
25978
26015
|
init_cliError();
|
|
25979
26016
|
import { ORPCError as ORPCError6 } from "@orpc/client";
|
|
25980
26017
|
import { openapi as openapi7 } from "@orpc/openapi";
|
|
25981
|
-
import { z as
|
|
25982
|
-
var AgentTreesListInputSchema =
|
|
26018
|
+
import { z as z48 } from "zod";
|
|
26019
|
+
var AgentTreesListInputSchema = z48.strictObject({
|
|
25983
26020
|
/** Only this identity's sessions. */
|
|
25984
|
-
identity:
|
|
26021
|
+
identity: z48.string().optional(),
|
|
25985
26022
|
/** Include sessions that spawned no agent and ran no workflow. */
|
|
25986
|
-
all:
|
|
26023
|
+
all: z48.boolean().optional()
|
|
25987
26024
|
});
|
|
25988
|
-
var AgentTreesListOutputSchema =
|
|
25989
|
-
var AgentTreesShowInputSchema =
|
|
26025
|
+
var AgentTreesListOutputSchema = z48.array(SessionSummarySchema);
|
|
26026
|
+
var AgentTreesShowInputSchema = z48.strictObject({
|
|
25990
26027
|
/** A session id, or an unambiguous prefix of one. */
|
|
25991
|
-
session:
|
|
26028
|
+
session: z48.string().min(1),
|
|
25992
26029
|
/** Look only in this identity. */
|
|
25993
|
-
identity:
|
|
26030
|
+
identity: z48.string().optional()
|
|
25994
26031
|
});
|
|
25995
|
-
var AgentTreesShowOutputSchema =
|
|
26032
|
+
var AgentTreesShowOutputSchema = z48.strictObject({ identities: z48.array(z48.string()), ...MergedAgentTreeSchema.shape });
|
|
25996
26033
|
function asBadRequest(error) {
|
|
25997
26034
|
if (error instanceof CliError) {
|
|
25998
26035
|
throw new ORPCError6("BAD_REQUEST", { message: error.message });
|
|
@@ -26045,7 +26082,7 @@ import { openapi as openapi8 } from "@orpc/openapi";
|
|
|
26045
26082
|
import { eventIterator as eventIterator3, withEventMeta as withEventMeta3 } from "@orpc/server";
|
|
26046
26083
|
|
|
26047
26084
|
// src/frontdoor/rcEventLog.ts
|
|
26048
|
-
import { z as
|
|
26085
|
+
import { z as z49 } from "zod";
|
|
26049
26086
|
|
|
26050
26087
|
// src/frontdoor/eventHub.ts
|
|
26051
26088
|
var DOOR_EVENT_BUFFER_EVENTS = 100;
|
|
@@ -26170,46 +26207,46 @@ var NUMBER_FIELDS = ["at", "sequence"].length;
|
|
|
26170
26207
|
var BYTES_PER_CODE_UNIT = Uint16Array.BYTES_PER_ELEMENT;
|
|
26171
26208
|
var RC_SESSION_END_REASONS = ["expired", "archived", "conflict"];
|
|
26172
26209
|
var RC_PENDING_RETIRE_REASONS = ["answered", "withdrawn", "worker-stopped", "session-ended"];
|
|
26173
|
-
var transitionBase = { session:
|
|
26174
|
-
var cursorFields = { cursor:
|
|
26175
|
-
var sessionAppearedShape = { kind:
|
|
26176
|
-
var sessionEndedShape = { kind:
|
|
26177
|
-
var workerStateShape = { kind:
|
|
26178
|
-
var pendingBornShape = { kind:
|
|
26179
|
-
var pendingRetiredShape = { kind:
|
|
26180
|
-
var RcSessionTransitionSchema =
|
|
26181
|
-
|
|
26182
|
-
|
|
26183
|
-
|
|
26184
|
-
|
|
26185
|
-
|
|
26210
|
+
var transitionBase = { session: z49.string(), at: z49.number() };
|
|
26211
|
+
var cursorFields = { cursor: z49.string(), sequence: z49.int().positive() };
|
|
26212
|
+
var sessionAppearedShape = { kind: z49.literal("session-appeared"), ...transitionBase };
|
|
26213
|
+
var sessionEndedShape = { kind: z49.literal("session-ended"), reason: z49.enum(RC_SESSION_END_REASONS), ...transitionBase };
|
|
26214
|
+
var workerStateShape = { kind: z49.literal("worker-state"), state: z49.string(), previous: z49.string().optional(), ...transitionBase };
|
|
26215
|
+
var pendingBornShape = { kind: z49.literal("pending-born"), requestId: z49.string(), type: z49.string(), summary: z49.string(), ...transitionBase };
|
|
26216
|
+
var pendingRetiredShape = { kind: z49.literal("pending-retired"), requestId: z49.string(), reason: z49.enum(RC_PENDING_RETIRE_REASONS), ...transitionBase };
|
|
26217
|
+
var RcSessionTransitionSchema = z49.discriminatedUnion("kind", [
|
|
26218
|
+
z49.strictObject(sessionAppearedShape),
|
|
26219
|
+
z49.strictObject(sessionEndedShape),
|
|
26220
|
+
z49.strictObject(workerStateShape),
|
|
26221
|
+
z49.strictObject(pendingBornShape),
|
|
26222
|
+
z49.strictObject(pendingRetiredShape)
|
|
26186
26223
|
]);
|
|
26187
26224
|
var KIND_MAX_CHARS = Math.max(...RcSessionTransitionSchema.options.map((option) => option.shape.kind.value.length));
|
|
26188
26225
|
var RC_SESSION_EVENT_MAX_BYTES = (RC_SESSION_EVENT_GENERATION_MAX_CHARS + ".".length + SEQUENCE_MAX_DIGITS + RC_SESSION_EVENT_TOKEN_MAX_CHARS + KIND_MAX_CHARS + RC_SESSION_EVENT_TOKEN_MAX_CHARS + RC_SESSION_EVENT_TOKEN_MAX_CHARS + RC_SESSION_EVENT_SUMMARY_MAX_CHARS) * BYTES_PER_CODE_UNIT + NUMBER_FIELDS * NUMBER_BYTES;
|
|
26189
26226
|
var RC_SESSION_EVENT_LOG_CAPACITY = Math.floor(CONTROL_BODY_CAP_BYTES / RC_SESSION_EVENT_MAX_BYTES);
|
|
26190
|
-
var RcSessionEventSchema =
|
|
26191
|
-
|
|
26192
|
-
|
|
26193
|
-
|
|
26194
|
-
|
|
26195
|
-
|
|
26227
|
+
var RcSessionEventSchema = z49.discriminatedUnion("kind", [
|
|
26228
|
+
z49.strictObject({ ...cursorFields, ...sessionAppearedShape }),
|
|
26229
|
+
z49.strictObject({ ...cursorFields, ...sessionEndedShape }),
|
|
26230
|
+
z49.strictObject({ ...cursorFields, ...workerStateShape }),
|
|
26231
|
+
z49.strictObject({ ...cursorFields, ...pendingBornShape }),
|
|
26232
|
+
z49.strictObject({ ...cursorFields, ...pendingRetiredShape })
|
|
26196
26233
|
]);
|
|
26197
|
-
var RcSessionEventsReadInputSchema =
|
|
26234
|
+
var RcSessionEventsReadInputSchema = z49.strictObject({
|
|
26198
26235
|
/** The cursor of the last event the caller saw; every retained event when omitted. */
|
|
26199
|
-
since:
|
|
26236
|
+
since: z49.string().min(1).optional(),
|
|
26200
26237
|
/** One `cse_` session id; every session when omitted. */
|
|
26201
|
-
session:
|
|
26238
|
+
session: z49.string().min(1).optional(),
|
|
26202
26239
|
/** The most events one answer carries; every event after `since` when omitted. */
|
|
26203
|
-
limit:
|
|
26240
|
+
limit: z49.int().positive().optional()
|
|
26204
26241
|
});
|
|
26205
26242
|
var RcSessionEventsPageInputSchema = RcSessionEventsReadInputSchema.extend({
|
|
26206
26243
|
/** The most events this page carries: by default and at most, the bound the door's event backbone already holds per slow consumer (`DOOR_EVENT_BUFFER_EVENTS`, oRPC's own documented default for that case). A page lands whole in its reader, so a reader receives at most one consumer buffer's worth at a time (at worst `DOOR_EVENT_BUFFER_EVENTS` times `RC_SESSION_EVENT_MAX_BYTES`) and pages on with the cursor for more; a maximum of the whole window would let one page carry the log's entire memory budget into an agent's context. */
|
|
26207
|
-
limit:
|
|
26244
|
+
limit: z49.int().positive().max(DOOR_EVENT_BUFFER_EVENTS).default(DOOR_EVENT_BUFFER_EVENTS)
|
|
26208
26245
|
});
|
|
26209
26246
|
var RcSessionEventsStreamInputSchema = RcSessionEventsReadInputSchema.omit({ limit: true });
|
|
26210
|
-
var RcSessionEventsReadOutputSchema =
|
|
26211
|
-
|
|
26212
|
-
|
|
26247
|
+
var RcSessionEventsReadOutputSchema = z49.discriminatedUnion("status", [
|
|
26248
|
+
z49.strictObject({ status: z49.literal("ok"), events: z49.readonly(z49.array(RcSessionEventSchema)), cursor: z49.string(), more: z49.boolean(), head: z49.string() }),
|
|
26249
|
+
z49.strictObject({ status: z49.literal("expired"), message: z49.string(), head: z49.string() })
|
|
26213
26250
|
]);
|
|
26214
26251
|
var CURSOR_SEPARATOR = ".";
|
|
26215
26252
|
var RESYNC_ADVICE = "cursor expired, resync from status: read `rc status` for every session's present state, then resume after the head this answer names";
|
|
@@ -28422,7 +28459,7 @@ init_liveTasks();
|
|
|
28422
28459
|
// src/agents/read.ts
|
|
28423
28460
|
init_schema3();
|
|
28424
28461
|
import path49 from "node:path";
|
|
28425
|
-
import { z as
|
|
28462
|
+
import { z as z50 } from "zod";
|
|
28426
28463
|
var PROJECTS_DIR = "projects";
|
|
28427
28464
|
var TASKS_DIR = "tasks";
|
|
28428
28465
|
var SUBAGENTS_DIR = "subagents";
|
|
@@ -28541,14 +28578,14 @@ function parseJson2(text) {
|
|
|
28541
28578
|
return void 0;
|
|
28542
28579
|
}
|
|
28543
28580
|
}
|
|
28544
|
-
var TaskFileSchema =
|
|
28545
|
-
var WorkflowRunFileSchema =
|
|
28546
|
-
runId:
|
|
28547
|
-
workflowName:
|
|
28548
|
-
status:
|
|
28549
|
-
startTime:
|
|
28550
|
-
phases:
|
|
28551
|
-
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()
|
|
28552
28589
|
});
|
|
28553
28590
|
function summariseSession(fs17, configDir, ref) {
|
|
28554
28591
|
const sessionRelative = path49.join(PROJECTS_DIR, ref.project, ref.entry);
|