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/index.js CHANGED
@@ -47045,6 +47045,9 @@ function normalizeInlineMeshGitStatus(status, node, options) {
47045
47045
  headCommit: readStringValue(status.headCommit) ?? null,
47046
47046
  headMessage: readStringValue(status.headMessage) ?? null,
47047
47047
  upstream: readStringValue(status.upstream) ?? null,
47048
+ upstreamStatus: readStringValue(status.upstreamStatus, status.upstream_status) ?? (readStringValue(status.upstream) ? "unchecked" : "no_upstream"),
47049
+ upstreamFetchedAt: readNumberValue(status.upstreamFetchedAt, status.upstream_fetched_at),
47050
+ upstreamFetchError: readStringValue(status.upstreamFetchError, status.upstream_fetch_error),
47048
47051
  ahead: readNumberValue(status.ahead) ?? 0,
47049
47052
  behind: readNumberValue(status.behind) ?? 0,
47050
47053
  staged: readNumberValue(status.staged) ?? 0,
@@ -47243,8 +47246,11 @@ function reconcileInlineMeshCache(cached2, incoming) {
47243
47246
  };
47244
47247
  }
47245
47248
  function hasGitWorktreeChanges(git) {
47246
- if (!git) return false;
47247
- return Number(git.staged || 0) + Number(git.modified || 0) + Number(git.untracked || 0) + Number(git.deleted || 0) + Number(git.renamed || 0) > 0;
47249
+ return countGitWorktreeChanges(git) > 0;
47250
+ }
47251
+ function countGitWorktreeChanges(git) {
47252
+ if (!git) return 0;
47253
+ return Number(git.staged || 0) + Number(git.modified || 0) + Number(git.untracked || 0) + Number(git.deleted || 0) + Number(git.renamed || 0);
47248
47254
  }
