adhdev 0.9.82-rc.46 → 0.9.82-rc.47
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 +74 -6
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +74 -6
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/cli/index.js
CHANGED
|
@@ -46760,6 +46760,21 @@ function normalizeInlineMeshGitStatus(status, node, options) {
|
|
|
46760
46760
|
...submodules ? { submodules } : {}
|
|
46761
46761
|
};
|
|
46762
46762
|
}
|
|
46763
|
+
function scoreInlineMeshGitStatus(git) {
|
|
46764
|
+
if (!git) return Number.NEGATIVE_INFINITY;
|
|
46765
|
+
let score = 0;
|
|
46766
|
+
if (readBooleanValue(git.isGitRepo) === true) score += 50;
|
|
46767
|
+
if (readBooleanValue(git.isGitRepo) === false) score -= 10;
|
|
46768
|
+
if (readStringValue(git.branch)) score += 20;
|
|
46769
|
+
if (readStringValue(git.headCommit)) score += 20;
|
|
46770
|
+
if (readStringValue(git.upstream)) score += 10;
|
|
46771
|
+
if (readStringValue(git.upstreamStatus)) score += 5;
|
|
46772
|
+
if (readNumberValue(git.ahead) !== void 0) score += 2;
|
|
46773
|
+
if (readNumberValue(git.behind) !== void 0) score += 2;
|
|
46774
|
+
if (Array.isArray(git.submodules) && git.submodules.length > 0) score += 4 + git.submodules.length;
|
|
46775
|
+
if (readStringValue(git.error)) score -= 20;
|
|
46776
|
+
return score;
|
|
46777
|
+
}
|
|
46763
46778
|
function buildInlineMeshTransitGitStatus(node) {
|
|
46764
46779
|
const rawGit = readObjectRecord(node?.lastGit ?? node?.last_git);
|
|
46765
46780
|
const gitResult = readObjectRecord(rawGit.result);
|
|
@@ -46771,11 +46786,36 @@ function buildInlineMeshTransitGitStatus(node) {
|
|
|
46771
46786
|
const probeDirectStatus = readObjectRecord(probeGit.status);
|
|
46772
46787
|
const probeNestedStatus = readObjectRecord(probeGitResult.status);
|
|
46773
46788
|
const candidates = [directStatus, nestedStatus, probeDirectStatus, probeNestedStatus];
|
|
46789
|
+
let best = null;
|
|
46774
46790
|
for (const status of candidates) {
|
|
46775
46791
|
const normalized = normalizeInlineMeshGitStatus(status, node, { lastCheckedAt: Date.now() });
|
|
46776
|
-
if (normalized)
|
|
46777
|
-
|
|
46778
|
-
|
|
46792
|
+
if (!normalized) continue;
|
|
46793
|
+
const score = scoreInlineMeshGitStatus(normalized);
|
|
46794
|
+
if (!best || score > best.score) best = { git: normalized, score };
|
|
46795
|
+
}
|
|
46796
|
+
return best?.git;
|
|
46797
|
+
}
|
|
46798
|
+
function shouldRefreshStalePendingAggregate(snapshot, options) {
|
|
46799
|
+
if (options?.requireDirectPeerTruth !== true || !Array.isArray(snapshot?.nodes)) return false;
|
|
46800
|
+
return snapshot.nodes.some((node) => {
|
|
46801
|
+
if (node?.gitProbePending !== true) return false;
|
|
46802
|
+
const git = readObjectRecord(node?.git);
|
|
46803
|
+
return !readBooleanValue(git.isGitRepo) && !readStringValue(git.branch, git.headCommit, git.upstream);
|
|
46804
|
+
});
|
|
46805
|
+
}
|
|
46806
|
+
function buildLivePeerGitConnection(connection, timestamp2 = (/* @__PURE__ */ new Date()).toISOString()) {
|
|
46807
|
+
const source = readStringValue(connection.source);
|
|
46808
|
+
const transport = readStringValue(connection.transport);
|
|
46809
|
+
return {
|
|
46810
|
+
...connection,
|
|
46811
|
+
perspective: readStringValue(connection.perspective) ?? "selected_coordinator",
|
|
46812
|
+
source: source && source !== "not_reported" ? source : "mesh_peer_status",
|
|
46813
|
+
state: "connected",
|
|
46814
|
+
transport: transport && transport !== "unknown" ? transport : "direct",
|
|
46815
|
+
reported: true,
|
|
46816
|
+
reason: "Live peer git snapshot reported by the selected coordinator.",
|
|
46817
|
+
lastStateChangeAt: readStringValue(connection.lastStateChangeAt) ?? timestamp2
|
|
46818
|
+
};
|
|
46779
46819
|
}
|
|
46780
46820
|
function recordInlineMeshDirectGitTruth(node, git, source) {
|
|
46781
46821
|
if (!node || typeof node !== "object" || Array.isArray(node)) return;
|
|
@@ -47706,8 +47746,16 @@ var init_router = __esm({
|
|
|
47706
47746
|
const nextStatus = { ...statusNode };
|
|
47707
47747
|
nextStatus.git = liveGit;
|
|
47708
47748
|
nextStatus.health = deriveMeshNodeHealthFromGit(liveGit);
|
|
47749
|
+
nextStatus.launchReady = readBooleanValue(nextStatus.launchReady) ?? true;
|
|
47750
|
+
const connection = readObjectRecord(nextStatus.connection);
|
|
47751
|
+
const connectionState = readStringValue(connection.state);
|
|
47752
|
+
const connectionReported = readBooleanValue(connection.reported) ?? false;
|
|
47753
|
+
if (!connectionReported || connectionState === "unknown") {
|
|
47754
|
+
nextStatus.connection = buildLivePeerGitConnection(connection);
|
|
47755
|
+
}
|
|
47709
47756
|
delete nextStatus.gitProbePending;
|
|
47710
|
-
|
|
47757
|
+
const error48 = readStringValue(nextStatus.error);
|
|
47758
|
+
if (error48 && /pending_git|git probe|live peer git snapshot|no peer git snapshot/i.test(error48)) delete nextStatus.error;
|
|
47711
47759
|
if (!readStringValue(nextStatus.machineStatus)) nextStatus.machineStatus = "online";
|
|
47712
47760
|
if (nodeId) unavailableNodeIds.delete(nodeId);
|
|
47713
47761
|
changed = true;
|
|
@@ -47744,6 +47792,7 @@ var init_router = __esm({
|
|
|
47744
47792
|
if (!cached2?.snapshot || cached2.snapshot.success !== true || !Array.isArray(cached2.snapshot.nodes)) return null;
|
|
47745
47793
|
let snapshot = this.cloneJsonValue(cached2.snapshot);
|
|
47746
47794
|
snapshot = this.hydrateCachedAggregateMeshStatusFromInline(snapshot, mesh, options);
|
|
47795
|
+
if (shouldRefreshStalePendingAggregate(snapshot, options)) return null;
|
|
47747
47796
|
const ageMs = Math.max(0, Date.now() - cached2.builtAt);
|
|
47748
47797
|
const sourceOfTruth = snapshot.sourceOfTruth && typeof snapshot.sourceOfTruth === "object" ? snapshot.sourceOfTruth : {};
|
|
47749
47798
|
snapshot.sourceOfTruth = {
|
|
@@ -49789,6 +49838,7 @@ ${block}`);
|
|
|
49789
49838
|
const mesh = meshRecord?.mesh;
|
|
49790
49839
|
if (!mesh) return { success: false, error: "Mesh not found" };
|
|
49791
49840
|
const refreshRequested = args?.refresh === true || args?.forceRefresh === true;
|
|
49841
|
+
const hadAggregateCache = this.aggregateMeshStatusCache.has(meshId);
|
|
49792
49842
|
if (!refreshRequested) {
|
|
49793
49843
|
const cachedStatus = this.getCachedAggregateMeshStatus(meshId, mesh, { requireDirectPeerTruth: args?.requireDirectPeerTruth === true });
|
|
49794
49844
|
if (cachedStatus) {
|
|
@@ -49801,7 +49851,7 @@ ${block}`);
|
|
|
49801
49851
|
return cachedStatus;
|
|
49802
49852
|
}
|
|
49803
49853
|
}
|
|
49804
|
-
const refreshReason = refreshRequested ? "explicit_refresh" : "cold_cache_miss";
|
|
49854
|
+
const refreshReason = refreshRequested ? "explicit_refresh" : hadAggregateCache ? "stale_pending_cache_refresh" : "cold_cache_miss";
|
|
49805
49855
|
const { getMeshQueueStats: getMeshQueueStats2, getQueue: getQueue2 } = await Promise.resolve().then(() => (init_mesh_work_queue(), mesh_work_queue_exports));
|
|
49806
49856
|
const queue = getQueue2(meshId);
|
|
49807
49857
|
const queueSummary = getMeshQueueStats2(meshId);
|
|
@@ -49952,6 +50002,12 @@ ${block}`);
|
|
|
49952
50002
|
if (inlineTransitGit) {
|
|
49953
50003
|
status.git = inlineTransitGit;
|
|
49954
50004
|
status.health = inlineTransitGit.isGitRepo ? deriveMeshNodeHealthFromGit(inlineTransitGit) : "degraded";
|
|
50005
|
+
const connection = readObjectRecord(status.connection);
|
|
50006
|
+
const connectionState = readStringValue(connection.state);
|
|
50007
|
+
const connectionReported = readBooleanValue(connection.reported) ?? false;
|
|
50008
|
+
if (!connectionReported || connectionState === "unknown") {
|
|
50009
|
+
status.connection = buildLivePeerGitConnection(connection, refreshedAt);
|
|
50010
|
+
}
|
|
49955
50011
|
remoteProbeApplied = true;
|
|
49956
50012
|
} else if (!isSelfNode && daemonId && this.deps.dispatchMeshCommand && !directTruthUnavailableNodeIds.has(nodeId)) {
|
|
49957
50013
|
try {
|
|
@@ -49964,6 +50020,12 @@ ${block}`);
|
|
|
49964
50020
|
if (remoteGit) {
|
|
49965
50021
|
status.git = remoteGit;
|
|
49966
50022
|
status.health = remoteGit.isGitRepo ? deriveMeshNodeHealthFromGit(remoteGit) : "degraded";
|
|
50023
|
+
const connection = readObjectRecord(status.connection);
|
|
50024
|
+
const connectionState = readStringValue(connection.state);
|
|
50025
|
+
const connectionReported = readBooleanValue(connection.reported) ?? false;
|
|
50026
|
+
if (!connectionReported || connectionState === "unknown") {
|
|
50027
|
+
status.connection = buildLivePeerGitConnection(connection, refreshedAt);
|
|
50028
|
+
}
|
|
49967
50029
|
recordInlineMeshDirectGitTruth(node, remoteGit, "selected_coordinator_mesh_p2p_git");
|
|
49968
50030
|
remoteProbeApplied = true;
|
|
49969
50031
|
}
|
|
@@ -49982,6 +50044,12 @@ ${block}`);
|
|
|
49982
50044
|
if (remoteGit) {
|
|
49983
50045
|
status.git = remoteGit;
|
|
49984
50046
|
status.health = remoteGit.isGitRepo ? deriveMeshNodeHealthFromGit(remoteGit) : "degraded";
|
|
50047
|
+
const connection = readObjectRecord(status.connection);
|
|
50048
|
+
const connectionState = readStringValue(connection.state);
|
|
50049
|
+
const connectionReported = readBooleanValue(connection.reported) ?? false;
|
|
50050
|
+
if (!connectionReported || connectionState === "unknown") {
|
|
50051
|
+
status.connection = buildLivePeerGitConnection(connection, refreshedAt);
|
|
50052
|
+
}
|
|
49985
50053
|
recordInlineMeshDirectGitTruth(node, remoteGit, "selected_coordinator_mesh_p2p_git");
|
|
49986
50054
|
remoteProbeApplied = true;
|
|
49987
50055
|
}
|
|
@@ -99308,7 +99376,7 @@ var init_adhdev_daemon = __esm({
|
|
|
99308
99376
|
init_version();
|
|
99309
99377
|
init_src();
|
|
99310
99378
|
init_runtime_defaults();
|
|
99311
|
-
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.82-rc.
|
|
99379
|
+
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.82-rc.47" });
|
|
99312
99380
|
AdhdevDaemon = class _AdhdevDaemon {
|
|
99313
99381
|
localHttpServer = null;
|
|
99314
99382
|
localWss = null;
|