(mgr: AgentManager)
| 260 | } |
| 261 | |
| 262 | function printLoopSummary(mgr: AgentManager): void { |
| 263 | const counts = mgr.tasks.reduce<Record<string, number>>((acc, s) => { |
| 264 | acc[s.status] = (acc[s.status] ?? 0) + 1; |
| 265 | return acc; |
| 266 | }, {}); |
| 267 | console.log(""); |
| 268 | if (isAndonActive(mgr.state.andon)) { |
| 269 | console.log( |
| 270 | `>> ANDON ACTIVE - raised at ${mgr.state.andon.raisedAt} by ${mgr.state.andon.raisedBy ?? "unknown"}: ${truncate(mgr.state.andon.reason ?? "", 100)}` |
| 271 | ); |
| 272 | } else if (mgr.andon.clearedDuringLoop && mgr.state.andon?.clearedAt) { |
| 273 | console.log( |
| 274 | `Andon cleared at ${mgr.state.andon.clearedAt} by ${mgr.state.andon.clearedBy ?? "unknown"}` |
| 275 | ); |
| 276 | } |
| 277 | console.log(`orchestrate summary (${mgr.plan.rootSlug}):`); |
| 278 | for (const [status, n] of Object.entries(counts).sort()) { |
| 279 | console.log(` ${status}: ${n}`); |
| 280 | } |
| 281 | const handed = mgr.tasks.filter(s => s.status === "handed-off"); |
| 282 | if (handed.length > 0) { |
| 283 | console.log(` handoffs written to: ${mgr.handoffsDir}`); |
| 284 | for (const s of handed) console.log(` - ${s.handoffPath}`); |
| 285 | } |
| 286 | if (mgr.state.attention.length > 0) { |
| 287 | console.log( |
| 288 | ` attention entries: ${mgr.state.attention.length} (see ${mgr.attentionLog})` |
| 289 | ); |
| 290 | } |
| 291 | } |
| 292 | |
| 293 | function planTasks(plan: Plan): PlanTask[] { |
| 294 | return plan.tasks ?? []; |
no test coverage detected