import { UnsupportedFeatureError } from "../errors/index.js";
/**
 * Abstract base class for all LLM providers.
 * Provides common functionality and default implementations for unsupported features.
 * Each provider must implement the abstract methods and can override default implementations.
 */
export class BaseProvider {
    get id() {
        return this.providerName();
    }
    defaultModel(_feature) {
        return "";
    }
    throwUnsupportedError(feature) {
        throw new UnsupportedFeatureError(this.providerName(), feature);
    }
    capabilities;
    /**
     * Provides a set of default capabilities where everything is disabled.
     * Useful for custom providers to start with a safe baseline.
     */
    defaultCapabilities() {
        return {
            supportsVision: () => false,
            supportsTools: () => false,
            supportsStructuredOutput: () => false,
            supportsEmbeddings: () => false,
            supportsImageGeneration: () => false,
            supportsTranscription: () => false,
            supportsModeration: () => false,
            supportsReasoning: () => false,
            supportsDeveloperRole: () => false,
            getContextWindow: () => null
        };
    }
    async *stream(_request) {
        this.throwUnsupportedError("stream");
        yield* [];
    }
    async listModels() {
        this.throwUnsupportedError("listModels");
    }
    async paint(_request) {
        this.throwUnsupportedError("paint");
    }
    async transcribe(_request) {
        this.throwUnsupportedError("transcribe");
    }
    async moderate(_request) {
        this.throwUnsupportedError("moderate");
    }
    async embed(_request) {
        this.throwUnsupportedError("embed");
    }
    formatToolResultMessage(toolCallId, content, options) {
        return {
            role: "tool",
            tool_call_id: toolCallId,
            content: content,
            isError: options?.isError
        };
    }
}
