export type DeviceRole = 'main' | 'client' | string; export interface NetworkEndpoint { host: string; port: number; } export interface DeviceIdentity { schema: 'nelloz-device.v1'; deviceId: string; name: string; role: DeviceRole; publicKey: string; privateKey: string; createdAt: string; } export interface NellozSystem { schema: 'nelloz-system.v1'; role: DeviceRole; systemId: string; mainDeviceId: string; hubPublicKey: string; endpoints?: NetworkEndpoint[]; credential?: Record; [key: string]: unknown; } export interface PairingInfo { code: string; expiresAt: string; pairingId: string; } export interface NellozHubOptions { home: string; identity: DeviceIdentity; system: NellozSystem; host?: string; port?: number; discovery?: boolean; discoveryPort?: number; pairingTtlMs?: number; onPairingCode?: ((info: PairingInfo) => void) | null; } export const PAIRING_PORT: number; export const DISCOVERY_PORT: number; export const PAIRING_TTL_MS: number; export const PAIRING_PROTOCOL: string; export const SESSION_PROTOCOL: string; export function createPairingCode(): string; export function ensureDeviceIdentity( home: string, options?: { role?: DeviceRole; name?: string }, ): Promise; export function loadNellozSystem(home: string): Promise; export function ensureMainSystem( home: string, options?: { name?: string }, ): Promise<{ identity: DeviceIdentity; system: NellozSystem }>; export class NellozHub { constructor(options: NellozHubOptions); static create(options: Omit): Promise; readonly port: number; readonly pairingInfo: PairingInfo | null; rotatePairingCode(reason?: string): PairingInfo; ensurePairing(): unknown; start(): Promise; close(): Promise; } export function discoverNellozSystem(options?: { timeoutMs?: number; discoveryPort?: number; }): Promise<{ endpoint: NetworkEndpoint; advert: Record }>; export function pairDevice(options: { home: string; code: string; role?: DeviceRole; name?: string; host?: string | null; port?: number; timeoutMs?: number; discoveryPort?: number; }): Promise<{ ok: true; identity: DeviceIdentity; system: NellozSystem; endpoint: NetworkEndpoint; }>; export function connectDevice(options: { home: string; host?: string | null; port?: number | null; timeoutMs?: number; discoveryPort?: number; presence?: Record | null; }): Promise<{ ok: true; endpoint: NetworkEndpoint; status: unknown; system: NellozSystem; identity: DeviceIdentity; }>; export function waitForShutdown(close: () => void | Promise): Promise; export const __testing: Readonly>;