/**
 * Transcript rows persisted on disk may include non-LLM entries (e.g. `kind: 'context'`).
 * {@link buildSessionContextForLlm} is the single choke point for provider-facing history.
 *
 * Do not pass raw on-disk JSONL rows into pi-agent / providers — always run
 * {@link buildSessionContextForLlm} first (or use {@link SessionStore.loadMessages}, which already does).
 */
import type { AgentMessage } from '@earendil-works/pi-agent-core';
/** Persisted-only row: never sent to the model as a chat message. */
export interface XopcTranscriptContextEntry {
    kind: 'context';
    id?: string;
    /** Short human-readable line for UIs / logs. */
    text?: string;
    /** Structured payload (tool summaries, delivery metadata, etc.). */
    data?: Record<string, unknown>;
    createdAt?: string;
}
export type TranscriptStoredRow = AgentMessage | XopcTranscriptContextEntry;
export declare function isTranscriptContextEntry(x: unknown): x is XopcTranscriptContextEntry;
/**
 * Normalize a JSON array from on-disk transcript into stored rows (drops unrecognized objects).
 */
export declare function transcriptRowsFromJsonArray(arr: unknown[]): TranscriptStoredRow[];
/** Messages only — what providers and pi-agent should see. */
export declare function buildSessionContextForLlm(rows: TranscriptStoredRow[]): AgentMessage[];
/**
 * When persisting LLM messages, keep prior `kind: 'context'` rows in their relative positions:
 * each non-context slot in the previous file is replaced by the next incoming LLM message;
 * trailing new LLM rows are appended. Extra old LLM rows are dropped if the new list is shorter.
 */
export declare function mergeLlmMessagesPreservingContextRows(prevRows: TranscriptStoredRow[], llmMessages: AgentMessage[]): TranscriptStoredRow[];
