/**
 * Generalized server operations for the management cockpit: service lifecycle
 * (restart/reload/start/stop/enable/disable), deployment rollback, scheduled
 * backup run + database restore, worker restart, and scheduler run-now.
 *
 * The catalog is derived purely from the cloud config + live server data (so it
 * is trivially unit-testable); the runner dispatches each operation over the
 * active driver (SSH/SSM), reusing the shared compute-ops builders.
 */
import type { CloudConfig, EnvironmentType } from '@ts-cloud/core';
export type OperationGroup = 'service' | 'deploy' | 'backup' | 'worker' | 'scheduler';
export interface DashboardOperation {
    id: string;
    label: string;
    group: OperationGroup;
    target: string;
    mutates: boolean;
    /** Token the operator must type to run a mutating operation. */
    confirm: string;
    /** Destructive operations rendered with a danger affordance. */
    danger?: boolean;
}
export interface DashboardOperationResult {
    operation: string;
    command?: string;
    ok: boolean;
    stdout?: string;
    stderr?: string;
    error?: string;
}
/** Guard systemd unit names so an operation id can never inject shell. */
export declare function isSafeSystemdUnit(value: string): boolean;
/**
 * Build the full operation catalog from config + live server data. Pure: every
 * operation that appears here is runnable by {@link runDashboardOperation}.
 */
export declare function buildDashboardOperations(config: CloudConfig, data: Record<string, any>): DashboardOperation[];
export declare function resolveDashboardOperation(id: string, config: CloudConfig, data: Record<string, any>): DashboardOperation | undefined;
/**
 * Run an operation over the active driver. Rollback + DB restore delegate to the
 * shared compute-ops; the rest run a single bounded remote script on the app
 * target. Returns a structured result (never throws on a remote failure).
 */
export interface RunOperationOptions {
    /** For rollback: the release id to roll back to (omit for the previous release). */
    to?: string;
}
export declare function runDashboardOperation(config: CloudConfig, environment: EnvironmentType, operation: DashboardOperation, options?: RunOperationOptions): Promise<DashboardOperationResult>;
/**
 * Run an arbitrary shell command on the app box (Forge-style "run command" /
 * recipe runner). The dashboard is behind Basic auth and the caller must type a
 * confirmation, so this is an operator affordance, not an open endpoint. Output
 * is bounded and errors are captured rather than thrown.
 */
export declare function runServerShellCommand(config: CloudConfig, environment: EnvironmentType, command: string): Promise<DashboardOperationResult>;
