/** * Plugin lifecycle state machine. * * Defines the valid state transitions for the 8-state plugin lifecycle * and provides pure guard/transition functions with no side effects. * * States: * discovered → loading → loaded → active ↔ degraded * ↓ * error → (unloading | disabled | loading) * loading/loaded/active/degraded → error * active/loaded/degraded/error → unloading → disabled * disabled → loading (re-enable) * * Recoverable plugin errors are recorded by the lifecycle manager without a state * transition; only fatal/load failures enter the `error` state. */ import type { PluginLifecycleState } from '../store/domains/plugins.js'; import type { TransitionResult } from './types.js'; /** * Adjacency map: from state → set of valid target states. * * Encoded as a plain Record so it is safe to evaluate at module load time * with no external dependencies. */ export declare const VALID_TRANSITIONS: Readonly>>; /** * Returns whether a transition from `from` → `to` is permitted by the * state machine. */ export declare function canTransition(from: PluginLifecycleState, to: PluginLifecycleState): boolean; /** * Attempts a state transition and returns a typed result. * * This is a pure function, it has no side effects. The caller is responsible * for updating the plugin record and emitting events. * * @param from - Current state. * @param to - Desired target state. * @returns `{ ok: true, from, to }` on success or `{ ok: false, reason }` on * invalid transition. */ export declare function applyTransition(from: PluginLifecycleState, to: PluginLifecycleState): TransitionResult; /** * Returns whether a plugin in the given state is considered "operational" * (i.e. actively servicing requests, possibly in a degraded capacity). */ export declare function isOperational(state: PluginLifecycleState): boolean; /** * Returns whether a plugin in the given state can be safely hot-reloaded. * A hot reload requires the plugin to be quiesceable. */ export declare function isReloadable(state: PluginLifecycleState): boolean; /** * Returns whether the plugin's current state represents a terminal lifecycle * stop. The `error` state is recoverable via retry or unload. */ export declare function isTerminal(state: PluginLifecycleState): boolean; //# sourceMappingURL=lifecycle.d.ts.map