@adhdev/daemon-core 0.9.82-rc.230 → 0.9.82-rc.232

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.mjs CHANGED
@@ -5632,6 +5632,15 @@ Do NOT retry on this node. Consider reassigning to a different node or asking th
5632
5632
  if (args.event === "monitor:long_generating") {
5633
5633
  return `[System] ${args.nodeLabel} is still reported as generating after a long interval${metadata}. Wait for pendingCoordinatorEvents or a completion/status event; if the user explicitly asks for status, make one bounded status check and then wait again.`;
5634
5634
  }
5635
+ if (args.event === "worktree_bootstrap_complete") {
5636
+ const worktreePath = readNonEmptyString2(args.metadataEvent.worktreePath);
5637
+ const durationMs = typeof args.metadataEvent.durationMs === "number" ? args.metadataEvent.durationMs : void 0;
5638
+ return `[System] ${args.nodeLabel} worktree bootstrap completed${worktreePath ? ` at ${worktreePath}` : ""}${durationMs !== void 0 ? ` in ${Math.round(durationMs / 1e3)}s` : ""}. The worktree is ready \u2014 use \`mesh_launch_session\` to start an agent.`;
5639
+ }
5640
+ if (args.event === "worktree_bootstrap_failed") {
5641
+ const error = readNonEmptyString2(args.metadataEvent.error);
5642
+ return `[System] ${args.nodeLabel} worktree bootstrap failed${error ? `: ${error}` : "."}. Use \`mesh_retry_node_bootstrap\` to retry or inspect the node state.`;
5643
+ }
5635
5644
  if (args.event === "refine:accepted") {
5636
5645
  const jobId = readRefineJobId({ metadataEvent: args.metadataEvent });
5637
5646
  return `[System] Refinery accepted async job${jobId ? ` ${jobId}` : ""} for ${args.nodeLabel}. Completion/failure will be delivered as a terminal refine event; do not poll repeatedly.`;
@@ -28823,6 +28832,7 @@ function expandPath2(template, input) {
28823
28832
  const vars = {
28824
28833
  cwd: workspaceResolved,
28825
28834
  cwd_dashed: workspaceResolved.replace(/\//g, "-"),
28835
+ cwd_claude_project: claudeProjectDirName(workspaceResolved),
28826
28836
  session_id: input.providerSessionId || input.sessionId || input.historySessionId || "",
28827
28837
  yyyy: String(now.getFullYear()),
28828
28838
  mm: String(now.getMonth() + 1).padStart(2, "0"),
@@ -28837,6 +28847,9 @@ function expandPath2(template, input) {
28837
28847
  if (missing) return null;
28838
28848
  return out;
28839
28849
  }
28850
+ function claudeProjectDirName(workspace) {
28851
+ return workspace.replace(/[^A-Za-z0-9_-]/g, "-");
28852
+ }
28840
28853
  function globToRegex(pattern) {
28841
28854
  const re = pattern.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*/g, "[^/]*").replace(/\?/g, "[^/]");
28842
28855
  return new RegExp(`^${re}$`);
@@ -28964,6 +28977,7 @@ function expandPathForDate(template, input, day) {
28964
28977
  const vars = {
28965
28978
  cwd: workspaceResolved,
28966
28979
  cwd_dashed: workspaceResolved.replace(/\//g, "-"),
28980
+ cwd_claude_project: claudeProjectDirName(workspaceResolved),
28967
28981
  session_id: input.providerSessionId || input.sessionId || input.historySessionId || "",
28968
28982
  yyyy: String(day.getFullYear()),
28969
28983
  mm: String(day.getMonth() + 1).padStart(2, "0"),
@@ -43504,10 +43518,11 @@ ${tail}` : ""
43504
43518
  }
43505
43519
  const selfDaemonId = this.deps.statusInstanceId;
43506
43520
  const isRemote = nodeDaemonId && selfDaemonId && nodeDaemonId !== selfDaemonId;
43507
- if (isRemote && this.deps.dispatchMeshCommand) {
43521
+ if (isRemote && this.deps.dispatchMeshCommand && !args?._meshDirectDispatch) {
43508
43522
  const forwarded = await this.deps.dispatchMeshCommand(nodeDaemonId, "fast_forward_mesh_node", {
43509
43523
  ...typeof args === "object" && args !== null ? args : {},
43510
- workspace
43524
+ workspace,
43525
+ _meshDirectDispatch: true
43511
43526
  });
43512
43527
  return forwarded ?? { success: false, error: "no response from remote node" };
43513
43528
  }
@@ -43548,10 +43563,11 @@ ${tail}` : ""
43548
43563
  let worktreeCleanup;
43549
43564
  if (node?.isLocalWorktree) {
43550
43565
  const nodeDaemonId = typeof node.daemonId === "string" ? node.daemonId.trim() : void 0;
43551
- const isRemoteWorktree = nodeDaemonId && nodeDaemonId !== this.deps.statusInstanceId && this.deps.dispatchMeshCommand;
43566
+ const isRemoteWorktree = nodeDaemonId && nodeDaemonId !== this.deps.statusInstanceId && this.deps.dispatchMeshCommand && !args?._meshDirectDispatch;
43552
43567
  if (isRemoteWorktree) {
43553
43568
  const forwarded = await this.deps.dispatchMeshCommand(nodeDaemonId, "remove_mesh_node", {
43554
- ...typeof args === "object" && args !== null ? args : {}
43569
+ ...typeof args === "object" && args !== null ? args : {},
43570
+ _meshDirectDispatch: true
43555
43571
  });
43556
43572
  return forwarded ?? { success: false, error: "no response from remote node" };
43557
43573
  }
@@ -43622,9 +43638,10 @@ ${tail}` : ""
43622
43638
  const sourceNode = mesh.nodes?.find((n) => n.id === sourceNodeId || n.nodeId === sourceNodeId);
43623
43639
  if (!sourceNode) return { success: false, error: `Source node '${sourceNodeId}' not found in mesh` };
43624
43640
  const sourceDaemonId = typeof sourceNode.daemonId === "string" ? sourceNode.daemonId.trim() : void 0;
43625
- if (sourceDaemonId && sourceDaemonId !== this.deps.statusInstanceId && this.deps.dispatchMeshCommand) {
43641
+ if (sourceDaemonId && sourceDaemonId !== this.deps.statusInstanceId && this.deps.dispatchMeshCommand && !args?._meshDirectDispatch) {
43626
43642
  const forwarded = await this.deps.dispatchMeshCommand(sourceDaemonId, "clone_mesh_node", {
43627
- ...typeof args === "object" && args !== null ? args : {}
43643
+ ...typeof args === "object" && args !== null ? args : {},
43644
+ _meshDirectDispatch: true
43628
43645
  });
43629
43646
  return forwarded ?? { success: false, error: "no response from remote node" };
43630
43647
  }
@@ -43861,9 +43878,10 @@ ${tail}` : ""
43861
43878
  if (!node) return { success: false, error: `Node '${nodeId}' not found in mesh` };
43862
43879
  if (!node.isLocalWorktree) return { success: false, error: "Node is not a local worktree node" };
43863
43880
  const nodeDaemonId = typeof node.daemonId === "string" ? node.daemonId.trim() : void 0;
43864
- if (nodeDaemonId && nodeDaemonId !== this.deps.statusInstanceId && this.deps.dispatchMeshCommand) {
43881
+ if (nodeDaemonId && nodeDaemonId !== this.deps.statusInstanceId && this.deps.dispatchMeshCommand && !args?._meshDirectDispatch) {
43865
43882
  const forwarded = await this.deps.dispatchMeshCommand(nodeDaemonId, "retry_mesh_node_bootstrap", {
43866
- ...typeof args === "object" && args !== null ? args : {}
43883
+ ...typeof args === "object" && args !== null ? args : {},
43884
+ _meshDirectDispatch: true
43867
43885
  });
43868
43886
  return forwarded ?? { success: false, error: "no response from remote node" };
43869
43887
  }