@adhdev/daemon-core 0.9.77-rc.42 → 0.9.77-rc.44
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/config/mesh-config.d.ts +1 -0
- package/dist/index.js +19 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -8
- package/dist/index.mjs.map +1 -1
- package/dist/repo-mesh-types.d.ts +2 -0
- package/package.json +1 -1
- package/src/commands/router.ts +2 -0
- package/src/config/mesh-config.ts +2 -0
- package/src/mesh/coordinator-prompt.ts +16 -8
- package/src/repo-mesh-types.ts +2 -0
package/dist/index.js
CHANGED
|
@@ -558,6 +558,7 @@ function addNode(meshId, opts) {
|
|
|
558
558
|
workspace: opts.workspace.trim(),
|
|
559
559
|
repoRoot: opts.repoRoot,
|
|
560
560
|
daemonId: opts.daemonId,
|
|
561
|
+
machineId: opts.machineId,
|
|
561
562
|
userOverrides: opts.userOverrides || {},
|
|
562
563
|
policy: opts.policy || {},
|
|
563
564
|
isLocalWorktree: opts.isLocalWorktree,
|
|
@@ -688,7 +689,8 @@ function buildRulesSection(coordinatorCliType) {
|
|
|
688
689
|
- **Minimize coordinator context.** The coordinator's job is routing, not implementing. Do not read source files, run commands, or analyze code directly \u2014 delegate all of that to node agents. Your context should stay lean.
|
|
689
690
|
- **Delegate analysis too.** If you need to understand a bug or explore the codebase, send that investigation as a task to the queue or a node. Do not do it yourself.
|
|
690
691
|
- **Respect explicit provider requests.** If the user names an agent/provider, pass the matching provider type to \`mesh_launch_session\`: Hermes \u2192 \`hermes-cli\`, Claude Code/Claude \u2192 \`claude-cli\`, Codex \u2192 \`codex-cli\`, Gemini \u2192 \`gemini-cli\`. Never substitute \`claude-cli\` just because the coordinator itself is Claude Code.
|
|
691
|
-
- **Front-load
|
|
692
|
+
- **Front-load new task messages.** When calling \`mesh_enqueue_task\` or \`mesh_send_task\` for a new task, include everything the agent needs: what files to touch, what the problem is, what the fix should look like. The agent won't ask follow-up questions.
|
|
693
|
+
- **Avoid context-wasting restarts.** For follow-up, retry, commit/push, preview, or cleanup work on the same issue, prefer the existing idle session and send only the delta from its last verified state. Start a fresh chat/session only for genuinely independent work, explicit provider/user request, unsafe transcript contamination, or required branch/worktree isolation.
|
|
692
694
|
- **Don't inspect code.** Treat delegated agent summaries as self-reports, not verification. Verify side effects via \`mesh_git_status\` (including related repo freshness when configured), not by reading source files.
|
|
693
695
|
- **Don't over-parallelize.** Start with 1-2 concurrent tasks. Scale up if they succeed. Never launch a duplicate session or second worker solely because \`mesh_read_chat\` has no final assistant message while the delegated session is still showing tool/terminal activity.
|
|
694
696
|
- **Handle failures with context.** If a task fails, check \`mesh_task_history\` first to see if this task was attempted before and how it failed. Read the chat to understand why, then decide: retry on the same node, reassign to a different node, or escalate to the user.
|
|
@@ -709,18 +711,24 @@ var init_coordinator_prompt = __esm({
|
|
|
709
711
|
|
|
710
712
|
| Tool | Purpose |
|
|
711
713
|
|------|---------|
|
|
712
|
-
| \`mesh_status\` | Check all nodes' health, git state,
|
|
714
|
+
| \`mesh_status\` | Check all nodes' health, git state, active sessions, and branch convergence |
|
|
713
715
|
| \`mesh_list_nodes\` | List nodes with workspace paths |
|
|
716
|
+
| \`mesh_enqueue_task\` | Add a task to the pull-based work queue; idle nodes auto-claim |
|
|
717
|
+
| \`mesh_view_queue\` | View queue status \u2014 pending, assigned, completed, failed, cancelled tasks |
|
|
718
|
+
| \`mesh_queue_cancel\` | Cancel a queue task without deleting audit history |
|
|
719
|
+
| \`mesh_queue_requeue\` | Return a task to pending for retry; clears stale session targets |
|
|
720
|
+
| \`mesh_send_task\` | Legacy push: enqueue a task targeted at a specific node |
|
|
714
721
|
| \`mesh_launch_session\` | Start a new agent session on a node |
|
|
715
|
-
| \`
|
|
716
|
-
| \`
|
|
722
|
+
| \`mesh_read_chat\` | Read recent chat messages from a delegated agent session |
|
|
723
|
+
| \`mesh_read_debug\` | Collect a daemon-side chat/parser debug bundle for a session |
|
|
717
724
|
| \`mesh_task_history\` | Read the task ledger \u2014 dispatches, completions, failures. Use to understand what has been done before deciding next steps |
|
|
718
725
|
| \`mesh_git_status\` | Check git status on a specific node |
|
|
719
726
|
| \`mesh_checkpoint\` | Create a git checkpoint on a node |
|
|
720
727
|
| \`mesh_approve\` | Approve/reject a pending agent action |
|
|
721
728
|
| \`mesh_clone_node\` | Create a worktree node for isolated parallel branch work |
|
|
722
729
|
| \`mesh_refine_node\` | Validate and merge a completed worktree node back into its base branch |
|
|
723
|
-
| \`mesh_remove_node\` | Remove a node (cleans up worktree if applicable)
|
|
730
|
+
| \`mesh_remove_node\` | Remove a node (cleans up worktree if applicable) |
|
|
731
|
+
| \`mesh_cleanup_sessions\` | Manually clean up delegated session records for a node |`;
|
|
724
732
|
TOOL_EXPOSURE_PREFLIGHT_SECTION = `## Tool Exposure Preflight
|
|
725
733
|
|
|
726
734
|
Before doing any coordinator work, confirm that the actual callable tool list includes \`mesh_status\` and the other \`mesh_*\` tools from the table above. If this Repo Mesh coordinator prompt is present but the callable \`mesh_*\` tools are missing, the MCP server/tool manifest is stale or not injected yet. Do not substitute terminal/file/git tools, do not inspect or edit the repository directly, and do not continue as a non-mesh local coding agent. Stop immediately and tell the user to run \`/reload-mcp\` or start a fresh coordinator session so ADHDev can reconnect \`adhdev-mesh\`.`;
|
|
@@ -730,9 +738,10 @@ Before doing any coordinator work, confirm that the actual callable tool list in
|
|
|
730
738
|
2. **Plan** \u2014 Decompose the user's request into independent tasks for parallel execution, or sequential tasks when dependencies exist. If \`mesh_task_history\` shows a recent failure for a task, decide whether to retry or reassign.
|
|
731
739
|
3. **Queue / Delegate** \u2014 The Mesh uses an autonomous pull-based Work Queue:
|
|
732
740
|
a. **General Tasks**: Enqueue tasks using \`mesh_enqueue_task\`. Idle node agents will automatically pull tasks from the queue and begin working.
|
|
733
|
-
b. **Node Preparation**: Call \`mesh_launch_session\`
|
|
741
|
+
b. **Node Preparation**: Reuse an existing idle session on the correct node/provider before launching a new chat/session. Call \`mesh_launch_session\` only when no suitable session exists, when the user explicitly asks for a fresh provider/session, or when branch/worktree isolation requires it. If you need branch isolation for parallel work, call \`mesh_clone_node\` to create a worktree node first.
|
|
734
742
|
c. **Targeted Tasks**: Use \`mesh_send_task\` only when you need to bypass the queue and force a specific node to execute a task immediately.
|
|
735
|
-
d.
|
|
743
|
+
d. For the first dispatch of a new task, provide a **complete, self-contained** instruction that includes all context the agent needs (file paths, line numbers, what to change, why). Do not send partial instructions expecting future follow-up.
|
|
744
|
+
e. For a continuation of the same issue in an existing session, send a concise **delta instruction**: current verified state, the exact failed/blocked step, the newly approved action, and final reporting requirements. Do not resend the full original task or open a new chat solely to continue the same work; that wastes coordinator and worker context.
|
|
736
745
|
4. **Monitor** \u2014 Prefer event-driven completion/status notifications. Do **not** poll \`mesh_read_chat\` repeatedly. Use \`mesh_view_queue\` to see the status of all pending, assigned, completed, and failed tasks. Do not call \`mesh_read_chat\` again within a few seconds for the same generating session. Use at most one compact \`mesh_read_chat\` check after a completion/approval signal. Handle approvals via \`mesh_approve\`.
|
|
737
746
|
5. **Verify** \u2014 When a task reports completion or git work is visible, call \`mesh_git_status\` to verify changes were made.
|
|
738
747
|
6. **Checkpoint** \u2014 Call \`mesh_checkpoint\` to save the work.
|
|
@@ -748,7 +757,7 @@ When a node agent stops unexpectedly, the daemon automatically enriches the syst
|
|
|
748
757
|
- A recommendation: **retry**, **reassign**, or **escalate**
|
|
749
758
|
|
|
750
759
|
Follow these recovery rules:
|
|
751
|
-
1. **If "Retry recommended"**:
|
|
760
|
+
1. **If "Retry recommended"**: Check \`mesh_view_queue\` first \u2014 the daemon may have auto-requeued. If not, re-launch the session on the same node (\`mesh_launch_session\`), then resend the original task (\`mesh_send_task\`). The system message includes the original task text.
|
|
752
761
|
2. **If "Max retries exceeded"**: Do NOT retry on the same node. Either reassign the task to a different node, or inform the user that the task requires manual intervention.
|
|
753
762
|
3. **If no recovery context**: The stop may be intentional (normal completion). Use \`mesh_read_chat\` once to verify, then move on.
|
|
754
763
|
4. **Always record what happened**: After handling a failure, briefly note the outcome in your report to the user.`;
|
|
@@ -24460,6 +24469,7 @@ var DaemonCommandRouter = class {
|
|
|
24460
24469
|
workspace: result.worktreePath,
|
|
24461
24470
|
repoRoot: result.worktreePath,
|
|
24462
24471
|
daemonId: sourceNode.daemonId,
|
|
24472
|
+
machineId: sourceNode.machineId ?? sourceNode.machine_id,
|
|
24463
24473
|
userOverrides: { ...sourceNode.userOverrides || {} },
|
|
24464
24474
|
policy: { ...sourceNode.policy || {} },
|
|
24465
24475
|
isLocalWorktree: true,
|
|
@@ -24473,6 +24483,7 @@ var DaemonCommandRouter = class {
|
|
|
24473
24483
|
workspace: result.worktreePath,
|
|
24474
24484
|
repoRoot: result.worktreePath,
|
|
24475
24485
|
daemonId: sourceNode.daemonId,
|
|
24486
|
+
machineId: sourceNode.machineId ?? sourceNode.machine_id,
|
|
24476
24487
|
userOverrides: { ...sourceNode.userOverrides || {} },
|
|
24477
24488
|
isLocalWorktree: true,
|
|
24478
24489
|
worktreeBranch: result.branch,
|