import { AdapterRequest, StreamChunk, AdapterFactory } from '@agentskit/core';

/**
 * Optional second AbortSignal keeps one-argument callbacks assignable
 * (extra parameters are optional). createAdapter races send against abort
 * and will not start work after pre-abort.
 */
interface CreateAdapterConfig {
    send: (request: AdapterRequest, signal?: AbortSignal) => Promise<ReadableStream | Response>;
    parse: (stream: ReadableStream, response?: Response) => AsyncIterableIterator<StreamChunk>;
    abort?: () => void;
}
interface GenericAdapterConfig {
    send: (request: AdapterRequest, signal?: AbortSignal) => Promise<ReadableStream>;
}

declare function createAdapter(config: CreateAdapterConfig): AdapterFactory;

export { type CreateAdapterConfig as C, type GenericAdapterConfig as G, createAdapter as c };
