/** * Live traffic for a dispatched lane, as the relay daemon sees it (2026-09-17, owner decision: a * lane is stopped when it is IDLE, never because it passed a time budget). * * The MCP server gives every lane it starts a random TAG and sends it as the * `x-llm-relay-lane-activity` request header — through `ANTHROPIC_CUSTOM_HEADERS` for a spawned * `claude -p`, directly for an answer-mode call. Every request that carries a tag touches its * record here: the request start, every write to the response, and the request end. So the daemon * can say "this lane has a request in flight" or "its last traffic was N seconds ago" — which is * the one activity signal `claude -p` does not hide, because it buffers its own output until exit. * * ⚠ In memory only, in the daemon process. A restart forgets every tag, and the MCP server then * reads "no record", which is NO signal, never "idle": the walk still has the lane's output and * its working tree. * ⚠ The tag carries nothing: it is a random token the MCP server made, validated to a closed * alphabet so a caller cannot put prose into a map key. The header never leaves the relay * (`INTERNAL_REQUEST_HEADERS` in `candidate-runner.ts`). */ /** The request header that carries a lane's activity tag. */ export declare const LANE_ACTIVITY_HEADER = "x-llm-relay-lane-activity"; /** The tags the daemon keeps at once. The oldest record is dropped past it. */ export declare const MAX_LANE_ACTIVITY_TAGS = 1000; /** Create one opaque activity tag carrying no lane/task meaning. */ export declare function createLaneActivityTag(): string; /** * Add exactly one lane-activity header to an ANTHROPIC_CUSTOM_HEADERS value. * A nested dispatch may inherit its parent's value, so replace this header while preserving every * unrelated custom header. */ export declare function withLaneActivityHeader(existing: string | undefined, tag: string): string; /** What the daemon knows about one tag. */ export interface LaneTrafficRecord { /** Requests with this tag the daemon is serving now. */ inFlight: number; /** Requests with this tag the daemon has seen. */ requests: number; /** Epoch ms of the last request start, response write or request end. */ lastActivityAt: number; } /** The tag in a header value, or null when the value is absent or not a valid tag. */ export declare function laneActivityTag(value: string | string[] | undefined): string | null; /** A request with this tag started. Returns the calls for its writes and its end. */ export declare function beginLaneRequest(tag: string, now?: () => number): { wrote: () => void; ended: () => void; }; /** The record for a tag, or null when the daemon has none. */ export declare function readLaneActivity(tag: string): LaneTrafficRecord | null; /** Test seam: forget every tag. */ export declare function resetLaneActivity(): void;