(response: string)
| 98 | } |
| 99 | |
| 100 | function normalizeJudgeResponse(response: string): { blocked: boolean; text: string } { |
| 101 | const verdict = response.match(/VERDICT\s*:\s*(OK|BLOCKED)/i)?.[1]?.toUpperCase() ?? "OK"; |
| 102 | const reason = response.match(/REASON\s*:\s*([^\n\r]+)/i)?.[1]?.trim() ?? shortText(response, 160); |
| 103 | return { |
| 104 | blocked: verdict === "BLOCKED", |
| 105 | text: `VERDICT: ${verdict}\nREASON: ${reason}`, |
| 106 | }; |
| 107 | } |
| 108 | |
| 109 | export function decisionAlignmentDetect( |
| 110 | state: SessionState, |
no test coverage detected