@moxt-ai/mobius 0.0.194 → 0.0.195
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 +105 -54
- package/dist/cli.js.map +3 -3
- package/dist/daemon-history-commands.d.ts.map +1 -1
- package/dist/daemon-history-commands.js +70 -29
- package/dist/daemon-history-commands.js.map +1 -1
- package/dist/index.js +105 -54
- package/dist/index.js.map +3 -3
- package/dist/runtime.js +105 -54
- package/dist/runtime.js.map +3 -3
- package/package.json +1 -1
package/dist/runtime.js
CHANGED
|
@@ -21327,6 +21327,7 @@ var provenanceSchema = external_exports.discriminatedUnion("kind", [
|
|
|
21327
21327
|
]);
|
|
21328
21328
|
var sessionEventFieldsV2 = {
|
|
21329
21329
|
eventId: identifierStringSchema,
|
|
21330
|
+
mobiusMetadata: external_exports.object({ omitted: external_exports.literal(true).optional() }).readonly().optional(),
|
|
21330
21331
|
position: positionSchema,
|
|
21331
21332
|
provenance: provenanceSchema,
|
|
21332
21333
|
recordedAt: external_exports.iso.datetime({ offset: true }),
|
|
@@ -21393,7 +21394,12 @@ var sessionEventLogPageV2Schema = external_exports.object({
|
|
|
21393
21394
|
truncated: external_exports.boolean(),
|
|
21394
21395
|
version: external_exports.literal(2)
|
|
21395
21396
|
}).readonly();
|
|
21396
|
-
var
|
|
21397
|
+
var sessionEventOmissionV2Schema = external_exports.literal("agent-reasoning");
|
|
21398
|
+
var nativeEventPageRequestV2Schema = external_exports.object({
|
|
21399
|
+
cursor: external_exports.string().min(1).max(512).nullable(),
|
|
21400
|
+
eventLimit: external_exports.number().int().min(1).max(1e4),
|
|
21401
|
+
omit: external_exports.array(sessionEventOmissionV2Schema).max(1).readonly().optional()
|
|
21402
|
+
}).readonly();
|
|
21397
21403
|
var queuedPromptRequestEventLogV2Schema = external_exports.object({
|
|
21398
21404
|
commandId: identifierStringSchema,
|
|
21399
21405
|
content: external_exports.array(contentBlockV2Schema).min(1).max(100).readonly(),
|
|
@@ -21440,6 +21446,7 @@ var directoryIdentifier = external_exports.string().regex(/^[a-zA-Z0-9][a-zA-Z0-
|
|
|
21440
21446
|
var pageRequestFields = {
|
|
21441
21447
|
cursor: external_exports.string().min(1).max(512).nullable(),
|
|
21442
21448
|
eventLimit: external_exports.number().int().min(1).max(1e4),
|
|
21449
|
+
omit: external_exports.array(sessionEventOmissionV2Schema).max(1).readonly().optional(),
|
|
21443
21450
|
requestId: identifierStringSchema,
|
|
21444
21451
|
sessionId: identifierStringSchema
|
|
21445
21452
|
};
|
|
@@ -40764,7 +40771,7 @@ import { WebSocket as WebSocket5 } from "undici";
|
|
|
40764
40771
|
// package.json
|
|
40765
40772
|
var package_default = {
|
|
40766
40773
|
name: "@moxt-ai/mobius",
|
|
40767
|
-
version: "0.0.
|
|
40774
|
+
version: "0.0.195",
|
|
40768
40775
|
description: "Mobius CLI for pairing and running local AI agent services.",
|
|
40769
40776
|
type: "module",
|
|
40770
40777
|
bin: {
|
|
@@ -41803,6 +41810,78 @@ async function executeSessionConfigure(socket, command, config2, directories, au
|
|
|
41803
41810
|
}
|
|
41804
41811
|
|
|
41805
41812
|
// src/daemon-history-commands.ts
|
|
41813
|
+
function isAgentReasoning(event) {
|
|
41814
|
+
return event?.type === "acp" && event.payload.sessionUpdate === "agent_thought_chunk";
|
|
41815
|
+
}
|
|
41816
|
+
function omitAgentReasoning(events) {
|
|
41817
|
+
const retained = [];
|
|
41818
|
+
let previousReasoningMessageId;
|
|
41819
|
+
for (const event of events) {
|
|
41820
|
+
if (event.type !== "acp" || event.payload.sessionUpdate !== "agent_thought_chunk") {
|
|
41821
|
+
previousReasoningMessageId = void 0;
|
|
41822
|
+
retained.push(event);
|
|
41823
|
+
continue;
|
|
41824
|
+
}
|
|
41825
|
+
const messageId = event.payload.messageId ?? null;
|
|
41826
|
+
if (previousReasoningMessageId === void 0 || previousReasoningMessageId !== messageId) {
|
|
41827
|
+
retained.push({
|
|
41828
|
+
...event,
|
|
41829
|
+
mobiusMetadata: { omitted: true },
|
|
41830
|
+
payload: { ...event.payload, content: { text: "", type: "text" } }
|
|
41831
|
+
});
|
|
41832
|
+
}
|
|
41833
|
+
previousReasoningMessageId = messageId;
|
|
41834
|
+
}
|
|
41835
|
+
return retained;
|
|
41836
|
+
}
|
|
41837
|
+
async function loadHistoryPage(sessionId, eventLimit, initialCursor, omitReasoning, queuedPromptRequests, load, eventLogV2) {
|
|
41838
|
+
let cursor = initialCursor;
|
|
41839
|
+
let loaded = [];
|
|
41840
|
+
let sessionGenerationId = null;
|
|
41841
|
+
let sourceNextCursor = null;
|
|
41842
|
+
do {
|
|
41843
|
+
const replay = await load(eventLimit, cursor);
|
|
41844
|
+
if (sessionGenerationId !== null && replay.sessionGenerationId !== sessionGenerationId) {
|
|
41845
|
+
throw new AcpExecutionError("The Session reloaded while history was loading", {}, "session_reloaded");
|
|
41846
|
+
}
|
|
41847
|
+
sessionGenerationId = replay.sessionGenerationId;
|
|
41848
|
+
const events2 = replay.events.map(
|
|
41849
|
+
(event, index2) => eventLogV2.event(
|
|
41850
|
+
sessionId,
|
|
41851
|
+
replay.sessionGenerationId,
|
|
41852
|
+
replay.startPosition + index2,
|
|
41853
|
+
event,
|
|
41854
|
+
"1970-01-01T00:00:00.000Z"
|
|
41855
|
+
)
|
|
41856
|
+
);
|
|
41857
|
+
loaded = [...events2, ...loaded];
|
|
41858
|
+
sourceNextCursor = replay.nextCursor;
|
|
41859
|
+
const visible2 = omitReasoning ? omitAgentReasoning(loaded) : loaded;
|
|
41860
|
+
const reasoningContinuesBeforePage = sourceNextCursor !== null && isAgentReasoning(loaded[0]);
|
|
41861
|
+
if (visible2.length >= eventLimit && !reasoningContinuesBeforePage) {
|
|
41862
|
+
break;
|
|
41863
|
+
}
|
|
41864
|
+
cursor = sourceNextCursor;
|
|
41865
|
+
} while (cursor !== null);
|
|
41866
|
+
if (sessionGenerationId === null) {
|
|
41867
|
+
throw new AcpExecutionError("The Session history is unavailable", {}, "session_history_unavailable");
|
|
41868
|
+
}
|
|
41869
|
+
const visible = omitReasoning ? omitAgentReasoning(loaded) : loaded;
|
|
41870
|
+
const events = visible.slice(-eventLimit);
|
|
41871
|
+
const firstPosition = events[0] === void 0 ? 0 : Number(events[0].position);
|
|
41872
|
+
const nextCursor = firstPosition <= 1 ? null : (firstPosition - 1).toString();
|
|
41873
|
+
return {
|
|
41874
|
+
events: {
|
|
41875
|
+
events,
|
|
41876
|
+
nextCursor,
|
|
41877
|
+
sessionGenerationId,
|
|
41878
|
+
tailCursor: events.at(-1)?.eventId ?? "",
|
|
41879
|
+
truncated: nextCursor !== null,
|
|
41880
|
+
version: 2
|
|
41881
|
+
},
|
|
41882
|
+
queuedPromptRequests
|
|
41883
|
+
};
|
|
41884
|
+
}
|
|
41806
41885
|
async function executeSessionLiveHistoryV2PageLoad(socket, command, config2, directories, audit, diagnostics, sessions, nativeSessions, eventLogV2, signal) {
|
|
41807
41886
|
let agentId;
|
|
41808
41887
|
try {
|
|
@@ -41826,35 +41905,23 @@ async function executeSessionLiveHistoryV2PageLoad(socket, command, config2, dir
|
|
|
41826
41905
|
signal
|
|
41827
41906
|
};
|
|
41828
41907
|
const recovery = eventLogV2.promptRequestRecovery(command.sessionId);
|
|
41829
|
-
const
|
|
41830
|
-
|
|
41831
|
-
|
|
41832
|
-
|
|
41833
|
-
|
|
41834
|
-
|
|
41835
|
-
|
|
41836
|
-
|
|
41837
|
-
"1970-01-01T00:00:00.000Z"
|
|
41838
|
-
)
|
|
41908
|
+
const events = await loadHistoryPage(
|
|
41909
|
+
command.sessionId,
|
|
41910
|
+
command.eventLimit,
|
|
41911
|
+
command.cursor,
|
|
41912
|
+
command.omit?.includes("agent-reasoning") === true,
|
|
41913
|
+
recovery.queuedPromptRequests,
|
|
41914
|
+
async (eventLimit, cursor) => await sessions.loadSessionEventsV2(loadOptions, eventLimit, cursor),
|
|
41915
|
+
eventLogV2
|
|
41839
41916
|
);
|
|
41840
|
-
|
|
41917
|
+
signal.throwIfAborted();
|
|
41841
41918
|
audit.record({
|
|
41842
41919
|
commandId: command.requestId,
|
|
41843
41920
|
event: "session_event_log_v2_loaded",
|
|
41844
41921
|
sessionId: command.sessionId
|
|
41845
41922
|
});
|
|
41846
41923
|
send(socket, {
|
|
41847
|
-
events
|
|
41848
|
-
events: {
|
|
41849
|
-
events,
|
|
41850
|
-
nextCursor: replay.nextCursor,
|
|
41851
|
-
sessionGenerationId: replay.sessionGenerationId,
|
|
41852
|
-
tailCursor,
|
|
41853
|
-
truncated: replay.truncated,
|
|
41854
|
-
version: 2
|
|
41855
|
-
},
|
|
41856
|
-
queuedPromptRequests: recovery.queuedPromptRequests
|
|
41857
|
-
},
|
|
41924
|
+
events,
|
|
41858
41925
|
kind: SESSION_LIVE_HISTORY_V2_PAGE_LOADED_KIND,
|
|
41859
41926
|
requestId: command.requestId,
|
|
41860
41927
|
sessionId: command.sessionId
|
|
@@ -41893,46 +41960,30 @@ async function executeSessionPreviewHistoryPageLoad(socket, command, config2, di
|
|
|
41893
41960
|
command.additionalDirectoryIds,
|
|
41894
41961
|
signal
|
|
41895
41962
|
);
|
|
41896
|
-
const
|
|
41897
|
-
|
|
41898
|
-
|
|
41899
|
-
|
|
41900
|
-
|
|
41901
|
-
|
|
41902
|
-
|
|
41903
|
-
|
|
41963
|
+
const loadOptions = {
|
|
41964
|
+
additionalDirectories: resolved.additionalDirectories,
|
|
41965
|
+
agent: await resolveCatalogAgent(config2, command.agentId, signal),
|
|
41966
|
+
cwd: resolved.cwd,
|
|
41967
|
+
sessionId: command.sessionId,
|
|
41968
|
+
signal
|
|
41969
|
+
};
|
|
41970
|
+
const events = await loadHistoryPage(
|
|
41904
41971
|
command.sessionId,
|
|
41905
41972
|
command.eventLimit,
|
|
41906
|
-
command.cursor
|
|
41973
|
+
command.cursor,
|
|
41974
|
+
command.omit?.includes("agent-reasoning") === true,
|
|
41975
|
+
[],
|
|
41976
|
+
async (eventLimit, cursor) => await sessions.previewNativeSessionEventsV2(loadOptions, command.sessionId, eventLimit, cursor),
|
|
41977
|
+
eventLogV2
|
|
41907
41978
|
);
|
|
41908
41979
|
signal.throwIfAborted();
|
|
41909
|
-
const events = replay.events.map(
|
|
41910
|
-
(event, index2) => eventLogV2.event(
|
|
41911
|
-
command.sessionId,
|
|
41912
|
-
replay.sessionGenerationId,
|
|
41913
|
-
replay.startPosition + index2,
|
|
41914
|
-
event,
|
|
41915
|
-
"1970-01-01T00:00:00.000Z"
|
|
41916
|
-
)
|
|
41917
|
-
);
|
|
41918
|
-
const tailCursor = events.at(-1)?.eventId ?? "";
|
|
41919
41980
|
audit.record({
|
|
41920
41981
|
commandId: command.requestId,
|
|
41921
41982
|
event: "session_event_log_v2_loaded",
|
|
41922
41983
|
sessionId: command.sessionId
|
|
41923
41984
|
});
|
|
41924
41985
|
send(socket, {
|
|
41925
|
-
events
|
|
41926
|
-
events: {
|
|
41927
|
-
events,
|
|
41928
|
-
nextCursor: replay.nextCursor,
|
|
41929
|
-
sessionGenerationId: replay.sessionGenerationId,
|
|
41930
|
-
tailCursor,
|
|
41931
|
-
truncated: replay.truncated,
|
|
41932
|
-
version: 2
|
|
41933
|
-
},
|
|
41934
|
-
queuedPromptRequests: []
|
|
41935
|
-
},
|
|
41986
|
+
events,
|
|
41936
41987
|
kind: SESSION_PREVIEW_HISTORY_PAGE_LOADED_KIND,
|
|
41937
41988
|
requestId: command.requestId,
|
|
41938
41989
|
sessionId: command.sessionId
|