rushes 0.7.1 → 0.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "rushes",
3
3
  "description": "A local review desk for video made with AI agents: timecoded notes, script edits and audio picks your agent reads and acts on.",
4
- "version": "0.7.1",
4
+ "version": "0.7.3",
5
5
  "author": { "name": "Red Morley Hewitt" },
6
6
  "homepage": "https://github.com/iamredmh/rushes",
7
7
  "repository": "https://github.com/iamredmh/rushes",
package/AGENTS.md CHANGED
@@ -113,11 +113,12 @@ The user can shelve a film they have set aside (the **Film actions** menu in the
113
113
  - A render: `rushes_add_version` with `video` and `file`. Run it again for each new cut. Give every cut a short `label` (48 characters at most) that says what changed, e.g. `"launch 1.45x slower"`, and put the detail in `note`: the version list shows the label, and a longer one is refused. When the cut is likely to play badly in a browser (4K or larger, over 1.5 GB, or a codec such as ProRes), the reply carries `proxySuggested: true` and `proxyReason`; Picture then offers the user a proxy. Prefer H.264 MP4 to begin with and this won't come up.
114
114
  - Other shapes of the same cut (a 9:16, 1:1 or 4:5 of the 16:9: same edit, same length): register every shape you rendered, main one first. `rushes_add_version` with `file` (the main one) and `formats: [{ file }, …]` registers them all in one call; `rushes_add_format` (`file`, optional `video`, `version` and `label`) adds one to a cut already registered. Rushes measures each ratio with ffprobe; here `label` is only a ratio hint for an unusual shape such as 2.39:1 (not the cut's short label, which belongs to `rushes_add_version`). A second render with a ratio the cut already has is refused: a re-render is a new version. A shape more than 0.1 s off the cut's length is still registered, with a warning: `rushes_add_format` returns it as `warning`, and `rushes_add_version` returns a list as `formatWarnings` (there, `warning` means "Picture is locked").
115
115
  - A VO script: `rushes_set_script` with sections `{start, end, current}` in seconds. It merges by `id`: send only the sections you changed, with their ids, plus any new ones without an id. Sections you leave out are kept, with their takes. Pass `replace: true` only when you mean to replace the whole script. `rushes_get_script` reads the whole script back.
116
- - A voice read: `rushes_add_variant` with `stage: "voice"` and `round` (the round's name, e.g. "Round 2 · Gerald, tone" — reads in one round are compared side by side; a new direction gets a new round, a small fix to a marked word can stay in the current one). Say in `description` what the read is, or what changed from the one it's based on. `rushes_add_take` stays in the file format and API for compatibility only; voiceover work doesn't use it.
117
- - Music beds or SFX passes: `rushes_add_variant` with `stage` `music` or `sfx`. Give it `meta: {description: "..."}`, shown on its lane card in place of `bpm`/`key`; SFX passes also take `cues` (`{name, t, file?}`: `t` in seconds, and `file` the sample you placed there, an audio file, optional), labelled on the waveform. Give a sound the same name every time it comes back (`thud`, not `thud 2`): the Sound effects tab groups cues by name into layers, one per sound, and shows a cue's `file` on its card, where the user can play that sample on its own.
116
+ - A voice read: `rushes_add_variant` with `stage: "voice"`, `video` (the film it is for) and `round` (the round's name, e.g. "Round 2 · Gerald, tone" — reads in one round are compared side by side; a new direction gets a new round, a small fix to a marked word can stay in the current one). Say in `description` what the read is, or what changed from the one it's based on. `rushes_add_take` stays in the file format and API for compatibility only; voiceover work doesn't use it.
117
+ - Music beds or SFX passes: `rushes_add_variant` with `stage` `music` or `sfx`, and `video`. Give it `meta: {description: "..."}`, shown on its lane card in place of `bpm`/`key`; SFX passes also take `cues` (`{name, t, file?}`: `t` in seconds, and `file` the sample you placed there, an audio file, optional), labelled on the waveform. Give a sound the same name every time it comes back (`thud`, not `thud 2`): the Sound effects tab groups cues by name into layers, one per sound, and shows a cue's `file` on its card, where the user can play that sample on its own.
118
+ - Every voice read, music bed and SFX pass belongs to a film: pass its `video` (id or name) to `rushes_add_variant`, and the Voiceover, Music, Sound effects and Mix tabs list it only on that film. One without a `video` is listed on every film, so leave it out only for audio that really is for every film. `rushes_bring_in` and `rushes_open` give the files they bring in the `film` you name (or, for the files they match to the newest cut, that cut's film).
118
119
  - The storyboard's shots, once you have the first cut: `rushes_set_shots` with `video`, optional `version` (defaults to the newest) and `shots` as `{start, name, tag?}`. Send new timings whenever a later cut moves them.
119
120
  2. **Open it for the user:** `rushes_open`. It also looks through the project folder and brings in the files that go with the cut (next section). Each project's dashboard lives at its own address, `/p/<id>/` — safe to run more than one project at once. A tab unlocks as soon as it has something in it.
120
- 3. **Wait for feedback.** The user presses **Send to agent**, which saves a batch and gives them a prompt to paste to you. Call `rushes_get_batch` to read the latest batch, its notes and any changed script sections.
121
+ 3. **Wait for feedback.** The user presses **Send to agent**, which saves a batch and gives them a prompt to paste to you. Whichever tab they press it on, the batch holds every open note from every tab and every film in play, plus any changed script sections; its `stage` is the tab when everything came from one, or `null` when it spans tabs. Each note carries its own `stage` and `video`: fix each one on its own tab and film. Call `rushes_get_batch` to read the latest batch, its notes and any changed script sections. When the brief or the storyboard changed too, the prompt the user pastes ends with a line about each.
121
122
  4. **Fix each note.** A note has `stage`, `scope` (`point`, `range` or `whole` — Voiceover only ever uses `point` or `whole`; it has no Range scope), `t`, `tOut`, `on` (the lane, variant, take, cue or section it's about), `text`, and optionally `box` (normalised 0 to 1), `grab` (a PNG path in `screenshots/`; older notes may point to `.rushes/grabs/`), `shot` (the shot it falls in, `{n, name}`, worked out by the server from the version's shots — not yours to set) and, on Picture, `format` (`null` when the note is for every format, or a format id such as `"9x16"` when it's for that shape only). When a note's `format` is not null, fix only that format and leave the others alone; an all-format note is for every shape, so fix each and say in `reply` which formats you fixed. `rushes_list_notes` takes `format` (an id such as `9x16`, or its label `9:16`: that format's Picture notes plus the all-format ones) and `onlyThisFormat: true` (only that format's). On an audio stage, `on` is `"<laneId>/<variantId>"` for a music bed, SFX pass or voice read (the lane and variant ids `rushes_add_variant` returns) — on Voiceover the lane id is the round's slugged name, so `on` names the round and the read together — or `"<laneId>/<variantId>:<cueId>"` for an SFX cue. On Mix it's `null` for the whole mix, `"vo"` for the VO lane (the newest round with a pick), or `"<laneId>/<variantId>"` for the music or SFX lane. Older notes may carry a bare variant id, `"vo"` on Voiceover itself, a section id, `"<sectionId>:<takeId>"` for a take, `"<variantId>:<cueId>"` or a bare cue id; Rushes still lists these with a sensible label, but none of them name a read any more. On Music, Sound effects and Mix, a note can also carry `marks` — short feedback like `Fall` (bring the level down over the range) or `Quieter 3 dB` (3 dB lower over the range). `rushes_list_notes`, `rushes_get_batch` and exported notes all show them. Marks are the user's, like a note's text and times — you read and act on them, you don't set them. Voiceover notes carry no marks: a note there is **Whole** (`Speaker`, `Pacing`, `Tone` or `Overall` — about the read as a whole) or **Point** (`Fix this` or `Keep this`, marked at the playhead).
122
123
  5. **Register the new cut** with `rushes_add_version`, with a short `label` and the detail in `note`. If the video is locked, the reply carries `warning: "Picture is locked at vN"`; the version is still added.
123
124
  6. **Reply to every note** in one `rushes_reply` call. For each, set `status: "done"`, a one-line `reply`, `fixT` (when the fix is visible in the new cut, in seconds) and `fixVersion`. If you didn't fix a note, leave it `todo` and say why in `reply`.
package/README.md CHANGED
@@ -138,7 +138,7 @@ Rushes keeps a running log of what happened: each cut, read, bed and pass as it
138
138
  ## Why Rushes
139
139
 
140
140
  - **Notes your agent can act on.** Each one carries its stage, a timecode or range, an optional box on the frame, a frame grab, and the shot it falls in.
141
- - **One batch at a time.** **Send to agent** covers the tab you're on, because you review one stage at a time.
141
+ - **Everything in one batch.** **Send to agent** sends every open note from every tab and every film, whichever tab you press it on, so nothing waits behind.
142
142
  - **Versions keep their history.** Notes follow the work from cut to cut, and you can lock picture when it's done.
143
143
  - **Local, with no sign-up.** No account, no API key, nothing uploaded. It runs on your machine.
144
144
  - **Works with the agent you already use.** One MCP server for Claude Code, Codex, Cursor, Claude Desktop and Gemini CLI, a plugin and skill for Claude Code, and a command line for anything else.
package/dist/cli/main.js CHANGED
@@ -41,7 +41,7 @@ Usage
41
41
  rushes add format <file> [--video NAME] [--version V] [--label RATIO]
42
42
  register another shape (aspect ratio) of a cut;
43
43
  --label here is only a ratio hint such as 2.39:1, not the cut's label
44
- rushes add variant <music|sfx|voice> <file> --name NAME [--lane ID] [--round NAME] [--description TEXT]
44
+ rushes add variant <music|sfx|voice> <file> --name NAME [--video NAME] [--lane ID] [--round NAME] [--description TEXT]
45
45
  rushes add shots <file.json> --video NAME [--version V]
46
46
  rushes add file <path> --kind K [--name NAME] [--note TEXT] [--video V]
47
47
  register a doc, image, caption, export, delivery or edit file
@@ -408,8 +408,10 @@ export async function main(argv, io) {
408
408
  if (what === "variant") {
409
409
  if (!a || !b || !o.name)
410
410
  return usage(io, "rushes add variant <music|sfx|voice> <file> --name NAME");
411
- const r = await (await client()).post("/api/variants", { stage: a, file: resolve(io.cwd, b), name: o.name, lane: o.lane, round: o.round, description: o.description });
411
+ const r = await (await client()).post("/api/variants", { stage: a, file: resolve(io.cwd, b), name: o.name, lane: o.lane, round: o.round, description: o.description, video: o.video });
412
412
  io.out(`Added ${r.lane.name}: ${r.variant.name}`);
413
+ if (r.warning)
414
+ io.out(`Warning: ${r.warning}`);
413
415
  return 0;
414
416
  }
415
417
  if (what === "shots") {
@@ -1,7 +1,9 @@
1
1
  import { chipOrder, versionFormats } from "./formats.js";
2
+ import { STAGES } from "./schema.js";
2
3
  import { EmptyBatchError } from "./errors.js";
3
4
  import { noteInPlay } from "./project.js";
4
5
  import { isChanged } from "./script.js";
6
+ import { TAB_NAMES } from "./logEvents.js";
5
7
  const STAGE_NAMES = {
6
8
  script: "script",
7
9
  picture: "picture",
@@ -12,25 +14,33 @@ const STAGE_NAMES = {
12
14
  visuals: "visuals",
13
15
  };
14
16
  /**
15
- * Gather this tab's open, unsent items into a batch: to-do notes with no
16
- * batch yet, and (on the script tab) changed or flagged sections.
17
+ * Gather open, unsent items into a batch: to-do notes with no batch yet, and changed or flagged
18
+ * script sections. With a stage, only that tab's; with none (Send to agent), every tab's, on every
19
+ * film in play. A batch whose items all come from one tab is that tab's batch; one that spans tabs
20
+ * has no stage.
17
21
  */
18
22
  export function createBatch(ctx, stage, now = new Date()) {
19
23
  // §26: a shelved film is never asked about; its open notes stay unsent.
20
- const notes = ctx.notes.notes.filter((n) => n.stage === stage && n.status === "todo" && n.batch === null && noteInPlay(n, ctx.project));
21
- const sections = stage === "script" ? ctx.script.sections.filter((s) => isChanged(s) || s.status === "flagged") : [];
24
+ const notes = ctx.notes.notes.filter((n) => (stage === undefined || n.stage === stage) && n.status === "todo" && n.batch === null && noteInPlay(n, ctx.project));
25
+ const sections = stage === undefined || stage === "script" ? ctx.script.sections.filter((s) => isChanged(s) || s.status === "flagged") : [];
22
26
  if (notes.length === 0 && sections.length === 0)
23
27
  throw new EmptyBatchError(stage);
24
28
  const id = `b_${ctx.batches.batches.length + 1}`;
25
29
  for (const n of notes)
26
30
  n.batch = id;
31
+ // The tabs it covers, in tab order.
32
+ const stages = STAGES.filter((st) => (st === "script" && sections.length > 0) || notes.some((n) => n.stage === st));
33
+ const only = stages.length === 1 ? stages[0] : null;
34
+ const picture = notes.filter((n) => n.stage === "picture");
27
35
  const batch = {
28
36
  id,
29
- stage,
37
+ stage: only,
30
38
  noteIds: notes.map((n) => n.id),
31
39
  sectionIds: sections.map((s) => s.id),
32
40
  sentAt: now.toISOString(),
33
- prompt: buildPrompt(ctx.project.name, stage, id, notes.length, sections.length, stage === "picture" ? formatLines(ctx.project, notes) : []),
41
+ prompt: only
42
+ ? buildPrompt(ctx.project.name, only, id, notes.length, sections.length, only === "picture" ? formatLines(ctx.project, picture) : [])
43
+ : buildWidePrompt(ctx.project, id, notes, sections.length),
34
44
  };
35
45
  ctx.batches.batches.push(batch);
36
46
  return batch;
@@ -70,13 +80,9 @@ export function formatLines(project, notes) {
70
80
  lines.push(FORMAT_STEPS);
71
81
  return lines;
72
82
  }
73
- export function buildPrompt(project, stage, batchId, notes, sections, extra = []) {
74
- const parts = [];
75
- if (notes)
76
- parts.push(`${notes} note${notes === 1 ? "" : "s"}`);
77
- if (sections)
78
- parts.push(`${sections} script section${sections === 1 ? "" : "s"}`);
79
- const steps = stage === "script"
83
+ /** What the agent does with one tab's notes (or, on Script, its changed sections). */
84
+ function stepsFor(stage) {
85
+ return stage === "script"
80
86
  ? "Use rushes_get_batch, take each section's proposed line, then rushes_set_script with just those sections (it merges by id). If voiceover already exists, re-record the picked voice with the corrected script and register it with rushes_add_variant as a new read in a new round."
81
87
  : stage === "voice"
82
88
  ? "Use rushes_get_batch and rushes_get_picks. Answer the notes with new whole reads (rushes_add_variant with stage voice and round): a new round for a new direction, or the current round for a small fix to a marked word. Say in each read's description what changed. Then rushes_reply."
@@ -89,7 +95,39 @@ export function buildPrompt(project, stage, batchId, notes, sections, extra = []
89
95
  : AUDIO_STAGES.includes(stage)
90
96
  ? 'Use rushes_get_batch and rushes_get_picks, fix each note (marks such as "Fall" or "Quieter 3 dB" are part of the note), register the new variant, then rushes_reply.'
91
97
  : "Use rushes_get_batch, fix each note, then rushes_reply with a fixT for each and rushes_add_version for the new cut.";
92
- return `Work through ${STAGE_NAMES[stage]} batch ${batchId} on ${project}: ${parts.join(" and ")}.\n${[...extra, steps].join("\n")}`;
98
+ }
99
+ export function buildPrompt(project, stage, batchId, notes, sections, extra = []) {
100
+ const parts = [];
101
+ if (notes)
102
+ parts.push(`${notes} note${notes === 1 ? "" : "s"}`);
103
+ if (sections)
104
+ parts.push(`${sections} script section${sections === 1 ? "" : "s"}`);
105
+ return `Work through ${STAGE_NAMES[stage]} batch ${batchId} on ${project}: ${parts.join(" and ")}.\n${[...extra, stepsFor(stage)].join("\n")}`;
106
+ }
107
+ /**
108
+ * The prompt for a batch that spans tabs: what is in it, tab by tab with the films each tab's notes
109
+ * are on, then what to do on each tab.
110
+ */
111
+ export function buildWidePrompt(project, batchId, notes, sections) {
112
+ const lines = [];
113
+ const counts = [];
114
+ for (const stage of STAGES) {
115
+ const here = notes.filter((n) => n.stage === stage);
116
+ const k = here.length + (stage === "script" ? sections : 0);
117
+ if (k === 0)
118
+ continue;
119
+ const what = stage === "script" && sections > 0
120
+ ? [here.length ? `${here.length} note${here.length === 1 ? "" : "s"}` : "", `${sections} script section${sections === 1 ? "" : "s"}`].filter(Boolean).join(" and ")
121
+ : `${here.length} note${here.length === 1 ? "" : "s"}`;
122
+ // The films a tab's notes are on, by name, so the agent passes the right one to rushes_get_picks.
123
+ const films = [...new Set(here.map((n) => n.video).filter((v) => !!v))].map((v) => project.videos.find((x) => x.id === v)?.name ?? v);
124
+ counts.push(`${TAB_NAMES[stage]}: ${what}${films.length ? ` (${films.join(", ")})` : ""}`);
125
+ const extra = stage === "picture" ? formatLines(project, here) : [];
126
+ lines.push(`${TAB_NAMES[stage]}: ${[...extra, stepsFor(stage)].join(" ")}`);
127
+ }
128
+ const total = notes.length + sections;
129
+ const head = `Work through batch ${batchId} on ${project.name}: ${total} item${total === 1 ? "" : "s"} across ${counts.length} tabs. Each note says its tab (stage) and film (video); on an audio tab, pass that film to rushes_get_picks.`;
130
+ return [head, ...counts.map((c) => `- ${c}`), ...lines].join("\n");
93
131
  }
94
132
  export function latestBatch(file) {
95
133
  return file.batches[file.batches.length - 1];
@@ -32,6 +32,6 @@ export class CorruptFileError extends RushesError {
32
32
  }
33
33
  export class EmptyBatchError extends RushesError {
34
34
  constructor(stage) {
35
- super(`Nothing open on the ${stage} tab to send`, 409, "empty_batch", { stage });
35
+ super(stage === undefined ? "Nothing open to send" : `Nothing open on the ${stage} tab to send`, 409, "empty_batch", stage === undefined ? {} : { stage });
36
36
  }
37
37
  }
@@ -151,9 +151,9 @@ export function filmEvent(video, shelved) {
151
151
  const text = ["Film", quoted(video.name, ""), shelved ? "shelved" : "restored"].filter(Boolean).join(" ");
152
152
  return { area: "picture", kind: "film", merge: "replace", subject: video.id, text, video: video.id, version: null };
153
153
  }
154
- /** "3 notes sent from Picture"; on Script, "1 note and 2 script edits sent from Script". */
154
+ /** "3 notes sent from Picture"; on Script, "1 note and 2 script edits sent from Script"; from more than one tab, "5 notes sent from several tabs". */
155
155
  export function notesSentEvent(batch) {
156
- const tab = TAB_NAMES[batch.stage];
156
+ const tab = batch.stage === null ? "" : TAB_NAMES[batch.stage];
157
157
  const notes = batch.noteIds.length;
158
158
  const edits = batch.sectionIds.length;
159
159
  const what = notes && edits
@@ -161,7 +161,7 @@ export function notesSentEvent(batch) {
161
161
  : edits ? plural(edits, "script edit", "script edits") : plural(notes, "note", "notes");
162
162
  return {
163
163
  area: "notes", kind: "notes-sent", merge: "count", count: Math.max(1, notes + edits), subject: tab, tab: batch.stage,
164
- text: `${what} sent from ${tab}`,
164
+ text: `${what} sent from ${tab || "several tabs"}`,
165
165
  many: (n, subject) => `${plural(n, "note", "notes")} sent from ${subject || "several tabs"}`,
166
166
  };
167
167
  }
@@ -108,9 +108,23 @@ function resolveVersion(video, versionId) {
108
108
  throw new NotFoundError("version", versionId);
109
109
  return v;
110
110
  }
111
+ /** The words of a name or file name, lower-cased: "f3a SFX pass 3" and "f3a-sfx-v3.wav" both start with "f3a". */
112
+ const firstWord = (text) => text.replace(/\.[a-z0-9]{2,4}$/i, "").toLowerCase().match(/[a-z0-9]+/)?.[0] ?? "";
113
+ /**
114
+ * The film a variant is for when nobody said: the one film in play whose name starts with the same
115
+ * word as the variant's name or its file's name ("f3a One phone, four buttons" and "f3a SFX pass 3").
116
+ * With none matching, or more than one, no film: the variant then shows on every film, as it always has.
117
+ */
118
+ export function inferFilm(p, name, file) {
119
+ const words = new Set([firstWord(name), firstWord(basename(file))].filter((w) => w.length >= 2));
120
+ const films = p.videos.filter((v) => inPlay(v) && words.has(firstWord(v.name)));
121
+ return films.length === 1 ? films[0].id : undefined;
122
+ }
111
123
  const LANE_NAMES = { voice: "Voiceover", music: "Music", sfx: "Sound effects" };
112
124
  export function addVariant(p, input) {
113
- // §23: the cues first, so a cue refused for its file leaves the project untouched.
125
+ // The film and (§23) the cues first, so an unknown film or a cue refused for its file leaves the
126
+ // project untouched.
127
+ const video = input.video === undefined ? inferFilm(p, input.name, input.file) : resolveVideo(p, input.video).id;
114
128
  const cues = [];
115
129
  for (const c of input.cues ?? []) {
116
130
  const cue = { id: uniqueId(slugify(c.name), cues.map((x) => x.id)), name: c.name, t: c.t };
@@ -134,6 +148,8 @@ export function addVariant(p, input) {
134
148
  meta: input.description === undefined ? { ...input.meta } : { ...input.meta, description: input.description },
135
149
  cues,
136
150
  };
151
+ if (video !== undefined)
152
+ variant.video = video;
137
153
  lane.variants.push(variant);
138
154
  return { lane, variant };
139
155
  }
@@ -101,6 +101,10 @@ export const VariantSchema = fileObject({
101
101
  file: z.string().min(1),
102
102
  meta: z.record(z.string(), z.union([z.string(), z.number()])).default({}),
103
103
  cues: z.array(CueSchema).default([]),
104
+ // The film (video id) this read, bed or pass was made for: only that film's tabs list it. Absent
105
+ // on a variant made for every film, and on every older one, so an older project loads and writes
106
+ // back unchanged.
107
+ video: id.optional(),
104
108
  });
105
109
  export const LaneSchema = fileObject({
106
110
  id,
@@ -293,9 +297,19 @@ export function picksForVideo(picks, videoId) {
293
297
  const own = picks.videos[videoId];
294
298
  return { ...picks, lanes: { ...(own?.lanes ?? {}) }, levels: { ...(own?.levels ?? {}) }, sections: {}, videos: {} };
295
299
  }
300
+ /** The lanes one film hears: each keeps only the variants made for it or for every film, and a lane
301
+ * left with none is dropped. With no film named, every lane as it is. */
302
+ export function lanesForVideo(lanes, videoId) {
303
+ if (!videoId)
304
+ return lanes;
305
+ return lanes
306
+ .map((l) => ({ ...l, variants: l.variants.filter((v) => v.video === undefined || v.video === videoId) }))
307
+ .filter((l) => l.variants.length > 0);
308
+ }
296
309
  export const BatchSchema = fileObject({
297
310
  id,
298
- stage: StageSchema,
311
+ // The tab the batch's items all come from, or null when it spans tabs (Send to agent sends every tab).
312
+ stage: StageSchema.nullable(),
299
313
  noteIds: z.array(z.string()).default([]),
300
314
  sectionIds: z.array(z.string()).default([]),
301
315
  sentAt: z.string(),
package/dist/mcp/tools.js CHANGED
@@ -247,6 +247,11 @@ export function createMcpServer(ctx) {
247
247
  .max(200)
248
248
  .optional()
249
249
  .describe("One line on what this read, bed or pass is, shown on its lane card. Stored as meta.description, and wins over one given in meta."),
250
+ video: z
251
+ .string()
252
+ .min(1)
253
+ .optional()
254
+ .describe("The film (id or name) this read, bed or pass is for: only that film's Voiceover, Music, Sound effects and Mix list it. Rushes works the film out when the read, bed or pass's name or file name starts with the film's first word (\"f3a SFX pass 3\" for \"f3a One phone\"), but always give it in a project with more than one film. The reply carries a `warning` when it ended up on every film."),
250
255
  cues: z
251
256
  .array(z.object({
252
257
  name: z.string(),
@@ -311,7 +316,7 @@ export function createMcpServer(ctx) {
311
316
  }));
312
317
  server.registerTool("rushes_get_batch", {
313
318
  title: "Get a batch",
314
- description: "The batch the user sent with Send to agent (latest by default), with its notes and script sections. A note's `on` says what it's about: null on Picture or for the whole mix, \"<lane>/<variant>\" for a music bed, SFX pass or voice variant, \"<lane>/<variant>:<cue>\" for an SFX cue, \"vo\" for the VO lane on Mix. Older notes may carry a bare variant id, \"vo\" for the assembled read, \"<section>:<take>\" for a take, or a section id.",
319
+ description: "The batch the user sent with Send to agent (latest by default), with its notes and script sections. It holds every open note from every tab and every film in play: `stage` is the tab when they all came from one, or null when it spans tabs, and each note carries its own `stage` and `video`. A note's `on` says what it's about: null on Picture or for the whole mix, \"<lane>/<variant>\" for a music bed, SFX pass or voice variant, \"<lane>/<variant>:<cue>\" for an SFX cue, \"vo\" for the VO lane on Mix. Older notes may carry a bare variant id, \"vo\" for the assembled read, \"<section>:<take>\" for a take, or a section id.",
315
320
  inputSchema: { project, id: z.string().optional() },
316
321
  }, safe(async ({ project, id }) => (await ctx.client(project)).get(`/api/batches/${encodeURIComponent(id ?? "latest")}`)));
317
322
  server.registerTool("rushes_reply", {
@@ -2,7 +2,7 @@ import { Hono } from "hono";
2
2
  import { streamSSE } from "hono/streaming";
3
3
  import { z } from "zod";
4
4
  import { RushesError, InvalidError, NotFoundError } from "../core/errors.js";
5
- import { addFile, addFormat, addVariant, addVersion, ensureProjectIdOnce, lockPicture, noteInPlay, resolveCut, resolveVideo, setShots, shelveFilm, shotAt } from "../core/project.js";
5
+ import { addFile, addFormat, addVariant, addVersion, ensureProjectIdOnce, inPlay, lockPicture, noteInPlay, resolveCut, resolveVideo, setShots, shelveFilm, shotAt } from "../core/project.js";
6
6
  import { addTake, editSection, setSections } from "../core/script.js";
7
7
  import { addNote, applyReply, applyUserEdit, checkNoteFormat, filterNotes } from "../core/notes.js";
8
8
  import { FORMAT_ID_RE, MAX_FORMATS, isPictureSize, labelOfId, versionFormats } from "../core/formats.js";
@@ -24,7 +24,7 @@ import { GRAB_PATH, OUTSIDE_CUT_EXT, OUTSIDE_MEDIA_EXT, SCREENSHOT_PATH, content
24
24
  import { BRING_IN_MAX, FoundScanner, ffprobeDuration, foundAnnouncer } from "./found.js";
25
25
  import { candidatePaths, listAssets, fpsFor, screenshotName } from "./assets.js";
26
26
  import { osRevealer, osOpener, OPEN_SAFE_EXT } from "./reveal.js";
27
- import { LaneStageSchema, SectionStatusSchema, StageSchema, BoxSchema, PinSchema, FileKindSchema, MarkSchema, ProjectIdSchema, ShotSchema, LEVEL_MIN, LEVEL_MAX, LEVEL_STEP, picksForVideo } from "../core/schema.js";
27
+ import { LaneStageSchema, SectionStatusSchema, StageSchema, BoxSchema, PinSchema, FileKindSchema, MarkSchema, ProjectIdSchema, ShotSchema, LEVEL_MIN, LEVEL_MAX, LEVEL_STEP, lanesForVideo, picksForVideo } from "../core/schema.js";
28
28
  import { LABEL_MAX, oneLineOf } from "../core/labels.js";
29
29
  import { byOf, logBookFor } from "./logbook.js";
30
30
  import { BriefService } from "./brief.js";
@@ -33,7 +33,7 @@ import { buildState, planWarning } from "../core/plan.js";
33
33
  import { broughtInEvent, cutEvent, fileEvent, filmEvent, formatEvent, lineEvent, lockEvent, notesSentEvent, picksEvent, repliesEvent, scriptEvent, takeEvent, variantEvent, visualEvent, } from "../core/logEvents.js";
34
34
  import { LOG_AREAS, LOG_MAX, changeLogFileName, logText, recentChanges } from "../core/logText.js";
35
35
  import { defaultRunner, measureMix } from "./loudness.js";
36
- export const VERSION = "0.7.1";
36
+ export const VERSION = "0.7.3";
37
37
  async function body(c, schema) {
38
38
  let json;
39
39
  try {
@@ -135,6 +135,7 @@ const VariantBody = z.object({
135
135
  file: z.string().min(1),
136
136
  meta: z.record(z.string(), z.union([z.string(), z.number()])).optional(),
137
137
  description: z.string().min(1).max(200).optional(),
138
+ video: z.string().min(1).max(200).optional(),
138
139
  // §23.6: a cue's file has no length cap here. The 1024 limit applies to the stored (manifest) form,
139
140
  // which checkCueFile enforces with a 400 naming the cue.
140
141
  cues: z.array(z.object({ name: z.string().min(1), t, file: z.string().min(1).optional() })).optional(),
@@ -169,7 +170,8 @@ const PickMap = z.record(z.string(), z.string().nullable());
169
170
  const LevelValue = z.number().min(LEVEL_MIN).max(LEVEL_MAX).multipleOf(LEVEL_STEP);
170
171
  const LevelsBody = z.object({ voice: LevelValue.nullable(), music: LevelValue.nullable(), sfx: LevelValue.nullable() }).partial();
171
172
  const PicksBody = z.object({ video: z.string().min(1).max(200).optional(), lanes: PickMap.optional(), sections: PickMap.optional(), levels: LevelsBody.optional() });
172
- const BatchBody = z.object({ stage: StageSchema });
173
+ // No stage: every tab's open notes (Send to agent). A stage: that tab's only.
174
+ const BatchBody = z.object({ stage: StageSchema.optional() });
173
175
  const NoteQuery = z.object({
174
176
  stage: StageSchema.optional(),
175
177
  status: z.enum(["todo", "done"]).optional(),
@@ -669,7 +671,7 @@ export function createApp(store, opts = {}) {
669
671
  ...v,
670
672
  versions: await Promise.all(v.versions.map(async (ver) => ({ ...ver, proxyNeed: await jobs.needNow(fromManifestPath(store.root, ver.file)) }))),
671
673
  })));
672
- return c.json({ project: { ...project, videos }, script, notes, picks, batches, tabs, visuals, proxies: { ffmpeg, jobs: jobs.list() }, found: foundSummary, log: logHead, brief: briefView, storyboard: storyboardView, build: buildState({ brief: briefView, script: script.sections, storyboard: storyboardView }) });
674
+ return c.json({ version: VERSION, project: { ...project, videos }, script, notes, picks, batches, tabs, visuals, proxies: { ffmpeg, jobs: jobs.list() }, found: foundSummary, log: logHead, brief: briefView, storyboard: storyboardView, build: buildState({ brief: briefView, script: script.sections, storyboard: storyboardView }) });
673
675
  });
674
676
  // ---- found: the project's other files (§20) ----
675
677
  app.get("/api/found", async (c) => {
@@ -1128,7 +1130,15 @@ export function createApp(store, opts = {}) {
1128
1130
  const b = await body(c, VariantBody);
1129
1131
  // §23: a cue's file is stored as a manifest path, like the variant's own.
1130
1132
  const cues = b.cues?.map((q) => (q.file === undefined ? q : { ...q, file: toManifestPath(store.root, q.file) }));
1131
- const { result } = await store.update("project", (p) => addVariant(p, { ...b, cues, file: toManifestPath(store.root, b.file) }));
1133
+ const { result } = await store.update("project", (p) => {
1134
+ const added = addVariant(p, { ...b, cues, file: toManifestPath(store.root, b.file) });
1135
+ // With several films in play, a variant with no film shows on all of them: say so, so the agent names one.
1136
+ const films = p.videos.filter(inPlay).length;
1137
+ const warning = added.variant.video === undefined && films > 1
1138
+ ? `No film was named, and none could be told from the names, so this ${added.lane.stage === "voice" ? "read" : added.lane.stage === "music" ? "bed" : "pass"} shows on all ${films} films. Pass \`video\` (the film's id or name) to put it on one.`
1139
+ : undefined;
1140
+ return { ...added, ...(warning ? { warning } : {}) };
1141
+ });
1132
1142
  await log.add(() => variantEvent(result.lane, result.variant), by(c));
1133
1143
  return c.json(result, 201);
1134
1144
  });
@@ -1224,7 +1234,9 @@ export function createApp(store, opts = {}) {
1224
1234
  const b = await body(c, MixLoudnessBody);
1225
1235
  const [project, picks] = await Promise.all([store.read("project"), store.read("picks")]);
1226
1236
  const run = opts.loudnessRunner ?? defaultRunner;
1227
- const result = await measureMix(project, picksForVideo(picks, b.video), b.lanes, store.root, run, opts.loudnessTimeoutMs);
1237
+ // A film hears only its own reads, beds and passes, as its Mix tab plays them.
1238
+ const heard = { ...project, lanes: lanesForVideo(project.lanes, b.video) };
1239
+ const result = await measureMix(heard, picksForVideo(picks, b.video), b.lanes, store.root, run, opts.loudnessTimeoutMs);
1228
1240
  return c.json(result);
1229
1241
  });
1230
1242
  // ---- batches ----
@@ -181,6 +181,18 @@ export function anchorCut(p, film) {
181
181
  }
182
182
  return best;
183
183
  }
184
+ /** The film found audio is for: the named film, when it is one of this project's. Otherwise none, so
185
+ * every film lists it. */
186
+ function audioFilm(p, film) {
187
+ if (film === undefined)
188
+ return undefined;
189
+ try {
190
+ return resolveVideo(p, film).id;
191
+ }
192
+ catch {
193
+ return undefined;
194
+ }
195
+ }
184
196
  /** The film a found cut joins: the anchor cut's film, else the first film. Null with no films. */
185
197
  function filmFor(p, film) {
186
198
  return anchorCut(p, film)?.video.id ?? p.videos[0]?.id ?? null;
@@ -564,7 +576,8 @@ export class FoundScanner {
564
576
  if (picked.length === 0)
565
577
  return none();
566
578
  const reasons = new Map(picked.map((f) => [f.path, byPath.get(f.path)?.reasons ?? []]));
567
- const result = await this.bringInNow(picked.map((f) => ({ path: f.path, kind: f.kind })), { reasons, film, origin: "auto" });
579
+ // The current set was matched to the anchor cut, so it comes in for that cut's film.
580
+ const result = await this.bringInNow(picked.map((f) => ({ path: f.path, kind: f.kind })), { reasons, film: film ?? anchor?.video.id, origin: "auto" });
568
581
  // §22.5: what the current set brought in is one line, by Rushes (R8, R9); its variants are dated (R5).
569
582
  // Built inside add's guard, so a line that can't be made never undoes the bring-in (M1).
570
583
  const cut = anchor;
@@ -789,7 +802,7 @@ export class FoundScanner {
789
802
  return { reason: clash };
790
803
  const description = it.reasons.length > 0 ? it.reasons.join(" · ") : undefined;
791
804
  try {
792
- const { lane, variant } = addVariant(p, { stage: it.kind, round, name, file: it.rel, description });
805
+ const { lane, variant } = addVariant(p, { stage: it.kind, round, name, file: it.rel, description, video: audioFilm(p, film) });
793
806
  return { path: it.rel, kind: it.kind, lane: lane.id, variant: variant.id };
794
807
  }
795
808
  catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rushes",
3
- "version": "0.7.1",
3
+ "version": "0.7.3",
4
4
  "description": "A local review desk for video made with AI agents: timecoded notes, script edits and audio picks your agent can read and act on.",
5
5
  "keywords": [
6
6
  "video",
@@ -61,10 +61,10 @@ For stills, standalone images and carousels, register one visual per post with `
61
61
  - `rushes_add_version` for a render. Give every cut a short `label` (48 characters at most) saying what changed, and put the detail in `note`. If the cut is likely to play badly in a browser, the reply carries `proxySuggested: true` and `proxyReason`; Picture offers the user a proxy. Prefer H.264 MP4 to avoid this;
62
62
  - `rushes_add_format` for each other shape of a cut (a 9:16, 1:1 or 4:5 of the same edit): register every shape you rendered, main one first, or pass `formats: [{ file }]` to `rushes_add_version`. Its `label` is only a ratio hint such as 2.39:1, never the cut's short label;
63
63
  - `rushes_set_script` for the VO script. It merges by `id`, so send only the sections you changed; sections you leave out are kept. `rushes_get_script` reads the whole script;
64
- - `rushes_add_variant` for each voice read, music bed or SFX pass. Voice reads carry `stage: "voice"` and a `round` (its name — reads in one round are compared side by side; a new direction gets a new round); say what the read is, or what changed, in `description`. Music and SFX carry `meta.description` for their lane card, and SFX passes carry `cues` as `{name, t, file?}`: the same name each time a sound comes back, and `file` (an audio file) when you know which sample you placed;
64
+ - `rushes_add_variant` for each voice read, music bed or SFX pass, with `video` set to the film it is for (only that film's tabs list it; leave `video` out only for audio that is for every film). Voice reads carry `stage: "voice"` and a `round` (its name — reads in one round are compared side by side; a new direction gets a new round); say what the read is, or what changed, in `description`. Music and SFX carry `meta.description` for their lane card, and SFX passes carry `cues` as `{name, t, file?}`: the same name each time a sound comes back, and `file` (an audio file) when you know which sample you placed;
65
65
  - `rushes_set_shots` for the storyboard's shots, once you have the first cut; send new timings when a later cut moves them.
66
66
  2. Call `rushes_open` and tell the user it's ready, with what it brought in and what it left (below). Each project's dashboard lives at its own address, `/p/<id>/`.
67
- 3. When the user sends a batch, call `rushes_get_batch` and fix every note in it. A note carries the `shot` it falls in; on an audio stage, call `rushes_get_picks` first — on Mix it also returns `levels` (dB per lane), which you read, not set. Its `on` says what it's about: `"<lane>/<variant>"` for a bed, pass or voice read (on Voiceover the lane names the round), `"<lane>/<variant>:<cue>"` for an SFX cue, `"vo"` for the Mix VO lane, or `null` for the whole mix; older notes may carry a section id or `"<section>:<take>"`. On Music, Sound effects and Mix treat `marks` (e.g. "Fall", "Quieter 3 dB") as part of the note; Voiceover notes carry none — they're Whole (`Speaker`, `Pacing`, `Tone`, `Overall`) or Point (`Fix this`, `Keep this`) instead. A Picture note's `format` is null for every format, or a format id such as `"9x16"`: when it isn't null, fix only that format. Picks are set from the dashboard only — no tool or CLI command sets one.
67
+ 3. When the user sends a batch, call `rushes_get_batch` and fix every note in it. A batch holds every open note from every tab and film, so each note's own `stage` and `video` say where it belongs. A note carries the `shot` it falls in; on an audio stage, call `rushes_get_picks` first — on Mix it also returns `levels` (dB per lane), which you read, not set. Its `on` says what it's about: `"<lane>/<variant>"` for a bed, pass or voice read (on Voiceover the lane names the round), `"<lane>/<variant>:<cue>"` for an SFX cue, `"vo"` for the Mix VO lane, or `null` for the whole mix; older notes may carry a section id or `"<section>:<take>"`. On Music, Sound effects and Mix treat `marks` (e.g. "Fall", "Quieter 3 dB") as part of the note; Voiceover notes carry none — they're Whole (`Speaker`, `Pacing`, `Tone`, `Overall`) or Point (`Fix this`, `Keep this`) instead. A Picture note's `format` is null for every format, or a format id such as `"9x16"`: when it isn't null, fix only that format. Picks are set from the dashboard only — no tool or CLI command sets one.
68
68
  4. Register the new cut with `rushes_add_version`. On a locked video the reply carries a `warning`.
69
69
  5. Reply to all the notes in one `rushes_reply` call. For each note set `status: "done"`, a one-line `reply`, `fixT` (when the fix is visible in the new cut, in seconds) and `fixVersion`.
70
70
  6. For script batches: when a section's `proposed` differs from `current`, adopt it with `rushes_set_script`, sending just that section with its `id`. If voiceover already exists, re-record the picked voice with the corrected script and register it with `rushes_add_variant` as a new read in a new round.