@moxt-ai/mobius 0.0.277 → 0.0.279
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 +234 -108
- 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/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.js +234 -108
- package/dist/runtime.js.map +4 -4
- package/package.json +2 -2
package/dist/runtime.js
CHANGED
|
@@ -22239,6 +22239,66 @@ var encodeFileEndEvent = (message) => encodeZodMessage(message, fileEndEventSche
|
|
|
22239
22239
|
var decodeFileFailedEvent = (encoded) => decodeZodMessage(encoded, fileFailedEventSchema);
|
|
22240
22240
|
var encodeFileFailedEvent = (message) => encodeZodMessage(message, fileFailedEventSchema);
|
|
22241
22241
|
|
|
22242
|
+
// ../mobius-sdk/src/protocol/shared/tool-input.ts
|
|
22243
|
+
var MAX_CONTENT_LENGTH = 1e6;
|
|
22244
|
+
var MAX_COLLECTION_SIZE = 1e3;
|
|
22245
|
+
var MAX_JSON_DEPTH = 16;
|
|
22246
|
+
var MAX_JSON_KEYS = 1e3;
|
|
22247
|
+
var boundedString = external_exports.string().max(MAX_CONTENT_LENGTH);
|
|
22248
|
+
function boundedJsonIssue(value, depth = 0) {
|
|
22249
|
+
if (depth > MAX_JSON_DEPTH) {
|
|
22250
|
+
return "JSON nesting exceeds the maximum depth";
|
|
22251
|
+
}
|
|
22252
|
+
if (typeof value === "string") {
|
|
22253
|
+
return value.length <= MAX_CONTENT_LENGTH ? null : "JSON string exceeds the maximum length";
|
|
22254
|
+
}
|
|
22255
|
+
if (typeof value === "number") {
|
|
22256
|
+
return Number.isFinite(value) ? null : "JSON number must be finite";
|
|
22257
|
+
}
|
|
22258
|
+
if (typeof value === "boolean" || value === null) {
|
|
22259
|
+
return null;
|
|
22260
|
+
}
|
|
22261
|
+
if (Array.isArray(value)) {
|
|
22262
|
+
if (value.length > MAX_COLLECTION_SIZE) {
|
|
22263
|
+
return "JSON array exceeds the maximum length";
|
|
22264
|
+
}
|
|
22265
|
+
for (const item of value) {
|
|
22266
|
+
const issue2 = boundedJsonIssue(item, depth + 1);
|
|
22267
|
+
if (issue2 !== null) {
|
|
22268
|
+
return issue2;
|
|
22269
|
+
}
|
|
22270
|
+
}
|
|
22271
|
+
return null;
|
|
22272
|
+
}
|
|
22273
|
+
if (typeof value === "object" && value !== void 0) {
|
|
22274
|
+
const entries = Object.entries(value);
|
|
22275
|
+
if (entries.length > MAX_JSON_KEYS) {
|
|
22276
|
+
return "JSON object exceeds the maximum key count";
|
|
22277
|
+
}
|
|
22278
|
+
for (const [key, item] of entries) {
|
|
22279
|
+
if (key.length > 255) {
|
|
22280
|
+
return "JSON key exceeds the maximum length";
|
|
22281
|
+
}
|
|
22282
|
+
const issue2 = boundedJsonIssue(item, depth + 1);
|
|
22283
|
+
if (issue2 !== null) {
|
|
22284
|
+
return issue2;
|
|
22285
|
+
}
|
|
22286
|
+
}
|
|
22287
|
+
return null;
|
|
22288
|
+
}
|
|
22289
|
+
return "Value is not bounded JSON";
|
|
22290
|
+
}
|
|
22291
|
+
var boundedJsonSchema = external_exports.unknown().superRefine((value, context) => {
|
|
22292
|
+
const issue2 = boundedJsonIssue(value);
|
|
22293
|
+
if (issue2 !== null) {
|
|
22294
|
+
context.addIssue({ code: "custom", message: issue2 });
|
|
22295
|
+
}
|
|
22296
|
+
});
|
|
22297
|
+
var toolCallLocationSchema = external_exports.object({
|
|
22298
|
+
line: external_exports.number().int().nonnegative().safe().nullable().optional(),
|
|
22299
|
+
path: boundedString
|
|
22300
|
+
}).readonly();
|
|
22301
|
+
|
|
22242
22302
|
// ../mobius-sdk/src/protocol/session/interactions/index.ts
|
|
22243
22303
|
var SESSION_PERMISSION_REQUESTED_KIND = "session.permission.requested";
|
|
22244
22304
|
var SESSION_PERMISSION_RESPOND_KIND = "session.permission.respond";
|
|
@@ -22276,6 +22336,12 @@ var elicitationFieldSchema = external_exports.object({
|
|
|
22276
22336
|
}).readonly();
|
|
22277
22337
|
var sessionPermissionRequestedEventSchema = external_exports.object({
|
|
22278
22338
|
commandId: identifierStringSchema,
|
|
22339
|
+
// Absent only for events from older runtimes and saved history.
|
|
22340
|
+
details: external_exports.object({
|
|
22341
|
+
cwd: external_exports.string().min(1).max(4096),
|
|
22342
|
+
rawInput: boundedJsonSchema.optional(),
|
|
22343
|
+
locations: external_exports.array(toolCallLocationSchema).max(1e3).readonly()
|
|
22344
|
+
}).readonly().optional(),
|
|
22279
22345
|
interactionId: identifierStringSchema,
|
|
22280
22346
|
kind: external_exports.literal(SESSION_PERMISSION_REQUESTED_KIND),
|
|
22281
22347
|
options: external_exports.array(permissionOptionSchema).min(1).max(20).readonly(),
|
|
@@ -22339,6 +22405,8 @@ var SESSION_RESTORE_KIND = "session.restore";
|
|
|
22339
22405
|
var SESSION_RESTORED_KIND = "session.restored";
|
|
22340
22406
|
var SESSION_CLOSE_KIND = "session.close";
|
|
22341
22407
|
var SESSION_CLOSED_KIND = "session.closed";
|
|
22408
|
+
var SESSION_CLOSE_NOTICE_KIND = "session.close.notice";
|
|
22409
|
+
var SESSION_CLOSED_ERROR_CODE = "session_closed";
|
|
22342
22410
|
var SESSION_STATUS_CHANGED_KIND = "session.status.changed";
|
|
22343
22411
|
var SESSION_COMMANDS_UPDATED_KIND = "session.commands.updated";
|
|
22344
22412
|
var SESSION_INFO_UPDATED_KIND = "session.info.updated";
|
|
@@ -22444,6 +22512,11 @@ var sessionClosedEventSchema = external_exports.object({
|
|
|
22444
22512
|
requestId: identifierStringSchema,
|
|
22445
22513
|
sessionId: identifierStringSchema
|
|
22446
22514
|
}).readonly();
|
|
22515
|
+
var sessionCloseNoticeEventSchema = external_exports.object({
|
|
22516
|
+
kind: external_exports.literal(SESSION_CLOSE_NOTICE_KIND),
|
|
22517
|
+
reason: external_exports.string().min(1).max(500),
|
|
22518
|
+
sessionId: identifierStringSchema
|
|
22519
|
+
}).readonly();
|
|
22447
22520
|
var sessionCommandsUpdatedEventSchema = external_exports.object({
|
|
22448
22521
|
commands: external_exports.array(sessionCommandSchema).max(500).readonly(),
|
|
22449
22522
|
kind: external_exports.literal(SESSION_COMMANDS_UPDATED_KIND),
|
|
@@ -22480,6 +22553,8 @@ var decodeSessionCloseCommand = (encoded) => decodeZodMessage(encoded, sessionCl
|
|
|
22480
22553
|
var encodeSessionCloseCommand = (message) => encodeZodMessage(message, sessionCloseCommandSchema);
|
|
22481
22554
|
var decodeSessionClosedEvent = (encoded) => decodeZodMessage(encoded, sessionClosedEventSchema);
|
|
22482
22555
|
var encodeSessionClosedEvent = (message) => encodeZodMessage(message, sessionClosedEventSchema);
|
|
22556
|
+
var decodeSessionCloseNoticeEvent = (encoded) => decodeZodMessage(encoded, sessionCloseNoticeEventSchema);
|
|
22557
|
+
var encodeSessionCloseNoticeEvent = (message) => encodeZodMessage(message, sessionCloseNoticeEventSchema);
|
|
22483
22558
|
var decodeSessionStatusChangedEvent = (encoded) => decodeZodMessage(encoded, sessionStatusChangedEventSchema);
|
|
22484
22559
|
var encodeSessionStatusChangedEvent = (message) => encodeZodMessage(message, sessionStatusChangedEventSchema);
|
|
22485
22560
|
var decodeSessionPrepareCommand = (encoded) => decodeZodMessage(encoded, sessionPrepareCommandSchema);
|
|
@@ -22723,86 +22798,35 @@ var encodeNativeSessionCancel = (value) => JSON.stringify(nativeSessionCancelSch
|
|
|
22723
22798
|
|
|
22724
22799
|
// ../mobius-sdk/src/protocol/session/observability/event-log.ts
|
|
22725
22800
|
var MAX_EVENT_COUNT = 1e4;
|
|
22726
|
-
var
|
|
22727
|
-
var
|
|
22728
|
-
var MAX_JSON_DEPTH = 16;
|
|
22729
|
-
var MAX_JSON_KEYS = 1e3;
|
|
22801
|
+
var MAX_COLLECTION_SIZE2 = 1e3;
|
|
22802
|
+
var MAX_CONTENT_LENGTH2 = 1e6;
|
|
22730
22803
|
var SESSION_EVENT_KIND = "session.event.v2";
|
|
22731
22804
|
var SESSION_EVENT_BATCH_MAX_SIZE = 1e3;
|
|
22732
|
-
var
|
|
22805
|
+
var boundedString2 = external_exports.string().max(MAX_CONTENT_LENGTH2);
|
|
22733
22806
|
var shortString = external_exports.string().max(2048);
|
|
22734
22807
|
var externalContentKeySchema = external_exports.string().regex(/^[a-f0-9]{64}$/u);
|
|
22735
|
-
function boundedJsonIssue(value, depth = 0) {
|
|
22736
|
-
if (depth > MAX_JSON_DEPTH) {
|
|
22737
|
-
return "JSON nesting exceeds the maximum depth";
|
|
22738
|
-
}
|
|
22739
|
-
if (typeof value === "string") {
|
|
22740
|
-
return value.length <= MAX_CONTENT_LENGTH ? null : "JSON string exceeds the maximum length";
|
|
22741
|
-
}
|
|
22742
|
-
if (typeof value === "number") {
|
|
22743
|
-
return Number.isFinite(value) ? null : "JSON number must be finite";
|
|
22744
|
-
}
|
|
22745
|
-
if (typeof value === "boolean" || value === null) {
|
|
22746
|
-
return null;
|
|
22747
|
-
}
|
|
22748
|
-
if (Array.isArray(value)) {
|
|
22749
|
-
if (value.length > MAX_COLLECTION_SIZE) {
|
|
22750
|
-
return "JSON array exceeds the maximum length";
|
|
22751
|
-
}
|
|
22752
|
-
for (const item of value) {
|
|
22753
|
-
const issue2 = boundedJsonIssue(item, depth + 1);
|
|
22754
|
-
if (issue2 !== null) {
|
|
22755
|
-
return issue2;
|
|
22756
|
-
}
|
|
22757
|
-
}
|
|
22758
|
-
return null;
|
|
22759
|
-
}
|
|
22760
|
-
if (typeof value === "object" && value !== void 0) {
|
|
22761
|
-
const entries = Object.entries(value);
|
|
22762
|
-
if (entries.length > MAX_JSON_KEYS) {
|
|
22763
|
-
return "JSON object exceeds the maximum key count";
|
|
22764
|
-
}
|
|
22765
|
-
for (const [key, item] of entries) {
|
|
22766
|
-
if (key.length > 255) {
|
|
22767
|
-
return "JSON key exceeds the maximum length";
|
|
22768
|
-
}
|
|
22769
|
-
const issue2 = boundedJsonIssue(item, depth + 1);
|
|
22770
|
-
if (issue2 !== null) {
|
|
22771
|
-
return issue2;
|
|
22772
|
-
}
|
|
22773
|
-
}
|
|
22774
|
-
return null;
|
|
22775
|
-
}
|
|
22776
|
-
return "Value is not bounded JSON";
|
|
22777
|
-
}
|
|
22778
|
-
var boundedJsonSchema = external_exports.unknown().superRefine((value, context) => {
|
|
22779
|
-
const issue2 = boundedJsonIssue(value);
|
|
22780
|
-
if (issue2 !== null) {
|
|
22781
|
-
context.addIssue({ code: "custom", message: issue2 });
|
|
22782
|
-
}
|
|
22783
|
-
});
|
|
22784
22808
|
var annotationsSchema = external_exports.object({
|
|
22785
22809
|
audience: external_exports.array(external_exports.enum(["assistant", "user"])).max(2).readonly().nullable().optional(),
|
|
22786
22810
|
lastModified: shortString.nullable().optional(),
|
|
22787
22811
|
priority: external_exports.number().finite().nullable().optional()
|
|
22788
22812
|
}).readonly();
|
|
22789
22813
|
var contentFields = { annotations: annotationsSchema.nullable().optional() };
|
|
22790
|
-
var textContentSchema = external_exports.object({ ...contentFields, text:
|
|
22814
|
+
var textContentSchema = external_exports.object({ ...contentFields, text: boundedString2, type: external_exports.literal("text") }).readonly();
|
|
22791
22815
|
var imageContentSchema = external_exports.object({
|
|
22792
22816
|
...contentFields,
|
|
22793
|
-
data:
|
|
22817
|
+
data: boundedString2,
|
|
22794
22818
|
mimeType: shortString,
|
|
22795
22819
|
type: external_exports.literal("image"),
|
|
22796
|
-
uri:
|
|
22820
|
+
uri: boundedString2.nullable().optional()
|
|
22797
22821
|
}).readonly();
|
|
22798
|
-
var audioContentSchema = external_exports.object({ ...contentFields, data:
|
|
22822
|
+
var audioContentSchema = external_exports.object({ ...contentFields, data: boundedString2, mimeType: shortString, type: external_exports.literal("audio") }).readonly();
|
|
22799
22823
|
var externalImageContentSchema = external_exports.object({
|
|
22800
22824
|
...contentFields,
|
|
22801
22825
|
byteLength: external_exports.number().int().positive().safe(),
|
|
22802
22826
|
imageKey: externalContentKeySchema,
|
|
22803
22827
|
mimeType: shortString,
|
|
22804
22828
|
type: external_exports.literal("external_image"),
|
|
22805
|
-
uri:
|
|
22829
|
+
uri: boundedString2.nullable().optional()
|
|
22806
22830
|
}).readonly();
|
|
22807
22831
|
var externalAudioContentSchema = external_exports.object({
|
|
22808
22832
|
...contentFields,
|
|
@@ -22818,27 +22842,27 @@ var externalResourceContentSchema = external_exports.object({
|
|
|
22818
22842
|
mimeType: shortString.nullable().optional(),
|
|
22819
22843
|
resourceKey: externalContentKeySchema,
|
|
22820
22844
|
type: external_exports.literal("external_resource"),
|
|
22821
|
-
uri:
|
|
22845
|
+
uri: boundedString2
|
|
22822
22846
|
}).readonly();
|
|
22823
22847
|
var resourceLinkSchema = external_exports.object({
|
|
22824
22848
|
...contentFields,
|
|
22825
|
-
description:
|
|
22849
|
+
description: boundedString2.nullable().optional(),
|
|
22826
22850
|
mimeType: shortString.nullable().optional(),
|
|
22827
22851
|
name: shortString,
|
|
22828
22852
|
size: external_exports.number().int().nonnegative().safe().nullable().optional(),
|
|
22829
22853
|
title: shortString.nullable().optional(),
|
|
22830
22854
|
type: external_exports.literal("resource_link"),
|
|
22831
|
-
uri:
|
|
22855
|
+
uri: boundedString2
|
|
22832
22856
|
}).readonly();
|
|
22833
22857
|
var textResourceSchema = external_exports.object({
|
|
22834
22858
|
mimeType: shortString.nullable().optional(),
|
|
22835
|
-
text:
|
|
22836
|
-
uri:
|
|
22859
|
+
text: boundedString2,
|
|
22860
|
+
uri: boundedString2
|
|
22837
22861
|
}).readonly();
|
|
22838
22862
|
var blobResourceSchema = external_exports.object({
|
|
22839
|
-
blob:
|
|
22863
|
+
blob: boundedString2,
|
|
22840
22864
|
mimeType: shortString.nullable().optional(),
|
|
22841
|
-
uri:
|
|
22865
|
+
uri: boundedString2
|
|
22842
22866
|
}).readonly();
|
|
22843
22867
|
var embeddedResourceSchema = external_exports.object({
|
|
22844
22868
|
...contentFields,
|
|
@@ -22858,17 +22882,13 @@ var contentBlockSchema = external_exports.discriminatedUnion("type", [
|
|
|
22858
22882
|
var toolCallContentSchema = external_exports.discriminatedUnion("type", [
|
|
22859
22883
|
external_exports.object({ content: contentBlockSchema, type: external_exports.literal("content") }).readonly(),
|
|
22860
22884
|
external_exports.object({
|
|
22861
|
-
newText:
|
|
22862
|
-
oldText:
|
|
22863
|
-
path:
|
|
22885
|
+
newText: boundedString2,
|
|
22886
|
+
oldText: boundedString2.nullable().optional(),
|
|
22887
|
+
path: boundedString2,
|
|
22864
22888
|
type: external_exports.literal("diff")
|
|
22865
22889
|
}).readonly(),
|
|
22866
22890
|
external_exports.object({ terminalId: shortString, type: external_exports.literal("terminal") }).readonly()
|
|
22867
22891
|
]);
|
|
22868
|
-
var toolCallLocationSchema = external_exports.object({
|
|
22869
|
-
line: external_exports.number().int().nonnegative().safe().nullable().optional(),
|
|
22870
|
-
path: boundedString
|
|
22871
|
-
}).readonly();
|
|
22872
22892
|
var toolKindSchema = external_exports.enum([
|
|
22873
22893
|
"read",
|
|
22874
22894
|
"edit",
|
|
@@ -22883,51 +22903,51 @@ var toolKindSchema = external_exports.enum([
|
|
|
22883
22903
|
]);
|
|
22884
22904
|
var toolStatusSchema = external_exports.enum(["pending", "in_progress", "completed", "failed"]);
|
|
22885
22905
|
var toolPatchFields = {
|
|
22886
|
-
content: external_exports.array(toolCallContentSchema).max(
|
|
22906
|
+
content: external_exports.array(toolCallContentSchema).max(MAX_COLLECTION_SIZE2).readonly().nullable().optional(),
|
|
22887
22907
|
kind: toolKindSchema.nullable().optional(),
|
|
22888
|
-
locations: external_exports.array(toolCallLocationSchema).max(
|
|
22908
|
+
locations: external_exports.array(toolCallLocationSchema).max(MAX_COLLECTION_SIZE2).readonly().nullable().optional(),
|
|
22889
22909
|
name: shortString.nullable().optional(),
|
|
22890
22910
|
rawInput: boundedJsonSchema.optional(),
|
|
22891
22911
|
rawOutput: boundedJsonSchema.optional(),
|
|
22892
22912
|
status: toolStatusSchema.nullable().optional(),
|
|
22893
|
-
title:
|
|
22913
|
+
title: boundedString2.nullable().optional()
|
|
22894
22914
|
};
|
|
22895
22915
|
var planEntrySchema = external_exports.object({
|
|
22896
|
-
content:
|
|
22916
|
+
content: boundedString2,
|
|
22897
22917
|
priority: external_exports.enum(["high", "medium", "low"]),
|
|
22898
22918
|
status: external_exports.enum(["pending", "in_progress", "completed"])
|
|
22899
22919
|
}).readonly();
|
|
22900
22920
|
var planContentSchema = external_exports.discriminatedUnion("type", [
|
|
22901
22921
|
external_exports.object({
|
|
22902
|
-
entries: external_exports.array(planEntrySchema).max(
|
|
22922
|
+
entries: external_exports.array(planEntrySchema).max(MAX_COLLECTION_SIZE2).readonly(),
|
|
22903
22923
|
planId: shortString,
|
|
22904
22924
|
type: external_exports.literal("items")
|
|
22905
22925
|
}).readonly(),
|
|
22906
|
-
external_exports.object({ planId: shortString, type: external_exports.literal("file"), uri:
|
|
22926
|
+
external_exports.object({ planId: shortString, type: external_exports.literal("file"), uri: boundedString2 }).readonly(),
|
|
22907
22927
|
external_exports.object({
|
|
22908
|
-
content:
|
|
22928
|
+
content: boundedString2,
|
|
22909
22929
|
planId: shortString,
|
|
22910
22930
|
type: external_exports.literal("markdown")
|
|
22911
22931
|
}).readonly()
|
|
22912
22932
|
]);
|
|
22913
22933
|
var commandSchema = external_exports.object({
|
|
22914
|
-
description:
|
|
22915
|
-
input: external_exports.object({ hint:
|
|
22934
|
+
description: boundedString2,
|
|
22935
|
+
input: external_exports.object({ hint: boundedString2 }).readonly().nullable().optional(),
|
|
22916
22936
|
name: shortString
|
|
22917
22937
|
}).readonly();
|
|
22918
22938
|
var configSelectOptionSchema = external_exports.object({
|
|
22919
|
-
description:
|
|
22939
|
+
description: boundedString2.nullable().optional(),
|
|
22920
22940
|
name: shortString,
|
|
22921
22941
|
value: shortString
|
|
22922
22942
|
}).readonly();
|
|
22923
22943
|
var configSelectGroupSchema = external_exports.object({
|
|
22924
22944
|
group: shortString,
|
|
22925
22945
|
name: shortString,
|
|
22926
|
-
options: external_exports.array(configSelectOptionSchema).max(
|
|
22946
|
+
options: external_exports.array(configSelectOptionSchema).max(MAX_COLLECTION_SIZE2).readonly()
|
|
22927
22947
|
}).readonly();
|
|
22928
22948
|
var configBaseFields = {
|
|
22929
22949
|
category: shortString.nullable().optional(),
|
|
22930
|
-
description:
|
|
22950
|
+
description: boundedString2.nullable().optional(),
|
|
22931
22951
|
id: shortString,
|
|
22932
22952
|
name: shortString
|
|
22933
22953
|
};
|
|
@@ -22936,8 +22956,8 @@ var sessionConfigOptionSchema2 = external_exports.discriminatedUnion("type", [
|
|
|
22936
22956
|
...configBaseFields,
|
|
22937
22957
|
currentValue: shortString,
|
|
22938
22958
|
options: external_exports.union([
|
|
22939
|
-
external_exports.array(configSelectOptionSchema).max(
|
|
22940
|
-
external_exports.array(configSelectGroupSchema).max(
|
|
22959
|
+
external_exports.array(configSelectOptionSchema).max(MAX_COLLECTION_SIZE2).readonly(),
|
|
22960
|
+
external_exports.array(configSelectGroupSchema).max(MAX_COLLECTION_SIZE2).readonly()
|
|
22941
22961
|
]),
|
|
22942
22962
|
type: external_exports.literal("select")
|
|
22943
22963
|
}).readonly(),
|
|
@@ -22952,26 +22972,26 @@ var acpSessionUpdateSchema = external_exports.discriminatedUnion("sessionUpdate"
|
|
|
22952
22972
|
external_exports.object({ ...contentChunkFields, sessionUpdate: external_exports.literal("agent_message_chunk") }).readonly(),
|
|
22953
22973
|
external_exports.object({ ...contentChunkFields, sessionUpdate: external_exports.literal("agent_thought_chunk") }).readonly(),
|
|
22954
22974
|
external_exports.object({
|
|
22955
|
-
content: external_exports.array(toolCallContentSchema).max(
|
|
22975
|
+
content: external_exports.array(toolCallContentSchema).max(MAX_COLLECTION_SIZE2).readonly().optional(),
|
|
22956
22976
|
kind: toolKindSchema.optional(),
|
|
22957
|
-
locations: external_exports.array(toolCallLocationSchema).max(
|
|
22977
|
+
locations: external_exports.array(toolCallLocationSchema).max(MAX_COLLECTION_SIZE2).readonly().optional(),
|
|
22958
22978
|
name: shortString.nullable().optional(),
|
|
22959
22979
|
rawInput: boundedJsonSchema.optional(),
|
|
22960
22980
|
rawOutput: boundedJsonSchema.optional(),
|
|
22961
22981
|
sessionUpdate: external_exports.literal("tool_call"),
|
|
22962
22982
|
status: toolStatusSchema.optional(),
|
|
22963
|
-
title:
|
|
22983
|
+
title: boundedString2,
|
|
22964
22984
|
toolCallId: shortString
|
|
22965
22985
|
}).readonly(),
|
|
22966
22986
|
external_exports.object({ ...toolPatchFields, sessionUpdate: external_exports.literal("tool_call_update"), toolCallId: shortString }).readonly(),
|
|
22967
22987
|
external_exports.object({
|
|
22968
|
-
entries: external_exports.array(planEntrySchema).max(
|
|
22988
|
+
entries: external_exports.array(planEntrySchema).max(MAX_COLLECTION_SIZE2).readonly(),
|
|
22969
22989
|
sessionUpdate: external_exports.literal("plan")
|
|
22970
22990
|
}).readonly(),
|
|
22971
22991
|
external_exports.object({ plan: planContentSchema, sessionUpdate: external_exports.literal("plan_update") }).readonly(),
|
|
22972
22992
|
external_exports.object({ planId: shortString, sessionUpdate: external_exports.literal("plan_removed") }).readonly(),
|
|
22973
22993
|
external_exports.object({
|
|
22974
|
-
availableCommands: external_exports.array(commandSchema).max(
|
|
22994
|
+
availableCommands: external_exports.array(commandSchema).max(MAX_COLLECTION_SIZE2).readonly(),
|
|
22975
22995
|
sessionUpdate: external_exports.literal("available_commands_update")
|
|
22976
22996
|
}).readonly(),
|
|
22977
22997
|
external_exports.object({
|
|
@@ -22979,12 +22999,12 @@ var acpSessionUpdateSchema = external_exports.discriminatedUnion("sessionUpdate"
|
|
|
22979
22999
|
sessionUpdate: external_exports.literal("current_mode_update")
|
|
22980
23000
|
}).readonly(),
|
|
22981
23001
|
external_exports.object({
|
|
22982
|
-
configOptions: external_exports.array(sessionConfigOptionSchema2).max(
|
|
23002
|
+
configOptions: external_exports.array(sessionConfigOptionSchema2).max(MAX_COLLECTION_SIZE2).readonly(),
|
|
22983
23003
|
sessionUpdate: external_exports.literal("config_option_update")
|
|
22984
23004
|
}).readonly(),
|
|
22985
23005
|
external_exports.object({
|
|
22986
23006
|
sessionUpdate: external_exports.literal("session_info_update"),
|
|
22987
|
-
title:
|
|
23007
|
+
title: boundedString2.nullable().optional(),
|
|
22988
23008
|
updatedAt: shortString.nullable().optional()
|
|
22989
23009
|
}).readonly(),
|
|
22990
23010
|
external_exports.object({
|
|
@@ -22995,10 +23015,10 @@ var acpSessionUpdateSchema = external_exports.discriminatedUnion("sessionUpdate"
|
|
|
22995
23015
|
}).readonly(),
|
|
22996
23016
|
external_exports.object({
|
|
22997
23017
|
compactionId: shortString,
|
|
22998
|
-
error:
|
|
23018
|
+
error: boundedString2.nullable().optional(),
|
|
22999
23019
|
sessionUpdate: external_exports.literal("compaction_update"),
|
|
23000
23020
|
status: shortString,
|
|
23001
|
-
summary: external_exports.array(contentBlockSchema).max(
|
|
23021
|
+
summary: external_exports.array(contentBlockSchema).max(MAX_COLLECTION_SIZE2).readonly().nullable().optional()
|
|
23002
23022
|
}).readonly(),
|
|
23003
23023
|
external_exports.object({
|
|
23004
23024
|
compactionId: shortString,
|
|
@@ -23128,7 +23148,7 @@ var queuedPromptRequestEventLogSchema = external_exports.object({
|
|
|
23128
23148
|
}).readonly();
|
|
23129
23149
|
var nativeSessionEventsSchema = external_exports.object({
|
|
23130
23150
|
events: sessionEventLogPageSchema,
|
|
23131
|
-
queuedPromptRequests: external_exports.array(queuedPromptRequestEventLogSchema).max(
|
|
23151
|
+
queuedPromptRequests: external_exports.array(queuedPromptRequestEventLogSchema).max(MAX_COLLECTION_SIZE2).readonly()
|
|
23132
23152
|
}).readonly();
|
|
23133
23153
|
function inputValue(value) {
|
|
23134
23154
|
if (typeof value !== "string") {
|
|
@@ -23431,6 +23451,11 @@ var daemonToServiceSignatures = {
|
|
|
23431
23451
|
encodeSessionClosedEvent,
|
|
23432
23452
|
decodeSessionClosedEvent
|
|
23433
23453
|
),
|
|
23454
|
+
[SESSION_CLOSE_NOTICE_KIND]: defineMessageSignature(
|
|
23455
|
+
SESSION_CLOSE_NOTICE_KIND,
|
|
23456
|
+
encodeSessionCloseNoticeEvent,
|
|
23457
|
+
decodeSessionCloseNoticeEvent
|
|
23458
|
+
),
|
|
23434
23459
|
[SESSION_PREVIEW_HISTORY_PAGE_LOADED_KIND]: defineMessageSignature(
|
|
23435
23460
|
SESSION_PREVIEW_HISTORY_PAGE_LOADED_KIND,
|
|
23436
23461
|
encodeSessionPreviewHistoryPageLoaded,
|
|
@@ -76884,6 +76909,7 @@ var ActiveExecutions = class {
|
|
|
76884
76909
|
};
|
|
76885
76910
|
|
|
76886
76911
|
// src/acp/agent-session.ts
|
|
76912
|
+
import { setImmediate as yieldToRuntime2 } from "node:timers/promises";
|
|
76887
76913
|
import {
|
|
76888
76914
|
methods as methods10,
|
|
76889
76915
|
PROTOCOL_VERSION as PROTOCOL_VERSION3
|
|
@@ -77256,6 +77282,36 @@ var AgentUpdateStream = class {
|
|
|
77256
77282
|
};
|
|
77257
77283
|
};
|
|
77258
77284
|
|
|
77285
|
+
// src/acp/announced-tool-calls.ts
|
|
77286
|
+
var MAX_ANNOUNCED_TOOL_CALLS = 256;
|
|
77287
|
+
var AnnouncedToolCalls = class {
|
|
77288
|
+
#calls = /* @__PURE__ */ new Map();
|
|
77289
|
+
record = (update) => {
|
|
77290
|
+
const merged = this.describe(update);
|
|
77291
|
+
this.#calls.delete(update.toolCallId);
|
|
77292
|
+
this.#calls.set(update.toolCallId, merged);
|
|
77293
|
+
if (this.#calls.size > MAX_ANNOUNCED_TOOL_CALLS) {
|
|
77294
|
+
const oldest = this.#calls.keys().next();
|
|
77295
|
+
if (oldest.done !== true) {
|
|
77296
|
+
this.#calls.delete(oldest.value);
|
|
77297
|
+
}
|
|
77298
|
+
}
|
|
77299
|
+
};
|
|
77300
|
+
/** Applies a partial update to what was announced for the same tool call. */
|
|
77301
|
+
describe = (update) => {
|
|
77302
|
+
const announced = this.#calls.get(update.toolCallId);
|
|
77303
|
+
return {
|
|
77304
|
+
title: update.title ?? announced?.title,
|
|
77305
|
+
kind: update.kind ?? announced?.kind,
|
|
77306
|
+
rawInput: update.rawInput ?? announced?.rawInput,
|
|
77307
|
+
locations: update.locations ?? announced?.locations
|
|
77308
|
+
};
|
|
77309
|
+
};
|
|
77310
|
+
clear = () => {
|
|
77311
|
+
this.#calls.clear();
|
|
77312
|
+
};
|
|
77313
|
+
};
|
|
77314
|
+
|
|
77259
77315
|
// src/acp/runtime-operations.ts
|
|
77260
77316
|
var RuntimeOperations = class {
|
|
77261
77317
|
#shutdown = new AbortController();
|
|
@@ -78042,15 +78098,21 @@ var AcpSessionInteractions = class {
|
|
|
78042
78098
|
};
|
|
78043
78099
|
signal.addEventListener("abort", abort, { once: true });
|
|
78044
78100
|
try {
|
|
78101
|
+
const toolCall = this.#context.describeToolCall(request.toolCall);
|
|
78045
78102
|
await this.#notifyPermissionRequested({
|
|
78046
78103
|
commandId: this.#context.commandId(),
|
|
78104
|
+
details: {
|
|
78105
|
+
cwd: this.#context.cwd(),
|
|
78106
|
+
rawInput: toolCall.rawInput,
|
|
78107
|
+
locations: toolCall.locations ?? []
|
|
78108
|
+
},
|
|
78047
78109
|
interactionId,
|
|
78048
78110
|
kind: SESSION_PERMISSION_REQUESTED_KIND,
|
|
78049
78111
|
options,
|
|
78050
78112
|
sessionId: this.#context.sessionId(),
|
|
78051
|
-
title: truncate2(
|
|
78113
|
+
title: truncate2(toolCall.title ?? "Permission required", 500),
|
|
78052
78114
|
toolCallId: truncate2(request.toolCall.toolCallId, 255),
|
|
78053
|
-
toolKind: truncate2(
|
|
78115
|
+
toolKind: truncate2(toolCall.kind ?? "other", 64)
|
|
78054
78116
|
});
|
|
78055
78117
|
return await pending.completion.promise;
|
|
78056
78118
|
} finally {
|
|
@@ -83712,6 +83774,7 @@ var AgentSession = class _AgentSession {
|
|
|
83712
83774
|
#connection;
|
|
83713
83775
|
#contentExternalizer;
|
|
83714
83776
|
#interactions;
|
|
83777
|
+
#announcedToolCalls = new AnnouncedToolCalls();
|
|
83715
83778
|
#additionalDirectories;
|
|
83716
83779
|
#agentId;
|
|
83717
83780
|
#cwd;
|
|
@@ -83752,6 +83815,8 @@ var AgentSession = class _AgentSession {
|
|
|
83752
83815
|
this.#store = store;
|
|
83753
83816
|
this.#verifiedAgentVersion = agent.agentVersion;
|
|
83754
83817
|
this.#interactions = new AcpSessionInteractions({
|
|
83818
|
+
cwd: () => this.#cwd,
|
|
83819
|
+
describeToolCall: this.#announcedToolCalls.describe,
|
|
83755
83820
|
sessionId: () => this.#mobiusSessionId,
|
|
83756
83821
|
commandId: () => this.#turn.commandId,
|
|
83757
83822
|
assertNativeSession: (sessionId) => this.assertNativeSession(sessionId),
|
|
@@ -84475,6 +84540,7 @@ var AgentSession = class _AgentSession {
|
|
|
84475
84540
|
throw failure2;
|
|
84476
84541
|
} finally {
|
|
84477
84542
|
this.#turn = new IdleAcpTurn();
|
|
84543
|
+
this.#announcedToolCalls.clear();
|
|
84478
84544
|
}
|
|
84479
84545
|
};
|
|
84480
84546
|
steer = async (options) => {
|
|
@@ -84581,7 +84647,12 @@ var AgentSession = class _AgentSession {
|
|
|
84581
84647
|
};
|
|
84582
84648
|
respondPermission = (options) => this.#interactions.respondPermission(options);
|
|
84583
84649
|
respondElicitation = (options) => this.#interactions.respondElicitation(options);
|
|
84584
|
-
onPermission = (request, signal) =>
|
|
84650
|
+
onPermission = async (request, signal) => {
|
|
84651
|
+
await yieldToRuntime2(void 0, { signal });
|
|
84652
|
+
await this.#updates.drained();
|
|
84653
|
+
signal.throwIfAborted();
|
|
84654
|
+
return await this.#interactions.onPermission(request, signal);
|
|
84655
|
+
};
|
|
84585
84656
|
onElicitation = (request, signal) => this.#interactions.onElicitation(request, signal);
|
|
84586
84657
|
onElicitationComplete = (notification) => this.#interactions.onElicitationComplete(notification);
|
|
84587
84658
|
onUpdate = (notification) => this.#updates.receive(notification);
|
|
@@ -84623,6 +84694,9 @@ var AgentSession = class _AgentSession {
|
|
|
84623
84694
|
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")) {
|
|
84624
84695
|
return;
|
|
84625
84696
|
}
|
|
84697
|
+
if (update.sessionUpdate === "tool_call" || update.sessionUpdate === "tool_call_update") {
|
|
84698
|
+
this.#announcedToolCalls.record(update);
|
|
84699
|
+
}
|
|
84626
84700
|
if (update.sessionUpdate === "available_commands_update") {
|
|
84627
84701
|
const commands = update.availableCommands.slice(0, 500).map((command) => ({
|
|
84628
84702
|
description: truncate2(command.description, 500),
|
|
@@ -84986,10 +85060,13 @@ var AgentRuntimeManager = class {
|
|
|
84986
85060
|
#agentSettingsObserver = new NullAcpSessionObserver();
|
|
84987
85061
|
#nativeOperations = /* @__PURE__ */ new Set();
|
|
84988
85062
|
#sessionClosures = /* @__PURE__ */ new Map();
|
|
85063
|
+
/** Sessions that were closed and not reopened since. Only a prepare or restore of the Session reopens it. */
|
|
85064
|
+
#closedSessions = /* @__PURE__ */ new Set();
|
|
84989
85065
|
#store;
|
|
84990
85066
|
#adapters;
|
|
84991
85067
|
#sessionIdentity;
|
|
84992
85068
|
#onSessionStatusChanged;
|
|
85069
|
+
#onSessionClosed;
|
|
84993
85070
|
#contentExternalizer;
|
|
84994
85071
|
#timer;
|
|
84995
85072
|
#observer;
|
|
@@ -84999,6 +85076,7 @@ var AgentRuntimeManager = class {
|
|
|
84999
85076
|
adapters,
|
|
85000
85077
|
sessionIdentity,
|
|
85001
85078
|
onSessionStatusChanged,
|
|
85079
|
+
onSessionClosed = () => void 0,
|
|
85002
85080
|
contentExternalizer,
|
|
85003
85081
|
timer,
|
|
85004
85082
|
maxProcesses
|
|
@@ -85009,6 +85087,7 @@ var AgentRuntimeManager = class {
|
|
|
85009
85087
|
this.#adapters = adapters;
|
|
85010
85088
|
this.#sessionIdentity = sessionIdentity;
|
|
85011
85089
|
this.#onSessionStatusChanged = onSessionStatusChanged;
|
|
85090
|
+
this.#onSessionClosed = onSessionClosed;
|
|
85012
85091
|
this.#contentExternalizer = contentExternalizer;
|
|
85013
85092
|
this.#timer = timer;
|
|
85014
85093
|
this.#queryProcesses = new AgentQueryProcesses(this.#processes, contentExternalizer);
|
|
@@ -85046,6 +85125,34 @@ var AgentRuntimeManager = class {
|
|
|
85046
85125
|
}
|
|
85047
85126
|
}
|
|
85048
85127
|
}
|
|
85128
|
+
/**
|
|
85129
|
+
* Stops the process of a Session that is being closed. Unlike retiring it, this keeps the stored Session,
|
|
85130
|
+
* so the closed Session stays listed with its title and settings and can be reopened.
|
|
85131
|
+
*/
|
|
85132
|
+
async #stopSessionProcess(sessionId, runtime) {
|
|
85133
|
+
this.#executionProcesses.detach(sessionId, runtime);
|
|
85134
|
+
await this.#processes.retire(runtime, () => runtime.close());
|
|
85135
|
+
}
|
|
85136
|
+
#isKnownSession(sessionId) {
|
|
85137
|
+
return this.#executionProcesses.get(sessionId) !== void 0 || this.#executionProcesses.pending(sessionId) !== void 0 || this.#store.read(sessionId) instanceof FoundAcpStoredSession;
|
|
85138
|
+
}
|
|
85139
|
+
/**
|
|
85140
|
+
* Marks a Session closed and tells every client why, once for each closing. Clients show `reason` to their
|
|
85141
|
+
* users as is. Unknown Sessions have nothing to close.
|
|
85142
|
+
*/
|
|
85143
|
+
#announceClosed(sessionId, reason) {
|
|
85144
|
+
if (this.#closedSessions.has(sessionId) || !this.#isKnownSession(sessionId)) {
|
|
85145
|
+
return;
|
|
85146
|
+
}
|
|
85147
|
+
this.#closedSessions.add(sessionId);
|
|
85148
|
+
this.#onSessionClosed({ kind: SESSION_CLOSE_NOTICE_KIND, reason, sessionId });
|
|
85149
|
+
}
|
|
85150
|
+
/** A closed Session fails the operations that would silently reopen it, so a client learns that its view is stale. */
|
|
85151
|
+
#assertOpen(sessionId) {
|
|
85152
|
+
if (this.#closedSessions.has(sessionId)) {
|
|
85153
|
+
throw new AcpExecutionError("The Session is closed; reopen it to continue", {}, SESSION_CLOSED_ERROR_CODE);
|
|
85154
|
+
}
|
|
85155
|
+
}
|
|
85049
85156
|
async #startRetainedSessionProcess(options, start) {
|
|
85050
85157
|
const runtime = await this.#processes.startRetained(options.signal, start, this.#retention(options.sessionId));
|
|
85051
85158
|
this.#executionProcesses.retain(options.sessionId, runtime);
|
|
@@ -85139,12 +85246,17 @@ var AgentRuntimeManager = class {
|
|
|
85139
85246
|
return runtime;
|
|
85140
85247
|
});
|
|
85141
85248
|
}
|
|
85142
|
-
async #prepareSession(options, recovery, metrics = unmeasuredOperationMetrics) {
|
|
85249
|
+
async #prepareSession(options, recovery, closed, metrics = unmeasuredOperationMetrics) {
|
|
85143
85250
|
return await this.#operations.run(options, async (options2) => {
|
|
85144
85251
|
const closing = this.#sessionClosures.get(options2.sessionId);
|
|
85145
85252
|
if (closing !== void 0) {
|
|
85146
85253
|
await waitForSharedOperation(closing, options2.signal);
|
|
85147
85254
|
}
|
|
85255
|
+
if (closed === "reopen") {
|
|
85256
|
+
this.#closedSessions.delete(options2.sessionId);
|
|
85257
|
+
} else {
|
|
85258
|
+
this.#assertOpen(options2.sessionId);
|
|
85259
|
+
}
|
|
85148
85260
|
const stored = metrics.measureSync("session-state-read", () => this.#store.read(options2.sessionId));
|
|
85149
85261
|
if (stored instanceof FoundAcpStoredSession && this.#nativeOperations.has(`${stored.session.agentId}:${stored.session.nativeSessionId}`)) {
|
|
85150
85262
|
throw new AcpExecutionError("The native session is being managed", {}, "session_busy");
|
|
@@ -85165,7 +85277,7 @@ var AgentRuntimeManager = class {
|
|
|
85165
85277
|
}
|
|
85166
85278
|
return runtime2.prepared();
|
|
85167
85279
|
}
|
|
85168
|
-
return await this.#prepareSession(options2, recovery, metrics);
|
|
85280
|
+
return await this.#prepareSession(options2, recovery, closed, metrics);
|
|
85169
85281
|
}
|
|
85170
85282
|
const existing = this.#executionProcesses.get(options2.sessionId);
|
|
85171
85283
|
if (existing !== void 0) {
|
|
@@ -85193,8 +85305,8 @@ var AgentRuntimeManager = class {
|
|
|
85193
85305
|
return runtime.prepared();
|
|
85194
85306
|
});
|
|
85195
85307
|
}
|
|
85196
|
-
prepareSession = async (options, metrics = unmeasuredOperationMetrics) => await this.#prepareSession(options, { kind: "interactive-only" }, metrics);
|
|
85197
|
-
restoreSession = async (options, metrics = unmeasuredOperationMetrics) => await this.#prepareSession(options, { kind: "history-required" }, metrics);
|
|
85308
|
+
prepareSession = async (options, metrics = unmeasuredOperationMetrics, closed = "reopen") => await this.#prepareSession(options, { kind: "interactive-only" }, closed, metrics);
|
|
85309
|
+
restoreSession = async (options, metrics = unmeasuredOperationMetrics, closed = "reopen") => await this.#prepareSession(options, { kind: "history-required" }, closed, metrics);
|
|
85198
85310
|
/**
|
|
85199
85311
|
* Opens a short-lived native ACP session only to read the local Agent's
|
|
85200
85312
|
* authoritative settings. Its identity and store are private to this
|
|
@@ -85265,6 +85377,7 @@ var AgentRuntimeManager = class {
|
|
|
85265
85377
|
});
|
|
85266
85378
|
});
|
|
85267
85379
|
prepareExecutionSession = async (options) => this.#operations.run(options, async (options2) => {
|
|
85380
|
+
this.#assertOpen(options2.sessionId);
|
|
85268
85381
|
const pending = this.#executionProcesses.pending(options2.sessionId);
|
|
85269
85382
|
if (pending !== void 0) {
|
|
85270
85383
|
await waitForSharedOperation(pending, options2.signal);
|
|
@@ -85302,6 +85415,7 @@ var AgentRuntimeManager = class {
|
|
|
85302
85415
|
});
|
|
85303
85416
|
});
|
|
85304
85417
|
renameSession = async (sessionId, title2, signal) => await this.#operations.run({ sessionId, signal }, async (options) => {
|
|
85418
|
+
this.#assertOpen(options.sessionId);
|
|
85305
85419
|
const runtime = this.#executionProcesses.get(options.sessionId);
|
|
85306
85420
|
if (runtime !== void 0) {
|
|
85307
85421
|
return await runtime.renameSession(title2, options.signal);
|
|
@@ -85377,6 +85491,7 @@ var AgentRuntimeManager = class {
|
|
|
85377
85491
|
}
|
|
85378
85492
|
});
|
|
85379
85493
|
runPrompt = async (options) => this.#operations.run(options, async (options2) => {
|
|
85494
|
+
this.#assertOpen(options2.sessionId);
|
|
85380
85495
|
const stored = this.#store.read(options2.sessionId);
|
|
85381
85496
|
if (stored instanceof FoundAcpStoredSession && this.#nativeOperations.has(`${stored.session.agentId}:${stored.session.nativeSessionId}`)) {
|
|
85382
85497
|
throw new AcpExecutionError("The native session is being managed", {}, "session_busy");
|
|
@@ -85445,6 +85560,7 @@ var AgentRuntimeManager = class {
|
|
|
85445
85560
|
}
|
|
85446
85561
|
});
|
|
85447
85562
|
respondPermission = async (options) => {
|
|
85563
|
+
this.#assertOpen(options.sessionId);
|
|
85448
85564
|
const runtime = this.#executionProcesses.get(options.sessionId);
|
|
85449
85565
|
if (runtime === void 0) {
|
|
85450
85566
|
throw new AcpExecutionError("The permission request session is unavailable", {}, "session_not_found");
|
|
@@ -85452,6 +85568,7 @@ var AgentRuntimeManager = class {
|
|
|
85452
85568
|
await runtime.respondPermission(options);
|
|
85453
85569
|
};
|
|
85454
85570
|
respondElicitation = async (options) => {
|
|
85571
|
+
this.#assertOpen(options.sessionId);
|
|
85455
85572
|
const runtime = this.#executionProcesses.get(options.sessionId);
|
|
85456
85573
|
if (runtime === void 0) {
|
|
85457
85574
|
throw new AcpExecutionError("The elicitation request session is unavailable", {}, "session_not_found");
|
|
@@ -85464,11 +85581,12 @@ var AgentRuntimeManager = class {
|
|
|
85464
85581
|
await waitForSharedOperation(existing, options.signal);
|
|
85465
85582
|
return;
|
|
85466
85583
|
}
|
|
85584
|
+
this.#announceClosed(options.sessionId, "This Session was closed on request.");
|
|
85467
85585
|
const release = (async () => {
|
|
85468
85586
|
const pending = this.#executionProcesses.pending(options.sessionId);
|
|
85469
85587
|
const runtime = pending === void 0 ? this.#executionProcesses.get(options.sessionId) : await pending;
|
|
85470
85588
|
if (runtime !== void 0) {
|
|
85471
|
-
await this.#
|
|
85589
|
+
await this.#stopSessionProcess(options.sessionId, runtime);
|
|
85472
85590
|
}
|
|
85473
85591
|
})();
|
|
85474
85592
|
const deadline = Promise.withResolvers();
|
|
@@ -85550,6 +85668,7 @@ var AgentRuntimeManager = class {
|
|
|
85550
85668
|
});
|
|
85551
85669
|
});
|
|
85552
85670
|
ensureSession = async (options) => this.#operations.run(options, async (options2) => {
|
|
85671
|
+
this.#assertOpen(options2.sessionId);
|
|
85553
85672
|
const existing = this.#executionProcesses.get(options2.sessionId);
|
|
85554
85673
|
if (existing !== void 0) {
|
|
85555
85674
|
if (!existing.belongsTo(options2.agent.id, options2.cwd, options2.additionalDirectories)) {
|
|
@@ -85628,6 +85747,7 @@ var AgentRuntimeManager = class {
|
|
|
85628
85747
|
const existing = linked[0];
|
|
85629
85748
|
if (origin.kind === "import" && existing !== void 0) {
|
|
85630
85749
|
return await this.#executionProcesses.use(existing.sessionId, async () => {
|
|
85750
|
+
this.#closedSessions.delete(existing.sessionId);
|
|
85631
85751
|
const runtime = await this.ensureSession({
|
|
85632
85752
|
...options2,
|
|
85633
85753
|
sessionId: existing.sessionId
|
|
@@ -87147,7 +87267,7 @@ import { WebSocket as WebSocket7 } from "undici";
|
|
|
87147
87267
|
// package.json
|
|
87148
87268
|
var package_default = {
|
|
87149
87269
|
name: "@moxt-ai/mobius",
|
|
87150
|
-
version: "0.0.
|
|
87270
|
+
version: "0.0.279",
|
|
87151
87271
|
description: "Mobius CLI for pairing and running local AI agent services.",
|
|
87152
87272
|
type: "module",
|
|
87153
87273
|
bin: {
|
|
@@ -89038,7 +89158,7 @@ async function resolveCatalogAgent(config2, agentId, signal) {
|
|
|
89038
89158
|
const agent = config2.catalog.find(agentId);
|
|
89039
89159
|
return config2.resolveAgent === void 0 ? agent : await config2.resolveAgent(agent, signal);
|
|
89040
89160
|
}
|
|
89041
|
-
async function prepareSession(command, recovery, config2, directories, sessions, metrics, signal) {
|
|
89161
|
+
async function prepareSession(command, recovery, closed, config2, directories, sessions, metrics, signal) {
|
|
89042
89162
|
return await metrics.measure("prepare-total", async () => {
|
|
89043
89163
|
const resolved = await metrics.measure(
|
|
89044
89164
|
"workspace-resolve",
|
|
@@ -89058,7 +89178,7 @@ async function prepareSession(command, recovery, config2, directories, sessions,
|
|
|
89058
89178
|
sessionId: command.sessionId,
|
|
89059
89179
|
signal
|
|
89060
89180
|
};
|
|
89061
|
-
const prepared = command.transient === true ? await sessions.inspectSession(preparation, metrics) : recovery.kind === "history-required" ? await sessions.restoreSession(preparation, metrics) : await sessions.prepareSession(preparation, metrics);
|
|
89181
|
+
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);
|
|
89062
89182
|
const configuration = command.configuration;
|
|
89063
89183
|
const configOptions = configuration === void 0 ? prepared.configOptions : await metrics.measure(
|
|
89064
89184
|
"configuration",
|
|
@@ -89114,6 +89234,7 @@ async function executeSessionPrepare(socket, command, config2, directories, sess
|
|
|
89114
89234
|
const readyEvent = await prepareSession(
|
|
89115
89235
|
command,
|
|
89116
89236
|
{ kind: "interactive-only" },
|
|
89237
|
+
"reopen",
|
|
89117
89238
|
config2,
|
|
89118
89239
|
directories,
|
|
89119
89240
|
sessions,
|
|
@@ -89160,6 +89281,7 @@ async function executeSessionRestore(socket, command, config2, directories, sess
|
|
|
89160
89281
|
sessionState: "provisioned"
|
|
89161
89282
|
},
|
|
89162
89283
|
{ kind: "history-required" },
|
|
89284
|
+
"reopen",
|
|
89163
89285
|
config2,
|
|
89164
89286
|
directories,
|
|
89165
89287
|
sessions,
|
|
@@ -89330,6 +89452,8 @@ async function executeSessionConfigRead(socket, command, config2, directories, s
|
|
|
89330
89452
|
// load support would fail even with a live process whose config is
|
|
89331
89453
|
// already readable, and prepare reuses the current configuration.
|
|
89332
89454
|
{ kind: "interactive-only" },
|
|
89455
|
+
// Reading settings must not reopen a Session that a client closed.
|
|
89456
|
+
"keep-closed",
|
|
89333
89457
|
config2,
|
|
89334
89458
|
directories,
|
|
89335
89459
|
sessions,
|
|
@@ -90828,6 +90952,7 @@ var RuntimeSessionEventPublisher = class {
|
|
|
90828
90952
|
};
|
|
90829
90953
|
publishStatus = (event) => this.#send(event);
|
|
90830
90954
|
publishInfo = (event) => this.#send(event);
|
|
90955
|
+
publishClosed = (event) => this.#send(event);
|
|
90831
90956
|
#send = (message) => {
|
|
90832
90957
|
const socket = this.#socket;
|
|
90833
90958
|
if (socket === null || socket.readyState !== WebSocket8.OPEN) {
|
|
@@ -91575,6 +91700,7 @@ async function runRuntime(config2, parentSignal, timer = systemTimer, options =
|
|
|
91575
91700
|
adapters: harnessAdapters,
|
|
91576
91701
|
sessionIdentity: "native",
|
|
91577
91702
|
onSessionStatusChanged: publisher.publishStatus,
|
|
91703
|
+
onSessionClosed: publisher.publishClosed,
|
|
91578
91704
|
contentExternalizer: new AcpContentExternalizer(externalContent),
|
|
91579
91705
|
timer,
|
|
91580
91706
|
maxProcesses: resolveMaxAcpProcesses(config2.localContext.environment)
|