/** * Adapter: wrap a custom `ApiHandler` (from the `@cline/llms` handler registry) * as an `AgentModel` for the agent runtime. * * The agent runtime builds models via `createAgentModelFromConfig`, which goes * straight to the gateway. Hosts can register provider handlers that need * host-only dependencies (e.g. the VS Code `vscode.lm` API) via * `registerHandler(providerId, factory)`. Those produce an `ApiHandler` * (`createMessage` -> `ApiStreamChunk`), which this adapter converts into the * `AgentModel` contract (`stream` -> `AgentModelEvent`). * * This is the inverse of the gateway's `toApiStreamChunk` in * `@cline/llms` `compat.ts`. */ import type { ApiHandler } from "@cline/llms"; import type { AgentModel } from "@cline/shared"; /** * Resolves the `ApiHandler` to delegate to. A function is supported (and may be * async) so handler construction can be deferred to the first `stream` call — * which is required for providers registered via `registerAsyncHandler`. */ export type ApiHandlerSource = ApiHandler | (() => ApiHandler | Promise); /** * Build an `AgentModel` that delegates to a registered `ApiHandler`. */ export declare function createAgentModelFromApiHandler(source: ApiHandlerSource): AgentModel;