@adhdev/daemon-standalone 0.9.82-rc.82 → 0.9.82-rc.84

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
@@ -22146,6 +22146,7 @@ var require_dist2 = __commonJS({
22146
22146
  requirePreTaskCheckpoint: false,
22147
22147
  requirePostTaskCheckpoint: true,
22148
22148
  requireApprovalForPush: true,
22149
+ allowAutoPublishSubmoduleMainCommits: false,
22149
22150
  requireApprovalForDestructiveGit: true,
22150
22151
  dirtyWorkspaceBehavior: "warn",
22151
22152
  maxParallelTasks: 2,
@@ -22908,6 +22909,7 @@ ${error48.message || ""}`;
22908
22909
  }
22909
22910
  const maxParallelTasks = Number(policy.maxParallelTasks);
22910
22911
  policy.maxParallelTasks = Number.isFinite(maxParallelTasks) ? Math.max(1, Math.min(8, Math.floor(maxParallelTasks))) : 2;
22912
+ policy.allowAutoPublishSubmoduleMainCommits = policy.allowAutoPublishSubmoduleMainCommits === true;
22911
22913
  if (!SESSION_CLEANUP_MODES.has(String(policy.sessionCleanupOnNodeRemove))) {
22912
22914
  policy.sessionCleanupOnNodeRemove = "preserve";
22913
22915
  }
@@ -23299,6 +23301,9 @@ ${userInstruction}`);
23299
23301
  if (policy.requirePreTaskCheckpoint) rules.push("- Create a git checkpoint **before** starting each task");
23300
23302
  if (policy.requirePostTaskCheckpoint) rules.push("- Create a git checkpoint **after** each task completes");
23301
23303
  if (policy.requireApprovalForPush) rules.push("- **Ask for user approval** before pushing to remote");
23304
+ if (policy.allowAutoPublishSubmoduleMainCommits) {
23305
+ rules.push("- Refinery may auto-publish unreachable submodule gitlink commits to submodule origin/main with non-force pushes after validation and patch-equivalence pass");
23306
+ }
23302
23307
  if (policy.requireApprovalForDestructiveGit) rules.push("- **Ask for user approval** before destructive git operations (force push, reset, etc.)");
23303
23308
  const dirtyBehavior = {
23304
23309
  block: "- **Do not** send tasks to nodes with dirty workspaces",
@@ -23330,7 +23335,7 @@ ${rules.join("\n")}`;
23330
23335
  - **Clean up worktree nodes.** After a worktree task completes and its changes are merged or checkpointed, call \`mesh_remove_node\` to free resources.
23331
23336
  - **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.
23332
23337
  - **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.
23333
- - **Treat submodule main reachability as publish-needed.** A \`submodule_reachability_failed\` refine result means the root gitlink points at a submodule commit that is not reachable from the configured submodule remote main branch. Do not treat feature-branch reachability as complete, retry validation blindly, or start code review first. Classify it as \`blocked_review\`, request user approval to push/publish the submodule commit to submodule main, then rerun \`mesh_refine_node\`.
23338
+ - **Treat submodule main reachability as publish-needed.** A \`submodule_reachability_failed\` refine result means the root gitlink points at a submodule commit that is not reachable from the configured submodule remote main branch. Do not treat feature-branch reachability as complete, retry validation blindly, or start code review first. Classify it as \`blocked_review\`, request user approval to push/publish the submodule commit to submodule main, then rerun \`mesh_refine_node\`, unless the mesh or repo refine config explicitly enabled \`allowAutoPublishSubmoduleMainCommits\` and Refinery reports exact path/commit/remote/branch evidence with post-publish verification.
23334
23339
  - **Name worktree branches meaningfully.** Use descriptive names like \`feat/auth-refactor\` or \`fix/build-123\`.${coordinatorNote}`;
23335
23340
  }
23336
23341
  var TOOLS_SECTION;
@@ -23379,7 +23384,7 @@ Before doing any coordinator work, confirm that the actual callable tool list in
23379
23384
  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\`.
23380
23385
  5. **Verify** \u2014 When a task reports completion or git work is visible, call \`mesh_git_status\` to verify changes were made.
23381
23386
  6. **Checkpoint** \u2014 Call \`mesh_checkpoint\` to save the work.
23382
- 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. Before/refine merging root commits that contain submodule gitlink changes, require each submodule commit to be reachable from the configured submodule remote main branch, not merely present on a feature ref or local checkout. If \`mesh_refine_node\` returns \`submodule_reachability_failed\` or publish-required evidence, keep the public convergence bucket as \`blocked_review\`, ask the user for explicit approval to push/publish the unreachable submodule commit(s) to submodule main, then rerun \`mesh_refine_node\`; do not merge the root branch until the submodule commit(s) are reachable from submodule origin/main. 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.
23387
+ 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. Before/refine merging root commits that contain submodule gitlink changes, require each submodule commit to be reachable from the configured submodule remote main branch, not merely present on a feature ref or local checkout. If \`mesh_refine_node\` returns \`submodule_reachability_failed\` or publish-required evidence, keep the public convergence bucket as \`blocked_review\`; unless \`allowAutoPublishSubmoduleMainCommits\` is explicitly enabled and Refinery reports successful non-force publish plus post-publish verification, ask the user for explicit approval to push/publish the unreachable submodule commit(s) to submodule main, then rerun \`mesh_refine_node\`. Do not merge the root branch until the submodule commit(s) are reachable from submodule origin/main. 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.
23383
23388
  8. **Clean up** \u2014 Remove worktree nodes via \`mesh_remove_node\` after their work is merged or no longer needed.
23384
23389
  9. **Report** \u2014 Summarize what was done, what changed, any issues, and the branch convergence state.
23385
23390
 
@@ -25356,7 +25361,8 @@ Next step: ${nextStep}`;
25356
25361
  const providerSessionId = readNonEmptyString2(args.metadataEvent.providerSessionId) || void 0;
25357
25362
  const finalSummary = readNonEmptyString2(args.metadataEvent.finalSummary) || void 0;
25358
25363
  const workerResult = readWorkerResultMetadata(args.metadataEvent);
25359
- const completedTask = sessionId ? updateSessionTaskStatus(args.meshId, sessionId, "completed") : null;
25364
+ const hasCompletionEvidence = !!finalSummary || !!workerResult;
25365
+ const completedTask = sessionId && hasCompletionEvidence ? updateSessionTaskStatus(args.meshId, sessionId, "completed") : null;
25360
25366
  if (completedTask) {
25361
25367
  completedTaskForLedger = { id: completedTask.id };
25362
25368
  try {
@@ -30802,6 +30808,11 @@ ${lastSnapshot}`;
30802
30808
  required: ["version"],
30803
30809
  properties: {
30804
30810
  version: { const: 1 },
30811
+ allowAutoPublishSubmoduleMainCommits: {
30812
+ type: "boolean",
30813
+ default: false,
30814
+ description: "When true, Refinery may non-force publish submodule gitlink commits referenced by the refined root tree to each submodule origin/main after validation and patch-equivalence pass, then verify reachability."
30815
+ },
30805
30816
  validation: {
30806
30817
  type: "object",
30807
30818
  additionalProperties: false,
@@ -30894,6 +30905,9 @@ ${lastSnapshot}`;
30894
30905
  const rejectedCommands = [];
30895
30906
  if (!isRecord(config2)) return { valid: false, errors: ["config must be an object"], commands, rejectedCommands };
30896
30907
  if (config2.version !== 1) errors.push("version must be 1");
30908
+ if (config2.allowAutoPublishSubmoduleMainCommits !== void 0 && typeof config2.allowAutoPublishSubmoduleMainCommits !== "boolean") {
30909
+ errors.push("allowAutoPublishSubmoduleMainCommits must be a boolean when provided");
30910
+ }
30897
30911
  const validation = config2.validation;
30898
30912
  if (validation !== void 0 && !isRecord(validation)) errors.push("validation must be an object");
30899
30913
  const rawCommands = isRecord(validation) ? validation.commands : void 0;
@@ -38240,6 +38254,15 @@ ${effect.notification.body || ""}`.trim();
38240
38254
  function isGeneratingLikeStatus(status) {
38241
38255
  return status === "generating" || status === "streaming" || status === "long_generating" || status === "starting";
38242
38256
  }
38257
+ function hasVisibleAssistantMessage(messages) {
38258
+ if (!Array.isArray(messages)) return false;
38259
+ return messages.some((message) => {
38260
+ if (!message || message.role !== "assistant") return false;
38261
+ const kind = typeof message.kind === "string" ? message.kind : "standard";
38262
+ if (kind !== "standard") return false;
38263
+ return String(message.content || "").trim().length > 0;
38264
+ });
38265
+ }
38243
38266
  function shouldTrustCliAdapterTerminalStatus(parsedStatus, activeModal, adapter, adapterStatus) {
38244
38267
  if (!isGeneratingLikeStatus(parsedStatus)) return false;
38245
38268
  if (hasNonEmptyModalButtons(activeModal)) return false;
@@ -38253,6 +38276,9 @@ ${effect.notification.body || ""}`.trim();
38253
38276
  if (adapterRawStatus === "starting" && isGeneratingLikeStatus(parsedStatus) && !hasNonEmptyModalButtons(activeModal) && Array.isArray(parsedMessages) && parsedMessages.length === 0 && Array.isArray(adapterStatus?.messages) && adapterStatus.messages.length === 0 && !(typeof adapter.isProcessing === "function" && adapter.isProcessing())) {
38254
38277
  return "starting";
38255
38278
  }
38279
+ if (isGeneratingLikeStatus(adapterRawStatus) && parsedStatus === "idle" && !hasNonEmptyModalButtons(activeModal) && !hasVisibleAssistantMessage(parsedMessages)) {
38280
+ return adapterRawStatus;
38281
+ }
38256
38282
  if (shouldTrustCliAdapterTerminalStatus(parsedStatus, activeModal, adapter, adapterStatus)) return "idle";
38257
38283
  return typeof parsedStatus === "string" && parsedStatus.trim() ? parsedStatus : "idle";
38258
38284
  }
@@ -38761,7 +38787,7 @@ ${effect.notification.body || ""}`.trim();
38761
38787
  returnedMessages,
38762
38788
  ptyStatusApprovalOnly: false
38763
38789
  });
38764
- if (supportsCliNativeTranscript(providerType)) {
38790
+ if (supportsCliNativeTranscript(providerType) && provider?.canonicalHistory?.mode === "native-source") {
38765
38791
  const agentStr = provider?.type || args?.agentType || getCurrentProviderType(h, adapter.cliType);
38766
38792
  const workspace = typeof args?.workspace === "string" ? args.workspace : typeof h.currentSession?.workspace === "string" ? h.currentSession.workspace : typeof adapter.workingDir === "string" ? adapter.workingDir : void 0;
38767
38793
  const nativeHistoryLimit = Math.max(
@@ -38920,6 +38946,17 @@ ${effect.notification.body || ""}`.trim();
38920
38946
  freshEnough: true,
38921
38947
  ptyStatusApprovalOnly: false
38922
38948
  });
