@moxt-ai/mobius 0.0.197 → 0.0.199

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.
Files changed (44) hide show
  1. package/dist/acp/codex/agent.d.ts.map +1 -1
  2. package/dist/acp/codex/agent.js +6 -1
  3. package/dist/acp/codex/agent.js.map +1 -1
  4. package/dist/acp/codex/items.d.ts +2 -2
  5. package/dist/acp/codex/items.d.ts.map +1 -1
  6. package/dist/acp/codex/items.js.map +1 -1
  7. package/dist/acp/session-event-store-v2.d.ts.map +1 -1
  8. package/dist/acp/session-event-store-v2.js +108 -16
  9. package/dist/acp/session-event-store-v2.js.map +1 -1
  10. package/dist/cli.js +148 -52
  11. package/dist/cli.js.map +4 -4
  12. package/dist/daemon-command-handler.d.ts +3 -3
  13. package/dist/daemon-command-handler.d.ts.map +1 -1
  14. package/dist/daemon-command-handler.js +8 -8
  15. package/dist/daemon-command-handler.js.map +1 -1
  16. package/dist/daemon-command-results.d.ts +2 -2
  17. package/dist/daemon-command-results.d.ts.map +1 -1
  18. package/dist/daemon-command-results.js +3 -3
  19. package/dist/daemon-command-results.js.map +1 -1
  20. package/dist/daemon-history-commands.d.ts +3 -3
  21. package/dist/daemon-history-commands.d.ts.map +1 -1
  22. package/dist/daemon-history-commands.js +7 -7
  23. package/dist/daemon-history-commands.js.map +1 -1
  24. package/dist/daemon-prompt-executor.d.ts +3 -3
  25. package/dist/daemon-prompt-executor.d.ts.map +1 -1
  26. package/dist/daemon-prompt-executor.js +5 -5
  27. package/dist/daemon-prompt-executor.js.map +1 -1
  28. package/dist/index.js +148 -52
  29. package/dist/index.js.map +4 -4
  30. package/dist/relay-connection/run-relay-connection.d.ts +3 -3
  31. package/dist/relay-connection/run-relay-connection.d.ts.map +1 -1
  32. package/dist/relay-connection/run-relay-connection.js +2 -2
  33. package/dist/relay-connection/run-relay-connection.js.map +1 -1
  34. package/dist/run-daemon.js +4 -4
  35. package/dist/run-daemon.js.map +1 -1
  36. package/dist/runtime.js +148 -52
  37. package/dist/runtime.js.map +4 -4
  38. package/dist/{session-event-log-v2.d.ts → session-event-projection-v2.d.ts} +3 -3
  39. package/dist/session-event-projection-v2.d.ts.map +1 -0
  40. package/dist/{session-event-log-v2.js → session-event-projection-v2.js} +4 -4
  41. package/dist/session-event-projection-v2.js.map +1 -0
  42. package/package.json +1 -1
  43. package/dist/session-event-log-v2.d.ts.map +0 -1
  44. package/dist/session-event-log-v2.js.map +0 -1
