/** * Combines a single "constructor-provided" handler with a list of handlers * appended later (e.g. via fluent on*() calls), preserving registration order. */ export declare function collectHandlers(single: T | undefined, list: T[] | undefined): T[]; /** * Runs every handler with the given args, awaiting each in order. Use for * pure observers (onNewMessage, onEndMessage, onToolCallStart, onToolCallEnd) * where every registered handler should fire and none of them return a value. */ export declare function runAllHandlers(handlers: Array<(...args: Args) => unknown>, ...args: Args): Promise; /** * Runs every handler in order and returns the first defined (non-void) * result, but still calls the remaining handlers so every one of them gets a * chance to observe/react (mirrors the middleware-runner directive pattern). * Use for onToolCallError, where the first STOP/RETRY/CONTINUE wins. */ export declare function runDirectiveHandlers(handlers: Array<(...args: Args) => R | void | Promise>, ...args: Args): Promise; /** * Runs every handler in order, AND-ing boolean results together. Used for * onConfirmToolCall: every registered handler must approve for the call to * proceed. Short-circuits once a handler declines. */ export declare function runConfirmHandlers(handlers: Array<(...args: Args) => Promise | boolean>, ...args: Args): Promise; /** * Runs every handler in order, feeding each handler's (possibly transformed) * output into the next as its input. Used for onBeforeRequest/onAfterResponse, * where each handler may rewrite the value for downstream handlers. */ export declare function runChainHandlers(handlers: Array<(value: T) => Promise | T | void>, initial: T): Promise; //# sourceMappingURL=handler-stacking.d.ts.map