import type { ImageContent, TextContent, Usage } from "@earendil-works/pi-ai"; import type { AgentMessage } from "../../types.ts"; import type { CustomEntry, SessionContext, SessionEntryCursorOptions, SessionMetadata, SessionStats, SessionStorage, SessionTreeEntry } from "../types.ts"; export type ContextEntryTransform = (entries: readonly SessionTreeEntry[]) => readonly SessionTreeEntry[]; export type CustomEntryContextMessageProjector = (entry: CustomEntry, index: number, entries: readonly SessionTreeEntry[]) => readonly AgentMessage[] | undefined; export interface SessionContextBuildOptions { /** Additional entry transforms applied after the default compaction transform. */ entryTransforms?: readonly ContextEntryTransform[]; /** Optional custom-entry projectors. Custom entries are omitted from model context by default. */ entryProjectors?: Readonly>; } export declare function defaultContextEntryTransform(pathEntries: readonly SessionTreeEntry[]): SessionTreeEntry[]; export declare function buildContextEntries(pathEntries: readonly SessionTreeEntry[], options?: SessionContextBuildOptions): SessionTreeEntry[]; export declare function sessionEntryToContextMessages(entry: SessionTreeEntry, index: number, entries: readonly SessionTreeEntry[], options?: SessionContextBuildOptions): AgentMessage[]; export declare function buildSessionContext(pathEntries: readonly SessionTreeEntry[], options?: SessionContextBuildOptions): SessionContext; export declare class Session { private storage; private contextBuildOptions; constructor(storage: SessionStorage, contextBuildOptions?: SessionContextBuildOptions); getMetadata(): Promise; getStorage(): SessionStorage; getLeafId(): Promise; getEntry(id: string): Promise; getEntries(options?: SessionEntryCursorOptions): Promise; getBranch(fromId?: string): Promise; buildContextEntries(options?: SessionContextBuildOptions): Promise; buildContext(options?: SessionContextBuildOptions): Promise; private mergeContextBuildOptions; getLabel(id: string): Promise; getSessionStats(): Promise; getSessionName(): Promise; private appendTypedEntry; appendMessage(message: AgentMessage): Promise; appendThinkingLevelChange(thinkingLevel: string): Promise; appendModelChange(provider: string, modelId: string): Promise; appendActiveToolsChange(activeToolNames: string[]): Promise; appendCompaction(summary: string, firstKeptEntryId: string | undefined, tokensBefore: number, details?: T, fromHook?: boolean, usage?: Usage, retainedTail?: AgentMessage[]): Promise; appendCustomEntry(customType: string, data?: unknown): Promise; appendCustomMessageEntry(customType: string, content: string | (TextContent | ImageContent)[], display: boolean, details?: T): Promise; appendLabel(targetId: string, label: string | undefined): Promise; appendSessionName(name: string): Promise; moveTo(entryId: string | null, summary?: { summary: string; details?: unknown; usage?: Usage; fromHook?: boolean; }): Promise; } //# sourceMappingURL=session.d.ts.map