@moxt-ai/mobius 0.0.403 → 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.
Files changed (29) hide show
  1. package/dist/{chunk-5S4YJP7Y.js → chunk-EEGF33EL.js} +55 -38
  2. package/dist/{chunk-5S4YJP7Y.js.map → chunk-EEGF33EL.js.map} +3 -3
  3. package/dist/{chunk-KMPTV5P7.js → chunk-ZPDX3V6A.js} +2 -2
  4. package/dist/{chunk-KMPTV5P7.js.map → chunk-ZPDX3V6A.js.map} +1 -1
  5. package/dist/{cli-FQ3VTTOC.js → cli-KWYXFEYZ.js} +19 -6
  6. package/dist/{cli-FQ3VTTOC.js.map → cli-KWYXFEYZ.js.map} +3 -3
  7. package/dist/cli.js +2 -2
  8. package/dist/engine/runtime/run.d.ts.map +1 -1
  9. package/dist/engine/runtime/run.js +0 -1
  10. package/dist/engine/runtime/run.js.map +1 -1
  11. package/dist/engine/session/api/session-layer.d.ts +0 -1
  12. package/dist/engine/session/api/session-layer.d.ts.map +1 -1
  13. package/dist/engine/session/api/session-layer.js +5 -8
  14. package/dist/engine/session/api/session-layer.js.map +1 -1
  15. package/dist/engine/session/live/session-restore.d.ts.map +1 -1
  16. package/dist/engine/session/live/session-restore.js +30 -18
  17. package/dist/engine/session/live/session-restore.js.map +1 -1
  18. package/dist/engine/session/native/native-session-browser.d.ts.map +1 -1
  19. package/dist/engine/session/native/native-session-browser.js +16 -10
  20. package/dist/engine/session/native/native-session-browser.js.map +1 -1
  21. package/dist/engine/session/workspace/workspace-directory.d.ts +10 -0
  22. package/dist/engine/session/workspace/workspace-directory.d.ts.map +1 -1
  23. package/dist/engine/session/workspace/workspace-directory.js +13 -0
  24. package/dist/engine/session/workspace/workspace-directory.js.map +1 -1
  25. package/dist/engine.js +2 -2
  26. package/dist/storage/daemon/daemon-lock.d.ts.map +1 -1
  27. package/dist/storage/daemon/daemon-lock.js +26 -3
  28. package/dist/storage/daemon/daemon-lock.js.map +1 -1
  29. package/package.json +1 -1
@@ -3,7 +3,7 @@ import {
3
3
  __export,
4
4
  __using,
5
5
  package_default
6
- } from "./chunk-KMPTV5P7.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
 
@@ -88356,18 +88360,22 @@ var NativeSessionService = class {
88356
88360
  title: title2
88357
88361
  };
88358
88362
  };
88359
- listSessions = async (limit, signal) => await this.describeSessions(this.#sessions.listSessions(limit), signal);
88360
- querySessions = async (sessionIds, signal) => await this.describeSessions(this.#sessions.findSessions(sessionIds), signal);
88361
- describeSessions = async (sessions, signal) => {
88363
+ listSessions = async (limit, signal) => {
88364
+ signal.throwIfAborted();
88365
+ return this.describeSessions(this.#sessions.listSessions(limit));
88366
+ };
88367
+ querySessions = async (sessionIds, signal) => {
88368
+ signal.throwIfAborted();
88369
+ return this.describeSessions(this.#sessions.findSessions(sessionIds));
88370
+ };
88371
+ describeSessions = (sessions) => {
88362
88372
  const entries = [];
88363
88373
  for (const session of sessions) {
88364
- signal.throwIfAborted();
88365
- const directory = await this.#directories.identify(this.#bindingId, session.cwd, signal);
88366
- const additionalDirectories = [];
88367
- for (const path7 of session.additionalDirectories) {
88368
- const identified = await this.#directories.identify(this.#bindingId, path7, signal);
88369
- additionalDirectories.push({ directoryId: identified.directoryId, name: identified.name });
88370
- }
88374
+ const directory = this.#directories.identifyRecorded(this.#bindingId, session.cwd);
88375
+ const additionalDirectories = session.additionalDirectories.map((path7) => {
88376
+ const identified = this.#directories.identifyRecorded(this.#bindingId, path7);
88377
+ return { directoryId: identified.directoryId, name: identified.name };
88378
+ });
88371
88379
  entries.push({
88372
88380
  additionalDirectories,
88373
88381
  agentId: session.agentId,
@@ -89614,6 +89622,19 @@ var WorkspaceDirectoryService = class {
89614
89622
  label: this.label(path7)
89615
89623
  };
89616
89624
  };
89625
+ /**
89626
+ * Names a directory a Session recorded when it was resolved, without reading the filesystem. A Session
89627
+ * keeps its identity after its directory is moved, deleted or unmounted; using the Session resolves the
89628
+ * directory again and fails there.
89629
+ */
89630
+ identifyRecorded = (bindingId, recordedPath) => {
89631
+ this.authorizeMachine(bindingId);
89632
+ return {
89633
+ directoryId: encodePath(recordedPath),
89634
+ name: basename7(recordedPath) || recordedPath,
89635
+ label: this.label(recordedPath)
89636
+ };
89637
+ };
89617
89638
  resolve = async (bindingId, id, signal) => {
89618
89639
  this.authorizeMachine(bindingId);
89619
89640
  return await this.resolvePath(this.requestedPath(id), signal);
@@ -89787,13 +89808,10 @@ function buildSessionLayer(options) {
89787
89808
  };
89788
89809
  }
89789
89810
  );
89790
- 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
+ }
89791
89814
  return {
89792
- publishRecoveredOutcomes: () => {
89793
- for (const event of recoveredEvents) {
89794
- sink.publish(event);
89795
- }
89796
- },
89797
89815
  activeSessions,
89798
89816
  directories,
89799
89817
  eventProjection,
@@ -93629,7 +93647,6 @@ async function runRuntime(config2, parentSignal, timer = systemTimer, options =
93629
93647
  reportUpgradeAvailability,
93630
93648
  diagnostics,
93631
93649
  onConnected: () => {
93632
- layer.publishRecoveredOutcomes();
93633
93650
  if (catalogPublished) {
93634
93651
  options.onConnectionStatus?.("online");
93635
93652
  }
@@ -93928,4 +93945,4 @@ export {
93928
93945
  * MIT Licensed
93929
93946
  *)
93930
93947
  */
93931
- //# sourceMappingURL=chunk-5S4YJP7Y.js.map
93948
+ //# sourceMappingURL=chunk-EEGF33EL.js.map