import { loadConfig } from '../config.js'; import { restartRoles, type OpsDeps } from '../ops.js'; import { FleetError } from './errors.js'; import { RoleRepository } from './role-repository.js'; import type { RoleStatus } from './types.js'; export interface RestartBatchPlan { readonly roleIds: readonly string[]; readonly mode: 'keep' | 'fresh'; readonly config: ReturnType; readonly configPath?: string; } /** Shared restart kernel. Receipt policy and surface rendering stay with callers. */ export declare class RoleLifecycleService { private readonly options; constructor(options: RoleCommandOptions); prepareRestart(input: { roleIds: string[]; mode: 'keep' | 'fresh'; config?: ReturnType; }): Promise; executeRestart(plan: RestartBatchPlan): Promise; status(roleId: string): Promise; } /** Adapter-facing batch entry point used by CLI and detached Messenger workers. */ export declare function executeRestartBatch(lifecycle: Pick, input: { roleIds: string[]; mode: 'keep' | 'fresh'; config?: ReturnType; }): Promise; export type LifecycleAction = 'start' | 'stop' | 'restart_resume' | 'restart_fresh'; export interface CommandReceipt { actionId: string; roleId: string; action: LifecycleAction; acceptedAt: string; completedAt?: string; state: 'accepted' | 'running' | 'succeeded' | 'failed' | 'uncertain'; error?: ReturnType; postcondition?: Pick; } export interface RoleCommandOptions { repository: RoleRepository; ops: OpsDeps; configPath?: string; status(roleId: string): Promise; onProgress?: (receipt: CommandReceipt) => void; restart?: typeof restartRoles; lifecycle?: RoleLifecycleService; } export declare class RoleCommandService { private readonly options; private readonly receipts; private readonly locks; readonly lifecycle: RoleLifecycleService; constructor(options: RoleCommandOptions); execute(input: { roleId: string; action: LifecycleAction; actionId?: string; confirmation?: string; }): Promise; get(actionId: string): CommandReceipt | undefined; private run; private serial; }