import type { SessionEntry, SessionMessageEntry } from "@oh-my-pi/pi-coding-agent"; import { type CoreMessage } from "acp-kernel"; type AgentMessage = SessionMessageEntry["message"]; export type { AgentMessage }; export declare function entriesToCoreMessages(entries: SessionEntry[]): CoreMessage[]; export declare function streamToCoreMessages(stream: AgentMessage[]): CoreMessage[]; /** Map of toolCallId → result text for tool results in the stream. Used to * skip replaying compress calls that were REJECTED live ("No changes * applied") — only calls that actually created blocks should rebuild them. */ export declare function toolResultTexts(stream: AgentMessage[]): Map; export type { StreamCompressCall } from "acp-kernel/wire"; import type { StreamCompressCall } from "acp-kernel/wire"; export declare function findCompressCalls(message: AgentMessage): StreamCompressCall[]; import { compressToolArgs } from "acp-kernel/wire"; export { compressToolArgs }; export declare function extractText(content: unknown, stripTags?: boolean): string; export declare function stripRefTag(text: string): string; export declare function messageIdentity(message: unknown): string; export declare function matchesStoredText(stored: string, visible: string): boolean; export declare function coreOutToAgentMessages(coreOut: CoreMessage[], originalById: Map): AgentMessage[]; /** 1-based stream position encoded in a p-id ("p7" | "p7#tc1" → 7). */ export declare function rawPos(rawId: string): number; /** Stable fingerprint of a covered span, computed from the deterministic core * projection: hash of the first and last covered CoreMessages' content * fields. Written into the compress tool's success result (which lives in * the stream) and re-verified on fold replay — if a host-side rewrite * (compaction, edit) shifted positions, the fingerprint mismatches and the * call is skipped instead of silently compressing the wrong messages. * Boundaries bind to the EXACT piece the ref names (parallel tool calls * split one stream message into several pieces sharing a position — * hashing "whatever is at that position" is position-collision-fragile). */ export declare function spanFingerprint(coreMessages: CoreMessage[], startId: string, endId: string): string; export interface BlockLike { blockId: string; effectiveMessageIds: string[]; } export declare function isBlockRef(ref: string): boolean; /** Resolve a range boundary ref to the EXACT raw id of the piece it names. * Message refs (mNNNNN) go through byRef; block refs (bN) resolve to the * earliest (min) or latest (max) covered message's raw id. "" = unresolved. */ export declare function boundaryRaw(ref: string, byRef: Record, blocks: BlockLike[], pick: "min" | "max"): string; /** One fingerprint per range (never filtered, "-" for unresolvable * boundaries) so replay-side index lookup stays aligned even for mixed * message/block boundary batches. Written into the compress tool result. */ export declare function rangeFingerprints(ranges: Array<{ startRef: string; endRef: string; }>, coreMessages: CoreMessage[], byRef: Record, blocks: BlockLike[]): string[];