Scanning ${escapeHtml(RELAYS_ROOT)}…
`; if (listing.kind === "unavailable") return renderErrorState("Could not scan workspace relays.", listing.detail); if (listing.kind === "missing" || listing.relays.length === 0) return renderEmptyState(); return this.renderSelectedRelay(); } private renderSelectedRelay(): string { const documents = this.documents; if (documents === undefined) return `Loading relay documents…
`; if (documents.kind === "unavailable") return renderErrorState("Could not list this relay's documents.", documents.detail); if (documents.kind === "missing") { return `Click Refresh to rescan ${escapeHtml(RELAYS_ROOT)}.
Relay packets usually contain status.md, charter.md, and log.md.
Select a document.
`; if (content === undefined) return `Loading ${escapeHtml(documentName(documentPath))}…
`; if (content.kind === "unavailable") return renderErrorState("Could not read this document.", content.detail); if (content.kind === "missing") { return `Click Refresh to rescan the relay.
Binary documents have no text preview.
${escapeHtml(content.content)}`;
}
}
/** Shell regions come from a literal template; absence means the template broke. */
function requiredRegion(root: ShadowRoot, selector: string): HTMLElement {
const element = root.querySelector(selector);
if (!(element instanceof HTMLElement)) throw new Error(`relays panel shell is missing ${selector}`);
return element;
}
/** Reload glyph matching the app's own refresh control (AppRefreshControl). */
function refreshIconSvg(): string {
return `
`;
}
function contextKey(context: WorkspacePanelContext): string {
return `${context.machine.id}:${context.workspace.projectId}:${context.workspace.id}`;
}
function documentName(path: string): string {
return path.slice(path.lastIndexOf("/") + 1);
}
function renderEmptyState(): string {
return `
Relay packets live in ${escapeHtml(RELAYS_ROOT)}/<name>/. This workspace has none yet.
${escapeHtml(detail)}