@adhdev/daemon-standalone 0.9.82-rc.264 → 0.9.82-rc.266

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
@@ -29973,10 +29973,10 @@ var require_dist3 = __commonJS({
29973
29973
  }
29974
29974
  function getDaemonBuildInfo() {
29975
29975
  if (cached2) return cached2;
29976
- const commit = readInjected(true ? "751232919b0935654ee3d75d7cee4607594d6836" : void 0) ?? "unknown";
29977
- const commitShort = readInjected(true ? "7512329" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
29978
- const version2 = readInjected(true ? "0.9.82-rc.264" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
29979
- const builtAt = readInjected(true ? "2026-06-14T15:25:15.217Z" : void 0);
29976
+ const commit = readInjected(true ? "bf805cc2b4d63e722d2e330fa10a9890db3b4668" : void 0) ?? "unknown";
29977
+ const commitShort = readInjected(true ? "bf805cc" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
29978
+ const version2 = readInjected(true ? "0.9.82-rc.266" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
29979
+ const builtAt = readInjected(true ? "2026-06-14T19:48:44.612Z" : void 0);
29980
29980
  cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
29981
29981
  return cached2;
29982
29982
  }
@@ -68653,6 +68653,203 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
68653
68653
  init_config();
68654
68654
  init_cli_detector();
68655
68655
  init_git_status();
68656
+ function readRecord5(value) {
68657
+ return value && typeof value === "object" && !Array.isArray(value) ? value : {};
68658
+ }
68659
+ function readString6(...values) {
68660
+ for (const value of values) {
68661
+ if (typeof value !== "string") continue;
68662
+ const trimmed = value.trim();
68663
+ if (trimmed) return trimmed;
68664
+ }
68665
+ return void 0;
68666
+ }
68667
+ function readNumber(...values) {
68668
+ for (const value of values) {
68669
+ if (typeof value === "number" && Number.isFinite(value)) return value;
68670
+ }
68671
+ return void 0;
68672
+ }
68673
+ function readBoolean(...values) {
68674
+ for (const value of values) {
68675
+ if (typeof value === "boolean") return value;
68676
+ }
68677
+ return void 0;
68678
+ }
68679
+ function joinRepoPath(root, relativePath) {
68680
+ const normalizedRoot = typeof root === "string" ? root.trim().replace(/[\\/]+$/, "") : "";
68681
+ const normalizedPath = typeof relativePath === "string" ? relativePath.trim() : "";
68682
+ if (!normalizedPath) return void 0;
68683
+ if (/^(?:[A-Za-z]:[\\/]|\/)/.test(normalizedPath)) return normalizedPath;
68684
+ if (!normalizedRoot) return void 0;
68685
+ return `${normalizedRoot}/${normalizedPath.replace(/^[\\/]+/, "")}`;
68686
+ }
68687
+ function scoreGitUpstreamFreshness(status) {
68688
+ switch (status) {
68689
+ case "fresh":
68690
+ return 30;
68691
+ case "no_upstream":
68692
+ return 4;
68693
+ case "unchecked":
68694
+ case void 0:
68695
+ return 0;
68696
+ case "stale":
68697
+ return -10;
68698
+ case "unavailable":
68699
+ return -15;
68700
+ default:
68701
+ return 0;
68702
+ }
68703
+ }
68704
+ function readGitSubmodules(value, parentRepoRoot) {
68705
+ if (!Array.isArray(value)) return void 0;
68706
+ const submodules = value.map((entry) => {
68707
+ const submodule = readRecord5(entry);
68708
+ const path39 = readString6(submodule.path);
68709
+ const commit = readString6(submodule.commit);
68710
+ const repoPath = readString6(submodule.repoPath, submodule.repo_root) ?? joinRepoPath(parentRepoRoot, path39);
68711
+ if (!path39 || !commit) return null;
68712
+ const result = {
68713
+ path: path39,
68714
+ commit,
68715
+ dirty: readBoolean(submodule.dirty) ?? false,
68716
+ outOfSync: readBoolean(submodule.outOfSync, submodule.out_of_sync) ?? false,
68717
+ lastCheckedAt: readNumber(submodule.lastCheckedAt, submodule.last_checked_at) ?? Date.now()
68718
+ };
68719
+ if (repoPath) result.repoPath = repoPath;
68720
+ const error48 = readString6(submodule.error);
68721
+ if (error48) result.error = error48;
68722
+ return result;
68723
+ }).filter((entry) => entry !== null);
68724
+ return submodules.length > 0 ? submodules : void 0;
68725
+ }
68726
+ function hasGitStatusEvidence(status) {
68727
+ return readBoolean(status.isGitRepo) !== void 0 || Boolean(readString6(status.branch, status.upstream, status.upstreamStatus, status.upstream_status, status.headCommit)) || Boolean(readString6(status.repoRoot, status.repo_root, status.workspace)) || readNumber(
68728
+ status.ahead,
68729
+ status.behind,
68730
+ status.staged,
68731
+ status.modified,
68732
+ status.untracked,
68733
+ status.deleted,
68734
+ status.renamed,
68735
+ status.lastCheckedAt,
68736
+ status.last_checked_at
68737
+ ) !== void 0 || Array.isArray(status.submodules) && status.submodules.length > 0;
68738
+ }
68739
+ function normalizeGitStatus(status, node, options) {
68740
+ const explicitIsGitRepo = readBoolean(status.isGitRepo);
68741
+ if (!Object.keys(status).length || !hasGitStatusEvidence(status)) return void 0;
68742
+ const isGitRepo = explicitIsGitRepo ?? true;
68743
+ const conflictFiles = Array.isArray(status.conflictFiles) ? status.conflictFiles.filter((entry) => typeof entry === "string") : [];
68744
+ const conflictCount = readNumber(status.conflicts) ?? conflictFiles.length;
68745
+ const hasConflicts = readBoolean(status.hasConflicts) ?? conflictCount > 0;
68746
+ const repoRoot = readString6(status.repoRoot, status.repo_root, node.repoRoot, node.repo_root, status.workspace, node.workspace) || void 0;
68747
+ const submodules = readGitSubmodules(status.submodules, repoRoot);
68748
+ const upstreamStatus = readString6(status.upstreamStatus, status.upstream_status);
68749
+ const upstreamFetchedAt = readNumber(status.upstreamFetchedAt, status.upstream_fetched_at);
68750
+ const upstreamFetchError = readString6(status.upstreamFetchError, status.upstream_fetch_error);
68751
+ const error48 = readString6(status.error);
68752
+ const staged = readNumber(status.staged) ?? 0;
68753
+ const modified = readNumber(status.modified) ?? 0;
68754
+ const untracked = readNumber(status.untracked) ?? 0;
68755
+ const deleted = readNumber(status.deleted) ?? 0;
68756
+ const renamed = readNumber(status.renamed) ?? 0;
68757
+ return {
68758
+ workspace: readString6(status.workspace, node.workspace) || "",
68759
+ repoRoot: repoRoot ?? null,
68760
+ isGitRepo,
68761
+ branch: readString6(status.branch) ?? null,
68762
+ headCommit: readString6(status.headCommit) ?? null,
68763
+ headMessage: readString6(status.headMessage) ?? null,
68764
+ upstream: readString6(status.upstream) ?? null,
68765
+ upstreamStatus: upstreamStatus ?? "unchecked",
68766
+ ...upstreamFetchedAt !== void 0 ? { upstreamFetchedAt } : {},
68767
+ ...upstreamFetchError ? { upstreamFetchError } : {},
68768
+ ahead: readNumber(status.ahead) ?? 0,
68769
+ behind: readNumber(status.behind) ?? 0,
68770
+ staged,
68771
+ modified,
68772
+ untracked,
68773
+ deleted,
68774
+ renamed,
68775
+ dirty: readBoolean(status.dirty, status.isDirty, status.is_dirty) ?? (staged + modified + untracked + deleted + renamed > 0 || hasConflicts),
68776
+ hasConflicts,
68777
+ conflictFiles,
68778
+ stashCount: readNumber(status.stashCount, status.stash_count) ?? 0,
68779
+ lastCheckedAt: options?.lastCheckedAt ?? readNumber(status.lastCheckedAt, status.last_checked_at) ?? Date.now(),
68780
+ ...submodules ? { submodules } : {},
68781
+ ...error48 ? { error: error48 } : {}
68782
+ };
68783
+ }
68784
+ function scoreGitStatusCandidate(git) {
68785
+ if (!git) return Number.NEGATIVE_INFINITY;
68786
+ let score = 0;
68787
+ if (git.isGitRepo === true) score += 50;
68788
+ if (git.isGitRepo === false) score -= 10;
68789
+ if (git.branch) score += 20;
68790
+ if (git.headCommit) score += 20;
68791
+ if (git.upstream) score += 10;
68792
+ score += scoreGitUpstreamFreshness(git.upstreamStatus);
68793
+ if (typeof git.ahead === "number") score += 2;
68794
+ if (typeof git.behind === "number") score += 2;
68795
+ if (Array.isArray(git.submodules) && git.submodules.length > 0) score += 4 + git.submodules.length;
68796
+ if (git.error) score -= 20;
68797
+ return score;
68798
+ }
68799
+ function pickBestTransitGitStatus(node, options) {
68800
+ const rawGit = readRecord5(node.lastGit ?? node.last_git);
68801
+ const gitResult = readRecord5(rawGit.result);
68802
+ const directStatus = readRecord5(rawGit.status);
68803
+ const nestedStatus = readRecord5(gitResult.status);
68804
+ const rawProbe = readRecord5(node.lastProbe ?? node.last_probe);
68805
+ const probeGit = readRecord5(rawProbe.git);
68806
+ const probeGitResult = readRecord5(probeGit.result);
68807
+ const probeDirectStatus = readRecord5(probeGit.status);
68808
+ const probeNestedStatus = readRecord5(probeGitResult.status);
68809
+ const lastCheckedAt = options?.lastCheckedAt;
68810
+ let best = null;
68811
+ for (const status of [directStatus, nestedStatus, probeDirectStatus, probeNestedStatus]) {
68812
+ const normalized = normalizeGitStatus(status, node, { lastCheckedAt: lastCheckedAt ?? Date.now() });
68813
+ if (!normalized) continue;
68814
+ const score = scoreGitStatusCandidate(normalized);
68815
+ if (!best || score > best.score) best = { git: normalized, score };
68816
+ }
68817
+ return best?.git;
68818
+ }
68819
+ function summarizeGitShape(status) {
68820
+ const record2 = readRecord5(status);
68821
+ if (!Object.keys(record2).length) return null;
68822
+ const submodules = Array.isArray(record2.submodules) ? record2.submodules.map((entry) => {
68823
+ const sub = readRecord5(entry);
68824
+ return {
68825
+ path: readString6(sub.path) ?? null,
68826
+ commit: readString6(sub.commit)?.slice(0, 12) ?? null,
68827
+ dirty: readBoolean(sub.dirty) ?? false,
68828
+ outOfSync: readBoolean(sub.outOfSync, sub.out_of_sync) ?? false
68829
+ };
68830
+ }) : [];
68831
+ return {
68832
+ isGitRepo: readBoolean(record2.isGitRepo),
68833
+ workspace: readString6(record2.workspace) ?? null,
68834
+ repoRoot: readString6(record2.repoRoot, record2.repo_root) ?? null,
68835
+ branch: readString6(record2.branch) ?? null,
68836
+ upstream: readString6(record2.upstream) ?? null,
68837
+ upstreamStatus: readString6(record2.upstreamStatus, record2.upstream_status) ?? null,
68838
+ headCommit: readString6(record2.headCommit, record2.head_commit)?.slice(0, 12) ?? null,
68839
+ ahead: readNumber(record2.ahead) ?? null,
68840
+ behind: readNumber(record2.behind) ?? null,
68841
+ dirtyCounts: {
68842
+ staged: readNumber(record2.staged) ?? 0,
68843
+ modified: readNumber(record2.modified) ?? 0,
68844
+ untracked: readNumber(record2.untracked) ?? 0,
68845
+ deleted: readNumber(record2.deleted) ?? 0,
68846
+ renamed: readNumber(record2.renamed) ?? 0
68847
+ },
68848
+ lastCheckedAt: readNumber(record2.lastCheckedAt, record2.last_checked_at) ?? null,
68849
+ submoduleCount: submodules.length,
68850
+ submodules
68851
+ };
68852
+ }
68656
68853
  init_logger();
68657
68854
  var fs21 = __toESM2(require("fs"));
68658
68855
  var path322 = __toESM2(require("path"));
@@ -68904,7 +69101,7 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
68904
69101
  return "";
68905
69102
  }
68906
69103
  }
68907
- function readRecord5(repoRoot) {
69104
+ function readRecord6(repoRoot) {
68908
69105
  const path39 = (0, import_node_path2.resolve)(repoRoot, PREVIEW_DEPLOY_RECORD);
68909
69106
  if (!(0, import_node_fs4.existsSync)(path39)) return null;
68910
69107
  try {
@@ -68944,7 +69141,7 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
68944
69141
  }
68945
69142
  function buildPreviewFreshness(repoRoot) {
68946
69143
  const current = readCurrentMainCommit(repoRoot);
68947
- const record2 = readRecord5(repoRoot);
69144
+ const record2 = readRecord6(repoRoot);
68948
69145
  const lastPreviewCommit = normalizeCommit(record2?.lastPreviewCommit);
68949
69146
  const targets = readTargetFreshness(record2, current.currentMainCommit);
68950
69147
  let status = "unknown";
@@ -69703,37 +69900,6 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
69703
69900
  }
69704
69901
  return void 0;
69705
69902
  }
69706
- function summarizeRepoMeshDebugGit(git) {
69707
- const record2 = readObjectRecord(git);
69708
- if (!Object.keys(record2).length) return null;
69709
- const submodules = Array.isArray(record2.submodules) ? record2.submodules.map((entry) => ({
69710
- path: readStringValue(entry?.path) ?? null,
69711
- commit: readStringValue(entry?.commit)?.slice(0, 12) ?? null,
69712
- dirty: readBooleanValue(entry?.dirty) ?? false,
69713
- outOfSync: readBooleanValue(entry?.outOfSync, entry?.out_of_sync) ?? false
69714
- })) : [];
69715
- return {
69716
- isGitRepo: readBooleanValue(record2.isGitRepo),
69717
- workspace: readStringValue(record2.workspace) ?? null,
69718
- repoRoot: readStringValue(record2.repoRoot, record2.repo_root) ?? null,
69719
- branch: readStringValue(record2.branch) ?? null,
69720
- upstream: readStringValue(record2.upstream) ?? null,
69721
- upstreamStatus: readStringValue(record2.upstreamStatus, record2.upstream_status) ?? null,
69722
- headCommit: readStringValue(record2.headCommit, record2.head_commit)?.slice(0, 12) ?? null,
69723
- ahead: readNumberValue(record2.ahead) ?? null,
69724
- behind: readNumberValue(record2.behind) ?? null,
69725
- dirtyCounts: {
69726
- staged: readNumberValue(record2.staged) ?? 0,
69727
- modified: readNumberValue(record2.modified) ?? 0,
69728
- untracked: readNumberValue(record2.untracked) ?? 0,
69729
- deleted: readNumberValue(record2.deleted) ?? 0,
69730
- renamed: readNumberValue(record2.renamed) ?? 0
69731
- },
69732
- lastCheckedAt: readNumberValue(record2.lastCheckedAt, record2.last_checked_at) ?? null,
69733
- submoduleCount: submodules.length,
69734
- submodules
69735
- };
69736
- }
69737
69903
  function summarizeRepoMeshStatusDebug(status) {
69738
69904
  const nodes = Array.isArray(status?.nodes) ? status.nodes : [];
69739
69905
  return {
@@ -69757,7 +69923,7 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
69757
69923
  } : null,
69758
69924
  gitProbePending: node?.gitProbePending === true,
69759
69925
  launchReady: node?.launchReady === true,
69760
- git: summarizeRepoMeshDebugGit(node?.git),
69926
+ git: summarizeGitShape(node?.git),
69761
69927
  branchConvergence: node?.branchConvergence ?? node?.branch_convergence ?? null
69762
69928
  }))
69763
69929
  };
@@ -69769,34 +69935,6 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
69769
69935
  LOG2.info("MeshStatusDebug", `[RepoMeshStatusDebug] ${event}`);
69770
69936
  }
