@adhdev/daemon-standalone 1.0.58-rc.44 → 1.0.58-rc.45

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
@@ -36911,10 +36911,10 @@ var require_dist3 = __commonJS({
36911
36911
  }
36912
36912
  function getDaemonBuildInfo() {
36913
36913
  if (cached2) return cached2;
36914
- const commit = readInjected(true ? "2c9a4f385d00c90bde2c4b0ae4b682cd9e5120a6" : void 0) ?? "unknown";
36915
- const commitShort = readInjected(true ? "2c9a4f38" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
36916
- const version2 = readInjected(true ? "1.0.58-rc.44" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
36917
- const builtAt = readInjected(true ? "2026-08-29T18:43:13.498Z" : void 0);
36914
+ const commit = readInjected(true ? "f678a3c56c08e7876a714abda968b9e6a8787841" : void 0) ?? "unknown";
36915
+ const commitShort = readInjected(true ? "f678a3c5" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
36916
+ const version2 = readInjected(true ? "1.0.58-rc.45" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
36917
+ const builtAt = readInjected(true ? "2026-08-30T01:11:37.487Z" : void 0);
36918
36918
  cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
36919
36919
  return cached2;
36920
36920
  }
@@ -51080,7 +51080,8 @@ ${lines.join("\n")}
51080
51080
  });
51081
51081
  if (!stamp2) return event;
51082
51082
  const dispatchedBySelfFallback = selfFallback && stamp2.scope === "broadcast";
51083
- const selfFallbackTarget = dispatchedBySelfFallback && !readNonEmptyString(event.targetCoordinatorDaemonId) && !readNonEmptyString(event.targetCoordinatorSessionId) ? readNonEmptyString(stamp2.dispatchedBy.daemonId) : void 0;
51083
+ const isWorktreeBootstrapEvent = event.event === "worktree_bootstrap_complete" || event.event === "worktree_bootstrap_failed";
51084
+ const selfFallbackTarget = dispatchedBySelfFallback && !isWorktreeBootstrapEvent && !readNonEmptyString(event.targetCoordinatorDaemonId) && !readNonEmptyString(event.targetCoordinatorSessionId) ? readNonEmptyString(stamp2.dispatchedBy.daemonId) : void 0;
51084
51085
  return {
51085
51086
  ...event,
51086
51087
  protocolVersion: stamp2.protocolVersion,
@@ -86254,11 +86255,17 @@ ${cleanBody}`;
86254
86255
  if (bootstrapNodeId) {
86255
86256
  try {
86256
86257
  const bootstrapWorkspace = readNonEmptyString(args.metadataEvent.worktreePath) || readNonEmptyString(args.metadataEvent.workspace);
86258
+ const originDaemonId = readNonEmptyString(args.metadataEvent.originDaemonId) || readNonEmptyString(args.metadataEvent.daemonId);
86259
+ const originMachineId = readNonEmptyString(args.metadataEvent.originMachineId) || readNonEmptyString(args.metadataEvent.machineId);
86257
86260
  components.router.markWorktreeBootstrapTerminalState(
86258
86261
  args.meshId,
86259
86262
  bootstrapNodeId,
86260
86263
  args.event === "worktree_bootstrap_failed" ? "failed" : "complete",
86261
- bootstrapWorkspace ? { workspace: bootstrapWorkspace } : void 0
86264
+ bootstrapWorkspace || originDaemonId || originMachineId ? {
86265
+ ...bootstrapWorkspace ? { workspace: bootstrapWorkspace } : {},
86266
+ ...originDaemonId ? { daemonId: originDaemonId } : {},
86267
+ ...originMachineId ? { machineId: originMachineId } : {}
86268
+ } : void 0
86262
86269
  );
86263
86270
  } catch (e) {
86264
86271
  LOG2.error("MeshQueue", `Failed to stamp terminal bootstrap state for ${bootstrapNodeId} (mesh ${args.meshId}): ${e?.message || e}`);
@@ -86587,6 +86594,10 @@ ${cleanBody}`;
86587
86594
  interactionId: readNonEmptyString(payload.interactionId),
86588
86595
  status: readNonEmptyString(payload.status),
86589
86596
  targetDaemonId: readNonEmptyString(payload.targetDaemonId),
86597
+ // Worker origin identity for a remotely cloned worktree's bootstrap event
86598
+ // so the coordinator's hydrate-on-miss upsert is P2P-addressable.
86599
+ originDaemonId: readNonEmptyString(payload.originDaemonId) || readNonEmptyString(payload.daemonId) || readNonEmptyString(payload.metadataEvent?.originDaemonId),
86600
+ originMachineId: readNonEmptyString(payload.originMachineId) || readNonEmptyString(payload.machineId) || readNonEmptyString(payload.metadataEvent?.originMachineId),
86590
86601
  startedAt: readNonEmptyString(payload.startedAt),
86591
86602
  completedAt: readNonEmptyString(payload.completedAt),
86592
86603
  retryOfJobId: readNonEmptyString(payload.retryOfJobId),
@@ -87140,10 +87151,24 @@ ${cleanBody}`;
87140
87151
  return [];
87141
87152
  }
87142
87153
  function extractPendingEvents(raw) {
87143
- if (Array.isArray(raw)) return raw;
87144
- if (raw && typeof raw === "object") {
87145
- const events = raw.events;
87146
- if (Array.isArray(events)) return events;
87154
+ let cursor = raw;
87155
+ for (let depth = 0; depth < 4 && cursor && typeof cursor === "object"; depth++) {
87156
+ if (Array.isArray(cursor)) return cursor;
87157
+ const record2 = cursor;
87158
+ if (Array.isArray(record2.events)) return record2.events;
87159
+ if (record2.payload && typeof record2.payload === "object") {
87160
+ cursor = record2.payload;
87161
+ continue;
87162
+ }
87163
+ if (record2.result && typeof record2.result === "object") {
87164
+ cursor = record2.result;
87165
+ continue;
87166
+ }
87167
+ if (record2.data && typeof record2.data === "object") {
87168
+ cursor = record2.data;
87169
+ continue;
87170
+ }
87171
+ break;
87147
87172
  }
87148
87173
  return [];
87149
87174
  }
@@ -137601,6 +137626,7 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
137601
137626
  try {
137602
137627
  const durationMs = Date.now() - startedAtMs;
137603
137628
  const event = `worktree_${eventStatus2}`;
137629
+ const hostDaemonId = readNonEmptyString(mesh?.meshHost?.hostDaemonId);
137604
137630
  const metadataEvent = {
137605
137631
  source: "clone_mesh_node_bootstrap",
137606
137632
  nodeId: node.id,
@@ -137608,6 +137634,9 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
137608
137634
  worktreePath: result.worktreePath,
137609
137635
  durationMs,
137610
137636
  bootstrapStatus: bootstrapState2.status,
137637
+ ...hostDaemonId ? { targetCoordinatorDaemonId: hostDaemonId } : {},
137638
+ ...effectiveDaemonId ? { originDaemonId: effectiveDaemonId } : {},
137639
+ ...effectiveMachineId ? { originMachineId: effectiveMachineId } : {},
137611
137640
  ...bootstrapState2.error ? { error: bootstrapState2.error } : {},
137612
137641
  ...bootstrapState2.exitCode !== void 0 ? { exitCode: bootstrapState2.exitCode } : {},
137613
137642
  ...extraPayload || {}
@@ -137622,7 +137651,16 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
137622
137651
  getCachedInlineMesh: ctx.getCachedInlineMesh
137623
137652
  }
137624
137653
  },
137625
- { event, meshId, nodeId: node.id, workspace: result.worktreePath, metadataEvent }
137654
+ {
137655
+ event,
137656
+ meshId,
137657
+ nodeId: node.id,
137658
+ workspace: result.worktreePath,
137659
+ metadataEvent,
137660
+ ...hostDaemonId ? { targetCoordinatorDaemonId: hostDaemonId } : {},
137661
+ ...effectiveDaemonId ? { originDaemonId: effectiveDaemonId } : {},
137662
+ ...effectiveMachineId ? { originMachineId: effectiveMachineId } : {}
137663
+ }
137626
137664
  );
137627
137665
  if (forwarded?.success === true) return;
137628
137666
  } catch {
@@ -137635,7 +137673,8 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
137635
137673
  nodeId: node.id,
137636
137674
  workspace: result.worktreePath,
137637
137675
  metadataEvent,
137638
- queuedAt: Date.now()
137676
+ queuedAt: Date.now(),
137677
+ ...hostDaemonId ? { targetCoordinatorDaemonId: hostDaemonId } : {}
137639
137678
  });
137640
137679
  } catch {
137641
137680
  }
@@ -141904,6 +141943,11 @@ ${ptyResult.output.slice(-2e3)}`);
141904
141943
  nodeId,
141905
141944
  isLocalWorktree: true,
141906
141945
  ...opts?.workspace ? { workspace: opts.workspace } : {},
141946
+ // Origin identity from the worker's bootstrap event: without
141947
+ // these, isLocalAutoLaunchNode treats the shell as LOCAL and the
141948
+ // coordinator tries to spawn the remote worktree on itself.
141949
+ ...opts?.daemonId ? { daemonId: opts.daemonId } : {},
141950
+ ...opts?.machineId ? { machineId: opts.machineId } : {},
141907
141951
  worktreeBootstrap: terminalBootstrap()
141908
141952
  };
141909
141953
  this.updateInlineMeshNode(meshId, shell, hydratedNode);