/** * Finish alert: when a long run ends, or a run that has been going for a while stops to ask you * something, ring the terminal bell and put a mark in the window title, so you notice from another * window or tab. * * It uses only two terminal standards and no OS commands: BEL (0x07) and the OSC 0 title. What the * terminal does with them is its own setting (a taskbar flash, a tab badge, a sound, or nothing). * Runs shorter than the threshold stay quiet, and `/chassis alert off` switches it off. * * The setting lives in the same state file as the disabled widgets (`alert`: `{ enabled, seconds }`). */ export declare const DEFAULT_ALERT_SECONDS = 30; export interface AlertSettings { enabled: boolean; /** Runs shorter than this stay quiet. */ seconds: number; } export declare function defaultAlert(): AlertSettings; /** Settings from the state file; anything missing or malformed falls back to the default. */ export declare function loadAlert(path?: string): AlertSettings; /** Save into the state file, keeping its other keys. Best effort, like the widget list. */ export declare function saveAlert(s: AlertSettings, path?: string): void; /** Why the agent stopped. */ export type AlertReason = "finished" | "failed" | "waiting"; /** * Whether to alert: on, and the run has lasted the threshold. A shorter run is one you are * watching. This holds for a finish, a failure and a stop that waits for you alike. */ export declare function shouldAlert(s: AlertSettings, durationMs: number | undefined): boolean; /** The mark put in front of the title. */ export declare const TITLE_MARK: Record; /** Title while alerting: the mark in front of pi's own title. */ export declare function alertTitle(reason: AlertReason, title: string): string; export interface AlertOutput { /** Raw write to the terminal. */ write(data: string): void; setTitle(title: string): void; } /** Ring the bell and mark the title. */ export declare function alert(out: AlertOutput, reason: AlertReason, title: string): void; /** * How a run ended, from the last assistant message's stop reason in an agent_end message list. An * abort means you pressed esc, so you are there and nothing should ring. */ export declare function runOutcome(messages: readonly unknown[] | undefined): "finished" | "failed" | "aborted"; /** The title pi itself sets when there is no session name: "π - ". Used to clear the mark. */ export declare function plainTitle(cwd: string, sessionName?: string): string; /** "off", "on", or a number of seconds ("30", "30s", "2m"); undefined when it is none of these. */ export declare function parseAlertArg(arg: string): Partial | undefined; export declare function describeAlert(s: AlertSettings): string;