/** * Plugin Manager * Handles actual plugin installation, persistence, and lifecycle * Bridges discovery service with file system persistence */ import { type TrustDecision } from './trust-policy.js'; export interface InstalledPlugin { name: string; version: string; installedAt: string; enabled: boolean; source: 'npm' | 'local' | 'ipfs'; path?: string; commands?: string[]; hooks?: string[]; config?: Record; /** Declared (or registry-assigned) trust level, recorded at install time. */ trustLevel?: string; /** Declared permissions, recorded at install time so they can be enforced. */ permissions?: string[]; /** How the install was verified. */ verification?: 'checksum' | 'npm-integrity' | 'policy' | 'skipped'; /** Whether npm lifecycle scripts ran during install (false = `--ignore-scripts`). */ scriptsRun?: boolean; /** Hooks/commands the plugin declared but that were not registered, and why. */ withheld?: { hooks: string[]; commands: string[]; reasons: string[]; }; } /** Options for {@link PluginManager.installFromLocal} / {@link PluginManager.installFromNpm}. */ export interface PluginInstallOptions { /** `--verify` (default true). */ verify?: boolean; /** `--trust` (default false). */ trust?: boolean; /** Registry checksum (`sha256:`) the downloaded tarball must match. */ expectedChecksum?: string; /** Trust level from the registry entry, when the plugin was found there. */ registryTrustLevel?: string; /** Permissions from the registry entry, merged with the package's own declaration. */ registryPermissions?: string[]; } export interface PluginInstallResult { success: boolean; error?: string; plugin?: InstalledPlugin; decision?: TrustDecision; warnings?: string[]; } export interface InstalledPluginsManifest { version: '1.0.0'; lastUpdated: string; plugins: Record; } export interface PluginManagerConfig { pluginsDir: string; manifestPath: string; } /** * Manages plugin installation, persistence, and lifecycle. * * Unlike the simulated version, this actually: * - Persists plugins to disk * - Downloads from npm * - Tracks enabled/disabled state * - Loads plugin modules */ export declare class PluginManager { private config; private manifest; constructor(baseDir?: string); /** * Initialize the plugin manager, creating directories and loading manifest */ initialize(): Promise; private ensureDirectory; private loadManifest; private saveManifest; /** * Install a plugin from npm */ installFromNpm(packageName: string, version?: string, opts?: PluginInstallOptions): Promise; /** * Install a plugin from a local path */ installFromLocal(sourcePath: string, opts?: PluginInstallOptions): Promise; /** * Uninstall a plugin */ uninstall(packageName: string): Promise<{ success: boolean; error?: string; }>; /** * Enable a plugin */ enable(packageName: string): Promise<{ success: boolean; error?: string; }>; /** * Disable a plugin */ disable(packageName: string): Promise<{ success: boolean; error?: string; }>; /** * Toggle a plugin's enabled state */ toggle(packageName: string): Promise<{ success: boolean; enabled?: boolean; error?: string; }>; /** * Get all installed plugins */ getInstalled(): Promise; /** * Get enabled plugins */ getEnabled(): Promise; /** * Check if a plugin is installed */ isInstalled(packageName: string): Promise; /** * Get a specific installed plugin */ getPlugin(packageName: string): Promise; /** * Upgrade a plugin to a new version */ upgrade(packageName: string, version?: string): Promise<{ success: boolean; error?: string; plugin?: InstalledPlugin; }>; /** * Update plugin config */ setConfig(packageName: string, config: Record): Promise<{ success: boolean; error?: string; }>; /** * Get plugins directory path */ getPluginsDir(): string; /** * Get manifest path */ getManifestPath(): string; } export declare function getPluginManager(baseDir?: string): PluginManager; export declare function resetPluginManager(): void; //# sourceMappingURL=manager.d.ts.map