69771
69937
  }
69772
- function joinRepoPath(root, relativePath) {
69773
- const normalizedRoot = typeof root === "string" ? root.trim().replace(/[\\/]+$/, "") : "";
69774
- const normalizedPath = typeof relativePath === "string" ? relativePath.trim() : "";
69775
- if (!normalizedPath) return void 0;
69776
- if (/^(?:[A-Za-z]:[\\/]|\/)/.test(normalizedPath)) return normalizedPath;
69777
- if (!normalizedRoot) return void 0;
69778
- return `${normalizedRoot}/${normalizedPath.replace(/^[\\/]+/, "")}`;
69779
- }
69780
- function readGitSubmodules(value, parentRepoRoot) {
69781
- if (!Array.isArray(value)) return void 0;
69782
- const submodules = value.map((entry) => {
69783
- const submodule = readObjectRecord(entry);
69784
- const path39 = readStringValue(submodule.path);
69785
- const commit = readStringValue(submodule.commit);
69786
- const repoPath = readStringValue(submodule.repoPath, submodule.repo_root) ?? joinRepoPath(parentRepoRoot, path39);
69787
- if (!path39 || !commit || !repoPath) return null;
69788
- return {
69789
- path: path39,
69790
- commit,
69791
- repoPath,
69792
- dirty: readBooleanValue(submodule.dirty) ?? false,
69793
- outOfSync: readBooleanValue(submodule.outOfSync, submodule.out_of_sync) ?? false,
69794
- lastCheckedAt: readNumberValue(submodule.lastCheckedAt, submodule.last_checked_at) ?? Date.now(),
69795
- ...readStringValue(submodule.error) ? { error: readStringValue(submodule.error) } : {}
69796
- };
69797
- }).filter((entry) => entry !== null);
69798
- return submodules.length > 0 ? submodules : void 0;
69799
- }
69800
69938
  function buildMeshNodeDisplayLabel(node, nodeId, providerPriority) {
69801
69939
  const explicit = readStringValue(node.machineLabel, node.machine_label, node.machineNickname, node.machine_nickname, node.alias);
69802
69940
  if (explicit) return explicit;
@@ -69911,72 +70049,10 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
69911
70049
  };
