import type { CommandRegistryLike } from '../runtime/host-ui.js';
import type { ModelDefinition, ProviderRegistry, TokenLimits, ModelTier } from '../providers/registry.js';
import type { LLMProvider } from '../providers/interface.js';
import type { ToolRegistry } from '../tools/registry.js';
import type { RuntimeEventBus, AnyRuntimeEvent, RuntimeEventPayload } from '../runtime/events/index.js';
import type { GatewayMethodCatalog, GatewayMethodDescriptor, GatewayMethodHandler } from '../control-plane/index.js';
import { type ChannelDeliveryStrategy, type ChannelPlugin } from '../channels/index.js';
import type { ChannelDeliveryRouter, ChannelPluginRegistry } from '../channels/index.js';
import type { MemoryEmbeddingProvider, MemoryEmbeddingProviderRegistry } from '../state/index.js';
import type { VoiceProvider, VoiceProviderRegistry } from '../voice/index.js';
import type { MediaProvider, MediaProviderRegistry } from '../media/index.js';
import type { WebSearchProvider, WebSearchProviderRegistry } from '../web-search/index.js';
/**
 * PluginProviderConfig — minimal config for registering a custom LLM provider
 * via an OpenAI-compatible endpoint.
 */
export interface PluginProviderConfig {
    /** Base URL for an OpenAI-compatible endpoint (e.g. "http://localhost:8080/v1"). */
    baseURL: string;
    /** API key. May be empty string for local/unauthenticated servers. */
    apiKey?: string | undefined;
    /** Model IDs this provider exposes. */
    models: string[];
    /** Optional display label shown in the model picker. */
    displayName?: string | undefined;
    /** Optional embedding model exposed by the endpoint. */
    embeddingModel?: string | undefined;
    /** Optional reasoning-format override for compatible endpoints. */
    reasoningFormat?: 'mercury' | 'openrouter' | 'llamacpp' | 'none' | undefined;
    /** Optional context-window metadata for runtime-registered model picker entries. */
    contextWindow?: number | undefined;
    /** Optional runtime capability hints for the registered model entries. */
    capabilities?: Partial<ModelDefinition['capabilities']> | undefined;
    /** Optional reasoning effort options surfaced in the picker. */
    reasoningEffort?: string[] | undefined;
    /** Optional provider tier surfaced in the picker. */
    tier?: ModelTier | undefined;
    /** Optional token limits surfaced in the picker. */
    tokenLimits?: TokenLimits | undefined;
    /** Optional auth env vars for provider posture. */
    authEnvVars?: readonly string[] | undefined;
    /** Optional service names that expose service-owned OAuth. */
    serviceNames?: readonly string[] | undefined;
    /** Optional subscription-provider identity used for stored OAuth posture. */
    subscriptionProviderId?: string | undefined;
    /** Optional provider-qualified catalog registry keys hidden by this runtime provider. */
    suppressCatalogModelRegistryKeys?: readonly string[] | undefined;
}
export interface PluginRuntimeProviderModel {
    readonly id: string;
    readonly displayName?: string | undefined;
    readonly description?: string | undefined;
    readonly contextWindow?: number | undefined;
    readonly selectable?: boolean | undefined;
    readonly capabilities?: Partial<ModelDefinition['capabilities']> | undefined;
    readonly reasoningEffort?: string[] | undefined;
    readonly tier?: ModelTier | undefined;
    readonly tokenLimits?: TokenLimits | undefined;
}
export interface PluginProviderRegistration {
    readonly provider: LLMProvider;
    readonly models?: readonly PluginRuntimeProviderModel[] | undefined;
    readonly suppressCatalogModelRegistryKeys?: readonly string[] | undefined;
    readonly replace?: boolean | undefined;
}
/**
 * PluginToolSchema — JSON Schema for a tool parameter object.
 */
export type PluginToolSchema = Record<string, unknown>;
/**
 * PluginToolHandler — Called when the LLM invokes a plugin-registered tool.
 */
export type PluginToolHandler = (args: Record<string, unknown>) => Promise<{
    success: boolean;
    output?: string;
    error?: string;
}>;
/**
 * PluginCommandHandler — Called when a user runs a plugin-registered slash command.
 */
