@adhdev/daemon-standalone 0.9.82-rc.116 → 0.9.82-rc.118
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 +143 -60
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/vendor/mcp-server/index.js +31 -9
- package/vendor/mcp-server/index.js.map +1 -1
package/package.json
CHANGED
|
@@ -1086,7 +1086,8 @@ function buildNodeMachineIdentity(ctx, node) {
|
|
|
1086
1086
|
const hostname = readNodeHostname(node);
|
|
1087
1087
|
const machineName = readNodeDisplayMachineName(node);
|
|
1088
1088
|
const coordinatorHostname = readString(ctx.coordinatorHostname);
|
|
1089
|
-
const
|
|
1089
|
+
const localControlPlaneReason = getLocalControlPlaneMatchReason(ctx, node);
|
|
1090
|
+
const directLocal = !!localControlPlaneReason;
|
|
1090
1091
|
const hostnameMatches = Boolean(
|
|
1091
1092
|
normalizeHostname(hostname) && normalizeHostname(coordinatorHostname) && normalizeHostname(hostname) === normalizeHostname(coordinatorHostname)
|
|
1092
1093
|
);
|
|
@@ -1096,8 +1097,13 @@ function buildNodeMachineIdentity(ctx, node) {
|
|
|
1096
1097
|
pushIdentityEvidence(evidence, "hostname", hostname);
|
|
1097
1098
|
pushIdentityEvidence(evidence, "machineId", machineId);
|
|
1098
1099
|
pushIdentityEvidence(evidence, "daemonId", daemonId);
|
|
1100
|
+
if (localControlPlaneReason) {
|
|
1101
|
+
pushIdentityEvidence(evidence, "localMatch", localControlPlaneReason);
|
|
1102
|
+
pushIdentityEvidence(evidence, "localMachineId", ctx.localMachineId);
|
|
1103
|
+
pushIdentityEvidence(evidence, "localDaemonId", ctx.localDaemonId);
|
|
1104
|
+
}
|
|
1099
1105
|
const locality = sameMachine ? "same_machine" : evidence.length > 0 ? "remote_known" : "remote_or_unknown";
|
|
1100
|
-
const localityReason = sameMachine ?
|
|
1106
|
+
const localityReason = sameMachine ? localControlPlaneReason || "matched coordinator hostname" : evidence.length > 0 ? `known remote/other machine identity; no local coordinator match (${evidence.join(", ")})` : "no useful machine identity evidence available";
|
|
1101
1107
|
return {
|
|
1102
1108
|
daemonId,
|
|
1103
1109
|
machineId,
|
|
@@ -1159,18 +1165,33 @@ function isDirectLocalNode(ctx, node) {
|
|
|
1159
1165
|
ctx.localMachineId && machineId === ctx.localMachineId || ctx.localDaemonId && daemonId === ctx.localDaemonId || nodeHasLocalDaemonEvidence(ctx, node)
|
|
1160
1166
|
);
|
|
1161
1167
|
}
|
|
1168
|
+
function isConfiguredCoordinatorNode(ctx, node) {
|
|
1169
|
+
if (!ctx.localMachineId && !ctx.localDaemonId) return false;
|
|
1170
|
+
const nodeId = readString(node.id) || readString(node.nodeId) || readString(node.node_id);
|
|
1171
|
+
if (!nodeId) return false;
|
|
1172
|
+
const preferredNodeId = readString(ctx.mesh.coordinator?.preferredNodeId) || readString(ctx.mesh.coordinator?.preferred_node_id);
|
|
1173
|
+
if (preferredNodeId) return nodeId === preferredNodeId;
|
|
1174
|
+
const first = ctx.mesh.nodes?.[0];
|
|
1175
|
+
const firstNodeId = readString(first?.id) || readString(first?.nodeId) || readString(first?.node_id);
|
|
1176
|
+
return !!firstNodeId && nodeId === firstNodeId;
|
|
1177
|
+
}
|
|
1178
|
+
function getLocalControlPlaneMatchReason(ctx, node) {
|
|
1179
|
+
if (isDirectLocalNode(ctx, node)) return "matched coordinator daemon or machine id";
|
|
1180
|
+
if (isConfiguredCoordinatorNode(ctx, node)) return "matched configured coordinator node";
|
|
1181
|
+
if (node.isLocalWorktree === true) {
|
|
1182
|
+
const sourceNode = findClonedFromNode(ctx, node);
|
|
1183
|
+
if (sourceNode && isDirectLocalNode(ctx, sourceNode)) return "matched local cloned-from node";
|
|
1184
|
+
if (sourceNode && isConfiguredCoordinatorNode(ctx, sourceNode)) return "matched configured coordinator source node";
|
|
1185
|
+
}
|
|
1186
|
+
return void 0;
|
|
1187
|
+
}
|
|
1162
1188
|
function findClonedFromNode(ctx, node) {
|
|
1163
1189
|
const clonedFromNodeId = readString(node.clonedFromNodeId) || readString(node.cloned_from_node_id);
|
|
1164
1190
|
if (!clonedFromNodeId) return void 0;
|
|
1165
1191
|
return ctx.mesh.nodes.find((n) => n.id === clonedFromNodeId || n.nodeId === clonedFromNodeId || n.node_id === clonedFromNodeId);
|
|
1166
1192
|
}
|
|
1167
1193
|
function isLocalControlPlaneNode(ctx, node) {
|
|
1168
|
-
|
|
1169
|
-
if (node.isLocalWorktree === true) {
|
|
1170
|
-
const sourceNode = findClonedFromNode(ctx, node);
|
|
1171
|
-
if (sourceNode && isDirectLocalNode(ctx, sourceNode)) return true;
|
|
1172
|
-
}
|
|
1173
|
-
return false;
|
|
1194
|
+
return !!getLocalControlPlaneMatchReason(ctx, node);
|
|
1174
1195
|
}
|
|
1175
1196
|
function meshSessionCacheKey(nodeId, runtimeSessionId) {
|
|
1176
1197
|
return `${nodeId}:${runtimeSessionId}`;
|
|
@@ -4825,7 +4846,8 @@ async function startMcpServer(opts) {
|
|
|
4825
4846
|
try {
|
|
4826
4847
|
const { loadConfig } = await import("@adhdev/daemon-core");
|
|
4827
4848
|
const cfg = loadConfig();
|
|
4828
|
-
if (cfg.
|
|
4849
|
+
if (cfg.machineId) localMachineId = cfg.machineId;
|
|
4850
|
+
else if (cfg.registeredMachineId) localMachineId = cfg.registeredMachineId;
|
|
4829
4851
|
} catch {
|
|
4830
4852
|
}
|
|
4831
4853
|
}
|