INNER CODE UNIT · JavaScript

writeDraftState

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

  const writeDraftState = (patch) => {
    if (!stateFile) return;
    try {
      let prev = {};
      try { prev = JSON.parse(readFileSync(stateFile, "utf8")) || {}; } catch { prev = {}; }
      writeFileSync(stateFile, JSON.stringify({ ...prev, ...patch }, null, 2));
    } catch {
      // best-effort: never interrupt the agent's main flow
    }
  };

  const v = validateDraftDesc(desc, baseConfig?.draft?.minDescLength);
  if (!v.ok) {
    console.error(`[DRAFT VALIDATION] ${v.reason}`);
    console.error(`Hint: draft 需要一句描述目标的话;示例:draft '为 mission-driver 增加 audit 计数'`);
    // mdr-remediate-3 A1: terminal state write for the draft-job UI. Without
    // this, startDraftJob's initial `status: "running"` would persist forever
    // (child stderr is `stdio: "ignore"`-discarded by the parent, and

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…