Archilyzer · Source

archilyzer

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

commit 5f6da8bbf166617253b9ff4fec3b1bc59bf4c1c6
parent 79471fb4e705aa6648924f02c368bd032b4d613e
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Wed, 21 Oct 2026 18:07:06 -0400

docs: cookie refresh alerts — OPERATING recipe, FACTS, CHANGELOG, COMMANDS.md regenerated; doctor test

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

Diffstat:
MCOMMANDS.md | 8++++++++
MOPERATING.md | 22++++++++++++++++++++++
Mcommon/bin/doctor.test.ts | 50++++++++++++++++++++++++++++++++++++++++++++++++++
Meditor/CHANGELOG.md | 1+
Mplans/FACTS.md | 53+++++++++++++++++++++++++++++++++++++++++++++++++++++
Mscripts/archilyzer-ops.mjs | 3++-
6 files changed, 136 insertions(+), 1 deletion(-)

diff --git a/COMMANDS.md b/COMMANDS.md @@ -149,6 +149,9 @@ Drives a running editor over HTTP (`/api/ops/*`, the same actions its pages run) | `tts` | tts speaks a line with a local text-to-speech engine and a STOCK voice, as a job on the `tts` queue: {"text": "..."} or {"file": "/abs/script.txt"} (UTF-8, at most 20,000 characters), "engine" (kokoro \| orpheus \| espeak-ng), "voice" (one of the engine's stock voices; kokoro: af\_heart, bm\_george, ...; orpheus: leah, zac, ...), "speed" (0.5-2; orpheus has none) — defaults from settings.tts (kokoro, af\_heart, 1) — and "out" (an absolute .wav path the result is copied to, never inside the corpus). The expressive tags &lt;laugh&gt; &lt;chuckle&gt; &lt;sigh&gt; &lt;cough&gt; &lt;sniffle&gt; &lt;groan&gt; &lt;yawn&gt; &lt;gasp&gt; are performed by orpheus and stripped for the others; any other &lt;...&gt; is refused. Numbers, years, money and times are spoken (2024: "twenty twenty-four"). The result is {wav, seconds, engine, voice, cached, durationMs, waitedMs, sha, sampleRate, speed, disclosure}: wav is the 48 kHz mono WAV the editor wrote (out, or its cache), disclosure the line a narrated export carries. The same ask again is answered from the cache (cached: true, no engine run). Kokoro and orpheus need `archilyzer tts setup [--engine orpheus]` first; orpheus runs on the GPU (a local llama-server the editor starts and stops) and waits while a transcription holds it. With --wait the result is printed on stdout. | `pnpm ops tts --json '{"text":"In 2024 the archive spoke."}' --wait`<br>`pnpm ops tts --json '{"file":"/abs/script.txt","voice":"bm_george","out":"/abs/line.wav"}' --wait` | | `settings` | settings patches settings.json through the editor's one writer: {"patch": {"&lt;top-level key&gt;": value, …}} (SETTINGS.md). A block's keys merge one level; an array, a scalar or an object nested in a block replaces. Refused before anything is written: an unknown key; a key another writer owns (channelPriority, autoQueue, workers, storage — the refusal names it); a value the schema would not keep as sent (clamped, dropped), named with what would be saved. Answers the saved values. | `pnpm ops settings --json '{"patch":{"minFreeDiskGB":20}}'` | | `clear-platform-hold` | clear-platform-hold clears a platform's rate-limit hold, backoff and raised pace, as the lane strip's Clear hold: {"platform"}. Answers the sentence. | | +| `recheck-service` | recheck-service asks a service whose cookie refresh alert is up ONE request through its own path, as the dashboard banner's Recheck: {"service"} ("rumble", "youtube", "odysee", "archive.today" or a forum host). Waits for it: {jobId, result: "clean" \| "stale" \| "failed", message}; "clean" clears the alert (and a yt-dlp service's backoff, as any clean request). dismiss-service clears a service's cookie alert by hand: {"service"}. rerun-service-jobs retries every job a service's cookie alert stopped, once it is OK again: {"service"} -&gt; {jobIds, skipped}. --wait follows them. | `pnpm ops recheck-service --json '{"service":"rumble"}'` | +| `dismiss-service` | — | | +| `rerun-service-jobs` | — | | | `workers` | workers switches transcription workers as /workers does: {"op": "enable" \| "disable" \| "drain", "ids": \[...\]} — the live pool; a restart restores the launch default. An unknown id is named; the others still apply. | `pnpm ops workers --json '{"op":"disable","ids":["parakeet-cpu"]}'` | | `transcribe-one` | transcribe-one transcribes one video: {"slug", "id", "file"?}. With "file" (an audio file in its dir) that file; without, the video page's Transcribe — the audio on disk, or downloaded first through the channel's managed path. A job; --wait follows it. "salvage": true decodes a damaged file with error tolerance and transcribes what decodes, on the recording's clock, its gaps recorded (the transcript is listed as salvaged); a corrupt-full-source video is salvaged unless "salvage": false — once its full audio was tried: when its record stores an Odysee media URL, that URL is downloaded first, up to 2 times (20 min apart), and the salvage follows only if neither download is clean. "storedUrl": "only" \| "fallback" \| "never" downloads missing audio from the media URL the record stores (Odysee's CDN), read in ranges as its player reads it — no page request with "only", the page first with "fallback" — through the audio check; one new file per platform per 20 min. Absent = the channel's storedUrlDownloads. "whilePaused": true runs this one transcription during a pause-all on a worker the pause alone switched off; the pause stays on (the video page's "Transcribe now (workers paused)"). | | | `delete-file` | delete-file deletes one file of one video, as its Files list does: {"slug", "id", "file"}. A tiered media file goes with its bytes on the media drive (never a bare link); refused while that drive is not answering. No undo. | | @@ -197,6 +200,7 @@ Usage: pnpm ops <action> [--json '<body>' | --file <path>] [--wait] pnpm ops job wait <id>... [--wait-timeout <seconds>] pnpm ops get settings [<key>] pnpm ops get storage | sites | workers | auto-queue | scheduler + pnpm ops get services pnpm ops get cleanup <slug> pnpm ops get remote-listing <slug> [--wait-timeout <seconds>] pnpm ops get transcript <videoId> [--slug <slug>] @@ -235,6 +239,10 @@ get sites lists every site: id, title, siteUrl, Pages project, audience, is the status.) get workers, get auto-queue and get scheduler are /workers, the four lanes of /operations, and /operations/sync — the payloads those pages poll. +get services is the dashboard's cookie refresh alerts: each service + (rumble, youtube, odysee, archive.today, a forum host) whose cookies look + stale, or are OK again with the jobs the alert stopped; "pending" lists + a first Rumble embed 403 waiting for a second video. get cleanup <slug> is one channel's /cleanup row: what each sweep would reclaim (they overlap — never add them), what holds the rest, and the failed-transcriptions count. measured: false means unknown, not zero. diff --git a/OPERATING.md b/OPERATING.md @@ -55,6 +55,28 @@ pnpm ops persist-videos --json '{"items":[{"slug":"example","id":"<videoId>"}] - Bucket names and sizes: `pnpm ops get channel example`. - Keep videos out of cleanup by title or description: `pnpm ops keep-videos --json '{"slug":"example","match":"interview","dryRun":true}'`. +### Cookies gone stale: the dashboard's banner + +```sh +pnpm ops get services # what is stale, since when, which jobs it stopped +pnpm ops recheck-service --json '{"service":"rumble"}' # one request through the service's own path +pnpm ops rerun-service-jobs --json '{"service":"rumble"}' --wait +pnpm ops dismiss-service --json '{"service":"rumble"}' +``` + +- A banner at the top of the dashboard says which service's cookies look stale and what to do. Do it, + then press **Recheck**; when the service answers, the banner turns to "OK again" and offers **Re-run + stopped jobs**. The next clean request clears it without you too. +- What raises it: Rumble refusing its embed JSON with a 403 on **two different videos in a row** (one is + not enough — a removed video answers 403 too) → open rumble.com in the browser `cookiesFromBrowser` + names. YouTube's bot check → open youtube.com there, signed in. Odysee's Cloudflare page (a 403 with + Cloudflare's challenge words; no real sample yet) → open odysee.com. A forum's browser check, captcha or + login wall, by host → Connect forum session on the thread's channel page. archive.today's check page → + Connect archive session (Settings). A Connect that ends on a cleared page clears the banner too. +- The job it stopped says so in its log: `stopped: Rumble cookies look stale — open rumble.com in …, then + Recheck on the dashboard.` `archilyzer doctor` lists it under "service cookies". +- The state is `transcripts/.service-cookies.json` (`common/lib/serviceCookies.ts`); never hand-edit it. + ## Import from archive.org, Odysee, BitChute and the Wayback Machine ```sh diff --git a/common/bin/doctor.test.ts b/common/bin/doctor.test.ts @@ -632,6 +632,56 @@ test("download pacing: a held platform and a raised pace warn, and nothing is wr assert.deepEqual(tree(c.root), before); }); +test("service cookies: a stale service warns with its fix, a pending first 403 is a note, and nothing is written", async () => { + const c = checkout(); + mkdirSync(c.paths.transcriptsDir, { recursive: true }); + const now = Date.UTC(2026, 9, 21, 17, 10); + writeFileSync( + path.join(c.paths.transcriptsDir, ".service-cookies.json"), + JSON.stringify({ + version: 1, + services: { + rumble: { + kind: "embed-403", + since: "2026-10-21T17:02:00.000Z", + lastSeen: "2026-10-21T17:04:00.000Z", + count: 2, + videos: ["v7d7myw", "v7d2lxe"], + raisedAt: "2026-10-21T17:04:00.000Z", + evidence: { line: "ERROR: [RumbleEmbed] v7d2lxe: Unable to download JSON metadata: HTTP Error 403: Forbidden" }, + jobs: [], + }, + youtube: { + kind: "bot-check", + since: "2026-10-21T17:05:00.000Z", + lastSeen: "2026-10-21T17:05:00.000Z", + count: 1, + videos: [], + raisedAt: "2026-10-21T17:05:00.000Z", + clearedAt: "2026-10-21T17:08:00.000Z", + clearedBy: "recheck", + evidence: { line: "x" }, + jobs: [], + }, + }, + lastGood: {}, + }), + ); + const before = tree(c.root); + const r = await run(c, {}, { now: new Date(now) }); + const sc = r.checks.filter((x) => x.section === "service cookies"); + assert.deepEqual( + sc.map((x) => [x.id, x.status]), + [ + ["rumble", "warn"], + ["youtube", "info"], + ], + ); + assert.match(sc[0].detail, /^cookies look stale — 2 embed 403s on different videos since 17:02 UTC\. Fix: open rumble\.com in /); + assert.match(sc[1].detail, /^YouTube cookies OK again \(cleared .*, recheck\)$/); + assert.deepEqual(tree(c.root), before); +}); + // ── release 18: the downloader and publish checks ───────────────────────── const find = (r: DoctorReport, section: string, id: string) => diff --git a/editor/CHANGELOG.md b/editor/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog ## [Unreleased] +- **The dashboard says when a service's cookies have gone stale, and what to do.** When Rumble refuses its embeds with a 403 on two different videos in a row (one is not enough — a removed video answers 403 too), when YouTube asks to confirm you're not a bot, when Odysee answers with Cloudflare's check, when a forum's browser check or login wall stops a thread, or when archive.today answers with its check page, a banner at the top of the dashboard says so — "Rumble needs fresh cookies: open rumble.com in firefox" — with the jobs it happened in. **Recheck** asks the service once, through the same path and cookies the jobs use, and clears the banner when it answers; the next clean request clears it by itself too, and **Dismiss** clears it by hand. Once it is clear the banner says "OK again" and offers **Re-run stopped jobs**, which retries the jobs it stopped. The stopped job's log ends with the cause and the fix, `archilyzer doctor` lists it under "service cookies", and a Connect forum session or Connect archive session that ends on a cleared page clears the matching banner. From a terminal: `pnpm ops get services`, `recheck-service`, `rerun-service-jobs` and `dismiss-service`. Odysee's check is recognised by Cloudflare's own words beside a 403; no real Odysee sample has been seen yet. Needs a restart of the editor. - **archive.today copies are page records too, like Wayback captures.** The channel kind is now **Archived pages** on the New channel form (paste an archive.today copy's URL, `archive.ph/newest/<page>`, and the channel's target is that page on archive.today), and each target says where its copies are looked for: the Wayback Machine, archive.today, or both. The channel page's **Import a capture** takes an archive.today copy's URL (`archive.ph/<id>`, or any of its other names), or the page's own URL, a date and **on archive.today** for the copy nearest that date; the copy is kept as archive.today served it and read without its header bar, links back to the pages they pointed at, so a tweet, a Tumblr post or an article gives the same records it would from the Wayback Machine — each saying it came from archive.today and linking that copy, its images archive.today's own copies. archive.today is asked one request at a time, eight seconds apart; when it says "too many requests" the import stops with a sentence and nothing more is asked of it for half an hour. When it answers with a CAPTCHA instead of the copy, the import is refused and never reads the CAPTCHA as a page: **Connect archive session** (on the channel page, and in Settings → Archive sources) opens a window on the editor's machine to pass the check once, and the next import reads through it; nothing is ever solved for you. **Look up a page** lists every copy each archive holds of a page, with an Import button on each. From a terminal: `pnpm ops import-page` takes `"source": "archive.today"`, `pnpm ops archive-lookup` lists the copies, and `pnpm archilyzer archive lookup <url>` runs without the editor. Needs a restart of the editor. - **A page the Wayback Machine will not show says so.** When the Wayback Machine answers "forbidden" for one page while it answers others, that page is excluded from it, and Wayback lookups, page imports and archive lookups now say "excluded from the Wayback Machine (cause unknown)" instead of reporting an error. - **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. diff --git a/plans/FACTS.md b/plans/FACTS.md @@ -11483,3 +11483,56 @@ parsed to 0 cues, indexing the video textless) is CLOSED by `200a3105` (transcri `pageRecords`. Editor route `GET /api/channels/<slug>/posts-media/<id>/<name>` serves a capture's images. - **The fake:** `PAGE_SPLIT_URL`/`PAGE_SPLIT_TS` (a Tumblr-themed index, two fixed-width posts, one image) served by default, and `/web/<ts>im_/<image url>` → a 2×2 PNG (`IMAGE_PNG`). + +## Cookie refresh alerts: one state per service (verified 2026-10-21, branch `lane/cookie-alerts`) + +- **The name is `serviceCookies`** / "cookie refresh alert": "hold", "cooldown", `needsCookies` and a bare "session" + were all taken. A per-channel `needsCookies` (posts-state.json, the needsCookies bucket) is unchanged and unrelated. +- **The state** is `<transcriptsDir>/.service-cookies.json` (`common/lib/serviceCookies-server.ts` + `serviceCookiesFile`; NOT a `Paths` field — tests that build `Paths` by hand are untouched): `{version: 1, + services: {<key>: {service, kind: embed-403|bot-check|challenge|check-page, since, lastSeen, count, evidence: + {jobId?, channel?, videoId?, url?, line}, videos[], raisedAt?, jobs: [{id, kind?}], clearedAt?, clearedBy?: + clean|recheck|dismiss|connect, rerunAt?, rerunJobIds?}}, lastGood: {<key>: {url, channel?, at}}}`. Keys: + `rumble`, `youtube`, `odysee`, `archive.today`, or a forum's host (`forumServiceKey`: lowercased, no www.). + `coerceServiceCookieState` drops what it cannot read; every write is `withJsonFileLock` + `writeJsonAtomic` + (`mutate`), and every recorder swallows its own errors — no job fails on the bookkeeping. +- **The rules** (pure, `common/lib/serviceCookies.ts`): an entry is PENDING until `raisedAt`. `embed-403` needs 2 + DISTINCT `videos` (a removed Rumble video 403s too; prefetch + download of one video is one); every other kind 1. + A pending entry is dropped by any clean request to the service and forgotten after 1 h + (`PENDING_SIGNAL_TTL_MS`). A raised one is CLEARED by a clean request, kept 24 h (`CLEARED_KEEP_MS`) for "OK + again — re-run the N jobs it stopped"; with no job left to re-run, the view shows it only 15 min + (`OK_AGAIN_SHOW_MS`). A signal after the clearing starts a fresh entry. `lastGood` refreshes at most every 10 min. +- **The signals** (`serviceCookieSignalFromStderr`): `[RumbleEmbed] <id>: Unable to download … HTTP Error 403` + (the embed id is the video); `isBotCheck` → youtube; Odysee = a 403 on an `[lbry|odysee]` line (or an odysee URL) + AND Cloudflare's words (`just a moment|cloudflare|cf-mitigated|cf-chl|anti-bot challenge`) — NO REAL SAMPLE yet. + `classifyDownloadFailure` is unchanged (the embed 403 is still `network`). Real samples: + `common/lib/__fixtures__/rumble-{embed-403.download,fetch-windows-stopped}.log` (paths scrubbed). +- **Where they are recorded:** `runOneYtdlp` takes `observe: {paths, url, channel?}` and, after the child exits, + calls `observeYtdlpServiceOutcome` (exit 0 on a yt-dlp service = clean; else the signal). Passed by + `downloadOneManaged`'s wrapper, `fetchWindowManaged`'s yt-dlp run (NOT its ffmpeg stored-URL cut, which goes + through the same runner), `fetchCopyManaged`, `refreshVideoMetadata`, `fetchLiveChat`. Without `observe` nothing + is observed. Batch stops call `observeStderrServiceSignal`: `metadataScan` (a block that survived its cookie + retry; a clean scan clears), `checkAvailability` (blocked), `runYtdlp`'s enumeration (any non-zero exit). Forum: + `fetchPosts.fetchTimeline` → `noteForumServiceOutcome` (challenge/captcha/login = signal; no block and no error = + clean). archive.today: `ArchiveTodayClientDeps.observe` (the process client in `lib/archives/index.ts` → + `noteArchiveTodayOutcome`): a check that stood (`challenged`) = signal, a timemap/copy/404 (`answered`) = clean. + Connect forum/archive session with `record.cleared` → clean, `by: "connect"`. +- **The job context:** `common/lib/jobContext.ts` — an `AsyncLocalStorage` on globalThis; `runManagedFunction` + runs `fn` inside `runInJobContext({jobId, kind, channelSlug?, onLog, staleServices})`. The recorder adds the job to + the entry's `jobs` and, once the alert is up, writes `serviceStoppedLine` into that job's log once per service + (`stopped: Rumble cookies look stale — open rumble.com in <browser>…, then Recheck on the dashboard.`); a job that + then FAILS repeats it after its `[error]` line. "Stopped jobs" = the entry's jobs whose status (registry, else + `.meta.json`) is failed or cancelled. +- **Recheck** (`common/controller/recheckServiceCookies.ts`, job kind `recheck-service-cookies` on queue + `service-cookies:<service>`): yt-dlp services → `recheckYtdlpArgs` (`--skip-download --print id`, the channel's + `channelExtraArgs` with `authRetryCookies`, the window fetch's refusals after them) for `lastGood`, else the + evidence URL, cwd the channel dir; clean also calls `recordPlatformClean` (the 403 streak's network backoff would + otherwise refuse the re-run). Forum → one page through `browserForumLoader` + `classifyForumPage`. archive.today → + the evidence request again through `archiveTodayClient` (timemap → `listCaptures`, else `getCapture`). +- **Surfaces:** view `cookieAlerts` (`VIEW_NAMES`; `editor/app/lib/cookieAlerts.ts` `loadCookieAlerts`; the first + view with no old-path rewrite — `route.test.ts` `NEW_VIEWS`), SSR-seeded and polled SLOW by `DashboardCockpit` + above `FirstRunPanel` (`CookieAlertsPanel`, `role="alert"` named "<Label> cookies", `data-state`). Actions: + `editor/app/operations/serviceCookiesActions.ts`. Ops: `GET /api/ops/services` (`pnpm ops get services`), POST + `recheck-service`, `dismiss-service`, `rerun-service-jobs` (`{service}`). Doctor section "service cookies". The + e2e fake answers `embed403` URLs with the RumbleEmbed 403 until `fake-ytdlp.fresh-cookies` is in its cwd, and + `--skip-download --print id` is its recheck branch (`e2e/cookie-alerts.spec.ts`). diff --git a/scripts/archilyzer-ops.mjs b/scripts/archilyzer-ops.mjs @@ -912,7 +912,8 @@ export function usage() { " pnpm ops job retry-failed [--wait]", " pnpm ops job wait <id>... [--wait-timeout <seconds>]", " pnpm ops get settings [<key>]", - " pnpm ops get storage | sites | workers | auto-queue | scheduler | services", + " pnpm ops get storage | sites | workers | auto-queue | scheduler", + " pnpm ops get services", " pnpm ops get cleanup <slug>", " pnpm ops get remote-listing <slug> [--wait-timeout <seconds>]", " pnpm ops get transcript <videoId> [--slug <slug>]",