@adhdev/daemon-core 0.9.82-rc.67 → 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.js +21 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/commands/router.ts +11 -1
- package/src/mesh/beads-db.ts +16 -3
package/dist/index.js
CHANGED
|
@@ -1684,20 +1684,27 @@ var init_mesh_ledger = __esm({
|
|
|
1684
1684
|
});
|
|
1685
1685
|
|
|
1686
1686
|
// src/mesh/beads-db.ts
|
|
1687
|
+
function loadDatabaseCtor() {
|
|
1688
|
+
if (DatabaseCtor) return DatabaseCtor;
|
|
1689
|
+
const runtimeRequire = typeof require === "function" ? require : (0, import_module.createRequire)(import_meta.url);
|
|
1690
|
+
DatabaseCtor = runtimeRequire("better-sqlite3");
|
|
1691
|
+
return DatabaseCtor;
|
|
1692
|
+
}
|
|
1687
1693
|
function safeMeshId(meshId) {
|
|
1688
1694
|
return meshId.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
1689
1695
|
}
|
|
1690
1696
|
function legacyQueuePath(meshId) {
|
|
1691
1697
|
return (0, import_path5.join)(getLedgerDir(), `${safeMeshId(meshId)}.queue.json`);
|
|
1692
1698
|
}
|
|
1693
|
-
var
|
|
1699
|
+
var import_fs5, import_path5, import_module, import_meta, DatabaseCtor, BeadsDB;
|
|
1694
1700
|
var init_beads_db = __esm({
|
|
1695
1701
|
"src/mesh/beads-db.ts"() {
|
|
1696
1702
|
"use strict";
|
|
1697
|
-
import_better_sqlite3 = __toESM(require("better-sqlite3"));
|
|
1698
1703
|
import_fs5 = require("fs");
|
|
1699
1704
|
import_path5 = require("path");
|
|
1705
|
+
import_module = require("module");
|
|
1700
1706
|
init_mesh_ledger();
|
|
1707
|
+
import_meta = {};
|
|
1701
1708
|
BeadsDB = class _BeadsDB {
|
|
1702
1709
|
static instance;
|
|
1703
1710
|
db;
|
|
@@ -1705,7 +1712,7 @@ var init_beads_db = __esm({
|
|
|
1705
1712
|
constructor(dbPath) {
|
|
1706
1713
|
const dir = (0, import_path5.dirname)(dbPath);
|
|
1707
1714
|
if (!(0, import_fs5.existsSync)(dir)) (0, import_fs5.mkdirSync)(dir, { recursive: true });
|
|
1708
|
-
this.db = new
|
|
1715
|
+
this.db = new (loadDatabaseCtor())(dbPath);
|
|
1709
1716
|
this.db.pragma("journal_mode = WAL");
|
|
1710
1717
|
this.db.pragma("synchronous = NORMAL");
|
|
1711
1718
|
this.db.pragma("foreign_keys = ON");
|
|
@@ -28633,7 +28640,17 @@ var DaemonCommandRouter = class {
|
|
|
28633
28640
|
...providerPriority.length ? { providerPriority } : {}
|
|
28634
28641
|
};
|
|
28635
28642
|
const role = normalizeMeshDaemonRole(args?.role);
|
|
28636
|
-
const
|
|
28643
|
+
const daemonId = typeof args?.daemonId === "string" && args.daemonId.trim() ? args.daemonId.trim() : void 0;
|
|
28644
|
+
const machineId = typeof args?.machineId === "string" && args.machineId.trim() ? args.machineId.trim() : void 0;
|
|
28645
|
+
const repoRoot = typeof args?.repoRoot === "string" && args.repoRoot.trim() ? args.repoRoot.trim() : void 0;
|
|
28646
|
+
const node = addNode3(meshId, {
|
|
28647
|
+
workspace,
|
|
28648
|
+
...repoRoot ? { repoRoot } : {},
|
|
28649
|
+
...daemonId ? { daemonId } : {},
|
|
28650
|
+
...machineId ? { machineId } : {},
|
|
28651
|
+
...policy ? { policy } : {},
|
|
28652
|
+
...role ? { role } : {}
|
|
28653
|
+
});
|
|
28637
28654
|
if (!node) return { success: false, error: "Mesh not found" };
|
|
28638
28655
|
return { success: true, node };
|
|
28639
28656
|
} catch (e) {
|