adhdev 0.9.82-rc.63 → 0.9.82-rc.65

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
@@ -47963,6 +47963,7 @@ function summarizeRepoMeshStatusDebug(status) {
47963
47963
  meshId: readStringValue(status?.meshId, status?.mesh_id) ?? null,
47964
47964
  refreshedAt: readStringValue(status?.refreshedAt, status?.refreshed_at) ?? null,
47965
47965
  sourceOfTruth: status?.sourceOfTruth ?? null,
47966
+ branchConvergenceSummary: status?.branchConvergenceSummary ?? status?.branch_convergence_summary ?? null,
47966
47967
  nodeCount: nodes.length,
47967
47968
  nodes: nodes.map((node) => ({
47968
47969
  nodeId: readStringValue(node?.nodeId, node?.id) ?? null,
@@ -47978,7 +47979,8 @@ function summarizeRepoMeshStatusDebug(status) {
47978
47979
  } : null,
47979
47980
  gitProbePending: node?.gitProbePending === true,
47980
47981
  launchReady: node?.launchReady === true,
47981
- git: summarizeRepoMeshDebugGit(node?.git)
47982
+ git: summarizeRepoMeshDebugGit(node?.git),
47983
+ branchConvergence: node?.branchConvergence ?? node?.branch_convergence ?? null
47982
47984
  }))
47983
47985
  };
47984
47986
  }
@@ -48033,6 +48035,9 @@ function normalizeInlineMeshGitStatus(status, node, options) {
48033
48035
  headCommit: readStringValue(status.headCommit) ?? null,
48034
48036
  headMessage: readStringValue(status.headMessage) ?? null,
48035
48037
  upstream: readStringValue(status.upstream) ?? null,
48038
+ upstreamStatus: readStringValue(status.upstreamStatus, status.upstream_status) ?? (readStringValue(status.upstream) ? "unchecked" : "no_upstream"),
48039
+ upstreamFetchedAt: readNumberValue(status.upstreamFetchedAt, status.upstream_fetched_at),
48040
+ upstreamFetchError: readStringValue(status.upstreamFetchError, status.upstream_fetch_error),
48036
48041
  ahead: readNumberValue(status.ahead) ?? 0,
48037
48042
  behind: readNumberValue(status.behind) ?? 0,
48038
48043
  staged: readNumberValue(status.staged) ?? 0,
@@ -48231,8 +48236,11 @@ function reconcileInlineMeshCache(cached2, incoming) {
48231
48236
  };
48232
48237
  }
48233
48238
  function hasGitWorktreeChanges(git) {
48234
- if (!git) return false;
48235
- return Number(git.staged || 0) + Number(git.modified || 0) + Number(git.untracked || 0) + Number(git.deleted || 0) + Number(git.renamed || 0) > 0;
48239
+ return countGitWorktreeChanges(git) > 0;
48240
+ }
48241
+ function countGitWorktreeChanges(git) {
48242
+ if (!git) return 0;
48243
+ return Number(git.staged || 0) + Number(git.modified || 0) + Number(git.untracked || 0) + Number(git.deleted || 0) + Number(git.renamed || 0);
48236
48244
  }
