import type { PluginToolSourceMetadata, ToolCategory, ToolConsentLevel, ToolDefinition, ToolParametersSchema, ToolRisk, ToolTier } from "../tools/contracts.js";
import type { ToolPermission } from "../security/tool-permissions.js";
import type { ChannelConnector } from "../channels/types.js";
import type { PluginManifest } from "./manifest.js";
export interface PluginContext {
    gatewayVersion: string;
    projectRoot: string;
    /** Read plugin-scoped config (persisted in DB). */
    getConfig<T = Record<string, unknown>>(): T;
    /** Write plugin-scoped config. */
    setConfig(value: Record<string, unknown>): Promise<void>;
    /** Scoped logger. */
    log: {
        info(msg: string, ...args: unknown[]): void;
        warn(msg: string, ...args: unknown[]): void;
        error(msg: string, ...args: unknown[]): void;
    };
}
export interface PluginDescriptor {
    id: string;
    displayName: string;
}
export interface PluginToolDeclaration<TInput = unknown> extends Omit<ToolDefinition<TInput>, "source" | "sourceMetadata" | "risk" | "defaultConsentLevel" | "tier" | "category"> {
    tier: ToolTier;
    category: ToolCategory;
    risk: ToolRisk;
    defaultConsentLevel: ToolConsentLevel;
}
export declare function buildPluginToolSourceMetadata(plugin: PluginDescriptor): PluginToolSourceMetadata;
export declare function toPluginToolDefinition<TInput = unknown>(plugin: PluginDescriptor, tool: PluginToolDeclaration<TInput>): ToolDefinition<TInput>;
export interface PluginContribution {
    tools?: PluginToolDeclaration[];
    /** Messaging channels exposed by this extension. Registered only while enabled. */
    channels?: ChannelConnector[];
    settingsSchema?: ToolParametersSchema;
    permissions?: ToolPermission[];
}
export interface PluginModule extends PluginDescriptor {
    setup(context: PluginContext): Promise<PluginContribution | void>;
    dispose(): Promise<void>;
}
export type PluginStatus = "installed" | "enabled" | "disabled" | "error";
/** Persisted metadata about an installed plugin (stored in DB). */
export interface InstalledPlugin {
    id: string;
    displayName: string;
    version: string;
    description?: string;
    author?: string;
    /** Absolute path to the plugin's root directory. */
    path: string;
    status: PluginStatus;
    /** Plugin-scoped user config (JSON blob). */
    config: Record<string, unknown>;
    /** Error message when status === "error". */
    error?: string;
    installedAt: string;
    updatedAt: string;
}
/** Runtime handle for a loaded plugin (in-memory only). */
export interface LoadedPlugin {
    manifest: PluginManifest;
    installed: InstalledPlugin;
    module: PluginModule | null;
    contribution: PluginContribution | null;
}
export interface PluginEntry {
    id: string;
    displayName: string;
    setup(context: PluginContext): Promise<PluginContribution | void>;
    dispose?(): Promise<void>;
}
/** Convenience wrapper for plugin authors. */
export declare function definePlugin(entry: PluginEntry): PluginModule;
//# sourceMappingURL=contracts.d.ts.map