@moxt-ai/mobius 0.0.277 → 0.0.280
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-runtime-manager.d.ts +8 -4
- package/dist/acp/agent-runtime-manager.d.ts.map +1 -1
- package/dist/acp/agent-runtime-manager.js +59 -6
- package/dist/acp/agent-runtime-manager.js.map +1 -1
- package/dist/acp/agent-session.d.ts.map +1 -1
- package/dist/acp/agent-session.js +20 -1
- package/dist/acp/agent-session.js.map +1 -1
- package/dist/acp/announced-tool-calls.d.ts +24 -0
- package/dist/acp/announced-tool-calls.d.ts.map +1 -0
- package/dist/acp/announced-tool-calls.js +37 -0
- package/dist/acp/announced-tool-calls.js.map +1 -0
- package/dist/acp/session-history.d.ts +2 -1
- package/dist/acp/session-history.d.ts.map +1 -1
- package/dist/acp/session-history.js.map +1 -1
- package/dist/acp/session-interactions.d.ts +4 -1
- package/dist/acp/session-interactions.d.ts.map +1 -1
- package/dist/acp/session-interactions.js +8 -2
- package/dist/acp/session-interactions.js.map +1 -1
- package/dist/cli.js +289 -172
- package/dist/cli.js.map +4 -4
- package/dist/runtime/command/registry/session.d.ts.map +1 -1
- package/dist/runtime/command/registry/session.js +8 -6
- package/dist/runtime/command/registry/session.js.map +1 -1
- package/dist/runtime/relay/diagnostics.d.ts +1 -1
- package/dist/runtime/relay/diagnostics.d.ts.map +1 -1
- package/dist/runtime/relay/diagnostics.js +1 -2
- package/dist/runtime/relay/diagnostics.js.map +1 -1
- package/dist/runtime/relay/liveness.d.ts +3 -3
- package/dist/runtime/relay/liveness.d.ts.map +1 -1
- package/dist/runtime/relay/liveness.js +11 -19
- package/dist/runtime/relay/liveness.js.map +1 -1
- package/dist/runtime/relay/run-relay-connection.js +3 -3
- package/dist/runtime/relay/run-relay-connection.js.map +1 -1
- package/dist/runtime/relay/session-event-publisher.d.ts +2 -1
- package/dist/runtime/relay/session-event-publisher.d.ts.map +1 -1
- package/dist/runtime/relay/session-event-publisher.js +1 -0
- package/dist/runtime/relay/session-event-publisher.js.map +1 -1
- package/dist/runtime/run.d.ts.map +1 -1
- package/dist/runtime/run.js +1 -0
- package/dist/runtime/run.js.map +1 -1
- package/dist/runtime/sessions.d.ts +8 -0
- package/dist/runtime/sessions.d.ts.map +1 -1
- package/dist/runtime/workspace/workspace-directory.d.ts +1 -1
- package/dist/runtime/workspace/workspace-directory.d.ts.map +1 -1
- package/dist/runtime/workspace/workspace-directory.js +6 -2
- package/dist/runtime/workspace/workspace-directory.js.map +1 -1
- package/dist/runtime.js +289 -172
- package/dist/runtime.js.map +4 -4
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -5398,7 +5398,7 @@ var program = new Command();
|
|
|
5398
5398
|
// package.json
|
|
5399
5399
|
var package_default = {
|
|
5400
5400
|
name: "@moxt-ai/mobius",
|
|
5401
|
-
version: "0.0.
|
|
5401
|
+
version: "0.0.280",
|
|
5402
5402
|
description: "Mobius CLI for pairing and running local AI agent services.",
|
|
5403
5403
|
type: "module",
|
|
5404
5404
|
bin: {
|
|
@@ -25213,8 +25213,17 @@ var decodeRuntimeDiagnosticsResult = (raw) => runtimeDiagnosticsResultSchema.par
|
|
|
25213
25213
|
var encodeRuntimeDiagnosticsRequest = (value) => JSON.stringify(runtimeDiagnosticsRequestSchema.parse(value));
|
|
25214
25214
|
var encodeRuntimeDiagnosticsResult = (value) => JSON.stringify(runtimeDiagnosticsResultSchema.parse(value));
|
|
25215
25215
|
|
|
25216
|
+
// ../mobius-sdk/src/protocol/shared/directory.ts
|
|
25217
|
+
var MAX_WORKSPACE_PATH_LENGTH = 4096;
|
|
25218
|
+
var MAX_DIRECTORY_IDENTIFIER_LENGTH = "path-".length + MAX_WORKSPACE_PATH_LENGTH * 4;
|
|
25219
|
+
var DIRECTORY_IDENTIFIER_PATTERN = new RegExp(
|
|
25220
|
+
`^[a-zA-Z0-9][a-zA-Z0-9_-]{0,${MAX_DIRECTORY_IDENTIFIER_LENGTH - 1}}$`,
|
|
25221
|
+
"u"
|
|
25222
|
+
);
|
|
25223
|
+
var DIRECTORY_IDENTIFIER = external_exports.string().min(1).max(MAX_DIRECTORY_IDENTIFIER_LENGTH).regex(DIRECTORY_IDENTIFIER_PATTERN);
|
|
25224
|
+
var isDirectoryIdentifier = (value) => typeof value === "string" && value.length <= MAX_DIRECTORY_IDENTIFIER_LENGTH && DIRECTORY_IDENTIFIER_PATTERN.test(value);
|
|
25225
|
+
|
|
25216
25226
|
// ../mobius-sdk/src/protocol/shared/message-codec.ts
|
|
25217
|
-
var DIRECTORY_IDENTIFIER_PATTERN = /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,2047}$/;
|
|
25218
25227
|
var ProtocolMessageError = class extends Error {
|
|
25219
25228
|
code = "invalid_protocol_message";
|
|
25220
25229
|
constructor(message, options = {}) {
|
|
@@ -25272,7 +25281,7 @@ function readDirectoryIdentifiers(value, key, maximumCount) {
|
|
|
25272
25281
|
const identifiers = [];
|
|
25273
25282
|
const unique = /* @__PURE__ */ new Set();
|
|
25274
25283
|
for (const candidate of field) {
|
|
25275
|
-
if (
|
|
25284
|
+
if (!isDirectoryIdentifier(candidate) || unique.has(candidate)) {
|
|
25276
25285
|
throw new ProtocolMessageError(`Invalid directory in field: ${key}`);
|
|
25277
25286
|
}
|
|
25278
25287
|
unique.add(candidate);
|
|
@@ -25288,8 +25297,8 @@ function readIdentifier(value, key) {
|
|
|
25288
25297
|
}
|
|
25289
25298
|
}
|
|
25290
25299
|
function readDirectoryIdentifier(value, key) {
|
|
25291
|
-
const field = readString(value, key,
|
|
25292
|
-
if (!
|
|
25300
|
+
const field = readString(value, key, MAX_DIRECTORY_IDENTIFIER_LENGTH);
|
|
25301
|
+
if (!isDirectoryIdentifier(field)) {
|
|
25293
25302
|
throw new ProtocolMessageError(`Invalid directory identifier field: ${key}`);
|
|
25294
25303
|
}
|
|
25295
25304
|
return field;
|
|
@@ -25330,6 +25339,8 @@ var RUNTIME_HEARTBEAT_KIND = "runtime.heartbeat";
|
|
|
25330
25339
|
var RUNTIME_HEARTBEAT_ACK_KIND = "runtime.heartbeat.ack";
|
|
25331
25340
|
var RUNTIME_PING_KIND = "runtime.ping";
|
|
25332
25341
|
var RUNTIME_PONG_KIND = "runtime.pong";
|
|
25342
|
+
var RUNTIME_HEARTBEAT_MESSAGE = `{"kind":"${RUNTIME_HEARTBEAT_KIND}"}`;
|
|
25343
|
+
var RUNTIME_HEARTBEAT_ACK_MESSAGE = `{"kind":"${RUNTIME_HEARTBEAT_ACK_KIND}"}`;
|
|
25333
25344
|
function decodeRuntimeLivenessReadyEvent(encoded) {
|
|
25334
25345
|
const value = parseJson(encoded);
|
|
25335
25346
|
assertKind(value, RUNTIME_LIVENESS_READY_KIND);
|
|
@@ -25338,18 +25349,12 @@ function decodeRuntimeLivenessReadyEvent(encoded) {
|
|
|
25338
25349
|
function decodeRuntimeHeartbeatEvent(encoded) {
|
|
25339
25350
|
const value = parseJson(encoded);
|
|
25340
25351
|
assertKind(value, RUNTIME_HEARTBEAT_KIND);
|
|
25341
|
-
return {
|
|
25342
|
-
heartbeatId: readIdentifier(value, "heartbeatId"),
|
|
25343
|
-
kind: RUNTIME_HEARTBEAT_KIND
|
|
25344
|
-
};
|
|
25352
|
+
return "heartbeatId" in value ? { heartbeatId: readIdentifier(value, "heartbeatId"), kind: RUNTIME_HEARTBEAT_KIND } : { kind: RUNTIME_HEARTBEAT_KIND };
|
|
25345
25353
|
}
|
|
25346
25354
|
function decodeRuntimeHeartbeatAckEvent(encoded) {
|
|
25347
25355
|
const value = parseJson(encoded);
|
|
25348
25356
|
assertKind(value, RUNTIME_HEARTBEAT_ACK_KIND);
|
|
25349
|
-
return {
|
|
25350
|
-
heartbeatId: readIdentifier(value, "heartbeatId"),
|
|
25351
|
-
kind: RUNTIME_HEARTBEAT_ACK_KIND
|
|
25352
|
-
};
|
|
25357
|
+
return "heartbeatId" in value ? { heartbeatId: readIdentifier(value, "heartbeatId"), kind: RUNTIME_HEARTBEAT_ACK_KIND } : { kind: RUNTIME_HEARTBEAT_ACK_KIND };
|
|
25353
25358
|
}
|
|
25354
25359
|
function decodeRuntimePingCommand(encoded) {
|
|
25355
25360
|
const value = parseJson(encoded);
|
|
@@ -25365,10 +25370,12 @@ function encodeRuntimeLivenessReadyEvent(message) {
|
|
|
25365
25370
|
return JSON.stringify(decodeRuntimeLivenessReadyEvent(JSON.stringify(message)));
|
|
25366
25371
|
}
|
|
25367
25372
|
function encodeRuntimeHeartbeatEvent(message) {
|
|
25368
|
-
|
|
25373
|
+
const decoded = decodeRuntimeHeartbeatEvent(JSON.stringify(message));
|
|
25374
|
+
return "heartbeatId" in decoded ? JSON.stringify(decoded) : RUNTIME_HEARTBEAT_MESSAGE;
|
|
25369
25375
|
}
|
|
25370
25376
|
function encodeRuntimeHeartbeatAckEvent(message) {
|
|
25371
|
-
|
|
25377
|
+
const decoded = decodeRuntimeHeartbeatAckEvent(JSON.stringify(message));
|
|
25378
|
+
return "heartbeatId" in decoded ? JSON.stringify(decoded) : RUNTIME_HEARTBEAT_ACK_MESSAGE;
|
|
25372
25379
|
}
|
|
25373
25380
|
function encodeRuntimePingCommand(message) {
|
|
25374
25381
|
return JSON.stringify(decodeRuntimePingCommand(JSON.stringify(message)));
|
|
@@ -25407,8 +25414,6 @@ var decodeRuntimeUpgradeResult = (raw) => runtimeUpgradeResultSchema.parse(JSON.
|
|
|
25407
25414
|
var encodeRuntimeUpgradeResult = (value) => JSON.stringify(runtimeUpgradeResultSchema.parse(value));
|
|
25408
25415
|
|
|
25409
25416
|
// ../mobius-sdk/src/protocol/session/shared/index.ts
|
|
25410
|
-
var DIRECTORY_IDENTIFIER_PATTERN2 = /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,2047}$/;
|
|
25411
|
-
var DIRECTORY_IDENTIFIER = external_exports.string().min(1).max(2048).regex(DIRECTORY_IDENTIFIER_PATTERN2);
|
|
25412
25417
|
var SHORT_TEXT = external_exports.string().max(500);
|
|
25413
25418
|
var workspaceEntrySchema = external_exports.object({
|
|
25414
25419
|
directoryId: DIRECTORY_IDENTIFIER,
|
|
@@ -25702,6 +25707,66 @@ var encodeFileEndEvent = (message) => encodeZodMessage(message, fileEndEventSche
|
|
|
25702
25707
|
var decodeFileFailedEvent = (encoded) => decodeZodMessage(encoded, fileFailedEventSchema);
|
|
25703
25708
|
var encodeFileFailedEvent = (message) => encodeZodMessage(message, fileFailedEventSchema);
|
|
25704
25709
|
|
|
25710
|
+
// ../mobius-sdk/src/protocol/shared/tool-input.ts
|
|
25711
|
+
var MAX_CONTENT_LENGTH = 1e6;
|
|
25712
|
+
var MAX_COLLECTION_SIZE = 1e3;
|
|
25713
|
+
var MAX_JSON_DEPTH = 16;
|
|
25714
|
+
var MAX_JSON_KEYS = 1e3;
|
|
25715
|
+
var boundedString = external_exports.string().max(MAX_CONTENT_LENGTH);
|
|
25716
|
+
function boundedJsonIssue(value, depth = 0) {
|
|
25717
|
+
if (depth > MAX_JSON_DEPTH) {
|
|
25718
|
+
return "JSON nesting exceeds the maximum depth";
|
|
25719
|
+
}
|
|
25720
|
+
if (typeof value === "string") {
|
|
25721
|
+
return value.length <= MAX_CONTENT_LENGTH ? null : "JSON string exceeds the maximum length";
|
|
25722
|
+
}
|
|
25723
|
+
if (typeof value === "number") {
|
|
25724
|
+
return Number.isFinite(value) ? null : "JSON number must be finite";
|
|
25725
|
+
}
|
|
25726
|
+
if (typeof value === "boolean" || value === null) {
|
|
25727
|
+
return null;
|
|
25728
|
+
}
|
|
25729
|
+
if (Array.isArray(value)) {
|
|
25730
|
+
if (value.length > MAX_COLLECTION_SIZE) {
|
|
25731
|
+
return "JSON array exceeds the maximum length";
|
|
25732
|
+
}
|
|
25733
|
+
for (const item of value) {
|
|
25734
|
+
const issue2 = boundedJsonIssue(item, depth + 1);
|
|
25735
|
+
if (issue2 !== null) {
|
|
25736
|
+
return issue2;
|
|
25737
|
+
}
|
|
25738
|
+
}
|
|
25739
|
+
return null;
|
|
25740
|
+
}
|
|
25741
|
+
if (typeof value === "object" && value !== void 0) {
|
|
25742
|
+
const entries = Object.entries(value);
|
|
25743
|
+
if (entries.length > MAX_JSON_KEYS) {
|
|
25744
|
+
return "JSON object exceeds the maximum key count";
|
|
25745
|
+
}
|
|
25746
|
+
for (const [key, item] of entries) {
|
|
25747
|
+
if (key.length > 255) {
|
|
25748
|
+
return "JSON key exceeds the maximum length";
|
|
25749
|
+
}
|
|
25750
|
+
const issue2 = boundedJsonIssue(item, depth + 1);
|
|
25751
|
+
if (issue2 !== null) {
|
|
25752
|
+
return issue2;
|
|
25753
|
+
}
|
|
25754
|
+
}
|
|
25755
|
+
return null;
|
|
25756
|
+
}
|
|
25757
|
+
return "Value is not bounded JSON";
|
|
25758
|
+
}
|
|
25759
|
+
var boundedJsonSchema = external_exports.unknown().superRefine((value, context) => {
|
|
25760
|
+
const issue2 = boundedJsonIssue(value);
|
|
25761
|
+
if (issue2 !== null) {
|
|
25762
|
+
context.addIssue({ code: "custom", message: issue2 });
|
|
25763
|
+
}
|
|
25764
|
+
});
|
|
25765
|
+
var toolCallLocationSchema = external_exports.object({
|
|
25766
|
+
line: external_exports.number().int().nonnegative().safe().nullable().optional(),
|
|
25767
|
+
path: boundedString
|
|
25768
|
+
}).readonly();
|
|
25769
|
+
|
|
25705
25770
|
// ../mobius-sdk/src/protocol/session/interactions/index.ts
|
|
25706
25771
|
var SESSION_PERMISSION_REQUESTED_KIND = "session.permission.requested";
|
|
25707
25772
|
var SESSION_PERMISSION_RESPOND_KIND = "session.permission.respond";
|
|
@@ -25739,6 +25804,12 @@ var elicitationFieldSchema = external_exports.object({
|
|
|
25739
25804
|
}).readonly();
|
|
25740
25805
|
var sessionPermissionRequestedEventSchema = external_exports.object({
|
|
25741
25806
|
commandId: identifierStringSchema,
|
|
25807
|
+
// Absent only for events from older runtimes and saved history.
|
|
25808
|
+
details: external_exports.object({
|
|
25809
|
+
cwd: external_exports.string().min(1).max(4096),
|
|
25810
|
+
rawInput: boundedJsonSchema.optional(),
|
|
25811
|
+
locations: external_exports.array(toolCallLocationSchema).max(1e3).readonly()
|
|
25812
|
+
}).readonly().optional(),
|
|
25742
25813
|
interactionId: identifierStringSchema,
|
|
25743
25814
|
kind: external_exports.literal(SESSION_PERMISSION_REQUESTED_KIND),
|
|
25744
25815
|
options: external_exports.array(permissionOptionSchema).min(1).max(20).readonly(),
|
|
@@ -25802,6 +25873,8 @@ var SESSION_RESTORE_KIND = "session.restore";
|
|
|
25802
25873
|
var SESSION_RESTORED_KIND = "session.restored";
|
|
25803
25874
|
var SESSION_CLOSE_KIND = "session.close";
|
|
25804
25875
|
var SESSION_CLOSED_KIND = "session.closed";
|
|
25876
|
+
var SESSION_CLOSE_NOTICE_KIND = "session.close.notice";
|
|
25877
|
+
var SESSION_CLOSED_ERROR_CODE = "session_closed";
|
|
25805
25878
|
var SESSION_STATUS_CHANGED_KIND = "session.status.changed";
|
|
25806
25879
|
var SESSION_COMMANDS_UPDATED_KIND = "session.commands.updated";
|
|
25807
25880
|
var SESSION_INFO_UPDATED_KIND = "session.info.updated";
|
|
@@ -25815,7 +25888,7 @@ var sessionMetadataSchema = external_exports.object({
|
|
|
25815
25888
|
additionalDirectories: external_exports.array(workspaceEntrySchema).max(16).readonly(),
|
|
25816
25889
|
agentId: identifierStringSchema,
|
|
25817
25890
|
directoryId: DIRECTORY_IDENTIFIER,
|
|
25818
|
-
directoryLabel: external_exports.string().min(1).max(
|
|
25891
|
+
directoryLabel: external_exports.string().min(1).max(MAX_WORKSPACE_PATH_LENGTH),
|
|
25819
25892
|
prompted: external_exports.boolean(),
|
|
25820
25893
|
sessionId: identifierStringSchema,
|
|
25821
25894
|
status: sessionStatusSchema.default({ kind: "idle" }),
|
|
@@ -25889,7 +25962,7 @@ var sessionReadyEventSchema = external_exports.object({
|
|
|
25889
25962
|
commands: external_exports.array(sessionCommandSchema).max(500).readonly(),
|
|
25890
25963
|
configOptions: sessionConfigOptionsSchema,
|
|
25891
25964
|
directoryId: DIRECTORY_IDENTIFIER,
|
|
25892
|
-
directoryLabel: external_exports.string().min(1).max(
|
|
25965
|
+
directoryLabel: external_exports.string().min(1).max(MAX_WORKSPACE_PATH_LENGTH),
|
|
25893
25966
|
kind: external_exports.literal(SESSION_READY_KIND),
|
|
25894
25967
|
requestId: identifierStringSchema,
|
|
25895
25968
|
restored: external_exports.boolean(),
|
|
@@ -25907,6 +25980,11 @@ var sessionClosedEventSchema = external_exports.object({
|
|
|
25907
25980
|
requestId: identifierStringSchema,
|
|
25908
25981
|
sessionId: identifierStringSchema
|
|
25909
25982
|
}).readonly();
|
|
25983
|
+
var sessionCloseNoticeEventSchema = external_exports.object({
|
|
25984
|
+
kind: external_exports.literal(SESSION_CLOSE_NOTICE_KIND),
|
|
25985
|
+
reason: external_exports.string().min(1).max(500),
|
|
25986
|
+
sessionId: identifierStringSchema
|
|
25987
|
+
}).readonly();
|
|
25910
25988
|
var sessionCommandsUpdatedEventSchema = external_exports.object({
|
|
25911
25989
|
commands: external_exports.array(sessionCommandSchema).max(500).readonly(),
|
|
25912
25990
|
kind: external_exports.literal(SESSION_COMMANDS_UPDATED_KIND),
|
|
@@ -25943,6 +26021,8 @@ var decodeSessionCloseCommand = (encoded) => decodeZodMessage(encoded, sessionCl
|
|
|
25943
26021
|
var encodeSessionCloseCommand = (message) => encodeZodMessage(message, sessionCloseCommandSchema);
|
|
25944
26022
|
var decodeSessionClosedEvent = (encoded) => decodeZodMessage(encoded, sessionClosedEventSchema);
|
|
25945
26023
|
var encodeSessionClosedEvent = (message) => encodeZodMessage(message, sessionClosedEventSchema);
|
|
26024
|
+
var decodeSessionCloseNoticeEvent = (encoded) => decodeZodMessage(encoded, sessionCloseNoticeEventSchema);
|
|
26025
|
+
var encodeSessionCloseNoticeEvent = (message) => encodeZodMessage(message, sessionCloseNoticeEventSchema);
|
|
25946
26026
|
var decodeSessionStatusChangedEvent = (encoded) => decodeZodMessage(encoded, sessionStatusChangedEventSchema);
|
|
25947
26027
|
var encodeSessionStatusChangedEvent = (message) => encodeZodMessage(message, sessionStatusChangedEventSchema);
|
|
25948
26028
|
var decodeSessionPrepareCommand = (encoded) => decodeZodMessage(encoded, sessionPrepareCommandSchema);
|
|
@@ -26070,7 +26150,6 @@ var NATIVE_SESSION_RESULT_KIND = "native.session.result";
|
|
|
26070
26150
|
var NATIVE_SESSION_CANCEL_KIND = "native.session.cancel";
|
|
26071
26151
|
var SESSION_HISTORY_CHARACTER_LIMIT = 256e3;
|
|
26072
26152
|
var SESSION_HISTORY_MESSAGE_LIMIT = 1e3;
|
|
26073
|
-
var directoryId = external_exports.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,2047}$/);
|
|
26074
26153
|
var envelope = {
|
|
26075
26154
|
requestId: identifierStringSchema,
|
|
26076
26155
|
sessionId: identifierStringSchema
|
|
@@ -26085,10 +26164,10 @@ var activeTurnSnapshotSchema = external_exports.object({
|
|
|
26085
26164
|
var identity = {
|
|
26086
26165
|
...envelope,
|
|
26087
26166
|
kind: external_exports.literal(NATIVE_SESSION_REQUEST_KIND),
|
|
26088
|
-
additionalDirectoryIds: external_exports.array(
|
|
26167
|
+
additionalDirectoryIds: external_exports.array(DIRECTORY_IDENTIFIER).max(16).readonly(),
|
|
26089
26168
|
agentId: identifierStringSchema,
|
|
26090
26169
|
bindingId: identifierStringSchema,
|
|
26091
|
-
directoryId
|
|
26170
|
+
directoryId: DIRECTORY_IDENTIFIER
|
|
26092
26171
|
};
|
|
26093
26172
|
var nativeSessionRequestSchema = external_exports.discriminatedUnion("action", [
|
|
26094
26173
|
external_exports.object({ ...identity, action: external_exports.literal("active-turn"), targetSessionId: identifierStringSchema }).readonly(),
|
|
@@ -26125,10 +26204,10 @@ var nativeSessionEntrySchema = external_exports.object({
|
|
|
26125
26204
|
mobiusSessionIds: external_exports.array(identifierStringSchema).max(500).readonly(),
|
|
26126
26205
|
nativeSessionId: identifierStringSchema,
|
|
26127
26206
|
title: external_exports.string().max(500),
|
|
26128
|
-
directoryId,
|
|
26129
|
-
directoryLabel: external_exports.string().min(1).max(
|
|
26207
|
+
directoryId: DIRECTORY_IDENTIFIER,
|
|
26208
|
+
directoryLabel: external_exports.string().min(1).max(MAX_WORKSPACE_PATH_LENGTH),
|
|
26130
26209
|
updatedAt: external_exports.iso.datetime({ offset: true }).nullable(),
|
|
26131
|
-
additionalDirectories: external_exports.array(external_exports.object({ directoryId, name: external_exports.string().min(1).max(255) }).readonly()).max(16).readonly()
|
|
26210
|
+
additionalDirectories: external_exports.array(external_exports.object({ directoryId: DIRECTORY_IDENTIFIER, name: external_exports.string().min(1).max(255) }).readonly()).max(16).readonly()
|
|
26132
26211
|
}).readonly();
|
|
26133
26212
|
var resultEnvelope = {
|
|
26134
26213
|
...envelope,
|
|
@@ -26186,86 +26265,35 @@ var encodeNativeSessionCancel = (value) => JSON.stringify(nativeSessionCancelSch
|
|
|
26186
26265
|
|
|
26187
26266
|
// ../mobius-sdk/src/protocol/session/observability/event-log.ts
|
|
26188
26267
|
var MAX_EVENT_COUNT = 1e4;
|
|
26189
|
-
var
|
|
26190
|
-
var
|
|
26191
|
-
var MAX_JSON_DEPTH = 16;
|
|
26192
|
-
var MAX_JSON_KEYS = 1e3;
|
|
26268
|
+
var MAX_COLLECTION_SIZE2 = 1e3;
|
|
26269
|
+
var MAX_CONTENT_LENGTH2 = 1e6;
|
|
26193
26270
|
var SESSION_EVENT_KIND = "session.event.v2";
|
|
26194
26271
|
var SESSION_EVENT_BATCH_MAX_SIZE = 1e3;
|
|
26195
|
-
var
|
|
26272
|
+
var boundedString2 = external_exports.string().max(MAX_CONTENT_LENGTH2);
|
|
26196
26273
|
var shortString = external_exports.string().max(2048);
|
|
26197
26274
|
var externalContentKeySchema = external_exports.string().regex(/^[a-f0-9]{64}$/u);
|
|
26198
|
-
function boundedJsonIssue(value, depth = 0) {
|
|
26199
|
-
if (depth > MAX_JSON_DEPTH) {
|
|
26200
|
-
return "JSON nesting exceeds the maximum depth";
|
|
26201
|
-
}
|
|
26202
|
-
if (typeof value === "string") {
|
|
26203
|
-
return value.length <= MAX_CONTENT_LENGTH ? null : "JSON string exceeds the maximum length";
|
|
26204
|
-
}
|
|
26205
|
-
if (typeof value === "number") {
|
|
26206
|
-
return Number.isFinite(value) ? null : "JSON number must be finite";
|
|
26207
|
-
}
|
|
26208
|
-
if (typeof value === "boolean" || value === null) {
|
|
26209
|
-
return null;
|
|
26210
|
-
}
|
|
26211
|
-
if (Array.isArray(value)) {
|
|
26212
|
-
if (value.length > MAX_COLLECTION_SIZE) {
|
|
26213
|
-
return "JSON array exceeds the maximum length";
|
|
26214
|
-
}
|
|
26215
|
-
for (const item of value) {
|
|
26216
|
-
const issue2 = boundedJsonIssue(item, depth + 1);
|
|
26217
|
-
if (issue2 !== null) {
|
|
26218
|
-
return issue2;
|
|
26219
|
-
}
|
|
26220
|
-
}
|
|
26221
|
-
return null;
|
|
26222
|
-
}
|
|
26223
|
-
if (typeof value === "object" && value !== void 0) {
|
|
26224
|
-
const entries = Object.entries(value);
|
|
26225
|
-
if (entries.length > MAX_JSON_KEYS) {
|
|
26226
|
-
return "JSON object exceeds the maximum key count";
|
|
26227
|
-
}
|
|
26228
|
-
for (const [key, item] of entries) {
|
|
26229
|
-
if (key.length > 255) {
|
|
26230
|
-
return "JSON key exceeds the maximum length";
|
|
26231
|
-
}
|
|
26232
|
-
const issue2 = boundedJsonIssue(item, depth + 1);
|
|
26233
|
-
if (issue2 !== null) {
|
|
26234
|
-
return issue2;
|
|
26235
|
-
}
|
|
26236
|
-
}
|
|
26237
|
-
return null;
|
|
26238
|
-
}
|
|
26239
|
-
return "Value is not bounded JSON";
|
|
26240
|
-
}
|
|
26241
|
-
var boundedJsonSchema = external_exports.unknown().superRefine((value, context) => {
|
|
26242
|
-
const issue2 = boundedJsonIssue(value);
|
|
26243
|
-
if (issue2 !== null) {
|
|
26244
|
-
context.addIssue({ code: "custom", message: issue2 });
|
|
26245
|
-
}
|
|
26246
|
-
});
|
|
26247
26275
|
var annotationsSchema = external_exports.object({
|
|
26248
26276
|
audience: external_exports.array(external_exports.enum(["assistant", "user"])).max(2).readonly().nullable().optional(),
|
|
26249
26277
|
lastModified: shortString.nullable().optional(),
|
|
26250
26278
|
priority: external_exports.number().finite().nullable().optional()
|
|
26251
26279
|
}).readonly();
|
|
26252
26280
|
var contentFields = { annotations: annotationsSchema.nullable().optional() };
|
|
26253
|
-
var textContentSchema = external_exports.object({ ...contentFields, text:
|
|
26281
|
+
var textContentSchema = external_exports.object({ ...contentFields, text: boundedString2, type: external_exports.literal("text") }).readonly();
|
|
26254
26282
|
var imageContentSchema = external_exports.object({
|
|
26255
26283
|
...contentFields,
|
|
26256
|
-
data:
|
|
26284
|
+
data: boundedString2,
|
|
26257
26285
|
mimeType: shortString,
|
|
26258
26286
|
type: external_exports.literal("image"),
|
|
26259
|
-
uri:
|
|
26287
|
+
uri: boundedString2.nullable().optional()
|
|
26260
26288
|
}).readonly();
|
|
26261
|
-
var audioContentSchema = external_exports.object({ ...contentFields, data:
|
|
26289
|
+
var audioContentSchema = external_exports.object({ ...contentFields, data: boundedString2, mimeType: shortString, type: external_exports.literal("audio") }).readonly();
|
|
26262
26290
|
var externalImageContentSchema = external_exports.object({
|
|
26263
26291
|
...contentFields,
|
|
26264
26292
|
byteLength: external_exports.number().int().positive().safe(),
|
|
26265
26293
|
imageKey: externalContentKeySchema,
|
|
26266
26294
|
mimeType: shortString,
|
|
26267
26295
|
type: external_exports.literal("external_image"),
|
|
26268
|
-
uri:
|
|
26296
|
+
uri: boundedString2.nullable().optional()
|
|
26269
26297
|
}).readonly();
|
|
26270
26298
|
var externalAudioContentSchema = external_exports.object({
|
|
26271
26299
|
...contentFields,
|
|
@@ -26281,27 +26309,27 @@ var externalResourceContentSchema = external_exports.object({
|
|
|
26281
26309
|
mimeType: shortString.nullable().optional(),
|
|
26282
26310
|
resourceKey: externalContentKeySchema,
|
|
26283
26311
|
type: external_exports.literal("external_resource"),
|
|
26284
|
-
uri:
|
|
26312
|
+
uri: boundedString2
|
|
26285
26313
|
}).readonly();
|
|
26286
26314
|
var resourceLinkSchema = external_exports.object({
|
|
26287
26315
|
...contentFields,
|
|
26288
|
-
description:
|
|
26316
|
+
description: boundedString2.nullable().optional(),
|
|
26289
26317
|
mimeType: shortString.nullable().optional(),
|
|
26290
26318
|
name: shortString,
|
|
26291
26319
|
size: external_exports.number().int().nonnegative().safe().nullable().optional(),
|
|
26292
26320
|
title: shortString.nullable().optional(),
|
|
26293
26321
|
type: external_exports.literal("resource_link"),
|
|
26294
|
-
uri:
|
|
26322
|
+
uri: boundedString2
|
|
26295
26323
|
}).readonly();
|
|
26296
26324
|
var textResourceSchema = external_exports.object({
|
|
26297
26325
|
mimeType: shortString.nullable().optional(),
|
|
26298
|
-
text:
|
|
26299
|
-
uri:
|
|
26326
|
+
text: boundedString2,
|
|
26327
|
+
uri: boundedString2
|
|
26300
26328
|
}).readonly();
|
|
26301
26329
|
var blobResourceSchema = external_exports.object({
|
|
26302
|
-
blob:
|
|
26330
|
+
blob: boundedString2,
|
|
26303
26331
|
mimeType: shortString.nullable().optional(),
|
|
26304
|
-
uri:
|
|
26332
|
+
uri: boundedString2
|
|
26305
26333
|
}).readonly();
|
|
26306
26334
|
var embeddedResourceSchema = external_exports.object({
|
|
26307
26335
|
...contentFields,
|
|
@@ -26321,17 +26349,13 @@ var contentBlockSchema = external_exports.discriminatedUnion("type", [
|
|
|
26321
26349
|
var toolCallContentSchema = external_exports.discriminatedUnion("type", [
|
|
26322
26350
|
external_exports.object({ content: contentBlockSchema, type: external_exports.literal("content") }).readonly(),
|
|
26323
26351
|
external_exports.object({
|
|
26324
|
-
newText:
|
|
26325
|
-
oldText:
|
|
26326
|
-
path:
|
|
26352
|
+
newText: boundedString2,
|
|
26353
|
+
oldText: boundedString2.nullable().optional(),
|
|
26354
|
+
path: boundedString2,
|
|
26327
26355
|
type: external_exports.literal("diff")
|
|
26328
26356
|
}).readonly(),
|
|
26329
26357
|
external_exports.object({ terminalId: shortString, type: external_exports.literal("terminal") }).readonly()
|
|
26330
26358
|
]);
|
|
26331
|
-
var toolCallLocationSchema = external_exports.object({
|
|
26332
|
-
line: external_exports.number().int().nonnegative().safe().nullable().optional(),
|
|
26333
|
-
path: boundedString
|
|
26334
|
-
}).readonly();
|
|
26335
26359
|
var toolKindSchema = external_exports.enum([
|
|
26336
26360
|
"read",
|
|
26337
26361
|
"edit",
|
|
@@ -26346,51 +26370,51 @@ var toolKindSchema = external_exports.enum([
|
|
|
26346
26370
|
]);
|
|
26347
26371
|
var toolStatusSchema = external_exports.enum(["pending", "in_progress", "completed", "failed"]);
|
|
26348
26372
|
var toolPatchFields = {
|
|
26349
|
-
content: external_exports.array(toolCallContentSchema).max(
|
|
26373
|
+
content: external_exports.array(toolCallContentSchema).max(MAX_COLLECTION_SIZE2).readonly().nullable().optional(),
|
|
26350
26374
|
kind: toolKindSchema.nullable().optional(),
|
|
26351
|
-
locations: external_exports.array(toolCallLocationSchema).max(
|
|
26375
|
+
locations: external_exports.array(toolCallLocationSchema).max(MAX_COLLECTION_SIZE2).readonly().nullable().optional(),
|
|
26352
26376
|
name: shortString.nullable().optional(),
|
|
26353
26377
|
rawInput: boundedJsonSchema.optional(),
|
|
26354
26378
|
rawOutput: boundedJsonSchema.optional(),
|
|
26355
26379
|
status: toolStatusSchema.nullable().optional(),
|
|
26356
|
-
title:
|
|
26380
|
+
title: boundedString2.nullable().optional()
|
|
26357
26381
|
};
|
|
26358
26382
|
var planEntrySchema = external_exports.object({
|
|
26359
|
-
content:
|
|
26383
|
+
content: boundedString2,
|
|
26360
26384
|
priority: external_exports.enum(["high", "medium", "low"]),
|
|
26361
26385
|
status: external_exports.enum(["pending", "in_progress", "completed"])
|
|
26362
26386
|
}).readonly();
|
|
26363
26387
|
var planContentSchema = external_exports.discriminatedUnion("type", [
|
|
26364
26388
|
external_exports.object({
|
|
26365
|
-
entries: external_exports.array(planEntrySchema).max(
|
|
26389
|
+
entries: external_exports.array(planEntrySchema).max(MAX_COLLECTION_SIZE2).readonly(),
|
|
26366
26390
|
planId: shortString,
|
|
26367
26391
|
type: external_exports.literal("items")
|
|
26368
26392
|
}).readonly(),
|
|
26369
|
-
external_exports.object({ planId: shortString, type: external_exports.literal("file"), uri:
|
|
26393
|
+
external_exports.object({ planId: shortString, type: external_exports.literal("file"), uri: boundedString2 }).readonly(),
|
|
26370
26394
|
external_exports.object({
|
|
26371
|
-
content:
|
|
26395
|
+
content: boundedString2,
|
|
26372
26396
|
planId: shortString,
|
|
26373
26397
|
type: external_exports.literal("markdown")
|
|
26374
26398
|
}).readonly()
|
|
26375
26399
|
]);
|
|
26376
26400
|
var commandSchema = external_exports.object({
|
|
26377
|
-
description:
|
|
26378
|
-
input: external_exports.object({ hint:
|
|
26401
|
+
description: boundedString2,
|
|
26402
|
+
input: external_exports.object({ hint: boundedString2 }).readonly().nullable().optional(),
|
|
26379
26403
|
name: shortString
|
|
26380
26404
|
}).readonly();
|
|
26381
26405
|
var configSelectOptionSchema = external_exports.object({
|
|
26382
|
-
description:
|
|
26406
|
+
description: boundedString2.nullable().optional(),
|
|
26383
26407
|
name: shortString,
|
|
26384
26408
|
value: shortString
|
|
26385
26409
|
}).readonly();
|
|
26386
26410
|
var configSelectGroupSchema = external_exports.object({
|
|
26387
26411
|
group: shortString,
|
|
26388
26412
|
name: shortString,
|
|
26389
|
-
options: external_exports.array(configSelectOptionSchema).max(
|
|
26413
|
+
options: external_exports.array(configSelectOptionSchema).max(MAX_COLLECTION_SIZE2).readonly()
|
|
26390
26414
|
}).readonly();
|
|
26391
26415
|
var configBaseFields = {
|
|
26392
26416
|
category: shortString.nullable().optional(),
|
|
26393
|
-
description:
|
|
26417
|
+
description: boundedString2.nullable().optional(),
|
|
26394
26418
|
id: shortString,
|
|
26395
26419
|
name: shortString
|
|
26396
26420
|
};
|
|
@@ -26399,8 +26423,8 @@ var sessionConfigOptionSchema2 = external_exports.discriminatedUnion("type", [
|
|
|
26399
26423
|
...configBaseFields,
|
|
26400
26424
|
currentValue: shortString,
|
|
26401
26425
|
options: external_exports.union([
|
|
26402
|
-
external_exports.array(configSelectOptionSchema).max(
|
|
26403
|
-
external_exports.array(configSelectGroupSchema).max(
|
|
26426
|
+
external_exports.array(configSelectOptionSchema).max(MAX_COLLECTION_SIZE2).readonly(),
|
|
26427
|
+
external_exports.array(configSelectGroupSchema).max(MAX_COLLECTION_SIZE2).readonly()
|
|
26404
26428
|
]),
|
|
26405
26429
|
type: external_exports.literal("select")
|
|
26406
26430
|
}).readonly(),
|
|
@@ -26415,26 +26439,26 @@ var acpSessionUpdateSchema = external_exports.discriminatedUnion("sessionUpdate"
|
|
|
26415
26439
|
external_exports.object({ ...contentChunkFields, sessionUpdate: external_exports.literal("agent_message_chunk") }).readonly(),
|
|
26416
26440
|
external_exports.object({ ...contentChunkFields, sessionUpdate: external_exports.literal("agent_thought_chunk") }).readonly(),
|
|
26417
26441
|
external_exports.object({
|
|
26418
|
-
content: external_exports.array(toolCallContentSchema).max(
|
|
26442
|
+
content: external_exports.array(toolCallContentSchema).max(MAX_COLLECTION_SIZE2).readonly().optional(),
|
|
26419
26443
|
kind: toolKindSchema.optional(),
|
|
26420
|
-
locations: external_exports.array(toolCallLocationSchema).max(
|
|
26444
|
+
locations: external_exports.array(toolCallLocationSchema).max(MAX_COLLECTION_SIZE2).readonly().optional(),
|
|
26421
26445
|
name: shortString.nullable().optional(),
|
|
26422
26446
|
rawInput: boundedJsonSchema.optional(),
|
|
26423
26447
|
rawOutput: boundedJsonSchema.optional(),
|
|
26424
26448
|
sessionUpdate: external_exports.literal("tool_call"),
|
|
26425
26449
|
status: toolStatusSchema.optional(),
|
|
26426
|
-
title:
|
|
26450
|
+
title: boundedString2,
|
|
26427
26451
|
toolCallId: shortString
|
|
26428
26452
|
}).readonly(),
|
|
26429
26453
|
external_exports.object({ ...toolPatchFields, sessionUpdate: external_exports.literal("tool_call_update"), toolCallId: shortString }).readonly(),
|
|
26430
26454
|
external_exports.object({
|
|
26431
|
-
entries: external_exports.array(planEntrySchema).max(
|
|
26455
|
+
entries: external_exports.array(planEntrySchema).max(MAX_COLLECTION_SIZE2).readonly(),
|
|
26432
26456
|
sessionUpdate: external_exports.literal("plan")
|
|
26433
26457
|
}).readonly(),
|
|
26434
26458
|
external_exports.object({ plan: planContentSchema, sessionUpdate: external_exports.literal("plan_update") }).readonly(),
|
|
26435
26459
|
external_exports.object({ planId: shortString, sessionUpdate: external_exports.literal("plan_removed") }).readonly(),
|
|
26436
26460
|
external_exports.object({
|
|
26437
|
-
availableCommands: external_exports.array(commandSchema).max(
|
|
26461
|
+
availableCommands: external_exports.array(commandSchema).max(MAX_COLLECTION_SIZE2).readonly(),
|
|
26438
26462
|
sessionUpdate: external_exports.literal("available_commands_update")
|
|
26439
26463
|
}).readonly(),
|
|
26440
26464
|
external_exports.object({
|
|
@@ -26442,12 +26466,12 @@ var acpSessionUpdateSchema = external_exports.discriminatedUnion("sessionUpdate"
|
|
|
26442
26466
|
sessionUpdate: external_exports.literal("current_mode_update")
|
|
26443
26467
|
}).readonly(),
|
|
26444
26468
|
external_exports.object({
|
|
26445
|
-
configOptions: external_exports.array(sessionConfigOptionSchema2).max(
|
|
26469
|
+
configOptions: external_exports.array(sessionConfigOptionSchema2).max(MAX_COLLECTION_SIZE2).readonly(),
|
|
26446
26470
|
sessionUpdate: external_exports.literal("config_option_update")
|
|
26447
26471
|
}).readonly(),
|
|
26448
26472
|
external_exports.object({
|
|
26449
26473
|
sessionUpdate: external_exports.literal("session_info_update"),
|
|
26450
|
-
title:
|
|
26474
|
+
title: boundedString2.nullable().optional(),
|
|
26451
26475
|
updatedAt: shortString.nullable().optional()
|
|
26452
26476
|
}).readonly(),
|
|
26453
26477
|
external_exports.object({
|
|
@@ -26458,10 +26482,10 @@ var acpSessionUpdateSchema = external_exports.discriminatedUnion("sessionUpdate"
|
|
|
26458
26482
|
}).readonly(),
|
|
26459
26483
|
external_exports.object({
|
|
26460
26484
|
compactionId: shortString,
|
|
26461
|
-
error:
|
|
26485
|
+
error: boundedString2.nullable().optional(),
|
|
26462
26486
|
sessionUpdate: external_exports.literal("compaction_update"),
|
|
26463
26487
|
status: shortString,
|
|
26464
|
-
summary: external_exports.array(contentBlockSchema).max(
|
|
26488
|
+
summary: external_exports.array(contentBlockSchema).max(MAX_COLLECTION_SIZE2).readonly().nullable().optional()
|
|
26465
26489
|
}).readonly(),
|
|
26466
26490
|
external_exports.object({
|
|
26467
26491
|
compactionId: shortString,
|
|
@@ -26472,8 +26496,8 @@ var acpSessionUpdateSchema = external_exports.discriminatedUnion("sessionUpdate"
|
|
|
26472
26496
|
var lifecycleBase = { commandId: identifierStringSchema };
|
|
26473
26497
|
var promptExecutionContextSchema = external_exports.object({
|
|
26474
26498
|
agentId: identifierStringSchema,
|
|
26475
|
-
directoryId:
|
|
26476
|
-
additionalDirectoryIds: external_exports.array(
|
|
26499
|
+
directoryId: DIRECTORY_IDENTIFIER,
|
|
26500
|
+
additionalDirectoryIds: external_exports.array(DIRECTORY_IDENTIFIER).max(16).readonly()
|
|
26477
26501
|
}).readonly();
|
|
26478
26502
|
var lifecycleMetadataSchema = external_exports.discriminatedUnion("kind", [
|
|
26479
26503
|
external_exports.object({ kind: external_exports.literal("session.queue.changed") }).readonly(),
|
|
@@ -26591,7 +26615,7 @@ var queuedPromptRequestEventLogSchema = external_exports.object({
|
|
|
26591
26615
|
}).readonly();
|
|
26592
26616
|
var nativeSessionEventsSchema = external_exports.object({
|
|
26593
26617
|
events: sessionEventLogPageSchema,
|
|
26594
|
-
queuedPromptRequests: external_exports.array(queuedPromptRequestEventLogSchema).max(
|
|
26618
|
+
queuedPromptRequests: external_exports.array(queuedPromptRequestEventLogSchema).max(MAX_COLLECTION_SIZE2).readonly()
|
|
26595
26619
|
}).readonly();
|
|
26596
26620
|
function inputValue(value) {
|
|
26597
26621
|
if (typeof value !== "string") {
|
|
@@ -26625,7 +26649,6 @@ var SESSION_HISTORY_PAGE_LOAD_KIND = "session.live-history.v2.page.load";
|
|
|
26625
26649
|
var SESSION_HISTORY_PAGE_LOADED_KIND = "session.live-history.v2.page.loaded";
|
|
26626
26650
|
var SESSION_PREVIEW_HISTORY_PAGE_LOAD_KIND = "session.preview-history.page.load";
|
|
26627
26651
|
var SESSION_PREVIEW_HISTORY_PAGE_LOADED_KIND = "session.preview-history.page.loaded";
|
|
26628
|
-
var directoryIdentifier = external_exports.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,2047}$/);
|
|
26629
26652
|
var pageRequestFields = {
|
|
26630
26653
|
cursor: external_exports.string().min(1).max(512).nullable(),
|
|
26631
26654
|
eventLimit: external_exports.number().int().min(1).max(1e4),
|
|
@@ -26636,10 +26659,10 @@ var pageRequestFields = {
|
|
|
26636
26659
|
var sessionHistoryPageLoadSchema = external_exports.object({ ...pageRequestFields, kind: external_exports.literal(SESSION_HISTORY_PAGE_LOAD_KIND) }).readonly();
|
|
26637
26660
|
var sessionPreviewHistoryPageLoadSchema = external_exports.object({
|
|
26638
26661
|
...pageRequestFields,
|
|
26639
|
-
additionalDirectoryIds: external_exports.array(
|
|
26662
|
+
additionalDirectoryIds: external_exports.array(DIRECTORY_IDENTIFIER).max(16).readonly(),
|
|
26640
26663
|
agentId: identifierStringSchema,
|
|
26641
26664
|
bindingId: identifierStringSchema,
|
|
26642
|
-
directoryId:
|
|
26665
|
+
directoryId: DIRECTORY_IDENTIFIER,
|
|
26643
26666
|
kind: external_exports.literal(SESSION_PREVIEW_HISTORY_PAGE_LOAD_KIND)
|
|
26644
26667
|
}).readonly();
|
|
26645
26668
|
var pageLoadedFields = {
|
|
@@ -26748,10 +26771,10 @@ var workspaceListCommandSchema = external_exports.object({
|
|
|
26748
26771
|
var workspaceEntriesEventSchema = external_exports.object({
|
|
26749
26772
|
bindingId: identifierStringSchema,
|
|
26750
26773
|
directoryId: DIRECTORY_IDENTIFIER,
|
|
26751
|
-
directoryLabel: external_exports.string().min(1).max(
|
|
26774
|
+
directoryLabel: external_exports.string().min(1).max(MAX_WORKSPACE_PATH_LENGTH),
|
|
26752
26775
|
entries: external_exports.array(workspaceEntrySchema).max(500).readonly(),
|
|
26753
26776
|
kind: external_exports.literal(WORKSPACE_ENTRIES_KIND),
|
|
26754
|
-
parentDirectoryId: external_exports.string().max(
|
|
26777
|
+
parentDirectoryId: external_exports.string().max(MAX_DIRECTORY_IDENTIFIER_LENGTH),
|
|
26755
26778
|
requestId: identifierStringSchema
|
|
26756
26779
|
}).readonly();
|
|
26757
26780
|
var decodeWorkspaceListCommand = (encoded) => decodeZodMessage(encoded, workspaceListCommandSchema);
|
|
@@ -26894,6 +26917,11 @@ var daemonToServiceSignatures = {
|
|
|
26894
26917
|
encodeSessionClosedEvent,
|
|
26895
26918
|
decodeSessionClosedEvent
|
|
26896
26919
|
),
|
|
26920
|
+
[SESSION_CLOSE_NOTICE_KIND]: defineMessageSignature(
|
|
26921
|
+
SESSION_CLOSE_NOTICE_KIND,
|
|
26922
|
+
encodeSessionCloseNoticeEvent,
|
|
26923
|
+
decodeSessionCloseNoticeEvent
|
|
26924
|
+
),
|
|
26897
26925
|
[SESSION_PREVIEW_HISTORY_PAGE_LOADED_KIND]: defineMessageSignature(
|
|
26898
26926
|
SESSION_PREVIEW_HISTORY_PAGE_LOADED_KIND,
|
|
26899
26927
|
encodeSessionPreviewHistoryPageLoaded,
|
|
@@ -82340,6 +82368,7 @@ var ActiveExecutions = class {
|
|
|
82340
82368
|
};
|
|
82341
82369
|
|
|
82342
82370
|
// src/acp/agent-session.ts
|
|
82371
|
+
import { setImmediate as yieldToRuntime2 } from "node:timers/promises";
|
|
82343
82372
|
import {
|
|
82344
82373
|
methods as methods10,
|
|
82345
82374
|
PROTOCOL_VERSION as PROTOCOL_VERSION3
|
|
@@ -82712,6 +82741,36 @@ var AgentUpdateStream = class {
|
|
|
82712
82741
|
};
|
|
82713
82742
|
};
|
|
82714
82743
|
|
|
82744
|
+
// src/acp/announced-tool-calls.ts
|
|
82745
|
+
var MAX_ANNOUNCED_TOOL_CALLS = 256;
|
|
82746
|
+
var AnnouncedToolCalls = class {
|
|
82747
|
+
#calls = /* @__PURE__ */ new Map();
|
|
82748
|
+
record = (update) => {
|
|
82749
|
+
const merged = this.describe(update);
|
|
82750
|
+
this.#calls.delete(update.toolCallId);
|
|
82751
|
+
this.#calls.set(update.toolCallId, merged);
|
|
82752
|
+
if (this.#calls.size > MAX_ANNOUNCED_TOOL_CALLS) {
|
|
82753
|
+
const oldest = this.#calls.keys().next();
|
|
82754
|
+
if (oldest.done !== true) {
|
|
82755
|
+
this.#calls.delete(oldest.value);
|
|
82756
|
+
}
|
|
82757
|
+
}
|
|
82758
|
+
};
|
|
82759
|
+
/** Applies a partial update to what was announced for the same tool call. */
|
|
82760
|
+
describe = (update) => {
|
|
82761
|
+
const announced = this.#calls.get(update.toolCallId);
|
|
82762
|
+
return {
|
|
82763
|
+
title: update.title ?? announced?.title,
|
|
82764
|
+
kind: update.kind ?? announced?.kind,
|
|
82765
|
+
rawInput: update.rawInput ?? announced?.rawInput,
|
|
82766
|
+
locations: update.locations ?? announced?.locations
|
|
82767
|
+
};
|
|
82768
|
+
};
|
|
82769
|
+
clear = () => {
|
|
82770
|
+
this.#calls.clear();
|
|
82771
|
+
};
|
|
82772
|
+
};
|
|
82773
|
+
|
|
82715
82774
|
// src/acp/runtime-operations.ts
|
|
82716
82775
|
var RuntimeOperations = class {
|
|
82717
82776
|
#shutdown = new AbortController();
|
|
@@ -83498,15 +83557,21 @@ var AcpSessionInteractions = class {
|
|
|
83498
83557
|
};
|
|
83499
83558
|
signal.addEventListener("abort", abort, { once: true });
|
|
83500
83559
|
try {
|
|
83560
|
+
const toolCall = this.#context.describeToolCall(request.toolCall);
|
|
83501
83561
|
await this.#notifyPermissionRequested({
|
|
83502
83562
|
commandId: this.#context.commandId(),
|
|
83563
|
+
details: {
|
|
83564
|
+
cwd: this.#context.cwd(),
|
|
83565
|
+
rawInput: toolCall.rawInput,
|
|
83566
|
+
locations: toolCall.locations ?? []
|
|
83567
|
+
},
|
|
83503
83568
|
interactionId,
|
|
83504
83569
|
kind: SESSION_PERMISSION_REQUESTED_KIND,
|
|
83505
83570
|
options,
|
|
83506
83571
|
sessionId: this.#context.sessionId(),
|
|
83507
|
-
title: truncate2(
|
|
83572
|
+
title: truncate2(toolCall.title ?? "Permission required", 500),
|
|
83508
83573
|
toolCallId: truncate2(request.toolCall.toolCallId, 255),
|
|
83509
|
-
toolKind: truncate2(
|
|
83574
|
+
toolKind: truncate2(toolCall.kind ?? "other", 64)
|
|
83510
83575
|
});
|
|
83511
83576
|
return await pending.completion.promise;
|
|
83512
83577
|
} finally {
|
|
@@ -89168,6 +89233,7 @@ var AgentSession = class _AgentSession {
|
|
|
89168
89233
|
#connection;
|
|
89169
89234
|
#contentExternalizer;
|
|
89170
89235
|
#interactions;
|
|
89236
|
+
#announcedToolCalls = new AnnouncedToolCalls();
|
|
89171
89237
|
#additionalDirectories;
|
|
89172
89238
|
#agentId;
|
|
89173
89239
|
#cwd;
|
|
@@ -89208,6 +89274,8 @@ var AgentSession = class _AgentSession {
|
|
|
89208
89274
|
this.#store = store;
|
|
89209
89275
|
this.#verifiedAgentVersion = agent.agentVersion;
|
|
89210
89276
|
this.#interactions = new AcpSessionInteractions({
|
|
89277
|
+
cwd: () => this.#cwd,
|
|
89278
|
+
describeToolCall: this.#announcedToolCalls.describe,
|
|
89211
89279
|
sessionId: () => this.#mobiusSessionId,
|
|
89212
89280
|
commandId: () => this.#turn.commandId,
|
|
89213
89281
|
assertNativeSession: (sessionId) => this.assertNativeSession(sessionId),
|
|
@@ -89931,6 +89999,7 @@ var AgentSession = class _AgentSession {
|
|
|
89931
89999
|
throw failure2;
|
|
89932
90000
|
} finally {
|
|
89933
90001
|
this.#turn = new IdleAcpTurn();
|
|
90002
|
+
this.#announcedToolCalls.clear();
|
|
89934
90003
|
}
|
|
89935
90004
|
};
|
|
89936
90005
|
steer = async (options) => {
|
|
@@ -90037,7 +90106,12 @@ var AgentSession = class _AgentSession {
|
|
|
90037
90106
|
};
|
|
90038
90107
|
respondPermission = (options) => this.#interactions.respondPermission(options);
|
|
90039
90108
|
respondElicitation = (options) => this.#interactions.respondElicitation(options);
|
|
90040
|
-
onPermission = (request, signal) =>
|
|
90109
|
+
onPermission = async (request, signal) => {
|
|
90110
|
+
await yieldToRuntime2(void 0, { signal });
|
|
90111
|
+
await this.#updates.drained();
|
|
90112
|
+
signal.throwIfAborted();
|
|
90113
|
+
return await this.#interactions.onPermission(request, signal);
|
|
90114
|
+
};
|
|
90041
90115
|
onElicitation = (request, signal) => this.#interactions.onElicitation(request, signal);
|
|
90042
90116
|
onElicitationComplete = (notification) => this.#interactions.onElicitationComplete(notification);
|
|
90043
90117
|
onUpdate = (notification) => this.#updates.receive(notification);
|
|
@@ -90079,6 +90153,9 @@ var AgentSession = class _AgentSession {
|
|
|
90079
90153
|
if (this.#sessionLoad.kind === "capturing" && (update.sessionUpdate === "user_message_chunk" || update.sessionUpdate === "agent_message_chunk" || update.sessionUpdate === "agent_thought_chunk" || update.sessionUpdate === "tool_call" || update.sessionUpdate === "tool_call_update" || update.sessionUpdate === "plan" || update.sessionUpdate === "plan_update" || update.sessionUpdate === "plan_removed")) {
|
|
90080
90154
|
return;
|
|
90081
90155
|
}
|
|
90156
|
+
if (update.sessionUpdate === "tool_call" || update.sessionUpdate === "tool_call_update") {
|
|
90157
|
+
this.#announcedToolCalls.record(update);
|
|
90158
|
+
}
|
|
90082
90159
|
if (update.sessionUpdate === "available_commands_update") {
|
|
90083
90160
|
const commands = update.availableCommands.slice(0, 500).map((command) => ({
|
|
90084
90161
|
description: truncate2(command.description, 500),
|
|
@@ -90442,10 +90519,13 @@ var AgentRuntimeManager = class {
|
|
|
90442
90519
|
#agentSettingsObserver = new NullAcpSessionObserver();
|
|
90443
90520
|
#nativeOperations = /* @__PURE__ */ new Set();
|
|
90444
90521
|
#sessionClosures = /* @__PURE__ */ new Map();
|
|
90522
|
+
/** Sessions that were closed and not reopened since. Only a prepare or restore of the Session reopens it. */
|
|
90523
|
+
#closedSessions = /* @__PURE__ */ new Set();
|
|
90445
90524
|
#store;
|
|
90446
90525
|
#adapters;
|
|
90447
90526
|
#sessionIdentity;
|
|
90448
90527
|
#onSessionStatusChanged;
|
|
90528
|
+
#onSessionClosed;
|
|
90449
90529
|
#contentExternalizer;
|
|
90450
90530
|
#timer;
|
|
90451
90531
|
#observer;
|
|
@@ -90455,6 +90535,7 @@ var AgentRuntimeManager = class {
|
|
|
90455
90535
|
adapters,
|
|
90456
90536
|
sessionIdentity,
|
|
90457
90537
|
onSessionStatusChanged,
|
|
90538
|
+
onSessionClosed = () => void 0,
|
|
90458
90539
|
contentExternalizer,
|
|
90459
90540
|
timer,
|
|
90460
90541
|
maxProcesses
|
|
@@ -90465,6 +90546,7 @@ var AgentRuntimeManager = class {
|
|
|
90465
90546
|
this.#adapters = adapters;
|
|
90466
90547
|
this.#sessionIdentity = sessionIdentity;
|
|
90467
90548
|
this.#onSessionStatusChanged = onSessionStatusChanged;
|
|
90549
|
+
this.#onSessionClosed = onSessionClosed;
|
|
90468
90550
|
this.#contentExternalizer = contentExternalizer;
|
|
90469
90551
|
this.#timer = timer;
|
|
90470
90552
|
this.#queryProcesses = new AgentQueryProcesses(this.#processes, contentExternalizer);
|
|
@@ -90502,6 +90584,34 @@ var AgentRuntimeManager = class {
|
|
|
90502
90584
|
}
|
|
90503
90585
|
}
|
|
90504
90586
|
}
|
|
90587
|
+
/**
|
|
90588
|
+
* Stops the process of a Session that is being closed. Unlike retiring it, this keeps the stored Session,
|
|
90589
|
+
* so the closed Session stays listed with its title and settings and can be reopened.
|
|
90590
|
+
*/
|
|
90591
|
+
async #stopSessionProcess(sessionId, runtime) {
|
|
90592
|
+
this.#executionProcesses.detach(sessionId, runtime);
|
|
90593
|
+
await this.#processes.retire(runtime, () => runtime.close());
|
|
90594
|
+
}
|
|
90595
|
+
#isKnownSession(sessionId) {
|
|
90596
|
+
return this.#executionProcesses.get(sessionId) !== void 0 || this.#executionProcesses.pending(sessionId) !== void 0 || this.#store.read(sessionId) instanceof FoundAcpStoredSession;
|
|
90597
|
+
}
|
|
90598
|
+
/**
|
|
90599
|
+
* Marks a Session closed and tells every client why, once for each closing. Clients show `reason` to their
|
|
90600
|
+
* users as is. Unknown Sessions have nothing to close.
|
|
90601
|
+
*/
|
|
90602
|
+
#announceClosed(sessionId, reason) {
|
|
90603
|
+
if (this.#closedSessions.has(sessionId) || !this.#isKnownSession(sessionId)) {
|
|
90604
|
+
return;
|
|
90605
|
+
}
|
|
90606
|
+
this.#closedSessions.add(sessionId);
|
|
90607
|
+
this.#onSessionClosed({ kind: SESSION_CLOSE_NOTICE_KIND, reason, sessionId });
|
|
90608
|
+
}
|
|
90609
|
+
/** A closed Session fails the operations that would silently reopen it, so a client learns that its view is stale. */
|
|
90610
|
+
#assertOpen(sessionId) {
|
|
90611
|
+
if (this.#closedSessions.has(sessionId)) {
|
|
90612
|
+
throw new AcpExecutionError("The Session is closed; reopen it to continue", {}, SESSION_CLOSED_ERROR_CODE);
|
|
90613
|
+
}
|
|
90614
|
+
}
|
|
90505
90615
|
async #startRetainedSessionProcess(options, start) {
|
|
90506
90616
|
const runtime = await this.#processes.startRetained(options.signal, start, this.#retention(options.sessionId));
|
|
90507
90617
|
this.#executionProcesses.retain(options.sessionId, runtime);
|
|
@@ -90595,12 +90705,17 @@ var AgentRuntimeManager = class {
|
|
|
90595
90705
|
return runtime;
|
|
90596
90706
|
});
|
|
90597
90707
|
}
|
|
90598
|
-
async #prepareSession(options, recovery, metrics = unmeasuredOperationMetrics) {
|
|
90708
|
+
async #prepareSession(options, recovery, closed, metrics = unmeasuredOperationMetrics) {
|
|
90599
90709
|
return await this.#operations.run(options, async (options2) => {
|
|
90600
90710
|
const closing = this.#sessionClosures.get(options2.sessionId);
|
|
90601
90711
|
if (closing !== void 0) {
|
|
90602
90712
|
await waitForSharedOperation(closing, options2.signal);
|
|
90603
90713
|
}
|
|
90714
|
+
if (closed === "reopen") {
|
|
90715
|
+
this.#closedSessions.delete(options2.sessionId);
|
|
90716
|
+
} else {
|
|
90717
|
+
this.#assertOpen(options2.sessionId);
|
|
90718
|
+
}
|
|
90604
90719
|
const stored = metrics.measureSync("session-state-read", () => this.#store.read(options2.sessionId));
|
|
90605
90720
|
if (stored instanceof FoundAcpStoredSession && this.#nativeOperations.has(`${stored.session.agentId}:${stored.session.nativeSessionId}`)) {
|
|
90606
90721
|
throw new AcpExecutionError("The native session is being managed", {}, "session_busy");
|
|
@@ -90621,7 +90736,7 @@ var AgentRuntimeManager = class {
|
|
|
90621
90736
|
}
|
|
90622
90737
|
return runtime2.prepared();
|
|
90623
90738
|
}
|
|
90624
|
-
return await this.#prepareSession(options2, recovery, metrics);
|
|
90739
|
+
return await this.#prepareSession(options2, recovery, closed, metrics);
|
|
90625
90740
|
}
|
|
90626
90741
|
const existing = this.#executionProcesses.get(options2.sessionId);
|
|
90627
90742
|
if (existing !== void 0) {
|
|
@@ -90649,8 +90764,8 @@ var AgentRuntimeManager = class {
|
|
|
90649
90764
|
return runtime.prepared();
|
|
90650
90765
|
});
|
|
90651
90766
|
}
|
|
90652
|
-
prepareSession = async (options, metrics = unmeasuredOperationMetrics) => await this.#prepareSession(options, { kind: "interactive-only" }, metrics);
|
|
90653
|
-
restoreSession = async (options, metrics = unmeasuredOperationMetrics) => await this.#prepareSession(options, { kind: "history-required" }, metrics);
|
|
90767
|
+
prepareSession = async (options, metrics = unmeasuredOperationMetrics, closed = "reopen") => await this.#prepareSession(options, { kind: "interactive-only" }, closed, metrics);
|
|
90768
|
+
restoreSession = async (options, metrics = unmeasuredOperationMetrics, closed = "reopen") => await this.#prepareSession(options, { kind: "history-required" }, closed, metrics);
|
|
90654
90769
|
/**
|
|
90655
90770
|
* Opens a short-lived native ACP session only to read the local Agent's
|
|
90656
90771
|
* authoritative settings. Its identity and store are private to this
|
|
@@ -90721,6 +90836,7 @@ var AgentRuntimeManager = class {
|
|
|
90721
90836
|
});
|
|
90722
90837
|
});
|
|
90723
90838
|
prepareExecutionSession = async (options) => this.#operations.run(options, async (options2) => {
|
|
90839
|
+
this.#assertOpen(options2.sessionId);
|
|
90724
90840
|
const pending = this.#executionProcesses.pending(options2.sessionId);
|
|
90725
90841
|
if (pending !== void 0) {
|
|
90726
90842
|
await waitForSharedOperation(pending, options2.signal);
|
|
@@ -90758,6 +90874,7 @@ var AgentRuntimeManager = class {
|
|
|
90758
90874
|
});
|
|
90759
90875
|
});
|
|
90760
90876
|
renameSession = async (sessionId, title2, signal) => await this.#operations.run({ sessionId, signal }, async (options) => {
|
|
90877
|
+
this.#assertOpen(options.sessionId);
|
|
90761
90878
|
const runtime = this.#executionProcesses.get(options.sessionId);
|
|
90762
90879
|
if (runtime !== void 0) {
|
|
90763
90880
|
return await runtime.renameSession(title2, options.signal);
|
|
@@ -90833,6 +90950,7 @@ var AgentRuntimeManager = class {
|
|
|
90833
90950
|
}
|
|
90834
90951
|
});
|
|
90835
90952
|
runPrompt = async (options) => this.#operations.run(options, async (options2) => {
|
|
90953
|
+
this.#assertOpen(options2.sessionId);
|
|
90836
90954
|
const stored = this.#store.read(options2.sessionId);
|
|
90837
90955
|
if (stored instanceof FoundAcpStoredSession && this.#nativeOperations.has(`${stored.session.agentId}:${stored.session.nativeSessionId}`)) {
|
|
90838
90956
|
throw new AcpExecutionError("The native session is being managed", {}, "session_busy");
|
|
@@ -90901,6 +91019,7 @@ var AgentRuntimeManager = class {
|
|
|
90901
91019
|
}
|
|
90902
91020
|
});
|
|
90903
91021
|
respondPermission = async (options) => {
|
|
91022
|
+
this.#assertOpen(options.sessionId);
|
|
90904
91023
|
const runtime = this.#executionProcesses.get(options.sessionId);
|
|
90905
91024
|
if (runtime === void 0) {
|
|
90906
91025
|
throw new AcpExecutionError("The permission request session is unavailable", {}, "session_not_found");
|
|
@@ -90908,6 +91027,7 @@ var AgentRuntimeManager = class {
|
|
|
90908
91027
|
await runtime.respondPermission(options);
|
|
90909
91028
|
};
|
|
90910
91029
|
respondElicitation = async (options) => {
|
|
91030
|
+
this.#assertOpen(options.sessionId);
|
|
90911
91031
|
const runtime = this.#executionProcesses.get(options.sessionId);
|
|
90912
91032
|
if (runtime === void 0) {
|
|
90913
91033
|
throw new AcpExecutionError("The elicitation request session is unavailable", {}, "session_not_found");
|
|
@@ -90920,11 +91040,12 @@ var AgentRuntimeManager = class {
|
|
|
90920
91040
|
await waitForSharedOperation(existing, options.signal);
|
|
90921
91041
|
return;
|
|
90922
91042
|
}
|
|
91043
|
+
this.#announceClosed(options.sessionId, "This Session was closed on request.");
|
|
90923
91044
|
const release = (async () => {
|
|
90924
91045
|
const pending = this.#executionProcesses.pending(options.sessionId);
|
|
90925
91046
|
const runtime = pending === void 0 ? this.#executionProcesses.get(options.sessionId) : await pending;
|
|
90926
91047
|
if (runtime !== void 0) {
|
|
90927
|
-
await this.#
|
|
91048
|
+
await this.#stopSessionProcess(options.sessionId, runtime);
|
|
90928
91049
|
}
|
|
90929
91050
|
})();
|
|
90930
91051
|
const deadline = Promise.withResolvers();
|
|
@@ -91006,6 +91127,7 @@ var AgentRuntimeManager = class {
|
|
|
91006
91127
|
});
|
|
91007
91128
|
});
|
|
91008
91129
|
ensureSession = async (options) => this.#operations.run(options, async (options2) => {
|
|
91130
|
+
this.#assertOpen(options2.sessionId);
|
|
91009
91131
|
const existing = this.#executionProcesses.get(options2.sessionId);
|
|
91010
91132
|
if (existing !== void 0) {
|
|
91011
91133
|
if (!existing.belongsTo(options2.agent.id, options2.cwd, options2.additionalDirectories)) {
|
|
@@ -91084,6 +91206,7 @@ var AgentRuntimeManager = class {
|
|
|
91084
91206
|
const existing = linked[0];
|
|
91085
91207
|
if (origin.kind === "import" && existing !== void 0) {
|
|
91086
91208
|
return await this.#executionProcesses.use(existing.sessionId, async () => {
|
|
91209
|
+
this.#closedSessions.delete(existing.sessionId);
|
|
91087
91210
|
const runtime = await this.ensureSession({
|
|
91088
91211
|
...options2,
|
|
91089
91212
|
sessionId: existing.sessionId
|
|
@@ -92489,12 +92612,11 @@ var RelayConnectionDiagnostics = class {
|
|
|
92489
92612
|
false
|
|
92490
92613
|
);
|
|
92491
92614
|
};
|
|
92492
|
-
heartbeatTimedOut = (connectionEpoch,
|
|
92615
|
+
heartbeatTimedOut = (connectionEpoch, timeoutMilliseconds) => {
|
|
92493
92616
|
this.#record(
|
|
92494
92617
|
"relay_heartbeat_timed_out",
|
|
92495
92618
|
{
|
|
92496
92619
|
connectionEpoch: connectionEpoch.toString(),
|
|
92497
|
-
heartbeatId,
|
|
92498
92620
|
relayOrigin: this.#relayOrigin,
|
|
92499
92621
|
timeoutMilliseconds: timeoutMilliseconds.toString(),
|
|
92500
92622
|
...this.#route
|
|
@@ -93546,8 +93668,8 @@ var ResolvedSessionDirectories = class {
|
|
|
93546
93668
|
this.cwd = cwd;
|
|
93547
93669
|
}
|
|
93548
93670
|
};
|
|
93549
|
-
async function resolveSessionDirectories(directories, bindingId,
|
|
93550
|
-
const cwd = await directories.resolve(bindingId,
|
|
93671
|
+
async function resolveSessionDirectories(directories, bindingId, directoryId, additionalDirectoryIds, signal) {
|
|
93672
|
+
const cwd = await directories.resolve(bindingId, directoryId, signal);
|
|
93551
93673
|
const additionalDirectories = [];
|
|
93552
93674
|
const additionalDirectoryEntries = [];
|
|
93553
93675
|
const unique = /* @__PURE__ */ new Set([cwd]);
|
|
@@ -93571,7 +93693,7 @@ async function resolveCatalogAgent(config2, agentId, signal) {
|
|
|
93571
93693
|
const agent = config2.catalog.find(agentId);
|
|
93572
93694
|
return config2.resolveAgent === void 0 ? agent : await config2.resolveAgent(agent, signal);
|
|
93573
93695
|
}
|
|
93574
|
-
async function prepareSession(command, recovery, config2, directories, sessions, metrics, signal) {
|
|
93696
|
+
async function prepareSession(command, recovery, closed, config2, directories, sessions, metrics, signal) {
|
|
93575
93697
|
return await metrics.measure("prepare-total", async () => {
|
|
93576
93698
|
const resolved = await metrics.measure(
|
|
93577
93699
|
"workspace-resolve",
|
|
@@ -93591,7 +93713,7 @@ async function prepareSession(command, recovery, config2, directories, sessions,
|
|
|
93591
93713
|
sessionId: command.sessionId,
|
|
93592
93714
|
signal
|
|
93593
93715
|
};
|
|
93594
|
-
const prepared = command.transient === true ? await sessions.inspectSession(preparation, metrics) : recovery.kind === "history-required" ? await sessions.restoreSession(preparation, metrics) : await sessions.prepareSession(preparation, metrics);
|
|
93716
|
+
const prepared = command.transient === true ? await sessions.inspectSession(preparation, metrics) : recovery.kind === "history-required" ? await sessions.restoreSession(preparation, metrics, closed) : await sessions.prepareSession(preparation, metrics, closed);
|
|
93595
93717
|
const configuration = command.configuration;
|
|
93596
93718
|
const configOptions = configuration === void 0 ? prepared.configOptions : await metrics.measure(
|
|
93597
93719
|
"configuration",
|
|
@@ -93647,6 +93769,7 @@ async function executeSessionPrepare(socket, command, config2, directories, sess
|
|
|
93647
93769
|
const readyEvent = await prepareSession(
|
|
93648
93770
|
command,
|
|
93649
93771
|
{ kind: "interactive-only" },
|
|
93772
|
+
"reopen",
|
|
93650
93773
|
config2,
|
|
93651
93774
|
directories,
|
|
93652
93775
|
sessions,
|
|
@@ -93693,6 +93816,7 @@ async function executeSessionRestore(socket, command, config2, directories, sess
|
|
|
93693
93816
|
sessionState: "provisioned"
|
|
93694
93817
|
},
|
|
93695
93818
|
{ kind: "history-required" },
|
|
93819
|
+
"reopen",
|
|
93696
93820
|
config2,
|
|
93697
93821
|
directories,
|
|
93698
93822
|
sessions,
|
|
@@ -93863,6 +93987,8 @@ async function executeSessionConfigRead(socket, command, config2, directories, s
|
|
|
93863
93987
|
// load support would fail even with a live process whose config is
|
|
93864
93988
|
// already readable, and prepare reuses the current configuration.
|
|
93865
93989
|
{ kind: "interactive-only" },
|
|
93990
|
+
// Reading settings must not reopen a Session that a client closed.
|
|
93991
|
+
"keep-closed",
|
|
93866
93992
|
config2,
|
|
93867
93993
|
directories,
|
|
93868
93994
|
sessions,
|
|
@@ -94980,7 +95106,6 @@ function connectRelay(url2, signal) {
|
|
|
94980
95106
|
}
|
|
94981
95107
|
|
|
94982
95108
|
// src/runtime/relay/liveness.ts
|
|
94983
|
-
import { randomUUID as randomUUID16 } from "node:crypto";
|
|
94984
95109
|
var HEARTBEAT_ACK_TIMEOUT_MILLISECONDS = 1e4;
|
|
94985
95110
|
var HEARTBEAT_INTERVAL_MILLISECONDS = 2e4;
|
|
94986
95111
|
var RelayLivenessState = class {
|
|
@@ -94988,11 +95113,9 @@ var RelayLivenessState = class {
|
|
|
94988
95113
|
var UnsupportedRelayLivenessState = class extends RelayLivenessState {
|
|
94989
95114
|
};
|
|
94990
95115
|
var AwaitingHeartbeatAckState = class extends RelayLivenessState {
|
|
94991
|
-
heartbeatId;
|
|
94992
95116
|
timeout;
|
|
94993
|
-
constructor(
|
|
95117
|
+
constructor(timeout) {
|
|
94994
95118
|
super();
|
|
94995
|
-
this.heartbeatId = heartbeatId;
|
|
94996
95119
|
this.timeout = timeout;
|
|
94997
95120
|
}
|
|
94998
95121
|
};
|
|
@@ -95013,13 +95136,10 @@ var RelayConnectionLiveness = class {
|
|
|
95013
95136
|
this.#timer = timer;
|
|
95014
95137
|
this.#transport = transport;
|
|
95015
95138
|
}
|
|
95016
|
-
acknowledge = (
|
|
95139
|
+
acknowledge = () => {
|
|
95017
95140
|
if (!(this.#state instanceof AwaitingHeartbeatAckState)) {
|
|
95018
95141
|
throw new Error("Unexpected relay heartbeat acknowledgement");
|
|
95019
95142
|
}
|
|
95020
|
-
if (event.heartbeatId !== this.#state.heartbeatId) {
|
|
95021
|
-
throw new Error("Relay acknowledged the wrong heartbeat");
|
|
95022
|
-
}
|
|
95023
95143
|
this.#state.timeout.cancel();
|
|
95024
95144
|
this.#state = new WaitingForHeartbeatState(
|
|
95025
95145
|
this.#timer.schedule(this.#sendHeartbeat, HEARTBEAT_INTERVAL_MILLISECONDS)
|
|
@@ -95055,10 +95175,9 @@ var RelayConnectionLiveness = class {
|
|
|
95055
95175
|
if (!(this.#state instanceof AwaitingHeartbeatAckState)) {
|
|
95056
95176
|
throw new Error("Heartbeat timeout occurred in an invalid state");
|
|
95057
95177
|
}
|
|
95058
|
-
const heartbeatId = this.#state.heartbeatId;
|
|
95059
95178
|
this.#state.timeout.cancel();
|
|
95060
95179
|
this.#state = new FinishedRelayLivenessState();
|
|
95061
|
-
this.#transport.unresponsive(
|
|
95180
|
+
this.#transport.unresponsive(HEARTBEAT_ACK_TIMEOUT_MILLISECONDS);
|
|
95062
95181
|
};
|
|
95063
95182
|
#sendHeartbeat = () => {
|
|
95064
95183
|
if (this.#state instanceof WaitingForHeartbeatState) {
|
|
@@ -95069,17 +95188,13 @@ var RelayConnectionLiveness = class {
|
|
|
95069
95188
|
}
|
|
95070
95189
|
throw new Error("Heartbeat was scheduled in an invalid state");
|
|
95071
95190
|
}
|
|
95072
|
-
const
|
|
95073
|
-
this.#state = new AwaitingHeartbeatAckState(
|
|
95074
|
-
heartbeatId,
|
|
95191
|
+
const awaiting = new AwaitingHeartbeatAckState(
|
|
95075
95192
|
this.#timer.schedule(this.#handleTimeout, HEARTBEAT_ACK_TIMEOUT_MILLISECONDS)
|
|
95076
95193
|
);
|
|
95077
|
-
|
|
95078
|
-
|
|
95079
|
-
|
|
95080
|
-
|
|
95081
|
-
if (!sent && this.#state instanceof AwaitingHeartbeatAckState && this.#state.heartbeatId === heartbeatId) {
|
|
95082
|
-
this.#state.timeout.cancel();
|
|
95194
|
+
this.#state = awaiting;
|
|
95195
|
+
const sent = this.#transport.send({ kind: RUNTIME_HEARTBEAT_KIND });
|
|
95196
|
+
if (!sent && this.#state === awaiting) {
|
|
95197
|
+
awaiting.timeout.cancel();
|
|
95083
95198
|
this.#state = new FinishedRelayLivenessState();
|
|
95084
95199
|
}
|
|
95085
95200
|
};
|
|
@@ -95226,8 +95341,8 @@ async function runRelayConnection({
|
|
|
95226
95341
|
throw error62;
|
|
95227
95342
|
}
|
|
95228
95343
|
},
|
|
95229
|
-
unresponsive: (
|
|
95230
|
-
diagnostics.heartbeatTimedOut(connectionEpoch,
|
|
95344
|
+
unresponsive: (timeoutMilliseconds) => {
|
|
95345
|
+
diagnostics.heartbeatTimedOut(connectionEpoch, timeoutMilliseconds);
|
|
95231
95346
|
diagnostics.connectionClosed(
|
|
95232
95347
|
connectionEpoch,
|
|
95233
95348
|
4001,
|
|
@@ -95278,7 +95393,7 @@ async function runRelayConnection({
|
|
|
95278
95393
|
return;
|
|
95279
95394
|
}
|
|
95280
95395
|
if (kind === RUNTIME_HEARTBEAT_ACK_KIND) {
|
|
95281
|
-
connectionLiveness.acknowledge(
|
|
95396
|
+
connectionLiveness.acknowledge();
|
|
95282
95397
|
return;
|
|
95283
95398
|
}
|
|
95284
95399
|
commands.dispatch(message);
|
|
@@ -95361,6 +95476,7 @@ var RuntimeSessionEventPublisher = class {
|
|
|
95361
95476
|
};
|
|
95362
95477
|
publishStatus = (event) => this.#send(event);
|
|
95363
95478
|
publishInfo = (event) => this.#send(event);
|
|
95479
|
+
publishClosed = (event) => this.#send(event);
|
|
95364
95480
|
#send = (message) => {
|
|
95365
95481
|
const socket = this.#socket;
|
|
95366
95482
|
if (socket === null || socket.readyState !== WebSocket8.OPEN) {
|
|
@@ -95600,7 +95716,7 @@ var RuntimeSessionEventProjection = class {
|
|
|
95600
95716
|
};
|
|
95601
95717
|
|
|
95602
95718
|
// src/runtime/session/turn/active-turn.ts
|
|
95603
|
-
import { randomUUID as
|
|
95719
|
+
import { randomUUID as randomUUID16 } from "node:crypto";
|
|
95604
95720
|
var ActiveRuntimeTurn = class {
|
|
95605
95721
|
attemptId;
|
|
95606
95722
|
command;
|
|
@@ -95610,7 +95726,7 @@ var ActiveRuntimeTurn = class {
|
|
|
95610
95726
|
#dispatch;
|
|
95611
95727
|
#sequence = 0;
|
|
95612
95728
|
#interaction = null;
|
|
95613
|
-
#epoch = decodeIdentifier(
|
|
95729
|
+
#epoch = decodeIdentifier(randomUUID16());
|
|
95614
95730
|
constructor(command, attemptId) {
|
|
95615
95731
|
this.attemptId = attemptId;
|
|
95616
95732
|
this.command = command;
|
|
@@ -95892,8 +96008,8 @@ var WorkspaceDirectoryListing = class {
|
|
|
95892
96008
|
directoryLabel;
|
|
95893
96009
|
entries;
|
|
95894
96010
|
parentDirectoryId;
|
|
95895
|
-
constructor(
|
|
95896
|
-
this.directoryId =
|
|
96011
|
+
constructor(directoryId, directoryLabel, entries, parentDirectoryId) {
|
|
96012
|
+
this.directoryId = directoryId;
|
|
95897
96013
|
this.directoryLabel = directoryLabel;
|
|
95898
96014
|
this.entries = entries;
|
|
95899
96015
|
this.parentDirectoryId = parentDirectoryId;
|
|
@@ -95901,7 +96017,7 @@ var WorkspaceDirectoryListing = class {
|
|
|
95901
96017
|
};
|
|
95902
96018
|
function encodePath(path8) {
|
|
95903
96019
|
const encoded = Buffer.from(path8, "utf8").toString("base64url");
|
|
95904
|
-
if (
|
|
96020
|
+
if (path8.length === 0 || path8.length > MAX_WORKSPACE_PATH_LENGTH || encoded.length + "path-".length > MAX_DIRECTORY_IDENTIFIER_LENGTH) {
|
|
95905
96021
|
throw new LocalAuthorizationError("The local directory path is too long to select");
|
|
95906
96022
|
}
|
|
95907
96023
|
return `path-${encoded}`;
|
|
@@ -95911,12 +96027,12 @@ function expandCurrentUserHome(path8) {
|
|
|
95911
96027
|
}
|
|
95912
96028
|
function decodePath(value, prefix) {
|
|
95913
96029
|
const encoded = value.slice(prefix.length);
|
|
95914
|
-
if (encoded.length === 0 ||
|
|
96030
|
+
if (encoded.length === 0 || value.length > MAX_DIRECTORY_IDENTIFIER_LENGTH || !/^[a-zA-Z0-9_-]+$/.test(encoded)) {
|
|
95915
96031
|
throw new LocalAuthorizationError("The directory identifier is invalid");
|
|
95916
96032
|
}
|
|
95917
96033
|
const decoded = Buffer.from(encoded, "base64url").toString("utf8");
|
|
95918
96034
|
const normalized = process.platform === "win32" && decoded.startsWith("~/") ? normalize3(decoded).replaceAll("\\", "/") : normalize3(decoded);
|
|
95919
|
-
if (Buffer.from(decoded, "utf8").toString("base64url") !== encoded || decoded.includes("\0") || normalized !== decoded) {
|
|
96035
|
+
if (Buffer.from(decoded, "utf8").toString("base64url") !== encoded || decoded.length > MAX_WORKSPACE_PATH_LENGTH || decoded.includes("\0") || normalized !== decoded) {
|
|
95920
96036
|
throw new LocalAuthorizationError("The directory identifier is invalid");
|
|
95921
96037
|
}
|
|
95922
96038
|
return decoded;
|
|
@@ -96108,6 +96224,7 @@ async function runRuntime(config2, parentSignal, timer = systemTimer, options =
|
|
|
96108
96224
|
adapters: harnessAdapters,
|
|
96109
96225
|
sessionIdentity: "native",
|
|
96110
96226
|
onSessionStatusChanged: publisher.publishStatus,
|
|
96227
|
+
onSessionClosed: publisher.publishClosed,
|
|
96111
96228
|
contentExternalizer: new AcpContentExternalizer(externalContent),
|
|
96112
96229
|
timer,
|
|
96113
96230
|
maxProcesses: resolveMaxAcpProcesses(config2.localContext.environment)
|