/** * AgentSession - Individual session management * * Responsibilities: * - Load session state from persistence on initialization * - Parse transcripts using static parser (no sandbox needed) * - Lazily create sandbox only when sendMessage is called * - Execute agent queries in sandbox * - Track main transcript + subagent transcripts * - Monitor workspace file changes * - Sync state to persistence periodically * - Emit domain events to EventBus * - Notify SessionManager when sandbox terminates */ import type { ModalContext } from '../lib/sandbox/modal/client.js'; import type { PersistenceAdapter } from '../types/persistence-adapter.js'; import type { RuntimeSessionData, PersistedSessionListData, SessionRuntimeState, CreateSessionArgs } from '../types/session/index.js'; import type { EventBus } from './event-bus.js'; import type { AgentArchitectureSessionOptions } from '../lib/agent-architectures/base.js'; /** * Callback type for sandbox termination notification */ export type OnSandboxTerminatedCallback = (sessionId: string) => void; /** * AgentSession class - manages individual session lifecycle */ export declare class AgentSession { readonly sessionId: string; private sandboxPrimitive?; private architectureAdapter?; private sandboxId?; private sandboxStatus; private statusMessage?; private lastHealthCheck?; private sandboxRestartCount; private createdAt?; private lastActivity?; private blocks; private rawTranscript?; private subagents; private workspaceFiles; private sessionOptions?; private agentProfile; private architecture; private readonly modalContext; private readonly eventBus; private readonly persistenceAdapter; private onSandboxTerminated?; private syncInterval?; private sandboxHeartbeat?; static create(input: { sessionId: string; } | CreateSessionArgs, modalContext: ModalContext, eventBus: EventBus, persistenceAdapter: PersistenceAdapter, onSandboxTerminated?: OnSandboxTerminatedCallback): Promise; private constructor(); /** * Lazily create sandbox when needed (private, called by sendMessage) */ private activateSandbox; /** * Start file watchers for workspace and transcript directories */ private startWatchers; /** * Handle workspace file change events from adapter */ private handleWorkspaceFileChange; /** * Handle transcript change events from adapter. * Now receives the full combined transcript (main + subagents) on any change. */ private handleTranscriptChange; /** * Emit the current runtime status * @param message Optional human-readable status message for UI display */ private emitRuntimeStatus; /** * Send message to agent and stream responses */ sendMessage(message: string): Promise; private syncSessionStateWithSandbox; private persistFullSessionState; syncSessionStateToStorage(): Promise; updateSessionOptions(sessionOptions: AgentArchitectureSessionOptions): Promise; /** * Destroy session and cleanup resources */ destroy(): Promise; private stopWatchersAndJobs; /** * Get full session state for clients */ getState(): RuntimeSessionData; /** * Get minimal session data for persistence */ getPersistedListData(): PersistedSessionListData; /** * Get runtime state (isLoaded, sandbox info) */ getRuntimeState(): SessionRuntimeState; private startPeriodicSync; private startHealthMonitoring; } //# sourceMappingURL=agent-session.d.ts.map