/** * A flow run, painted: its plan as `livePlan` fills it, and under a visit * running now, what each of its subagents is doing. * * The same painter draws the widget while the run goes and the frame its * answer ends on, so the two cannot disagree about what a line says. What a * line holds is the library's (`liveRows`); what a subagent is doing is the * TUI's own pieces (`currentActivity`, `detailLine`), the ones the widget of * a run with no plan is built from. This file only colours and cuts. */ import { type LivePlan, type RunSnapshot } from "../../src/index.ts"; import type { Widget, WidgetTheme } from "../pi.ts"; /** What a paint may vary: the subagents to show under their visit, the one selected, and how many rows the plan may take. */ export type FlowPaint = { /** The run's subagents, for the activity under a running visit. Absent draws the plan alone. */ snapshot?: RunSnapshot; /** The subagent a key would stop, marked `▸`. */ selected?: string; /** How many rows the plan may take under its summary, the cuts counted among them. Absent cuts none. */ maxRows?: number; /** The working directory, left out of the paths a line names. Defaults to this process's. */ cwd?: string; }; /** * The widget above the prompt while a flow runs: its plan, `footer` under it, * drawn one column in from each edge as pi draws a widget given as lines. * The footer is asked for at each draw, and at the width the plan is cut to, * since a question card coming up changes what it says before the next paint. */ export declare function planWidget(live: LivePlan, theme: WidgetTheme, paint: Pick, footer: (width: number) => readonly string[]): Widget; /** * `live` as coloured lines, none wider than `width`. Past `maxRows`, the * plan is cut above and below what runs now, and each cut says how many * lines it holds: the finished lines above are the ones to lose first, and * what runs is what the widget is for. */ export declare function paintFlow(live: LivePlan, theme: WidgetTheme, width: number, paint?: FlowPaint): string[]; /** * `text` with the working directory and this package left out of its paths, * and the home directory written `~`. A shipped agent reads `agents/coder.md` * where a repository's reads `.pi/agents/coder.md`, and neither takes half a * line of the terminal to say it. */ export declare function tidy(text: string, cwd: string): string; /** A flow's last frame as a component: painted again at whatever width pi draws it. */ export declare class PlanFrame { private readonly live; private readonly theme; constructor(live: LivePlan, theme: WidgetTheme); render(width: number): string[]; invalidate(): void; } //# sourceMappingURL=flow.d.ts.map