/** * SetupTab/CortexEncoderCard.tsx — encoder gate status card (VC9C). * * Projects the VC9A reader status: effective triad mode A/B/C, asset digest * prefix, qualification verdict + threshold failures, and encoder health. The * header carries the shared VcStatusBadge driven by the payload's status field * (VC0E honest-status pattern). Pure projection of the polled payload — never * payload bytes/prompts/ledger. */ import type React from "react"; import type { SetupCortexStatusResponse } from "../../types/setup-cortex"; import { VcStatusBadge } from "../VcStatusBadge"; import { styles } from "./CortexSetupStyles"; function modeLabel(mode: "A" | "B" | "C" | undefined): string { switch (mode) { case "A": return "A — qualified learned encoder asset"; case "B": return "B — demoted (heuristic/trigram)"; case "C": return "C — absent (asset not verified)"; default: return "—"; } } function verdictBadge( verdict: "qualified" | "demoted" | "unavailable" | undefined, ): React.ReactElement { const bg = verdict === "qualified" ? "#1a5a1a" : verdict === "demoted" ? "#3a3a1a" : "#3a1a1a"; const color = verdict === "qualified" ? "#4caf50" : verdict === "demoted" ? "#ffcc00" : "#f44336"; return ( {verdict ?? "unknown"} ); } export function CortexEncoderCard({ data, error, }: { data: SetupCortexStatusResponse | null; error: string | null; }): React.ReactElement { return (

Cortex Encoder

{error && (

Error: {error}

)} {!data && !error && (

Loading cortex status...

)} {!data?.enabled && (

Cortex status disabled (VC9A off).

)}
Mode: {modeLabel(data?.encoderHealth.mode)}
Asset digest prefix: {data?.assetDigestPrefix ?? ( not available )}
Qualification: {verdictBadge(data?.qualification.verdict)}
{(data?.qualification.thresholdFailures.length ?? 0) > 0 && (
Threshold failure(s):{" "} {data?.qualification.thresholdFailures.join(", ")}
)} {data?.status === "awaiting_data" && (

Awaiting encoder data. Qualification will appear once an asset is present.

)} {data?.status === "deferred" && (

Encoder status deferred.

)}
); }