/** Ops the daemon answers. Every one is peer-level — none of them needs the * TUN — which is what makes the beagle/decentlan split possible at all. */ export type IpcOp = "ping" | "diag" | "friend-request" | "friends-pending" | "friends-accept" | "friends-reject" | "friends-list" | "friend-remove" | "friend-set-alias" | "friends-autoaccept" | "set-profile" | "sign" | "chat-send" | "chat-history" | "chat-log-local" | "chat-mark-read" | "file-send" | "file-delete" | "file-cancel" | "file-retry" | "file-log-local" | "call-signal" | "call-poll"; export interface IpcRequest { op: IpcOp; address?: string; hello?: string; userid?: string; text?: string; alias?: string; name?: string; description?: string; path?: string; ids?: string[]; ts?: number; since?: number; limit?: number; enabled?: boolean; origin?: string; nonce?: string; signal?: unknown; custom_id?: string; component?: string; values?: Record; size?: number; dir?: "in" | "out"; peer?: string; before?: number; [key: string]: unknown; } export interface IpcResponseOk { ok: true; data?: Record; } export interface IpcResponseErr { ok: false; error: string; } export type IpcResponse = IpcResponseOk | IpcResponseErr; /** Must match decentlan's ipcSocketPath() exactly — daemon and client have to * agree on this string or beagle silently finds no daemon. */ export declare function ipcSocketPath(dataDir: string, platform?: NodeJS.Platform): string; /** fs.existsSync is meaningful for Unix-domain sockets but always false for * Windows named pipes, so on Windows we connect and let net report. */ export declare function ipcSocketSupportsFsExistenceCheck(platform?: NodeJS.Platform): boolean; /** How long the liveness probe waits for a connect before calling it dead. * A listening local socket accepts in well under a millisecond, so this * budget never measured the daemon — it measured how long OUR event loop took * to run the connect callback. At 400 ms a GC pause or a big JSON body in * beagle read as "daemon gone": 814 false flaps on mac-dev while the daemon's * pid never changed. One miss is not believed either; see DAEMON_MISS_STREAK * in lan-handoff.ts. */ export declare const DAEMON_PROBE_TIMEOUT_MS = 2000; /** * Is a decentlan daemon actually LISTENING for this identity? * * The only trustworthy answer is a connection. The previous check asked the * filesystem, which cannot answer on either platform: * * - Windows named pipes never appear to `existsSync`, so the old code * returned a hard-coded `true` — "can't tell; try it". Every beagle on * Windows therefore believed in a daemon that was not there, handed its * identity to a pipe nobody served, and failed every peer op with * `connect ENOENT \\.\pipe\agentnet-…`. That one wrong default is why * add-friend, renaming and .beagles.eth registration were all broken. * - On Unix a `daemon.sock` left behind by a crashed daemon exists just as * firmly as a live one, so the same promotion happened there too, only * rarer. * * Connecting costs a round trip to a local socket and removes both. It is the * same code on every platform, which is the real win: no branch that only one * of us can test. */ export declare function probeDaemon(dataDir: string, timeoutMs?: number): Promise; /** * Sync, best-effort: could a daemon socket be there? * * Only for callers that genuinely cannot await. It answers `false` when it * cannot tell — the opposite of the old default, and the whole point. A `true` * from this is still only a hint; confirm with {@link probeDaemon} before * handing an identity to anything. */ export declare function daemonSocketMayExist(dataDir: string): boolean; /** One request, one newline-delimited JSON response. */ export declare function ipcCall(dataDir: string, req: IpcRequest, timeoutMs?: number): Promise;