@adhdev/daemon-standalone 1.0.29-rc.2 → 1.0.29-rc.3

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
@@ -33311,10 +33311,10 @@ var require_dist3 = __commonJS({
33311
33311
  }
33312
33312
  function getDaemonBuildInfo() {
33313
33313
  if (cached2) return cached2;
33314
- const commit = readInjected(true ? "970517bde86bb64ddf4944f4676a0b7aa3e0ecd6" : void 0) ?? "unknown";
33315
- const commitShort = readInjected(true ? "970517bd" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
33316
- const version2 = readInjected(true ? "1.0.29-rc.2" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
33317
- const builtAt = readInjected(true ? "2026-08-01T12:48:29.542Z" : void 0);
33314
+ const commit = readInjected(true ? "8ee046ce7156a829d1038a65cb48221ca9bedb64" : void 0) ?? "unknown";
33315
+ const commitShort = readInjected(true ? "8ee046ce" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
33316
+ const version2 = readInjected(true ? "1.0.29-rc.3" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
33317
+ const builtAt = readInjected(true ? "2026-08-01T13:27:48.513Z" : void 0);
33318
33318
  cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
33319
33319
  return cached2;
33320
33320
  }
@@ -36155,20 +36155,40 @@ ${error48.message || ""}`;
36155
36155
  let hostDaemonId = readString3(raw?.hostDaemonId);
36156
36156
  let hostNodeId = readString3(raw?.hostNodeId);
36157
36157
  const hostAddress = readString3(raw?.hostAddress);
36158
+ let hostSynthesized = false;
36159
+ const nodes = Array.isArray(meshRecord?.nodes) ? meshRecord.nodes : [];
36160
+ const nodeDaemonIdOf = (node) => {
36161
+ const record2 = readObject(node);
36162
+ return readString3(record2?.daemonId) ?? readString3(record2?.daemon_id);
36163
+ };
36164
+ if (role === "host" && !hostDaemonId) {
36165
+ const declaredHostNode = nodes.find((n) => normalizeMeshDaemonRole(readObject(n)?.role) === "host");
36166
+ if (declaredHostNode) {
36167
+ const declaredDaemonId = nodeDaemonIdOf(declaredHostNode);
36168
+ if (declaredDaemonId) {
36169
+ hostDaemonId = declaredDaemonId;
36170
+ if (!hostNodeId) hostNodeId = readString3(readObject(declaredHostNode)?.id);
36171
+ }
36172
+ }
36173
+ }
36158
36174
  const localDaemonId = readString3(opts?.localDaemonId);
36159
- if (role === "host" && !hostDaemonId && localDaemonId) {
36175
+ const hasForeignDaemonNode = localDaemonId ? nodes.some((n) => {
36176
+ const nodeDaemonId = nodeDaemonIdOf(n);
36177
+ return nodeDaemonId ? !daemonIdsEquivalent(nodeDaemonId, localDaemonId) : false;
36178
+ }) : false;
36179
+ if (role === "host" && !hostDaemonId && !hostNodeId && localDaemonId && !hasForeignDaemonNode) {
36160
36180
  hostDaemonId = localDaemonId;
36161
- if (!hostNodeId && Array.isArray(meshRecord?.nodes)) {
36162
- const selfNode = meshRecord.nodes.find((n) => {
36163
- const nodeDaemonId = readString3(readObject(n)?.daemonId);
36164
- return nodeDaemonId ? daemonIdsEquivalent(nodeDaemonId, localDaemonId) : false;
36165
- });
36166
- const selfNodeId = readString3(readObject(selfNode)?.id);
36167
- if (selfNodeId) hostNodeId = selfNodeId;
36168
- }
36181
+ hostSynthesized = true;
36182
+ const selfNode = nodes.find((n) => {
36183
+ const nodeDaemonId = nodeDaemonIdOf(n);
36184
+ return nodeDaemonId ? daemonIdsEquivalent(nodeDaemonId, localDaemonId) : false;
36185
+ });
36186
+ const selfNodeId = readString3(readObject(selfNode)?.id);
36187
+ if (selfNodeId) hostNodeId = selfNodeId;
36169
36188
  }
36170
36189
  if (hostDaemonId) normalized.hostDaemonId = hostDaemonId;
36171
36190
  if (hostNodeId) normalized.hostNodeId = hostNodeId;
36191
+ if (hostSynthesized) normalized.hostSynthesized = true;
36172
36192
  if (hostAddress) normalized.hostAddress = hostAddress;
36173
36193
  if (pairing) {
36174
36194
  const status = pairing.status === "pairing" || pairing.status === "paired" || pairing.status === "rejected" || pairing.status === "revoked" ? pairing.status : "not_configured";