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

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 CHANGED
@@ -5638,6 +5638,15 @@ Do NOT retry on this node. Consider reassigning to a different node or asking th
5638
5638
  if (args.event === "monitor:long_generating") {
5639
5639
  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.`;
5640
5640
  }
5641
+ if (args.event === "worktree_bootstrap_complete") {
5642
+ const worktreePath = readNonEmptyString2(args.metadataEvent.worktreePath);
5643
+ const durationMs = typeof args.metadataEvent.durationMs === "number" ? args.metadataEvent.durationMs : void 0;
5644
+ 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.`;
5645
+ }
5646
+ if (args.event === "worktree_bootstrap_failed") {
5647
+ const error = readNonEmptyString2(args.metadataEvent.error);
5648
+ return `[System] ${args.nodeLabel} worktree bootstrap failed${error ? `: ${error}` : "."}. Use \`mesh_retry_node_bootstrap\` to retry or inspect the node state.`;
5649
+ }
5641
5650
  if (args.event === "refine:accepted") {
5642
5651
  const jobId = readRefineJobId({ metadataEvent: args.metadataEvent });
5643
5652
  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.`;
@@ -29155,6 +29164,7 @@ function expandPath2(template, input) {
29155
29164
  const vars = {
29156
29165
  cwd: workspaceResolved,
29157
29166
  cwd_dashed: workspaceResolved.replace(/\//g, "-"),
29167
+ cwd_claude_project: claudeProjectDirName(workspaceResolved),
29158
29168
  session_id: input.providerSessionId || input.sessionId || input.historySessionId || "",
29159
29169
  yyyy: String(now.getFullYear()),
29160
29170
  mm: String(now.getMonth() + 1).padStart(2, "0"),
@@ -29169,6 +29179,9 @@ function expandPath2(template, input) {
29169
29179
  if (missing) return null;
29170
29180
  return out;
29171
29181
  }
29182
+ function claudeProjectDirName(workspace) {
29183
+ return workspace.replace(/[^A-Za-z0-9_-]/g, "-");
29184
+ }
29172
29185
  function globToRegex(pattern) {
29173
29186
  const re = pattern.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*/g, "[^/]*").replace(/\?/g, "[^/]");
29174
29187
  return new RegExp(`^${re}$`);
@@ -29296,6 +29309,7 @@ function expandPathForDate(template, input, day) {
29296
29309
  const vars = {
29297
29310
  cwd: workspaceResolved,
29298
29311
  cwd_dashed: workspaceResolved.replace(/\//g, "-"),
29312
+ cwd_claude_project: claudeProjectDirName(workspaceResolved),
29299
29313
  session_id: input.providerSessionId || input.sessionId || input.historySessionId || "",
29300
29314
  yyyy: String(day.getFullYear()),
29301
29315
  mm: String(day.getMonth() + 1).padStart(2, "0"),
@@ -43875,10 +43889,11 @@ ${tail}` : ""
43875
43889
  let worktreeCleanup;
43876
43890
  if (node?.isLocalWorktree) {
43877
43891
  const nodeDaemonId = typeof node.daemonId === "string" ? node.daemonId.trim() : void 0;
43878
- const isRemoteWorktree = nodeDaemonId && nodeDaemonId !== this.deps.statusInstanceId && this.deps.dispatchMeshCommand;
43892
+ const isRemoteWorktree = nodeDaemonId && nodeDaemonId !== this.deps.statusInstanceId && this.deps.dispatchMeshCommand && !args?._meshDirectDispatch;
43879
43893
  if (isRemoteWorktree) {
43880
43894
  const forwarded = await this.deps.dispatchMeshCommand(nodeDaemonId, "remove_mesh_node", {
43881
- ...typeof args === "object" && args !== null ? args : {}
43895
+ ...typeof args === "object" && args !== null ? args : {},
43896
+ _meshDirectDispatch: true
43882
43897
  });
43883
43898
  return forwarded ?? { success: false, error: "no response from remote node" };
43884
43899
  }
@@ -43949,9 +43964,10 @@ ${tail}` : ""
43949
43964
  const sourceNode = mesh.nodes?.find((n) => n.id === sourceNodeId || n.nodeId === sourceNodeId);
43950
43965
  if (!sourceNode) return { success: false, error: `Source node '${sourceNodeId}' not found in mesh` };
43951
43966
  const sourceDaemonId = typeof sourceNode.daemonId === "string" ? sourceNode.daemonId.trim() : void 0;
43952
- if (sourceDaemonId && sourceDaemonId !== this.deps.statusInstanceId && this.deps.dispatchMeshCommand) {
43967
+ if (sourceDaemonId && sourceDaemonId !== this.deps.statusInstanceId && this.deps.dispatchMeshCommand && !args?._meshDirectDispatch) {
43953
43968
  const forwarded = await this.deps.dispatchMeshCommand(sourceDaemonId, "clone_mesh_node", {
43954
- ...typeof args === "object" && args !== null ? args : {}
43969
+ ...typeof args === "object" && args !== null ? args : {},
43970
+ _meshDirectDispatch: true
43955
43971
  });
43956
43972
  return forwarded ?? { success: false, error: "no response from remote node" };
43957
43973
  }
@@ -44188,9 +44204,10 @@ ${tail}` : ""
44188
44204
  if (!node) return { success: false, error: `Node '${nodeId}' not found in mesh` };
44189
44205
  if (!node.isLocalWorktree) return { success: false, error: "Node is not a local worktree node" };
44190
44206
  const nodeDaemonId = typeof node.daemonId === "string" ? node.daemonId.trim() : void 0;
44191
- if (nodeDaemonId && nodeDaemonId !== this.deps.statusInstanceId && this.deps.dispatchMeshCommand) {
44207
+ if (nodeDaemonId && nodeDaemonId !== this.deps.statusInstanceId && this.deps.dispatchMeshCommand && !args?._meshDirectDispatch) {
44192
44208
  const forwarded = await this.deps.dispatchMeshCommand(nodeDaemonId, "retry_mesh_node_bootstrap", {
44193
- ...typeof args === "object" && args !== null ? args : {}
44209
+ ...typeof args === "object" && args !== null ? args : {},
44210
+ _meshDirectDispatch: true
44194
44211
  });
44195
44212
  return forwarded ?? { success: false, error: "no response from remote node" };
44196
44213
  }