@adhdev/daemon-standalone 0.9.82-rc.43 → 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/index.js +170 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/public/assets/index-phY3RKNC.js +98 -0
- package/public/index.html +1 -1
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() : "";
|
|
@@ -46120,8 +46184,12 @@ ${(0, import_node_path.resolve)(workspace || os17.tmpdir())}`;
|
|
|
46120
46184
|
const probeGitResult = readObjectRecord(probeGit.result);
|
|
46121
46185
|
const probeDirectStatus = readObjectRecord(probeGit.status);
|
|
46122
46186
|
const probeNestedStatus = readObjectRecord(probeGitResult.status);
|
|
46123
|
-
const
|
|
46124
|
-
|
|
46187
|
+
const candidates = [directStatus, nestedStatus, probeDirectStatus, probeNestedStatus];
|
|
46188
|
+
for (const status of candidates) {
|
|
46189
|
+
const normalized = normalizeInlineMeshGitStatus(status, node, { lastCheckedAt: Date.now() });
|
|
46190
|
+
if (normalized) return normalized;
|
|
46191
|
+
}
|
|
46192
|
+
return void 0;
|
|
46125
46193
|
}
|
|
46126
46194
|
function recordInlineMeshDirectGitTruth(node, git, source) {
|
|
46127
46195
|
if (!node || typeof node !== "object" || Array.isArray(node)) return;
|
|
@@ -46990,10 +47058,69 @@ ${(0, import_node_path.resolve)(workspace || os17.tmpdir())}`;
|
|
|
46990
47058
|
if (typeof structuredClone === "function") return structuredClone(value);
|
|
46991
47059
|
return JSON.parse(JSON.stringify(value));
|
|
46992
47060
|
}
|
|
46993
|
-
|
|
47061
|
+
hydrateCachedAggregateMeshStatusFromInline(snapshot, mesh, options) {
|
|
47062
|
+
if (!mesh || typeof mesh !== "object" || !Array.isArray(mesh.nodes) || !Array.isArray(snapshot?.nodes)) return snapshot;
|
|
47063
|
+
const inlineNodesById = /* @__PURE__ */ new Map();
|
|
47064
|
+
for (const node of mesh.nodes) {
|
|
47065
|
+
const nodeId = readInlineMeshNodeId(node);
|
|
47066
|
+
if (nodeId) inlineNodesById.set(nodeId, node);
|
|
47067
|
+
}
|
|
47068
|
+
if (!inlineNodesById.size) return snapshot;
|
|
47069
|
+
let changed = false;
|
|
47070
|
+
const unavailableNodeIds = /* @__PURE__ */ new Set();
|
|
47071
|
+
const sourceOfTruth = readObjectRecord(snapshot.sourceOfTruth);
|
|
47072
|
+
const directPeerTruth = readObjectRecord(sourceOfTruth.directPeerTruth);
|
|
47073
|
+
for (const entry of Array.isArray(directPeerTruth.unavailableNodeIds) ? directPeerTruth.unavailableNodeIds : []) {
|
|
47074
|
+
const nodeId = readStringValue(entry);
|
|
47075
|
+
if (nodeId) unavailableNodeIds.add(nodeId);
|
|
47076
|
+
}
|
|
47077
|
+
const nodes = snapshot.nodes.map((statusNode) => {
|
|
47078
|
+
const nodeId = readStringValue(statusNode?.nodeId, statusNode?.id);
|
|
47079
|
+
const inlineNode = nodeId ? inlineNodesById.get(nodeId) : void 0;
|
|
47080
|
+
if (!inlineNode) return statusNode;
|
|
47081
|
+
const liveGit = buildInlineMeshTransitGitStatus(inlineNode);
|
|
47082
|
+
if (!liveGit) return statusNode;
|
|
47083
|
+
const nextStatus = { ...statusNode };
|
|
47084
|
+
nextStatus.git = liveGit;
|
|
47085
|
+
nextStatus.health = deriveMeshNodeHealthFromGit(liveGit);
|
|
47086
|
+
delete nextStatus.gitProbePending;
|
|
47087
|
+
if (readStringValue(nextStatus.error) === "waiting for live peer git snapshot") delete nextStatus.error;
|
|
47088
|
+
if (!readStringValue(nextStatus.machineStatus)) nextStatus.machineStatus = "online";
|
|
47089
|
+
if (nodeId) unavailableNodeIds.delete(nodeId);
|
|
47090
|
+
changed = true;
|
|
47091
|
+
return nextStatus;
|
|
47092
|
+
});
|
|
47093
|
+
if (!changed && !(options?.requireDirectPeerTruth && unavailableNodeIds.size > 0)) return snapshot;
|
|
47094
|
+
const nextSourceOfTruth = {
|
|
47095
|
+
...sourceOfTruth,
|
|
47096
|
+
...Object.keys(directPeerTruth).length ? {
|
|
47097
|
+
directPeerTruth: {
|
|
47098
|
+
...directPeerTruth,
|
|
47099
|
+
satisfied: options?.requireDirectPeerTruth === true ? unavailableNodeIds.size === 0 : directPeerTruth.satisfied,
|
|
47100
|
+
unavailableNodeIds: [...unavailableNodeIds]
|
|
47101
|
+
},
|
|
47102
|
+
...options?.requireDirectPeerTruth === true ? {
|
|
47103
|
+
coordinatorOwnsLiveTruth: unavailableNodeIds.size === 0,
|
|
47104
|
+
currentStatus: unavailableNodeIds.size === 0 ? "live_git_and_session_probes" : "direct_peer_truth_unavailable"
|
|
47105
|
+
} : {}
|
|
47106
|
+
} : {}
|
|
47107
|
+
};
|
|
47108
|
+
return {
|
|
47109
|
+
...snapshot,
|
|
47110
|
+
...options?.requireDirectPeerTruth === true && unavailableNodeIds.size > 0 ? {
|
|
47111
|
+
success: false,
|
|
47112
|
+
code: "mesh_direct_peer_truth_unavailable",
|
|
47113
|
+
error: "Selected coordinator could not confirm direct mesh truth for every remote node yet."
|
|
47114
|
+
} : {},
|
|
47115
|
+
sourceOfTruth: nextSourceOfTruth,
|
|
47116
|
+
nodes
|
|
47117
|
+
};
|
|
47118
|
+
}
|
|
47119
|
+
getCachedAggregateMeshStatus(meshId, mesh, options) {
|
|
46994
47120
|
const cached2 = this.aggregateMeshStatusCache.get(meshId);
|
|
46995
47121
|
if (!cached2?.snapshot || cached2.snapshot.success !== true || !Array.isArray(cached2.snapshot.nodes)) return null;
|
|
46996
|
-
|
|
47122
|
+
let snapshot = this.cloneJsonValue(cached2.snapshot);
|
|
47123
|
+
snapshot = this.hydrateCachedAggregateMeshStatusFromInline(snapshot, mesh, options);
|
|
46997
47124
|
const ageMs = Math.max(0, Date.now() - cached2.builtAt);
|
|
46998
47125
|
const sourceOfTruth = snapshot.sourceOfTruth && typeof snapshot.sourceOfTruth === "object" ? snapshot.sourceOfTruth : {};
|
|
46999
47126
|
snapshot.sourceOfTruth = {
|
|
@@ -47053,7 +47180,14 @@ ${(0, import_node_path.resolve)(workspace || os17.tmpdir())}`;
|
|
|
47053
47180
|
const preferInline = options?.preferInline === true;
|
|
47054
47181
|
if (preferInline) {
|
|
47055
47182
|
const cached22 = this.getCachedInlineMesh(meshId);
|
|
47056
|
-
if (cached22)
|
|
47183
|
+
if (cached22) {
|
|
47184
|
+
if (inlineMeshCarriesTransientNodeTruth(inlineMesh)) {
|
|
47185
|
+
const merged = reconcileInlineMeshCache(cached22, inlineMesh);
|
|
47186
|
+
this.inlineMeshCache.set(meshId, sanitizeInlineMesh(merged));
|
|
47187
|
+
return { mesh: merged, inline: true, source: "inline_cache" };
|
|
47188
|
+
}
|
|
47189
|
+
return { mesh: cached22, inline: true, source: "inline_cache" };
|
|
47190
|
+
}
|
|
47057
47191
|
if (inlineMeshCarriesTransientNodeTruth(inlineMesh)) {
|
|
47058
47192
|
this.warmInlineMeshCache(meshId, inlineMesh);
|
|
47059
47193
|
return { mesh: inlineMesh, inline: true, source: "inline_bootstrap" };
|
|
@@ -49033,8 +49167,16 @@ ${block}`);
|
|
|
49033
49167
|
if (!mesh) return { success: false, error: "Mesh not found" };
|
|
49034
49168
|
const refreshRequested = args?.refresh === true || args?.forceRefresh === true;
|
|
49035
49169
|
if (!refreshRequested) {
|
|
49036
|
-
const cachedStatus = this.getCachedAggregateMeshStatus(meshId);
|
|
49037
|
-
if (cachedStatus)
|
|
49170
|
+
const cachedStatus = this.getCachedAggregateMeshStatus(meshId, mesh, { requireDirectPeerTruth: args?.requireDirectPeerTruth === true });
|
|
49171
|
+
if (cachedStatus) {
|
|
49172
|
+
logRepoMeshStatusDebug("return_cached", {
|
|
49173
|
+
meshId,
|
|
49174
|
+
command: "mesh_status",
|
|
49175
|
+
refreshRequested,
|
|
49176
|
+
summary: summarizeRepoMeshStatusDebug(cachedStatus)
|
|
49177
|
+
});
|
|
49178
|
+
return cachedStatus;
|
|
49179
|
+
}
|
|
49038
49180
|
}
|
|
49039
49181
|
const refreshReason = refreshRequested ? "explicit_refresh" : "cold_cache_miss";
|
|
49040
49182
|
const { getMeshQueueStats: getMeshQueueStats2, getQueue: getQueue2 } = await Promise.resolve().then(() => (init_mesh_work_queue(), mesh_work_queue_exports));
|
|
@@ -49060,9 +49202,9 @@ ${block}`);
|
|
|
49060
49202
|
peerConfirmedCount: 0,
|
|
49061
49203
|
unavailableNodeIds: []
|
|
49062
49204
|
};
|
|
49063
|
-
const directTruthSatisfied =
|
|
49205
|
+
const directTruthSatisfied = !requireDirectPeerTruth || directTruth.directEvidenceCount > 0 && directTruth.unavailableNodeIds.length === 0;
|
|
49064
49206
|
if (requireDirectPeerTruth && !directTruthSatisfied) {
|
|
49065
|
-
|
|
49207
|
+
const failureResult = {
|
|
49066
49208
|
success: false,
|
|
49067
49209
|
code: "mesh_direct_peer_truth_unavailable",
|
|
49068
49210
|
error: "Selected coordinator could not confirm direct mesh truth yet. Bootstrap inventory stays unavailable until direct mesh_status probes succeed.",
|
|
@@ -49081,6 +49223,14 @@ ${block}`);
|
|
|
49081
49223
|
}
|
|
49082
49224
|
}
|
|
49083
49225
|
};
|
|
49226
|
+
logRepoMeshStatusDebug("direct_truth_unavailable", {
|
|
49227
|
+
meshId,
|
|
49228
|
+
command: "mesh_status",
|
|
49229
|
+
refreshRequested,
|
|
49230
|
+
meshSource: meshRecord.source,
|
|
49231
|
+
directTruth
|
|
49232
|
+
});
|
|
49233
|
+
return failureResult;
|
|
49084
49234
|
}
|
|
49085
49235
|
const directTruthUnavailableNodeIds = new Set(directTruth.unavailableNodeIds);
|
|
49086
49236
|
const selectedCoordinatorNodeId = readStringValue(
|
|
@@ -49288,7 +49438,17 @@ ${block}`);
|
|
|
49288
49438
|
queue: { tasks: queue, summary: queueSummary },
|
|
49289
49439
|
ledger: { entries: ledgerEntries, summary: ledgerSummary }
|
|
49290
49440
|
};
|
|
49291
|
-
|
|
49441
|
+
const rememberedStatus = this.rememberAggregateMeshStatus(meshId, statusResult, refreshReason);
|
|
49442
|
+
logRepoMeshStatusDebug("return_live", {
|
|
49443
|
+
meshId,
|
|
49444
|
+
command: "mesh_status",
|
|
49445
|
+
refreshRequested,
|
|
49446
|
+
refreshReason,
|
|
49447
|
+
meshSource: meshRecord.source,
|
|
49448
|
+
directTruth,
|
|
49449
|
+
summary: summarizeRepoMeshStatusDebug(rememberedStatus)
|
|
49450
|
+
});
|
|
49451
|
+
return rememberedStatus;
|
|
49292
49452
|
} catch (e) {
|
|
49293
49453
|
return { success: false, error: e.message };
|
|
49294
49454
|
}
|