@adhdev/daemon-core 0.9.82-rc.42 → 0.9.82-rc.44

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
@@ -24072,6 +24072,70 @@ function readBooleanValue(...values) {
24072
24072
  }
24073
24073
  return void 0;
24074
24074
  }
24075
+ function summarizeRepoMeshDebugGit(git) {
24076
+ const record = readObjectRecord(git);
24077
+ if (!Object.keys(record).length) return null;
24078
+ const submodules = Array.isArray(record.submodules) ? record.submodules.map((entry) => ({
24079
+ path: readStringValue(entry?.path) ?? null,
24080
+ commit: readStringValue(entry?.commit)?.slice(0, 12) ?? null,
24081
+ dirty: readBooleanValue(entry?.dirty) ?? false,
24082
+ outOfSync: readBooleanValue(entry?.outOfSync, entry?.out_of_sync) ?? false
24083
+ })) : [];
24084
+ return {
24085
+ isGitRepo: readBooleanValue(record.isGitRepo),
24086
+ workspace: readStringValue(record.workspace) ?? null,
24087
+ repoRoot: readStringValue(record.repoRoot, record.repo_root) ?? null,
24088
+ branch: readStringValue(record.branch) ?? null,
24089
+ upstream: readStringValue(record.upstream) ?? null,
24090
+ upstreamStatus: readStringValue(record.upstreamStatus, record.upstream_status) ?? null,
24091
+ headCommit: readStringValue(record.headCommit, record.head_commit)?.slice(0, 12) ?? null,
24092
+ ahead: readNumberValue(record.ahead) ?? null,
24093
+ behind: readNumberValue(record.behind) ?? null,
24094
+ dirtyCounts: {
24095
+ staged: readNumberValue(record.staged) ?? 0,
24096
+ modified: readNumberValue(record.modified) ?? 0,
24097
+ untracked: readNumberValue(record.untracked) ?? 0,
24098
+ deleted: readNumberValue(record.deleted) ?? 0,
24099
+ renamed: readNumberValue(record.renamed) ?? 0
24100
+ },
24101
+ lastCheckedAt: readNumberValue(record.lastCheckedAt, record.last_checked_at) ?? null,
24102
+ submoduleCount: submodules.length,
24103
+ submodules
24104
+ };
24105
+ }
24106
+ function summarizeRepoMeshStatusDebug(status) {
24107
+ const nodes = Array.isArray(status?.nodes) ? status.nodes : [];
24108
+ return {
24109
+ success: status?.success,
24110
+ meshId: readStringValue(status?.meshId, status?.mesh_id) ?? null,
24111
+ refreshedAt: readStringValue(status?.refreshedAt, status?.refreshed_at) ?? null,
24112
+ sourceOfTruth: status?.sourceOfTruth ?? null,
24113
+ nodeCount: nodes.length,
24114
+ nodes: nodes.map((node) => ({
24115
+ nodeId: readStringValue(node?.nodeId, node?.id) ?? null,
24116
+ daemonId: readStringValue(node?.daemonId, node?.daemon_id) ?? null,
24117
+ workspace: readStringValue(node?.workspace, node?.git?.workspace) ?? null,
24118
+ health: readStringValue(node?.health) ?? null,
24119
+ machineStatus: readStringValue(node?.machineStatus, node?.machine_status) ?? null,
24120
+ connection: node?.connection && typeof node.connection === "object" ? {
24121
+ state: readStringValue(node.connection.state) ?? null,
24122
+ transport: readStringValue(node.connection.transport) ?? null,
24123
+ source: readStringValue(node.connection.source) ?? null,
24124
+ reported: readBooleanValue(node.connection.reported) ?? null
24125
+ } : null,
24126
+ gitProbePending: node?.gitProbePending === true,
24127
+ launchReady: node?.launchReady === true,
24128
+ git: summarizeRepoMeshDebugGit(node?.git)
24129
+ }))
24130
+ };
24131
+ }
24132
+ function logRepoMeshStatusDebug(event, fields) {
24133
+ try {
24134
+ LOG.info("MeshStatusDebug", `[RepoMeshStatusDebug] ${JSON.stringify({ event, ...fields })}`);
24135
+ } catch {
24136
+ LOG.info("MeshStatusDebug", `[RepoMeshStatusDebug] ${event}`);
24137
+ }
24138
+ }
24075
24139
  function joinRepoPath(root, relativePath) {
24076
24140
  const normalizedRoot = typeof root === "string" ? root.trim().replace(/[\\/]+$/, "") : "";
24077
24141
  const normalizedPath = typeof relativePath === "string" ? relativePath.trim() : "";
@@ -27054,7 +27118,15 @@ ${block}`);
27054
27118
  const refreshRequested = args?.refresh === true || args?.forceRefresh === true;
27055
27119
  if (!refreshRequested) {
27056
27120
  const cachedStatus = this.getCachedAggregateMeshStatus(meshId);
27057
- if (cachedStatus) return cachedStatus;
27121
+ if (cachedStatus) {
27122
+ logRepoMeshStatusDebug("return_cached", {
27123
+ meshId,
27124
+ command: "mesh_status",
27125
+ refreshRequested,
27126
+ summary: summarizeRepoMeshStatusDebug(cachedStatus)
27127
+ });
27128
+ return cachedStatus;
27129
+ }
27058
27130
  }
27059
27131
  const refreshReason = refreshRequested ? "explicit_refresh" : "cold_cache_miss";
27060
27132
  const { getMeshQueueStats: getMeshQueueStats2, getQueue: getQueue2 } = await Promise.resolve().then(() => (init_mesh_work_queue(), mesh_work_queue_exports));
@@ -27082,7 +27154,7 @@ ${block}`);
27082
27154
  };
