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/cli/index.js CHANGED
@@ -2199,9 +2199,9 @@ async function listWorktrees(repoRoot) {
2199
2199
  function parseWorktreeListOutput(output) {
2200
2200
  const entries = [];
2201
2201
  const blocks = output.trim().split(/\n\n+/);
2202
- for (const block of blocks) {
2203
- if (!block.trim()) continue;
2204
- const lines = block.trim().split("\n");
2202
+ for (const block2 of blocks) {
2203
+ if (!block2.trim()) continue;
2204
+ const lines = block2.trim().split("\n");
2205
2205
  const entry = { path: "", head: "", branch: null, bare: false };
2206
2206
  for (const line of lines) {
2207
2207
  if (line.startsWith("worktree ")) {
@@ -3516,7 +3516,8 @@ function buildRulesSection(coordinatorCliType) {
3516
3516
  - **Respect node capabilities.** Don't send build tasks to read-only nodes. Don't push from nodes that aren't allowed to.
3517
3517
  - **Never fabricate tool results.** Always call the actual tool; never pretend you did.
3518
3518
  - **Clean up worktree nodes.** After a worktree task completes and its changes are merged or checkpointed, call \`mesh_remove_node\` to free resources.
3519
- - **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.
3519
+ - **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.
3520
+ - **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.
3520
3521
  - **Name worktree branches meaningfully.** Use descriptive names like \`feat/auth-refactor\` or \`fix/build-123\`.${coordinatorNote}`;
3521
3522
  }
3522
3523
  var TOOLS_SECTION, TOOL_EXPOSURE_PREFLIGHT_SECTION, WORKFLOW_SECTION;
@@ -3540,6 +3541,7 @@ var init_coordinator_prompt = __esm({
3540
3541
  | \`mesh_read_debug\` | Collect a daemon-side chat/parser debug bundle for a session |
3541
3542
  | \`mesh_task_history\` | Read the task ledger \u2014 dispatches, completions, failures. Use to understand what has been done before deciding next steps |
3542
3543
  | \`mesh_git_status\` | Check git status on a specific node |
3544
+ | \`mesh_fast_forward_node\` | Safely dry-run or explicitly execute an obvious clean fast-forward without launching an agent session |
3543
3545
  | \`mesh_checkpoint\` | Create a git checkpoint on a node |
3544
3546
  | \`mesh_approve\` | Approve/reject a pending agent action |
3545
3547
  | \`mesh_clone_node\` | Create a worktree node for isolated parallel branch work |
@@ -3562,7 +3564,7 @@ Before doing any coordinator work, confirm that the actual callable tool list in
3562
3564
  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\`.
3563
3565
  5. **Verify** \u2014 When a task reports completion or git work is visible, call \`mesh_git_status\` to verify changes were made.
3564
3566
  6. **Checkpoint** \u2014 Call \`mesh_checkpoint\` to save the work.
3565
- 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.
3567
+ 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.
3566
3568
  8. **Clean up** \u2014 Remove worktree nodes via \`mesh_remove_node\` after their work is merged or no longer needed.
3567
3569
  9. **Report** \u2014 Summarize what was done, what changed, any issues, and the branch convergence state.
3568
3570
 
@@ -5654,17 +5656,17 @@ function detectType(state, object2, explicit) {
5654
5656
  }
5655
5657
  return false;
5656
5658
  }
5657
- function writeNode(state, level, object2, block, compact, iskey, isblockseq) {
5659
+ function writeNode(state, level, object2, block2, compact, iskey, isblockseq) {
5658
5660
  state.tag = null;
5659
5661
  state.dump = object2;
5660
5662
  if (!detectType(state, object2, false)) {
5661
5663
  detectType(state, object2, true);
5662
5664
  }
5663
5665
  var type2 = _toString.call(state.dump);
5664
- var inblock = block;
5666
+ var inblock = block2;
5665
5667
  var tagStr;
5666
- if (block) {
5667
- block = state.flowLevel < 0 || state.flowLevel > level;
5668
+ if (block2) {
5669
+ block2 = state.flowLevel < 0 || state.flowLevel > level;
5668
5670
  }
5669
5671
  var objectOrArray = type2 === "[object Object]" || type2 === "[object Array]", duplicateIndex, duplicate;
5670
5672
  if (objectOrArray) {
@@ -5681,7 +5683,7 @@ function writeNode(state, level, object2, block, compact, iskey, isblockseq) {
5681
5683
  state.usedDuplicates[duplicateIndex] = true;
5682
5684
  }
5683
5685
  if (type2 === "[object Object]") {
5684
- if (block && Object.keys(state.dump).length !== 0) {
5686
+ if (block2 && Object.keys(state.dump).length !== 0) {
5685
5687
  writeBlockMapping(state, level, state.dump, compact);
5686
5688
  if (duplicate) {
5687
5689
  state.dump = "&ref_" + duplicateIndex + state.dump;
@@ -5693,7 +5695,7 @@ function writeNode(state, level, object2, block, compact, iskey, isblockseq) {
5693
5695
  }
5694
5696
  }
5695
5697
  } else if (type2 === "[object Array]") {
5696
- if (block && state.dump.length !== 0) {
5698
+ if (block2 && state.dump.length !== 0) {
5697
5699
  if (state.noArrayIndent && !isblockseq && level > 0) {
5698
5700
  writeBlockSequence(state, level - 1, state.dump, compact);
5699
5701
  } else {
@@ -6871,6 +6873,363 @@ var init_mesh_ledger = __esm({
6871
6873
  }
6872
6874
  });
6873
6875
 
6876
+ // ../../oss/packages/daemon-core/src/mesh/mesh-fast-forward.ts
6877
+ async function fastForwardMeshNode(args) {
6878
+ const workspace = typeof args.workspace === "string" ? args.workspace.trim() : "";
6879
+ const nodeId = normalizeOptionalString(args.nodeId);
6880
+ const meshId = normalizeOptionalString(args.meshId);
6881
+ const requestedBranch = normalizeOptionalString(args.branch);
6882
+ const updateSubmodules = args.updateSubmodules === true;
6883
+ const dryRun = args.dryRun === true || args.execute !== true;
6884
+ const plannedSteps = buildPlannedSteps(updateSubmodules);
6885
+ const base = {
6886
+ ...nodeId ? { nodeId } : {},
6887
+ ...meshId ? { meshId } : {},
6888
+ workspace,
6889
+ dryRun,
6890
+ updateSubmodules,
6891
+ plannedSteps
6892
+ };
6893
+ if (!workspace) {
6894
+ return block(base, "invalid_workspace", ["workspace_required"]);
6895
+ }
6896
+ const current = await getGitRepoStatus(workspace, {
6897
+ ...STATUS_OPTIONS,
6898
+ submoduleIgnorePaths: args.submoduleIgnorePaths,
6899
+ timeoutMs: args.timeoutMs ?? STATUS_OPTIONS.timeoutMs
6900
+ });
6901
+ const earlyBlockers = collectPreflightBlockers(current, requestedBranch);
6902
+ if (earlyBlockers.length > 0) {
6903
+ return {
6904
+ ...block(base, chooseBlockCode(current, earlyBlockers), earlyBlockers),
6905
+ current,
6906
+ finalBranchConvergenceState: buildConvergenceState(current, codeToConvergenceStatus(chooseBlockCode(current, earlyBlockers)))
6907
+ };
6908
+ }
6909
+ if (current.behind === 0) {
6910
+ const result2 = {
6911
+ ...base,
6912
+ success: true,
6913
+ code: "already_up_to_date",
6914
+ allowed: true,
6915
+ willRun: false,
6916
+ executed: false,
6917
+ blockingReasons: [],
6918
+ current,
6919
+ preStatus: current,
6920
+ postStatus: current,
6921
+ finalBranchConvergenceState: buildConvergenceState(current, "up_to_date")
6922
+ };
6923
+ await appendFastForwardLedger(result2, "noop");
6924
+ return result2;
6925
+ }
6926
+ const ancestorCheck = await verifyHeadIsAncestorOfUpstream(workspace, current.upstream || "", args.timeoutMs);
6927
+ if (!ancestorCheck.ok) {
6928
+ const result2 = {
6929
+ ...block(base, "non_fast_forward", ["head_is_not_ancestor_of_upstream"]),
6930
+ current,
6931
+ preStatus: current,
6932
+ operationError: ancestorCheck.error,
6933
+ finalBranchConvergenceState: buildConvergenceState(current, "not_mergeable")
6934
+ };
6935
+ await appendFastForwardLedger(result2, "blocked");
6936
+ return result2;
6937
+ }
6938
+ if (dryRun) {
6939
+ const result2 = {
6940
+ ...base,
6941
+ success: true,
6942
+ code: "fast_forward_available",
6943
+ allowed: true,
6944
+ willRun: false,
6945
+ executed: false,
6946
+ blockingReasons: [],
6947
+ current,
6948
+ preStatus: current,
6949
+ finalBranchConvergenceState: buildConvergenceState(current, "fast_forward_available")
6950
+ };
6951
+ return result2;
6952
+ }
6953
+ try {
6954
+ await runGit(workspace, ["merge", "--ff-only", current.upstream || ""], { timeoutMs: args.timeoutMs ?? 3e4 });
6955
+ } catch (error48) {
6956
+ const result2 = {
6957
+ ...block(base, "merge_ff_only_failed", ["merge_ff_only_failed"]),
6958
+ current,
6959
+ preStatus: current,
6960
+ operationError: formatGitError2(error48),
6961
+ finalBranchConvergenceState: buildConvergenceState(current, "not_mergeable")
6962
+ };
6963
+ await appendFastForwardLedger(result2, "failed");
6964
+ return result2;
6965
+ }
6966
+ let postStatus = await getGitRepoStatus(workspace, {
6967
+ ...STATUS_OPTIONS,
6968
+ submoduleIgnorePaths: args.submoduleIgnorePaths,
6969
+ timeoutMs: args.timeoutMs ?? STATUS_OPTIONS.timeoutMs
6970
+ });
6971
+ const submoduleIssues = collectSubmoduleBlockers(postStatus, "post");
6972
+ let submoduleFollowUpRequired = false;
6973
+ let operationError;
6974
+ if (submoduleIssues.length > 0) {
6975
+ if (updateSubmodules) {
6976
+ try {
6977
+ await runGit(workspace, ["submodule", "update", "--init", "--recursive"], { timeoutMs: args.timeoutMs ?? 6e4 });
6978
+ postStatus = await getGitRepoStatus(workspace, {
6979
+ ...STATUS_OPTIONS,
6980
+ submoduleIgnorePaths: args.submoduleIgnorePaths,
6981
+ timeoutMs: args.timeoutMs ?? STATUS_OPTIONS.timeoutMs
6982
+ });
6983
+ } catch (error48) {
6984
+ operationError = formatGitError2(error48);
6985
+ }
6986
+ } else {
6987
+ submoduleFollowUpRequired = true;
6988
+ }
6989
+ }
6990
+ const postBlockers = collectPostExecutionBlockers(postStatus);
6991
+ if (operationError) postBlockers.push("submodule_update_failed");
6992
+ if (submoduleFollowUpRequired) postBlockers.push("submodule_update_required");
6993
+ const success2 = postBlockers.length === 0 || submoduleFollowUpRequired;
6994
+ const code = postBlockers.length === 0 ? "fast_forward_applied" : submoduleFollowUpRequired ? "fast_forward_applied_submodule_update_required" : "post_verify_failed";
6995
+ const result = {
6996
+ ...base,
6997
+ success: success2,
6998
+ code,
6999
+ allowed: true,
7000
+ willRun: true,
7001
+ executed: true,
7002
+ blockingReasons: postBlockers,
7003
+ current,
7004
+ preStatus: current,
7005
+ postStatus,
7006
+ ...operationError ? { operationError } : {},
7007
+ finalBranchConvergenceState: buildConvergenceState(
7008
+ postStatus,
7009
+ postBlockers.length === 0 ? "fast_forwarded" : submoduleFollowUpRequired ? "follow_up_required" : "post_verify_failed"
7010
+ )
7011
+ };
7012
+ await appendFastForwardLedger(result, success2 ? "executed" : "failed");
7013
+ return result;
7014
+ }
7015
+ function buildPlannedSteps(updateSubmodules) {
7016
+ const steps = [
7017
+ {
7018
+ operation: "refresh_upstream",
7019
+ description: "Refresh the tracked upstream remote ref before trusting ahead/behind state.",
7020
+ safe: true,
7021
+ willMutateWorktree: false
7022
+ },
7023
+ {
7024
+ operation: "verify_clean_worktree",
7025
+ description: "Require clean staged/modified/untracked/deleted/renamed/conflict/stash/submodule state.",
7026
+ safe: true,
7027
+ willMutateWorktree: false
7028
+ },
7029
+ {
7030
+ operation: "verify_fast_forward",
7031
+ description: "Require ahead=0, behind>0, and HEAD to be an ancestor of the upstream ref.",
7032
+ safe: true,
7033
+ willMutateWorktree: false
7034
+ },
7035
+ {
7036
+ operation: "merge_ff_only",
7037
+ description: "Apply git merge --ff-only against the tracked upstream; no force, reset, rebase, push, or deploy.",
7038
+ safe: true,
7039
+ willMutateWorktree: true
7040
+ }
7041
+ ];
7042
+ if (updateSubmodules) {
7043
+ steps.push({
7044
+ operation: "submodule_update",
7045
+ description: "If the fast-forward changes gitlinks, run git submodule update --init --recursive and re-verify submodules.",
7046
+ safe: true,
7047
+ willMutateWorktree: true
7048
+ });
7049
+ }
7050
+ steps.push({
7051
+ operation: "verify_post_status",
7052
+ description: "Re-read daemon-owned git status and report final branch convergence state.",
7053
+ safe: true,
7054
+ willMutateWorktree: false
7055
+ });
7056
+ return steps;
7057
+ }
7058
+ function collectPreflightBlockers(status, requestedBranch) {
7059
+ const blockers = [];
7060
+ if (!status.isGitRepo) blockers.push("not_git_repo");
7061
+ if (!status.branch) blockers.push("detached_head_or_unknown_branch");
7062
+ if (requestedBranch && status.branch !== requestedBranch) blockers.push("branch_mismatch");
7063
+ if (!status.upstream) blockers.push("upstream_missing");
7064
+ if (status.upstreamStatus !== "fresh") blockers.push("upstream_not_fresh");
7065
+ if (status.hasConflicts) blockers.push("conflicts_present");
7066
+ if (status.staged > 0) blockers.push("staged_changes_present");
7067
+ if (status.modified > 0) blockers.push("modified_changes_present");
7068
+ if (status.untracked > 0) blockers.push("untracked_changes_present");
7069
+ if (status.deleted > 0) blockers.push("deleted_changes_present");
7070
+ if (status.renamed > 0) blockers.push("renamed_changes_present");
7071
+ if (status.stashCount > 0) blockers.push("stash_entries_present");
7072
+ blockers.push(...collectSubmoduleBlockers(status, "pre"));
7073
+ if (status.ahead > 0 && status.behind > 0) {
7074
+ blockers.push("branch_diverged_from_upstream");
7075
+ blockers.push("branch_has_local_commits");
7076
+ } else if (status.ahead > 0) blockers.push("branch_has_local_commits");
7077
+ return blockers;
7078
+ }
7079
+ function collectPostExecutionBlockers(status) {
7080
+ const blockers = [];
7081
+ if (!status.isGitRepo) blockers.push("post_not_git_repo");
7082
+ if (status.hasConflicts) blockers.push("post_conflicts_present");
7083
+ if (status.ahead !== 0) blockers.push("post_branch_ahead");
7084
+ if (status.behind !== 0) blockers.push("post_branch_still_behind");
7085
+ if (status.staged > 0 || status.modified > 0 || status.untracked > 0 || status.deleted > 0 || status.renamed > 0) {
7086
+ blockers.push("post_working_tree_not_clean");
7087
+ }
7088
+ if (status.stashCount > 0) blockers.push("post_stash_entries_present");
7089
+ blockers.push(...collectSubmoduleBlockers(status, "post"));
7090
+ return blockers;
7091
+ }
7092
+ function collectSubmoduleBlockers(status, phase) {
7093
+ const submodules = Array.isArray(status.submodules) ? status.submodules : [];
7094
+ const blockers = [];
7095
+ for (const submodule of submodules) {
7096
+ if (submodule.error) blockers.push(`${phase}_submodule_status_error:${submodule.path}`);
7097
+ if (submodule.dirty) blockers.push(`${phase}_submodule_dirty:${submodule.path}`);
7098
+ if (submodule.outOfSync) blockers.push(`${phase}_submodule_out_of_sync:${submodule.path}`);
7099
+ }
7100
+ return blockers;
7101
+ }
7102
+ function chooseBlockCode(status, blockers) {
7103
+ if (blockers.includes("not_git_repo")) return "not_git_repo";
7104
+ if (blockers.includes("branch_mismatch")) return "branch_mismatch";
7105
+ if (blockers.includes("upstream_missing")) return "upstream_missing";
7106
+ if (blockers.includes("upstream_not_fresh")) return "upstream_not_fresh";
7107
+ if (blockers.some((reason) => reason.includes("submodule"))) return "submodule_not_clean";
7108
+ if (blockers.includes("branch_diverged_from_upstream")) return "branch_diverged";
7109
+ if (blockers.includes("branch_has_local_commits") || status.ahead > 0) return "branch_ahead";
7110
+ if (blockers.some((reason) => reason.includes("changes") || reason.includes("conflicts") || reason.includes("stash"))) return "dirty_worktree";
7111
+ return "preflight_blocked";
7112
+ }
7113
+ function codeToConvergenceStatus(code) {
7114
+ if (code === "branch_diverged" || code === "branch_ahead" || code === "non_fast_forward") return "not_mergeable";
7115
+ if (code === "dirty_worktree" || code === "submodule_not_clean") return "blocked_review";
7116
+ return "blocked";
7117
+ }
7118
+ async function verifyHeadIsAncestorOfUpstream(workspace, upstream, timeoutMs) {
7119
+ if (!upstream) return { ok: false, error: "missing upstream" };
7120
+ try {
7121
+ await runGit(workspace, ["merge-base", "--is-ancestor", "HEAD", upstream], { timeoutMs: timeoutMs ?? 15e3 });
7122
+ return { ok: true };
7123
+ } catch (error48) {
7124
+ return { ok: false, error: formatGitError2(error48) };
7125
+ }
7126
+ }
7127
+ function block(base, code, blockingReasons) {
7128
+ const normalizedReasons = normalizeBlockingReasons(blockingReasons);
7129
+ return {
7130
+ ...base,
7131
+ success: false,
7132
+ code,
7133
+ allowed: false,
7134
+ willRun: false,
7135
+ executed: false,
7136
+ blockingReasons: normalizedReasons
7137
+ };
7138
+ }
7139
+ function normalizeBlockingReasons(reasons) {
7140
+ const normalized = /* @__PURE__ */ new Set();
7141
+ for (const reason of reasons) {
7142
+ normalized.add(reason);
7143
+ }
7144
+ if ([
7145
+ "conflicts_present",
7146
+ "staged_changes_present",
7147
+ "modified_changes_present",
7148
+ "untracked_changes_present",
7149
+ "deleted_changes_present",
7150
+ "renamed_changes_present"
7151
+ ].some((reason) => normalized.has(reason))) {
7152
+ normalized.add("working_tree_not_clean");
7153
+ }
7154
+ return Array.from(normalized);
7155
+ }
7156
+ function buildConvergenceState(status, convergenceStatus) {
7157
+ return {
7158
+ status: convergenceStatus,
7159
+ branch: status.branch,
7160
+ headCommit: status.headCommit,
7161
+ upstream: status.upstream,
7162
+ ahead: status.ahead,
7163
+ behind: status.behind,
7164
+ dirty: status.staged + status.modified + status.untracked + status.deleted + status.renamed > 0 || status.hasConflicts,
7165
+ stashCount: status.stashCount,
7166
+ submodules: summarizeSubmodules(status.submodules)
7167
+ };
7168
+ }
7169
+ function summarizeSubmodules(submodules) {
7170
+ return (submodules || []).map((submodule) => ({
7171
+ path: submodule.path,
7172
+ commit: submodule.commit,
7173
+ dirty: submodule.dirty,
7174
+ outOfSync: submodule.outOfSync,
7175
+ ...submodule.error ? { error: submodule.error } : {}
7176
+ }));
7177
+ }
7178
+ function normalizeOptionalString(value) {
7179
+ return typeof value === "string" && value.trim() ? value.trim() : void 0;
7180
+ }
7181
+ function formatGitError2(error48) {
7182
+ if (error48 instanceof GitCommandError) {
7183
+ return error48.stderr || error48.stdout || error48.message;
7184
+ }
7185
+ if (error48 instanceof Error) return error48.message;
7186
+ return String(error48);
7187
+ }
7188
+ async function appendFastForwardLedger(result, outcome) {
7189
+ if (!result.meshId) return;
7190
+ try {
7191
+ const { appendLedgerEntry: appendLedgerEntry2 } = await Promise.resolve().then(() => (init_mesh_ledger(), mesh_ledger_exports));
7192
+ appendLedgerEntry2(result.meshId, {
7193
+ kind: "direct_fast_forward",
7194
+ ...result.nodeId ? { nodeId: result.nodeId } : {},
7195
+ payload: {
7196
+ operation: "mesh_fast_forward_node",
7197
+ outcome,
7198
+ code: result.code,
7199
+ workspace: result.workspace,
7200
+ allowed: result.allowed,
7201
+ dryRun: result.dryRun,
7202
+ willRun: result.willRun,
7203
+ executed: result.executed,
7204
+ branch: result.postStatus?.branch ?? result.current?.branch,
7205
+ upstream: result.postStatus?.upstream ?? result.current?.upstream,
7206
+ before: result.current ? {
7207
+ headCommit: result.current.headCommit,
7208
+ ahead: result.current.ahead,
7209
+ behind: result.current.behind
7210
+ } : void 0,
7211
+ after: result.postStatus ? {
7212
+ headCommit: result.postStatus.headCommit,
7213
+ ahead: result.postStatus.ahead,
7214
+ behind: result.postStatus.behind
7215
+ } : void 0,
7216
+ blockingReasons: result.blockingReasons
7217
+ }
7218
+ });
7219
+ } catch (error48) {
7220
+ result.ledgerError = error48 instanceof Error ? error48.message : String(error48);
7221
+ }
7222
+ }
7223
+ var STATUS_OPTIONS;
7224
+ var init_mesh_fast_forward = __esm({
7225
+ "../../oss/packages/daemon-core/src/mesh/mesh-fast-forward.ts"() {
7226
+ "use strict";
7227
+ init_git_status();
7228
+ init_git_executor();
7229
+ STATUS_OPTIONS = { refreshUpstream: true, includeSubmodules: true, timeoutMs: 15e3 };
7230
+ }
7231
+ });
7232
+
6874
7233
  // ../../oss/packages/daemon-core/src/mesh/mesh-ledger-reconciliation.ts
6875
7234
  function lastTimestamp(slice) {
6876
7235
  const entries = Array.isArray(slice?.entries) ? slice.entries : [];
@@ -46520,10 +46879,10 @@ function getMessageEventTime(message) {
46520
46879
  function stringifyPreviewContent(content) {
46521
46880
  if (typeof content === "string") return content;
46522
46881
  if (Array.isArray(content)) {
46523
- return content.map((block) => {
46524
- if (typeof block === "string") return block;
46525
- if (block && typeof block === "object" && "text" in block) {
46526
- return String(block.text || "");
46882
+ return content.map((block2) => {
46883
+ if (typeof block2 === "string") return block2;
46884
+ if (block2 && typeof block2 === "object" && "text" in block2) {
46885
+ return String(block2.text || "");
46527
46886
  }
46528
46887
  return "";
46529
46888
  }).join(" ");
@@ -48108,6 +48467,7 @@ var init_router = __esm({
48108
48467
  init_builders();
48109
48468
  init_mesh_events();
48110
48469
  init_mesh_host_ownership();
48470
+ init_mesh_fast_forward();
48111
48471
  init_refine_config();
48112
48472
  init_snapshot();
48113
48473
  init_snapshot();
@@ -49824,6 +50184,32 @@ var init_router = __esm({
49824
50184
  cleanupWillRun: false
49825
50185
  };
49826
50186
  }
50187
+ case "fast_forward_mesh_node": {
50188
+ const meshId = typeof args?.meshId === "string" ? args.meshId.trim() : "";
50189
+ const nodeId = typeof args?.nodeId === "string" ? args.nodeId.trim() : "";
50190
+ let workspace = typeof args?.workspace === "string" ? args.workspace.trim() : "";
50191
+ let submoduleIgnorePaths = Array.isArray(args?.submoduleIgnorePaths) ? args.submoduleIgnorePaths.filter((value) => typeof value === "string") : void 0;
50192
+ if (!workspace && meshId && nodeId) {
50193
+ const meshRecord = await this.getMeshForCommand(meshId, args?.inlineMesh);
50194
+ const mesh = meshRecord?.mesh;
50195
+ const node = mesh?.nodes?.find((n) => n.id === nodeId || n.nodeId === nodeId);
50196
+ workspace = typeof node?.workspace === "string" ? node.workspace.trim() : "";
50197
+ if (!submoduleIgnorePaths && Array.isArray(node?.policy?.submoduleIgnorePaths)) {
50198
+ submoduleIgnorePaths = node.policy.submoduleIgnorePaths.filter((value) => typeof value === "string");
50199
+ }
50200
+ }
50201
+ const result = await fastForwardMeshNode({
50202
+ meshId: meshId || void 0,
50203
+ nodeId: nodeId || void 0,
50204
+ workspace,
50205
+ branch: typeof args?.branch === "string" ? args.branch : void 0,
50206
+ execute: args?.execute === true,
50207
+ dryRun: args?.dryRun === true,
50208
+ updateSubmodules: args?.updateSubmodules === true,
50209
+ submoduleIgnorePaths
50210
+ });
50211
+ return result;
50212
+ }
49827
50213
  case "refine_mesh_node": {
49828
50214
  const meshId = typeof args?.meshId === "string" ? args.meshId.trim() : "";
49829
50215
  const nodeId = typeof args?.nodeId === "string" ? args.nodeId.trim() : "";
@@ -50334,20 +50720,20 @@ var init_router = __esm({
50334
50720
  const geminiMdPath = `${workspace}/GEMINI.md`;
50335
50721
  const marker = "<!-- adhdev-mesh-coordinator-prompt -->";
50336
50722
  const markerEnd = "<!-- /adhdev-mesh-coordinator-prompt -->";
50337
- const block = `${marker}
50723
+ const block2 = `${marker}
50338
50724
  ${cliCmdSystemPrompt}
50339
50725
  ${markerEnd}`;
50340
50726
  if (efs(geminiMdPath)) {
50341
50727
  const existing = rfs(geminiMdPath, "utf-8");
50342
50728
  const replaced = existing.replace(
50343
50729
  new RegExp(`${marker}[\\s\\S]*?${markerEnd}`, "g"),
50344
- block
50730
+ block2
50345
50731
  );
50346
50732
  wfs(geminiMdPath, replaced.includes(marker) ? replaced : `${existing}
50347
50733
 
50348
- ${block}`);
50734
+ ${block2}`);
50349
50735
  } else {
50350
- wfs(geminiMdPath, block);
50736
+ wfs(geminiMdPath, block2);
50351
50737
  }
50352
50738
  LOG.info("MeshCoordinator", `Wrote coordinator prompt to ${workspace}/GEMINI.md`);
50353
50739
  } catch (e) {
@@ -59161,6 +59547,7 @@ __export(src_exports, {
59161
59547
  enqueueTask: () => enqueueTask,
59162
59548
  ensureSessionHostReady: () => ensureSessionHostReady,
59163
59549
  execNpmCommandSync: () => execNpmCommandSync,
59550
+ fastForwardMeshNode: () => fastForwardMeshNode,
59164
59551
  filterActivityChatMessages: () => filterActivityChatMessages,
59165
59552
  filterChatMessagesByVisibility: () => filterChatMessagesByVisibility,
59166
59553
  filterInternalChatMessages: () => filterInternalChatMessages,
@@ -59310,6 +59697,7 @@ var init_src = __esm({
59310
59697
  init_refine_config();
59311
59698
  init_mesh_sync();
59312
59699
  init_mesh_ledger();
59700
+ init_mesh_fast_forward();
59313
59701
  init_mesh_ledger_reconciliation();
59314
59702
  init_mesh_work_queue();
59315
59703
  init_mesh_host_ownership();
@@ -98395,7 +98783,7 @@ var require_utility = __commonJS({
98395
98783
  function simd(simd2) {
98396
98784
  return sharp.simd(is.bool(simd2) ? simd2 : null);
98397
98785
  }
98398
- function block(options) {
98786
+ function block2(options) {
98399
98787
  if (is.object(options)) {
98400
98788
  if (Array.isArray(options.operation) && options.operation.every(is.string)) {
98401
98789
  sharp.block(options.operation, true);
@@ -98426,7 +98814,7 @@ var require_utility = __commonJS({
98426
98814
  Sharp.interpolators = interpolators;
98427
98815
  Sharp.versions = versions;
98428
98816
  Sharp.queue = queue;
98429
- Sharp.block = block;
98817
+ Sharp.block = block2;
98430
98818
  Sharp.unblock = unblock;
98431
98819
  };
98432
98820
  }
@@ -99220,6 +99608,17 @@ function summarizeMeshCommandArgs(command, args) {
99220
99608
  includeSubmodules: args.includeSubmodules === true
99221
99609
  };
99222
99610
  }
99611
+ if (command === "fast_forward_mesh_node") {
99612
+ return {
99613
+ meshId: typeof args.meshId === "string" ? args.meshId : null,
99614
+ nodeId: typeof args.nodeId === "string" ? args.nodeId : null,
99615
+ workspace: typeof args.workspace === "string" ? args.workspace : null,
99616
+ branch: typeof args.branch === "string" ? args.branch : null,
99617
+ execute: args.execute === true,
99618
+ dryRun: args.dryRun === true,
99619
+ updateSubmodules: args.updateSubmodules === true
99620
+ };
99621
+ }
99223
99622
  if (command === "mesh_status" || command === "get_mesh") {
99224
99623
  const inlineMesh = asRecord(args.inlineMesh);
99225
99624
  const inlineNodes = Array.isArray(inlineMesh.nodes) ? inlineMesh.nodes : [];
@@ -100115,7 +100514,7 @@ var init_adhdev_daemon = __esm({
100115
100514
  init_version();
100116
100515
  init_src();
100117
100516
  init_runtime_defaults();
100118
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.82-rc.53" });
100517
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.82-rc.55" });
100119
100518
  AdhdevDaemon = class _AdhdevDaemon {
100120
100519
  localHttpServer = null;
100121
100520
  localWss = null;