@adhdev/daemon-standalone 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/index.js +73 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/public/assets/index-CYwXUKol.js +98 -0
- package/public/index.html +1 -1
package/dist/index.js
CHANGED
|
@@ -46174,6 +46174,21 @@ ${(0, import_node_path.resolve)(workspace || os17.tmpdir())}`;
|
|
|
46174
46174
|
...submodules ? { submodules } : {}
|
|
46175
46175
|
};
|
|
46176
46176
|
}
|
|
46177
|
+
function scoreInlineMeshGitStatus(git) {
|
|
46178
|
+
if (!git) return Number.NEGATIVE_INFINITY;
|
|
46179
|
+
let score = 0;
|
|
46180
|
+
if (readBooleanValue(git.isGitRepo) === true) score += 50;
|
|
46181
|
+
if (readBooleanValue(git.isGitRepo) === false) score -= 10;
|
|
46182
|
+
if (readStringValue(git.branch)) score += 20;
|
|
46183
|
+
if (readStringValue(git.headCommit)) score += 20;
|
|
46184
|
+
if (readStringValue(git.upstream)) score += 10;
|
|
46185
|
+
if (readStringValue(git.upstreamStatus)) score += 5;
|
|
46186
|
+
if (readNumberValue(git.ahead) !== void 0) score += 2;
|
|
46187
|
+
if (readNumberValue(git.behind) !== void 0) score += 2;
|
|
46188
|
+
if (Array.isArray(git.submodules) && git.submodules.length > 0) score += 4 + git.submodules.length;
|
|
46189
|
+
if (readStringValue(git.error)) score -= 20;
|
|
46190
|
+
return score;
|
|
46191
|
+
}
|
|
46177
46192
|
function buildInlineMeshTransitGitStatus(node) {
|
|
46178
46193
|
const rawGit = readObjectRecord(node?.lastGit ?? node?.last_git);
|
|
46179
46194
|
const gitResult = readObjectRecord(rawGit.result);
|
|
@@ -46185,11 +46200,36 @@ ${(0, import_node_path.resolve)(workspace || os17.tmpdir())}`;
|
|
|
46185
46200
|
const probeDirectStatus = readObjectRecord(probeGit.status);
|
|
46186
46201
|
const probeNestedStatus = readObjectRecord(probeGitResult.status);
|
|
46187
46202
|
const candidates = [directStatus, nestedStatus, probeDirectStatus, probeNestedStatus];
|
|
46203
|
+
let best = null;
|
|
46188
46204
|
for (const status of candidates) {
|
|
46189
46205
|
const normalized = normalizeInlineMeshGitStatus(status, node, { lastCheckedAt: Date.now() });
|
|
46190
|
-
if (normalized)
|
|
46191
|
-
|
|
46192
|
-
|
|
46206
|
+
if (!normalized) continue;
|
|
46207
|
+
const score = scoreInlineMeshGitStatus(normalized);
|
|
46208
|
+
if (!best || score > best.score) best = { git: normalized, score };
|
|
46209
|
+
}
|
|
46210
|
+
return best?.git;
|
|
46211
|
+
}
|
|
46212
|
+
function shouldRefreshStalePendingAggregate(snapshot, options) {
|
|
46213
|
+
if (options?.requireDirectPeerTruth !== true || !Array.isArray(snapshot?.nodes)) return false;
|
|
46214
|
+
return snapshot.nodes.some((node) => {
|
|
46215
|
+
if (node?.gitProbePending !== true) return false;
|
|
46216
|
+
const git = readObjectRecord(node?.git);
|
|
46217
|
+
return !readBooleanValue(git.isGitRepo) && !readStringValue(git.branch, git.headCommit, git.upstream);
|
|
46218
|
+
});
|
|
46219
|
+
}
|
|
46220
|
+
function buildLivePeerGitConnection(connection, timestamp = (/* @__PURE__ */ new Date()).toISOString()) {
|
|
46221
|
+
const source = readStringValue(connection.source);
|
|
46222
|
+
const transport = readStringValue(connection.transport);
|
|
46223
|
+
return {
|
|
46224
|
+
...connection,
|
|
46225
|
+
perspective: readStringValue(connection.perspective) ?? "selected_coordinator",
|
|
46226
|
+
source: source && source !== "not_reported" ? source : "mesh_peer_status",
|
|
46227
|
+
state: "connected",
|
|
46228
|
+
transport: transport && transport !== "unknown" ? transport : "direct",
|
|
46229
|
+
reported: true,
|
|
46230
|
+
reason: "Live peer git snapshot reported by the selected coordinator.",
|
|
46231
|
+
lastStateChangeAt: readStringValue(connection.lastStateChangeAt) ?? timestamp
|
|
46232
|
+
};
|
|
46193
46233
|
}
|
|
46194
46234
|
function recordInlineMeshDirectGitTruth(node, git, source) {
|
|
46195
46235
|
if (!node || typeof node !== "object" || Array.isArray(node)) return;
|
|
@@ -47083,8 +47123,16 @@ ${(0, import_node_path.resolve)(workspace || os17.tmpdir())}`;
|
|
|
47083
47123
|
const nextStatus = { ...statusNode };
|
|
47084
47124
|
nextStatus.git = liveGit;
|
|
47085
47125
|
nextStatus.health = deriveMeshNodeHealthFromGit(liveGit);
|
|
47126
|
+
nextStatus.launchReady = readBooleanValue(nextStatus.launchReady) ?? true;
|
|
47127
|
+
const connection = readObjectRecord(nextStatus.connection);
|
|
47128
|
+
const connectionState = readStringValue(connection.state);
|
|
47129
|
+
const connectionReported = readBooleanValue(connection.reported) ?? false;
|
|
47130
|
+
if (!connectionReported || connectionState === "unknown") {
|
|
47131
|
+
nextStatus.connection = buildLivePeerGitConnection(connection);
|
|
47132
|
+
}
|
|
47086
47133
|
delete nextStatus.gitProbePending;
|
|
47087
|
-
|
|
47134
|
+
const error48 = readStringValue(nextStatus.error);
|
|
47135
|
+
if (error48 && /pending_git|git probe|live peer git snapshot|no peer git snapshot/i.test(error48)) delete nextStatus.error;
|
|
47088
47136
|
if (!readStringValue(nextStatus.machineStatus)) nextStatus.machineStatus = "online";
|
|
47089
47137
|
if (nodeId) unavailableNodeIds.delete(nodeId);
|
|
47090
47138
|
changed = true;
|
|
@@ -47121,6 +47169,7 @@ ${(0, import_node_path.resolve)(workspace || os17.tmpdir())}`;
|
|
|
47121
47169
|
if (!cached2?.snapshot || cached2.snapshot.success !== true || !Array.isArray(cached2.snapshot.nodes)) return null;
|
|
47122
47170
|
let snapshot = this.cloneJsonValue(cached2.snapshot);
|
|
47123
47171
|
snapshot = this.hydrateCachedAggregateMeshStatusFromInline(snapshot, mesh, options);
|
|
47172
|
+
if (shouldRefreshStalePendingAggregate(snapshot, options)) return null;
|
|
47124
47173
|
const ageMs = Math.max(0, Date.now() - cached2.builtAt);
|
|
47125
47174
|
const sourceOfTruth = snapshot.sourceOfTruth && typeof snapshot.sourceOfTruth === "object" ? snapshot.sourceOfTruth : {};
|
|
47126
47175
|
snapshot.sourceOfTruth = {
|
|
@@ -49166,6 +49215,7 @@ ${block}`);
|
|
|
49166
49215
|
const mesh = meshRecord?.mesh;
|
|
49167
49216
|
if (!mesh) return { success: false, error: "Mesh not found" };
|
|
49168
49217
|
const refreshRequested = args?.refresh === true || args?.forceRefresh === true;
|
|
49218
|
+
const hadAggregateCache = this.aggregateMeshStatusCache.has(meshId);
|
|
49169
49219
|
if (!refreshRequested) {
|
|
49170
49220
|
const cachedStatus = this.getCachedAggregateMeshStatus(meshId, mesh, { requireDirectPeerTruth: args?.requireDirectPeerTruth === true });
|
|
49171
49221
|
if (cachedStatus) {
|
|
@@ -49178,7 +49228,7 @@ ${block}`);
|
|
|
49178
49228
|
return cachedStatus;
|
|
49179
49229
|
}
|
|
49180
49230
|
}
|
|
49181
|
-
const refreshReason = refreshRequested ? "explicit_refresh" : "cold_cache_miss";
|
|
49231
|
+
const refreshReason = refreshRequested ? "explicit_refresh" : hadAggregateCache ? "stale_pending_cache_refresh" : "cold_cache_miss";
|
|
49182
49232
|
const { getMeshQueueStats: getMeshQueueStats2, getQueue: getQueue2 } = await Promise.resolve().then(() => (init_mesh_work_queue(), mesh_work_queue_exports));
|
|
49183
49233
|
const queue = getQueue2(meshId);
|
|
49184
49234
|
const queueSummary = getMeshQueueStats2(meshId);
|
|
@@ -49329,6 +49379,12 @@ ${block}`);
|
|
|
49329
49379
|
if (inlineTransitGit) {
|
|
49330
49380
|
status.git = inlineTransitGit;
|
|
49331
49381
|
status.health = inlineTransitGit.isGitRepo ? deriveMeshNodeHealthFromGit(inlineTransitGit) : "degraded";
|
|
49382
|
+
const connection = readObjectRecord(status.connection);
|
|
49383
|
+
const connectionState = readStringValue(connection.state);
|
|
49384
|
+
const connectionReported = readBooleanValue(connection.reported) ?? false;
|
|
49385
|
+
if (!connectionReported || connectionState === "unknown") {
|
|
49386
|
+
status.connection = buildLivePeerGitConnection(connection, refreshedAt);
|
|
49387
|
+
}
|
|
49332
49388
|
remoteProbeApplied = true;
|
|
49333
49389
|
} else if (!isSelfNode && daemonId && this.deps.dispatchMeshCommand && !directTruthUnavailableNodeIds.has(nodeId)) {
|
|
49334
49390
|
try {
|
|
@@ -49341,6 +49397,12 @@ ${block}`);
|
|
|
49341
49397
|
if (remoteGit) {
|
|
49342
49398
|
status.git = remoteGit;
|
|
49343
49399
|
status.health = remoteGit.isGitRepo ? deriveMeshNodeHealthFromGit(remoteGit) : "degraded";
|
|
49400
|
+
const connection = readObjectRecord(status.connection);
|
|
49401
|
+
const connectionState = readStringValue(connection.state);
|
|
49402
|
+
const connectionReported = readBooleanValue(connection.reported) ?? false;
|
|
49403
|
+
if (!connectionReported || connectionState === "unknown") {
|
|
49404
|
+
status.connection = buildLivePeerGitConnection(connection, refreshedAt);
|
|
49405
|
+
}
|
|
49344
49406
|
recordInlineMeshDirectGitTruth(node, remoteGit, "selected_coordinator_mesh_p2p_git");
|
|
49345
49407
|
remoteProbeApplied = true;
|
|
49346
49408
|
}
|
|
@@ -49359,6 +49421,12 @@ ${block}`);
|
|
|
49359
49421
|
if (remoteGit) {
|
|
49360
49422
|
status.git = remoteGit;
|
|
49361
49423
|
status.health = remoteGit.isGitRepo ? deriveMeshNodeHealthFromGit(remoteGit) : "degraded";
|
|
49424
|
+
const connection = readObjectRecord(status.connection);
|
|
49425
|
+
const connectionState = readStringValue(connection.state);
|
|
49426
|
+
const connectionReported = readBooleanValue(connection.reported) ?? false;
|
|
49427
|
+
if (!connectionReported || connectionState === "unknown") {
|
|
49428
|
+
status.connection = buildLivePeerGitConnection(connection, refreshedAt);
|
|
49429
|
+
}
|
|
49362
49430
|
recordInlineMeshDirectGitTruth(node, remoteGit, "selected_coordinator_mesh_p2p_git");
|
|
49363
49431
|
remoteProbeApplied = true;
|
|
49364
49432
|
}
|