adhdev 0.9.82-rc.44 → 0.9.82-rc.45
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/cli/index.js +78 -8
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +78 -8
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -45782,8 +45782,12 @@ function buildInlineMeshTransitGitStatus(node) {
|
|
|
45782
45782
|
const probeGitResult = readObjectRecord(probeGit.result);
|
|
45783
45783
|
const probeDirectStatus = readObjectRecord(probeGit.status);
|
|
45784
45784
|
const probeNestedStatus = readObjectRecord(probeGitResult.status);
|
|
45785
|
-
const
|
|
45786
|
-
|
|
45785
|
+
const candidates = [directStatus, nestedStatus, probeDirectStatus, probeNestedStatus];
|
|
45786
|
+
for (const status of candidates) {
|
|
45787
|
+
const normalized = normalizeInlineMeshGitStatus(status, node, { lastCheckedAt: Date.now() });
|
|
45788
|
+
if (normalized) return normalized;
|
|
45789
|
+
}
|
|
45790
|
+
return void 0;
|
|
45787
45791
|
}
|
|
45788
45792
|
function recordInlineMeshDirectGitTruth(node, git, source) {
|
|
45789
45793
|
if (!node || typeof node !== "object" || Array.isArray(node)) return;
|
|
@@ -46689,10 +46693,69 @@ var init_router = __esm({
|
|
|
46689
46693
|
if (typeof structuredClone === "function") return structuredClone(value);
|
|
46690
46694
|
return JSON.parse(JSON.stringify(value));
|
|
46691
46695
|
}
|
|
46692
|
-
|
|
46696
|
+
hydrateCachedAggregateMeshStatusFromInline(snapshot, mesh, options) {
|
|
46697
|
+
if (!mesh || typeof mesh !== "object" || !Array.isArray(mesh.nodes) || !Array.isArray(snapshot?.nodes)) return snapshot;
|
|
46698
|
+
const inlineNodesById = /* @__PURE__ */ new Map();
|
|
46699
|
+
for (const node of mesh.nodes) {
|
|
46700
|
+
const nodeId = readInlineMeshNodeId(node);
|
|
46701
|
+
if (nodeId) inlineNodesById.set(nodeId, node);
|
|
46702
|
+
}
|
|
46703
|
+
if (!inlineNodesById.size) return snapshot;
|
|
46704
|
+
let changed = false;
|
|
46705
|
+
const unavailableNodeIds = /* @__PURE__ */ new Set();
|
|
46706
|
+
const sourceOfTruth = readObjectRecord(snapshot.sourceOfTruth);
|
|
46707
|
+
const directPeerTruth = readObjectRecord(sourceOfTruth.directPeerTruth);
|
|
46708
|
+
for (const entry of Array.isArray(directPeerTruth.unavailableNodeIds) ? directPeerTruth.unavailableNodeIds : []) {
|
|
46709
|
+
const nodeId = readStringValue(entry);
|
|
46710
|
+
if (nodeId) unavailableNodeIds.add(nodeId);
|
|
46711
|
+
}
|
|
46712
|
+
const nodes = snapshot.nodes.map((statusNode) => {
|
|
46713
|
+
const nodeId = readStringValue(statusNode?.nodeId, statusNode?.id);
|
|
46714
|
+
const inlineNode = nodeId ? inlineNodesById.get(nodeId) : void 0;
|
|
46715
|
+
if (!inlineNode) return statusNode;
|
|
46716
|
+
const liveGit = buildInlineMeshTransitGitStatus(inlineNode);
|
|
46717
|
+
if (!liveGit) return statusNode;
|
|
46718
|
+
const nextStatus = { ...statusNode };
|
|
46719
|
+
nextStatus.git = liveGit;
|
|
46720
|
+
nextStatus.health = deriveMeshNodeHealthFromGit(liveGit);
|
|
46721
|
+
delete nextStatus.gitProbePending;
|
|
46722
|
+
if (readStringValue(nextStatus.error) === "waiting for live peer git snapshot") delete nextStatus.error;
|
|
46723
|
+
if (!readStringValue(nextStatus.machineStatus)) nextStatus.machineStatus = "online";
|
|
46724
|
+
if (nodeId) unavailableNodeIds.delete(nodeId);
|
|
46725
|
+
changed = true;
|
|
46726
|
+
return nextStatus;
|
|
46727
|
+
});
|
|
46728
|
+
if (!changed && !(options?.requireDirectPeerTruth && unavailableNodeIds.size > 0)) return snapshot;
|
|
46729
|
+
const nextSourceOfTruth = {
|
|
46730
|
+
...sourceOfTruth,
|
|
46731
|
+
...Object.keys(directPeerTruth).length ? {
|
|
46732
|
+
directPeerTruth: {
|
|
46733
|
+
...directPeerTruth,
|
|
46734
|
+
satisfied: options?.requireDirectPeerTruth === true ? unavailableNodeIds.size === 0 : directPeerTruth.satisfied,
|
|
46735
|
+
unavailableNodeIds: [...unavailableNodeIds]
|
|
46736
|
+
},
|
|
46737
|
+
...options?.requireDirectPeerTruth === true ? {
|
|
46738
|
+
coordinatorOwnsLiveTruth: unavailableNodeIds.size === 0,
|
|
46739
|
+
currentStatus: unavailableNodeIds.size === 0 ? "live_git_and_session_probes" : "direct_peer_truth_unavailable"
|
|
46740
|
+
} : {}
|
|
46741
|
+
} : {}
|
|
46742
|
+
};
|
|
46743
|
+
return {
|
|
46744
|
+
...snapshot,
|
|
46745
|
+
...options?.requireDirectPeerTruth === true && unavailableNodeIds.size > 0 ? {
|
|
46746
|
+
success: false,
|
|
46747
|
+
code: "mesh_direct_peer_truth_unavailable",
|
|
46748
|
+
error: "Selected coordinator could not confirm direct mesh truth for every remote node yet."
|
|
46749
|
+
} : {},
|
|
46750
|
+
sourceOfTruth: nextSourceOfTruth,
|
|
46751
|
+
nodes
|
|
46752
|
+
};
|
|
46753
|
+
}
|
|
46754
|
+
getCachedAggregateMeshStatus(meshId, mesh, options) {
|
|
46693
46755
|
const cached2 = this.aggregateMeshStatusCache.get(meshId);
|
|
46694
46756
|
if (!cached2?.snapshot || cached2.snapshot.success !== true || !Array.isArray(cached2.snapshot.nodes)) return null;
|
|
46695
|
-
|
|
46757
|
+
let snapshot = this.cloneJsonValue(cached2.snapshot);
|
|
46758
|
+
snapshot = this.hydrateCachedAggregateMeshStatusFromInline(snapshot, mesh, options);
|
|
46696
46759
|
const ageMs = Math.max(0, Date.now() - cached2.builtAt);
|
|
46697
46760
|
const sourceOfTruth = snapshot.sourceOfTruth && typeof snapshot.sourceOfTruth === "object" ? snapshot.sourceOfTruth : {};
|
|
46698
46761
|
snapshot.sourceOfTruth = {
|
|
@@ -46752,7 +46815,14 @@ var init_router = __esm({
|
|
|
46752
46815
|
const preferInline = options?.preferInline === true;
|
|
46753
46816
|
if (preferInline) {
|
|
46754
46817
|
const cached3 = this.getCachedInlineMesh(meshId);
|
|
46755
|
-
if (cached3)
|
|
46818
|
+
if (cached3) {
|
|
46819
|
+
if (inlineMeshCarriesTransientNodeTruth(inlineMesh)) {
|
|
46820
|
+
const merged = reconcileInlineMeshCache(cached3, inlineMesh);
|
|
46821
|
+
this.inlineMeshCache.set(meshId, sanitizeInlineMesh(merged));
|
|
46822
|
+
return { mesh: merged, inline: true, source: "inline_cache" };
|
|
46823
|
+
}
|
|
46824
|
+
return { mesh: cached3, inline: true, source: "inline_cache" };
|
|
46825
|
+
}
|
|
46756
46826
|
if (inlineMeshCarriesTransientNodeTruth(inlineMesh)) {
|
|
46757
46827
|
this.warmInlineMeshCache(meshId, inlineMesh);
|
|
46758
46828
|
return { mesh: inlineMesh, inline: true, source: "inline_bootstrap" };
|
|
@@ -48732,7 +48802,7 @@ ${block}`);
|
|
|
48732
48802
|
if (!mesh) return { success: false, error: "Mesh not found" };
|
|
48733
48803
|
const refreshRequested = args?.refresh === true || args?.forceRefresh === true;
|
|
48734
48804
|
if (!refreshRequested) {
|
|
48735
|
-
const cachedStatus = this.getCachedAggregateMeshStatus(meshId);
|
|
48805
|
+
const cachedStatus = this.getCachedAggregateMeshStatus(meshId, mesh, { requireDirectPeerTruth: args?.requireDirectPeerTruth === true });
|
|
48736
48806
|
if (cachedStatus) {
|
|
48737
48807
|
logRepoMeshStatusDebug("return_cached", {
|
|
48738
48808
|
meshId,
|
|
@@ -48767,7 +48837,7 @@ ${block}`);
|
|
|
48767
48837
|
peerConfirmedCount: 0,
|
|
48768
48838
|
unavailableNodeIds: []
|
|
48769
48839
|
};
|
|
48770
|
-
const directTruthSatisfied =
|
|
48840
|
+
const directTruthSatisfied = !requireDirectPeerTruth || directTruth.directEvidenceCount > 0 && directTruth.unavailableNodeIds.length === 0;
|
|
48771
48841
|
if (requireDirectPeerTruth && !directTruthSatisfied) {
|
|
48772
48842
|
const failureResult = {
|
|
48773
48843
|
success: false,
|
|
@@ -68066,7 +68136,7 @@ var init_adhdev_daemon = __esm({
|
|
|
68066
68136
|
init_version();
|
|
68067
68137
|
init_src();
|
|
68068
68138
|
init_runtime_defaults();
|
|
68069
|
-
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.82-rc.
|
|
68139
|
+
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.82-rc.45" });
|
|
68070
68140
|
AdhdevDaemon = class _AdhdevDaemon {
|
|
68071
68141
|
localHttpServer = null;
|
|
68072
68142
|
localWss = null;
|