package/dist/index.js CHANGED
@@ -30271,6 +30271,73 @@ var sessionEventV2 = sqliteTable(
30271
30271
  // src/acp/session-event-store-v2.ts
30272
30272
  var HOT_EVENT_HIGH_WATER_MARK = 256;
30273
30273
  var HOT_EVENT_RETENTION = 128;
30274
+ var PositionedSessionEventV2 = class {
30275
+ #event;
30276
+ position;
30277
+ constructor(event, position) {
30278
+ this.#event = event;
30279
+ this.position = position;
30280
+ }
30281
+ get event() {
30282
+ return this.#event;
30283
+ }
30284
+ replaceEvent = (event) => {
30285
+ this.#event = event;
30286
+ };
30287
+ };
30288
+ var SessionEventsV2 = class {
30289
+ hot = [];
30290
+ #toolCallUpdateMap = /* @__PURE__ */ new Map();
30291
+ sessionGenerationId;
30292
+ nextPosition = 1;
30293
+ constructor() {
30294
+ this.sessionGenerationId = randomUUID();
30295
+ }
30296
+ getToolCallUpdate = (toolCallId) => this.#toolCallUpdateMap.get(toolCallId);
30297
+ updateToolCallUpdate = (toolCallId, item) => {
30298
+ const current = this.#toolCallUpdateMap.get(toolCallId);
30299
+ if (current === void 0 || current.position !== item.position) {
30300
+ return false;
30301
+ }
30302
+ current.replaceEvent(item.event);
30303
+ return true;
30304
+ };
30305
+ append = (item) => {
30306
+ this.hot.push(item);
30307
+ const event = item.event;
30308
+ if (event.type === "acp" && (event.payload.sessionUpdate === "tool_call" || event.payload.sessionUpdate === "tool_call_update")) {
30309
+ this.#toolCallUpdateMap.set(event.payload.toolCallId, item);
30310
+ }
30311
+ };
30312
+ removeHotHead = (count) => {
30313
+ this.hot.splice(0, count);
30314
+ };
30315
+ };
30316
+ function projectAppend(session, event, position) {
30317
+ if (event.type !== "acp" || event.payload.sessionUpdate !== "tool_call_update") {
30318
+ return { item: new PositionedSessionEventV2(event, position), kind: "append" };
30319
+ }
30320
+ const update = event.payload;
30321
+ const previous = session.getToolCallUpdate(update.toolCallId);
30322
+ const previousPayload = previous?.event.type === "acp" ? previous.event.payload : void 0;
30323
+ const previousUpdate = previousPayload?.sessionUpdate === "tool_call" || previousPayload?.sessionUpdate === "tool_call_update" ? previousPayload : void 0;
30324
+ const merged = {
30325
+ ...previousUpdate,
30326
+ ...update,
30327
+ sessionUpdate: "tool_call_update",
30328
+ toolCallId: update.toolCallId
30329
+ };
30330
+ const item = new PositionedSessionEventV2({ payload: merged, type: "acp" }, position);
30331
+ return previousPayload?.sessionUpdate !== "tool_call_update" || previous === void 0 ? { item, kind: "append" } : {
30332
+ item,
30333
+ kind: "compact-and-append",
30334
+ previous: new PositionedSessionEventV2(compactedToolCallUpdate(update.toolCallId), previous.position),
30335
+ toolCallId: update.toolCallId
30336
+ };
30337
+ }
30338
+ function compactedToolCallUpdate(toolCallId) {
30339
+ return { payload: { sessionUpdate: "tool_call_update", toolCallId }, type: "acp" };
30340
+ }
30274
30341
  function eventPage(sessionGenerationId, eventCount, eventLimit, cursor, read) {
30275
30342
  const parsedCursor = cursor === null ? eventCount : Number(cursor);
30276
30343
  if (!Number.isSafeInteger(parsedCursor) || parsedCursor < 0 || parsedCursor > eventCount) {
@@ -30298,18 +30365,18 @@ function pageAcpSessionEventsV2(sessionGenerationId, events, eventLimit, cursor)
30298
30365
  var MemoryAcpSessionEventStoreV2 = class {
30299
30366
  #events = /* @__PURE__ */ new Map();
30300
30367
  #session = (sessionId) => {
30301
- const session = this.#events.get(sessionId) ?? {
30302
- hot: [],
30303
- nextPosition: 1,
30304
- sessionGenerationId: randomUUID()
30305
- };
30368
+ const session = this.#events.get(sessionId) ?? new SessionEventsV2();
30306
30369
  this.#events.set(sessionId, session);
30307
30370
  return session;
30308
30371
  };
30309
30372
  append = (sessionId, event) => {
30310
30373
  const session = this.#session(sessionId);
30311
30374
  const position = session.nextPosition;
30312
- session.hot.push({ event, position });
30375
+ const projected = projectAppend(session, event, position);
30376
+ if (projected.kind === "compact-and-append") {
30377
+ session.updateToolCallUpdate(projected.toolCallId, projected.previous);
30378
+ }
30379
+ session.append(projected.item);
30313
30380
  session.nextPosition += 1;
30314
30381
  return { position, sessionGenerationId: session.sessionGenerationId };
30315
30382
  };
@@ -30328,7 +30395,7 @@ var MemoryAcpSessionEventStoreV2 = class {
30328
30395
  this.#events.delete(sessionId);
30329
30396
  };
30330
30397
  reset = (sessionId) => {
30331
- this.#events.set(sessionId, { hot: [], nextPosition: 1, sessionGenerationId: randomUUID() });
30398
+ this.#events.set(sessionId, new SessionEventsV2());
30332
30399
  };
30333
30400
  };
30334
30401
  var cachedEventRowSchema = external_exports.object({ eventJson: external_exports.string(), position: external_exports.number().int().positive() });
@@ -30363,11 +30430,7 @@ var CachedAcpSessionEventStoreV2 = class {
30363
30430
  }
30364
30431
  }
