Archilyzer · Source

archilyzer

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

commit 3dd00ff9617dc9f0d5ca21d65e2fedebeb74ee42
parent 9363de06e4e70fc2b5ed7b171013ea83d7633b6d
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Thu,  5 Nov 2026 02:26:42 -0500

umtool: Edit this take only, on the post bench -- "edits go to: the cut · take <t> only" (the newest takes); ?inTake=<t> reads the item as the take has it and runs every write of the bench (set, fx, transcribe, combo) under takeScope.mjs withTakeScope, the CLI's --in-take: the take's patch with its own undo point, the project's manifest untouched; reads stay on the cut's bench (a take's own read is still `posts narrate … --in-take`); Play from here plays that take

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

Diffstat:
Mumtool/app/api/report/post-combo/route.ts | 22++++++++++++++++++++++
Mumtool/app/api/report/post-item/route.ts | 22++++++++++++++++++++++
Mumtool/components/projects/PostBench.tsx | 6++++--
Mumtool/components/projects/PostBenchPage.tsx | 36+++++++++++++++++++++++++++++++++++-
Mumtool/components/projects/PostComboPanel.tsx | 4+++-
Mumtool/components/projects/PostNarrationPanel.tsx | 9+++++++++
Mumtool/components/projects/PostThreadPanel.tsx | 9+++++++++
Mumtool/components/projects/PostZoomPanel.tsx | 4+++-
Aumtool/components/projects/inTake.tsx | 16++++++++++++++++
9 files changed, 123 insertions(+), 5 deletions(-)

diff --git a/umtool/app/api/report/post-combo/route.ts b/umtool/app/api/report/post-combo/route.ts @@ -7,6 +7,8 @@ import { withEditNotes } from "@/lib/report/guard"; import { StaleToken, StructureRefused, updatePostCombo, updatePostComboRender } from "@/lib/report/manifest.mjs"; import { resolveReport } from "@/lib/report/serve.mjs"; import { refuseCaller } from "@/lib/report/caller"; +import { withTakeScope } from "@/lib/report/takeScope.mjs"; +import { isTakeId } from "@/lib/report/takes.mjs"; export const dynamic = "force-dynamic"; @@ -41,7 +43,27 @@ export async function GET(request: Request) { } } +// "Edit this take only" (lane/ui-simplify): a body naming `inTake` runs the same write under takeScope.mjs +// withTakeScope -- the take's manifest read, the write into its patch, the project's manifest untouched (the +// CLI's `--in-take`). The token is then the take's (take.json's), so a client's project token is not checked. export async function POST(request: Request) { + const text = await request.text(); + let parsed: Record<string, unknown> | null = null; + try { + parsed = JSON.parse(text); + } catch { + parsed = null; + } + const take = parsed && typeof parsed.inTake === "string" && parsed.inTake ? parsed.inTake : null; + const again = (body: string) => new Request(request.url, { method: "POST", headers: request.headers, body }); + if (!take || !parsed) return postHere(again(text)); + if (!isTakeId(take)) return Response.json({ error: "inTake must be a take id" }, { status: 400 }); + const rr = await resolveReport(String(parsed.project ?? "")); + if ("error" in rr) return Response.json({ error: rr.error }, { status: rr.status }); + return withTakeScope(rr.project.dir, take, () => postHere(again(JSON.stringify({ ...parsed, token: null })))); +} + +async function postHere(request: Request) { const refused = refuseCaller(request, "/api/report/post-combo"); if (refused) return refused; let body: Record<string, unknown>; diff --git a/umtool/app/api/report/post-item/route.ts b/umtool/app/api/report/post-item/route.ts @@ -17,6 +17,8 @@ import { recognizedOf, takeWordSources, wordsFileOf } from "@/lib/report/postFxC import { rangeResponse, resolveReport } from "@/lib/report/serve.mjs"; import { resolveTakeManifest } from "@/lib/report/takeManifest.mjs"; import { refuseCaller } from "@/lib/report/caller"; +import { withTakeScope } from "@/lib/report/takeScope.mjs"; +import { isTakeId } from "@/lib/report/takes.mjs"; import { projectRedaction } from "@/lib/report/postRedaction.mjs"; export const dynamic = "force-dynamic"; @@ -224,7 +226,27 @@ export async function GET(request: Request) { return new Response(html, { headers: { "content-type": "text/html; charset=utf-8", ...noStore } }); } +// "Edit this take only" (lane/ui-simplify): a body naming `inTake` runs the same write under takeScope.mjs +// withTakeScope -- the take's manifest read, the write into its patch, the project's manifest untouched (the +// CLI's `--in-take`). The token is then the take's (take.json's), so a client's project token is not checked. export async function POST(request: Request) { + const text = await request.text(); + let parsed: Record<string, unknown> | null = null; + try { + parsed = JSON.parse(text); + } catch { + parsed = null; + } + const take = parsed && typeof parsed.inTake === "string" && parsed.inTake ? parsed.inTake : null; + const again = (body: string) => new Request(request.url, { method: "POST", headers: request.headers, body }); + if (!take || !parsed) return postHere(again(text)); + if (!isTakeId(take)) return Response.json({ error: "inTake must be a take id" }, { status: 400 }); + const rr = await resolveReport(String(parsed.project ?? "")); + if ("error" in rr) return Response.json({ error: rr.error }, { status: rr.status }); + return withTakeScope(rr.project.dir, take, () => postHere(again(JSON.stringify({ ...parsed, token: null })))); +} + +async function postHere(request: Request) { const refused = refuseCaller(request, "/api/report/post-item"); if (refused) return refused; let body: Record<string, unknown>; diff --git a/umtool/components/projects/PostBench.tsx b/umtool/components/projects/PostBench.tsx @@ -1,5 +1,6 @@ "use client"; +import { inTakeBody, useInTake } from "./inTake"; import Link from "next/link"; import { useRouter } from "next/navigation"; import { useCallback, useEffect, useMemo, useRef, useState } from "react"; @@ -105,6 +106,7 @@ export default function PostBench({ /** The posts its conversation's run leaves on screen (post-conversation.mjs planContext): kept on top or collapsed away. It wins the card over a media scene. */ conversation?: Record<string, unknown> | null; }) { + const inTake = useInTake(); const router = useRouter(); const [entry, setEntry] = useState<Entry>(initial); const [saved, setSaved] = useState<Entry>(initial); @@ -232,7 +234,7 @@ export default function PostBench({ const res = await fetch("/api/report/post-item", { method: "POST", headers: { "content-type": "application/json" }, - body: JSON.stringify({ project, op: "set", id: entry.id, patch: patchOf(entry), token }), + body: JSON.stringify({ project, op: "set", id: entry.id, patch: patchOf(entry), token, ...inTakeBody(inTake) }), }); const j = (await res.json().catch(() => ({}))) as { entry?: Entry; token?: string; error?: string; errors?: string[] }; if (!res.ok || !j.entry) { @@ -252,7 +254,7 @@ export default function PostBench({ const [jobs, setJobs] = useState<Record<number, { job: string; state: string; error?: string }>>({}); const transcribe = async (i: number) => { setError(null); - const res = await fetch("/api/report/post-item", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ project, op: "transcribe", id: entry.id, media: i }) }); + const res = await fetch("/api/report/post-item", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ project, op: "transcribe", id: entry.id, media: i, ...inTakeBody(inTake) }) }); const j = (await res.json().catch(() => ({}))) as { jobId?: string; error?: string }; if (!res.ok || !j.jobId) { setJobs((x) => ({ ...x, [i]: { job: "", state: "failed", error: j.error ?? `HTTP ${res.status}` } })); diff --git a/umtool/components/projects/PostBenchPage.tsx b/umtool/components/projects/PostBenchPage.tsx @@ -5,6 +5,11 @@ import { channelsDirFor, readManifest } from "@/lib/projects/report.mjs"; import { manifestToken } from "@/lib/report/manifest.mjs"; import { projectHref, playHref } from "@/lib/hrefs"; import PlayLink from "./PlayLink"; +import Link from "next/link"; +import { InTakeProvider } from "./inTake"; +import { postBenchHref } from "@/lib/hrefs"; +import { withTakeScope } from "@/lib/report/takeScope.mjs"; +import { isTakeId, listTakes } from "@/lib/report/takes.mjs"; import { deckGeometry, deckOn, feedGeometry, feedOn } from "umtool-report-to-video/deck"; import { postItemPlan, panelEntry } from "umtool-report-to-video/post-item"; import { planContext } from "umtool-report-to-video/post-conversation"; @@ -21,7 +26,21 @@ import type { ComboInfo } from "./review/ComboBadge"; // words through the editor's transcription. Every save is updatePostItem // (POST /api/report/post-item {op: "set"}), the writer `umtool posts set-item` runs. +// "EDIT THIS TAKE ONLY" (lane/ui-simplify): `?inTake=<take>` reads the item as the take has it and scopes every +// write of the bench to the take's patch (takeScope.mjs, the CLI's `--in-take`); the project's cut is untouched. export default async function PostBenchPage({ project, id, search = {} }: { project: ProjectRef; id: string; search?: Record<string, string | undefined> }) { + const inTake = search.inTake && isTakeId(search.inTake) ? search.inTake : null; + const takes = ((await listTakes(project.dir)).takes as { id: string; builtAt?: string | null; draft?: boolean }[]) + .filter((t) => t.builtAt || t.draft) + .sort((a, b) => String(b.builtAt ?? "").localeCompare(String(a.builtAt ?? ""))) + .slice(0, 6) + .map((t) => t.id); + if (inTake && !takes.includes(inTake)) takes.unshift(inTake); + const body = () => postBenchBody({ project, id, search, inTake, takes }); + return inTake ? withTakeScope(project.dir, inTake, body) : body(); +} + +async function postBenchBody({ project, id, search, inTake, takes }: { project: ProjectRef; id: string; search: Record<string, string | undefined>; inTake: string | null; takes: string[] }) { const m = (await readManifest(project.dir)) as Record<string, unknown> | null; if (!m) notFound(); const tl = (Array.isArray(m.timeline) ? m.timeline : []) as Array<Record<string, unknown> & { id: string; type?: string }>; @@ -50,9 +69,23 @@ export default async function PostBenchPage({ project, id, search = {} }: { proj active="projects" crumbs={[{ href: "/projects", label: "Projects" }, { href: projectHref(project.id), label: project.name }, { label: `post ${id}` }]} note={`post item ${k + 1} of ${neighbours.length} · ${String(entry.post ?? "")}`} - actions={<PlayLink project={project.id} clip={id} where="post-bench" variant="header" label="▶ Play from here" />} + actions={<PlayLink project={project.id} take={inTake} clip={id} where="post-bench" variant="header" label="▶ Play from here" />} /> <main className="deck-main flex-1 overflow-auto p-4"> + {/* Where the bench's edits go: the cut, or one take only. */} + <p className="mb-2 flex flex-wrap items-center gap-2 text-[12px]" data-post-bench-scope={inTake ?? "cut"}> + <span className="micro">edits go to</span> + <Link href={postBenchHref(project.id, id)} aria-current={!inTake ? "page" : undefined} className={!inTake ? "font-medium text-text" : "ink-link"} data-post-bench-scope-link=""> + the cut + </Link> + {takes.map((t) => ( + <Link key={t} href={`${postBenchHref(project.id, id)}?inTake=${encodeURIComponent(t)}`} aria-current={inTake === t ? "page" : undefined} className={inTake === t ? "font-medium text-text" : "ink-link"} data-post-bench-scope-link={t}> + take {t} only + </Link> + ))} + {inTake && <span className="text-doubt-text">editing take {inTake} only — the cut and its other takes are untouched; reads are re-made on the cut&apos;s bench</span>} + </p> + <InTakeProvider take={inTake}> <PostBench project={project.id} entry={entry} @@ -69,6 +102,7 @@ export default async function PostBenchPage({ project, id, search = {} }: { proj next={k < neighbours.length - 1 ? neighbours[k + 1] : null} fromPlay={fromPlay} /> + </InTakeProvider> </main> </div> ); diff --git a/umtool/components/projects/PostComboPanel.tsx b/umtool/components/projects/PostComboPanel.tsx @@ -1,5 +1,6 @@ "use client"; +import { inTakeBody, useInTake } from "./inTake"; import Link from "next/link"; import { useState } from "react"; import { postBenchHref } from "@/lib/hrefs"; @@ -28,6 +29,7 @@ export default function PostComboPanel({ render: Record<string, unknown>; onEntry: (entry: Record<string, unknown> & { id: string }, token: string | null) => void; }) { + const inTake = useInTake(); const [error, setError] = useState<string | null>(null); const [busy, setBusy] = useState(false); // The box follows the click at once; the write's answer settles it (a refusal puts it back). @@ -42,7 +44,7 @@ export default function PostComboPanel({ const res = await fetch("/api/report/post-combo", { method: "POST", headers: { "content-type": "application/json" }, - body: JSON.stringify({ project, op: "set", id: entry.id, combo: on ? null : false, token }), + body: JSON.stringify({ project, op: "set", id: entry.id, combo: on ? null : false, token, ...inTakeBody(inTake) }), }); const j = (await res.json().catch(() => ({}))) as { entry?: Record<string, unknown> & { id: string }; token?: string; error?: string; errors?: string[] }; setBusy(false); diff --git a/umtool/components/projects/PostNarrationPanel.tsx b/umtool/components/projects/PostNarrationPanel.tsx @@ -1,5 +1,6 @@ "use client"; +import { useInTake } from "./inTake"; import Link from "next/link"; import { useCallback, useEffect, useMemo, useRef, useState } from "react"; import Waveform from "@/components/Waveform"; @@ -60,6 +61,7 @@ export default function PostNarrationPanel({ next: string | null; fromPlay: boolean; }) { + const inTake = useInTake(); const n = entry.narration ?? {}; const takes = n.takes ?? []; const picked = pickedTake(entry) as (Take & { index: number }) | null; @@ -329,6 +331,13 @@ export default function PostNarrationPanel({ </label> ); + // A take-scoped bench (?inTake): a read is made for the cut here; a take's own read is \`umtool posts narrate … --in-take <t>\`. + if (inTake) + return ( + <p className="m-0 text-[12px] text-muted" data-post-bench-in-take-note=""> + Narration is edited on the cut&apos;s bench (edits go to: the cut); take {inTake} keeps the reads it has. + </p> + ); return ( <div className="space-y-3 text-[12.5px]" data-post-narration={entry.id} data-post-narration-plays={picked ? (picked.engine === "recorded" ? "recorded" : "synthesized") : "none"}> {/* The cut's reading: how far along, and where next. */} diff --git a/umtool/components/projects/PostThreadPanel.tsx b/umtool/components/projects/PostThreadPanel.tsx @@ -1,5 +1,6 @@ "use client"; +import { useInTake } from "./inTake"; import { useMemo, useState } from "react"; import { THREAD_DEFAULTS, THREAD_LIMITS, THREAD_MODES, partRoles, readPieces, threadKnobs, threadLayout, threadReadErrors } from "umtool-report-to-video/post-thread"; import { followKnobs } from "umtool-report-to-video/read-follow"; @@ -39,6 +40,7 @@ export default function PostThreadPanel({ setS: (s: number) => void; setEntry: (f: (e: Entry) => Entry) => void; }) { + const inTake = useInTake(); const own = (entry.thread ?? undefined) as Thread | undefined; const k = threadKnobs(entry, render) as Required<Thread>; const layout = useMemo(() => threadLayout(entry, render, { prev: before, scene }), [entry, render, before, scene]); @@ -104,6 +106,13 @@ export default function PostThreadPanel({ </label> ); if (!parents.length && !entry.quoted && !sceneTiles.length) return null; + // A take-scoped bench (?inTake): a read is made for the cut here; a take's own read is \`umtool posts narrate … --in-take <t>\`. + if (inTake) + return ( + <p className="m-0 text-[12px] text-muted" data-post-bench-in-take-note=""> + The thread read is edited on the cut&apos;s bench (edits go to: the cut); take {inTake} keeps the reads it has. + </p> + ); return ( <section className="rounded border border-[var(--color-line)] bg-[var(--color-panel)] p-3 text-[12px]" data-post-thread-panel="" data-threaded={layout.on ? "1" : "0"}> <div className="mb-2 flex flex-wrap items-center gap-2"> diff --git a/umtool/components/projects/PostZoomPanel.tsx b/umtool/components/projects/PostZoomPanel.tsx @@ -1,5 +1,6 @@ "use client"; +import { inTakeBody, useInTake } from "./inTake"; import { useEffect, useMemo, useState } from "react"; import { buttonVariants } from "@/components/ui/button"; import { cn } from "@/lib/utils"; @@ -40,6 +41,7 @@ export default function PostZoomPanel({ setS: (s: number) => void; onEntry: (e: Entry, token: string | null) => void; }) { + const inTake = useInTake(); const btn = cn(buttonVariants({ variant: "outline", size: "sm" })); const [error, setError] = useState<string | null>(null); const [status, setStatus] = useState<string | null>(null); @@ -69,7 +71,7 @@ export default function PostZoomPanel({ const send = async (fx: Record<string, unknown>) => { setError(null); - const res = await fetch("/api/report/post-item", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ project, op: "fx", id: entry.id, fx, token }) }); + const res = await fetch("/api/report/post-item", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ project, op: "fx", id: entry.id, fx, token, ...inTakeBody(inTake) }) }); const j = (await res.json().catch(() => ({}))) as { entry?: Entry; token?: string; error?: string; errors?: string[] }; if (!res.ok || !j.entry) { setError(j.errors?.join("; ") ?? j.error ?? `HTTP ${res.status}`); diff --git a/umtool/components/projects/inTake.tsx b/umtool/components/projects/inTake.tsx @@ -0,0 +1,16 @@ +"use client"; + +import { createContext, useContext } from "react"; + +// "EDIT THIS TAKE ONLY" on the post bench (lane/ui-simplify, 5 Nov): the take every write of the bench is scoped +// to (`?inTake=<t>`; the routes run the writer under takeScope.mjs withTakeScope, as `umtool posts set-item … --in-take` +// does), or null for the project's cut. A writer adds `...inTakeBody(take)` to its POST body. +const Ctx = createContext<string | null>(null); + +export function InTakeProvider({ take, children }: { take: string | null; children: React.ReactNode }) { + return <Ctx.Provider value={take}>{children}</Ctx.Provider>; +} + +export const useInTake = () => useContext(Ctx); + +export const inTakeBody = (take: string | null) => (take ? { inTake: take } : {});