| 576 | |
| 577 | // Autopilot launch card on the Plan tab. |
| 578 | function autopilotCard(s) { |
| 579 | const running = !!(s.autopilot && s.autopilot.running); |
| 580 | const blocked = s.doctor && s.doctor.overall === "blocked"; |
| 581 | let body = |
| 582 | '<p class="muted" style="margin:0 0 10px">Let Copilot work the checklist for you. Autopilot runs each eligible step <b>in order</b>, ' + |
| 583 | "updates <code>progress.md</code>, and streams results here live. It pauses at the end of the phase, stops if a step needs a decision, " + |
| 584 | "and <b>does not commit</b> — so you stay in control and can review the diff.</p>"; |
| 585 | let actions; |
| 586 | if (running) { |
| 587 | actions = btn("■ Stop autopilot", "autopilot_stop", {}); |
| 588 | } else if (blocked) { |
| 589 | actions = '<span class="smuted">Environment is not ready. </span>' + btn("Open Readiness →", "goto:readiness"); |
| 590 | } else { |
| 591 | actions = |
| 592 | btn("▶ Run this phase", "autopilot_start", { scope: "phase" }, { primary: true }) + |
| 593 | btn("Run all phases", "autopilot_start", { scope: "all" }); |
| 594 | } |
| 595 | return '<div class="card autopilot"><h2>⚡ Autopilot <span class="badge b-blue">beta</span></h2>' + body + '<div class="actions">' + actions + "</div></div>"; |
| 596 | } |
| 597 | |
| 598 | function planTab(s) { |
| 599 | const usingProgress = !!(s.progress && s.progress.steps.length); |