@moxt-ai/mobius 0.0.165 → 0.0.167
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/acp/agent-query-processes.d.ts +2 -1
- package/dist/acp/agent-query-processes.d.ts.map +1 -1
- package/dist/acp/agent-query-processes.js +6 -4
- package/dist/acp/agent-query-processes.js.map +1 -1
- package/dist/acp/agent-runtime-manager.d.ts +2 -1
- package/dist/acp/agent-runtime-manager.d.ts.map +1 -1
- package/dist/acp/agent-runtime-manager.js +11 -6
- package/dist/acp/agent-runtime-manager.js.map +1 -1
- package/dist/acp/agent-session.d.ts +3 -2
- package/dist/acp/agent-session.d.ts.map +1 -1
- package/dist/acp/agent-session.js +9 -6
- package/dist/acp/agent-session.js.map +1 -1
- package/dist/artifacts/local-file-streamer.d.ts +2 -1
- package/dist/artifacts/local-file-streamer.d.ts.map +1 -1
- package/dist/artifacts/local-file-streamer.js +6 -5
- package/dist/artifacts/local-file-streamer.js.map +1 -1
- package/dist/cli.js +585 -327
- package/dist/cli.js.map +4 -4
- package/dist/config.d.ts +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -1
- package/dist/config.js.map +1 -1
- package/dist/daemon-command-handler.d.ts +3 -1
- package/dist/daemon-command-handler.d.ts.map +1 -1
- package/dist/daemon-command-handler.js +2 -2
- package/dist/daemon-command-handler.js.map +1 -1
- package/dist/external-content/acp-content-externalizer.d.ts +8 -0
- package/dist/external-content/acp-content-externalizer.d.ts.map +1 -0
- package/dist/external-content/acp-content-externalizer.js +131 -0
- package/dist/external-content/acp-content-externalizer.js.map +1 -0
- package/dist/external-content/local-external-content-store.d.ts +32 -0
- package/dist/external-content/local-external-content-store.d.ts.map +1 -0
- package/dist/external-content/local-external-content-store.js +88 -0
- package/dist/external-content/local-external-content-store.js.map +1 -0
- package/dist/index.js +643 -391
- package/dist/index.js.map +4 -4
- package/dist/relay-connection/run-relay-connection.d.ts +3 -1
- package/dist/relay-connection/run-relay-connection.d.ts.map +1 -1
- package/dist/relay-connection/run-relay-connection.js +11 -2
- package/dist/relay-connection/run-relay-connection.js.map +1 -1
- package/dist/run-daemon.d.ts.map +1 -1
- package/dist/run-daemon.js +5 -1
- package/dist/run-daemon.js.map +1 -1
- package/dist/runtime.d.ts +2 -1
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +584 -331
- package/dist/runtime.js.map +4 -4
- package/package.json +16 -10
package/dist/cli.js
CHANGED
|
@@ -7,7 +7,7 @@ var __export = (target, all) => {
|
|
|
7
7
|
|
|
8
8
|
// src/cli.ts
|
|
9
9
|
import { constants as constants2 } from "node:fs";
|
|
10
|
-
import { mkdir as
|
|
10
|
+
import { mkdir as mkdir7, open as open6 } from "node:fs/promises";
|
|
11
11
|
import { resolve as resolve8 } from "node:path";
|
|
12
12
|
|
|
13
13
|
// ../../node_modules/.pnpm/commander@15.0.0/node_modules/commander/lib/error.js
|
|
@@ -3381,21 +3381,16 @@ var program = new Command();
|
|
|
3381
3381
|
// package.json
|
|
3382
3382
|
var package_default = {
|
|
3383
3383
|
name: "@moxt-ai/mobius",
|
|
3384
|
-
version: "0.0.
|
|
3384
|
+
version: "0.0.167",
|
|
3385
3385
|
description: "Mobius CLI for pairing and running local AI agent services.",
|
|
3386
3386
|
type: "module",
|
|
3387
3387
|
bin: {
|
|
3388
3388
|
mobius: "dist/cli.js"
|
|
3389
3389
|
},
|
|
3390
|
+
types: "./src/index.ts",
|
|
3390
3391
|
exports: {
|
|
3391
|
-
".":
|
|
3392
|
-
|
|
3393
|
-
import: "./dist/index.js"
|
|
3394
|
-
},
|
|
3395
|
-
"./runtime": {
|
|
3396
|
-
types: "./dist/runtime.d.ts",
|
|
3397
|
-
import: "./dist/runtime.js"
|
|
3398
|
-
}
|
|
3392
|
+
".": "./src/index.ts",
|
|
3393
|
+
"./runtime": "./src/runtime.ts"
|
|
3399
3394
|
},
|
|
3400
3395
|
files: [
|
|
3401
3396
|
"dist"
|
|
@@ -3404,7 +3399,18 @@ var package_default = {
|
|
|
3404
3399
|
node: ">=22.13.0"
|
|
3405
3400
|
},
|
|
3406
3401
|
publishConfig: {
|
|
3407
|
-
access: "public"
|
|
3402
|
+
access: "public",
|
|
3403
|
+
types: "./dist/index.d.ts",
|
|
3404
|
+
exports: {
|
|
3405
|
+
".": {
|
|
3406
|
+
types: "./dist/index.d.ts",
|
|
3407
|
+
import: "./dist/index.js"
|
|
3408
|
+
},
|
|
3409
|
+
"./runtime": {
|
|
3410
|
+
types: "./dist/runtime.d.ts",
|
|
3411
|
+
import: "./dist/runtime.js"
|
|
3412
|
+
}
|
|
3413
|
+
}
|
|
3408
3414
|
},
|
|
3409
3415
|
repository: {
|
|
3410
3416
|
type: "git",
|
|
@@ -28411,61 +28417,61 @@ var DIRECTORY_IDENTIFIER_PATTERN = /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,2047}$/;
|
|
|
28411
28417
|
var DIRECTORY_IDENTIFIER = external_exports.string().min(1).max(2048).regex(DIRECTORY_IDENTIFIER_PATTERN);
|
|
28412
28418
|
var SHORT_TEXT = external_exports.string().max(500);
|
|
28413
28419
|
var LONG_TEXT = external_exports.string().max(1e5);
|
|
28414
|
-
var workspaceEntrySchema = external_exports.
|
|
28420
|
+
var workspaceEntrySchema = external_exports.object({
|
|
28415
28421
|
directoryId: DIRECTORY_IDENTIFIER,
|
|
28416
28422
|
name: external_exports.string().min(1).max(255)
|
|
28417
28423
|
}).readonly();
|
|
28418
28424
|
var sessionStatusSchema = external_exports.discriminatedUnion("kind", [
|
|
28419
|
-
external_exports.
|
|
28420
|
-
external_exports.
|
|
28425
|
+
external_exports.object({ kind: external_exports.literal("idle") }).readonly(),
|
|
28426
|
+
external_exports.object({
|
|
28421
28427
|
commandId: identifierStringSchema,
|
|
28422
28428
|
kind: external_exports.literal("working")
|
|
28423
28429
|
}).readonly()
|
|
28424
28430
|
]);
|
|
28425
|
-
var sessionStatusChangedEventSchema = external_exports.
|
|
28431
|
+
var sessionStatusChangedEventSchema = external_exports.object({
|
|
28426
28432
|
kind: external_exports.literal(SESSION_STATUS_CHANGED_KIND),
|
|
28427
28433
|
sessionId: identifierStringSchema,
|
|
28428
28434
|
status: sessionStatusSchema
|
|
28429
28435
|
}).readonly();
|
|
28430
|
-
var sessionMetadataSchema = external_exports.
|
|
28436
|
+
var sessionMetadataSchema = external_exports.object({
|
|
28431
28437
|
additionalDirectories: external_exports.array(workspaceEntrySchema).max(16).readonly(),
|
|
28432
28438
|
agentId: identifierStringSchema,
|
|
28433
28439
|
directoryId: DIRECTORY_IDENTIFIER,
|
|
28434
28440
|
directoryLabel: external_exports.string().min(1).max(2048),
|
|
28435
28441
|
prompted: external_exports.boolean(),
|
|
28436
28442
|
sessionId: identifierStringSchema,
|
|
28437
|
-
status: sessionStatusSchema,
|
|
28443
|
+
status: sessionStatusSchema.default({ kind: "idle" }),
|
|
28438
28444
|
title: external_exports.string().max(500),
|
|
28439
28445
|
updatedAt: external_exports.iso.datetime({ offset: true })
|
|
28440
28446
|
}).readonly();
|
|
28441
|
-
var sessionListCommandSchema = external_exports.
|
|
28447
|
+
var sessionListCommandSchema = external_exports.object({
|
|
28442
28448
|
kind: external_exports.literal(SESSION_LIST_KIND),
|
|
28443
28449
|
limit: external_exports.number().int().positive().max(500),
|
|
28444
28450
|
requestId: identifierStringSchema
|
|
28445
28451
|
}).readonly();
|
|
28446
|
-
var sessionsListedEventSchema = external_exports.
|
|
28452
|
+
var sessionsListedEventSchema = external_exports.object({
|
|
28447
28453
|
entries: external_exports.array(sessionMetadataSchema).max(500).readonly(),
|
|
28448
28454
|
kind: external_exports.literal(SESSION_LISTED_KIND),
|
|
28449
28455
|
requestId: identifierStringSchema
|
|
28450
28456
|
}).readonly();
|
|
28451
|
-
var sessionQueryCommandSchema = external_exports.
|
|
28457
|
+
var sessionQueryCommandSchema = external_exports.object({
|
|
28452
28458
|
kind: external_exports.literal(SESSION_QUERY_KIND),
|
|
28453
28459
|
requestId: identifierStringSchema,
|
|
28454
28460
|
sessionIds: external_exports.array(identifierStringSchema).min(1).max(500).readonly()
|
|
28455
28461
|
}).readonly();
|
|
28456
|
-
var sessionsQueriedEventSchema = external_exports.
|
|
28462
|
+
var sessionsQueriedEventSchema = external_exports.object({
|
|
28457
28463
|
entries: external_exports.array(sessionMetadataSchema).max(500).readonly(),
|
|
28458
28464
|
kind: external_exports.literal(SESSION_QUERIED_KIND),
|
|
28459
28465
|
requestId: identifierStringSchema
|
|
28460
28466
|
}).readonly();
|
|
28461
|
-
var fileReadCommandSchema = external_exports.
|
|
28467
|
+
var fileReadCommandSchema = external_exports.object({
|
|
28462
28468
|
kind: external_exports.literal(FILE_READ_KIND),
|
|
28463
28469
|
maxBytes: external_exports.number().int().positive().max(128 * 1024 * 1024),
|
|
28464
28470
|
requestId: identifierStringSchema,
|
|
28465
28471
|
sessionId: identifierStringSchema,
|
|
28466
28472
|
path: external_exports.string().min(1).max(4096)
|
|
28467
28473
|
}).readonly();
|
|
28468
|
-
var fileBeginEventSchema = external_exports.
|
|
28474
|
+
var fileBeginEventSchema = external_exports.object({
|
|
28469
28475
|
byteLength: external_exports.number().int().positive().max(128 * 1024 * 1024),
|
|
28470
28476
|
kind: external_exports.literal(FILE_BEGIN_KIND),
|
|
28471
28477
|
mediaType: external_exports.string().min(1).max(255),
|
|
@@ -28474,26 +28480,26 @@ var fileBeginEventSchema = external_exports.strictObject({
|
|
|
28474
28480
|
requestId: identifierStringSchema,
|
|
28475
28481
|
sessionId: identifierStringSchema
|
|
28476
28482
|
}).readonly();
|
|
28477
|
-
var fileChunkEventSchema = external_exports.
|
|
28483
|
+
var fileChunkEventSchema = external_exports.object({
|
|
28478
28484
|
data: external_exports.string().min(1).max(4e5),
|
|
28479
28485
|
kind: external_exports.literal(FILE_CHUNK_KIND),
|
|
28480
28486
|
requestId: identifierStringSchema,
|
|
28481
28487
|
sequence: external_exports.number().int().nonnegative().max(1024),
|
|
28482
28488
|
sessionId: identifierStringSchema
|
|
28483
28489
|
}).readonly();
|
|
28484
|
-
var fileEndEventSchema = external_exports.
|
|
28490
|
+
var fileEndEventSchema = external_exports.object({
|
|
28485
28491
|
kind: external_exports.literal(FILE_END_KIND),
|
|
28486
28492
|
requestId: identifierStringSchema,
|
|
28487
28493
|
sessionId: identifierStringSchema
|
|
28488
28494
|
}).readonly();
|
|
28489
|
-
var fileFailedEventSchema = external_exports.
|
|
28495
|
+
var fileFailedEventSchema = external_exports.object({
|
|
28490
28496
|
code: identifierStringSchema,
|
|
28491
28497
|
kind: external_exports.literal(FILE_FAILED_KIND),
|
|
28492
28498
|
message: external_exports.string().min(1).max(500),
|
|
28493
28499
|
requestId: identifierStringSchema,
|
|
28494
28500
|
sessionId: identifierStringSchema
|
|
28495
28501
|
}).readonly();
|
|
28496
|
-
var configValueSchema = external_exports.
|
|
28502
|
+
var configValueSchema = external_exports.object({
|
|
28497
28503
|
description: SHORT_TEXT,
|
|
28498
28504
|
groupId: external_exports.string().max(128),
|
|
28499
28505
|
groupName: external_exports.string().max(255),
|
|
@@ -28504,7 +28510,7 @@ var configValueSchema = external_exports.strictObject({
|
|
|
28504
28510
|
// by length alone.
|
|
28505
28511
|
value: external_exports.string().max(500)
|
|
28506
28512
|
}).readonly();
|
|
28507
|
-
var sessionConfigOptionSchema = external_exports.
|
|
28513
|
+
var sessionConfigOptionSchema = external_exports.object({
|
|
28508
28514
|
booleanValue: external_exports.boolean(),
|
|
28509
28515
|
category: external_exports.string().max(128),
|
|
28510
28516
|
currentValue: external_exports.string().max(500),
|
|
@@ -28515,7 +28521,7 @@ var sessionConfigOptionSchema = external_exports.strictObject({
|
|
|
28515
28521
|
values: external_exports.array(configValueSchema).max(500).readonly()
|
|
28516
28522
|
}).readonly();
|
|
28517
28523
|
var sessionConfigOptionsSchema = external_exports.array(sessionConfigOptionSchema).max(100).readonly();
|
|
28518
|
-
var agentSettingSchema = external_exports.
|
|
28524
|
+
var agentSettingSchema = external_exports.object({
|
|
28519
28525
|
booleanValue: external_exports.boolean(),
|
|
28520
28526
|
category: external_exports.string().max(128),
|
|
28521
28527
|
defaultValue: external_exports.string().max(500),
|
|
@@ -28534,20 +28540,20 @@ var agentModelEffortResolutionSchema = external_exports.enum([
|
|
|
28534
28540
|
AGENT_MODEL_EFFORT_RESOLUTION_ON_MODEL_SELECTION,
|
|
28535
28541
|
AGENT_MODEL_EFFORT_RESOLUTION_UNAVAILABLE
|
|
28536
28542
|
]);
|
|
28537
|
-
var agentModelEffortSchema = external_exports.
|
|
28543
|
+
var agentModelEffortSchema = external_exports.object({
|
|
28538
28544
|
effortSettingId: external_exports.string().max(128),
|
|
28539
28545
|
modelSettingId: external_exports.string().max(128),
|
|
28540
28546
|
resolution: agentModelEffortResolutionSchema,
|
|
28541
28547
|
unsupportedModelIds: external_exports.array(external_exports.string().min(1).max(500)).max(500).readonly().default([]),
|
|
28542
28548
|
valuesByModel: external_exports.record(external_exports.string().min(1).max(500), external_exports.array(configValueSchema).max(500).readonly()).readonly()
|
|
28543
28549
|
}).readonly();
|
|
28544
|
-
var agentSettingsDiscoverCommandSchema = external_exports.
|
|
28550
|
+
var agentSettingsDiscoverCommandSchema = external_exports.object({
|
|
28545
28551
|
agentId: identifierStringSchema,
|
|
28546
28552
|
kind: external_exports.literal(AGENT_SETTINGS_DISCOVER_KIND),
|
|
28547
28553
|
model: external_exports.string().min(1).max(500).optional(),
|
|
28548
28554
|
requestId: identifierStringSchema
|
|
28549
28555
|
}).readonly();
|
|
28550
|
-
var agentSettingsDiscoveredEventSchema = external_exports.
|
|
28556
|
+
var agentSettingsDiscoveredEventSchema = external_exports.object({
|
|
28551
28557
|
agentId: identifierStringSchema,
|
|
28552
28558
|
agentName: external_exports.string().max(255),
|
|
28553
28559
|
agentVersion: external_exports.string().max(128),
|
|
@@ -28557,27 +28563,27 @@ var agentSettingsDiscoveredEventSchema = external_exports.strictObject({
|
|
|
28557
28563
|
settings: agentSettingsSchema,
|
|
28558
28564
|
settingsRevision: external_exports.string().regex(/^[a-f0-9]{64}$/)
|
|
28559
28565
|
}).readonly();
|
|
28560
|
-
var agentSettingsDiscoveryFailedEventSchema = external_exports.
|
|
28566
|
+
var agentSettingsDiscoveryFailedEventSchema = external_exports.object({
|
|
28561
28567
|
code: identifierStringSchema,
|
|
28562
28568
|
kind: external_exports.literal(AGENT_SETTINGS_DISCOVERY_FAILED_KIND),
|
|
28563
28569
|
message: external_exports.string().min(1).max(500),
|
|
28564
28570
|
requestId: identifierStringSchema
|
|
28565
28571
|
}).readonly();
|
|
28566
|
-
var agentCatalogRefreshCommandSchema = external_exports.
|
|
28572
|
+
var agentCatalogRefreshCommandSchema = external_exports.object({
|
|
28567
28573
|
kind: external_exports.literal(AGENT_CATALOG_REFRESH_KIND),
|
|
28568
28574
|
requestId: identifierStringSchema
|
|
28569
28575
|
}).readonly();
|
|
28570
|
-
var agentCatalogRefreshedEventSchema = external_exports.
|
|
28576
|
+
var agentCatalogRefreshedEventSchema = external_exports.object({
|
|
28571
28577
|
kind: external_exports.literal(AGENT_CATALOG_REFRESHED_KIND),
|
|
28572
28578
|
requestId: identifierStringSchema
|
|
28573
28579
|
}).readonly();
|
|
28574
|
-
var agentCatalogRefreshFailedEventSchema = external_exports.
|
|
28580
|
+
var agentCatalogRefreshFailedEventSchema = external_exports.object({
|
|
28575
28581
|
code: identifierStringSchema,
|
|
28576
28582
|
kind: external_exports.literal(AGENT_CATALOG_REFRESH_FAILED_KIND),
|
|
28577
28583
|
message: external_exports.string().min(1).max(500),
|
|
28578
28584
|
requestId: identifierStringSchema
|
|
28579
28585
|
}).readonly();
|
|
28580
|
-
var sessionConfigurationSelectionSchema = external_exports.
|
|
28586
|
+
var sessionConfigurationSelectionSchema = external_exports.object({
|
|
28581
28587
|
booleanValue: external_exports.boolean(),
|
|
28582
28588
|
configId: identifierStringSchema,
|
|
28583
28589
|
value: external_exports.string().max(500),
|
|
@@ -28591,7 +28597,7 @@ var AGENT_PERMISSION_MODES = Object.freeze([
|
|
|
28591
28597
|
"workspace-write",
|
|
28592
28598
|
"danger-full-access"
|
|
28593
28599
|
]);
|
|
28594
|
-
var agentExecutionConfigurationSchema = external_exports.
|
|
28600
|
+
var agentExecutionConfigurationSchema = external_exports.object({
|
|
28595
28601
|
model: sessionConfigurationSelectionSchema,
|
|
28596
28602
|
permissionMode: external_exports.string().refine((value) => AGENT_PERMISSION_MODES.includes(value)),
|
|
28597
28603
|
reasoningEffort: sessionConfigurationSelectionSchema
|
|
@@ -28635,7 +28641,7 @@ var sessionConfigurationSelectionsSchema = external_exports.array(sessionConfigu
|
|
|
28635
28641
|
identifiers.add(selection.configId);
|
|
28636
28642
|
}
|
|
28637
28643
|
}).readonly();
|
|
28638
|
-
var sessionCapabilitiesSchema = external_exports.
|
|
28644
|
+
var sessionCapabilitiesSchema = external_exports.object({
|
|
28639
28645
|
additionalDirectories: external_exports.boolean(),
|
|
28640
28646
|
audioPrompt: external_exports.boolean(),
|
|
28641
28647
|
closeSession: external_exports.boolean(),
|
|
@@ -28649,22 +28655,22 @@ var sessionCapabilitiesSchema = external_exports.strictObject({
|
|
|
28649
28655
|
steering: external_exports.boolean().default(false),
|
|
28650
28656
|
unstableForkSession: external_exports.boolean().default(false)
|
|
28651
28657
|
}).readonly();
|
|
28652
|
-
var sessionCommandSchema = external_exports.
|
|
28658
|
+
var sessionCommandSchema = external_exports.object({
|
|
28653
28659
|
description: SHORT_TEXT,
|
|
28654
28660
|
inputHint: external_exports.string().max(255),
|
|
28655
28661
|
name: external_exports.string().min(1).max(128)
|
|
28656
28662
|
}).readonly();
|
|
28657
|
-
var permissionOptionSchema = external_exports.
|
|
28663
|
+
var permissionOptionSchema = external_exports.object({
|
|
28658
28664
|
kind: external_exports.enum(["allow_once", "allow_always", "reject_once", "reject_always"]),
|
|
28659
28665
|
name: external_exports.string().min(1).max(255),
|
|
28660
28666
|
optionId: external_exports.string().min(1).max(255)
|
|
28661
28667
|
}).readonly();
|
|
28662
|
-
var elicitationOptionSchema = external_exports.
|
|
28668
|
+
var elicitationOptionSchema = external_exports.object({
|
|
28663
28669
|
description: SHORT_TEXT,
|
|
28664
28670
|
label: external_exports.string().min(1).max(255),
|
|
28665
28671
|
value: external_exports.string().max(500)
|
|
28666
28672
|
}).readonly();
|
|
28667
|
-
var elicitationFieldSchema = external_exports.
|
|
28673
|
+
var elicitationFieldSchema = external_exports.object({
|
|
28668
28674
|
defaultBooleanValue: external_exports.boolean(),
|
|
28669
28675
|
defaultNumberValue: external_exports.number().finite(),
|
|
28670
28676
|
defaultStringValue: external_exports.string().max(1e4),
|
|
@@ -28682,7 +28688,7 @@ var elicitationFieldSchema = external_exports.strictObject({
|
|
|
28682
28688
|
title: external_exports.string().min(1).max(255),
|
|
28683
28689
|
type: external_exports.enum(["boolean", "integer", "multiselect", "number", "select", "string"])
|
|
28684
28690
|
}).readonly();
|
|
28685
|
-
var displayContentSchema = external_exports.
|
|
28691
|
+
var displayContentSchema = external_exports.object({
|
|
28686
28692
|
artifactId: external_exports.string().max(128).default(""),
|
|
28687
28693
|
data: external_exports.string().max(4e6),
|
|
28688
28694
|
mimeType: external_exports.string().max(255),
|
|
@@ -28695,7 +28701,7 @@ var displayContentSchema = external_exports.strictObject({
|
|
|
28695
28701
|
type: external_exports.enum(["diff", "image", "resource", "resource_link", "terminal", "text", "video"]),
|
|
28696
28702
|
uri: external_exports.string().max(4096)
|
|
28697
28703
|
}).readonly();
|
|
28698
|
-
var recordedDisplayContentSchema = external_exports.
|
|
28704
|
+
var recordedDisplayContentSchema = external_exports.object({
|
|
28699
28705
|
artifactId: external_exports.string().max(128).default(""),
|
|
28700
28706
|
data: external_exports.string().max(4e6),
|
|
28701
28707
|
mimeType: external_exports.string().max(255),
|
|
@@ -28708,25 +28714,25 @@ var recordedDisplayContentSchema = external_exports.strictObject({
|
|
|
28708
28714
|
type: external_exports.enum(["diff", "image", "resource", "resource_link", "terminal", "text", "video"]),
|
|
28709
28715
|
uri: external_exports.string().max(4096)
|
|
28710
28716
|
}).readonly();
|
|
28711
|
-
var promptImageSchema = external_exports.
|
|
28717
|
+
var promptImageSchema = external_exports.object({
|
|
28712
28718
|
data: external_exports.string().min(1).max(4e6),
|
|
28713
28719
|
mimeType: external_exports.string().min(1).max(255),
|
|
28714
28720
|
name: external_exports.string().min(1).max(500)
|
|
28715
28721
|
}).readonly();
|
|
28716
|
-
var promptResourceSchema = external_exports.
|
|
28722
|
+
var promptResourceSchema = external_exports.object({
|
|
28717
28723
|
mimeType: external_exports.string().max(255),
|
|
28718
28724
|
name: external_exports.string().min(1).max(500),
|
|
28719
28725
|
text: external_exports.string().max(1e6),
|
|
28720
28726
|
type: external_exports.enum(["embedded", "link"]),
|
|
28721
28727
|
uri: external_exports.string().min(1).max(4096)
|
|
28722
28728
|
}).readonly();
|
|
28723
|
-
var workspaceListCommandSchema = external_exports.
|
|
28729
|
+
var workspaceListCommandSchema = external_exports.object({
|
|
28724
28730
|
bindingId: identifierStringSchema,
|
|
28725
28731
|
directoryId: DIRECTORY_IDENTIFIER,
|
|
28726
28732
|
kind: external_exports.literal(WORKSPACE_LIST_KIND),
|
|
28727
28733
|
requestId: identifierStringSchema
|
|
28728
28734
|
}).readonly();
|
|
28729
|
-
var workspaceEntriesEventSchema = external_exports.
|
|
28735
|
+
var workspaceEntriesEventSchema = external_exports.object({
|
|
28730
28736
|
bindingId: identifierStringSchema,
|
|
28731
28737
|
directoryId: DIRECTORY_IDENTIFIER,
|
|
28732
28738
|
directoryLabel: external_exports.string().min(1).max(2048),
|
|
@@ -28742,9 +28748,9 @@ var sessionIdentityFields = {
|
|
|
28742
28748
|
directoryId: DIRECTORY_IDENTIFIER,
|
|
28743
28749
|
sessionId: identifierStringSchema
|
|
28744
28750
|
};
|
|
28745
|
-
var sessionPrepareCommandSchema = external_exports.
|
|
28751
|
+
var sessionPrepareCommandSchema = external_exports.object({
|
|
28746
28752
|
...sessionIdentityFields,
|
|
28747
|
-
configuration: external_exports.
|
|
28753
|
+
configuration: external_exports.object({
|
|
28748
28754
|
booleanValue: external_exports.boolean(),
|
|
28749
28755
|
configId: external_exports.string().min(1).max(128),
|
|
28750
28756
|
value: external_exports.string().max(500),
|
|
@@ -28765,12 +28771,12 @@ var sessionPrepareCommandSchema = external_exports.strictObject({
|
|
|
28765
28771
|
}
|
|
28766
28772
|
}).readonly();
|
|
28767
28773
|
var runtimeTimingsSchema = external_exports.array(
|
|
28768
|
-
external_exports.
|
|
28774
|
+
external_exports.object({
|
|
28769
28775
|
durationMilliseconds: external_exports.number().finite().nonnegative().max(12e4),
|
|
28770
28776
|
name: external_exports.string().regex(/^[a-z][a-z0-9-]{0,63}$/)
|
|
28771
28777
|
}).readonly()
|
|
28772
28778
|
).max(16).readonly();
|
|
28773
|
-
var sessionReadyEventSchema = external_exports.
|
|
28779
|
+
var sessionReadyEventSchema = external_exports.object({
|
|
28774
28780
|
additionalDirectories: external_exports.array(workspaceEntrySchema).max(16).readonly(),
|
|
28775
28781
|
agentId: identifierStringSchema,
|
|
28776
28782
|
agentName: external_exports.string().max(255),
|
|
@@ -28786,7 +28792,7 @@ var sessionReadyEventSchema = external_exports.strictObject({
|
|
|
28786
28792
|
runtimeTimings: runtimeTimingsSchema.optional(),
|
|
28787
28793
|
sessionId: identifierStringSchema
|
|
28788
28794
|
}).readonly();
|
|
28789
|
-
var sessionConfigureCommandSchema = external_exports.
|
|
28795
|
+
var sessionConfigureCommandSchema = external_exports.object({
|
|
28790
28796
|
...sessionIdentityFields,
|
|
28791
28797
|
booleanValue: external_exports.boolean(),
|
|
28792
28798
|
configId: external_exports.string().min(1).max(128),
|
|
@@ -28795,13 +28801,13 @@ var sessionConfigureCommandSchema = external_exports.strictObject({
|
|
|
28795
28801
|
value: external_exports.string().max(500),
|
|
28796
28802
|
valueType: external_exports.enum(["boolean", "select"])
|
|
28797
28803
|
}).readonly();
|
|
28798
|
-
var sessionConfigUpdatedEventSchema = external_exports.
|
|
28804
|
+
var sessionConfigUpdatedEventSchema = external_exports.object({
|
|
28799
28805
|
configOptions: sessionConfigOptionsSchema,
|
|
28800
28806
|
kind: external_exports.literal(SESSION_CONFIG_UPDATED_KIND),
|
|
28801
28807
|
requestId: identifierStringSchema,
|
|
28802
28808
|
sessionId: identifierStringSchema
|
|
28803
28809
|
}).readonly();
|
|
28804
|
-
var sessionContextUsageUpdatedEventSchema = external_exports.
|
|
28810
|
+
var sessionContextUsageUpdatedEventSchema = external_exports.object({
|
|
28805
28811
|
costAmount: external_exports.number().finite().nonnegative(),
|
|
28806
28812
|
costCurrency: external_exports.string().max(16),
|
|
28807
28813
|
hasCost: external_exports.boolean(),
|
|
@@ -28811,7 +28817,7 @@ var sessionContextUsageUpdatedEventSchema = external_exports.strictObject({
|
|
|
28811
28817
|
source: external_exports.literal("context").default("context"),
|
|
28812
28818
|
used: external_exports.number().int().nonnegative()
|
|
28813
28819
|
}).readonly();
|
|
28814
|
-
var sessionPromptUsageUpdatedEventSchema = external_exports.
|
|
28820
|
+
var sessionPromptUsageUpdatedEventSchema = external_exports.object({
|
|
28815
28821
|
_meta: promptMetadataSchema.nullable(),
|
|
28816
28822
|
commandId: identifierStringSchema,
|
|
28817
28823
|
kind: external_exports.literal(SESSION_USAGE_UPDATED_KIND),
|
|
@@ -28823,18 +28829,18 @@ var sessionUsageUpdatedEventSchema = external_exports.union([
|
|
|
28823
28829
|
sessionContextUsageUpdatedEventSchema,
|
|
28824
28830
|
sessionPromptUsageUpdatedEventSchema
|
|
28825
28831
|
]);
|
|
28826
|
-
var sessionCommandsUpdatedEventSchema = external_exports.
|
|
28832
|
+
var sessionCommandsUpdatedEventSchema = external_exports.object({
|
|
28827
28833
|
commands: external_exports.array(sessionCommandSchema).max(500).readonly(),
|
|
28828
28834
|
kind: external_exports.literal(SESSION_COMMANDS_UPDATED_KIND),
|
|
28829
28835
|
sessionId: identifierStringSchema
|
|
28830
28836
|
}).readonly();
|
|
28831
|
-
var sessionInfoUpdatedEventSchema = external_exports.
|
|
28837
|
+
var sessionInfoUpdatedEventSchema = external_exports.object({
|
|
28832
28838
|
kind: external_exports.literal(SESSION_INFO_UPDATED_KIND),
|
|
28833
28839
|
sessionId: identifierStringSchema,
|
|
28834
28840
|
title: external_exports.string().max(500).nullable(),
|
|
28835
28841
|
updatedAt: external_exports.string().max(128)
|
|
28836
28842
|
}).readonly();
|
|
28837
|
-
var sessionPermissionRequestedEventSchema = external_exports.
|
|
28843
|
+
var sessionPermissionRequestedEventSchema = external_exports.object({
|
|
28838
28844
|
commandId: identifierStringSchema,
|
|
28839
28845
|
interactionId: identifierStringSchema,
|
|
28840
28846
|
kind: external_exports.literal(SESSION_PERMISSION_REQUESTED_KIND),
|
|
@@ -28844,21 +28850,21 @@ var sessionPermissionRequestedEventSchema = external_exports.strictObject({
|
|
|
28844
28850
|
toolCallId: external_exports.string().min(1).max(255),
|
|
28845
28851
|
toolKind: external_exports.string().max(64)
|
|
28846
28852
|
}).readonly();
|
|
28847
|
-
var sessionPermissionRespondCommandSchema = external_exports.
|
|
28853
|
+
var sessionPermissionRespondCommandSchema = external_exports.object({
|
|
28848
28854
|
interactionId: identifierStringSchema,
|
|
28849
28855
|
kind: external_exports.literal(SESSION_PERMISSION_RESPOND_KIND),
|
|
28850
28856
|
optionId: external_exports.string().max(255),
|
|
28851
28857
|
outcome: external_exports.enum(["cancelled", "selected"]),
|
|
28852
28858
|
sessionId: identifierStringSchema
|
|
28853
28859
|
}).readonly();
|
|
28854
|
-
var sessionPermissionResolvedEventSchema = external_exports.
|
|
28860
|
+
var sessionPermissionResolvedEventSchema = external_exports.object({
|
|
28855
28861
|
interactionId: identifierStringSchema,
|
|
28856
28862
|
kind: external_exports.literal(SESSION_PERMISSION_RESOLVED_KIND),
|
|
28857
28863
|
optionId: external_exports.string().max(255),
|
|
28858
28864
|
outcome: external_exports.enum(["cancelled", "selected"]),
|
|
28859
28865
|
sessionId: identifierStringSchema
|
|
28860
28866
|
}).readonly();
|
|
28861
|
-
var sessionElicitationRequestedEventSchema = external_exports.
|
|
28867
|
+
var sessionElicitationRequestedEventSchema = external_exports.object({
|
|
28862
28868
|
accepted: external_exports.boolean(),
|
|
28863
28869
|
commandId: identifierStringSchema,
|
|
28864
28870
|
elicitationId: external_exports.string().max(255),
|
|
@@ -28870,20 +28876,20 @@ var sessionElicitationRequestedEventSchema = external_exports.strictObject({
|
|
|
28870
28876
|
sessionId: identifierStringSchema,
|
|
28871
28877
|
url: external_exports.string().max(4096)
|
|
28872
28878
|
}).readonly();
|
|
28873
|
-
var sessionElicitationRespondCommandSchema = external_exports.
|
|
28879
|
+
var sessionElicitationRespondCommandSchema = external_exports.object({
|
|
28874
28880
|
action: external_exports.enum(["accept", "cancel", "decline"]),
|
|
28875
28881
|
content: external_exports.string().max(1e5),
|
|
28876
28882
|
interactionId: identifierStringSchema,
|
|
28877
28883
|
kind: external_exports.literal(SESSION_ELICITATION_RESPOND_KIND),
|
|
28878
28884
|
sessionId: identifierStringSchema
|
|
28879
28885
|
}).readonly();
|
|
28880
|
-
var sessionElicitationResolvedEventSchema = external_exports.
|
|
28886
|
+
var sessionElicitationResolvedEventSchema = external_exports.object({
|
|
28881
28887
|
action: external_exports.enum(["accept", "cancel", "decline", "complete"]),
|
|
28882
28888
|
interactionId: identifierStringSchema,
|
|
28883
28889
|
kind: external_exports.literal(SESSION_ELICITATION_RESOLVED_KIND),
|
|
28884
28890
|
sessionId: identifierStringSchema
|
|
28885
28891
|
}).readonly();
|
|
28886
|
-
var sessionOperationFailedEventSchema = external_exports.
|
|
28892
|
+
var sessionOperationFailedEventSchema = external_exports.object({
|
|
28887
28893
|
code: identifierStringSchema,
|
|
28888
28894
|
kind: external_exports.literal(SESSION_OPERATION_FAILED_KIND),
|
|
28889
28895
|
message: external_exports.string().min(1).max(500),
|
|
@@ -28891,7 +28897,7 @@ var sessionOperationFailedEventSchema = external_exports.strictObject({
|
|
|
28891
28897
|
runtimeTimings: runtimeTimingsSchema.optional(),
|
|
28892
28898
|
sessionId: external_exports.string().max(128)
|
|
28893
28899
|
}).readonly();
|
|
28894
|
-
var agentContentEventSchema = external_exports.
|
|
28900
|
+
var agentContentEventSchema = external_exports.object({
|
|
28895
28901
|
commandId: identifierStringSchema,
|
|
28896
28902
|
content: displayContentSchema,
|
|
28897
28903
|
contentId: identifierStringSchema,
|
|
@@ -28903,15 +28909,15 @@ var agentInstallIdentityFields = {
|
|
|
28903
28909
|
agentId: identifierStringSchema,
|
|
28904
28910
|
requestId: identifierStringSchema
|
|
28905
28911
|
};
|
|
28906
|
-
var agentInstallRequestCommandSchema = external_exports.
|
|
28912
|
+
var agentInstallRequestCommandSchema = external_exports.object({
|
|
28907
28913
|
...agentInstallIdentityFields,
|
|
28908
28914
|
kind: external_exports.literal(AGENT_INSTALL_REQUEST_KIND)
|
|
28909
28915
|
}).readonly();
|
|
28910
|
-
var agentInstallCancelCommandSchema = external_exports.
|
|
28916
|
+
var agentInstallCancelCommandSchema = external_exports.object({
|
|
28911
28917
|
kind: external_exports.literal(AGENT_INSTALL_CANCEL_KIND),
|
|
28912
28918
|
requestId: identifierStringSchema
|
|
28913
28919
|
}).readonly();
|
|
28914
|
-
var agentInstallStartedEventSchema = external_exports.
|
|
28920
|
+
var agentInstallStartedEventSchema = external_exports.object({
|
|
28915
28921
|
...agentInstallIdentityFields,
|
|
28916
28922
|
kind: external_exports.literal(AGENT_INSTALL_STARTED_KIND)
|
|
28917
28923
|
}).readonly();
|
|
@@ -28922,23 +28928,23 @@ var installationStageSchema = external_exports.enum([
|
|
|
28922
28928
|
"installing_adapter",
|
|
28923
28929
|
"checking_acp"
|
|
28924
28930
|
]);
|
|
28925
|
-
var agentInstallProgressEventSchema = external_exports.
|
|
28931
|
+
var agentInstallProgressEventSchema = external_exports.object({
|
|
28926
28932
|
...agentInstallIdentityFields,
|
|
28927
28933
|
kind: external_exports.literal(AGENT_INSTALL_PROGRESS_KIND),
|
|
28928
28934
|
stage: installationStageSchema
|
|
28929
28935
|
}).readonly();
|
|
28930
|
-
var agentInstallCompletedEventSchema = external_exports.
|
|
28936
|
+
var agentInstallCompletedEventSchema = external_exports.object({
|
|
28931
28937
|
...agentInstallIdentityFields,
|
|
28932
28938
|
authenticationMayBeRequired: external_exports.boolean(),
|
|
28933
28939
|
kind: external_exports.literal(AGENT_INSTALL_COMPLETED_KIND)
|
|
28934
28940
|
}).readonly();
|
|
28935
|
-
var agentInstallFailedEventSchema = external_exports.
|
|
28941
|
+
var agentInstallFailedEventSchema = external_exports.object({
|
|
28936
28942
|
...agentInstallIdentityFields,
|
|
28937
28943
|
code: identifierStringSchema,
|
|
28938
28944
|
kind: external_exports.literal(AGENT_INSTALL_FAILED_KIND),
|
|
28939
28945
|
message: external_exports.string().min(1).max(500)
|
|
28940
28946
|
}).readonly();
|
|
28941
|
-
var agentInstallCancelledEventSchema = external_exports.
|
|
28947
|
+
var agentInstallCancelledEventSchema = external_exports.object({
|
|
28942
28948
|
...agentInstallIdentityFields,
|
|
28943
28949
|
kind: external_exports.literal(AGENT_INSTALL_CANCELLED_KIND)
|
|
28944
28950
|
}).readonly();
|
|
@@ -29101,6 +29107,17 @@ var ProtocolMessageError = class extends Error {
|
|
|
29101
29107
|
this.name = "ProtocolMessageError";
|
|
29102
29108
|
}
|
|
29103
29109
|
};
|
|
29110
|
+
var UnsupportedProtocolMessageKindError = class extends Error {
|
|
29111
|
+
code = "unsupported_protocol_message_kind";
|
|
29112
|
+
direction;
|
|
29113
|
+
messageKind;
|
|
29114
|
+
constructor(direction, messageKind) {
|
|
29115
|
+
super(`Unsupported ${direction} message kind: ${messageKind}`);
|
|
29116
|
+
this.name = "UnsupportedProtocolMessageKindError";
|
|
29117
|
+
this.direction = direction;
|
|
29118
|
+
this.messageKind = messageKind;
|
|
29119
|
+
}
|
|
29120
|
+
};
|
|
29104
29121
|
function isRecord5(value) {
|
|
29105
29122
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
29106
29123
|
}
|
|
@@ -29118,13 +29135,6 @@ function parseJson2(encoded) {
|
|
|
29118
29135
|
}
|
|
29119
29136
|
return value;
|
|
29120
29137
|
}
|
|
29121
|
-
function assertExactKeys(value, allowedKeys) {
|
|
29122
|
-
for (const key of Object.keys(value)) {
|
|
29123
|
-
if (!allowedKeys.includes(key)) {
|
|
29124
|
-
throw new ProtocolMessageError(`Unexpected message field: ${key}`);
|
|
29125
|
-
}
|
|
29126
|
-
}
|
|
29127
|
-
}
|
|
29128
29138
|
function readString2(value, key, maximumLength) {
|
|
29129
29139
|
const field = value[key];
|
|
29130
29140
|
if (typeof field !== "string" || field.length === 0 || field.length > maximumLength) {
|
|
@@ -29215,18 +29225,15 @@ function readActivityDetail(value) {
|
|
|
29215
29225
|
}
|
|
29216
29226
|
const kind = readString2(field, "kind", 32);
|
|
29217
29227
|
if (kind === "available") {
|
|
29218
|
-
assertExactKeys(field, ["artifactId", "kind"]);
|
|
29219
29228
|
return {
|
|
29220
29229
|
artifactId: readIdentifier(field, "artifactId"),
|
|
29221
29230
|
kind
|
|
29222
29231
|
};
|
|
29223
29232
|
}
|
|
29224
29233
|
if (kind === "unrecorded") {
|
|
29225
|
-
assertExactKeys(field, ["kind"]);
|
|
29226
29234
|
return { kind };
|
|
29227
29235
|
}
|
|
29228
29236
|
if (kind === "truncated") {
|
|
29229
|
-
assertExactKeys(field, ["capturedBytes", "kind", "originalBytes"]);
|
|
29230
29237
|
const capturedBytes = readSequence(field, "capturedBytes");
|
|
29231
29238
|
const originalBytes = readSequence(field, "originalBytes");
|
|
29232
29239
|
if (capturedBytes > originalBytes) {
|
|
@@ -29235,7 +29242,6 @@ function readActivityDetail(value) {
|
|
|
29235
29242
|
return { capturedBytes, kind, originalBytes };
|
|
29236
29243
|
}
|
|
29237
29244
|
if (kind === "recorded") {
|
|
29238
|
-
assertExactKeys(field, ["content", "input", "kind", "output"]);
|
|
29239
29245
|
const contentValue = field["content"];
|
|
29240
29246
|
if (!Array.isArray(contentValue) || contentValue.length > 100) {
|
|
29241
29247
|
throw new ProtocolMessageError("Invalid recorded activity content");
|
|
@@ -29278,21 +29284,6 @@ function decodeMessageKind(encoded) {
|
|
|
29278
29284
|
function decodeSessionPromptCommand(encoded) {
|
|
29279
29285
|
const value = parseJson2(encoded);
|
|
29280
29286
|
const hasSessionConfigurations = Object.hasOwn(value, "sessionConfigurations");
|
|
29281
|
-
assertExactKeys(value, [
|
|
29282
|
-
"additionalDirectoryIds",
|
|
29283
|
-
"agentId",
|
|
29284
|
-
"bindingId",
|
|
29285
|
-
"commandId",
|
|
29286
|
-
"directoryId",
|
|
29287
|
-
"disposition",
|
|
29288
|
-
"images",
|
|
29289
|
-
"kind",
|
|
29290
|
-
"prompt",
|
|
29291
|
-
"resources",
|
|
29292
|
-
...hasSessionConfigurations ? ["sessionConfigurations"] : [],
|
|
29293
|
-
"sessionId",
|
|
29294
|
-
"targetCommandId"
|
|
29295
|
-
]);
|
|
29296
29287
|
assertKind(value, SESSION_PROMPT_KIND);
|
|
29297
29288
|
const prompt = readText(value, "prompt", MAX_PROMPT_LENGTH);
|
|
29298
29289
|
const images = decodePromptImagesValue(value["images"]);
|
|
@@ -29332,7 +29323,6 @@ function decodeSessionPromptCommand(encoded) {
|
|
|
29332
29323
|
}
|
|
29333
29324
|
function decodeSessionCancelCommand(encoded) {
|
|
29334
29325
|
const value = parseJson2(encoded);
|
|
29335
|
-
assertExactKeys(value, ["commandId", "kind", "sessionId"]);
|
|
29336
29326
|
assertKind(value, SESSION_CANCEL_KIND);
|
|
29337
29327
|
return {
|
|
29338
29328
|
commandId: readIdentifier(value, "commandId"),
|
|
@@ -29342,7 +29332,6 @@ function decodeSessionCancelCommand(encoded) {
|
|
|
29342
29332
|
}
|
|
29343
29333
|
function decodeSessionPromptDispositionCommand(encoded) {
|
|
29344
29334
|
const value = parseJson2(encoded);
|
|
29345
|
-
assertExactKeys(value, ["commandId", "disposition", "kind", "sessionId"]);
|
|
29346
29335
|
assertKind(value, SESSION_PROMPT_DISPOSITION_KIND);
|
|
29347
29336
|
if (readPromptDisposition(value) !== SessionPromptDisposition.Steer) {
|
|
29348
29337
|
throw new ProtocolMessageError("Only queued prompts can be steered");
|
|
@@ -29356,7 +29345,6 @@ function decodeSessionPromptDispositionCommand(encoded) {
|
|
|
29356
29345
|
}
|
|
29357
29346
|
function decodeSessionQueuedEvent(encoded) {
|
|
29358
29347
|
const value = parseJson2(encoded);
|
|
29359
|
-
assertExactKeys(value, ["commandId", "kind", "sessionId"]);
|
|
29360
29348
|
assertKind(value, SESSION_QUEUED_KIND);
|
|
29361
29349
|
return {
|
|
29362
29350
|
commandId: readIdentifier(value, "commandId"),
|
|
@@ -29367,12 +29355,10 @@ function decodeSessionQueuedEvent(encoded) {
|
|
|
29367
29355
|
function decodeRuntimeLivenessReadyEvent(encoded) {
|
|
29368
29356
|
const value = parseJson2(encoded);
|
|
29369
29357
|
assertKind(value, RUNTIME_LIVENESS_READY_KIND);
|
|
29370
|
-
assertExactKeys(value, ["kind"]);
|
|
29371
29358
|
return { kind: RUNTIME_LIVENESS_READY_KIND };
|
|
29372
29359
|
}
|
|
29373
29360
|
function decodeRuntimeHeartbeatEvent(encoded) {
|
|
29374
29361
|
const value = parseJson2(encoded);
|
|
29375
|
-
assertExactKeys(value, ["heartbeatId", "kind"]);
|
|
29376
29362
|
assertKind(value, RUNTIME_HEARTBEAT_KIND);
|
|
29377
29363
|
return {
|
|
29378
29364
|
heartbeatId: readIdentifier(value, "heartbeatId"),
|
|
@@ -29381,7 +29367,6 @@ function decodeRuntimeHeartbeatEvent(encoded) {
|
|
|
29381
29367
|
}
|
|
29382
29368
|
function decodeRuntimeHeartbeatAckEvent(encoded) {
|
|
29383
29369
|
const value = parseJson2(encoded);
|
|
29384
|
-
assertExactKeys(value, ["heartbeatId", "kind"]);
|
|
29385
29370
|
assertKind(value, RUNTIME_HEARTBEAT_ACK_KIND);
|
|
29386
29371
|
return {
|
|
29387
29372
|
heartbeatId: readIdentifier(value, "heartbeatId"),
|
|
@@ -29390,7 +29375,6 @@ function decodeRuntimeHeartbeatAckEvent(encoded) {
|
|
|
29390
29375
|
}
|
|
29391
29376
|
function decodeSessionStartedEvent(encoded) {
|
|
29392
29377
|
const value = parseJson2(encoded);
|
|
29393
|
-
assertExactKeys(value, ["commandId", "epoch", "kind", "attemptId", "prompt", "sequence", "sessionId"]);
|
|
29394
29378
|
assertKind(value, SESSION_STARTED_KIND);
|
|
29395
29379
|
const sequence = readSequence(value, "sequence");
|
|
29396
29380
|
if (sequence !== 0) {
|
|
@@ -29408,7 +29392,6 @@ function decodeSessionStartedEvent(encoded) {
|
|
|
29408
29392
|
}
|
|
29409
29393
|
function decodeAgentMessageDeltaEvent(encoded) {
|
|
29410
29394
|
const value = parseJson2(encoded);
|
|
29411
|
-
assertExactKeys(value, ["commandId", "epoch", "kind", "messageId", "sequence", "sessionId", "text"]);
|
|
29412
29395
|
assertKind(value, AGENT_MESSAGE_DELTA_KIND);
|
|
29413
29396
|
const sequence = readSequence(value, "sequence");
|
|
29414
29397
|
if (sequence === 0) {
|
|
@@ -29426,23 +29409,6 @@ function decodeAgentMessageDeltaEvent(encoded) {
|
|
|
29426
29409
|
}
|
|
29427
29410
|
function decodeAgentActivityEvent(encoded) {
|
|
29428
29411
|
const value = parseJson2(encoded);
|
|
29429
|
-
assertExactKeys(value, [
|
|
29430
|
-
"activityId",
|
|
29431
|
-
"activityType",
|
|
29432
|
-
"commandId",
|
|
29433
|
-
"content",
|
|
29434
|
-
"detail",
|
|
29435
|
-
"input",
|
|
29436
|
-
"kind",
|
|
29437
|
-
"locations",
|
|
29438
|
-
"name",
|
|
29439
|
-
"output",
|
|
29440
|
-
"sequence",
|
|
29441
|
-
"sessionId",
|
|
29442
|
-
"status",
|
|
29443
|
-
"title",
|
|
29444
|
-
"toolKind"
|
|
29445
|
-
]);
|
|
29446
29412
|
assertKind(value, AGENT_ACTIVITY_KIND);
|
|
29447
29413
|
return {
|
|
29448
29414
|
activityId: readIdentifier(value, "activityId"),
|
|
@@ -29464,7 +29430,6 @@ function decodeAgentActivityEvent(encoded) {
|
|
|
29464
29430
|
}
|
|
29465
29431
|
function decodeSessionCompletedEvent(encoded) {
|
|
29466
29432
|
const value = parseJson2(encoded);
|
|
29467
|
-
assertExactKeys(value, ["commandId", "kind", "sessionId", "stopReason"]);
|
|
29468
29433
|
assertKind(value, SESSION_COMPLETED_KIND);
|
|
29469
29434
|
return {
|
|
29470
29435
|
commandId: readIdentifier(value, "commandId"),
|
|
@@ -29475,7 +29440,6 @@ function decodeSessionCompletedEvent(encoded) {
|
|
|
29475
29440
|
}
|
|
29476
29441
|
function decodeSessionFailedEvent(encoded) {
|
|
29477
29442
|
const value = parseJson2(encoded);
|
|
29478
|
-
assertExactKeys(value, ["code", "commandId", "kind", "message", "sessionId"]);
|
|
29479
29443
|
assertKind(value, SESSION_FAILED_KIND);
|
|
29480
29444
|
return {
|
|
29481
29445
|
code: readIdentifier(value, "code"),
|
|
@@ -29508,7 +29472,6 @@ function encodeRuntimeHeartbeatAckEvent(message) {
|
|
|
29508
29472
|
}
|
|
29509
29473
|
function decodeAgentActivityNarrationEvent(encoded) {
|
|
29510
29474
|
const value = parseJson2(encoded);
|
|
29511
|
-
assertExactKeys(value, ["activityId", "activityType", "commandId", "kind", "sequence", "sessionId", "text"]);
|
|
29512
29475
|
assertKind(value, AGENT_ACTIVITY_NARRATION_KIND);
|
|
29513
29476
|
return {
|
|
29514
29477
|
activityId: readIdentifier(value, "activityId"),
|
|
@@ -29526,7 +29489,7 @@ var SESSION_HISTORY_CHARACTER_LIMIT = 256e3;
|
|
|
29526
29489
|
var SESSION_HISTORY_MESSAGE_LIMIT = 1e3;
|
|
29527
29490
|
var SESSION_HISTORY_PREVIEW_MESSAGE_LIMIT = 10;
|
|
29528
29491
|
var SESSION_HISTORY_IMAGE_CHARACTER_LIMIT = 4e6;
|
|
29529
|
-
var historyImage = external_exports.
|
|
29492
|
+
var historyImage = external_exports.object({
|
|
29530
29493
|
data: external_exports.string().min(4).max(SESSION_HISTORY_IMAGE_CHARACTER_LIMIT).refine((data) => data.length % 4 === 0 && /^[A-Za-z0-9+/]*={0,2}$/.test(data)),
|
|
29531
29494
|
mimeType: external_exports.enum(["image/png", "image/jpeg", "image/gif", "image/webp"]),
|
|
29532
29495
|
name: external_exports.string().min(1).max(500)
|
|
@@ -29553,7 +29516,7 @@ function parseNativeHistoryText(text2) {
|
|
|
29553
29516
|
});
|
|
29554
29517
|
return { text: plainText, images };
|
|
29555
29518
|
}
|
|
29556
|
-
var nativeMessageActivitySchema = external_exports.
|
|
29519
|
+
var nativeMessageActivitySchema = external_exports.object({
|
|
29557
29520
|
activityId: external_exports.string().min(1).max(128),
|
|
29558
29521
|
activityType: external_exports.string().min(1).max(128),
|
|
29559
29522
|
content: external_exports.array(displayContentSchema).max(100).readonly(),
|
|
@@ -29566,12 +29529,12 @@ var nativeMessageActivitySchema = external_exports.strictObject({
|
|
|
29566
29529
|
title: external_exports.string().max(500),
|
|
29567
29530
|
toolKind: external_exports.string().max(64)
|
|
29568
29531
|
}).readonly();
|
|
29569
|
-
var userHistoryMessage = external_exports.
|
|
29532
|
+
var userHistoryMessage = external_exports.object({
|
|
29570
29533
|
role: external_exports.literal("user"),
|
|
29571
29534
|
text: external_exports.string().max(SESSION_HISTORY_CHARACTER_LIMIT),
|
|
29572
29535
|
images: external_exports.array(historyImage).max(8).readonly().optional()
|
|
29573
29536
|
}).readonly();
|
|
29574
|
-
var assistantHistoryMessageSchema = external_exports.
|
|
29537
|
+
var assistantHistoryMessageSchema = external_exports.object({
|
|
29575
29538
|
activities: external_exports.array(nativeMessageActivitySchema).max(100).readonly().default([]),
|
|
29576
29539
|
content: external_exports.array(displayContentSchema).max(100).readonly().default([]),
|
|
29577
29540
|
role: external_exports.literal("assistant"),
|
|
@@ -29581,8 +29544,8 @@ var assistantHistoryMessageSchema = external_exports.strictObject({
|
|
|
29581
29544
|
images: external_exports.array(historyImage).max(8).readonly().optional()
|
|
29582
29545
|
}).readonly();
|
|
29583
29546
|
var historyMessage = external_exports.discriminatedUnion("role", [userHistoryMessage, assistantHistoryMessageSchema]);
|
|
29584
|
-
var availableSessionHistoryObjectSchema = external_exports.
|
|
29585
|
-
streamPosition: external_exports.
|
|
29547
|
+
var availableSessionHistoryObjectSchema = external_exports.object({
|
|
29548
|
+
streamPosition: external_exports.object({
|
|
29586
29549
|
commandId: identifierStringSchema,
|
|
29587
29550
|
epoch: identifierStringSchema,
|
|
29588
29551
|
sequence: external_exports.number().int().nonnegative()
|
|
@@ -29599,9 +29562,9 @@ var availableSessionHistoryObjectSchema = external_exports.strictObject({
|
|
|
29599
29562
|
).max(2e4).readonly().default([])
|
|
29600
29563
|
});
|
|
29601
29564
|
var availableSessionHistorySchema = availableSessionHistoryObjectSchema.readonly();
|
|
29602
|
-
var unavailableSessionHistoryObjectSchema = external_exports.
|
|
29565
|
+
var unavailableSessionHistoryObjectSchema = external_exports.object({
|
|
29603
29566
|
status: external_exports.literal("unavailable"),
|
|
29604
|
-
cause: external_exports.
|
|
29567
|
+
cause: external_exports.object({
|
|
29605
29568
|
code: external_exports.string().regex(/^[a-z][a-z0-9_]{0,127}$/),
|
|
29606
29569
|
message: external_exports.string().min(1).max(1e3)
|
|
29607
29570
|
}).readonly()
|
|
@@ -29634,7 +29597,7 @@ var envelope = {
|
|
|
29634
29597
|
requestId: identifierStringSchema,
|
|
29635
29598
|
sessionId: identifierStringSchema
|
|
29636
29599
|
};
|
|
29637
|
-
var activeTurnActivitySchema = external_exports.
|
|
29600
|
+
var activeTurnActivitySchema = external_exports.object({
|
|
29638
29601
|
activityId: external_exports.string().min(1).max(128),
|
|
29639
29602
|
activityType: external_exports.string().min(1).max(128),
|
|
29640
29603
|
content: external_exports.array(displayContentSchema).max(100).readonly(),
|
|
@@ -29647,13 +29610,13 @@ var activeTurnActivitySchema = external_exports.strictObject({
|
|
|
29647
29610
|
title: external_exports.string().max(500),
|
|
29648
29611
|
toolKind: external_exports.string().max(64)
|
|
29649
29612
|
}).readonly();
|
|
29650
|
-
var activeTurnUserMessageSchema = external_exports.
|
|
29613
|
+
var activeTurnUserMessageSchema = external_exports.object({
|
|
29651
29614
|
id: identifierStringSchema,
|
|
29652
29615
|
images: external_exports.array(promptImageSchema).max(8).readonly().optional(),
|
|
29653
29616
|
role: external_exports.literal("user"),
|
|
29654
29617
|
text: external_exports.string().max(SESSION_HISTORY_CHARACTER_LIMIT)
|
|
29655
29618
|
}).readonly();
|
|
29656
|
-
var activeTurnAssistantMessageSchema = external_exports.
|
|
29619
|
+
var activeTurnAssistantMessageSchema = external_exports.object({
|
|
29657
29620
|
activities: external_exports.array(activeTurnActivitySchema).max(100).readonly().default([]),
|
|
29658
29621
|
content: external_exports.array(displayContentSchema).max(100).readonly().default([]),
|
|
29659
29622
|
id: identifierStringSchema,
|
|
@@ -29664,7 +29627,7 @@ var activeTurnMessageSchema = external_exports.discriminatedUnion("role", [
|
|
|
29664
29627
|
activeTurnUserMessageSchema,
|
|
29665
29628
|
activeTurnAssistantMessageSchema
|
|
29666
29629
|
]);
|
|
29667
|
-
var activeTurnSnapshotSchema = external_exports.
|
|
29630
|
+
var activeTurnSnapshotSchema = external_exports.object({
|
|
29668
29631
|
commandId: identifierStringSchema,
|
|
29669
29632
|
epoch: identifierStringSchema,
|
|
29670
29633
|
hasOlder: external_exports.boolean(),
|
|
@@ -29689,64 +29652,64 @@ var identity = {
|
|
|
29689
29652
|
directoryId
|
|
29690
29653
|
};
|
|
29691
29654
|
var nativeSessionRequestSchema = external_exports.discriminatedUnion("action", [
|
|
29692
|
-
external_exports.
|
|
29693
|
-
external_exports.
|
|
29694
|
-
external_exports.
|
|
29695
|
-
external_exports.
|
|
29696
|
-
external_exports.
|
|
29697
|
-
external_exports.
|
|
29655
|
+
external_exports.object({ ...identity, action: external_exports.literal("create") }).readonly(),
|
|
29656
|
+
external_exports.object({ ...identity, action: external_exports.literal("active-turn"), targetSessionId: identifierStringSchema }).readonly(),
|
|
29657
|
+
external_exports.object({ ...identity, action: external_exports.literal("preview"), entryId: identifierStringSchema }).readonly(),
|
|
29658
|
+
external_exports.object({ ...identity, action: external_exports.literal("history"), entryId: identifierStringSchema }).readonly(),
|
|
29659
|
+
external_exports.object({ ...identity, action: external_exports.literal("find"), nativeSessionId: identifierStringSchema }).readonly(),
|
|
29660
|
+
external_exports.object({
|
|
29698
29661
|
...identity,
|
|
29699
29662
|
action: external_exports.literal("list"),
|
|
29700
29663
|
cursor: identifierStringSchema.nullable()
|
|
29701
29664
|
}).readonly(),
|
|
29702
|
-
external_exports.
|
|
29665
|
+
external_exports.object({
|
|
29703
29666
|
...identity,
|
|
29704
29667
|
action: external_exports.enum(["import", "fork"]),
|
|
29705
29668
|
entryId: identifierStringSchema,
|
|
29706
29669
|
targetSessionId: identifierStringSchema
|
|
29707
29670
|
}).readonly(),
|
|
29708
|
-
external_exports.
|
|
29671
|
+
external_exports.object({
|
|
29709
29672
|
...identity,
|
|
29710
29673
|
action: external_exports.literal("fork-recorded"),
|
|
29711
29674
|
targetSessionId: identifierStringSchema,
|
|
29712
29675
|
throughCommandId: identifierStringSchema
|
|
29713
29676
|
}).readonly(),
|
|
29714
|
-
external_exports.
|
|
29677
|
+
external_exports.object({
|
|
29715
29678
|
...identity,
|
|
29716
29679
|
action: external_exports.literal("delete"),
|
|
29717
29680
|
entryId: identifierStringSchema
|
|
29718
29681
|
}).readonly()
|
|
29719
29682
|
]);
|
|
29720
29683
|
var nativeSessionCommandSchema = external_exports.discriminatedUnion("action", [
|
|
29721
|
-
external_exports.
|
|
29722
|
-
external_exports.
|
|
29723
|
-
external_exports.
|
|
29724
|
-
external_exports.
|
|
29725
|
-
external_exports.
|
|
29726
|
-
external_exports.
|
|
29684
|
+
external_exports.object({ ...identity, action: external_exports.literal("create") }).readonly(),
|
|
29685
|
+
external_exports.object({ ...identity, action: external_exports.literal("active-turn"), targetSessionId: identifierStringSchema }).readonly(),
|
|
29686
|
+
external_exports.object({ ...identity, action: external_exports.literal("preview"), entryId: identifierStringSchema }).readonly(),
|
|
29687
|
+
external_exports.object({ ...identity, action: external_exports.literal("history"), entryId: identifierStringSchema }).readonly(),
|
|
29688
|
+
external_exports.object({ ...identity, action: external_exports.literal("find"), nativeSessionId: identifierStringSchema }).readonly(),
|
|
29689
|
+
external_exports.object({
|
|
29727
29690
|
...identity,
|
|
29728
29691
|
action: external_exports.literal("list"),
|
|
29729
29692
|
cursor: identifierStringSchema.nullable()
|
|
29730
29693
|
}).readonly(),
|
|
29731
|
-
external_exports.
|
|
29694
|
+
external_exports.object({
|
|
29732
29695
|
...identity,
|
|
29733
29696
|
action: external_exports.enum(["import", "fork"]),
|
|
29734
29697
|
entryId: identifierStringSchema,
|
|
29735
29698
|
targetSessionId: identifierStringSchema
|
|
29736
29699
|
}).readonly(),
|
|
29737
|
-
external_exports.
|
|
29700
|
+
external_exports.object({
|
|
29738
29701
|
...identity,
|
|
29739
29702
|
action: external_exports.literal("fork-recorded"),
|
|
29740
29703
|
targetSessionId: identifierStringSchema,
|
|
29741
29704
|
throughCommandId: identifierStringSchema
|
|
29742
29705
|
}).readonly(),
|
|
29743
|
-
external_exports.
|
|
29706
|
+
external_exports.object({
|
|
29744
29707
|
...identity,
|
|
29745
29708
|
action: external_exports.literal("delete"),
|
|
29746
29709
|
entryId: identifierStringSchema
|
|
29747
29710
|
}).readonly()
|
|
29748
29711
|
]);
|
|
29749
|
-
var nativeSessionEntrySchema = external_exports.
|
|
29712
|
+
var nativeSessionEntrySchema = external_exports.object({
|
|
29750
29713
|
entryId: identifierStringSchema,
|
|
29751
29714
|
mobiusSessionIds: external_exports.array(identifierStringSchema).max(500).readonly(),
|
|
29752
29715
|
nativeSessionId: identifierStringSchema,
|
|
@@ -29754,20 +29717,20 @@ var nativeSessionEntrySchema = external_exports.strictObject({
|
|
|
29754
29717
|
directoryId,
|
|
29755
29718
|
directoryLabel: external_exports.string().min(1).max(2048),
|
|
29756
29719
|
updatedAt: external_exports.iso.datetime({ offset: true }).nullable(),
|
|
29757
|
-
additionalDirectories: external_exports.array(external_exports.
|
|
29720
|
+
additionalDirectories: external_exports.array(external_exports.object({ directoryId, name: external_exports.string().min(1).max(255) }).readonly()).max(16).readonly()
|
|
29758
29721
|
}).readonly();
|
|
29759
29722
|
var resultEnvelope = {
|
|
29760
29723
|
...envelope,
|
|
29761
29724
|
kind: external_exports.literal(NATIVE_SESSION_RESULT_KIND)
|
|
29762
29725
|
};
|
|
29763
29726
|
var nativeSessionResultSchema = external_exports.discriminatedUnion("action", [
|
|
29764
|
-
external_exports.
|
|
29765
|
-
external_exports.
|
|
29727
|
+
external_exports.object({ ...resultEnvelope, action: external_exports.literal("create"), nativeSessionId: identifierStringSchema }).readonly(),
|
|
29728
|
+
external_exports.object({
|
|
29766
29729
|
...resultEnvelope,
|
|
29767
29730
|
action: external_exports.literal("active-turn"),
|
|
29768
29731
|
targetSessionId: identifierStringSchema,
|
|
29769
29732
|
queued: external_exports.array(
|
|
29770
|
-
external_exports.
|
|
29733
|
+
external_exports.object({
|
|
29771
29734
|
commandId: identifierStringSchema,
|
|
29772
29735
|
prompt: external_exports.string().max(1e5),
|
|
29773
29736
|
images: external_exports.array(promptImageSchema).max(8).readonly()
|
|
@@ -29775,26 +29738,26 @@ var nativeSessionResultSchema = external_exports.discriminatedUnion("action", [
|
|
|
29775
29738
|
).readonly(),
|
|
29776
29739
|
turn: activeTurnSnapshotSchema.nullable()
|
|
29777
29740
|
}).readonly(),
|
|
29778
|
-
external_exports.
|
|
29741
|
+
external_exports.object({
|
|
29779
29742
|
...resultEnvelope,
|
|
29780
29743
|
action: external_exports.literal("find"),
|
|
29781
29744
|
entry: nativeSessionEntrySchema
|
|
29782
29745
|
}).readonly(),
|
|
29783
|
-
external_exports.
|
|
29746
|
+
external_exports.object({
|
|
29784
29747
|
...resultEnvelope,
|
|
29785
29748
|
action: external_exports.literal("list"),
|
|
29786
29749
|
capabilities: sessionCapabilitiesSchema,
|
|
29787
29750
|
entries: external_exports.array(nativeSessionEntrySchema).max(500).readonly(),
|
|
29788
29751
|
nextCursor: identifierStringSchema.nullable()
|
|
29789
29752
|
}).readonly(),
|
|
29790
|
-
external_exports.
|
|
29753
|
+
external_exports.object({
|
|
29791
29754
|
...resultEnvelope,
|
|
29792
29755
|
action: external_exports.enum(["import", "fork", "fork-recorded"]),
|
|
29793
29756
|
targetSessionId: identifierStringSchema,
|
|
29794
29757
|
ready: sessionReadyEventSchema,
|
|
29795
29758
|
title: external_exports.string().max(500)
|
|
29796
29759
|
}).readonly(),
|
|
29797
|
-
external_exports.
|
|
29760
|
+
external_exports.object({
|
|
29798
29761
|
...resultEnvelope,
|
|
29799
29762
|
action: external_exports.literal("preview"),
|
|
29800
29763
|
entryId: identifierStringSchema,
|
|
@@ -29803,21 +29766,21 @@ var nativeSessionResultSchema = external_exports.discriminatedUnion("action", [
|
|
|
29803
29766
|
history: sessionHistorySchema,
|
|
29804
29767
|
title: external_exports.string().max(500)
|
|
29805
29768
|
}).readonly(),
|
|
29806
|
-
external_exports.
|
|
29769
|
+
external_exports.object({
|
|
29807
29770
|
...resultEnvelope,
|
|
29808
29771
|
action: external_exports.literal("history"),
|
|
29809
29772
|
entryId: identifierStringSchema,
|
|
29810
29773
|
history: sessionHistorySchema,
|
|
29811
29774
|
title: external_exports.string().max(500)
|
|
29812
29775
|
}).readonly(),
|
|
29813
|
-
external_exports.
|
|
29776
|
+
external_exports.object({
|
|
29814
29777
|
...resultEnvelope,
|
|
29815
29778
|
action: external_exports.literal("delete"),
|
|
29816
29779
|
entryId: identifierStringSchema,
|
|
29817
29780
|
deletedSessionIds: external_exports.array(identifierStringSchema).max(500).readonly()
|
|
29818
29781
|
}).readonly()
|
|
29819
29782
|
]);
|
|
29820
|
-
var nativeSessionCancelSchema = external_exports.
|
|
29783
|
+
var nativeSessionCancelSchema = external_exports.object({ ...envelope, kind: external_exports.literal(NATIVE_SESSION_CANCEL_KIND) }).readonly();
|
|
29821
29784
|
function decode4(schema, encoded) {
|
|
29822
29785
|
try {
|
|
29823
29786
|
const value = JSON.parse(encoded);
|
|
@@ -29842,6 +29805,7 @@ var MAX_JSON_KEYS = 1e3;
|
|
|
29842
29805
|
var SESSION_EVENT_V2_KIND = "session.event.v2";
|
|
29843
29806
|
var boundedString = external_exports.string().max(MAX_CONTENT_LENGTH);
|
|
29844
29807
|
var shortString = external_exports.string().max(2048);
|
|
29808
|
+
var externalContentKeySchema = external_exports.string().regex(/^[a-f0-9]{64}$/u);
|
|
29845
29809
|
function boundedJsonIssue(value, depth = 0) {
|
|
29846
29810
|
if (depth > MAX_JSON_DEPTH) {
|
|
29847
29811
|
return "JSON nesting exceeds the maximum depth";
|
|
@@ -29893,23 +29857,47 @@ var boundedJsonSchema = external_exports.unknown().superRefine((value, context)
|
|
|
29893
29857
|
});
|
|
29894
29858
|
var metadataSchema = external_exports.record(external_exports.string().max(255), boundedJsonSchema).readonly();
|
|
29895
29859
|
var optionalMetadata = metadataSchema.nullable().optional();
|
|
29896
|
-
var annotationsSchema = external_exports.
|
|
29860
|
+
var annotationsSchema = external_exports.object({
|
|
29897
29861
|
_meta: optionalMetadata,
|
|
29898
29862
|
audience: external_exports.array(external_exports.enum(["assistant", "user"])).max(2).readonly().nullable().optional(),
|
|
29899
29863
|
lastModified: shortString.nullable().optional(),
|
|
29900
29864
|
priority: external_exports.number().finite().nullable().optional()
|
|
29901
29865
|
}).readonly();
|
|
29902
29866
|
var contentFields = { _meta: optionalMetadata, annotations: annotationsSchema.nullable().optional() };
|
|
29903
|
-
var textContentSchema = external_exports.
|
|
29904
|
-
var imageContentSchema = external_exports.
|
|
29867
|
+
var textContentSchema = external_exports.object({ ...contentFields, text: boundedString, type: external_exports.literal("text") }).readonly();
|
|
29868
|
+
var imageContentSchema = external_exports.object({
|
|
29905
29869
|
...contentFields,
|
|
29906
29870
|
data: boundedString,
|
|
29907
29871
|
mimeType: shortString,
|
|
29908
29872
|
type: external_exports.literal("image"),
|
|
29909
29873
|
uri: boundedString.nullable().optional()
|
|
29910
29874
|
}).readonly();
|
|
29911
|
-
var audioContentSchema = external_exports.
|
|
29912
|
-
var
|
|
29875
|
+
var audioContentSchema = external_exports.object({ ...contentFields, data: boundedString, mimeType: shortString, type: external_exports.literal("audio") }).readonly();
|
|
29876
|
+
var externalImageContentSchema = external_exports.strictObject({
|
|
29877
|
+
...contentFields,
|
|
29878
|
+
byteLength: external_exports.number().int().positive().safe(),
|
|
29879
|
+
imageKey: externalContentKeySchema,
|
|
29880
|
+
mimeType: shortString,
|
|
29881
|
+
type: external_exports.literal("external_image"),
|
|
29882
|
+
uri: boundedString.nullable().optional()
|
|
29883
|
+
}).readonly();
|
|
29884
|
+
var externalAudioContentSchema = external_exports.strictObject({
|
|
29885
|
+
...contentFields,
|
|
29886
|
+
audioKey: externalContentKeySchema,
|
|
29887
|
+
byteLength: external_exports.number().int().positive().safe(),
|
|
29888
|
+
mimeType: shortString,
|
|
29889
|
+
type: external_exports.literal("external_audio")
|
|
29890
|
+
}).readonly();
|
|
29891
|
+
var externalResourceContentSchema = external_exports.strictObject({
|
|
29892
|
+
...contentFields,
|
|
29893
|
+
byteLength: external_exports.number().int().positive().safe(),
|
|
29894
|
+
encoding: external_exports.enum(["binary", "text"]),
|
|
29895
|
+
mimeType: shortString.nullable().optional(),
|
|
29896
|
+
resourceKey: externalContentKeySchema,
|
|
29897
|
+
type: external_exports.literal("external_resource"),
|
|
29898
|
+
uri: boundedString
|
|
29899
|
+
}).readonly();
|
|
29900
|
+
var resourceLinkSchema = external_exports.object({
|
|
29913
29901
|
...contentFields,
|
|
29914
29902
|
description: boundedString.nullable().optional(),
|
|
29915
29903
|
mimeType: shortString.nullable().optional(),
|
|
@@ -29919,19 +29907,19 @@ var resourceLinkSchema = external_exports.strictObject({
|
|
|
29919
29907
|
type: external_exports.literal("resource_link"),
|
|
29920
29908
|
uri: boundedString
|
|
29921
29909
|
}).readonly();
|
|
29922
|
-
var textResourceSchema = external_exports.
|
|
29910
|
+
var textResourceSchema = external_exports.object({
|
|
29923
29911
|
_meta: optionalMetadata,
|
|
29924
29912
|
mimeType: shortString.nullable().optional(),
|
|
29925
29913
|
text: boundedString,
|
|
29926
29914
|
uri: boundedString
|
|
29927
29915
|
}).readonly();
|
|
29928
|
-
var blobResourceSchema = external_exports.
|
|
29916
|
+
var blobResourceSchema = external_exports.object({
|
|
29929
29917
|
_meta: optionalMetadata,
|
|
29930
29918
|
blob: boundedString,
|
|
29931
29919
|
mimeType: shortString.nullable().optional(),
|
|
29932
29920
|
uri: boundedString
|
|
29933
29921
|
}).readonly();
|
|
29934
|
-
var embeddedResourceSchema = external_exports.
|
|
29922
|
+
var embeddedResourceSchema = external_exports.object({
|
|
29935
29923
|
...contentFields,
|
|
29936
29924
|
resource: external_exports.union([textResourceSchema, blobResourceSchema]),
|
|
29937
29925
|
type: external_exports.literal("resource")
|
|
@@ -29941,20 +29929,23 @@ var contentBlockV2Schema = external_exports.discriminatedUnion("type", [
|
|
|
29941
29929
|
imageContentSchema,
|
|
29942
29930
|
audioContentSchema,
|
|
29943
29931
|
resourceLinkSchema,
|
|
29944
|
-
embeddedResourceSchema
|
|
29932
|
+
embeddedResourceSchema,
|
|
29933
|
+
externalImageContentSchema,
|
|
29934
|
+
externalAudioContentSchema,
|
|
29935
|
+
externalResourceContentSchema
|
|
29945
29936
|
]);
|
|
29946
29937
|
var toolCallContentSchema = external_exports.discriminatedUnion("type", [
|
|
29947
|
-
external_exports.
|
|
29948
|
-
external_exports.
|
|
29938
|
+
external_exports.object({ _meta: optionalMetadata, content: contentBlockV2Schema, type: external_exports.literal("content") }).readonly(),
|
|
29939
|
+
external_exports.object({
|
|
29949
29940
|
_meta: optionalMetadata,
|
|
29950
29941
|
newText: boundedString,
|
|
29951
29942
|
oldText: boundedString.nullable().optional(),
|
|
29952
29943
|
path: boundedString,
|
|
29953
29944
|
type: external_exports.literal("diff")
|
|
29954
29945
|
}).readonly(),
|
|
29955
|
-
external_exports.
|
|
29946
|
+
external_exports.object({ _meta: optionalMetadata, terminalId: shortString, type: external_exports.literal("terminal") }).readonly()
|
|
29956
29947
|
]);
|
|
29957
|
-
var toolCallLocationSchema = external_exports.
|
|
29948
|
+
var toolCallLocationSchema = external_exports.object({
|
|
29958
29949
|
_meta: optionalMetadata,
|
|
29959
29950
|
line: external_exports.number().int().nonnegative().safe().nullable().optional(),
|
|
29960
29951
|
path: boundedString
|
|
@@ -29983,40 +29974,40 @@ var toolPatchFields = {
|
|
|
29983
29974
|
status: toolStatusSchema.nullable().optional(),
|
|
29984
29975
|
title: boundedString.nullable().optional()
|
|
29985
29976
|
};
|
|
29986
|
-
var planEntrySchema = external_exports.
|
|
29977
|
+
var planEntrySchema = external_exports.object({
|
|
29987
29978
|
_meta: optionalMetadata,
|
|
29988
29979
|
content: boundedString,
|
|
29989
29980
|
priority: external_exports.enum(["high", "medium", "low"]),
|
|
29990
29981
|
status: external_exports.enum(["pending", "in_progress", "completed"])
|
|
29991
29982
|
}).readonly();
|
|
29992
29983
|
var planContentSchema = external_exports.discriminatedUnion("type", [
|
|
29993
|
-
external_exports.
|
|
29984
|
+
external_exports.object({
|
|
29994
29985
|
_meta: optionalMetadata,
|
|
29995
29986
|
entries: external_exports.array(planEntrySchema).max(MAX_COLLECTION_SIZE).readonly(),
|
|
29996
29987
|
planId: shortString,
|
|
29997
29988
|
type: external_exports.literal("items")
|
|
29998
29989
|
}).readonly(),
|
|
29999
|
-
external_exports.
|
|
30000
|
-
external_exports.
|
|
29990
|
+
external_exports.object({ _meta: optionalMetadata, planId: shortString, type: external_exports.literal("file"), uri: boundedString }).readonly(),
|
|
29991
|
+
external_exports.object({
|
|
30001
29992
|
_meta: optionalMetadata,
|
|
30002
29993
|
content: boundedString,
|
|
30003
29994
|
planId: shortString,
|
|
30004
29995
|
type: external_exports.literal("markdown")
|
|
30005
29996
|
}).readonly()
|
|
30006
29997
|
]);
|
|
30007
|
-
var commandSchema = external_exports.
|
|
29998
|
+
var commandSchema = external_exports.object({
|
|
30008
29999
|
_meta: optionalMetadata,
|
|
30009
30000
|
description: boundedString,
|
|
30010
|
-
input: external_exports.
|
|
30001
|
+
input: external_exports.object({ _meta: optionalMetadata, hint: boundedString }).readonly().nullable().optional(),
|
|
30011
30002
|
name: shortString
|
|
30012
30003
|
}).readonly();
|
|
30013
|
-
var configSelectOptionSchema = external_exports.
|
|
30004
|
+
var configSelectOptionSchema = external_exports.object({
|
|
30014
30005
|
_meta: optionalMetadata,
|
|
30015
30006
|
description: boundedString.nullable().optional(),
|
|
30016
30007
|
name: shortString,
|
|
30017
30008
|
value: shortString
|
|
30018
30009
|
}).readonly();
|
|
30019
|
-
var configSelectGroupSchema = external_exports.
|
|
30010
|
+
var configSelectGroupSchema = external_exports.object({
|
|
30020
30011
|
_meta: optionalMetadata,
|
|
30021
30012
|
group: shortString,
|
|
30022
30013
|
name: shortString,
|
|
@@ -30030,7 +30021,7 @@ var configBaseFields = {
|
|
|
30030
30021
|
name: shortString
|
|
30031
30022
|
};
|
|
30032
30023
|
var sessionConfigOptionSchema2 = external_exports.discriminatedUnion("type", [
|
|
30033
|
-
external_exports.
|
|
30024
|
+
external_exports.object({
|
|
30034
30025
|
...configBaseFields,
|
|
30035
30026
|
currentValue: shortString,
|
|
30036
30027
|
options: external_exports.union([
|
|
@@ -30039,7 +30030,7 @@ var sessionConfigOptionSchema2 = external_exports.discriminatedUnion("type", [
|
|
|
30039
30030
|
]),
|
|
30040
30031
|
type: external_exports.literal("select")
|
|
30041
30032
|
}).readonly(),
|
|
30042
|
-
external_exports.
|
|
30033
|
+
external_exports.object({ ...configBaseFields, currentValue: external_exports.boolean(), type: external_exports.literal("boolean") }).readonly()
|
|
30043
30034
|
]);
|
|
30044
30035
|
var contentChunkFields = {
|
|
30045
30036
|
_meta: optionalMetadata,
|
|
@@ -30047,10 +30038,10 @@ var contentChunkFields = {
|
|
|
30047
30038
|
messageId: shortString.nullable().optional()
|
|
30048
30039
|
};
|
|
30049
30040
|
var acpSessionUpdateV2Schema = external_exports.discriminatedUnion("sessionUpdate", [
|
|
30050
|
-
external_exports.
|
|
30051
|
-
external_exports.
|
|
30052
|
-
external_exports.
|
|
30053
|
-
external_exports.
|
|
30041
|
+
external_exports.object({ ...contentChunkFields, sessionUpdate: external_exports.literal("user_message_chunk") }).readonly(),
|
|
30042
|
+
external_exports.object({ ...contentChunkFields, sessionUpdate: external_exports.literal("agent_message_chunk") }).readonly(),
|
|
30043
|
+
external_exports.object({ ...contentChunkFields, sessionUpdate: external_exports.literal("agent_thought_chunk") }).readonly(),
|
|
30044
|
+
external_exports.object({
|
|
30054
30045
|
_meta: optionalMetadata,
|
|
30055
30046
|
content: external_exports.array(toolCallContentSchema).max(MAX_COLLECTION_SIZE).readonly().optional(),
|
|
30056
30047
|
kind: toolKindSchema.optional(),
|
|
@@ -30063,43 +30054,43 @@ var acpSessionUpdateV2Schema = external_exports.discriminatedUnion("sessionUpdat
|
|
|
30063
30054
|
title: boundedString,
|
|
30064
30055
|
toolCallId: shortString
|
|
30065
30056
|
}).readonly(),
|
|
30066
|
-
external_exports.
|
|
30067
|
-
external_exports.
|
|
30057
|
+
external_exports.object({ ...toolPatchFields, sessionUpdate: external_exports.literal("tool_call_update"), toolCallId: shortString }).readonly(),
|
|
30058
|
+
external_exports.object({
|
|
30068
30059
|
_meta: optionalMetadata,
|
|
30069
30060
|
entries: external_exports.array(planEntrySchema).max(MAX_COLLECTION_SIZE).readonly(),
|
|
30070
30061
|
sessionUpdate: external_exports.literal("plan")
|
|
30071
30062
|
}).readonly(),
|
|
30072
|
-
external_exports.
|
|
30073
|
-
external_exports.
|
|
30074
|
-
external_exports.
|
|
30063
|
+
external_exports.object({ _meta: optionalMetadata, plan: planContentSchema, sessionUpdate: external_exports.literal("plan_update") }).readonly(),
|
|
30064
|
+
external_exports.object({ _meta: optionalMetadata, planId: shortString, sessionUpdate: external_exports.literal("plan_removed") }).readonly(),
|
|
30065
|
+
external_exports.object({
|
|
30075
30066
|
_meta: optionalMetadata,
|
|
30076
30067
|
availableCommands: external_exports.array(commandSchema).max(MAX_COLLECTION_SIZE).readonly(),
|
|
30077
30068
|
sessionUpdate: external_exports.literal("available_commands_update")
|
|
30078
30069
|
}).readonly(),
|
|
30079
|
-
external_exports.
|
|
30070
|
+
external_exports.object({
|
|
30080
30071
|
_meta: optionalMetadata,
|
|
30081
30072
|
currentModeId: shortString,
|
|
30082
30073
|
sessionUpdate: external_exports.literal("current_mode_update")
|
|
30083
30074
|
}).readonly(),
|
|
30084
|
-
external_exports.
|
|
30075
|
+
external_exports.object({
|
|
30085
30076
|
_meta: optionalMetadata,
|
|
30086
30077
|
configOptions: external_exports.array(sessionConfigOptionSchema2).max(MAX_COLLECTION_SIZE).readonly(),
|
|
30087
30078
|
sessionUpdate: external_exports.literal("config_option_update")
|
|
30088
30079
|
}).readonly(),
|
|
30089
|
-
external_exports.
|
|
30080
|
+
external_exports.object({
|
|
30090
30081
|
_meta: optionalMetadata,
|
|
30091
30082
|
sessionUpdate: external_exports.literal("session_info_update"),
|
|
30092
30083
|
title: boundedString.nullable().optional(),
|
|
30093
30084
|
updatedAt: shortString.nullable().optional()
|
|
30094
30085
|
}).readonly(),
|
|
30095
|
-
external_exports.
|
|
30086
|
+
external_exports.object({
|
|
30096
30087
|
_meta: optionalMetadata,
|
|
30097
|
-
cost: external_exports.
|
|
30088
|
+
cost: external_exports.object({ _meta: optionalMetadata, amount: external_exports.number().finite(), currency: external_exports.string().max(16) }).readonly().nullable().optional(),
|
|
30098
30089
|
sessionUpdate: external_exports.literal("usage_update"),
|
|
30099
30090
|
size: external_exports.number().int().nonnegative().safe(),
|
|
30100
30091
|
used: external_exports.number().int().nonnegative().safe()
|
|
30101
30092
|
}).readonly(),
|
|
30102
|
-
external_exports.
|
|
30093
|
+
external_exports.object({
|
|
30103
30094
|
_meta: optionalMetadata,
|
|
30104
30095
|
compactionId: shortString,
|
|
30105
30096
|
error: boundedString.nullable().optional(),
|
|
@@ -30107,7 +30098,7 @@ var acpSessionUpdateV2Schema = external_exports.discriminatedUnion("sessionUpdat
|
|
|
30107
30098
|
status: shortString,
|
|
30108
30099
|
summary: external_exports.array(contentBlockV2Schema).max(MAX_COLLECTION_SIZE).readonly().nullable().optional()
|
|
30109
30100
|
}).readonly(),
|
|
30110
|
-
external_exports.
|
|
30101
|
+
external_exports.object({
|
|
30111
30102
|
_meta: optionalMetadata,
|
|
30112
30103
|
compactionId: shortString,
|
|
30113
30104
|
content: contentBlockV2Schema,
|
|
@@ -30116,28 +30107,28 @@ var acpSessionUpdateV2Schema = external_exports.discriminatedUnion("sessionUpdat
|
|
|
30116
30107
|
]);
|
|
30117
30108
|
var lifecycleBase = { commandId: identifierStringSchema };
|
|
30118
30109
|
var lifecycleMetadataV2Schema = external_exports.discriminatedUnion("kind", [
|
|
30119
|
-
external_exports.
|
|
30120
|
-
external_exports.
|
|
30121
|
-
external_exports.
|
|
30122
|
-
external_exports.
|
|
30110
|
+
external_exports.object({ kind: external_exports.literal("session.queue.changed") }).readonly(),
|
|
30111
|
+
external_exports.object({ event: sessionPermissionRequestedEventSchema, kind: external_exports.literal("session.permission.requested") }).readonly(),
|
|
30112
|
+
external_exports.object({ event: sessionPermissionResolvedEventSchema, kind: external_exports.literal("session.permission.resolved") }).readonly(),
|
|
30113
|
+
external_exports.object({
|
|
30123
30114
|
event: sessionElicitationRequestedEventSchema,
|
|
30124
30115
|
kind: external_exports.literal("session.elicitation.requested")
|
|
30125
30116
|
}).readonly(),
|
|
30126
|
-
external_exports.
|
|
30127
|
-
external_exports.
|
|
30117
|
+
external_exports.object({ event: sessionElicitationResolvedEventSchema, kind: external_exports.literal("session.elicitation.resolved") }).readonly(),
|
|
30118
|
+
external_exports.object({
|
|
30128
30119
|
...lifecycleBase,
|
|
30129
30120
|
content: external_exports.array(contentBlockV2Schema).min(1).max(100).readonly(),
|
|
30130
30121
|
kind: external_exports.literal("prompt.requested")
|
|
30131
30122
|
}).readonly(),
|
|
30132
|
-
external_exports.
|
|
30133
|
-
external_exports.
|
|
30134
|
-
external_exports.
|
|
30123
|
+
external_exports.object({ ...lifecycleBase, attemptId: identifierStringSchema, epoch: identifierStringSchema, kind: external_exports.literal("prompt.started") }).readonly(),
|
|
30124
|
+
external_exports.object({ ...lifecycleBase, kind: external_exports.literal("prompt.completed"), stopReason: shortString }).readonly(),
|
|
30125
|
+
external_exports.object({
|
|
30135
30126
|
...lifecycleBase,
|
|
30136
30127
|
code: identifierStringSchema,
|
|
30137
30128
|
kind: external_exports.literal("prompt.failed-before-start"),
|
|
30138
30129
|
message: external_exports.string().min(1).max(500)
|
|
30139
30130
|
}).readonly(),
|
|
30140
|
-
external_exports.
|
|
30131
|
+
external_exports.object({
|
|
30141
30132
|
...lifecycleBase,
|
|
30142
30133
|
attemptId: identifierStringSchema,
|
|
30143
30134
|
code: identifierStringSchema,
|
|
@@ -30146,19 +30137,19 @@ var lifecycleMetadataV2Schema = external_exports.discriminatedUnion("kind", [
|
|
|
30146
30137
|
}).readonly()
|
|
30147
30138
|
]);
|
|
30148
30139
|
var sessionEventPayloadV2Schema = external_exports.discriminatedUnion("type", [
|
|
30149
|
-
external_exports.
|
|
30150
|
-
external_exports.
|
|
30140
|
+
external_exports.object({ payload: acpSessionUpdateV2Schema, type: external_exports.literal("acp") }).readonly(),
|
|
30141
|
+
external_exports.object({ payload: lifecycleMetadataV2Schema, type: external_exports.literal("lifecycle-metadata") }).readonly()
|
|
30151
30142
|
]);
|
|
30152
30143
|
var positionSchema = external_exports.string().regex(/^(0|[1-9][0-9]*)$/);
|
|
30153
30144
|
var provenanceSchema = external_exports.discriminatedUnion("kind", [
|
|
30154
|
-
external_exports.
|
|
30155
|
-
external_exports.
|
|
30145
|
+
external_exports.object({ kind: external_exports.literal("original") }).readonly(),
|
|
30146
|
+
external_exports.object({
|
|
30156
30147
|
kind: external_exports.literal("imported"),
|
|
30157
30148
|
sourceEventId: identifierStringSchema,
|
|
30158
30149
|
sourcePosition: positionSchema,
|
|
30159
30150
|
sourceSessionId: identifierStringSchema
|
|
30160
30151
|
}).readonly(),
|
|
30161
|
-
external_exports.
|
|
30152
|
+
external_exports.object({
|
|
30162
30153
|
kind: external_exports.literal("forked"),
|
|
30163
30154
|
sourceEventId: identifierStringSchema,
|
|
30164
30155
|
sourcePosition: positionSchema,
|
|
@@ -30173,15 +30164,15 @@ var sessionEventFieldsV2 = {
|
|
|
30173
30164
|
sessionId: identifierStringSchema
|
|
30174
30165
|
};
|
|
30175
30166
|
var sessionEventV2Schema = external_exports.discriminatedUnion("type", [
|
|
30176
|
-
external_exports.
|
|
30177
|
-
external_exports.
|
|
30167
|
+
external_exports.object({ ...sessionEventFieldsV2, payload: acpSessionUpdateV2Schema, type: external_exports.literal("acp") }).readonly(),
|
|
30168
|
+
external_exports.object({
|
|
30178
30169
|
...sessionEventFieldsV2,
|
|
30179
30170
|
payload: lifecycleMetadataV2Schema,
|
|
30180
30171
|
type: external_exports.literal("lifecycle-metadata")
|
|
30181
30172
|
}).readonly()
|
|
30182
30173
|
]);
|
|
30183
|
-
var sessionExportV2Schema = external_exports.
|
|
30184
|
-
binding: external_exports.
|
|
30174
|
+
var sessionExportV2Schema = external_exports.object({
|
|
30175
|
+
binding: external_exports.object({
|
|
30185
30176
|
bindingId: identifierStringSchema,
|
|
30186
30177
|
runtimeId: identifierStringSchema
|
|
30187
30178
|
}).readonly(),
|
|
@@ -30218,20 +30209,20 @@ var sessionExportV2Schema = external_exports.strictObject({
|
|
|
30218
30209
|
eventIds.add(event.eventId);
|
|
30219
30210
|
}
|
|
30220
30211
|
});
|
|
30221
|
-
var mobiusSessionExportV2Schema = external_exports.
|
|
30212
|
+
var mobiusSessionExportV2Schema = external_exports.object({
|
|
30222
30213
|
formatVersion: external_exports.literal("2"),
|
|
30223
30214
|
session: sessionExportV2Schema
|
|
30224
30215
|
}).readonly();
|
|
30225
|
-
var sessionEventEnvelopeV2Schema = external_exports.
|
|
30226
|
-
var sessionEventLogPageV2Schema = external_exports.
|
|
30216
|
+
var sessionEventEnvelopeV2Schema = external_exports.object({ event: sessionEventV2Schema, kind: external_exports.literal(SESSION_EVENT_V2_KIND) }).readonly();
|
|
30217
|
+
var sessionEventLogPageV2Schema = external_exports.object({
|
|
30227
30218
|
events: external_exports.array(sessionEventV2Schema).max(MAX_EVENT_COUNT).readonly(),
|
|
30228
30219
|
nextCursor: external_exports.string().min(1).max(512).nullable(),
|
|
30229
30220
|
tailCursor: external_exports.string().max(512),
|
|
30230
30221
|
truncated: external_exports.boolean(),
|
|
30231
30222
|
version: external_exports.literal(2)
|
|
30232
30223
|
}).readonly();
|
|
30233
|
-
var nativeEventPageRequestV2Schema = external_exports.
|
|
30234
|
-
var executingPromptRequestEventLogV2Schema = external_exports.
|
|
30224
|
+
var nativeEventPageRequestV2Schema = external_exports.object({ cursor: external_exports.string().min(1).max(512).nullable(), eventLimit: external_exports.number().int().min(1).max(1e4) }).readonly();
|
|
30225
|
+
var executingPromptRequestEventLogV2Schema = external_exports.object({
|
|
30235
30226
|
attemptId: identifierStringSchema,
|
|
30236
30227
|
commandId: identifierStringSchema,
|
|
30237
30228
|
epoch: identifierStringSchema,
|
|
@@ -30239,7 +30230,7 @@ var executingPromptRequestEventLogV2Schema = external_exports.strictObject({
|
|
|
30239
30230
|
tailCursor: external_exports.string().max(512),
|
|
30240
30231
|
truncated: external_exports.boolean()
|
|
30241
30232
|
}).readonly();
|
|
30242
|
-
var nativeSessionEventsV2Schema = external_exports.
|
|
30233
|
+
var nativeSessionEventsV2Schema = external_exports.object({
|
|
30243
30234
|
executingPromptRequest: executingPromptRequestEventLogV2Schema.nullable(),
|
|
30244
30235
|
history: sessionEventLogPageV2Schema
|
|
30245
30236
|
}).readonly();
|
|
@@ -30274,14 +30265,14 @@ var decodeAcpSessionUpdateV2 = (value) => decode5(value, acpSessionUpdateV2Schem
|
|
|
30274
30265
|
var SESSION_EVENT_KIND = "session.event";
|
|
30275
30266
|
var SESSION_FORKED_KIND = "session.forked";
|
|
30276
30267
|
var MAX_RECORDED_EVENT_LENGTH = 8 * 1024 * 1024;
|
|
30277
|
-
var sessionEventEnvelopeSchema = external_exports.
|
|
30268
|
+
var sessionEventEnvelopeSchema = external_exports.object({
|
|
30278
30269
|
kind: external_exports.literal(SESSION_EVENT_KIND),
|
|
30279
30270
|
payload: external_exports.string().min(2).max(MAX_RECORDED_EVENT_LENGTH),
|
|
30280
30271
|
sessionId: identifierStringSchema
|
|
30281
30272
|
}).readonly();
|
|
30282
30273
|
var SESSION_QUEUE_CHANGED_KIND = "session.queue.changed";
|
|
30283
|
-
var sessionQueueChangedSchema = external_exports.
|
|
30284
|
-
var sessionForkedSchema = external_exports.
|
|
30274
|
+
var sessionQueueChangedSchema = external_exports.object({ kind: external_exports.literal(SESSION_QUEUE_CHANGED_KIND), sessionId: identifierStringSchema }).readonly();
|
|
30275
|
+
var sessionForkedSchema = external_exports.object({
|
|
30285
30276
|
kind: external_exports.literal(SESSION_FORKED_KIND),
|
|
30286
30277
|
sessionId: identifierStringSchema,
|
|
30287
30278
|
sourceSessionId: identifierStringSchema,
|
|
@@ -30353,7 +30344,7 @@ function decodeRecordedSessionEvent(encoded) {
|
|
|
30353
30344
|
case SESSION_USAGE_UPDATED_KIND:
|
|
30354
30345
|
return decodeSessionUsageUpdatedEvent(encoded);
|
|
30355
30346
|
default:
|
|
30356
|
-
throw new
|
|
30347
|
+
throw new UnsupportedProtocolMessageKindError("daemon-to-service", kind);
|
|
30357
30348
|
}
|
|
30358
30349
|
}
|
|
30359
30350
|
var encodeRecordedSessionEvent = (event) => JSON.stringify(decodeRecordedSessionEvent(JSON.stringify(event)));
|
|
@@ -30366,7 +30357,7 @@ var SESSION_LIVE_HISTORY_PAGE_LOADED_KIND = "session.live-history.page.loaded";
|
|
|
30366
30357
|
var SESSION_LIVE_HISTORY_V2_PAGE_LOAD_KIND = "session.live-history.v2.page.load";
|
|
30367
30358
|
var SESSION_LIVE_HISTORY_V2_PAGE_LOADED_KIND = "session.live-history.v2.page.loaded";
|
|
30368
30359
|
var directoryIdentifier = external_exports.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,2047}$/);
|
|
30369
|
-
var sessionLiveHistoryLoadSchema = external_exports.
|
|
30360
|
+
var sessionLiveHistoryLoadSchema = external_exports.object({
|
|
30370
30361
|
additionalDirectoryIds: external_exports.array(directoryIdentifier).max(16).readonly(),
|
|
30371
30362
|
agentId: identifierStringSchema,
|
|
30372
30363
|
bindingId: identifierStringSchema,
|
|
@@ -30375,13 +30366,13 @@ var sessionLiveHistoryLoadSchema = external_exports.strictObject({
|
|
|
30375
30366
|
requestId: identifierStringSchema,
|
|
30376
30367
|
sessionId: identifierStringSchema
|
|
30377
30368
|
}).readonly();
|
|
30378
|
-
var sessionLiveHistoryLoadedSchema = external_exports.
|
|
30369
|
+
var sessionLiveHistoryLoadedSchema = external_exports.object({
|
|
30379
30370
|
history: sessionHistorySchema,
|
|
30380
30371
|
kind: external_exports.literal(SESSION_LIVE_HISTORY_LOADED_KIND),
|
|
30381
30372
|
requestId: identifierStringSchema,
|
|
30382
30373
|
sessionId: identifierStringSchema
|
|
30383
30374
|
}).readonly();
|
|
30384
|
-
var sessionLiveHistoryPageLoadSchema = external_exports.
|
|
30375
|
+
var sessionLiveHistoryPageLoadSchema = external_exports.object({
|
|
30385
30376
|
additionalDirectoryIds: external_exports.array(directoryIdentifier).max(16).readonly(),
|
|
30386
30377
|
agentId: identifierStringSchema,
|
|
30387
30378
|
bindingId: identifierStringSchema,
|
|
@@ -30392,13 +30383,13 @@ var sessionLiveHistoryPageLoadSchema = external_exports.strictObject({
|
|
|
30392
30383
|
requestId: identifierStringSchema,
|
|
30393
30384
|
sessionId: identifierStringSchema
|
|
30394
30385
|
}).readonly();
|
|
30395
|
-
var sessionLiveHistoryPageLoadedSchema = external_exports.
|
|
30386
|
+
var sessionLiveHistoryPageLoadedSchema = external_exports.object({
|
|
30396
30387
|
kind: external_exports.literal(SESSION_LIVE_HISTORY_PAGE_LOADED_KIND),
|
|
30397
30388
|
page: nativeMessagePageSchema,
|
|
30398
30389
|
requestId: identifierStringSchema,
|
|
30399
30390
|
sessionId: identifierStringSchema
|
|
30400
30391
|
}).readonly();
|
|
30401
|
-
var sessionLiveHistoryV2PageLoadSchema = external_exports.
|
|
30392
|
+
var sessionLiveHistoryV2PageLoadSchema = external_exports.object({
|
|
30402
30393
|
additionalDirectoryIds: external_exports.array(directoryIdentifier).max(16).readonly(),
|
|
30403
30394
|
agentId: identifierStringSchema,
|
|
30404
30395
|
bindingId: identifierStringSchema,
|
|
@@ -30409,7 +30400,7 @@ var sessionLiveHistoryV2PageLoadSchema = external_exports.strictObject({
|
|
|
30409
30400
|
requestId: identifierStringSchema,
|
|
30410
30401
|
sessionId: identifierStringSchema
|
|
30411
30402
|
}).readonly();
|
|
30412
|
-
var sessionLiveHistoryV2PageLoadedSchema = external_exports.
|
|
30403
|
+
var sessionLiveHistoryV2PageLoadedSchema = external_exports.object({
|
|
30413
30404
|
events: nativeSessionEventsV2Schema,
|
|
30414
30405
|
kind: external_exports.literal(SESSION_LIVE_HISTORY_V2_PAGE_LOADED_KIND),
|
|
30415
30406
|
requestId: identifierStringSchema,
|
|
@@ -30555,7 +30546,7 @@ function decodeServiceToDaemonMessage(encoded) {
|
|
|
30555
30546
|
const kind = decodeMessageKind(encoded);
|
|
30556
30547
|
const signature = serviceToDaemonRegistry[kind];
|
|
30557
30548
|
if (signature === void 0) {
|
|
30558
|
-
throw new
|
|
30549
|
+
throw new UnsupportedProtocolMessageKindError("service-to-daemon", kind);
|
|
30559
30550
|
}
|
|
30560
30551
|
return signature.decoder(encoded);
|
|
30561
30552
|
}
|
|
@@ -30753,11 +30744,11 @@ function createDaemonConfig(connection, agents = [], installableAgents = [], loc
|
|
|
30753
30744
|
|
|
30754
30745
|
// src/daemon-manager.ts
|
|
30755
30746
|
import { spawn as spawn6 } from "node:child_process";
|
|
30756
|
-
import { createHash as
|
|
30757
|
-
import { readFile as
|
|
30747
|
+
import { createHash as createHash9, randomBytes } from "node:crypto";
|
|
30748
|
+
import { readFile as readFile4, unlink as unlink2, writeFile as writeFile5 } from "node:fs/promises";
|
|
30758
30749
|
import { createConnection, createServer } from "node:net";
|
|
30759
30750
|
import { tmpdir } from "node:os";
|
|
30760
|
-
import { join as
|
|
30751
|
+
import { join as join20 } from "node:path";
|
|
30761
30752
|
|
|
30762
30753
|
// src/pairing/pair-local-machine.ts
|
|
30763
30754
|
import { mkdir as mkdir5, realpath as realpath6, stat as stat5 } from "node:fs/promises";
|
|
@@ -31587,8 +31578,8 @@ var AuditStore = class {
|
|
|
31587
31578
|
};
|
|
31588
31579
|
|
|
31589
31580
|
// src/run-daemon.ts
|
|
31590
|
-
import { createHash as
|
|
31591
|
-
import { join as
|
|
31581
|
+
import { createHash as createHash8, randomUUID as randomUUID8 } from "node:crypto";
|
|
31582
|
+
import { join as join19 } from "node:path";
|
|
31592
31583
|
import { styleText } from "node:util";
|
|
31593
31584
|
|
|
31594
31585
|
// src/acp/active-executions.ts
|
|
@@ -34960,7 +34951,7 @@ function sql(strings, ...params) {
|
|
|
34960
34951
|
return new SQL([new StringChunk(str)]);
|
|
34961
34952
|
}
|
|
34962
34953
|
sql2.raw = raw;
|
|
34963
|
-
function
|
|
34954
|
+
function join21(chunks, separator) {
|
|
34964
34955
|
const result = [];
|
|
34965
34956
|
for (const [i, chunk] of chunks.entries()) {
|
|
34966
34957
|
if (i > 0 && separator !== void 0) {
|
|
@@ -34970,7 +34961,7 @@ function sql(strings, ...params) {
|
|
|
34970
34961
|
}
|
|
34971
34962
|
return new SQL(result);
|
|
34972
34963
|
}
|
|
34973
|
-
sql2.join =
|
|
34964
|
+
sql2.join = join21;
|
|
34974
34965
|
function identifier(value) {
|
|
34975
34966
|
return new Name(value);
|
|
34976
34967
|
}
|
|
@@ -37514,7 +37505,7 @@ var SQLiteSelectQueryBuilderBase = class extends TypedQueryBuilder {
|
|
|
37514
37505
|
const baseTableName = this.tableName;
|
|
37515
37506
|
const tableName = getTableLikeName(table);
|
|
37516
37507
|
for (const item of extractUsedTable(table)) this.usedTables.add(item);
|
|
37517
|
-
if (typeof tableName === "string" && this.config.joins?.some((
|
|
37508
|
+
if (typeof tableName === "string" && this.config.joins?.some((join21) => join21.alias === tableName)) {
|
|
37518
37509
|
throw new Error(`Alias "${tableName}" is already used in this query`);
|
|
37519
37510
|
}
|
|
37520
37511
|
if (!this.isPartialSelect) {
|
|
@@ -38373,7 +38364,7 @@ var SQLiteUpdateBase = class extends QueryPromise {
|
|
|
38373
38364
|
createJoin(joinType) {
|
|
38374
38365
|
return (table, on) => {
|
|
38375
38366
|
const tableName = getTableLikeName(table);
|
|
38376
|
-
if (typeof tableName === "string" && this.config.joins.some((
|
|
38367
|
+
if (typeof tableName === "string" && this.config.joins.some((join21) => join21.alias === tableName)) {
|
|
38377
38368
|
throw new Error(`Alias "${tableName}" is already used in this query`);
|
|
38378
38369
|
}
|
|
38379
38370
|
if (typeof on === "function") {
|
|
@@ -39696,6 +39687,7 @@ function recordsEqual(left, right) {
|
|
|
39696
39687
|
}
|
|
39697
39688
|
var AgentSession = class _AgentSession {
|
|
39698
39689
|
#connection;
|
|
39690
|
+
#contentExternalizer;
|
|
39699
39691
|
#interactions;
|
|
39700
39692
|
#additionalDirectories;
|
|
39701
39693
|
#agentId;
|
|
@@ -39723,7 +39715,7 @@ var AgentSession = class _AgentSession {
|
|
|
39723
39715
|
#sessionTitle = null;
|
|
39724
39716
|
#sessionUpdatedAt = "";
|
|
39725
39717
|
#turn = new IdleAcpTurn();
|
|
39726
|
-
constructor(agent, cwd, additionalDirectories, mobiusSessionId, getObserver, store, metrics) {
|
|
39718
|
+
constructor(agent, cwd, additionalDirectories, mobiusSessionId, getObserver, store, metrics, contentExternalizer) {
|
|
39727
39719
|
this.#updates = new AgentUpdateStream((notification) => this.#processUpdate(notification));
|
|
39728
39720
|
this.#additionalDirectories = [...additionalDirectories];
|
|
39729
39721
|
this.#agentId = agent.id;
|
|
@@ -39743,8 +39735,9 @@ var AgentSession = class _AgentSession {
|
|
|
39743
39735
|
observer: getObserver
|
|
39744
39736
|
});
|
|
39745
39737
|
this.#connection = new AgentConnection(agent, cwd, this);
|
|
39738
|
+
this.#contentExternalizer = contentExternalizer;
|
|
39746
39739
|
}
|
|
39747
|
-
static async #start(options, getObserver, store, initialize, metrics) {
|
|
39740
|
+
static async #start(options, getObserver, store, initialize, metrics, contentExternalizer) {
|
|
39748
39741
|
for (let attempt = 1; attempt <= 2; attempt += 1) {
|
|
39749
39742
|
options.signal.throwIfAborted();
|
|
39750
39743
|
const unchanged = await metrics.measure(
|
|
@@ -39772,7 +39765,8 @@ var AgentSession = class _AgentSession {
|
|
|
39772
39765
|
options.sessionId,
|
|
39773
39766
|
getObserver,
|
|
39774
39767
|
store,
|
|
39775
|
-
metrics
|
|
39768
|
+
metrics,
|
|
39769
|
+
contentExternalizer
|
|
39776
39770
|
)
|
|
39777
39771
|
);
|
|
39778
39772
|
try {
|
|
@@ -39795,19 +39789,21 @@ var AgentSession = class _AgentSession {
|
|
|
39795
39789
|
}
|
|
39796
39790
|
throw new AcpExecutionError("ACP agent initialization failed");
|
|
39797
39791
|
}
|
|
39798
|
-
static start = async (options, getObserver, store, metrics
|
|
39792
|
+
static start = async (options, getObserver, store, metrics, contentExternalizer) => await _AgentSession.#start(
|
|
39799
39793
|
options,
|
|
39800
39794
|
getObserver,
|
|
39801
39795
|
store,
|
|
39802
39796
|
async (runtime) => await runtime.initialize(options.signal, options.origin),
|
|
39803
|
-
metrics
|
|
39797
|
+
metrics,
|
|
39798
|
+
contentExternalizer
|
|
39804
39799
|
);
|
|
39805
|
-
static startNativeSessionBrowser = async (options, getObserver, store) => await _AgentSession.#start(
|
|
39800
|
+
static startNativeSessionBrowser = async (options, getObserver, store, contentExternalizer) => await _AgentSession.#start(
|
|
39806
39801
|
options,
|
|
39807
39802
|
getObserver,
|
|
39808
39803
|
store,
|
|
39809
39804
|
async (runtime) => await runtime.#initializeAgent(options.signal),
|
|
39810
|
-
unmeasuredOperationMetrics
|
|
39805
|
+
unmeasuredOperationMetrics,
|
|
39806
|
+
contentExternalizer
|
|
39811
39807
|
);
|
|
39812
39808
|
belongsTo = (agentId, cwd, additionalDirectories) => this.#agentId === agentId && this.#cwd === cwd && arraysEqual(this.#additionalDirectories, additionalDirectories);
|
|
39813
39809
|
usesEnvironment = (environment) => recordsEqual(this.#environment, environment);
|
|
@@ -40512,7 +40508,12 @@ var AgentSession = class _AgentSession {
|
|
|
40512
40508
|
#processUpdate = async (notification) => {
|
|
40513
40509
|
this.assertNativeSession(notification.sessionId);
|
|
40514
40510
|
const update = notification.update;
|
|
40515
|
-
const
|
|
40511
|
+
const externalized = await this.#contentExternalizer.update(
|
|
40512
|
+
this.#mobiusSessionId,
|
|
40513
|
+
update,
|
|
40514
|
+
AbortSignal.timeout(3e4)
|
|
40515
|
+
);
|
|
40516
|
+
const rawUpdate = decodeAcpSessionUpdateV2(JSON.stringify(externalized));
|
|
40516
40517
|
if (this.#sessionLoad.kind === "capturing") {
|
|
40517
40518
|
await this.#sessionLoad.history.record(update, rawUpdate);
|
|
40518
40519
|
} else {
|
|
@@ -40799,8 +40800,10 @@ var AgentQueryProcesses = class {
|
|
|
40799
40800
|
#processes;
|
|
40800
40801
|
#observer = new NullAcpSessionObserver();
|
|
40801
40802
|
#store = new MemoryAcpSessionStore();
|
|
40802
|
-
|
|
40803
|
+
#contentExternalizer;
|
|
40804
|
+
constructor(processes, contentExternalizer) {
|
|
40803
40805
|
this.#processes = processes;
|
|
40806
|
+
this.#contentExternalizer = contentExternalizer;
|
|
40804
40807
|
this.#processesByQuery = new RetainedAgentProcesses({
|
|
40805
40808
|
touch: processes.touch,
|
|
40806
40809
|
changed: processes.notifyChanged
|
|
@@ -40816,7 +40819,12 @@ var AgentQueryProcesses = class {
|
|
|
40816
40819
|
async #startRetained(options) {
|
|
40817
40820
|
const runtime = await this.#processes.startRetained(
|
|
40818
40821
|
options.signal,
|
|
40819
|
-
() => AgentSession.startNativeSessionBrowser(
|
|
40822
|
+
() => AgentSession.startNativeSessionBrowser(
|
|
40823
|
+
options,
|
|
40824
|
+
() => this.#observer,
|
|
40825
|
+
this.#store,
|
|
40826
|
+
this.#contentExternalizer
|
|
40827
|
+
),
|
|
40820
40828
|
{
|
|
40821
40829
|
isBusy: () => this.#processesByQuery.isBusy(options.sessionId),
|
|
40822
40830
|
retire: (runtime2) => this.retire(options.sessionId, runtime2)
|
|
@@ -40892,7 +40900,8 @@ var AgentQueryProcesses = class {
|
|
|
40892
40900
|
async () => await AgentSession.startNativeSessionBrowser(
|
|
40893
40901
|
options,
|
|
40894
40902
|
() => this.#observer,
|
|
40895
|
-
new MemoryAcpSessionStore()
|
|
40903
|
+
new MemoryAcpSessionStore(),
|
|
40904
|
+
this.#contentExternalizer
|
|
40896
40905
|
),
|
|
40897
40906
|
async (runtime) => {
|
|
40898
40907
|
runtime.selectNativeSession(nativeSessionId);
|
|
@@ -40907,7 +40916,8 @@ var AgentQueryProcesses = class {
|
|
|
40907
40916
|
async () => await AgentSession.startNativeSessionBrowser(
|
|
40908
40917
|
options,
|
|
40909
40918
|
() => this.#observer,
|
|
40910
|
-
new MemoryAcpSessionStore()
|
|
40919
|
+
new MemoryAcpSessionStore(),
|
|
40920
|
+
this.#contentExternalizer
|
|
40911
40921
|
),
|
|
40912
40922
|
async (runtime) => {
|
|
40913
40923
|
runtime.selectNativeSession(nativeSessionId);
|
|
@@ -40923,6 +40933,220 @@ var AgentQueryProcesses = class {
|
|
|
40923
40933
|
};
|
|
40924
40934
|
};
|
|
40925
40935
|
|
|
40936
|
+
// src/external-content/acp-content-externalizer.ts
|
|
40937
|
+
var MAXIMUM_ENCODED_CONTENT_CHARACTERS = 4e6;
|
|
40938
|
+
function decodeBase64(data) {
|
|
40939
|
+
if (data.length > MAXIMUM_ENCODED_CONTENT_CHARACTERS || data.length % 4 !== 0 || !/^[A-Za-z0-9+/]*={0,2}$/u.test(data)) {
|
|
40940
|
+
throw new Error("The ACP embedded content is not valid bounded base64");
|
|
40941
|
+
}
|
|
40942
|
+
return Buffer.from(data, "base64");
|
|
40943
|
+
}
|
|
40944
|
+
var AcpContentExternalizer = class {
|
|
40945
|
+
#store;
|
|
40946
|
+
constructor(store) {
|
|
40947
|
+
this.#store = store;
|
|
40948
|
+
}
|
|
40949
|
+
async #content(sessionId, content, signal) {
|
|
40950
|
+
switch (content.type) {
|
|
40951
|
+
case "text":
|
|
40952
|
+
case "resource_link":
|
|
40953
|
+
return content;
|
|
40954
|
+
case "image": {
|
|
40955
|
+
if (content.data.length === 0) {
|
|
40956
|
+
return content;
|
|
40957
|
+
}
|
|
40958
|
+
const stored = await this.#store.put({
|
|
40959
|
+
bytes: decodeBase64(content.data),
|
|
40960
|
+
kind: "image",
|
|
40961
|
+
mediaType: content.mimeType,
|
|
40962
|
+
name: "image",
|
|
40963
|
+
sessionId,
|
|
40964
|
+
signal
|
|
40965
|
+
});
|
|
40966
|
+
return {
|
|
40967
|
+
_meta: content._meta,
|
|
40968
|
+
annotations: content.annotations,
|
|
40969
|
+
byteLength: stored.byteLength,
|
|
40970
|
+
imageKey: stored.key,
|
|
40971
|
+
mimeType: content.mimeType,
|
|
40972
|
+
type: "external_image",
|
|
40973
|
+
uri: content.uri
|
|
40974
|
+
};
|
|
40975
|
+
}
|
|
40976
|
+
case "audio": {
|
|
40977
|
+
if (content.data.length === 0) {
|
|
40978
|
+
return content;
|
|
40979
|
+
}
|
|
40980
|
+
const stored = await this.#store.put({
|
|
40981
|
+
bytes: decodeBase64(content.data),
|
|
40982
|
+
kind: "audio",
|
|
40983
|
+
mediaType: content.mimeType,
|
|
40984
|
+
name: "audio",
|
|
40985
|
+
sessionId,
|
|
40986
|
+
signal
|
|
40987
|
+
});
|
|
40988
|
+
return {
|
|
40989
|
+
_meta: content._meta,
|
|
40990
|
+
annotations: content.annotations,
|
|
40991
|
+
audioKey: stored.key,
|
|
40992
|
+
byteLength: stored.byteLength,
|
|
40993
|
+
mimeType: content.mimeType,
|
|
40994
|
+
type: "external_audio"
|
|
40995
|
+
};
|
|
40996
|
+
}
|
|
40997
|
+
case "resource": {
|
|
40998
|
+
const embedded = content.resource;
|
|
40999
|
+
const encoding = "text" in embedded ? "text" : "binary";
|
|
41000
|
+
const bytes = "text" in embedded ? Buffer.from(embedded.text, "utf8") : decodeBase64(embedded.blob);
|
|
41001
|
+
if (bytes.byteLength === 0) {
|
|
41002
|
+
return content;
|
|
41003
|
+
}
|
|
41004
|
+
const mediaType = embedded.mimeType ?? "application/octet-stream";
|
|
41005
|
+
const stored = await this.#store.put({
|
|
41006
|
+
bytes,
|
|
41007
|
+
kind: "resource",
|
|
41008
|
+
mediaType,
|
|
41009
|
+
name: "resource",
|
|
41010
|
+
sessionId,
|
|
41011
|
+
signal
|
|
41012
|
+
});
|
|
41013
|
+
return {
|
|
41014
|
+
_meta: content._meta,
|
|
41015
|
+
annotations: content.annotations,
|
|
41016
|
+
byteLength: stored.byteLength,
|
|
41017
|
+
encoding,
|
|
41018
|
+
mimeType: embedded.mimeType,
|
|
41019
|
+
resourceKey: stored.key,
|
|
41020
|
+
type: "external_resource",
|
|
41021
|
+
uri: embedded.uri
|
|
41022
|
+
};
|
|
41023
|
+
}
|
|
41024
|
+
}
|
|
41025
|
+
}
|
|
41026
|
+
async #toolContent(sessionId, item, signal) {
|
|
41027
|
+
return item.type === "content" ? { ...item, content: await this.#content(sessionId, item.content, signal) } : item;
|
|
41028
|
+
}
|
|
41029
|
+
update = async (sessionId, update, signal) => {
|
|
41030
|
+
switch (update.sessionUpdate) {
|
|
41031
|
+
case "user_message_chunk":
|
|
41032
|
+
case "agent_message_chunk":
|
|
41033
|
+
case "agent_thought_chunk":
|
|
41034
|
+
case "compaction_summary_chunk":
|
|
41035
|
+
return { ...update, content: await this.#content(sessionId, update.content, signal) };
|
|
41036
|
+
case "tool_call":
|
|
41037
|
+
case "tool_call_update":
|
|
41038
|
+
return update.content === void 0 || update.content === null ? update : {
|
|
41039
|
+
...update,
|
|
41040
|
+
content: await Promise.all(
|
|
41041
|
+
update.content.map(async (item) => await this.#toolContent(sessionId, item, signal))
|
|
41042
|
+
)
|
|
41043
|
+
};
|
|
41044
|
+
case "compaction_update":
|
|
41045
|
+
return update.summary === void 0 || update.summary === null ? update : {
|
|
41046
|
+
...update,
|
|
41047
|
+
summary: await Promise.all(
|
|
41048
|
+
update.summary.map(async (content) => await this.#content(sessionId, content, signal))
|
|
41049
|
+
)
|
|
41050
|
+
};
|
|
41051
|
+
case "plan":
|
|
41052
|
+
case "plan_update":
|
|
41053
|
+
case "plan_removed":
|
|
41054
|
+
case "available_commands_update":
|
|
41055
|
+
case "current_mode_update":
|
|
41056
|
+
case "config_option_update":
|
|
41057
|
+
case "session_info_update":
|
|
41058
|
+
case "usage_update":
|
|
41059
|
+
return update;
|
|
41060
|
+
}
|
|
41061
|
+
};
|
|
41062
|
+
};
|
|
41063
|
+
|
|
41064
|
+
// src/external-content/local-external-content-store.ts
|
|
41065
|
+
import { createHash as createHash3, randomUUID as randomUUID2 } from "node:crypto";
|
|
41066
|
+
import { lstat, mkdir as mkdir6, readFile as readFile3, realpath as realpath8, rename as rename4, rm as rm3, stat as stat7, writeFile as writeFile4 } from "node:fs/promises";
|
|
41067
|
+
import { dirname as dirname5, join as join16 } from "node:path";
|
|
41068
|
+
var contentRequest = /^mobius-content:(image|audio|resource):([a-f0-9]{64})$/u;
|
|
41069
|
+
var metadataSchema2 = external_exports.strictObject({
|
|
41070
|
+
kind: external_exports.enum(["image", "audio", "resource"]),
|
|
41071
|
+
mediaType: external_exports.string().min(1).max(2048).regex(/^[\u0020-\u007e]+$/u),
|
|
41072
|
+
name: external_exports.string().min(1).max(500)
|
|
41073
|
+
});
|
|
41074
|
+
var UnretainedExternalContentStore = class {
|
|
41075
|
+
put = async ({ bytes, signal }) => {
|
|
41076
|
+
signal.throwIfAborted();
|
|
41077
|
+
return { byteLength: bytes.byteLength, key: createHash3("sha256").update(bytes).digest("hex") };
|
|
41078
|
+
};
|
|
41079
|
+
resolve = (_sessionId, _request, signal) => {
|
|
41080
|
+
signal.throwIfAborted();
|
|
41081
|
+
return Promise.resolve(null);
|
|
41082
|
+
};
|
|
41083
|
+
};
|
|
41084
|
+
function sessionScope(sessionId) {
|
|
41085
|
+
return createHash3("sha256").update(sessionId).digest("hex");
|
|
41086
|
+
}
|
|
41087
|
+
async function atomicWrite(path3, bytes, signal) {
|
|
41088
|
+
const temporary = `${path3}.${randomUUID2()}.tmp`;
|
|
41089
|
+
try {
|
|
41090
|
+
await writeFile4(temporary, bytes, { mode: 384, signal });
|
|
41091
|
+
signal.throwIfAborted();
|
|
41092
|
+
await rename4(temporary, path3);
|
|
41093
|
+
} finally {
|
|
41094
|
+
await rm3(temporary, { force: true });
|
|
41095
|
+
}
|
|
41096
|
+
}
|
|
41097
|
+
var LocalExternalContentStore = class {
|
|
41098
|
+
#root;
|
|
41099
|
+
constructor(stateDirectory) {
|
|
41100
|
+
this.#root = join16(stateDirectory, "tmp", "session-content");
|
|
41101
|
+
}
|
|
41102
|
+
put = async ({ bytes, kind, mediaType, name, sessionId, signal }) => {
|
|
41103
|
+
signal.throwIfAborted();
|
|
41104
|
+
const key = createHash3("sha256").update(bytes).digest("hex");
|
|
41105
|
+
const directory = join16(this.#root, sessionScope(sessionId), kind);
|
|
41106
|
+
await mkdir6(directory, { mode: 448, recursive: true });
|
|
41107
|
+
signal.throwIfAborted();
|
|
41108
|
+
const path3 = join16(directory, key);
|
|
41109
|
+
await atomicWrite(path3, bytes, signal);
|
|
41110
|
+
await atomicWrite(
|
|
41111
|
+
`${path3}.json`,
|
|
41112
|
+
Buffer.from(JSON.stringify(metadataSchema2.parse({ kind, mediaType, name })), "utf8"),
|
|
41113
|
+
signal
|
|
41114
|
+
);
|
|
41115
|
+
return { byteLength: bytes.byteLength, key };
|
|
41116
|
+
};
|
|
41117
|
+
resolve = async (sessionId, request, signal) => {
|
|
41118
|
+
const matched = contentRequest.exec(request);
|
|
41119
|
+
if (matched === null) {
|
|
41120
|
+
return null;
|
|
41121
|
+
}
|
|
41122
|
+
const kind = matched[1];
|
|
41123
|
+
const key = matched[2];
|
|
41124
|
+
if (kind !== "image" && kind !== "audio" && kind !== "resource" || key === void 0) {
|
|
41125
|
+
return null;
|
|
41126
|
+
}
|
|
41127
|
+
const directory = join16(this.#root, sessionScope(sessionId), kind);
|
|
41128
|
+
const path3 = join16(directory, key);
|
|
41129
|
+
try {
|
|
41130
|
+
const [resolvedDirectory, resolvedPath, file2, metadata] = await Promise.all([
|
|
41131
|
+
realpath8(directory),
|
|
41132
|
+
realpath8(path3),
|
|
41133
|
+
lstat(path3),
|
|
41134
|
+
readFile3(`${path3}.json`, "utf8").then((value) => metadataSchema2.parse(JSON.parse(value)))
|
|
41135
|
+
]);
|
|
41136
|
+
signal.throwIfAborted();
|
|
41137
|
+
if (!file2.isFile() || dirname5(resolvedPath) !== resolvedDirectory || metadata.kind !== kind) {
|
|
41138
|
+
return null;
|
|
41139
|
+
}
|
|
41140
|
+
await stat7(resolvedPath);
|
|
41141
|
+
signal.throwIfAborted();
|
|
41142
|
+
return { mediaType: metadata.mediaType, name: metadata.name, path: resolvedPath };
|
|
41143
|
+
} catch {
|
|
41144
|
+
signal.throwIfAborted();
|
|
41145
|
+
return null;
|
|
41146
|
+
}
|
|
41147
|
+
};
|
|
41148
|
+
};
|
|
41149
|
+
|
|
40926
41150
|
// src/native-sessions/chat-agent.ts
|
|
40927
41151
|
function supportsNativeChat(agentId) {
|
|
40928
41152
|
return agentId === "codex" || agentId === "claude" || agentId === "opencode" || agentId === "pi";
|
|
@@ -41139,7 +41363,7 @@ var AgentRuntimeManager = class {
|
|
|
41139
41363
|
touch: this.#processes.touch,
|
|
41140
41364
|
changed: this.#processes.notifyChanged
|
|
41141
41365
|
});
|
|
41142
|
-
#queryProcesses
|
|
41366
|
+
#queryProcesses;
|
|
41143
41367
|
#executions = new ActiveExecutions();
|
|
41144
41368
|
#agentSettingsObserver = new NullAcpSessionObserver();
|
|
41145
41369
|
#nativeOperations = /* @__PURE__ */ new Set();
|
|
@@ -41147,13 +41371,16 @@ var AgentRuntimeManager = class {
|
|
|
41147
41371
|
#nativeHistoryReader;
|
|
41148
41372
|
#sessionIdentity;
|
|
41149
41373
|
#onSessionStatusChanged;
|
|
41374
|
+
#contentExternalizer;
|
|
41150
41375
|
#observer;
|
|
41151
|
-
constructor(observer = new NullAcpSessionObserver(), store = new MemoryAcpSessionStore(), nativeHistoryReader = null, sessionIdentity = "assigned", onSessionStatusChanged = () => void 0) {
|
|
41376
|
+
constructor(observer = new NullAcpSessionObserver(), store = new MemoryAcpSessionStore(), nativeHistoryReader = null, sessionIdentity = "assigned", onSessionStatusChanged = () => void 0, contentExternalizer = new AcpContentExternalizer(new UnretainedExternalContentStore())) {
|
|
41152
41377
|
this.#observer = observer;
|
|
41153
41378
|
this.#store = store;
|
|
41154
41379
|
this.#nativeHistoryReader = nativeHistoryReader;
|
|
41155
41380
|
this.#sessionIdentity = sessionIdentity;
|
|
41156
41381
|
this.#onSessionStatusChanged = onSessionStatusChanged;
|
|
41382
|
+
this.#contentExternalizer = contentExternalizer;
|
|
41383
|
+
this.#queryProcesses = new AgentQueryProcesses(this.#processes, contentExternalizer);
|
|
41157
41384
|
}
|
|
41158
41385
|
setObserver = (observer) => {
|
|
41159
41386
|
this.#observer = observer;
|
|
@@ -41194,7 +41421,8 @@ var AgentRuntimeManager = class {
|
|
|
41194
41421
|
options.origin === void 0 && this.#sessionIdentity === "native" && isNativeChatSessionId(options.agent.id, options.sessionId) && this.#store.read(options.sessionId) instanceof MissingAcpStoredSession ? { ...options, origin: { kind: "import", nativeSessionId: options.sessionId } } : options,
|
|
41195
41422
|
() => this.#observer,
|
|
41196
41423
|
this.#store,
|
|
41197
|
-
metrics
|
|
41424
|
+
metrics,
|
|
41425
|
+
this.#contentExternalizer
|
|
41198
41426
|
)
|
|
41199
41427
|
);
|
|
41200
41428
|
});
|
|
@@ -41209,7 +41437,13 @@ var AgentRuntimeManager = class {
|
|
|
41209
41437
|
this.#store.remove(options.sessionId);
|
|
41210
41438
|
return await this.#startRetainedSessionProcess(
|
|
41211
41439
|
options,
|
|
41212
|
-
async () => await AgentSession.start(
|
|
41440
|
+
async () => await AgentSession.start(
|
|
41441
|
+
options,
|
|
41442
|
+
() => this.#observer,
|
|
41443
|
+
this.#store,
|
|
41444
|
+
metrics,
|
|
41445
|
+
this.#contentExternalizer
|
|
41446
|
+
)
|
|
41213
41447
|
);
|
|
41214
41448
|
});
|
|
41215
41449
|
}
|
|
@@ -41219,7 +41453,13 @@ var AgentRuntimeManager = class {
|
|
|
41219
41453
|
await this.#retireSessionProcess(options.sessionId, existing, async () => await existing.close());
|
|
41220
41454
|
const runtime = await this.#startRetainedSessionProcess(
|
|
41221
41455
|
options,
|
|
41222
|
-
async () => await AgentSession.start(
|
|
41456
|
+
async () => await AgentSession.start(
|
|
41457
|
+
options,
|
|
41458
|
+
() => this.#observer,
|
|
41459
|
+
this.#store,
|
|
41460
|
+
unmeasuredOperationMetrics,
|
|
41461
|
+
this.#contentExternalizer
|
|
41462
|
+
)
|
|
41223
41463
|
);
|
|
41224
41464
|
try {
|
|
41225
41465
|
for (const desired of desiredConfigOptions) {
|
|
@@ -41315,7 +41555,9 @@ var AgentRuntimeManager = class {
|
|
|
41315
41555
|
sessionId: `agent-settings-${crypto.randomUUID()}`
|
|
41316
41556
|
},
|
|
41317
41557
|
() => this.#agentSettingsObserver,
|
|
41318
|
-
new MemoryAcpSessionStore()
|
|
41558
|
+
new MemoryAcpSessionStore(),
|
|
41559
|
+
unmeasuredOperationMetrics,
|
|
41560
|
+
this.#contentExternalizer
|
|
41319
41561
|
),
|
|
41320
41562
|
async (runtime) => {
|
|
41321
41563
|
const prepared = runtime.prepared();
|
|
@@ -42368,9 +42610,9 @@ var FixedInstallationExecutor = class {
|
|
|
42368
42610
|
};
|
|
42369
42611
|
|
|
42370
42612
|
// src/authorization/workspace-directory.ts
|
|
42371
|
-
import { readdir as readdir3, realpath as
|
|
42613
|
+
import { readdir as readdir3, realpath as realpath9, stat as stat8 } from "node:fs/promises";
|
|
42372
42614
|
import { homedir as homedir2 } from "node:os";
|
|
42373
|
-
import { basename as basename4, dirname as
|
|
42615
|
+
import { basename as basename4, dirname as dirname6, isAbsolute as isAbsolute9, join as join17, normalize as normalize3, relative as relative4 } from "node:path";
|
|
42374
42616
|
|
|
42375
42617
|
// src/authorization/local-authorization-error.ts
|
|
42376
42618
|
var LocalAuthorizationError = class extends Error {
|
|
@@ -42449,9 +42691,9 @@ var WorkspaceDirectoryService = class {
|
|
|
42449
42691
|
throw new LocalAuthorizationError("The local directory path is invalid");
|
|
42450
42692
|
}
|
|
42451
42693
|
try {
|
|
42452
|
-
const target = await
|
|
42694
|
+
const target = await realpath9(requested);
|
|
42453
42695
|
signal.throwIfAborted();
|
|
42454
|
-
const metadata = await
|
|
42696
|
+
const metadata = await stat8(target);
|
|
42455
42697
|
signal.throwIfAborted();
|
|
42456
42698
|
if (!isAbsolute9(target) || normalize3(target) !== target || !metadata.isDirectory()) {
|
|
42457
42699
|
throw new LocalAuthorizationError("The selected location is not a directory");
|
|
@@ -42499,7 +42741,7 @@ var WorkspaceDirectoryService = class {
|
|
|
42499
42741
|
continue;
|
|
42500
42742
|
}
|
|
42501
42743
|
try {
|
|
42502
|
-
const path3 = await this.resolvePath(
|
|
42744
|
+
const path3 = await this.resolvePath(join17(target, child2.name), signal);
|
|
42503
42745
|
entries.push({ directoryId: encodePath(path3), name: child2.name });
|
|
42504
42746
|
} catch (cause) {
|
|
42505
42747
|
signal.throwIfAborted();
|
|
@@ -42509,7 +42751,7 @@ var WorkspaceDirectoryService = class {
|
|
|
42509
42751
|
}
|
|
42510
42752
|
}
|
|
42511
42753
|
entries.sort((a, b) => a.name.localeCompare(b.name));
|
|
42512
|
-
const parent =
|
|
42754
|
+
const parent = dirname6(target);
|
|
42513
42755
|
return new WorkspaceDirectoryListing(
|
|
42514
42756
|
id,
|
|
42515
42757
|
this.label(target),
|
|
@@ -42535,15 +42777,15 @@ var WorkspaceDirectoryService = class {
|
|
|
42535
42777
|
|
|
42536
42778
|
// src/daemon-diagnostic-log.ts
|
|
42537
42779
|
import { appendFileSync, mkdirSync as mkdirSync2, readFileSync as readFileSync2, renameSync, statSync as statSync3, writeFileSync } from "node:fs";
|
|
42538
|
-
import { join as
|
|
42780
|
+
import { join as join18 } from "node:path";
|
|
42539
42781
|
var MAXIMUM_DAEMON_LOG_BYTES = 1 * 1024 * 1024;
|
|
42540
42782
|
var DaemonDiagnosticLog = class {
|
|
42541
42783
|
#directory;
|
|
42542
42784
|
#path;
|
|
42543
42785
|
#maximumBytes;
|
|
42544
42786
|
constructor(stateDirectory, maximumBytes = MAXIMUM_DAEMON_LOG_BYTES) {
|
|
42545
|
-
this.#directory =
|
|
42546
|
-
this.#path =
|
|
42787
|
+
this.#directory = join18(stateDirectory, "logs");
|
|
42788
|
+
this.#path = join18(this.#directory, "daemon.log");
|
|
42547
42789
|
this.#maximumBytes = maximumBytes;
|
|
42548
42790
|
}
|
|
42549
42791
|
record = (diagnostic) => {
|
|
@@ -42588,7 +42830,7 @@ import { WebSocket as WebSocket2 } from "undici";
|
|
|
42588
42830
|
import { WebSocket } from "undici";
|
|
42589
42831
|
|
|
42590
42832
|
// src/prompt-artifact-resolver.ts
|
|
42591
|
-
import { createHash as
|
|
42833
|
+
import { createHash as createHash4 } from "node:crypto";
|
|
42592
42834
|
import { fetch as fetch4 } from "undici";
|
|
42593
42835
|
var ARTIFACT_SCHEME = "mobius-artifact:";
|
|
42594
42836
|
var ARTIFACT_DOWNLOAD_TIMEOUT_MILLISECONDS = 2e4;
|
|
@@ -42726,7 +42968,7 @@ async function download(config2, command, reference, signal) {
|
|
|
42726
42968
|
);
|
|
42727
42969
|
}
|
|
42728
42970
|
const bytes = await responseBytes(response, reference.byteLength, requestSignal);
|
|
42729
|
-
if (
|
|
42971
|
+
if (createHash4("sha256").update(bytes).digest("hex") !== reference.sha256) {
|
|
42730
42972
|
throw new PromptArtifactError(
|
|
42731
42973
|
"artifact_integrity_failed",
|
|
42732
42974
|
"The prompt artifact failed integrity validation"
|
|
@@ -43031,7 +43273,7 @@ var DaemonInstallationObserver = class {
|
|
|
43031
43273
|
};
|
|
43032
43274
|
|
|
43033
43275
|
// src/daemon-active-turn.ts
|
|
43034
|
-
import { randomUUID as
|
|
43276
|
+
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
43035
43277
|
function activeMessageCharacters(message) {
|
|
43036
43278
|
return message.text.length + (message.role === "assistant" ? JSON.stringify(message.activities).length + JSON.stringify(message.content).length : 0);
|
|
43037
43279
|
}
|
|
@@ -43065,7 +43307,7 @@ var ActiveDaemonTurn = class {
|
|
|
43065
43307
|
#timeline;
|
|
43066
43308
|
#sequence = 0;
|
|
43067
43309
|
#interaction = null;
|
|
43068
|
-
#epoch = decodeIdentifier(
|
|
43310
|
+
#epoch = decodeIdentifier(randomUUID3());
|
|
43069
43311
|
constructor(command, attemptId) {
|
|
43070
43312
|
this.attemptId = attemptId;
|
|
43071
43313
|
this.command = command;
|
|
@@ -43127,7 +43369,7 @@ var ActiveDaemonTurn = class {
|
|
|
43127
43369
|
if (!this.#activities.has(event.activityId)) {
|
|
43128
43370
|
this.#timeline = [
|
|
43129
43371
|
...this.#timeline,
|
|
43130
|
-
{ activityId: event.activityId, id: decodeIdentifier(
|
|
43372
|
+
{ activityId: event.activityId, id: decodeIdentifier(randomUUID3()), kind: "activity" }
|
|
43131
43373
|
];
|
|
43132
43374
|
}
|
|
43133
43375
|
this.#activities.set(event.activityId, {
|
|
@@ -43148,7 +43390,7 @@ var ActiveDaemonTurn = class {
|
|
|
43148
43390
|
if (previous === void 0) {
|
|
43149
43391
|
this.#timeline = [
|
|
43150
43392
|
...this.#timeline,
|
|
43151
|
-
{ activityId: event.activityId, id: decodeIdentifier(
|
|
43393
|
+
{ activityId: event.activityId, id: decodeIdentifier(randomUUID3()), kind: "activity" }
|
|
43152
43394
|
];
|
|
43153
43395
|
}
|
|
43154
43396
|
this.#activities.set(event.activityId, {
|
|
@@ -43173,7 +43415,7 @@ var ActiveDaemonTurn = class {
|
|
|
43173
43415
|
...this.#timeline,
|
|
43174
43416
|
{
|
|
43175
43417
|
content: /* @__PURE__ */ new Map([[event.contentId, event.content]]),
|
|
43176
|
-
id: decodeIdentifier(
|
|
43418
|
+
id: decodeIdentifier(randomUUID3()),
|
|
43177
43419
|
kind: "message",
|
|
43178
43420
|
sourceMessageId: event.messageId,
|
|
43179
43421
|
text: ""
|
|
@@ -43213,7 +43455,7 @@ var ActiveDaemonTurn = class {
|
|
|
43213
43455
|
...this.#timeline,
|
|
43214
43456
|
{
|
|
43215
43457
|
content: /* @__PURE__ */ new Map(),
|
|
43216
|
-
id: decodeIdentifier(
|
|
43458
|
+
id: decodeIdentifier(randomUUID3()),
|
|
43217
43459
|
kind: "message",
|
|
43218
43460
|
sourceMessageId: messageId,
|
|
43219
43461
|
text: remaining.slice(0, ACTIVE_TURN_TEXT_CHUNK_LIMIT)
|
|
@@ -44189,7 +44431,7 @@ var readCodexFullHistory = async (agent, cwd, nativeSessionId, signal, nativeTur
|
|
|
44189
44431
|
});
|
|
44190
44432
|
|
|
44191
44433
|
// src/native-sessions/service.ts
|
|
44192
|
-
import { randomUUID as
|
|
44434
|
+
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
44193
44435
|
import { basename as basename5 } from "node:path";
|
|
44194
44436
|
|
|
44195
44437
|
// src/native-sessions/acp-history.ts
|
|
@@ -44404,7 +44646,7 @@ var NativeSessionService = class {
|
|
|
44404
44646
|
if (authorized === null) {
|
|
44405
44647
|
return null;
|
|
44406
44648
|
}
|
|
44407
|
-
const entryId = decodeIdentifier(
|
|
44649
|
+
const entryId = decodeIdentifier(randomUUID4());
|
|
44408
44650
|
if (this.#entries.size >= 5e3) {
|
|
44409
44651
|
this.#entries.clear();
|
|
44410
44652
|
}
|
|
@@ -44460,7 +44702,7 @@ var NativeSessionService = class {
|
|
|
44460
44702
|
"invalid_native_session_response"
|
|
44461
44703
|
);
|
|
44462
44704
|
}
|
|
44463
|
-
nextCursor = decodeIdentifier(
|
|
44705
|
+
nextCursor = decodeIdentifier(randomUUID4());
|
|
44464
44706
|
if (this.#cursors.size >= 500) {
|
|
44465
44707
|
this.#cursors.clear();
|
|
44466
44708
|
}
|
|
@@ -44742,7 +44984,7 @@ var NativeSessionService = class {
|
|
|
44742
44984
|
};
|
|
44743
44985
|
|
|
44744
44986
|
// src/relay-connection/daemon-operation-state.ts
|
|
44745
|
-
import { createHash as
|
|
44987
|
+
import { createHash as createHash5, randomUUID as randomUUID5 } from "node:crypto";
|
|
44746
44988
|
var MAX_TERMINAL_RECEIPTS = 1024;
|
|
44747
44989
|
function isTerminal(state) {
|
|
44748
44990
|
return state === "succeeded" || state === "failed" || state === "cancelled";
|
|
@@ -44751,7 +44993,7 @@ var DaemonOperationState = class {
|
|
|
44751
44993
|
#executions = /* @__PURE__ */ new Map();
|
|
44752
44994
|
#terminalCount = 0;
|
|
44753
44995
|
claimExecution = (commandId, sessionId, commandJson) => {
|
|
44754
|
-
const commandHash =
|
|
44996
|
+
const commandHash = createHash5("sha256").update(commandJson).digest("hex");
|
|
44755
44997
|
const existing = this.#executions.get(commandId);
|
|
44756
44998
|
if (existing !== void 0) {
|
|
44757
44999
|
if (existing.sessionId !== sessionId || existing.commandHash !== commandHash) {
|
|
@@ -44759,7 +45001,7 @@ var DaemonOperationState = class {
|
|
|
44759
45001
|
}
|
|
44760
45002
|
return { attemptId: existing.attemptId, commandId, kind: "duplicate", state: existing.state };
|
|
44761
45003
|
}
|
|
44762
|
-
const attemptId =
|
|
45004
|
+
const attemptId = randomUUID5();
|
|
44763
45005
|
this.#executions.set(commandId, { attemptId, commandHash, sessionId, state: "dispatching" });
|
|
44764
45006
|
return { attemptId, commandId, kind: "accepted", state: "dispatching" };
|
|
44765
45007
|
};
|
|
@@ -45095,7 +45337,7 @@ function createAgentCatalogRefreshHandler(dependencies) {
|
|
|
45095
45337
|
import { WebSocket as WebSocket4 } from "undici";
|
|
45096
45338
|
|
|
45097
45339
|
// src/agent-catalog/discover-agent-settings.ts
|
|
45098
|
-
import { createHash as
|
|
45340
|
+
import { createHash as createHash6 } from "node:crypto";
|
|
45099
45341
|
|
|
45100
45342
|
// src/agent-catalog/agent-settings-base.ts
|
|
45101
45343
|
var AgentSettingsConfigurationError = class extends Error {
|
|
@@ -45559,7 +45801,7 @@ function settingsRevision(agent, reportedAgentVersion, settings, modelEffort) {
|
|
|
45559
45801
|
unsupportedModelIds: modelEffort.unsupportedModelIds,
|
|
45560
45802
|
valuesByModel: {}
|
|
45561
45803
|
};
|
|
45562
|
-
return
|
|
45804
|
+
return createHash6("sha256").update(
|
|
45563
45805
|
JSON.stringify({
|
|
45564
45806
|
adapterVersion: agent.kind === "acp-adapter-process" ? agent.adapterVersion : agent.agentVersion,
|
|
45565
45807
|
agentId: agent.id,
|
|
@@ -45710,7 +45952,7 @@ function createAgentSettingsDiscoveryHandler(dependencies) {
|
|
|
45710
45952
|
|
|
45711
45953
|
// src/artifacts/local-file-streamer.ts
|
|
45712
45954
|
import { createReadStream as createReadStream2 } from "node:fs";
|
|
45713
|
-
import { realpath as
|
|
45955
|
+
import { realpath as realpath10, stat as stat9 } from "node:fs/promises";
|
|
45714
45956
|
import { basename as basename6, isAbsolute as isAbsolute10, normalize as normalize4, resolve as resolve7 } from "node:path";
|
|
45715
45957
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
45716
45958
|
var CHUNK_BYTES = 192 * 1024;
|
|
@@ -45738,7 +45980,7 @@ async function resolveFile(value, workingDirectory, signal) {
|
|
|
45738
45980
|
return null;
|
|
45739
45981
|
}
|
|
45740
45982
|
try {
|
|
45741
|
-
const target = await
|
|
45983
|
+
const target = await realpath10(requested);
|
|
45742
45984
|
signal.throwIfAborted();
|
|
45743
45985
|
return isAbsolute10(target) && normalize4(target) === target ? target : null;
|
|
45744
45986
|
} catch {
|
|
@@ -45746,23 +45988,24 @@ async function resolveFile(value, workingDirectory, signal) {
|
|
|
45746
45988
|
return null;
|
|
45747
45989
|
}
|
|
45748
45990
|
}
|
|
45749
|
-
async function streamLocalFile(command, send2, signal, workingDirectory) {
|
|
45750
|
-
const
|
|
45991
|
+
async function streamLocalFile(command, send2, signal, workingDirectory, externalContent) {
|
|
45992
|
+
const external = await externalContent.resolve(command.sessionId, command.path, signal);
|
|
45993
|
+
const target = external?.path ?? await resolveFile(command.path, workingDirectory, signal);
|
|
45751
45994
|
if (target === null) {
|
|
45752
45995
|
throw new Error("The local file is unavailable");
|
|
45753
45996
|
}
|
|
45754
|
-
const before = await
|
|
45997
|
+
const before = await stat9(target);
|
|
45755
45998
|
signal.throwIfAborted();
|
|
45756
45999
|
if (!before.isFile() || before.size < 1 || before.size > command.maxBytes) {
|
|
45757
46000
|
throw new Error("The local file is too large to read");
|
|
45758
46001
|
}
|
|
45759
|
-
const raster = await readLocalRaster(target, signal);
|
|
46002
|
+
const raster = external === null ? await readLocalRaster(target, signal) : null;
|
|
45760
46003
|
send2({
|
|
45761
46004
|
byteLength: before.size,
|
|
45762
46005
|
kind: FILE_BEGIN_KIND,
|
|
45763
|
-
mediaType: raster?.mimeType ?? "application/octet-stream",
|
|
46006
|
+
mediaType: external?.mediaType ?? raster?.mimeType ?? "application/octet-stream",
|
|
45764
46007
|
modifiedAt: before.mtime.toISOString(),
|
|
45765
|
-
name: basename6(target) || "file",
|
|
46008
|
+
name: external?.name ?? (basename6(target) || "file"),
|
|
45766
46009
|
requestId: command.requestId,
|
|
45767
46010
|
sessionId: command.sessionId
|
|
45768
46011
|
});
|
|
@@ -45779,7 +46022,7 @@ async function streamLocalFile(command, send2, signal, workingDirectory) {
|
|
|
45779
46022
|
});
|
|
45780
46023
|
sequence += 1;
|
|
45781
46024
|
}
|
|
45782
|
-
const after = await
|
|
46025
|
+
const after = await stat9(target);
|
|
45783
46026
|
signal.throwIfAborted();
|
|
45784
46027
|
if (after.size !== before.size || after.mtimeMs !== before.mtimeMs) {
|
|
45785
46028
|
throw new Error("The local file changed during transfer");
|
|
@@ -45792,7 +46035,7 @@ async function streamLocalFile(command, send2, signal, workingDirectory) {
|
|
|
45792
46035
|
}
|
|
45793
46036
|
|
|
45794
46037
|
// src/daemon-history-commands.ts
|
|
45795
|
-
import { createHash as
|
|
46038
|
+
import { createHash as createHash7 } from "node:crypto";
|
|
45796
46039
|
|
|
45797
46040
|
// src/authorization/resolve-session-directories.ts
|
|
45798
46041
|
import { basename as basename7 } from "node:path";
|
|
@@ -46186,7 +46429,7 @@ async function executeSessionLiveHistoryPageLoad(socket, command, config2, direc
|
|
|
46186
46429
|
}
|
|
46187
46430
|
function replayEvent(sessionId, position, update) {
|
|
46188
46431
|
const encoded = JSON.stringify(update);
|
|
46189
|
-
const eventId = `native-${
|
|
46432
|
+
const eventId = `native-${createHash7("sha256").update(sessionId).update(":").update(position.toString()).update(":").update(encoded).digest("hex")}`;
|
|
46190
46433
|
return {
|
|
46191
46434
|
eventId,
|
|
46192
46435
|
payload: update,
|
|
@@ -46269,7 +46512,7 @@ async function executeSessionLiveHistoryV2PageLoad(socket, command, config2, dir
|
|
|
46269
46512
|
}
|
|
46270
46513
|
|
|
46271
46514
|
// src/acp/session-config/apply-session-configuration.ts
|
|
46272
|
-
import { randomUUID as
|
|
46515
|
+
import { randomUUID as randomUUID6 } from "node:crypto";
|
|
46273
46516
|
function invalidSessionConfiguration(message) {
|
|
46274
46517
|
return new AcpExecutionError(message, {}, "invalid_session_configuration");
|
|
46275
46518
|
}
|
|
@@ -46410,7 +46653,7 @@ async function applySessionConfigurationSelection(sessions, audit, options, sele
|
|
|
46410
46653
|
booleanValue: selection.booleanValue,
|
|
46411
46654
|
configId: selection.configId,
|
|
46412
46655
|
cwd,
|
|
46413
|
-
requestId: `cfg_${
|
|
46656
|
+
requestId: `cfg_${randomUUID6()}`,
|
|
46414
46657
|
sessionId,
|
|
46415
46658
|
signal,
|
|
46416
46659
|
value: selection.value,
|
|
@@ -47084,6 +47327,7 @@ function createDaemonCommandHandler({
|
|
|
47084
47327
|
operations,
|
|
47085
47328
|
publisher,
|
|
47086
47329
|
eventLogV2,
|
|
47330
|
+
externalContent,
|
|
47087
47331
|
activeTurns,
|
|
47088
47332
|
diagnostics,
|
|
47089
47333
|
socket,
|
|
@@ -47192,7 +47436,8 @@ function createDaemonCommandHandler({
|
|
|
47192
47436
|
command2,
|
|
47193
47437
|
(message2) => send(socket, message2),
|
|
47194
47438
|
signal,
|
|
47195
|
-
sessions.findSessions([command2.sessionId])[0]?.cwd ?? null
|
|
47439
|
+
sessions.findSessions([command2.sessionId])[0]?.cwd ?? null,
|
|
47440
|
+
externalContent
|
|
47196
47441
|
).catch((error62) => {
|
|
47197
47442
|
if (socket.readyState !== WebSocket6.OPEN || signal.aborted) {
|
|
47198
47443
|
return;
|
|
@@ -47531,7 +47776,7 @@ function connectRelay(url2, signal) {
|
|
|
47531
47776
|
}
|
|
47532
47777
|
|
|
47533
47778
|
// src/relay-connection/liveness.ts
|
|
47534
|
-
import { randomUUID as
|
|
47779
|
+
import { randomUUID as randomUUID7 } from "node:crypto";
|
|
47535
47780
|
var HEARTBEAT_ACK_TIMEOUT_MILLISECONDS = 1e4;
|
|
47536
47781
|
var HEARTBEAT_INTERVAL_MILLISECONDS = 2e4;
|
|
47537
47782
|
var RelayLivenessState = class {
|
|
@@ -47620,7 +47865,7 @@ var RelayConnectionLiveness = class {
|
|
|
47620
47865
|
}
|
|
47621
47866
|
throw new Error("Heartbeat was scheduled in an invalid state");
|
|
47622
47867
|
}
|
|
47623
|
-
const heartbeatId =
|
|
47868
|
+
const heartbeatId = randomUUID7();
|
|
47624
47869
|
this.#state = new AwaitingHeartbeatAckState(
|
|
47625
47870
|
heartbeatId,
|
|
47626
47871
|
this.#timer.schedule(this.#handleTimeout, HEARTBEAT_ACK_TIMEOUT_MILLISECONDS)
|
|
@@ -47660,6 +47905,7 @@ async function runRelayConnection({
|
|
|
47660
47905
|
operations,
|
|
47661
47906
|
publisher,
|
|
47662
47907
|
eventLogV2,
|
|
47908
|
+
externalContent,
|
|
47663
47909
|
activeTurns,
|
|
47664
47910
|
connectionEpoch,
|
|
47665
47911
|
diagnostics,
|
|
@@ -47683,6 +47929,7 @@ async function runRelayConnection({
|
|
|
47683
47929
|
operations,
|
|
47684
47930
|
publisher,
|
|
47685
47931
|
eventLogV2,
|
|
47932
|
+
externalContent,
|
|
47686
47933
|
activeTurns,
|
|
47687
47934
|
diagnostics,
|
|
47688
47935
|
socket,
|
|
@@ -47800,6 +48047,14 @@ async function runRelayConnection({
|
|
|
47800
48047
|
}
|
|
47801
48048
|
commands.handle(message);
|
|
47802
48049
|
} catch (error62) {
|
|
48050
|
+
if (error62 instanceof UnsupportedProtocolMessageKindError) {
|
|
48051
|
+
console.warn("Mobius daemon skipped an unsupported Relay message", {
|
|
48052
|
+
code: error62.code,
|
|
48053
|
+
direction: error62.direction,
|
|
48054
|
+
messageKind: error62.messageKind
|
|
48055
|
+
});
|
|
48056
|
+
return;
|
|
48057
|
+
}
|
|
47803
48058
|
console.error("Mobius daemon rejected a message", error62);
|
|
47804
48059
|
failAndClose(
|
|
47805
48060
|
new Error("Relay sent an invalid protocol message", { cause: error62 }),
|
|
@@ -48153,7 +48408,7 @@ async function installDetectedAgentIntegrations(config2, installations, signal)
|
|
|
48153
48408
|
{
|
|
48154
48409
|
agentId: agent.id,
|
|
48155
48410
|
kind: AGENT_INSTALL_REQUEST_KIND,
|
|
48156
|
-
requestId: `automatic-integration-${
|
|
48411
|
+
requestId: `automatic-integration-${randomUUID8()}`
|
|
48157
48412
|
},
|
|
48158
48413
|
signal
|
|
48159
48414
|
);
|
|
@@ -48172,8 +48427,9 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
|
|
|
48172
48427
|
stateDirectory
|
|
48173
48428
|
});
|
|
48174
48429
|
const sessionStore = new SqliteAcpSessionStore(
|
|
48175
|
-
|
|
48430
|
+
join19(stateDirectory, "sessions", `${createHash8("sha256").update(config2.channelId).digest("hex")}.sqlite`)
|
|
48176
48431
|
);
|
|
48432
|
+
const externalContent = new LocalExternalContentStore(stateDirectory);
|
|
48177
48433
|
const operations = new DaemonOperationState();
|
|
48178
48434
|
const publisher = new DaemonSessionEventPublisher(sessionStore);
|
|
48179
48435
|
const eventLogV2 = new DaemonSessionEventLogV2(publisher, sessionStore);
|
|
@@ -48194,7 +48450,8 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
|
|
|
48194
48450
|
)).history : null
|
|
48195
48451
|
},
|
|
48196
48452
|
"native",
|
|
48197
|
-
publisher.publishStatus
|
|
48453
|
+
publisher.publishStatus,
|
|
48454
|
+
new AcpContentExternalizer(externalContent)
|
|
48198
48455
|
);
|
|
48199
48456
|
const directories = new WorkspaceDirectoryService(config2.bindingId, config2.defaultWorkspace);
|
|
48200
48457
|
const installationObserver = new DaemonInstallationObserver();
|
|
@@ -48308,6 +48565,7 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
|
|
|
48308
48565
|
operations,
|
|
48309
48566
|
publisher,
|
|
48310
48567
|
eventLogV2,
|
|
48568
|
+
externalContent,
|
|
48311
48569
|
activeTurns,
|
|
48312
48570
|
connectionEpoch,
|
|
48313
48571
|
diagnostics,
|
|
@@ -48429,17 +48687,17 @@ var START_TIMEOUT_MILLISECONDS = 12e4;
|
|
|
48429
48687
|
var MAXIMUM_MESSAGE_BYTES = 64 * 1024;
|
|
48430
48688
|
var CONNECTION_ID_PATTERN2 = /^mcn_[a-f0-9]{32}$/;
|
|
48431
48689
|
async function acquireManagerLock(stateDirectory) {
|
|
48432
|
-
const path3 =
|
|
48690
|
+
const path3 = join20(stateDirectory, "manager.lock");
|
|
48433
48691
|
for (let attempt = 0; attempt < 2; attempt += 1) {
|
|
48434
48692
|
try {
|
|
48435
|
-
await
|
|
48693
|
+
await writeFile5(path3, `${process.pid.toString()}
|
|
48436
48694
|
`, { flag: "wx", mode: 384 });
|
|
48437
48695
|
return async () => await unlink2(path3).catch(() => void 0);
|
|
48438
48696
|
} catch (cause) {
|
|
48439
48697
|
if (!isNodeError2(cause, "EEXIST")) {
|
|
48440
48698
|
throw cause;
|
|
48441
48699
|
}
|
|
48442
|
-
const encoded = await
|
|
48700
|
+
const encoded = await readFile4(path3, "utf8").catch(() => "");
|
|
48443
48701
|
const pid = Number(encoded.trim());
|
|
48444
48702
|
if (Number.isSafeInteger(pid) && pid > 1) {
|
|
48445
48703
|
try {
|
|
@@ -48460,16 +48718,16 @@ function isRecord11(value) {
|
|
|
48460
48718
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
48461
48719
|
}
|
|
48462
48720
|
function controlSocketPath(stateDirectory) {
|
|
48463
|
-
const installationHash =
|
|
48464
|
-
return process.platform === "win32" ? `\\\\.\\pipe\\mobius-${installationHash}` :
|
|
48721
|
+
const installationHash = createHash9("sha256").update(stateDirectory).digest("hex").slice(0, 32);
|
|
48722
|
+
return process.platform === "win32" ? `\\\\.\\pipe\\mobius-${installationHash}` : join20(tmpdir(), `mobius-${installationHash}.sock`);
|
|
48465
48723
|
}
|
|
48466
48724
|
function controlTokenPath(stateDirectory) {
|
|
48467
|
-
return
|
|
48725
|
+
return join20(stateDirectory, "manager.token");
|
|
48468
48726
|
}
|
|
48469
48727
|
async function readOrCreateControlToken(stateDirectory) {
|
|
48470
48728
|
const path3 = controlTokenPath(stateDirectory);
|
|
48471
48729
|
try {
|
|
48472
|
-
return (await
|
|
48730
|
+
return (await readFile4(path3, "utf8")).trim();
|
|
48473
48731
|
} catch (cause) {
|
|
48474
48732
|
if (!isNodeError2(cause, "ENOENT")) {
|
|
48475
48733
|
throw cause;
|
|
@@ -48477,14 +48735,14 @@ async function readOrCreateControlToken(stateDirectory) {
|
|
|
48477
48735
|
}
|
|
48478
48736
|
const token = randomBytes(32).toString("base64url");
|
|
48479
48737
|
try {
|
|
48480
|
-
await
|
|
48738
|
+
await writeFile5(path3, `${token}
|
|
48481
48739
|
`, { flag: "wx", mode: 384 });
|
|
48482
48740
|
return token;
|
|
48483
48741
|
} catch (cause) {
|
|
48484
48742
|
if (!isNodeError2(cause, "EEXIST")) {
|
|
48485
48743
|
throw cause;
|
|
48486
48744
|
}
|
|
48487
|
-
return (await
|
|
48745
|
+
return (await readFile4(path3, "utf8")).trim();
|
|
48488
48746
|
}
|
|
48489
48747
|
}
|
|
48490
48748
|
function isNodeError2(error62, code) {
|
|
@@ -48796,7 +49054,7 @@ async function waitForManagerExit(stateDirectory, signal) {
|
|
|
48796
49054
|
const deadline = AbortSignal.any([signal, AbortSignal.timeout(1e4)]);
|
|
48797
49055
|
while (!deadline.aborted) {
|
|
48798
49056
|
try {
|
|
48799
|
-
await
|
|
49057
|
+
await readFile4(join20(stateDirectory, "manager.lock"), "utf8");
|
|
48800
49058
|
} catch (cause) {
|
|
48801
49059
|
if (isNodeError2(cause, "ENOENT")) {
|
|
48802
49060
|
return;
|
|
@@ -49074,7 +49332,7 @@ function createProgram() {
|
|
|
49074
49332
|
const installation = await openMobiusCliInstallation(shutdown.signal, process.env);
|
|
49075
49333
|
const localContext = new DaemonLocalContext(installation.stateDirectory, process.env);
|
|
49076
49334
|
const defaultWorkspace = loadDefaultWorkspace(localContext.environment);
|
|
49077
|
-
await
|
|
49335
|
+
await mkdir7(defaultWorkspace, { recursive: true, mode: 448 });
|
|
49078
49336
|
const inventory = await discoverLocalAgentInventory({
|
|
49079
49337
|
defaultWorkspace,
|
|
49080
49338
|
environment: localContext.environment,
|