import type { AgentEvent, AgentMessage } from "@mariozechner/pi-agent-core";
import type { Model, Api } from "@mariozechner/pi-ai";
import type { PipelineRunner } from "../pipeline/runner.js";
export interface AgentSessionConfig {
    /** Unique session identifier (typically the BookSession id). */
    sessionId: string;
    /** Book ID, or null if in "new book" mode. */
    bookId: string | null;
    /** Language for the system prompt. */
    language: string;
    /** PipelineRunner for sub-agent tool delegation. */
    pipeline: PipelineRunner;
    /** Project root directory (books/ lives under this). */
    projectRoot: string;
    /** pi-ai Model to use, or provider+modelId to resolve via getModel. */
    model: Model<Api> | {
        provider: string;
        modelId: string;
    };
    /** Optional API key. When omitted, falls back to env-based key lookup. */
    apiKey?: string;
    /** Allow the read tool to read absolute paths outside projectRoot/books. Defaults to false; set INKOS_AGENT_ALLOW_SYSTEM_READ=1 to enable. */
    allowSystemFileRead?: boolean;
    /** Optional listener for streaming events (for SSE forwarding). */
    onEvent?: (event: AgentEvent) => void;
}
export interface AgentSessionResult {
    /** Extracted text from the final assistant message. */
    responseText: string;
    /** Full raw Agent conversation history. */
    messages: AgentMessage[];
    /** Upstream model error surfaced by pi-agent-core, if the final assistant turn failed. */
    errorMessage?: string;
}
/**
 * Run a single conversation turn within a cached Agent session.
 *
 * If the session already exists in the cache, reuses the Agent (with its full
 * in-memory message history including tool calls). Otherwise creates a new
 * Agent, optionally restoring messages from `initialMessages`.
 */
export declare function runAgentSession(config: AgentSessionConfig, userMessage: string, initialMessages?: Array<{
    role: string;
    content: string;
}>): Promise<AgentSessionResult>;
/** Manually evict a cached Agent session. */
export declare function evictAgentCache(sessionId: string): boolean;
//# sourceMappingURL=agent-session.d.ts.map