import { type PluginServiceDefinition } from './runtime.js'; import type { InstalledPluginRecord, PluginServiceMode, PluginServiceState } from './types.js'; export interface PluginServiceReport { pluginId: string; action: 'started' | 'already-running' | 'stopped' | 'not-running' | 'failed' | 'status' | 'deleted'; mode?: PluginServiceMode; status?: string; pid?: number; port?: number; openUrl?: string; healthUrl?: string; warning?: string; } export type PluginLifecycleOperation = 'install' | 'update' | 'uninstall'; export declare class PluginServiceRunningError extends Error { readonly pluginId: string; readonly operation: PluginLifecycleOperation; readonly serviceStatus: string; readonly pid?: number | undefined; readonly code = "plugin_service_running"; constructor(pluginId: string, operation: PluginLifecycleOperation, serviceStatus: string, pid?: number | undefined); } export declare class PluginServiceDeleteError extends Error { readonly reports: PluginServiceReport[]; readonly code = "plugin_service_delete_failed"; readonly failures: PluginServiceReport[]; constructor(reports: PluginServiceReport[]); } /** * Plugin PM2 shares the God's PM2_HOME with the core fleet, so every plugin * lifecycle mutation must ALSO hold the shared fleet-mutation lock — without * it, a concurrent plugin start could slip between an include-pm2 restart's * plugin stop and its `pm2 kill`. Lock order is fixed everywhere: fleet lock * FIRST, then the plugin service lock (never the reverse). Same-process * nesting (cmdRestart already holds the fleet lock when it stops plugin * services) is handled by the fleet lock's re-entrancy counter. */ export declare function withPluginServiceLockSync(fn: () => T): T; export declare function withPluginServiceLock(fn: () => Promise | T): Promise; export declare function assertPluginServiceStopped(pluginId: string, operation: PluginLifecycleOperation): void; export declare function rewriteLoopbackServiceUrl(rawUrl: string | undefined): string | undefined; export declare function serviceUrls(record: InstalledPluginRecord, definition: PluginServiceDefinition): Pick; export declare function startPluginServices(pluginIds?: readonly string[], options?: { autoOnly?: boolean; }): Promise; export declare function stopPluginServices(pluginIds?: readonly string[], options?: { autoOnly?: boolean; }): Promise; export declare function deletePluginServicesUnlocked(pluginIds?: readonly string[]): Promise; /** Destructive lifecycle callers use the strict variant so a PM2 failure * aborts before registry/runtime/binding cleanup can begin. */ export declare function deletePluginServicesOrThrowUnlocked(pluginIds?: readonly string[]): Promise; export declare function deletePluginServices(pluginIds?: readonly string[]): Promise; export declare function listPluginServiceStatus(): Promise; //# sourceMappingURL=service-manager.d.ts.map