import type { SpawnMode, SpawnUsage } from "../types.js"; import type { AcpEvent } from "./types.js"; export interface SessionToolCall { id?: string; kind?: string; title?: string; input?: unknown; path?: string; } export interface SessionResult { output: string; messages: string[]; toolCalls: SessionToolCall[]; } export interface SpawnContext { sessionId: string; agent: string; logPath?: string; logDir?: string; logFileName?: string; logContent?: boolean; events: AcpEvent[]; usage: SpawnUsage; eventStream?: AsyncIterable; sessionResult?: SessionResult; threadId?: string; prompt?: string; model?: string; mode?: SpawnMode; cwd?: string; startedAt?: Date; logFile?: string; /** Reason the spawn log could not be written, when logging failed. */ logError?: string; metadata?: Record; } export type AcpMiddleware = (ctx: SpawnContext, next: () => Promise) => Promise; export declare function applyMiddlewares(middlewares: AcpMiddleware[], ctx: SpawnContext): Promise;