feat: make Core reports commercially production-ready
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
? "Unavailable" : new Intl.NumberFormat("en-US").format(Number(value));
|
||||
const time = (value) => value ? String(value).replace("T", " ").replace("Z", " UTC") : "No timestamp";
|
||||
const money = (value) => value === null || value === undefined ? "Unavailable" : `$${Number(value).toFixed(6)}`;
|
||||
const statusLabel = (value) => String(value || "unknown").replaceAll("_", " ");
|
||||
const pill = (value) => `<span class="pill ${slug(value)}">${esc(String(value || "unknown").replaceAll("_", " "))}</span>`;
|
||||
|
||||
async function api(path) {
|
||||
@@ -122,6 +123,22 @@
|
||||
const certified = latest.certified === true;
|
||||
const latestTrace = latest.trace_id || recent[0]?.trace_id;
|
||||
const maturity = profile.maturity || {};
|
||||
const readiness = profile.readiness || {};
|
||||
const dimensions = readiness.dimensions || {};
|
||||
const core = dimensions.core || { status: "not_assessed", summary: "Core readiness has not been assessed." };
|
||||
const domain = dimensions.domain_pipeline || { status: "not_assessed", summary: "Domain Pipeline readiness has not been assessed." };
|
||||
const telemetry = dimensions.provider_telemetry || { status: "not_assessed", summary: "Provider Telemetry readiness has not been assessed." };
|
||||
const nextActions = readiness.next_actions || [];
|
||||
const coreReady = ["ready", "ready_with_attention"].includes(core.status);
|
||||
const readinessActionList = `<div class="findings">${nextActions.map((action, index) => `<div class="finding warning">
|
||||
<span class="finding-index">${String(index + 1).padStart(2, "0")}</span>
|
||||
<div><code>${esc(action.code)}</code><p>${esc(action.message)}</p></div>
|
||||
</div>`).join("")}</div>`;
|
||||
const readinessCards = `<section class="metric-grid readiness-grid" aria-label="Commercial readiness">
|
||||
${metric("Core", statusLabel(core.status), core.summary)}
|
||||
${metric("Domain Pipeline", statusLabel(domain.status), domain.summary)}
|
||||
${metric("Provider Telemetry", statusLabel(telemetry.status), telemetry.summary)}
|
||||
</section>`;
|
||||
const actions = latestTrace
|
||||
? `<button class="button primary" type="button" data-open-trace="${esc(latestTrace)}">Inspect latest run</button>
|
||||
<button class="button secondary" type="button" data-open-h6="${esc(latestTrace)}">Open H6</button>`
|
||||
@@ -129,22 +146,43 @@
|
||||
$("#overview-view").innerHTML =
|
||||
hero({
|
||||
eyebrow: "CASAN Core · Local assurance",
|
||||
title: latestTrace ? "One prompt. One evidence trail." : "Ready for the first governed run.",
|
||||
description: "A read-only, offline-capable assurance workspace reconstructed from canonical project evidence. No Platform service or HTML generation on the prompt hot path.",
|
||||
verdict: latestTrace ? (certified ? "certified" : "review required") : "ready",
|
||||
title: latestTrace ? "One prompt. One evidence trail." :
|
||||
coreReady ? "Core reporting is ready." : "Finish Core activation.",
|
||||
description: latestTrace
|
||||
? "A read-only, offline-capable assurance workspace reconstructed from canonical project evidence. No Platform service or HTML generation on the prompt hot path."
|
||||
: coreReady
|
||||
? "Core visual reporting works without a Domain Pack or application-source changes. Send a governed prompt to create the first run dossier."
|
||||
: "Core visual reporting works without a Domain Pack or application-source changes. Complete the activation action below, then send a governed prompt.",
|
||||
verdict: latestTrace ? (certified ? "certified" : "review required") : core.status,
|
||||
meta: [
|
||||
`${profile.project_name} · ${profile.edition}`,
|
||||
latestTrace ? `Trace ${latestTrace}` : "No finalized trace yet",
|
||||
`Maturity ${maturity.level == null ? "not assessed" : `L${maturity.level}`} · ${maturity.status}`,
|
||||
`Maturity ${maturity.level == null ? "not assessed" : `L${maturity.level}`} · ${statusLabel(maturity.status)}`,
|
||||
],
|
||||
actions,
|
||||
}) +
|
||||
`<section class="metric-grid">
|
||||
}) + readinessCards +
|
||||
(latestTrace && nextActions.length ? panel(
|
||||
"Activation attention",
|
||||
"A selected client route needs action.",
|
||||
"Healthy routes remain operational; complete this step before relying on the affected integration.",
|
||||
readinessActionList,
|
||||
pill(core.status),
|
||||
) : "") +
|
||||
(latestTrace ? `<section class="metric-grid">
|
||||
${metric("Governed records", number(registry.count), `${recent.length} recent records loaded`)}
|
||||
${metric("Latest H6 quality", latest.telemetry_quality || "Unavailable", "Missing values are disclosed, never coerced to zero")}
|
||||
${metric("Observed failures", number(failures), `${recent.length ? Math.round((failures / recent.length) * 100) : 0}% of loaded records`)}
|
||||
${metric("Evidence gates", latestTrace ? "H1 → H7" : "Waiting", latestTrace ? "Control-by-control reconstruction available" : "Evidence appears after a prompt finalizes")}
|
||||
</section>` +
|
||||
</section>` : panel(
|
||||
"First-run onboarding",
|
||||
"No operational KPIs are shown until evidence exists.",
|
||||
"CASAN does not turn missing telemetry into zeroes or claim a run is certified before a governed prompt finishes.",
|
||||
`${nextActions.length ? `<div class="onboarding-actions">${readinessActionList}</div>` : ""}
|
||||
<div class="two-col">
|
||||
<div class="notice success"><strong>Available now</strong><br>Local viewer, H1–H7 run dossier, history, H6 AgentOps and on-demand JSON/HTML export.</div>
|
||||
<div class="notice warning"><strong>Optional expansion</strong><br>Install a Domain Pack only when the team needs project-specific SRS→test acceptance.</div>
|
||||
</div>`
|
||||
)) +
|
||||
disclosure(
|
||||
"About this local report",
|
||||
"Edition boundaries and implementation notes are hidden until needed.",
|
||||
@@ -172,13 +210,22 @@
|
||||
function renderRuns() {
|
||||
const rows = state.registry.runs || [];
|
||||
const selected = state.run;
|
||||
const hasRuns = rows.length > 0;
|
||||
const body = hero({
|
||||
eyebrow: "Run assurance registry",
|
||||
title: "Every governed run, one evidence trail.",
|
||||
description: "Select a lifecycle record to reconstruct H1–H7 decisions, inspect sanitized evidence and export an independent dossier.",
|
||||
verdict: rows.some((row) => row.status === "failed") ? "attention" : "operational",
|
||||
meta: [`${state.registry.count} records`, `${rows.filter((row) => row.status === "failed").length} failures`, "Local canonical evidence"],
|
||||
actions: `<button class="button primary" type="button" data-view-target="h6">Open H6 dossier</button>`,
|
||||
title: hasRuns ? "Every governed run, one evidence trail." : "No governed runs yet.",
|
||||
description: hasRuns
|
||||
? "Select a lifecycle record to reconstruct H1–H7 decisions, inspect sanitized evidence and export an independent dossier."
|
||||
: "The registry will populate after a configured client finalizes its first governed prompt.",
|
||||
verdict: hasRuns
|
||||
? (rows.some((row) => row.status === "failed") ? "attention" : "operational")
|
||||
: "waiting",
|
||||
meta: hasRuns
|
||||
? [`${state.registry.count} records`, `${rows.filter((row) => row.status === "failed").length} failures`, "Local canonical evidence"]
|
||||
: ["No operational counters yet", "Local canonical evidence"],
|
||||
actions: hasRuns
|
||||
? `<button class="button primary" type="button" data-view-target="h6">Open H6 dossier</button>`
|
||||
: "",
|
||||
}) + (selected ? renderTrace(selected) : "") + recentRunsPanel(rows);
|
||||
$("#runs-view").innerHTML = body;
|
||||
bindActions();
|
||||
@@ -225,10 +272,33 @@
|
||||
function renderH6() {
|
||||
const data = state.h6;
|
||||
if (!data) return;
|
||||
const hasRuns = Number(data.summary?.runs) > 0;
|
||||
const query = data.scope || {};
|
||||
const queryObject = Object.fromEntries(Object.entries(query).filter(([, value]) => value));
|
||||
const actions = `<a class="button secondary" href="${downloadUrl("/api/v1/reports/h6/export", { ...queryObject, format: "json" })}">JSON evidence</a>
|
||||
<a class="button primary" href="${downloadUrl("/api/v1/reports/h6/export", { ...queryObject, format: "html" })}">Export dossier</a>`;
|
||||
if (!hasRuns) {
|
||||
const provider = state.project?.readiness?.dimensions?.provider_telemetry || {};
|
||||
$("#h6-view").innerHTML =
|
||||
hero({
|
||||
eyebrow: "H6 · AgentOps assurance",
|
||||
title: "H6 begins with the first governed run.",
|
||||
description: "No runtime record exists yet, so CASAN hides failure, latency, token and cost counters instead of presenting fabricated zeroes.",
|
||||
verdict: "waiting",
|
||||
meta: [data.report_id, `Generated ${time(data.generated_at)}`, "No operational evidence yet"],
|
||||
actions: "",
|
||||
}) +
|
||||
panel(
|
||||
"H6 onboarding",
|
||||
"Provider telemetry is optional.",
|
||||
provider.summary || "Provider token and cost telemetry has not been observed; this does not block Core.",
|
||||
`<div class="two-col">
|
||||
<div class="notice success"><strong>Core remains ready</strong><br>Send a prompt through a configured client. CASAN will persist runtime evidence automatically.</div>
|
||||
<div class="notice warning"><strong>No automatic export</strong><br>Open H6 or export a dossier only when a review artifact is needed.</div>
|
||||
</div>`,
|
||||
);
|
||||
return;
|
||||
}
|
||||
const findings = data.findings.length ? `<div class="findings">${data.findings.map((item, index) => `<article class="finding ${slug(item.severity)}">
|
||||
<span class="finding-index">${String(index + 1).padStart(2, "0")}</span><div><code>${esc(item.code)}</code><p>${esc(item.message)}</p></div></article>`).join("")}</div>`
|
||||
: `<div class="notice success">No threshold breach was detected in the selected evidence boundary.</div>`;
|
||||
|
||||
Reference in New Issue
Block a user