import type { KnowledgeSnapshots } from "../../shared/knowledge-runtime";
/** Renders one applicable knowledge block or null when both files are absent. */
export function renderKnowledgeBlock(
snapshots: KnowledgeSnapshots,
): string | null {
if (snapshots.global === null && snapshots.local === null) {
return null;
}
const sections = [
...(snapshots.global === null
? []
: ["", snapshots.global, ""]),
...(snapshots.local === null
? []
: ["", snapshots.local, ""]),
];
return ["", ...sections, ""].join("\n");
}