/** * Session Management - Session, Run, and Trace tracking */ export interface SessionConfig { id?: string; metadata?: Record; } export interface RunConfig { id?: string; metadata?: Record; } export interface TraceConfig { id?: string; name: string; attributes?: Record; } export type RunStatus = 'pending' | 'running' | 'completed' | 'failed'; export type TraceStatus = 'pending' | 'running' | 'completed' | 'failed'; export interface Message { id: string; role: 'system' | 'user' | 'assistant' | 'tool'; content: string | null; name?: string; tool_call_id?: string; tool_calls?: any[]; timestamp: number; runId?: string; } /** * Trace represents a span within a run (e.g., LLM call, tool call) */ export declare class Trace { readonly id: string; readonly runId: string; readonly name: string; readonly parentId: string | null; readonly startTime: number; endTime: number | null; status: TraceStatus; attributes: Record; private children; constructor(runId: string, config: TraceConfig, parentId?: string | null); start(): this; complete(attributes?: Record): this; fail(error?: Error): this; get duration(): number | null; createChild(config: TraceConfig): Trace; getChildren(): Trace[]; toJSON(): Record; } /** * Run represents a single execution within a session (e.g., one chat call) */ export declare class Run { readonly id: string; readonly sessionId: string; readonly startTime: number; endTime: number | null; status: RunStatus; error: Error | null; metadata: Record; private traces; private messages; constructor(sessionId: string, config?: RunConfig); start(): this; complete(metadata?: Record): this; fail(error: Error): this; get duration(): number | null; createTrace(config: TraceConfig): Trace; addMessage(message: Omit): Message; getTraces(): Trace[]; getMessages(): Message[]; toJSON(): Record; } /** * Session represents a conversation session with message history */ export declare class Session { readonly id: string; readonly createdAt: number; metadata: Record; private _runs; private _messages; constructor(config?: SessionConfig); createRun(config?: RunConfig): Run; get runs(): Run[]; get messages(): Message[]; addMessage(message: Omit): Message; getMessagesForLLM(): Array<{ role: string; content: string | null; tool_call_id?: string; tool_calls?: any[]; }>; clearMessages(): void; toJSON(): Record; } /** * SessionManager for managing multiple sessions */ export declare class SessionManager { private sessions; create(config?: SessionConfig): Session; get(id: string): Session | undefined; getOrCreate(id: string, config?: Omit): Session; list(): Session[]; delete(id: string): boolean; clear(): void; toJSON(): Record; } export declare function getSessionManager(): SessionManager; export { HierarchicalSession, createHierarchicalSession, type HierarchicalSessionConfig, type SessionScope, } from './hierarchy'; export { Session as EnhancedSession, createSession, type SessionConfig as EnhancedSessionConfig, type SessionState, type SessionMessage, } from './session'; export { MemorySessionStore, FileSessionStore, createSessionStore, createStoredSession, type StoredSession, type SessionStoreConfig, type ISessionStore } from './store'; export { SessionParts, createSessionParts, type SessionPart, type SessionPartType, type SessionPartsConfig } from './parts';