@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 CHANGED
@@ -3381,7 +3381,7 @@ var program = new Command();
3381
3381
  // package.json
3382
3382
  var package_default = {
3383
3383
  name: "@moxt-ai/mobius",
3384
- version: "0.0.194",
3384
+ version: "0.0.195",
3385
3385
  description: "Mobius CLI for pairing and running local AI agent services.",
3386
3386
  type: "module",
3387
3387
  bin: {
@@ -27091,6 +27091,7 @@ var provenanceSchema = external_exports.discriminatedUnion("kind", [
27091
27091
  ]);
27092
27092
  var sessionEventFieldsV2 = {
27093
27093
  eventId: identifierStringSchema,
27094
+ mobiusMetadata: external_exports.object({ omitted: external_exports.literal(true).optional() }).readonly().optional(),
27094
27095
  position: positionSchema,
27095
27096
  provenance: provenanceSchema,
27096
27097
  recordedAt: external_exports.iso.datetime({ offset: true }),
@@ -27157,7 +27158,12 @@ var sessionEventLogPageV2Schema = external_exports.object({
27157
27158
  truncated: external_exports.boolean(),
27158
27159
  version: external_exports.literal(2)
27159
27160
  }).readonly();
27160
- var nativeEventPageRequestV2Schema = external_exports.object({ cursor: external_exports.string().min(1).max(512).nullable(), eventLimit: external_exports.number().int().min(1).max(1e4) }).readonly();
27161
+ var sessionEventOmissionV2Schema = external_exports.literal("agent-reasoning");
27162
+ var nativeEventPageRequestV2Schema = external_exports.object({
27163
+ cursor: external_exports.string().min(1).max(512).nullable(),
27164
+ eventLimit: external_exports.number().int().min(1).max(1e4),
27165
+ omit: external_exports.array(sessionEventOmissionV2Schema).max(1).readonly().optional()
27166
+ }).readonly();
27161
27167
  var queuedPromptRequestEventLogV2Schema = external_exports.object({
27162
27168
  commandId: identifierStringSchema,
27163
27169
  content: external_exports.array(contentBlockV2Schema).min(1).max(100).readonly(),
@@ -27204,6 +27210,7 @@ var directoryIdentifier = external_exports.string().regex(/^[a-zA-Z0-9][a-zA-Z0-
27204
27210
  var pageRequestFields = {
27205
27211
  cursor: external_exports.string().min(1).max(512).nullable(),
27206
27212
  eventLimit: external_exports.number().int().min(1).max(1e4),
27213
+ omit: external_exports.array(sessionEventOmissionV2Schema).max(1).readonly().optional(),
27207
27214
  requestId: identifierStringSchema,
27208
27215
  sessionId: identifierStringSchema
27209
27216
  };
@@ -46103,6 +46110,78 @@ async function executeSessionConfigure(socket, command, config2, directories, au
46103
46110
  }
46104
46111
 
46105
46112
  // src/daemon-history-commands.ts
46113
+ function isAgentReasoning(event) {
46114
+ return event?.type === "acp" && event.payload.sessionUpdate === "agent_thought_chunk";
46115
+ }
46116
+ function omitAgentReasoning(events) {
46117
+ const retained = [];
46118
+ let previousReasoningMessageId;
46119
+ for (const event of events) {
46120
+ if (event.type !== "acp" || event.payload.sessionUpdate !== "agent_thought_chunk") {
46121
+ previousReasoningMessageId = void 0;
46122
+ retained.push(event);
46123
+ continue;
46124
+ }
46125
+ const messageId = event.payload.messageId ?? null;
46126
+ if (previousReasoningMessageId === void 0 || previousReasoningMessageId !== messageId) {
46127
+ retained.push({
46128
+ ...event,
46129
+ mobiusMetadata: { omitted: true },
46130
+ payload: { ...event.payload, content: { text: "", type: "text" } }
46131
+ });
46132
+ }
46133
+ previousReasoningMessageId = messageId;
46134
+ }
46135
+ return retained;
46136
+ }
46137
+ async function loadHistoryPage(sessionId, eventLimit, initialCursor, omitReasoning, queuedPromptRequests, load, eventLogV2) {
46138
+ let cursor = initialCursor;
46139
+ let loaded = [];
46140
+ let sessionGenerationId = null;
46141
+ let sourceNextCursor = null;
46142
+ do {
46143
+ const replay = await load(eventLimit, cursor);
46144
+ if (sessionGenerationId !== null && replay.sessionGenerationId !== sessionGenerationId) {
46145
+ throw new AcpExecutionError("The Session reloaded while history was loading", {}, "session_reloaded");
46146
+ }
46147
+ sessionGenerationId = replay.sessionGenerationId;
46148
+ const events2 = replay.events.map(
46149
+ (event, index2) => eventLogV2.event(
46150
+ sessionId,
46151
+ replay.sessionGenerationId,
46152
+ replay.startPosition + index2,
46153
+ event,
46154
+ "1970-01-01T00:00:00.000Z"
46155
+ )
46156
+ );
46157
+ loaded = [...events2, ...loaded];
46158
+ sourceNextCursor = replay.nextCursor;
46159
+ const visible2 = omitReasoning ? omitAgentReasoning(loaded) : loaded;
46160
+ const reasoningContinuesBeforePage = sourceNextCursor !== null && isAgentReasoning(loaded[0]);
46161
+ if (visible2.length >= eventLimit && !reasoningContinuesBeforePage) {
46162
+ break;
46163
+ }
46164
+ cursor = sourceNextCursor;
46165
+ } while (cursor !== null);
46166
+ if (sessionGenerationId === null) {
46167
+ throw new AcpExecutionError("The Session history is unavailable", {}, "session_history_unavailable");
46168
+ }
46169
+ const visible = omitReasoning ? omitAgentReasoning(loaded) : loaded;
46170
+ const events = visible.slice(-eventLimit);
46171
+ const firstPosition = events[0] === void 0 ? 0 : Number(events[0].position);
46172
+ const nextCursor = firstPosition <= 1 ? null : (firstPosition - 1).toString();
46173
+ return {
46174
+ events: {
46175
+ events,
46176
+ nextCursor,
46177
+ sessionGenerationId,
46178
+ tailCursor: events.at(-1)?.eventId ?? "",
46179
+ truncated: nextCursor !== null,
46180
+ version: 2
46181
+ },
46182
+ queuedPromptRequests
46183
+ };
46184
+ }
46106
46185
  async function executeSessionLiveHistoryV2PageLoad(socket, command, config2, directories, audit, diagnostics, sessions, nativeSessions, eventLogV2, signal) {
46107
46186
  let agentId;
46108
46187
  try {
@@ -46126,35 +46205,23 @@ async function executeSessionLiveHistoryV2PageLoad(socket, command, config2, dir
46126
46205
  signal
46127
46206
  };
46128
46207
  const recovery = eventLogV2.promptRequestRecovery(command.sessionId);
46129
- const replay = await sessions.loadSessionEventsV2(loadOptions, command.eventLimit, command.cursor);
46130
- signal.throwIfAborted();
46131
- const events = replay.events.map(
46132
- (event, index2) => eventLogV2.event(
46133
- command.sessionId,
46134
- replay.sessionGenerationId,
46135
- replay.startPosition + index2,
46136
- event,
46137
- "1970-01-01T00:00:00.000Z"
46138
- )
46208
+ const events = await loadHistoryPage(
46209
+ command.sessionId,
46210
+ command.eventLimit,
46211
+ command.cursor,
46212
+ command.omit?.includes("agent-reasoning") === true,
46213
+ recovery.queuedPromptRequests,
46214
+ async (eventLimit, cursor) => await sessions.loadSessionEventsV2(loadOptions, eventLimit, cursor),
46215
+ eventLogV2
46139
46216
  );
46140
- const tailCursor = events.at(-1)?.eventId ?? "";
46217
+ signal.throwIfAborted();
46141
46218
  audit.record({
46142
46219
  commandId: command.requestId,
46143
46220
  event: "session_event_log_v2_loaded",
46144
46221
  sessionId: command.sessionId
46145
46222
  });
46146
46223
  send(socket, {
46147
- events: {
46148
- events: {
46149
- events,
46150
- nextCursor: replay.nextCursor,
46151
- sessionGenerationId: replay.sessionGenerationId,
46152
- tailCursor,
46153
- truncated: replay.truncated,
46154
- version: 2
46155
- },
46156
- queuedPromptRequests: recovery.queuedPromptRequests
46157
- },
46224
+ events,
46158
46225
  kind: SESSION_LIVE_HISTORY_V2_PAGE_LOADED_KIND,
46159
46226
  requestId: command.requestId,
46160
46227
  sessionId: command.sessionId
@@ -46193,46 +46260,30 @@ async function executeSessionPreviewHistoryPageLoad(socket, command, config2, di
46193
46260
  command.additionalDirectoryIds,
46194
46261
  signal
46195
46262
  );
46196
- const replay = await sessions.previewNativeSessionEventsV2(
46197
- {
46198
- additionalDirectories: resolved.additionalDirectories,
46199
- agent: await resolveCatalogAgent(config2, command.agentId, signal),
46200
- cwd: resolved.cwd,
46201
- sessionId: command.sessionId,
46202
- signal
46203
- },
46263
+ const loadOptions = {
46264
+ additionalDirectories: resolved.additionalDirectories,
46265
+ agent: await resolveCatalogAgent(config2, command.agentId, signal),
46266
+ cwd: resolved.cwd,
46267
+ sessionId: command.sessionId,
46268
+ signal
46269
+ };
46270
+ const events = await loadHistoryPage(
46204
46271
  command.sessionId,
46205
46272
  command.eventLimit,
46206
- command.cursor
46273
+ command.cursor,
46274
+ command.omit?.includes("agent-reasoning") === true,
46275
+ [],
46276
+ async (eventLimit, cursor) => await sessions.previewNativeSessionEventsV2(loadOptions, command.sessionId, eventLimit, cursor),
46277
+ eventLogV2
46207
46278
  );
46208
46279
  signal.throwIfAborted();
46209
- const events = replay.events.map(
46210
- (event, index2) => eventLogV2.event(
46211
- command.sessionId,
46212
- replay.sessionGenerationId,
46213
- replay.startPosition + index2,
46214
- event,
46215
- "1970-01-01T00:00:00.000Z"
46216
- )
46217
- );
46218
- const tailCursor = events.at(-1)?.eventId ?? "";
46219
46280
  audit.record({
46220
46281
  commandId: command.requestId,
46221
46282
  event: "session_event_log_v2_loaded",
46222
46283
  sessionId: command.sessionId
46223
46284
  });
46224
46285
  send(socket, {
46225
- events: {
46226
- events: {
46227
- events,
46228
- nextCursor: replay.nextCursor,
46229
- sessionGenerationId: replay.sessionGenerationId,
46230
- tailCursor,
46231
- truncated: replay.truncated,
46232
- version: 2
46233
- },
46234
- queuedPromptRequests: []
46235
- },
46286
+ events,
46236
46287
  kind: SESSION_PREVIEW_HISTORY_PAGE_LOADED_KIND,
46237
46288
  requestId: command.requestId,
46238
46289
  sessionId: command.sessionId