27083
27155
  const directTruthSatisfied = meshRecord.source !== "inline_bootstrap" || directTruth.directEvidenceCount > 0;
27084
27156
  if (requireDirectPeerTruth && !directTruthSatisfied) {
27085
- return {
27157
+ const failureResult = {
27086
27158
  success: false,
27087
27159
  code: "mesh_direct_peer_truth_unavailable",
27088
27160
  error: "Selected coordinator could not confirm direct mesh truth yet. Bootstrap inventory stays unavailable until direct mesh_status probes succeed.",
@@ -27101,6 +27173,14 @@ ${block}`);
27101
27173
  }
27102
27174
  }
27103
27175
  };
27176
+ logRepoMeshStatusDebug("direct_truth_unavailable", {
27177
+ meshId,
27178
+ command: "mesh_status",
27179
+ refreshRequested,
27180
+ meshSource: meshRecord.source,
27181
+ directTruth
27182
+ });
27183
+ return failureResult;
27104
27184
  }
27105
27185
  const directTruthUnavailableNodeIds = new Set(directTruth.unavailableNodeIds);
27106
27186
  const selectedCoordinatorNodeId = readStringValue(
@@ -27308,7 +27388,17 @@ ${block}`);
27308
27388
  queue: { tasks: queue, summary: queueSummary },
27309
27389
  ledger: { entries: ledgerEntries, summary: ledgerSummary }
27310
27390
  };
27311
- return this.rememberAggregateMeshStatus(meshId, statusResult, refreshReason);
27391
+ const rememberedStatus = this.rememberAggregateMeshStatus(meshId, statusResult, refreshReason);
27392
+ logRepoMeshStatusDebug("return_live", {
27393
+ meshId,
27394
+ command: "mesh_status",
27395
+ refreshRequested,
27396
+ refreshReason,
27397
+ meshSource: meshRecord.source,
27398
+ directTruth,
27399
+ summary: summarizeRepoMeshStatusDebug(rememberedStatus)
27400
+ });
27401
+ return rememberedStatus;
27312
27402
  } catch (e) {
27313
27403
  return { success: false, error: e.message };
27314
27404
  }