@moxt-ai/mobius 0.0.405 → 0.0.409

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-SEIA72PR.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
 
@@ -88899,7 +88903,10 @@ var ExecutionReceipts = class {
88899
88903
  /**
88900
88904
  * How the Session's most recently admitted turn ended. Admission order survives updates and
88901
88905
  * restarts. Commands that never started (queued, or reserved for cancellation) are not turns,
88902
- * unless they failed before starting. Undefined while the latest turn runs or none is retained.
88906
+ * unless they failed before starting. A steering command that completed as `steered` joined the
88907
+ * turn it steered, which reports for both; a steer not known to have joined (it failed, or a
88908
+ * restart interrupted it) keeps its own outcome. Undefined while the latest turn runs or none is
88909
+ * retained.
88903
88910
  */
88904
88911
  lastTurn = (sessionId) => {
88905
88912
  let last;
@@ -88909,8 +88916,10 @@ var ExecutionReceipts = class {
88909
88916
  continue;
88910
88917
  }
88911
88918
  const outcome2 = this.outcome(commandId);
88912
- const failedBeforeStart = outcome2?.type === "lifecycle-metadata" && outcome2.payload.kind === "prompt.failed-before-start";
88913
- if ((executionStarted(receipt.state) || failedBeforeStart) && receipt.admissionOrder > latestOrder) {
88919
+ const payload = outcome2?.type === "lifecycle-metadata" ? outcome2.payload : void 0;
88920
+ const failedBeforeStart = payload?.kind === "prompt.failed-before-start";
88921
+ const steered = payload?.kind === "prompt.completed" && promptCompletion(payload).kind === "steered";
88922
+ if ((executionStarted(receipt.state) || failedBeforeStart) && !steered && receipt.admissionOrder > latestOrder) {
88914
88923
  last = commandId;
88915
88924
  latestOrder = receipt.admissionOrder;
88916
88925
  }
@@ -89804,13 +89813,10 @@ function buildSessionLayer(options) {
89804
89813
  };
89805
89814
  }
89806
89815
  );
89807
- const recoveredEvents = operations.recover().map(({ sessionId, event, recordedAt }) => events.append(sessionId, event, recordedAt));
89816
+ for (const { sessionId, event, recordedAt } of operations.recover()) {
89817
+ sink.publish(events.append(sessionId, event, recordedAt));
89818
+ }
89808
89819
  return {
89809
- publishRecoveredOutcomes: () => {
89810
- for (const event of recoveredEvents) {
89811
- sink.publish(event);
89812
- }
89813
- },
89814
89820
  activeSessions,
89815
89821
  directories,
89816
89822
  eventProjection,
@@ -93646,7 +93652,6 @@ async function runRuntime(config2, parentSignal, timer = systemTimer, options =
93646
93652
  reportUpgradeAvailability,
93647
93653
  diagnostics,
93648
93654
  onConnected: () => {
93649
- layer.publishRecoveredOutcomes();
93650
93655
  if (catalogPublished) {
93651
93656
  options.onConnectionStatus?.("online");
93652
93657
  }
@@ -93945,4 +93950,4 @@ export {
93945
93950
  * MIT Licensed
93946
93951
  *)
93947
93952
  */
93948
- //# sourceMappingURL=chunk-2BOWMHCH.js.map
93953
+ //# sourceMappingURL=chunk-PAJOMX6L.js.map