import type { PlatformAdapter, DownloadedFile } from '../platform/index.js'; import type { AgentResult } from '../core/types/agent-types.js'; export interface RunConversationOptions { adapter: PlatformAdapter; channel: string; /** The raw user message (without the default agent's directive). */ userMessage: string; /** Channel-level session to resume, or null for a fresh session. */ existingSessionId: string | null; /** Resolved session name for this turn. */ sessionName: string; files: DownloadedFile[]; startTime: number; /** Execution trigger; defaults to 'user'. Scheduled session-target dispatch passes 'scheduled'. */ trigger?: string; scheduleTaskId?: string | null; /** Profile override for `__active__` agents (used by scheduler). */ profileOverride?: string | null; /** Fired once the execution record is created, before the agent starts — lets the caller * attach an execution-scoped Cancel button to the status message. */ onExecutionStarted?: (executionId: string) => void | Promise; onAssistantMessage?: ((text: string) => void) | null; onProgress?: ((progress: any) => void) | null; onFallback?: ((...args: any[]) => Promise) | null; onToolUse?: ((name: string, input: any) => void) | null; onPlanWritten?: ((event: { path: string; content: string; toolUseId: string; }) => void) | null; onAskUserQuestion?: ((event: any) => void) | null; } export interface ConversationResult { result: AgentResult; executionId: string; /** Underlying agent process for the turn. Used by the background-task continuation path to * register a ContinuationSink on the (Claude) session. Opaque to other consumers. */ agentProcess?: unknown; } /** * Execute a single plain user-conversation turn against the active default agent — no thread, * no workspace, no artifact. Mirrors the legacy default-thread branch of runThread() exactly * (channel session reuse, useCoreMcp:false, isUserInitiated:true, single step) and the * register/complete lifecycle of lifecycle.ts:runRetryAgent. * * Does NOT catch agent errors: the caller's try/catch (agent-runner._executeReal) invokes * handleAgentError, which finalizes the execution record and removes the running-execution * entry via runningExecutions.fail(executionId). On success this function removes the entry via * runningExecutions.complete(executionId); handleAgentSuccess finalizes the execution record. */ export declare function runConversation(opts: RunConversationOptions): Promise;