@adhdev/daemon-standalone 0.9.82-rc.342 → 0.9.82-rc.345

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.342",
3
+ "version": "0.9.82-rc.345",
4
4
  "description": "ADHDev standalone daemon — embedded HTTP/WS server for local dashboard",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -9,7 +9,7 @@
9
9
  "adhdev-mcp": "./vendor/mcp-server/index.js"
10
10
  },
11
11
  "scripts": {
12
- "preinstall": "node -e \"const major=Number.parseInt(process.versions.node.split('.')[0],10); if (process.platform === 'win32' && major >= 24) { console.error('\\n✗ ADHDev standalone does not currently support Node.js 24+ on Windows.\\n Install Node.js 22.x on Windows, then retry.\\n'); process.exit(1); }\"",
12
+ "preinstall": "node -e \"const major=Number.parseInt(process.versions.node.split('.')[0],10); if (process.platform === 'win32' && major >= 24 && !process.env.ADHDEV_BOOTSTRAP && !process.env.CI) { console.error('\\n✗ ADHDev standalone does not currently support Node.js 24+ on Windows.\\n Install Node.js 22.x on Windows, then retry.\\n'); process.exit(1); }\"",
13
13
  "build": "tsup",
14
14
  "bundle:web": "node -e \"const{cpSync,mkdirSync}=require('fs');mkdirSync('public',{recursive:true});cpSync('../web-standalone/dist','public',{recursive:true});console.log('bundled web-standalone → public/')\"",
15
15
  "bundle:vendor": "node ./scripts/vendor-runtime-deps.mjs",
@@ -48,7 +48,23 @@ var IPC_COMMAND_TIMEOUTS_MS = {
48
48
  git_status: 45e3,
49
49
  git_diff_summary: 45e3,
50
50
  fast_forward_mesh_node: 12e4,
51
- mesh_status: 12e4
51
+ mesh_status: 12e4,
52
+ // Heavy repo-mutating worktree ops (relay budgets: clone 90s, remove 60s). A local
53
+ // clone synchronously creates a worktree (~30s) plus a bounded setup-wait (~14s);
54
+ // 120s leaves headroom and matches the relay-wrapped remote path.
55
+ clone_mesh_node: 12e4,
56
+ remove_mesh_node: 6e4,
57
+ // A5: plan_mesh_refine_node is the SYNCHRONOUS refine dry-run — it runs several git
58
+ // probes (status/merge-tree/submodule) inline before replying, which can approach the
59
+ // 15s default on a slow (Windows) host. 45s defensively, matching git_status/diff.
60
+ plan_mesh_refine_node: 45e3,
61
+ // A2: refine_mesh_node / batch_refine_mesh_nodes are async-job-ack (the responder
62
+ // returns { async:true, status:'accepted' } immediately and works in the background),
63
+ // so 15s already suffices. 30s is a defensive floor guarding a future sync-dry-run
64
+ // regression; it is intentionally BELOW the relay 90s budget because the synchronous
65
+ // ack reply is sub-second and never bounded by the relay deadline.
66
+ refine_mesh_node: 3e4,
67
+ batch_refine_mesh_nodes: 3e4
52
68
  };
53
69
  var WS_CONNECTING = 0;
54
70
  var WS_OPEN = 1;
@@ -1078,7 +1094,7 @@ function chooseDispatchableSession(sessions, providerType, meshId, nodeId, coord
1078
1094
  const safety = classifyRemoteDelegateRelaySafety(session, meshId, nodeId, coordinatorDaemonId);
1079
1095
  return safety === "safe" || safety === "self_heal";
1080
1096
  });
1081
- return meshSessions.find((session) => isIdleSessionRecord(session) && matchingProvider(session)) || meshSessions.find(matchingProvider) || void 0;
1097
+ return meshSessions.find((session) => isIdleSessionRecord(session) && matchingProvider(session)) || void 0;
1082
1098
  }
