@adhdev/daemon-standalone 0.9.82-rc.43 → 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
@@ -46052,6 +46052,70 @@ ${(0, import_node_path.resolve)(workspace || os17.tmpdir())}`;
46052
46052
  }
46053
46053
  return void 0;
46054
46054
  }
46055
+ function summarizeRepoMeshDebugGit(git) {
46056
+ const record2 = readObjectRecord(git);
46057
+ if (!Object.keys(record2).length) return null;
46058
+ const submodules = Array.isArray(record2.submodules) ? record2.submodules.map((entry) => ({
46059
+ path: readStringValue(entry?.path) ?? null,
46060
+ commit: readStringValue(entry?.commit)?.slice(0, 12) ?? null,
46061
+ dirty: readBooleanValue(entry?.dirty) ?? false,
46062
+ outOfSync: readBooleanValue(entry?.outOfSync, entry?.out_of_sync) ?? false
46063
+ })) : [];
46064
+ return {
46065
+ isGitRepo: readBooleanValue(record2.isGitRepo),
46066
+ workspace: readStringValue(record2.workspace) ?? null,
46067
+ repoRoot: readStringValue(record2.repoRoot, record2.repo_root) ?? null,
46068
+ branch: readStringValue(record2.branch) ?? null,
46069
+ upstream: readStringValue(record2.upstream) ?? null,
46070
+ upstreamStatus: readStringValue(record2.upstreamStatus, record2.upstream_status) ?? null,
46071
+ headCommit: readStringValue(record2.headCommit, record2.head_commit)?.slice(0, 12) ?? null,
46072
+ ahead: readNumberValue(record2.ahead) ?? null,
46073
+ behind: readNumberValue(record2.behind) ?? null,
46074
+ dirtyCounts: {
46075
+ staged: readNumberValue(record2.staged) ?? 0,
46076
+ modified: readNumberValue(record2.modified) ?? 0,
46077
+ untracked: readNumberValue(record2.untracked) ?? 0,
46078
+ deleted: readNumberValue(record2.deleted) ?? 0,
46079
+ renamed: readNumberValue(record2.renamed) ?? 0
46080
+ },
46081
+ lastCheckedAt: readNumberValue(record2.lastCheckedAt, record2.last_checked_at) ?? null,
46082
+ submoduleCount: submodules.length,
46083
+ submodules
46084
+ };
46085
+ }
46086
+ function summarizeRepoMeshStatusDebug(status) {
46087
+ const nodes = Array.isArray(status?.nodes) ? status.nodes : [];
46088
+ return {
46089
+ success: status?.success,
46090
+ meshId: readStringValue(status?.meshId, status?.mesh_id) ?? null,
46091
+ refreshedAt: readStringValue(status?.refreshedAt, status?.refreshed_at) ?? null,
46092
+ sourceOfTruth: status?.sourceOfTruth ?? null,
46093
+ nodeCount: nodes.length,
46094
+ nodes: nodes.map((node) => ({
46095
+ nodeId: readStringValue(node?.nodeId, node?.id) ?? null,
46096
+ daemonId: readStringValue(node?.daemonId, node?.daemon_id) ?? null,
46097
+ workspace: readStringValue(node?.workspace, node?.git?.workspace) ?? null,
46098
+ health: readStringValue(node?.health) ?? null,
46099
+ machineStatus: readStringValue(node?.machineStatus, node?.machine_status) ?? null,
46100
+ connection: node?.connection && typeof node.connection === "object" ? {
46101
+ state: readStringValue(node.connection.state) ?? null,
46102
+ transport: readStringValue(node.connection.transport) ?? null,
46103
+ source: readStringValue(node.connection.source) ?? null,
46104
+ reported: readBooleanValue(node.connection.reported) ?? null
46105
+ } : null,
46106
+ gitProbePending: node?.gitProbePending === true,
46107
+ launchReady: node?.launchReady === true,
46108
+ git: summarizeRepoMeshDebugGit(node?.git)
46109
+ }))
46110
+ };
46111
+ }
46112
+ function logRepoMeshStatusDebug(event, fields) {
46113
+ try {
46114
+ LOG2.info("MeshStatusDebug", `[RepoMeshStatusDebug] ${JSON.stringify({ event, ...fields })}`);
46115
+ } catch {
46116
+ LOG2.info("MeshStatusDebug", `[RepoMeshStatusDebug] ${event}`);
46117
+ }
46118
+ }
46055
46119
  function joinRepoPath(root, relativePath) {
46056
46120
  const normalizedRoot = typeof root === "string" ? root.trim().replace(/[\\/]+$/, "") : "";
46057
46121
  const normalizedPath = typeof relativePath === "string" ? relativePath.trim() : "";
@@ -49034,7 +49098,15 @@ ${block}`);
49034
49098
  const refreshRequested = args?.refresh === true || args?.forceRefresh === true;
