import { type ModelCallAnalyticsWriter } from './analyticsTable.ts';
import { ServerError } from '../../utility/errors/hdbError.ts';
import type { EmbedOpts, GenerateChunk, GenerateInput, GenerateOpts, GenerateResult, Models as ModelsContract } from './types.ts';
type MetricEmitter = (value: number, metric: string, path?: string) => void;
/**
 * Process-wide singleton. One shared instance serves all Scopes — `scope.models`,
 * `global.models`, and `import { models } from 'harperdb'` all alias the same object.
 *
 * On every call:
 * - Resolves the configured backend via `backendRegistry`.
 * - Reads the ALS-bound request `Context` to extract accounting context
 *   (tenantId, handlerPath) and an `AbortSignal`. Outside an ALS scope
 *   (app-init, internal jobs), accounting is empty and signal is undefined.
 * - Records the call to `hdb_model_calls` via the buffered writer — both
 *   successful and failed calls land in the table for billing visibility.
 *   Pre-call resolution / capability errors land too, with `backend: 'unknown'`.
 *
 * The ALS pattern matches `resources/Table.ts:3517` and is rooted at
 * `resources/transaction.ts:6`.
 */
export declare class Models implements ModelsContract {
    #private;
    constructor(analyticsWriter?: ModelCallAnalyticsWriter, metricEmitter?: MetricEmitter);
    embed(input: string | string[], opts?: EmbedOpts): Promise<Float32Array[]>;
    generate(input: GenerateInput, opts?: GenerateOpts): Promise<GenerateResult>;
    generateStream(input: GenerateInput, opts?: GenerateOpts): AsyncIterable<GenerateChunk>;
}
export declare class ModelCapabilityError extends ServerError {
    constructor(backendName: string, capability: 'embed' | 'generate' | 'stream' | 'tools');
}
export declare class ModelPendingNotSupportedError extends ServerError {
    constructor(backendName: string);
}
/**
 * Process-wide `Models` singleton exposed to user code as the `models` global
 * (and as `import { models } from 'harperdb'`).  The Models class itself holds
 * no per-Scope or per-ApplicationScope state — the backend registry it reads
 * from is process-wide and accounting context comes from ALS — so one shared
 * instance is observationally identical to the per-Scope instances built in
 * `components/Scope.ts`, with the advantage that user resources can call
 * `models.embed(...)` without writing a `handleApplication` shim that stashes
 * `scope.models` on a global.
 */
export declare const models: Models;
export {};
