// What the terminal page decides about cancelling a turn, without a DOM. The // controller answers `POST /api/agents/{name}/cancel` with whether a turn was // running and was stopped (`acted`), so a cancel is never silently a no-op. /** Whether to offer the cancel button: while the agent is in a turn. */ export function canCancel(turnState: string | undefined): boolean { return turnState === "thinking"; } /** The path a cancel is sent to. */ export function cancelPath(agentName: string): string { return `/api/agents/${encodeURIComponent(agentName)}/cancel`; } /** What to tell the operator once the agent has answered. */ export function cancelNote(acted: boolean): string { return acted ? "turn cancelled" : "nothing was running"; }