import type { ParsedMessage, ChatMessage, AgentTurnOutcome } from './types.js'; import type { Logger } from 'pino'; import { registry } from './registry.js'; import { type SessionStickyFields } from './agent-session-bindings.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; /** 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__agim__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; /** Cancellation for the current inbound turn. Inline jobs bind this to the * job-board controller so /abort reaches every adapter. */ signal?: AbortSignal; /** Structured terminal state reported by the selected adapter. Consumers * (CLI/job/web) use it after draining the generator. */ agentOutcome?: AgentTurnOutcome; /** Web chat WS run id — correlated with SPA ChatActivityBlock. */ webRunId?: string; /** Live tool activity callback for web chat (Agim Agent harness). */ onToolActivity?: import('./types.js').AgentSendOpts['onToolActivity']; } 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>; /** * Call agent with conversation history and save messages. * Exported so command handlers (commands/*.ts) can reuse it. */ export declare function callAgentWithHistory(agent: ReturnType, sessionId: string, prompt: string, history: ChatMessage[], ctx: RouteContext, model?: string, variant?: string, planMode?: boolean, options?: AgentCallOptions): Promise>; export declare function prepareSubtaskAgentCallOptions(agentName: string, ctx: RouteContext, storageThreadId: string, subSession: SessionStickyFields): Promise; //# sourceMappingURL=router.d.ts.map