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