import { type Socket } from 'node:net'; import type { Harness } from './harness.js'; import { BrokerClient } from '../../broker-client/index.js'; import { type BrokerToClient, type ClientToBroker, type ClientRole, type WelcomeFrame } from '../../runtime/broker-protocol.js'; export declare const delay: (ms: number) => Promise; export declare const tok: (s: string) => string; export declare const frameHas: (f: BrokerToClient, token: string) => boolean; export declare function brokerLogText(h: Harness, id: string): string; /** lsof the holders of `path`, or null when lsof is unavailable (skip the fd * check). Exit-non-zero with empty stdout means "no holders". */ export declare function lsofHolders(path: string): number[] | null; export interface Attached { client: BrokerClient; frames: BrokerToClient[]; welcome: WelcomeFrame; send(frame: ClientToBroker): void; waitFrame(pred: (f: BrokerToClient) => boolean, label: string, timeoutMs?: number): Promise; close(): void; } export interface RawClient { socket: Socket; frames: BrokerToClient[]; closed: () => boolean; send(frame: ClientToBroker): void; writeRaw(data: Buffer | string): void; waitClosed(label: string, timeoutMs?: number): Promise; close(): void; } export interface AttachKit { /** Connect a BrokerClient to a node's running broker, hello, await welcome. */ attach(id: string, role: ClientRole, clientId: string): Promise; /** Attach (as `role`) and retry until the welcome satisfies `pred`. */ attachUntil(id: string, role: ClientRole, clientId: string, pred: (a: Attached) => boolean, label: string): Promise; /** A raw node:net peer. read:false leaves the socket PAUSED (G8 stalled viewer). */ connectRaw(id: string, opts: { read: boolean; }): Promise; /** Close every client opened since the last closeAll — wire into afterEach. */ closeAll(): void; } /** Build the attach kit against a lazily-resolved harness (the harness is * created in the file's before() hook, after the kit is constructed). */ export declare function createAttachKit(getH: () => Harness): AttachKit;