UNPKG

@phren/cli

Version:

Knowledge layer for AI agents - CLI, MCP server, and data layer

26 lines (25 loc) • 1.19 kB
import { awaitedInReply, waitingOn } from "./worker-unfinished.js"; import { ownerQuestion } from "./schedule-watch.js"; /** * Why a row whose turn has ended is not done, for the phone's live board: * absent while a turn runs, while the owner is needed (an ask or question), * and when nothing is waited on. A sentence in the ended turn's reply that * waits on CI or a queue says so; otherwise background work still running is * `background`; otherwise the awaited sentence's kind, if the reply has one. * Most "needs you" notices were workers waiting on CI (owner, 2026-11-26). */ export function tabWaiting(phase, tab) { if (["blocked", "waiting"].includes(String(tab.agentStatus))) return undefined; if (phase?.phase !== "ended") return undefined; if (phase.reply && ownerQuestion(phase.reply)) return undefined; const awaited = awaitedInReply(phase.truncated ? undefined : phase.reply); const kind = awaited ? waitingOn(awaited) : undefined; if (kind === "ci" || kind === "queue") return kind; if (typeof tab.backgroundTasks === "number" && tab.backgroundTasks > 0) return "background"; return kind; }