export { SessionStore, type CreateSessionOptions, type CustomToolConfig, DEFAULT_TOOLS, resolveInternalAgentDir, INTERNAL_AGENT_DIR } from "./sessions.js"; export { startWatchdog, type WatchdogOptions } from "./watchdog.js"; export { createHttpToolExecutor, normalizeHttpToolConfig, interpolate, type HttpToolConfig } from "./http-tool-executor.js"; export { createLogger } from "./logger.js"; import { type IncomingMessage } from "node:http"; import { type WatchdogOptions } from "./watchdog.js"; export declare function parseBody(req: IncomingMessage): Promise; /** Thrown when a matched route pattern has an invalid percent-encoded or control-char param. */ export declare class BadRouteParamError extends Error { readonly statusCode = 400; constructor(message: string); } export declare function routeMatch(url: string, pattern: string): Record | null; /** * Escape values for single-line `[sidecar] ACTION: key=value, …` logs. * Controls, commas, and equals must not appear unescaped — otherwise decoded * route params can forge/blur structured fields. */ export declare function sanitizeForLog(value: string): string; /** * True when the bind address is loopback-only. Used to decide whether * GET /models/:provider/status may return full auth diagnostics. * Fail-closed: unrecognized forms are treated as non-loopback (over-redact). */ export declare function isLoopbackBindHost(host: string): boolean; /** * Strip auth-configuration detail (env labels, credential sources) for * non-loopback binds. Keeps authStatus.configured (boolean) and authCheck.type * (string); strips source/label. Loopback responses pass through. */ export declare function redactProviderStatusAuth(status: T, bindHost: string): T; export interface SidecarHandle { close(): Promise; } /** Why the sidecar HTTP server stopped. `fatal` means the process should exit nonzero. */ export interface SidecarStopResult { reason: string; fatal: boolean; } /** Handle returned by `startSidecar()` — adds listen readiness without changing `SidecarHandle`. */ export interface StartedSidecarHandle extends SidecarHandle { /** Resolves when the HTTP server is listening; rejects on async bind failure. */ ready: Promise; /** Settles when shutdown finishes. `fatal` is true for listen/server/watchdog failures. */ stopped: Promise; } export declare function startSidecar(options?: { port?: number; host?: string; watchdogUrl?: string; watchdogOptions?: WatchdogOptions; /** * Agent dir the internal runtime reads models.json/auth.json/settings.json * from (custom pi providers, credentials, and settings for deployments). * settings.json is read once at process start — restart to apply changes. * Falls back to PI_SIDECAR_AGENT_DIR, then /tmp/pi-sidecar-agent. */ agentDir?: string; /** Test hook: runs after TCP listen and before `ready` resolves. */ beforeListenReady?: () => void | Promise; }): StartedSidecarHandle; /** CLI helper: exit 1 on async bind failure or a later fatal server stop. */ export declare function bindSidecarListenExit(handle: StartedSidecarHandle, exitProcess?: (code: number) => void): void;