import type { AgentSession, SessionManager } from "@earendil-works/pi-coding-agent"; import { type Destination, type RunEnvelope } from "./output.js"; import { type SessionArgs } from "./sessions.js"; import { type ExtractField } from "./result.js"; /** One task, start to end. Never exits, never traps signals: the caller owns the process. */ export declare function runTask(request: TaskRequest, control?: TaskControl): Promise; /** Everything a task needs, checked before a single token is spent. */ export declare function prepareTask(request: TaskRequest, cwd: string): Promise; /** * What the agent is asked, in the order it reads: the task, what moved since * the last round, then the user's reply. The task stays in front of both — * session restore is best-effort in CI, and a round that lost its thread must * still know what it was asked to do. An empty reply changes nothing, so a job * can pass a comment body that is not there. */ export declare function compose(prompt: string, update?: string | null, followUp?: string): string; export declare function exitCode(error: string | null, status: "pass" | "fail" | undefined, wantsReport: boolean, report: string | null, exitZero?: boolean): number; /** Stops the session when the caller aborts, for as long as it is watched. */ export declare class TaskAbort { private readonly session; private readonly signal?; private readonly stop; constructor(session: Pick, signal?: AbortSignal | undefined); watch(): void; release(): void; get reason(): string | null; } export interface TaskRequest extends SessionArgs { prompt: string; followUp?: string; /** Same strings as -o. */ outputs: string[]; json?: boolean; brief?: boolean; /** `testeiya extract`: the values to find. The run submits them instead of reporting. */ extract?: ExtractField[]; name?: string; model?: string; thread?: string; header?: string; footer?: string; noDefaultFooter?: boolean; noThread?: boolean; exitZero?: boolean; } export interface TaskControl { signal?: AbortSignal; } export interface TaskOutcome { code: number; envelope: RunEnvelope; /** A destination failed: the caller keeps the report. */ undelivered: boolean; } export type TaskRunner = (request: TaskRequest, control?: TaskControl) => Promise; export interface PrintOptions { prompt: string; followUp?: string; /** Which conversation this run is, for pull request comments (`--thread`). */ thread?: string; destinations: Destination[]; sessionManager: SessionManager; sessionId?: string | null; model?: string; brief?: boolean; extract?: ExtractField[]; exitZero?: boolean; header?: string; footer?: string; noDefaultFooter?: boolean; /** Leave the comment thread alone: no thread rules, no thread comments read. */ noThread?: boolean; }