/**
 * Marketplace Service
 *
 * Handles fetching the marketplace registry from the Crewly webapp API,
 * managing the local installed-items manifest, and enriching items
 * with install status information.
 *
 * @module services/marketplace/marketplace.service
 */
import { MarketplaceRegistry, MarketplaceItemWithStatus, MarketplaceFilter, InstalledItemsManifest, InstalledItemRecord, type MarketplaceItemType } from '../../types/marketplace.types.js';
/**
 * Fetches the marketplace registry from the Crewly webapp API.
 * Uses in-memory caching with a 1-hour TTL. Concurrent callers share
 * the same in-flight request to avoid duplicate network fetches.
 *
 * On network failure, falls back to the previously cached registry
 * if one is available. Throws only when no cached data exists.
 *
 * @param forceRefresh - If true, bypasses the cache and fetches fresh data
 * @returns The marketplace registry containing all available items
 * @throws Error if the fetch fails and no cached registry is available
 */
export declare function fetchRegistry(forceRefresh?: boolean): Promise<MarketplaceRegistry>;
/**
 * Loads the locally installed items manifest from disk.
 *
 * Returns an empty manifest (schemaVersion 1, no items) if the
 * manifest file does not exist or cannot be parsed.
 *
 * @returns The installed items manifest
 */
export declare function loadManifest(): Promise<InstalledItemsManifest>;
/**
 * Saves the installed items manifest to disk.
 *
 * Creates the marketplace directory if it does not exist.
 *
 * @param manifest - The manifest to persist
 */
export declare function saveManifest(manifest: InstalledItemsManifest): Promise<void>;
/**
 * Returns a single marketplace item by ID, enriched with install status.
 *
 * @param id - The marketplace item ID to look up
 * @returns The item with install status, or null if not found in the registry
 */
export declare function getItem(id: string): Promise<MarketplaceItemWithStatus | null>;
/**
 * Lists marketplace items with optional filtering, enriched with install status.
 *
 * Supports filtering by type, category, and free-text search (matches name,
 * description, and tags). Results are sorted by the specified sort option,
 * defaulting to most popular (highest downloads).
 *
 * @param filter - Optional filter and sort criteria
 * @returns Filtered and sorted list of items with install status
 */
export declare function listItems(filter?: MarketplaceFilter): Promise<MarketplaceItemWithStatus[]>;
/**
 * Returns marketplace items that have updates available.
 *
 * An item has an update available when the installed version differs
 * from the latest version in the registry.
 *
 * @returns Items with installStatus 'update_available'
 */
export declare function getUpdatableItems(): Promise<MarketplaceItemWithStatus[]>;
/**
 * Returns locally installed items from the manifest.
 *
 * @returns Array of installed item records
 */
export declare function getInstalledItems(): Promise<InstalledItemRecord[]>;
/**
 * Searches marketplace items by query string.
 *
 * Convenience wrapper around listItems with a search filter.
 *
 * @param query - Free-text search query
 * @returns Matching items with install status
 */
export declare function searchItems(query: string): Promise<MarketplaceItemWithStatus[]>;
export declare function getInstallPath(type: MarketplaceItemType, id: string): string;
/**
 * Retrieves the README.md content for a marketplace item.
 *
 * Looks for a README.md file in the item's install directory. Tries multiple
 * filenames (README.md, readme.md, SKILL.md) for flexibility.
 *
 * @param id - The marketplace item ID
 * @returns The README content as a string, or null if not found
 * @throws Error if the item ID is invalid (path traversal protection)
 */
export declare function getItemReadme(id: string): Promise<string | null>;
/**
 * Resets the in-memory registry cache.
 *
 * Used primarily for testing to ensure a clean state between test runs.
 */
export declare function resetRegistryCache(): void;
//# sourceMappingURL=marketplace.service.d.ts.map