import type { NormalizedDriverMessage } from "./messages.js"; import type { DriverEventEnvelope, RuntimeDriver, RuntimeDriverRunHandle, RuntimeDriverRunInput, RuntimeThinkingLevel } from "../types.js"; import { type PiCodingAgentThinkingLevel } from "./thinking.js"; export declare function parsePiCodingAgentEvent(event: unknown): NormalizedDriverMessage[]; export interface PiCodingAgentSessionLike { readonly sessionId: string; /** Absolute path to the SDK's JSONL session file, when persisted. */ readonly sessionFile?: string; subscribe(listener: (event: unknown) => void): () => void; prompt(text: string, options?: { expandPromptTemplates?: boolean; }): Promise; abort?: () => Promise | void; dispose?: () => void; } export interface PiCodingAgentSessionFactoryInput { cwd: string; prompt: string; model?: string; tools?: string[]; env?: Record; appendSystemPrompt?: string; resumeSessionId?: string; /** * Effective thinking level for this session, in the SDK-native vocabulary. * Resolved by the driver from the per-call `RuntimeDriverRunInput.thinkingLevel` * (folded via `foldThinkingLevelForPiCodingAgent` — `minimal → low`, * `xhigh → high`) with a fallback to `PiCodingAgentDriverOptions.defaultThinkingLevel`. * Always set. */ thinkingLevel: PiCodingAgentThinkingLevel; /** * Driver-owned directory for this runtime session's SDK state. Pinning the * SDK's `sessionDir` here decouples session lookup from `cwd`, so resume * works across worktree-per-turn callers (issue #5) and across process * restarts. Always set by the driver — defaults to a per-sessionId tmpdir * subtree when the runtime doesn't supply `sessionStorageDir`. */ driverSessionDir: string; } export type PiCodingAgentSessionFactory = (input: PiCodingAgentSessionFactoryInput) => Promise; export interface PiCodingAgentDriverOptions { /** Inject a custom session factory (used by tests; otherwise the real SDK is loaded). */ createSession?: PiCodingAgentSessionFactory; /** Default thinking level when none is configured. Accepts the runtime * superset; folded to SDK-native via `foldThinkingLevelForPiCodingAgent`. */ defaultThinkingLevel?: RuntimeThinkingLevel; } export declare class PiCodingAgentDriver implements RuntimeDriver { readonly name: "pi-coding-agent"; private readonly createSession; private readonly defaultThinkingLevel; constructor(options?: PiCodingAgentDriverOptions); run(input: RuntimeDriverRunInput, onEvent: (event: DriverEventEnvelope) => Promise | void): RuntimeDriverRunHandle; }