import type { RuntimeEventBus } from '../runtime/events/index.js';
import type { LLMProvider } from './interface.js';
import type { ModelDefinition } from './registry.js';
import { LocalContextIngestionService } from '@pellux/goodvibes-sdk/platform/providers/local-context-ingestion';
/**
 * JSON schema for a custom provider configuration file.
 * Place a *.json file in the configured providers directory to define a custom provider.
 */
export interface CustomProviderConfig {
    /** Unique provider identifier, e.g. 'ollama' */
    name: string;
    /** Human-friendly display name, e.g. 'Ollama' */
    displayName: string;
    /**
     * API compatibility type.
     * - 'openai-compat': provider speaks the OpenAI Chat Completions API
     * - 'anthropic-compat': provider speaks the Anthropic Messages API (SSE streaming)
     */
    type: 'openai-compat' | 'anthropic-compat';
    /** Base URL for the API, e.g. 'http://localhost:11434/v1' */
    baseURL: string;
    /** Optional env var name whose value is used as the API key */
    apiKeyEnv?: string;
    /** Optional explicit API key (takes precedence over apiKeyEnv) */
    apiKey?: string;
    /** Optional extra HTTP headers sent with every request */
    defaultHeaders?: Record<string, string>;
    /** How to send reasoning params. Default: 'none' (don't send). */
    reasoningFormat?: 'mercury' | 'openrouter' | 'llamacpp' | 'none';
    /** List of models exposed by this provider */
    models: Array<{
        id: string;
        displayName: string;
        description?: string;
        contextWindow: number;
        selectable?: boolean;
        capabilities: {
            toolCalling: boolean;
            codeEditing: boolean;
            reasoning: boolean;
            multimodal: boolean;
        };
        reasoningEffort?: string[];
        /** Model capability tier — controls system prompt verbosity. */
        tier?: 'free' | 'standard' | 'premium';
    }>;
}
/** Result of loading all custom providers from disk. */
export interface LoadCustomProvidersResult {
    providers: Array<{
        config: CustomProviderConfig;
        provider: LLMProvider;
    }>;
    models: ModelDefinition[];
    warnings: string[];
}
/** Options for loadCustomProviders. */
export interface LoadCustomProvidersOptions {
    /** Directory that owns custom provider JSON files. */
    providersDir: string;
    /**
     * When true, attempts to fetch max_context_length from each provider's
     * /v1/models endpoint and uses the reported value with 'provider_api'
     * provenance. Falls back to the configured contextWindow or DEFAULT_CONTEXT_WINDOW.
     * Defaults to false.
     */
    ingestContextWindows?: boolean;
    contextIngestion?: Pick<LocalContextIngestionService, 'ingestProviderContextWindows'>;
}
/**
 * Load all custom providers from an owned providers directory.
 * Auto-creates the directory if it does not exist.
 * Invalid files are skipped with a warning rather than failing the whole load.
 *
 * When `options.ingestContextWindows` is true, each provider's /v1/models
 * endpoint is queried concurrently (via Promise.allSettled) to resolve
 * `max_context_length` with `provider_api` provenance.
 */
export declare function loadCustomProviders(options: LoadCustomProvidersOptions): Promise<LoadCustomProvidersResult>;
/**
 * Start watching an owned providers directory for file changes.
 * Debounces rapid events by 300ms before invoking the onChange callback.
 * Emits typed provider warnings if the watcher cannot be started.
 * Returns a handle with a `close()` method to stop watching.
 */
export declare function watchCustomProviders(runtimeBus: RuntimeEventBus | null, onChange: () => void, providersDir: string): {
    close: () => void;
};
//# sourceMappingURL=custom-loader.d.ts.map