import { type IpcRequest, type IpcResponse } from "./ipc.js"; export type BackendKind = "daemon" | "embedded"; export interface PeerHost { readonly kind: BackendKind; /** True when this backend also provides the virtual LAN (TUN + exits), i.e. * when the network panel has anything to show. */ readonly hasVirtualLan: boolean; call(req: IpcRequest): Promise; stop(): Promise; } /** Where decentlan keeps its Carrier identity and daemon socket. Beagle reuses * this identity when it exists so a user's friends carry over — the whole * point of the split is that it is the same node, not a new one. */ export declare function decentlanCarrierDir(configDir: string): string; export declare function defaultConfigDir(): string; /** Build an IPC-backed host directly. Used by the LAN handoff, which knows a * daemon has appeared and needs to switch to it without re-running detection. */ export declare function makeDaemonHost(dataDir: string): PeerHost; export interface OpenPeerHostResult { host: PeerHost; /** Human-readable reason for the choice, for the startup banner. */ why: string; } export interface OpenPeerHostOptions { configDir: string; bootstrapNodes: { host: string; port: number; pk: string; }[]; expressNodes?: { host: string; port: number; pk: string; tls?: boolean; }[]; nickname?: string; statusMessage?: string; autoAcceptFriends?: boolean; /** @decentnetwork/peer version, forwarded to an embedded host so its `ping` * can name the code actually running. Ignored for a daemon host — the * daemon reports its own. */ peerVersion?: string; /** Persist a runtime auto-accept toggle (embedded backend only). */ onAutoAcceptChange?: (enabled: boolean) => void; /** Force a backend instead of auto-detecting. Mainly for testing the * embedded path on a machine that also runs a daemon. */ force?: BackendKind; /** How long `force: "daemon"` waits for the daemon socket. Default 60s. */ waitForDaemonMs?: number; } /** * Pick a backend. * * Daemon-first when one is running: it already holds this identity's Carrier * peer, and starting a second peer on the same keypair is the one thing that * must never happen. If there's no daemon, run the peer ourselves — no root, * no TUN, just messaging. */ export declare function openPeerHost(opts: OpenPeerHostOptions): Promise;