MCPcopy Create free account
hub / github.com/FIND-Lab/AgentWard / normalizeJudgeResponse

Function normalizeJudgeResponse

layers/decision-alignment.ts:100–107  ·  view source on GitHub ↗
(response: string)

Source from the content-addressed store, hash-verified

98}
99
100function 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
109export function decisionAlignmentDetect(
110 state: SessionState,

Callers 1

decisionAlignmentDetectFunction · 0.85

Calls 1

shortTextFunction · 0.85

Tested by

no test coverage detected