Archilyzer · Source

archilyzer

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

commit 65e7de6f692f089f024bb46b133495fa3fdaa848
parent a87db3e4cf99646cc9aa146afe49c93fe95c6f50
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Fri, 16 Oct 2026 02:50:20 -0400

plans: release 31 lane D, as shipped — the mirror config, matcher, scan, Mirror stage and MCP copies; FACTS, CHANGELOG

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

Diffstat:
Meditor/CHANGELOG.md | 1+
Mplans/FACTS.md | 44++++++++++++++++++++++++++++++++++++++++++++
Aplans/release-31/mirrors.md | 94+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 139 insertions(+), 0 deletions(-)

diff --git a/editor/CHANGELOG.md b/editor/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog ## [Unreleased] +- **A channel that copies another creator's streams can be paired with the creator, both ways.** Name the creator's channels on the mirror's Configure form ("Mirror of (channel slugs)", or `pnpm ops channel-config --json '{"slug":"<mirror>","patch":{"mirrorOf":"<creator>, <creator-rumble>"}}'`). The channel page then has a **Mirror** stage: **Scan** (or `pnpm ops mirror-scan --json '{"slug":"<mirror>"}'`, `"dryRun": true` to count without writing) matches each of the mirror's videos, by the day it was recorded (the title's date when the channel has a recorded-date pattern) and its title and length, with the creator's videos uploaded a day before to two days after. Each video is then the **only copy** (no creator channel has it public), **creator deleted** (removed on one platform, public on another), **never uploaded** (missing from one platform) or **creator public**, with a filter for each and links to the creator's copies; and the other way, the creator's deleted or private videos in the mirror's span and how many of them the mirror holds. The result stays on this machine (`transcripts/mirrors/<slug>.json`) and is never published. With the MCP on a local archive, `get_video_metadata` says what copies a video has, and `enumerate_matches` takes `"copies": "only-here"` for the videos that survive only on a mirror; a published site says this is not available. - **find-copy can bring a deleted or private video's whole audio home, so it gets transcribed.** `pnpm ops find-copy --json '{"siteId":"<site>","gone":"no-transcript","dryRun":true}'` (or `{"slug":"<channel>", …}`) lists every gone video of the site's channels (or of one channel) that has no audio and no transcript, and the copy each would use: the Wayback Machine when it holds the video, else an archive.org mirror of the upload. `"gone":"all"` takes the transcribed ones too, after the others. Without `dryRun` it looks up at most `max` videos (10 by default, at most 200) and starts one **Fetch copies** job on archive.org's download queue, which fetches each copy's audio into the video's own record as `audio.<format>`, one at a time with a pause between them; the transcription lane then picks it up like any downloaded audio. The video's title, date and page stay the original's. Its page says **Audio from a copy:** and links the Wayback capture (with its date) or the archive.org item, where the Wayback or archive.org line used to be. A video neither archive holds is noted in its `copy-attempts.json` and left out of the next 30 days of runs, as is one whose copy failed at its source; `"retryFailed": true` asks again. Needs a restart of the editor. - **A frame scan's timeline reads like the stream.** One tournament stays one tournament until the streamer busts: a hand description, a player's name or a misread of the title no longer starts a new one, and the tournament is named by the title most frames agree on. A stack read mid-hand (chips in the pot) or misread no longer makes a double-up or a big loss; players left come only from the client's own "position N of M" or the log's finishing places, so a table's seats are not the field and no final table appears from them; the big blind is the log's "Blinds are now", so a stack is never 700 big blinds by a misread; "won" banners on other players' hands are gone. A frame and a spoken number that disagree are flagged, and a flagged reading makes no event. **Re-derive** an existing scan with no model call: `pnpm ops frame-scan --json '{"slug":"<channel>","id":"<video>","rederive":true}'`, or `archilyzer frames rederive <channel>/<video> --dry` to see what would change. Needs a restart of the editor. - **Retrying a corrupt full source downloads it again.** A video whose download completed with malformed audio (Odysee's intermittent AAC, on a channel with the audio check) kept its file, and that file made every retry say "Nothing to fetch". A retry of the **corrupt full sources** bucket — the new card on the channel's Download stage, or `pnpm ops retry-bucket --json '{"slug": "<channel>", "bucket": "corruptFullSource"}'` — now sets the kept file aside and downloads again: a clean result replaces it; a malformed one keeps whichever copy decodes longer; a download that fails (a 429, the network) puts the kept file back and the video stays in the bucket, with the attempt recorded. Each retry is recorded in the video's `download-outcome.json`. Needs a restart of the editor. diff --git a/plans/FACTS.md b/plans/FACTS.md @@ -9751,3 +9751,47 @@ parsed to 0 cues, indexing the video textless) is CLOSED by `200a3105` (transcri - **The video page** reads `latestFetchedCopy(copy-attempts.json)`: "Audio from a copy: Wayback Machine, <date>" / "… archive.org <identifier>", linking the copy, in place of (and under the label of) the source's own provenance line ("Wayback provenance" / "archive.org provenance"). + +## Release 31 lane D: a mirror channel and the creator it copies (verified 2026-10-16, branch `r31/mirrors`) + +- **Config `mirror: {of: string[]}`** (`lib/mirrors/config.ts` `coerceMirrorConfig`): the creator's channel slugs, + trimmed, de-duplicated, invalid ones dropped, an empty list drops the key. Written by the Configure form's + `mirrorOf` field (commas or spaces; a value that is not a slug is refused) and so by `ops channel-config` + `{"patch": {"mirrorOf": "a, b"}}`. CHANNEL.md documents it (nested table `mirror`). +- **The matcher** (`lib/mirrors/match.ts`, pure): a mirror video is dated by `contentDate` (recordedDate, else + uploadDate); a creator video is a candidate when its date is `MIRROR_DAYS_BEFORE` (1) before to `MIRROR_DAYS_AFTER` + (2) after; it matches by `title` (word Jaccard ≥ 0.25), `title-duration` (≥ 0.12 and durations within 25 % of the + mirror's) or `live-duration` (durations agree, creator `wasLive` and > 3000 s). Words: lowercase `[a-z0-9']+`, one + letter and `MIRROR_STOP_WORDS` dropped; the mirror's side is its TOPIC (`mirrorTopic`: the title after the date its + recorded-date rule reads, else before it, else whole). STRONG = score (Jaccard to 2 dp) ≥ 0.5, or ≥ 0.25 with + durations — only strong matches decide anything. `presence` per creator PLATFORM (public | gone | none) → status: + `only-copy` (no platform public) > `creator-deleted` (one gone, another public) > `never-uploaded` (one none, rest + public) > `creator-public`. The other way: creator videos that are gone with a date in the mirror's window (first to + last dated mirror video), `heldBy` = mirror videos that strongly match them. The thresholds are the research + scripts' (`~/reports/quartering-cornbreadman/match.py`, `status.py`); wasLive is the record's `isLivestream`. +- **The scan** (`controller/mirrorScan.ts`; job kind `mirror-scan`, needsText, queue `mirror-scan`; `pnpm ops + mirror-scan {slug, dryRun?}`; the editor's `mirrorScanAction`): records from the index — `mtimes` range `[slug]` + gives each data dir's `indexKey`, `sums` its summary — and a dir the index has not seen off disk (`summarize`); a + missing recordedDate is derived from the channel's rule (so a scan is right before the index rebuild); gone = + `sourceGoneState` on the creator's dirs dated within the window ± the day margins only. Refused before any job + without `mirror.of` (or when none of its channels exists); a missing creator slug is skipped and listed in + `missing`. The log ends `@@mirror-scan {slug, dryRun, file?, of, missing?, window, videos, matched, byStatus, + byPlatform, creatorRemoved}`. +- **`transcripts/mirrors/<slug>.json`** (`lib/mirrors/scanFile.ts`, `scanFile-server.ts`): `{format: + "archilyzer-mirror-scan", version: 1, mirror, of, missing?, generatedAt, jobId?, rules, window, platforms + (creator slug → platform), totals: {videos, dated, matched, byStatus, byPlatform: {<platform>: {public, gone, + none}}, creatorRemoved: {inWindow, held, byChannel}}, videos: [{id, dir?, title, date, recordedDate?, duration, + status, presence, matches: [{channel, id, dir?, title, date, duration, wasLive, rule, score, durationAgrees, strong, + gone?}]}], removed: [{channel, id, dir?, title, date, duration, gone, heldBy}]}`, written atomically. `dir` is set + only when the data dir is not the record id (Rumble). PRIVATE: nothing in `export/`, `common/publish/` or the index + build reads `transcripts/mirrors/`. +- **The editor**: stage `mirror` (StageId; `computeStageStatuses` `mirrorScan` input; `mirror-scan` → `mirror` in + JOB_KIND_TO_STAGE), listed only for a channel with `mirror` (`?stage=mirror`). `MirrorStage`: the status line, Scan + / Scan again (`Mirror scan output`), totals (`mirror totals`, `mirror creator removed`, `mirror presence by + platform`), the status filter (`mirror status filter`, chips "Only copy N" …), rows `mirror video <id>` with + `data-status`, the removed list in a `<details>`. +- **The MCP** (`mcp/src/mirrorCopies.ts`): only a `LocalSource` reads the scans (`getPaths().transcriptsDir`, i.e. + TRANSCRIPTS_DIR or the checkout's `transcripts/`); a remote or hub source answers `COPIES_NOT_AVAILABLE`. + `get_video_metadata` adds a `- copies:` line (`copiesIndex`: a mirror video's status and the creator's strong + matches; a creator video held by a mirror, and whether it is gone); `enumerate_matches` `copies: "only-here"` + restricts the scan to the only-copy mirror videos by id (to the mirror channels unless the call scopes itself). diff --git a/plans/release-31/mirrors.md b/plans/release-31/mirrors.md @@ -0,0 +1,94 @@ +# Release 31, lane D — a mirror channel and the creator it copies (as shipped) + +Branch `r31/mirrors` from `main` `3ef1b558` (`main` `c9ec3bc8`, lane C, merged in before the final gates). Brief: +`r31d-brief.md` (the plan of record for this lane). FACTS: "Release 31 lane D: a mirror channel and the creator it +copies". + +## What and why + +A channel that MIRRORS another creator's streams (a VOD archive on another platform) was invisible as one: the +duplicate finder clusters only short videos, so a 1–5 h stream never folds with its original, and nothing said which +of the mirror's videos survive nowhere else, or which of the creator's removed videos the mirror still holds. The +research that answered it once did so by hand, in two scripts whose counts did not reconcile. This lane makes it one +source, both directions. + +- **Config `mirror: {of}`** (`lib/mirrors/config.ts`): the creator's channel slugs (every platform). Declared in the + channel schema (drop-invalid like its siblings; CHANNEL.md regenerated), written by the Configure form's + "Mirror of (channel slugs)" field and so by `ops channel-config` `{"patch": {"mirrorOf": "a, b"}}` (the route's + allowlist is the form's value list; `mirrorOf` added). +- **The matcher** (`lib/mirrors/match.ts`, pure, every threshold a named constant): the research's rules + (`match.py`) for a match and its strong cut (`status.py`), over records dated by recorded date else upload date, + with the mirror's title reduced to its topic (after the date the recorded-date rule reads). Per mirror video: every + match (rule, score, strong, gone), `presence` per creator platform, and the status `only-copy` | `creator-deleted` + | `never-uploaded` | `creator-public` (defined in the module doc and FACTS). The other way: the creator's gone + uploads inside the mirror's window and the mirror videos that hold them — from the SAME strong matches, so the two + directions reconcile by construction. +- **The scan** (`controller/mirrorScan.ts`, job kind `mirror-scan` (needsText) on its own queue, `pnpm ops mirror-scan + {slug, dryRun?}`): records from the index (`mtimes` → `sums`; a dir the index has not seen off disk), recorded + dates from the index or the channel's rule, the gone state through THE gone reading (`sourceGoneState`) only + where it can matter; `transcripts/mirrors/<slug>.json` written atomically (`archilyzer-mirror-scan` v1); a dry + run writes nothing; refused before any job without `mirror.of`. +- **The editor**: a **Mirror** stage on a channel with `mirror` only — the totals both ways, a filter per status, + each row linking the mirror video and the creator's copies (removed ones marked), the creator's removed videos in + the window with what holds them, Scan / Scan again; "No scan yet" with the button when the file is missing. The + stage summary is on the overview's switcher. +- **The MCP**: `get_video_metadata`'s `- copies:` line and `enumerate_matches`' `copies: "only-here"`, from the + scans on a LOCAL source; a remote or hub source says "not available" (`instructions.ts` names the filter). +- **Private**: the scan file is corpus-side only. Checked: nothing in `export/`, `common/publish/`, the index build or + the stats build reads `transcripts/mirrors/` (the only `readdir(transcriptsDir)` in publish is the + `duplicates*.json` listing; `reader-fs` lists a composed site's `transcripts/`, not the corpus). No new key reaches + a record, a page or a site. + +| Commit | What | +| --- | --- | +| `70bef53e` | common, editor: the `mirror` config key (schema, form field, CHANNEL.md), the matcher, the synthetic mirror corpus in the kit | +| `fb08bd35` | common, editor, scripts: the scan controller, the job kind, the scan file, the ops route and action, ops help, COMMANDS.md | +| `08d76737` | merge `main` `c9ec3bc8` (lane C) — clean, no conflicts | +| `ffec8a82` | common, editor: the Mirror stage, `e2e/mirror-panel.spec.ts` | +| `af67049b` | mcp: the copies line, `copies: "only-here"`, instructions | +| `c9201d97` | mcp: the filter's refusal asserted as a tool error | +| (this commit) | this record, FACTS, CHANGELOG | + +## Gates + +From the worktree root, every heavy step through the shared lock, on `08d76737` (main merged in) and after. + +- `pnpm -r --no-bail --workspace-concurrency=1 exec tsc --noEmit`: clean before each commit (last on `08d76737` + with the UI and MCP changes in the tree). +- common 4379 → 4398/4398 (+19: `lib/mirrors/match.test.ts` 11, `lib/mirrors/config.test.ts` 2, + `controller/mirrorScan.test.ts` 6 — off disk, through the REAL `buildIndex`, the dry run, the refusals, the job). +- editor unit 320 → 322/322 (`parseChannelForm.test.ts` +2: the `mirrorOf` field and its ops patch). +- mcp 373 → 377/377 (`mirrorCopies.test.ts` 4: local/remote, the copies line, get_video_metadata, + `copies: "only-here"`). +- `pnpm run test:scripts` 1030 passed + 3 skipped (1033), unchanged (the ops CLI's new action is a list entry). +- `docs files --check`, `docs env --check`, `docs cli --check`, `settings example --check`: clean (CHANNEL.md, + COMMANDS.md regenerated). +- e2e (editor, one spec, through the lock): `mirror-panel.spec.ts` 1/1 passed (20.3 s; its start-mode build 102 s; + 173 s in all). +- A read-only run of the matcher over the real corpus (the scan's own readers, no write; the orchestrator's live + sequence is in the lane report) reproduced the research's forward figures exactly. + +## Rulings and calls + +- **The statuses are one exclusive partition, by platform presence** (only-copy > creator-deleted > never-uploaded > + creator-public). The brief's four names overlap as written (an only copy is also deleted or never uploaded); the + partition keeps a filter per status meaningful, and the file's `presence` and `totals.byPlatform` keep the + research's per-platform figures (YouTube public / removed / none, Rumble public). +- **`live-duration` uses the CREATOR's duration > 3000 s**, as `match.py` does (the brief's prose said the mirror's; + with durations within 25 % the difference is a hair). wasLive is the record's `isLivestream` (was_live, or + live_status was_live / is_live / is_upcoming) — `match.py` read live_status `was_live` only. +- **Strong is judged on the score rounded to two decimals**, as `status.py` did on `match.py`'s rounded `j`; the rules + themselves use the exact Jaccard. +- **Gone is the gone reading** (deleted or private, effective availability), not "anything but public": the research + counted unlisted, members-only, error probes and never-checked videos as not public. The counts move accordingly + (the report's prediction says by how much). +- **The removed window is the mirror's first to last dated video**, with no day margins; a removed upload is held + when a mirror video STRONGLY matches it (the research's held-gone used ±1 day and Jaccard > 0.3, a looser, + separate rule). +- **The scan derives a missing recorded date from the channel's rule itself**, so it is right before the index is + rebuilt for a new pattern (the index's own `recordedDate` wins when present). +- **The Mirror panel is a channel stage** (`?stage=mirror`), listed only for a mirror — the channel page's panels are + its stages. +- **The MCP reads the scans only for a local source**, from the archive's own `transcripts/` (TRANSCRIPTS_DIR or the + checkout's): a LocalSource is a composed site dir, but its ids are the corpus's, and mirror data exists nowhere + else. Remote or hub: "not available".