@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 +93 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +93 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/commands/router.ts +98 -3
package/dist/index.mjs
CHANGED
|
@@ -23839,6 +23839,70 @@ function readBooleanValue(...values) {
|
|
|
23839
23839
|
}
|
|
23840
23840
|
return void 0;
|
|
23841
23841
|
}
|
|
23842
|
+
function summarizeRepoMeshDebugGit(git) {
|
|
23843
|
+
const record = readObjectRecord(git);
|
|
23844
|
+
if (!Object.keys(record).length) return null;
|
|
23845
|
+
const submodules = Array.isArray(record.submodules) ? record.submodules.map((entry) => ({
|
|
23846
|
+
path: readStringValue(entry?.path) ?? null,
|
|
23847
|
+
commit: readStringValue(entry?.commit)?.slice(0, 12) ?? null,
|
|
23848
|
+
dirty: readBooleanValue(entry?.dirty) ?? false,
|
|
23849
|
+
outOfSync: readBooleanValue(entry?.outOfSync, entry?.out_of_sync) ?? false
|
|
23850
|
+
})) : [];
|
|
23851
|
+
return {
|
|
23852
|
+
isGitRepo: readBooleanValue(record.isGitRepo),
|
|
23853
|
+
workspace: readStringValue(record.workspace) ?? null,
|
|
23854
|
+
repoRoot: readStringValue(record.repoRoot, record.repo_root) ?? null,
|
|
23855
|
+
branch: readStringValue(record.branch) ?? null,
|
|
23856
|
+
upstream: readStringValue(record.upstream) ?? null,
|
|
23857
|
+
upstreamStatus: readStringValue(record.upstreamStatus, record.upstream_status) ?? null,
|
|
23858
|
+
headCommit: readStringValue(record.headCommit, record.head_commit)?.slice(0, 12) ?? null,
|
|
23859
|
+
ahead: readNumberValue(record.ahead) ?? null,
|
|
23860
|
+
behind: readNumberValue(record.behind) ?? null,
|
|
23861
|
+
dirtyCounts: {
|
|
23862
|
+
staged: readNumberValue(record.staged) ?? 0,
|
|
23863
|
+
modified: readNumberValue(record.modified) ?? 0,
|
|
23864
|
+
untracked: readNumberValue(record.untracked) ?? 0,
|
|
23865
|
+
deleted: readNumberValue(record.deleted) ?? 0,
|
|
23866
|
+
renamed: readNumberValue(record.renamed) ?? 0
|
|
23867
|
+
},
|
|
23868
|
+
lastCheckedAt: readNumberValue(record.lastCheckedAt, record.last_checked_at) ?? null,
|
|
23869
|
+
submoduleCount: submodules.length,
|
|
23870
|
+
submodules
|
|
23871
|
+
};
|
|
23872
|
+
}
|
|
23873
|
+
function summarizeRepoMeshStatusDebug(status) {
|
|
23874
|
+
const nodes = Array.isArray(status?.nodes) ? status.nodes : [];
|
|
23875
|
+
return {
|
|
23876
|
+
success: status?.success,
|
|
23877
|
+
meshId: readStringValue(status?.meshId, status?.mesh_id) ?? null,
|
|
23878
|
+
refreshedAt: readStringValue(status?.refreshedAt, status?.refreshed_at) ?? null,
|
|
23879
|
+
sourceOfTruth: status?.sourceOfTruth ?? null,
|
|
23880
|
+
nodeCount: nodes.length,
|
|
23881
|
+
nodes: nodes.map((node) => ({
|
|
23882
|
+
nodeId: readStringValue(node?.nodeId, node?.id) ?? null,
|
|
23883
|
+
daemonId: readStringValue(node?.daemonId, node?.daemon_id) ?? null,
|
|
23884
|
+
workspace: readStringValue(node?.workspace, node?.git?.workspace) ?? null,
|
|
23885
|
+
health: readStringValue(node?.health) ?? null,
|
|
23886
|
+
machineStatus: readStringValue(node?.machineStatus, node?.machine_status) ?? null,
|
|
23887
|
+
connection: node?.connection && typeof node.connection === "object" ? {
|
|
23888
|
+
state: readStringValue(node.connection.state) ?? null,
|
|
23889
|
+
transport: readStringValue(node.connection.transport) ?? null,
|
|
23890
|
+
source: readStringValue(node.connection.source) ?? null,
|
|
23891
|
+
reported: readBooleanValue(node.connection.reported) ?? null
|
|
23892
|
+
} : null,
|
|
23893
|
+
gitProbePending: node?.gitProbePending === true,
|
|
23894
|
+
launchReady: node?.launchReady === true,
|
|
23895
|
+
git: summarizeRepoMeshDebugGit(node?.git)
|
|
23896
|
+
}))
|
|
23897
|
+
};
|
|
23898
|
+
}
|
|
23899
|
+
function logRepoMeshStatusDebug(event, fields) {
|
|
23900
|
+
try {
|
|
23901
|
+
LOG.info("MeshStatusDebug", `[RepoMeshStatusDebug] ${JSON.stringify({ event, ...fields })}`);
|
|
23902
|
+
} catch {
|
|
23903
|
+
LOG.info("MeshStatusDebug", `[RepoMeshStatusDebug] ${event}`);
|
|
23904
|
+
}
|
|
23905
|
+
}
|
|
23842
23906
|
function joinRepoPath(root, relativePath) {
|
|
23843
23907
|
const normalizedRoot = typeof root === "string" ? root.trim().replace(/[\\/]+$/, "") : "";
|
|
23844
23908
|
const normalizedPath = typeof relativePath === "string" ? relativePath.trim() : "";
|
|
@@ -26821,7 +26885,15 @@ ${block}`);
|
|
|
26821
26885
|
const refreshRequested = args?.refresh === true || args?.forceRefresh === true;
|
|
26822
26886
|
if (!refreshRequested) {
|
|
26823
26887
|
const cachedStatus = this.getCachedAggregateMeshStatus(meshId);
|
|
26824
|
-
if (cachedStatus)
|
|
26888
|
+
if (cachedStatus) {
|
|
26889
|
+
logRepoMeshStatusDebug("return_cached", {
|
|
26890
|
+
meshId,
|
|
26891
|
+
command: "mesh_status",
|
|
26892
|
+
refreshRequested,
|
|
26893
|
+
summary: summarizeRepoMeshStatusDebug(cachedStatus)
|
|
26894
|
+
});
|
|
26895
|
+
return cachedStatus;
|
|
26896
|
+
}
|
|
26825
26897
|
}
|
|
26826
26898
|
const refreshReason = refreshRequested ? "explicit_refresh" : "cold_cache_miss";
|
|
26827
26899
|
const { getMeshQueueStats: getMeshQueueStats2, getQueue: getQueue2 } = await Promise.resolve().then(() => (init_mesh_work_queue(), mesh_work_queue_exports));
|
|
@@ -26849,7 +26921,7 @@ ${block}`);
|
|
|
26849
26921
|
};
|
|
26850
26922
|
const directTruthSatisfied = meshRecord.source !== "inline_bootstrap" || directTruth.directEvidenceCount > 0;
|
|
26851
26923
|
if (requireDirectPeerTruth && !directTruthSatisfied) {
|
|
26852
|
-
|
|
26924
|
+
const failureResult = {
|
|
26853
26925
|
success: false,
|
|
26854
26926
|
code: "mesh_direct_peer_truth_unavailable",
|
|
26855
26927
|
error: "Selected coordinator could not confirm direct mesh truth yet. Bootstrap inventory stays unavailable until direct mesh_status probes succeed.",
|
|
@@ -26868,6 +26940,14 @@ ${block}`);
|
|
|
26868
26940
|
}
|
|
26869
26941
|
}
|
|
26870
26942
|
};
|
|
26943
|
+
logRepoMeshStatusDebug("direct_truth_unavailable", {
|
|
26944
|
+
meshId,
|
|
26945
|
+
command: "mesh_status",
|
|
26946
|
+
refreshRequested,
|
|
26947
|
+
meshSource: meshRecord.source,
|
|
26948
|
+
directTruth
|
|
26949
|
+
});
|
|
26950
|
+
return failureResult;
|
|
26871
26951
|
}
|
|
26872
26952
|
const directTruthUnavailableNodeIds = new Set(directTruth.unavailableNodeIds);
|
|
26873
26953
|
const selectedCoordinatorNodeId = readStringValue(
|
|
@@ -27075,7 +27155,17 @@ ${block}`);
|
|
|
27075
27155
|
queue: { tasks: queue, summary: queueSummary },
|
|
27076
27156
|
ledger: { entries: ledgerEntries, summary: ledgerSummary }
|
|
27077
27157
|
};
|
|
27078
|
-
|
|
27158
|
+
const rememberedStatus = this.rememberAggregateMeshStatus(meshId, statusResult, refreshReason);
|
|
27159
|
+
logRepoMeshStatusDebug("return_live", {
|
|
27160
|
+
meshId,
|
|
27161
|
+
command: "mesh_status",
|
|
27162
|
+
refreshRequested,
|
|
27163
|
+
refreshReason,
|
|
27164
|
+
meshSource: meshRecord.source,
|
|
27165
|
+
directTruth,
|
|
27166
|
+
summary: summarizeRepoMeshStatusDebug(rememberedStatus)
|
|
27167
|
+
});
|
|
27168
|
+
return rememberedStatus;
|
|
27079
27169
|
} catch (e) {
|
|
27080
27170
|
return { success: false, error: e.message };
|
|
27081
27171
|
}
|