/** * Detection and transport for herdr's socket API. Nothing else lives here. * * Reporting agent state is ported from the integration herdr installs into pi * itself (`~/.pi/agent/extensions/herdr-agent-state.ts`, * `HERDR_INTEGRATION_ID=pi`): that file is proven against this exact server, * and there is no reason to invent a second dialect. * * Opening a pane is not in it - the integration only ever reports on the pane * it was launched in - so those calls answer to `herdr api schema --json` * alone, and `scripts/check-herdr.ts` is what holds them to it. */ /** The three variables herdr injects into a pane. All three, or nothing. */ export type HerdrEnv = { /** The unix socket herdr listens on, from `HERDR_SOCKET_PATH`. */ socketPath: string; /** The pane we were launched in, from `HERDR_PANE_ID`. Ours are opened beside it. */ paneId: string; }; /** * Detects a live herdr pane. * * Returns `undefined` when any of the three markers is missing - which is the * normal case outside herdr, not an error. Callers fall back silently: no * warning is ever printed just because herdr is not there. */ export declare function detectHerdr(env?: NodeJS.ProcessEnv): HerdrEnv | undefined; /** * Sends one request to herdr. Resolves with the response, or `undefined` when * the call could not be delivered. * * It **never rejects**. A herdr that stopped answering must not take a workflow * down with it - the display is an observer, never a participant. */ export type HerdrSend = (method: string, params: Record) => Promise; /** Source id under which we report. Distinct from the pi integration's `herdr:pi`. */ export declare const HERDR_SOURCE = "combo"; /** * Builds a sender bound to a herdr socket. * * One connection per request, closed as soon as the first response arrives - * that is what the reference implementation does, and the server expects it. * A first attempt at 500 ms, then one retry at 1500 ms, then we give up quietly. */ export declare function createHerdrSend(env: HerdrEnv): HerdrSend; /** The next ordering number. Every request and every status report takes one. */ export declare function nextSeq(): number; /** * The error herdr answered with, if it answered with one. * * A refusal and a success are both delivered responses, and telling them apart * is not a reporter's business: it drops a pane either way. It is * `/herdr on`'s, which is the one place allowed to say so out loud. */ export declare function errorOf(response: unknown): { code: string; message: string; } | undefined; /** Pulls the pane id out of a `pane.split` response, if there is one. */ export declare function paneIdOf(response: unknown): string | undefined; //# sourceMappingURL=herdr-client.d.ts.map