@adhdev/daemon-standalone 0.9.82-rc.287 → 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 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 ? "542b47e003c32fc24f6325d1fd48a6b3ed745edd" : void 0) ?? "unknown";
29987
- const commitShort = readInjected(true ? "542b47e0" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
29988
- const version2 = readInjected(true ? "0.9.82-rc.287" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
29989
- const builtAt = readInjected(true ? "2026-06-16T02:16:58.716Z" : void 0);
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
  }