/** * Resolve a response-supplied endpoint URL against the trusted host, then * reject it if it left that origin, embedded credentials, or used a non-HTTP(S) * scheme. Resolve first, validate second — a relative `/serve/...` (which * statelog returns) is legitimate and must survive. Throws on any violation. */ export declare function resolveTrustedEndpointUrl(rawUrl: string, targetHost: string): string; /** A parsed, canonicalized serve base. Identifiers are decoded for use; * `serveUrl` re-encodes each exactly once. */ export type ServeAddress = { serveUrl: string; origin: string; userId: string; projectId: string; filename: string; }; /** * Parse a serve base URL, accepting *only* the exact * `…/serve/:userId/:projectId/:filename` shape. A trailing slash is * canonicalized away; anything else — query, hash, credentials, a non-HTTP(S) * scheme, empty identifiers, or extra/command segments (`…/node/main`) — is * rejected with `null`. */ export declare function parseServeBaseUrl(rawUrl: string): ServeAddress | null; /** Build a request URL under a serve base, encoding each dynamic segment once. * Validates the base through `parseServeBaseUrl` first. */ export declare function serveRouteUrl(serveUrl: string, segments: string[]): string; /** The inverse of `parseServeBaseUrl`. `filename` is the URL segment: the * agent file without its `.agency` suffix. */ export declare function buildServeAddress(parts: { origin: string; userId: string; projectId: string; filename: string; }): ServeAddress; /** The statelog web-app page for a project. */ export declare function projectPageUrl(address: { origin: string; projectId: string; }): string; /** Reduce a host string to a bare origin (`scheme://host[:port]`), or null if it * is not a usable statelog origin. Account-management routes are built from this * with `new URL(...)`, so anything ambiguous is rejected: non-HTTP(S) schemes, * embedded credentials, a query or fragment, or a non-root path (statelog is * served at the root). A trailing slash is canonicalized away. */ export declare function canonicalOrigin(host: string): string | null;