import { SentenceSplitter } from "../misc/Misc";
import { LlmClient } from "../worker/llm-client";
import { GenerateOptions, Message, ModelProvider } from "../worker/types/types";
/** The manager-level handle you get back for a streaming generation. */
export type GenerationHandle = {
    /** Correlation id for this request (matches worker/client). */
    requestId: string;
    /** Cancel this request and await worker acknowledgement. */
    cancel: () => Promise<void>;
    /** Promise that resolves with the final text (or rejects on error). */
    promise: Promise<string>;
};
/** Status type derived from the client’s getStatus() return. */
export type ManagerMessageStatus = ReturnType<LlmClient["getStatus"]>;
/**
 * High-level LLM Manager that:
 * - initializes the worker (once),
 * - exposes both simple one-shot generation and streaming generation,
 * - lets you cancel by request id,
 * - and query per-request status.
 */
export declare class LlmManager {
    private _client;
    _sentenceSplitter: SentenceSplitter;
    /**
     * Tracks the initialization process:
     *  - `true` once init completed (success or handled error),
     *  - otherwise a Promise that resolves/rejects with the client's initialize result.
     */
    private _initPromise;
    /** Default path to the compiled worker bundle. */
    static workerPath: "/aic-runtime-deps/llm-deps/llm-worker.js";
    /**
     * Create an LlmManager and kick off initialization immediately.
     *
     * @param workerPath Path to the worker JS module (ignored in sync mode).
     * @param sync Run the worker in-process (no true streaming); primarily for tests/dev.
     */
    constructor(workerPath?: string, sync?: boolean, sentenceSplitter?: SentenceSplitter, modelProvider?: ModelProvider);
    /**
     * Ensure the underlying worker has been initialized.
     * Safe to call multiple times; subsequent calls are no-ops.
     *
     * Manager logs the initialize result and continues (even on error),
     * mirroring your original behavior.
     */
    private _ensureInitialized;
    /**
     * Simple convenience method: waits for the final text and returns it.
     * No streaming, no handle. (Backwards compatible with your original API.)
     *
     * @param messages Chat messages to render into a prompt.
     * @param maxTokens Max new tokens to generate.
     * @returns Final generated text.
     */
    generateResponse(messages: Message[], maxTokens: number, options?: GenerateOptions): Promise<string>;
    /**
     * Start a **streaming** generation and get a handle to:
     *  - listen for `onStart` / `onDelta` / `onToken` / `onEnd`,
     *  - `cancel()` the request (awaiting the worker’s acknowledgement),
     *  - await `promise` for the final text.
     *
     * Note: If a previous request is still active, the client will auto-cancel it
     * and await the worker’s ack *before* starting this one.
     *
     * @param messages Chat messages to render into a prompt.
     * @param maxTokens Max new tokens to generate.
     * @param options Streaming and callback options. Provide a `requestId` if you want to control it.
     * @returns A { requestId, cancel, promise } handle.
     */
    generateStreaming(messages: Message[], maxTokens: number, options?: GenerateOptions): Promise<GenerationHandle>;
    /**
     * Cancel a specific in-flight request by id and await worker confirmation.
     * If the request is already done or unknown, resolves immediately.
     *
     * @param requestId The correlation id to cancel.
     */
    cancel(requestId: string): Promise<void>;
    /**
     * Get the current status for a request id:
     *  - "pending" | "streaming" | "completed" | "error" (and possibly "cancelled" if your client adopted it)
     *
     * @param requestId The correlation id to check.
     * @returns Status string or undefined if unknown.
     */
    getStatus(requestId: string): ManagerMessageStatus;
    /**
     * Access the client's public messageStatus map (read-only usage recommended).
     * Useful for UIs that list all in-flight/completed requests.
     */
    get messageStatus(): Record<string, {
        id: string;
        status: import("../worker/types/types").MessageStatus;
        error?: string;
    }>;
}
//# sourceMappingURL=LlmManager.d.ts.map