@adhdev/daemon-standalone 0.9.77-rc.15 → 0.9.77-rc.17

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.77-rc.15",
3
+ "version": "0.9.77-rc.17",
4
4
  "description": "ADHDev standalone daemon — embedded HTTP/WS server for local dashboard",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -57410,6 +57410,10 @@ function resolveCoordinatorNode(ctx) {
57410
57410
  const preferred = ctx.mesh.nodes.find((n) => n.id === preferredNodeId && typeof n.daemonId === "string" && n.daemonId.trim());
57411
57411
  if (preferred) return preferred;
57412
57412
  }
57413
+ if (ctx.localMachineId) {
57414
+ const byMachine = ctx.mesh.nodes.find((n) => n.machineId === ctx.localMachineId);
57415
+ if (byMachine) return byMachine;
57416
+ }
57413
57417
  if (ctx.localDaemonId) {
57414
57418
  return ctx.mesh.nodes.find((n) => n.daemonId === ctx.localDaemonId);
57415
57419
  }
@@ -57499,7 +57503,8 @@ function getNodeLaunchReadiness(node) {
57499
57503
  };
57500
57504
  }
57501
57505
  async function commandForNode(ctx, node, command, args = {}) {
57502
- if (ctx.transport instanceof IpcTransport && node.daemonId && node.daemonId !== ctx.localDaemonId) {
57506
+ const isLocalNode = ctx.localMachineId && node.machineId === ctx.localMachineId || ctx.localDaemonId && node.daemonId === ctx.localDaemonId;
57507
+ if (ctx.transport instanceof IpcTransport && node.daemonId && !isLocalNode) {
57503
57508
  return ctx.transport.meshCommand(node.daemonId, command, args);
57504
57509
  }
57505
57510
  if (isLocalTransport(ctx.transport)) {
@@ -57828,10 +57833,7 @@ async function meshListNodes(ctx) {
57828
57833
  async function meshEnqueueTask(ctx, args) {
57829
57834
  try {
57830
57835
  const task = enqueueTask(ctx.mesh.id, args.message);
57831
- if (ctx.transport instanceof IpcTransport && ctx.localDaemonId) {
57832
- ctx.transport.meshCommand(ctx.localDaemonId, "trigger_mesh_queue", { meshId: ctx.mesh.id }).catch(() => {
57833
- });
57834
- } else if (isLocalTransport(ctx.transport)) {
57836
+ if (isLocalTransport(ctx.transport)) {
57835
57837
  ctx.transport.command("trigger_mesh_queue", { meshId: ctx.mesh.id }).catch(() => {
57836
57838
  });
57837
57839
  }
@@ -57863,7 +57865,8 @@ async function meshSendTask(ctx, args) {
57863
57865
  return JSON.stringify(res);
57864
57866
  }
57865
57867
  const task = enqueueTask(ctx.mesh.id, args.message, { targetNodeId: args.node_id });
57866
- if (ctx.transport instanceof IpcTransport && node.daemonId && node.daemonId !== ctx.localDaemonId) {
57868
+ const isLocalNode = ctx.localMachineId && node.machineId === ctx.localMachineId || ctx.localDaemonId && node.daemonId === ctx.localDaemonId;
57869
+ if (ctx.transport instanceof IpcTransport && node.daemonId && !isLocalNode) {
57867
57870
  ctx.transport.meshCommand(node.daemonId, "trigger_mesh_queue", { meshId: ctx.mesh.id }).catch(() => {
57868
57871
  });
57869
57872
  } else if (isLocalTransport(ctx.transport)) {
@@ -58010,7 +58013,8 @@ async function meshLaunchSession(ctx, args) {
58010
58013
  });
58011
58014
  } catch {
58012
58015
  }
58013
- if (ctx.transport instanceof IpcTransport && node.daemonId && node.daemonId !== ctx.localDaemonId) {
58016
+ const isLocalNode = ctx.localMachineId && node.machineId === ctx.localMachineId || ctx.localDaemonId && node.daemonId === ctx.localDaemonId;
58017
+ if (ctx.transport instanceof IpcTransport && node.daemonId && !isLocalNode) {
58014
58018
  ctx.transport.meshCommand(node.daemonId, "trigger_mesh_queue", { meshId: ctx.mesh.id }).catch(() => {
58015
58019
  });
58016
58020
  } else if (isLocalTransport(ctx.transport)) {
@@ -59948,6 +59952,15 @@ async function startMcpServer(opts) {
59948
59952
  process.exit(1);
59949
59953
  }
59950
59954
  let localDaemonId;
59955
+ let localMachineId;
59956
+ if (transport instanceof LocalTransport || transport instanceof IpcTransport) {
59957
+ try {
59958
+ const { loadConfig: loadConfig2 } = await Promise.resolve().then(() => (init_dist2(), dist_exports));
59959
+ const cfg = loadConfig2();
59960
+ if (cfg.registeredMachineId) localMachineId = cfg.registeredMachineId;
59961
+ } catch {
59962
+ }
59963
+ }
59951
59964
  if (transport instanceof IpcTransport) {
59952
59965
  try {
59953
59966
  const statusResult = await transport.getStatus();
@@ -59956,7 +59969,7 @@ async function startMcpServer(opts) {
59956
59969
  } catch {
59957
59970
  }
59958
59971
  }
59959
- const meshCtx = { mesh, transport, ...localDaemonId ? { localDaemonId } : {} };
59972
+ const meshCtx = { mesh, transport, ...localDaemonId ? { localDaemonId } : {}, ...localMachineId ? { localMachineId } : {} };
59960
59973
  const coordinatorPrompt = await buildMeshModeCoordinatorPrompt(mesh);
59961
59974
  const server2 = new import_server.Server(
59962
59975
  { name: "adhdev-mcp-server", version: "0.9.76" },