@moxt-ai/mobius 0.0.309 → 0.0.310
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +31 -27
- package/dist/cli.js.map +3 -3
- package/dist/runtime.js +31 -27
- package/dist/runtime.js.map +3 -3
- package/dist/session/api/session-layer.d.ts.map +1 -1
- package/dist/session/api/session-layer.js +1 -1
- package/dist/session/api/session-layer.js.map +1 -1
- package/dist/session/history/session-event-history-projection.d.ts +6 -1
- package/dist/session/history/session-event-history-projection.d.ts.map +1 -1
- package/dist/session/history/session-event-history-projection.js +19 -1
- package/dist/session/history/session-event-history-projection.js.map +1 -1
- package/dist/session/history/session-event-store.d.ts +1 -4
- package/dist/session/history/session-event-store.d.ts.map +1 -1
- package/dist/session/history/session-event-store.js +10 -11
- package/dist/session/history/session-event-store.js.map +1 -1
- package/dist/session/turn/execution-receipts.d.ts +0 -4
- package/dist/session/turn/execution-receipts.d.ts.map +1 -1
- package/dist/session/turn/execution-receipts.js +0 -12
- package/dist/session/turn/execution-receipts.js.map +1 -1
- package/package.json +1 -1
package/dist/runtime.js
CHANGED
|
@@ -22693,7 +22693,7 @@ import { fetch as fetch3 } from "undici";
|
|
|
22693
22693
|
// package.json
|
|
22694
22694
|
var package_default = {
|
|
22695
22695
|
name: "@moxt-ai/mobius",
|
|
22696
|
-
version: "0.0.
|
|
22696
|
+
version: "0.0.310",
|
|
22697
22697
|
description: "Mobius CLI for pairing and running local AI agent services.",
|
|
22698
22698
|
type: "module",
|
|
22699
22699
|
bin: {
|
|
@@ -74662,6 +74662,24 @@ var SessionEventHistoryProjection = class {
|
|
|
74662
74662
|
#toolCallEventIds = /* @__PURE__ */ new Map();
|
|
74663
74663
|
#latestEvent = null;
|
|
74664
74664
|
apply = (liveEvent2, resolve18) => {
|
|
74665
|
+
if (liveEvent2.type === "lifecycle-metadata") {
|
|
74666
|
+
this.#latestEvent = null;
|
|
74667
|
+
const prompt = liveEvent2.payload;
|
|
74668
|
+
if (prompt.kind === "prompt.requested") {
|
|
74669
|
+
const events = prompt.content.map(
|
|
74670
|
+
(content, index2) => ({
|
|
74671
|
+
eventId: index2 === 0 ? liveEvent2.eventId : `${liveEvent2.eventId}-content-${index2}`,
|
|
74672
|
+
payload: { content, messageId: liveEvent2.eventId, sessionUpdate: "user_message_chunk" },
|
|
74673
|
+
recordedAt: liveEvent2.recordedAt,
|
|
74674
|
+
sessionGenerationId: liveEvent2.sessionGenerationId,
|
|
74675
|
+
sessionId: liveEvent2.sessionId,
|
|
74676
|
+
type: "acp"
|
|
74677
|
+
})
|
|
74678
|
+
);
|
|
74679
|
+
return { events, kind: "append" };
|
|
74680
|
+
}
|
|
74681
|
+
return { kind: "skip" };
|
|
74682
|
+
}
|
|
74665
74683
|
if (liveEvent2.type === "acp" && liveEvent2.payload.sessionUpdate === "tool_call_update") {
|
|
74666
74684
|
const targetEventId = this.#toolCallEventIds.get(liveEvent2.payload.toolCallId);
|
|
74667
74685
|
const current = targetEventId === void 0 ? void 0 : resolve18([targetEventId]).get(targetEventId);
|
|
@@ -74682,7 +74700,7 @@ var SessionEventHistoryProjection = class {
|
|
|
74682
74700
|
const event = projectNewEvent(liveEvent2, liveEvent2.eventId);
|
|
74683
74701
|
this.#latestEvent = event;
|
|
74684
74702
|
this.#indexToolCall(event);
|
|
74685
|
-
return { event, kind: "append" };
|
|
74703
|
+
return { events: [event], kind: "append" };
|
|
74686
74704
|
};
|
|
74687
74705
|
/**
|
|
74688
74706
|
* The projected tool call announced with this identifier, in its current
|
|
@@ -74756,6 +74774,9 @@ var SessionEvents = class {
|
|
|
74756
74774
|
apply = (event, resolve18) => {
|
|
74757
74775
|
const projected = this.#projection.apply(event, resolve18);
|
|
74758
74776
|
this.#throughPosition = event.position;
|
|
74777
|
+
if (projected.kind === "skip") {
|
|
74778
|
+
return;
|
|
74779
|
+
}
|
|
74759
74780
|
if (projected.kind === "replace") {
|
|
74760
74781
|
const current = this.#cachedItemsByEventId.get(projected.replacedEventId);
|
|
74761
74782
|
if (current === void 0) {
|
|
@@ -74764,10 +74785,12 @@ var SessionEvents = class {
|
|
|
74764
74785
|
current.replaceEvent(projected.event);
|
|
74765
74786
|
return;
|
|
74766
74787
|
}
|
|
74767
|
-
const
|
|
74768
|
-
|
|
74769
|
-
|
|
74770
|
-
|
|
74788
|
+
for (const projectedEvent of projected.events) {
|
|
74789
|
+
const item = new ProjectedSessionEvent(projectedEvent);
|
|
74790
|
+
this.#eventIndexById.set(projectedEvent.eventId, this.#eventIds.length);
|
|
74791
|
+
this.#cachedItemsByEventId.set(projectedEvent.eventId, item);
|
|
74792
|
+
this.#eventIds.push(projectedEvent.eventId);
|
|
74793
|
+
}
|
|
74771
74794
|
};
|
|
74772
74795
|
get throughPosition() {
|
|
74773
74796
|
return this.#throughPosition;
|
|
@@ -74943,14 +74966,12 @@ var MemorySessionEventStore = class {
|
|
|
74943
74966
|
};
|
|
74944
74967
|
};
|
|
74945
74968
|
var CachedSessionEventStore = class {
|
|
74946
|
-
#terminalOutcomes;
|
|
74947
74969
|
#cacheTable;
|
|
74948
74970
|
#eventIds;
|
|
74949
74971
|
#liveEventPositions;
|
|
74950
74972
|
#sessions = /* @__PURE__ */ new Map();
|
|
74951
74973
|
#flushSchedule = { kind: "idle" };
|
|
74952
|
-
constructor(cacheTable, liveEventPositions, eventIds = new InMemorySessionEventIdAllocator()
|
|
74953
|
-
this.#terminalOutcomes = terminalOutcomes;
|
|
74974
|
+
constructor(cacheTable, liveEventPositions, eventIds = new InMemorySessionEventIdAllocator()) {
|
|
74954
74975
|
this.#eventIds = eventIds;
|
|
74955
74976
|
this.#liveEventPositions = liveEventPositions;
|
|
74956
74977
|
this.#cacheTable = cacheTable;
|
|
@@ -75084,9 +75105,6 @@ var CachedSessionEventStore = class {
|
|
|
75084
75105
|
this.#deletePersisted(sessionId, previous?.sessionGenerationId);
|
|
75085
75106
|
const sessionGenerationId = randomUUID8();
|
|
75086
75107
|
this.#sessions.set(sessionId, new SessionEvents(sessionGenerationId));
|
|
75087
|
-
for (const { event, recordedAt } of this.#terminalOutcomes(sessionId)) {
|
|
75088
|
-
this.append(sessionId, event, recordedAt);
|
|
75089
|
-
}
|
|
75090
75108
|
};
|
|
75091
75109
|
materializedEventCount = (sessionId) => this.#sessions.get(sessionId)?.materializedCount ?? 0;
|
|
75092
75110
|
close = () => {
|
|
@@ -86497,18 +86515,6 @@ var ExecutionReceipts = class {
|
|
|
86497
86515
|
}
|
|
86498
86516
|
return recovered;
|
|
86499
86517
|
};
|
|
86500
|
-
terminalOutcomes = (sessionId) => [...this.#executions.values()].flatMap((receipt) => {
|
|
86501
|
-
if (receipt.sessionId !== sessionId || receipt.outcome === null) {
|
|
86502
|
-
return [];
|
|
86503
|
-
}
|
|
86504
|
-
const decoded = JSON.parse(receipt.outcome);
|
|
86505
|
-
return [
|
|
86506
|
-
{
|
|
86507
|
-
event: sessionEventPayloadSchema.parse(decoded),
|
|
86508
|
-
recordedAt: external_exports.object({ recordedAt: external_exports.string() }).parse(decoded).recordedAt
|
|
86509
|
-
}
|
|
86510
|
-
];
|
|
86511
|
-
});
|
|
86512
86518
|
claimExecution = (commandId, sessionId, commandJson) => {
|
|
86513
86519
|
const commandHash = createHash6("sha256").update(commandJson).digest("hex");
|
|
86514
86520
|
let existing = this.#executions.get(commandId);
|
|
@@ -87124,9 +87130,7 @@ function buildSessionLayer(options) {
|
|
|
87124
87130
|
operations = new ExecutionReceipts(new ExecutionReceiptTable(sessionDatabase), options.onExecutionCountChange);
|
|
87125
87131
|
events = new CachedSessionEventStore(
|
|
87126
87132
|
new SessionEventCacheTable(openSessionEventCacheDatabase(databases.events)),
|
|
87127
|
-
new SqliteSessionLiveEventPosition(new LiveEventPositionTable(sessionDatabase))
|
|
87128
|
-
void 0,
|
|
87129
|
-
(sessionId) => operations.terminalOutcomes(sessionId)
|
|
87133
|
+
new SqliteSessionLiveEventPosition(new LiveEventPositionTable(sessionDatabase))
|
|
87130
87134
|
);
|
|
87131
87135
|
} catch (error62) {
|
|
87132
87136
|
sessionDatabase.close();
|