@adhdev/daemon-standalone 0.9.82-rc.115 → 0.9.82-rc.117

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adhdev/daemon-standalone",
3
- "version": "0.9.82-rc.115",
3
+ "version": "0.9.82-rc.117",
4
4
  "description": "ADHDev standalone daemon — embedded HTTP/WS server for local dashboard",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -1111,11 +1111,52 @@ function buildNodeMachineIdentity(ctx, node) {
1111
1111
  identityEvidence: evidence
1112
1112
  };
1113
1113
  }
1114
+ function nodeHasLocalDaemonEvidence(ctx, node) {
1115
+ const isLocal = (session) => {
1116
+ if (!session || typeof session !== "object") return false;
1117
+ if (ctx.localDaemonId && session.settings?.meshCoordinatorDaemonId === ctx.localDaemonId) return true;
1118
+ if (session.launchedByCoordinator === true) return true;
1119
+ if (ctx.localDaemonId && session.runtime?.owner === ctx.localDaemonId) return true;
1120
+ if (ctx.localDaemonId && session.daemonClient?.daemonId === ctx.localDaemonId) return true;
1121
+ return false;
1122
+ };
1123
+ const sessionArrays = [
1124
+ node?.sessions,
1125
+ node?.activeSessions,
1126
+ node?.active_sessions,
1127
+ node?.lastProbe?.sessions,
1128
+ node?.last_probe?.sessions,
1129
+ node?.lastProbe?.status?.sessions,
1130
+ node?.last_probe?.status?.sessions
1131
+ ];
1132
+ for (const arr of sessionArrays) {
1133
+ if (Array.isArray(arr) && arr.some(isLocal)) return true;
1134
+ }
1135
+ const sessionRecords = [
1136
+ node?.activeSession,
1137
+ node?.active_session,
1138
+ node?.currentSession,
1139
+ node?.current_session,
1140
+ node?.runtimeSession,
1141
+ node?.runtime_session,
1142
+ node?.session,
1143
+ node?.lastProbe?.activeSession,
1144
+ node?.last_probe?.active_session,
1145
+ node?.lastProbe?.currentSession,
1146
+ node?.last_probe?.current_session,
1147
+ node?.lastProbe?.session,
1148
+ node?.last_probe?.session
1149
+ ];
1150
+ for (const session of sessionRecords) {
1151
+ if (isLocal(session)) return true;
1152
+ }
1153
+ return false;
1154
+ }
1114
1155
  function isDirectLocalNode(ctx, node) {
1115
1156
  const machineId = readNodeMachineId(node);
1116
1157
  const daemonId = readNodeDaemonId(node);
1117
1158
  return Boolean(
1118
- ctx.localMachineId && machineId === ctx.localMachineId || ctx.localDaemonId && daemonId === ctx.localDaemonId
1159
+ ctx.localMachineId && machineId === ctx.localMachineId || ctx.localDaemonId && daemonId === ctx.localDaemonId || nodeHasLocalDaemonEvidence(ctx, node)
1119
1160
  );
1120
1161
  }
1121
1162
  function findClonedFromNode(ctx, node) {