@moxt-ai/mobius 0.0.337 → 0.0.338
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +1087 -1037
- package/dist/cli.js.map +4 -4
- package/dist/daemon/upgrades/upgrade.d.ts.map +1 -1
- package/dist/daemon/upgrades/upgrade.js +25 -2
- package/dist/daemon/upgrades/upgrade.js.map +1 -1
- package/dist/runtime.js +860 -830
- package/dist/runtime.js.map +4 -4
- package/dist/session/turn/runtime-turn-activity.d.ts +12 -1
- package/dist/session/turn/runtime-turn-activity.d.ts.map +1 -1
- package/dist/session/turn/runtime-turn-activity.js +52 -26
- package/dist/session/turn/runtime-turn-activity.js.map +1 -1
- package/package.json +2 -2
package/dist/runtime.js
CHANGED
|
@@ -21252,6 +21252,725 @@ var encodeSessionRenameCommand = (message) => encodeZodMessage(message, sessionR
|
|
|
21252
21252
|
var decodeSessionRenamedEvent = (encoded) => decodeZodMessage(encoded, sessionRenamedEventSchema);
|
|
21253
21253
|
var encodeSessionRenamedEvent = (message) => encodeZodMessage(message, sessionRenamedEventSchema);
|
|
21254
21254
|
|
|
21255
|
+
// ../mobius-sdk/src/protocol/shared/tool-input.ts
|
|
21256
|
+
var MAX_CONTENT_LENGTH = 1e6;
|
|
21257
|
+
var MAX_COLLECTION_SIZE = 1e3;
|
|
21258
|
+
var MAX_JSON_DEPTH = 16;
|
|
21259
|
+
var MAX_JSON_KEYS = 1e3;
|
|
21260
|
+
var boundedString = external_exports.string().max(MAX_CONTENT_LENGTH);
|
|
21261
|
+
function boundedJsonIssue(value, depth = 0) {
|
|
21262
|
+
if (depth > MAX_JSON_DEPTH) {
|
|
21263
|
+
return "JSON nesting exceeds the maximum depth";
|
|
21264
|
+
}
|
|
21265
|
+
if (typeof value === "string") {
|
|
21266
|
+
return value.length <= MAX_CONTENT_LENGTH ? null : "JSON string exceeds the maximum length";
|
|
21267
|
+
}
|
|
21268
|
+
if (typeof value === "number") {
|
|
21269
|
+
return Number.isFinite(value) ? null : "JSON number must be finite";
|
|
21270
|
+
}
|
|
21271
|
+
if (typeof value === "boolean" || value === null) {
|
|
21272
|
+
return null;
|
|
21273
|
+
}
|
|
21274
|
+
if (Array.isArray(value)) {
|
|
21275
|
+
if (value.length > MAX_COLLECTION_SIZE) {
|
|
21276
|
+
return "JSON array exceeds the maximum length";
|
|
21277
|
+
}
|
|
21278
|
+
for (const item of value) {
|
|
21279
|
+
const issue2 = boundedJsonIssue(item, depth + 1);
|
|
21280
|
+
if (issue2 !== null) {
|
|
21281
|
+
return issue2;
|
|
21282
|
+
}
|
|
21283
|
+
}
|
|
21284
|
+
return null;
|
|
21285
|
+
}
|
|
21286
|
+
if (typeof value === "object" && value !== void 0) {
|
|
21287
|
+
const entries = Object.entries(value);
|
|
21288
|
+
if (entries.length > MAX_JSON_KEYS) {
|
|
21289
|
+
return "JSON object exceeds the maximum key count";
|
|
21290
|
+
}
|
|
21291
|
+
for (const [key, item] of entries) {
|
|
21292
|
+
if (key.length > 255) {
|
|
21293
|
+
return "JSON key exceeds the maximum length";
|
|
21294
|
+
}
|
|
21295
|
+
const issue2 = boundedJsonIssue(item, depth + 1);
|
|
21296
|
+
if (issue2 !== null) {
|
|
21297
|
+
return issue2;
|
|
21298
|
+
}
|
|
21299
|
+
}
|
|
21300
|
+
return null;
|
|
21301
|
+
}
|
|
21302
|
+
return "Value is not bounded JSON";
|
|
21303
|
+
}
|
|
21304
|
+
var boundedJsonSchema = external_exports.unknown().superRefine((value, context) => {
|
|
21305
|
+
const issue2 = boundedJsonIssue(value);
|
|
21306
|
+
if (issue2 !== null) {
|
|
21307
|
+
context.addIssue({ code: "custom", message: issue2 });
|
|
21308
|
+
}
|
|
21309
|
+
});
|
|
21310
|
+
var toolCallLocationSchema = external_exports.object({
|
|
21311
|
+
line: external_exports.number().int().nonnegative().safe().nullable().optional(),
|
|
21312
|
+
path: boundedString
|
|
21313
|
+
}).readonly();
|
|
21314
|
+
|
|
21315
|
+
// ../mobius-sdk/src/protocol/session/interactions/index.ts
|
|
21316
|
+
var SESSION_PERMISSION_REQUESTED_KIND = "session.permission.requested";
|
|
21317
|
+
var SESSION_PERMISSION_RESPOND_KIND = "session.permission.respond";
|
|
21318
|
+
var SESSION_PERMISSION_RESOLVED_KIND = "session.permission.resolved";
|
|
21319
|
+
var SESSION_ELICITATION_REQUESTED_KIND = "session.elicitation.requested";
|
|
21320
|
+
var SESSION_ELICITATION_RESPOND_KIND = "session.elicitation.respond";
|
|
21321
|
+
var SESSION_ELICITATION_RESOLVED_KIND = "session.elicitation.resolved";
|
|
21322
|
+
var permissionOptionSchema = external_exports.object({
|
|
21323
|
+
kind: external_exports.enum(["allow_once", "allow_always", "reject_once", "reject_always"]),
|
|
21324
|
+
name: external_exports.string().min(1).max(255),
|
|
21325
|
+
optionId: external_exports.string().min(1).max(255)
|
|
21326
|
+
}).readonly();
|
|
21327
|
+
var elicitationOptionSchema = external_exports.object({
|
|
21328
|
+
description: SHORT_TEXT,
|
|
21329
|
+
label: external_exports.string().min(1).max(255),
|
|
21330
|
+
value: external_exports.string().max(500)
|
|
21331
|
+
}).readonly();
|
|
21332
|
+
var elicitationFieldSchema = external_exports.object({
|
|
21333
|
+
defaultBooleanValue: external_exports.boolean(),
|
|
21334
|
+
defaultNumberValue: external_exports.number().finite(),
|
|
21335
|
+
defaultStringValue: external_exports.string().max(1e4),
|
|
21336
|
+
description: SHORT_TEXT,
|
|
21337
|
+
format: external_exports.string().max(64),
|
|
21338
|
+
hasDefaultValue: external_exports.boolean(),
|
|
21339
|
+
maximum: external_exports.string().max(128),
|
|
21340
|
+
maximumLength: external_exports.string().max(128),
|
|
21341
|
+
minimum: external_exports.string().max(128),
|
|
21342
|
+
minimumLength: external_exports.string().max(128),
|
|
21343
|
+
multiline: external_exports.boolean().optional(),
|
|
21344
|
+
name: external_exports.string().min(1).max(128),
|
|
21345
|
+
options: external_exports.array(elicitationOptionSchema).max(200).readonly(),
|
|
21346
|
+
pattern: external_exports.string().max(500),
|
|
21347
|
+
required: external_exports.boolean(),
|
|
21348
|
+
title: external_exports.string().min(1).max(255),
|
|
21349
|
+
type: external_exports.enum(["boolean", "integer", "multiselect", "number", "select", "string"])
|
|
21350
|
+
}).readonly();
|
|
21351
|
+
var sessionPermissionRequestedEventSchema = external_exports.object({
|
|
21352
|
+
commandId: identifierStringSchema,
|
|
21353
|
+
// Absent only for events from older runtimes and saved history.
|
|
21354
|
+
details: external_exports.object({
|
|
21355
|
+
cwd: external_exports.string().min(1).max(4096),
|
|
21356
|
+
rawInput: boundedJsonSchema.optional(),
|
|
21357
|
+
locations: external_exports.array(toolCallLocationSchema).max(1e3).readonly()
|
|
21358
|
+
}).readonly().optional(),
|
|
21359
|
+
interactionId: identifierStringSchema,
|
|
21360
|
+
kind: external_exports.literal(SESSION_PERMISSION_REQUESTED_KIND),
|
|
21361
|
+
options: external_exports.array(permissionOptionSchema).min(1).max(20).readonly(),
|
|
21362
|
+
sessionId: identifierStringSchema,
|
|
21363
|
+
title: external_exports.string().min(1).max(500),
|
|
21364
|
+
toolCallId: external_exports.string().min(1).max(255),
|
|
21365
|
+
toolKind: external_exports.string().max(64)
|
|
21366
|
+
}).readonly();
|
|
21367
|
+
var sessionPermissionRespondCommandSchema = external_exports.object({
|
|
21368
|
+
interactionId: identifierStringSchema,
|
|
21369
|
+
kind: external_exports.literal(SESSION_PERMISSION_RESPOND_KIND),
|
|
21370
|
+
optionId: external_exports.string().max(255),
|
|
21371
|
+
outcome: external_exports.enum(["cancelled", "selected"]),
|
|
21372
|
+
sessionId: identifierStringSchema
|
|
21373
|
+
}).readonly();
|
|
21374
|
+
var sessionPermissionResolvedEventSchema = external_exports.object({
|
|
21375
|
+
interactionId: identifierStringSchema,
|
|
21376
|
+
kind: external_exports.literal(SESSION_PERMISSION_RESOLVED_KIND),
|
|
21377
|
+
optionId: external_exports.string().max(255),
|
|
21378
|
+
outcome: external_exports.enum(["cancelled", "selected"]),
|
|
21379
|
+
sessionId: identifierStringSchema
|
|
21380
|
+
}).readonly();
|
|
21381
|
+
var sessionElicitationRequestedEventSchema = external_exports.object({
|
|
21382
|
+
accepted: external_exports.boolean(),
|
|
21383
|
+
commandId: identifierStringSchema,
|
|
21384
|
+
elicitationId: external_exports.string().max(255),
|
|
21385
|
+
fields: external_exports.array(elicitationFieldSchema).max(100).readonly(),
|
|
21386
|
+
interactionId: identifierStringSchema,
|
|
21387
|
+
kind: external_exports.literal(SESSION_ELICITATION_REQUESTED_KIND),
|
|
21388
|
+
message: external_exports.string().min(1).max(2e3),
|
|
21389
|
+
mode: external_exports.enum(["form", "url"]),
|
|
21390
|
+
sessionId: identifierStringSchema,
|
|
21391
|
+
url: external_exports.string().max(4096)
|
|
21392
|
+
}).readonly();
|
|
21393
|
+
var sessionElicitationRespondCommandSchema = external_exports.object({
|
|
21394
|
+
action: external_exports.enum(["accept", "cancel", "decline"]),
|
|
21395
|
+
content: external_exports.string().max(1e5),
|
|
21396
|
+
interactionId: identifierStringSchema,
|
|
21397
|
+
kind: external_exports.literal(SESSION_ELICITATION_RESPOND_KIND),
|
|
21398
|
+
sessionId: identifierStringSchema
|
|
21399
|
+
}).readonly();
|
|
21400
|
+
var sessionElicitationResolvedEventSchema = external_exports.object({
|
|
21401
|
+
action: external_exports.enum(["accept", "cancel", "decline", "complete"]),
|
|
21402
|
+
interactionId: identifierStringSchema,
|
|
21403
|
+
kind: external_exports.literal(SESSION_ELICITATION_RESOLVED_KIND),
|
|
21404
|
+
sessionId: identifierStringSchema
|
|
21405
|
+
}).readonly();
|
|
21406
|
+
var decodeSessionPermissionRespondCommand = (encoded) => decodeZodMessage(encoded, sessionPermissionRespondCommandSchema);
|
|
21407
|
+
var encodeSessionPermissionRespondCommand = (message) => encodeZodMessage(message, sessionPermissionRespondCommandSchema);
|
|
21408
|
+
var decodeSessionElicitationRespondCommand = (encoded) => decodeZodMessage(encoded, sessionElicitationRespondCommandSchema);
|
|
21409
|
+
var encodeSessionElicitationRespondCommand = (message) => encodeZodMessage(message, sessionElicitationRespondCommandSchema);
|
|
21410
|
+
|
|
21411
|
+
// ../mobius-sdk/src/protocol/session/events/index.ts
|
|
21412
|
+
var MAX_EVENT_COUNT = 1e4;
|
|
21413
|
+
var MAX_COLLECTION_SIZE2 = 1e3;
|
|
21414
|
+
var MAX_CONTENT_LENGTH2 = 1e6;
|
|
21415
|
+
var SESSION_EVENT_KIND = "session.event.v2";
|
|
21416
|
+
var SESSION_EVENT_BATCH_MAX_SIZE = 1e3;
|
|
21417
|
+
var boundedString2 = external_exports.string().max(MAX_CONTENT_LENGTH2);
|
|
21418
|
+
var shortString = external_exports.string().max(2048);
|
|
21419
|
+
var externalContentKeySchema = external_exports.string().regex(/^[a-f0-9]{64}$/u);
|
|
21420
|
+
var annotationsSchema = external_exports.object({
|
|
21421
|
+
audience: external_exports.array(external_exports.enum(["assistant", "user"])).max(2).readonly().nullable().optional(),
|
|
21422
|
+
lastModified: shortString.nullable().optional(),
|
|
21423
|
+
priority: external_exports.number().finite().nullable().optional()
|
|
21424
|
+
}).readonly();
|
|
21425
|
+
var contentFields = { annotations: annotationsSchema.nullable().optional() };
|
|
21426
|
+
var textContentSchema = external_exports.object({ ...contentFields, text: boundedString2, type: external_exports.literal("text") }).readonly();
|
|
21427
|
+
var imageContentSchema = external_exports.object({
|
|
21428
|
+
...contentFields,
|
|
21429
|
+
data: external_exports.string(),
|
|
21430
|
+
mimeType: shortString,
|
|
21431
|
+
type: external_exports.literal("image"),
|
|
21432
|
+
uri: boundedString2.nullable().optional()
|
|
21433
|
+
}).readonly();
|
|
21434
|
+
var audioContentSchema = external_exports.object({ ...contentFields, data: external_exports.string(), mimeType: shortString, type: external_exports.literal("audio") }).readonly();
|
|
21435
|
+
var externalImageContentSchema = external_exports.object({
|
|
21436
|
+
...contentFields,
|
|
21437
|
+
byteLength: external_exports.number().int().positive().safe(),
|
|
21438
|
+
imageKey: externalContentKeySchema,
|
|
21439
|
+
mimeType: shortString,
|
|
21440
|
+
type: external_exports.literal("external_image"),
|
|
21441
|
+
uri: boundedString2.nullable().optional()
|
|
21442
|
+
}).readonly();
|
|
21443
|
+
var externalAudioContentSchema = external_exports.object({
|
|
21444
|
+
...contentFields,
|
|
21445
|
+
audioKey: externalContentKeySchema,
|
|
21446
|
+
byteLength: external_exports.number().int().positive().safe(),
|
|
21447
|
+
mimeType: shortString,
|
|
21448
|
+
type: external_exports.literal("external_audio")
|
|
21449
|
+
}).readonly();
|
|
21450
|
+
var externalResourceContentSchema = external_exports.object({
|
|
21451
|
+
...contentFields,
|
|
21452
|
+
byteLength: external_exports.number().int().positive().safe(),
|
|
21453
|
+
encoding: external_exports.enum(["binary", "text"]),
|
|
21454
|
+
mimeType: shortString.nullable().optional(),
|
|
21455
|
+
resourceKey: externalContentKeySchema,
|
|
21456
|
+
type: external_exports.literal("external_resource"),
|
|
21457
|
+
uri: boundedString2
|
|
21458
|
+
}).readonly();
|
|
21459
|
+
var resourceLinkSchema = external_exports.object({
|
|
21460
|
+
...contentFields,
|
|
21461
|
+
description: boundedString2.nullable().optional(),
|
|
21462
|
+
mimeType: shortString.nullable().optional(),
|
|
21463
|
+
name: shortString,
|
|
21464
|
+
size: external_exports.number().int().nonnegative().safe().nullable().optional(),
|
|
21465
|
+
title: shortString.nullable().optional(),
|
|
21466
|
+
type: external_exports.literal("resource_link"),
|
|
21467
|
+
uri: boundedString2
|
|
21468
|
+
}).readonly();
|
|
21469
|
+
var textResourceSchema = external_exports.object({
|
|
21470
|
+
mimeType: shortString.nullable().optional(),
|
|
21471
|
+
text: boundedString2,
|
|
21472
|
+
uri: boundedString2
|
|
21473
|
+
}).readonly();
|
|
21474
|
+
var blobResourceSchema = external_exports.object({
|
|
21475
|
+
blob: external_exports.string(),
|
|
21476
|
+
mimeType: shortString.nullable().optional(),
|
|
21477
|
+
uri: boundedString2
|
|
21478
|
+
}).readonly();
|
|
21479
|
+
var embeddedResourceSchema = external_exports.object({
|
|
21480
|
+
...contentFields,
|
|
21481
|
+
resource: external_exports.union([textResourceSchema, blobResourceSchema]),
|
|
21482
|
+
type: external_exports.literal("resource")
|
|
21483
|
+
}).readonly();
|
|
21484
|
+
var contentBlockSchema = external_exports.discriminatedUnion("type", [
|
|
21485
|
+
textContentSchema,
|
|
21486
|
+
imageContentSchema,
|
|
21487
|
+
audioContentSchema,
|
|
21488
|
+
resourceLinkSchema,
|
|
21489
|
+
embeddedResourceSchema,
|
|
21490
|
+
externalImageContentSchema,
|
|
21491
|
+
externalAudioContentSchema,
|
|
21492
|
+
externalResourceContentSchema
|
|
21493
|
+
]);
|
|
21494
|
+
var toolCallContentSchema = external_exports.discriminatedUnion("type", [
|
|
21495
|
+
external_exports.object({ content: contentBlockSchema, type: external_exports.literal("content") }).readonly(),
|
|
21496
|
+
external_exports.object({
|
|
21497
|
+
newText: boundedString2,
|
|
21498
|
+
oldText: boundedString2.nullable().optional(),
|
|
21499
|
+
path: boundedString2,
|
|
21500
|
+
type: external_exports.literal("diff")
|
|
21501
|
+
}).readonly(),
|
|
21502
|
+
external_exports.object({ terminalId: shortString, type: external_exports.literal("terminal") }).readonly()
|
|
21503
|
+
]);
|
|
21504
|
+
var toolKindSchema = external_exports.enum([
|
|
21505
|
+
"read",
|
|
21506
|
+
"edit",
|
|
21507
|
+
"delete",
|
|
21508
|
+
"move",
|
|
21509
|
+
"search",
|
|
21510
|
+
"execute",
|
|
21511
|
+
"think",
|
|
21512
|
+
"fetch",
|
|
21513
|
+
"switch_mode",
|
|
21514
|
+
"other"
|
|
21515
|
+
]);
|
|
21516
|
+
var toolStatusSchema = external_exports.enum(["pending", "in_progress", "completed", "failed"]);
|
|
21517
|
+
var backgroundTaskSchema = external_exports.object({
|
|
21518
|
+
id: shortString,
|
|
21519
|
+
status: external_exports.enum(["running", "completed", "failed", "stopped", "unknown"])
|
|
21520
|
+
}).readonly();
|
|
21521
|
+
var toolPatchFields = {
|
|
21522
|
+
backgroundTask: backgroundTaskSchema.optional(),
|
|
21523
|
+
content: external_exports.array(toolCallContentSchema).max(MAX_COLLECTION_SIZE2).readonly().nullable().optional(),
|
|
21524
|
+
kind: toolKindSchema.nullable().optional(),
|
|
21525
|
+
locations: external_exports.array(toolCallLocationSchema).max(MAX_COLLECTION_SIZE2).readonly().nullable().optional(),
|
|
21526
|
+
name: shortString.nullable().optional(),
|
|
21527
|
+
rawInput: boundedJsonSchema.optional(),
|
|
21528
|
+
rawOutput: boundedJsonSchema.optional(),
|
|
21529
|
+
status: toolStatusSchema.nullable().optional(),
|
|
21530
|
+
title: boundedString2.nullable().optional()
|
|
21531
|
+
};
|
|
21532
|
+
var planEntrySchema = external_exports.object({
|
|
21533
|
+
content: boundedString2,
|
|
21534
|
+
priority: external_exports.enum(["high", "medium", "low"]),
|
|
21535
|
+
status: external_exports.enum(["pending", "in_progress", "completed"])
|
|
21536
|
+
}).readonly();
|
|
21537
|
+
var planContentSchema = external_exports.discriminatedUnion("type", [
|
|
21538
|
+
external_exports.object({
|
|
21539
|
+
entries: external_exports.array(planEntrySchema).max(MAX_COLLECTION_SIZE2).readonly(),
|
|
21540
|
+
planId: shortString,
|
|
21541
|
+
type: external_exports.literal("items")
|
|
21542
|
+
}).readonly(),
|
|
21543
|
+
external_exports.object({ planId: shortString, type: external_exports.literal("file"), uri: boundedString2 }).readonly(),
|
|
21544
|
+
external_exports.object({
|
|
21545
|
+
content: boundedString2,
|
|
21546
|
+
planId: shortString,
|
|
21547
|
+
type: external_exports.literal("markdown")
|
|
21548
|
+
}).readonly()
|
|
21549
|
+
]);
|
|
21550
|
+
var commandSchema = external_exports.object({
|
|
21551
|
+
description: boundedString2,
|
|
21552
|
+
input: external_exports.object({ hint: boundedString2 }).readonly().nullable().optional(),
|
|
21553
|
+
name: shortString
|
|
21554
|
+
}).readonly();
|
|
21555
|
+
var configSelectOptionSchema = external_exports.object({
|
|
21556
|
+
description: boundedString2.nullable().optional(),
|
|
21557
|
+
name: shortString,
|
|
21558
|
+
value: shortString
|
|
21559
|
+
}).readonly();
|
|
21560
|
+
var configSelectGroupSchema = external_exports.object({
|
|
21561
|
+
group: shortString,
|
|
21562
|
+
name: shortString,
|
|
21563
|
+
options: external_exports.array(configSelectOptionSchema).max(MAX_COLLECTION_SIZE2).readonly()
|
|
21564
|
+
}).readonly();
|
|
21565
|
+
var configBaseFields = {
|
|
21566
|
+
category: shortString.nullable().optional(),
|
|
21567
|
+
description: boundedString2.nullable().optional(),
|
|
21568
|
+
id: shortString,
|
|
21569
|
+
name: shortString
|
|
21570
|
+
};
|
|
21571
|
+
var sessionConfigOptionSchema2 = external_exports.discriminatedUnion("type", [
|
|
21572
|
+
external_exports.object({
|
|
21573
|
+
...configBaseFields,
|
|
21574
|
+
currentValue: shortString,
|
|
21575
|
+
options: external_exports.union([
|
|
21576
|
+
external_exports.array(configSelectOptionSchema).max(MAX_COLLECTION_SIZE2).readonly(),
|
|
21577
|
+
external_exports.array(configSelectGroupSchema).max(MAX_COLLECTION_SIZE2).readonly()
|
|
21578
|
+
]),
|
|
21579
|
+
type: external_exports.literal("select")
|
|
21580
|
+
}).readonly(),
|
|
21581
|
+
external_exports.object({ ...configBaseFields, currentValue: external_exports.boolean(), type: external_exports.literal("boolean") }).readonly()
|
|
21582
|
+
]);
|
|
21583
|
+
var contentChunkFields = {
|
|
21584
|
+
content: contentBlockSchema,
|
|
21585
|
+
messageId: shortString.nullable().optional()
|
|
21586
|
+
};
|
|
21587
|
+
var acpSessionUpdateSchema = external_exports.discriminatedUnion("sessionUpdate", [
|
|
21588
|
+
external_exports.object({ ...contentChunkFields, sessionUpdate: external_exports.literal("user_message_chunk") }).readonly(),
|
|
21589
|
+
external_exports.object({ ...contentChunkFields, sessionUpdate: external_exports.literal("agent_message_chunk") }).readonly(),
|
|
21590
|
+
external_exports.object({
|
|
21591
|
+
...contentChunkFields,
|
|
21592
|
+
meta: external_exports.object({ truncated: external_exports.boolean().optional() }).readonly().optional(),
|
|
21593
|
+
sessionUpdate: external_exports.literal("agent_thought_chunk")
|
|
21594
|
+
}).readonly(),
|
|
21595
|
+
external_exports.object({
|
|
21596
|
+
backgroundTask: backgroundTaskSchema.optional(),
|
|
21597
|
+
content: external_exports.array(toolCallContentSchema).max(MAX_COLLECTION_SIZE2).readonly().optional(),
|
|
21598
|
+
kind: toolKindSchema.optional(),
|
|
21599
|
+
locations: external_exports.array(toolCallLocationSchema).max(MAX_COLLECTION_SIZE2).readonly().optional(),
|
|
21600
|
+
name: shortString.nullable().optional(),
|
|
21601
|
+
rawInput: boundedJsonSchema.optional(),
|
|
21602
|
+
rawOutput: boundedJsonSchema.optional(),
|
|
21603
|
+
sessionUpdate: external_exports.literal("tool_call"),
|
|
21604
|
+
status: toolStatusSchema.optional(),
|
|
21605
|
+
title: boundedString2,
|
|
21606
|
+
toolCallId: shortString
|
|
21607
|
+
}).readonly(),
|
|
21608
|
+
external_exports.object({ ...toolPatchFields, sessionUpdate: external_exports.literal("tool_call_update"), toolCallId: shortString }).readonly(),
|
|
21609
|
+
external_exports.object({
|
|
21610
|
+
entries: external_exports.array(planEntrySchema).max(MAX_COLLECTION_SIZE2).readonly(),
|
|
21611
|
+
sessionUpdate: external_exports.literal("plan")
|
|
21612
|
+
}).readonly(),
|
|
21613
|
+
external_exports.object({ plan: planContentSchema, sessionUpdate: external_exports.literal("plan_update") }).readonly(),
|
|
21614
|
+
external_exports.object({ planId: shortString, sessionUpdate: external_exports.literal("plan_removed") }).readonly(),
|
|
21615
|
+
external_exports.object({
|
|
21616
|
+
availableCommands: external_exports.array(commandSchema).max(MAX_COLLECTION_SIZE2).readonly(),
|
|
21617
|
+
sessionUpdate: external_exports.literal("available_commands_update")
|
|
21618
|
+
}).readonly(),
|
|
21619
|
+
external_exports.object({
|
|
21620
|
+
currentModeId: shortString,
|
|
21621
|
+
sessionUpdate: external_exports.literal("current_mode_update")
|
|
21622
|
+
}).readonly(),
|
|
21623
|
+
external_exports.object({
|
|
21624
|
+
configOptions: external_exports.array(sessionConfigOptionSchema2).max(MAX_COLLECTION_SIZE2).readonly(),
|
|
21625
|
+
sessionUpdate: external_exports.literal("config_option_update")
|
|
21626
|
+
}).readonly(),
|
|
21627
|
+
external_exports.object({
|
|
21628
|
+
sessionUpdate: external_exports.literal("session_info_update"),
|
|
21629
|
+
title: boundedString2.nullable().optional(),
|
|
21630
|
+
updatedAt: shortString.nullable().optional()
|
|
21631
|
+
}).readonly(),
|
|
21632
|
+
external_exports.object({
|
|
21633
|
+
cost: external_exports.object({ amount: external_exports.number().finite(), currency: external_exports.string().max(16) }).readonly().nullable().optional(),
|
|
21634
|
+
sessionUpdate: external_exports.literal("usage_update"),
|
|
21635
|
+
size: external_exports.number().int().nonnegative().safe(),
|
|
21636
|
+
used: external_exports.number().int().nonnegative().safe()
|
|
21637
|
+
}).readonly(),
|
|
21638
|
+
external_exports.object({
|
|
21639
|
+
compactionId: shortString,
|
|
21640
|
+
error: boundedString2.nullable().optional(),
|
|
21641
|
+
sessionUpdate: external_exports.literal("compaction_update"),
|
|
21642
|
+
status: shortString,
|
|
21643
|
+
summary: external_exports.array(contentBlockSchema).max(MAX_COLLECTION_SIZE2).readonly().nullable().optional()
|
|
21644
|
+
}).readonly(),
|
|
21645
|
+
external_exports.object({
|
|
21646
|
+
compactionId: shortString,
|
|
21647
|
+
content: contentBlockSchema,
|
|
21648
|
+
sessionUpdate: external_exports.literal("compaction_summary_chunk")
|
|
21649
|
+
}).readonly()
|
|
21650
|
+
]);
|
|
21651
|
+
var lifecycleBase = { commandId: identifierStringSchema };
|
|
21652
|
+
var promptExecutionContextSchema = external_exports.object({
|
|
21653
|
+
agentId: identifierStringSchema,
|
|
21654
|
+
directoryId: DIRECTORY_IDENTIFIER,
|
|
21655
|
+
additionalDirectoryIds: external_exports.array(DIRECTORY_IDENTIFIER).max(16).readonly()
|
|
21656
|
+
}).readonly();
|
|
21657
|
+
var lifecycleMetadataSchema = external_exports.discriminatedUnion("kind", [
|
|
21658
|
+
external_exports.object({ kind: external_exports.literal("session.queue.changed") }).readonly(),
|
|
21659
|
+
external_exports.object({ event: sessionPermissionRequestedEventSchema, kind: external_exports.literal("session.permission.requested") }).readonly(),
|
|
21660
|
+
external_exports.object({ event: sessionPermissionResolvedEventSchema, kind: external_exports.literal("session.permission.resolved") }).readonly(),
|
|
21661
|
+
external_exports.object({ event: sessionElicitationRequestedEventSchema, kind: external_exports.literal("session.elicitation.requested") }).readonly(),
|
|
21662
|
+
external_exports.object({ event: sessionElicitationResolvedEventSchema, kind: external_exports.literal("session.elicitation.resolved") }).readonly(),
|
|
21663
|
+
external_exports.object({
|
|
21664
|
+
...lifecycleBase,
|
|
21665
|
+
content: external_exports.array(contentBlockSchema).min(1).max(100).readonly(),
|
|
21666
|
+
disposition: shortString.optional(),
|
|
21667
|
+
kind: external_exports.literal("prompt.requested"),
|
|
21668
|
+
context: promptExecutionContextSchema.optional(),
|
|
21669
|
+
targetCommandId: identifierStringSchema.optional()
|
|
21670
|
+
}).readonly(),
|
|
21671
|
+
external_exports.object({ ...lifecycleBase, attemptId: identifierStringSchema, epoch: identifierStringSchema, kind: external_exports.literal("prompt.started") }).readonly(),
|
|
21672
|
+
external_exports.object({
|
|
21673
|
+
...lifecycleBase,
|
|
21674
|
+
kind: external_exports.literal("prompt.completed"),
|
|
21675
|
+
stopReason: shortString
|
|
21676
|
+
}).readonly(),
|
|
21677
|
+
external_exports.object({
|
|
21678
|
+
...lifecycleBase,
|
|
21679
|
+
code: identifierStringSchema,
|
|
21680
|
+
kind: external_exports.literal("prompt.failed-before-start"),
|
|
21681
|
+
message: external_exports.string().min(1).max(500)
|
|
21682
|
+
}).readonly(),
|
|
21683
|
+
external_exports.object({
|
|
21684
|
+
...lifecycleBase,
|
|
21685
|
+
attemptId: identifierStringSchema,
|
|
21686
|
+
code: identifierStringSchema,
|
|
21687
|
+
kind: external_exports.literal("prompt.failed"),
|
|
21688
|
+
message: external_exports.string().min(1).max(500)
|
|
21689
|
+
}).readonly()
|
|
21690
|
+
]);
|
|
21691
|
+
var sessionEventPayloadSchema = external_exports.discriminatedUnion("type", [
|
|
21692
|
+
external_exports.object({ payload: acpSessionUpdateSchema, type: external_exports.literal("acp") }).readonly(),
|
|
21693
|
+
external_exports.object({ payload: lifecycleMetadataSchema, type: external_exports.literal("lifecycle-metadata") }).readonly()
|
|
21694
|
+
]);
|
|
21695
|
+
var positionSchema = external_exports.string().regex(/^(0|[1-9][0-9]*)$/);
|
|
21696
|
+
var sharedSessionEventFields = {
|
|
21697
|
+
eventId: identifierStringSchema,
|
|
21698
|
+
mobiusMetadata: external_exports.object({ omitted: external_exports.literal(true).optional() }).readonly().optional(),
|
|
21699
|
+
recordedAt: external_exports.iso.datetime({ offset: true }),
|
|
21700
|
+
sessionGenerationId: identifierStringSchema,
|
|
21701
|
+
sessionId: identifierStringSchema
|
|
21702
|
+
};
|
|
21703
|
+
var sessionLiveEventFields = { ...sharedSessionEventFields, position: positionSchema };
|
|
21704
|
+
var sessionEventSchema = external_exports.object({ ...sharedSessionEventFields, payload: acpSessionUpdateSchema, type: external_exports.literal("acp") }).readonly();
|
|
21705
|
+
var sessionLiveEventSchema = external_exports.discriminatedUnion("type", [
|
|
21706
|
+
external_exports.object({ ...sessionLiveEventFields, payload: acpSessionUpdateSchema, type: external_exports.literal("acp") }).readonly(),
|
|
21707
|
+
external_exports.object({
|
|
21708
|
+
...sessionLiveEventFields,
|
|
21709
|
+
payload: lifecycleMetadataSchema,
|
|
21710
|
+
type: external_exports.literal("lifecycle-metadata")
|
|
21711
|
+
}).readonly()
|
|
21712
|
+
]);
|
|
21713
|
+
var wireLifecyclePayloadSchema = external_exports.object({
|
|
21714
|
+
kind: identifierStringSchema,
|
|
21715
|
+
commandId: identifierStringSchema.optional(),
|
|
21716
|
+
context: promptExecutionContextSchema.unwrap().passthrough().readonly().optional(),
|
|
21717
|
+
event: external_exports.object({ interactionId: identifierStringSchema.optional() }).passthrough().readonly().optional()
|
|
21718
|
+
}).passthrough().readonly();
|
|
21719
|
+
var wireEventFields = {
|
|
21720
|
+
...sessionLiveEventFields,
|
|
21721
|
+
mobiusMetadata: external_exports.object({ omitted: external_exports.literal(true).optional() }).passthrough().readonly().optional()
|
|
21722
|
+
};
|
|
21723
|
+
var sessionWireEventSchema = external_exports.union([
|
|
21724
|
+
external_exports.object({
|
|
21725
|
+
...wireEventFields,
|
|
21726
|
+
type: external_exports.literal("acp"),
|
|
21727
|
+
payload: external_exports.object({ sessionUpdate: identifierStringSchema }).passthrough().readonly()
|
|
21728
|
+
}).passthrough().readonly(),
|
|
21729
|
+
external_exports.object({
|
|
21730
|
+
...wireEventFields,
|
|
21731
|
+
type: external_exports.literal("lifecycle-metadata"),
|
|
21732
|
+
payload: wireLifecyclePayloadSchema
|
|
21733
|
+
}).passthrough().readonly(),
|
|
21734
|
+
external_exports.object({
|
|
21735
|
+
...wireEventFields,
|
|
21736
|
+
type: identifierStringSchema.refine((type) => type !== "acp" && type !== "lifecycle-metadata"),
|
|
21737
|
+
payload: external_exports.record(external_exports.string(), external_exports.unknown()).readonly()
|
|
21738
|
+
}).passthrough().readonly()
|
|
21739
|
+
]);
|
|
21740
|
+
var sessionWireEnvelopeSchema = external_exports.object({
|
|
21741
|
+
kind: external_exports.literal(SESSION_EVENT_KIND),
|
|
21742
|
+
events: external_exports.array(sessionWireEventSchema).min(1).max(SESSION_EVENT_BATCH_MAX_SIZE).readonly()
|
|
21743
|
+
}).passthrough().readonly();
|
|
21744
|
+
var knownContentBlockTypes = /* @__PURE__ */ new Set([
|
|
21745
|
+
"text",
|
|
21746
|
+
"image",
|
|
21747
|
+
"audio",
|
|
21748
|
+
"resource_link",
|
|
21749
|
+
"resource",
|
|
21750
|
+
"external_image",
|
|
21751
|
+
"external_audio",
|
|
21752
|
+
"external_resource"
|
|
21753
|
+
]);
|
|
21754
|
+
var knownToolCallContentTypes = /* @__PURE__ */ new Set(["content", "diff", "terminal"]);
|
|
21755
|
+
var knownPlanTypes = /* @__PURE__ */ new Set(["items", "file", "markdown"]);
|
|
21756
|
+
var knownConfigOptionTypes = /* @__PURE__ */ new Set(["select", "boolean"]);
|
|
21757
|
+
var knownSessionUpdates = /* @__PURE__ */ new Set([
|
|
21758
|
+
"user_message_chunk",
|
|
21759
|
+
"agent_message_chunk",
|
|
21760
|
+
"agent_thought_chunk",
|
|
21761
|
+
"tool_call",
|
|
21762
|
+
"tool_call_update",
|
|
21763
|
+
"plan",
|
|
21764
|
+
"plan_update",
|
|
21765
|
+
"plan_removed",
|
|
21766
|
+
"available_commands_update",
|
|
21767
|
+
"current_mode_update",
|
|
21768
|
+
"config_option_update",
|
|
21769
|
+
"session_info_update",
|
|
21770
|
+
"usage_update",
|
|
21771
|
+
"compaction_update",
|
|
21772
|
+
"compaction_summary_chunk"
|
|
21773
|
+
]);
|
|
21774
|
+
var knownLifecycleKinds = /* @__PURE__ */ new Set([
|
|
21775
|
+
"session.queue.changed",
|
|
21776
|
+
"session.permission.requested",
|
|
21777
|
+
"session.permission.resolved",
|
|
21778
|
+
"session.elicitation.requested",
|
|
21779
|
+
"session.elicitation.resolved",
|
|
21780
|
+
"prompt.requested",
|
|
21781
|
+
"prompt.started",
|
|
21782
|
+
"prompt.completed",
|
|
21783
|
+
"prompt.failed-before-start",
|
|
21784
|
+
"prompt.failed"
|
|
21785
|
+
]);
|
|
21786
|
+
function isRecord3(value) {
|
|
21787
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
21788
|
+
}
|
|
21789
|
+
function hasUnknownDiscriminator(value, key, known) {
|
|
21790
|
+
if (!isRecord3(value)) {
|
|
21791
|
+
return false;
|
|
21792
|
+
}
|
|
21793
|
+
const variant = value[key];
|
|
21794
|
+
return typeof variant === "string" && !known.has(variant);
|
|
21795
|
+
}
|
|
21796
|
+
function containsUnknownContentBlock(value) {
|
|
21797
|
+
return hasUnknownDiscriminator(value, "type", knownContentBlockTypes);
|
|
21798
|
+
}
|
|
21799
|
+
function containsUnknownToolCallContent(value) {
|
|
21800
|
+
if (hasUnknownDiscriminator(value, "type", knownToolCallContentTypes)) {
|
|
21801
|
+
return true;
|
|
21802
|
+
}
|
|
21803
|
+
return isRecord3(value) && value["type"] === "content" && containsUnknownContentBlock(value["content"]);
|
|
21804
|
+
}
|
|
21805
|
+
function arrayContainsUnknown(value, predicate) {
|
|
21806
|
+
return Array.isArray(value) && value.some(predicate);
|
|
21807
|
+
}
|
|
21808
|
+
function containsUnknownAcpVariant(payload) {
|
|
21809
|
+
const update = payload["sessionUpdate"];
|
|
21810
|
+
if (typeof update !== "string") {
|
|
21811
|
+
return false;
|
|
21812
|
+
}
|
|
21813
|
+
if (!knownSessionUpdates.has(update)) {
|
|
21814
|
+
return true;
|
|
21815
|
+
}
|
|
21816
|
+
if (["user_message_chunk", "agent_message_chunk", "agent_thought_chunk", "compaction_summary_chunk"].includes(
|
|
21817
|
+
update
|
|
21818
|
+
)) {
|
|
21819
|
+
return containsUnknownContentBlock(payload["content"]);
|
|
21820
|
+
}
|
|
21821
|
+
if (update === "tool_call" || update === "tool_call_update") {
|
|
21822
|
+
return arrayContainsUnknown(payload["content"], containsUnknownToolCallContent);
|
|
21823
|
+
}
|
|
21824
|
+
if (update === "plan_update") {
|
|
21825
|
+
return hasUnknownDiscriminator(payload["plan"], "type", knownPlanTypes);
|
|
21826
|
+
}
|
|
21827
|
+
if (update === "config_option_update") {
|
|
21828
|
+
return arrayContainsUnknown(
|
|
21829
|
+
payload["configOptions"],
|
|
21830
|
+
(option) => hasUnknownDiscriminator(option, "type", knownConfigOptionTypes)
|
|
21831
|
+
);
|
|
21832
|
+
}
|
|
21833
|
+
if (update === "compaction_update") {
|
|
21834
|
+
return arrayContainsUnknown(payload["summary"], containsUnknownContentBlock);
|
|
21835
|
+
}
|
|
21836
|
+
return false;
|
|
21837
|
+
}
|
|
21838
|
+
function isKnownSessionEventVariant(value) {
|
|
21839
|
+
if (!isRecord3(value)) {
|
|
21840
|
+
return true;
|
|
21841
|
+
}
|
|
21842
|
+
const type = value["type"];
|
|
21843
|
+
if (typeof type !== "string") {
|
|
21844
|
+
return true;
|
|
21845
|
+
}
|
|
21846
|
+
if (type === "acp") {
|
|
21847
|
+
const payload = value["payload"];
|
|
21848
|
+
return !isRecord3(payload) || !containsUnknownAcpVariant(payload);
|
|
21849
|
+
}
|
|
21850
|
+
if (type === "lifecycle-metadata") {
|
|
21851
|
+
const payload = value["payload"];
|
|
21852
|
+
if (!isRecord3(payload)) {
|
|
21853
|
+
return true;
|
|
21854
|
+
}
|
|
21855
|
+
const kind = payload["kind"];
|
|
21856
|
+
if (typeof kind === "string" && !knownLifecycleKinds.has(kind)) {
|
|
21857
|
+
return false;
|
|
21858
|
+
}
|
|
21859
|
+
return kind !== "prompt.requested" || !arrayContainsUnknown(payload["content"], containsUnknownContentBlock);
|
|
21860
|
+
}
|
|
21861
|
+
return false;
|
|
21862
|
+
}
|
|
21863
|
+
function filterKnownSessionEventVariants(events) {
|
|
21864
|
+
return Array.isArray(events) ? events.filter(isKnownSessionEventVariant) : events;
|
|
21865
|
+
}
|
|
21866
|
+
var sessionEventBatchSchema = external_exports.array(sessionEventSchema).min(1).max(SESSION_EVENT_BATCH_MAX_SIZE).readonly();
|
|
21867
|
+
var sessionLiveEventBatchSchema = external_exports.array(sessionLiveEventSchema).min(1).max(SESSION_EVENT_BATCH_MAX_SIZE).readonly();
|
|
21868
|
+
var sessionExportSchema = external_exports.object({
|
|
21869
|
+
binding: external_exports.object({
|
|
21870
|
+
bindingId: identifierStringSchema,
|
|
21871
|
+
runtimeId: identifierStringSchema
|
|
21872
|
+
}).readonly(),
|
|
21873
|
+
events: external_exports.array(sessionEventSchema).max(MAX_EVENT_COUNT).readonly(),
|
|
21874
|
+
sessionId: identifierStringSchema,
|
|
21875
|
+
truncated: external_exports.boolean()
|
|
21876
|
+
}).readonly().superRefine((session, context) => {
|
|
21877
|
+
const eventIds = /* @__PURE__ */ new Set();
|
|
21878
|
+
for (const [index2, event] of session.events.entries()) {
|
|
21879
|
+
if (event.sessionId !== session.sessionId) {
|
|
21880
|
+
context.addIssue({
|
|
21881
|
+
code: "custom",
|
|
21882
|
+
message: "Exported event belongs to a different Session",
|
|
21883
|
+
path: ["events", index2, "sessionId"]
|
|
21884
|
+
});
|
|
21885
|
+
}
|
|
21886
|
+
if (eventIds.has(event.eventId)) {
|
|
21887
|
+
context.addIssue({
|
|
21888
|
+
code: "custom",
|
|
21889
|
+
message: "Exported event identities are not unique",
|
|
21890
|
+
path: ["events", index2, "eventId"]
|
|
21891
|
+
});
|
|
21892
|
+
}
|
|
21893
|
+
eventIds.add(event.eventId);
|
|
21894
|
+
}
|
|
21895
|
+
});
|
|
21896
|
+
var mobiusSessionExportSchema = external_exports.object({
|
|
21897
|
+
formatVersion: external_exports.literal("2"),
|
|
21898
|
+
session: sessionExportSchema
|
|
21899
|
+
}).readonly();
|
|
21900
|
+
var sessionEventEnvelopeSchema = external_exports.object({ events: sessionLiveEventBatchSchema, kind: external_exports.literal(SESSION_EVENT_KIND) }).readonly();
|
|
21901
|
+
var sessionEventLogPageSchema = external_exports.object({
|
|
21902
|
+
events: external_exports.array(sessionEventSchema).max(MAX_EVENT_COUNT).readonly(),
|
|
21903
|
+
nextCursor: external_exports.string().min(1).max(512).nullable(),
|
|
21904
|
+
sessionGenerationId: identifierStringSchema,
|
|
21905
|
+
tailCursor: external_exports.string().max(512),
|
|
21906
|
+
// The generation-scoped live position covered by this snapshot, including
|
|
21907
|
+
// coalesced and omitted events. Absent only on older Runtime versions.
|
|
21908
|
+
throughPosition: positionSchema.optional(),
|
|
21909
|
+
truncated: external_exports.boolean(),
|
|
21910
|
+
version: external_exports.literal(2)
|
|
21911
|
+
}).readonly();
|
|
21912
|
+
var sessionEventOmissionSchema = external_exports.literal("agent-reasoning");
|
|
21913
|
+
var nativeEventPageRequestSchema = external_exports.object({
|
|
21914
|
+
cursor: external_exports.string().min(1).max(512).nullable(),
|
|
21915
|
+
eventLimit: external_exports.number().int().min(1).max(1e4),
|
|
21916
|
+
// Legacy callers may still send this option; readers must ignore it.
|
|
21917
|
+
omit: external_exports.array(sessionEventOmissionSchema).max(1).readonly().optional()
|
|
21918
|
+
}).readonly();
|
|
21919
|
+
var queuedPromptRequestEventLogSchema = external_exports.object({
|
|
21920
|
+
commandId: identifierStringSchema,
|
|
21921
|
+
content: external_exports.array(contentBlockSchema).min(1).max(100).readonly(),
|
|
21922
|
+
disposition: shortString.optional(),
|
|
21923
|
+
targetCommandId: identifierStringSchema.optional()
|
|
21924
|
+
}).readonly();
|
|
21925
|
+
var nativeSessionEventsSchema = external_exports.object({
|
|
21926
|
+
events: sessionEventLogPageSchema,
|
|
21927
|
+
queuedPromptRequests: external_exports.array(queuedPromptRequestEventLogSchema).max(MAX_COLLECTION_SIZE2).readonly()
|
|
21928
|
+
}).readonly();
|
|
21929
|
+
function inputValue(value) {
|
|
21930
|
+
if (typeof value !== "string") {
|
|
21931
|
+
return value;
|
|
21932
|
+
}
|
|
21933
|
+
try {
|
|
21934
|
+
return JSON.parse(value);
|
|
21935
|
+
} catch (cause) {
|
|
21936
|
+
throw new ProtocolMessageError("Session Event Log V2 message is not valid JSON", { cause });
|
|
21937
|
+
}
|
|
21938
|
+
}
|
|
21939
|
+
function decode3(value, schema) {
|
|
21940
|
+
const result = schema.safeParse(inputValue(value));
|
|
21941
|
+
if (!result.success) {
|
|
21942
|
+
throw new ProtocolMessageError("Session Event Log V2 message does not match its schema", {
|
|
21943
|
+
cause: result.error
|
|
21944
|
+
});
|
|
21945
|
+
}
|
|
21946
|
+
return result.data;
|
|
21947
|
+
}
|
|
21948
|
+
function encode3(value, schema) {
|
|
21949
|
+
return JSON.stringify(decode3(value, schema));
|
|
21950
|
+
}
|
|
21951
|
+
function sanitizeKnownNativeSessionEvents(value) {
|
|
21952
|
+
const input2 = inputValue(value);
|
|
21953
|
+
if (!isRecord3(input2)) {
|
|
21954
|
+
return input2;
|
|
21955
|
+
}
|
|
21956
|
+
const page = input2["events"];
|
|
21957
|
+
const queuedPromptRequests = input2["queuedPromptRequests"];
|
|
21958
|
+
return {
|
|
21959
|
+
...input2,
|
|
21960
|
+
events: isRecord3(page) ? { ...page, events: filterKnownSessionEventVariants(page["events"]) } : page,
|
|
21961
|
+
queuedPromptRequests: Array.isArray(queuedPromptRequests) ? queuedPromptRequests.filter(
|
|
21962
|
+
(prompt) => !isRecord3(prompt) || !arrayContainsUnknown(prompt["content"], containsUnknownContentBlock)
|
|
21963
|
+
) : queuedPromptRequests
|
|
21964
|
+
};
|
|
21965
|
+
}
|
|
21966
|
+
var knownSessionLiveEventBatchSchema = external_exports.array(sessionLiveEventSchema).max(SESSION_EVENT_BATCH_MAX_SIZE).readonly();
|
|
21967
|
+
var decodeSessionEvent = (value) => decode3(value, sessionEventSchema);
|
|
21968
|
+
var decodeKnownSessionEventPayload = (value) => isKnownSessionEventVariant(value) ? decode3(value, sessionEventPayloadSchema) : null;
|
|
21969
|
+
var decodeSessionEventEnvelope = (value) => decode3(value, sessionEventEnvelopeSchema);
|
|
21970
|
+
var encodeSessionEventEnvelope = (value) => encode3(value, sessionEventEnvelopeSchema);
|
|
21971
|
+
var decodeAcpSessionUpdate = (value) => decode3(value, acpSessionUpdateSchema);
|
|
21972
|
+
var decodeKnownNativeSessionEvents = (value) => decode3(sanitizeKnownNativeSessionEvents(value), nativeSessionEventsSchema);
|
|
21973
|
+
|
|
21255
21974
|
// ../mobius-sdk/src/protocol/session/files/index.ts
|
|
21256
21975
|
var FILE_READ_KIND = "file.read";
|
|
21257
21976
|
var FILE_BEGIN_KIND = "file.begin";
|
|
@@ -21391,162 +22110,6 @@ var encodeContentReadyEvent = (message) => encodeZodMessage(message, contentRead
|
|
|
21391
22110
|
var decodeContentAvailableEvent = (encoded) => decodeZodMessage(encoded, contentAvailableEventSchema);
|
|
21392
22111
|
var encodeContentAvailableEvent = (message) => encodeZodMessage(message, contentAvailableEventSchema);
|
|
21393
22112
|
|
|
21394
|
-
// ../mobius-sdk/src/protocol/shared/tool-input.ts
|
|
21395
|
-
var MAX_CONTENT_LENGTH = 1e6;
|
|
21396
|
-
var MAX_COLLECTION_SIZE = 1e3;
|
|
21397
|
-
var MAX_JSON_DEPTH = 16;
|
|
21398
|
-
var MAX_JSON_KEYS = 1e3;
|
|
21399
|
-
var boundedString = external_exports.string().max(MAX_CONTENT_LENGTH);
|
|
21400
|
-
function boundedJsonIssue(value, depth = 0) {
|
|
21401
|
-
if (depth > MAX_JSON_DEPTH) {
|
|
21402
|
-
return "JSON nesting exceeds the maximum depth";
|
|
21403
|
-
}
|
|
21404
|
-
if (typeof value === "string") {
|
|
21405
|
-
return value.length <= MAX_CONTENT_LENGTH ? null : "JSON string exceeds the maximum length";
|
|
21406
|
-
}
|
|
21407
|
-
if (typeof value === "number") {
|
|
21408
|
-
return Number.isFinite(value) ? null : "JSON number must be finite";
|
|
21409
|
-
}
|
|
21410
|
-
if (typeof value === "boolean" || value === null) {
|
|
21411
|
-
return null;
|
|
21412
|
-
}
|
|
21413
|
-
if (Array.isArray(value)) {
|
|
21414
|
-
if (value.length > MAX_COLLECTION_SIZE) {
|
|
21415
|
-
return "JSON array exceeds the maximum length";
|
|
21416
|
-
}
|
|
21417
|
-
for (const item of value) {
|
|
21418
|
-
const issue2 = boundedJsonIssue(item, depth + 1);
|
|
21419
|
-
if (issue2 !== null) {
|
|
21420
|
-
return issue2;
|
|
21421
|
-
}
|
|
21422
|
-
}
|
|
21423
|
-
return null;
|
|
21424
|
-
}
|
|
21425
|
-
if (typeof value === "object" && value !== void 0) {
|
|
21426
|
-
const entries = Object.entries(value);
|
|
21427
|
-
if (entries.length > MAX_JSON_KEYS) {
|
|
21428
|
-
return "JSON object exceeds the maximum key count";
|
|
21429
|
-
}
|
|
21430
|
-
for (const [key, item] of entries) {
|
|
21431
|
-
if (key.length > 255) {
|
|
21432
|
-
return "JSON key exceeds the maximum length";
|
|
21433
|
-
}
|
|
21434
|
-
const issue2 = boundedJsonIssue(item, depth + 1);
|
|
21435
|
-
if (issue2 !== null) {
|
|
21436
|
-
return issue2;
|
|
21437
|
-
}
|
|
21438
|
-
}
|
|
21439
|
-
return null;
|
|
21440
|
-
}
|
|
21441
|
-
return "Value is not bounded JSON";
|
|
21442
|
-
}
|
|
21443
|
-
var boundedJsonSchema = external_exports.unknown().superRefine((value, context) => {
|
|
21444
|
-
const issue2 = boundedJsonIssue(value);
|
|
21445
|
-
if (issue2 !== null) {
|
|
21446
|
-
context.addIssue({ code: "custom", message: issue2 });
|
|
21447
|
-
}
|
|
21448
|
-
});
|
|
21449
|
-
var toolCallLocationSchema = external_exports.object({
|
|
21450
|
-
line: external_exports.number().int().nonnegative().safe().nullable().optional(),
|
|
21451
|
-
path: boundedString
|
|
21452
|
-
}).readonly();
|
|
21453
|
-
|
|
21454
|
-
// ../mobius-sdk/src/protocol/session/interactions/index.ts
|
|
21455
|
-
var SESSION_PERMISSION_REQUESTED_KIND = "session.permission.requested";
|
|
21456
|
-
var SESSION_PERMISSION_RESPOND_KIND = "session.permission.respond";
|
|
21457
|
-
var SESSION_PERMISSION_RESOLVED_KIND = "session.permission.resolved";
|
|
21458
|
-
var SESSION_ELICITATION_REQUESTED_KIND = "session.elicitation.requested";
|
|
21459
|
-
var SESSION_ELICITATION_RESPOND_KIND = "session.elicitation.respond";
|
|
21460
|
-
var SESSION_ELICITATION_RESOLVED_KIND = "session.elicitation.resolved";
|
|
21461
|
-
var permissionOptionSchema = external_exports.object({
|
|
21462
|
-
kind: external_exports.enum(["allow_once", "allow_always", "reject_once", "reject_always"]),
|
|
21463
|
-
name: external_exports.string().min(1).max(255),
|
|
21464
|
-
optionId: external_exports.string().min(1).max(255)
|
|
21465
|
-
}).readonly();
|
|
21466
|
-
var elicitationOptionSchema = external_exports.object({
|
|
21467
|
-
description: SHORT_TEXT,
|
|
21468
|
-
label: external_exports.string().min(1).max(255),
|
|
21469
|
-
value: external_exports.string().max(500)
|
|
21470
|
-
}).readonly();
|
|
21471
|
-
var elicitationFieldSchema = external_exports.object({
|
|
21472
|
-
defaultBooleanValue: external_exports.boolean(),
|
|
21473
|
-
defaultNumberValue: external_exports.number().finite(),
|
|
21474
|
-
defaultStringValue: external_exports.string().max(1e4),
|
|
21475
|
-
description: SHORT_TEXT,
|
|
21476
|
-
format: external_exports.string().max(64),
|
|
21477
|
-
hasDefaultValue: external_exports.boolean(),
|
|
21478
|
-
maximum: external_exports.string().max(128),
|
|
21479
|
-
maximumLength: external_exports.string().max(128),
|
|
21480
|
-
minimum: external_exports.string().max(128),
|
|
21481
|
-
minimumLength: external_exports.string().max(128),
|
|
21482
|
-
multiline: external_exports.boolean().optional(),
|
|
21483
|
-
name: external_exports.string().min(1).max(128),
|
|
21484
|
-
options: external_exports.array(elicitationOptionSchema).max(200).readonly(),
|
|
21485
|
-
pattern: external_exports.string().max(500),
|
|
21486
|
-
required: external_exports.boolean(),
|
|
21487
|
-
title: external_exports.string().min(1).max(255),
|
|
21488
|
-
type: external_exports.enum(["boolean", "integer", "multiselect", "number", "select", "string"])
|
|
21489
|
-
}).readonly();
|
|
21490
|
-
var sessionPermissionRequestedEventSchema = external_exports.object({
|
|
21491
|
-
commandId: identifierStringSchema,
|
|
21492
|
-
// Absent only for events from older runtimes and saved history.
|
|
21493
|
-
details: external_exports.object({
|
|
21494
|
-
cwd: external_exports.string().min(1).max(4096),
|
|
21495
|
-
rawInput: boundedJsonSchema.optional(),
|
|
21496
|
-
locations: external_exports.array(toolCallLocationSchema).max(1e3).readonly()
|
|
21497
|
-
}).readonly().optional(),
|
|
21498
|
-
interactionId: identifierStringSchema,
|
|
21499
|
-
kind: external_exports.literal(SESSION_PERMISSION_REQUESTED_KIND),
|
|
21500
|
-
options: external_exports.array(permissionOptionSchema).min(1).max(20).readonly(),
|
|
21501
|
-
sessionId: identifierStringSchema,
|
|
21502
|
-
title: external_exports.string().min(1).max(500),
|
|
21503
|
-
toolCallId: external_exports.string().min(1).max(255),
|
|
21504
|
-
toolKind: external_exports.string().max(64)
|
|
21505
|
-
}).readonly();
|
|
21506
|
-
var sessionPermissionRespondCommandSchema = external_exports.object({
|
|
21507
|
-
interactionId: identifierStringSchema,
|
|
21508
|
-
kind: external_exports.literal(SESSION_PERMISSION_RESPOND_KIND),
|
|
21509
|
-
optionId: external_exports.string().max(255),
|
|
21510
|
-
outcome: external_exports.enum(["cancelled", "selected"]),
|
|
21511
|
-
sessionId: identifierStringSchema
|
|
21512
|
-
}).readonly();
|
|
21513
|
-
var sessionPermissionResolvedEventSchema = external_exports.object({
|
|
21514
|
-
interactionId: identifierStringSchema,
|
|
21515
|
-
kind: external_exports.literal(SESSION_PERMISSION_RESOLVED_KIND),
|
|
21516
|
-
optionId: external_exports.string().max(255),
|
|
21517
|
-
outcome: external_exports.enum(["cancelled", "selected"]),
|
|
21518
|
-
sessionId: identifierStringSchema
|
|
21519
|
-
}).readonly();
|
|
21520
|
-
var sessionElicitationRequestedEventSchema = external_exports.object({
|
|
21521
|
-
accepted: external_exports.boolean(),
|
|
21522
|
-
commandId: identifierStringSchema,
|
|
21523
|
-
elicitationId: external_exports.string().max(255),
|
|
21524
|
-
fields: external_exports.array(elicitationFieldSchema).max(100).readonly(),
|
|
21525
|
-
interactionId: identifierStringSchema,
|
|
21526
|
-
kind: external_exports.literal(SESSION_ELICITATION_REQUESTED_KIND),
|
|
21527
|
-
message: external_exports.string().min(1).max(2e3),
|
|
21528
|
-
mode: external_exports.enum(["form", "url"]),
|
|
21529
|
-
sessionId: identifierStringSchema,
|
|
21530
|
-
url: external_exports.string().max(4096)
|
|
21531
|
-
}).readonly();
|
|
21532
|
-
var sessionElicitationRespondCommandSchema = external_exports.object({
|
|
21533
|
-
action: external_exports.enum(["accept", "cancel", "decline"]),
|
|
21534
|
-
content: external_exports.string().max(1e5),
|
|
21535
|
-
interactionId: identifierStringSchema,
|
|
21536
|
-
kind: external_exports.literal(SESSION_ELICITATION_RESPOND_KIND),
|
|
21537
|
-
sessionId: identifierStringSchema
|
|
21538
|
-
}).readonly();
|
|
21539
|
-
var sessionElicitationResolvedEventSchema = external_exports.object({
|
|
21540
|
-
action: external_exports.enum(["accept", "cancel", "decline", "complete"]),
|
|
21541
|
-
interactionId: identifierStringSchema,
|
|
21542
|
-
kind: external_exports.literal(SESSION_ELICITATION_RESOLVED_KIND),
|
|
21543
|
-
sessionId: identifierStringSchema
|
|
21544
|
-
}).readonly();
|
|
21545
|
-
var decodeSessionPermissionRespondCommand = (encoded) => decodeZodMessage(encoded, sessionPermissionRespondCommandSchema);
|
|
21546
|
-
var encodeSessionPermissionRespondCommand = (message) => encodeZodMessage(message, sessionPermissionRespondCommandSchema);
|
|
21547
|
-
var decodeSessionElicitationRespondCommand = (encoded) => decodeZodMessage(encoded, sessionElicitationRespondCommandSchema);
|
|
21548
|
-
var encodeSessionElicitationRespondCommand = (message) => encodeZodMessage(message, sessionElicitationRespondCommandSchema);
|
|
21549
|
-
|
|
21550
22113
|
// ../mobius-sdk/src/protocol/session/lifecycle/index.ts
|
|
21551
22114
|
var SESSION_PREPARE_KIND = "session.prepare";
|
|
21552
22115
|
var SESSION_READY_KIND = "session.ready";
|
|
@@ -21863,678 +22426,115 @@ var NATIVE_SESSION_CANCEL_KIND = "native.session.cancel";
|
|
|
21863
22426
|
var envelope = {
|
|
21864
22427
|
requestId: identifierStringSchema,
|
|
21865
22428
|
sessionId: identifierStringSchema
|
|
21866
|
-
};
|
|
21867
|
-
var activeTurnSnapshotSchema = external_exports.object({
|
|
21868
|
-
commandId: identifierStringSchema,
|
|
21869
|
-
epoch: identifierStringSchema,
|
|
21870
|
-
interaction: external_exports.discriminatedUnion("kind", [sessionPermissionRequestedEventSchema, sessionElicitationRequestedEventSchema]).nullable(),
|
|
21871
|
-
sequence: external_exports.number().int().nonnegative(),
|
|
21872
|
-
state: external_exports.literal("running")
|
|
21873
|
-
}).readonly();
|
|
21874
|
-
var identity = {
|
|
21875
|
-
...envelope,
|
|
21876
|
-
kind: external_exports.literal(NATIVE_SESSION_REQUEST_KIND),
|
|
21877
|
-
additionalDirectoryIds: external_exports.array(DIRECTORY_IDENTIFIER).max(16).readonly(),
|
|
21878
|
-
agentId: identifierStringSchema,
|
|
21879
|
-
bindingId: identifierStringSchema,
|
|
21880
|
-
directoryId: DIRECTORY_IDENTIFIER
|
|
21881
|
-
};
|
|
21882
|
-
var nativeSessionRequestSchema = external_exports.discriminatedUnion("action", [
|
|
21883
|
-
external_exports.object({ ...identity, action: external_exports.literal("active-turn"), targetSessionId: identifierStringSchema }).readonly(),
|
|
21884
|
-
external_exports.object({ ...identity, action: external_exports.literal("find"), nativeSessionId: identifierStringSchema }).readonly(),
|
|
21885
|
-
external_exports.object({
|
|
21886
|
-
...identity,
|
|
21887
|
-
action: external_exports.literal("list"),
|
|
21888
|
-
cursor: identifierStringSchema.nullable()
|
|
21889
|
-
}).readonly(),
|
|
21890
|
-
external_exports.object({
|
|
21891
|
-
...identity,
|
|
21892
|
-
action: external_exports.enum(["import", "fork"]),
|
|
21893
|
-
entryId: identifierStringSchema,
|
|
21894
|
-
targetSessionId: identifierStringSchema
|
|
21895
|
-
}).readonly()
|
|
21896
|
-
]);
|
|
21897
|
-
var nativeSessionCommandSchema = external_exports.discriminatedUnion("action", [
|
|
21898
|
-
external_exports.object({ ...identity, action: external_exports.literal("active-turn"), targetSessionId: identifierStringSchema }).readonly(),
|
|
21899
|
-
external_exports.object({ ...identity, action: external_exports.literal("find"), nativeSessionId: identifierStringSchema }).readonly(),
|
|
21900
|
-
external_exports.object({
|
|
21901
|
-
...identity,
|
|
21902
|
-
action: external_exports.literal("list"),
|
|
21903
|
-
cursor: identifierStringSchema.nullable()
|
|
21904
|
-
}).readonly(),
|
|
21905
|
-
external_exports.object({
|
|
21906
|
-
...identity,
|
|
21907
|
-
action: external_exports.enum(["import", "fork"]),
|
|
21908
|
-
entryId: identifierStringSchema,
|
|
21909
|
-
targetSessionId: identifierStringSchema
|
|
21910
|
-
}).readonly()
|
|
21911
|
-
]);
|
|
21912
|
-
var nativeSessionEntrySchema = external_exports.object({
|
|
21913
|
-
entryId: identifierStringSchema,
|
|
21914
|
-
mobiusSessionIds: external_exports.array(identifierStringSchema).max(500).readonly(),
|
|
21915
|
-
nativeSessionId: identifierStringSchema,
|
|
21916
|
-
title: external_exports.string().max(500),
|
|
21917
|
-
directoryId: DIRECTORY_IDENTIFIER,
|
|
21918
|
-
directoryLabel: external_exports.string().min(1).max(MAX_WORKSPACE_PATH_LENGTH),
|
|
21919
|
-
updatedAt: external_exports.iso.datetime({ offset: true }).nullable(),
|
|
21920
|
-
additionalDirectories: external_exports.array(external_exports.object({ directoryId: DIRECTORY_IDENTIFIER, name: external_exports.string().min(1).max(255) }).readonly()).max(16).readonly()
|
|
21921
|
-
}).readonly();
|
|
21922
|
-
var resultEnvelope = {
|
|
21923
|
-
...envelope,
|
|
21924
|
-
kind: external_exports.literal(NATIVE_SESSION_RESULT_KIND)
|
|
21925
|
-
};
|
|
21926
|
-
var nativeSessionResultSchema = external_exports.discriminatedUnion("action", [
|
|
21927
|
-
external_exports.object({
|
|
21928
|
-
...resultEnvelope,
|
|
21929
|
-
action: external_exports.literal("active-turn"),
|
|
21930
|
-
targetSessionId: identifierStringSchema,
|
|
21931
|
-
queued: external_exports.array(
|
|
21932
|
-
external_exports.object({
|
|
21933
|
-
commandId: identifierStringSchema,
|
|
21934
|
-
prompt: external_exports.string().max(1e5),
|
|
21935
|
-
attachments: external_exports.array(promptAttachmentSchema).max(16).readonly()
|
|
21936
|
-
}).readonly()
|
|
21937
|
-
).readonly(),
|
|
21938
|
-
turn: activeTurnSnapshotSchema.nullable()
|
|
21939
|
-
}).readonly(),
|
|
21940
|
-
external_exports.object({
|
|
21941
|
-
...resultEnvelope,
|
|
21942
|
-
action: external_exports.literal("find"),
|
|
21943
|
-
entry: nativeSessionEntrySchema
|
|
21944
|
-
}).readonly(),
|
|
21945
|
-
external_exports.object({
|
|
21946
|
-
...resultEnvelope,
|
|
21947
|
-
action: external_exports.literal("list"),
|
|
21948
|
-
capabilities: sessionCapabilitiesSchema,
|
|
21949
|
-
entries: external_exports.array(nativeSessionEntrySchema).max(500).readonly(),
|
|
21950
|
-
nextCursor: identifierStringSchema.nullable()
|
|
21951
|
-
}).readonly(),
|
|
21952
|
-
external_exports.object({
|
|
21953
|
-
...resultEnvelope,
|
|
21954
|
-
action: external_exports.enum(["import", "fork"]),
|
|
21955
|
-
targetSessionId: identifierStringSchema,
|
|
21956
|
-
ready: sessionReadyEventSchema,
|
|
21957
|
-
title: external_exports.string().max(500)
|
|
21958
|
-
}).readonly()
|
|
21959
|
-
]);
|
|
21960
|
-
var nativeSessionCancelSchema = external_exports.object({ ...envelope, kind: external_exports.literal(NATIVE_SESSION_CANCEL_KIND) }).readonly();
|
|
21961
|
-
function decode3(schema, encoded) {
|
|
21962
|
-
try {
|
|
21963
|
-
const value = JSON.parse(encoded);
|
|
21964
|
-
return schema.parse(value);
|
|
21965
|
-
} catch (cause) {
|
|
21966
|
-
throw new ProtocolMessageError("Invalid native session message", { cause });
|
|
21967
|
-
}
|
|
21968
|
-
}
|
|
21969
|
-
var decodeNativeSessionCommand = (encoded) => decode3(nativeSessionCommandSchema, encoded);
|
|
21970
|
-
var encodeNativeSessionCommand = (value) => JSON.stringify(nativeSessionCommandSchema.parse(value));
|
|
21971
|
-
var decodeNativeSessionResult = (encoded) => decode3(nativeSessionResultSchema, encoded);
|
|
21972
|
-
var encodeNativeSessionResult = (value) => JSON.stringify(nativeSessionResultSchema.parse(value));
|
|
21973
|
-
var decodeNativeSessionCancel = (encoded) => decode3(nativeSessionCancelSchema, encoded);
|
|
21974
|
-
var encodeNativeSessionCancel = (value) => JSON.stringify(nativeSessionCancelSchema.parse(value));
|
|
21975
|
-
|
|
21976
|
-
// ../mobius-sdk/src/protocol/session/observability/event-log.ts
|
|
21977
|
-
var MAX_EVENT_COUNT = 1e4;
|
|
21978
|
-
var MAX_COLLECTION_SIZE2 = 1e3;
|
|
21979
|
-
var MAX_CONTENT_LENGTH2 = 1e6;
|
|
21980
|
-
var SESSION_EVENT_KIND = "session.event.v2";
|
|
21981
|
-
var SESSION_EVENT_BATCH_MAX_SIZE = 1e3;
|
|
21982
|
-
var boundedString2 = external_exports.string().max(MAX_CONTENT_LENGTH2);
|
|
21983
|
-
var shortString = external_exports.string().max(2048);
|
|
21984
|
-
var externalContentKeySchema = external_exports.string().regex(/^[a-f0-9]{64}$/u);
|
|
21985
|
-
var annotationsSchema = external_exports.object({
|
|
21986
|
-
audience: external_exports.array(external_exports.enum(["assistant", "user"])).max(2).readonly().nullable().optional(),
|
|
21987
|
-
lastModified: shortString.nullable().optional(),
|
|
21988
|
-
priority: external_exports.number().finite().nullable().optional()
|
|
21989
|
-
}).readonly();
|
|
21990
|
-
var contentFields = { annotations: annotationsSchema.nullable().optional() };
|
|
21991
|
-
var textContentSchema = external_exports.object({ ...contentFields, text: boundedString2, type: external_exports.literal("text") }).readonly();
|
|
21992
|
-
var imageContentSchema = external_exports.object({
|
|
21993
|
-
...contentFields,
|
|
21994
|
-
data: external_exports.string(),
|
|
21995
|
-
mimeType: shortString,
|
|
21996
|
-
type: external_exports.literal("image"),
|
|
21997
|
-
uri: boundedString2.nullable().optional()
|
|
21998
|
-
}).readonly();
|
|
21999
|
-
var audioContentSchema = external_exports.object({ ...contentFields, data: external_exports.string(), mimeType: shortString, type: external_exports.literal("audio") }).readonly();
|
|
22000
|
-
var externalImageContentSchema = external_exports.object({
|
|
22001
|
-
...contentFields,
|
|
22002
|
-
byteLength: external_exports.number().int().positive().safe(),
|
|
22003
|
-
imageKey: externalContentKeySchema,
|
|
22004
|
-
mimeType: shortString,
|
|
22005
|
-
type: external_exports.literal("external_image"),
|
|
22006
|
-
uri: boundedString2.nullable().optional()
|
|
22007
|
-
}).readonly();
|
|
22008
|
-
var externalAudioContentSchema = external_exports.object({
|
|
22009
|
-
...contentFields,
|
|
22010
|
-
audioKey: externalContentKeySchema,
|
|
22011
|
-
byteLength: external_exports.number().int().positive().safe(),
|
|
22012
|
-
mimeType: shortString,
|
|
22013
|
-
type: external_exports.literal("external_audio")
|
|
22014
|
-
}).readonly();
|
|
22015
|
-
var externalResourceContentSchema = external_exports.object({
|
|
22016
|
-
...contentFields,
|
|
22017
|
-
byteLength: external_exports.number().int().positive().safe(),
|
|
22018
|
-
encoding: external_exports.enum(["binary", "text"]),
|
|
22019
|
-
mimeType: shortString.nullable().optional(),
|
|
22020
|
-
resourceKey: externalContentKeySchema,
|
|
22021
|
-
type: external_exports.literal("external_resource"),
|
|
22022
|
-
uri: boundedString2
|
|
22023
|
-
}).readonly();
|
|
22024
|
-
var resourceLinkSchema = external_exports.object({
|
|
22025
|
-
...contentFields,
|
|
22026
|
-
description: boundedString2.nullable().optional(),
|
|
22027
|
-
mimeType: shortString.nullable().optional(),
|
|
22028
|
-
name: shortString,
|
|
22029
|
-
size: external_exports.number().int().nonnegative().safe().nullable().optional(),
|
|
22030
|
-
title: shortString.nullable().optional(),
|
|
22031
|
-
type: external_exports.literal("resource_link"),
|
|
22032
|
-
uri: boundedString2
|
|
22033
|
-
}).readonly();
|
|
22034
|
-
var textResourceSchema = external_exports.object({
|
|
22035
|
-
mimeType: shortString.nullable().optional(),
|
|
22036
|
-
text: boundedString2,
|
|
22037
|
-
uri: boundedString2
|
|
22038
|
-
}).readonly();
|
|
22039
|
-
var blobResourceSchema = external_exports.object({
|
|
22040
|
-
blob: external_exports.string(),
|
|
22041
|
-
mimeType: shortString.nullable().optional(),
|
|
22042
|
-
uri: boundedString2
|
|
22043
|
-
}).readonly();
|
|
22044
|
-
var embeddedResourceSchema = external_exports.object({
|
|
22045
|
-
...contentFields,
|
|
22046
|
-
resource: external_exports.union([textResourceSchema, blobResourceSchema]),
|
|
22047
|
-
type: external_exports.literal("resource")
|
|
22048
|
-
}).readonly();
|
|
22049
|
-
var contentBlockSchema = external_exports.discriminatedUnion("type", [
|
|
22050
|
-
textContentSchema,
|
|
22051
|
-
imageContentSchema,
|
|
22052
|
-
audioContentSchema,
|
|
22053
|
-
resourceLinkSchema,
|
|
22054
|
-
embeddedResourceSchema,
|
|
22055
|
-
externalImageContentSchema,
|
|
22056
|
-
externalAudioContentSchema,
|
|
22057
|
-
externalResourceContentSchema
|
|
22058
|
-
]);
|
|
22059
|
-
var toolCallContentSchema = external_exports.discriminatedUnion("type", [
|
|
22060
|
-
external_exports.object({ content: contentBlockSchema, type: external_exports.literal("content") }).readonly(),
|
|
22061
|
-
external_exports.object({
|
|
22062
|
-
newText: boundedString2,
|
|
22063
|
-
oldText: boundedString2.nullable().optional(),
|
|
22064
|
-
path: boundedString2,
|
|
22065
|
-
type: external_exports.literal("diff")
|
|
22066
|
-
}).readonly(),
|
|
22067
|
-
external_exports.object({ terminalId: shortString, type: external_exports.literal("terminal") }).readonly()
|
|
22068
|
-
]);
|
|
22069
|
-
var toolKindSchema = external_exports.enum([
|
|
22070
|
-
"read",
|
|
22071
|
-
"edit",
|
|
22072
|
-
"delete",
|
|
22073
|
-
"move",
|
|
22074
|
-
"search",
|
|
22075
|
-
"execute",
|
|
22076
|
-
"think",
|
|
22077
|
-
"fetch",
|
|
22078
|
-
"switch_mode",
|
|
22079
|
-
"other"
|
|
22080
|
-
]);
|
|
22081
|
-
var toolStatusSchema = external_exports.enum(["pending", "in_progress", "completed", "failed"]);
|
|
22082
|
-
var backgroundTaskSchema = external_exports.object({
|
|
22083
|
-
id: shortString,
|
|
22084
|
-
status: external_exports.enum(["running", "completed", "failed", "stopped", "unknown"])
|
|
22085
|
-
}).readonly();
|
|
22086
|
-
var toolPatchFields = {
|
|
22087
|
-
backgroundTask: backgroundTaskSchema.optional(),
|
|
22088
|
-
content: external_exports.array(toolCallContentSchema).max(MAX_COLLECTION_SIZE2).readonly().nullable().optional(),
|
|
22089
|
-
kind: toolKindSchema.nullable().optional(),
|
|
22090
|
-
locations: external_exports.array(toolCallLocationSchema).max(MAX_COLLECTION_SIZE2).readonly().nullable().optional(),
|
|
22091
|
-
name: shortString.nullable().optional(),
|
|
22092
|
-
rawInput: boundedJsonSchema.optional(),
|
|
22093
|
-
rawOutput: boundedJsonSchema.optional(),
|
|
22094
|
-
status: toolStatusSchema.nullable().optional(),
|
|
22095
|
-
title: boundedString2.nullable().optional()
|
|
22096
|
-
};
|
|
22097
|
-
var planEntrySchema = external_exports.object({
|
|
22098
|
-
content: boundedString2,
|
|
22099
|
-
priority: external_exports.enum(["high", "medium", "low"]),
|
|
22100
|
-
status: external_exports.enum(["pending", "in_progress", "completed"])
|
|
22429
|
+
};
|
|
22430
|
+
var activeTurnSnapshotSchema = external_exports.object({
|
|
22431
|
+
commandId: identifierStringSchema,
|
|
22432
|
+
epoch: identifierStringSchema,
|
|
22433
|
+
interaction: external_exports.discriminatedUnion("kind", [sessionPermissionRequestedEventSchema, sessionElicitationRequestedEventSchema]).nullable(),
|
|
22434
|
+
sequence: external_exports.number().int().nonnegative(),
|
|
22435
|
+
state: external_exports.literal("running")
|
|
22101
22436
|
}).readonly();
|
|
22102
|
-
var
|
|
22437
|
+
var identity = {
|
|
22438
|
+
...envelope,
|
|
22439
|
+
kind: external_exports.literal(NATIVE_SESSION_REQUEST_KIND),
|
|
22440
|
+
additionalDirectoryIds: external_exports.array(DIRECTORY_IDENTIFIER).max(16).readonly(),
|
|
22441
|
+
agentId: identifierStringSchema,
|
|
22442
|
+
bindingId: identifierStringSchema,
|
|
22443
|
+
directoryId: DIRECTORY_IDENTIFIER
|
|
22444
|
+
};
|
|
22445
|
+
var nativeSessionRequestSchema = external_exports.discriminatedUnion("action", [
|
|
22446
|
+
external_exports.object({ ...identity, action: external_exports.literal("active-turn"), targetSessionId: identifierStringSchema }).readonly(),
|
|
22447
|
+
external_exports.object({ ...identity, action: external_exports.literal("find"), nativeSessionId: identifierStringSchema }).readonly(),
|
|
22103
22448
|
external_exports.object({
|
|
22104
|
-
|
|
22105
|
-
|
|
22106
|
-
|
|
22449
|
+
...identity,
|
|
22450
|
+
action: external_exports.literal("list"),
|
|
22451
|
+
cursor: identifierStringSchema.nullable()
|
|
22107
22452
|
}).readonly(),
|
|
22108
|
-
external_exports.object({ planId: shortString, type: external_exports.literal("file"), uri: boundedString2 }).readonly(),
|
|
22109
22453
|
external_exports.object({
|
|
22110
|
-
|
|
22111
|
-
|
|
22112
|
-
|
|
22454
|
+
...identity,
|
|
22455
|
+
action: external_exports.enum(["import", "fork"]),
|
|
22456
|
+
entryId: identifierStringSchema,
|
|
22457
|
+
targetSessionId: identifierStringSchema
|
|
22113
22458
|
}).readonly()
|
|
22114
22459
|
]);
|
|
22115
|
-
var
|
|
22116
|
-
|
|
22117
|
-
|
|
22118
|
-
name: shortString
|
|
22119
|
-
}).readonly();
|
|
22120
|
-
var configSelectOptionSchema = external_exports.object({
|
|
22121
|
-
description: boundedString2.nullable().optional(),
|
|
22122
|
-
name: shortString,
|
|
22123
|
-
value: shortString
|
|
22124
|
-
}).readonly();
|
|
22125
|
-
var configSelectGroupSchema = external_exports.object({
|
|
22126
|
-
group: shortString,
|
|
22127
|
-
name: shortString,
|
|
22128
|
-
options: external_exports.array(configSelectOptionSchema).max(MAX_COLLECTION_SIZE2).readonly()
|
|
22129
|
-
}).readonly();
|
|
22130
|
-
var configBaseFields = {
|
|
22131
|
-
category: shortString.nullable().optional(),
|
|
22132
|
-
description: boundedString2.nullable().optional(),
|
|
22133
|
-
id: shortString,
|
|
22134
|
-
name: shortString
|
|
22135
|
-
};
|
|
22136
|
-
var sessionConfigOptionSchema2 = external_exports.discriminatedUnion("type", [
|
|
22137
|
-
external_exports.object({
|
|
22138
|
-
...configBaseFields,
|
|
22139
|
-
currentValue: shortString,
|
|
22140
|
-
options: external_exports.union([
|
|
22141
|
-
external_exports.array(configSelectOptionSchema).max(MAX_COLLECTION_SIZE2).readonly(),
|
|
22142
|
-
external_exports.array(configSelectGroupSchema).max(MAX_COLLECTION_SIZE2).readonly()
|
|
22143
|
-
]),
|
|
22144
|
-
type: external_exports.literal("select")
|
|
22145
|
-
}).readonly(),
|
|
22146
|
-
external_exports.object({ ...configBaseFields, currentValue: external_exports.boolean(), type: external_exports.literal("boolean") }).readonly()
|
|
22147
|
-
]);
|
|
22148
|
-
var contentChunkFields = {
|
|
22149
|
-
content: contentBlockSchema,
|
|
22150
|
-
messageId: shortString.nullable().optional()
|
|
22151
|
-
};
|
|
22152
|
-
var acpSessionUpdateSchema = external_exports.discriminatedUnion("sessionUpdate", [
|
|
22153
|
-
external_exports.object({ ...contentChunkFields, sessionUpdate: external_exports.literal("user_message_chunk") }).readonly(),
|
|
22154
|
-
external_exports.object({ ...contentChunkFields, sessionUpdate: external_exports.literal("agent_message_chunk") }).readonly(),
|
|
22155
|
-
external_exports.object({
|
|
22156
|
-
...contentChunkFields,
|
|
22157
|
-
meta: external_exports.object({ truncated: external_exports.boolean().optional() }).readonly().optional(),
|
|
22158
|
-
sessionUpdate: external_exports.literal("agent_thought_chunk")
|
|
22159
|
-
}).readonly(),
|
|
22160
|
-
external_exports.object({
|
|
22161
|
-
backgroundTask: backgroundTaskSchema.optional(),
|
|
22162
|
-
content: external_exports.array(toolCallContentSchema).max(MAX_COLLECTION_SIZE2).readonly().optional(),
|
|
22163
|
-
kind: toolKindSchema.optional(),
|
|
22164
|
-
locations: external_exports.array(toolCallLocationSchema).max(MAX_COLLECTION_SIZE2).readonly().optional(),
|
|
22165
|
-
name: shortString.nullable().optional(),
|
|
22166
|
-
rawInput: boundedJsonSchema.optional(),
|
|
22167
|
-
rawOutput: boundedJsonSchema.optional(),
|
|
22168
|
-
sessionUpdate: external_exports.literal("tool_call"),
|
|
22169
|
-
status: toolStatusSchema.optional(),
|
|
22170
|
-
title: boundedString2,
|
|
22171
|
-
toolCallId: shortString
|
|
22172
|
-
}).readonly(),
|
|
22173
|
-
external_exports.object({ ...toolPatchFields, sessionUpdate: external_exports.literal("tool_call_update"), toolCallId: shortString }).readonly(),
|
|
22174
|
-
external_exports.object({
|
|
22175
|
-
entries: external_exports.array(planEntrySchema).max(MAX_COLLECTION_SIZE2).readonly(),
|
|
22176
|
-
sessionUpdate: external_exports.literal("plan")
|
|
22177
|
-
}).readonly(),
|
|
22178
|
-
external_exports.object({ plan: planContentSchema, sessionUpdate: external_exports.literal("plan_update") }).readonly(),
|
|
22179
|
-
external_exports.object({ planId: shortString, sessionUpdate: external_exports.literal("plan_removed") }).readonly(),
|
|
22180
|
-
external_exports.object({
|
|
22181
|
-
availableCommands: external_exports.array(commandSchema).max(MAX_COLLECTION_SIZE2).readonly(),
|
|
22182
|
-
sessionUpdate: external_exports.literal("available_commands_update")
|
|
22183
|
-
}).readonly(),
|
|
22184
|
-
external_exports.object({
|
|
22185
|
-
currentModeId: shortString,
|
|
22186
|
-
sessionUpdate: external_exports.literal("current_mode_update")
|
|
22187
|
-
}).readonly(),
|
|
22188
|
-
external_exports.object({
|
|
22189
|
-
configOptions: external_exports.array(sessionConfigOptionSchema2).max(MAX_COLLECTION_SIZE2).readonly(),
|
|
22190
|
-
sessionUpdate: external_exports.literal("config_option_update")
|
|
22191
|
-
}).readonly(),
|
|
22192
|
-
external_exports.object({
|
|
22193
|
-
sessionUpdate: external_exports.literal("session_info_update"),
|
|
22194
|
-
title: boundedString2.nullable().optional(),
|
|
22195
|
-
updatedAt: shortString.nullable().optional()
|
|
22196
|
-
}).readonly(),
|
|
22197
|
-
external_exports.object({
|
|
22198
|
-
cost: external_exports.object({ amount: external_exports.number().finite(), currency: external_exports.string().max(16) }).readonly().nullable().optional(),
|
|
22199
|
-
sessionUpdate: external_exports.literal("usage_update"),
|
|
22200
|
-
size: external_exports.number().int().nonnegative().safe(),
|
|
22201
|
-
used: external_exports.number().int().nonnegative().safe()
|
|
22202
|
-
}).readonly(),
|
|
22460
|
+
var nativeSessionCommandSchema = external_exports.discriminatedUnion("action", [
|
|
22461
|
+
external_exports.object({ ...identity, action: external_exports.literal("active-turn"), targetSessionId: identifierStringSchema }).readonly(),
|
|
22462
|
+
external_exports.object({ ...identity, action: external_exports.literal("find"), nativeSessionId: identifierStringSchema }).readonly(),
|
|
22203
22463
|
external_exports.object({
|
|
22204
|
-
|
|
22205
|
-
|
|
22206
|
-
|
|
22207
|
-
status: shortString,
|
|
22208
|
-
summary: external_exports.array(contentBlockSchema).max(MAX_COLLECTION_SIZE2).readonly().nullable().optional()
|
|
22464
|
+
...identity,
|
|
22465
|
+
action: external_exports.literal("list"),
|
|
22466
|
+
cursor: identifierStringSchema.nullable()
|
|
22209
22467
|
}).readonly(),
|
|
22210
22468
|
external_exports.object({
|
|
22211
|
-
|
|
22212
|
-
|
|
22213
|
-
|
|
22469
|
+
...identity,
|
|
22470
|
+
action: external_exports.enum(["import", "fork"]),
|
|
22471
|
+
entryId: identifierStringSchema,
|
|
22472
|
+
targetSessionId: identifierStringSchema
|
|
22214
22473
|
}).readonly()
|
|
22215
22474
|
]);
|
|
22216
|
-
var
|
|
22217
|
-
|
|
22218
|
-
|
|
22475
|
+
var nativeSessionEntrySchema = external_exports.object({
|
|
22476
|
+
entryId: identifierStringSchema,
|
|
22477
|
+
mobiusSessionIds: external_exports.array(identifierStringSchema).max(500).readonly(),
|
|
22478
|
+
nativeSessionId: identifierStringSchema,
|
|
22479
|
+
title: external_exports.string().max(500),
|
|
22219
22480
|
directoryId: DIRECTORY_IDENTIFIER,
|
|
22220
|
-
|
|
22481
|
+
directoryLabel: external_exports.string().min(1).max(MAX_WORKSPACE_PATH_LENGTH),
|
|
22482
|
+
updatedAt: external_exports.iso.datetime({ offset: true }).nullable(),
|
|
22483
|
+
additionalDirectories: external_exports.array(external_exports.object({ directoryId: DIRECTORY_IDENTIFIER, name: external_exports.string().min(1).max(255) }).readonly()).max(16).readonly()
|
|
22221
22484
|
}).readonly();
|
|
22222
|
-
var
|
|
22223
|
-
|
|
22224
|
-
|
|
22225
|
-
|
|
22226
|
-
|
|
22227
|
-
external_exports.object({ event: sessionElicitationResolvedEventSchema, kind: external_exports.literal("session.elicitation.resolved") }).readonly(),
|
|
22485
|
+
var resultEnvelope = {
|
|
22486
|
+
...envelope,
|
|
22487
|
+
kind: external_exports.literal(NATIVE_SESSION_RESULT_KIND)
|
|
22488
|
+
};
|
|
22489
|
+
var nativeSessionResultSchema = external_exports.discriminatedUnion("action", [
|
|
22228
22490
|
external_exports.object({
|
|
22229
|
-
...
|
|
22230
|
-
|
|
22231
|
-
|
|
22232
|
-
|
|
22233
|
-
|
|
22234
|
-
|
|
22491
|
+
...resultEnvelope,
|
|
22492
|
+
action: external_exports.literal("active-turn"),
|
|
22493
|
+
targetSessionId: identifierStringSchema,
|
|
22494
|
+
queued: external_exports.array(
|
|
22495
|
+
external_exports.object({
|
|
22496
|
+
commandId: identifierStringSchema,
|
|
22497
|
+
prompt: external_exports.string().max(1e5),
|
|
22498
|
+
attachments: external_exports.array(promptAttachmentSchema).max(16).readonly()
|
|
22499
|
+
}).readonly()
|
|
22500
|
+
).readonly(),
|
|
22501
|
+
turn: activeTurnSnapshotSchema.nullable()
|
|
22235
22502
|
}).readonly(),
|
|
22236
|
-
external_exports.object({ ...lifecycleBase, attemptId: identifierStringSchema, epoch: identifierStringSchema, kind: external_exports.literal("prompt.started") }).readonly(),
|
|
22237
22503
|
external_exports.object({
|
|
22238
|
-
...
|
|
22239
|
-
|
|
22240
|
-
|
|
22504
|
+
...resultEnvelope,
|
|
22505
|
+
action: external_exports.literal("find"),
|
|
22506
|
+
entry: nativeSessionEntrySchema
|
|
22241
22507
|
}).readonly(),
|
|
22242
22508
|
external_exports.object({
|
|
22243
|
-
...
|
|
22244
|
-
|
|
22245
|
-
|
|
22246
|
-
|
|
22509
|
+
...resultEnvelope,
|
|
22510
|
+
action: external_exports.literal("list"),
|
|
22511
|
+
capabilities: sessionCapabilitiesSchema,
|
|
22512
|
+
entries: external_exports.array(nativeSessionEntrySchema).max(500).readonly(),
|
|
22513
|
+
nextCursor: identifierStringSchema.nullable()
|
|
22247
22514
|
}).readonly(),
|
|
22248
22515
|
external_exports.object({
|
|
22249
|
-
...
|
|
22250
|
-
|
|
22251
|
-
|
|
22252
|
-
|
|
22253
|
-
|
|
22254
|
-
}).readonly()
|
|
22255
|
-
]);
|
|
22256
|
-
var sessionEventPayloadSchema = external_exports.discriminatedUnion("type", [
|
|
22257
|
-
external_exports.object({ payload: acpSessionUpdateSchema, type: external_exports.literal("acp") }).readonly(),
|
|
22258
|
-
external_exports.object({ payload: lifecycleMetadataSchema, type: external_exports.literal("lifecycle-metadata") }).readonly()
|
|
22259
|
-
]);
|
|
22260
|
-
var positionSchema = external_exports.string().regex(/^(0|[1-9][0-9]*)$/);
|
|
22261
|
-
var sharedSessionEventFields = {
|
|
22262
|
-
eventId: identifierStringSchema,
|
|
22263
|
-
mobiusMetadata: external_exports.object({ omitted: external_exports.literal(true).optional() }).readonly().optional(),
|
|
22264
|
-
recordedAt: external_exports.iso.datetime({ offset: true }),
|
|
22265
|
-
sessionGenerationId: identifierStringSchema,
|
|
22266
|
-
sessionId: identifierStringSchema
|
|
22267
|
-
};
|
|
22268
|
-
var sessionLiveEventFields = { ...sharedSessionEventFields, position: positionSchema };
|
|
22269
|
-
var sessionEventSchema = external_exports.object({ ...sharedSessionEventFields, payload: acpSessionUpdateSchema, type: external_exports.literal("acp") }).readonly();
|
|
22270
|
-
var sessionLiveEventSchema = external_exports.discriminatedUnion("type", [
|
|
22271
|
-
external_exports.object({ ...sessionLiveEventFields, payload: acpSessionUpdateSchema, type: external_exports.literal("acp") }).readonly(),
|
|
22272
|
-
external_exports.object({
|
|
22273
|
-
...sessionLiveEventFields,
|
|
22274
|
-
payload: lifecycleMetadataSchema,
|
|
22275
|
-
type: external_exports.literal("lifecycle-metadata")
|
|
22516
|
+
...resultEnvelope,
|
|
22517
|
+
action: external_exports.enum(["import", "fork"]),
|
|
22518
|
+
targetSessionId: identifierStringSchema,
|
|
22519
|
+
ready: sessionReadyEventSchema,
|
|
22520
|
+
title: external_exports.string().max(500)
|
|
22276
22521
|
}).readonly()
|
|
22277
22522
|
]);
|
|
22278
|
-
var
|
|
22279
|
-
|
|
22280
|
-
commandId: identifierStringSchema.optional(),
|
|
22281
|
-
context: promptExecutionContextSchema.unwrap().passthrough().readonly().optional(),
|
|
22282
|
-
event: external_exports.object({ interactionId: identifierStringSchema.optional() }).passthrough().readonly().optional()
|
|
22283
|
-
}).passthrough().readonly();
|
|
22284
|
-
var wireEventFields = {
|
|
22285
|
-
...sessionLiveEventFields,
|
|
22286
|
-
mobiusMetadata: external_exports.object({ omitted: external_exports.literal(true).optional() }).passthrough().readonly().optional()
|
|
22287
|
-
};
|
|
22288
|
-
var sessionWireEventSchema = external_exports.union([
|
|
22289
|
-
external_exports.object({
|
|
22290
|
-
...wireEventFields,
|
|
22291
|
-
type: external_exports.literal("acp"),
|
|
22292
|
-
payload: external_exports.object({ sessionUpdate: identifierStringSchema }).passthrough().readonly()
|
|
22293
|
-
}).passthrough().readonly(),
|
|
22294
|
-
external_exports.object({
|
|
22295
|
-
...wireEventFields,
|
|
22296
|
-
type: external_exports.literal("lifecycle-metadata"),
|
|
22297
|
-
payload: wireLifecyclePayloadSchema
|
|
22298
|
-
}).passthrough().readonly(),
|
|
22299
|
-
external_exports.object({
|
|
22300
|
-
...wireEventFields,
|
|
22301
|
-
type: identifierStringSchema.refine((type) => type !== "acp" && type !== "lifecycle-metadata"),
|
|
22302
|
-
payload: external_exports.record(external_exports.string(), external_exports.unknown()).readonly()
|
|
22303
|
-
}).passthrough().readonly()
|
|
22304
|
-
]);
|
|
22305
|
-
var sessionWireEnvelopeSchema = external_exports.object({
|
|
22306
|
-
kind: external_exports.literal(SESSION_EVENT_KIND),
|
|
22307
|
-
events: external_exports.array(sessionWireEventSchema).min(1).max(SESSION_EVENT_BATCH_MAX_SIZE).readonly()
|
|
22308
|
-
}).passthrough().readonly();
|
|
22309
|
-
var knownContentBlockTypes = /* @__PURE__ */ new Set([
|
|
22310
|
-
"text",
|
|
22311
|
-
"image",
|
|
22312
|
-
"audio",
|
|
22313
|
-
"resource_link",
|
|
22314
|
-
"resource",
|
|
22315
|
-
"external_image",
|
|
22316
|
-
"external_audio",
|
|
22317
|
-
"external_resource"
|
|
22318
|
-
]);
|
|
22319
|
-
var knownToolCallContentTypes = /* @__PURE__ */ new Set(["content", "diff", "terminal"]);
|
|
22320
|
-
var knownPlanTypes = /* @__PURE__ */ new Set(["items", "file", "markdown"]);
|
|
22321
|
-
var knownConfigOptionTypes = /* @__PURE__ */ new Set(["select", "boolean"]);
|
|
22322
|
-
var knownSessionUpdates = /* @__PURE__ */ new Set([
|
|
22323
|
-
"user_message_chunk",
|
|
22324
|
-
"agent_message_chunk",
|
|
22325
|
-
"agent_thought_chunk",
|
|
22326
|
-
"tool_call",
|
|
22327
|
-
"tool_call_update",
|
|
22328
|
-
"plan",
|
|
22329
|
-
"plan_update",
|
|
22330
|
-
"plan_removed",
|
|
22331
|
-
"available_commands_update",
|
|
22332
|
-
"current_mode_update",
|
|
22333
|
-
"config_option_update",
|
|
22334
|
-
"session_info_update",
|
|
22335
|
-
"usage_update",
|
|
22336
|
-
"compaction_update",
|
|
22337
|
-
"compaction_summary_chunk"
|
|
22338
|
-
]);
|
|
22339
|
-
var knownLifecycleKinds = /* @__PURE__ */ new Set([
|
|
22340
|
-
"session.queue.changed",
|
|
22341
|
-
"session.permission.requested",
|
|
22342
|
-
"session.permission.resolved",
|
|
22343
|
-
"session.elicitation.requested",
|
|
22344
|
-
"session.elicitation.resolved",
|
|
22345
|
-
"prompt.requested",
|
|
22346
|
-
"prompt.started",
|
|
22347
|
-
"prompt.completed",
|
|
22348
|
-
"prompt.failed-before-start",
|
|
22349
|
-
"prompt.failed"
|
|
22350
|
-
]);
|
|
22351
|
-
function isRecord3(value) {
|
|
22352
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
22353
|
-
}
|
|
22354
|
-
function hasUnknownDiscriminator(value, key, known) {
|
|
22355
|
-
if (!isRecord3(value)) {
|
|
22356
|
-
return false;
|
|
22357
|
-
}
|
|
22358
|
-
const variant = value[key];
|
|
22359
|
-
return typeof variant === "string" && !known.has(variant);
|
|
22360
|
-
}
|
|
22361
|
-
function containsUnknownContentBlock(value) {
|
|
22362
|
-
return hasUnknownDiscriminator(value, "type", knownContentBlockTypes);
|
|
22363
|
-
}
|
|
22364
|
-
function containsUnknownToolCallContent(value) {
|
|
22365
|
-
if (hasUnknownDiscriminator(value, "type", knownToolCallContentTypes)) {
|
|
22366
|
-
return true;
|
|
22367
|
-
}
|
|
22368
|
-
return isRecord3(value) && value["type"] === "content" && containsUnknownContentBlock(value["content"]);
|
|
22369
|
-
}
|
|
22370
|
-
function arrayContainsUnknown(value, predicate) {
|
|
22371
|
-
return Array.isArray(value) && value.some(predicate);
|
|
22372
|
-
}
|
|
22373
|
-
function containsUnknownAcpVariant(payload) {
|
|
22374
|
-
const update = payload["sessionUpdate"];
|
|
22375
|
-
if (typeof update !== "string") {
|
|
22376
|
-
return false;
|
|
22377
|
-
}
|
|
22378
|
-
if (!knownSessionUpdates.has(update)) {
|
|
22379
|
-
return true;
|
|
22380
|
-
}
|
|
22381
|
-
if (["user_message_chunk", "agent_message_chunk", "agent_thought_chunk", "compaction_summary_chunk"].includes(
|
|
22382
|
-
update
|
|
22383
|
-
)) {
|
|
22384
|
-
return containsUnknownContentBlock(payload["content"]);
|
|
22385
|
-
}
|
|
22386
|
-
if (update === "tool_call" || update === "tool_call_update") {
|
|
22387
|
-
return arrayContainsUnknown(payload["content"], containsUnknownToolCallContent);
|
|
22388
|
-
}
|
|
22389
|
-
if (update === "plan_update") {
|
|
22390
|
-
return hasUnknownDiscriminator(payload["plan"], "type", knownPlanTypes);
|
|
22391
|
-
}
|
|
22392
|
-
if (update === "config_option_update") {
|
|
22393
|
-
return arrayContainsUnknown(
|
|
22394
|
-
payload["configOptions"],
|
|
22395
|
-
(option) => hasUnknownDiscriminator(option, "type", knownConfigOptionTypes)
|
|
22396
|
-
);
|
|
22397
|
-
}
|
|
22398
|
-
if (update === "compaction_update") {
|
|
22399
|
-
return arrayContainsUnknown(payload["summary"], containsUnknownContentBlock);
|
|
22400
|
-
}
|
|
22401
|
-
return false;
|
|
22402
|
-
}
|
|
22403
|
-
function isKnownSessionEventVariant(value) {
|
|
22404
|
-
if (!isRecord3(value)) {
|
|
22405
|
-
return true;
|
|
22406
|
-
}
|
|
22407
|
-
const type = value["type"];
|
|
22408
|
-
if (typeof type !== "string") {
|
|
22409
|
-
return true;
|
|
22410
|
-
}
|
|
22411
|
-
if (type === "acp") {
|
|
22412
|
-
const payload = value["payload"];
|
|
22413
|
-
return !isRecord3(payload) || !containsUnknownAcpVariant(payload);
|
|
22414
|
-
}
|
|
22415
|
-
if (type === "lifecycle-metadata") {
|
|
22416
|
-
const payload = value["payload"];
|
|
22417
|
-
if (!isRecord3(payload)) {
|
|
22418
|
-
return true;
|
|
22419
|
-
}
|
|
22420
|
-
const kind = payload["kind"];
|
|
22421
|
-
if (typeof kind === "string" && !knownLifecycleKinds.has(kind)) {
|
|
22422
|
-
return false;
|
|
22423
|
-
}
|
|
22424
|
-
return kind !== "prompt.requested" || !arrayContainsUnknown(payload["content"], containsUnknownContentBlock);
|
|
22425
|
-
}
|
|
22426
|
-
return false;
|
|
22427
|
-
}
|
|
22428
|
-
function filterKnownSessionEventVariants(events) {
|
|
22429
|
-
return Array.isArray(events) ? events.filter(isKnownSessionEventVariant) : events;
|
|
22430
|
-
}
|
|
22431
|
-
var sessionEventBatchSchema = external_exports.array(sessionEventSchema).min(1).max(SESSION_EVENT_BATCH_MAX_SIZE).readonly();
|
|
22432
|
-
var sessionLiveEventBatchSchema = external_exports.array(sessionLiveEventSchema).min(1).max(SESSION_EVENT_BATCH_MAX_SIZE).readonly();
|
|
22433
|
-
var sessionExportSchema = external_exports.object({
|
|
22434
|
-
binding: external_exports.object({
|
|
22435
|
-
bindingId: identifierStringSchema,
|
|
22436
|
-
runtimeId: identifierStringSchema
|
|
22437
|
-
}).readonly(),
|
|
22438
|
-
events: external_exports.array(sessionEventSchema).max(MAX_EVENT_COUNT).readonly(),
|
|
22439
|
-
sessionId: identifierStringSchema,
|
|
22440
|
-
truncated: external_exports.boolean()
|
|
22441
|
-
}).readonly().superRefine((session, context) => {
|
|
22442
|
-
const eventIds = /* @__PURE__ */ new Set();
|
|
22443
|
-
for (const [index2, event] of session.events.entries()) {
|
|
22444
|
-
if (event.sessionId !== session.sessionId) {
|
|
22445
|
-
context.addIssue({
|
|
22446
|
-
code: "custom",
|
|
22447
|
-
message: "Exported event belongs to a different Session",
|
|
22448
|
-
path: ["events", index2, "sessionId"]
|
|
22449
|
-
});
|
|
22450
|
-
}
|
|
22451
|
-
if (eventIds.has(event.eventId)) {
|
|
22452
|
-
context.addIssue({
|
|
22453
|
-
code: "custom",
|
|
22454
|
-
message: "Exported event identities are not unique",
|
|
22455
|
-
path: ["events", index2, "eventId"]
|
|
22456
|
-
});
|
|
22457
|
-
}
|
|
22458
|
-
eventIds.add(event.eventId);
|
|
22459
|
-
}
|
|
22460
|
-
});
|
|
22461
|
-
var mobiusSessionExportSchema = external_exports.object({
|
|
22462
|
-
formatVersion: external_exports.literal("2"),
|
|
22463
|
-
session: sessionExportSchema
|
|
22464
|
-
}).readonly();
|
|
22465
|
-
var sessionEventEnvelopeSchema = external_exports.object({ events: sessionLiveEventBatchSchema, kind: external_exports.literal(SESSION_EVENT_KIND) }).readonly();
|
|
22466
|
-
var sessionEventLogPageSchema = external_exports.object({
|
|
22467
|
-
events: external_exports.array(sessionEventSchema).max(MAX_EVENT_COUNT).readonly(),
|
|
22468
|
-
nextCursor: external_exports.string().min(1).max(512).nullable(),
|
|
22469
|
-
sessionGenerationId: identifierStringSchema,
|
|
22470
|
-
tailCursor: external_exports.string().max(512),
|
|
22471
|
-
// The generation-scoped live position covered by this snapshot, including
|
|
22472
|
-
// coalesced and omitted events. Absent only on older Runtime versions.
|
|
22473
|
-
throughPosition: positionSchema.optional(),
|
|
22474
|
-
truncated: external_exports.boolean(),
|
|
22475
|
-
version: external_exports.literal(2)
|
|
22476
|
-
}).readonly();
|
|
22477
|
-
var sessionEventOmissionSchema = external_exports.literal("agent-reasoning");
|
|
22478
|
-
var nativeEventPageRequestSchema = external_exports.object({
|
|
22479
|
-
cursor: external_exports.string().min(1).max(512).nullable(),
|
|
22480
|
-
eventLimit: external_exports.number().int().min(1).max(1e4),
|
|
22481
|
-
// Legacy callers may still send this option; readers must ignore it.
|
|
22482
|
-
omit: external_exports.array(sessionEventOmissionSchema).max(1).readonly().optional()
|
|
22483
|
-
}).readonly();
|
|
22484
|
-
var queuedPromptRequestEventLogSchema = external_exports.object({
|
|
22485
|
-
commandId: identifierStringSchema,
|
|
22486
|
-
content: external_exports.array(contentBlockSchema).min(1).max(100).readonly(),
|
|
22487
|
-
disposition: shortString.optional(),
|
|
22488
|
-
targetCommandId: identifierStringSchema.optional()
|
|
22489
|
-
}).readonly();
|
|
22490
|
-
var nativeSessionEventsSchema = external_exports.object({
|
|
22491
|
-
events: sessionEventLogPageSchema,
|
|
22492
|
-
queuedPromptRequests: external_exports.array(queuedPromptRequestEventLogSchema).max(MAX_COLLECTION_SIZE2).readonly()
|
|
22493
|
-
}).readonly();
|
|
22494
|
-
function inputValue(value) {
|
|
22495
|
-
if (typeof value !== "string") {
|
|
22496
|
-
return value;
|
|
22497
|
-
}
|
|
22523
|
+
var nativeSessionCancelSchema = external_exports.object({ ...envelope, kind: external_exports.literal(NATIVE_SESSION_CANCEL_KIND) }).readonly();
|
|
22524
|
+
function decode4(schema, encoded) {
|
|
22498
22525
|
try {
|
|
22499
|
-
|
|
22526
|
+
const value = JSON.parse(encoded);
|
|
22527
|
+
return schema.parse(value);
|
|
22500
22528
|
} catch (cause) {
|
|
22501
|
-
throw new ProtocolMessageError("
|
|
22502
|
-
}
|
|
22503
|
-
}
|
|
22504
|
-
function decode4(value, schema) {
|
|
22505
|
-
const result = schema.safeParse(inputValue(value));
|
|
22506
|
-
if (!result.success) {
|
|
22507
|
-
throw new ProtocolMessageError("Session Event Log V2 message does not match its schema", {
|
|
22508
|
-
cause: result.error
|
|
22509
|
-
});
|
|
22510
|
-
}
|
|
22511
|
-
return result.data;
|
|
22512
|
-
}
|
|
22513
|
-
function encode3(value, schema) {
|
|
22514
|
-
return JSON.stringify(decode4(value, schema));
|
|
22515
|
-
}
|
|
22516
|
-
function sanitizeKnownNativeSessionEvents(value) {
|
|
22517
|
-
const input2 = inputValue(value);
|
|
22518
|
-
if (!isRecord3(input2)) {
|
|
22519
|
-
return input2;
|
|
22529
|
+
throw new ProtocolMessageError("Invalid native session message", { cause });
|
|
22520
22530
|
}
|
|
22521
|
-
const page = input2["events"];
|
|
22522
|
-
const queuedPromptRequests = input2["queuedPromptRequests"];
|
|
22523
|
-
return {
|
|
22524
|
-
...input2,
|
|
22525
|
-
events: isRecord3(page) ? { ...page, events: filterKnownSessionEventVariants(page["events"]) } : page,
|
|
22526
|
-
queuedPromptRequests: Array.isArray(queuedPromptRequests) ? queuedPromptRequests.filter(
|
|
22527
|
-
(prompt) => !isRecord3(prompt) || !arrayContainsUnknown(prompt["content"], containsUnknownContentBlock)
|
|
22528
|
-
) : queuedPromptRequests
|
|
22529
|
-
};
|
|
22530
22531
|
}
|
|
22531
|
-
var
|
|
22532
|
-
var
|
|
22533
|
-
var
|
|
22534
|
-
var
|
|
22535
|
-
var
|
|
22536
|
-
var
|
|
22537
|
-
var decodeKnownNativeSessionEvents = (value) => decode4(sanitizeKnownNativeSessionEvents(value), nativeSessionEventsSchema);
|
|
22532
|
+
var decodeNativeSessionCommand = (encoded) => decode4(nativeSessionCommandSchema, encoded);
|
|
22533
|
+
var encodeNativeSessionCommand = (value) => JSON.stringify(nativeSessionCommandSchema.parse(value));
|
|
22534
|
+
var decodeNativeSessionResult = (encoded) => decode4(nativeSessionResultSchema, encoded);
|
|
22535
|
+
var encodeNativeSessionResult = (value) => JSON.stringify(nativeSessionResultSchema.parse(value));
|
|
22536
|
+
var decodeNativeSessionCancel = (encoded) => decode4(nativeSessionCancelSchema, encoded);
|
|
22537
|
+
var encodeNativeSessionCancel = (value) => JSON.stringify(nativeSessionCancelSchema.parse(value));
|
|
22538
22538
|
|
|
22539
22539
|
// ../mobius-sdk/src/protocol/session/observability/history.ts
|
|
22540
22540
|
var SESSION_HISTORY_PAGE_LOAD_KIND = "session.live-history.v2.page.load";
|
|
@@ -32557,7 +32557,7 @@ import { fetch as fetch3 } from "undici";
|
|
|
32557
32557
|
// package.json
|
|
32558
32558
|
var package_default = {
|
|
32559
32559
|
name: "@moxt-ai/mobius",
|
|
32560
|
-
version: "0.0.
|
|
32560
|
+
version: "0.0.338",
|
|
32561
32561
|
description: "Mobius CLI for pairing and running local AI agent services.",
|
|
32562
32562
|
type: "module",
|
|
32563
32563
|
bin: {
|
|
@@ -73734,16 +73734,20 @@ var ClaudeAcpAgent = class {
|
|
|
73734
73734
|
}, message.tool_use_id !== void 0)
|
|
73735
73735
|
});
|
|
73736
73736
|
}
|
|
73737
|
-
backgroundTasks.delete(message.task_id);
|
|
73738
73737
|
if (message.skip_transcript) {
|
|
73738
|
+
backgroundTasks.delete(message.task_id);
|
|
73739
73739
|
awaitingBackgroundResults.delete(message.task_id);
|
|
73740
|
-
} else {
|
|
73740
|
+
} else if (backgroundTasks.delete(message.task_id)) {
|
|
73741
73741
|
awaitingBackgroundResults.add(message.task_id);
|
|
73742
73742
|
}
|
|
73743
73743
|
reportBackgroundActivity();
|
|
73744
73744
|
session.liveBackgroundTasks.delete(message.task_id);
|
|
73745
73745
|
break;
|
|
73746
73746
|
case "task_updated":
|
|
73747
|
+
if (!hasBackgroundLevel && message.patch.is_backgrounded === true) {
|
|
73748
|
+
backgroundTasks.add(message.task_id);
|
|
73749
|
+
reportBackgroundActivity();
|
|
73750
|
+
}
|
|
73747
73751
|
if (message.patch.status === "completed" || message.patch.status === "failed" || message.patch.status === "killed") {
|
|
73748
73752
|
session.liveBackgroundTasks.delete(message.task_id);
|
|
73749
73753
|
if (backgroundTasks.delete(message.task_id)) {
|
|
@@ -87460,56 +87464,82 @@ var ExecutionReceipts = class {
|
|
|
87460
87464
|
var RuntimeTurnActivity = class {
|
|
87461
87465
|
#turns = /* @__PURE__ */ new Set();
|
|
87462
87466
|
#backgroundSources = /* @__PURE__ */ new Set();
|
|
87463
|
-
#
|
|
87464
|
-
|
|
87467
|
+
#idleWaiters = /* @__PURE__ */ new Set();
|
|
87468
|
+
// When work last started or stopped; the quiet period is measured from here.
|
|
87469
|
+
#changedAt = Date.now();
|
|
87470
|
+
#reserved = false;
|
|
87471
|
+
acceptsPrompts = () => !this.#reserved;
|
|
87465
87472
|
count = () => this.#turns.size + this.#backgroundSources.size;
|
|
87473
|
+
describe = () => ({
|
|
87474
|
+
turns: this.#turns.size,
|
|
87475
|
+
backgroundSources: this.#backgroundSources.size
|
|
87476
|
+
});
|
|
87466
87477
|
setBackgroundActivity = (source, active) => {
|
|
87478
|
+
if (active === this.#backgroundSources.has(source)) {
|
|
87479
|
+
return;
|
|
87480
|
+
}
|
|
87467
87481
|
if (active) {
|
|
87468
87482
|
this.#backgroundSources.add(source);
|
|
87469
87483
|
} else {
|
|
87470
87484
|
this.#backgroundSources.delete(source);
|
|
87471
87485
|
}
|
|
87472
|
-
this.#
|
|
87486
|
+
this.#changed();
|
|
87473
87487
|
};
|
|
87474
|
-
#reserveIfIdle() {
|
|
87475
|
-
if (this.count() === 0 && this.#admission.kind === "waiting") {
|
|
87476
|
-
this.#admission.reserve();
|
|
87477
|
-
}
|
|
87478
|
-
}
|
|
87479
87488
|
start = (turn) => {
|
|
87480
87489
|
this.#turns.add(turn);
|
|
87490
|
+
this.#changed();
|
|
87481
87491
|
};
|
|
87482
87492
|
finish = (turn) => {
|
|
87483
87493
|
this.#turns.delete(turn);
|
|
87484
|
-
this.#
|
|
87494
|
+
this.#changed();
|
|
87485
87495
|
};
|
|
87486
|
-
|
|
87496
|
+
#changed() {
|
|
87497
|
+
this.#changedAt = Date.now();
|
|
87498
|
+
if (this.count() === 0) {
|
|
87499
|
+
for (const resolve19 of this.#idleWaiters) {
|
|
87500
|
+
resolve19();
|
|
87501
|
+
}
|
|
87502
|
+
this.#idleWaiters.clear();
|
|
87503
|
+
}
|
|
87504
|
+
}
|
|
87505
|
+
whenIdle = (signal) => {
|
|
87487
87506
|
signal.throwIfAborted();
|
|
87488
|
-
if (this
|
|
87489
|
-
|
|
87507
|
+
if (this.count() === 0) {
|
|
87508
|
+
return Promise.resolve();
|
|
87490
87509
|
}
|
|
87491
87510
|
return new Promise((resolve19, reject2) => {
|
|
87492
87511
|
const abort = () => {
|
|
87493
|
-
this.#
|
|
87494
|
-
signal.removeEventListener("abort", abort);
|
|
87512
|
+
this.#idleWaiters.delete(idle);
|
|
87495
87513
|
reject2(signal.reason);
|
|
87496
87514
|
};
|
|
87497
|
-
const
|
|
87498
|
-
this.#admission = { kind: "reserved" };
|
|
87515
|
+
const idle = () => {
|
|
87499
87516
|
signal.removeEventListener("abort", abort);
|
|
87500
|
-
resolve19(
|
|
87501
|
-
[Symbol.dispose]: () => {
|
|
87502
|
-
this.#admission = { kind: "open" };
|
|
87503
|
-
}
|
|
87504
|
-
});
|
|
87517
|
+
resolve19();
|
|
87505
87518
|
};
|
|
87506
|
-
this.#
|
|
87519
|
+
this.#idleWaiters.add(idle);
|
|
87507
87520
|
signal.addEventListener("abort", abort, { once: true });
|
|
87508
|
-
if (this.count() === 0) {
|
|
87509
|
-
reserve();
|
|
87510
|
-
}
|
|
87511
87521
|
});
|
|
87512
87522
|
};
|
|
87523
|
+
/**
|
|
87524
|
+
* Close admission only after the Runtime has had no work for `quietMilliseconds`.
|
|
87525
|
+
* The moment a reply finishes is when a user is most likely to continue, so idle
|
|
87526
|
+
* alone is not an upgrade window. Checking and reserving happen synchronously, so
|
|
87527
|
+
* no prompt can be admitted between them.
|
|
87528
|
+
*/
|
|
87529
|
+
reserveIfQuiet = (quietMilliseconds) => {
|
|
87530
|
+
if (this.#reserved) {
|
|
87531
|
+
throw new Error("A daemon upgrade already owns admission");
|
|
87532
|
+
}
|
|
87533
|
+
if (this.count() > 0 || Date.now() - this.#changedAt < quietMilliseconds) {
|
|
87534
|
+
return null;
|
|
87535
|
+
}
|
|
87536
|
+
this.#reserved = true;
|
|
87537
|
+
return {
|
|
87538
|
+
[Symbol.dispose]: () => {
|
|
87539
|
+
this.#reserved = false;
|
|
87540
|
+
}
|
|
87541
|
+
};
|
|
87542
|
+
};
|
|
87513
87543
|
};
|
|
87514
87544
|
|
|
87515
87545
|
// src/session/turn/active-turn.ts
|