/** * SessionManager interface and implementation for @a5c-ai/agent-mux. * * Provides read-only access to agent session data stored in each agent's * native format. Delegates parsing and listing to agent adapters. * * @see 07-session-manager.md */ import type { AgentName } from './types.js'; import type { AdapterRegistry } from './adapter-registry.js'; export type { SessionToolCall, SessionMessage, SessionSummary, FullSession, Session, SessionListOptions, SessionQuery, CostAggregationOptions, CostSummary, CostBreakdown, SessionDiff, DiffOperation, } from './session-types.js'; import type { SessionSummary, FullSession, SessionListOptions, SessionQuery, CostAggregationOptions, CostSummary, SessionDiff } from './session-types.js'; /** Read-only access to agent session data. */ export interface SessionManager { /** List sessions for a specific agent. */ list(agent: AgentName, options?: SessionListOptions): Promise; /** Retrieve full session content. */ get(agent: AgentName, sessionId: string): Promise; /** Full-text search across sessions. */ search(query: SessionQuery): Promise; /** Aggregate cost data across sessions. */ totalCost(options?: CostAggregationOptions): Promise; /** Export a session in a specified format. */ export(agent: AgentName, sessionId: string, format: 'json' | 'jsonl' | 'markdown'): Promise; /** Compute structural diff between two sessions. */ diff(a: { agent: AgentName; sessionId: string; }, b: { agent: AgentName; sessionId: string; }): Promise; /** Map a native session ID to a unified cross-agent ID. */ resolveUnifiedId(agent: AgentName, nativeSessionId: string): string; /** Parse a unified session ID back into agent and native ID. */ resolveNativeId(unifiedId: string): { agent: AgentName; nativeSessionId: string; } | null; } /** * Implementation of SessionManager. * * Delegates session file I/O to the adapter registry. Provides * filtering, sorting, search, cost aggregation, export, diff, and * unified ID resolution. */ export declare class SessionManagerImpl implements SessionManager { private readonly _adapters; private readonly logger; constructor(adapters: AdapterRegistry); private _getAdapter; list(agent: AgentName, options?: SessionListOptions): Promise; get(agent: AgentName, sessionId: string): Promise; search(query: SessionQuery): Promise; totalCost(options?: CostAggregationOptions): Promise; export(agent: AgentName, sessionId: string, format: 'json' | 'jsonl' | 'markdown'): Promise; diff(a: { agent: AgentName; sessionId: string; }, b: { agent: AgentName; sessionId: string; }): Promise; resolveUnifiedId(agent: AgentName, nativeSessionId: string): string; resolveNativeId(unifiedId: string): { agent: AgentName; nativeSessionId: string; } | null; }