Archilyzer · Source

archilyzer

Archilyzer
git clone https://archilyzer.pages.dev/source/archilyzer.git
Log | Files | Refs | README | LICENSE

commit 766798700cdd1208779bb98fa9cd000602fd4ab5
parent 251102e38815f3f00198bf2b229c6d69b4381762
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Tue, 20 Oct 2026 17:15:56 -0400

docs: X search channels — OPERATING "X search", CHANNEL.md and COMMANDS.md regenerated, FACTS "Release 38 lane S", CHANGELOG

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Diffstat:
MCHANNEL.md | 1+
MCOMMANDS.md | 5+++--
MOPERATING.md | 26++++++++++++++++++++++++++
Meditor/CHANGELOG.md | 1+
Mplans/FACTS.md | 61+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 92 insertions(+), 2 deletions(-)

diff --git a/CHANNEL.md b/CHANNEL.md @@ -51,6 +51,7 @@ Regenerate this file with `pnpm --filter yt-dlp-transcript-common exec tsx bin/f | `recordedDate` | config | For a channel that MIRRORS another's streams (a VOD archive): how to read the date a video was RECORDED from its title, since its `upload_date` is the date of the copy. The index stores the result as the record's `recordedDate` (`YYYYMMDD`), which coverage reads before the upload date. A title it does not match, a date that is not a real day, or one after the upload date gives none. Changing the rule re-derives the channel's records on the next index build. An object without a usable `titlePattern` is dropped. See [`recordedDate`](#recordeddate). | | `mirror` | config | For a channel that MIRRORS another creator's streams: the creator's channels it copies (`of`, their slugs). The mirror scan (`pnpm ops mirror-scan`) pairs each of this channel's videos with the creator's by date and title and writes `transcripts/mirrors/<slug>.json`: which videos the creator still has public, removed or never uploaded, and which of the creator's removed videos this channel holds. Private: never published. An object without a usable `of` is dropped. See [`mirror`](#mirror). | | `wayback` | config | A WAYBACK PAGES channel (platform `"webpage"`, `sourceKind` `"social"`): which Wayback Machine captures of pages that are not videos are in scope. `{targets: [{url, match, from?, to?, mime?, include?, exclude?}], collapse?: "digest", auto?: true}` — `match` is `"exact"` (one page), `"prefix"` (every URL under a path), `"host"` (one host) or `"domain"` (a host and its subdomains); `from`/`to` bound the capture time (a Wayback timestamp prefix, 4–14 digits, inclusive); `mime` the mimetypes kept (default `text/html`); `include`/`exclude` regex sources over a capture's original URL. Each capture imported (`pnpm ops import-page`, the channel page's **Import a capture**) becomes a page record in the channel's posts, its raw body kept under `pages/` (OPERATING.md, "Import from the Wayback Machine"). A target without a URL or a valid `match` is dropped; an object with no valid target is dropped. `auto: true` lets the download lane import the captures a later scan (`pnpm ops wayback-scan`, the **Captures** tab) adds, one job each at archive.org's pace; absent, nothing is imported unasked. | +| `xSearch` | config | An X SEARCH channel (platform `"twitter"`, `sourceKind` `"social"`, `url` the search page): a saved X search across accounts, its records the matching posts from ANY author. `{query, since?, until?, windowMonths?, lang?, exclude?}` — `query` as X's search box takes it (words, `"phrases"`, `OR`, `-term`, `from:`, `to:`, `@mention`, `url:`, `filter:`, `lang:` pass through; `since:`, `until:` and `max_id:` are refused — the walk adds them); `since`/`until` the days walked between (YYYY-MM-DD; `since` inclusive, `until` exclusive; absent `until` = tomorrow, and each later fetch searches what is new); `windowMonths` each search window's span (1–12, default 3); `lang` a language code added as `lang:<code>`; `exclude` the handles **Never archive** hid from the leads view (lower case). A fetch walks the windows newest first through gallery-dl's search, resumable, at the older walk's pace and with its login (OPERATING.md, "X search"). Never on a site. An object without a valid query is dropped. | #### `downloadFilter` diff --git a/COMMANDS.md b/COMMANDS.md @@ -107,7 +107,7 @@ Drives a running editor over HTTP (`/api/ops/*`, the same actions its pages run) | `delete-article` | delete-article deletes an article, as `archilyzer reports delete <id>` does: {"id"}, "dryRun"? (answer the plan — every path with its size, what is kept and why — and write nothing), "force"? (unpublish it, and drop a site page naming it with no report of its own, first). It removes the article's directory (report, video, history, notes, iterations), each iteration's video project under settings.generation.projectsRoot and its staged exports. Refused with the plan (409): a published article or such a site page without "force"; a queued or running iteration, force or not. | `pnpm ops delete-article --json '{"id":"demo-article","dryRun":true}'`<br>`pnpm ops delete-article --json '{"id":"demo-article","force":true}'` | | `delete-iteration` | delete-iteration deletes one iteration and its video project: {"id", "n"}, "dryRun"?. Its number is never given again. Refused with the plan (409), no override: the current article, the iteration its report.json came from, the current video, a queued or running one, one another revises or copies. | `pnpm ops delete-iteration --json '{"id":"demo-article","n":3}'` | | `delete-site` | delete-site deletes a site, plan first: {"id"}, "dryRun"? (answer the plan — every path with its size, what is kept and why — and write nothing), "force"? It removes sites/&lt;id&gt;/ (site.json, its pool and pages, tags, charts, its reports), its publish state and last bundle (export/.export-builds/&lt;id&gt;/) and compose's staging for it (export/.export-index/sites/&lt;id&gt;/). Channel data is never touched; the Pages project, what was deployed and a deployed hub are kept (a delete does not undeploy). Refused with the plan (409) unless "force": a deploy target (cloudflareProject), a deploy in its publish state, reports of its own. Refused, force or not: no such site (404), a site dir that is a link, a publish stage running. | `pnpm ops delete-site --json '{"id":"demo-site","dryRun":true}'` | -| `create-channel` | create-channel is the New channel form: {"fields": {"name", "handling": "youtube"\|"transcribe", "url"?, "platform"?, "sourceKind"?, "postFetcher"?, "socialHandle"?, …}} with channel-config's patch keys; "slug"? (else derived from the name), "sites"? (absent = on no site). "fetchPlaylist", "fetchPostsNow" and "prioritizeDownload" are the form's checkboxes, OFF unless true; a job they start comes back as jobId(s), so --wait follows it. | `pnpm ops create-channel --json '{"fields":{"name":"Example (X)","handling":"transcribe","url":"https://x.com/example"}}'` | +| `create-channel` | create-channel is the New channel form: {"fields": {"name", "handling": "youtube"\|"transcribe", "url"?, "platform"?, "sourceKind"?, "postFetcher"?, "socialHandle"?, …}} with channel-config's patch keys; "slug"? (else derived from the name), "sites"? (absent = on no site). "fetchPlaylist", "fetchPostsNow" and "prioritizeDownload" are the form's checkboxes, OFF unless true; a job they start comes back as jobId(s), so --wait follows it. An X search page URL (x.com/search?q=…), or "platform": "x-search" with "xSearchQuery" (and "xSearchSince"?, "xSearchUntil"?, "xSearchWindowMonths"?, "xSearchLang"?), makes an X SEARCH channel: the matching posts from any account, walked by fetch-posts in search windows; never on a site (sites refused). | `pnpm ops create-channel --json '{"fields":{"name":"Example (X)","handling":"transcribe","url":"https://x.com/example"}}'`<br>`pnpm ops create-channel --json '{"fields":{"name":"Demo search","handling":"transcribe","url":"https://x.com/search?q=%22demo%20phrase%22"}}'` | | `rename-channel` | rename-channel moves a channel to a new slug, as Danger → Rename does: {"slug", "newSlug"}. Refused while the channel is busy (a job, a lane unit, media in transition) or when the new slug is taken. Old links break. | `pnpm ops rename-channel --json '{"slug":"old-slug","newSlug":"new-slug"}'` | | `delete-channel` | delete-channel removes a channel's whole directory, as Danger → Delete does: {"slug", "confirm"} — "confirm" must repeat the slug. No undo outside the transcripts/ repo's own history. | `pnpm ops delete-channel --json '{"slug":"x","confirm":"x"}'` | | `metadata-scan` | metadata-scan reads every listed video's title, date and description into the channel's scan file, fetching no media: {"slug"}. Not held by the download pause and needs no disk floor; one request per video, so it respects the platform's cooldown and records one when pushed back. | `pnpm ops metadata-scan --json '{"slug":"the-quartering"}'` | @@ -160,6 +160,7 @@ Drives a running editor over HTTP (`/api/ops/*`, the same actions its pages run) | `import-post` | import-post imports ONE post by its URL into a posts channel of its platform: {"slug", "url"} — an X status (x.com/&lt;handle&gt;/status/&lt;id&gt;) or a Bluesky post (bsky.app/profile/&lt;handle&gt;/post/&lt;id&gt;, or its at:// URI). Read through the channel's own fetcher (gallery-dl for X, with the channel's login; the public AppView for Bluesky) as an import-post job on the platform's queue. Refused, before any job: a URL that is not a post, a channel that is not a posts channel of that platform or whose fetcher cannot read one post, a post the URL names as another account's, the platform held or cooling down. A post already archived is not read again; one the platform says is another account's is not written. The log ends with @@import-post {ok, slug, url, id, written, already?, post?, error?}. | `pnpm ops import-post --json '{"slug":"demo-x","url":"https://x.com/example/status/1700000000000000001"}' --wait` | | `import-page` | import-page imports ONE Wayback Machine capture of a page that is not a video into a Wayback pages channel (platform "webpage"): {"slug", "url"} — a capture's replay URL (web.archive.org/web/&lt;timestamp&gt;/&lt;page&gt;) — or {"slug", "url": &lt;the page&gt;, "at": "YYYYMMDD\[hhmmss\]"} for the capture nearest that date (one CDX lookup). An import-page job on the archive.org queue, at archive.org's pace: the raw (id\_) body, at most 2 MB, html, plain text or JSON only, redirects followed inside the archive only and the FINAL capture recorded; stored under the channel's pages/, read by the first site extractor that claims it (else the generic one), its page records written to the channel's posts. Refused, before any job: no such channel, not a Wayback pages channel, a URL that names no capture, a video (use import-video), an X capture outside an X channel while social.x.visibility is "private". A capture already stored is not fetched again. "dryRun" answers what it would fetch and starts nothing. The log ends with @@import-page {ok, slug, url, captureTs, originalUrl, records, written, updated, unchanged, extractor, already?, error?}. | `pnpm ops import-page --json '{"slug":"demo-pages","url":"https://web.archive.org/web/20140305120000/https://blog.example/a-post.html","dryRun":true}'`<br>`pnpm ops import-page --json '{"slug":"demo-pages","url":"https://blog.example/a-post.html","at":"20140301"}' --wait` | | `reextract-pages` | reextract-pages re-derives a Wayback pages channel's records from the raw captures it stores: {"slug", "dryRun"?}. No request. A reextract-pages job on the archive.org queue (never beside an import into the channel): every stored capture read again by the extractor it goes to now, the records replaced when anything differs. The log ends with @@reextract-pages {captures, stale, records: {added, changed, removed, unchanged, kept}, written}. | `pnpm ops reextract-pages --json '{"slug":"demo-pages","dryRun":true}' --wait` | +| `x-search-lead` | x-search-lead acts on one lead of an X search channel (the accounts its posts came from — `get channel <slug> --leads [--limit <n>]` lists them, most matches first): {"slug", "handle", "action": "archive" \| "never" \| "restore"}. "archive" creates &lt;handle&gt;-x, an X channel on NO site, by the New channel form's path and starts its first post fetch ("fetch": false skips it; "name"? names it; "dryRun" answers the fields and creates nothing) -&gt; {slug, jobIds}. Refused: not an X search channel, an account an X channel archives already, a slug taken. "never" hides the handle (the channel's xSearch.exclude), "restore" un-hides it -&gt; {exclude, changed}. No model, no request but the new channel's fetch. | `pnpm ops x-search-lead --json '{"slug":"demo-search","handle":"example","action":"archive","dryRun":true}'`<br>`pnpm ops x-search-lead --json '{"slug":"demo-search","handle":"example","action":"never"}'` | | `wayback-lookup` | wayback-lookup answers the Wayback Machine's captures of a page (its CDX API): {"url"} or a record's {"slug", "id"} (its metadata's page, else its availability check's, else the playlist's), "okOnly"?: only the captures that recorded a 200, "limit"?: 100 (at most 500) -&gt; {url, found, captures: \[{timestamp, status, mimetype?, replayUrl}\]}, oldest first. One request through the editor's Wayback client, with archive.org's manners (one at a time, 2 s apart, 429s waited out). Read only. | `pnpm ops wayback-lookup --json '{"slug":"demo-channel","id":"dQw4w9WgXcQ","okOnly":true}'` | | `find-copy` | find-copy looks for a copy of every gone recording (deleted or private) a report cites, and fetches the cited windows from it, as a find-copy job: {"article"} \| {"articles": true} \| {"siteId"}, "dryRun"?, "retryFailed"? -&gt; {jobId}. Per YouTube recording, one at a time: the Wayback Machine when it holds the video (the check yt-dlp makes, not a capture of the page), then archive.org (a mirror of the upload: its identifier, a file name or its original URL names the id, and the file has the recording's length). A copy a fetch failed from at its source (404, 410, 403, unreachable; never our own format selector) is not picked again, unless "retryFailed": true. A copy's windows are cut with a lenient selector (a direct file of unknown height: then the best single file). Every copy's windows go to ONE fetch-windows job on the archive.org clip queue, the copy's URL as each window's page, so the clips land in the recording's own clips/ with the copy (wayback or archive.org, and its URL) in each window's provenance. A recording with no copy is left: its moments show their words only, marked "Source deleted". The log ends with @@find-copy {recordings: \[{slug, id, gone, watchUrl, youtubeId, windows, failedBefore, tried, copy?, outcome}\], items, stopped?, fetchJobId?, refused?}. dryRun looks and starts no fetch; a cancelled job starts none. The scope mode (release 31): {"slug"} \| {"siteId"}, "gone": "no-transcript" \| "all", "dryRun"?, "max"? (10, at most 200), "retryFailed"? -&gt; {jobId}. Every gone (deleted or private) video of the channel, or of the site's channels, that holds no audio or video ("no-transcript": and no transcript; "all": the transcribed ones too, after) is looked for the same way, at most max per run; a video whose last copy attempt found none or failed in the last 30 days is left out unless "retryFailed". Each copy's WHOLE audio is fetched into the video's own record (audio.&lt;fmt&gt;; its metadata stays the original's, the copy is in wayback.json or archiveorg.json and copy-attempts.json) by ONE fetch-copies job on archive.org's download queue, one at a time; the transcription lane then transcribes it like any downloaded audio. A video neither source holds is recorded none-found. dryRun asks the same (paced) questions and records and fetches nothing. The log ends with @@find-copy {scope, gone, dryRun, max, channels, eligible, skipped, looked: \[{slug, id, gone, noTranscript, watchUrl, youtubeId, tried, copy?, via?, outcome}\], left, items, stopped?, fetchJobId?, refused?}. | `pnpm ops find-copy --json '{"article":"demo-article","dryRun":true}'`<br>`pnpm ops find-copy --json '{"article":"demo-article"}' --wait`<br>`pnpm ops find-copy --json '{"article":"demo-article","retryFailed":true}' --wait`<br>`pnpm ops find-copy --json '{"siteId":"demo-site","gone":"no-transcript","dryRun":true}' --wait`<br>`pnpm ops find-copy --json '{"slug":"demo-channel","gone":"all","max":5}' --wait` | | `wayback-scan` | wayback-scan lists the Wayback Machine's captures of a Wayback pages channel's targets (config wayback.targets) into its wayback-scan.json, as a wayback-scan job on archive.org's queue: {"slug", "dryRun"?, "maxRows"? (50000, at most 200000), "full"?} -&gt; {jobId}. The CDX API per target (its matchType exact \| prefix \| host \| domain, status 200, its mimes — text/html unless it names text/plain or application/json — collapse=digest, its from/to), in pages of 5,000 with a resume key; obvious assets (css, js, images, fonts) dropped unless the target's include names them. One row per distinct (URL, digest) with first/last seen. No bodies: import-page fetches a capture. A run cut short (the row cap, a refusal, a drain) keeps each target's resume key and the next continues; once every target is complete the next run is a new pass, from 30 days before the last began, and what it adds is marked new; "full" starts a new pass from each target's start. Paced as archive.org asks (one at a time, 2 s apart, 429/503 waited out; a refusal stops the job). dryRun asks nothing and writes nothing: it logs the next request per target. The log ends with @@wayback-scan {slug, dryRun, pass, newPass, targets: \[{url, match, requests, rows, added, complete, resumeKey?, next?}\], requests, rowsRead, added, totalRows, complete, stopped?, error?}. | `pnpm ops wayback-scan --json '{"slug":"demo-pages","dryRun":true}' --wait`<br>`pnpm ops wayback-scan --json '{"slug":"demo-pages"}' --wait` | @@ -180,7 +181,7 @@ Drives a running editor over HTTP (`/api/ops/*`, the same actions its pages run) ```text Usage: pnpm ops <action> [--json '<body>' | --file <path>] [--wait] [--wait-timeout <seconds>] [--quiet] - pnpm ops get channel <slug> [--counts] + pnpm ops get channel <slug> [--counts] [--leads [--limit <n>]] pnpm ops get channels pnpm ops get tags [<tagId>] pnpm ops get publish diff --git a/OPERATING.md b/OPERATING.md @@ -149,6 +149,32 @@ pnpm ops capture-posts --json '{"slug":"example-x","ids":["<postId>"]}' --wait - Forum pages saved from a browser: `pnpm archilyzer posts import-html <slug> <file-or-dir> --dry-run`. - Which archived posts were deleted at the source: `pnpm archilyzer posts check --slug <slug>`. +### X search + +```sh +pnpm ops create-channel --json '{"fields":{"name":"Zephyr search","handling":"transcribe","url":"https://x.com/search?q=%22zephyr%20archive%22%20OR%20zephyrs"}}' +pnpm ops create-channel --json '{"fields":{"name":"Zephyr search","handling":"transcribe","platform":"x-search","xSearchQuery":"zephyr -from:spam_bot","xSearchSince":"2024-01-01"}}' +pnpm ops fetch-posts --json '{"slug":"zephyr-search"}' --wait +pnpm ops get channel zephyr-search --leads --limit 20 +pnpm ops x-search-lead --json '{"slug":"zephyr-search","handle":"example","action":"archive","dryRun":true}' +pnpm ops x-search-lead --json '{"slug":"zephyr-search","handle":"example","action":"never"}' +``` + +- An X search page URL (`x.com/search?q=…`, as copied from X), or **X search** in the New channel form's Platform + with a query, makes an X search channel: the posts that match the query, from any account (`config.xSearch`, + CHANNEL.md). The query is X's own — OR, quotes, `-term`, `from:`, `to:`, `@name`, `url:`, `filter:`, `lang:` — + but never `since:`/`until:` (a pasted URL's are lifted into the channel's Since and Until) or `max_id:`. +- A fetch walks the search backwards in windows (3 months, `xSearchWindowMonths`), newest first, from Until (blank: + tomorrow) down to Since (blank: until a year of windows matches nothing) — the older walk's windows, pacing, login + and 3-hour budget. A cut-short run resumes where it stopped; later fetches search only the new days (and the + earlier ones when Since moves back); a new query starts afresh; **Search again from the top** re-walks it all. + Each matching post is the search channel's own copy, deduped by id within the channel, as every posts channel. +- The channel page's **Leads** ranks the accounts by matching posts (first and last day, a sample). + **Archive this account** creates `<handle>-x` on no site and starts its fetch; **Never archive** hides the + account (the channel's `xSearch.exclude`; **Restore** undoes it). The MCP's `x_search_leads` reads the same list. +- An X search channel is never put on a site (refused on create, on Configure, and by every site writer); its posts + follow `social.x.visibility` like any X channel's. + ## Transcribe ```sh diff --git a/editor/CHANGELOG.md b/editor/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog ## [Unreleased] +- **Save an X search across accounts, and see who keeps saying it.** Paste an X search page's URL (as copied from X's search box) into the New channel form, or choose **X search** as the platform and type a query: it makes an X search channel whose records are the matching posts from any account. The query is X's own — OR, "quotes", -term, from:, to:, @name, url:, filter:, lang: — and its dates are the channel's **Since** and **Until** (a pasted URL's since:/until: are moved there; typed into the query they are refused with a sentence). Fetch posts searches backwards a window at a time (3 months, or your **Window**), newest first, at the older walk's pace and with its X login; a run cut short resumes where it stopped, later fetches search only the new days, and a new query starts afresh. The channel page's **Leads** lists the accounts by how many matching posts they made, with their first and last day and a sample: **Archive this account** creates `<handle>-x` on no site and starts its fetch, **Never archive** hides the account (Restore brings it back), and an account an X channel already archives says so. An X search channel is never put on a site. From a terminal: `pnpm ops create-channel` with the search URL, `pnpm ops fetch-posts`, `pnpm ops get channel <slug> --leads` and `pnpm ops x-search-lead`; the MCP has `x_search_leads`. Nothing calls a model. Needs a restart of the editor. - **Wayback Machine captures of pages are records of their own.** A capture of a page that is not a video — an old blog post, a group's site, a channel's About page, a document taken down — goes into a **Wayback pages** channel: on the New channel form, paste a Wayback URL of such a page (`web.archive.org/web/*/example.com/blog*` scopes every capture under that path, `*.example.com` a whole domain, one capture's URL that page) or choose **Wayback pages** as the platform, and edit its targets (a URL, how it matches, optional dates). The channel page's **Import a capture** takes a capture's URL, or the page's own URL and a date for the capture nearest it, and imports it as one job at archive.org's pace: the page as captured is kept, its readable text, title, author, date, links and images become a record — searchable, in the MCP and on a built site like any post — dated by the page's own date when it gives one. A later capture of the same page is kept as a version of the first. **Re-extract** reads every kept capture again with no request. A capture of a video is still Import video's, and is refused here with a sentence saying so. An x.com or twitter.com capture is private exactly as X posts are. From a terminal: `pnpm ops import-page` (`dryRun` says what it would fetch) and `pnpm ops reextract-pages`; `pnpm archilyzer wayback pages import|reextract` run without the editor. Needs a restart of the editor. - **Scan a Wayback pages channel, then choose what to import.** A channel whose config names `wayback.targets` (a page, a prefix, a host or a domain, with optional dates) has a **Captures** tab: **Scan now** lists what the Wayback Machine holds of them — one row per distinct version of each page, with when it was first and last seen — without fetching a single page, at archive.org's pace, at most 50,000 rows a run; **Continue scan** picks up where a run stopped, and a later scan marks what is **new**. Filter by year, path and text, then **Import selected** or **Import all in range** (asked to confirm above 50): one import job per capture, one at a time. Rows already imported are marked and skipped. The same over HTTP: `pnpm ops wayback-scan --json '{"slug":"<slug>"}'` and `pnpm ops wayback-import --json '{"slug":"<slug>","year":"2014"}'` (both take `dryRun`); offline, `pnpm archilyzer wayback scan <slug>`. With `wayback.auto: true` the download lane imports the captures later scans add, at the same pace; it is off unless a channel turns it on. - **Wayback captures of Tumblr, Twitter, forums, Google Docs and YouTube About pages are read as their posts.** A Tumblr blog's post, index, tagged or archive page becomes one record per post (its date, tags, images and what it reblogged), and the same post seen on an index and on its own page is one record. An old Twitter profile or status page becomes one record per tweet — replies, retweets and quotes pointing at the tweets they answer, and the profile's bio, website and counts as one more — and a capture of X's later JavaScript app says it holds no posts. A captured XenForo thread page gives the same posts, with the same ids, that a forum channel of the thread holds. A Google Doc's mobilebasic or published page gives the document's text with its headings; its edit page says it holds no text and names the mobilebasic address to look for. A YouTube channel's About page gives how the channel described itself at that capture: description, links, joined date and counts. Nothing calls a model. diff --git a/plans/FACTS.md b/plans/FACTS.md @@ -11186,3 +11186,64 @@ parsed to 0 cues, indexing the video textless) is CLOSED by `200a3105` (transcri brace-matched string-aware and `JSON.parse`d, or — when assigned as a JS string — unescaped (`\xNN`, `\uNNNN`) then parsed; renderers found by key anywhere (`channelAboutFullMetadataRenderer` | `aboutChannelViewModel`, `c4TabbedHeaderRenderer` | `pageHeaderViewModel`, `channelMetadataRenderer`). + +## Release 38 lane S: X search channels (verified 2026-10-20, branch `r38/x-search`) + +- **An X search channel is `config.xSearch` on an X posts channel** (`sourceKind: "social"`, `platform: "twitter"`, + `postFetcher: "x-gallery-dl"`, `url` = `xSearchUrl(query)` — `https://x.com/search?q=<query, percent-encoded + whole>&f=live`, rebuilt from the query by the form parser on every save; no `socialHandle`). + `{query, since?, until?, windowMonths?, lang?, exclude?}` — `common/lib/xSearch/config.ts`, a client-safe leaf; + `isXSearchChannel(config)` is the one test. The New channel form's platform choice `"x-search"` is NOT a platform: + `parseChannelForm` maps it (or an `x.com|twitter.com/search?q=` URL with the platform on Auto or X) to + `platform: "twitter"` + `xSearch`. Form fields: `xSearchQuery`, `xSearchSince`, `xSearchUntil`, + `xSearchWindowMonths`, `xSearchLang`, and the hidden `xSearchExclude` (JSON) so a Configure save keeps the + hidden authors. +- **The query is refused, never repaired, when it carries `since:`, `until:`, `max_id:`, `since_id:`, + `until_id:`, `since_time:` or `until_time:`** (outside a quoted phrase, any case, `-` or `(` prefixed), is empty, + two lines, over 500 characters, or leaves a quote open (`xSearchQueryProblem`). A pasted URL's single + `since:<day>`/`until:<day>` are LIFTED into the channel's dates (`xSearchFromUrl`); a typed query's are refused. + Every other operator passes through as typed. `lang` adds `lang:<code>` unless the query names a `lang:` itself. +- **The walk is the older walk's machinery with a different query.** `xGalleryDlFetcher.ts`: `fetchOlderViaSearch` + and the new `fetchSearchViaWindows` (`SocialFetcher.fetchSearch`) both run `walkSearchWindows` — the same + `GalleryDlStream`, 45–120 s between windows, `sleep-request=4.0-10.0`, `ratelimit=wait` (a 429 is waited out by + gallery-dl in-process, as for the older walk), the 3-hour `BACKFILL_BUDGET_MS`, mid-window checkpoints with the + oldest id read as `max_id:`, and the same login (`galleryDlLoginFor`; a guest run refused before spawning, + `needsCookies`). `buildGalleryDlQueryArgs({query})` is the argv for any window query; `buildGalleryDlSearchArgs` + (from:<handle>) now calls it. A search window's query is `xSearchWindowQuery`: `<query> [lang:<l>] + since:<d> until:<d> [max_id:<id>]` — no `from:`, no `include:nativeretweets`. With a `floor` (the channel's + `since`) every window down to it is searched (`maxEmptyWindows: Infinity`); with none the walk ends after + `OLDER_MAX_EMPTY_WINDOWS` (4) empty windows in a row — never the 2-window "nothing archived" shortcut. +- **State: `posts-state.json` `search`** (`XSearchWalkState`, `lib/posts-server.ts`): `{queryKey, walk?: {top, + floor?, since, until, emptyWindows, maxId?}, coveredSince?, coveredUntil?, completeReason?, completedAt?, + lastRunAt?, lastWritten?, lastError?}`. `queryKey` = query + lang (`xSearchQueryKey`); a different key starts + afresh (posts kept, deduped). Each fetch walks ONE stretch (`lib/xSearch/walk.ts` `planXSearchWalk`): a walk in + progress first; else the first walk from `until` (or tomorrow, UTC) down to `since`; else the new days, from + `until`/tomorrow down to `coveredUntil − 1 day` (a day of overlap); else the earlier days when `since` < + `coveredSince`; else nothing ("already searched …"). `full` forgets the state ("Search again from the top"). + `older` is refused (`X_SEARCH_OLDER_REFUSAL`) in the action and the controller. The fetch stamps `lastSyncedAt` + (it is the channel's sync; the scheduler paces it as any posts channel). Controller: + `common/controller/fetchXSearch.ts`, called from `fetchPosts` before the handle is resolved. +- **Cross-channel dedupe is per channel — as for every posts channel.** `writePosts` dedupes by id against the + channel's own `posts-archive`; the LMDB `posts` sub-DB is keyed `[createdAt, channelSlug, id]`. The same status id + in an account channel and a search channel is two records, one per channel; nothing writes into another + channel's archive. The leads view instead marks an account an X channel archives (`archivedAs`). +- **Leads** (`lib/xSearch/leads.ts` `rankXSearchLeads`, pure; `controller/xSearchLeads.ts` reads): one row per + lower-cased author — count (reposts among them), first/last `createdAt`, a sample (the account's own newest post, + else its newest repost, 280 chars), `archivedAs` (X account channels — not search channels — whose + `socialHandle` / URL handle matches). Ranked count desc, last desc, handle asc; `exclude` handles go to `hidden` + (an excluded handle with no posts is listed with count 0); default limit 100, `more` = the rest. + **Archive this account** = `planArchiveXLead` (refuses an archived account and a taken slug) → the New channel + form's fields (`<Name|handle> (X)`, `https://x.com/<handle>`, twitter, social, x-gallery-dl, socialHandle) → + `createChannelFromForm` with slug `<handle lower-case>-x` (`x<handle>-x` when the handle starts with `_`), no + sites, `fetchPostsNow`. **Never archive / Restore** = `setXSearchLeadHidden`, through `patchChannelConfig`'s new + `derive` option (a patch computed from the config re-read inside the lock). +- **Never on a site, at three doors:** `createChannelFromForm` and `updateChannelAction` refuse a search channel + with site memberships before anything is written; `writeSite` (`lib/site.ts`, every site writer — the site form, + `patchSite`/site-config, memberships, rename) refuses a site whose `channels` or `citedChannels` name one + (`xSearchChannelOnSite`, one config read per member; `X_SEARCH_NOT_ON_A_SITE`). `social.x.visibility` applies + unchanged (`isXPostsChannel` — platform twitter). +- **Ops / CLI / MCP:** `GET /api/ops/channel/<slug>?leads=1[&limit=N]` adds `leads` (`pnpm ops get channel <slug> + --leads [--limit N]`; `--limit` without `--leads` is refused); `POST /api/ops/x-search-lead {slug, handle, + action: "archive"|"never"|"restore", name?, fetch?, dryRun?}`; MCP `x_search_leads {channel, limit?}` + (`mcp/src/xSearchLeads.ts`, read only, through the editor). The e2e fake gallery-dl answers a `/search` URL with + four posts by three accounts dated 2026-05/06, bounded by the query's since/until/max_id.