/** Owns runtime pipeline hook registration, ordering, execution, and telemetry. Hook handlers receive the original runtime and share its canonical state-cache invalidation and output-sanitization policies. */ import type { PipelineHookContext, PipelineHookPhase, PipelineHookSpec, ResolvedPipelineHook } from "../types/pipeline-hooks.js"; import type { IAgentRuntime } from "../types/runtime.js"; export declare class RuntimePipelineHooks { private readonly runtime; constructor(runtime: IAgentRuntime); private pipelineHookEntries; private pipelineHookIdToIndex; /** * Per-phase, position-sorted hook lists, cached because the * `model_stream_chunk` phase is consulted once per streamed token — a * filter+sort over all registered hooks per token dominated the zero-hook * stream path. Invalidated wholesale on register/unregister (rare, * boot-time operations). Callers must treat the returned array as * read-only. */ private pipelineHooksByPhase; hooksForPhase(phase: PipelineHookPhase): ResolvedPipelineHook[]; upsertPipelineHook(entry: ResolvedPipelineHook): void; invokePipelineHooks(phase: PipelineHookPhase, ctx: PipelineHookContext, logLabel: string, pipelineHookTelemetry?: boolean): Promise; registerPipelineHook(spec: PipelineHookSpec): void; unregisterPipelineHook(id: string): void; /** * Run pipeline hooks for a phase (skip metadata, ordering, and outgoing sanitize + redact). * @param pipelineHookTelemetry When false, skips debug logs / `PIPELINE_HOOK_METRIC` per hook * (still logs warn/error for slow hooks). Defaults to false for `model_stream_chunk` only. */ applyPipelineHooks(phase: PipelineHookPhase, ctx: PipelineHookContext, pipelineHookTelemetry?: boolean): Promise; }