38949
+ const requiresNativeSource = supportsCliNativeTranscript(agentStr) && provider?.canonicalHistory?.mode === "native-source";
38950
+ if (requiresNativeSource && !nativeSelected) {
38951
+ return {
38952
+ success: false,
38953
+ code: "native_history_not_safely_available",
38954
+ error: "Provider-native history was not safely available for the requested CLI session.",
38955
+ providerSessionId: historyProviderSessionId,
38956
+ messageSource,
38957
+ transcriptProvenance: messageSource
38958
+ };
38959
+ }
38923
38960
  return buildReadChatCommandResult({
38924
38961
  messages: historyMessages,
38925
38962
  status: "idle",
@@ -43788,6 +43825,14 @@ ${rawInput}` : rawInput;
43788
43825
  function countMessages(value) {
43789
43826
  return Array.isArray(value) ? value.length : 0;
43790
43827
  }
43828
+ function hasFinalAssistantMessage(value) {
43829
+ const messages = Array.isArray(value) ? value : [];
43830
+ const last = messages[messages.length - 1];
43831
+ if (!last || last.role !== "assistant") return false;
43832
+ if (last.bubbleState === "streaming") return false;
43833
+ if (last.meta?.streaming === true) return false;
43834
+ return typeof last.content === "string" && last.content.trim().length > 0;
43835
+ }
43791
43836
  function hasZeroMessageStartingLaunch(adapter) {
43792
43837
  const adapterStatus = adapter?.getStatus?.({ allowParse: false }) ?? adapter?.getStatus?.() ?? {};
43793
43838
  const parsedStatus = typeof adapter?.getScriptParsedStatus === "function" ? adapter.getScriptParsedStatus() : {};
@@ -43799,6 +43844,17 @@ ${rawInput}` : rawInput;
43799
43844
  if (countMessages(adapterStatus?.messages) > 0 || countMessages(parsedStatus?.messages) > 0) return false;
43800
43845
  return !hasAdapterPendingResponse(adapter);
43801
43846
  }
43847
+ function hasCompletedStartingLaunch(adapter) {
43848
+ const adapterStatus = adapter?.getStatus?.({ allowParse: false }) ?? adapter?.getStatus?.() ?? {};
43849
+ const adapterRawStatus = normalizeAgentStatus(adapterStatus?.status);
43850
+ if (adapterRawStatus !== "starting") return false;
43851
+ if (hasAdapterPendingResponse(adapter)) return false;
43852
+ const parsedStatus = typeof adapter?.getScriptParsedStatus === "function" ? adapter.getScriptParsedStatus() : {};
43853
+ const parsedRawStatus = normalizeAgentStatus(parsedStatus?.status);
43854
+ if (parsedRawStatus !== "idle") return false;
43855
+ if (hasNonEmptyModalButtons2(adapterStatus?.activeModal ?? adapterStatus?.modal ?? parsedStatus?.activeModal ?? parsedStatus?.modal)) return false;
43856
+ return hasFinalAssistantMessage(parsedStatus?.messages);
43857
+ }
43802
43858
  function shouldSuppressStaleParsedBusyStatus(adapterStatus, parsedStatus, adapter) {
43803
43859
  const parsedRawStatus = normalizeAgentStatus(parsedStatus?.status);
43804
43860
  if (!BUSY_AGENT_STATUSES.has(parsedRawStatus)) return false;
@@ -43808,6 +43864,7 @@ ${rawInput}` : rawInput;
43808
43864
  }
43809
43865
  function getEffectiveAgentSendStatus(adapter) {
43810
43866
  const adapterStatus = normalizeAgentStatus(adapter?.getStatus?.({ allowParse: false })?.status ?? adapter?.getStatus?.()?.status);
43867
+ if (adapterStatus === "starting" && hasCompletedStartingLaunch(adapter)) return "idle";
43811
43868
  if (adapterStatus && adapterStatus !== "idle") return adapterStatus;
43812
43869
  if (adapterStatus !== "idle") return adapterStatus;
43813
43870
  if (typeof adapter?.getScriptParsedStatus !== "function") return adapterStatus;
@@ -48758,6 +48815,16 @@ ${(0, import_node_path.resolve)(workspace || os17.tmpdir())}`;
48758
48815
  const refs = entries.map((entry) => `${entry.path}@${entry.commit}`).join(", ");
48759
48816
  return `Ask the user for explicit approval to push/publish the unreachable submodule commit(s) (${refs}) to the configured submodule remote main branch, then rerun mesh_refine_node. Do not merge the root branch until every submodule gitlink commit is reachable from submodule origin/main.`;
48760
48817
  }
48818
+ function resolveRefineryAutoPublishSubmoduleMainCommits(mesh, workspace) {
48819
+ if (mesh?.policy?.allowAutoPublishSubmoduleMainCommits === true) {
48820
+ return { enabled: true, source: "mesh.policy.allowAutoPublishSubmoduleMainCommits" };
48821
+ }
48822
+ const loaded = loadMeshRefineConfig(mesh, workspace);
48823
+ if (loaded.config?.allowAutoPublishSubmoduleMainCommits === true) {
48824
+ return { enabled: true, source: loaded.path || loaded.source };
48825
+ }
48826
+ return { enabled: false };
48827
+ }
48761
48828
  async function computeGitPatchId(cwd, fromRef, toRef) {
48762
48829
  const { execFileSync: execFileSync3 } = await import("child_process");
48763
48830
  const diff = execFileSync3("git", ["diff", "--patch", "--full-index", fromRef, toRef], {
@@ -48826,7 +48893,7 @@ ${(0, import_node_path.resolve)(workspace || os17.tmpdir())}`;
48826
48893
  };
48827
48894
  }
48828
48895
  }
48829
- async function runMeshRefineSubmoduleReachabilityGate(repoRoot, mergedTree) {
48896
+ async function runMeshRefineSubmoduleReachabilityGate(repoRoot, mergedTree, options = {}) {
48830
48897
  const startedAt = Date.now();
48831
48898
  const entries = [];
48832
48899
  try {
@@ -48847,6 +48914,17 @@ ${(0, import_node_path.resolve)(workspace || os17.tmpdir())}`;
48847
48914
  await runGit2(submodulePath, ["-c", "protocol.file.allow=always", "fetch", "origin", `refs/heads/${branch}:refs/remotes/origin/${branch}`]);
48848
48915
  await runGit2(submodulePath, ["merge-base", "--is-ancestor", commit, `refs/remotes/origin/${branch}`]);
48849
48916
  };
48917
+ const publishCommitToRemoteMain = async (submodulePath, commit, branch = "main") => {
48918
+ const refspec = `${commit}:refs/heads/${branch}`;
48919
+ const { stdout, stderr } = await execFileAsync3("git", ["push", "origin", refspec], {
48920
+ cwd: submodulePath,
48921
+ encoding: "utf8",
48922
+ timeout: 3e4,
48923
+ maxBuffer: REFINE_PATCH_EQUIVALENCE_OUTPUT_LIMIT_BYTES,
48924
+ windowsHide: true
48925
+ });
48926
+ return { stdout: String(stdout || ""), stderr: String(stderr || ""), refspec };
48927
+ };
48850
48928
  const treeOutput = await runGit2(repoRoot, ["ls-tree", "-r", "-z", mergedTree]);
48851
48929
  const gitlinks = treeOutput.split("\0").filter(Boolean).map((record2) => {
48852
48930
  const match = /^160000\s+commit\s+([0-9a-f]{40})\t(.+)$/.exec(record2);
@@ -48887,11 +48965,43 @@ ${(0, import_node_path.resolve)(workspace || os17.tmpdir())}`;
48887
48965
  continue;
48888
48966
  }
48889
48967
  entry.remoteMainBranch = "main";
48890
- await verifyRemoteMainContainsCommit(submodulePath, gitlink.commit, "main");
48891
- entry.fetchedFromOrigin = true;
48892
- entry.remoteReachable = true;
48893
- entry.remoteMainReachable = true;
48894
- entry.reachable = true;
48968
+ try {
48969
+ await verifyRemoteMainContainsCommit(submodulePath, gitlink.commit, "main");
48970
+ entry.fetchedFromOrigin = true;
48971
+ entry.remoteReachable = true;
48972
+ entry.remoteMainReachable = true;
48973
+ entry.reachable = true;
48974
+ } catch (e) {
48975
+ entry.remoteReachable = false;
48976
+ entry.remoteMainReachable = false;
48977
+ entry.publishRequired = true;
48978
+ const details = truncateValidationOutput(e?.stderr || e?.message || String(e));
48979
+ entry.error = `Submodule remote main reachability check failed for origin/main: ${details}`;
48980
+ if (options.allowAutoPublishSubmoduleMainCommits === true && entry.localReachable === true) {
48981
+ entry.autoPublishAllowed = true;
48982
+ entry.autoPublishAttempted = true;
48983
+ try {
48984
+ const publish = await publishCommitToRemoteMain(submodulePath, gitlink.commit, "main");
48985
+ entry.autoPublishRefspec = publish.refspec;
48986
+ entry.publishStdout = truncateValidationOutput(publish.stdout);
48987
+ entry.publishStderr = truncateValidationOutput(publish.stderr);
48988
+ entry.autoPublishSucceeded = true;
48989
+ await verifyRemoteMainContainsCommit(submodulePath, gitlink.commit, "main");
48990
+ entry.fetchedFromOrigin = true;
48991
+ entry.remoteReachable = true;
48992
+ entry.remoteMainReachable = true;
48993
+ entry.autoPublishVerified = true;
48994
+ entry.publishRequired = false;
48995
+ entry.reachable = true;
48996
+ entry.error = void 0;
48997
+ } catch (publishError) {
48998
+ entry.autoPublishSucceeded = false;
48999
+ entry.autoPublishVerified = false;
49000
+ const publishDetails = truncateValidationOutput(publishError?.stderr || publishError?.message || String(publishError));
49001
+ entry.error = `Submodule auto-publish to origin/main failed or could not be verified: ${publishDetails}`;
49002
+ }
49003
+ }
49004
+ }
48895
49005
  } catch (e) {
48896
49006
  entry.remoteReachable = false;
48897
49007
  entry.remoteMainReachable = false;
@@ -48911,7 +49021,9 @@ ${(0, import_node_path.resolve)(workspace || os17.tmpdir())}`;
48911
49021
  checked: entries.length,
48912
49022
  unreachable: unreachable.map((entry) => ({ ...entry, publishRequired: entry.publishRequired !== false })),
48913
49023
  entries: entries.map((entry) => entry.reachable ? entry : { ...entry, publishRequired: entry.publishRequired !== false }),
48914
- durationMs: Date.now() - startedAt
49024
+ durationMs: Date.now() - startedAt,
49025
+ autoPublishAllowed: options.allowAutoPublishSubmoduleMainCommits === true,
49026
+ autoPublishPolicySource: options.autoPublishPolicySource
48915
49027
  };
48916
49028
  } catch (e) {
48917
49029
  const unreachable = entries.filter((entry) => !entry.reachable).map((entry) => ({ ...entry, publishRequired: true }));
@@ -48921,6 +49033,8 @@ ${(0, import_node_path.resolve)(workspace || os17.tmpdir())}`;
48921
49033
  unreachable,
48922
49034
  entries: entries.map((entry) => entry.reachable ? entry : { ...entry, publishRequired: true }),
48923
49035
  durationMs: Date.now() - startedAt,
49036
+ autoPublishAllowed: options.allowAutoPublishSubmoduleMainCommits === true,
49037
+ autoPublishPolicySource: options.autoPublishPolicySource,
48924
49038
  error: truncateValidationOutput(e?.message || String(e))
48925
49039
  };
48926
49040
  }
@@ -50059,13 +50173,36 @@ ${(0, import_node_path.resolve)(workspace || os17.tmpdir())}`;
50059
50173
  };
50060
50174
  }
50061
50175
  const submoduleReachabilityStarted = Date.now();
50062
- const submoduleReachability = await runMeshRefineSubmoduleReachabilityGate(repoRoot, patchEquivalence.mergedTree || branchHead);
50176
+ const autoPublishSubmoduleMainCommits = resolveRefineryAutoPublishSubmoduleMainCommits(mesh, node.workspace);
50177
+ const submoduleReachability = await runMeshRefineSubmoduleReachabilityGate(repoRoot, patchEquivalence.mergedTree || branchHead, {
50178
+ allowAutoPublishSubmoduleMainCommits: autoPublishSubmoduleMainCommits.enabled,
50179
+ autoPublishPolicySource: autoPublishSubmoduleMainCommits.source
50180
+ });
50063
50181
  recordMeshRefineStage(refineStages, "submodule_reachability", submoduleReachability.status, submoduleReachabilityStarted, {
50064
50182
  checked: submoduleReachability.checked,
50183
+ autoPublishAllowed: submoduleReachability.autoPublishAllowed,
50184
+ autoPublishPolicySource: submoduleReachability.autoPublishPolicySource,
50185
+ autoPublished: submoduleReachability.entries.filter((entry) => entry.autoPublishAttempted).map((entry) => ({
50186
+ path: entry.path,
50187
+ commit: entry.commit,
50188
+ remote: entry.remote,
50189
+ remoteUrl: entry.remoteUrl,
50190
+ remoteMainBranch: entry.remoteMainBranch,
50191
+ refspec: entry.autoPublishRefspec,
50192
+ succeeded: entry.autoPublishSucceeded,
50193
+ verified: entry.autoPublishVerified,
50194
+ remoteMainReachable: entry.remoteMainReachable,
50195
+ error: entry.error
50196
+ })),
50065
50197
  unreachable: submoduleReachability.unreachable.map((entry) => ({
50066
50198
  path: entry.path,
50067
50199
  commit: entry.commit,
50068
50200
  publishRequired: entry.publishRequired === true,
50201
+ autoPublishAllowed: entry.autoPublishAllowed,
50202
+ autoPublishAttempted: entry.autoPublishAttempted,
50203
+ autoPublishSucceeded: entry.autoPublishSucceeded,
50204
+ autoPublishVerified: entry.autoPublishVerified,
50205
+ autoPublishRefspec: entry.autoPublishRefspec,
50069
50206
  remote: entry.remote,
50070
50207
  remoteUrl: entry.remoteUrl,
50071
50208
  remoteReachable: entry.remoteReachable,
@@ -50099,6 +50236,11 @@ ${(0, import_node_path.resolve)(workspace || os17.tmpdir())}`;
50099
50236
  remoteReachable: entry.remoteReachable,
50100
50237
  remoteMainBranch: entry.remoteMainBranch,
50101
50238
  remoteMainReachable: entry.remoteMainReachable,
50239
+ autoPublishAllowed: entry.autoPublishAllowed,
50240
+ autoPublishAttempted: entry.autoPublishAttempted,
50241
+ autoPublishSucceeded: entry.autoPublishSucceeded,
50242
+ autoPublishVerified: entry.autoPublishVerified,
50243
+ autoPublishRefspec: entry.autoPublishRefspec,
50102
50244
  error: entry.error
50103
50245
  })),
50104
50246
  branch,
@@ -50173,7 +50315,7 @@ ${(0, import_node_path.resolve)(workspace || os17.tmpdir())}`;
50173
50315
  appendLedgerEntry2(meshId, {
50174
50316
  kind: "node_removed",
50175
50317
  nodeId,
50176
- payload: { refined: true, mergedBranch: branch, into: baseBranch, validationSummary, patchEquivalence }
50318
+ payload: { refined: true, mergedBranch: branch, into: baseBranch, validationSummary, patchEquivalence, submoduleReachability }
50177
50319
  });
50178
50320
  recordMeshRefineStage(refineStages, "ledger", "passed", ledgerStarted);
50179
50321
  } catch (e) {
@@ -50201,6 +50343,7 @@ ${(0, import_node_path.resolve)(workspace || os17.tmpdir())}`;
50201
50343
  removeResult,
50202
50344
  validationSummary,
50203
50345
  patchEquivalence,
50346
+ submoduleReachability,
50204
50347
  mergeResult,
50205
50348
  refineStages,
50206
50349
  ...ledgerError ? { ledgerError } : {},
@@ -50215,6 +50358,7 @@ ${(0, import_node_path.resolve)(workspace || os17.tmpdir())}`;
50215
50358
  removeResult,
50216
50359
  validationSummary,
50217
50360
  patchEquivalence,
50361
+ submoduleReachability,
50218
50362
  mergeResult,
50219
50363
  refineStages,
50220
50364
  ...ledgerError ? { ledgerError } : {},