@moxt-ai/mobius 0.0.405 → 0.0.408

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.
@@ -3,7 +3,7 @@ import {
3
3
  __export,
4
4
  __using,
5
5
  package_default
6
- } from "./chunk-CVS27UI7.js";
6
+ } from "./chunk-ZPDX3V6A.js";
7
7
 
8
8
  // src/engine/runtime/relay/runtime-revocation.ts
9
9
  var runtimeRevocationCloseCode = 1008;
@@ -86179,7 +86179,7 @@ async function restoreSession(session, signal, recovery, origin) {
86179
86179
  if (origin !== void 0) {
86180
86180
  session.setSessionTitle(origin.title);
86181
86181
  }
86182
- let stored = session.metrics.measureSync(
86182
+ const stored = session.metrics.measureSync(
86183
86183
  "session-state-read",
86184
86184
  () => origin?.kind === "import" ? new FoundStoredSession(
86185
86185
  new StoredSession(
@@ -86193,9 +86193,11 @@ async function restoreSession(session, signal, recovery, origin) {
86193
86193
  )
86194
86194
  ) : session.store.read(session.sessionId)
86195
86195
  );
86196
- if (stored instanceof FoundStoredSession && !stored.session.prompted) {
86196
+ const sameConversation = (record2) => record2.agentId === session.agentId && record2.cwd === session.cwd && arraysEqual(record2.additionalDirectories, session.additionalDirectories);
86197
+ const conversation = stored instanceof FoundStoredSession && stored.session.prompted ? stored.session : void 0;
86198
+ const unprompted = origin?.kind !== "fork" && stored instanceof FoundStoredSession && !stored.session.prompted && sameConversation(stored.session) ? stored.session : void 0;
86199
+ if (stored instanceof FoundStoredSession && !stored.session.prompted && unprompted === void 0) {
86197
86200
  session.store.remove(session.sessionId);
86198
- stored = session.metrics.measureSync("session-state-read", () => session.store.read(session.sessionId));
86199
86201
  }
86200
86202
  const forkSource = origin?.kind === "fork" ? session.store.findNative(session.agentId, origin.nativeSessionId)[0] : void 0;
86201
86203
  let opened;
@@ -86232,10 +86234,10 @@ async function restoreSession(session, signal, recovery, origin) {
86232
86234
  session.startExecutionOnlyCapture();
86233
86235
  }
86234
86236
  opened = forked;
86235
- } else if (stored instanceof FoundStoredSession && stored.session.agentId === session.agentId && stored.session.cwd === session.cwd && arraysEqual(stored.session.additionalDirectories, session.additionalDirectories)) {
86236
- session.selectNativeSession(stored.session.nativeSessionId);
86237
- session.setPrompted(stored.session.prompted);
86238
- session.setSessionTitle(stored.session.title);
86237
+ } else if (conversation !== void 0 && sameConversation(conversation)) {
86238
+ session.selectNativeSession(conversation.nativeSessionId);
86239
+ session.setPrompted(conversation.prompted);
86240
+ session.setSessionTitle(conversation.title);
86239
86241
  session.setRestored(true);
86240
86242
  if (recovery.kind === "history-required") {
86241
86243
  if (!session.capabilities.loadSession) {
@@ -86279,15 +86281,15 @@ async function restoreSession(session, signal, recovery, origin) {
86279
86281
  );
86280
86282
  }
86281
86283
  } else {
86282
- if (stored instanceof FoundStoredSession) {
86283
- if (stored.session.prompted) {
86284
- throw new AcpExecutionError(
86285
- "The agent or workspace cannot change after a conversation has started",
86286
- {},
86287
- "session_identity_mismatch"
86288
- );
86289
- }
86290
- session.store.remove(session.sessionId);
86284
+ if (conversation !== void 0) {
86285
+ throw new AcpExecutionError(
86286
+ "The agent or workspace cannot change after a conversation has started",
86287
+ {},
86288
+ "session_identity_mismatch"
86289
+ );
86290
+ }
86291
+ if (unprompted !== void 0) {
86292
+ session.setSessionTitle(unprompted.title);
86291
86293
  }
86292
86294
  const created = await session.metrics.measure("session-new", async () => await session.createSession(signal));
86293
86295
  session.selectNativeSession(created.nativeSessionId);
@@ -86300,12 +86302,14 @@ async function restoreSession(session, signal, recovery, origin) {
86300
86302
  session.applySessionOpened(opened);
86301
86303
  if (forkSource !== void 0) {
86302
86304
  await session.restoreStoredConfigurations(forkSource, signal, "fork");
86303
- } else if (stored instanceof FoundStoredSession && session.restored) {
86304
- await session.restoreStoredConfigurations(stored.session, signal);
86305
+ } else if (conversation !== void 0 && session.restored) {
86306
+ await session.restoreStoredConfigurations(conversation, signal);
86307
+ } else if (unprompted !== void 0) {
86308
+ await session.restoreStoredConfigurations(unprompted, signal);
86305
86309
  }
86306
86310
  signal.throwIfAborted();
86307
86311
  session.writeStoredSession(
86308
- stored instanceof FoundStoredSession && session.restored ? stored.session.updatedAt : (/* @__PURE__ */ new Date()).toISOString()
86312
+ conversation !== void 0 && session.restored ? conversation.updatedAt : (/* @__PURE__ */ new Date()).toISOString()
86309
86313
  );
86310
86314
  }
86311
86315
 
@@ -89804,13 +89808,10 @@ function buildSessionLayer(options) {
89804
89808
  };
89805
89809
  }
89806
89810
  );
89807
- const recoveredEvents = operations.recover().map(({ sessionId, event, recordedAt }) => events.append(sessionId, event, recordedAt));
89811
+ for (const { sessionId, event, recordedAt } of operations.recover()) {
89812
+ sink.publish(events.append(sessionId, event, recordedAt));
89813
+ }
89808
89814
  return {
89809
- publishRecoveredOutcomes: () => {
89810
- for (const event of recoveredEvents) {
89811
- sink.publish(event);
89812
- }
89813
- },
89814
89815
  activeSessions,
89815
89816
  directories,
89816
89817
  eventProjection,
@@ -93646,7 +93647,6 @@ async function runRuntime(config2, parentSignal, timer = systemTimer, options =
93646
93647
  reportUpgradeAvailability,
93647
93648
  diagnostics,
93648
93649
  onConnected: () => {
93649
- layer.publishRecoveredOutcomes();
93650
93650
  if (catalogPublished) {
93651
93651
  options.onConnectionStatus?.("online");
93652
93652
  }
@@ -93945,4 +93945,4 @@ export {
93945
93945
  * MIT Licensed
93946
93946
  *)
93947
93947
  */
93948
- //# sourceMappingURL=chunk-2BOWMHCH.js.map
93948
+ //# sourceMappingURL=chunk-EEGF33EL.js.map