/** Header carried by local CLI control requests. */ export declare const CONTROL_AUTHORIZATION_HEADER = "x-llm-relay-control-token"; /** Per-install capability file, relative to the relay config directory. */ export declare const CONTROL_AUTHORIZATION_FILENAME = "control-token"; /** Default config directory used when a Config was assembled in memory and has no sourcePath. */ export declare function defaultRelayConfigDir(): string; /** * Resolve the one install directory shared by the server and CLI. * * A loaded config's `sourcePath` wins, including an explicit relative `--config` path. In-memory * configs fall back to the standard per-user relay directory; callers/tests may inject a different * fallback without changing process globals. */ export declare function resolveControlAuthorizationConfigDir(sourcePath: string | undefined, fallbackDir?: string): string; export type ControlAuthorizationHeaders = Readonly> | { get(name: string): string | null; }; /** * The narrow dependency injected into request admission. * * Keeping only validation on the port means callers cannot obtain the installed capability from * an admission dependency. The file-backed implementation additionally has explicit CLI helpers. */ export interface ControlAuthorizationPort { validate(candidateToken: unknown): boolean; } export interface FileControlAuthorization extends ControlAuthorizationPort { readonly headerName: typeof CONTROL_AUTHORIZATION_HEADER; validateHeaders(headers: ControlAuthorizationHeaders | undefined): boolean; /** Return a new header record carrying the capability; the input is never mutated. */ attach(headers?: Readonly>): Record; } export declare class ControlAuthorizationError extends Error { constructor(); } /** Read the configured control header from either WHATWG Headers or Node-style header records. */ export declare function readControlAuthorizationHeader(headers: ControlAuthorizationHeaders | undefined): string | undefined; /** Fail closed when the injected port is unavailable or rejects the request header. */ export declare function validateControlAuthorization(authorization: ControlAuthorizationPort | undefined, headers: ControlAuthorizationHeaders | undefined): boolean; /** * Synchronously load (or initialize) the per-install capability and return a closure-backed port. * No secret-bearing property is placed on the returned object, error, or serializable snapshot. * Repeated calls read the existing file; they never rotate or rewrite a valid capability. */ export declare function createControlAuthorization(configDir: string): FileControlAuthorization;