/** * Per-session metadata projection for the clickable sidebar. Entries only * exist for sessions present in `activeSessions`; they never activate a * session by themselves. The key is always the full sessionID — never an * alias — and the parent link lives exclusively in `sessionParents`. */ export interface TuiSessionDetails { alias?: string; /** providerID/modelID observed for this specific session. */ model?: string; status?: 'busy' | 'retry'; } export interface TuiSnapshot { version: 1; updatedAt: number; agentModels: Record; agentVariants: Record; activeSessions: Record; /** * Recording process per activity; used to sweep crash residue. */ activityPids: Record; /** * Persistent child→parent index for the project, independent of live * activities. The single authority for scoping: both the visible route * session and every active session resolve their conversation root * against this same index at render time (#1147), so a late-learned * link re-roots everything consistently. Shared v2 daemons record * activities for every window from one process, so process identity * cannot scope the sidebar; the session tree can. */ sessionParents: Record; /** Per-active-session details (alias/model/status) for the sidebar. */ sessionDetails: Record; } export declare function getTuiStatePath(projectDir: string): string; export declare function readTuiSnapshot(projectDir: string): TuiSnapshot; export declare function readTuiSnapshotAsync(projectDir: string): Promise; export declare function snapshotSectionsEqual(a: TuiSnapshot, b: TuiSnapshot): boolean; export declare function recordTuiAgentModels(input: { agentModels: Record; agentVariants?: Record; }, projectDir: string): void; export declare function recordTuiAgentModel(input: { agentName: string; model: string; variant?: string | null; }, projectDir: string): void; export declare function recordTuiAgentActivity(input: { sessionID: string; agentName: string; active: true; details?: TuiSessionDetails; } | { sessionID: string; active: false; }, projectDir: string): void; /** * Update per-session sidebar details (alias/model/status) for an ACTIVE * session only. A late detail update after idle must never resurrect an * activity entry — the whole update is dropped when the session is gone * from `activeSessions` at commit time (under the same lock). */ export declare function updateTuiSessionDetails(sessionID: string, details: TuiSessionDetails, projectDir: string): void; /** * Retract only the alias of an active session (e.g. its board record was * dropped). Model/status survive; the session stays visible in the * sidebar under its abbreviated sessionID until it goes idle. */ export declare function clearTuiSessionAlias(sessionID: string, projectDir: string): void; export declare function clearTuiAgentActivities(projectDir: string): void; /** * Record a child→parent link so any process (recorder or TUI) can resolve * a session to its conversation root, surviving restarts and revives * (#1147). Roots are never stored per-activity: render resolves the * visible session and every active session against this same index, so a * late-learned link re-roots everything consistently. */ export declare function recordTuiSessionParent(sessionID: string, parentID: string, projectDir: string): void; /** Resolve a session to its conversation root via the persistent index. */ export declare function resolveTuiSessionRoot(sessionID: string, projectDir: string): string; /** * Root of a session according to an already-loaded snapshot. Used by the * render side: the visible route session (possibly a child) must be * compared against activity roots, not against itself (#1147). */ export declare function resolveTuiSnapshotRoot(snapshot: TuiSnapshot, sessionID: string): string;