adhdev 0.9.82-rc.62 → 0.9.82-rc.64

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