@moxt-ai/mobius 0.0.321 → 0.0.322

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
@@ -2086,7 +2086,7 @@ var init_package = __esm({
2086
2086
  "package.json"() {
2087
2087
  package_default = {
2088
2088
  name: "@moxt-ai/mobius",
2089
- version: "0.0.321",
2089
+ version: "0.0.322",
2090
2090
  description: "Mobius CLI for pairing and running local AI agent services.",
2091
2091
  type: "module",
2092
2092
  bin: {
@@ -91190,6 +91190,22 @@ async function copyVersionData(root, sourceVersion, targetVersion, signal) {
91190
91190
  await rm3(staging, { recursive: true, force: true });
91191
91191
  }
91192
91192
  }
91193
+ async function discardVersionData(root, version2, signal) {
91194
+ if (await readCurrentDataVersion(root, signal) === version2 || !await versionDataExists(root, version2, signal)) {
91195
+ return;
91196
+ }
91197
+ const versions = join25(root, STATE_ROOT_LAYOUT.versions);
91198
+ const discarded = join25(versions, `.${version2}-discarded-${randomUUID12()}`);
91199
+ try {
91200
+ await rename4(join25(versions, version2), discarded);
91201
+ } catch (cause) {
91202
+ if (isNodeError(cause, "ENOENT")) {
91203
+ return;
91204
+ }
91205
+ throw cause;
91206
+ }
91207
+ await rm3(discarded, { recursive: true, force: true });
91208
+ }
91193
91209
  async function writeCurrentDataVersion(root, version2, signal) {
91194
91210
  await validateLocalPath(root, true, true, signal);
91195
91211
  await validateLocalPath(join25(root, STATE_ROOT_LAYOUT.versions, version2), true, true, signal);
@@ -91430,6 +91446,9 @@ async function prepareVersionData(version2, signal, environment = process.env, f
91430
91446
  );
91431
91447
  }
91432
91448
  }
91449
+ async function discardRolledBackData(version2, signal) {
91450
+ await discardVersionData(readStateDirectory(), runtimeUpgradeVersionSchema.parse(version2), signal);
91451
+ }
91433
91452
  async function recordCurrentData(version2, signal) {
91434
91453
  await writeCurrentDataVersion(readStateDirectory(), runtimeUpgradeVersionSchema.parse(version2), signal);
91435
91454
  }
@@ -92685,6 +92704,7 @@ async function runManager(stateDirectory, signal) {
92685
92704
  retryAfter: Date.now() + 8 * 36e5
92686
92705
  };
92687
92706
  await start(transition2.previous);
92707
+ await discardRolledBackData(transition2.next.version, combined);
92688
92708
  }
92689
92709
  };
92690
92710
  const handle = async (value, requestSignal) => {
@@ -92789,6 +92809,7 @@ var init_manager = __esm({
92789
92809
  init_manager_lock();
92790
92810
  init_local_server();
92791
92811
  init_protocol2();
92812
+ init_data();
92792
92813
  init_unhandled_rejection();
92793
92814
  init_worker_lifecycle_log();
92794
92815
  init_worker_process();
@@ -96040,22 +96061,13 @@ var init_session_manager = __esm({
96040
96061
  throw new AcpExecutionError("The native session is being managed", {}, "session_busy");
96041
96062
  }
96042
96063
  const linked = this.#store.findNative(options2.agent.id, origin.nativeSessionId);
96043
- if (linked.some(
96044
- (entry) => this.#executions.command(entry.sessionId) !== void 0 || this.#executionProcesses.pending(entry.sessionId) !== void 0
96045
- )) {
96046
- throw new AcpExecutionError(
96047
- "Wait for the native session's running operation to finish",
96048
- {},
96049
- "session_busy"
96050
- );
96051
- }
96052
96064
  const existing = linked[0];
96053
96065
  if (origin.kind === "import" && existing !== void 0) {
96054
96066
  return await this.#executionProcesses.use(existing.sessionId, async () => {
96055
96067
  this.#closedSessions.delete(existing.sessionId);
96056
96068
  const target2 = await this.#nativeTargetOptions(options2, existing.sessionId, resolveAgent);
96057
96069
  const runtime = await this.ensureSession(target2);
96058
- if (this.#executions.command(existing.sessionId) !== void 0 || this.#nativeOperations.has(key)) {
96070
+ if (this.#nativeOperations.has(key)) {
96059
96071
  throw new AcpExecutionError(
96060
96072
  "Wait for the native session's running operation to finish",
96061
96073
  {},
@@ -96074,6 +96086,15 @@ var init_session_manager = __esm({
96074
96086
  }
96075
96087
  });
96076
96088
  }
96089
+ if (linked.some(
96090
+ (entry) => this.#executions.command(entry.sessionId) !== void 0 || this.#executionProcesses.pending(entry.sessionId) !== void 0
96091
+ )) {
96092
+ throw new AcpExecutionError(
96093
+ "Wait for the native session's running operation to finish",
96094
+ {},
96095
+ "session_busy"
96096
+ );
96097
+ }
96077
96098
  const target = await this.#nativeTargetOptions(options2, options2.sessionId, resolveAgent);
96078
96099
  if (this.#executionProcesses.get(options2.sessionId) !== void 0 || this.#executionProcesses.pending(options2.sessionId) !== void 0 || this.#store.read(options2.sessionId) instanceof FoundStoredSession) {
96079
96100
  throw new AcpExecutionError(