@moxt-ai/mobius 0.0.422 → 0.0.424

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.
@@ -80,7 +80,7 @@ var __callDispose = (stack, error, hasError) => {
80
80
  // package.json
81
81
  var package_default = {
82
82
  name: "@moxt-ai/mobius",
83
- version: "0.0.422",
83
+ version: "0.0.424",
84
84
  description: "Mobius CLI for pairing and running local AI agent services.",
85
85
  type: "module",
86
86
  bin: {
@@ -171,4 +171,4 @@ export {
171
171
  __callDispose,
172
172
  package_default
173
173
  };
174
- //# sourceMappingURL=chunk-LYXXD335.js.map
174
+ //# sourceMappingURL=chunk-PWNESRGO.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../package.json"],
4
- "sourcesContent": ["{\n \"name\": \"@moxt-ai/mobius\",\n \"version\": \"0.0.422\",\n \"description\": \"Mobius CLI for pairing and running local AI agent services.\",\n \"type\": \"module\",\n \"bin\": {\n \"mobius\": \"dist/cli.js\"\n },\n \"exports\": {\n \"./engine\": {\n \"mobius-source\": \"./src/exports/engine.ts\",\n \"types\": \"./dist/exports/engine.d.ts\",\n \"default\": \"./dist/engine.js\"\n }\n },\n \"files\": [\n \"dist\",\n \"NOTICE\",\n \"THIRD-PARTY-NOTICES.txt\"\n ],\n \"engines\": {\n \"node\": \">=22.19.0\"\n },\n \"publishConfig\": {\n \"access\": \"public\",\n \"exports\": {\n \"./engine\": {\n \"types\": \"./dist/exports/engine.d.ts\",\n \"import\": \"./dist/engine.js\",\n \"default\": \"./dist/engine.js\"\n }\n }\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/moxt-ai/mobius.git\",\n \"directory\": \"packages/cli\"\n },\n \"scripts\": {\n \"prebuild\": \"tsc --project src/engine/acp/harness/claude/upstream/tsconfig.json && tsc --project src/engine/acp/harness/pi/upstream/tsconfig.json\",\n \"build\": \"node scripts/build.ts && tsc --project tsconfig.build.json\",\n \"dev\": \"node --watch src/cli/entrypoint.ts\",\n \"pretypecheck\": \"tsc --project src/engine/acp/harness/claude/upstream/tsconfig.json && tsc --project src/engine/acp/harness/pi/upstream/tsconfig.json\",\n \"prepack\": \"pnpm build\",\n \"start\": \"node dist/cli.js\",\n \"typecheck\": \"tsc --project tsconfig.json && tsc --project tests/tsconfig.json\",\n \"pretest:controlled\": \"pnpm build\",\n \"test:controlled\": \"vitest run tests/sessions tests/runtime\",\n \"pretest:manual\": \"pnpm pretest:controlled\",\n \"test:manual\": \"vitest run tests/manual\",\n \"pretest:agents\": \"pnpm build\",\n \"test:agents\": \"vitest run tests/agents --maxWorkers=2\",\n \"pretest:pressure\": \"tsc --project src/engine/acp/harness/claude/upstream/tsconfig.json && tsc --project src/engine/acp/harness/pi/upstream/tsconfig.json\",\n \"test:pressure\": \"node tests/pressure/concurrent-sessions.mjs\"\n },\n \"dependencies\": {\n \"undici\": \"8.12.2\"\n },\n \"devDependencies\": {\n \"@agentclientprotocol/sdk\": \"^1.4.0\",\n \"@anthropic-ai/claude-agent-sdk\": \"0.3.257\",\n \"@anthropic-ai/sdk\": \"0.122.0\",\n \"@moxt-ai/mobius-sdk\": \"workspace:*\",\n \"@moxt-ai/mobius-test\": \"workspace:*\",\n \"@types/node\": \"^24.13.5\",\n \"@types/semver\": \"^7.8.0\",\n \"@types/ws\": \"^8.18.1\",\n \"commander\": \"15.0.0\",\n \"drizzle-kit\": \"1.0.0-rc.4\",\n \"drizzle-orm\": \"1.0.0-rc.4\",\n \"esbuild\": \"0.28.2\",\n \"semver\": \"^7.8.5\",\n \"valibot\": \"1.5.0\",\n \"ws\": \"^8.21.3\",\n \"zod\": \"^4.6.7\"\n },\n \"keywords\": [],\n \"author\": \"Moxt\",\n \"license\": \"Apache-2.0\",\n \"bugs\": {\n \"url\": \"https://github.com/moxt-ai/mobius/issues\"\n },\n \"homepage\": \"https://github.com/moxt-ai/mobius#readme\"\n}\n"],
4
+ "sourcesContent": ["{\n \"name\": \"@moxt-ai/mobius\",\n \"version\": \"0.0.424\",\n \"description\": \"Mobius CLI for pairing and running local AI agent services.\",\n \"type\": \"module\",\n \"bin\": {\n \"mobius\": \"dist/cli.js\"\n },\n \"exports\": {\n \"./engine\": {\n \"mobius-source\": \"./src/exports/engine.ts\",\n \"types\": \"./dist/exports/engine.d.ts\",\n \"default\": \"./dist/engine.js\"\n }\n },\n \"files\": [\n \"dist\",\n \"NOTICE\",\n \"THIRD-PARTY-NOTICES.txt\"\n ],\n \"engines\": {\n \"node\": \">=22.19.0\"\n },\n \"publishConfig\": {\n \"access\": \"public\",\n \"exports\": {\n \"./engine\": {\n \"types\": \"./dist/exports/engine.d.ts\",\n \"import\": \"./dist/engine.js\",\n \"default\": \"./dist/engine.js\"\n }\n }\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/moxt-ai/mobius.git\",\n \"directory\": \"packages/cli\"\n },\n \"scripts\": {\n \"prebuild\": \"tsc --project src/engine/acp/harness/claude/upstream/tsconfig.json && tsc --project src/engine/acp/harness/pi/upstream/tsconfig.json\",\n \"build\": \"node scripts/build.ts && tsc --project tsconfig.build.json\",\n \"dev\": \"node --watch src/cli/entrypoint.ts\",\n \"pretypecheck\": \"tsc --project src/engine/acp/harness/claude/upstream/tsconfig.json && tsc --project src/engine/acp/harness/pi/upstream/tsconfig.json\",\n \"prepack\": \"pnpm build\",\n \"start\": \"node dist/cli.js\",\n \"typecheck\": \"tsc --project tsconfig.json && tsc --project tests/tsconfig.json\",\n \"pretest:controlled\": \"pnpm build\",\n \"test:controlled\": \"vitest run tests/sessions tests/runtime\",\n \"pretest:manual\": \"pnpm pretest:controlled\",\n \"test:manual\": \"vitest run tests/manual\",\n \"pretest:agents\": \"pnpm build\",\n \"test:agents\": \"vitest run tests/agents --maxWorkers=2\",\n \"pretest:pressure\": \"tsc --project src/engine/acp/harness/claude/upstream/tsconfig.json && tsc --project src/engine/acp/harness/pi/upstream/tsconfig.json\",\n \"test:pressure\": \"node tests/pressure/concurrent-sessions.mjs\"\n },\n \"dependencies\": {\n \"undici\": \"8.12.2\"\n },\n \"devDependencies\": {\n \"@agentclientprotocol/sdk\": \"^1.4.0\",\n \"@anthropic-ai/claude-agent-sdk\": \"0.3.257\",\n \"@anthropic-ai/sdk\": \"0.122.0\",\n \"@moxt-ai/mobius-sdk\": \"workspace:*\",\n \"@moxt-ai/mobius-test\": \"workspace:*\",\n \"@types/node\": \"^24.13.5\",\n \"@types/semver\": \"^7.8.0\",\n \"@types/ws\": \"^8.18.1\",\n \"commander\": \"15.0.0\",\n \"drizzle-kit\": \"1.0.0-rc.4\",\n \"drizzle-orm\": \"1.0.0-rc.4\",\n \"esbuild\": \"0.28.2\",\n \"semver\": \"^7.8.5\",\n \"valibot\": \"1.5.0\",\n \"ws\": \"^8.21.3\",\n \"zod\": \"^4.6.7\"\n },\n \"keywords\": [],\n \"author\": \"Moxt\",\n \"license\": \"Apache-2.0\",\n \"bugs\": {\n \"url\": \"https://github.com/moxt-ai/mobius/issues\"\n },\n \"homepage\": \"https://github.com/moxt-ai/mobius#readme\"\n}\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,EACI,MAAQ;AAAA,EACR,SAAW;AAAA,EACX,aAAe;AAAA,EACf,MAAQ;AAAA,EACR,KAAO;AAAA,IACH,QAAU;AAAA,EACd;AAAA,EACA,SAAW;AAAA,IACP,YAAY;AAAA,MACR,iBAAiB;AAAA,MACjB,OAAS;AAAA,MACT,SAAW;AAAA,IACf;AAAA,EACJ;AAAA,EACA,OAAS;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACJ;AAAA,EACA,SAAW;AAAA,IACP,MAAQ;AAAA,EACZ;AAAA,EACA,eAAiB;AAAA,IACb,QAAU;AAAA,IACV,SAAW;AAAA,MACP,YAAY;AAAA,QACR,OAAS;AAAA,QACT,QAAU;AAAA,QACV,SAAW;AAAA,MACf;AAAA,IACJ;AAAA,EACJ;AAAA,EACA,YAAc;AAAA,IACV,MAAQ;AAAA,IACR,KAAO;AAAA,IACP,WAAa;AAAA,EACjB;AAAA,EACA,SAAW;AAAA,IACP,UAAY;AAAA,IACZ,OAAS;AAAA,IACT,KAAO;AAAA,IACP,cAAgB;AAAA,IAChB,SAAW;AAAA,IACX,OAAS;AAAA,IACT,WAAa;AAAA,IACb,sBAAsB;AAAA,IACtB,mBAAmB;AAAA,IACnB,kBAAkB;AAAA,IAClB,eAAe;AAAA,IACf,kBAAkB;AAAA,IAClB,eAAe;AAAA,IACf,oBAAoB;AAAA,IACpB,iBAAiB;AAAA,EACrB;AAAA,EACA,cAAgB;AAAA,IACZ,QAAU;AAAA,EACd;AAAA,EACA,iBAAmB;AAAA,IACf,4BAA4B;AAAA,IAC5B,kCAAkC;AAAA,IAClC,qBAAqB;AAAA,IACrB,uBAAuB;AAAA,IACvB,wBAAwB;AAAA,IACxB,eAAe;AAAA,IACf,iBAAiB;AAAA,IACjB,aAAa;AAAA,IACb,WAAa;AAAA,IACb,eAAe;AAAA,IACf,eAAe;AAAA,IACf,SAAW;AAAA,IACX,QAAU;AAAA,IACV,SAAW;AAAA,IACX,IAAM;AAAA,IACN,KAAO;AAAA,EACX;AAAA,EACA,UAAY,CAAC;AAAA,EACb,QAAU;AAAA,EACV,SAAW;AAAA,EACX,MAAQ;AAAA,IACJ,KAAO;AAAA,EACX;AAAA,EACA,UAAY;AAChB;",
6
6
  "names": []
7
7
  }
@@ -3,7 +3,7 @@ import {
3
3
  __export,
4
4
  __using,
5
5
  package_default
6
- } from "./chunk-LYXXD335.js";
6
+ } from "./chunk-PWNESRGO.js";
7
7
 
8
8
  // src/engine/runtime/relay/runtime-revocation.ts
9
9
  var runtimeRevocationCloseCode = 1008;
@@ -97645,6 +97645,7 @@ export {
97645
97645
  connectionFilePath,
97646
97646
  channelIndexFilePath,
97647
97647
  readInstallationFile,
97648
+ createInstallationFile,
97648
97649
  removeInstallationFile,
97649
97650
  isIdentifier,
97650
97651
  decodeRuntimeUpgradeVersion,
@@ -97683,4 +97684,4 @@ export {
97683
97684
  * MIT Licensed
97684
97685
  *)
97685
97686
  */
97686
- //# sourceMappingURL=chunk-KZSWPDB2.js.map
97687
+ //# sourceMappingURL=chunk-RSYDC4H6.js.map
@@ -12,6 +12,7 @@ import {
12
12
  WORKER_LIFECYCLE_LOG_FILENAME,
13
13
  channelIndexFilePath,
14
14
  connectionFilePath,
15
+ createInstallationFile,
15
16
  decodeRuntimeUpgradeVersion,
16
17
  describeRelayFailure,
17
18
  discoverLocalAgentInventory,
@@ -31,10 +32,10 @@ import {
31
32
  unhandledRejectionLogFilename,
32
33
  validateLocalPath,
33
34
  validatePairingId
34
- } from "./chunk-KZSWPDB2.js";
35
+ } from "./chunk-RSYDC4H6.js";
35
36
  import {
36
37
  package_default
37
- } from "./chunk-LYXXD335.js";
38
+ } from "./chunk-PWNESRGO.js";
38
39
 
39
40
  // ../../node_modules/.pnpm/commander@15.0.0/node_modules/commander/lib/error.js
40
41
  var CommanderError = class extends Error {
@@ -3865,8 +3866,11 @@ var RuntimeAgentProcesses = class {
3865
3866
 
3866
3867
  // src/storage/daemon/daemon-lock.ts
3867
3868
  import { randomUUID as randomUUID2 } from "node:crypto";
3868
- import { readFile as readFile3, rename, unlink, writeFile as writeFile2 } from "node:fs/promises";
3869
+ import { readFile as readFile3, rename, unlink } from "node:fs/promises";
3869
3870
  import { join as join7 } from "node:path";
3871
+ import { DatabaseSync } from "node:sqlite";
3872
+ var SQLITE_BUSY = 5;
3873
+ var OWNERSHIP_CONTENTION_MILLISECONDS = 2e3;
3870
3874
  async function removeLockFile(path2) {
3871
3875
  const released = `${path2}.${randomUUID2()}.released`;
3872
3876
  try {
@@ -3876,12 +3880,40 @@ async function removeLockFile(path2) {
3876
3880
  }
3877
3881
  await unlink(released).catch(() => void 0);
3878
3882
  }
3879
- async function acquireDaemonLock(stateDirectory, filename = "manager.lock") {
3880
- const path2 = join7(stateDirectory, filename);
3883
+ function holdDaemonOwnership(path2) {
3884
+ const database = new DatabaseSync(path2);
3885
+ try {
3886
+ database.exec(`PRAGMA busy_timeout = ${OWNERSHIP_CONTENTION_MILLISECONDS.toString()}`);
3887
+ database.exec("BEGIN EXCLUSIVE");
3888
+ database.exec("PRAGMA locking_mode = EXCLUSIVE");
3889
+ } catch (cause) {
3890
+ database.close();
3891
+ if (cause instanceof Error && "errcode" in cause && cause.errcode === SQLITE_BUSY) {
3892
+ return null;
3893
+ }
3894
+ throw cause;
3895
+ }
3896
+ try {
3897
+ database.exec(
3898
+ "CREATE TABLE IF NOT EXISTS daemon_owner (singleton INTEGER PRIMARY KEY CHECK (singleton = 1), pid INTEGER NOT NULL)"
3899
+ );
3900
+ const previous = database.prepare("SELECT pid FROM daemon_owner").get();
3901
+ database.prepare("INSERT OR REPLACE INTO daemon_owner (singleton, pid) VALUES (1, ?)").run(process.pid);
3902
+ database.exec("COMMIT");
3903
+ return {
3904
+ previousOwner: typeof previous?.["pid"] === "number" ? previous["pid"] : null,
3905
+ release: () => database.close()
3906
+ };
3907
+ } catch (cause) {
3908
+ database.close();
3909
+ throw cause;
3910
+ }
3911
+ }
3912
+ async function takeLockFile(path2, previousOwner) {
3881
3913
  for (let attempt = 0; attempt < 2; attempt += 1) {
3882
3914
  try {
3883
- await writeFile2(path2, `${process.pid.toString()}
3884
- `, { flag: "wx", mode: 384 });
3915
+ await createInstallationFile(path2, `${process.pid.toString()}
3916
+ `);
3885
3917
  return async () => await removeLockFile(path2);
3886
3918
  } catch (cause) {
3887
3919
  if (!isNodeError(cause, "EEXIST")) {
@@ -3889,7 +3921,7 @@ async function acquireDaemonLock(stateDirectory, filename = "manager.lock") {
3889
3921
  }
3890
3922
  const encoded = await readFile3(path2, "utf8").catch(() => "");
3891
3923
  const pid = Number(encoded.trim());
3892
- if (Number.isSafeInteger(pid) && pid > 1) {
3924
+ if (Number.isSafeInteger(pid) && pid > 1 && pid !== previousOwner) {
3893
3925
  try {
3894
3926
  process.kill(pid, 0);
3895
3927
  return null;
@@ -3904,6 +3936,29 @@ async function acquireDaemonLock(stateDirectory, filename = "manager.lock") {
3904
3936
  }
3905
3937
  return null;
3906
3938
  }
3939
+ async function acquireDaemonLock(stateDirectory, filename = "manager.lock") {
3940
+ const path2 = join7(stateDirectory, filename);
3941
+ const ownership = holdDaemonOwnership(`${path2}.sqlite`);
3942
+ if (ownership === null) {
3943
+ return null;
3944
+ }
3945
+ let releaseLockFile = null;
3946
+ try {
3947
+ releaseLockFile = await takeLockFile(path2, ownership.previousOwner);
3948
+ } finally {
3949
+ if (releaseLockFile === null) {
3950
+ ownership.release();
3951
+ }
3952
+ }
3953
+ if (releaseLockFile === null) {
3954
+ return null;
3955
+ }
3956
+ const release = releaseLockFile;
3957
+ return async () => {
3958
+ await release();
3959
+ ownership.release();
3960
+ };
3961
+ }
3907
3962
  async function daemonLockExists(stateDirectory, filename = "manager.lock") {
3908
3963
  try {
3909
3964
  const pid = Number((await readFile3(join7(stateDirectory, filename), "utf8")).trim());
@@ -3938,7 +3993,7 @@ import { createConnection } from "node:net";
3938
3993
 
3939
3994
  // src/storage/daemon/control-token.ts
3940
3995
  import { randomBytes } from "node:crypto";
3941
- import { readFile as readFile4, writeFile as writeFile3 } from "node:fs/promises";
3996
+ import { readFile as readFile4 } from "node:fs/promises";
3942
3997
  import { join as join8 } from "node:path";
3943
3998
  function controlTokenPath(stateDirectory) {
3944
3999
  return join8(stateDirectory, "manager.token");
@@ -3954,8 +4009,8 @@ async function readOrCreateControlToken(stateDirectory) {
3954
4009
  }
3955
4010
  const token = randomBytes(32).toString("base64url");
3956
4011
  try {
3957
- await writeFile3(path2, `${token}
3958
- `, { flag: "wx", mode: 384 });
4012
+ await createInstallationFile(path2, `${token}
4013
+ `);
3959
4014
  return token;
3960
4015
  } catch (cause) {
3961
4016
  if (!isNodeError(cause, "EEXIST")) {
@@ -4658,7 +4713,7 @@ import { fork } from "node:child_process";
4658
4713
  import { join as join11, resolve as resolve3 } from "node:path";
4659
4714
 
4660
4715
  // src/storage/diagnostics/relay-probe-files.ts
4661
- import { mkdir, readFile as readFile5, rm as rm2, stat as stat2, writeFile as writeFile4 } from "node:fs/promises";
4716
+ import { mkdir, readFile as readFile5, rm as rm2, stat as stat2, writeFile as writeFile2 } from "node:fs/promises";
4662
4717
  import { join as join9 } from "node:path";
4663
4718
  var ProbeConfigurationFileError = class extends Error {
4664
4719
  code = "probe_config_invalid";
@@ -4685,11 +4740,11 @@ async function ensureProbeDirectory(directory) {
4685
4740
  await mkdir(directory, { recursive: true, mode: 448 });
4686
4741
  }
4687
4742
  async function writeProbeReport(directory, report) {
4688
- await writeFile4(join9(directory, "report.json"), `${JSON.stringify(report, null, 2)}
4743
+ await writeFile2(join9(directory, "report.json"), `${JSON.stringify(report, null, 2)}
4689
4744
  `, { mode: 384 });
4690
4745
  }
4691
4746
  async function writeProbeEvents(directory, events) {
4692
- await writeFile4(join9(directory, "transport.jsonl"), events.map((event) => JSON.stringify(event)).join("\n"), {
4747
+ await writeFile2(join9(directory, "transport.jsonl"), events.map((event) => JSON.stringify(event)).join("\n"), {
4693
4748
  mode: 384
4694
4749
  });
4695
4750
  }
@@ -5733,4 +5788,4 @@ async function runCLI() {
5733
5788
  export {
5734
5789
  runCLI
5735
5790
  };
5736
- //# sourceMappingURL=cli-AT2J5IM3.js.map
5791
+ //# sourceMappingURL=cli-RWGALMSD.js.map