/** * X (formerly Twitter) URL vocabulary shared by the X reader * (`web/scrapers/twitter.ts`) and the xAI search provider's `x_search` mapping * (`web/search/providers/xai.ts`): which hosts serve X, which path segments are * account handles, and which page a URL shows. */ /** Profile timeline tab an X profile URL shows. */ export type XProfileTab = "posts" | "replies" | "media"; /** The X page a URL shows, as far as Grok's X tools can read it. */ export type XTarget = /** One post (`//status/`, `/i/web/status/`) with its thread. */ { kind: "post"; id: string; } /** A profile and one of its timeline tabs. */ | { kind: "profile"; handle: string; tab: XProfileTab; } /** Post search (`/search?q=`, `/hashtag/`); `latest` mirrors the Latest tab (`f=live`). */ | { kind: "search"; query: string; latest: boolean; } /** People search (`/search?q=…&f=user`). */ | { kind: "users"; query: string; } /** An X page no X tool reads (home, explore, lists, followers, …). */ | { kind: "unsupported"; }; /** Whether a bare, lowercased host serves X pages. */ export declare function isXHost(host: string): boolean; /** The account handle a path segment names, or `undefined` for app routes and invalid handles. */ export declare function xHandle(segment: string | undefined): string | undefined; /** * Classify an X URL for the X reader. * * Returns `null` for non-X URLs so other handlers can claim them. A missing * scheme (`www.x.com/jack`, as read paths may omit it) means `https`. * * @example * parseXUrl("https://x.com/jack/status/20/photo/1"); // { kind: "post", id: "20" } * parseXUrl("https://x.com/search?q=omp&f=live"); // { kind: "search", query: "omp", latest: true } */ export declare function parseXUrl(url: string): XTarget | null;