@adhdev/daemon-standalone 0.9.82-rc.64 → 0.9.82-rc.66

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
@@ -47374,6 +47374,7 @@ ${(0, import_node_path.resolve)(workspace || os17.tmpdir())}`;
47374
47374
  meshId: readStringValue(status?.meshId, status?.mesh_id) ?? null,
47375
47375
  refreshedAt: readStringValue(status?.refreshedAt, status?.refreshed_at) ?? null,
47376
47376
  sourceOfTruth: status?.sourceOfTruth ?? null,
47377
+ branchConvergenceSummary: status?.branchConvergenceSummary ?? status?.branch_convergence_summary ?? null,
47377
47378
  nodeCount: nodes.length,
47378
47379
  nodes: nodes.map((node) => ({
47379
47380
  nodeId: readStringValue(node?.nodeId, node?.id) ?? null,
@@ -47389,7 +47390,8 @@ ${(0, import_node_path.resolve)(workspace || os17.tmpdir())}`;
47389
47390
  } : null,
47390
47391
  gitProbePending: node?.gitProbePending === true,
47391
47392
  launchReady: node?.launchReady === true,
47392
- git: summarizeRepoMeshDebugGit(node?.git)
47393
+ git: summarizeRepoMeshDebugGit(node?.git),
47394
+ branchConvergence: node?.branchConvergence ?? node?.branch_convergence ?? null
47393
47395
  }))
47394
47396
  };
47395
47397
  }
@@ -47891,7 +47893,7 @@ ${(0, import_node_path.resolve)(workspace || os17.tmpdir())}`;
47891
47893
  async function probeRemoteMeshGitStatus(args) {
47892
47894
  if (!args.dispatchMeshCommand) return null;
47893
47895
  const remoteResult = await Promise.race([
47894
- args.dispatchMeshCommand(args.daemonId, "git_status", { workspace: args.workspace }),
47896
+ args.dispatchMeshCommand(args.daemonId, "git_status", { workspace: args.workspace, refreshUpstream: true }),
47895
47897
  new Promise((_, reject) => setTimeout(() => reject(new Error("timeout")), args.timeoutMs))
47896
47898
  ]);
47897
47899
  const remoteGit = remoteResult?.status ?? remoteResult?.git ?? remoteResult;
@@ -48164,6 +48166,81 @@ ${(0, import_node_path.resolve)(workspace || os17.tmpdir())}`;
48164
48166
  };
48165
48167
  }
48166
48168
  }