47249
47255
  function getGitSubmoduleDriftState(git) {
47250
47256
  const submodules = Array.isArray(git?.submodules) ? git.submodules : [];
@@ -47266,6 +47272,146 @@ function deriveMeshNodeHealthFromGit(git) {
47266
47272
  if (submoduleDrift.dirty || hasGitWorktreeChanges(git)) return "dirty";
47267
47273
  return "online";
47268
47274
  }
47275
+ function readMeshNodeLabel(status, node) {
47276
+ return readStringValue(status.nodeId, node?.id, node?.nodeId) ?? "unknown";
47277
+ }
47278
+ function buildInlineMeshBranchConvergence(args) {
47279
+ const git = readObjectRecord(args.status.git);
47280
+ const nodeLabel = readMeshNodeLabel(args.status, args.node);
47281
+ const defaultBranch = readStringValue(args.mesh?.defaultBranch) ?? "main";
47282
+ const branch = readStringValue(git.branch, args.node?.worktreeBranch) ?? null;
47283
+ const upstream = readStringValue(git.upstream) ?? null;
47284
+ const upstreamStatus = readStringValue(git.upstreamStatus, git.upstream_status) ?? (upstream ? "unchecked" : "no_upstream");
47285
+ const ahead = readNumberValue(git.ahead) ?? 0;
47286
+ const behind = readNumberValue(git.behind) ?? 0;
47287
+ const uncommittedChanges = countGitWorktreeChanges(git);
47288
+ const hasConflicts = readBooleanValue(git.hasConflicts) ?? (Array.isArray(git.conflictFiles) && git.conflictFiles.length > 0);
47289
+ const base = {
47290
+ defaultBranch,
47291
+ branch,
47292
+ upstream,
47293
+ upstreamStatus,
47294
+ ahead,
47295
+ behind,
47296
+ isWorktree: args.node?.isLocalWorktree === true || args.status.isLocalWorktree === true,
47297
+ isDefaultBranch: branch === defaultBranch
47298
+ };
47299
+ if (readBooleanValue(git.isGitRepo) !== true) {
47300
+ return {
47301
+ ...base,
47302
+ status: "blocked_review",
47303
+ needsConvergence: true,
47304
+ reason: "git_status_unavailable",
47305
+ nextStep: `Resolve git status for node '${nodeLabel}' before marking the task complete.`
47306
+ };
47307
+ }
47308
+ if (!branch) {
47309
+ return {
47310
+ ...base,
47311
+ status: "blocked_review",
47312
+ needsConvergence: true,
47313
+ reason: "branch_unknown",
47314
+ nextStep: `Inspect node '${nodeLabel}' git branch before deciding whether it is merged to ${defaultBranch}.`
47315
+ };
47316
+ }
47317
+ if (hasConflicts || uncommittedChanges > 0) {
47318
+ return {
47319
+ ...base,
47320
+ status: "not_mergeable",
47321
+ needsConvergence: true,
47322
+ reason: hasConflicts ? "conflicts_present" : "dirty_workspace",
47323
+ nextStep: `Commit, checkpoint, or resolve node '${nodeLabel}' before any main convergence step.`
47324
+ };
47325
+ }
47326
+ if (branch === defaultBranch) {
47327
+ if (upstream && upstreamStatus !== "fresh") {
47328
+ return {
47329
+ ...base,
47330
+ status: "blocked_review",
47331
+ needsConvergence: true,
47332
+ reason: "default_branch_upstream_unverified",
47333
+ nextStep: `Refresh ${defaultBranch}'s upstream refs or resolve the fetch failure before declaring convergence complete for node '${nodeLabel}'.`
47334
+ };
47335
+ }
47336
+ if (ahead > 0 || behind > 0) {
47337
+ return {
47338
+ ...base,
47339
+ status: "blocked_review",
47340
+ needsConvergence: true,
47341
+ reason: "default_branch_not_even_with_upstream",
47342
+ nextStep: `Bring ${defaultBranch} even with its upstream before declaring convergence complete.`
47343
+ };
47344
+ }
47345
+ return {
47346
+ ...base,
47347
+ status: "merged_to_main",
47348
+ needsConvergence: false,
47349
+ reason: "clean_default_branch",
47350
+ nextStep: null
47351
+ };
47352
+ }
47353
+ if (args.node?.isLocalWorktree === true || args.status.isLocalWorktree === true) {
47354
+ return {
47355
+ ...base,
47356
+ status: "cleanup_candidate",
47357
+ needsConvergence: true,
47358
+ reason: "clean_non_default_worktree_branch",
47359
+ nextStep: `Run mesh_refine_node(node_id: "${nodeLabel}") or explicitly classify this worktree as blocked_review/not_mergeable before ending the task.`
47360
+ };
47361
+ }
47362
+ if (upstream && upstreamStatus !== "fresh") {
47363
+ return {
47364
+ ...base,
47365
+ status: "blocked_review",
47366
+ needsConvergence: true,
47367
+ reason: "feature_branch_upstream_unverified",
47368
+ nextStep: `Refresh branch '${branch}' upstream refs or resolve the fetch failure before deciding whether it is ready to merge into ${defaultBranch}.`
47369
+ };
47370
+ }
47371
+ if (!upstream || ahead > 0 || behind > 0) {
47372
+ return {
47373
+ ...base,
47374
+ status: "blocked_review",
47375
+ needsConvergence: true,
47376
+ reason: !upstream ? "feature_branch_missing_upstream" : "feature_branch_not_even_with_upstream",
47377
+ nextStep: `Push or reconcile branch '${branch}', then merge it into ${defaultBranch} or mark it not_mergeable with a reason.`
47378
+ };
47379
+ }
47380
+ return {
47381
+ ...base,
47382
+ status: "pushed_feature_branch_needs_merge",
47383
+ needsConvergence: true,
47384
+ reason: "clean_non_default_branch",
47385
+ nextStep: `Review and merge branch '${branch}' into ${defaultBranch}; do not report the task as fully complete while it remains off main.`
47386
+ };
47387
+ }
47388
+ function applyInlineMeshBranchConvergence(mesh, node, status) {
47389
+ const git = readObjectRecord(status.git);
47390
+ if (Object.keys(git).length === 0 && !status.gitProbePending) return;
47391
+ const uncommittedChanges = countGitWorktreeChanges(git);
47392
+ status.isDirty = uncommittedChanges > 0;
47393
+ status.uncommittedChanges = uncommittedChanges;
47394
+ status.branchConvergence = buildInlineMeshBranchConvergence({ mesh, node, status });
47395
+ }
47396
+ function summarizeInlineMeshBranchConvergence(nodes) {
47397
+ const followUps = nodes.filter((node) => readObjectRecord(node.branchConvergence).needsConvergence === true).map((node) => {
47398
+ const convergence = readObjectRecord(node.branchConvergence);
47399
+ return {
47400
+ nodeId: node.nodeId,
47401
+ workspace: node.workspace,
47402
+ branch: convergence.branch,
47403
+ status: convergence.status,
47404
+ reason: convergence.reason,
47405
+ nextStep: convergence.nextStep
47406
+ };
47407
+ });
47408
+ return {
47409
+ needsFollowUp: followUps.length > 0,
47410
+ unresolvedCount: followUps.length,
47411
+ requiredFinalStates: ["merged_to_main", "pushed_feature_branch_needs_merge", "blocked_review", "cleanup_candidate", "not_mergeable"],
47412
+ followUps
47413
+ };
47414
+ }
47269
47415
  function readCachedInlineMeshActiveSessions(node) {
47270
47416
  const cachedStatus = readObjectRecord(node?.cachedStatus);
47271
47417
  const activeSession = readObjectRecord(cachedStatus.activeSession);
@@ -47979,6 +48125,7 @@ var init_router = __esm({
47979
48125
  const nextStatus = { ...statusNode };
47980
48126
  nextStatus.git = liveGit;
47981
48127
  nextStatus.health = deriveMeshNodeHealthFromGit(liveGit);
48128
+ applyInlineMeshBranchConvergence(mesh, inlineNode, nextStatus);
47982
48129
  nextStatus.launchReady = readBooleanValue(nextStatus.launchReady) ?? true;
47983
48130
  const connection = readObjectRecord(nextStatus.connection);
47984
48131
  const connectionState = readStringValue(connection.state);
@@ -48017,6 +48164,7 @@ var init_router = __esm({
48017
48164
  error: "Selected coordinator could not confirm direct mesh truth for every remote node yet."
48018
48165
  } : {},
48019
48166
  sourceOfTruth: nextSourceOfTruth,
48167
+ branchConvergenceSummary: summarizeInlineMeshBranchConvergence(nodes),
48020
48168
  nodes
48021
48169
  };
48022
48170
  }
@@ -50751,11 +50899,13 @@ ${block2}`);
50751
50899
  node,
50752
50900
  pendingPeerGitProbe ? { skipGit: true, skipError: true, skipHealth: true } : void 0
50753
50901
  )) {
50902
+ applyInlineMeshBranchConvergence(mesh, node, status);
50754
50903
  finalizeMeshNodeStatus({ status, node, daemonId, isSelfNode });
50755
50904
  nodeStatuses.push(status);
50756
50905
  continue;
50757
50906
  }
50758
50907
  if (meshRecord?.source === "inline_cache" && !isSelfNode) {
50908
+ applyInlineMeshBranchConvergence(mesh, node, status);
50759
50909
  finalizeMeshNodeStatus({ status, node, daemonId, isSelfNode });
50760
50910
  nodeStatuses.push(status);
50761
50911
  continue;
@@ -50781,6 +50931,7 @@ ${block2}`);
50781
50931
  } else {
50782
50932
  applyCachedInlineMeshNodeStatus(status, node);
50783
50933
  }
50934
+ applyInlineMeshBranchConvergence(mesh, node, status);
50784
50935
  finalizeMeshNodeStatus({ status, node, daemonId, isSelfNode });
50785
50936
  nodeStatuses.push(status);
50786
50937
  }
@@ -50816,6 +50967,7 @@ ${block2}`);
50816
50967
  } : {},
50817
50968
  historicalEvidenceOnly: ["recoveryHints", "ledger.summary", "queue.summary"]
50818
50969
  },
50970
+ branchConvergenceSummary: summarizeInlineMeshBranchConvergence(nodeStatuses),
50819
50971
  nodes: nodeStatuses,
50820
50972
  queue: { tasks: queue, summary: queueSummary },
50821
50973
  ledger: { entries: ledgerEntries, summary: ledgerSummary }
@@ -69918,7 +70070,7 @@ var init_adhdev_daemon = __esm({
69918
70070
  init_version();
69919
70071
  init_src();
69920
70072
  init_runtime_defaults();
69921
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.82-rc.62" });
70073
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.82-rc.64" });
69922
70074
  AdhdevDaemon = class _AdhdevDaemon {
69923
70075
  localHttpServer = null;
69924
70076
  localWss = null;