1083
1099
  function buildRelayUnsafeRemoteSessionFailure(ctx, node, sessionId, providerType) {
1084
1100
  return {
@@ -3368,7 +3384,7 @@ async function meshEnqueueTask(ctx, args) {
3368
3384
  const preferWorktree = args.preferWorktree === true || args.prefer_worktree === true;
3369
3385
  const targetNodeId = explicitTarget || (preferWorktree ? resolvePreferredWorktreeNodeId(ctx) : void 0);
3370
3386
  try {
3371
- const task = (0, import_daemon_core.enqueueTask)(ctx.mesh.id, args.message, { taskMode, requiredTags, dependsOn, missionId, targetNodeId });
3387
+ const task = (0, import_daemon_core.enqueueTask)(ctx.mesh.id, args.message, { taskMode, requiredTags, dependsOn, missionId, targetNodeId, ...ctx.coordinatorSessionId ? { sourceCoordinatorSessionId: ctx.coordinatorSessionId } : {} });
3372
3388
  if (!(ctx.transport instanceof IpcTransport)) {
3373
3389
  const queueTrigger = await triggerMeshQueueAndReport(ctx);
3374
3390
  return JSON.stringify({
@@ -3725,7 +3741,11 @@ async function meshSendTask(ctx, args) {
3725
3741
  meshId: ctx.mesh.id,
3726
3742
  nodeId: args.node_id,
3727
3743
  taskId,
3728
- ...coordinatorDaemonId ? { coordinatorDaemonId } : {}
3744
+ ...coordinatorDaemonId ? { coordinatorDaemonId } : {},
3745
+ // (3) Stamp the originating coordinator session so the worker's completion
3746
+ // routes back to THIS coordinator session (multi-coordinator). Survives the
3747
+ // P2P dispatch to the remote worker, which echoes it on its completion event.
3748
+ ...ctx.coordinatorSessionId ? { coordinatorSessionId: ctx.coordinatorSessionId } : {}
3729
3749
  }
3730
3750
  });
3731
3751
  if (result2.success) {
@@ -3899,7 +3919,9 @@ async function meshSendTask(ctx, args) {
3899
3919
  meshId: ctx.mesh.id,
3900
3920
  nodeId: args.node_id,
3901
3921
  taskId,
3902
- ...coordinatorDaemonId ? { coordinatorDaemonId } : {}
3922
+ ...coordinatorDaemonId ? { coordinatorDaemonId } : {},
3923
+ // (3) Originating coordinator session anchor — see the remote-dispatch path above.
3924
+ ...ctx.coordinatorSessionId ? { coordinatorSessionId: ctx.coordinatorSessionId } : {}
3903
3925
  }
3904
3926
  });
3905
3927
  const dispatchPayload = unwrapCommandPayload(dispatchResult);
@@ -4121,6 +4143,10 @@ async function meshLaunchSession(ctx, args) {
4121
4143
  // Lands in settingsOverride and beats the global per-provider autoApprove.
4122
4144
  autoApprove: delegatedWorkerAutoApprove,
4123
4145
  ...coordinatorDaemonId ? { meshCoordinatorDaemonId: coordinatorDaemonId } : {},
4146
+ // (3) Stamp the originating coordinator SESSION at launch too, so a worker
4147
+ // launched via mesh_launch_session routes its completions back to the exact
4148
+ // coordinator session (multi-coordinator). Absent → daemon-level fallback.
4149
+ ...ctx.coordinatorSessionId ? { meshCoordinatorSessionId: ctx.coordinatorSessionId } : {},
4124
4150
  ...coordinatorNode?.id ? { meshCoordinatorNodeId: coordinatorNode.id } : {},
4125
4151
  launchedByCoordinator: true
4126
4152
  }
@@ -5588,7 +5614,8 @@ async function startMcpServer(opts) {
5588
5614
  } catch {
5589
5615
  }
5590
5616
  }
5591
- const meshCtx = { mesh, transport, ...localDaemonId ? { localDaemonId } : {}, ...localMachineId ? { localMachineId } : {}, ...coordinatorHostname ? { coordinatorHostname } : {} };
5617
+ const coordinatorSessionId = typeof process.env.ADHDEV_COORDINATOR_SESSION_ID === "string" && process.env.ADHDEV_COORDINATOR_SESSION_ID.trim() ? process.env.ADHDEV_COORDINATOR_SESSION_ID.trim() : void 0;
5618
+ const meshCtx = { mesh, transport, ...localDaemonId ? { localDaemonId } : {}, ...localMachineId ? { localMachineId } : {}, ...coordinatorHostname ? { coordinatorHostname } : {}, ...coordinatorSessionId ? { coordinatorSessionId } : {} };
5592
5619
  const coordinatorPrompt = await buildMeshModeCoordinatorPrompt(mesh);
5593
5620
  const server2 = new import_server.Server(
5594
5621
  { name: "adhdev-mcp-server", version: "0.9.82" },