@moxt-ai/mobius 0.0.381 → 0.0.383
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/{chunk-HJN27I4Y.js → chunk-EFC2VFRR.js} +103 -50
- package/dist/{chunk-HJN27I4Y.js.map → chunk-EFC2VFRR.js.map} +3 -3
- package/dist/{chunk-VKU6W3IQ.js → chunk-LK7WPXMG.js} +2 -2
- package/dist/{chunk-ICRGF5ZU.js → chunk-NQRP5JBE.js} +2 -2
- package/dist/{chunk-ICRGF5ZU.js.map → chunk-NQRP5JBE.js.map} +1 -1
- package/dist/{cli-BI5CRENK.js → cli-PGKDISIO.js} +4 -4
- package/dist/cli.js +3 -3
- package/dist/engine/session/api/session-layer.d.ts.map +1 -1
- package/dist/engine/session/api/session-layer.js +5 -0
- package/dist/engine/session/api/session-layer.js.map +1 -1
- package/dist/engine/session/history/session-event-store.d.ts +4 -0
- package/dist/engine/session/history/session-event-store.d.ts.map +1 -1
- package/dist/engine/session/history/session-event-store.js +8 -0
- package/dist/engine/session/history/session-event-store.js.map +1 -1
- package/dist/engine/session/interaction/pending-interactions.d.ts +5 -4
- package/dist/engine/session/interaction/pending-interactions.d.ts.map +1 -1
- package/dist/engine/session/interaction/pending-interactions.js +8 -8
- package/dist/engine/session/interaction/pending-interactions.js.map +1 -1
- package/dist/engine/session/interaction/session-interactions.d.ts +2 -1
- package/dist/engine/session/interaction/session-interactions.d.ts.map +1 -1
- package/dist/engine/session/interaction/session-interactions.js +51 -44
- package/dist/engine/session/interaction/session-interactions.js.map +1 -1
- package/dist/engine/session/live/agent-session.d.ts +2 -0
- package/dist/engine/session/live/agent-session.d.ts.map +1 -1
- package/dist/engine/session/live/agent-session.js +4 -0
- package/dist/engine/session/live/agent-session.js.map +1 -1
- package/dist/engine/session/manager/session-manager.d.ts +2 -0
- package/dist/engine/session/manager/session-manager.d.ts.map +1 -1
- package/dist/engine/session/manager/session-manager.js +20 -0
- package/dist/engine/session/manager/session-manager.js.map +1 -1
- package/dist/engine/session/native/native-session-browser.d.ts +1 -1
- package/dist/engine/session/native/native-session-browser.d.ts.map +1 -1
- package/dist/engine.js +2 -2
- package/package.json +2 -2
- /package/dist/{chunk-VKU6W3IQ.js.map → chunk-LK7WPXMG.js.map} +0 -0
- /package/dist/{cli-BI5CRENK.js.map → cli-PGKDISIO.js.map} +0 -0
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
__export,
|
|
4
4
|
__using,
|
|
5
5
|
package_default
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-NQRP5JBE.js";
|
|
7
7
|
|
|
8
8
|
// src/engine/runtime/relay/runtime-revocation.ts
|
|
9
9
|
var runtimeRevocationCloseCode = 1008;
|
|
@@ -21348,6 +21348,16 @@ var envelope = {
|
|
|
21348
21348
|
requestId: identifierStringSchema,
|
|
21349
21349
|
sessionId: identifierStringSchema
|
|
21350
21350
|
};
|
|
21351
|
+
var sessionInteractionSnapshotSchema = external_exports.object({
|
|
21352
|
+
sessionGenerationId: identifierStringSchema,
|
|
21353
|
+
throughPosition: external_exports.string().regex(/^(0|[1-9][0-9]*)$/),
|
|
21354
|
+
interactions: external_exports.array(
|
|
21355
|
+
external_exports.discriminatedUnion("kind", [
|
|
21356
|
+
sessionPermissionRequestedEventSchema,
|
|
21357
|
+
sessionElicitationRequestedEventSchema
|
|
21358
|
+
])
|
|
21359
|
+
).readonly()
|
|
21360
|
+
}).readonly();
|
|
21351
21361
|
var activeTurnSnapshotSchema = external_exports.object({
|
|
21352
21362
|
commandId: identifierStringSchema,
|
|
21353
21363
|
epoch: identifierStringSchema,
|
|
@@ -21453,6 +21463,8 @@ var nativeSessionResultSchema = external_exports.discriminatedUnion("action", [
|
|
|
21453
21463
|
}).readonly()
|
|
21454
21464
|
).readonly(),
|
|
21455
21465
|
turn: activeTurnSnapshotSchema.nullable(),
|
|
21466
|
+
// Absent when an older Runtime or Relay cannot provide session-scoped interaction recovery.
|
|
21467
|
+
interactionState: sessionInteractionSnapshotSchema.optional(),
|
|
21456
21468
|
// Present only when the request named a command and every hop understands it. An
|
|
21457
21469
|
// unrecognized delivery from a newer peer reads as absent instead of failing the snapshot.
|
|
21458
21470
|
command: commandDeliverySchema.optional().catch(void 0),
|
|
@@ -61543,7 +61555,7 @@ function parseTaskListOutput(content) {
|
|
|
61543
61555
|
const tasks = [];
|
|
61544
61556
|
const lines = text2.trim().split("\n");
|
|
61545
61557
|
for (const line of lines) {
|
|
61546
|
-
const match = /^#(\S+) \[(pending|in_progress|completed)\] (.+?)(?: \(([^()]*)\))?(?: \[blocked by ((
|
|
61558
|
+
const match = /^#(\S+) \[(pending|in_progress|completed)\] (.+?)(?: \(([^()]*)\))?(?: \[blocked by (#[^,\]]+(?:, #[^,\]]+)*(?:, )?)\])?$/.exec(line);
|
|
61547
61559
|
if (!match) {
|
|
61548
61560
|
tasks.length = 0;
|
|
61549
61561
|
break;
|
|
@@ -77564,6 +77576,10 @@ var MemorySessionEventStore = class {
|
|
|
77564
77576
|
this.append(sessionId, event);
|
|
77565
77577
|
}
|
|
77566
77578
|
};
|
|
77579
|
+
livePosition = (sessionId) => {
|
|
77580
|
+
const session = this.#session(sessionId);
|
|
77581
|
+
return { sessionGenerationId: session.sessionGenerationId, throughPosition: session.throughPosition };
|
|
77582
|
+
};
|
|
77567
77583
|
page = (sessionId, eventLimit, cursor) => {
|
|
77568
77584
|
const session = this.#session(sessionId);
|
|
77569
77585
|
const endIndex = session.endIndex(cursor);
|
|
@@ -77691,6 +77707,10 @@ var CachedSessionEventStore = class {
|
|
|
77691
77707
|
}
|
|
77692
77708
|
}
|
|
77693
77709
|
};
|
|
77710
|
+
livePosition = (sessionId) => {
|
|
77711
|
+
const session = this.#session(sessionId);
|
|
77712
|
+
return { sessionGenerationId: session.sessionGenerationId, throughPosition: session.throughPosition };
|
|
77713
|
+
};
|
|
77694
77714
|
page = (sessionId, eventLimit, cursor) => {
|
|
77695
77715
|
const session = this.#sessions.get(sessionId);
|
|
77696
77716
|
const current = session ?? this.#session(sessionId);
|
|
@@ -85482,12 +85502,12 @@ function validateElicitationContent(encoded, requestedSchema) {
|
|
|
85482
85502
|
// src/engine/session/interaction/pending-interactions.ts
|
|
85483
85503
|
var PendingPermission = class {
|
|
85484
85504
|
completion = Promise.withResolvers();
|
|
85485
|
-
|
|
85505
|
+
request;
|
|
85486
85506
|
optionIds;
|
|
85487
85507
|
#settled = false;
|
|
85488
|
-
constructor(
|
|
85489
|
-
this.
|
|
85490
|
-
this.optionIds =
|
|
85508
|
+
constructor(request) {
|
|
85509
|
+
this.request = request;
|
|
85510
|
+
this.optionIds = new Set(request.options.map((option) => option.optionId));
|
|
85491
85511
|
}
|
|
85492
85512
|
cancel = () => {
|
|
85493
85513
|
if (this.#settled) {
|
|
@@ -85511,12 +85531,12 @@ var PendingPermission = class {
|
|
|
85511
85531
|
var PendingElicitation = class {
|
|
85512
85532
|
completion = Promise.withResolvers();
|
|
85513
85533
|
elicitationId;
|
|
85514
|
-
|
|
85534
|
+
request;
|
|
85515
85535
|
requestedSchema;
|
|
85516
85536
|
#settled = false;
|
|
85517
|
-
constructor(
|
|
85518
|
-
this.
|
|
85519
|
-
this.
|
|
85537
|
+
constructor(request, requestedSchema) {
|
|
85538
|
+
this.request = request;
|
|
85539
|
+
this.elicitationId = request.elicitationId;
|
|
85520
85540
|
this.requestedSchema = requestedSchema;
|
|
85521
85541
|
}
|
|
85522
85542
|
accept = (content) => {
|
|
@@ -85551,6 +85571,11 @@ var SessionInteractions = class {
|
|
|
85551
85571
|
#pendingElicitations = /* @__PURE__ */ new Map();
|
|
85552
85572
|
#acceptedUrlElicitations = /* @__PURE__ */ new Map();
|
|
85553
85573
|
#context;
|
|
85574
|
+
snapshot = () => [
|
|
85575
|
+
...[...this.#pendingPermissions.values()].map((pending) => pending.request),
|
|
85576
|
+
...[...this.#pendingElicitations.values()].map((pending) => pending.request),
|
|
85577
|
+
...this.#acceptedUrlElicitations.values()
|
|
85578
|
+
];
|
|
85554
85579
|
constructor(context) {
|
|
85555
85580
|
this.#context = context;
|
|
85556
85581
|
}
|
|
@@ -85629,7 +85654,7 @@ var SessionInteractions = class {
|
|
|
85629
85654
|
if (pending.elicitationId.length > 0) {
|
|
85630
85655
|
resolved = pending.accept({});
|
|
85631
85656
|
if (resolved) {
|
|
85632
|
-
this.#acceptedUrlElicitations.set(pending.elicitationId, pending.
|
|
85657
|
+
this.#acceptedUrlElicitations.set(pending.elicitationId, { ...pending.request, accepted: true });
|
|
85633
85658
|
}
|
|
85634
85659
|
} else {
|
|
85635
85660
|
resolved = pending.accept(validateElicitationContent(options.content, pending.requestedSchema));
|
|
@@ -85669,33 +85694,34 @@ var SessionInteractions = class {
|
|
|
85669
85694
|
"invalid_agent_permission_request"
|
|
85670
85695
|
);
|
|
85671
85696
|
}
|
|
85672
|
-
const
|
|
85697
|
+
const announced = this.#context.getToolCall(request.toolCall.toolCallId);
|
|
85698
|
+
const title2 = request.toolCall.title ?? announced?.title;
|
|
85699
|
+
const kind = request.toolCall.kind ?? announced?.kind;
|
|
85700
|
+
const rawInput = request.toolCall.rawInput ?? announced?.rawInput;
|
|
85701
|
+
const locations = request.toolCall.locations ?? announced?.locations ?? [];
|
|
85702
|
+
const event = {
|
|
85703
|
+
commandId: this.#context.commandId(),
|
|
85704
|
+
details: {
|
|
85705
|
+
cwd: this.#context.cwd(),
|
|
85706
|
+
rawInput,
|
|
85707
|
+
locations
|
|
85708
|
+
},
|
|
85709
|
+
interactionId,
|
|
85710
|
+
kind: SESSION_PERMISSION_REQUESTED_KIND,
|
|
85711
|
+
options,
|
|
85712
|
+
sessionId: this.#context.sessionId(),
|
|
85713
|
+
title: truncate(title2 ?? "Permission required", 500),
|
|
85714
|
+
toolCallId: truncate(request.toolCall.toolCallId, 255),
|
|
85715
|
+
toolKind: truncate(kind ?? "other", 64)
|
|
85716
|
+
};
|
|
85717
|
+
const pending = new PendingPermission(event);
|
|
85673
85718
|
this.#pendingPermissions.set(interactionId, pending);
|
|
85674
85719
|
const abort = () => {
|
|
85675
85720
|
void this.cancelPermission(interactionId);
|
|
85676
85721
|
};
|
|
85677
85722
|
signal.addEventListener("abort", abort, { once: true });
|
|
85678
85723
|
try {
|
|
85679
|
-
|
|
85680
|
-
const title2 = request.toolCall.title ?? announced?.title;
|
|
85681
|
-
const kind = request.toolCall.kind ?? announced?.kind;
|
|
85682
|
-
const rawInput = request.toolCall.rawInput ?? announced?.rawInput;
|
|
85683
|
-
const locations = request.toolCall.locations ?? announced?.locations ?? [];
|
|
85684
|
-
await this.#notifyPermissionRequested({
|
|
85685
|
-
commandId: this.#context.commandId(),
|
|
85686
|
-
details: {
|
|
85687
|
-
cwd: this.#context.cwd(),
|
|
85688
|
-
rawInput,
|
|
85689
|
-
locations
|
|
85690
|
-
},
|
|
85691
|
-
interactionId,
|
|
85692
|
-
kind: SESSION_PERMISSION_REQUESTED_KIND,
|
|
85693
|
-
options,
|
|
85694
|
-
sessionId: this.#context.sessionId(),
|
|
85695
|
-
title: truncate(title2 ?? "Permission required", 500),
|
|
85696
|
-
toolCallId: truncate(request.toolCall.toolCallId, 255),
|
|
85697
|
-
toolKind: truncate(kind ?? "other", 64)
|
|
85698
|
-
});
|
|
85724
|
+
await this.#notifyPermissionRequested(event);
|
|
85699
85725
|
return await pending.completion.promise;
|
|
85700
85726
|
} finally {
|
|
85701
85727
|
signal.removeEventListener("abort", abort);
|
|
@@ -85724,25 +85750,26 @@ var SessionInteractions = class {
|
|
|
85724
85750
|
const requestedSchema = request.mode === "form" ? schemaValue : {};
|
|
85725
85751
|
const elicitationIdValue = Reflect.get(request, "elicitationId");
|
|
85726
85752
|
const elicitationId = request.mode === "url" && typeof elicitationIdValue === "string" ? truncate(elicitationIdValue, 255) : "";
|
|
85727
|
-
const
|
|
85753
|
+
const event = {
|
|
85754
|
+
accepted: false,
|
|
85755
|
+
commandId: this.#context.commandId(),
|
|
85756
|
+
elicitationId,
|
|
85757
|
+
fields: normalizeElicitationFields(requestedSchema),
|
|
85758
|
+
interactionId,
|
|
85759
|
+
kind: SESSION_ELICITATION_REQUESTED_KIND,
|
|
85760
|
+
message: truncate(request.message, 2e3),
|
|
85761
|
+
mode: request.mode,
|
|
85762
|
+
sessionId: this.#context.sessionId(),
|
|
85763
|
+
url: request.mode === "url" && typeof Reflect.get(request, "url") === "string" ? truncate(readString2(Reflect.get(request, "url")), 4096) : ""
|
|
85764
|
+
};
|
|
85765
|
+
const pending = new PendingElicitation(event, requestedSchema);
|
|
85728
85766
|
this.#pendingElicitations.set(interactionId, pending);
|
|
85729
85767
|
const abort = () => {
|
|
85730
85768
|
void this.cancelElicitation(interactionId);
|
|
85731
85769
|
};
|
|
85732
85770
|
signal.addEventListener("abort", abort, { once: true });
|
|
85733
85771
|
try {
|
|
85734
|
-
await this.#notifyElicitationRequested(
|
|
85735
|
-
accepted: false,
|
|
85736
|
-
commandId: this.#context.commandId(),
|
|
85737
|
-
elicitationId,
|
|
85738
|
-
fields: normalizeElicitationFields(requestedSchema),
|
|
85739
|
-
interactionId,
|
|
85740
|
-
kind: SESSION_ELICITATION_REQUESTED_KIND,
|
|
85741
|
-
message: truncate(request.message, 2e3),
|
|
85742
|
-
mode: request.mode,
|
|
85743
|
-
sessionId: this.#context.sessionId(),
|
|
85744
|
-
url: request.mode === "url" && typeof Reflect.get(request, "url") === "string" ? truncate(readString2(Reflect.get(request, "url")), 4096) : ""
|
|
85745
|
-
});
|
|
85772
|
+
await this.#notifyElicitationRequested(event);
|
|
85746
85773
|
return await pending.completion.promise;
|
|
85747
85774
|
} finally {
|
|
85748
85775
|
signal.removeEventListener("abort", abort);
|
|
@@ -85750,14 +85777,14 @@ var SessionInteractions = class {
|
|
|
85750
85777
|
}
|
|
85751
85778
|
};
|
|
85752
85779
|
onElicitationComplete = async (notification) => {
|
|
85753
|
-
const
|
|
85754
|
-
if (
|
|
85780
|
+
const accepted = this.#acceptedUrlElicitations.get(notification.elicitationId);
|
|
85781
|
+
if (accepted === void 0) {
|
|
85755
85782
|
return;
|
|
85756
85783
|
}
|
|
85757
85784
|
this.#acceptedUrlElicitations.delete(notification.elicitationId);
|
|
85758
85785
|
await this.#notifyElicitationResolved({
|
|
85759
85786
|
action: "complete",
|
|
85760
|
-
interactionId,
|
|
85787
|
+
interactionId: accepted.interactionId,
|
|
85761
85788
|
kind: SESSION_ELICITATION_RESOLVED_KIND,
|
|
85762
85789
|
sessionId: this.#context.sessionId()
|
|
85763
85790
|
});
|
|
@@ -85792,7 +85819,9 @@ var SessionInteractions = class {
|
|
|
85792
85819
|
cancelPendingInteractions = async () => {
|
|
85793
85820
|
const permissionIds = [...this.#pendingPermissions.keys()];
|
|
85794
85821
|
const elicitationIds = [...this.#pendingElicitations.keys()];
|
|
85795
|
-
const acceptedElicitationIds = [...this.#acceptedUrlElicitations.values()]
|
|
85822
|
+
const acceptedElicitationIds = [...this.#acceptedUrlElicitations.values()].map(
|
|
85823
|
+
(request) => request.interactionId
|
|
85824
|
+
);
|
|
85796
85825
|
this.#acceptedUrlElicitations.clear();
|
|
85797
85826
|
for (const interactionId of permissionIds) {
|
|
85798
85827
|
await this.cancelPermission(interactionId);
|
|
@@ -86808,6 +86837,10 @@ var AgentSession = class _AgentSession {
|
|
|
86808
86837
|
}
|
|
86809
86838
|
return "retained";
|
|
86810
86839
|
};
|
|
86840
|
+
interactionSnapshot = () => {
|
|
86841
|
+
const { sessionGenerationId, throughPosition } = this.#store.events.livePosition(this.#mobiusSessionId);
|
|
86842
|
+
return { sessionGenerationId, throughPosition, interactions: this.#interactions.snapshot() };
|
|
86843
|
+
};
|
|
86811
86844
|
respondPermission = async (options) => {
|
|
86812
86845
|
await this.#interactions.respondPermission(options);
|
|
86813
86846
|
};
|
|
@@ -87720,6 +87753,21 @@ var SessionManager2 = class {
|
|
|
87720
87753
|
};
|
|
87721
87754
|
listSessions = (limit) => this.#store.list().filter((session) => session.prompted).slice(0, limit);
|
|
87722
87755
|
findLinkedSessions = (agentId, nativeSessionId) => this.#store.findNative(agentId, nativeSessionId);
|
|
87756
|
+
interactionSnapshot = (options) => {
|
|
87757
|
+
options.signal.throwIfAborted();
|
|
87758
|
+
const runtime = this.#executionProcesses.get(options.sessionId);
|
|
87759
|
+
if (runtime !== void 0) {
|
|
87760
|
+
return runtime.belongsTo(options.agent.id, options.cwd, options.additionalDirectories) ? runtime.interactionSnapshot() : void 0;
|
|
87761
|
+
}
|
|
87762
|
+
const stored = this.#store.read(options.sessionId);
|
|
87763
|
+
if (!(stored instanceof FoundStoredSession) || stored.session.agentId !== options.agent.id || stored.session.cwd !== options.cwd || stored.session.additionalDirectories.length !== options.additionalDirectories.length || !stored.session.additionalDirectories.every(
|
|
87764
|
+
(directory, index2) => directory === options.additionalDirectories[index2]
|
|
87765
|
+
)) {
|
|
87766
|
+
return void 0;
|
|
87767
|
+
}
|
|
87768
|
+
const { sessionGenerationId, throughPosition } = this.#store.events.livePosition(options.sessionId);
|
|
87769
|
+
return { sessionGenerationId, throughPosition, interactions: [] };
|
|
87770
|
+
};
|
|
87723
87771
|
hasPreparedSession = (sessionId, agentId, cwd, additionalDirectories) => this.#executionProcesses.get(sessionId)?.belongsTo(agentId, cwd, additionalDirectories) === true;
|
|
87724
87772
|
createNativeSession = async (options) => this.#operations.run(options, async (options2) => {
|
|
87725
87773
|
const temporarySessionId = `new-${crypto.randomUUID()}`;
|
|
@@ -89480,8 +89528,13 @@ function buildSessionLayer(options) {
|
|
|
89480
89528
|
);
|
|
89481
89529
|
});
|
|
89482
89530
|
const lastTurn = snapshot.turn === null ? operations.lastTurn(request.targetSessionId) : void 0;
|
|
89531
|
+
const interactionState = manager.interactionSnapshot({
|
|
89532
|
+
...requestOptions,
|
|
89533
|
+
sessionId: request.targetSessionId
|
|
89534
|
+
});
|
|
89483
89535
|
return {
|
|
89484
89536
|
...snapshot,
|
|
89537
|
+
...interactionState === void 0 ? {} : { interactionState },
|
|
89485
89538
|
...request.deliveryCommandId === void 0 ? {} : { command: operations.delivery(request.deliveryCommandId, request.targetSessionId) },
|
|
89486
89539
|
...lastTurn === void 0 ? {} : { lastTurn }
|
|
89487
89540
|
};
|
|
@@ -93583,4 +93636,4 @@ export {
|
|
|
93583
93636
|
* MIT Licensed
|
|
93584
93637
|
*)
|
|
93585
93638
|
*/
|
|
93586
|
-
//# sourceMappingURL=chunk-
|
|
93639
|
+
//# sourceMappingURL=chunk-EFC2VFRR.js.map
|