import type { Database } from "bun:sqlite";
import type { Machine, MachineTopologyDiagnostics } from "../types/index.js";
export interface MachineTopologyOptions {
    hostname?: string;
    platform?: string;
    ssh_address?: string;
    primary?: boolean;
    tailscale_name?: string;
    tailscale_ip?: string;
    lan_address?: string;
    workspace_path?: string;
    git_root?: string;
    arch?: string;
}
/**
 * Get or create the local machine entry.
 * Uses TODOS_MACHINE_NAME env var, falls back to OS hostname.
 * Idempotent — returns existing machine if name matches.
 */
export declare function getOrCreateLocalMachine(db?: Database): Machine;
export declare function getMachineId(db?: Database): string;
/** Reset cached machine ID (for tests). */
export declare function resetMachineId(): void;
export declare function getMachine(id: string, db?: Database): Machine | null;
export declare function getMachineByName(name: string, db?: Database): Machine | null;
export declare function listMachines(db?: Database, includeArchived?: boolean): Machine[];
/**
 * Register a new machine or update an existing one.
 */
export declare function registerMachine(name: string, opts: MachineTopologyOptions, db?: Database): Machine;
export declare function updateMachineHeartbeat(idOrName?: string, opts?: MachineTopologyOptions, db?: Database): Machine;
export declare function getMachineTopologyDiagnostics(opts?: {
    stale_minutes?: number;
    include_archived?: boolean;
}, db?: Database, at?: Date): MachineTopologyDiagnostics;
/**
 * Set a machine as the primary machine.
 * Clears is_primary on all other machines.
 */
export declare function setPrimaryMachine(name: string, db?: Database): Machine;
/**
 * Get the primary machine.
 */
export declare function getPrimaryMachine(db?: Database): Machine | null;
/**
 * Archive (soft-delete) a machine.
 * Cannot archive the primary machine or machines with active/pending tasks.
 */
export declare function archiveMachine(id: string, db?: Database): void;
/**
 * Unarchive a machine.
 */
export declare function unarchiveMachine(id: string, db?: Database): Machine | null;
/**
 * Delete a machine (hard delete). Only allowed if not primary and no tasks.
 */
export declare function deleteMachine(id: string, db?: Database): boolean;
export declare function backfillMachineId(db: Database, force?: boolean): void;
//# sourceMappingURL=machines.d.ts.map