INNER CODE UNIT · JavaScript

extractBriefGate

entropy-cloud/nop-entropy · tools/mission-driver/src/main.js:188

function extractBriefGate(resultText) {
  if (typeof resultText !== "string") return { gate: null, reason: null };
  // mdr-remediate-3 N1: strip ANSI BEFORE the marker match (see extractBriefPath).
  const clean = stripAnsiControl(resultText);
  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

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…