Archilyzer · Source

archilyzer

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

commit da18c2ff23679962311c34d5ea7887de8622068e
parent 9cccd3d21d137afa20abb8f9d6816b42ba3c854e
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Mon, 19 Oct 2026 00:43:16 -0400

umtool: the clip editor's player keeps its picture across trims and clip changes; docs, changelog, FACTS, record (release 35 C2)

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

Diffstat:
Meditor/CHANGELOG.md | 1+
Mplans/FACTS.md | 32++++++++++++++++++++++++++++++++
Aplans/release-35/clip-editor.md | 84+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mumtool/components/projects/review/ClipEditor.tsx | 32++++++++++++++++++++++++--------
Mumtool/docs/notes.md | 2+-
Mumtool/docs/report-video.md | 66++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mumtool/lib/hrefs.test.mjs | 6++++++
7 files changed, 214 insertions(+), 9 deletions(-)

diff --git a/editor/CHANGELOG.md b/editor/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog ## [Unreleased] +- **Hop in on an assistant's clips in umtool: trim, split, merge, keep or cut them, and comment.** A report video whose cut is not a montage has a **Clip editor** on its Cut tab (`/projects/<id>/clips`). It loops the selected clip from what is on disk, and under it shows the clip's neighbourhood (± 60 s, or closer): the speaker turns coloured host and subject, the laughs, the words, the other clips, and the cut with a handle at each edge. Move the edges by dragging, typing, nudging (±0.1, ±0.5, ±2 s) or **Snap to words**; **Keep** / **Cut**; **Split here** at the playhead; **Merge with next**; **Add a clip** from a span dragged on the strip; **Restore the assistant's version**; **Bring in** a proposal the assistant left out. Each clip says whether it is "by the assistant" (with its score and why) or "edited by you", with its edit history. A comment on a clip is a note anchored to it, so an agent reading `umtool notes` can act on it and its reply shows in the clip's thread. **This is the host** on a speaker's turn corrects which voice is the host. Keys: space, J/L, I/O, S, M, K, X, ←/→. A keep or cut follows its clip when an edit moves the clip's start. It works on any report video; a cut without the clip finder's speakers simply has no colours. - **The report-video test suite passes in the Docker image.** Run inside `archilyzer:r33-umtool` (Debian's ffmpeg 7.1), six report-to-video tests failed that pass on a newer ffmpeg. Four came from how the tests drove ffmpeg, not from the videos it renders: they now run the graphs the way a build does. One compared against an older ffmpeg's timing drift, which 7.1 does not show; it is now only checked where the drift happens. The sixth needs a git checkout, which an image does not include, and now says so and skips. Nothing a build renders changed. - **umtool scores who is speaking in each montage clip.** A montage's clip deck and its Cut tab have **Score the voices**: each clip's phrase (and a second either side, its speech only) is compared with the host's voice, and every Cut-tab row then reads `voice 0.43 · unsure` — likely, unsure or unlikely him — and the deck puts the doubtful clips first with their scores. The host's voice is the clips you ruled keep in the audition deck once there are three, or before that solo uploads of the channel found on disk (captioned, no speaker change in the captions, not a stream, no guest in the title, spread over the years); the picker beside the button chooses. It runs on this machine with the speaker model the diarization lane already uses — no network, no AI model — and takes about half a minute for 73 clips. It sorts and flags; whether it is him is still decided by ear. The scores are kept in `voice-match.json` beside the manifest, by the source moment, so a re-seeded montage keeps them. The same from a terminal: `umtool voice-match <project>`. Needs a restart of umtool. - **A montage's closing wall is the right length on older ffmpeg.** With ffmpeg 7.1 (the umtool Docker image), a tile did not hold its last frame after saying its phrase and did not wait for its turn, so the wall came out short of the length its plan gives (23 frames on the test cut) and, with groups, tiles vanished instead of freezing. The tiles now hold and wait on ffmpeg 7.1 as they do on newer versions; renders on the newer ffmpeg are unchanged. diff --git a/plans/FACTS.md b/plans/FACTS.md @@ -10600,3 +10600,35 @@ parsed to 0 cues, indexing the video textless) is CLOSED by `200a3105` (transcri run and by the next. Engine: `VOICE_MATCH_PYTHON` / `_SCRIPT` / `_MODEL` (ENVIRONMENT.md), else `settings.diarization.python` / `.embModel` (read from `SETTINGS_FILE` or `<repo>/settings.json`), else `.diarize/`. The e2e runs `common/testing/audio/fakeSpeakerEmbed.mjs` with node. + +## Release 35 lane C2: the clip editor (verified 2026-10-19, branch `r35/clip-editor`) + +- **Where**: `/projects/<id>/clips` on a report video whose manifest has NO montage clip (`hasMontageClips` false) → + `components/projects/ClipEditorPage.tsx` + `review/ClipEditor.tsx`; a montage keeps the release-34 deck unchanged; + `?mode=edit` forces the editor, `?clip=<id>` selects one (`clipEditorHref(p, {clip?, mode?})`). The Cut tab's + `[data-clip-editor-link=<n assisted>]` shows for a non-montage cut with clips. +- **The writers** (all in `umtool/lib/report/manifest.mjs`): `updateClip(dir, id, patch, {token, edit = "trim", now})` + now appends to a clip's `assist` (when the clip HAS `assist` and its cut moved): `assist.by = "operator"`, + `assist.edits.push({at, by: "operator", what, from: {cutStart, cutEnd}, to: {cutStart, cutEnd}})` (newest 200; + `cutOf(e)` = cut, else extent). A clip with no `assist` is edited exactly as before. `restoreClip` (= updateClip with + the `RESTORE_PATCH` sentinel: `assist.original` read inside the lock) sets `by` back to `"assistant"` when the clip + has a `proposal`. `splitClip(dir, id, at, {quotes})`, `mergeClips(dir, id, {quote})`, `addClip(dir, spec)` are + `structural` (auto snapshot `auto-before-split|merge|add`, structureErrors). Split: first half keeps id + `original`, + second = `freshEntryId(timeline, id)` (`r001-2`) with `assist {by: "operator", proposal?, score?, why?, edits}`, no + `original`, no `claim`. Merge: with the NEXT timeline entry, which must be a clip of the same channel+video. Add: `id` + default `<video>-<floor(cutStart)>`, placed after the last clip of the same recording whose cut starts ≤ it; `assist + {by: "operator", proposal?, score?, why?, original? (a proposal brought in), edits: [{what: "add", from: null}]}`. +- **The operations**: `umtool/lib/report/clipEditor.mjs` `runClipEditorOp(project, body)` — trim (a clip with a cut + moves its cut and widens the extent to hold it; one without moves start/end; an assisted clip's `quote` becomes the + words of the new span), restore, split (each half's quote from the words), merge, add, bring-in (a `reactions.json` + proposal → addClip with `proposal`), ruling (`keep`|`cut`|null via `setMontageRuling`, key `clipMomentKey`), role. + After every manifest op `carryRulings(dir, beforeKeys, afterKeys)`: a ruling whose clip's moment key changed moves to + the new key (unless that key is ruled already); a ruling whose clip is gone is removed (unless another clip sits on + that moment). `GET /api/report/clip-editor?project` (the view), `?project&clip&from&to` (the strip: turns, laughs, + words — `reactions.source.words` else `<project>/words.json`, `[{w|word|text, start, end}]` or `{words: […]}` — + else the clip's cues), `POST {project, op, token, …}` (409 stale token; 400 + `errors` for StructureRefused). +- **"Unused proposals"** = `reactions.json` proposals that NO manifest clip's `assist.proposal` names (not the file's own + `used`, which is what the last propose did). The editor never writes reactions.json except a speaker's role through + `umtool/lib/report/clipEditorBridge.mjs` `setSpeakerRole(dir, index, role)` — a LOCAL STAND-IN for C1's writer (sets + `role`, `label`, `how: "operator"`; other speakers untouched) — and `reproposeAvailable = false` until C1's + `umtool clips propose` is wired in that same file. diff --git a/plans/release-35/clip-editor.md b/plans/release-35/clip-editor.md @@ -0,0 +1,84 @@ +# Release 35 lane C2 — `r35/clip-editor`: a person hops in on an assistant's clips (as shipped) + +The operator: "Add the ability in the UI for an easy way for a human to hop in and either comment or manually adjust +clips created by an assistant." This lane is that surface: the clip editor at `/projects/<id>/clips` for a report video +whose cut is not a montage — the clip finder's highlights above all (lane C1 writes them, each with `assist`), and any +other report video's clips. Rulings followed: the UI works with no model (nothing here calls one; every proposal the +assistant makes a person can make, undo or adjust); every review step is a umtool surface; comments are notes +(`notes.json`, anchored to the clip, the `umtool notes` agent loop); the montage deck stays as it is; plain words, no +lead paragraphs; role tokens and the redesign's primitives; synthetic fixtures only. + +## What + +1. **The writers** — `umtool/lib/report/manifest.mjs`, the one manifest writer: + - `updateClip(dir, id, patch, {token, edit = "trim", now})`: a clip that carries `assist` and whose cut moved gets + `assist.by = "operator"` and an appended edit `{at, by: "operator", what, from: {cutStart, cutEnd}, to: {cutStart, + cutEnd}}` (newest 200 kept). A trim that leaves the cut where it was records nothing; a clip with no `assist` is + edited exactly as before (the clip bench's edits of an assistant's clip are recorded the same way). + - `restoreClip(dir, id)`: `assist.original` back (read inside the lock), an edit `restore`, and `by` the + assistant's again. + - `splitClip(dir, id, at, {quotes})`, `mergeClips(dir, id, {quote})`, `addClip(dir, spec)`: structural — an + `auto-before-<op>` snapshot first (the Cut tab's Undo takes it back) and the build's structure checks after (with + C1's `validateAssist` once both lanes are merged). Split: at a second half a second inside the cut; the first half + keeps the id and `original`, the second is `<id>-2` (the operator's, no `original`, no `claim`). Merge: with the + next timeline entry, which must be a clip of the same recording (a card between them refuses). Add: in time order + among the recording's clips, `assist {by: "operator", edits: [add]}`; a proposal brought in also keeps `proposal`, + `score`, `why` and the proposal's edges as `original`. +2. **The operations** — `umtool/lib/report/clipEditor.mjs` `runClipEditorOp`: trim (a clip with a cut moves the cut and + widens its extent to hold it; one without moves its extent; an assistant's clip's `quote` becomes the words of the new + span), restore, split (each half quoted from the words), merge, add, bring-in, ruling (`keep` | `cut` | clear, in + `montage-rulings.json` through the release-34 writer, keyed `clipMomentKey`), role. **Rulings follow their clips**: + after every manifest operation a ruling whose clip's moment key changed moves to the new key, and one whose clip is + gone (merged away) is removed. `clipEditorView` (the clips, the token, the speakers, the proposals not in the cut) and + `clipNeighbourhood` (turns, laughs, words — the project's `words.json` or `reactions.source.words` — else the clip's + cues) feed the page. `GET/POST /api/report/clip-editor`. +3. **The page** — `/projects/<id>/clips`: `ClipDeckPage` renders `ClipEditorPage` when the manifest has no montage clip + (or `?mode=edit`); `?clip=<id>` selects. The Cut tab's **Clip editor — n clips · k by the assistant**. + - The player loops the cut from what `/api/cited/play` finds (the neighbourhood, else the extent): a saved video, a + clip window, or audio. It is looked up by the clip's extent, so a trim does not reload it. + - The strip: ± 60 / 20 / 6 s; turns in two lanes coloured host (Signal) and subject (Meter), laughs (Doubt), word + ticks, the other clips (a click opens one), the cut with two drag handles, the playhead; a drag selects a span + (**Add a clip**); a click seeks. The words under it (the cut's lit, the one playing marked; a click seeks). + - Edges: a number field each, nudges ±0.1 / ±0.5 / ±2 s, **at playhead**, **Snap to words** (word gaps, the edges of + a silence between turns, else cue boundaries, within 1.5 s). Drafted locally, written once after 450 ms. + - Keep / Cut (toggle), Split here, Merge with next, Restore the assistant's version, Bring in (the proposals no clip + names), This is the host / Not the host (a click on a turn, or the Speakers list), Re-propose (offered after a role + change; disabled with its reason until C1's propose is wired), Render (the picked or whole-cut take again, else the + Takes page). + - Provenance: "by the assistant · 0.83 · why" / "edited by you · …" / "added by you" / "brought in by you", and the + edit history. + - Comments: the clip's notes (`{kind: "entry", entry}`), their threads with an agent's replies, Resolve / Won't fix + / Reopen / Reply, a box for another (no autofocus, so the keys keep working). + - Keys: space, `j` / `l`, `i` / `o`, `s`, `m`, `k`, `x`, ← / →. +4. **The seam onto C1** — `umtool/lib/report/clipEditorBridge.mjs` holds `readReactions` (lenient: `{doc, error}`) and a + LOCAL `setSpeakerRole(dir, index, role)` (sets `role`, `label`, `how: "operator"`; other speakers untouched) and + `reproposeAvailable = false`. Every caller imports from it. + +## Files + +umtool: `lib/report/manifest.mjs` (updateClip's assist edits; `restoreClip`, `splitClip`, `mergeClips`, `addClip`, +`noteAssistEdit`, `cutOf`, `RESTORE_PATCH`, `ASSIST_EDITS_MAX`), `lib/report/clipEditor.mjs` (new), +`lib/report/clipEditorBridge.mjs` (new), `lib/report/clipEditorModel.mjs` (new, pure), `lib/report/clipEditorTypes.ts` +(new), `lib/report/clipEditor.test.mjs` (new, 13 tests), `lib/hrefs.ts` (`clipEditorHref`; + test 1), +`app/api/report/clip-editor/route.ts` (new), `components/projects/ClipEditorPage.tsx` (new), +`components/projects/review/ClipEditor.tsx` (new), `components/projects/ClipDeckPage.tsx` (the editor for a +non-montage cut), `components/projects/ProjectView.tsx` (`mode`, `clip`), `components/projects/report/CutTab.tsx` (the +link), `e2e/clip-editor.spec.ts` (new), `e2e/fixtures/clip-editor-fixture.mjs` (new), `e2e/fixtures/make-fixture.mjs`, +`docs/report-video.md` ("Reviewing assistant clips: the clip editor"), `docs/notes.md`. `editor/CHANGELOG.md`, +`plans/FACTS.md` ("Release 35 lane C2"). + +## Gates + +GATES_PLACEHOLDER + +## Found and left + +- C1's `setSpeakerRole` (common/lib/clips/reactions.mjs, on `r35/clip-analysis`) takes the role OFF every other + speaker that held it (one host, one subject) and records `rolesChangedAt`; the local stand-in leaves the others alone. + Swapping is `clipEditorBridge.mjs` alone (re-export C1's `setSpeakerRole`; keep the lenient reader); the page then + shows the demotion because every write returns the whole view. +- Re-propose: the button is disabled with "Re-propose arrives with the clip finder (umtool clips propose)". Wiring it + is `reproposeAvailable` plus one `op: "repropose"` calling C1's umtool-side propose (never touching `by: + "operator"` clips — C1's `applyProposals` already guarantees it). +- A clip merged away leaves its notes anchored to an id no clip has; they still list under `umtool notes` (the anchor + resolves to nothing). Not migrated. diff --git a/umtool/components/projects/review/ClipEditor.tsx b/umtool/components/projects/review/ClipEditor.tsx @@ -306,16 +306,18 @@ export default function ClipEditor({ }, []); // ---- what plays ----------------------------------------------------------- + // Named by the clip's EXTENT, not its cut: a trim inside the extent must + // not send the player looking again (and reload the picture) on every save. const targets = useMemo(() => { if (!clip.channel) return []; const base = { channel: clip.channel, video: clip.video, project, clip: clip.id }; + const far = REACHES[0]; const spans: [number, number][] = [ - [viewFrom, viewTo], + [Math.max(0, Math.floor(clip.start - far)), Math.ceil(duration ? Math.min(duration, clip.end + far) : clip.end + far)], [clip.start, clip.end], - [committed.cutStart, committed.cutEnd], ]; return spans.filter(([a, b], i) => b > a && spans.findIndex(([x, y]) => x === a && y === b) === i).map(([from, to]) => ({ ...base, from, to })); - }, [clip.channel, clip.video, clip.id, clip.start, clip.end, committed.cutStart, committed.cutEnd, project, viewFrom, viewTo]); + }, [clip.channel, clip.video, clip.id, clip.start, clip.end, project, duration]); const assist = clip.assist; const prov = provenanceWords(assist); @@ -356,7 +358,7 @@ export default function ClipEditor({ </p> )} - <Player ref={player} targets={targets} cut={cut} onTime={setPlayhead} onPlaying={setPlaying} /> + <Player ref={player} clipId={clip.id} targets={targets} cut={cut} onTime={setPlayhead} onPlaying={setPlaying} /> {/* ---- the strip --------------------------------------------------- */} <div className="space-y-1"> @@ -609,7 +611,7 @@ type PlayerHandle = { toggle: () => void; seek: (t: number) => void }; type Target = { channel: string; video: string; from: number; to: number; project: string; clip: string }; -const Player = forwardRef<PlayerHandle, { targets: Target[]; cut: Cut; onTime: (t: number) => void; onPlaying: (p: boolean) => void }>(function Player({ targets, cut, onTime, onPlaying }, ref) { +const Player = forwardRef<PlayerHandle, { clipId: string; targets: Target[]; cut: Cut; onTime: (t: number) => void; onPlaying: (p: boolean) => void }>(function Player({ clipId, targets, cut, onTime, onPlaying }, ref) { const [found, setFound] = useState<{ play: CitedPlay; from: number } | null | undefined>(undefined); const media = useRef<HTMLMediaElement | null>(null); // The seek to the cut on load is the player's own, not a person's: it must @@ -621,18 +623,21 @@ const Player = forwardRef<PlayerHandle, { targets: Target[]; cut: Cut; onTime: ( useEffect(() => { let live = true; - setFound(undefined); + // The same file at the same clock keeps playing: only a different answer + // replaces the media element. + const settle = (next: { play: CitedPlay; from: number } | null) => + setFound((was) => (was && next && was.play.url === next.play.url && was.play.offset - was.from === next.play.offset - next.from ? was : next)); (async () => { for (const t of targets) { const q = new URLSearchParams({ channel: t.channel, video: t.video, from: String(t.from), to: String(t.to), project: t.project, clip: t.clip }); const r = await fetch(`/api/cited/play?${q}`, { cache: "no-store" }).catch(() => null); const j = r?.ok ? ((await r.json()) as { play: CitedPlay | null }) : null; if (j?.play) { - if (live) setFound({ play: j.play, from: t.from }); + if (live) settle({ play: j.play, from: t.from }); return; } } - if (live) setFound(null); + if (live) settle(null); })(); return () => { live = false; @@ -641,6 +646,17 @@ const Player = forwardRef<PlayerHandle, { targets: Target[]; cut: Cut; onTime: ( // eslint-disable-next-line react-hooks/exhaustive-deps }, [key]); + // Another clip on the same file: go to its cut, paused. + useEffect(() => { + const m = media.current; + if (!m || m.readyState < 1 || !found) return; + m.pause(); + ownSeek.current = true; + m.currentTime = Math.max(0, cutRef.current.cutStart - found.from + found.play.offset); + // Only a change of clip moves the picture. + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [clipId]); + const fileT = (t: number) => (found ? Math.max(0, t - found.from + found.play.offset) : 0); const sourceT = (ft: number) => (found ? ft - found.play.offset + found.from : 0); diff --git a/umtool/docs/notes.md b/umtool/docs/notes.md @@ -5,7 +5,7 @@ | On | Where in umtool | |---|---| | an article (the store's `/articles/<id>`, or a site's `/sites/<site>/<report>`) | the piece's **Article** tab: a passage, a section, a citation, the whole article ([piece.md](piece.md#reading-and-noting-the-article-tab)); a timed note on its video | -| a report-video project | the **Cut** tab's rows and the clip bench (`entry`), the takes bench (`take`), the **Build** tab's final video and a take's preview (`moment`), an edit to a generated manifest (`edit`) | +| a report-video project | the **Cut** tab's rows, the clip bench and the clip editor's **Comments** on a clip (`entry`, [report-video.md](report-video.md#reviewing-assistant-clips-the-clip-editor)), the takes bench (`take`), the **Build** tab's final video and a take's preview (`moment`), an edit to a generated manifest (`edit`) | | a song | the song piece's **Notes** tab and the notes beside each cut and file (a song's own `notes.json`, not this store) | A note is saved where the agent that made the thing can read it back, act on the right SOURCE file, and reply or diff --git a/umtool/docs/report-video.md b/umtool/docs/report-video.md @@ -905,6 +905,72 @@ fallback?, inReference?, why?}}}` — keyed by the source moment, as the rulings are, so a re-seed keeps it. A clip with no window on disk, or no speech in it, has `score: null` and says why. +## Reviewing assistant clips: the clip editor + +When an assistant made the clips (the clip finder's highlights, release 35: +each clip carries `assist`), a person hops in on them at +`/projects/<id>/clips` — the **Clip editor** button on the Cut tab of any cut +that is not a montage (a montage's clips keep the clip deck above; `?mode=edit` +opens the editor on one too). It works on every report video; with no +`reactions.json` the strip has no speaker colours or laughs, and trimming, +keep / cut and comments work the same. Nothing in it calls a model. + +- **The player** loops the selected clip's cut, from what is on disk: a saved + video, a clip window, or audio (the cited clip's own lookup). Nothing on disk: + fetch the windows from the Cut tab first. +- **The strip** under it is the clip's neighbourhood, ± 60 s (± 20 s, ± 6 s to + look closer): the speaker turns coloured host / subject (`reactions.json`), + the laughs, a tick per word, the other clips (a click opens one), and the cut + with a handle at each edge to drag. A drag on the strip selects a span: **Add a + clip** from it. A click puts the playhead there; so does a click on a word in + the words under the strip (the project's word timings, else the cues; the + cut's words are lit). +- **The edges:** a number field each, nudges ±0.1 / ±0.5 / ±2 s, **at + playhead**, and **Snap to words** (each edge to the nearest gap between two + words, the edge of a silence between turns, or with no word timings a cue + boundary, within 1.5 s). A run of nudges is written once, after a short pause. + A cut that grows past its extent widens the extent; an assistant's clip's + quote follows its words. +- **The decisions:** **Keep** / **Cut** (`montage-rulings.json`, the deck's + file, keyed by the moment — a render leaves a cut clip out), **Split here** + (at the playhead, half a second inside the cut), **Merge with next** (the next + clip of the same recording; a card between them refuses), **Restore the + assistant's version** (`assist.original`), and **Bring in** one of the + proposals not in the cut. A ruling follows its clip: an edit that moves the + clip's start moves its keep / cut to the new moment, and a clip merged away + takes its ruling with it. +- **Provenance:** "by the assistant · 0.83 · why", or "edited by you · 3 + edits" / "added by you" / "brought in by you", and the edit history. +- **Comments** are notes anchored to the clip (`{kind: "entry", entry: + <clip id>}` in `notes.json`), with their thread — an agent's replies too — + and Resolve / Reopen: the same notes `umtool notes` reads and answers. +- **Speakers:** a click on a turn says whose it is; **This is the host** (or + **Not the host**) writes that speaker's role into `reactions.json` (`how: + "operator"`), and **Re-propose** is offered (it runs the clip finder's + `umtool clips propose`; until that lands the button is disabled and says so). +- **Render:** the picked take (or the one whole-cut take) made again, else the + Takes page. + +Keys: space play / pause, `j` / `l` back / on 2 s, `i` / `o` in / out at the +playhead, `s` split, `m` merge, `k` keep, `x` cut, ← / → the previous / next +clip. + +What a person's edit writes into the clip's `assist` (the clip finder's key): +the first edit of its cut flips `by` to `"operator"` (a re-propose never +touches it again) and every edit appends `{at, by: "operator", what: "trim" | +"split" | "merge" | "add" | "restore", from: {cutStart, cutEnd} | null, to: +{cutStart, cutEnd}}` to `edits` (the newest 200 kept). **Restore** puts +`original` back and makes the clip the assistant's again (`by: "assistant"`). +A split's first half keeps the id and `original`; the second is a fresh id +(`r004-2`), the operator's, with no `original`. A merge keeps the first clip's +id. A clip added from the strip is `{by: "operator", edits: [add]}`; a proposal +brought in also keeps `proposal`, `score`, `why` and the proposal's edges as +`original`. Split, merge and add are structural edits: each takes an +`auto-before-<op>` snapshot first, so the Cut tab's **Undo last edit** takes it +back. The writers are `lib/report/manifest.mjs` (`updateClip`, `restoreClip`, +`splitClip`, `mergeClips`, `addClip`); the editor's operations are +`lib/report/clipEditor.mjs` behind `/api/report/clip-editor`. + ## Operator notes, timed notes and the generated-manifest guard Notes on a project live in `<project>/notes.json` (shape and CLI: diff --git a/umtool/lib/hrefs.test.mjs b/umtool/lib/hrefs.test.mjs @@ -28,6 +28,12 @@ test("the clip deck: /projects/<p>/clips, its filter in `show`", () => { assert.equal(H.clipDeckHref("a/b", { show: "unruled" }), "/projects/a/b/clips?show=unruled"); }); +test("the clip editor: the deck's address, `mode=edit` and the clip; note last", () => { + assert.equal(H.clipEditorHref("a/b"), "/projects/a/b/clips"); + assert.equal(H.clipEditorHref("a/b", { clip: "r001" }), "/projects/a/b/clips?clip=r001"); + assert.equal(H.clipEditorHref("a/b", { mode: "edit", clip: "r 2", note: "n" }), "/projects/a/b/clips?mode=edit&clip=r+2&note=n"); +}); + test("withNote re-points an href and keeps note last, and the fragment after it", () => { assert.equal(H.withNote("/articles/x?note=old&tab=source", "new"), "/articles/x?tab=source&note=new"); assert.equal(H.withNote("/projects/p", "n"), "/projects/p?note=n");