@adhdev/daemon-core 0.9.82-rc.68 → 0.9.82-rc.69

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/index.mjs CHANGED
@@ -1679,16 +1679,22 @@ var init_mesh_ledger = __esm({
1679
1679
  });
1680
1680
 
1681
1681
  // src/mesh/beads-db.ts
1682
- import Database from "better-sqlite3";
1683
1682
  import { existsSync as existsSync7, mkdirSync as mkdirSync4, readFileSync as readFileSync5 } from "fs";
1684
1683
  import { dirname as dirname2, join as join7 } from "path";
1684
+ import { createRequire } from "module";
1685
+ function loadDatabaseCtor() {
1686
+ if (DatabaseCtor) return DatabaseCtor;
1687
+ const runtimeRequire = typeof __require === "function" ? __require : createRequire(import.meta.url);
1688
+ DatabaseCtor = runtimeRequire("better-sqlite3");
1689
+ return DatabaseCtor;
1690
+ }
1685
1691
  function safeMeshId(meshId) {
1686
1692
  return meshId.replace(/[^a-zA-Z0-9_-]/g, "_");
1687
1693
  }
1688
1694
  function legacyQueuePath(meshId) {
1689
1695
  return join7(getLedgerDir(), `${safeMeshId(meshId)}.queue.json`);
1690
1696
  }
1691
- var BeadsDB;
1697
+ var DatabaseCtor, BeadsDB;
1692
1698
  var init_beads_db = __esm({
1693
1699
  "src/mesh/beads-db.ts"() {
1694
1700
  "use strict";
@@ -1700,7 +1706,7 @@ var init_beads_db = __esm({
1700
1706
  constructor(dbPath) {
1701
1707
  const dir = dirname2(dbPath);
1702
1708
  if (!existsSync7(dir)) mkdirSync4(dir, { recursive: true });
1703
- this.db = new Database(dbPath);
1709
+ this.db = new (loadDatabaseCtor())(dbPath);
1704
1710
  this.db.pragma("journal_mode = WAL");
1705
1711
  this.db.pragma("synchronous = NORMAL");
1706
1712
  this.db.pragma("foreign_keys = ON");
@@ -18547,7 +18553,7 @@ import * as os12 from "os";
18547
18553
  import * as path16 from "path";
18548
18554
  import * as crypto3 from "crypto";
18549
18555
  import * as fs7 from "fs";
18550
- import { createRequire } from "module";
18556
+ import { createRequire as createRequire2 } from "module";
18551
18557
  init_provider_cli_adapter();
18552
18558
  init_logger();
18553
18559
 
@@ -18712,7 +18718,7 @@ function buildIncrementalHistoryAppendMessages(previousMessages, currentMessages
18712
18718
  var CachedDatabaseSync = null;
18713
18719
  function getDatabaseSync() {
18714
18720
  if (CachedDatabaseSync) return CachedDatabaseSync;
18715
- const requireFn = typeof __require === "function" ? __require : createRequire(path16.join(process.cwd(), "__adhdev_sqlite_loader__.js"));
18721
+ const requireFn = typeof __require === "function" ? __require : createRequire2(path16.join(process.cwd(), "__adhdev_sqlite_loader__.js"));
18716
18722
  const sqliteModule = requireFn(`node:${"sqlite"}`);
18717
18723
  CachedDatabaseSync = sqliteModule.DatabaseSync;
18718
18724
  if (!CachedDatabaseSync) {
@@ -28380,7 +28386,17 @@ var DaemonCommandRouter = class {
28380
28386
  ...providerPriority.length ? { providerPriority } : {}
28381
28387
  };
28382
28388
  const role = normalizeMeshDaemonRole(args?.role);
28383
- const node = addNode3(meshId, { workspace, ...policy ? { policy } : {}, ...role ? { role } : {} });
28389
+ const daemonId = typeof args?.daemonId === "string" && args.daemonId.trim() ? args.daemonId.trim() : void 0;
28390
+ const machineId = typeof args?.machineId === "string" && args.machineId.trim() ? args.machineId.trim() : void 0;
28391
+ const repoRoot = typeof args?.repoRoot === "string" && args.repoRoot.trim() ? args.repoRoot.trim() : void 0;
28392
+ const node = addNode3(meshId, {
28393
+ workspace,
28394
+ ...repoRoot ? { repoRoot } : {},
28395
+ ...daemonId ? { daemonId } : {},
28396
+ ...machineId ? { machineId } : {},
28397
+ ...policy ? { policy } : {},
28398
+ ...role ? { role } : {}
28399
+ });
28384
28400
  if (!node) return { success: false, error: "Mesh not found" };
28385
28401
  return { success: true, node };
28386
28402
  } catch (e) {