@adhdev/daemon-standalone 0.9.82-rc.286 → 0.9.82-rc.288
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 +50 -12
- 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 ? "b17916645417b641feddfdaa6e5b249aea09f12a" : void 0) ?? "unknown";
|
|
29987
|
+
const commitShort = readInjected(true ? "b1791664" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
29988
|
+
const version2 = readInjected(true ? "0.9.82-rc.288" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
29989
|
+
const builtAt = readInjected(true ? "2026-06-16T03:12:32.272Z" : void 0);
|
|
29990
29990
|
cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
|
|
29991
29991
|
return cached2;
|
|
29992
29992
|
}
|
|
@@ -37023,10 +37023,11 @@ Next step: ${nextStep}`;
|
|
|
37023
37023
|
const sessionId = readNonEmptyString2(instanceId);
|
|
37024
37024
|
let workspace = "";
|
|
37025
37025
|
let coordinatorDaemonId = "";
|
|
37026
|
+
let runtimeNodeId = "";
|
|
37026
37027
|
const reject = (rejectionReason) => ({
|
|
37027
37028
|
isDelegate: false,
|
|
37028
37029
|
meshId: "",
|
|
37029
|
-
nodeId:
|
|
37030
|
+
nodeId: runtimeNodeId,
|
|
37030
37031
|
nodeLabel: "",
|
|
37031
37032
|
coordinatorDaemonId,
|
|
37032
37033
|
workspace,
|
|
@@ -37040,6 +37041,7 @@ Next step: ${nextStep}`;
|
|
|
37040
37041
|
if (!workspace) return reject("no_workspace");
|
|
37041
37042
|
const settings = readSettings(state);
|
|
37042
37043
|
coordinatorDaemonId = readNonEmptyString2(settings.meshCoordinatorDaemonId);
|
|
37044
|
+
runtimeNodeId = readNonEmptyString2(settings.meshNodeId);
|
|
37043
37045
|
const coordinatorMeshId = readNonEmptyString2(settings.meshCoordinatorFor);
|
|
37044
37046
|
let meshIdFromDirectDispatch = "";
|
|
37045
37047
|
if (coordinatorMeshId) {
|
|
@@ -37060,7 +37062,6 @@ Next step: ${nextStep}`;
|
|
|
37060
37062
|
const meshId = meshIdFromRuntime || readNonEmptyString2(mesh?.id);
|
|
37061
37063
|
if (!meshId) return reject("mesh_unresolved");
|
|
37062
37064
|
const targetNode = mesh?.nodes?.find((n) => n.workspace === workspace);
|
|
37063
|
-
const runtimeNodeId = readNonEmptyString2(settings.meshNodeId);
|
|
37064
37065
|
const nodeId = readNonEmptyString2(targetNode?.id) || runtimeNodeId;
|
|
37065
37066
|
const nodeLabel = targetNode ? `Node '${targetNode.id}'` : runtimeNodeId ? `Node '${runtimeNodeId}'` : `Agent at ${workspace}`;
|
|
37066
37067
|
return {
|
|
@@ -38226,10 +38227,10 @@ Next step: ${nextStep}`;
|
|
|
38226
38227
|
if (!isMeshCoordinatorEvent(eventName)) {
|
|
38227
38228
|
return { success: false, error: "unsupported mesh event" };
|
|
38228
38229
|
}
|
|
38229
|
-
const meshId = readNonEmptyString2(payload.meshId);
|
|
38230
|
-
if (!meshId) return { success: false, error: "meshId required" };
|
|
38231
38230
|
const nodeId = readNonEmptyString2(payload.nodeId);
|
|
38232
38231
|
const workspace = readNonEmptyString2(payload.workspace);
|
|
38232
|
+
const meshId = readNonEmptyString2(payload.meshId) || (workspace ? readNonEmptyString2(getCachedMeshByWorkspace(workspace)?.id) : "");
|
|
38233
|
+
if (!meshId) return { success: false, error: "meshId required" };
|
|
38233
38234
|
const nodeLabel = nodeId ? `Node '${nodeId}'` : workspace ? `Agent at ${workspace}` : "Remote agent";
|
|
38234
38235
|
const relayModalMessage = readNonEmptyString2(payload.modalMessage);
|
|
38235
38236
|
const relayModalButtons = Array.isArray(payload.modalButtons) ? payload.modalButtons.filter((b) => typeof b === "string" && b.trim().length > 0) : null;
|
|
@@ -38268,6 +38269,24 @@ Next step: ${nextStep}`;
|
|
|
38268
38269
|
}
|
|
38269
38270
|
});
|
|
38270
38271
|
}
|
|
38272
|
+
function forwardUnresolvedDelegateEvent(components, routing, event) {
|
|
38273
|
+
const coordinatorDaemonId = readNonEmptyString2(routing.coordinatorDaemonId);
|
|
38274
|
+
if (!coordinatorDaemonId) return false;
|
|
38275
|
+
if (!components.dispatchMeshCommand) return false;
|
|
38276
|
+
const eventName = readNonEmptyString2(event.event);
|
|
38277
|
+
if (!eventName) return false;
|
|
38278
|
+
const payload = {
|
|
38279
|
+
...event,
|
|
38280
|
+
event: eventName,
|
|
38281
|
+
nodeId: readNonEmptyString2(routing.nodeId) || readNonEmptyString2(event.meshNodeId) || void 0,
|
|
38282
|
+
workspace: readNonEmptyString2(routing.workspace) || readNonEmptyString2(event.workspace) || void 0
|
|
38283
|
+
};
|
|
38284
|
+
Promise.resolve(components.dispatchMeshCommand(coordinatorDaemonId, "mesh_forward_event", payload)).catch((e) => {
|
|
38285
|
+
LOG2.warn("MeshEvents", `Fallback forward of ${eventName} to coordinator ${coordinatorDaemonId} failed: ${e?.message || e}`);
|
|
38286
|
+
});
|
|
38287
|
+
LOG2.info("MeshEvents", `Fallback-forwarded ${eventName} for unresolved-mesh worker at ${routing.workspace || "(no workspace)"} to coordinator daemon ${coordinatorDaemonId}`);
|
|
38288
|
+
return true;
|
|
38289
|
+
}
|
|
38271
38290
|
function setupMeshEventForwarding(components) {
|
|
38272
38291
|
components.instanceManager.onEvent((event) => {
|
|
38273
38292
|
if (event.event === "agent:ready" || event.event === "agent:generating_completed") {
|
|
@@ -38317,6 +38336,9 @@ Next step: ${nextStep}`;
|
|
|
38317
38336
|
getMeshByWorkspace: (workspace) => getCachedMeshByWorkspace(workspace)
|
|
38318
38337
|
});
|
|
38319
38338
|
if (!routing.isDelegate) {
|
|
38339
|
+
if (isUnroutableDelegateRejection(routing) && forwardUnresolvedDelegateEvent(components, routing, event)) {
|
|
38340
|
+
return;
|
|
38341
|
+
}
|
|
38320
38342
|
recordUnroutableDelegateEvent(routing, event.event);
|
|
38321
38343
|
return;
|
|
38322
38344
|
}
|
|
@@ -38426,6 +38448,20 @@ Next step: ${nextStep}`;
|
|
|
38426
38448
|
if (!hostDaemonId) return true;
|
|
38427
38449
|
return daemonIds.includes(hostDaemonId);
|
|
38428
38450
|
}
|
|
38451
|
+
function resolveCoordinatorSelfIds(mesh, drainDaemonIds) {
|
|
38452
|
+
const ids = new Set(drainDaemonIds);
|
|
38453
|
+
for (const node of mesh.nodes) {
|
|
38454
|
+
const nodeDaemonId = readNonEmptyString2(node.daemonId);
|
|
38455
|
+
const nodeMachineId = readNonEmptyString2(node.machineId);
|
|
38456
|
+
const isSelf = nodeDaemonId && drainDaemonIds.includes(nodeDaemonId) || nodeMachineId && drainDaemonIds.includes(nodeMachineId);
|
|
38457
|
+
if (!isSelf) continue;
|
|
38458
|
+
if (nodeDaemonId) ids.add(nodeDaemonId);
|
|
38459
|
+
if (nodeMachineId) ids.add(nodeMachineId);
|
|
38460
|
+
}
|
|
38461
|
+
const hostDaemonId = readNonEmptyString2(mesh.meshHost?.hostDaemonId);
|
|
38462
|
+
if (hostDaemonId && ids.has(hostDaemonId)) ids.add(hostDaemonId);
|
|
38463
|
+
return [...ids];
|
|
38464
|
+
}
|
|
38429
38465
|
function findLiveCoordinators(components) {
|
|
38430
38466
|
const out = [];
|
|
38431
38467
|
for (const inst of components.instanceManager.getByCategory("cli")) {
|
|
@@ -38459,9 +38495,10 @@ Next step: ${nextStep}`;
|
|
|
38459
38495
|
})();
|
|
38460
38496
|
if (dispatchMeshCommand) {
|
|
38461
38497
|
for (const mesh of listMeshes()) {
|
|
38462
|
-
|
|
38498
|
+
const selfIds = resolveCoordinatorSelfIds(mesh, drainDaemonIds);
|
|
38499
|
+
if (!daemonHostsMesh(mesh, selfIds)) continue;
|
|
38463
38500
|
try {
|
|
38464
|
-
await pullRemoteNodeQueues(components, mesh, localDaemonId,
|
|
38501
|
+
await pullRemoteNodeQueues(components, mesh, localDaemonId, selfIds);
|
|
38465
38502
|
} catch (e) {
|
|
38466
38503
|
LOG2.warn("MeshReconcile", `Remote node pull failed for mesh ${mesh.id}: ${e?.message || e}`);
|
|
38467
38504
|
}
|
|
@@ -38509,15 +38546,16 @@ Next step: ${nextStep}`;
|
|
|
38509
38546
|
}
|
|
38510
38547
|
}
|
|
38511
38548
|
}
|
|
38512
|
-
async function pullRemoteNodeQueues(components, mesh, localDaemonId,
|
|
38549
|
+
async function pullRemoteNodeQueues(components, mesh, localDaemonId, candidateDaemonIds) {
|
|
38513
38550
|
const dispatchMeshCommand = components.dispatchMeshCommand;
|
|
38514
38551
|
if (!dispatchMeshCommand) return;
|
|
38515
38552
|
const meshId = mesh.id;
|
|
38516
|
-
const pulls =
|
|
38553
|
+
const pulls = candidateDaemonIds.length > 0 ? candidateDaemonIds.map((id) => ({ meshId, coordinatorDaemonId: id })) : [{ meshId }];
|
|
38517
38554
|
for (const node of mesh.nodes) {
|
|
38518
38555
|
const nodeDaemonId = readNonEmptyString2(node.daemonId);
|
|
38519
38556
|
if (!nodeDaemonId) continue;
|
|
38520
38557
|
if (localDaemonId && nodeDaemonId === localDaemonId) continue;
|
|
38558
|
+
if (candidateDaemonIds.includes(nodeDaemonId)) continue;
|
|
38521
38559
|
for (const pendingEventArgs of pulls) {
|
|
38522
38560
|
let events;
|
|
38523
38561
|
try {
|