49035
49099
  if (!refreshRequested) {
49036
49100
  const cachedStatus = this.getCachedAggregateMeshStatus(meshId);
49037
- if (cachedStatus) return cachedStatus;
49101
+ if (cachedStatus) {
49102
+ logRepoMeshStatusDebug("return_cached", {
49103
+ meshId,
49104
+ command: "mesh_status",
49105
+ refreshRequested,
49106
+ summary: summarizeRepoMeshStatusDebug(cachedStatus)
49107
+ });
49108
+ return cachedStatus;
49109
+ }
49038
49110
  }
49039
49111
  const refreshReason = refreshRequested ? "explicit_refresh" : "cold_cache_miss";
49040
49112
  const { getMeshQueueStats: getMeshQueueStats2, getQueue: getQueue2 } = await Promise.resolve().then(() => (init_mesh_work_queue(), mesh_work_queue_exports));
@@ -49062,7 +49134,7 @@ ${block}`);
49062
49134
  };
49063
49135
  const directTruthSatisfied = meshRecord.source !== "inline_bootstrap" || directTruth.directEvidenceCount > 0;
49064
49136
  if (requireDirectPeerTruth && !directTruthSatisfied) {
49065
- return {
49137
+ const failureResult = {
49066
49138
  success: false,
49067
49139
  code: "mesh_direct_peer_truth_unavailable",
49068
49140
  error: "Selected coordinator could not confirm direct mesh truth yet. Bootstrap inventory stays unavailable until direct mesh_status probes succeed.",
@@ -49081,6 +49153,14 @@ ${block}`);
49081
49153
  }
49082
49154
  }
49083
49155
  };
49156
+ logRepoMeshStatusDebug("direct_truth_unavailable", {
49157
+ meshId,
49158
+ command: "mesh_status",
49159
+ refreshRequested,
49160
+ meshSource: meshRecord.source,
49161
+ directTruth
49162
+ });
49163
+ return failureResult;
49084
49164
  }
49085
49165
  const directTruthUnavailableNodeIds = new Set(directTruth.unavailableNodeIds);
49086
49166
  const selectedCoordinatorNodeId = readStringValue(
@@ -49288,7 +49368,17 @@ ${block}`);
49288
49368
  queue: { tasks: queue, summary: queueSummary },
49289
49369
  ledger: { entries: ledgerEntries, summary: ledgerSummary }
49290
49370
  };
49291
- return this.rememberAggregateMeshStatus(meshId, statusResult, refreshReason);
49371
+ const rememberedStatus = this.rememberAggregateMeshStatus(meshId, statusResult, refreshReason);
49372
+ logRepoMeshStatusDebug("return_live", {
49373
+ meshId,
49374
+ command: "mesh_status",
49375
+ refreshRequested,
49376
+ refreshReason,
49377
+ meshSource: meshRecord.source,
49378
+ directTruth,
49379
+ summary: summarizeRepoMeshStatusDebug(rememberedStatus)
49380
+ });
49381
+ return rememberedStatus;
49292
49382
  } catch (e) {
49293
49383
  return { success: false, error: e.message };
49294
49384
  }