adhdev 0.9.82-rc.53 → 0.9.82-rc.55

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
@@ -1679,9 +1679,9 @@ async function listWorktrees(repoRoot) {
1679
1679
  function parseWorktreeListOutput(output) {
1680
1680
  const entries = [];
1681
1681
  const blocks = output.trim().split(/\n\n+/);
1682
- for (const block of blocks) {
1683
- if (!block.trim()) continue;
1684
- const lines = block.trim().split("\n");
1682
+ for (const block2 of blocks) {
1683
+ if (!block2.trim()) continue;
1684
+ const lines = block2.trim().split("\n");
1685
1685
  const entry = { path: "", head: "", branch: null, bare: false };
1686
1686
  for (const line of lines) {
1687
1687
  if (line.startsWith("worktree ")) {
@@ -2996,7 +2996,8 @@ function buildRulesSection(coordinatorCliType) {
2996
2996
  - **Respect node capabilities.** Don't send build tasks to read-only nodes. Don't push from nodes that aren't allowed to.
2997
2997
  - **Never fabricate tool results.** Always call the actual tool; never pretend you did.
2998
2998
  - **Clean up worktree nodes.** After a worktree task completes and its changes are merged or checkpointed, call \`mesh_remove_node\` to free resources.
2999
- - **Do not strand completed branches.** A checkpointed or clean feature/worktree branch is not done by itself. Merge/refine it to the mesh default branch, or explicitly report one of \`pushed_feature_branch_needs_merge\`, \`blocked_review\`, \`cleanup_candidate\`, or \`not_mergeable\` with the next action.
2999
+ - **Do not strand completed branches.** A checkpointed or clean feature/worktree branch is not done by itself. Merge/refine it to the mesh default branch, fast-forward obvious clean behind-only branches with \`mesh_fast_forward_node\`, or explicitly report one of \`pushed_feature_branch_needs_merge\`, \`blocked_review\`, \`cleanup_candidate\`, or \`not_mergeable\` with the next action.
3000
+ - **Keep Refinery validation project-configurable.** \`mesh_refine_node\` must execute validation from repo mesh/refine config (for example \`.adhdev/refine.{json,yaml,yml}\`, \`.adhdev/repo-mesh-refine.*\`, or \`repo-mesh.refine.*\`). Heuristics are suggestions/scaffolding only, not the execution path.
3000
3001
  - **Name worktree branches meaningfully.** Use descriptive names like \`feat/auth-refactor\` or \`fix/build-123\`.${coordinatorNote}`;
3001
3002
  }
3002
3003
  var TOOLS_SECTION, TOOL_EXPOSURE_PREFLIGHT_SECTION, WORKFLOW_SECTION;
@@ -3020,6 +3021,7 @@ var init_coordinator_prompt = __esm({
3020
3021
  | \`mesh_read_debug\` | Collect a daemon-side chat/parser debug bundle for a session |
3021
3022
  | \`mesh_task_history\` | Read the task ledger \u2014 dispatches, completions, failures. Use to understand what has been done before deciding next steps |
3022
3023
  | \`mesh_git_status\` | Check git status on a specific node |
3024
+ | \`mesh_fast_forward_node\` | Safely dry-run or explicitly execute an obvious clean fast-forward without launching an agent session |
3023
3025
  | \`mesh_checkpoint\` | Create a git checkpoint on a node |
3024
3026
  | \`mesh_approve\` | Approve/reject a pending agent action |
3025
3027
  | \`mesh_clone_node\` | Create a worktree node for isolated parallel branch work |
@@ -3042,7 +3044,7 @@ Before doing any coordinator work, confirm that the actual callable tool list in
3042
3044
  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\`.
3043
3045
  5. **Verify** \u2014 When a task reports completion or git work is visible, call \`mesh_git_status\` to verify changes were made.
3044
3046
  6. **Checkpoint** \u2014 Call \`mesh_checkpoint\` to save the work.
3045
- 7. **Converge branches** \u2014 Before marking any task complete, classify every touched node/branch into exactly one final state: \`merged_to_main\`, \`pushed_feature_branch_needs_merge\`, \`blocked_review\`, \`cleanup_candidate\`, or \`not_mergeable\`. Use \`mesh_status\` branchConvergenceSummary and \`mesh_refine_node\` for clean worktree branches when safe. A task that remains on a non-main branch is not fully complete unless the final report names the follow-up state and next step.
3047
+ 7. **Converge branches** \u2014 Before marking any task complete, classify every touched node/branch into exactly one final state: \`merged_to_main\`, \`pushed_feature_branch_needs_merge\`, \`blocked_review\`, \`cleanup_candidate\`, or \`not_mergeable\`. Use \`mesh_status\` branchConvergenceSummary. For obvious clean branch catch-up (ahead 0, behind > 0, upstream fresh, no dirty/stash/submodule issues), use \`mesh_fast_forward_node\` dry-run first and execute only when explicitly safe/approved; this avoids consuming an agent session. Use \`mesh_refine_node\` for clean worktree branches when safe. A task that remains on a non-main branch is not fully complete unless the final report names the follow-up state and next step.
3046
3048
  8. **Clean up** \u2014 Remove worktree nodes via \`mesh_remove_node\` after their work is merged or no longer needed.
3047
3049
  9. **Report** \u2014 Summarize what was done, what changed, any issues, and the branch convergence state.
3048
3050
 
@@ -5134,17 +5136,17 @@ function detectType(state, object2, explicit) {
5134
5136
  }
5135
5137
  return false;
5136
5138
  }
5137
- function writeNode(state, level, object2, block, compact, iskey, isblockseq) {
5139
+ function writeNode(state, level, object2, block2, compact, iskey, isblockseq) {
5138
5140
  state.tag = null;
5139
5141
  state.dump = object2;
5140
5142
  if (!detectType(state, object2, false)) {
5141
5143
  detectType(state, object2, true);
5142
5144
  }
5143
5145
  var type2 = _toString.call(state.dump);
5144
- var inblock = block;
5146
+ var inblock = block2;
5145
5147
  var tagStr;
5146
- if (block) {
5147
- block = state.flowLevel < 0 || state.flowLevel > level;
5148
+ if (block2) {
5149
+ block2 = state.flowLevel < 0 || state.flowLevel > level;
5148
5150
  }
5149
5151
  var objectOrArray = type2 === "[object Object]" || type2 === "[object Array]", duplicateIndex, duplicate;
5150
5152
  if (objectOrArray) {
@@ -5161,7 +5163,7 @@ function writeNode(state, level, object2, block, compact, iskey, isblockseq) {
5161
5163
  state.usedDuplicates[duplicateIndex] = true;
5162
5164
  }
5163
5165
  if (type2 === "[object Object]") {
5164
- if (block && Object.keys(state.dump).length !== 0) {
5166
+ if (block2 && Object.keys(state.dump).length !== 0) {
5165
5167
  writeBlockMapping(state, level, state.dump, compact);
5166
5168
  if (duplicate) {
5167
5169
  state.dump = "&ref_" + duplicateIndex + state.dump;
@@ -5173,7 +5175,7 @@ function writeNode(state, level, object2, block, compact, iskey, isblockseq) {
5173
5175
  }
5174
5176
  }
5175
5177
  } else if (type2 === "[object Array]") {
5176
- if (block && state.dump.length !== 0) {
5178
+ if (block2 && state.dump.length !== 0) {
5177
5179
  if (state.noArrayIndent && !isblockseq && level > 0) {
5178
5180
  writeBlockSequence(state, level - 1, state.dump, compact);
5179
5181
  } else {
@@ -6351,6 +6353,363 @@ var init_mesh_ledger = __esm({
6351
6353
  }
6352
6354
  });
6353
6355
 
6356
+ // ../../oss/packages/daemon-core/src/mesh/mesh-fast-forward.ts
6357
+ async function fastForwardMeshNode(args) {
6358
+ const workspace = typeof args.workspace === "string" ? args.workspace.trim() : "";
6359
+ const nodeId = normalizeOptionalString(args.nodeId);
6360
+ const meshId = normalizeOptionalString(args.meshId);
6361
+ const requestedBranch = normalizeOptionalString(args.branch);
6362
+ const updateSubmodules = args.updateSubmodules === true;
6363
+ const dryRun = args.dryRun === true || args.execute !== true;
6364
+ const plannedSteps = buildPlannedSteps(updateSubmodules);
6365
+ const base = {
6366
+ ...nodeId ? { nodeId } : {},
6367
+ ...meshId ? { meshId } : {},
6368
+ workspace,
6369
+ dryRun,
6370
+ updateSubmodules,
6371
+ plannedSteps
6372
+ };
6373
+ if (!workspace) {
6374
+ return block(base, "invalid_workspace", ["workspace_required"]);
6375
+ }
6376
+ const current = await getGitRepoStatus(workspace, {
6377
+ ...STATUS_OPTIONS,
6378
+ submoduleIgnorePaths: args.submoduleIgnorePaths,
6379
+ timeoutMs: args.timeoutMs ?? STATUS_OPTIONS.timeoutMs
6380
+ });
6381
+ const earlyBlockers = collectPreflightBlockers(current, requestedBranch);
6382
+ if (earlyBlockers.length > 0) {
6383
+ return {
6384
+ ...block(base, chooseBlockCode(current, earlyBlockers), earlyBlockers),
6385
+ current,
6386
+ finalBranchConvergenceState: buildConvergenceState(current, codeToConvergenceStatus(chooseBlockCode(current, earlyBlockers)))
6387
+ };
6388
+ }
6389
+ if (current.behind === 0) {
6390
+ const result2 = {
6391
+ ...base,
6392
+ success: true,
6393
+ code: "already_up_to_date",
6394
+ allowed: true,
6395
+ willRun: false,
6396
+ executed: false,
6397
+ blockingReasons: [],
6398
+ current,
6399
+ preStatus: current,
6400
+ postStatus: current,
6401
+ finalBranchConvergenceState: buildConvergenceState(current, "up_to_date")
6402
+ };
6403
+ await appendFastForwardLedger(result2, "noop");
6404
+ return result2;
6405
+ }
6406
+ const ancestorCheck = await verifyHeadIsAncestorOfUpstream(workspace, current.upstream || "", args.timeoutMs);
6407
+ if (!ancestorCheck.ok) {
6408
+ const result2 = {
6409
+ ...block(base, "non_fast_forward", ["head_is_not_ancestor_of_upstream"]),
6410
+ current,
6411
+ preStatus: current,
6412
+ operationError: ancestorCheck.error,
6413
+ finalBranchConvergenceState: buildConvergenceState(current, "not_mergeable")
6414
+ };
6415
+ await appendFastForwardLedger(result2, "blocked");
6416
+ return result2;
6417
+ }
6418
+ if (dryRun) {
6419
+ const result2 = {
6420
+ ...base,
6421
+ success: true,
6422
+ code: "fast_forward_available",
6423
+ allowed: true,
6424
+ willRun: false,
6425
+ executed: false,
6426
+ blockingReasons: [],
6427
+ current,
6428
+ preStatus: current,
6429
+ finalBranchConvergenceState: buildConvergenceState(current, "fast_forward_available")
6430
+ };
6431
+ return result2;
6432
+ }
6433
+ try {
6434
+ await runGit(workspace, ["merge", "--ff-only", current.upstream || ""], { timeoutMs: args.timeoutMs ?? 3e4 });
6435
+ } catch (error48) {
6436
+ const result2 = {
6437
+ ...block(base, "merge_ff_only_failed", ["merge_ff_only_failed"]),
6438
+ current,
6439
+ preStatus: current,
6440
+ operationError: formatGitError2(error48),
6441
+ finalBranchConvergenceState: buildConvergenceState(current, "not_mergeable")
6442
+ };
6443
+ await appendFastForwardLedger(result2, "failed");
6444
+ return result2;
6445
+ }
6446
+ let postStatus = await getGitRepoStatus(workspace, {
6447
+ ...STATUS_OPTIONS,
6448
+ submoduleIgnorePaths: args.submoduleIgnorePaths,
6449
+ timeoutMs: args.timeoutMs ?? STATUS_OPTIONS.timeoutMs
6450
+ });
6451
+ const submoduleIssues = collectSubmoduleBlockers(postStatus, "post");
6452
+ let submoduleFollowUpRequired = false;
6453
+ let operationError;
6454
+ if (submoduleIssues.length > 0) {
6455
+ if (updateSubmodules) {
6456
+ try {
6457
+ await runGit(workspace, ["submodule", "update", "--init", "--recursive"], { timeoutMs: args.timeoutMs ?? 6e4 });
6458
+ postStatus = await getGitRepoStatus(workspace, {
6459
+ ...STATUS_OPTIONS,
6460
+ submoduleIgnorePaths: args.submoduleIgnorePaths,
6461
+ timeoutMs: args.timeoutMs ?? STATUS_OPTIONS.timeoutMs
6462
+ });
6463
+ } catch (error48) {
6464
+ operationError = formatGitError2(error48);
6465
+ }
6466
+ } else {
6467
+ submoduleFollowUpRequired = true;
6468
+ }
6469
+ }
6470
+ const postBlockers = collectPostExecutionBlockers(postStatus);
6471
+ if (operationError) postBlockers.push("submodule_update_failed");
6472
+ if (submoduleFollowUpRequired) postBlockers.push("submodule_update_required");
6473
+ const success2 = postBlockers.length === 0 || submoduleFollowUpRequired;
6474
+ const code = postBlockers.length === 0 ? "fast_forward_applied" : submoduleFollowUpRequired ? "fast_forward_applied_submodule_update_required" : "post_verify_failed";
6475
+ const result = {
6476
+ ...base,
6477
+ success: success2,
6478
+ code,
6479
+ allowed: true,
6480
+ willRun: true,
6481
+ executed: true,
6482
+ blockingReasons: postBlockers,
6483
+ current,
6484
+ preStatus: current,
6485
+ postStatus,
6486
+ ...operationError ? { operationError } : {},
6487
+ finalBranchConvergenceState: buildConvergenceState(
6488
+ postStatus,
6489
+ postBlockers.length === 0 ? "fast_forwarded" : submoduleFollowUpRequired ? "follow_up_required" : "post_verify_failed"
6490
+ )
6491
+ };
6492
+ await appendFastForwardLedger(result, success2 ? "executed" : "failed");
6493
+ return result;
6494
+ }
6495
+ function buildPlannedSteps(updateSubmodules) {
6496
+ const steps = [
6497
+ {
6498
+ operation: "refresh_upstream",
6499
+ description: "Refresh the tracked upstream remote ref before trusting ahead/behind state.",
6500
+ safe: true,
6501
+ willMutateWorktree: false
6502
+ },
6503
+ {
6504
+ operation: "verify_clean_worktree",
6505
+ description: "Require clean staged/modified/untracked/deleted/renamed/conflict/stash/submodule state.",
6506
+ safe: true,
6507
+ willMutateWorktree: false
6508
+ },
6509
+ {
6510
+ operation: "verify_fast_forward",
6511
+ description: "Require ahead=0, behind>0, and HEAD to be an ancestor of the upstream ref.",
6512
+ safe: true,
6513
+ willMutateWorktree: false
6514
+ },
6515
+ {
6516
+ operation: "merge_ff_only",
6517
+ description: "Apply git merge --ff-only against the tracked upstream; no force, reset, rebase, push, or deploy.",
6518
+ safe: true,
6519
+ willMutateWorktree: true
6520
+ }
6521
+ ];
6522
+ if (updateSubmodules) {
6523
+ steps.push({
6524
+ operation: "submodule_update",
6525
+ description: "If the fast-forward changes gitlinks, run git submodule update --init --recursive and re-verify submodules.",
6526
+ safe: true,
6527
+ willMutateWorktree: true
6528
+ });
6529
+ }
6530
+ steps.push({
6531
+ operation: "verify_post_status",
6532
+ description: "Re-read daemon-owned git status and report final branch convergence state.",
6533
+ safe: true,
6534
+ willMutateWorktree: false
6535
+ });
6536
+ return steps;
6537
+ }
6538
+ function collectPreflightBlockers(status, requestedBranch) {
6539
+ const blockers = [];
6540
+ if (!status.isGitRepo) blockers.push("not_git_repo");
6541
+ if (!status.branch) blockers.push("detached_head_or_unknown_branch");
6542
+ if (requestedBranch && status.branch !== requestedBranch) blockers.push("branch_mismatch");
6543
+ if (!status.upstream) blockers.push("upstream_missing");
6544
+ if (status.upstreamStatus !== "fresh") blockers.push("upstream_not_fresh");
6545
+ if (status.hasConflicts) blockers.push("conflicts_present");
6546
+ if (status.staged > 0) blockers.push("staged_changes_present");
6547
+ if (status.modified > 0) blockers.push("modified_changes_present");
6548
+ if (status.untracked > 0) blockers.push("untracked_changes_present");
6549
+ if (status.deleted > 0) blockers.push("deleted_changes_present");
6550
+ if (status.renamed > 0) blockers.push("renamed_changes_present");
6551
+ if (status.stashCount > 0) blockers.push("stash_entries_present");
6552
+ blockers.push(...collectSubmoduleBlockers(status, "pre"));
6553
+ if (status.ahead > 0 && status.behind > 0) {
6554
+ blockers.push("branch_diverged_from_upstream");
6555
+ blockers.push("branch_has_local_commits");
6556
+ } else if (status.ahead > 0) blockers.push("branch_has_local_commits");
6557
+ return blockers;
6558
+ }
6559
+ function collectPostExecutionBlockers(status) {
6560
+ const blockers = [];
6561
+ if (!status.isGitRepo) blockers.push("post_not_git_repo");
6562
+ if (status.hasConflicts) blockers.push("post_conflicts_present");
6563
+ if (status.ahead !== 0) blockers.push("post_branch_ahead");
6564
+ if (status.behind !== 0) blockers.push("post_branch_still_behind");
6565
+ if (status.staged > 0 || status.modified > 0 || status.untracked > 0 || status.deleted > 0 || status.renamed > 0) {
6566
+ blockers.push("post_working_tree_not_clean");
6567
+ }
6568
+ if (status.stashCount > 0) blockers.push("post_stash_entries_present");
6569
+ blockers.push(...collectSubmoduleBlockers(status, "post"));
6570
+ return blockers;
6571
+ }
6572
+ function collectSubmoduleBlockers(status, phase) {
6573
+ const submodules = Array.isArray(status.submodules) ? status.submodules : [];
6574
+ const blockers = [];
6575
+ for (const submodule of submodules) {
6576
+ if (submodule.error) blockers.push(`${phase}_submodule_status_error:${submodule.path}`);
6577
+ if (submodule.dirty) blockers.push(`${phase}_submodule_dirty:${submodule.path}`);
6578
+ if (submodule.outOfSync) blockers.push(`${phase}_submodule_out_of_sync:${submodule.path}`);
6579
+ }
6580
+ return blockers;
6581
+ }
6582
+ function chooseBlockCode(status, blockers) {
6583
+ if (blockers.includes("not_git_repo")) return "not_git_repo";
6584
+ if (blockers.includes("branch_mismatch")) return "branch_mismatch";
6585
+ if (blockers.includes("upstream_missing")) return "upstream_missing";
6586
+ if (blockers.includes("upstream_not_fresh")) return "upstream_not_fresh";
6587
+ if (blockers.some((reason) => reason.includes("submodule"))) return "submodule_not_clean";
6588
+ if (blockers.includes("branch_diverged_from_upstream")) return "branch_diverged";
6589
+ if (blockers.includes("branch_has_local_commits") || status.ahead > 0) return "branch_ahead";
6590
+ if (blockers.some((reason) => reason.includes("changes") || reason.includes("conflicts") || reason.includes("stash"))) return "dirty_worktree";
6591
+ return "preflight_blocked";
6592
+ }
6593
+ function codeToConvergenceStatus(code) {
6594
+ if (code === "branch_diverged" || code === "branch_ahead" || code === "non_fast_forward") return "not_mergeable";
6595
+ if (code === "dirty_worktree" || code === "submodule_not_clean") return "blocked_review";
6596
+ return "blocked";
6597
+ }
6598
+ async function verifyHeadIsAncestorOfUpstream(workspace, upstream, timeoutMs) {
6599
+ if (!upstream) return { ok: false, error: "missing upstream" };
6600
+ try {
6601
+ await runGit(workspace, ["merge-base", "--is-ancestor", "HEAD", upstream], { timeoutMs: timeoutMs ?? 15e3 });
6602
+ return { ok: true };
6603
+ } catch (error48) {
6604
+ return { ok: false, error: formatGitError2(error48) };
6605
+ }
6606
+ }
6607
+ function block(base, code, blockingReasons) {
6608
+ const normalizedReasons = normalizeBlockingReasons(blockingReasons);
6609
+ return {
6610
+ ...base,
6611
+ success: false,
6612
+ code,
6613
+ allowed: false,
6614
+ willRun: false,
6615
+ executed: false,
6616
+ blockingReasons: normalizedReasons
6617
+ };
6618
+ }
6619
+ function normalizeBlockingReasons(reasons) {
6620
+ const normalized = /* @__PURE__ */ new Set();
6621
+ for (const reason of reasons) {
6622
+ normalized.add(reason);
6623
+ }
6624
+ if ([
6625
+ "conflicts_present",
6626
+ "staged_changes_present",
6627
+ "modified_changes_present",
6628
+ "untracked_changes_present",
6629
+ "deleted_changes_present",
6630
+ "renamed_changes_present"
6631
+ ].some((reason) => normalized.has(reason))) {
6632
+ normalized.add("working_tree_not_clean");
6633
+ }
6634
+ return Array.from(normalized);
6635
+ }
6636
+ function buildConvergenceState(status, convergenceStatus) {
6637
+ return {
6638
+ status: convergenceStatus,
6639
+ branch: status.branch,
6640
+ headCommit: status.headCommit,
6641
+ upstream: status.upstream,
6642
+ ahead: status.ahead,
6643
+ behind: status.behind,
6644
+ dirty: status.staged + status.modified + status.untracked + status.deleted + status.renamed > 0 || status.hasConflicts,
6645
+ stashCount: status.stashCount,
6646
+ submodules: summarizeSubmodules(status.submodules)
6647
+ };
6648
+ }
6649
+ function summarizeSubmodules(submodules) {
6650
+ return (submodules || []).map((submodule) => ({
6651
+ path: submodule.path,
6652
+ commit: submodule.commit,
6653
+ dirty: submodule.dirty,
6654
+ outOfSync: submodule.outOfSync,
6655
+ ...submodule.error ? { error: submodule.error } : {}
6656
+ }));
6657
+ }
6658
+ function normalizeOptionalString(value) {
6659
+ return typeof value === "string" && value.trim() ? value.trim() : void 0;
6660
+ }
6661
+ function formatGitError2(error48) {
6662
+ if (error48 instanceof GitCommandError) {
6663
+ return error48.stderr || error48.stdout || error48.message;
6664
+ }
6665
+ if (error48 instanceof Error) return error48.message;
6666
+ return String(error48);
6667
+ }
6668
+ async function appendFastForwardLedger(result, outcome) {
6669
+ if (!result.meshId) return;
6670
+ try {
6671
+ const { appendLedgerEntry: appendLedgerEntry2 } = await Promise.resolve().then(() => (init_mesh_ledger(), mesh_ledger_exports));
6672
+ appendLedgerEntry2(result.meshId, {
6673
+ kind: "direct_fast_forward",
6674
+ ...result.nodeId ? { nodeId: result.nodeId } : {},
6675
+ payload: {
6676
+ operation: "mesh_fast_forward_node",
6677
+ outcome,
6678
+ code: result.code,
6679
+ workspace: result.workspace,
6680
+ allowed: result.allowed,
6681
+ dryRun: result.dryRun,
6682
+ willRun: result.willRun,
6683
+ executed: result.executed,
6684
+ branch: result.postStatus?.branch ?? result.current?.branch,
6685
+ upstream: result.postStatus?.upstream ?? result.current?.upstream,
6686
+ before: result.current ? {
6687
+ headCommit: result.current.headCommit,
6688
+ ahead: result.current.ahead,
6689
+ behind: result.current.behind
6690
+ } : void 0,
6691
+ after: result.postStatus ? {
6692
+ headCommit: result.postStatus.headCommit,
6693
+ ahead: result.postStatus.ahead,
6694
+ behind: result.postStatus.behind
6695
+ } : void 0,
6696
+ blockingReasons: result.blockingReasons
6697
+ }
6698
+ });
6699
+ } catch (error48) {
6700
+ result.ledgerError = error48 instanceof Error ? error48.message : String(error48);
6701
+ }
6702
+ }
6703
+ var STATUS_OPTIONS;
6704
+ var init_mesh_fast_forward = __esm({
6705
+ "../../oss/packages/daemon-core/src/mesh/mesh-fast-forward.ts"() {
6706
+ "use strict";
6707
+ init_git_status();
6708
+ init_git_executor();
6709
+ STATUS_OPTIONS = { refreshUpstream: true, includeSubmodules: true, timeoutMs: 15e3 };
6710
+ }
6711
+ });
6712
+
6354
6713
  // ../../oss/packages/daemon-core/src/mesh/mesh-ledger-reconciliation.ts
6355
6714
  function lastTimestamp(slice) {
6356
6715
  const entries = Array.isArray(slice?.entries) ? slice.entries : [];
@@ -45532,10 +45891,10 @@ function getMessageEventTime(message) {
45532
45891
  function stringifyPreviewContent(content) {
45533
45892
  if (typeof content === "string") return content;
45534
45893
  if (Array.isArray(content)) {
45535
- return content.map((block) => {
45536
- if (typeof block === "string") return block;
45537
- if (block && typeof block === "object" && "text" in block) {
45538
- return String(block.text || "");
45894
+ return content.map((block2) => {
45895
+ if (typeof block2 === "string") return block2;
45896
+ if (block2 && typeof block2 === "object" && "text" in block2) {
45897
+ return String(block2.text || "");
45539
45898
  }
45540
45899
  return "";
45541
45900
  }).join(" ");
@@ -47120,6 +47479,7 @@ var init_router = __esm({
47120
47479
  init_builders();
47121
47480
  init_mesh_events();
47122
47481
  init_mesh_host_ownership();
47482
+ init_mesh_fast_forward();
47123
47483
  init_refine_config();
47124
47484
  init_snapshot();
47125
47485
  init_snapshot();
@@ -48836,6 +49196,32 @@ var init_router = __esm({
48836
49196
  cleanupWillRun: false
48837
49197
  };
48838
49198
  }
49199
+ case "fast_forward_mesh_node": {
49200
+ const meshId = typeof args?.meshId === "string" ? args.meshId.trim() : "";
49201
+ const nodeId = typeof args?.nodeId === "string" ? args.nodeId.trim() : "";
49202
+ let workspace = typeof args?.workspace === "string" ? args.workspace.trim() : "";
49203
+ let submoduleIgnorePaths = Array.isArray(args?.submoduleIgnorePaths) ? args.submoduleIgnorePaths.filter((value) => typeof value === "string") : void 0;
49204
+ if (!workspace && meshId && nodeId) {
49205
+ const meshRecord = await this.getMeshForCommand(meshId, args?.inlineMesh);
49206
+ const mesh = meshRecord?.mesh;
49207
+ const node = mesh?.nodes?.find((n) => n.id === nodeId || n.nodeId === nodeId);
49208
+ workspace = typeof node?.workspace === "string" ? node.workspace.trim() : "";
49209
+ if (!submoduleIgnorePaths && Array.isArray(node?.policy?.submoduleIgnorePaths)) {
49210
+ submoduleIgnorePaths = node.policy.submoduleIgnorePaths.filter((value) => typeof value === "string");
49211
+ }
49212
+ }
49213
+ const result = await fastForwardMeshNode({
49214
+ meshId: meshId || void 0,
49215
+ nodeId: nodeId || void 0,
49216
+ workspace,
49217
+ branch: typeof args?.branch === "string" ? args.branch : void 0,
49218
+ execute: args?.execute === true,
49219
+ dryRun: args?.dryRun === true,
49220
+ updateSubmodules: args?.updateSubmodules === true,
49221
+ submoduleIgnorePaths
49222
+ });
49223
+ return result;
49224
+ }
48839
49225
  case "refine_mesh_node": {
48840
49226
  const meshId = typeof args?.meshId === "string" ? args.meshId.trim() : "";
48841
49227
  const nodeId = typeof args?.nodeId === "string" ? args.nodeId.trim() : "";
@@ -49346,20 +49732,20 @@ var init_router = __esm({
49346
49732
  const geminiMdPath = `${workspace}/GEMINI.md`;
49347
49733
  const marker = "<!-- adhdev-mesh-coordinator-prompt -->";
49348
49734
  const markerEnd = "<!-- /adhdev-mesh-coordinator-prompt -->";
49349
- const block = `${marker}
49735
+ const block2 = `${marker}
49350
49736
  ${cliCmdSystemPrompt}
49351
49737
  ${markerEnd}`;
49352
49738
  if (efs(geminiMdPath)) {
49353
49739
  const existing = rfs(geminiMdPath, "utf-8");
49354
49740
  const replaced = existing.replace(
49355
49741
  new RegExp(`${marker}[\\s\\S]*?${markerEnd}`, "g"),
49356
- block
49742
+ block2
49357
49743
  );
49358
49744
  wfs(geminiMdPath, replaced.includes(marker) ? replaced : `${existing}
49359
49745
 
49360
- ${block}`);
49746
+ ${block2}`);
49361
49747
  } else {
49362
- wfs(geminiMdPath, block);
49748
+ wfs(geminiMdPath, block2);
49363
49749
  }
49364
49750
  LOG.info("MeshCoordinator", `Wrote coordinator prompt to ${workspace}/GEMINI.md`);
49365
49751
  } catch (e) {
@@ -58173,6 +58559,7 @@ __export(src_exports, {
58173
58559
  enqueueTask: () => enqueueTask,
58174
58560
  ensureSessionHostReady: () => ensureSessionHostReady,
58175
58561
  execNpmCommandSync: () => execNpmCommandSync,
58562
+ fastForwardMeshNode: () => fastForwardMeshNode,
58176
58563
  filterActivityChatMessages: () => filterActivityChatMessages,
58177
58564
  filterChatMessagesByVisibility: () => filterChatMessagesByVisibility,
58178
58565
  filterInternalChatMessages: () => filterInternalChatMessages,
@@ -58322,6 +58709,7 @@ var init_src = __esm({
58322
58709
  init_refine_config();
58323
58710
  init_mesh_sync();
58324
58711
  init_mesh_ledger();
58712
+ init_mesh_fast_forward();
58325
58713
  init_mesh_ledger_reconciliation();
58326
58714
  init_mesh_work_queue();
58327
58715
  init_mesh_host_ownership();
@@ -66731,7 +67119,7 @@ var require_utility = __commonJS({
66731
67119
  function simd(simd2) {
66732
67120
  return sharp.simd(is.bool(simd2) ? simd2 : null);
66733
67121
  }
66734
- function block(options) {
67122
+ function block2(options) {
66735
67123
  if (is.object(options)) {
66736
67124
  if (Array.isArray(options.operation) && options.operation.every(is.string)) {
66737
67125
  sharp.block(options.operation, true);
@@ -66762,7 +67150,7 @@ var require_utility = __commonJS({
66762
67150
  Sharp.interpolators = interpolators;
66763
67151
  Sharp.versions = versions;
66764
67152
  Sharp.queue = queue;
66765
- Sharp.block = block;
67153
+ Sharp.block = block2;
66766
67154
  Sharp.unblock = unblock;
66767
67155
  };
66768
67156
  }
@@ -68050,6 +68438,17 @@ function summarizeMeshCommandArgs(command, args) {
68050
68438
  includeSubmodules: args.includeSubmodules === true
68051
68439
  };
68052
68440
  }
68441
+ if (command === "fast_forward_mesh_node") {
68442
+ return {
68443
+ meshId: typeof args.meshId === "string" ? args.meshId : null,
68444
+ nodeId: typeof args.nodeId === "string" ? args.nodeId : null,
68445
+ workspace: typeof args.workspace === "string" ? args.workspace : null,
68446
+ branch: typeof args.branch === "string" ? args.branch : null,
68447
+ execute: args.execute === true,
68448
+ dryRun: args.dryRun === true,
68449
+ updateSubmodules: args.updateSubmodules === true
68450
+ };
68451
+ }
68053
68452
  if (command === "mesh_status" || command === "get_mesh") {
68054
68453
  const inlineMesh = asRecord(args.inlineMesh);
68055
68454
  const inlineNodes = Array.isArray(inlineMesh.nodes) ? inlineMesh.nodes : [];
@@ -68945,7 +69344,7 @@ var init_adhdev_daemon = __esm({
68945
69344
  init_version();
68946
69345
  init_src();
68947
69346
  init_runtime_defaults();
68948
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.82-rc.53" });
69347
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.82-rc.55" });
68949
69348
  AdhdevDaemon = class _AdhdevDaemon {
68950
69349
  localHttpServer = null;
68951
69350
  localWss = null;