INNER CODE UNIT · JavaScript
m
entropy-cloud/nop-entropy · tools/mission-driver/src/main.js:192
const m = clean.match(/<BRIEF_GATE>\s*(pass|blocked)\s*<\/BRIEF_GATE>/i);
const r = clean.match(/<BRIEF_GATE_REASON>\s*(.+?)\s*<\/BRIEF_GATE_REASON>/is);
return { gate: m ? m[1].toLowerCase() : null, reason: r ? (r[1].trim() || null) : null };
}
/**
* Parse the draft agent's product into a mission identity. mdo-2 Phase 1.
*
* Strategy (FSD §3.1.3 boundary):
* 1. `<MISSION_FILE>path</MISSION_FILE>` tag in the agent text → resolve +
* read that mission.json for `name`/`roadmapPath`.
* 2. Fallback: scan `missions/*.json` for files with a `roadmapPath`, newest
* by mtime → derive missionName/roadmapPath/missionFile.
* 3. Still nothing → all fields null (status stays completed; the UI tells
* the user to check manually).
*
* Never throws; returns nulls on any failure so the caller's best-effort write
* does not abort the agent's main flow.