/** * Routes re-point a matching request at a different upstream, so pxpipe can * transform it without the agent ever seeing a non-first-party base URL. * * That indirection is the whole point. Claude Code hides /remote-control the * moment ANTHROPIC_BASE_URL is custom (and gates connectors on the same * "firstParty" check), so pointing the agent at pxpipe directly costs you the * feature. Under warp the agent still talks to api.anthropic.com; only the one * path we rewrite is diverted, and auth, telemetry and the control plane go to * the real host untouched. * * Ported from wardex route.go. */ export interface Route { /** Original spec text, for banners and logs. */ readonly pattern: string; /** Anchored matcher against "host/path". */ readonly re: RegExp; /** * Host-only matcher, used to decide whether a CONNECT is worth decrypting at * all — a CONNECT carries no path. */ readonly hostRe: RegExp; /** * Whether the pattern named a port. Loopback targets make the port the only * thing distinguishing two hosts (127.0.0.1:9090 vs 127.0.0.1:47821), so a * pattern that names one must be matched against "host:port" and a pattern * that does not must keep matching any port. */ readonly hasPort: boolean; readonly target: URL; /** * Target path prefix, normalized to "" or "/foo" (no trailing slash). Kept * separately because URL.pathname cannot represent the empty path: assigning * "" to a special-scheme URL silently snaps it back to "/", which would make * every rewrite emit a doubled "//v1/messages". */ readonly prefix: string; } /** * parseRoute reads one PATTERN=TARGET rule: * * api.anthropic.com/v1/messages*=http://127.0.0.1:47821 * re:^api\.anthropic\.com/v1/messages(/.*)?$=http://127.0.0.1:47821 * * PATTERN matches "host/path" with no scheme and no query. TARGET is * scheme://host[:port][/prefix]; the original path and query ride along. */ export declare function parseRoute(spec: string): Route; /** * First match wins, so earlier rules shadow later ones. * * `hostPort` carries the port so a pattern may select on it; patterns that name * no port are matched against the bare host and so still match any port. */ export declare function matchRoute(routes: readonly Route[], hostPort: string, path: string): Route | null; /** * Whether any rule could match this host. Decryption is decided at CONNECT * time, before a path exists, so this is deliberately permissive: guessing * "yes" costs a needless MITM, guessing "no" silently breaks the route. */ export declare function hostCouldMatch(routes: readonly Route[], hostPort: string): boolean; /** * Absolute URL a matched request is sent to. Path and query are preserved so * the downstream sees the same request the agent made. */ export declare function rewriteUrl(route: Route, requestUri: string): string; export declare function routeDestination(route: Route): string; //# sourceMappingURL=route.d.ts.map