/** * Agent Orchestrator - Coordinates Agent execution flow * * Manages the complete agent execution pipeline from message processing * to response generation. */ import type { Config } from '../../config/schema.js'; import type { InboundMessage } from '../../infra/bus/index.js'; import type { SessionConfigStore, SessionStore } from '../../session/index.js'; import type { SessionHydrator } from '../session/index.js'; import type { ThinkLevel } from '../transcript/thinking-types.js'; import type { ModelManager } from '../models/index.js'; import type { SessionContext } from '../session/session-context.js'; import type { AgentManager } from '../agent-manager.js'; import type { EmbeddedStreamEvent } from '../embedded/types.js'; export interface AgentOrchestratorConfig { agentManager: AgentManager; sessionStore: SessionStore; modelManager: ModelManager; sessionConfigStore: SessionConfigStore; /** Per-session hydration (workspace override + model override) before the agent runs. */ sessionHydrator: SessionHydrator; getThinkingDefault: () => ThinkLevel | undefined; /** Per-session default from merged `agents.list` / defaults (optional). */ getThinkingDefaultForSession?: (sessionKey: string) => ThinkLevel | undefined; /** Default workspace root when no per-session resolver is set. */ workspaceRoot: string; /** Per-agent workspace root for attachments (optional; defaults to `workspaceRoot`). */ getWorkspaceRootForSession?: (sessionKey: string) => string; /** Agent home (`…/agents//`) for inbound/TTS files — keeps internal state out of the markdown workspace. */ getAgentInternalStorageRootForSession?: (sessionKey: string) => string; /** Fire-and-forget after full session persist (e.g. LLM session title); not called from mid-turn snapshots. */ enqueueAutoTitle?: (sessionKey: string) => void; /** For per-turn timeout. */ getConfig?: () => Config | undefined; /** Channel streaming: token/tool events from pi embedded session. */ onEmbeddedStreamEvent?: (sessionKey: string, event: EmbeddedStreamEvent) => void; /** Called after a successful embedded turn with assistant plain text. */ onEmbeddedTurnComplete?: (sessionKey: string, lastAssistantText?: string) => void; } export declare class AgentOrchestrator { private agentManager; private sessionStore; private modelManager; private sessionConfigStore; private sessionHydrator; private getThinkingDefault; private getThinkingDefaultForSession?; private enqueueAutoTitle?; private getConfig?; private onEmbeddedStreamEvent?; private onEmbeddedTurnComplete?; constructor(config: AgentOrchestratorConfig); /** * Process a message through the agent orchestration pipeline */ process(msg: InboundMessage, context: SessionContext): Promise; /** * Get the current agent model ID */ getCurrentModel(): string; /** * Check if agent is currently processing for a session */ isProcessing(sessionKey: string): boolean; /** * Abort current agent execution for a session */ abort(sessionKey: string): void; }