import type { InterruptibleEngine, EngineRunOpts, EngineResult } from "../shared/types.js";
/**
* Pi coding agent (https://pi.dev) run headlessly against a local model.
*
* Invocation: `pi --provider
--model -p --mode json [--thinking ] \
* --session-id --session-dir ""`.
*
* Pi emits one JSON event per stdout line and exits when the run ends. The final
* assistant answer is the last `text` block of the last assistant message in the
* terminating `agent_end` event — reasoning models (e.g. Gemma 4) also emit
* `thinking` blocks, which we skip. Errors surface as an assistant message with
* `stopReason === "error"` and an `errorMessage`; we propagate that as
* EngineResult.error rather than swallowing it.
*
* Resume: Pi's session is keyed on the Jinn session id (`--session-id` + an
* isolated `--session-dir`), so re-running with the same id continues the same
* Pi conversation — no need to capture Pi's own session id.
*
* Provider/model: registry model ids are `provider/id` (e.g. "ollama/gemma4:12b").
* The provider is whatever the user configured in their Pi `~/.pi/agent/models.json`
* — the gateway never assumes Ollama or any specific backend.
*/
export declare class PiEngine implements InterruptibleEngine {
name: "pi";
private liveProcesses;
kill(sessionId: string, reason?: string): void;
killAll(): void;
/** Batch engine: no warm-PTY reuse, every live process is an in-flight turn.
* Nothing idle to recycle on org-reload — no-op. */
killIdle(): void;
isAlive(sessionId: string): boolean;
run(opts: EngineRunOpts): Promise;
/** Resolve a live run exactly once, mirroring Codex's close semantics. */
private settle;
private clearTimers;
/**
* Extract the final assistant answer + any error from an `agent_end` messages[]
* array. The answer is the last non-empty `text` content block across assistant
* messages (reasoning `thinking` blocks are ignored).
*/
private extractFromMessages;
/** Pull a streaming text delta out of a json-mode message_update (tolerant of shape). */
private extractDelta;
/** Human-readable summary of a tool_execution_start event for live streaming. */
private describeTool;
/** Extract a short text summary from a tool_execution_end result payload. */
private toolResultText;
private buildCleanEnv;
private signalProcess;
}
//# sourceMappingURL=pi.d.ts.map