import {
  _ as DynamicRouteId,
  b as WorkersAIModelId,
  c as GatewayOptions,
  d as CatalogModelId,
  s as AISettings
} from "../../transport-5moD2pW5.js";
import {
  o as CloudflareLanguageModelId,
  u as ModelOptions
} from "../../index-8k4qsX1T.js";
import { Plugin } from "@opencode/plugin";

//#region src/models/opencode/index.d.ts
/** The OpenCode provider id `createAI`'s plugin registers. */
declare const CLOUDFLARE_PROVIDER_ID = "cloudflare";
/**
 * A model as OpenCode references one: pass it to `OpenCodeHarness`'s
 * `defaults.model`, `session.setModel`, or OpenCode's `sessions.switchModel`.
 */
type OpenCodeModel = {
  readonly providerID: string;
  readonly id: string;
};
/** How OpenCode budgets a model's context. */
type OpenCodeModelLimit = {
  /** Context window, in tokens. Default 128_000. */ readonly context: number /** Most tokens OpenCode asks the model to generate. Default 8_192. */;
  readonly output: number;
};
/** Options for one model: `agents/models/ai-sdk`'s, plus OpenCode's limit. */
type OpenCodeModelOptions = ModelOptions & {
  readonly limit?: OpenCodeModelLimit;
};
/**
 * The provider `createAI` returns. Call it with a model id — a Workers AI id,
 * an AI Gateway catalog id, or a dynamic route — to register the model with
 * the plugin and get OpenCode's reference to it.
 */
interface AI {
  /** A model, registered with the plugin. */
  (
    modelId: CloudflareLanguageModelId,
    options?: OpenCodeModelOptions
  ): OpenCodeModel;
  /** Same as calling the provider directly. */
  model(
    modelId: CloudflareLanguageModelId,
    options?: OpenCodeModelOptions
  ): OpenCodeModel;
  /** The OpenCode plugin. Pass it in `OpenCodeWorkerd.create({ plugins })`. */
  readonly plugin: Plugin.Plugin;
}
/**
 * Create Cloudflare's model provider for OpenCode.
 *
 * @param settings - The `AI` binding, or an account id and API token, and
 *   gateway defaults, as for `agents/models/ai-sdk`.
 * @returns The provider: call it with model ids; register `plugin`.
 */
declare function createAI(settings: AISettings): AI;
//#endregion
export {
  AI,
  type AISettings,
  CLOUDFLARE_PROVIDER_ID,
  type CatalogModelId,
  type CloudflareLanguageModelId,
  type DynamicRouteId,
  type GatewayOptions,
  type ModelOptions,
  OpenCodeModel,
  OpenCodeModelLimit,
  OpenCodeModelOptions,
  type WorkersAIModelId,
  createAI
};
//# sourceMappingURL=index.d.ts.map