69912
70050
  }
69913
70051
  function normalizeInlineMeshGitStatus(status, node, options) {
69914
- const isGitRepo = readBooleanValue(status.isGitRepo);
69915
- if (!Object.keys(status).length || isGitRepo === void 0) return void 0;
69916
- const conflictFiles = Array.isArray(status.conflictFiles) ? status.conflictFiles.filter((value) => typeof value === "string") : [];
69917
- const conflictCount = readNumberValue(status.conflicts) ?? conflictFiles.length;
69918
- const hasConflicts = readBooleanValue(status.hasConflicts) ?? conflictCount > 0;
69919
- const repoRoot = readStringValue(status.repoRoot, status.repo_root, node?.repoRoot, node?.repo_root, status.workspace, node?.workspace) || void 0;
69920
- const submodules = readGitSubmodules(status.submodules, repoRoot);
69921
- return {
69922
- workspace: readStringValue(status.workspace, node?.workspace) || "",
69923
- repoRoot: repoRoot ?? null,
69924
- isGitRepo,
69925
- branch: readStringValue(status.branch) ?? null,
69926
- headCommit: readStringValue(status.headCommit) ?? null,
69927
- headMessage: readStringValue(status.headMessage) ?? null,
69928
- upstream: readStringValue(status.upstream) ?? null,
69929
- upstreamStatus: readStringValue(status.upstreamStatus, status.upstream_status) ?? (readStringValue(status.upstream) ? "unchecked" : "no_upstream"),
69930
- upstreamFetchedAt: readNumberValue(status.upstreamFetchedAt, status.upstream_fetched_at),
69931
- upstreamFetchError: readStringValue(status.upstreamFetchError, status.upstream_fetch_error),
69932
- ahead: readNumberValue(status.ahead) ?? 0,
69933
- behind: readNumberValue(status.behind) ?? 0,
69934
- staged: readNumberValue(status.staged) ?? 0,
69935
- modified: readNumberValue(status.modified) ?? 0,
69936
- untracked: readNumberValue(status.untracked) ?? 0,
69937
- deleted: readNumberValue(status.deleted) ?? 0,
69938
- renamed: readNumberValue(status.renamed) ?? 0,
69939
- hasConflicts,
69940
- conflictFiles,
69941
- stashCount: readNumberValue(status.stashCount) ?? 0,
69942
- lastCheckedAt: options?.lastCheckedAt ?? readNumberValue(status.lastCheckedAt) ?? Date.now(),
69943
- ...submodules ? { submodules } : {}
69944
- };
69945
- }
69946
- function scoreInlineMeshGitStatus(git) {
69947
- if (!git) return Number.NEGATIVE_INFINITY;
69948
- let score = 0;
69949
- if (readBooleanValue(git.isGitRepo) === true) score += 50;
69950
- if (readBooleanValue(git.isGitRepo) === false) score -= 10;
69951
- if (readStringValue(git.branch)) score += 20;
69952
- if (readStringValue(git.headCommit)) score += 20;
69953
- if (readStringValue(git.upstream)) score += 10;
69954
- if (readStringValue(git.upstreamStatus)) score += 5;
69955
- if (readNumberValue(git.ahead) !== void 0) score += 2;
69956
- if (readNumberValue(git.behind) !== void 0) score += 2;
69957
- if (Array.isArray(git.submodules) && git.submodules.length > 0) score += 4 + git.submodules.length;
69958
- if (readStringValue(git.error)) score -= 20;
69959
- return score;
70052
+ return normalizeGitStatus(status, readObjectRecord(node), options);
69960
70053
  }
