export interface BrokerEntry { url: string; pid: number; updatedAt: number; credential?: string; /** M4: the hosting daemon's project root — one root is one trust domain. */ root?: string; } /** M4: canonical form of a project root for trust-domain comparison. */ export declare function normalizeRoot(root: string): string; /** Normalize credential: trim whitespace, reject empty/oversized values. */ export declare function normalizeCredential(cred: string | undefined): string | undefined; export declare function defaultRegistryDir(): string; /** Where the OPERATOR credential lives — deliberately not the broker registry. * The registry entry is the agent-facing credential: every org process on the * machine reads it to deliver messages, so anything in it must be assumed * visible to agents. The operator credential authorizes human decisions * (approvals, gates, answers) and is only read by the `org` CLI. */ export declare function defaultOperatorDir(): string; /** Publish the operator credential for org `name` so `org approve/deny/answer/gate-*` * can authenticate to the hosting daemon's human-decision routes. */ export declare function writeOperatorCredential(name: string, credential: string, dir?: string): void; export declare function readOperatorCredential(name: string, dir?: string): string | undefined; export declare function removeOperatorCredential(name: string, dir?: string): void; /** Publish that this process hosts org `name`, reachable via `url`. Call again periodically (heartbeat) — see BrokerLease. * Writes via tmp+rename (same-directory rename is atomic on POSIX/NTFS) so a concurrent lookupOrg() never observes a * partially-written entry — this file is rewritten every heartbeat (default 20s) while other processes may read it. */ export declare function registerOrg(name: string, url: string, dir?: string, credential?: string, root?: string): void; /** Remove this process's registration for `name` (best effort). */ export declare function unregisterOrg(name: string, dir?: string): void; /** Find which process (if any) currently hosts org `name`. Null if never registered or the registration is stale (owner crashed without cleanup). */ export declare function lookupOrg(name: string, dir?: string, staleMs?: number): BrokerEntry | null; /** Keeps a broker registration alive with periodic heartbeats until stop() is called. * `credential` is the org's AGENT credential (published in the registry entry); * `operator` is the daemon's operator credential, written to its own directory * and never into the registry entry. */ export declare class BrokerLease { private name; private url; private dir; private intervalMs; private credential?; private operator?; /** M4: the daemon's project root, published in the registry entry. */ private root?; private timer; constructor(name: string, url: string, dir?: string, intervalMs?: number, credential?: string | undefined, operator?: { credential: string; dir?: string; } | undefined, /** M4: the daemon's project root, published in the registry entry. */ root?: string | undefined); private publish; start(): void; stop(): void; } //# sourceMappingURL=broker.d.ts.map