30365
30432
  #session = (sessionId) => {
30366
- const session = this.#sessions.get(sessionId) ?? {
30367
- hot: [],
30368
- nextPosition: 1,
30369
- sessionGenerationId: randomUUID()
30370
- };
30433
+ const session = this.#sessions.get(sessionId) ?? new SessionEventsV2();
30371
30434
  this.#sessions.set(sessionId, session);
30372
30435
  return session;
30373
30436
  };
@@ -30377,7 +30440,11 @@ var CachedAcpSessionEventStoreV2 = class {
30377
30440
  }
30378
30441
  const session = this.#session(sessionId);
30379
30442
  const position = session.nextPosition;
30380
- session.hot.push({ event, position });
30443
+ const projected = projectAppend(session, event, position);
30444
+ if (projected.kind === "compact-and-append") {
30445
+ this.#updateToolCallUpdate(sessionId, session, projected.toolCallId, projected.previous);
30446
+ }
30447
+ session.append(projected.item);
30381
30448
  session.nextPosition += 1;
30382
30449
  this.#sessions.set(sessionId, session);
30383
30450
  if (session.hot.length > HOT_EVENT_HIGH_WATER_MARK) {
@@ -30385,6 +30452,23 @@ var CachedAcpSessionEventStoreV2 = class {
30385
30452
  }
30386
30453
  return { position, sessionGenerationId: session.sessionGenerationId };
30387
30454
  };
30455
+ #updateToolCallUpdate = (sessionId, session, toolCallId, item) => {
30456
+ if (!session.updateToolCallUpdate(toolCallId, item) || !this.#isLocalDBAvailable) {
30457
+ return;
30458
+ }
30459
+ try {
30460
+ this.#database.update(sessionEventV2).set({ eventJson: JSON.stringify(item.event) }).where(
30461
+ and(
30462
+ eq(sessionEventV2.generationId, session.sessionGenerationId),
30463
+ eq(sessionEventV2.sessionId, sessionId),
30464
+ eq(sessionEventV2.position, item.position)
30465
+ )
30466
+ ).run();
30467
+ } catch (cause) {
30468
+ this.#isLocalDBAvailable = false;
30469
+ console.warn("Mobius V2 Session event cache writes are unavailable; retaining events in memory", cause);
30470
+ }
30471
+ };
30388
30472
  #scheduleFlush = () => {
30389
30473
  if (!this.#isLocalDBAvailable || this.#flushSchedule.kind !== "idle") {
30390
30474
  return;
@@ -30431,7 +30515,10 @@ var CachedAcpSessionEventStoreV2 = class {
30431
30515
  }
30432
30516
  });
30433
30517
  for (const batch of batches) {
30434
- this.#sessions.get(batch.sessionId)?.hot.splice(0, batch.count);
30518
+ const session = this.#sessions.get(batch.sessionId);
30519
+ if (session !== void 0) {
30520
+ session.removeHotHead(batch.count);
30521
+ }
30435
30522
  }
30436
30523
  } catch (cause) {
30437
30524
  this.#isLocalDBAvailable = false;
@@ -30452,7 +30539,10 @@ var CachedAcpSessionEventStoreV2 = class {
30452
30539
  )
30453
30540
  ).orderBy(asc(sessionEventV2.position)).all().map((value) => {
30454
30541
  const row = cachedEventRowSchema.parse(value);
30455
- return { event: decodeCachedEvent(JSON.parse(row.eventJson)), position: row.position };
30542
+ return new PositionedSessionEventV2(
30543
+ decodeCachedEvent(JSON.parse(row.eventJson)),
30544
+ row.position
30545
+ );
30456
30546
  });
