@agentknight/client 0.9.47 → 0.9.49
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/LICENSE +201 -201
- package/README.md +341 -305
- package/dist/chunks/chunk-KYTI7A5R.js +735 -0
- package/dist/chunks/chunk-NHA7HI6P.js +32 -0
- package/dist/chunks/chunk-OZKXJ6L4.js +2684 -0
- package/dist/chunks/chunk-SPZWIFFP.js +52 -0
- package/dist/chunks/chunk-WZIU4HVH.js +318 -0
- package/dist/chunks/chunk-YNKNHR5K.js +74 -0
- package/dist/chunks/client-home-LAKFDPXO.js +268 -0
- package/dist/chunks/local-sessions-EZUANCR4.js +29 -0
- package/dist/chunks/runtime-CTACRJCK.js +20 -0
- package/dist/chunks/start-client-C3PK6POG.js +3428 -0
- package/dist/chunks/upgrade-T32WY4HC.js +181 -0
- package/dist/chunks/upgrade-state-QXZT3TTS.js +17 -0
- package/dist/cli.js +83 -7196
- package/dist/upgrade-worker.js +2 -2
- package/package.json +5 -4
|
@@ -0,0 +1,2684 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// ../../shared/protocol/dist/conversation/timeline.js
|
|
4
|
+
import { z as z5 } from "zod";
|
|
5
|
+
|
|
6
|
+
// ../../shared/protocol/dist/common/primitives.js
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
var IdSchema = z.string().trim().min(1).max(256);
|
|
9
|
+
var IsoDateSchema = z.iso.datetime({ offset: true });
|
|
10
|
+
var Base64UrlKeyIdSchema = z.string().regex(/^[A-Za-z0-9_-]{22}$/u, "Expected a 16-byte base64url key ID");
|
|
11
|
+
var UsernameSchema = z.string().trim().min(1).max(120);
|
|
12
|
+
|
|
13
|
+
// ../../shared/protocol/dist/common/errors.js
|
|
14
|
+
import { z as z2 } from "zod";
|
|
15
|
+
var ProtocolFailureSchema = z2.object({
|
|
16
|
+
code: IdSchema,
|
|
17
|
+
message: z2.string().min(1).max(1024)
|
|
18
|
+
});
|
|
19
|
+
var OperationAckSchema = z2.discriminatedUnion("ok", [
|
|
20
|
+
z2.object({ ok: z2.literal(true), capabilities: z2.array(IdSchema).max(64).optional() }),
|
|
21
|
+
z2.object({
|
|
22
|
+
ok: z2.literal(false),
|
|
23
|
+
code: IdSchema,
|
|
24
|
+
message: z2.string().min(1).max(1024)
|
|
25
|
+
})
|
|
26
|
+
]);
|
|
27
|
+
var ProtocolErrorSchema = z2.object({
|
|
28
|
+
event: z2.string().min(1).max(128),
|
|
29
|
+
code: IdSchema,
|
|
30
|
+
message: z2.string().min(1).max(1024)
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
// ../../shared/protocol/dist/conversation/conversation.js
|
|
34
|
+
import { z as z4 } from "zod";
|
|
35
|
+
|
|
36
|
+
// ../../shared/protocol/dist/conversation/attachments.js
|
|
37
|
+
import { z as z3 } from "zod";
|
|
38
|
+
var MAX_INLINE_IMAGE_BYTES = 3 * 1024 * 1024;
|
|
39
|
+
var MAX_INLINE_HTML_BYTES = 512 * 1024;
|
|
40
|
+
var MAX_PROMPT_FILE_BYTES = 1024 * 1024;
|
|
41
|
+
var InlineImageMimeTypeSchema = z3.enum([
|
|
42
|
+
"image/gif",
|
|
43
|
+
"image/jpeg",
|
|
44
|
+
"image/png",
|
|
45
|
+
"image/webp"
|
|
46
|
+
]);
|
|
47
|
+
var Base64DataSchema = z3.string().min(4).max(Math.ceil(MAX_INLINE_IMAGE_BYTES / 3) * 4).regex(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/, "Expected canonical base64 data");
|
|
48
|
+
var Sha256Schema = z3.string().regex(/^[a-f0-9]{64}$/);
|
|
49
|
+
function decodedBase64ByteLength(value) {
|
|
50
|
+
const padding = value.endsWith("==") ? 2 : value.endsWith("=") ? 1 : 0;
|
|
51
|
+
return value.length / 4 * 3 - padding;
|
|
52
|
+
}
|
|
53
|
+
var PromptImageAttachmentSchema = z3.object({
|
|
54
|
+
name: z3.string().trim().min(1).max(255),
|
|
55
|
+
mimeType: z3.enum(["image/jpeg", "image/png", "image/webp"]),
|
|
56
|
+
data: Base64DataSchema,
|
|
57
|
+
byteLength: z3.number().int().positive().max(MAX_INLINE_IMAGE_BYTES),
|
|
58
|
+
sha256: Sha256Schema
|
|
59
|
+
}).strict().superRefine((attachment, context) => {
|
|
60
|
+
if (decodedBase64ByteLength(attachment.data) !== attachment.byteLength) {
|
|
61
|
+
context.addIssue({
|
|
62
|
+
code: "custom",
|
|
63
|
+
path: ["byteLength"],
|
|
64
|
+
message: "byteLength does not match the base64 payload"
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
var PromptFileAttachmentSchema = z3.object({
|
|
69
|
+
name: z3.string().trim().min(1).max(255).regex(/^[^\\/\x00-\x1f\x7f]+$/).refine((name) => name !== "." && name !== "..", "Expected a filename"),
|
|
70
|
+
mimeType: z3.string().max(256).regex(/^[a-zA-Z0-9!#$&^_.+-]+\/[a-zA-Z0-9!#$&^_.+-]+$/),
|
|
71
|
+
data: Base64DataSchema.max(Math.ceil(MAX_PROMPT_FILE_BYTES / 3) * 4),
|
|
72
|
+
byteLength: z3.number().int().positive().max(MAX_PROMPT_FILE_BYTES),
|
|
73
|
+
sha256: Sha256Schema
|
|
74
|
+
}).strict().superRefine((attachment, context) => {
|
|
75
|
+
if (decodedBase64ByteLength(attachment.data) !== attachment.byteLength) {
|
|
76
|
+
context.addIssue({
|
|
77
|
+
code: "custom",
|
|
78
|
+
path: ["byteLength"],
|
|
79
|
+
message: "byteLength does not match the base64 payload"
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
var ConversationAttachmentSchema = z3.object({
|
|
84
|
+
kind: z3.enum([
|
|
85
|
+
"file",
|
|
86
|
+
"image",
|
|
87
|
+
"html",
|
|
88
|
+
"selection",
|
|
89
|
+
"github-reference",
|
|
90
|
+
"unknown"
|
|
91
|
+
]),
|
|
92
|
+
name: z3.string().trim().min(1).max(1024),
|
|
93
|
+
mimeType: z3.string().trim().min(1).max(256).optional(),
|
|
94
|
+
uri: z3.string().trim().min(1).max(32768).optional(),
|
|
95
|
+
data: Base64DataSchema.optional(),
|
|
96
|
+
byteLength: z3.number().int().positive().max(MAX_INLINE_IMAGE_BYTES).optional(),
|
|
97
|
+
sha256: Sha256Schema.optional(),
|
|
98
|
+
imageRef: z3.literal("sha256").optional()
|
|
99
|
+
}).strict().superRefine((attachment, context) => {
|
|
100
|
+
if (attachment.imageRef !== void 0) {
|
|
101
|
+
if (attachment.kind !== "image" || attachment.data !== void 0 || attachment.sha256 === void 0 || attachment.byteLength === void 0 || !InlineImageMimeTypeSchema.safeParse(attachment.mimeType).success) {
|
|
102
|
+
context.addIssue({
|
|
103
|
+
code: "custom",
|
|
104
|
+
message: "Image references require image metadata and must not carry inline data"
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
const contentFields = [
|
|
110
|
+
attachment.data,
|
|
111
|
+
attachment.byteLength,
|
|
112
|
+
attachment.sha256
|
|
113
|
+
];
|
|
114
|
+
const contentFieldCount = contentFields.filter((field) => field !== void 0).length;
|
|
115
|
+
if (contentFieldCount !== 0 && contentFieldCount !== contentFields.length) {
|
|
116
|
+
context.addIssue({
|
|
117
|
+
code: "custom",
|
|
118
|
+
message: "Inline attachment content requires data, byteLength, and sha256"
|
|
119
|
+
});
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
if (attachment.data === void 0 || attachment.byteLength === void 0) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
if (attachment.kind !== "image" && attachment.kind !== "html") {
|
|
126
|
+
context.addIssue({
|
|
127
|
+
code: "custom",
|
|
128
|
+
path: ["data"],
|
|
129
|
+
message: "Only image and html attachments may carry inline content"
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
if (attachment.kind === "image" && !InlineImageMimeTypeSchema.safeParse(attachment.mimeType).success) {
|
|
133
|
+
context.addIssue({
|
|
134
|
+
code: "custom",
|
|
135
|
+
path: ["mimeType"],
|
|
136
|
+
message: "Inline images must be GIF, JPEG, PNG, or WebP"
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
if (attachment.kind === "html" && (attachment.mimeType !== "text/html" || attachment.byteLength > MAX_INLINE_HTML_BYTES)) {
|
|
140
|
+
context.addIssue({
|
|
141
|
+
code: "custom",
|
|
142
|
+
path: ["mimeType"],
|
|
143
|
+
message: "HTML content must be text/html and at most 512 KiB"
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
if (decodedBase64ByteLength(attachment.data) !== attachment.byteLength) {
|
|
147
|
+
context.addIssue({
|
|
148
|
+
code: "custom",
|
|
149
|
+
path: ["byteLength"],
|
|
150
|
+
message: "byteLength does not match the base64 payload"
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
// ../../shared/protocol/dist/conversation/conversation.js
|
|
156
|
+
var CONVERSATION_ACTIVITY_STEP_LIMIT = 1e3;
|
|
157
|
+
var CONVERSATION_SOURCE_ID_LIMIT = 1e3;
|
|
158
|
+
var ConversationItemBaseShape = {
|
|
159
|
+
id: IdSchema,
|
|
160
|
+
revision: z4.number().int().positive(),
|
|
161
|
+
turnId: IdSchema,
|
|
162
|
+
timestamp: IsoDateSchema,
|
|
163
|
+
sourceEventIds: z4.array(IdSchema).min(1).max(CONVERSATION_SOURCE_ID_LIMIT),
|
|
164
|
+
sourceMessageIds: z4.array(IdSchema).min(1).max(CONVERSATION_SOURCE_ID_LIMIT).optional(),
|
|
165
|
+
sourceInteractionIds: z4.array(IdSchema).min(1).max(CONVERSATION_SOURCE_ID_LIMIT).optional()
|
|
166
|
+
};
|
|
167
|
+
var MAX_INLINE_IMAGE_MESSAGE_BYTES = 3 * 1024 * 1024;
|
|
168
|
+
var MAX_INLINE_IMAGES_PER_MESSAGE = 4;
|
|
169
|
+
var ActivityStepTimeShape = {
|
|
170
|
+
// First observed event time; completion updates must not move an existing call.
|
|
171
|
+
timestamp: IsoDateSchema.optional()
|
|
172
|
+
};
|
|
173
|
+
var ConversationToolStepSchema = z4.object({
|
|
174
|
+
id: IdSchema,
|
|
175
|
+
kind: z4.literal("tool"),
|
|
176
|
+
name: z4.string().trim().min(1).max(256),
|
|
177
|
+
status: z4.enum(["running", "completed", "failed"]),
|
|
178
|
+
...ActivityStepTimeShape
|
|
179
|
+
}).strict();
|
|
180
|
+
var ConversationSkillStepSchema = z4.object({
|
|
181
|
+
id: IdSchema,
|
|
182
|
+
kind: z4.literal("skill"),
|
|
183
|
+
name: z4.string().trim().min(1).max(256),
|
|
184
|
+
status: z4.literal("completed"),
|
|
185
|
+
description: z4.string().trim().min(1).max(2048).optional(),
|
|
186
|
+
source: z4.string().trim().min(1).max(256).optional(),
|
|
187
|
+
...ActivityStepTimeShape
|
|
188
|
+
}).strict();
|
|
189
|
+
var ConversationSubagentStepSchema = z4.object({
|
|
190
|
+
id: IdSchema,
|
|
191
|
+
kind: z4.literal("subagent"),
|
|
192
|
+
name: z4.string().trim().min(1).max(256),
|
|
193
|
+
status: z4.enum(["running", "completed", "failed"]),
|
|
194
|
+
description: z4.string().trim().min(1).max(2048).optional(),
|
|
195
|
+
model: z4.string().trim().min(1).max(256).optional(),
|
|
196
|
+
durationMs: z4.number().int().nonnegative().optional(),
|
|
197
|
+
resultSummary: z4.string().max(4096).optional(),
|
|
198
|
+
error: z4.string().max(4096).optional(),
|
|
199
|
+
...ActivityStepTimeShape
|
|
200
|
+
}).strict();
|
|
201
|
+
var ConversationPermissionStepSchema = z4.object({
|
|
202
|
+
id: IdSchema,
|
|
203
|
+
kind: z4.literal("permission"),
|
|
204
|
+
name: z4.string().trim().min(1).max(256),
|
|
205
|
+
status: z4.enum(["running", "completed", "failed"]),
|
|
206
|
+
description: z4.string().trim().min(1).max(2048).optional(),
|
|
207
|
+
resultSummary: z4.string().max(4096).optional(),
|
|
208
|
+
error: z4.string().max(4096).optional(),
|
|
209
|
+
...ActivityStepTimeShape
|
|
210
|
+
}).strict();
|
|
211
|
+
var ConversationActivityStepSchema = z4.discriminatedUnion("kind", [
|
|
212
|
+
ConversationToolStepSchema,
|
|
213
|
+
ConversationSkillStepSchema,
|
|
214
|
+
ConversationSubagentStepSchema,
|
|
215
|
+
ConversationPermissionStepSchema
|
|
216
|
+
]);
|
|
217
|
+
var ConversationHumanMessageSchema = z4.object({
|
|
218
|
+
...ConversationItemBaseShape,
|
|
219
|
+
kind: z4.literal("human-message"),
|
|
220
|
+
actor: z4.literal("human"),
|
|
221
|
+
content: z4.string().max(1e5),
|
|
222
|
+
attachments: z4.array(ConversationAttachmentSchema).max(100),
|
|
223
|
+
operationId: IdSchema.optional()
|
|
224
|
+
}).strict();
|
|
225
|
+
var ConversationAssistantMessageSchema = z4.object({
|
|
226
|
+
...ConversationItemBaseShape,
|
|
227
|
+
kind: z4.literal("assistant-message"),
|
|
228
|
+
actor: z4.enum(["assistant", "subagent"]),
|
|
229
|
+
content: z4.string().max(5e5),
|
|
230
|
+
attachments: z4.array(ConversationAttachmentSchema).max(100).optional(),
|
|
231
|
+
model: z4.string().trim().min(1).max(256).optional(),
|
|
232
|
+
agentId: IdSchema.optional(),
|
|
233
|
+
final: z4.boolean()
|
|
234
|
+
}).strict().superRefine((message, context) => {
|
|
235
|
+
const inlineImages = message.attachments?.filter((attachment) => attachment.kind === "image" && attachment.data !== void 0) ?? [];
|
|
236
|
+
if (inlineImages.length > MAX_INLINE_IMAGES_PER_MESSAGE) {
|
|
237
|
+
context.addIssue({
|
|
238
|
+
code: "custom",
|
|
239
|
+
path: ["attachments"],
|
|
240
|
+
message: "Assistant messages may contain at most 4 inline images"
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
const inlineImageBytes = inlineImages.reduce((total, attachment) => total + (attachment.byteLength ?? 0), 0);
|
|
244
|
+
if (inlineImageBytes > MAX_INLINE_IMAGE_MESSAGE_BYTES) {
|
|
245
|
+
context.addIssue({
|
|
246
|
+
code: "custom",
|
|
247
|
+
path: ["attachments"],
|
|
248
|
+
message: "Assistant message images exceed the 3 MiB total limit"
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
var ConversationActivityGroupSchema = z4.object({
|
|
253
|
+
...ConversationItemBaseShape,
|
|
254
|
+
kind: z4.literal("activity-group"),
|
|
255
|
+
actor: z4.enum(["assistant", "subagent"]),
|
|
256
|
+
status: z4.enum(["running", "completed", "failed"]),
|
|
257
|
+
steps: z4.array(ConversationActivityStepSchema).max(CONVERSATION_ACTIVITY_STEP_LIMIT)
|
|
258
|
+
}).strict();
|
|
259
|
+
var ConversationNoticeSchema = z4.object({
|
|
260
|
+
...ConversationItemBaseShape,
|
|
261
|
+
kind: z4.literal("notice"),
|
|
262
|
+
actor: z4.enum(["system", "assistant", "subagent"]),
|
|
263
|
+
severity: z4.enum(["info", "success", "warning", "error"]),
|
|
264
|
+
title: z4.string().trim().min(1).max(256),
|
|
265
|
+
content: z4.string().max(4096),
|
|
266
|
+
presentation: z4.literal("compact").optional()
|
|
267
|
+
}).strict();
|
|
268
|
+
var ConversationPlanTodoSchema = z4.object({
|
|
269
|
+
id: IdSchema,
|
|
270
|
+
title: z4.string().trim().min(1).max(1024),
|
|
271
|
+
description: z4.string().max(4096).optional(),
|
|
272
|
+
status: z4.string().trim().min(1).max(64),
|
|
273
|
+
dependsOn: z4.array(IdSchema).max(100)
|
|
274
|
+
}).strict();
|
|
275
|
+
var ConversationPlanUpdateSchema = z4.object({
|
|
276
|
+
...ConversationItemBaseShape,
|
|
277
|
+
kind: z4.literal("plan-update"),
|
|
278
|
+
actor: z4.enum(["assistant", "subagent"]),
|
|
279
|
+
operation: z4.enum(["created", "updated", "deleted"]),
|
|
280
|
+
content: z4.string().max(1e5),
|
|
281
|
+
todos: z4.array(ConversationPlanTodoSchema).max(1e3)
|
|
282
|
+
}).strict();
|
|
283
|
+
var ConversationItemSchema = z4.discriminatedUnion("kind", [
|
|
284
|
+
ConversationHumanMessageSchema,
|
|
285
|
+
ConversationAssistantMessageSchema,
|
|
286
|
+
ConversationActivityGroupSchema,
|
|
287
|
+
ConversationNoticeSchema,
|
|
288
|
+
ConversationPlanUpdateSchema
|
|
289
|
+
]);
|
|
290
|
+
var ConversationItemUpsertSchema = z4.object({
|
|
291
|
+
userId: IdSchema,
|
|
292
|
+
machineId: IdSchema,
|
|
293
|
+
sessionId: IdSchema,
|
|
294
|
+
item: ConversationItemSchema
|
|
295
|
+
});
|
|
296
|
+
var ConversationActivityStepUpsertSchema = z4.object({
|
|
297
|
+
userId: IdSchema,
|
|
298
|
+
machineId: IdSchema,
|
|
299
|
+
sessionId: IdSchema,
|
|
300
|
+
activityId: IdSchema,
|
|
301
|
+
revision: z4.number().int().positive(),
|
|
302
|
+
turnId: IdSchema,
|
|
303
|
+
timestamp: IsoDateSchema,
|
|
304
|
+
actor: z4.enum(["assistant", "subagent"]),
|
|
305
|
+
status: z4.enum(["running", "completed", "failed"]),
|
|
306
|
+
sourceEventId: IdSchema,
|
|
307
|
+
step: ConversationActivityStepSchema
|
|
308
|
+
}).strict();
|
|
309
|
+
|
|
310
|
+
// ../../shared/protocol/dist/conversation/timeline.js
|
|
311
|
+
var SessionUserPreviewSchema = z5.object({
|
|
312
|
+
id: IdSchema,
|
|
313
|
+
revision: z5.number().int().positive(),
|
|
314
|
+
timestamp: IsoDateSchema,
|
|
315
|
+
text: z5.string().max(4096)
|
|
316
|
+
});
|
|
317
|
+
var SessionAssistantPreviewSchema = z5.object({
|
|
318
|
+
id: IdSchema,
|
|
319
|
+
revision: z5.number().int().positive(),
|
|
320
|
+
timestamp: IsoDateSchema,
|
|
321
|
+
sourceEventIds: z5.array(IdSchema).min(1).max(1e3),
|
|
322
|
+
text: z5.string().max(4096),
|
|
323
|
+
final: z5.boolean(),
|
|
324
|
+
attachments: z5.array(ConversationAttachmentSchema.refine((attachment) => attachment.kind === "image" && attachment.imageRef === "sha256", "Assistant previews contain image references only")).max(4),
|
|
325
|
+
kind: z5.enum(["assistant-message", "task-completion"]).optional()
|
|
326
|
+
});
|
|
327
|
+
var SESSION_TIMELINE_PAGE_SIZE = 100;
|
|
328
|
+
var SessionTimelinePageRequestSchema = z5.object({
|
|
329
|
+
requestId: IdSchema,
|
|
330
|
+
machineId: IdSchema,
|
|
331
|
+
sessionId: IdSchema,
|
|
332
|
+
cursor: z5.string().max(32768).optional(),
|
|
333
|
+
metadataOnly: z5.boolean().optional(),
|
|
334
|
+
acceptContentEncodings: z5.array(z5.string().min(1).max(32)).max(8).optional(),
|
|
335
|
+
imageReferences: z5.boolean().optional(),
|
|
336
|
+
pageSize: z5.number().int().min(1).max(SESSION_TIMELINE_PAGE_SIZE).default(SESSION_TIMELINE_PAGE_SIZE),
|
|
337
|
+
assistantPreview: z5.boolean().optional()
|
|
338
|
+
});
|
|
339
|
+
var SessionWatchRequestSchema = z5.object({
|
|
340
|
+
requestId: IdSchema,
|
|
341
|
+
machineId: IdSchema,
|
|
342
|
+
sessionId: IdSchema,
|
|
343
|
+
watching: z5.boolean()
|
|
344
|
+
}).strict();
|
|
345
|
+
var SessionWatchResultSchema = z5.discriminatedUnion("ok", [
|
|
346
|
+
z5.object({
|
|
347
|
+
ok: z5.literal(true),
|
|
348
|
+
requestId: IdSchema,
|
|
349
|
+
machineId: IdSchema,
|
|
350
|
+
sessionId: IdSchema,
|
|
351
|
+
watching: z5.boolean()
|
|
352
|
+
}).strict(),
|
|
353
|
+
z5.object({
|
|
354
|
+
ok: z5.literal(false),
|
|
355
|
+
requestId: IdSchema,
|
|
356
|
+
machineId: IdSchema,
|
|
357
|
+
sessionId: IdSchema,
|
|
358
|
+
watching: z5.boolean(),
|
|
359
|
+
error: ProtocolFailureSchema
|
|
360
|
+
}).strict()
|
|
361
|
+
]);
|
|
362
|
+
var SessionTimelinePageSchema = z5.object({
|
|
363
|
+
items: z5.array(ConversationItemSchema).max(SESSION_TIMELINE_PAGE_SIZE),
|
|
364
|
+
cursor: z5.string().max(32768),
|
|
365
|
+
hasMore: z5.boolean(),
|
|
366
|
+
cursorStatus: z5.enum(["ok", "expired"]),
|
|
367
|
+
assistantPreview: SessionAssistantPreviewSchema.optional(),
|
|
368
|
+
userPreview: SessionUserPreviewSchema.optional(),
|
|
369
|
+
previewsComplete: z5.boolean().optional()
|
|
370
|
+
});
|
|
371
|
+
var SessionTimelinePageResultSchema = z5.discriminatedUnion("ok", [
|
|
372
|
+
z5.object({
|
|
373
|
+
ok: z5.literal(true),
|
|
374
|
+
requestId: IdSchema,
|
|
375
|
+
machineId: IdSchema,
|
|
376
|
+
sessionId: IdSchema,
|
|
377
|
+
page: SessionTimelinePageSchema
|
|
378
|
+
}),
|
|
379
|
+
z5.object({
|
|
380
|
+
ok: z5.literal(false),
|
|
381
|
+
requestId: IdSchema,
|
|
382
|
+
machineId: IdSchema,
|
|
383
|
+
sessionId: IdSchema,
|
|
384
|
+
error: ProtocolFailureSchema
|
|
385
|
+
})
|
|
386
|
+
]);
|
|
387
|
+
var SessionTimelineInvalidatedSchema = z5.object({
|
|
388
|
+
userId: IdSchema,
|
|
389
|
+
machineId: IdSchema,
|
|
390
|
+
sessionId: IdSchema,
|
|
391
|
+
reason: z5.enum(["clear", "rewind"]),
|
|
392
|
+
sourceEventId: IdSchema,
|
|
393
|
+
timestamp: IsoDateSchema
|
|
394
|
+
}).strict();
|
|
395
|
+
|
|
396
|
+
// ../../shared/protocol/dist/common/version.js
|
|
397
|
+
import { z as z6 } from "zod";
|
|
398
|
+
var LEGACY_PROTOCOL_VERSION = 10;
|
|
399
|
+
var PROTOCOL_VERSION = 11;
|
|
400
|
+
var OLDEST_SUPPORTED_PROTOCOL_VERSION = 9;
|
|
401
|
+
var SupportedProtocolVersionSchema = z6.union([
|
|
402
|
+
z6.literal(OLDEST_SUPPORTED_PROTOCOL_VERSION),
|
|
403
|
+
z6.literal(LEGACY_PROTOCOL_VERSION),
|
|
404
|
+
z6.literal(PROTOCOL_VERSION)
|
|
405
|
+
]);
|
|
406
|
+
var TRANSPORT_V2 = 2;
|
|
407
|
+
|
|
408
|
+
// ../../shared/protocol/dist/auth/authentication.js
|
|
409
|
+
import { z as z7 } from "zod";
|
|
410
|
+
var UserRoleSchema = z7.enum(["admin", "user"]);
|
|
411
|
+
var PasswordSchema = z7.string().min(1).max(4096);
|
|
412
|
+
var PcTokenLabelSchema = z7.string().trim().min(1).max(120);
|
|
413
|
+
var AuthUserSchema = z7.object({
|
|
414
|
+
userId: IdSchema,
|
|
415
|
+
username: UsernameSchema,
|
|
416
|
+
role: UserRoleSchema
|
|
417
|
+
}).strict();
|
|
418
|
+
var LoginRequestSchema = z7.object({
|
|
419
|
+
username: UsernameSchema,
|
|
420
|
+
password: PasswordSchema
|
|
421
|
+
});
|
|
422
|
+
var LoginResultSchema = z7.discriminatedUnion("ok", [
|
|
423
|
+
z7.object({
|
|
424
|
+
ok: z7.literal(true),
|
|
425
|
+
accessToken: z7.string().min(32),
|
|
426
|
+
expiresAt: z7.number().int().positive(),
|
|
427
|
+
user: AuthUserSchema
|
|
428
|
+
}),
|
|
429
|
+
z7.object({
|
|
430
|
+
ok: z7.literal(false),
|
|
431
|
+
error: ProtocolFailureSchema
|
|
432
|
+
})
|
|
433
|
+
]);
|
|
434
|
+
var MobileLoginRequestSchema = z7.object({
|
|
435
|
+
mobileCredential: z7.string().min(64).max(4096),
|
|
436
|
+
clientId: IdSchema
|
|
437
|
+
});
|
|
438
|
+
var PcAccountRequestSchema = z7.object({
|
|
439
|
+
userId: IdSchema,
|
|
440
|
+
machineId: IdSchema
|
|
441
|
+
}).strict();
|
|
442
|
+
var PcAccountResultSchema = z7.discriminatedUnion("ok", [
|
|
443
|
+
z7.object({
|
|
444
|
+
ok: z7.literal(true),
|
|
445
|
+
user: AuthUserSchema,
|
|
446
|
+
method: z7.enum(["microsoft", "token"])
|
|
447
|
+
}).strict(),
|
|
448
|
+
z7.object({
|
|
449
|
+
ok: z7.literal(false),
|
|
450
|
+
error: ProtocolFailureSchema
|
|
451
|
+
}).strict()
|
|
452
|
+
]);
|
|
453
|
+
var AdminUserSummarySchema = z7.object({
|
|
454
|
+
userId: IdSchema,
|
|
455
|
+
username: UsernameSchema,
|
|
456
|
+
role: UserRoleSchema,
|
|
457
|
+
createdAt: z7.number().int().nonnegative(),
|
|
458
|
+
updatedAt: z7.number().int().nonnegative(),
|
|
459
|
+
disabledAt: z7.number().int().nonnegative().nullable()
|
|
460
|
+
}).strict();
|
|
461
|
+
var AdminFailureResultSchema = z7.object({
|
|
462
|
+
ok: z7.literal(false),
|
|
463
|
+
error: ProtocolFailureSchema
|
|
464
|
+
}).strict();
|
|
465
|
+
var AdminUserListResultSchema = z7.discriminatedUnion("ok", [
|
|
466
|
+
z7.object({
|
|
467
|
+
ok: z7.literal(true),
|
|
468
|
+
users: z7.array(AdminUserSummarySchema)
|
|
469
|
+
}).strict(),
|
|
470
|
+
AdminFailureResultSchema
|
|
471
|
+
]);
|
|
472
|
+
var AdminUserCreateRequestSchema = z7.object({
|
|
473
|
+
username: UsernameSchema,
|
|
474
|
+
password: PasswordSchema
|
|
475
|
+
}).strict();
|
|
476
|
+
var AdminUserCreateResultSchema = z7.discriminatedUnion("ok", [
|
|
477
|
+
z7.object({
|
|
478
|
+
ok: z7.literal(true),
|
|
479
|
+
user: AdminUserSummarySchema
|
|
480
|
+
}).strict(),
|
|
481
|
+
AdminFailureResultSchema
|
|
482
|
+
]);
|
|
483
|
+
var AdminUserStatusRequestSchema = z7.object({
|
|
484
|
+
userId: IdSchema,
|
|
485
|
+
disabled: z7.boolean()
|
|
486
|
+
}).strict();
|
|
487
|
+
var AdminUserStatusResultSchema = z7.discriminatedUnion("ok", [
|
|
488
|
+
z7.object({
|
|
489
|
+
ok: z7.literal(true),
|
|
490
|
+
user: AdminUserSummarySchema
|
|
491
|
+
}).strict(),
|
|
492
|
+
AdminFailureResultSchema
|
|
493
|
+
]);
|
|
494
|
+
var AdminUserPasswordRequestSchema = z7.object({
|
|
495
|
+
userId: IdSchema,
|
|
496
|
+
password: PasswordSchema
|
|
497
|
+
}).strict();
|
|
498
|
+
var AdminUserPasswordResultSchema = z7.discriminatedUnion("ok", [
|
|
499
|
+
z7.object({
|
|
500
|
+
ok: z7.literal(true),
|
|
501
|
+
user: AdminUserSummarySchema
|
|
502
|
+
}).strict(),
|
|
503
|
+
AdminFailureResultSchema
|
|
504
|
+
]);
|
|
505
|
+
var PcServiceTokenSummarySchema = z7.object({
|
|
506
|
+
tokenId: IdSchema,
|
|
507
|
+
userId: IdSchema,
|
|
508
|
+
label: PcTokenLabelSchema,
|
|
509
|
+
createdAt: z7.number().int().nonnegative(),
|
|
510
|
+
lastUsedAt: z7.number().int().nonnegative().nullable(),
|
|
511
|
+
revokedAt: z7.number().int().nonnegative().nullable()
|
|
512
|
+
}).strict();
|
|
513
|
+
var AdminPcTokenListRequestSchema = z7.object({
|
|
514
|
+
userId: IdSchema
|
|
515
|
+
}).strict();
|
|
516
|
+
var AdminPcTokenListResultSchema = z7.discriminatedUnion("ok", [
|
|
517
|
+
z7.object({
|
|
518
|
+
ok: z7.literal(true),
|
|
519
|
+
tokens: z7.array(PcServiceTokenSummarySchema)
|
|
520
|
+
}).strict(),
|
|
521
|
+
AdminFailureResultSchema
|
|
522
|
+
]);
|
|
523
|
+
var AdminPcTokenIssueRequestSchema = z7.object({
|
|
524
|
+
userId: IdSchema,
|
|
525
|
+
label: PcTokenLabelSchema
|
|
526
|
+
}).strict();
|
|
527
|
+
var AdminPcTokenIssueResultSchema = z7.discriminatedUnion("ok", [
|
|
528
|
+
z7.object({
|
|
529
|
+
ok: z7.literal(true),
|
|
530
|
+
token: z7.string().min(32).max(256),
|
|
531
|
+
pcToken: PcServiceTokenSummarySchema
|
|
532
|
+
}).strict(),
|
|
533
|
+
AdminFailureResultSchema
|
|
534
|
+
]);
|
|
535
|
+
var AdminPcTokenRevokeRequestSchema = z7.object({
|
|
536
|
+
tokenId: IdSchema
|
|
537
|
+
}).strict();
|
|
538
|
+
var AdminPcTokenRevokeResultSchema = z7.discriminatedUnion("ok", [
|
|
539
|
+
z7.object({
|
|
540
|
+
ok: z7.literal(true),
|
|
541
|
+
pcToken: PcServiceTokenSummarySchema
|
|
542
|
+
}).strict(),
|
|
543
|
+
AdminFailureResultSchema
|
|
544
|
+
]);
|
|
545
|
+
|
|
546
|
+
// ../../shared/protocol/dist/auth/pairing.js
|
|
547
|
+
import { z as z8 } from "zod";
|
|
548
|
+
var MOBILE_TRANSFER_MAX_PARTS = 64;
|
|
549
|
+
var MOBILE_TRANSFER_PART_DATA_MAX_LENGTH = 2600;
|
|
550
|
+
var MOBILE_TRANSFER_RELAY_TTL_MS = 10 * 60 * 1e3;
|
|
551
|
+
var MOBILE_TRANSFER_RELAY_MAX_CIPHERTEXT_LENGTH = 128 * 1024;
|
|
552
|
+
var PairingCreateRequestSchema = z8.object({
|
|
553
|
+
userId: IdSchema,
|
|
554
|
+
machineId: IdSchema,
|
|
555
|
+
stableDeviceId: IdSchema.optional(),
|
|
556
|
+
machineName: z8.string().trim().min(1).max(120),
|
|
557
|
+
keyId: Base64UrlKeyIdSchema.optional()
|
|
558
|
+
});
|
|
559
|
+
var PairingCreateResultSchema = z8.discriminatedUnion("ok", [
|
|
560
|
+
z8.object({
|
|
561
|
+
ok: z8.literal(true),
|
|
562
|
+
code: z8.string().min(32).max(256),
|
|
563
|
+
expiresAt: z8.number().int().positive(),
|
|
564
|
+
// Presence advertises the PC-only status endpoint; older Relays omit it.
|
|
565
|
+
statusId: z8.string().regex(/^[A-Za-z0-9_-]{43}$/u).optional()
|
|
566
|
+
}),
|
|
567
|
+
z8.object({
|
|
568
|
+
ok: z8.literal(false),
|
|
569
|
+
error: ProtocolFailureSchema
|
|
570
|
+
})
|
|
571
|
+
]);
|
|
572
|
+
var PairingStatusRequestSchema = z8.object({
|
|
573
|
+
userId: IdSchema,
|
|
574
|
+
machineId: IdSchema,
|
|
575
|
+
statusId: z8.string().regex(/^[A-Za-z0-9_-]{43}$/u)
|
|
576
|
+
});
|
|
577
|
+
var PairingStatusSchema = z8.enum(["pending", "paired", "unavailable"]);
|
|
578
|
+
var PairingStatusResultSchema = z8.discriminatedUnion("ok", [
|
|
579
|
+
z8.object({ ok: z8.literal(true), state: PairingStatusSchema }),
|
|
580
|
+
z8.object({ ok: z8.literal(false), error: ProtocolFailureSchema })
|
|
581
|
+
]);
|
|
582
|
+
var PairingExchangeRequestSchema = z8.object({
|
|
583
|
+
code: z8.string().min(32).max(256),
|
|
584
|
+
clientId: IdSchema
|
|
585
|
+
});
|
|
586
|
+
var PairingExchangeResultSchema = z8.discriminatedUnion("ok", [
|
|
587
|
+
z8.object({
|
|
588
|
+
ok: z8.literal(true),
|
|
589
|
+
accessToken: z8.string().min(32),
|
|
590
|
+
expiresAt: z8.number().int().positive(),
|
|
591
|
+
mobileCredential: z8.string().min(64).max(4096),
|
|
592
|
+
mobileCredentialExpiresAt: z8.number().int().positive(),
|
|
593
|
+
stableDeviceId: IdSchema.optional(),
|
|
594
|
+
user: AuthUserSchema
|
|
595
|
+
}),
|
|
596
|
+
z8.object({
|
|
597
|
+
ok: z8.literal(false),
|
|
598
|
+
error: ProtocolFailureSchema
|
|
599
|
+
})
|
|
600
|
+
]);
|
|
601
|
+
var MobileTransferMachineSchema = z8.object({
|
|
602
|
+
machineId: IdSchema,
|
|
603
|
+
mobileCredential: z8.string().min(64).max(4096),
|
|
604
|
+
contentKey: z8.string().regex(/^[A-Za-z0-9_-]{43}$/u, "Expected a 32-byte base64url key"),
|
|
605
|
+
relayUrl: z8.url().max(2048).optional(),
|
|
606
|
+
relayUsername: UsernameSchema.optional(),
|
|
607
|
+
stableDeviceId: IdSchema.optional(),
|
|
608
|
+
pairedAt: z8.number().int().nonnegative().optional(),
|
|
609
|
+
lastSeenAt: z8.number().int().nonnegative().optional(),
|
|
610
|
+
sleeping: z8.boolean().optional(),
|
|
611
|
+
selected: z8.boolean().optional()
|
|
612
|
+
}).strict();
|
|
613
|
+
var MobileTransferPayloadSchema = z8.object({
|
|
614
|
+
relayUrl: z8.url().max(2048),
|
|
615
|
+
username: UsernameSchema,
|
|
616
|
+
machines: z8.array(MobileTransferMachineSchema).min(1).max(32)
|
|
617
|
+
}).strict().superRefine((payload, context) => {
|
|
618
|
+
const normalizeEndpoint = (value) => value.trim().replace(/\/+$/u, "").replace(/^(https?):\/\/(\[[^\]]+\]|[^:/?#]+)(?::([0-9]+))?(?=\/|$)/iu, (_match, scheme, host, rawPort) => {
|
|
619
|
+
const protocol = scheme.toLowerCase();
|
|
620
|
+
const port = rawPort === void 0 ? void 0 : Number(rawPort);
|
|
621
|
+
const isDefaultPort = protocol === "http" && port === 80 || protocol === "https" && port === 443;
|
|
622
|
+
const authorityPort = port === void 0 || isDefaultPort ? "" : `:${port}`;
|
|
623
|
+
return `${protocol}://${host.toLowerCase()}${authorityPort}`;
|
|
624
|
+
});
|
|
625
|
+
const defaultEndpoint = normalizeEndpoint(payload.relayUrl);
|
|
626
|
+
const identities = /* @__PURE__ */ new Set();
|
|
627
|
+
const devices = /* @__PURE__ */ new Map();
|
|
628
|
+
payload.machines.forEach((machine, index) => {
|
|
629
|
+
const endpoint = normalizeEndpoint(machine.relayUrl ?? payload.relayUrl);
|
|
630
|
+
const account = machine.relayUsername ?? (endpoint === defaultEndpoint ? payload.username : null);
|
|
631
|
+
const identity2 = JSON.stringify([machine.machineId, endpoint, account]);
|
|
632
|
+
if (identities.has(identity2)) {
|
|
633
|
+
context.addIssue({
|
|
634
|
+
code: "custom",
|
|
635
|
+
message: "Transfer contains duplicate PC authorizations",
|
|
636
|
+
path: ["machines", index]
|
|
637
|
+
});
|
|
638
|
+
}
|
|
639
|
+
identities.add(identity2);
|
|
640
|
+
const deviceId = machine.stableDeviceId ?? machine.machineId;
|
|
641
|
+
const connections = devices.get(deviceId) ?? [];
|
|
642
|
+
connections.push(machine);
|
|
643
|
+
devices.set(deviceId, connections);
|
|
644
|
+
});
|
|
645
|
+
for (const connections of devices.values()) {
|
|
646
|
+
if (connections.some((machine) => machine.selected !== void 0) && connections.filter((machine) => machine.selected !== false).length > 1) {
|
|
647
|
+
context.addIssue({
|
|
648
|
+
code: "custom",
|
|
649
|
+
message: "Transfer selects multiple connections for one PC",
|
|
650
|
+
path: ["machines"]
|
|
651
|
+
});
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
});
|
|
655
|
+
var MobileTransferPartSchema = z8.object({
|
|
656
|
+
transferId: z8.string().regex(/^[A-Za-z0-9_-]{43}$/u, "Expected a SHA-256 base64url digest"),
|
|
657
|
+
part: z8.number().int().min(1).max(MOBILE_TRANSFER_MAX_PARTS),
|
|
658
|
+
total: z8.number().int().min(2).max(MOBILE_TRANSFER_MAX_PARTS),
|
|
659
|
+
data: z8.string().min(1).max(MOBILE_TRANSFER_PART_DATA_MAX_LENGTH).regex(/^[A-Za-z0-9_-]+$/u, "Expected base64url data")
|
|
660
|
+
}).strict().refine(({ part, total }) => part <= total, {
|
|
661
|
+
message: "Part number must not exceed total parts",
|
|
662
|
+
path: ["part"]
|
|
663
|
+
});
|
|
664
|
+
var MobileTransferUploadRequestSchema = z8.object({
|
|
665
|
+
ciphertext: z8.string().min(1).max(MOBILE_TRANSFER_RELAY_MAX_CIPHERTEXT_LENGTH).regex(/^[A-Za-z0-9_-]+$/u, "Expected base64url ciphertext")
|
|
666
|
+
}).strict();
|
|
667
|
+
var MobileTransferUploadResultSchema = z8.object({
|
|
668
|
+
token: z8.string().regex(/^[A-Za-z0-9_-]{43}$/u, "Expected a 32-byte base64url token"),
|
|
669
|
+
expiresAt: z8.number().int().positive()
|
|
670
|
+
}).strict();
|
|
671
|
+
var MobileTransferDownloadResultSchema = z8.object({
|
|
672
|
+
ciphertext: z8.string().min(1).max(MOBILE_TRANSFER_RELAY_MAX_CIPHERTEXT_LENGTH).regex(/^[A-Za-z0-9_-]+$/u, "Expected base64url ciphertext")
|
|
673
|
+
}).strict();
|
|
674
|
+
|
|
675
|
+
// ../../shared/protocol/dist/auth/microsoft-enrollment.js
|
|
676
|
+
import { z as z9 } from "zod";
|
|
677
|
+
var MicrosoftIdentityReferenceSchema = z9.object({
|
|
678
|
+
issuer: z9.literal("https://login.microsoftonline.com/9188040d-6c67-4c5b-b112-36a304b66dad/v2.0"),
|
|
679
|
+
clientId: z9.uuid(),
|
|
680
|
+
subject: z9.string().min(1).max(255).regex(/^[\x21-\x7e]+$/)
|
|
681
|
+
}).strict();
|
|
682
|
+
var PcEnrollmentIdSchema = z9.uuid();
|
|
683
|
+
var PcEnrollmentStateSchema = z9.enum([
|
|
684
|
+
"pending",
|
|
685
|
+
"approved",
|
|
686
|
+
"issued",
|
|
687
|
+
"confirmed",
|
|
688
|
+
"cancelled",
|
|
689
|
+
"expired"
|
|
690
|
+
]);
|
|
691
|
+
var PcEnrollmentStartRequestSchema = z9.object({
|
|
692
|
+
machineId: z9.string().min(1).max(128).regex(/^[A-Za-z0-9._:-]+$/),
|
|
693
|
+
deviceName: z9.string().trim().min(1).max(120).regex(/^[^\x00-\x1f\x7f]+$/),
|
|
694
|
+
codeChallenge: z9.string().regex(/^[A-Za-z0-9_-]{42}[AEIMQUYcgkosw048]$/)
|
|
695
|
+
}).strict();
|
|
696
|
+
var PcEnrollmentVerifierRequestSchema = z9.object({
|
|
697
|
+
verifier: z9.string().regex(/^[A-Za-z0-9._~-]{43,128}$/)
|
|
698
|
+
}).strict();
|
|
699
|
+
var MicrosoftCsrfRequestSchema = z9.object({
|
|
700
|
+
csrfToken: z9.string().min(1).max(256)
|
|
701
|
+
}).strict();
|
|
702
|
+
var PcEnrollmentApproveRequestSchema = MicrosoftCsrfRequestSchema.extend({
|
|
703
|
+
confirmationCode: z9.string().regex(/^[A-F0-9]{8}$/),
|
|
704
|
+
localCredentials: z9.object({
|
|
705
|
+
username: z9.string().trim().min(1).max(120),
|
|
706
|
+
password: z9.string().min(1).max(4096)
|
|
707
|
+
}).strict().optional()
|
|
708
|
+
}).strict();
|
|
709
|
+
var MicrosoftEnrollmentFailureSchema = z9.object({
|
|
710
|
+
ok: z9.literal(false),
|
|
711
|
+
error: z9.object({
|
|
712
|
+
code: z9.string().min(1).max(128),
|
|
713
|
+
message: z9.string().min(1).max(1024)
|
|
714
|
+
}).strict()
|
|
715
|
+
}).strict();
|
|
716
|
+
var MicrosoftMutationResultSchema = z9.discriminatedUnion("ok", [
|
|
717
|
+
z9.object({ ok: z9.literal(true) }).strict(),
|
|
718
|
+
MicrosoftEnrollmentFailureSchema
|
|
719
|
+
]);
|
|
720
|
+
var PcEnrollmentStartResultSchema = z9.discriminatedUnion("ok", [
|
|
721
|
+
z9.object({
|
|
722
|
+
ok: z9.literal(true),
|
|
723
|
+
enrollmentId: PcEnrollmentIdSchema,
|
|
724
|
+
confirmationCode: z9.string().regex(/^[A-F0-9]{8}$/),
|
|
725
|
+
verificationUri: z9.url(),
|
|
726
|
+
expiresAt: z9.number().int().positive(),
|
|
727
|
+
intervalSeconds: z9.number().int().positive()
|
|
728
|
+
}).strict(),
|
|
729
|
+
MicrosoftEnrollmentFailureSchema
|
|
730
|
+
]);
|
|
731
|
+
var PcEnrollmentStatusResultSchema = z9.discriminatedUnion("ok", [
|
|
732
|
+
z9.object({
|
|
733
|
+
ok: z9.literal(true),
|
|
734
|
+
state: PcEnrollmentStateSchema,
|
|
735
|
+
expiresAt: z9.number().int().positive()
|
|
736
|
+
}).strict(),
|
|
737
|
+
MicrosoftEnrollmentFailureSchema
|
|
738
|
+
]);
|
|
739
|
+
var PcEnrollmentExchangeResultSchema = z9.discriminatedUnion("ok", [
|
|
740
|
+
z9.object({
|
|
741
|
+
ok: z9.literal(true),
|
|
742
|
+
token: z9.string().min(32).max(4096),
|
|
743
|
+
tokenId: z9.string().min(1).max(256),
|
|
744
|
+
grantId: z9.uuid(),
|
|
745
|
+
machineId: PcEnrollmentStartRequestSchema.shape.machineId,
|
|
746
|
+
user: AuthUserSchema,
|
|
747
|
+
confirmBy: z9.number().int().positive()
|
|
748
|
+
}).strict(),
|
|
749
|
+
MicrosoftEnrollmentFailureSchema
|
|
750
|
+
]);
|
|
751
|
+
var PcBrowserRedirectUriSchema = z9.string().regex(/^http:\/\/127\.0\.0\.1:(?:[1-9]\d{0,3}|[1-5]\d{4}|6[0-4]\d{3}|65[0-4]\d{2}|655[0-2]\d|6553[0-5])\/relay-login\/callback$/);
|
|
752
|
+
var PcBrowserStateSchema = PcEnrollmentStartRequestSchema.shape.codeChallenge;
|
|
753
|
+
var PcBrowserAuthorizationCodeSchema = PcEnrollmentStartRequestSchema.shape.codeChallenge;
|
|
754
|
+
var PcBrowserAuthorizationStartRequestSchema = PcEnrollmentStartRequestSchema.extend({
|
|
755
|
+
redirectUri: PcBrowserRedirectUriSchema,
|
|
756
|
+
state: PcBrowserStateSchema
|
|
757
|
+
}).strict();
|
|
758
|
+
var PcBrowserAuthorizationStartResultSchema = z9.discriminatedUnion("ok", [
|
|
759
|
+
z9.object({
|
|
760
|
+
ok: z9.literal(true),
|
|
761
|
+
enrollmentId: PcEnrollmentIdSchema,
|
|
762
|
+
verificationUri: z9.url(),
|
|
763
|
+
expiresAt: z9.number().int().positive()
|
|
764
|
+
}).strict(),
|
|
765
|
+
MicrosoftEnrollmentFailureSchema
|
|
766
|
+
]);
|
|
767
|
+
var PcBrowserAuthorizationExchangeRequestSchema = PcEnrollmentVerifierRequestSchema.extend({
|
|
768
|
+
code: PcBrowserAuthorizationCodeSchema,
|
|
769
|
+
redirectUri: PcBrowserRedirectUriSchema
|
|
770
|
+
}).strict();
|
|
771
|
+
var PcBrowserAuthorizationCallbackSchema = z9.union([
|
|
772
|
+
z9.object({ state: PcBrowserStateSchema, code: PcBrowserAuthorizationCodeSchema }).strict(),
|
|
773
|
+
z9.object({
|
|
774
|
+
state: PcBrowserStateSchema,
|
|
775
|
+
error: z9.enum(["access_denied", "expired", "cancelled"])
|
|
776
|
+
}).strict()
|
|
777
|
+
]);
|
|
778
|
+
var MicrosoftDeviceSchema = z9.object({
|
|
779
|
+
grantId: z9.uuid(),
|
|
780
|
+
tokenId: z9.string().min(1).max(256),
|
|
781
|
+
machineId: PcEnrollmentStartRequestSchema.shape.machineId,
|
|
782
|
+
deviceName: PcEnrollmentStartRequestSchema.shape.deviceName,
|
|
783
|
+
createdAt: z9.number().int().nonnegative(),
|
|
784
|
+
revokedAt: z9.number().int().nonnegative().nullable()
|
|
785
|
+
}).strict();
|
|
786
|
+
var MicrosoftDevicesResultSchema = z9.discriminatedUnion("ok", [
|
|
787
|
+
z9.object({
|
|
788
|
+
ok: z9.literal(true),
|
|
789
|
+
identity: MicrosoftIdentityReferenceSchema,
|
|
790
|
+
devices: z9.array(MicrosoftDeviceSchema)
|
|
791
|
+
}).strict(),
|
|
792
|
+
MicrosoftEnrollmentFailureSchema
|
|
793
|
+
]);
|
|
794
|
+
var MicrosoftIdentitySummarySchema = MicrosoftIdentityReferenceSchema.extend({
|
|
795
|
+
identityId: z9.uuid(),
|
|
796
|
+
userId: z9.string().min(1).max(256).nullable(),
|
|
797
|
+
allowed: z9.boolean(),
|
|
798
|
+
decidedBy: z9.string().min(1).max(256),
|
|
799
|
+
decidedAt: z9.number().int().nonnegative(),
|
|
800
|
+
createdAt: z9.number().int().nonnegative(),
|
|
801
|
+
lastLoginAt: z9.number().int().nonnegative().nullable()
|
|
802
|
+
}).strict();
|
|
803
|
+
var MicrosoftIdentityAllowRequestSchema = z9.object({
|
|
804
|
+
identity: MicrosoftIdentityReferenceSchema,
|
|
805
|
+
allowed: z9.boolean()
|
|
806
|
+
}).strict();
|
|
807
|
+
var MicrosoftIdentityAllowResultSchema = z9.discriminatedUnion("ok", [
|
|
808
|
+
z9.object({ ok: z9.literal(true), identity: MicrosoftIdentitySummarySchema }).strict(),
|
|
809
|
+
MicrosoftEnrollmentFailureSchema
|
|
810
|
+
]);
|
|
811
|
+
var MicrosoftIdentitiesResultSchema = z9.discriminatedUnion("ok", [
|
|
812
|
+
z9.object({ ok: z9.literal(true), identities: z9.array(MicrosoftIdentitySummarySchema) }).strict(),
|
|
813
|
+
MicrosoftEnrollmentFailureSchema
|
|
814
|
+
]);
|
|
815
|
+
var MicrosoftInvitationEmailSchema = z9.email().max(254).regex(/^[\x21-\x7e]+$/);
|
|
816
|
+
var MicrosoftInvitationCodeSchema = z9.string().length(24).regex(/^[A-F0-9]{24}$/);
|
|
817
|
+
var MicrosoftInvitationCreateRequestSchema = z9.object({
|
|
818
|
+
email: MicrosoftInvitationEmailSchema
|
|
819
|
+
}).strict();
|
|
820
|
+
var MicrosoftInvitationCreateResultSchema = z9.discriminatedUnion("ok", [
|
|
821
|
+
z9.object({
|
|
822
|
+
ok: z9.literal(true),
|
|
823
|
+
invitationId: z9.uuid(),
|
|
824
|
+
email: MicrosoftInvitationEmailSchema,
|
|
825
|
+
code: MicrosoftInvitationCodeSchema,
|
|
826
|
+
expiresAt: z9.number().int().nonnegative(),
|
|
827
|
+
invitationUri: z9.url()
|
|
828
|
+
}).strict(),
|
|
829
|
+
MicrosoftEnrollmentFailureSchema
|
|
830
|
+
]);
|
|
831
|
+
var MicrosoftInvitationAcceptRequestSchema = MicrosoftCsrfRequestSchema.extend({
|
|
832
|
+
code: MicrosoftInvitationCodeSchema
|
|
833
|
+
}).strict();
|
|
834
|
+
|
|
835
|
+
// ../../shared/protocol/dist/transport/event-names.js
|
|
836
|
+
import { z as z10 } from "zod";
|
|
837
|
+
var PcSecureEventNameSchema = z10.enum([
|
|
838
|
+
"session.communication",
|
|
839
|
+
"session.list.result",
|
|
840
|
+
"session.options.result",
|
|
841
|
+
"session.create.result",
|
|
842
|
+
"session.delete.result",
|
|
843
|
+
"session.configure.result",
|
|
844
|
+
"session.remote.result",
|
|
845
|
+
"session.timeline.page.result",
|
|
846
|
+
"session.watch.result",
|
|
847
|
+
"session.prompt.result",
|
|
848
|
+
"session.activity",
|
|
849
|
+
"session.abort.result",
|
|
850
|
+
"conversation.item.upsert",
|
|
851
|
+
"conversation.activity.step.upsert",
|
|
852
|
+
"session.timeline.invalidated",
|
|
853
|
+
"interaction.request",
|
|
854
|
+
"interaction.respond.result",
|
|
855
|
+
"permission.request",
|
|
856
|
+
"permission.respond.result",
|
|
857
|
+
"sessions.snapshot"
|
|
858
|
+
]);
|
|
859
|
+
var MobileSecureEventNameSchema = z10.enum([
|
|
860
|
+
"session.communication",
|
|
861
|
+
"session.list",
|
|
862
|
+
"session.options",
|
|
863
|
+
"session.create",
|
|
864
|
+
"session.delete",
|
|
865
|
+
"session.configure",
|
|
866
|
+
"session.remote",
|
|
867
|
+
"session.timeline.page",
|
|
868
|
+
"session.watch",
|
|
869
|
+
"session.prompt",
|
|
870
|
+
"session.abort",
|
|
871
|
+
"interaction.respond",
|
|
872
|
+
"permission.respond"
|
|
873
|
+
]);
|
|
874
|
+
var SecureEventNameSchema = z10.enum([
|
|
875
|
+
"session.communication",
|
|
876
|
+
"session.list.result",
|
|
877
|
+
"session.options.result",
|
|
878
|
+
"session.create.result",
|
|
879
|
+
"session.delete.result",
|
|
880
|
+
"session.configure.result",
|
|
881
|
+
"session.remote.result",
|
|
882
|
+
"session.timeline.page.result",
|
|
883
|
+
"session.watch.result",
|
|
884
|
+
"session.prompt.result",
|
|
885
|
+
"session.activity",
|
|
886
|
+
"session.abort.result",
|
|
887
|
+
"conversation.item.upsert",
|
|
888
|
+
"conversation.activity.step.upsert",
|
|
889
|
+
"session.timeline.invalidated",
|
|
890
|
+
"interaction.request",
|
|
891
|
+
"interaction.respond.result",
|
|
892
|
+
"permission.request",
|
|
893
|
+
"permission.respond.result",
|
|
894
|
+
"sessions.snapshot",
|
|
895
|
+
"session.list",
|
|
896
|
+
"session.options",
|
|
897
|
+
"session.create",
|
|
898
|
+
"session.delete",
|
|
899
|
+
"session.configure",
|
|
900
|
+
"session.remote",
|
|
901
|
+
"session.timeline.page",
|
|
902
|
+
"session.watch",
|
|
903
|
+
"session.prompt",
|
|
904
|
+
"session.abort",
|
|
905
|
+
"interaction.respond",
|
|
906
|
+
"permission.respond"
|
|
907
|
+
]);
|
|
908
|
+
|
|
909
|
+
// ../../shared/protocol/dist/transport/transport.js
|
|
910
|
+
import { z as z11 } from "zod";
|
|
911
|
+
var RoleSchema = z11.enum(["pc", "mobile"]);
|
|
912
|
+
var V2SocketAuthBaseShape = {
|
|
913
|
+
transportVersion: z11.coerce.number().pipe(z11.literal(TRANSPORT_V2)),
|
|
914
|
+
protocolVersion: z11.coerce.number().pipe(SupportedProtocolVersionSchema),
|
|
915
|
+
token: z11.string().min(1),
|
|
916
|
+
clientId: IdSchema,
|
|
917
|
+
machineId: IdSchema,
|
|
918
|
+
keyId: Base64UrlKeyIdSchema
|
|
919
|
+
};
|
|
920
|
+
var V2PcSocketAuthSchema = z11.object({
|
|
921
|
+
...V2SocketAuthBaseShape,
|
|
922
|
+
role: z11.literal("pc"),
|
|
923
|
+
userId: IdSchema
|
|
924
|
+
}).strict();
|
|
925
|
+
var V2MobileSocketAuthSchema = z11.object({
|
|
926
|
+
...V2SocketAuthBaseShape,
|
|
927
|
+
role: z11.literal("mobile"),
|
|
928
|
+
mobileCredential: z11.string().min(64).max(4096)
|
|
929
|
+
}).strict();
|
|
930
|
+
var V2SocketAuthSchema = z11.discriminatedUnion("role", [
|
|
931
|
+
V2PcSocketAuthSchema,
|
|
932
|
+
V2MobileSocketAuthSchema
|
|
933
|
+
]);
|
|
934
|
+
var SECURE_MESSAGE_MAX_CIPHERTEXT_LENGTH = 16e6;
|
|
935
|
+
var SecureMessageBaseShape = {
|
|
936
|
+
version: z11.literal(1),
|
|
937
|
+
algorithm: z11.literal("A256GCM"),
|
|
938
|
+
messageId: IdSchema,
|
|
939
|
+
machineId: IdSchema,
|
|
940
|
+
clientId: IdSchema,
|
|
941
|
+
recipientClientId: IdSchema.optional(),
|
|
942
|
+
keyId: Base64UrlKeyIdSchema,
|
|
943
|
+
sentAt: z11.number().int().nonnegative(),
|
|
944
|
+
nonce: z11.string().regex(/^[A-Za-z0-9_-]{16}$/u, "Expected a 12-byte base64url nonce"),
|
|
945
|
+
ciphertext: z11.string().min(22).max(SECURE_MESSAGE_MAX_CIPHERTEXT_LENGTH).regex(/^[A-Za-z0-9_-]+$/u, "Expected base64url ciphertext")
|
|
946
|
+
};
|
|
947
|
+
var SecureMessageSchema = z11.discriminatedUnion("sender", [
|
|
948
|
+
z11.object({
|
|
949
|
+
...SecureMessageBaseShape,
|
|
950
|
+
sender: z11.literal("pc"),
|
|
951
|
+
event: PcSecureEventNameSchema
|
|
952
|
+
}).strict(),
|
|
953
|
+
z11.object({
|
|
954
|
+
...SecureMessageBaseShape,
|
|
955
|
+
sender: z11.literal("mobile"),
|
|
956
|
+
event: MobileSecureEventNameSchema
|
|
957
|
+
}).strict()
|
|
958
|
+
]);
|
|
959
|
+
var SecureDeliveryErrorSchema = z11.object({
|
|
960
|
+
messageId: IdSchema,
|
|
961
|
+
event: SecureEventNameSchema,
|
|
962
|
+
machineId: IdSchema,
|
|
963
|
+
code: z11.enum([
|
|
964
|
+
"MACHINE_OFFLINE",
|
|
965
|
+
"IDENTITY_MISMATCH",
|
|
966
|
+
"KEY_ID_MISMATCH",
|
|
967
|
+
"INVALID_PAYLOAD",
|
|
968
|
+
"SESSION_DELETE_UNSUPPORTED",
|
|
969
|
+
"SESSION_COMMUNICATION_UNSUPPORTED"
|
|
970
|
+
]),
|
|
971
|
+
message: z11.string().min(1).max(1024)
|
|
972
|
+
}).strict();
|
|
973
|
+
|
|
974
|
+
// ../../shared/protocol/dist/transport/machines.js
|
|
975
|
+
import { z as z12 } from "zod";
|
|
976
|
+
var MACHINE_HELLO_SDK_COMPAT_VERSION = "1.0.9";
|
|
977
|
+
var MachineHelloBaseShape = {
|
|
978
|
+
userId: IdSchema,
|
|
979
|
+
machineId: IdSchema,
|
|
980
|
+
machineName: z12.string().trim().min(1).max(120),
|
|
981
|
+
platform: z12.string().trim().min(1).max(64),
|
|
982
|
+
agentRunId: IdSchema,
|
|
983
|
+
sdkVersion: z12.literal(MACHINE_HELLO_SDK_COMPAT_VERSION),
|
|
984
|
+
clientVersion: z12.string().trim().min(1).max(64).optional(),
|
|
985
|
+
capabilities: z12.array(IdSchema).max(64).optional()
|
|
986
|
+
};
|
|
987
|
+
var OldestSupportedMachineHelloSchema = z12.object({
|
|
988
|
+
...MachineHelloBaseShape,
|
|
989
|
+
protocolVersion: z12.literal(OLDEST_SUPPORTED_PROTOCOL_VERSION)
|
|
990
|
+
});
|
|
991
|
+
var LegacyMachineHelloSchema = z12.object({
|
|
992
|
+
...MachineHelloBaseShape,
|
|
993
|
+
protocolVersion: z12.literal(LEGACY_PROTOCOL_VERSION)
|
|
994
|
+
});
|
|
995
|
+
var MachineHelloSchema = z12.object({
|
|
996
|
+
...MachineHelloBaseShape,
|
|
997
|
+
protocolVersion: z12.literal(PROTOCOL_VERSION)
|
|
998
|
+
});
|
|
999
|
+
var CompatibleMachineHelloSchema = z12.union([
|
|
1000
|
+
OldestSupportedMachineHelloSchema,
|
|
1001
|
+
LegacyMachineHelloSchema,
|
|
1002
|
+
MachineHelloSchema
|
|
1003
|
+
]);
|
|
1004
|
+
var V2MachineHelloSchema = z12.union([
|
|
1005
|
+
OldestSupportedMachineHelloSchema.strict(),
|
|
1006
|
+
LegacyMachineHelloSchema.strict(),
|
|
1007
|
+
MachineHelloSchema.strict()
|
|
1008
|
+
]);
|
|
1009
|
+
var MachineHeartbeatSchema = z12.object({
|
|
1010
|
+
userId: IdSchema,
|
|
1011
|
+
machineId: IdSchema,
|
|
1012
|
+
agentRunId: IdSchema,
|
|
1013
|
+
sentAt: z12.number().int().nonnegative()
|
|
1014
|
+
});
|
|
1015
|
+
var MachinePresenceStateShape = {
|
|
1016
|
+
online: z12.literal(true),
|
|
1017
|
+
connectedAt: z12.number().int().nonnegative(),
|
|
1018
|
+
lastSeen: z12.number().int().nonnegative()
|
|
1019
|
+
};
|
|
1020
|
+
var MachinePresenceSchema = z12.union([
|
|
1021
|
+
OldestSupportedMachineHelloSchema.extend(MachinePresenceStateShape),
|
|
1022
|
+
LegacyMachineHelloSchema.extend(MachinePresenceStateShape),
|
|
1023
|
+
MachineHelloSchema.extend(MachinePresenceStateShape)
|
|
1024
|
+
]);
|
|
1025
|
+
var MachineOfflineSchema = z12.object({
|
|
1026
|
+
userId: IdSchema,
|
|
1027
|
+
machineId: IdSchema,
|
|
1028
|
+
agentRunId: IdSchema,
|
|
1029
|
+
disconnectedAt: z12.number().int().nonnegative()
|
|
1030
|
+
});
|
|
1031
|
+
var MobileDisconnectedSchema = z12.object({
|
|
1032
|
+
clientId: IdSchema,
|
|
1033
|
+
machineId: IdSchema,
|
|
1034
|
+
disconnectedAt: z12.number().int().nonnegative()
|
|
1035
|
+
});
|
|
1036
|
+
var MobileConnectedSchema = z12.object({
|
|
1037
|
+
clientId: IdSchema,
|
|
1038
|
+
machineId: IdSchema,
|
|
1039
|
+
connectedAt: z12.number().int().nonnegative(),
|
|
1040
|
+
capabilities: z12.array(IdSchema).max(64).optional()
|
|
1041
|
+
});
|
|
1042
|
+
var MachineListRequestSchema = z12.object({
|
|
1043
|
+
requestId: IdSchema
|
|
1044
|
+
});
|
|
1045
|
+
var MachineListResultSchema = z12.object({
|
|
1046
|
+
requestId: IdSchema,
|
|
1047
|
+
machines: z12.array(MachinePresenceSchema),
|
|
1048
|
+
// Absent on older relays; PC presence capabilities alone do not negotiate routing.
|
|
1049
|
+
relayCapabilities: z12.array(IdSchema).max(64).optional()
|
|
1050
|
+
});
|
|
1051
|
+
|
|
1052
|
+
// ../../shared/protocol/dist/transport/peer-message.js
|
|
1053
|
+
import { z as z13 } from "zod";
|
|
1054
|
+
var PeerTextSchema = z13.string().max(16e3).refine((value) => value.trim().length > 0);
|
|
1055
|
+
var PeerMessageBaseShape = {
|
|
1056
|
+
version: z13.literal(1),
|
|
1057
|
+
messageId: IdSchema,
|
|
1058
|
+
sourceSessionId: IdSchema,
|
|
1059
|
+
targetMachineId: IdSchema,
|
|
1060
|
+
targetSessionId: IdSchema
|
|
1061
|
+
};
|
|
1062
|
+
var PeerMessageSchema = z13.discriminatedUnion("kind", [
|
|
1063
|
+
z13.object({
|
|
1064
|
+
...PeerMessageBaseShape,
|
|
1065
|
+
kind: z13.literal("request"),
|
|
1066
|
+
content: PeerTextSchema,
|
|
1067
|
+
timeoutMs: z13.number().int().min(1e3).max(12e4)
|
|
1068
|
+
}).strict(),
|
|
1069
|
+
z13.object({
|
|
1070
|
+
...PeerMessageBaseShape,
|
|
1071
|
+
kind: z13.literal("response"),
|
|
1072
|
+
requestId: IdSchema,
|
|
1073
|
+
content: PeerTextSchema
|
|
1074
|
+
}).strict(),
|
|
1075
|
+
z13.object({
|
|
1076
|
+
...PeerMessageBaseShape,
|
|
1077
|
+
kind: z13.literal("error"),
|
|
1078
|
+
requestId: IdSchema,
|
|
1079
|
+
code: z13.string().trim().min(1).max(80),
|
|
1080
|
+
message: z13.string().trim().min(1).max(1024)
|
|
1081
|
+
}).strict(),
|
|
1082
|
+
z13.object({
|
|
1083
|
+
...PeerMessageBaseShape,
|
|
1084
|
+
kind: z13.literal("cancel"),
|
|
1085
|
+
requestId: IdSchema
|
|
1086
|
+
}).strict()
|
|
1087
|
+
]);
|
|
1088
|
+
var PeerDeliverySchema = z13.object({
|
|
1089
|
+
sourceMachineId: IdSchema,
|
|
1090
|
+
message: PeerMessageSchema
|
|
1091
|
+
}).strict();
|
|
1092
|
+
|
|
1093
|
+
// ../../shared/protocol/dist/transport/a2a.js
|
|
1094
|
+
import { z as z14 } from "zod";
|
|
1095
|
+
var A2A_BODY_MAX_LENGTH = 65536;
|
|
1096
|
+
var A2aRelayRequestSchema = z14.object({
|
|
1097
|
+
userId: IdSchema,
|
|
1098
|
+
sourceMachineId: IdSchema,
|
|
1099
|
+
targetSessionId: IdSchema,
|
|
1100
|
+
endpointUrl: z14.url().max(2048),
|
|
1101
|
+
kind: z14.enum(["card", "rpc"]),
|
|
1102
|
+
body: z14.string().max(A2A_BODY_MAX_LENGTH),
|
|
1103
|
+
protocolVersion: z14.string().max(32).optional()
|
|
1104
|
+
}).strict().refine((request) => request.kind !== "card" || request.body === "", {
|
|
1105
|
+
path: ["body"],
|
|
1106
|
+
message: "Agent card requests must have an empty body"
|
|
1107
|
+
});
|
|
1108
|
+
var A2aRelayResponseSchema = z14.object({
|
|
1109
|
+
status: z14.number().int().min(200).max(599),
|
|
1110
|
+
body: z14.string().max(A2A_BODY_MAX_LENGTH)
|
|
1111
|
+
}).strict();
|
|
1112
|
+
|
|
1113
|
+
// ../../shared/protocol/dist/transport/browser-open-url.js
|
|
1114
|
+
import { z as z15 } from "zod";
|
|
1115
|
+
var BROWSER_OPEN_URL_MAX_LENGTH = 8192;
|
|
1116
|
+
var BrowserOpenUrlParamsSchema = z15.strictObject({
|
|
1117
|
+
url: z15.string().min(1).max(BROWSER_OPEN_URL_MAX_LENGTH).refine((value) => {
|
|
1118
|
+
if (!/^https?:\/\//i.test(value) || /[\s\p{Cc}\\]/u.test(value) || /%(?![0-9a-f]{2})/i.test(value))
|
|
1119
|
+
return false;
|
|
1120
|
+
const authority = value.split(/[/?#]/)[2];
|
|
1121
|
+
if (!authority || /[@%]|[^\x21-\x7e]/.test(authority))
|
|
1122
|
+
return false;
|
|
1123
|
+
try {
|
|
1124
|
+
return new URL(value).hostname.length > 0;
|
|
1125
|
+
} catch {
|
|
1126
|
+
return false;
|
|
1127
|
+
}
|
|
1128
|
+
}, "Expected an absolute HTTP(S) URL without credentials or whitespace")
|
|
1129
|
+
});
|
|
1130
|
+
var BrowserOpenUrlResultSchema = z15.strictObject({ opened: z15.literal(true) });
|
|
1131
|
+
|
|
1132
|
+
// ../../shared/protocol/dist/sessions/session-communication.js
|
|
1133
|
+
import { z as z16 } from "zod";
|
|
1134
|
+
var SessionCommunicationIdSchema = z16.string().min(1).max(256).refine((value) => value === value.trim(), "Expected an unpadded identity");
|
|
1135
|
+
var SessionCommunicationIdentityShape = {
|
|
1136
|
+
requestId: SessionCommunicationIdSchema,
|
|
1137
|
+
machineId: SessionCommunicationIdSchema,
|
|
1138
|
+
sessionId: SessionCommunicationIdSchema,
|
|
1139
|
+
operation: z16.string().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[.-][a-z0-9]+)*$/u),
|
|
1140
|
+
version: z16.number().int().positive().max(2147483647)
|
|
1141
|
+
};
|
|
1142
|
+
var SessionCommunicationDataSchema = z16.record(z16.string(), z16.json());
|
|
1143
|
+
var SessionCommunicationRequestSchema = z16.object({
|
|
1144
|
+
...SessionCommunicationIdentityShape,
|
|
1145
|
+
kind: z16.literal("request"),
|
|
1146
|
+
data: SessionCommunicationDataSchema
|
|
1147
|
+
}).strict();
|
|
1148
|
+
var SessionCommunicationResponseSchema = z16.object({
|
|
1149
|
+
...SessionCommunicationIdentityShape,
|
|
1150
|
+
kind: z16.literal("response"),
|
|
1151
|
+
data: SessionCommunicationDataSchema
|
|
1152
|
+
}).strict();
|
|
1153
|
+
var SessionCommunicationErrorSchema = z16.object({
|
|
1154
|
+
...SessionCommunicationIdentityShape,
|
|
1155
|
+
kind: z16.literal("error"),
|
|
1156
|
+
error: ProtocolFailureSchema
|
|
1157
|
+
}).strict();
|
|
1158
|
+
var SessionCommunicationSchema = z16.discriminatedUnion("kind", [
|
|
1159
|
+
SessionCommunicationRequestSchema,
|
|
1160
|
+
SessionCommunicationResponseSchema,
|
|
1161
|
+
SessionCommunicationErrorSchema
|
|
1162
|
+
]);
|
|
1163
|
+
function sessionCommunicationOperationCapability(operation, version) {
|
|
1164
|
+
return `${operation}.v${version}`;
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1167
|
+
// ../../shared/protocol/dist/sessions/session-workspace.js
|
|
1168
|
+
import { z as z17 } from "zod";
|
|
1169
|
+
var SESSION_PROJECT_IDENTITY_MAX_PATH_LENGTH = 32768;
|
|
1170
|
+
var SESSION_PROJECT_IDENTITY_MAX_RESPONSE_BYTES = 640 * 1024;
|
|
1171
|
+
var SESSION_DIRECTORY_MAX_PATH_LENGTH = 1024;
|
|
1172
|
+
var SESSION_DIRECTORY_MAX_DEPTH = 32;
|
|
1173
|
+
var SESSION_DIRECTORY_MAX_ENTRIES = 500;
|
|
1174
|
+
var SESSION_DIRECTORY_MAX_RESPONSE_BYTES = 128 * 1024;
|
|
1175
|
+
var SESSION_FILE_MAX_ORIGINAL_BYTES = 500 * 1024;
|
|
1176
|
+
var SESSION_FILE_V2_MAX_ORIGINAL_BYTES = 1024 * 1024;
|
|
1177
|
+
var SESSION_FILE_GZIP_THRESHOLD_BYTES = 20 * 1024;
|
|
1178
|
+
var SESSION_FILE_MAX_IMAGE_BYTES = 100 * 1024;
|
|
1179
|
+
var SESSION_FILE_MAX_IMAGE_PIXELS = 16 * 1024 * 1024;
|
|
1180
|
+
var SESSION_FILE_MAX_TRANSFER_BYTES = SESSION_FILE_MAX_ORIGINAL_BYTES + 1024;
|
|
1181
|
+
var SESSION_FILE_MAX_BASE64_LENGTH = Math.ceil(SESSION_FILE_MAX_TRANSFER_BYTES / 3) * 4;
|
|
1182
|
+
var SESSION_FILE_MAX_RESPONSE_BYTES = SESSION_FILE_MAX_BASE64_LENGTH + 8192;
|
|
1183
|
+
var SESSION_FILE_V2_MAX_TRANSFER_BYTES = SESSION_FILE_V2_MAX_ORIGINAL_BYTES + 1024;
|
|
1184
|
+
var SESSION_FILE_V2_MAX_BASE64_LENGTH = Math.ceil(SESSION_FILE_V2_MAX_TRANSFER_BYTES / 3) * 4;
|
|
1185
|
+
var SESSION_FILE_V2_MAX_RESPONSE_BYTES = SESSION_FILE_V2_MAX_BASE64_LENGTH + 8192;
|
|
1186
|
+
var SESSION_FILE_MEDIA_TYPES = [
|
|
1187
|
+
"text/plain",
|
|
1188
|
+
"text/html",
|
|
1189
|
+
"text/markdown",
|
|
1190
|
+
"text/css",
|
|
1191
|
+
"text/javascript",
|
|
1192
|
+
"application/json",
|
|
1193
|
+
"application/xml",
|
|
1194
|
+
"text/xml",
|
|
1195
|
+
"application/yaml",
|
|
1196
|
+
"image/webp"
|
|
1197
|
+
];
|
|
1198
|
+
var SESSION_FILE_VIDEO_MEDIA_TYPES = ["video/mp4", "video/webm"];
|
|
1199
|
+
var SESSION_FILE_V2_MEDIA_TYPES = [...SESSION_FILE_MEDIA_TYPES, ...SESSION_FILE_VIDEO_MEDIA_TYPES];
|
|
1200
|
+
var SESSION_FILE_MAX_VIDEO_PIXELS = 16 * 1024 * 1024;
|
|
1201
|
+
function isSafeSessionDirectoryPath(path) {
|
|
1202
|
+
if (path === "")
|
|
1203
|
+
return true;
|
|
1204
|
+
if (path.length > SESSION_DIRECTORY_MAX_PATH_LENGTH)
|
|
1205
|
+
return false;
|
|
1206
|
+
const segments = path.split("/");
|
|
1207
|
+
return segments.length <= SESSION_DIRECTORY_MAX_DEPTH && segments.every((segment) => segment.length > 0 && segment.length <= 255 && segment !== "." && segment !== ".." && !/[\\:<>"|?*\u0000-\u001f\u007f]/u.test(segment) && !/[. ]$/u.test(segment) && !/~[0-9]/u.test(segment) && !/^(?:con|prn|aux|nul|com[0-9¹²³]|lpt[0-9¹²³])(?:[ .]|$)/iu.test(segment) && !/^(?:conin\$|conout\$)$/iu.test(segment));
|
|
1208
|
+
}
|
|
1209
|
+
var SessionDirectoryListRequestSchema = z17.object({
|
|
1210
|
+
requestId: IdSchema,
|
|
1211
|
+
machineId: IdSchema,
|
|
1212
|
+
sessionId: IdSchema,
|
|
1213
|
+
path: z17.string().max(SESSION_DIRECTORY_MAX_PATH_LENGTH)
|
|
1214
|
+
}).strict();
|
|
1215
|
+
var SessionDirectoryEntrySchema = z17.object({
|
|
1216
|
+
name: z17.string().min(1).max(255),
|
|
1217
|
+
kind: z17.enum(["directory", "file", "blocked"])
|
|
1218
|
+
}).strict();
|
|
1219
|
+
var SessionDirectoryListDataSchema = SessionDirectoryListRequestSchema.pick({ path: true });
|
|
1220
|
+
var SessionDirectoryListResultDataSchema = z17.object({
|
|
1221
|
+
path: z17.string().max(SESSION_DIRECTORY_MAX_PATH_LENGTH),
|
|
1222
|
+
rootRevision: z17.string().min(1).max(128),
|
|
1223
|
+
entries: z17.array(SessionDirectoryEntrySchema).max(SESSION_DIRECTORY_MAX_ENTRIES)
|
|
1224
|
+
}).strict();
|
|
1225
|
+
var SessionDirectoryListResponseSchema = SessionDirectoryListRequestSchema.extend({
|
|
1226
|
+
rootRevision: z17.string().min(1).max(128).optional(),
|
|
1227
|
+
entries: z17.array(SessionDirectoryEntrySchema).max(SESSION_DIRECTORY_MAX_ENTRIES).optional(),
|
|
1228
|
+
error: ProtocolFailureSchema.optional()
|
|
1229
|
+
}).superRefine((response, context) => {
|
|
1230
|
+
if (response.error === void 0 ? response.entries === void 0 || response.rootRevision === void 0 : response.entries !== void 0 || response.rootRevision !== void 0) {
|
|
1231
|
+
context.addIssue({ code: "custom", message: "Expected directory success or failure" });
|
|
1232
|
+
}
|
|
1233
|
+
});
|
|
1234
|
+
var SessionFileReadDataSchema = z17.object({
|
|
1235
|
+
path: z17.string().min(1).max(SESSION_DIRECTORY_MAX_PATH_LENGTH).refine(isSafeSessionDirectoryPath),
|
|
1236
|
+
rootRevision: z17.string().regex(/^[A-Za-z0-9_-]{43}$/u)
|
|
1237
|
+
}).strict();
|
|
1238
|
+
function fileResultSchema(mediaTypes, extended) {
|
|
1239
|
+
const maxOriginal = extended ? SESSION_FILE_V2_MAX_ORIGINAL_BYTES : SESSION_FILE_MAX_ORIGINAL_BYTES;
|
|
1240
|
+
const maxTransfer = extended ? SESSION_FILE_V2_MAX_TRANSFER_BYTES : SESSION_FILE_MAX_TRANSFER_BYTES;
|
|
1241
|
+
return z17.object({
|
|
1242
|
+
path: SessionFileReadDataSchema.shape.path,
|
|
1243
|
+
rootRevision: SessionFileReadDataSchema.shape.rootRevision,
|
|
1244
|
+
mediaType: z17.enum(mediaTypes),
|
|
1245
|
+
originalByteLength: z17.number().int().min(0).max(maxOriginal),
|
|
1246
|
+
// Canonical length after decompression, not the length of the transport bytes.
|
|
1247
|
+
byteLength: z17.number().int().min(0).max(maxOriginal),
|
|
1248
|
+
encoding: z17.enum(["identity", "gzip"]),
|
|
1249
|
+
data: z17.string().max(extended ? SESSION_FILE_V2_MAX_BASE64_LENGTH : SESSION_FILE_MAX_BASE64_LENGTH)
|
|
1250
|
+
}).strict().superRefine((result, context) => {
|
|
1251
|
+
const invalid = () => context.addIssue({ code: "custom", message: "Invalid file content" });
|
|
1252
|
+
if (result.encoding === "gzip" !== result.originalByteLength >= SESSION_FILE_GZIP_THRESHOLD_BYTES)
|
|
1253
|
+
invalid();
|
|
1254
|
+
if (result.mediaType === "image/webp" ? result.byteLength === 0 || result.byteLength > SESSION_FILE_MAX_IMAGE_BYTES || result.originalByteLength === 0 : result.byteLength !== result.originalByteLength)
|
|
1255
|
+
invalid();
|
|
1256
|
+
if (result.mediaType.startsWith("video/") && (result.byteLength === 0 || !result.path.toLowerCase().endsWith(result.mediaType === "video/mp4" ? ".mp4" : ".webm")))
|
|
1257
|
+
invalid();
|
|
1258
|
+
const base64 = result.data;
|
|
1259
|
+
const padding = base64.endsWith("==") ? 2 : base64.endsWith("=") ? 1 : 0;
|
|
1260
|
+
const length = base64.length / 4 * 3 - padding;
|
|
1261
|
+
if (base64.length % 4 !== 0 || !/^[A-Za-z0-9+/]*={0,2}$/u.test(base64) || length > maxTransfer || padding === 2 && !/[AQgw]==$/u.test(base64) || padding === 1 && !/[AEIMQUYcgkosw048]=$/u.test(base64) || (result.encoding === "identity" ? length !== result.byteLength : length < 20))
|
|
1262
|
+
invalid();
|
|
1263
|
+
});
|
|
1264
|
+
}
|
|
1265
|
+
var SessionFileReadResultDataSchema = fileResultSchema(SESSION_FILE_MEDIA_TYPES, false);
|
|
1266
|
+
var SessionFileReadV2ResultDataSchema = fileResultSchema(SESSION_FILE_V2_MEDIA_TYPES, true);
|
|
1267
|
+
var SessionFileDownloadDataSchema = SessionFileReadDataSchema;
|
|
1268
|
+
var SessionFileDownloadResultDataSchema = fileResultSchema(["application/octet-stream"], true);
|
|
1269
|
+
var SessionGitProjectSchema = z17.object({
|
|
1270
|
+
localRepositoryKey: z17.string().length(43).regex(/^[A-Za-z0-9_-]{43}$/),
|
|
1271
|
+
worktreeRoot: z17.string().min(1).max(SESSION_PROJECT_IDENTITY_MAX_PATH_LENGTH),
|
|
1272
|
+
mainWorktreeRoot: z17.string().min(1).max(SESSION_PROJECT_IDENTITY_MAX_PATH_LENGTH).optional(),
|
|
1273
|
+
gitRemoteUrl: z17.string().max(SESSION_PROJECT_IDENTITY_MAX_PATH_LENGTH).optional()
|
|
1274
|
+
}).strict();
|
|
1275
|
+
var SessionProjectIdentityRequestDataSchema = z17.object({}).strict();
|
|
1276
|
+
var SessionProjectIdentityResultDataSchema = z17.object({
|
|
1277
|
+
project: SessionGitProjectSchema.optional()
|
|
1278
|
+
}).strict();
|
|
1279
|
+
|
|
1280
|
+
// ../../shared/protocol/dist/sessions/session-git-diff.js
|
|
1281
|
+
import { z as z18 } from "zod";
|
|
1282
|
+
var SESSION_GIT_DIFF_GZIP_MIN_BYTES = 2 * 1024;
|
|
1283
|
+
var SESSION_GIT_DIFF_MAX_FILES = 500;
|
|
1284
|
+
var SESSION_GIT_DIFF_MAX_PATCH_BYTES = 128 * 1024;
|
|
1285
|
+
var SESSION_GIT_DIFF_MAX_RESPONSE_BYTES = 512 * 1024;
|
|
1286
|
+
var SESSION_GIT_DIFF_MAX_TRANSFER_BYTES = SESSION_GIT_DIFF_MAX_RESPONSE_BYTES + 1024;
|
|
1287
|
+
var SESSION_GIT_DIFF_MAX_BASE64_LENGTH = Math.ceil(SESSION_GIT_DIFF_MAX_TRANSFER_BYTES / 3) * 4;
|
|
1288
|
+
var SESSION_GIT_DIFF_MAX_GZIP_RESPONSE_BYTES = SESSION_GIT_DIFF_MAX_BASE64_LENGTH + 1024;
|
|
1289
|
+
var commitSchema = z18.string().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/u);
|
|
1290
|
+
var SessionGitDiffDataSchema = z18.object({
|
|
1291
|
+
rootRevision: SessionFileReadDataSchema.shape.rootRevision,
|
|
1292
|
+
path: SessionFileReadDataSchema.shape.path.optional(),
|
|
1293
|
+
baseCommit: commitSchema.optional()
|
|
1294
|
+
}).strict().refine((value) => value.path === void 0 === (value.baseCommit === void 0), "A file diff must identify its listed base commit");
|
|
1295
|
+
var SessionGitDiffEntrySchema = z18.object({
|
|
1296
|
+
path: SessionFileReadDataSchema.shape.path,
|
|
1297
|
+
status: z18.enum(["added", "modified", "deleted", "untracked"])
|
|
1298
|
+
}).strict();
|
|
1299
|
+
var SessionGitDiffResultDataSchema = z18.object({
|
|
1300
|
+
rootRevision: SessionFileReadDataSchema.shape.rootRevision,
|
|
1301
|
+
baseRef: z18.enum(["origin/main", "main"]),
|
|
1302
|
+
baseCommit: commitSchema,
|
|
1303
|
+
files: z18.array(SessionGitDiffEntrySchema).max(SESSION_GIT_DIFF_MAX_FILES).optional(),
|
|
1304
|
+
path: SessionFileReadDataSchema.shape.path.optional(),
|
|
1305
|
+
patch: z18.string().max(SESSION_GIT_DIFF_MAX_PATCH_BYTES).optional(),
|
|
1306
|
+
binary: z18.boolean().optional()
|
|
1307
|
+
}).strict().superRefine((value, context) => {
|
|
1308
|
+
const encoder = new TextEncoder();
|
|
1309
|
+
if (value.patch !== void 0 && encoder.encode(value.patch).length > SESSION_GIT_DIFF_MAX_PATCH_BYTES || encoder.encode(JSON.stringify(value)).length > SESSION_GIT_DIFF_MAX_RESPONSE_BYTES) {
|
|
1310
|
+
context.addIssue({ code: "custom", message: "Git diff exceeds its transfer limit" });
|
|
1311
|
+
}
|
|
1312
|
+
if (value.path === void 0) {
|
|
1313
|
+
if (value.files === void 0 || value.patch !== void 0 || value.binary !== void 0 || new Set(value.files?.map((entry) => entry.path)).size !== value.files?.length) {
|
|
1314
|
+
context.addIssue({ code: "custom", message: "Expected a unique changed-file list" });
|
|
1315
|
+
}
|
|
1316
|
+
} else if (value.files !== void 0 || value.patch === void 0 || value.binary === void 0 || value.binary && value.patch !== "") {
|
|
1317
|
+
context.addIssue({ code: "custom", message: "Expected a text patch or an explicit binary change" });
|
|
1318
|
+
}
|
|
1319
|
+
});
|
|
1320
|
+
var SessionGitDiffFileErrorSchema = z18.object({
|
|
1321
|
+
code: z18.enum(["DIFF_BLOCKED", "DIFF_FILE_UNAVAILABLE"]),
|
|
1322
|
+
message: z18.string().min(1).max(512)
|
|
1323
|
+
}).strict();
|
|
1324
|
+
var SessionGitDiffPartialEntrySchema = SessionGitDiffEntrySchema.extend({
|
|
1325
|
+
// Error paths are display-only: they must never be used for file requests.
|
|
1326
|
+
path: z18.string().min(1).max(32768).refine((value) => !value.includes("\0")),
|
|
1327
|
+
error: SessionGitDiffFileErrorSchema.optional()
|
|
1328
|
+
}).superRefine((value, context) => {
|
|
1329
|
+
if (value.error === void 0 && !SessionGitDiffEntrySchema.shape.path.safeParse(value.path).success) {
|
|
1330
|
+
context.addIssue({ code: "custom", message: "A readable diff entry must have a safe path" });
|
|
1331
|
+
}
|
|
1332
|
+
});
|
|
1333
|
+
var SessionGitDiffPartialResultDataSchema = SessionGitDiffResultDataSchema.safeExtend({
|
|
1334
|
+
files: z18.array(SessionGitDiffPartialEntrySchema).max(SESSION_GIT_DIFF_MAX_FILES).optional()
|
|
1335
|
+
});
|
|
1336
|
+
var SessionGitDiffGzipResultDataSchema = z18.object({
|
|
1337
|
+
encoding: z18.literal("gzip"),
|
|
1338
|
+
byteLength: z18.number().int().min(1).max(SESSION_GIT_DIFF_MAX_RESPONSE_BYTES),
|
|
1339
|
+
data: z18.string().max(SESSION_GIT_DIFF_MAX_BASE64_LENGTH).regex(/^[A-Za-z0-9+/]*={0,2}$/u)
|
|
1340
|
+
}).strict().superRefine((value, context) => {
|
|
1341
|
+
const padding = value.data.endsWith("==") ? 2 : value.data.endsWith("=") ? 1 : 0;
|
|
1342
|
+
const bytes = value.data.length / 4 * 3 - padding;
|
|
1343
|
+
const alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
1344
|
+
const tail = alphabet.indexOf(value.data[value.data.length - padding - 1] ?? "");
|
|
1345
|
+
if (value.data.length % 4 !== 0 || bytes < 20 || bytes > SESSION_GIT_DIFF_MAX_TRANSFER_BYTES || padding === 2 && (tail & 15) !== 0 || padding === 1 && (tail & 3) !== 0) {
|
|
1346
|
+
context.addIssue({ code: "custom", message: "Invalid gzip transfer" });
|
|
1347
|
+
}
|
|
1348
|
+
});
|
|
1349
|
+
var SessionGitDiffV2ResultDataSchema = z18.union([
|
|
1350
|
+
SessionGitDiffResultDataSchema,
|
|
1351
|
+
SessionGitDiffGzipResultDataSchema
|
|
1352
|
+
]);
|
|
1353
|
+
|
|
1354
|
+
// ../../shared/protocol/dist/sessions/session-resource.js
|
|
1355
|
+
import { z as z19 } from "zod";
|
|
1356
|
+
var SESSION_RESOURCE_MAX_ORIGINAL_BYTES = 499999;
|
|
1357
|
+
var SESSION_RESOURCE_GZIP_THRESHOLD_BYTES = 20 * 1024;
|
|
1358
|
+
var SESSION_RESOURCE_MAX_IMAGE_PIXELS = 16 * 1024 * 1024;
|
|
1359
|
+
var SESSION_RESOURCE_MAX_TRANSFER_BYTES = SESSION_RESOURCE_MAX_ORIGINAL_BYTES + 1024;
|
|
1360
|
+
var SESSION_RESOURCE_MAX_BASE64_LENGTH = Math.ceil(SESSION_RESOURCE_MAX_TRANSFER_BYTES / 3) * 4;
|
|
1361
|
+
var SESSION_RESOURCE_MAX_RESPONSE_BYTES = SESSION_RESOURCE_MAX_BASE64_LENGTH + 8192;
|
|
1362
|
+
var SESSION_RESOURCE_MEDIA_TYPES = [
|
|
1363
|
+
"image/jpeg",
|
|
1364
|
+
"image/png",
|
|
1365
|
+
"image/webp",
|
|
1366
|
+
"text/css",
|
|
1367
|
+
"text/javascript"
|
|
1368
|
+
];
|
|
1369
|
+
var SessionResourceReadDataSchema = z19.object({
|
|
1370
|
+
path: z19.string().min(1).max(SESSION_DIRECTORY_MAX_PATH_LENGTH).refine(isSafeSessionDirectoryPath),
|
|
1371
|
+
rootRevision: z19.string().regex(/^[A-Za-z0-9_-]{43}$/u)
|
|
1372
|
+
}).strict();
|
|
1373
|
+
var SessionResourceReadResultDataSchema = z19.object({
|
|
1374
|
+
path: SessionResourceReadDataSchema.shape.path,
|
|
1375
|
+
rootRevision: SessionResourceReadDataSchema.shape.rootRevision,
|
|
1376
|
+
mediaType: z19.enum(SESSION_RESOURCE_MEDIA_TYPES),
|
|
1377
|
+
originalByteLength: z19.number().int().min(0).max(SESSION_RESOURCE_MAX_ORIGINAL_BYTES),
|
|
1378
|
+
byteLength: z19.number().int().min(0).max(SESSION_RESOURCE_MAX_ORIGINAL_BYTES),
|
|
1379
|
+
encoding: z19.enum(["identity", "gzip"]),
|
|
1380
|
+
data: z19.string().max(SESSION_RESOURCE_MAX_BASE64_LENGTH)
|
|
1381
|
+
}).strict().superRefine((result, context) => {
|
|
1382
|
+
const invalid = () => context.addIssue({ code: "custom", message: "Invalid resource content" });
|
|
1383
|
+
if (result.encoding === "gzip" !== result.originalByteLength >= SESSION_RESOURCE_GZIP_THRESHOLD_BYTES || result.byteLength !== result.originalByteLength || result.mediaType.startsWith("image/") && result.byteLength === 0)
|
|
1384
|
+
invalid();
|
|
1385
|
+
const base64 = result.data;
|
|
1386
|
+
const padding = base64.endsWith("==") ? 2 : base64.endsWith("=") ? 1 : 0;
|
|
1387
|
+
const length = base64.length / 4 * 3 - padding;
|
|
1388
|
+
if (base64.length % 4 !== 0 || !/^[A-Za-z0-9+/]*={0,2}$/u.test(base64) || length > SESSION_RESOURCE_MAX_TRANSFER_BYTES || padding === 2 && !/[AQgw]==$/u.test(base64) || padding === 1 && !/[AEIMQUYcgkosw048]=$/u.test(base64) || (result.encoding === "identity" ? length !== result.byteLength : length < 20))
|
|
1389
|
+
invalid();
|
|
1390
|
+
});
|
|
1391
|
+
|
|
1392
|
+
// ../../shared/protocol/dist/sessions/session-images.js
|
|
1393
|
+
import { z as z20 } from "zod";
|
|
1394
|
+
var SESSION_IMAGE_MAX_BYTES = 3 * 1024 * 1024;
|
|
1395
|
+
var SESSION_IMAGE_MAX_PIXELS = 16 * 1024 * 1024;
|
|
1396
|
+
var SessionImageIdSchema = z20.uuid();
|
|
1397
|
+
var SessionImageTransferModeSchema = z20.enum(["direct", "proxy"]);
|
|
1398
|
+
var DirectUrlSchema = z20.string().regex(/^https:\/\/[^/?#@\\\s\x00-\x1f\x7f]+(?:[/?][^#\\\s\x00-\x1f\x7f]*)?$/u).refine((raw) => {
|
|
1399
|
+
if (!URL.canParse(raw))
|
|
1400
|
+
return false;
|
|
1401
|
+
const url = new URL(raw);
|
|
1402
|
+
return url.protocol === "https:" && url.username === "" && url.password === "" && url.hash === "";
|
|
1403
|
+
}, "Direct transfers require HTTPS without userinfo, fragments or unsafe characters");
|
|
1404
|
+
var ProxyUrlSchema = z20.string().regex(/^\/api\/v3\/session-images\/[0-9a-f-]+\/content\?[^#\\\s\x00-\x1f\x7f]+$/u);
|
|
1405
|
+
var SessionImageTransferHeadersSchema = z20.record(z20.string().regex(/^(?:content-type|if-none-match|x-ms-blob-type)$/u), z20.string().min(1).max(256).regex(/^[\x20-\x7e]+$/u));
|
|
1406
|
+
var SessionImageUploadRequestSchema = z20.object({
|
|
1407
|
+
machineId: IdSchema,
|
|
1408
|
+
sessionId: IdSchema,
|
|
1409
|
+
sizeBytes: z20.number().int().min(1).max(SESSION_IMAGE_MAX_BYTES)
|
|
1410
|
+
}).strict();
|
|
1411
|
+
var SessionImageScopeSchema = z20.object({
|
|
1412
|
+
machineId: IdSchema,
|
|
1413
|
+
sessionId: IdSchema
|
|
1414
|
+
}).strict();
|
|
1415
|
+
var UploadResultFields = {
|
|
1416
|
+
imageId: SessionImageIdSchema,
|
|
1417
|
+
uploadExpiresAt: z20.number().int().positive(),
|
|
1418
|
+
method: z20.literal("PUT"),
|
|
1419
|
+
contentType: z20.literal("image/webp"),
|
|
1420
|
+
headers: SessionImageTransferHeadersSchema.refine((headers) => headers["content-type"] === "image/webp")
|
|
1421
|
+
};
|
|
1422
|
+
var SessionImageUploadResultSchema = z20.discriminatedUnion("mode", [
|
|
1423
|
+
z20.object({ ...UploadResultFields, mode: z20.literal("direct"), uploadUrl: DirectUrlSchema }).strict(),
|
|
1424
|
+
z20.object({ ...UploadResultFields, mode: z20.literal("proxy"), uploadUrl: ProxyUrlSchema }).strict()
|
|
1425
|
+
]);
|
|
1426
|
+
var SessionImageCommitResultSchema = z20.object({
|
|
1427
|
+
imageId: SessionImageIdSchema,
|
|
1428
|
+
machineId: IdSchema,
|
|
1429
|
+
sessionId: IdSchema,
|
|
1430
|
+
sizeBytes: z20.number().int().min(1).max(SESSION_IMAGE_MAX_BYTES),
|
|
1431
|
+
width: z20.number().int().positive(),
|
|
1432
|
+
height: z20.number().int().positive(),
|
|
1433
|
+
sha256: z20.string().regex(/^[a-f0-9]{64}$/u),
|
|
1434
|
+
expiresAt: z20.number().int().positive()
|
|
1435
|
+
}).strict();
|
|
1436
|
+
var DownloadResultFields = {
|
|
1437
|
+
image: SessionImageCommitResultSchema,
|
|
1438
|
+
downloadExpiresAt: z20.number().int().positive(),
|
|
1439
|
+
method: z20.literal("GET"),
|
|
1440
|
+
headers: SessionImageTransferHeadersSchema
|
|
1441
|
+
};
|
|
1442
|
+
var SessionImageDownloadResultSchema = z20.discriminatedUnion("mode", [
|
|
1443
|
+
z20.object({ ...DownloadResultFields, mode: z20.literal("direct"), downloadUrl: DirectUrlSchema }).strict(),
|
|
1444
|
+
z20.object({ ...DownloadResultFields, mode: z20.literal("proxy"), downloadUrl: ProxyUrlSchema }).strict()
|
|
1445
|
+
]);
|
|
1446
|
+
var TimelineImageBlobRequestSchema = z20.object({
|
|
1447
|
+
sha256: z20.string().regex(/^[a-f0-9]{64}$/u)
|
|
1448
|
+
}).strict();
|
|
1449
|
+
var TimelineImageBlobResultSchema = z20.object({
|
|
1450
|
+
sha256: TimelineImageBlobRequestSchema.shape.sha256,
|
|
1451
|
+
image: SessionImageCommitResultSchema
|
|
1452
|
+
}).strict();
|
|
1453
|
+
|
|
1454
|
+
// ../../shared/protocol/dist/sessions/session-rename.js
|
|
1455
|
+
import { z as z21 } from "zod";
|
|
1456
|
+
var SESSION_RENAME_OPERATION = "session.rename";
|
|
1457
|
+
var SESSION_RENAME_VERSION = 1;
|
|
1458
|
+
var SESSION_RENAME_CAPABILITY = sessionCommunicationOperationCapability(SESSION_RENAME_OPERATION, SESSION_RENAME_VERSION);
|
|
1459
|
+
var SESSION_NAME_MAX_LENGTH = 100;
|
|
1460
|
+
var SessionNameSchema = z21.string().regex(/^[^\u0000-\u001f\u007f]*$/u).trim().min(1).max(SESSION_NAME_MAX_LENGTH);
|
|
1461
|
+
var SessionRenameDataSchema = z21.object({ name: SessionNameSchema }).strict();
|
|
1462
|
+
var SessionRenameResultDataSchema = z21.object({ name: SessionNameSchema }).strict();
|
|
1463
|
+
|
|
1464
|
+
// ../../shared/protocol/dist/sessions/sessions.js
|
|
1465
|
+
import { z as z22 } from "zod";
|
|
1466
|
+
var GroupChatParticipantSchema = z22.object({
|
|
1467
|
+
sessionId: IdSchema,
|
|
1468
|
+
title: z22.string().trim().min(1).max(260)
|
|
1469
|
+
}).strict();
|
|
1470
|
+
var GroupChatInfoSchema = z22.object({
|
|
1471
|
+
participants: z22.array(GroupChatParticipantSchema).length(2).refine((participants) => new Set(participants.map((participant) => participant.sessionId)).size === 2, "A group requires two different sessions"),
|
|
1472
|
+
state: z22.enum(["ready", "running", "paused", "blocked"])
|
|
1473
|
+
}).strict();
|
|
1474
|
+
var SessionSummarySchema = z22.object({
|
|
1475
|
+
userId: IdSchema,
|
|
1476
|
+
sessionId: IdSchema,
|
|
1477
|
+
machineId: IdSchema,
|
|
1478
|
+
summary: z22.string().max(4096).optional(),
|
|
1479
|
+
renameSupported: z22.boolean().optional(),
|
|
1480
|
+
workingDirectory: z22.string().max(32768).optional(),
|
|
1481
|
+
gitRoot: z22.string().max(32768).optional(),
|
|
1482
|
+
repository: z22.string().max(1024).optional(),
|
|
1483
|
+
gitRemoteUrl: z22.string().max(32768).optional(),
|
|
1484
|
+
branch: z22.string().max(1024).optional(),
|
|
1485
|
+
isRemote: z22.boolean(),
|
|
1486
|
+
createdAt: IsoDateSchema,
|
|
1487
|
+
modifiedAt: IsoDateSchema,
|
|
1488
|
+
groupChat: GroupChatInfoSchema.optional()
|
|
1489
|
+
});
|
|
1490
|
+
var SessionsSnapshotSchema = z22.object({
|
|
1491
|
+
userId: IdSchema,
|
|
1492
|
+
machineId: IdSchema,
|
|
1493
|
+
machineName: z22.string().trim().min(1).max(120),
|
|
1494
|
+
platform: z22.string().trim().min(1).max(64),
|
|
1495
|
+
agentRunId: IdSchema,
|
|
1496
|
+
sequence: z22.number().int().positive(),
|
|
1497
|
+
generatedAt: IsoDateSchema,
|
|
1498
|
+
complete: z22.boolean(),
|
|
1499
|
+
totalCount: z22.number().int().nonnegative(),
|
|
1500
|
+
nextCursor: z22.string().min(1).max(1024).optional(),
|
|
1501
|
+
sessions: z22.array(SessionSummarySchema)
|
|
1502
|
+
}).superRefine((snapshot, context) => {
|
|
1503
|
+
if (snapshot.totalCount < snapshot.sessions.length) {
|
|
1504
|
+
context.addIssue({
|
|
1505
|
+
code: "custom",
|
|
1506
|
+
message: "Snapshot totalCount cannot be smaller than its session page",
|
|
1507
|
+
path: ["totalCount"]
|
|
1508
|
+
});
|
|
1509
|
+
}
|
|
1510
|
+
if (snapshot.complete === (snapshot.nextCursor !== void 0)) {
|
|
1511
|
+
context.addIssue({
|
|
1512
|
+
code: "custom",
|
|
1513
|
+
message: "Incomplete snapshots require a nextCursor",
|
|
1514
|
+
path: ["nextCursor"]
|
|
1515
|
+
});
|
|
1516
|
+
}
|
|
1517
|
+
const sessionIds = /* @__PURE__ */ new Set();
|
|
1518
|
+
for (const [index, session] of snapshot.sessions.entries()) {
|
|
1519
|
+
if (session.machineId !== snapshot.machineId) {
|
|
1520
|
+
context.addIssue({
|
|
1521
|
+
code: "custom",
|
|
1522
|
+
message: "Session machineId must match snapshot machineId",
|
|
1523
|
+
path: ["sessions", index, "machineId"]
|
|
1524
|
+
});
|
|
1525
|
+
}
|
|
1526
|
+
if (session.userId !== snapshot.userId) {
|
|
1527
|
+
context.addIssue({
|
|
1528
|
+
code: "custom",
|
|
1529
|
+
message: "Session userId must match snapshot userId",
|
|
1530
|
+
path: ["sessions", index, "userId"]
|
|
1531
|
+
});
|
|
1532
|
+
}
|
|
1533
|
+
if (sessionIds.has(session.sessionId)) {
|
|
1534
|
+
context.addIssue({
|
|
1535
|
+
code: "custom",
|
|
1536
|
+
message: "Session IDs must be unique within a snapshot",
|
|
1537
|
+
path: ["sessions", index, "sessionId"]
|
|
1538
|
+
});
|
|
1539
|
+
}
|
|
1540
|
+
sessionIds.add(session.sessionId);
|
|
1541
|
+
}
|
|
1542
|
+
});
|
|
1543
|
+
var SessionListRequestSchema = z22.object({
|
|
1544
|
+
requestId: IdSchema,
|
|
1545
|
+
machineId: IdSchema,
|
|
1546
|
+
cursor: z22.string().min(1).max(1024).optional()
|
|
1547
|
+
});
|
|
1548
|
+
var SessionListResultSchema = z22.discriminatedUnion("ok", [
|
|
1549
|
+
z22.object({
|
|
1550
|
+
ok: z22.literal(true),
|
|
1551
|
+
requestId: IdSchema,
|
|
1552
|
+
machineId: IdSchema,
|
|
1553
|
+
snapshot: SessionsSnapshotSchema
|
|
1554
|
+
}),
|
|
1555
|
+
z22.object({
|
|
1556
|
+
ok: z22.literal(false),
|
|
1557
|
+
requestId: IdSchema,
|
|
1558
|
+
machineId: IdSchema,
|
|
1559
|
+
error: ProtocolFailureSchema
|
|
1560
|
+
})
|
|
1561
|
+
]);
|
|
1562
|
+
var SessionAgentModeSchema = z22.enum([
|
|
1563
|
+
"interactive",
|
|
1564
|
+
"plan",
|
|
1565
|
+
"autopilot"
|
|
1566
|
+
]);
|
|
1567
|
+
var AgentConfigurationOptionSchema = z22.object({
|
|
1568
|
+
id: IdSchema,
|
|
1569
|
+
name: z22.string().trim().min(1).max(260),
|
|
1570
|
+
value: z22.string().min(1).max(256),
|
|
1571
|
+
options: z22.array(z22.object({
|
|
1572
|
+
value: z22.string().min(1).max(256),
|
|
1573
|
+
name: z22.string().trim().min(1).max(260)
|
|
1574
|
+
}).strict()).min(1).max(100)
|
|
1575
|
+
}).strict();
|
|
1576
|
+
var AgentConfigurationChangeSchema = z22.object({
|
|
1577
|
+
id: IdSchema,
|
|
1578
|
+
value: z22.string().min(1).max(256)
|
|
1579
|
+
}).strict();
|
|
1580
|
+
var WorkspaceOptionSchema = z22.object({
|
|
1581
|
+
id: IdSchema,
|
|
1582
|
+
name: z22.string().trim().min(1).max(260),
|
|
1583
|
+
path: z22.string().trim().min(1).max(32768)
|
|
1584
|
+
});
|
|
1585
|
+
var REASONING_EFFORTS = [
|
|
1586
|
+
"low",
|
|
1587
|
+
"medium",
|
|
1588
|
+
"high",
|
|
1589
|
+
"xhigh",
|
|
1590
|
+
"max"
|
|
1591
|
+
];
|
|
1592
|
+
var ReasoningEffortSchema = z22.enum(REASONING_EFFORTS);
|
|
1593
|
+
var CopilotModelOptionSchema = z22.object({
|
|
1594
|
+
id: IdSchema,
|
|
1595
|
+
name: z22.string().trim().min(1).max(260),
|
|
1596
|
+
isDefault: z22.boolean(),
|
|
1597
|
+
supportedReasoningEfforts: z22.array(ReasoningEffortSchema).optional(),
|
|
1598
|
+
defaultReasoningEffort: ReasoningEffortSchema.optional(),
|
|
1599
|
+
creation: z22.object({
|
|
1600
|
+
agentId: IdSchema,
|
|
1601
|
+
agentName: z22.string().trim().min(1).max(260),
|
|
1602
|
+
modelName: z22.string().trim().min(1).max(260),
|
|
1603
|
+
agentModes: z22.array(SessionAgentModeSchema).min(1),
|
|
1604
|
+
reasoningEffortConfigurationSupported: z22.boolean(),
|
|
1605
|
+
isDefault: z22.boolean()
|
|
1606
|
+
}).strict().optional()
|
|
1607
|
+
});
|
|
1608
|
+
var SessionReasoningEffortSchema = z22.enum([
|
|
1609
|
+
"default",
|
|
1610
|
+
...REASONING_EFFORTS
|
|
1611
|
+
]);
|
|
1612
|
+
var CurrentReasoningEffortSchema = z22.string().trim().min(1).max(64);
|
|
1613
|
+
var SessionToolInfoSchema = z22.object({
|
|
1614
|
+
name: z22.string().trim().min(1).max(260),
|
|
1615
|
+
description: z22.string().trim().min(1).max(4096).optional(),
|
|
1616
|
+
deferred: z22.boolean().optional()
|
|
1617
|
+
});
|
|
1618
|
+
var SessionSlashCommandInfoSchema = z22.object({
|
|
1619
|
+
name: z22.string().trim().min(1).max(260),
|
|
1620
|
+
description: z22.string().trim().min(1).max(4096).optional(),
|
|
1621
|
+
kind: z22.enum(["builtin", "skill", "client"])
|
|
1622
|
+
});
|
|
1623
|
+
var SessionSkillInfoSchema = z22.object({
|
|
1624
|
+
name: z22.string().trim().min(1).max(260),
|
|
1625
|
+
description: z22.string().trim().min(1).max(4096).optional(),
|
|
1626
|
+
source: z22.string().trim().min(1).max(260),
|
|
1627
|
+
enabled: z22.boolean(),
|
|
1628
|
+
userInvocable: z22.boolean(),
|
|
1629
|
+
commandName: z22.string().trim().min(1).max(260).optional()
|
|
1630
|
+
});
|
|
1631
|
+
var SessionEnvironmentInfoSchema = z22.object({
|
|
1632
|
+
tools: z22.array(SessionToolInfoSchema).max(512),
|
|
1633
|
+
slashCommands: z22.array(SessionSlashCommandInfoSchema).max(512),
|
|
1634
|
+
skills: z22.array(SessionSkillInfoSchema).max(512)
|
|
1635
|
+
});
|
|
1636
|
+
var SessionOptionsRequestSchema = z22.object({
|
|
1637
|
+
requestId: IdSchema,
|
|
1638
|
+
machineId: IdSchema,
|
|
1639
|
+
sessionId: IdSchema.optional(),
|
|
1640
|
+
workspaceId: IdSchema.optional(),
|
|
1641
|
+
capabilities: z22.array(IdSchema).max(64).optional()
|
|
1642
|
+
});
|
|
1643
|
+
var SessionOptionsResultSchema = z22.discriminatedUnion("ok", [
|
|
1644
|
+
z22.object({
|
|
1645
|
+
ok: z22.literal(true),
|
|
1646
|
+
requestId: IdSchema,
|
|
1647
|
+
machineId: IdSchema,
|
|
1648
|
+
sessionId: IdSchema.optional(),
|
|
1649
|
+
workspaces: z22.array(WorkspaceOptionSchema),
|
|
1650
|
+
models: z22.array(CopilotModelOptionSchema).min(1),
|
|
1651
|
+
modelRefreshError: z22.string().min(1).max(4096).optional(),
|
|
1652
|
+
agentModes: z22.array(SessionAgentModeSchema).min(1),
|
|
1653
|
+
reasoningEffortConfigurationSupported: z22.literal(true).optional(),
|
|
1654
|
+
fileAttachmentsSupported: z22.boolean().optional(),
|
|
1655
|
+
worktreeCreationSupported: z22.literal(true).optional(),
|
|
1656
|
+
worktreeBranches: z22.array(z22.string().min(1).max(1024)).optional(),
|
|
1657
|
+
worktreeCurrentBranch: z22.string().min(1).max(1024).optional(),
|
|
1658
|
+
currentModelId: IdSchema.optional(),
|
|
1659
|
+
currentAgentMode: SessionAgentModeSchema.optional(),
|
|
1660
|
+
currentReasoningEffort: CurrentReasoningEffortSchema.optional(),
|
|
1661
|
+
environment: SessionEnvironmentInfoSchema.optional(),
|
|
1662
|
+
environmentPending: z22.literal(true).optional(),
|
|
1663
|
+
agentName: z22.string().trim().min(1).max(260).optional(),
|
|
1664
|
+
configOptions: z22.array(AgentConfigurationOptionSchema).max(32).optional()
|
|
1665
|
+
}),
|
|
1666
|
+
z22.object({
|
|
1667
|
+
ok: z22.literal(false),
|
|
1668
|
+
requestId: IdSchema,
|
|
1669
|
+
machineId: IdSchema,
|
|
1670
|
+
sessionId: IdSchema.optional(),
|
|
1671
|
+
error: ProtocolFailureSchema,
|
|
1672
|
+
failureStage: z22.enum(["models", "configuration", "workspaces"]).optional(),
|
|
1673
|
+
models: z22.array(CopilotModelOptionSchema).min(1).optional(),
|
|
1674
|
+
agentModes: z22.array(SessionAgentModeSchema).min(1).optional(),
|
|
1675
|
+
reasoningEffortConfigurationSupported: z22.literal(true).optional(),
|
|
1676
|
+
fileAttachmentsSupported: z22.boolean().optional(),
|
|
1677
|
+
currentModelId: IdSchema.optional(),
|
|
1678
|
+
currentAgentMode: SessionAgentModeSchema.optional(),
|
|
1679
|
+
currentReasoningEffort: CurrentReasoningEffortSchema.optional(),
|
|
1680
|
+
agentName: z22.string().trim().min(1).max(260).optional(),
|
|
1681
|
+
configOptions: z22.array(AgentConfigurationOptionSchema).max(32).optional()
|
|
1682
|
+
})
|
|
1683
|
+
]);
|
|
1684
|
+
var SessionCreateRequestSchema = z22.object({
|
|
1685
|
+
requestId: IdSchema,
|
|
1686
|
+
machineId: IdSchema,
|
|
1687
|
+
workspaceId: IdSchema,
|
|
1688
|
+
modelId: IdSchema,
|
|
1689
|
+
agentMode: SessionAgentModeSchema,
|
|
1690
|
+
reasoningEffort: SessionReasoningEffortSchema.optional(),
|
|
1691
|
+
worktree: z22.object({
|
|
1692
|
+
branchName: z22.string().trim().min(1).max(120).optional(),
|
|
1693
|
+
baseBranch: z22.string().trim().min(1).max(1024).optional()
|
|
1694
|
+
}).strict().optional()
|
|
1695
|
+
});
|
|
1696
|
+
var SessionCreateResultSchema = z22.discriminatedUnion("ok", [
|
|
1697
|
+
z22.object({
|
|
1698
|
+
ok: z22.literal(true),
|
|
1699
|
+
requestId: IdSchema,
|
|
1700
|
+
machineId: IdSchema,
|
|
1701
|
+
session: SessionSummarySchema,
|
|
1702
|
+
modelId: IdSchema,
|
|
1703
|
+
agentMode: SessionAgentModeSchema,
|
|
1704
|
+
reasoningEffort: SessionReasoningEffortSchema.optional()
|
|
1705
|
+
}),
|
|
1706
|
+
z22.object({
|
|
1707
|
+
ok: z22.literal(false),
|
|
1708
|
+
requestId: IdSchema,
|
|
1709
|
+
machineId: IdSchema,
|
|
1710
|
+
error: ProtocolFailureSchema
|
|
1711
|
+
})
|
|
1712
|
+
]);
|
|
1713
|
+
var SessionDeleteRequestSchema = z22.object({
|
|
1714
|
+
requestId: IdSchema,
|
|
1715
|
+
machineId: IdSchema,
|
|
1716
|
+
sessionId: IdSchema
|
|
1717
|
+
}).strict();
|
|
1718
|
+
var SessionDeleteResultSchema = z22.discriminatedUnion("ok", [
|
|
1719
|
+
z22.object({
|
|
1720
|
+
ok: z22.literal(true),
|
|
1721
|
+
requestId: IdSchema,
|
|
1722
|
+
machineId: IdSchema,
|
|
1723
|
+
sessionId: IdSchema
|
|
1724
|
+
}).strict(),
|
|
1725
|
+
z22.object({
|
|
1726
|
+
ok: z22.literal(false),
|
|
1727
|
+
requestId: IdSchema,
|
|
1728
|
+
machineId: IdSchema,
|
|
1729
|
+
sessionId: IdSchema,
|
|
1730
|
+
error: ProtocolFailureSchema
|
|
1731
|
+
}).strict()
|
|
1732
|
+
]);
|
|
1733
|
+
var SessionConfigureRequestSchema = z22.object({
|
|
1734
|
+
requestId: IdSchema,
|
|
1735
|
+
machineId: IdSchema,
|
|
1736
|
+
sessionId: IdSchema,
|
|
1737
|
+
modelId: IdSchema.optional(),
|
|
1738
|
+
agentMode: SessionAgentModeSchema.optional(),
|
|
1739
|
+
reasoningEffort: SessionReasoningEffortSchema.optional(),
|
|
1740
|
+
configOption: AgentConfigurationChangeSchema.optional()
|
|
1741
|
+
}).refine((request) => request.modelId !== void 0 || request.agentMode !== void 0 || request.reasoningEffort !== void 0 || request.configOption !== void 0, { message: "A modelId, agentMode, reasoningEffort, or configOption change is required" });
|
|
1742
|
+
var SessionConfigureResultSchema = z22.discriminatedUnion("ok", [
|
|
1743
|
+
z22.object({
|
|
1744
|
+
ok: z22.literal(true),
|
|
1745
|
+
requestId: IdSchema,
|
|
1746
|
+
machineId: IdSchema,
|
|
1747
|
+
sessionId: IdSchema,
|
|
1748
|
+
modelId: IdSchema.optional(),
|
|
1749
|
+
agentMode: SessionAgentModeSchema,
|
|
1750
|
+
reasoningEffort: CurrentReasoningEffortSchema.optional(),
|
|
1751
|
+
configOptions: z22.array(AgentConfigurationOptionSchema).max(32).optional()
|
|
1752
|
+
}),
|
|
1753
|
+
z22.object({
|
|
1754
|
+
ok: z22.literal(false),
|
|
1755
|
+
requestId: IdSchema,
|
|
1756
|
+
machineId: IdSchema,
|
|
1757
|
+
sessionId: IdSchema,
|
|
1758
|
+
error: ProtocolFailureSchema
|
|
1759
|
+
})
|
|
1760
|
+
]);
|
|
1761
|
+
var SessionRemoteActionSchema = z22.enum([
|
|
1762
|
+
"status",
|
|
1763
|
+
"enable",
|
|
1764
|
+
"disable"
|
|
1765
|
+
]);
|
|
1766
|
+
var SessionRemoteStateSchema = z22.enum([
|
|
1767
|
+
"off",
|
|
1768
|
+
"connecting",
|
|
1769
|
+
"active",
|
|
1770
|
+
"error"
|
|
1771
|
+
]);
|
|
1772
|
+
var SessionRemoteRequestSchema = z22.object({
|
|
1773
|
+
requestId: IdSchema,
|
|
1774
|
+
machineId: IdSchema,
|
|
1775
|
+
sessionId: IdSchema,
|
|
1776
|
+
action: SessionRemoteActionSchema
|
|
1777
|
+
});
|
|
1778
|
+
var SessionRemoteStatusSchema = z22.object({
|
|
1779
|
+
state: SessionRemoteStateSchema,
|
|
1780
|
+
attachedSessionId: IdSchema.optional(),
|
|
1781
|
+
url: z22.url().max(32768).optional(),
|
|
1782
|
+
steerable: z22.boolean(),
|
|
1783
|
+
error: ProtocolFailureSchema.optional()
|
|
1784
|
+
});
|
|
1785
|
+
var SessionRemoteResultSchema = z22.discriminatedUnion("ok", [
|
|
1786
|
+
z22.object({
|
|
1787
|
+
ok: z22.literal(true),
|
|
1788
|
+
requestId: IdSchema,
|
|
1789
|
+
machineId: IdSchema,
|
|
1790
|
+
sessionId: IdSchema,
|
|
1791
|
+
status: SessionRemoteStatusSchema
|
|
1792
|
+
}),
|
|
1793
|
+
z22.object({
|
|
1794
|
+
ok: z22.literal(false),
|
|
1795
|
+
requestId: IdSchema,
|
|
1796
|
+
machineId: IdSchema,
|
|
1797
|
+
sessionId: IdSchema,
|
|
1798
|
+
error: ProtocolFailureSchema
|
|
1799
|
+
})
|
|
1800
|
+
]);
|
|
1801
|
+
|
|
1802
|
+
// ../../shared/protocol/dist/sessions/group-chat.js
|
|
1803
|
+
import { z as z23 } from "zod";
|
|
1804
|
+
var GROUP_CHAT_CREATE_OPERATION = "group-chat.create";
|
|
1805
|
+
var GROUP_CHAT_CREATE_VERSION = 1;
|
|
1806
|
+
var GROUP_CHAT_CREATE_CAPABILITY = sessionCommunicationOperationCapability(GROUP_CHAT_CREATE_OPERATION, GROUP_CHAT_CREATE_VERSION);
|
|
1807
|
+
var GroupChatCreateDataSchema = z23.object({
|
|
1808
|
+
peerSessionId: IdSchema
|
|
1809
|
+
}).strict();
|
|
1810
|
+
var GroupChatCreateResultDataSchema = z23.object({
|
|
1811
|
+
session: SessionSummarySchema.refine((session) => session.groupChat !== void 0, "Group creation must return a virtual group session")
|
|
1812
|
+
}).strict();
|
|
1813
|
+
|
|
1814
|
+
// ../../shared/protocol/dist/sessions/prompts.js
|
|
1815
|
+
import { z as z24 } from "zod";
|
|
1816
|
+
var SessionAvatarPersonaSchema = z24.object({
|
|
1817
|
+
role: z24.enum(["designer", "filmmaker", "developer", "secretary", "default"]),
|
|
1818
|
+
displayName: z24.string().trim().min(1).max(40).regex(/^[^\u0000-\u001f\u007f-\u009f]*$/).optional()
|
|
1819
|
+
}).strict().refine((value) => value.role === "default" ? value.displayName === void 0 : value.displayName !== void 0, { message: "A role requires a display name; default must not include one" });
|
|
1820
|
+
var MAX_PROMPT_IMAGE_BYTES = 3 * 1024 * 1024;
|
|
1821
|
+
var SessionPromptRequestSchema = z24.object({
|
|
1822
|
+
requestId: IdSchema,
|
|
1823
|
+
operationId: IdSchema,
|
|
1824
|
+
machineId: IdSchema,
|
|
1825
|
+
sessionId: IdSchema,
|
|
1826
|
+
prompt: z24.string().trim().max(1e5),
|
|
1827
|
+
attachments: z24.array(PromptImageAttachmentSchema).max(4).optional(),
|
|
1828
|
+
fileAttachments: z24.array(PromptFileAttachmentSchema).max(4).optional(),
|
|
1829
|
+
avatarPersona: SessionAvatarPersonaSchema.optional(),
|
|
1830
|
+
mode: z24.enum(["enqueue", "immediate"]).default("enqueue")
|
|
1831
|
+
}).strict().superRefine((request, context) => {
|
|
1832
|
+
if (request.prompt.length === 0 && (request.attachments?.length ?? 0) === 0 && (request.fileAttachments?.length ?? 0) === 0) {
|
|
1833
|
+
context.addIssue({
|
|
1834
|
+
code: "custom",
|
|
1835
|
+
path: ["prompt"],
|
|
1836
|
+
message: "A prompt or attachment is required"
|
|
1837
|
+
});
|
|
1838
|
+
}
|
|
1839
|
+
const attachments = [...request.attachments ?? [], ...request.fileAttachments ?? []];
|
|
1840
|
+
if (attachments.length > 4) {
|
|
1841
|
+
context.addIssue({
|
|
1842
|
+
code: "custom",
|
|
1843
|
+
path: ["fileAttachments"],
|
|
1844
|
+
message: "A prompt supports at most 4 attachments"
|
|
1845
|
+
});
|
|
1846
|
+
}
|
|
1847
|
+
const attachmentBytes = attachments.reduce((total, attachment) => total + attachment.byteLength, 0) ?? 0;
|
|
1848
|
+
if (attachmentBytes > MAX_PROMPT_IMAGE_BYTES) {
|
|
1849
|
+
context.addIssue({
|
|
1850
|
+
code: "custom",
|
|
1851
|
+
path: ["attachments"],
|
|
1852
|
+
message: "Prompt attachments exceed the 3 MiB total limit"
|
|
1853
|
+
});
|
|
1854
|
+
}
|
|
1855
|
+
});
|
|
1856
|
+
var SessionPromptResultSchema = z24.discriminatedUnion("ok", [
|
|
1857
|
+
z24.object({
|
|
1858
|
+
ok: z24.literal(true),
|
|
1859
|
+
requestId: IdSchema,
|
|
1860
|
+
operationId: IdSchema,
|
|
1861
|
+
machineId: IdSchema,
|
|
1862
|
+
sessionId: IdSchema,
|
|
1863
|
+
messageId: IdSchema,
|
|
1864
|
+
mode: z24.enum(["enqueue", "immediate"]),
|
|
1865
|
+
deliveryState: z24.enum(["queued", "processing"]),
|
|
1866
|
+
// Negotiated lower bound from the native event clock. Exact text and history
|
|
1867
|
+
// ownership checks still apply; this is not an identity or proof of persistence.
|
|
1868
|
+
submittedAt: IsoDateSchema.optional()
|
|
1869
|
+
}),
|
|
1870
|
+
z24.object({
|
|
1871
|
+
ok: z24.literal(false),
|
|
1872
|
+
requestId: IdSchema,
|
|
1873
|
+
operationId: IdSchema,
|
|
1874
|
+
machineId: IdSchema,
|
|
1875
|
+
sessionId: IdSchema,
|
|
1876
|
+
error: ProtocolFailureSchema
|
|
1877
|
+
})
|
|
1878
|
+
]);
|
|
1879
|
+
var SessionActivityUpdateSchema = z24.object({
|
|
1880
|
+
userId: IdSchema,
|
|
1881
|
+
machineId: IdSchema,
|
|
1882
|
+
sessionId: IdSchema,
|
|
1883
|
+
state: z24.enum(["working", "idle"]),
|
|
1884
|
+
occurredAt: IsoDateSchema,
|
|
1885
|
+
assistantPreview: SessionAssistantPreviewSchema.optional(),
|
|
1886
|
+
userPreview: SessionUserPreviewSchema.optional()
|
|
1887
|
+
});
|
|
1888
|
+
var SessionAbortRequestSchema = z24.object({
|
|
1889
|
+
requestId: IdSchema,
|
|
1890
|
+
machineId: IdSchema,
|
|
1891
|
+
sessionId: IdSchema
|
|
1892
|
+
});
|
|
1893
|
+
var SessionAbortResultSchema = z24.discriminatedUnion("ok", [
|
|
1894
|
+
z24.object({
|
|
1895
|
+
ok: z24.literal(true),
|
|
1896
|
+
requestId: IdSchema,
|
|
1897
|
+
machineId: IdSchema,
|
|
1898
|
+
sessionId: IdSchema
|
|
1899
|
+
}),
|
|
1900
|
+
z24.object({
|
|
1901
|
+
ok: z24.literal(false),
|
|
1902
|
+
requestId: IdSchema,
|
|
1903
|
+
machineId: IdSchema,
|
|
1904
|
+
sessionId: IdSchema,
|
|
1905
|
+
error: ProtocolFailureSchema
|
|
1906
|
+
})
|
|
1907
|
+
]);
|
|
1908
|
+
|
|
1909
|
+
// ../../shared/protocol/dist/sessions/interactions.js
|
|
1910
|
+
import { z as z25 } from "zod";
|
|
1911
|
+
var InteractionFormFieldSchema = z25.object({
|
|
1912
|
+
id: IdSchema,
|
|
1913
|
+
label: z25.string().trim().min(1).max(1024),
|
|
1914
|
+
description: z25.string().max(2048).optional(),
|
|
1915
|
+
inputType: z25.enum([
|
|
1916
|
+
"text",
|
|
1917
|
+
"number",
|
|
1918
|
+
"integer",
|
|
1919
|
+
"boolean",
|
|
1920
|
+
"select",
|
|
1921
|
+
"multi-select"
|
|
1922
|
+
]),
|
|
1923
|
+
required: z25.boolean(),
|
|
1924
|
+
options: z25.array(z25.string().max(1024)).max(100),
|
|
1925
|
+
defaultValue: z25.union([
|
|
1926
|
+
z25.string().max(4096),
|
|
1927
|
+
z25.number().finite(),
|
|
1928
|
+
z25.boolean(),
|
|
1929
|
+
z25.array(z25.string().max(1024)).max(100)
|
|
1930
|
+
]).optional(),
|
|
1931
|
+
minimum: z25.number().finite().optional(),
|
|
1932
|
+
maximum: z25.number().finite().optional(),
|
|
1933
|
+
minLength: z25.number().int().nonnegative().max(1e6).optional(),
|
|
1934
|
+
maxLength: z25.number().int().nonnegative().max(1e6).optional(),
|
|
1935
|
+
minItems: z25.number().int().nonnegative().max(100).optional(),
|
|
1936
|
+
maxItems: z25.number().int().nonnegative().max(100).optional(),
|
|
1937
|
+
format: z25.enum(["email", "uri", "date", "date-time"]).optional()
|
|
1938
|
+
}).strict();
|
|
1939
|
+
var InteractionPermissionRequestSchema = z25.object({
|
|
1940
|
+
kind: z25.literal("permission"),
|
|
1941
|
+
permissionKind: IdSchema,
|
|
1942
|
+
title: z25.string().trim().min(1).max(256),
|
|
1943
|
+
description: z25.string().max(4096),
|
|
1944
|
+
canApproveSession: z25.boolean(),
|
|
1945
|
+
canApproveAlways: z25.boolean().optional(),
|
|
1946
|
+
approvalScope: z25.string().trim().min(1).max(4096).optional()
|
|
1947
|
+
}).strict();
|
|
1948
|
+
var InteractionUserInputRequestSchema = z25.object({
|
|
1949
|
+
kind: z25.literal("user_input"),
|
|
1950
|
+
question: z25.string().trim().min(1).max(4096),
|
|
1951
|
+
choices: z25.array(z25.string().max(1024)).max(100),
|
|
1952
|
+
allowFreeform: z25.boolean()
|
|
1953
|
+
}).strict();
|
|
1954
|
+
var InteractionElicitationRequestSchema = z25.object({
|
|
1955
|
+
kind: z25.literal("elicitation"),
|
|
1956
|
+
message: z25.string().trim().min(1).max(4096),
|
|
1957
|
+
mode: z25.enum(["form", "url"]),
|
|
1958
|
+
source: z25.string().trim().min(1).max(256).optional(),
|
|
1959
|
+
url: z25.url().max(32768).optional(),
|
|
1960
|
+
fields: z25.array(InteractionFormFieldSchema).max(100)
|
|
1961
|
+
}).strict();
|
|
1962
|
+
var InteractionMcpOauthRequestSchema = z25.object({
|
|
1963
|
+
kind: z25.literal("mcp_oauth"),
|
|
1964
|
+
serverName: z25.string().trim().min(1).max(256),
|
|
1965
|
+
serverUrl: z25.url().max(32768),
|
|
1966
|
+
reason: z25.enum(["initial", "refresh", "reauth", "upscope"]),
|
|
1967
|
+
responseMode: z25.literal("cancel-only")
|
|
1968
|
+
}).strict();
|
|
1969
|
+
var InteractionMcpHeadersRequestSchema = z25.object({
|
|
1970
|
+
kind: z25.literal("mcp_headers"),
|
|
1971
|
+
serverName: z25.string().trim().min(1).max(256),
|
|
1972
|
+
serverUrl: z25.url().max(32768),
|
|
1973
|
+
reason: z25.string().trim().min(1).max(256),
|
|
1974
|
+
responseMode: z25.literal("none-only")
|
|
1975
|
+
}).strict();
|
|
1976
|
+
var InteractionAutoModeSwitchRequestSchema = z25.object({
|
|
1977
|
+
kind: z25.literal("auto_mode_switch"),
|
|
1978
|
+
errorCode: IdSchema.optional(),
|
|
1979
|
+
retryAfterSeconds: z25.number().int().nonnegative().optional()
|
|
1980
|
+
}).strict();
|
|
1981
|
+
var InteractionSessionLimitsRequestSchema = z25.object({
|
|
1982
|
+
kind: z25.literal("session_limits"),
|
|
1983
|
+
maxAiCredits: z25.number().finite().nonnegative(),
|
|
1984
|
+
usedAiCredits: z25.number().finite().nonnegative()
|
|
1985
|
+
}).strict();
|
|
1986
|
+
var InteractionExitPlanRequestSchema = z25.object({
|
|
1987
|
+
kind: z25.literal("exit_plan"),
|
|
1988
|
+
summary: z25.string().max(4096),
|
|
1989
|
+
planContent: z25.string().max(1e5).optional(),
|
|
1990
|
+
actions: z25.array(IdSchema).min(1).max(20),
|
|
1991
|
+
recommendedAction: IdSchema
|
|
1992
|
+
}).strict();
|
|
1993
|
+
var InteractionRequestSchema = z25.discriminatedUnion("kind", [
|
|
1994
|
+
InteractionPermissionRequestSchema,
|
|
1995
|
+
InteractionUserInputRequestSchema,
|
|
1996
|
+
InteractionElicitationRequestSchema,
|
|
1997
|
+
InteractionMcpOauthRequestSchema,
|
|
1998
|
+
InteractionMcpHeadersRequestSchema,
|
|
1999
|
+
InteractionAutoModeSwitchRequestSchema,
|
|
2000
|
+
InteractionSessionLimitsRequestSchema,
|
|
2001
|
+
InteractionExitPlanRequestSchema
|
|
2002
|
+
]);
|
|
2003
|
+
var InteractionPermissionResponseSchema = z25.object({
|
|
2004
|
+
kind: z25.literal("permission"),
|
|
2005
|
+
decision: z25.enum(["approve-once", "approve-for-session", "approve-always", "reject"]),
|
|
2006
|
+
feedback: z25.string().trim().min(1).max(2048).optional()
|
|
2007
|
+
}).strict();
|
|
2008
|
+
var InteractionUserInputResponseSchema = z25.object({
|
|
2009
|
+
kind: z25.literal("user_input"),
|
|
2010
|
+
answer: z25.string().max(1e5),
|
|
2011
|
+
wasFreeform: z25.boolean()
|
|
2012
|
+
}).strict();
|
|
2013
|
+
var InteractionFieldValueSchema = z25.union([
|
|
2014
|
+
z25.string().max(4096),
|
|
2015
|
+
z25.number(),
|
|
2016
|
+
z25.boolean(),
|
|
2017
|
+
z25.array(z25.string().max(1024)).max(100)
|
|
2018
|
+
]);
|
|
2019
|
+
var InteractionElicitationResponseSchema = z25.object({
|
|
2020
|
+
kind: z25.literal("elicitation"),
|
|
2021
|
+
action: z25.enum(["accept", "decline", "cancel"]),
|
|
2022
|
+
values: z25.record(z25.string().max(256), InteractionFieldValueSchema)
|
|
2023
|
+
}).strict();
|
|
2024
|
+
var InteractionMcpOauthResponseSchema = z25.object({
|
|
2025
|
+
kind: z25.literal("mcp_oauth"),
|
|
2026
|
+
action: z25.literal("cancel")
|
|
2027
|
+
}).strict();
|
|
2028
|
+
var InteractionMcpHeadersResponseSchema = z25.object({
|
|
2029
|
+
kind: z25.literal("mcp_headers"),
|
|
2030
|
+
action: z25.literal("none")
|
|
2031
|
+
}).strict();
|
|
2032
|
+
var InteractionAutoModeSwitchResponseSchema = z25.object({
|
|
2033
|
+
kind: z25.literal("auto_mode_switch"),
|
|
2034
|
+
action: z25.enum(["yes", "yes_always", "no"])
|
|
2035
|
+
}).strict();
|
|
2036
|
+
var InteractionSessionLimitsResponseSchema = z25.object({
|
|
2037
|
+
kind: z25.literal("session_limits"),
|
|
2038
|
+
action: z25.enum(["add", "set", "unset", "cancel"]),
|
|
2039
|
+
additionalAiCredits: z25.number().positive().optional(),
|
|
2040
|
+
maxAiCredits: z25.number().positive().optional()
|
|
2041
|
+
}).strict().superRefine((response, context) => {
|
|
2042
|
+
if (response.action === "add" && response.additionalAiCredits === void 0) {
|
|
2043
|
+
context.addIssue({
|
|
2044
|
+
code: z25.ZodIssueCode.custom,
|
|
2045
|
+
path: ["additionalAiCredits"],
|
|
2046
|
+
message: "additionalAiCredits is required for add"
|
|
2047
|
+
});
|
|
2048
|
+
}
|
|
2049
|
+
if (response.action === "set" && response.maxAiCredits === void 0) {
|
|
2050
|
+
context.addIssue({
|
|
2051
|
+
code: z25.ZodIssueCode.custom,
|
|
2052
|
+
path: ["maxAiCredits"],
|
|
2053
|
+
message: "maxAiCredits is required for set"
|
|
2054
|
+
});
|
|
2055
|
+
}
|
|
2056
|
+
if (response.action !== "add" && response.additionalAiCredits !== void 0) {
|
|
2057
|
+
context.addIssue({
|
|
2058
|
+
code: z25.ZodIssueCode.custom,
|
|
2059
|
+
path: ["additionalAiCredits"],
|
|
2060
|
+
message: "additionalAiCredits is only valid for add"
|
|
2061
|
+
});
|
|
2062
|
+
}
|
|
2063
|
+
if (response.action !== "set" && response.maxAiCredits !== void 0) {
|
|
2064
|
+
context.addIssue({
|
|
2065
|
+
code: z25.ZodIssueCode.custom,
|
|
2066
|
+
path: ["maxAiCredits"],
|
|
2067
|
+
message: "maxAiCredits is only valid for set"
|
|
2068
|
+
});
|
|
2069
|
+
}
|
|
2070
|
+
});
|
|
2071
|
+
var InteractionExitPlanResponseSchema = z25.object({
|
|
2072
|
+
kind: z25.literal("exit_plan"),
|
|
2073
|
+
approved: z25.boolean(),
|
|
2074
|
+
selectedAction: IdSchema.optional(),
|
|
2075
|
+
feedback: z25.string().trim().min(1).max(4096).optional()
|
|
2076
|
+
}).strict();
|
|
2077
|
+
var InteractionResponseSchema = z25.discriminatedUnion("kind", [
|
|
2078
|
+
InteractionPermissionResponseSchema,
|
|
2079
|
+
InteractionUserInputResponseSchema,
|
|
2080
|
+
InteractionElicitationResponseSchema,
|
|
2081
|
+
InteractionMcpOauthResponseSchema,
|
|
2082
|
+
InteractionMcpHeadersResponseSchema,
|
|
2083
|
+
InteractionAutoModeSwitchResponseSchema,
|
|
2084
|
+
InteractionSessionLimitsResponseSchema,
|
|
2085
|
+
InteractionExitPlanResponseSchema
|
|
2086
|
+
]);
|
|
2087
|
+
var InteractionRequestPayloadSchema = z25.object({
|
|
2088
|
+
interactionRequestId: IdSchema,
|
|
2089
|
+
userId: IdSchema,
|
|
2090
|
+
machineId: IdSchema,
|
|
2091
|
+
sessionId: IdSchema,
|
|
2092
|
+
request: InteractionRequestSchema
|
|
2093
|
+
}).strict();
|
|
2094
|
+
var InteractionRespondRequestSchema = z25.object({
|
|
2095
|
+
requestId: IdSchema,
|
|
2096
|
+
interactionRequestId: IdSchema,
|
|
2097
|
+
machineId: IdSchema,
|
|
2098
|
+
sessionId: IdSchema,
|
|
2099
|
+
response: InteractionResponseSchema
|
|
2100
|
+
}).strict();
|
|
2101
|
+
var InteractionRespondResultSchema = z25.discriminatedUnion("ok", [
|
|
2102
|
+
z25.object({
|
|
2103
|
+
ok: z25.literal(true),
|
|
2104
|
+
requestId: IdSchema,
|
|
2105
|
+
interactionRequestId: IdSchema,
|
|
2106
|
+
machineId: IdSchema,
|
|
2107
|
+
sessionId: IdSchema
|
|
2108
|
+
}).strict(),
|
|
2109
|
+
z25.object({
|
|
2110
|
+
ok: z25.literal(false),
|
|
2111
|
+
requestId: IdSchema,
|
|
2112
|
+
interactionRequestId: IdSchema,
|
|
2113
|
+
machineId: IdSchema,
|
|
2114
|
+
sessionId: IdSchema,
|
|
2115
|
+
error: ProtocolFailureSchema
|
|
2116
|
+
}).strict()
|
|
2117
|
+
]);
|
|
2118
|
+
var PermissionRequestPayloadSchema = z25.object({
|
|
2119
|
+
permissionRequestId: IdSchema,
|
|
2120
|
+
userId: IdSchema,
|
|
2121
|
+
machineId: IdSchema,
|
|
2122
|
+
sessionId: IdSchema,
|
|
2123
|
+
request: z25.record(z25.string(), z25.unknown())
|
|
2124
|
+
});
|
|
2125
|
+
var PermissionRespondRequestSchema = z25.object({
|
|
2126
|
+
requestId: IdSchema,
|
|
2127
|
+
permissionRequestId: IdSchema,
|
|
2128
|
+
machineId: IdSchema,
|
|
2129
|
+
sessionId: IdSchema,
|
|
2130
|
+
decision: z25.enum(["approve-once", "reject"]),
|
|
2131
|
+
feedback: z25.string().trim().min(1).max(2048).optional()
|
|
2132
|
+
});
|
|
2133
|
+
var PermissionRespondResultSchema = z25.discriminatedUnion("ok", [
|
|
2134
|
+
z25.object({
|
|
2135
|
+
ok: z25.literal(true),
|
|
2136
|
+
requestId: IdSchema,
|
|
2137
|
+
permissionRequestId: IdSchema,
|
|
2138
|
+
machineId: IdSchema,
|
|
2139
|
+
sessionId: IdSchema
|
|
2140
|
+
}),
|
|
2141
|
+
z25.object({
|
|
2142
|
+
ok: z25.literal(false),
|
|
2143
|
+
requestId: IdSchema,
|
|
2144
|
+
permissionRequestId: IdSchema,
|
|
2145
|
+
machineId: IdSchema,
|
|
2146
|
+
sessionId: IdSchema,
|
|
2147
|
+
error: ProtocolFailureSchema
|
|
2148
|
+
})
|
|
2149
|
+
]);
|
|
2150
|
+
|
|
2151
|
+
// ../../shared/protocol/dist/conversation/timeline-sync.js
|
|
2152
|
+
import { z as z26 } from "zod";
|
|
2153
|
+
var TIMELINE_SYNC_MAX_EVENTS = 128;
|
|
2154
|
+
var TIMELINE_SYNC_MAX_BYTES = 6 * 1024 * 1024;
|
|
2155
|
+
var TIMELINE_IMAGE_CHUNK_BYTES = 48 * 1024;
|
|
2156
|
+
var TIMELINE_IMAGE_MAX_BYTES = 3 * 1024 * 1024;
|
|
2157
|
+
var identity = z26.string().min(1).max(256);
|
|
2158
|
+
var sequence = z26.number().int().min(0).max(Number.MAX_SAFE_INTEGER);
|
|
2159
|
+
var hash = z26.string().regex(/^[a-f0-9]{64}$/u);
|
|
2160
|
+
var TimelineWatermarkSchema = z26.object({
|
|
2161
|
+
epoch: identity,
|
|
2162
|
+
sequence
|
|
2163
|
+
}).strict();
|
|
2164
|
+
var TimelineSyncRequestSchema = z26.object({
|
|
2165
|
+
watermark: TimelineWatermarkSchema.optional(),
|
|
2166
|
+
waitMs: z26.number().int().min(0).max(2e4).optional(),
|
|
2167
|
+
resume: z26.boolean().optional()
|
|
2168
|
+
}).strict();
|
|
2169
|
+
var TimelineTextAppendSchema = z26.object({
|
|
2170
|
+
itemId: identity,
|
|
2171
|
+
baseRevision: z26.number().int().positive(),
|
|
2172
|
+
revision: z26.number().int().positive(),
|
|
2173
|
+
appendText: z26.string().min(1).max(5e5),
|
|
2174
|
+
sourceEventIds: z26.array(identity).min(1).max(1e3).optional(),
|
|
2175
|
+
sourceMessageIds: z26.array(identity).min(1).max(1e3).optional(),
|
|
2176
|
+
sourceInteractionIds: z26.array(identity).min(1).max(1e3).optional()
|
|
2177
|
+
}).strict();
|
|
2178
|
+
var TimelineSyncEventSchema = z26.discriminatedUnion("kind", [
|
|
2179
|
+
z26.object({ kind: z26.literal("upsert"), sequence, item: ConversationItemSchema }).strict(),
|
|
2180
|
+
z26.object({ kind: z26.literal("append"), sequence, append: TimelineTextAppendSchema }).strict(),
|
|
2181
|
+
z26.object({
|
|
2182
|
+
kind: z26.literal("step"),
|
|
2183
|
+
sequence,
|
|
2184
|
+
upsert: ConversationActivityStepUpsertSchema
|
|
2185
|
+
}).strict()
|
|
2186
|
+
]);
|
|
2187
|
+
var TimelineResyncReasonSchema = z26.enum([
|
|
2188
|
+
"initial",
|
|
2189
|
+
"epoch-changed",
|
|
2190
|
+
"evicted",
|
|
2191
|
+
"gap",
|
|
2192
|
+
"clear",
|
|
2193
|
+
"rewind",
|
|
2194
|
+
"oversized"
|
|
2195
|
+
]);
|
|
2196
|
+
var TimelineSyncResponseSchema = z26.discriminatedUnion("status", [
|
|
2197
|
+
z26.object({
|
|
2198
|
+
status: z26.literal("snapshot"),
|
|
2199
|
+
watermark: TimelineWatermarkSchema,
|
|
2200
|
+
page: SessionTimelinePageSchema
|
|
2201
|
+
}).strict(),
|
|
2202
|
+
z26.object({
|
|
2203
|
+
status: z26.literal("replay"),
|
|
2204
|
+
watermark: TimelineWatermarkSchema,
|
|
2205
|
+
afterSequence: sequence,
|
|
2206
|
+
events: z26.array(TimelineSyncEventSchema).max(TIMELINE_SYNC_MAX_EVENTS),
|
|
2207
|
+
hasMore: z26.boolean()
|
|
2208
|
+
}).strict(),
|
|
2209
|
+
z26.object({
|
|
2210
|
+
status: z26.literal("resync"),
|
|
2211
|
+
epoch: identity,
|
|
2212
|
+
reason: TimelineResyncReasonSchema
|
|
2213
|
+
}).strict()
|
|
2214
|
+
]);
|
|
2215
|
+
var TimelineImageRequestSchema = z26.object({
|
|
2216
|
+
sha256: hash,
|
|
2217
|
+
offset: z26.number().int().min(0).max(TIMELINE_IMAGE_MAX_BYTES - 1)
|
|
2218
|
+
}).strict();
|
|
2219
|
+
var TimelineImageChunkSchema = z26.object({
|
|
2220
|
+
sha256: hash,
|
|
2221
|
+
offset: z26.number().int().min(0).max(TIMELINE_IMAGE_MAX_BYTES - 1),
|
|
2222
|
+
totalBytes: z26.number().int().positive().max(TIMELINE_IMAGE_MAX_BYTES),
|
|
2223
|
+
mimeType: z26.enum(["image/gif", "image/jpeg", "image/png", "image/webp"]),
|
|
2224
|
+
data: z26.string().min(4).max(Math.ceil(TIMELINE_IMAGE_CHUNK_BYTES / 3) * 4).regex(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/u),
|
|
2225
|
+
eof: z26.boolean()
|
|
2226
|
+
}).strict().superRefine((chunk, context) => {
|
|
2227
|
+
const padding = chunk.data.endsWith("==") ? 2 : chunk.data.endsWith("=") ? 1 : 0;
|
|
2228
|
+
const length = chunk.data.length / 4 * 3 - padding;
|
|
2229
|
+
const end = chunk.offset + length;
|
|
2230
|
+
if (end > chunk.totalBytes || chunk.eof !== (end === chunk.totalBytes) || !chunk.eof && length !== TIMELINE_IMAGE_CHUNK_BYTES) {
|
|
2231
|
+
context.addIssue({ code: "custom", message: "Image chunk length or completion does not match its total" });
|
|
2232
|
+
}
|
|
2233
|
+
});
|
|
2234
|
+
|
|
2235
|
+
// ../../shared/protocol/dist/workbench.js
|
|
2236
|
+
import { z as z28 } from "zod";
|
|
2237
|
+
|
|
2238
|
+
// ../../shared/protocol/dist/schedules.js
|
|
2239
|
+
import { z as z27 } from "zod";
|
|
2240
|
+
var SCHEDULE_OPERATIONS = [
|
|
2241
|
+
"schedule.snapshot",
|
|
2242
|
+
"schedule.create",
|
|
2243
|
+
"schedule.delete",
|
|
2244
|
+
"schedule.draft.dismiss",
|
|
2245
|
+
"schedule.resume"
|
|
2246
|
+
];
|
|
2247
|
+
var Id = z27.string().min(1).max(256);
|
|
2248
|
+
var NativeId = z27.number().int().positive().max(Number.MAX_SAFE_INTEGER);
|
|
2249
|
+
var Time = z27.iso.datetime({ offset: true });
|
|
2250
|
+
var WorkbenchScheduleRuleSchema = z27.discriminatedUnion("kind", [
|
|
2251
|
+
z27.object({ kind: z27.literal("once"), at: Time }).strict(),
|
|
2252
|
+
z27.object({
|
|
2253
|
+
kind: z27.literal("interval"),
|
|
2254
|
+
seconds: z27.number().int().min(10).max(86400),
|
|
2255
|
+
recurring: z27.boolean().optional()
|
|
2256
|
+
}).strict(),
|
|
2257
|
+
z27.object({
|
|
2258
|
+
kind: z27.literal("cron"),
|
|
2259
|
+
expression: z27.string().trim().min(9).max(256).regex(/^\S+(?: +\S+){4}$/),
|
|
2260
|
+
timezone: z27.string().min(1).max(128).regex(/^[A-Za-z0-9_+./-]+$/)
|
|
2261
|
+
}).strict()
|
|
2262
|
+
]);
|
|
2263
|
+
var Content = {
|
|
2264
|
+
rule: WorkbenchScheduleRuleSchema,
|
|
2265
|
+
prompt: z27.string().max(16e3).describe("The execution prompt, or ONLY the user's exact arguments when skill is set. Do not include the skill name, slash prefix, scheduling instructions, or extra explanation in skill arguments."),
|
|
2266
|
+
skill: z27.string().min(1).max(256).regex(/^[A-Za-z0-9][A-Za-z0-9_.:-]*$/).optional().describe("A genuine callable skill name from this session, without the leading slash. Set this field when the user requests a skill; put only its exact arguments in prompt.")
|
|
2267
|
+
};
|
|
2268
|
+
var WorkbenchScheduleProposalSchema = z27.object(Content).strict().refine((value) => value.prompt.trim().length > 0 || value.skill !== void 0, { message: "A prompt or skill is required" });
|
|
2269
|
+
var WorkbenchScheduleDraftSchema = z27.object({
|
|
2270
|
+
id: z27.uuid(),
|
|
2271
|
+
createdAt: Time,
|
|
2272
|
+
...Content
|
|
2273
|
+
}).strict();
|
|
2274
|
+
var WorkbenchScheduleEntrySchema = z27.object({
|
|
2275
|
+
id: NativeId,
|
|
2276
|
+
prompt: z27.string().max(1e5),
|
|
2277
|
+
displayPrompt: z27.string().max(1e5).optional(),
|
|
2278
|
+
recurring: z27.boolean(),
|
|
2279
|
+
nextRunAt: Time,
|
|
2280
|
+
intervalMs: z27.number().int().positive().optional(),
|
|
2281
|
+
cron: z27.string().max(256).optional(),
|
|
2282
|
+
timezone: z27.string().max(128).optional(),
|
|
2283
|
+
at: Time.optional()
|
|
2284
|
+
}).strict();
|
|
2285
|
+
var WorkbenchScheduleResultSchema = z27.object({
|
|
2286
|
+
id: Id,
|
|
2287
|
+
scheduleId: NativeId,
|
|
2288
|
+
triggerEventId: Id,
|
|
2289
|
+
time: Time,
|
|
2290
|
+
prompt: z27.string().max(16e3),
|
|
2291
|
+
status: z27.enum(["reply", "error", "merged", "pending", "unknown"]),
|
|
2292
|
+
reply: z27.string().max(16e3).optional(),
|
|
2293
|
+
replyEventId: Id.optional(),
|
|
2294
|
+
error: z27.string().max(1024).optional()
|
|
2295
|
+
}).strict();
|
|
2296
|
+
var WorkbenchScheduleSnapshotSchema = z27.object({
|
|
2297
|
+
state: z27.enum(["active", "needs-resume"]),
|
|
2298
|
+
workingDirectory: z27.string().max(32768).optional(),
|
|
2299
|
+
timezone: z27.string().max(128).optional(),
|
|
2300
|
+
entries: z27.array(WorkbenchScheduleEntrySchema).max(256),
|
|
2301
|
+
drafts: z27.array(WorkbenchScheduleDraftSchema).max(100),
|
|
2302
|
+
results: z27.array(WorkbenchScheduleResultSchema).max(100),
|
|
2303
|
+
historyTruncated: z27.boolean(),
|
|
2304
|
+
sampledAt: Time
|
|
2305
|
+
}).strict();
|
|
2306
|
+
var Submission = {
|
|
2307
|
+
operationId: z27.uuid(),
|
|
2308
|
+
operationCreatedAt: z27.iso.datetime(),
|
|
2309
|
+
expectedAgentRunId: Id
|
|
2310
|
+
};
|
|
2311
|
+
var WorkbenchScheduleCreateRequestSchema = z27.object({
|
|
2312
|
+
...Submission,
|
|
2313
|
+
...Content,
|
|
2314
|
+
draftId: z27.uuid().optional()
|
|
2315
|
+
}).strict().refine((value) => value.prompt.trim().length > 0 || value.skill !== void 0, { message: "A prompt or skill is required" });
|
|
2316
|
+
var WorkbenchScheduleCreateResultSchema = z27.object({
|
|
2317
|
+
snapshot: WorkbenchScheduleSnapshotSchema,
|
|
2318
|
+
verified: z27.boolean()
|
|
2319
|
+
}).strict();
|
|
2320
|
+
var WorkbenchScheduleDeleteRequestSchema = z27.object({
|
|
2321
|
+
...Submission,
|
|
2322
|
+
id: NativeId
|
|
2323
|
+
}).strict();
|
|
2324
|
+
var WorkbenchScheduleDeleteResultSchema = z27.object({
|
|
2325
|
+
snapshot: WorkbenchScheduleSnapshotSchema,
|
|
2326
|
+
removed: z27.boolean()
|
|
2327
|
+
}).strict();
|
|
2328
|
+
var WorkbenchScheduleDraftDismissRequestSchema = z27.object({
|
|
2329
|
+
...Submission,
|
|
2330
|
+
draftId: z27.uuid()
|
|
2331
|
+
}).strict();
|
|
2332
|
+
var ScheduleAndroidSchemas = {
|
|
2333
|
+
WorkbenchScheduleRule: WorkbenchScheduleRuleSchema,
|
|
2334
|
+
WorkbenchScheduleProposal: WorkbenchScheduleProposalSchema,
|
|
2335
|
+
WorkbenchScheduleDraft: WorkbenchScheduleDraftSchema,
|
|
2336
|
+
WorkbenchScheduleEntry: WorkbenchScheduleEntrySchema,
|
|
2337
|
+
WorkbenchScheduleResult: WorkbenchScheduleResultSchema,
|
|
2338
|
+
WorkbenchScheduleSnapshot: WorkbenchScheduleSnapshotSchema,
|
|
2339
|
+
WorkbenchScheduleCreateRequest: WorkbenchScheduleCreateRequestSchema,
|
|
2340
|
+
WorkbenchScheduleCreateResult: WorkbenchScheduleCreateResultSchema,
|
|
2341
|
+
WorkbenchScheduleDeleteRequest: WorkbenchScheduleDeleteRequestSchema,
|
|
2342
|
+
WorkbenchScheduleDeleteResult: WorkbenchScheduleDeleteResultSchema,
|
|
2343
|
+
WorkbenchScheduleDraftDismissRequest: WorkbenchScheduleDraftDismissRequestSchema
|
|
2344
|
+
};
|
|
2345
|
+
|
|
2346
|
+
// ../../shared/protocol/dist/workbench.js
|
|
2347
|
+
var Id2 = z28.string().trim().min(1).max(256);
|
|
2348
|
+
var Text = z28.string().max(1e5);
|
|
2349
|
+
var Count = z28.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);
|
|
2350
|
+
var Failure = z28.object({ code: Id2, message: z28.string().min(1).max(1024) }).strict();
|
|
2351
|
+
var WORKBENCH_OPERATIONS = [
|
|
2352
|
+
"operation.get",
|
|
2353
|
+
"question.ask",
|
|
2354
|
+
"research.create",
|
|
2355
|
+
"research.list",
|
|
2356
|
+
"research.timeline",
|
|
2357
|
+
"research.send",
|
|
2358
|
+
"research.abort",
|
|
2359
|
+
"research.delete",
|
|
2360
|
+
"command.list",
|
|
2361
|
+
"command.invoke",
|
|
2362
|
+
"queue.snapshot",
|
|
2363
|
+
"queue.mutate",
|
|
2364
|
+
"insights.read",
|
|
2365
|
+
"context.compact",
|
|
2366
|
+
...SCHEDULE_OPERATIONS
|
|
2367
|
+
];
|
|
2368
|
+
var Submission2 = {
|
|
2369
|
+
operationId: z28.uuid(),
|
|
2370
|
+
operationCreatedAt: z28.iso.datetime(),
|
|
2371
|
+
expectedAgentRunId: Id2
|
|
2372
|
+
};
|
|
2373
|
+
var WorkbenchOperationGetSchema = z28.object({ operationId: z28.uuid() }).strict();
|
|
2374
|
+
var WorkbenchOperationStatusSchema = z28.object({
|
|
2375
|
+
operationId: z28.uuid(),
|
|
2376
|
+
operation: z28.enum(WORKBENCH_OPERATIONS),
|
|
2377
|
+
agentRunId: Id2,
|
|
2378
|
+
state: z28.enum(["running", "succeeded", "failed", "uncertain", "result-expired"]),
|
|
2379
|
+
result: z28.record(z28.string(), z28.json()).optional(),
|
|
2380
|
+
error: Failure.optional()
|
|
2381
|
+
}).strict().superRefine((value, context) => {
|
|
2382
|
+
if (value.state === "succeeded" !== (value.result !== void 0) || (value.state === "failed" || value.state === "uncertain") !== (value.error !== void 0)) {
|
|
2383
|
+
context.addIssue({ code: "custom", message: "Invalid operation state payload" });
|
|
2384
|
+
}
|
|
2385
|
+
});
|
|
2386
|
+
var WorkbenchAskRequestSchema = z28.object({
|
|
2387
|
+
...Submission2,
|
|
2388
|
+
question: z28.string().trim().min(1).max(16e3)
|
|
2389
|
+
}).strict();
|
|
2390
|
+
var WorkbenchAskResultSchema = z28.object({ answer: Text }).strict();
|
|
2391
|
+
var WorkbenchEmptyRequestSchema = z28.object({}).strict();
|
|
2392
|
+
var WorkbenchSubmitRequestSchema = z28.object(Submission2).strict();
|
|
2393
|
+
var WorkbenchResearchCreateRequestSchema = z28.object({
|
|
2394
|
+
...Submission2,
|
|
2395
|
+
title: z28.string().trim().min(1).max(120),
|
|
2396
|
+
question: z28.string().trim().min(1).max(16e3),
|
|
2397
|
+
sourceItemId: Id2.optional(),
|
|
2398
|
+
deferInitialPrompt: z28.literal(true).optional()
|
|
2399
|
+
}).strict();
|
|
2400
|
+
var WorkbenchResearchThreadSchema = z28.object({
|
|
2401
|
+
sessionId: Id2,
|
|
2402
|
+
parentSessionId: Id2,
|
|
2403
|
+
title: z28.string().min(1).max(120),
|
|
2404
|
+
createdAt: z28.iso.datetime(),
|
|
2405
|
+
contextAnchor: Id2.optional(),
|
|
2406
|
+
contextTruncated: z28.boolean(),
|
|
2407
|
+
detached: z28.boolean(),
|
|
2408
|
+
state: z28.enum(["creating", "ready", "failed"])
|
|
2409
|
+
}).strict();
|
|
2410
|
+
var WorkbenchResearchCreateResultSchema = z28.object({
|
|
2411
|
+
thread: WorkbenchResearchThreadSchema
|
|
2412
|
+
}).strict();
|
|
2413
|
+
var WorkbenchResearchListResultSchema = z28.object({
|
|
2414
|
+
threads: z28.array(WorkbenchResearchThreadSchema).max(100)
|
|
2415
|
+
}).strict();
|
|
2416
|
+
var WorkbenchResearchTimelineRequestSchema = z28.object({
|
|
2417
|
+
cursor: Id2.optional()
|
|
2418
|
+
}).strict();
|
|
2419
|
+
var WorkbenchResearchSendRequestSchema = z28.object({
|
|
2420
|
+
...Submission2,
|
|
2421
|
+
prompt: z28.string().trim().min(1).max(16e3)
|
|
2422
|
+
}).strict();
|
|
2423
|
+
var WorkbenchResearchSendResultSchema = z28.object({ messageId: Id2 }).strict();
|
|
2424
|
+
var WorkbenchCompletedResultSchema = z28.object({ completed: z28.boolean() }).strict();
|
|
2425
|
+
var WorkbenchCommandSchema = z28.object({
|
|
2426
|
+
name: z28.string().min(1).max(260),
|
|
2427
|
+
description: z28.string().max(4096),
|
|
2428
|
+
argumentHint: z28.string().max(1024).optional(),
|
|
2429
|
+
kind: z28.enum(["builtin", "skill", "client"]),
|
|
2430
|
+
allowDuringExecution: z28.boolean(),
|
|
2431
|
+
supported: z28.boolean(),
|
|
2432
|
+
reason: z28.string().max(1024).optional()
|
|
2433
|
+
}).strict();
|
|
2434
|
+
var WorkbenchCommandListResultSchema = z28.object({
|
|
2435
|
+
commands: z28.array(WorkbenchCommandSchema).max(512)
|
|
2436
|
+
}).strict();
|
|
2437
|
+
var WorkbenchCommandInvokeRequestSchema = z28.object({
|
|
2438
|
+
...Submission2,
|
|
2439
|
+
name: z28.string().trim().min(1).max(260),
|
|
2440
|
+
input: z28.string().max(16e3)
|
|
2441
|
+
}).strict();
|
|
2442
|
+
var WorkbenchCommandChoiceSchema = z28.object({
|
|
2443
|
+
name: z28.string().min(1).max(260),
|
|
2444
|
+
label: z28.string().min(1).max(1024),
|
|
2445
|
+
input: z28.string().max(16e3)
|
|
2446
|
+
}).strict();
|
|
2447
|
+
var WorkbenchCommandResultSchema = z28.discriminatedUnion("kind", [
|
|
2448
|
+
z28.object({ kind: z28.literal("text"), text: Text }).strict(),
|
|
2449
|
+
z28.object({ kind: z28.literal("completed") }).strict(),
|
|
2450
|
+
z28.object({ kind: z28.literal("sent"), messageId: Id2 }).strict(),
|
|
2451
|
+
z28.object({
|
|
2452
|
+
kind: z28.literal("select-subcommand"),
|
|
2453
|
+
choices: z28.array(WorkbenchCommandChoiceSchema).min(1).max(100)
|
|
2454
|
+
}).strict()
|
|
2455
|
+
]);
|
|
2456
|
+
var WorkbenchQueueItemSchema = z28.object({
|
|
2457
|
+
id: Id2,
|
|
2458
|
+
kind: z28.string().min(1).max(64),
|
|
2459
|
+
texts: z28.array(z28.string().max(1e5)).min(1).max(100),
|
|
2460
|
+
actions: z28.array(z28.enum(["edit", "remove", "move", "send-now"])).max(4)
|
|
2461
|
+
}).strict();
|
|
2462
|
+
var WorkbenchQueueSnapshotSchema = z28.object({
|
|
2463
|
+
generation: Id2,
|
|
2464
|
+
revision: Id2,
|
|
2465
|
+
items: z28.array(WorkbenchQueueItemSchema).max(512),
|
|
2466
|
+
steeringMessages: z28.array(z28.string().max(1e5)).max(512)
|
|
2467
|
+
}).strict();
|
|
2468
|
+
var QueueMutation = {
|
|
2469
|
+
...Submission2,
|
|
2470
|
+
generation: Id2,
|
|
2471
|
+
revision: Id2,
|
|
2472
|
+
id: Id2
|
|
2473
|
+
};
|
|
2474
|
+
var WorkbenchQueueMutationRequestSchema = z28.discriminatedUnion("action", [
|
|
2475
|
+
z28.object({ ...QueueMutation, action: z28.literal("edit"), prompt: z28.string().trim().min(1).max(1e5) }).strict(),
|
|
2476
|
+
z28.object({ ...QueueMutation, action: z28.literal("remove") }).strict(),
|
|
2477
|
+
z28.object({ ...QueueMutation, action: z28.literal("move"), toPosition: z28.number().int().min(0).max(511) }).strict(),
|
|
2478
|
+
z28.object({ ...QueueMutation, action: z28.literal("send-now") }).strict()
|
|
2479
|
+
]);
|
|
2480
|
+
var WorkbenchQueueMutationResultSchema = z28.object({
|
|
2481
|
+
changed: z28.boolean(),
|
|
2482
|
+
snapshot: WorkbenchQueueSnapshotSchema
|
|
2483
|
+
}).strict();
|
|
2484
|
+
var WorkbenchTokenMetricSchema = z28.object({
|
|
2485
|
+
kind: z28.string().min(1).max(128),
|
|
2486
|
+
count: Count
|
|
2487
|
+
}).strict();
|
|
2488
|
+
var WorkbenchModelUsageSchema = z28.object({
|
|
2489
|
+
model: Id2,
|
|
2490
|
+
requests: Count,
|
|
2491
|
+
premiumRequestCost: z28.number().finite().nonnegative(),
|
|
2492
|
+
tokens: z28.array(WorkbenchTokenMetricSchema).max(32)
|
|
2493
|
+
}).strict();
|
|
2494
|
+
var WorkbenchContextSchema = z28.object({
|
|
2495
|
+
currentTokens: Count,
|
|
2496
|
+
tokenLimit: Count,
|
|
2497
|
+
systemTokens: Count.optional(),
|
|
2498
|
+
conversationTokens: Count.optional(),
|
|
2499
|
+
toolTokens: Count.optional()
|
|
2500
|
+
}).strict();
|
|
2501
|
+
var WorkbenchInsightsSchema = z28.object({
|
|
2502
|
+
sampledAt: z28.iso.datetime(),
|
|
2503
|
+
generation: Id2,
|
|
2504
|
+
model: Id2.optional(),
|
|
2505
|
+
totalUserRequests: Count,
|
|
2506
|
+
premiumRequestCost: z28.number().finite().nonnegative(),
|
|
2507
|
+
nanoAiu: z28.string().regex(/^\d+$/).max(40).optional(),
|
|
2508
|
+
tokens: z28.array(WorkbenchTokenMetricSchema).max(32),
|
|
2509
|
+
models: z28.array(WorkbenchModelUsageSchema).max(100),
|
|
2510
|
+
context: WorkbenchContextSchema.optional(),
|
|
2511
|
+
canCompact: z28.boolean(),
|
|
2512
|
+
compactUnavailableReason: z28.string().max(1024).optional()
|
|
2513
|
+
}).strict();
|
|
2514
|
+
var WorkbenchCompactResultSchema = z28.object({
|
|
2515
|
+
success: z28.boolean(),
|
|
2516
|
+
tokensRemoved: Count,
|
|
2517
|
+
messagesRemoved: Count
|
|
2518
|
+
}).strict();
|
|
2519
|
+
var WorkbenchAndroidSchemas = {
|
|
2520
|
+
WorkbenchOperationGet: WorkbenchOperationGetSchema,
|
|
2521
|
+
WorkbenchOperationStatus: WorkbenchOperationStatusSchema,
|
|
2522
|
+
WorkbenchAskRequest: WorkbenchAskRequestSchema,
|
|
2523
|
+
WorkbenchAskResult: WorkbenchAskResultSchema,
|
|
2524
|
+
WorkbenchSubmitRequest: WorkbenchSubmitRequestSchema,
|
|
2525
|
+
WorkbenchResearchCreateRequest: WorkbenchResearchCreateRequestSchema,
|
|
2526
|
+
WorkbenchResearchThread: WorkbenchResearchThreadSchema,
|
|
2527
|
+
WorkbenchResearchCreateResult: WorkbenchResearchCreateResultSchema,
|
|
2528
|
+
WorkbenchResearchListResult: WorkbenchResearchListResultSchema,
|
|
2529
|
+
WorkbenchResearchTimelineRequest: WorkbenchResearchTimelineRequestSchema,
|
|
2530
|
+
WorkbenchResearchSendRequest: WorkbenchResearchSendRequestSchema,
|
|
2531
|
+
WorkbenchResearchSendResult: WorkbenchResearchSendResultSchema,
|
|
2532
|
+
WorkbenchCompletedResult: WorkbenchCompletedResultSchema,
|
|
2533
|
+
WorkbenchCommand: WorkbenchCommandSchema,
|
|
2534
|
+
WorkbenchCommandListResult: WorkbenchCommandListResultSchema,
|
|
2535
|
+
WorkbenchCommandInvokeRequest: WorkbenchCommandInvokeRequestSchema,
|
|
2536
|
+
WorkbenchCommandChoice: WorkbenchCommandChoiceSchema,
|
|
2537
|
+
WorkbenchCommandResult: WorkbenchCommandResultSchema,
|
|
2538
|
+
WorkbenchQueueItem: WorkbenchQueueItemSchema,
|
|
2539
|
+
WorkbenchQueueSnapshot: WorkbenchQueueSnapshotSchema,
|
|
2540
|
+
WorkbenchQueueMutationRequest: WorkbenchQueueMutationRequestSchema,
|
|
2541
|
+
WorkbenchQueueMutationResult: WorkbenchQueueMutationResultSchema,
|
|
2542
|
+
WorkbenchTokenMetric: WorkbenchTokenMetricSchema,
|
|
2543
|
+
WorkbenchModelUsage: WorkbenchModelUsageSchema,
|
|
2544
|
+
WorkbenchContext: WorkbenchContextSchema,
|
|
2545
|
+
WorkbenchInsights: WorkbenchInsightsSchema,
|
|
2546
|
+
WorkbenchCompactResult: WorkbenchCompactResultSchema
|
|
2547
|
+
};
|
|
2548
|
+
|
|
2549
|
+
// ../../shared/protocol/dist/codegen/android-schemas.js
|
|
2550
|
+
var AndroidProtocolSchemas = {
|
|
2551
|
+
BrowserOpenUrlParams: BrowserOpenUrlParamsSchema,
|
|
2552
|
+
BrowserOpenUrlResult: BrowserOpenUrlResultSchema,
|
|
2553
|
+
TimelineImageBlobRequest: TimelineImageBlobRequestSchema,
|
|
2554
|
+
TimelineImageBlobResult: TimelineImageBlobResultSchema,
|
|
2555
|
+
SessionImageUploadRequest: SessionImageUploadRequestSchema,
|
|
2556
|
+
SessionImageScope: SessionImageScopeSchema,
|
|
2557
|
+
SessionImageUploadResult: SessionImageUploadResultSchema,
|
|
2558
|
+
SessionImageCommitResult: SessionImageCommitResultSchema,
|
|
2559
|
+
SessionImageDownloadResult: SessionImageDownloadResultSchema,
|
|
2560
|
+
...WorkbenchAndroidSchemas,
|
|
2561
|
+
...ScheduleAndroidSchemas,
|
|
2562
|
+
SessionCommunication: SessionCommunicationSchema,
|
|
2563
|
+
SessionGitDiffData: SessionGitDiffDataSchema,
|
|
2564
|
+
SessionGitDiffEntry: SessionGitDiffPartialEntrySchema,
|
|
2565
|
+
SessionGitDiffResultData: SessionGitDiffPartialResultDataSchema,
|
|
2566
|
+
SessionGitDiffFileError: SessionGitDiffFileErrorSchema,
|
|
2567
|
+
SessionGitDiffGzipResultData: SessionGitDiffGzipResultDataSchema,
|
|
2568
|
+
SessionRenameData: SessionRenameDataSchema,
|
|
2569
|
+
SessionRenameResultData: SessionRenameResultDataSchema,
|
|
2570
|
+
SessionDirectoryListData: SessionDirectoryListDataSchema,
|
|
2571
|
+
SessionDirectoryListResultData: SessionDirectoryListResultDataSchema,
|
|
2572
|
+
SessionFileReadData: SessionFileReadDataSchema,
|
|
2573
|
+
SessionFileReadResultData: SessionFileReadResultDataSchema,
|
|
2574
|
+
SessionFileReadV2ResultData: SessionFileReadV2ResultDataSchema,
|
|
2575
|
+
SessionFileDownloadData: SessionFileDownloadDataSchema,
|
|
2576
|
+
SessionFileDownloadResultData: SessionFileDownloadResultDataSchema,
|
|
2577
|
+
SessionResourceReadData: SessionResourceReadDataSchema,
|
|
2578
|
+
SessionResourceReadResultData: SessionResourceReadResultDataSchema,
|
|
2579
|
+
SessionDirectoryListRequest: SessionDirectoryListRequestSchema,
|
|
2580
|
+
SessionDirectoryEntry: SessionDirectoryEntrySchema,
|
|
2581
|
+
SessionDirectoryListResponse: SessionDirectoryListResponseSchema,
|
|
2582
|
+
SessionGitProject: SessionGitProjectSchema,
|
|
2583
|
+
SessionProjectIdentityResultData: SessionProjectIdentityResultDataSchema,
|
|
2584
|
+
V2SocketAuth: V2SocketAuthSchema,
|
|
2585
|
+
SecureMessage: SecureMessageSchema,
|
|
2586
|
+
SecureDeliveryError: SecureDeliveryErrorSchema,
|
|
2587
|
+
AuthUser: AuthUserSchema,
|
|
2588
|
+
LoginRequest: LoginRequestSchema,
|
|
2589
|
+
LoginResult: LoginResultSchema,
|
|
2590
|
+
PcAccountRequest: PcAccountRequestSchema,
|
|
2591
|
+
PcAccountResult: PcAccountResultSchema,
|
|
2592
|
+
PairingExchangeRequest: PairingExchangeRequestSchema,
|
|
2593
|
+
PairingExchangeResult: PairingExchangeResultSchema,
|
|
2594
|
+
MobileTransferMachine: MobileTransferMachineSchema,
|
|
2595
|
+
MobileTransferPayload: MobileTransferPayloadSchema,
|
|
2596
|
+
MobileTransferPart: MobileTransferPartSchema,
|
|
2597
|
+
MobileTransferUploadRequest: MobileTransferUploadRequestSchema,
|
|
2598
|
+
MobileTransferUploadResult: MobileTransferUploadResultSchema,
|
|
2599
|
+
MobileTransferDownloadResult: MobileTransferDownloadResultSchema,
|
|
2600
|
+
MobileLoginRequest: MobileLoginRequestSchema,
|
|
2601
|
+
MachinePresence: MachinePresenceSchema,
|
|
2602
|
+
MachineOffline: MachineOfflineSchema,
|
|
2603
|
+
MachineListRequest: MachineListRequestSchema,
|
|
2604
|
+
MachineListResult: MachineListResultSchema,
|
|
2605
|
+
SessionSummary: SessionSummarySchema,
|
|
2606
|
+
GroupChatParticipant: GroupChatParticipantSchema,
|
|
2607
|
+
GroupChatInfo: GroupChatInfoSchema,
|
|
2608
|
+
GroupChatCreateData: GroupChatCreateDataSchema,
|
|
2609
|
+
GroupChatCreateResultData: GroupChatCreateResultDataSchema,
|
|
2610
|
+
SessionsSnapshot: SessionsSnapshotSchema,
|
|
2611
|
+
SessionListRequest: SessionListRequestSchema,
|
|
2612
|
+
SessionListResult: SessionListResultSchema,
|
|
2613
|
+
WorkspaceOption: WorkspaceOptionSchema,
|
|
2614
|
+
CopilotModelOption: CopilotModelOptionSchema,
|
|
2615
|
+
SessionOptionsRequest: SessionOptionsRequestSchema,
|
|
2616
|
+
SessionOptionsResult: SessionOptionsResultSchema,
|
|
2617
|
+
SessionCreateRequest: SessionCreateRequestSchema,
|
|
2618
|
+
SessionCreateResult: SessionCreateResultSchema,
|
|
2619
|
+
SessionDeleteRequest: SessionDeleteRequestSchema,
|
|
2620
|
+
SessionDeleteResult: SessionDeleteResultSchema,
|
|
2621
|
+
SessionConfigureRequest: SessionConfigureRequestSchema,
|
|
2622
|
+
SessionConfigureResult: SessionConfigureResultSchema,
|
|
2623
|
+
SessionRemoteRequest: SessionRemoteRequestSchema,
|
|
2624
|
+
SessionRemoteStatus: SessionRemoteStatusSchema,
|
|
2625
|
+
SessionRemoteResult: SessionRemoteResultSchema,
|
|
2626
|
+
ConversationAttachment: ConversationAttachmentSchema,
|
|
2627
|
+
PromptImageAttachment: PromptImageAttachmentSchema,
|
|
2628
|
+
ConversationActivityStep: ConversationActivityStepSchema,
|
|
2629
|
+
ConversationPlanTodo: ConversationPlanTodoSchema,
|
|
2630
|
+
ConversationItem: ConversationItemSchema,
|
|
2631
|
+
SessionAssistantPreview: SessionAssistantPreviewSchema,
|
|
2632
|
+
SessionUserPreview: SessionUserPreviewSchema,
|
|
2633
|
+
SessionTimelinePageRequest: SessionTimelinePageRequestSchema,
|
|
2634
|
+
SessionWatchRequest: SessionWatchRequestSchema,
|
|
2635
|
+
SessionWatchResult: SessionWatchResultSchema,
|
|
2636
|
+
SessionTimelinePage: SessionTimelinePageSchema,
|
|
2637
|
+
SessionTimelinePageResult: SessionTimelinePageResultSchema,
|
|
2638
|
+
TimelineWatermark: TimelineWatermarkSchema,
|
|
2639
|
+
TimelineSyncRequest: TimelineSyncRequestSchema,
|
|
2640
|
+
TimelineTextAppend: TimelineTextAppendSchema,
|
|
2641
|
+
TimelineSyncEvent: TimelineSyncEventSchema,
|
|
2642
|
+
TimelineSyncResponse: TimelineSyncResponseSchema,
|
|
2643
|
+
TimelineImageRequest: TimelineImageRequestSchema,
|
|
2644
|
+
TimelineImageChunk: TimelineImageChunkSchema,
|
|
2645
|
+
SessionPromptRequest: SessionPromptRequestSchema,
|
|
2646
|
+
SessionPromptResult: SessionPromptResultSchema,
|
|
2647
|
+
SessionActivityUpdate: SessionActivityUpdateSchema,
|
|
2648
|
+
SessionAbortRequest: SessionAbortRequestSchema,
|
|
2649
|
+
SessionAbortResult: SessionAbortResultSchema,
|
|
2650
|
+
ConversationItemUpsert: ConversationItemUpsertSchema,
|
|
2651
|
+
ConversationActivityStepUpsert: ConversationActivityStepUpsertSchema,
|
|
2652
|
+
SessionTimelineInvalidated: SessionTimelineInvalidatedSchema,
|
|
2653
|
+
InteractionFormField: InteractionFormFieldSchema,
|
|
2654
|
+
InteractionRequest: InteractionRequestSchema,
|
|
2655
|
+
InteractionResponse: InteractionResponseSchema,
|
|
2656
|
+
InteractionRequestPayload: InteractionRequestPayloadSchema,
|
|
2657
|
+
InteractionRespondRequest: InteractionRespondRequestSchema,
|
|
2658
|
+
InteractionRespondResult: InteractionRespondResultSchema,
|
|
2659
|
+
PermissionRequestPayload: PermissionRequestPayloadSchema,
|
|
2660
|
+
PermissionRespondRequest: PermissionRespondRequestSchema,
|
|
2661
|
+
PermissionRespondResult: PermissionRespondResultSchema,
|
|
2662
|
+
ProtocolError: ProtocolErrorSchema
|
|
2663
|
+
};
|
|
2664
|
+
|
|
2665
|
+
export {
|
|
2666
|
+
AuthUserSchema,
|
|
2667
|
+
PcAccountRequestSchema,
|
|
2668
|
+
PcAccountResultSchema,
|
|
2669
|
+
PairingStatusRequestSchema,
|
|
2670
|
+
PcEnrollmentIdSchema,
|
|
2671
|
+
PcEnrollmentStartRequestSchema,
|
|
2672
|
+
PcEnrollmentVerifierRequestSchema,
|
|
2673
|
+
MicrosoftEnrollmentFailureSchema,
|
|
2674
|
+
MicrosoftMutationResultSchema,
|
|
2675
|
+
PcEnrollmentExchangeResultSchema,
|
|
2676
|
+
PcBrowserRedirectUriSchema,
|
|
2677
|
+
PcBrowserAuthorizationStartRequestSchema,
|
|
2678
|
+
PcBrowserAuthorizationStartResultSchema,
|
|
2679
|
+
PcBrowserAuthorizationCallbackSchema,
|
|
2680
|
+
SECURE_MESSAGE_MAX_CIPHERTEXT_LENGTH,
|
|
2681
|
+
SESSION_TIMELINE_PAGE_SIZE,
|
|
2682
|
+
SessionTimelinePageRequestSchema,
|
|
2683
|
+
SessionTimelinePageSchema
|
|
2684
|
+
};
|