@adhdev/daemon-standalone 0.9.82-rc.382 → 0.9.82-rc.384

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
@@ -30108,10 +30108,10 @@ var require_dist3 = __commonJS({
30108
30108
  }
30109
30109
  function getDaemonBuildInfo() {
30110
30110
  if (cached2) return cached2;
30111
- const commit = readInjected(true ? "70741c4fe19c6f71bcef702e7e149d963d6fd916" : void 0) ?? "unknown";
30112
- const commitShort = readInjected(true ? "70741c4f" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
30113
- const version2 = readInjected(true ? "0.9.82-rc.382" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
30114
- const builtAt = readInjected(true ? "2026-06-25T13:33:15.097Z" : void 0);
30111
+ const commit = readInjected(true ? "6cca365bcea9757dd350c6bac460ca5a169a9280" : void 0) ?? "unknown";
30112
+ const commitShort = readInjected(true ? "6cca365b" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
30113
+ const version2 = readInjected(true ? "0.9.82-rc.384" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
30114
+ const builtAt = readInjected(true ? "2026-06-25T15:23:09.439Z" : void 0);
30115
30115
  cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
30116
30116
  return cached2;
30117
30117
  }
@@ -44966,8 +44966,7 @@ ${cleanBody}`;
44966
44966
  const idleCoordinators = meshCoordinators.filter((c) => c.idle);
44967
44967
  const generatingCoordinators = meshCoordinators.filter((c) => !c.idle && !c.modalParked);
44968
44968
  const modalParkedCoordinators = meshCoordinators.filter((c) => !c.idle && c.modalParked);
44969
- const targetCoordinators = idleCoordinators.length > 0 ? idleCoordinators : generatingCoordinators;
44970
- const forceOnly = idleCoordinators.length === 0;
44969
+ const targetCoordinators = idleCoordinators;
44971
44970
  if (targetCoordinators.length === 0) {
44972
44971
  if (modalParkedCoordinators.length > 0) {
44973
44972
  const liveSessionIds = new Set(
@@ -45034,6 +45033,23 @@ ${cleanBody}`;
45034
45033
  modalParkedCoordinators.length
45035
45034
  );
45036
45035
  }
45036
+ } else if (generatingCoordinators.length > 0) {
45037
+ let hasPending = true;
45038
+ if (store) {
45039
+ try {
45040
+ hasPending = store.pendingEventCount(meshId) > 0;
45041
+ } catch {
45042
+ }
45043
+ }
45044
+ if (hasPending) {
45045
+ LOG2.info("MeshReconcile", `Reconcile skip \u2192 generating: holding pending event(s) for mesh ${meshId} (${generatingCoordinators.length} coordinator(s) busy; events left queued for the next idle tick)`);
45046
+ recordHeldTerminalEventsToLedger(
45047
+ meshId,
45048
+ drainDaemonIds.length > 0 ? drainDaemonIds : localDaemonId ? [localDaemonId] : [],
45049
+ "generating_no_idle_coordinator",
45050
+ generatingCoordinators.length
45051
+ );
45052
+ }
45037
45053
  }
45038
45054
  continue;
45039
45055
  }
@@ -45047,16 +45063,14 @@ ${cleanBody}`;
45047
45063
  try {
45048
45064
  pendingEvents = drainPendingMeshCoordinatorEvents(
45049
45065
  meshId,
45050
- drainDaemonIds.length > 0 ? drainDaemonIds : localDaemonId,
45051
- forceOnly ? { onlyEvents: MESH_FORCE_INJECT_EVENTS } : void 0
45066
+ drainDaemonIds.length > 0 ? drainDaemonIds : localDaemonId
45052
45067
  );
45053
45068
  } catch (e) {
45054
45069
  LOG2.warn("MeshReconcile", `Drain failed for mesh ${meshId}: ${e?.message || e}`);
45055
45070
  continue;
45056
45071
  }
45057
45072
  if (pendingEvents.length === 0) continue;
45058
- const mode = forceOnly ? "force-drain \u2192 generating" : "inject \u2192 idle";
45059
- LOG2.info("MeshReconcile", `Reconcile ${mode}: ${pendingEvents.length} pending event(s) \u2192 ${targetCoordinators.length} coordinator(s) for mesh ${meshId}`);
45073
+ LOG2.info("MeshReconcile", `Reconcile inject \u2192 idle: ${pendingEvents.length} pending event(s) \u2192 ${targetCoordinators.length} coordinator(s) for mesh ${meshId}`);
45060
45074
  for (const pending of pendingEvents) {
45061
45075
  const wantSession = readNonEmptyString2(pending.targetCoordinatorSessionId);
45062
45076
  if (wantSession) {
@@ -81969,17 +81983,40 @@ ${mergeTreeErr?.stderr || ""}`;
81969
81983
  * the wider plural-shape scan so a controlbar/modal command targeting a non-primary remote
81970
81984
  * session still resolves its owner — the singular readCachedInlineMeshActiveSessions semantics
81971
81985
  * other consumers depend on stay untouched.
81986
+ *
81987
+ * CANCEL-STOP-RELAY: the session-id cache scan above only matches when the coordinator's
81988
+ * cached status snapshot already lists the worker's session id in a recognized active-sessions
81989
+ * shape. A worktree-clone worker session whose id form/timing differs from the cached snapshot
81990
+ * (or is simply not yet reflected) misses the scan, so a stop that carries the authoritative
81991
+ * owning nodeId (mesh_queue_cancel knows assignedNodeId) used to silently fail to forward.
81992
+ * `ownerNodeIdHint` adds a deterministic fallback: when the session-id scan misses, resolve the
81993
+ * owner daemonId by matching the node by id (meshNodeIdMatches — same form-tolerant compare the
81994
+ * rest of the router uses, no new raw compare). The same self-loopback guard applies to both
81995
+ * paths, so a coordinator-hosted node is still never force-forwarded to a remote form of itself.
81972
81996
  */
81973
- resolveRemoteMeshSessionOwnerDaemonId(sessionId) {
81997
+ resolveRemoteMeshSessionOwnerDaemonId(sessionId, ownerNodeIdHint) {
81974
81998
  const trimmed = typeof sessionId === "string" ? sessionId.trim() : "";
81975
- if (!trimmed) return void 0;
81999
+ const nodeHint = typeof ownerNodeIdHint === "string" ? ownerNodeIdHint.trim() : "";
82000
+ if (!trimmed && !nodeHint) return void 0;
81976
82001
  const selfDaemonId = this.deps.statusInstanceId;
81977
- for (const node of this.collectMeshSessionOwnerCandidateNodes()) {
81978
- if (!collectMeshNodeHostedSessionIds(node).has(trimmed)) continue;
81979
- const nodeDaemonId = readMeshNodeDaemonId(readObjectRecord(node));
81980
- if (!nodeDaemonId) continue;
81981
- if (selfDaemonId && daemonIdsEquivalent(nodeDaemonId, selfDaemonId)) return void 0;
81982
- return nodeDaemonId;
82002
+ const candidates = this.collectMeshSessionOwnerCandidateNodes();
82003
+ if (trimmed) {
82004
+ for (const node of candidates) {
82005
+ if (!collectMeshNodeHostedSessionIds(node).has(trimmed)) continue;
82006
+ const nodeDaemonId = readMeshNodeDaemonId(readObjectRecord(node));
82007
+ if (!nodeDaemonId) continue;
82008
+ if (selfDaemonId && daemonIdsEquivalent(nodeDaemonId, selfDaemonId)) return void 0;
82009
+ return nodeDaemonId;
82010
+ }
82011
+ }
82012
+ if (nodeHint) {
82013
+ for (const node of candidates) {
82014
+ if (!meshNodeIdMatches(node, nodeHint)) continue;
82015
+ const nodeDaemonId = readMeshNodeDaemonId(readObjectRecord(node));
82016
+ if (!nodeDaemonId) continue;
82017
+ if (selfDaemonId && daemonIdsEquivalent(nodeDaemonId, selfDaemonId)) return void 0;
82018
+ return nodeDaemonId;
82019
+ }
81983
82020
  }
81984
82021
  return void 0;
81985
82022
  }
@@ -84113,7 +84150,9 @@ ${hintLines.join("\n")}` : "",
84113
84150
  const localInstance = this.deps.instanceManager?.getInstance(targetSessionId);
84114
84151
  const localRegistry = this.deps.sessionRegistry?.get?.(targetSessionId);
84115
84152
  if (!localInstance && !localRegistry) {
84116
- const ownerDaemonId = this.resolveRemoteMeshSessionOwnerDaemonId(targetSessionId);
84153
+ const meshContext = readObjectRecord(args?.meshContext);
84154
+ const ownerNodeIdHint = readStringValue(meshContext.nodeId);
84155
+ const ownerDaemonId = this.resolveRemoteMeshSessionOwnerDaemonId(targetSessionId, ownerNodeIdHint);
84117
84156
  if (ownerDaemonId) {
84118
84157
  LOG2.info("Mesh", `[Mesh] Forwarding session-scoped '${cmd}' for remote worker session ${targetSessionId.split("_")[0]} \u2192 daemon ${ownerDaemonId.slice(0, 12)}`);
84119
84158
  const forwarded = await this.deps.dispatchMeshCommand(ownerDaemonId, cmd, {