/** * cogitator run -p - one session without a terminal: a prompt in, the answer out as text, JSON * or stream-json, with stream-json input for many turns */ import type { Agent, Cogitator } from '@cogitator-ai/core'; import { type ClaimedStdout, type HeadlessPlan } from '../utils/headless.js'; /** The name the CLI's agent goes by in its sessions */ export declare const HEADLESS_AGENT = "default"; export interface HeadlessIo { /** Stdout, held for the answer and the protocol lines */ stdout: ClaimedStdout; stderr: { write(text: string): unknown; }; stdin: AsyncIterable; /** Whether stdin is a terminal, so a prompt is not read from it */ stdinIsTTY: boolean; } export interface HeadlessRun { cogitator: Cogitator; agent: Agent; plan: HeadlessPlan; /** The prompt of the command line, for text input */ message?: string; io: HeadlessIo; version?: string; } /** * Runs one headless session and returns the exit code: 0 when its last turn completed, 1 when it * failed or was interrupted, 3 when it was left paused. Only the answer, or protocol lines, reach * stdout. * * @throws CommandError when the session to resume or fork cannot be opened, UsageError for a * missing prompt */ export declare function runHeadless(run: HeadlessRun): Promise; /** * Runs pushed items one at a time in order. An item pushed while the last run is ending starts a * new run, so nothing waits in the queue with no run to take it */ export declare function serialQueue(run: (item: T) => Promise): { push(item: T): void; drain(): Promise; }; //# sourceMappingURL=headless.d.ts.map