import { type PlatformBootstrapConfig, type PlatformBootstrapSecrets } from './bootstrap'; import { type MetalPublicIdentity } from './metal-bootstrap'; import { type PlatformGenesisGuest } from './platform-genesis'; export interface OperatorSshHop { address: string; port: number; user: string; hostKey: string; hostKeySha256: string; } export interface OperatorSshIdentity { identityPublicKeyFile: string; agentSocket: string; } export type OperatorSshJump = OperatorSshHop & OperatorSshIdentity; export interface OperatorPlatformBootstrapRequest { kind: 'platform-remote'; target: OperatorSshHop & OperatorSshIdentity & { jump?: OperatorSshJump; }; platformConfigFile: string; } export interface OperatorMetalBootstrapRequest { kind: 'metal-remote'; target: OperatorPlatformBootstrapRequest['target']; metalConfigFile: string; /** Secret-free, pinned-host identity evidence written automatically after apply. */ metalIdentityEvidenceFile?: string; genesis: { nodes: readonly PlatformGenesisGuest[]; rehearsalNode?: PlatformGenesisGuest; sshPublicKeyFiles: string[]; }; } export interface OperatorMetalIdentityEvidence extends MetalPublicIdentity { format: 1; kind: 'forgezero-operator-metal-identity'; metalHostname: string; metalHostKeySha256: string; } export interface OperatorGuestHostKeyEvidence { format: 1; kind: 'forgezero-operator-guest-host-keys'; metalHostKeySha256: string; nodes: readonly { name: string; address: string; hostKey: string; hostKeySha256: string; }[]; } export interface OperatorPlatformBootstrapFleetRequest { kind: 'platform-fleet-remote'; requests: readonly string[]; /** Reviewed non-secret coordinates for the attended Tunnel/DNS/KV/DO phase. */ cloudflareConfigFile: string; /** Secret-free evidence retained after checkpoint and host handoffs are consumed. */ cloudflareAcceptanceFile: string; } export interface OperatorPlatformBootstrapFleetPlan { kind: 'platform-fleet-remote'; mode: OperatorPlatformBootstrapMode; mutation: boolean; environment: PlatformBootstrapConfig['environment']; nodes: readonly { computeReference: string; address: string; via?: string; }[]; secretInputs: readonly string[]; } export interface OperatorPlatformBootstrapFleetOutcome { computeReference: string; address: string; ok: boolean; output?: string; error?: string; } export interface OperatorPlatformBootstrapFleetResult { plan: OperatorPlatformBootstrapFleetPlan; ok: boolean; outcomes: readonly OperatorPlatformBootstrapFleetOutcome[]; } export interface OperatorPlatformFleetCoordinates { environment: PlatformBootstrapConfig['environment']; appOrigin: string; apiOrigin: string; nodes: readonly { computeReference: string; address: string; nodeHostname: string; databaseRole: 'master' | 'joiner'; }[]; } export type OperatorPlatformBootstrapMode = 'apply' | 'repair' | 'promote' | 'status'; export type OperatorMetalBootstrapMode = 'apply' | 'genesis' | 'genesis-cleanup' | 'rehearsal' | 'rehearsal-cleanup' | 'host-keys' | 'rehearsal-host-keys' | 'status'; export interface OperatorPlatformBootstrapPlan { kind: 'platform-remote'; mode: OperatorPlatformBootstrapMode; mutation: boolean; target: { address: string; port: number; user: string; via?: string; }; steps: readonly string[]; secretInputs: readonly string[]; } export interface OperatorMetalBootstrapPlan { kind: 'metal-remote'; mode: OperatorMetalBootstrapMode; mutation: boolean; target: { address: string; port: number; user: string; }; steps: readonly string[]; genesisNodes: readonly string[]; secretInputs: readonly string[]; } export interface OperatorCommandResult { exitCode: number; output: string; } export type OperatorCommand = (argv: readonly string[], options?: { stdin?: string; secret?: boolean; safeStdout?: boolean; }) => Promise; export declare const operatorPackagedFzCliPath: () => string; export declare const operatorPackagedAgentPath: () => string; export declare const operatorPackagedGitSshPath: () => string; export interface OperatorPlatformBootstrapOptions { exec?: OperatorCommand; fetch?: typeof fetch; fzCliPath?: string; fzAgentPath?: string; fzGitSshPath?: string; } export declare function createOperatorSshHop(input: Omit): OperatorSshHop; export declare function readOperatorPlatformBootstrapRequest(path: string): OperatorPlatformBootstrapRequest; export declare function writeOperatorPlatformBootstrapRequest(path: string, request: OperatorPlatformBootstrapRequest): string; export declare function readOperatorPlatformBootstrapFleetRequest(path: string): OperatorPlatformBootstrapFleetRequest; export declare function writeOperatorPlatformBootstrapFleetRequest(path: string, requestFiles: readonly string[], cloudflare: { configFile: string; acceptanceFile: string; }): string; export declare function readOperatorMetalBootstrapRequest(path: string, options?: { validateMetalConfig?: boolean; }): OperatorMetalBootstrapRequest; export declare function writeOperatorMetalBootstrapRequest(path: string, request: OperatorMetalBootstrapRequest): string; export declare function readOperatorMetalIdentityEvidence(path: string, request: OperatorMetalBootstrapRequest): OperatorMetalIdentityEvidence; export declare function readOperatorGuestHostKeyEvidence(path: string, request?: OperatorMetalBootstrapRequest): OperatorGuestHostKeyEvidence; export declare function writeOperatorGuestHostKeyEvidence(path: string, evidence: OperatorGuestHostKeyEvidence, request?: OperatorMetalBootstrapRequest): string; export declare function planOperatorMetalBootstrap(request: OperatorMetalBootstrapRequest, mode: OperatorMetalBootstrapMode): OperatorMetalBootstrapPlan; export declare function planOperatorPlatformBootstrap(request: OperatorPlatformBootstrapRequest, mode: OperatorPlatformBootstrapMode): OperatorPlatformBootstrapPlan; /** Exact non-secret coordinates derived from the same reviewed files bootstrap applies. */ export declare function operatorPlatformFleetCoordinates(fleet: OperatorPlatformBootstrapFleetRequest): OperatorPlatformFleetCoordinates; export declare function planOperatorPlatformFleetBootstrap(fleet: OperatorPlatformBootstrapFleetRequest, mode: OperatorPlatformBootstrapMode): OperatorPlatformBootstrapFleetPlan; /** Keep typed failure text while proving no attended value can be returned. */ export declare function redactOperatorSecretDiagnostic(stderr: string, stdin?: string): string; /** * Create or reopen the one shared genesis credential on the reviewed Metal * host. The operator laptop is transport only: the value exists in local RAM * long enough to cross the already pinned SSH sessions, while the only durable * copy is encrypted by Metal's systemd host key. */ export declare function operatorMetalClusterBootstrapCode(requestInput: OperatorMetalBootstrapRequest, options?: OperatorPlatformBootstrapOptions): Promise; export declare function collectOperatorGuestHostKeys(request: OperatorMetalBootstrapRequest, options?: OperatorPlatformBootstrapOptions, includeRehearsal?: boolean): Promise; export interface OperatorGuestTransport { run(nodeName: string, argv: readonly string[], options?: { stdin?: string; secret?: boolean; allowFailure?: boolean; }): Promise; copy(nodeName: string, localPath: string, remotePath: string): Promise; } /** * Execute a bounded callback through the same pinned Metal jump, operator * public identity selector and reviewed guest host keys used by bootstrap. */ export declare function withOperatorGuestTransport(request: OperatorMetalBootstrapRequest, evidence: OperatorGuestHostKeyEvidence, callback: (transport: OperatorGuestTransport) => Promise, options?: OperatorPlatformBootstrapOptions): Promise; /** * Run one reviewed operator action. No private SSH key, credential value or * management token is placed in argv; OpenSSH selects the matching private key * from the caller's approved agent using only its public half. */ export declare function applyOperatorPlatformBootstrap(request: OperatorPlatformBootstrapRequest, mode: OperatorPlatformBootstrapMode, options?: OperatorPlatformBootstrapOptions & { secrets?: PlatformBootstrapSecrets; }): Promise<{ plan: OperatorPlatformBootstrapPlan; output: string; }>; /** * Run the reviewed elastic fleet from one attended secret collection. * Every request is fully validated before the first SSH connection. Initial * genesis runs concurrently because the three-member Agency must form as one * operation. Promotion follows the same fleet-wide parallel execution model * as the checked-in deployment plan, bounded by one health barrier before and * one health barrier after the concurrent mutations. */ export declare function applyOperatorPlatformFleetBootstrap(fleet: OperatorPlatformBootstrapFleetRequest, mode: OperatorPlatformBootstrapMode, options?: OperatorPlatformBootstrapOptions & { secrets?: PlatformBootstrapSecrets; }): Promise; /** Run the fixed host acceptance operation through each request's pinned SSH identity. */ export declare function verifyOperatorPlatformFleet(fleet: OperatorPlatformBootstrapFleetRequest, expectedVersion: string, options?: OperatorPlatformBootstrapOptions): Promise; /** * Install/bootstrap one blank metal host or provision its reviewed platform * platform seed through the same pinned SSH transport used for guest bootstrap. */ export declare function applyOperatorMetalBootstrap(request: OperatorMetalBootstrapRequest, mode: OperatorMetalBootstrapMode, options?: OperatorPlatformBootstrapOptions): Promise<{ plan: OperatorMetalBootstrapPlan; output: string; }>;