@adhdev/daemon-core 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.mjs CHANGED
@@ -270,10 +270,10 @@ function readInjected(value) {
270
270
  }
271
271
  function getDaemonBuildInfo() {
272
272
  if (cached) return cached;
273
- const commit = readInjected(true ? "542b47e003c32fc24f6325d1fd48a6b3ed745edd" : void 0) ?? "unknown";
274
- const commitShort = readInjected(true ? "542b47e0" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
275
- const version = readInjected(true ? "0.9.82-rc.287" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
276
- const builtAt = readInjected(true ? "2026-06-16T02:16:32.113Z" : void 0);
273
+ const commit = readInjected(true ? "b17916645417b641feddfdaa6e5b249aea09f12a" : void 0) ?? "unknown";
274
+ const commitShort = readInjected(true ? "b1791664" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
275
+ const version = readInjected(true ? "0.9.82-rc.288" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
276
+ const builtAt = readInjected(true ? "2026-06-16T03:12:06.987Z" : void 0);
277
277
  cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
278
278
  return cached;
279
279
  }
@@ -7256,10 +7256,11 @@ function resolveWorkerDelegateRouting(components, instanceId, deps) {
7256
7256
  const sessionId = readNonEmptyString2(instanceId);
7257
7257
  let workspace = "";
7258
7258
  let coordinatorDaemonId = "";
7259
+ let runtimeNodeId = "";
7259
7260
  const reject = (rejectionReason) => ({
7260
7261
  isDelegate: false,
7261
7262
  meshId: "",
7262
- nodeId: "",
7263
+ nodeId: runtimeNodeId,
7263
7264
  nodeLabel: "",
7264
7265
  coordinatorDaemonId,
7265
7266
  workspace,
@@ -7273,6 +7274,7 @@ function resolveWorkerDelegateRouting(components, instanceId, deps) {
7273
7274
  if (!workspace) return reject("no_workspace");
7274
7275
  const settings = readSettings(state);
7275
7276
  coordinatorDaemonId = readNonEmptyString2(settings.meshCoordinatorDaemonId);
7277
+ runtimeNodeId = readNonEmptyString2(settings.meshNodeId);
7276
7278
  const coordinatorMeshId = readNonEmptyString2(settings.meshCoordinatorFor);
7277
7279
  let meshIdFromDirectDispatch = "";
7278
7280
  if (coordinatorMeshId) {
@@ -7293,7 +7295,6 @@ function resolveWorkerDelegateRouting(components, instanceId, deps) {
7293
7295
  const meshId = meshIdFromRuntime || readNonEmptyString2(mesh?.id);
7294
7296
  if (!meshId) return reject("mesh_unresolved");
7295
7297
  const targetNode = mesh?.nodes?.find((n) => n.workspace === workspace);
7296
- const runtimeNodeId = readNonEmptyString2(settings.meshNodeId);
7297
7298
  const nodeId = readNonEmptyString2(targetNode?.id) || runtimeNodeId;
7298
7299
  const nodeLabel = targetNode ? `Node '${targetNode.id}'` : runtimeNodeId ? `Node '${runtimeNodeId}'` : `Agent at ${workspace}`;
7299
7300
  return {
@@ -8460,10 +8461,10 @@ function handleMeshForwardEvent(components, payload) {
8460
8461
  if (!isMeshCoordinatorEvent(eventName)) {
8461
8462
  return { success: false, error: "unsupported mesh event" };
8462
8463
  }
8463
- const meshId = readNonEmptyString2(payload.meshId);
8464
- if (!meshId) return { success: false, error: "meshId required" };
8465
8464
  const nodeId = readNonEmptyString2(payload.nodeId);
8466
8465
  const workspace = readNonEmptyString2(payload.workspace);
8466
+ const meshId = readNonEmptyString2(payload.meshId) || (workspace ? readNonEmptyString2(getCachedMeshByWorkspace(workspace)?.id) : "");
8467
+ if (!meshId) return { success: false, error: "meshId required" };
8467
8468
  const nodeLabel = nodeId ? `Node '${nodeId}'` : workspace ? `Agent at ${workspace}` : "Remote agent";
8468
8469
  const relayModalMessage = readNonEmptyString2(payload.modalMessage);
8469
8470
  const relayModalButtons = Array.isArray(payload.modalButtons) ? payload.modalButtons.filter((b) => typeof b === "string" && b.trim().length > 0) : null;
@@ -8502,6 +8503,24 @@ function handleMeshForwardEvent(components, payload) {
8502
8503
  }
8503
8504
  });
8504
8505
  }
8506
+ function forwardUnresolvedDelegateEvent(components, routing, event) {
8507
+ const coordinatorDaemonId = readNonEmptyString2(routing.coordinatorDaemonId);
8508
+ if (!coordinatorDaemonId) return false;
8509
+ if (!components.dispatchMeshCommand) return false;
8510
+ const eventName = readNonEmptyString2(event.event);
8511
+ if (!eventName) return false;
8512
+ const payload = {
8513
+ ...event,
8514
+ event: eventName,
8515
+ nodeId: readNonEmptyString2(routing.nodeId) || readNonEmptyString2(event.meshNodeId) || void 0,
8516
+ workspace: readNonEmptyString2(routing.workspace) || readNonEmptyString2(event.workspace) || void 0
8517
+ };
8518
+ Promise.resolve(components.dispatchMeshCommand(coordinatorDaemonId, "mesh_forward_event", payload)).catch((e) => {
8519
+ LOG.warn("MeshEvents", `Fallback forward of ${eventName} to coordinator ${coordinatorDaemonId} failed: ${e?.message || e}`);
8520
+ });
8521
+ LOG.info("MeshEvents", `Fallback-forwarded ${eventName} for unresolved-mesh worker at ${routing.workspace || "(no workspace)"} to coordinator daemon ${coordinatorDaemonId}`);
8522
+ return true;
8523
+ }
8505
8524
  function setupMeshEventForwarding(components) {
8506
8525
  components.instanceManager.onEvent((event) => {
8507
8526
  if (event.event === "agent:ready" || event.event === "agent:generating_completed") {
@@ -8551,6 +8570,9 @@ function setupMeshEventForwarding(components) {
8551
8570
  getMeshByWorkspace: (workspace) => getCachedMeshByWorkspace(workspace)
8552
8571
  });
8553
8572
  if (!routing.isDelegate) {
8573
+ if (isUnroutableDelegateRejection(routing) && forwardUnresolvedDelegateEvent(components, routing, event)) {
8574
+ return;
8575
+ }
8554
8576
  recordUnroutableDelegateEvent(routing, event.event);
8555
8577
  return;
8556
8578
  }