@adhdev/daemon-standalone 0.9.82-rc.284 → 0.9.82-rc.285
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 +45 -36
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -29983,10 +29983,10 @@ var require_dist3 = __commonJS({
|
|
|
29983
29983
|
}
|
|
29984
29984
|
function getDaemonBuildInfo() {
|
|
29985
29985
|
if (cached2) return cached2;
|
|
29986
|
-
const commit = readInjected(true ? "
|
|
29987
|
-
const commitShort = readInjected(true ? "
|
|
29988
|
-
const version2 = readInjected(true ? "0.9.82-rc.
|
|
29989
|
-
const builtAt = readInjected(true ? "2026-06-
|
|
29986
|
+
const commit = readInjected(true ? "ff6934b27530406c46b2c1835f9f3708f8fa4aba" : void 0) ?? "unknown";
|
|
29987
|
+
const commitShort = readInjected(true ? "ff6934b2" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
29988
|
+
const version2 = readInjected(true ? "0.9.82-rc.285" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
29989
|
+
const builtAt = readInjected(true ? "2026-06-16T00:32:01.678Z" : void 0);
|
|
29990
29990
|
cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
|
|
29991
29991
|
return cached2;
|
|
29992
29992
|
}
|
|
@@ -38418,6 +38418,14 @@ Next step: ${nextStep}`;
|
|
|
38418
38418
|
if (machineId) ids.add(machineId);
|
|
38419
38419
|
return [...ids];
|
|
38420
38420
|
}
|
|
38421
|
+
function daemonHostsMesh(mesh, daemonIds) {
|
|
38422
|
+
const host = mesh.meshHost;
|
|
38423
|
+
if (!host) return true;
|
|
38424
|
+
if (host.role && host.role !== "host") return false;
|
|
38425
|
+
const hostDaemonId = readNonEmptyString2(host.hostDaemonId);
|
|
38426
|
+
if (!hostDaemonId) return true;
|
|
38427
|
+
return daemonIds.includes(hostDaemonId);
|
|
38428
|
+
}
|
|
38421
38429
|
function findLiveCoordinators(components) {
|
|
38422
38430
|
const out = [];
|
|
38423
38431
|
for (const inst of components.instanceManager.getByCategory("cli")) {
|
|
@@ -38439,16 +38447,6 @@ Next step: ${nextStep}`;
|
|
|
38439
38447
|
});
|
|
38440
38448
|
}
|
|
38441
38449
|
async function runMeshReconcileTick(components) {
|
|
38442
|
-
const coordinators = findLiveCoordinators(components);
|
|
38443
|
-
if (coordinators.length === 0) {
|
|
38444
|
-
return;
|
|
38445
|
-
}
|
|
38446
|
-
const byMesh = /* @__PURE__ */ new Map();
|
|
38447
|
-
for (const c of coordinators) {
|
|
38448
|
-
const list = byMesh.get(c.meshId);
|
|
38449
|
-
if (list) list.push(c);
|
|
38450
|
-
else byMesh.set(c.meshId, [c]);
|
|
38451
|
-
}
|
|
38452
38450
|
const localDaemonId = readNonEmptyString2(loadConfig2().machineId) || void 0;
|
|
38453
38451
|
const drainDaemonIds = resolveCoordinatorDaemonIds(components);
|
|
38454
38452
|
const dispatchMeshCommand = components.dispatchMeshCommand;
|
|
@@ -38459,14 +38457,27 @@ Next step: ${nextStep}`;
|
|
|
38459
38457
|
return void 0;
|
|
38460
38458
|
}
|
|
38461
38459
|
})();
|
|
38462
|
-
|
|
38463
|
-
|
|
38460
|
+
if (dispatchMeshCommand) {
|
|
38461
|
+
for (const mesh of listMeshes()) {
|
|
38462
|
+
if (!daemonHostsMesh(mesh, drainDaemonIds)) continue;
|
|
38464
38463
|
try {
|
|
38465
|
-
await pullRemoteNodeQueues(components,
|
|
38464
|
+
await pullRemoteNodeQueues(components, mesh, localDaemonId, drainDaemonIds);
|
|
38466
38465
|
} catch (e) {
|
|
38467
|
-
LOG2.warn("MeshReconcile", `Remote node pull failed for mesh ${
|
|
38466
|
+
LOG2.warn("MeshReconcile", `Remote node pull failed for mesh ${mesh.id}: ${e?.message || e}`);
|
|
38468
38467
|
}
|
|
38469
38468
|
}
|
|
38469
|
+
}
|
|
38470
|
+
const coordinators = findLiveCoordinators(components);
|
|
38471
|
+
if (coordinators.length === 0) {
|
|
38472
|
+
return;
|
|
38473
|
+
}
|
|
38474
|
+
const byMesh = /* @__PURE__ */ new Map();
|
|
38475
|
+
for (const c of coordinators) {
|
|
38476
|
+
const list = byMesh.get(c.meshId);
|
|
38477
|
+
if (list) list.push(c);
|
|
38478
|
+
else byMesh.set(c.meshId, [c]);
|
|
38479
|
+
}
|
|
38480
|
+
for (const [meshId, meshCoordinators] of byMesh) {
|
|
38470
38481
|
const idleCoordinators = meshCoordinators.filter((c) => c.idle);
|
|
38471
38482
|
const generatingCoordinators = meshCoordinators.filter((c) => !c.idle);
|
|
38472
38483
|
const targetCoordinators = idleCoordinators.length > 0 ? idleCoordinators : generatingCoordinators;
|
|
@@ -38498,32 +38509,30 @@ Next step: ${nextStep}`;
|
|
|
38498
38509
|
}
|
|
38499
38510
|
}
|
|
38500
38511
|
}
|
|
38501
|
-
async function pullRemoteNodeQueues(components,
|
|
38512
|
+
async function pullRemoteNodeQueues(components, mesh, localDaemonId, drainDaemonIds) {
|
|
38502
38513
|
const dispatchMeshCommand = components.dispatchMeshCommand;
|
|
38503
38514
|
if (!dispatchMeshCommand) return;
|
|
38504
|
-
const
|
|
38505
|
-
|
|
38506
|
-
const pendingEventArgs = {
|
|
38507
|
-
meshId,
|
|
38508
|
-
...localDaemonId ? { coordinatorDaemonId: localDaemonId } : {}
|
|
38509
|
-
};
|
|
38515
|
+
const meshId = mesh.id;
|
|
38516
|
+
const pulls = drainDaemonIds.length > 0 ? drainDaemonIds.map((id) => ({ meshId, coordinatorDaemonId: id })) : [{ meshId }];
|
|
38510
38517
|
for (const node of mesh.nodes) {
|
|
38511
38518
|
const nodeDaemonId = readNonEmptyString2(node.daemonId);
|
|
38512
38519
|
if (!nodeDaemonId) continue;
|
|
38513
38520
|
if (localDaemonId && nodeDaemonId === localDaemonId) continue;
|
|
38514
|
-
|
|
38515
|
-
|
|
38516
|
-
events = await dispatchMeshCommand(nodeDaemonId, "get_pending_mesh_events", pendingEventArgs);
|
|
38517
|
-
} catch {
|
|
38518
|
-
continue;
|
|
38519
|
-
}
|
|
38520
|
-
const list = extractPendingEvents(events).filter((e) => readNonEmptyString2(e?.meshId) === meshId);
|
|
38521
|
-
for (const event of list) {
|
|
38522
|
-
const payload = buildForwardPayloadFromPending(event);
|
|
38523
|
-
if (!payload.event || !payload.meshId) continue;
|
|
38521
|
+
for (const pendingEventArgs of pulls) {
|
|
38522
|
+
let events;
|
|
38524
38523
|
try {
|
|
38525
|
-
|
|
38524
|
+
events = await dispatchMeshCommand(nodeDaemonId, "get_pending_mesh_events", pendingEventArgs);
|
|
38526
38525
|
} catch {
|
|
38526
|
+
break;
|
|
38527
|
+
}
|
|
38528
|
+
const list = extractPendingEvents(events).filter((e) => readNonEmptyString2(e?.meshId) === meshId);
|
|
38529
|
+
for (const event of list) {
|
|
38530
|
+
const payload = buildForwardPayloadFromPending(event);
|
|
38531
|
+
if (!payload.event || !payload.meshId) continue;
|
|
38532
|
+
try {
|
|
38533
|
+
handleMeshForwardEvent(components, payload);
|
|
38534
|
+
} catch {
|
|
38535
|
+
}
|
|
38527
38536
|
}
|
|
38528
38537
|
}
|
|
38529
38538
|
}
|