import type { ParsedMessage, ChatMessage, Session } from './types.js';
import type { Logger } from 'pino';
import { registry } from './registry.js';
/** Route context passed through the routing pipeline */
export interface RouteContext {
    channelId: string;
    threadId: string;
    platform: string;
    defaultAgent: string;
    traceId: string;
    logger: Logger;
    userId?: string;
    /** Set by the routing layer when intent classification picks the agent.
     * Audit log records this so we can answer "why was this agent chosen?". */
    intent?: string;
    /** Pre-allocated UUID forwarded to adapters that support a resumable
     * session (currently claude-code's --session-id). Set by cli when an
     * IM message is about to invoke a claude-code run, so the placeholder
     * can show the same id the user will later use with `claude --resume`. */
    agentSessionId?: string;
    /** True when the adapter should --resume an existing session under
     *  agentSessionId instead of creating a new one. */
    agentSessionResume?: boolean;
    /** Callback invoked by the router once the final agent is determined
     *  (after intent classification). CLI uses this to lazily prepare native
     *  agent sessions (Claude UUID, opencode session, etc.) only for the
     *  agent that will actually run. */
    onAgentResolved?: (agentName: string) => Promise<void>;
    /** A2A-L1: inline-jobs row id tracking THIS run. cli.ts stashes the
     *  freshly-created inlineJobId here so callAgentWithHistory forwards it
     *  into AgentSendOpts → adapter.registerRun → RunContext.parentJobId.
     *  Any mcp__imhub__call_agent fired from inside the run then knows what
     *  parent_id to stamp on its callee row. */
    parentJobId?: number;
    /** A2A-L1: call_depth (0 for user-originated runs). */
    callDepth?: number;
}
export interface AgentCallOptions {
    /** Session key suffix used for history/user/assistant/usage persistence. */
    storageThreadId?: string;
    /** Adapter-native session id override for this invocation. */
    agentSessionId?: string;
    /** Adapter-native resume flag override for this invocation. */
    agentSessionResume?: boolean;
}
/**
 * Parse a message to determine how to route it
 *
 * Command format: /alias prompt... or /agent-name prompt...
 * Built-in commands: /status, /help, /agents
 */
export declare function parseMessage(text: string): ParsedMessage;
/**
 * Route a parsed message to the appropriate handler
 */
export declare function routeMessage(parsed: ParsedMessage, ctx: RouteContext): Promise<string | AsyncGenerator<string>>;
/**
 * Call agent with conversation history and save messages.
 * Exported so command handlers (commands/*.ts) can reuse it.
 */
export declare function callAgentWithHistory(agent: ReturnType<typeof registry.findAgent>, sessionId: string, prompt: string, history: ChatMessage[], ctx: RouteContext, model?: string, variant?: string, planMode?: boolean, options?: AgentCallOptions): Promise<AsyncGenerator<string>>;
export declare function prepareSubtaskAgentCallOptions(agentName: string, ctx: RouteContext, storageThreadId: string, subSession: Pick<Session, 'claudeSessionId' | 'claudeSessionPrimed' | 'opencodeSessionId' | 'codexSessionId'>): Promise<AgentCallOptions>;
//# sourceMappingURL=router.d.ts.map