import type { VerifiedGeneration } from "../installation/generation-store.js"; import { type PersistedOperationObserver } from "../persisted-operation-observer.js"; import type { GatewayController, GatewayControllerState, GatewayOperation } from "./gateway-controller.js"; export interface ActiveGenerationPointer { id: string; planDigest: string; } export interface GenerationActivationOperation { id: string; status: "running" | "succeeded" | "failed"; phase: "accepted" | "stopping" | "starting" | "restoring" | "completed" | "failed"; previous: ActiveGenerationPointer | null; target: ActiveGenerationPointer; desiredBefore: "running" | "stopped"; startedAt: string; finishedAt?: string; error?: string; rolledBack?: boolean; } export interface GenerationActivationState { schemaVersion: 1; /** null is the bundled runtime, never a fabricated verified generation id. */ active: ActiveGenerationPointer | null; recoveryRequired: boolean; operations: GenerationActivationOperation[]; error?: string; } export interface GenerationActivationOptions { statePath: string; gateway: GatewayController; /** Must be the trusted generation store's readVerified, including receipt/file validation. */ readVerified(id: string): VerifiedGeneration; /** Only proves children owned by this live manager; never use as cold-start orphan proof. */ hasLiveChildren(): boolean; configurationRecoveryRequired?(): boolean; /** Verify candidate configuration under the lifecycle queue; guard must synchronously recheck its snapshot. */ verifyActivation?(generation: VerifiedGeneration, expectedConfigRevision?: string): Promise<() => void>; onOperation?: PersistedOperationObserver; } /** 仅供可信配置服务使用;事务中必须 await 操作,不得调用外层 facade。 */ export interface ConfigurationTransactionPort { activeGenerationId(): string | null; hasLiveChildren(): boolean; gatewayStatus(): { desired: "running" | "stopped"; recoveryRequired?: boolean; }; suspend(): Promise<{ status: string; }>; start(): Promise<{ status: string; }>; } /** 恢复事务只读取生命周期事实;不能启动、停止或自行对账未知实例。 */ export type ConfigurationRecoveryTransactionPort = Pick; /** * Host must route ALL start/stop/restart/shutdown/activate writes through this facade. * Do not also expose its underlying GatewayController to client handlers or recovery timers. * Driver prepare reads activeGeneration(); observeExit may report facts directly to gateway. */ export declare class GenerationActivationController { private readonly options; private state; private initialized; private queue; private readonly configurationContext; constructor(options: GenerationActivationOptions); initialize(): Promise; status(): GenerationActivationState & { gateway: GatewayControllerState; }; activeGeneration(): VerifiedGeneration | null; start(): Promise; stop(): Promise; restart(): Promise; shutdown(): Promise; runConfigurationTransaction(task: (port: ConfigurationTransactionPort) => Promise): Promise; runConfigurationRecoveryTransaction(task: (port: ConfigurationRecoveryTransactionPort) => Promise): Promise; /** Host supplies identity-aware evidence; absence from a fresh driver's map is not evidence. */ reconcileStopped(confirm: (state: GatewayControllerState) => boolean): Promise; activate(id: string, expected?: string | null, expectedConfigRevision?: string): Promise; private restore; private observe; private lifecycle; private verifyPointer; private complete; private markUnknown; private assertInitialized; private assertWritable; private serial; private persist; } export declare class GenerationConflictError extends Error { constructor(); } //# sourceMappingURL=generation-activation.d.ts.map