"use client"; import { useCallback, useEffect, useMemo, useState } from "react"; interface ReliabilityState { mode: string; phase: string; turnCount: number; toolCalls: number; blockedCalls: number; approvedCalls: number; failedCalls: number; lastRisk: string; } interface Snapshot { generatedAt: string; projectRoot: string; doctor: { ok: boolean; checks: Array<{ name: string; status: boolean; detail?: string }> } | null; dashboard: { health: { ok: boolean; failing: string[]; checks: number }; reliability: { mode: string; traceDir: string; approvals: { highRiskBash: boolean; externalEditPolicy: string } } | null; gates: { ok: boolean; enabled: boolean; failing: string[]; checks: number }; subagents: { enabled: boolean; maxConcurrent: number; persistence: boolean; isolation: boolean } | null; memory: { enabled: boolean; rootDir: string; autoRecall: boolean } | null; evaluation: { enabled: boolean; attempts: number; successRate: number | null; candidates: number } | null; memoryGovernance: { enabled: boolean; auditLog: { exists: boolean; bytes: number } } | null; protocols: { lsp: { status: string }; dap: { status: string } } | null; runtimeFiles: { protocolTrace: { exists: boolean; bytes: number }; subagentEvents: { exists: boolean; bytes: number } }; } | null; reliability: { sessionFile: string; state: ReliabilityState } | null; eval: EvalStats | { error: string } | null; harbor: HarborData | { error: string } | null; costs: { totalTokens: number; totalCostUsd: number; byModel: Array<{ provider: string; model: string; tokens: number; costUsd: number; sessions: number }>; bySession: Array<{ session: string; modifiedAt: string; tokens: number; costUsd: number }>; } | null; memoryBridge: { ok: boolean; version?: string; rootDir?: string; error?: string } | null; traces: { total: number; byEvent: Record; failureEvents: number; recentEvents: Array<{ timestamp: string; event: string; phase: string | null; toolName: string | null; risk: string | null; chars: number | null; error: string | null; detail: unknown; }>; }; } interface TraceEvent { timestamp?: string; event?: string; sessionId?: string; phase?: string | null; toolName?: string | null; risk?: string | null; error?: string | null; [key: string]: unknown; } interface FileEntry { path: string; exists: boolean; bytes: number; modifiedAt: string | null; kind: "runtime" | "session"; } interface FileContent { path: string; totalLines: number; offset: number; limit: number; lines: Array<{ n: number; text: string }>; } interface EvalStats { attempts: number; successes: number; failures: number; unknowns: number; successRate: number | null; decisions: unknown[]; matrix: EvalMatrixRow[]; } interface HarborData { budget: { equaxis?: Record; pi_control?: Record; gain?: Record; } | null; cycle: { cycleDir?: string; cycleId?: string; generatedAt?: string; diagnosis?: Record; hypotheses?: unknown[]; experiments?: unknown[]; decisions?: unknown[]; nextIterationFocus?: unknown[]; } | null; } function rateClass(rate: number | null): string { if (rate == null) return "na"; if (rate >= 0.9) return "ok"; if (rate >= 0.6) return "warn"; return "bad"; } const PAGE_SIZE = 100; const FILE_PAGE_SIZE = 200; interface EvalMatrixRow { provider: string; model: string; tool: string; capabilities: string[]; attempts: number; successes: number; failures: number; unknowns: number; successRate: number | null; averageLatencyMs: number | null; averageInputTokens: number | null; averageOutputTokens: number | null; averageCostUsd: number | null; errorCodes: Record; } const EVAL_COLUMNS: Array<{ key: string; label: string; value: (row: EvalMatrixRow) => number | string | null }> = [ { key: "model", label: "Provider / Model", value: (row) => `${row.provider}/${row.model}` }, { key: "tool", label: "Tool", value: (row) => row.tool }, { key: "caps", label: "Capabilities", value: (row) => row.capabilities.join(", ") }, { key: "attempts", label: "Attempts", value: (row) => row.attempts }, { key: "rate", label: "Rate", value: (row) => row.successRate }, { key: "fail", label: "Fail", value: (row) => row.failures }, { key: "latency", label: "Latency", value: (row) => row.averageLatencyMs }, { key: "tokens", label: "In/Out tokens", value: (row) => row.averageInputTokens }, { key: "cost", label: "Cost", value: (row) => row.averageCostUsd }, { key: "errors", label: "Errors", value: (row) => Object.keys(row.errorCodes).length } ]; function formatBytes(bytes: number): string { if (bytes >= 1_000_000) return `${(bytes / 1_000_000).toFixed(1)} MB`; if (bytes >= 1_000) return `${(bytes / 1_000).toFixed(1)} KB`; return `${bytes} B`; } function formatTime(timestamp: string): string { const date = new Date(timestamp); if (Number.isNaN(date.getTime())) return timestamp; return date.toLocaleTimeString(); } function formatDate(timestamp: string): string { const date = new Date(timestamp); if (Number.isNaN(date.getTime())) return timestamp; return date.toLocaleString(); } function getPathValue(object: Record | undefined, path: string): unknown { let current: unknown = object; for (const part of path.split(".")) { if (current === null || typeof current !== "object") return undefined; current = (current as Record)[part]; } return current; } function ConfigKeyRow({ meta, path, source, layers, file, busy, onSave }: { meta: ConfigKeyMeta; path: string; source: Record; layers: ConfigView["layers"]; file: string; busy: boolean; onSave: (key: string, value: unknown | null) => void; }) { const [editing, setEditing] = useState(false); const [draft, setDraft] = useState(""); const value = getPathValue(source, path); const layer = file === "settings" ? (value !== undefined ? "project" : "default") : getPathValue(layers.project, path) !== undefined ? "project" : getPathValue(layers.global, path) !== undefined ? "global" : "default"; const display = value === undefined ? "—" : (typeof value === "object" ? JSON.stringify(value) : String(value)); const startEdit = () => { setDraft(display === "—" ? "" : display); setEditing(true); }; const save = () => { let parsed: unknown = draft.trim(); if (parsed === "") { onSave(path, null); setEditing(false); return; } try { parsed = JSON.parse(String(parsed)); } catch { // keep as a plain string } onSave(path, parsed); setEditing(false); }; return (
{meta.label ?? meta.key} {layer} {meta.key}
{meta.description &&
{meta.description}
} {file === "settings" ? (
{display} managed in .pi/settings.json
) : editing ? (
{meta.type === "enum" && meta.options ? ( ) : ( setDraft(event.target.value)} /> )}
) : (
{display}
)}
); } function shortDetail(entry: TraceEvent): string | null { const candidates = [entry.error, entry.reason, entry.toolName]; for (const value of candidates) { if (typeof value === "string" && value) return value; } return null; } type Tab = "overview" | "events" | "files" | "eval" | "harbor" | "approvals" | "settings"; interface ConfigKeyMeta { key: string; label?: string; type?: string; options?: string[]; description?: string; } interface ConfigSectionMeta { id: string; label: string; file: string; description: string; keys: ConfigKeyMeta[]; } interface ConfigView { sections: ConfigSectionMeta[]; layers: { defaults: Record; global: Record; project: Record; }; effective: Record; piSettings: Record; paths: { global: string; project: string }; } interface ApprovalItem { requestId: string; toolName?: string; summary?: string; reason?: string; requestedAt?: string; decision?: "approve" | "deny"; decidedAt?: string; } export function HarnessDashboard({ cwd, onClose }: { cwd: string | null; onClose: () => void }) { const [snapshot, setSnapshot] = useState(null); const [loading, setLoading] = useState(false); const [error, setError] = useState(null); const [tab, setTab] = useState("overview"); // Events view const [events, setEvents] = useState<{ total: number; offset: number; limit: number; events: TraceEvent[] } | null>(null); const [eventsLoading, setEventsLoading] = useState(false); const [eventFilter, setEventFilter] = useState(""); const [sessionFilter, setSessionFilter] = useState(""); const [query, setQuery] = useState(""); const [failedOnly, setFailedOnly] = useState(false); const [offset, setOffset] = useState(0); const [expandedEvent, setExpandedEvent] = useState(null); // Files view const [files, setFiles] = useState<{ files: FileEntry[]; sessionFiles: FileEntry[] } | null>(null); const [openFile, setOpenFile] = useState(null); const [fileContent, setFileContent] = useState(null); const [fileOffset, setFileOffset] = useState(0); const [evalSort, setEvalSort] = useState<{ key: string; dir: "asc" | "desc" }>({ key: "", dir: "asc" }); const [approvals, setApprovals] = useState<{ pending: ApprovalItem[]; history: ApprovalItem[] } | null>(null); const [approvalBusy, setApprovalBusy] = useState(false); const [configView, setConfigView] = useState(null); const [configSection, setConfigSection] = useState("agent"); const [configBusy, setConfigBusy] = useState(false); const load = useCallback(() => { if (!cwd) return; setLoading(true); setError(null); fetch(`/api/harness?cwd=${encodeURIComponent(cwd)}`, { cache: "no-store" }) .then(async (response) => { const body = await response.json(); if (!response.ok) throw new Error(String(body?.error ?? `HTTP ${response.status}`)); setSnapshot(body as Snapshot); }) .catch((reason: unknown) => setError(reason instanceof Error ? reason.message : String(reason))) .finally(() => setLoading(false)); }, [cwd]); useEffect(() => { load(); }, [cwd, load]); useEffect(() => { const onKey = (event: KeyboardEvent) => { if (event.key === "Escape") onClose(); }; window.addEventListener("keydown", onKey); return () => window.removeEventListener("keydown", onKey); }, [onClose]); const loadEvents = useCallback((nextOffset: number, overrides?: { failed?: boolean }) => { if (!cwd) return; const failed = overrides?.failed ?? failedOnly; setEventsLoading(true); setError(null); const params = new URLSearchParams({ cwd, offset: String(nextOffset), limit: String(PAGE_SIZE) }); if (eventFilter) params.set("event", eventFilter); if (sessionFilter) params.set("session", sessionFilter); if (query) params.set("q", query); if (failed) params.set("failed", "1"); fetch(`/api/harness/events?${params.toString()}`, { cache: "no-store" }) .then(async (response) => { const body = await response.json(); if (!response.ok) throw new Error(String(body?.error ?? `HTTP ${response.status}`)); setEvents(body as { total: number; offset: number; limit: number; events: TraceEvent[] }); setOffset(nextOffset); setExpandedEvent(null); }) .catch((reason: unknown) => setError(reason instanceof Error ? reason.message : String(reason))) .finally(() => setEventsLoading(false)); }, [cwd, eventFilter, sessionFilter, query, failedOnly]); const loadFiles = useCallback(() => { if (!cwd) return; setError(null); fetch(`/api/harness/files?cwd=${encodeURIComponent(cwd)}`, { cache: "no-store" }) .then(async (response) => { const body = await response.json(); if (!response.ok) throw new Error(String(body?.error ?? `HTTP ${response.status}`)); setFiles(body as { files: FileEntry[]; sessionFiles: FileEntry[] }); }) .catch((reason: unknown) => setError(reason instanceof Error ? reason.message : String(reason))); }, [cwd]); const loadConfig = useCallback(() => { if (!cwd) return; setError(null); fetch(`/api/harness/config?cwd=${encodeURIComponent(cwd)}`, { cache: "no-store" }) .then(async (response) => { const body = await response.json(); if (!response.ok) throw new Error(String(body?.error ?? `HTTP ${response.status}`)); setConfigView(body as ConfigView); }) .catch((reason: unknown) => setError(reason instanceof Error ? reason.message : String(reason))); }, [cwd]); const saveConfigKey = useCallback(async (key: string, value: unknown | null) => { if (!cwd) return; setConfigBusy(true); setError(null); try { const response = await fetch("/api/harness/config", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ cwd, action: value === null ? "unset" : "set", layer: "project", key, ...(value === null ? {} : { value }), }), }); const body = await response.json(); if (!response.ok) throw new Error(String(body?.error ?? `HTTP ${response.status}`)); loadConfig(); } catch (reason) { setError(reason instanceof Error ? reason.message : String(reason)); } finally { setConfigBusy(false); } }, [cwd, loadConfig]); const loadApprovals = useCallback(() => { if (!cwd) return; setError(null); fetch(`/api/harness/approvals?cwd=${encodeURIComponent(cwd)}`, { cache: "no-store" }) .then(async (response) => { const body = await response.json(); if (!response.ok) throw new Error(String(body?.error ?? `HTTP ${response.status}`)); setApprovals(body as { pending: ApprovalItem[]; history: ApprovalItem[] }); }) .catch((reason: unknown) => setError(reason instanceof Error ? reason.message : String(reason))); }, [cwd]); const decideApproval = useCallback(async (requestId: string, decision: "approve" | "deny") => { if (!cwd) return; setApprovalBusy(true); setError(null); try { const response = await fetch("/api/harness/approvals", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ cwd, requestId, decision }), }); const body = await response.json(); if (!response.ok) throw new Error(String(body?.error ?? `HTTP ${response.status}`)); loadApprovals(); } catch (reason) { setError(reason instanceof Error ? reason.message : String(reason)); } finally { setApprovalBusy(false); } }, [cwd, loadApprovals]); // Poll the approval queue while the tab is open. useEffect(() => { if (tab !== "approvals") return; loadApprovals(); const timer = window.setInterval(loadApprovals, 5000); return () => window.clearInterval(timer); }, [tab, loadApprovals]); const loadFileContent = useCallback((entry: FileEntry, nextOffset: number) => { if (!cwd) return; setError(null); const params = new URLSearchParams({ cwd, path: entry.path, offset: String(nextOffset), limit: String(FILE_PAGE_SIZE) }); fetch(`/api/harness/file?${params.toString()}`, { cache: "no-store" }) .then(async (response) => { const body = await response.json(); if (!response.ok) throw new Error(String(body?.error ?? `HTTP ${response.status}`)); setFileContent(body as FileContent); setFileOffset(nextOffset); }) .catch((reason: unknown) => setError(reason instanceof Error ? reason.message : String(reason))); }, [cwd]); const openTab = useCallback((next: Tab) => { setTab(next); setError(null); if (next === "events" && !events) loadEvents(0); if (next === "files" && !files) loadFiles(); if (next === "settings" && !configView) loadConfig(); }, [events, files, configView, loadEvents, loadFiles, loadConfig]); const reliability = snapshot?.reliability?.state ?? null; const dashboard = snapshot?.dashboard ?? null; const doctor = snapshot?.doctor ?? null; const traces = snapshot?.traces ?? null; const evalData = snapshot?.eval && !("error" in snapshot.eval) ? snapshot.eval : null; const harborData = snapshot?.harbor && !("error" in snapshot.harbor) ? snapshot.harbor : null; const sortedMatrix = useMemo(() => { const matrix = evalData?.matrix ?? []; if (!evalSort.key) return matrix; const column = EVAL_COLUMNS.find((item) => item.key === evalSort.key); if (!column) return matrix; const dir = evalSort.dir === "asc" ? 1 : -1; return [...matrix].sort((left, right) => { const leftValue = column.value(left); const rightValue = column.value(right); if (leftValue == null && rightValue == null) return 0; if (leftValue == null) return 1; if (rightValue == null) return -1; if (typeof leftValue === "number" && typeof rightValue === "number") return (leftValue - rightValue) * dir; return String(leftValue).localeCompare(String(rightValue)) * dir; }); }, [evalData, evalSort]); const toggleEvalSort = useCallback((key: string) => { setEvalSort((current) => { if (current.key === key) return { key, dir: current.dir === "asc" ? "desc" : "asc" }; return { key, dir: "asc" }; }); }, []); const healthChecks = doctor?.checks ?? []; const passing = healthChecks.filter((check) => check.status).length; return (
EQUAXIS HARNESS

Runtime harness

{cwd ?? "No workspace selected"}

{traces && traces.failureEvents > 0 && ( )}
{error &&
{error}
} {tab === "overview" && ( !snapshot ?
{loading ? <>Loading harness… : "Select an Equaxis workspace to inspect the harness."}
: <> {reliability && (
Reliability harness
Mode{reliability.mode}
Phase{reliability.phase}
Last risk{reliability.lastRisk}
Turn count{reliability.turnCount}
Tool calls{reliability.toolCalls}
Approved{reliability.approvedCalls}
Blocked 0 ? "harness-blocked" : ""}>{reliability.blockedCalls}
Failed 0 ? "harness-failed" : ""}>{reliability.failedCalls}
)}
Health · {passing}/{healthChecks.length} checks {dashboard?.gates && gates {dashboard.gates.ok ? "READY" : "FAIL"} } {traces && traces.failureEvents > 0 && ( )} {snapshot?.memoryBridge && ( memory bridge {snapshot.memoryBridge.ok ? `OK${snapshot.memoryBridge.version ? ` v${snapshot.memoryBridge.version}` : ""}` : `DOWN: ${snapshot.memoryBridge.error ?? "unknown"}`} )}
{healthChecks.map((check) => (
{check.status ? "✓" : "✗"} {check.name} {check.detail && {check.detail}}
))}
{snapshot?.costs && (
Session costs
Total tokens{snapshot.costs.totalTokens.toLocaleString()}
Total cost${snapshot.costs.totalCostUsd.toFixed(4)}
{snapshot.costs.byModel.map((row, index) => ( ))}
Provider / ModelSessionsTokensCost
{row.provider}/{row.model} {row.sessions} {row.tokens.toLocaleString()} ${row.costUsd.toFixed(4)}
)}
Configuration
{dashboard?.reliability && (
Reliability mode: {dashboard.reliability.mode} high-risk bash approval: {dashboard.reliability.approvals.highRiskBash ? "on" : "off"} external edits: {dashboard.reliability.approvals.externalEditPolicy} {dashboard.reliability.traceDir}
)} {dashboard?.subagents && (
Subagents {dashboard.subagents.enabled ? "enabled" : "disabled"} · max {dashboard.subagents.maxConcurrent} persistence {dashboard.subagents.persistence ? "on" : "off"} · isolation {dashboard.subagents.isolation ? "on" : "off"}
)} {dashboard?.memory && (
Memory {dashboard.memory.enabled ? "enabled" : "disabled"} · autoRecall {dashboard.memory.autoRecall ? "on" : "off"} {dashboard.memory.rootDir}
)} {dashboard?.evaluation && (
Evaluation {dashboard.evaluation.enabled ? "enabled" : "disabled"} · {dashboard.evaluation.attempts} attempts success rate: {dashboard.evaluation.successRate != null ? `${(dashboard.evaluation.successRate * 100).toFixed(1)}%` : "n/a"} {dashboard.evaluation.candidates} candidates
)} {dashboard?.memoryGovernance && (
Memory governance {dashboard.memoryGovernance.enabled ? "enabled" : "disabled"} · audit {dashboard.memoryGovernance.auditLog.exists ? formatBytes(dashboard.memoryGovernance.auditLog.bytes) : "missing"}
)} {dashboard?.protocols && (
Protocols LSP {dashboard.protocols.lsp.status} · DAP {dashboard.protocols.dap.status}
)} {dashboard?.runtimeFiles && (
Runtime files protocol trace {dashboard.runtimeFiles.protocolTrace.exists ? formatBytes(dashboard.runtimeFiles.protocolTrace.bytes) : "missing"} subagent events {dashboard.runtimeFiles.subagentEvents.exists ? formatBytes(dashboard.runtimeFiles.subagentEvents.bytes) : "missing"}
)}
)} {tab === "events" && (
{ setSessionFilter(event.target.value); setOffset(0); }} placeholder="session id…" /> { setQuery(event.target.value); setOffset(0); }} placeholder="search text…" onKeyDown={(event) => { if (event.key === "Enter") loadEvents(0); }} />
{events && ( <>
{events.total === 0 ? "no matching events" : `${events.offset + 1}–${Math.min(events.offset + events.events.length, events.total)} of ${events.total}`}
{events.events.map((entry, index) => { const detail = shortDetail(entry); const isExpanded = expandedEvent === index; return (
setExpandedEvent(isExpanded ? null : index)}> {formatTime(entry.timestamp ?? "")} {entry.event ?? "?"} {entry.phase && {String(entry.phase)}} {entry.toolName && {String(entry.toolName)}} {entry.risk && {String(entry.risk)}} {entry.sessionId && {String(entry.sessionId).slice(0, 12)}…} {detail && {detail.slice(0, 90)}} {isExpanded && (
{JSON.stringify(entry, null, 2)}
)}
); })} {events.events.length === 0 &&
No events match the current filters.
}
)}
)} {tab === "eval" && (
{!evalData ? (
No eval data yet. Run sessions or `node scripts/equaxis.mjs eval record …`.
) : ( <>
Eval outcomes (traces-derived)
Attempts{evalData.attempts}
Successes{evalData.successes}
Failures 0 ? "harness-failed" : ""}>{evalData.failures}
Unknowns{evalData.unknowns}
Success rate{evalData.successRate != null ? `${(evalData.successRate * 100).toFixed(1)}%` : "n/a"}
{EVAL_COLUMNS.map((column) => ( ))} {sortedMatrix.map((row, index) => ( ))}
toggleEvalSort(column.key)} title={`Sort by ${column.label}`}> {column.label} {evalSort.key === column.key && {evalSort.dir === "asc" ? " ▲" : " ▼"}}
{row.provider}/{row.model} {row.tool} {row.capabilities.join(", ") || "—"} {row.attempts} {row.successRate != null ? {(row.successRate * 100).toFixed(0)}% : —} {row.failures}{row.unknowns > 0 ? ` (+${row.unknowns}?)` : ""} {row.averageLatencyMs != null ? `${row.averageLatencyMs}ms` : "—"} {row.averageInputTokens != null ? `${Math.round(row.averageInputTokens)}/${Math.round(row.averageOutputTokens ?? 0)}` : "—"} {row.averageCostUsd != null ? `$${row.averageCostUsd}` : "—"} {Object.entries(row.errorCodes).map(([code, count]) => `${code}:${count}`).join(" ") || "—"}
{evalData.decisions.length > 0 && (
Decisions
)} )}
)} {tab === "harbor" && (
{!harborData ? (
No harbor artifacts yet. Run `npm run eval:cycle` or the budget analyzer.
) : ( <> {harborData.budget && ( <>
Budget comparison (equaxis vs pi_control)
{(["equaxis", "pi_control", "gain"] as const).map((name) => { const row = harborData.budget![name] as Record | undefined; if (!row) return null; return (
{name === "gain" ? "Gain" : name} {Object.entries(row).slice(0, 9).map(([key, value]) => ( {key}: {typeof value === "number" ? (Number.isInteger(value) ? String(value) : value.toFixed(3)) : String(value ?? "—")} ))}
); })}
)} {harborData.cycle && ( <>
Improvement cycle · {harborData.cycle.cycleDir ?? harborData.cycle.cycleId ?? "unknown"} {harborData.cycle.generatedAt ? ` · ${formatDate(harborData.cycle.generatedAt)}` : ""}
Diagnosis {Object.entries(harborData.cycle.diagnosis ?? {}).filter(([key]) => !["taskTable", "capabilityMatrix"].includes(key)).slice(0, 6).map(([key, value]) => { const text = typeof value === "object" ? JSON.stringify(value) : String(value); const display = text.length > 220 ? `${text.slice(0, 219)}…` : text; return 220 ? text : undefined}>{key}: {display}; })}
Hypotheses {harborData.cycle.hypotheses?.length ?? 0} hypotheses {harborData.cycle.nextIterationFocus && ( next focus: {JSON.stringify(harborData.cycle.nextIterationFocus)} )}
Experiments {harborData.cycle.experiments?.length ?? 0} experiments
Decisions {harborData.cycle.decisions?.length ?? 0} decisions {(harborData.cycle.decisions ?? []).slice(0, 3).map((decision, index) => ( {typeof decision === "object" ? JSON.stringify(decision) : String(decision)} ))}
)} )}
)} {tab === "approvals" && (
Pending approvals{approvals && approvals.pending.length > 0 ? ` · ${approvals.pending.length} waiting` : ""}
{!approvals ? (
Loading approvals…
) : approvals.pending.length === 0 ? (
No pending approvals. High-risk calls in headless sessions wait here for your decision.
) : (
{approvals.pending.map((request) => (
{request.toolName ?? "tool"} {request.requestId} {request.requestedAt && {formatTime(request.requestedAt)}}
{request.reason &&
{request.reason}
} {request.summary &&
{request.summary.slice(0, 1200)}
}
))}
)}
Recent decisions
{approvals?.history.map((entry) => (
{entry.decision} {entry.requestId} {entry.decidedAt && {formatTime(entry.decidedAt)}}
))} {approvals && approvals.history.length === 0 &&
No decisions yet.
}
)} {tab === "settings" && (
{!configView ? null : (() => { const section = configView.sections.find((item) => item.id === configSection) ?? configView.sections[0]; const source = section.file === "settings" ? configView.piSettings : configView.effective; return ( <>
{section.label} {section.description}
{section.keys.map((meta) => ( ))} ); })()}
)} {tab === "files" && (
{openFile ? ( <>
{openFile.path} {fileContent ? `${fileContent.totalLines} lines · ${formatBytes(openFile.bytes)}` : formatBytes(openFile.bytes)}
{fileContent ? `${fileContent.offset + 1}–${Math.min(fileContent.offset + fileContent.lines.length, fileContent.totalLines)} of ${fileContent.totalLines}` : ""}
{fileContent?.lines.map((line) => (
{line.n}
{line.text}
))} {fileContent?.lines.length === 0 &&
End of file.
}
) : ( <>
Runtime artifacts
{files?.files.map((file) => ( ))}
Session files (newest 30)
{files?.sessionFiles.map((file) => ( ))}
)}
)}
); }