/** * Session structure analysis for pi-omni-compact. * * Extracts structural metadata from the full session via * ctx.sessionManager.getEntries(). The analysis output is serialized * as a section in the compaction input, giving the * LLM a verified map of what happened before it reads the conversation. * * Pure computation on in-memory session data — no I/O, no LLM calls. */ import type { SessionEntry } from "@mariozechner/pi-coding-agent"; export interface SessionStats { messageCount: number; userMessageCount: number; assistantMessageCount: number; toolResultCount: number; compactionCount: number; branchPointCount: number; modelsUsed: string[]; } export interface SessionBoundary { type: "compaction" | "branch" | "resume" | "tree_jump"; timestamp: string; detail: string; } export interface FrictionSignals { rephrasingCascades: number; toolLoops: number; contextChurn: number; silentTermination: boolean; } export interface DelightSignals { resilientRecovery: boolean; oneShotSuccess: boolean; explicitPraise: boolean; } export interface FilesTouched { read: string[]; written: string[]; } export interface SessionAnalysis { stats: SessionStats; boundaries: SessionBoundary[]; friction: FrictionSignals; delight: DelightSignals; filesTouched: FilesTouched; } /** * Analyze a session's entries and extract structural metadata. * * Pure function: no I/O, no side effects. O(n) over entries. * Returns undefined if entries are empty or analysis fails. */ export declare function analyzeSession(entries: SessionEntry[]): SessionAnalysis | undefined; //# sourceMappingURL=session-analysis.d.ts.map