/** * Photon Marketplace Client - Manage multiple Photon marketplaces * * Integrates with Photon's marketplace system to query and install Photons * from the official portel-dev/photons repository and user-defined marketplaces */ export type MarketplaceSourceType = 'github' | 'git-ssh' | 'url' | 'local'; export interface Marketplace { name: string; repo: string; url: string; sourceType: MarketplaceSourceType; source: string; enabled: boolean; lastUpdated?: string; } export interface MarketplaceConfig { marketplaces: Marketplace[]; } /** * Photon metadata from photons.json manifest */ export interface PhotonMetadata { name: string; version: string; description: string; author?: string; homepage?: string; repository?: string; license?: string; tags?: string[]; category?: string; source: string; hash?: string; tools?: string[]; } /** * Local installation metadata for tracking Photon origins */ export interface PhotonInstallMetadata { marketplace: string; marketplaceRepo: string; version: string; originalHash: string; installedAt: string; lastChecked?: string; } /** * Local metadata file structure */ export interface LocalMetadata { photons: Record; } /** * Marketplace manifest (.marketplace/photons.json) */ export interface MarketplaceManifest { name: string; version?: string; description?: string; owner?: { name: string; email?: string; url?: string; }; photons: PhotonMetadata[]; } /** * Calculate SHA-256 hash of file content */ export declare function calculateFileHash(filePath: string): Promise; /** * Calculate SHA-256 hash of string content */ export declare function calculateHash(content: string): string; /** * Read local installation metadata */ export declare function readLocalMetadata(): Promise; /** * Write local installation metadata */ export declare function writeLocalMetadata(metadata: LocalMetadata): Promise; export declare class PhotonMarketplaceClient { private config; initialize(): Promise; save(): Promise; /** * Get all marketplaces */ getAll(): Marketplace[]; /** * Get enabled marketplaces */ getEnabled(): Marketplace[]; /** * Get marketplace by name */ get(name: string): Marketplace | undefined; /** * Parse marketplace source into structured info * Supports: * 1. GitHub shorthand: username/repo * 2. GitHub HTTPS: https://github.com/username/repo[.git] * 3. GitHub SSH: git@github.com:username/repo.git * 4. Direct URL: https://example.com/photons.json * 5. Local path: ./path/to/marketplace or /absolute/path */ private parseMarketplaceSource; /** * Get next available name with numeric suffix if name already exists * e.g., if 'photon-mcps' exists, returns 'photon-mcps-2' * if 'photon-mcps' and 'photon-mcps-2' exist, returns 'photon-mcps-3' */ private getUniqueName; /** * Check if a marketplace with the same source already exists */ private findBySource; /** * Add a new marketplace * Supports: * - GitHub: username/repo, https://github.com/username/repo, git@github.com:username/repo.git * - Direct URL: https://example.com/photons.json * - Local path: ./path/to/marketplace, /absolute/path * * If a marketplace with the same name already exists, automatically appends a numeric suffix (-2, -3, etc.) * If the exact same source already exists, returns the existing marketplace without creating a duplicate. * * @returns Object with marketplace info and 'added' flag (false if already existed) */ add(source: string): Promise<{ marketplace: Omit; added: boolean; }>; /** * Remove a marketplace */ remove(name: string): Promise; /** * Enable/disable a marketplace */ setEnabled(name: string, enabled: boolean): Promise; /** * Get cache file path for marketplace */ private getCacheFile; /** * Fetch photons.json manifest from various sources */ fetchManifest(marketplace: Marketplace): Promise; /** * Update marketplace cache (fetch and save photons.json manifest) */ updateMarketplaceCache(name: string): Promise; /** * Update all enabled marketplace caches */ updateAllCaches(): Promise>; /** * Get cached marketplace manifest */ getCachedManifest(marketplaceName: string): Promise; /** * Get Photon metadata from cached manifest */ getPhotonMetadata(photonName: string): Promise<{ metadata: PhotonMetadata; marketplace: Marketplace; } | null>; /** * Get all Photons with metadata from all enabled marketplaces */ getAllPhotons(): Promise>; /** * Get count of available Photons per marketplace */ getMarketplaceCounts(): Promise>; /** * Check if marketplace cache is stale */ private isCacheStale; /** * Auto-update stale caches * Returns true if any updates were performed */ autoUpdateStaleCaches(): Promise; /** * Try to fetch MCP from all enabled marketplaces * Returns content, marketplace info, and metadata (version, hash) */ fetchMCP(mcpName: string): Promise<{ content: string; marketplace: Marketplace; metadata?: PhotonMetadata; } | null>; /** * Fetch version from all enabled marketplaces */ fetchVersion(mcpName: string): Promise<{ version: string; marketplace: Marketplace; } | null>; /** * Search for Photon in all marketplaces * Searches in name, description, tags, and author fields */ search(query: string): Promise>; /** * List all available MCPs from a marketplace * Note: Requires marketplace to have a .marketplace/photons.json file */ listFromMarketplace(marketplaceName: string): Promise; /** * Save installation metadata for a Photon */ savePhotonMetadata(fileName: string, marketplace: Marketplace, metadata: PhotonMetadata, contentHash: string): Promise; /** * Get local installation metadata for a Photon */ getPhotonInstallMetadata(fileName: string): Promise; /** * Check if a Photon file has been modified since installation */ isPhotonModified(filePath: string, fileName: string): Promise; /** * Find all marketplaces that have a specific MCP (for conflict detection) */ findAllSources(mcpName: string): Promise>; /** * Detect all MCP conflicts across marketplaces */ detectAllConflicts(): Promise>>; /** * Check if adding/upgrading an MCP would create a conflict */ checkConflict(mcpName: string, targetMarketplace?: string): Promise<{ hasConflict: boolean; sources: Array<{ marketplace: Marketplace; metadata?: PhotonMetadata; }>; recommendation?: string; }>; /** * Compare two semver versions * Returns: positive if v1 > v2, negative if v1 < v2, 0 if equal */ private compareVersions; } //# sourceMappingURL=photon-marketplace-client.d.ts.map