export type PluginCommandHandler = (args: string[]) => void | Promise<void>;
/**
 * PluginAPI — The constrained API surface exposed to plugins.
 * Plugins receive an instance of this interface during init; they cannot
 * access the wider application implementation details directly.
 */
export interface PluginAPI {
    /** Register a custom slash command. */
    registerCommand(name: string, description: string, handler: PluginCommandHandler): void;
    /** Register a custom LLM provider (OpenAI-compatible endpoint). */
    registerProvider(name: string, config: PluginProviderConfig): Promise<void>;
    /** Register a fully custom runtime provider instance with optional model entries. */
    registerProviderInstance(registration: PluginProviderRegistration): void;
    /** Register a custom tool available to the LLM. */
    registerTool(name: string, schema: PluginToolSchema, handler: PluginToolHandler): void;
    /** Register a callable control-plane gateway method. */
    registerGatewayMethod(descriptor: Omit<GatewayMethodDescriptor, 'source' | 'pluginId'> & Partial<Pick<GatewayMethodDescriptor, 'source' | 'pluginId'>>, handler: GatewayMethodHandler): void;
    /** Register a channel plugin for a surface such as Slack, Discord, ntfy, or webhooks. */
    registerChannelPlugin(plugin: ChannelPlugin): void;
    /** Register an outbound channel delivery strategy. */
    registerDeliveryStrategy(strategy: ChannelDeliveryStrategy, options?: {
        readonly replace?: boolean;
    }): void;
    /** Register a memory embedding provider. Sync providers can power sqlite-vec indexing immediately. */
    registerMemoryEmbeddingProvider(provider: MemoryEmbeddingProvider, options?: {
        readonly replace?: boolean;
        readonly makeDefault?: boolean;
    }): void;
    /** Register a TS-only voice provider for TTS, STT, or realtime session negotiation. */
    registerVoiceProvider(provider: VoiceProvider, options?: {
        readonly replace?: boolean;
    }): void;
    /** Register a TS-only media provider for analysis, transform, or generation. */
    registerMediaProvider(provider: MediaProvider, options?: {
        readonly replace?: boolean;
    }): void;
    /** Register a provider-backed web search adapter. */
    registerWebSearchProvider(provider: WebSearchProvider, options?: {
        readonly replace?: boolean;
    }): void;
    /** Subscribe to a typed runtime event. Returns an unsubscribe function. */
    onEvent<K extends AnyRuntimeEvent['type']>(eventName: K, handler: (payload: RuntimeEventPayload<K>) => void): () => void;
    /** Read a plugin-specific config value from the plugin's stored settings. */
    getConfig(key: string): unknown;
    /** Emit structured log output to the application logger. */
    log(level: 'info' | 'warn' | 'error' | 'debug', message: string): void;
}
/** Dependencies passed when creating a PluginAPI instance. */
export interface PluginAPIContext {
    pluginName: string;
    runtimeBus: RuntimeEventBus;
    commandRegistry: CommandRegistryLike;
    providerRegistry: ProviderRegistry;
    toolRegistry: ToolRegistry;
    gatewayMethods: GatewayMethodCatalog;
    channelRegistry: ChannelPluginRegistry;
    channelDeliveryRouter: ChannelDeliveryRouter;
    memoryEmbeddingRegistry: MemoryEmbeddingProviderRegistry;
    voiceProviderRegistry: VoiceProviderRegistry;
    mediaProviderRegistry: MediaProviderRegistry;
    webSearchProviderRegistry: WebSearchProviderRegistry;
    /** Plugin-specific config key-value pairs from plugins.json state. */
    pluginConfig: Record<string, unknown>;
    /** Collect cleanup callbacks so the manager can teardown on disable/reload. */
    cleanup: Array<() => void>;
}
/**
 * createPluginAPI — Factory that creates a sandboxed PluginAPI for a single plugin.
 * All registrations are tracked in `ctx.cleanup` so they can be undone on deactivation.
 */
export declare function createPluginAPI(ctx: PluginAPIContext): PluginAPI;
//# sourceMappingURL=api.d.ts.map