feat(workbench-ui): add practice evidence view helpers
This commit is contained in:
parent
f89909c953
commit
e54f05eb7b
1 changed files with 26 additions and 0 deletions
26
workbench-ui/src/app/trace/practiceEvidenceView.ts
Normal file
26
workbench-ui/src/app/trace/practiceEvidenceView.ts
Normal file
|
|
@ -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})`;
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue