INNER CODE UNIT · JavaScript
extractBriefPath
entropy-cloud/nop-entropy · tools/mission-driver/src/main.js:160
function extractBriefPath(resultText) {
if (typeof resultText !== "string") return null;
// mdr-remediate-3 N1: strip ANSI BEFORE the marker match so log-colored brief
// output (e.g. `\x1b[32m<BRIEF_FILE>...\x1b[0m`) does not defeat the strict
// `[^<]+` value matcher. Mirrors the engine-layer discipline (memory L009).
const clean = stripAnsiControl(resultText);
const m = clean.match(/<BRIEF_FILE>\s*([^\s<]+)\s*<\/BRIEF_FILE>/i);
return m && m[1] ? m[1].trim() : null;
}
/**
* Extract the brief gate decision from the mission-brief agent's output
* (draft-robustness-design §4.2.2 / WI2). The agent emits:
* <BRIEF_GATE>pass|blocked</BRIEF_GATE>
* <BRIEF_GATE_REASON>short reason (required for blocked)</BRIEF_GATE_REASON>
*
* Returns `{ gate, reason }`:
* - `gate` is `"pass"` | `"blocked"` (lower-cased) when the marker is present