48237
48245
  function getGitSubmoduleDriftState(git) {
48238
48246
  const submodules = Array.isArray(git?.submodules) ? git.submodules : [];
@@ -48254,6 +48262,146 @@ function deriveMeshNodeHealthFromGit(git) {
48254
48262
  if (submoduleDrift.dirty || hasGitWorktreeChanges(git)) return "dirty";
48255
48263
  return "online";
48256
48264
  }
48265
+ function readMeshNodeLabel(status, node) {
48266
+ return readStringValue(status.nodeId, node?.id, node?.nodeId) ?? "unknown";
48267
+ }
48268
+ function buildInlineMeshBranchConvergence(args) {
48269
+ const git = readObjectRecord(args.status.git);
48270
+ const nodeLabel = readMeshNodeLabel(args.status, args.node);
48271
+ const defaultBranch = readStringValue(args.mesh?.defaultBranch) ?? "main";
48272
+ const branch = readStringValue(git.branch, args.node?.worktreeBranch) ?? null;
48273
+ const upstream = readStringValue(git.upstream) ?? null;
48274
+ const upstreamStatus = readStringValue(git.upstreamStatus, git.upstream_status) ?? (upstream ? "unchecked" : "no_upstream");
48275
+ const ahead = readNumberValue(git.ahead) ?? 0;
48276
+ const behind = readNumberValue(git.behind) ?? 0;
48277
+ const uncommittedChanges = countGitWorktreeChanges(git);
48278
+ const hasConflicts = readBooleanValue(git.hasConflicts) ?? (Array.isArray(git.conflictFiles) && git.conflictFiles.length > 0);
48279
+ const base = {
48280
+ defaultBranch,
48281
+ branch,
48282
+ upstream,
48283
+ upstreamStatus,
48284
+ ahead,
48285
+ behind,
48286
+ isWorktree: args.node?.isLocalWorktree === true || args.status.isLocalWorktree === true,
48287
+ isDefaultBranch: branch === defaultBranch
48288
+ };
48289
+ if (readBooleanValue(git.isGitRepo) !== true) {
48290
+ return {
48291
+ ...base,
48292
+ status: "blocked_review",
48293
+ needsConvergence: true,
48294
+ reason: "git_status_unavailable",
48295
+ nextStep: `Resolve git status for node '${nodeLabel}' before marking the task complete.`
48296
+ };
48297
+ }
48298
+ if (!branch) {
48299
+ return {
48300
+ ...base,
48301
+ status: "blocked_review",
48302
+ needsConvergence: true,
48303
+ reason: "branch_unknown",
48304
+ nextStep: `Inspect node '${nodeLabel}' git branch before deciding whether it is merged to ${defaultBranch}.`
48305
+ };
48306
+ }
48307
+ if (hasConflicts || uncommittedChanges > 0) {
48308
+ return {
48309
+ ...base,
48310
+ status: "not_mergeable",
48311
+ needsConvergence: true,
48312
+ reason: hasConflicts ? "conflicts_present" : "dirty_workspace",
48313
+ nextStep: `Commit, checkpoint, or resolve node '${nodeLabel}' before any main convergence step.`
48314
+ };
48315
+ }
48316
+ if (branch === defaultBranch) {
48317
+ if (upstream && upstreamStatus !== "fresh") {
48318
+ return {
48319
+ ...base,
48320
+ status: "blocked_review",
48321
+ needsConvergence: true,
48322
+ reason: "default_branch_upstream_unverified",
48323
+ nextStep: `Refresh ${defaultBranch}'s upstream refs or resolve the fetch failure before declaring convergence complete for node '${nodeLabel}'.`
48324
+ };
48325
+ }
48326
+ if (ahead > 0 || behind > 0) {
48327
+ return {
48328
+ ...base,
48329
+ status: "blocked_review",
48330
+ needsConvergence: true,
48331
+ reason: "default_branch_not_even_with_upstream",
48332
+ nextStep: `Bring ${defaultBranch} even with its upstream before declaring convergence complete.`
48333
+ };
48334
+ }
48335
+ return {
48336
+ ...base,
48337
+ status: "merged_to_main",
48338
+ needsConvergence: false,
48339
+ reason: "clean_default_branch",
48340
+ nextStep: null
48341
+ };
48342
+ }
48343
+ if (args.node?.isLocalWorktree === true || args.status.isLocalWorktree === true) {
48344
+ return {
48345
+ ...base,
48346
+ status: "cleanup_candidate",
48347
+ needsConvergence: true,
48348
+ reason: "clean_non_default_worktree_branch",
48349
+ nextStep: `Run mesh_refine_node(node_id: "${nodeLabel}") or explicitly classify this worktree as blocked_review/not_mergeable before ending the task.`
48350
+ };
48351
+ }
48352
+ if (upstream && upstreamStatus !== "fresh") {
48353
+ return {
48354
+ ...base,
48355
+ status: "blocked_review",
48356
+ needsConvergence: true,
48357
+ reason: "feature_branch_upstream_unverified",
48358
+ nextStep: `Refresh branch '${branch}' upstream refs or resolve the fetch failure before deciding whether it is ready to merge into ${defaultBranch}.`
48359
+ };
48360
+ }
48361
+ if (!upstream || ahead > 0 || behind > 0) {
48362
+ return {
48363
+ ...base,
48364
+ status: "blocked_review",
48365
+ needsConvergence: true,
48366
+ reason: !upstream ? "feature_branch_missing_upstream" : "feature_branch_not_even_with_upstream",
48367
+ nextStep: `Push or reconcile branch '${branch}', then merge it into ${defaultBranch} or mark it not_mergeable with a reason.`
48368
+ };
48369
+ }
48370
+ return {
48371
+ ...base,
48372
+ status: "pushed_feature_branch_needs_merge",
48373
+ needsConvergence: true,
48374
+ reason: "clean_non_default_branch",
48375
+ nextStep: `Review and merge branch '${branch}' into ${defaultBranch}; do not report the task as fully complete while it remains off main.`
48376
+ };
48377
+ }
48378
+ function applyInlineMeshBranchConvergence(mesh, node, status) {
48379
+ const git = readObjectRecord(status.git);
48380
+ if (Object.keys(git).length === 0 && !status.gitProbePending) return;
48381
+ const uncommittedChanges = countGitWorktreeChanges(git);
48382
+ status.isDirty = uncommittedChanges > 0;
48383
+ status.uncommittedChanges = uncommittedChanges;
48384
+ status.branchConvergence = buildInlineMeshBranchConvergence({ mesh, node, status });
48385
+ }
48386
+ function summarizeInlineMeshBranchConvergence(nodes) {
48387
+ const followUps = nodes.filter((node) => readObjectRecord(node.branchConvergence).needsConvergence === true).map((node) => {
48388
+ const convergence = readObjectRecord(node.branchConvergence);
48389
+ return {
48390
+ nodeId: node.nodeId,
48391
+ workspace: node.workspace,
48392
+ branch: convergence.branch,
48393
+ status: convergence.status,
48394
+ reason: convergence.reason,
48395
+ nextStep: convergence.nextStep
48396
+ };
48397
+ });
48398
+ return {
48399
+ needsFollowUp: followUps.length > 0,
48400
+ unresolvedCount: followUps.length,
48401
+ requiredFinalStates: ["merged_to_main", "pushed_feature_branch_needs_merge", "blocked_review", "cleanup_candidate", "not_mergeable"],
48402
+ followUps
48403
+ };
48404
+ }
48257
48405
  function readCachedInlineMeshActiveSessions(node) {
48258
48406
  const cachedStatus = readObjectRecord(node?.cachedStatus);
48259
48407
  const activeSession = readObjectRecord(cachedStatus.activeSession);
@@ -48334,7 +48482,7 @@ function finalizeMeshNodeStatus(args) {
48334
48482
  async function probeRemoteMeshGitStatus(args) {
48335
48483
  if (!args.dispatchMeshCommand) return null;
48336
48484
  const remoteResult = await Promise.race([
48337
- args.dispatchMeshCommand(args.daemonId, "git_status", { workspace: args.workspace }),
48485
+ args.dispatchMeshCommand(args.daemonId, "git_status", { workspace: args.workspace, refreshUpstream: true }),
48338
48486
  new Promise((_2, reject) => setTimeout(() => reject(new Error("timeout")), args.timeoutMs))
48339
48487
  ]);
48340
48488
  const remoteGit = remoteResult?.status ?? remoteResult?.git ?? remoteResult;
@@ -48967,6 +49115,7 @@ var init_router = __esm({
48967
49115
  const nextStatus = { ...statusNode };
48968
49116
  nextStatus.git = liveGit;
48969
49117
  nextStatus.health = deriveMeshNodeHealthFromGit(liveGit);
49118
+ applyInlineMeshBranchConvergence(mesh, inlineNode, nextStatus);
48970
49119
  nextStatus.launchReady = readBooleanValue(nextStatus.launchReady) ?? true;
48971
49120
  const connection = readObjectRecord(nextStatus.connection);
48972
49121
  const connectionState = readStringValue(connection.state);
@@ -49005,6 +49154,7 @@ var init_router = __esm({
49005
49154
  error: "Selected coordinator could not confirm direct mesh truth for every remote node yet."
49006
49155
  } : {},
49007
49156
  sourceOfTruth: nextSourceOfTruth,
49157
+ branchConvergenceSummary: summarizeInlineMeshBranchConvergence(nodes),
49008
49158
  nodes
49009
49159
  };
49010
49160
  }
@@ -51739,11 +51889,13 @@ ${block2}`);
51739
51889
  node,
51740
51890
  pendingPeerGitProbe ? { skipGit: true, skipError: true, skipHealth: true } : void 0
51741
51891
  )) {
51892
+ applyInlineMeshBranchConvergence(mesh, node, status);
51742
51893
  finalizeMeshNodeStatus({ status, node, daemonId, isSelfNode });
51743
51894
  nodeStatuses.push(status);
51744
51895
  continue;
51745
51896
  }
51746
51897
  if (meshRecord?.source === "inline_cache" && !isSelfNode) {
51898
+ applyInlineMeshBranchConvergence(mesh, node, status);
51747
51899
  finalizeMeshNodeStatus({ status, node, daemonId, isSelfNode });
51748
51900
  nodeStatuses.push(status);
51749
51901
  continue;
@@ -51769,6 +51921,7 @@ ${block2}`);
51769
51921
  } else {
51770
51922
  applyCachedInlineMeshNodeStatus(status, node);
51771
51923
  }
51924
+ applyInlineMeshBranchConvergence(mesh, node, status);
51772
51925
  finalizeMeshNodeStatus({ status, node, daemonId, isSelfNode });
51773
51926
  nodeStatuses.push(status);
51774
51927
  }
@@ -51804,6 +51957,7 @@ ${block2}`);
51804
51957
  } : {},
51805
51958
  historicalEvidenceOnly: ["recoveryHints", "ledger.summary", "queue.summary"]
51806
51959
  },
51960
+ branchConvergenceSummary: summarizeInlineMeshBranchConvergence(nodeStatuses),
51807
51961
  nodes: nodeStatuses,
51808
51962
  queue: { tasks: queue, summary: queueSummary },
51809
51963
  ledger: { entries: ledgerEntries, summary: ledgerSummary }
@@ -101088,7 +101242,7 @@ var init_adhdev_daemon = __esm({
101088
101242
  init_version();
101089
101243
  init_src();
101090
101244
  init_runtime_defaults();
101091
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.82-rc.63" });
101245
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.82-rc.65" });
101092
101246
  AdhdevDaemon = class _AdhdevDaemon {
101093
101247
  localHttpServer = null;
101094
101248
  localWss = null;