diff --git a/workbench-ui/src/app/trace/practiceEvidenceView.ts b/workbench-ui/src/app/trace/practiceEvidenceView.ts new file mode 100644 index 00000000..51bbb260 --- /dev/null +++ b/workbench-ui/src/app/trace/practiceEvidenceView.ts @@ -0,0 +1,26 @@ +import type { PracticeEvidence, PracticeSourceSpanView } from "../../types/practiceEvidence"; + +export const PRACTICE_AUTHORITY_DISCLOSURES = [ + "Diagnostic Only", + "Serving Disallowed", + "Mutation Disallowed", + "Replay Execution Disallowed", + "Workbench Did Not Execute Replay", +] as const; + +export function practiceEvidenceEmptyMessage(evidence: PracticeEvidence): string | null { + if (evidence.status === "missing_evidence") { + return evidence.missing_reason ?? "No sealed practice evidence recorded for this turn."; + } + return evidence.chain.length > 0 || evidence.sealed_trace !== null || evidence.trace_refusal !== null + ? null + : "No sealed practice evidence recorded for this turn."; +} + +export function practiceSourceSpanLabel(span: PracticeSourceSpanView): string { + const sentence = + span.sentence_index === null || span.sentence_index === undefined + ? "sentence unknown" + : `sentence ${span.sentence_index}`; + return `${span.start}:${span.end} ${span.text} (${sentence})`; +}