import type { Config } from '../../config/schema.js';
import type { AgentService } from '../../agent/service.js';
import type { ChannelManager } from '../../channels/manager.js';
import type { ExtensionLoader } from '../../extensions/loader.js';
import type { SkillCatalogEntry } from '../../agent/agent-manager.js';
import type { ManagedSkillListItem } from '../../agent/skills/managed-store.js';
import type { SkillMarkdownPreviewPayload } from '../../agent/skills/types.js';
import type { MarketplaceCategoryOption, SkillsStoreListParams, UnifiedMarketplaceListResponse, UnifiedMarketplacePackageDetail } from '../../agent/skills/skills-marketplace.js';
import type { MarketplacePackageDetail } from '../../agent/skills/marketplace/adapters/store/store-api-client.js';
export interface GatewayMarketplaceServiceOptions {
    getConfig: () => Config;
    getAgentService: () => AgentService;
    getExtensionLoader: () => ExtensionLoader | null;
    getChannelManager: () => ChannelManager;
    saveConfig: (config: Config) => Promise<{
        saved: boolean;
        error?: string;
    }>;
    emit: (type: string, payload: unknown) => void;
}
export declare class GatewayMarketplaceService {
    private readonly opts;
    constructor(opts: GatewayMarketplaceServiceOptions);
    getSkillsApi(lang?: string): {
        catalog: SkillCatalogEntry[];
        managed: ManagedSkillListItem[];
    };
    getSkillMarkdownSource(skillName: string, lang?: string): SkillMarkdownPreviewPayload | null;
    deleteSkill(skillId: string): void;
    installSkillZip(buffer: Buffer, opts: {
        skillId?: string;
        overwrite?: boolean;
    }): {
        skillId: string;
        path: string;
    };
    reloadSkills(): void;
    patchSkillEnabled(skillName: string, enabled: boolean): void;
    fetchSkillsCatalog(params: SkillsStoreListParams, provider?: string): Promise<UnifiedMarketplaceListResponse>;
    fetchSkillsCategories(provider?: string): Promise<{
        items: MarketplaceCategoryOption[];
    }>;
    fetchSkillsPackageDetail(packageName: string, provider?: string): Promise<UnifiedMarketplacePackageDetail>;
    installSkill(opts: {
        name: string;
        version?: string;
        overwrite?: boolean;
        provider?: string;
    }): Promise<{
        skillId: string;
        path: string;
    }>;
    getSkillsProvider(): {
        provider: string;
        displayName: string;
    };
    /** All registered marketplace providers (built-in + extension-contributed). */
    getSkillsProviders(): Array<{
        id: string;
        displayName: string;
    }>;
    /** xopc-store extension package preview (type must be `extension`). */
    fetchExtensionPackageDetail(packageName: string): Promise<MarketplacePackageDetail>;
    /**
     * Install an extension from xopc-store into `~/.xopc/extensions`, append id
     * to `extensions.enabled`, refresh the loader, and emit `config.reload`.
     * Returns `requiresGatewayRestart=true` when a new channel plugin would have
     * to wire into the running gateway (channel registration cannot hot-patch).
     */
    installExtension(opts: {
        name: string;
        version?: string;
        overwrite?: boolean;
    }): Promise<{
        extensionId: string;
        version: string;
        requiresGatewayRestart: boolean;
    }>;
    /** Remove a user-installed extension (global or per-agent dir) from disk and config. */
    uninstallExtension(extensionId: string): Promise<{
        requiresGatewayRestart: boolean;
    }>;
    private mergeExtensionEnabledIntoConfig;
    private mergeExtensionRemovedFromEnabledConfig;
}
