Discover Bifrost Eve surface by default

This commit is contained in:
Meta Vens 2026-06-04 20:59:16 +01:00
commit 2eb0b7397a
3 changed files with 36 additions and 5 deletions

View file

@ -26,9 +26,13 @@ function buildConfig(argv) {
.filter(Boolean);
const observationLogPath = args.observationLogPath || path.join(repoRoot, "..", "Mimir", "artifacts", "runtime", "periwinkle-cultmesh-sensors.out.log");
const observationFreshSeconds = Number(args.observationFreshSeconds || 120);
const defaultInterfaceBindingStores = [
path.join(repoRoot, "..", "VoidBot", ".voidbot", "status", "cultmesh", "voidbot-swarm-state.cc"),
path.join(repoRoot, "..", "Bifrost", ".bifrost", "provider-advertisement.cc"),
].join(",");
const interfaceBindingStores = String(
args.interfaceBindingStore ||
path.join(repoRoot, "..", "VoidBot", ".voidbot", "status", "cultmesh", "voidbot-swarm-state.cc"),
defaultInterfaceBindingStores,
)
.split(",")
.map((entry) => entry.trim())

View file

@ -139,16 +139,17 @@ function createInterfaceDiscovery({
continue;
}
const state = node.get(surfaceDefinition, binding.providerId);
const surface = state?.surface || binding.surface || null;
interfaces.push({
providerId: binding.providerId,
title: binding.title || state?.title || binding.providerId,
state: "active",
detail: `${state?.surface?.root?.kind || binding.kind || "surface"} ${state?.nodes?.length || 0} nodes via CultMesh`,
detail: `${surface?.root?.kind || binding.kind || "surface"} ${countSurfaceNodes(surface, state)} nodes via CultMesh`,
version: state?.version || 0,
updatedAt: state?.updatedAt || binding.updatedAt || new Date().toISOString(),
source: `cultmesh:${storePath}`,
manifest: binding.provider || null,
surface: state?.surface || binding.surface || null,
surface,
});
}
} catch (error) {
@ -209,7 +210,7 @@ async function fetchEveProvider(url, providerId, manifest = null) {
providerId,
title: state.title || manifest?.title || providerId,
state: "active",
detail: `${surface?.root?.kind || "surface"} ${state.nodes?.length || 0} nodes`,
detail: `${surface?.root?.kind || "surface"} ${countSurfaceNodes(surface, state)} nodes`,
version: state.version,
updatedAt: state.updatedAt,
source: url,
@ -241,6 +242,31 @@ function dashboardUnavailable(providerId, source, detail) {
};
}
function countSurfaceNodes(surface, state = null) {
if (Array.isArray(state?.nodes)) {
return state.nodes.length;
}
if (!surface?.root) {
return 0;
}
let count = 0;
const stack = [surface.root];
while (stack.length > 0) {
const node = stack.pop();
if (!node || typeof node !== "object") {
continue;
}
count += 1;
if (Array.isArray(node.children)) {
for (const child of node.children) {
stack.push(child);
}
}
}
return count;
}
function legacySurfaceFromNodes(state, manifest = null) {
const nodes = Array.isArray(state?.nodes) ? state.nodes : [];
if (!nodes.length) {

View file

@ -34,7 +34,8 @@ function buildSurface({ observedAt, docker, adb, hosts, yggdrasilServices, verse
id: `interface-${stableId(entry.providerId)}`,
kind: "interface",
props: {
title: verseUri(entry),
title: entry.title || entry.providerId,
verseUri: verseUri(entry),
providerId: entry.providerId,
source: entry.source,
status: entry.state,