/** * StreamingBaseAdapter — Abstract base for all streaming-capable adapters. * * Extends {@link BaseAdapter} with a default `executeAgentStream()` that wraps * the non-streaming `executeAgent()` result as a single `StreamingChunk`. * Subclasses override `executeAgentStream()` and/or `supportsStreaming()` to * provide genuine incremental streaming. * * @module StreamingBaseAdapter * @version 1.0.0 */ import type { AgentPayload, AgentContext } from '../types/agent-adapter'; import type { IStreamingAdapter, StreamingChunk } from '../types/streaming-adapter'; import { BaseAdapter } from './base-adapter'; export declare abstract class StreamingBaseAdapter extends BaseAdapter implements IStreamingAdapter { /** * Returns `true` when the named agent has a real streaming implementation. * Default: `false` (fallback single-chunk wrapper is used). * Override in subclasses that register streaming agents. */ supportsStreaming(_agentId: string): boolean; /** * Default streaming implementation — wraps `executeAgent()` as a single chunk. * * Subclasses that support genuine streaming should override this method. * The overriding implementation should: * 1. yield partial text chunks as they arrive * 2. yield a final chunk with `done: true` and `text: ''` * * **Permission-check semantics:** Permission is checked once at the start of * the stream (when `executeAgent` / the overriding implementation begins), * not per-chunk. A stream is treated as a single logical operation. Keep * stream lifetimes short and request the narrowest permission scope possible * to minimise the window between the initial check and stream completion. */ executeAgentStream(agentId: string, payload: AgentPayload, context: AgentContext): AsyncIterable; } /** * Utility: drain a streaming adapter into a single accumulated result. * * @example * const { output } = await collectStream(adapter.executeAgentStream('my-agent', payload, ctx)); */ export declare function collectStream(stream: AsyncIterable): Promise<{ output: string; chunks: StreamingChunk[]; }>; //# sourceMappingURL=streaming-base-adapter.d.ts.map