30457
30547
  const hot = (session?.hot ?? []).filter(
30458
30548
  ({ position }) => position >= startPosition && position <= endPosition
@@ -30486,7 +30576,7 @@ var CachedAcpSessionEventStoreV2 = class {
30486
30576
  reset = (sessionId) => {
30487
30577
  const previous = this.#sessions.get(sessionId);
30488
30578
  this.#deletePersisted(sessionId, previous?.sessionGenerationId);
30489
- this.#sessions.set(sessionId, { hot: [], nextPosition: 1, sessionGenerationId: randomUUID() });
30579
+ this.#sessions.set(sessionId, new SessionEventsV2());
30490
30580
  };
30491
30581
  close = () => {
30492
30582
  if (this.#flushSchedule.kind === "closed") {
@@ -35739,7 +35829,11 @@ var CodexAcpAgent = class {
35739
35829
  const update = toolCallUpdate(item, method === "item/completed" ? "completed" : "started");
35740
35830
  if (update !== null) {
35741
35831
  await this.#enqueue(async () => {
35742
- await this.#emit({ ...update, sessionUpdate: "tool_call_update" });
35832
+ if (method === "item/started") {
35833
+ await this.#emit({ ...update, sessionUpdate: "tool_call" });
35834
+ } else {
35835
+ await this.#emit({ ...update, sessionUpdate: "tool_call_update" });
35836
+ }
35743
35837
  });
35744
35838
  }
35745
35839
  };
@@ -39732,7 +39826,7 @@ function send(socket, message) {
39732
39826
  }
39733
39827
  socket.send(encodeDaemonToServiceMessage(message));
39734
39828
  }
39735
- async function settleAbandonedTurn(eventLog, operations, audit, cancellation) {
39829
+ async function settleAbandonedTurn(projection, operations, audit, cancellation) {
39736
39830
  const attemptId = operations.findUnsettledAttemptId(cancellation.commandId, cancellation.sessionId);
39737
39831
  if (attemptId === null) {
39738
39832
  console.warn("Mobius daemon ignored cancellation for an inactive turn");
@@ -39743,14 +39837,14 @@ async function settleAbandonedTurn(eventLog, operations, audit, cancellation) {
39743
39837
  event: "session_abandoned_turn_settled",
39744
39838
  sessionId: cancellation.sessionId
39745
39839
  });
39746
- await eventLog.failed(
39840
+ await projection.failed(
39747
39841
  cancellation.sessionId,
39748
39842
  cancellation.commandId,
39749
39843
  "agent_execution_abandoned",
39750
39844
  "The local Agent execution was abandoned before it completed"
39751
39845
  );
39752
39846
  operations.transitionExecution(cancellation.commandId, "failed");
39753
- eventLog.publishTerminal(cancellation.sessionId, cancellation.commandId);
39847
+ projection.publishTerminal(cancellation.sessionId, cancellation.commandId);
39754
39848
  }
39755
39849
  function operationErrorCode(error62) {
39756
39850
  if (error62 instanceof AcpExecutionError || error62 instanceof LocalAuthorizationError || error62 instanceof LocalAgentCatalogError || error62 instanceof PromptArtifactError) {
@@ -41900,7 +41994,7 @@ import { WebSocket as WebSocket5 } from "undici";
41900
41994
  // package.json
41901
41995
  var package_default = {
41902
41996
  name: "@moxt-ai/mobius",
41903
- version: "0.0.197",
41997
+ version: "0.0.199",
41904
41998
  description: "Mobius CLI for pairing and running local AI agent services.",
41905
41999
  type: "module",
41906
42000
  bin: {
@@ -42977,7 +43071,7 @@ function omitAgentReasoning(events) {
42977
43071
  }
42978
43072
  return retained;
42979
43073
  }
42980
- async function loadHistoryPage(sessionId, eventLimit, initialCursor, omitReasoning, queuedPromptRequests, load, eventLogV2) {
43074
+ async function loadHistoryPage(sessionId, eventLimit, initialCursor, omitReasoning, queuedPromptRequests, load, eventProjectionV2) {
42981
43075
  let cursor = initialCursor;
42982
43076
  let loaded = [];
42983
43077
  let sessionGenerationId = null;
@@ -42989,7 +43083,7 @@ async function loadHistoryPage(sessionId, eventLimit, initialCursor, omitReasoni
42989
43083
  }
42990
43084
  sessionGenerationId = replay.sessionGenerationId;
42991
43085
  const events2 = replay.events.map(
42992
- (event, index2) => eventLogV2.event(
43086
+ (event, index2) => eventProjectionV2.event(
42993
43087
  sessionId,
42994
43088
  replay.sessionGenerationId,
42995
43089
  replay.startPosition + index2,
@@ -43025,7 +43119,7 @@ async function loadHistoryPage(sessionId, eventLimit, initialCursor, omitReasoni
43025
43119
  queuedPromptRequests
43026
43120
  };
43027
43121
  }
43028
- async function executeSessionLiveHistoryV2PageLoad(socket, command, config2, directories, audit, diagnostics, sessions, nativeSessions, eventLogV2, signal) {
43122
+ async function executeSessionLiveHistoryV2PageLoad(socket, command, config2, directories, audit, diagnostics, sessions, nativeSessions, eventProjectionV2, signal) {
43029
43123
  let agentId;
43030
43124
  try {
43031
43125
  const [entry] = await nativeSessions.querySessions([command.sessionId], signal);
@@ -43047,7 +43141,7 @@ async function executeSessionLiveHistoryV2PageLoad(socket, command, config2, dir
43047
43141
  sessionId: command.sessionId,
43048
43142
  signal
43049
43143
  };
43050
- const recovery = eventLogV2.promptRequestRecovery(command.sessionId);
43144
+ const recovery = eventProjectionV2.promptRequestRecovery(command.sessionId);
43051
43145
  const events = await loadHistoryPage(
43052
43146
  command.sessionId,
43053
43147
  command.eventLimit,
@@ -43055,7 +43149,7 @@ async function executeSessionLiveHistoryV2PageLoad(socket, command, config2, dir
43055
43149
  command.omit?.includes("agent-reasoning") === true,
43056
43150
  recovery.queuedPromptRequests,
43057
43151
  async (eventLimit, cursor) => await sessions.loadSessionEventsV2(loadOptions, eventLimit, cursor),
43058
- eventLogV2
43152
+ eventProjectionV2
43059
43153
  );
43060
43154
  signal.throwIfAborted();
43061
43155
  audit.record({
@@ -43094,7 +43188,7 @@ async function executeSessionLiveHistoryV2PageLoad(socket, command, config2, dir
43094
43188
  }
43095
43189
  }
43096
43190
  }
43097
- async function executeSessionPreviewHistoryPageLoad(socket, command, config2, directories, audit, diagnostics, sessions, eventLogV2, signal) {
43191
+ async function executeSessionPreviewHistoryPageLoad(socket, command, config2, directories, audit, diagnostics, sessions, eventProjectionV2, signal) {
43098
43192
  try {
43099
43193
  const resolved = await resolveSessionDirectories(
43100
43194
  directories,
@@ -43117,7 +43211,7 @@ async function executeSessionPreviewHistoryPageLoad(socket, command, config2, di
43117
43211
  command.omit?.includes("agent-reasoning") === true,
43118
43212
  [],
43119
43213
  async (eventLimit, cursor) => await sessions.previewNativeSessionEventsV2(loadOptions, command.sessionId, eventLimit, cursor),
43120
- eventLogV2
43214
+ eventProjectionV2
43121
43215
  );
43122
43216
  signal.throwIfAborted();
43123
43217
  audit.record({
@@ -43360,7 +43454,7 @@ function daemonActivity(command, activity2) {
43360
43454
  }
43361
43455
  async function executePrompt({
43362
43456
  operations,
43363
- eventLogV2,
43457
+ eventProjectionV2,
43364
43458
  command,
43365
43459
  config: config2,
43366
43460
  directories,
@@ -43440,7 +43534,7 @@ async function executePrompt({
43440
43534
  }
43441
43535
  }
43442
43536
  const stream = activateAttempt();
43443
- const lifecycleV2 = eventLogV2.started(
43537
+ const lifecycleV2 = eventProjectionV2.started(
43444
43538
  command.sessionId,
43445
43539
  command.commandId,
43446
43540
  attemptId,
@@ -43495,7 +43589,7 @@ async function executePrompt({
43495
43589
  });
43496
43590
  stopReason = result.stopReason;
43497
43591
  }
43498
- await eventLogV2.completed(command.sessionId, command.commandId, stopReason);
43592
+ await eventProjectionV2.completed(command.sessionId, command.commandId, stopReason);
43499
43593
  operations.transitionExecution(command.commandId, stopReason === "cancelled" ? "cancelled" : "succeeded");
43500
43594
  audit.record({
43501
43595
  commandId: command.commandId,
@@ -43504,7 +43598,7 @@ async function executePrompt({
43504
43598
  });
43505
43599
  } catch (error62) {
43506
43600
  if (signal.aborted && cancellationRequested()) {
43507
- await eventLogV2.completed(command.sessionId, command.commandId, "cancelled");
43601
+ await eventProjectionV2.completed(command.sessionId, command.commandId, "cancelled");
43508
43602
  operations.transitionExecution(command.commandId, "cancelled");
43509
43603
  audit.record({
43510
43604
  commandId: command.commandId,
@@ -43521,7 +43615,7 @@ async function executePrompt({
43521
43615
  const code = operationErrorCode(error62);
43522
43616
  const failureCode = code === "session_operation_failed" ? "agent_execution_failed" : code;
43523
43617
  const failureMessage = code === "session_operation_failed" ? "The local agent could not complete the request" : operationErrorMessage(error62);
43524
- await eventLogV2.failed(command.sessionId, command.commandId, failureCode, failureMessage);
43618
+ await eventProjectionV2.failed(command.sessionId, command.commandId, failureCode, failureMessage);
43525
43619
  operations.transitionExecution(command.commandId, "failed");
43526
43620
  console.error("Mobius daemon command failed", error62);
43527
43621
  }
@@ -43633,7 +43727,7 @@ function createDaemonCommandHandler({
43633
43727
  installations,
43634
43728
  nativeSessions,
43635
43729
  operations,
43636
- eventLogV2,
43730
+ eventProjectionV2,
43637
43731
  externalContent,
43638
43732
  activeTurns,
43639
43733
  diagnostics,
@@ -43653,7 +43747,7 @@ function createDaemonCommandHandler({
43653
43747
  timer
43654
43748
  });
43655
43749
  const queueChanged = (sessionId) => {
43656
- void eventLogV2.queueChanged(sessionId).catch((error62) => {
43750
+ void eventProjectionV2.queueChanged(sessionId).catch((error62) => {
43657
43751
  console.error("Could not record queue change", error62);
43658
43752
  });
43659
43753
  };
@@ -43713,7 +43807,7 @@ function createDaemonCommandHandler({
43713
43807
  diagnostics,
43714
43808
  sessions,
43715
43809
  nativeSessions,
43716
- eventLogV2,
43810
+ eventProjectionV2,
43717
43811
  signal
43718
43812
  );
43719
43813
  return;
@@ -43727,7 +43821,7 @@ function createDaemonCommandHandler({
43727
43821
  audit,
43728
43822
  diagnostics,
43729
43823
  sessions,
43730
- eventLogV2,
43824
+ eventProjectionV2,
43731
43825
  signal
43732
43826
  );
43733
43827
  return;
@@ -43770,9 +43864,11 @@ function createDaemonCommandHandler({
43770
43864
  const cancellation = message;
43771
43865
  const turn2 = activeTurns.get(cancellation.commandId);
43772
43866
  if (turn2 === void 0 || !turn2.matches(cancellation)) {
43773
- void settleAbandonedTurn(eventLogV2, operations, audit, cancellation).catch((error62) => {
43774
- console.error("Could not settle abandoned turn", error62);
43775
- });
43867
+ void settleAbandonedTurn(eventProjectionV2, operations, audit, cancellation).catch(
43868
+ (error62) => {
43869
+ console.error("Could not settle abandoned turn", error62);
43870
+ }
43871
+ );
43776
43872
  return;
43777
43873
  }
43778
43874
  const cancellationState = turn2.requestCancellation();
@@ -43931,10 +44027,10 @@ function createDaemonCommandHandler({
43931
44027
  return;
43932
44028
  }
43933
44029
  const turn = activeTurns.start(command, receipt.attemptId);
43934
- eventLogV2.requested(command);
44030
+ eventProjectionV2.requested(command);
43935
44031
  void executePrompt({
43936
44032
  operations,
43937
- eventLogV2,
44033
+ eventProjectionV2,
43938
44034
  command,
43939
44035
  config: config2,
43940
44036
  directories,
@@ -43958,7 +44054,7 @@ function createDaemonCommandHandler({
43958
44054
  console.error("Mobius daemon turn failed", error62);
43959
44055
  }).finally(() => {
43960
44056
  activeTurns.finish(turn);
43961
- eventLogV2.publishTerminal(command.sessionId, command.commandId);
44057
+ eventProjectionV2.publishTerminal(command.sessionId, command.commandId);
43962
44058
  if (command.disposition === SessionPromptDisposition.Queue) {
43963
44059
  queueChanged(command.sessionId);
43964
44060
  }
@@ -44200,7 +44296,7 @@ async function runRelayConnection({
44200
44296
  nativeSessions,
44201
44297
  operations,
44202
44298
  publisher,
44203
- eventLogV2,
44299
+ eventProjectionV2,
44204
44300
  externalContent,
44205
44301
  activeTurns,
44206
44302
  connectionEpoch,
@@ -44222,7 +44318,7 @@ async function runRelayConnection({
44222
44318
  installations,
44223
44319
  nativeSessions,
44224
44320
  operations,
44225
- eventLogV2,
44321
+ eventProjectionV2,
44226
44322
  externalContent,
44227
44323
  activeTurns,
44228
44324
  diagnostics,
@@ -44465,7 +44561,7 @@ var SystemDaemonTimer = class {
44465
44561
  };
44466
44562
  var systemDaemonTimer = new SystemDaemonTimer();
44467
44563
 
44468
- // src/session-event-log-v2.ts
44564
+ // src/session-event-projection-v2.ts
44469
44565
  function promptContent(command) {
44470
44566
  const content = [];
44471
44567
  if (command.prompt.length > 0) {
@@ -44489,7 +44585,7 @@ function promptContent(command) {
44489
44585
  }
44490
44586
  return content;
44491
44587
  }
44492
- function sessionEventV22(sessionGenerationId, sessionId, position, event, recordedAt) {
44588
+ function projectSessionEventV2(sessionGenerationId, sessionId, position, event, recordedAt) {
44493
44589
  return {
44494
44590
  eventId: `event-${sessionGenerationId}-${position.toString().padStart(16, "0")}`,
44495
44591
  ...event,
@@ -44500,7 +44596,7 @@ function sessionEventV22(sessionGenerationId, sessionId, position, event, record
44500
44596
  sessionId
44501
44597
  };
44502
44598
  }
44503
- var DaemonSessionEventLogV2 = class {
44599
+ var DaemonSessionEventProjectionV2 = class {
44504
44600
  #publisher;
44505
44601
  #terminal = /* @__PURE__ */ new Map();
44506
44602
  #publications = /* @__PURE__ */ new Map();
@@ -44584,7 +44680,7 @@ var DaemonSessionEventLogV2 = class {
44584
44680
  }
44585
44681
  this.#queued.delete(commandId);
44586
44682
  };
44587
- event = (sessionId, sessionGenerationId, position, event, recordedAt) => sessionEventV22(sessionGenerationId, sessionId, position, event, recordedAt);
44683
+ event = (sessionId, sessionGenerationId, position, event, recordedAt) => projectSessionEventV2(sessionGenerationId, sessionId, position, event, recordedAt);
44588
44684
  queueChanged = async (sessionId) => {
44589
44685
  await this.#recordLifecycle(sessionId, {
44590
44686
  type: "lifecycle-metadata",
@@ -44713,7 +44809,7 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
44713
44809
  await using externalContent = new LocalExternalContentStore(stateDirectory);
44714
44810
  const operations = new DaemonOperationState();
44715
44811
  const publisher = new DaemonSessionEventPublisher(timer);
44716
- const eventLogV2 = new DaemonSessionEventLogV2(
44812
+ const eventProjectionV2 = new DaemonSessionEventProjectionV2(
44717
44813
  publisher,
44718
44814
  (sessionId, event) => agentRuntime.recordLifecycleEventV2(sessionId, event)
44719
44815
  );
@@ -44724,7 +44820,7 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
44724
44820
  if (event.kind === "session.info.updated") {
44725
44821
  publisher.publishInfo(event);
44726
44822
  }
44727
- }, eventLogV2.record),
44823
+ }, eventProjectionV2.record),
44728
44824
  sessionStore,
44729
44825
  {
44730
44826
  access: (options2) => options2.agent.id === "codex" ? {
@@ -44849,7 +44945,7 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
44849
44945
  nativeSessions,
44850
44946
  operations,
44851
44947
  publisher,
44852
- eventLogV2,
44948
+ eventProjectionV2,
44853
44949
  externalContent,
44854
44950
  activeTurns,
44855
44951
  connectionEpoch,