69961
70054
  function buildInlineMeshTransitGitStatus(node) {
69962
- const rawGit = readObjectRecord(node?.lastGit ?? node?.last_git);
69963
- const gitResult = readObjectRecord(rawGit.result);
69964
- const directStatus = readObjectRecord(rawGit.status);
69965
- const nestedStatus = readObjectRecord(gitResult.status);
69966
- const rawProbe = readObjectRecord(node?.lastProbe ?? node?.last_probe);
69967
- const probeGit = readObjectRecord(rawProbe.git);
69968
- const probeGitResult = readObjectRecord(probeGit.result);
69969
- const probeDirectStatus = readObjectRecord(probeGit.status);
69970
- const probeNestedStatus = readObjectRecord(probeGitResult.status);
69971
- const candidates = [directStatus, nestedStatus, probeDirectStatus, probeNestedStatus];
69972
- let best = null;
69973
- for (const status of candidates) {
69974
- const normalized = normalizeInlineMeshGitStatus(status, node, { lastCheckedAt: Date.now() });
69975
- if (!normalized) continue;
69976
- const score = scoreInlineMeshGitStatus(normalized);
69977
- if (!best || score > best.score) best = { git: normalized, score };
69978
- }
69979
- return best?.git;
70055
+ return pickBestTransitGitStatus(readObjectRecord(node), { lastCheckedAt: Date.now() });
69980
70056
  }
69981
70057
  function shouldRefreshStalePendingAggregate(snapshot, options) {
69982
70058
  if (options?.requireDirectPeerTruth !== true || !Array.isArray(snapshot?.nodes)) return false;