48169
+ async function runMeshRefineSubmoduleReachabilityGate(repoRoot, mergedTree) {
48170
+ const startedAt = Date.now();
48171
+ const entries = [];
48172
+ try {
48173
+ const { execFile: execFile3 } = await import("child_process");
48174
+ const { promisify: promisify3 } = await import("util");
48175
+ const execFileAsync3 = promisify3(execFile3);
48176
+ const runGit2 = async (cwd, args) => {
48177
+ const { stdout } = await execFileAsync3("git", args, {
48178
+ cwd,
48179
+ encoding: "utf8",
48180
+ timeout: 3e4,
48181
+ maxBuffer: REFINE_PATCH_EQUIVALENCE_OUTPUT_LIMIT_BYTES,
48182
+ windowsHide: true
48183
+ });
48184
+ return String(stdout || "");
48185
+ };
48186
+ const treeOutput = await runGit2(repoRoot, ["ls-tree", "-r", "-z", mergedTree]);
48187
+ const gitlinks = treeOutput.split("\0").filter(Boolean).map((record2) => {
48188
+ const match = /^160000\s+commit\s+([0-9a-f]{40})\t(.+)$/.exec(record2);
48189
+ return match ? { commit: match[1], path: match[2] } : null;
48190
+ }).filter((entry) => !!entry);
48191
+ for (const gitlink of gitlinks) {
48192
+ const submodulePath = (0, import_path8.resolve)(repoRoot, gitlink.path);
48193
+ const entry = {
48194
+ path: gitlink.path,
48195
+ commit: gitlink.commit,
48196
+ reachable: false
48197
+ };
48198
+ try {
48199
+ if (!fs10.existsSync(submodulePath)) {
48200
+ entry.error = `Submodule checkout missing at ${gitlink.path}`;
48201
+ entries.push(entry);
48202
+ continue;
48203
+ }
48204
+ entry.checkedLocal = true;
48205
+ try {
48206
+ await runGit2(submodulePath, ["cat-file", "-e", `${gitlink.commit}^{commit}`]);
48207
+ entry.reachable = true;
48208
+ entries.push(entry);
48209
+ continue;
48210
+ } catch {
48211
+ }
48212
+ try {
48213
+ await runGit2(submodulePath, ["fetch", "origin", gitlink.commit]);
48214
+ entry.fetchedFromOrigin = true;
48215
+ await runGit2(submodulePath, ["cat-file", "-e", `${gitlink.commit}^{commit}`]);
48216
+ entry.reachable = true;
48217
+ } catch (e) {
48218
+ entry.error = truncateValidationOutput(e?.stderr || e?.message || String(e));
48219
+ }
48220
+ } catch (e) {
48221
+ entry.error = truncateValidationOutput(e?.message || String(e));
48222
+ }
48223
+ entries.push(entry);
48224
+ }
48225
+ const unreachable = entries.filter((entry) => !entry.reachable);
48226
+ return {
48227
+ status: unreachable.length ? "failed" : "passed",
48228
+ checked: entries.length,
48229
+ unreachable,
48230
+ entries,
48231
+ durationMs: Date.now() - startedAt
48232
+ };
48233
+ } catch (e) {
48234
+ return {
48235
+ status: "failed",
48236
+ checked: entries.length,
48237
+ unreachable: entries.filter((entry) => !entry.reachable),
48238
+ entries,
48239
+ durationMs: Date.now() - startedAt,
48240
+ error: truncateValidationOutput(e?.message || String(e))
48241
+ };
48242
+ }
48243
+ }
48167
48244
  function buildMeshRefineValidationPlan(mesh, workspace) {
48168
48245
  const plan = resolveMeshRefineValidationPlan(mesh, workspace);
48169
48246
  return {
@@ -49272,6 +49349,37 @@ ${(0, import_node_path.resolve)(workspace || os17.tmpdir())}`;
49272
49349
  }
49273
49350
  };
49274
49351
  }
49352
+ const submoduleReachabilityStarted = Date.now();
49353
+ const submoduleReachability = await runMeshRefineSubmoduleReachabilityGate(repoRoot, patchEquivalence.mergedTree || branchHead);
49354
+ recordMeshRefineStage(refineStages, "submodule_reachability", submoduleReachability.status, submoduleReachabilityStarted, {
49355
+ checked: submoduleReachability.checked,
49356
+ unreachable: submoduleReachability.unreachable.map((entry) => ({ path: entry.path, commit: entry.commit, error: entry.error })),
49357
+ error: submoduleReachability.error
49358
+ });
49359
+ if (submoduleReachability.status === "failed") {
49360
+ return {
49361
+ success: false,
49362
+ code: "submodule_reachability_failed",
49363
+ convergenceStatus: "blocked_review",
49364
+ error: "Refinery submodule reachability preflight failed; merge/refine cleanup was not attempted.",
49365
+ branch,
49366
+ into: baseBranch,
49367
+ validationSummary,
49368
+ patchEquivalence,
49369
+ submoduleReachability,
49370
+ refineStages,
49371
+ finalBranchConvergenceState: {
49372
+ branch,
49373
+ baseBranch,
49374
+ merged: false,
49375
+ removed: false,
49376
+ validation: "passed",
49377
+ patchEquivalence: "passed",
49378
+ submoduleReachability: "failed",
49379
+ status: "blocked_review"
49380
+ }
49381
+ };
49382
+ }
49275
49383
  let mergeResult;
49276
49384
  const mergeStarted = Date.now();
49277
49385
  try {