import type { AgentConfig, HarnessConfig, HarnessStreamPart, Session, StreamOptions } from '../types/index.js'; import type { MemoryService } from '../memory/MemoryService.js'; import type { ToolExecutor } from '../foundation/ToolExecutor.js'; import type { ConversationState } from '../foundation/ConversationState.js'; import type { ConversationEventLog } from '../foundation/ConversationEventLog.js'; import type { AgentStateController } from '../foundation/AgentStateController.js'; import type { OrchestrationAuthority } from '../orchestration/OrchestrationAuthority.js'; /** * Text-mode runtime facade. Flow graph execution (expression transitions, tool nodes, * per-node models) is implemented in FlowManager (wired through FlowExecutor). */ export declare class Runtime { private readonly config; private abortControllers; private _userIdWarned; private sessionMutex; private turnServices; private _authority; private _sessionStore; private _memoryService; private _toolExecutor; private _conversationState; private _eventLog; private _agentStateController; constructor(config: HarnessConfig); get sessionStore(): NonNullable; get memoryService(): MemoryService | undefined; /** Foundation services — shared primitives reusable by VoiceEngine etc. */ get foundation(): { toolExecutor: ToolExecutor; conversationState: ConversationState; eventLog: ConversationEventLog; agentState: AgentStateController; }; /** * The core orchestration authority shared by this Runtime. * * This authority uses the same backing services (session store, hook runner, * tool executor, etc.) as the text pipeline. Use it to construct a * RealtimeRuntime that shares state with this Runtime: * * ```typescript * const runtime = createRuntime(config); * const realtimeRuntime = new RealtimeRuntime({ * agents: config.agents, * defaultAgentId: config.defaultAgentId, * authority: runtime.authority, * }); * ``` * * This ensures text and realtime sessions share the same session store, * the same hooks fire for both paths, and agent state is consistent. */ get authority(): OrchestrationAuthority; getActiveAbortController(sessionId: string): AbortController | undefined; abortSession(sessionId: string, reason?: string): void; getSession(id: string): Promise; deleteSession(id: string): Promise; getAgent(id: string): AgentConfig | undefined; getAllAgents(): AgentConfig[]; chat(sessionId: string, input: string, userId?: string): AsyncGenerator; stream(options: StreamOptions): AsyncGenerator; /** * Inner stream implementation — separated so the mutex can wrap the * entire async generator lifecycle from IntakeStage through PostStreamStage. */ private _streamInner; private setupAbortHandlers; } export declare function createRuntime(config: HarnessConfig): Runtime;