rushes 0.10.1 → 0.12.0
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.
- package/.claude-plugin/plugin.json +1 -1
- package/AGENTS.md +14 -4
- package/README.md +14 -8
- package/dist/cli/demo.js +3 -2
- package/dist/cli/main.js +33 -1
- package/dist/core/agentRules.js +7 -0
- package/dist/core/balance.js +238 -0
- package/dist/core/batches.js +29 -11
- package/dist/core/exportNotes.js +4 -2
- package/dist/core/films.js +114 -0
- package/dist/core/log.js +35 -3
- package/dist/core/logEvents.js +7 -7
- package/dist/core/notes.js +19 -1
- package/dist/core/schema.js +69 -14
- package/dist/core/script.js +67 -0
- package/dist/core/tabs.js +15 -7
- package/dist/core/takes.js +1 -1
- package/dist/mcp/tools.js +90 -23
- package/dist/server/agent/adapters.js +39 -8
- package/dist/server/agent/rules.js +106 -9
- package/dist/server/agent/runner.js +135 -35
- package/dist/server/agent/setupOnce.js +44 -0
- package/dist/server/app.js +348 -65
- package/dist/server/assets.js +40 -14
- package/dist/server/balance.js +103 -0
- package/dist/server/brief.js +9 -7
- package/dist/server/files.js +3 -2
- package/dist/server/films.js +43 -0
- package/dist/server/found.js +2 -1
- package/dist/server/logbook.js +28 -2
- package/dist/server/plans.js +68 -0
- package/dist/server/record.js +31 -13
- package/dist/server/start.js +15 -7
- package/dist/server/storyboard.js +8 -6
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/skills/rushes/SKILL.md +4 -4
- package/web-dist/assets/{index-BIJlv6zN.css → index-BCYA0Awp.css} +1 -1
- package/web-dist/assets/index-LPvsS2vO.js +70 -0
- package/web-dist/index.html +2 -2
- package/web-dist/assets/index-D430jOsg.js +0 -70
|
@@ -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.
|
|
4
|
+
"version": "0.12.0",
|
|
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
|
@@ -55,7 +55,7 @@ When the user wants a new video ("start a new film", "make a launch video", "a n
|
|
|
55
55
|
2. **Interview, briefly.** Ask at most three questions, and only ones whose answer changes the film: length and formats, who it is for, tone. Give each a recommended answer with its trade-off ("30 seconds fits a feed; 60 leaves room for the demo"). Never send a list of ten.
|
|
56
56
|
3. **Write `brief.md`.** Its sections, in order, are Title, Purpose, Audience, Length and formats, Tone, Include and avoid, Built with, Open questions and References. Fill every one, keep the `Status: draft` line, and tell the user to open Plan › Brief in Rushes, change any section and press **Approve brief**. Rushes then sets `Status: approved` in the file itself. Never approve it yourself or change that line, and if they say it's approved in chat while the file still says `draft`, ask them to press Approve. When they press **Send** on the Brief page, read `brief.md` again and keep their wording: a section they changed shows "Edited by you" with your last version struck through beneath it, so read the file before you rewrite it.
|
|
57
57
|
4. **Script.** Add it with `rushes_set_script`. The user edits and approves each section in Plan › Script. Read `rushes_get_script` and wait until every section is `approved`.
|
|
58
|
-
5. **Storyboard.** Write `storyboard.md` in the project root: a `# Storyboard: <film>` title, then one section per shot, in this shape:
|
|
58
|
+
5. **Storyboard.** Write the film's storyboard (`storyboard.md` in the project root for the first film, `films/<film-id>/storyboard.md` for any other: see "More than one film" below): a `# Storyboard: <film>` title, then one section per shot, in this shape:
|
|
59
59
|
|
|
60
60
|
```markdown
|
|
61
61
|
## Shot 02 · Drop a folder
|
|
@@ -73,6 +73,16 @@ When the user wants a new video ("start a new film", "make a launch video", "a n
|
|
|
73
73
|
|
|
74
74
|
The brief and the storyboard are Markdown files the user reads and approves on their own pages under Plan. Use the same file names so the next session finds them.
|
|
75
75
|
|
|
76
|
+
### More than one film
|
|
77
|
+
|
|
78
|
+
A project can hold several films (each film is a `video`). Everything on the desk belongs to a film, and the user works on one film at a time: with a film selected, every tab shows only that film's material. Each film has its own script, brief and storyboard:
|
|
79
|
+
|
|
80
|
+
- **Brief and storyboard:** the project's first film keeps `brief.md` and `storyboard.md` at the project root. Every other film's are `films/<film-id>/brief.md` and `films/<film-id>/storyboard.md`. `rushes_status` gives every film's paths in `plans` (by film id); write each film's in its own place, and never put one film's shots in another's file. A film's first cut starts with its own storyboard's shots.
|
|
81
|
+
- **Script:** `rushes_set_script` and `rushes_get_script` take `film`.
|
|
82
|
+
- **Tools that read or write a film's material** (`rushes_status`, `rushes_set_script`, `rushes_get_script`, `rushes_add_take`, `rushes_list_notes`, `rushes_get_log`, `rushes_list_assets`) take `film`: the film's id or name. With one film you may leave it out; with several, leaving it out is an error that lists the films.
|
|
83
|
+
- **Visuals** are the project's, not a film's: they show on every film as shared.
|
|
84
|
+
- Nothing is on no film: a note, take or file that names none is the first film's.
|
|
85
|
+
|
|
76
86
|
## Picking up a film that's underway
|
|
77
87
|
|
|
78
88
|
When the user asks to open or review a film they started in the chat, or the project already has files but no `brief.md`, don't make them start again. Rebuild the plan from what you have, then say what you did.
|
|
@@ -115,14 +125,14 @@ The user can shelve a film they have set aside (**Shelve film** in the dashboard
|
|
|
115
125
|
- 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
126
|
- 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
127
|
- Music beds or SFX passes: `rushes_add_variant` with `stage` `music` or `sfx`, `video`, and `round` as for a voice read (each new batch of beds or passes is a round, e.g. "Round 2 · softer middle"). Give it `meta: {description: "..."}` (and `bpm`, `key` or `lufs` when you know them), shown in its details: the tooltip on its name in the tab's list of takes and the line its details button opens; 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 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 one film or several: pass its `video` (an id or name, or a list of them when one bed is fitted to several films) to `rushes_add_variant`, and the Voice, Music and Effects tabs (and the Timeline) list it only on those films. In a project with more than one film, one without a `video` is on no film
|
|
128
|
+
- Every voice read, music bed and SFX pass belongs to one film or several: pass its `video` (an id or name, or a list of them when one bed is fitted to several films) to `rushes_add_variant`, and the Voice, Music and Effects tabs (and the Timeline) list it only on those films. In a project with more than one film, one without a `video` whose film can't be told from its names goes on the first film (the reply carries a `warning`): nothing is on no film. The ones on other films wait, folded, under "Not on this film" on each film's tab. `rushes_set_films` (`lane`, `variant`, `videos`) moves an existing one; the user does the same from the **Films** button on its card. `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). Put a take only on the films it was fitted to: a read timed to one film's cut is that film's alone, even when another film shares its script (Red, 16 Nov 2026: earlier reads listed on a second film read as clutter from the wrong film). When a new cut changes a film's length or timing, fit its bed and effects to the new cut and add them as new takes on that film; until then, tell the user the bed in use was made for an older cut.
|
|
119
129
|
- 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.
|
|
120
130
|
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.
|
|
121
|
-
3. **Wait for feedback.** The user presses **Send**, at the foot of the notes panel, which saves a batch and gives them a prompt to paste to you. With **Send to AI** on, Rushes starts the user's own Claude Code or Codex with that prompt instead, and you may be that agent; then any note you leave with neither a done reply nor a question on it goes back to the user's to do when your turn ends.
|
|
131
|
+
3. **Wait for feedback.** The user presses **Send**, at the foot of the notes panel, which saves a batch and gives them a prompt to paste to you. With **Send to AI** on, Rushes starts the user's own Claude Code or Codex with that prompt instead, and you may be that agent; then any note you leave with neither a done reply nor a question on it goes back to the user's to do when your turn ends. What you may do without asking is the user's choice, one of four rows in Rushes's agent menu: **Manual** (every action asks the user in Rushes), **Accept edits** (file edits inside the project go through; commands ask unless an Always rule covers them), **Auto** (your own safety review decides, and Rushes sees only what you ask) or **Bypass** (nothing asks). Only the user sets it, in the menu; never try to change it, and never write the user's rules files under `~/.config/rushes/`. Under every row, leave `.rushes/` and `.git/` alone except through the Rushes tools. A batch is about one film: the film the user had selected when they pressed Send. It holds every open note from every tab on that film (plus any on the shared Visuals), and that film's changed script sections; its `stage` is the tab when everything came from one, or `null` when it spans tabs. `rushes_get_batch` names the batch's `film`: pass it to every tool that asks for one while you work the batch. Each note carries its own `stage` and `video`: fix each one on its own tab. 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 user gives you a line about each: at the end of the prompt they paste or, with **Send to AI** on, in a separate message they paste to you themselves, since those lines are not handed over with the batch yet.
|
|
122
132
|
4. **Fix each note.** Before you start on a note, call `rushes_working_on` with its `note` id and what you are doing in a few plain words (`doing`, 200 characters at most, e.g. "Moving the title up"): the user sees it on the note while you work. It is only for a note that was sent to you; any other is refused (`note_not_sent`). It shows only while Rushes is running you on a batch or an answer; otherwise (the user pasted the prompt to you) it is accepted and changes nothing. A note has `stage`, `scope` (`point`, `range` or `whole` — on every tab, a voice read included: a voice range note is about that stretch of the read), `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) — for a voice read 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 a mix note (stage `mix`, made on the Timeline tab) it's `null` for the whole mix, `"vo"` for the voice (the newest round with a pick), or `"<laneId>/<variantId>"` for the music or the effects. Older notes may carry a bare variant id, `"vo"` on a voice note 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. A music, sfx or mix 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. Voice notes carry no marks: a voice note is about the whole read (`scope: "whole"`), a point in it (`t`) or a range of it (`t` to `tOut`: replace or fix just that stretch), and its `text` says what to change. Older voice notes may begin with a word such as `Speaker`, `Pacing`, `Tone`, `Fix this` or `Keep this`, from quick-start buttons the dashboard no longer has.
|
|
123
133
|
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.
|
|
124
134
|
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`. Every note comes back with its `state`: `todo` (the user's, not sent yet), `sent` (in a batch the user sent: yours, and shown to them as "With your agent") or `done`. `rushes_list_notes` with `state: "sent"` lists everything you have been given and not finished, whichever batch it came in. A done note the user opens again is `todo` and goes out in their next batch.
|
|
125
|
-
7. **Audio batches.** For a note on the voice, the music, the effects or the mix (stage `mix` is the Timeline tab, where every take in use plays together), call `rushes_get_picks` first (pass the note's film as `video`: picks and levels are per film), so you know which read or variant is in use before you fix anything. It also returns `levels: { voice?, music?, sfx? }` in dB — where the user wants each sound to sit. Don't try to change these; they're set from the level on each sound's row of the Timeline tab and only tell you the balance the user has already chosen. Then fix each note:
|
|
135
|
+
7. **Audio batches.** For a note on the voice, the music, the effects or the mix (stage `mix` is the Timeline tab, where every take in use plays together), call `rushes_get_picks` first (pass the note's film as `video`: picks and levels are per film), so you know which read or variant is in use before you fix anything. It also returns `levels: { voice?, music?, sfx? }` in dB — where the user wants each sound to sit. Don't try to change these; they're set from the level on each sound's row of the Timeline tab and only tell you the balance the user has already chosen. When `balanced` is there and its `levels` equal `levels`, they are Rushes' house balance (§29: music level with the voice and clear of it on every spoken line, each effect just under the music around it), set by Balance or by itself when a take was put in use; a level that differs was moved by hand. Rushes balances a new take in use against the others by itself while the levels are still the balance's own, so render a new bed, pass or read at a sensible level rather than leaning on the fader: `rushes balance --voice F --music F --sfx F` runs the same rule on files (no server) and says how many dB each would move; aim for moves near 0, and re-render a take it says hit the end of the fader. A finished mix you render yourself applies `levels` on top of the takes, as Mix plays them. Then fix each note:
|
|
126
136
|
- **Voice:** register a new whole read with `rushes_add_variant` (`stage: "voice"`) — a new round for a new direction (another voice, a different tone), or the current round for a small fix to a marked word. Say in `description` what changed.
|
|
127
137
|
- **Music or effects:** make the new bed or pass the text and marks ask for, and register it as in step 1.
|
|
128
138
|
|
package/README.md
CHANGED
|
@@ -93,6 +93,8 @@ Rewrite a line, add a direction, flag it or approve it. Every line sits in a fie
|
|
|
93
93
|
|
|
94
94
|
Plan is one workspace, so planning never crowds the review. A switch at its top opens **Brief**, **Script** and **Storyboard**, each with a tick once it is approved and a dot while it has edits you haven't sent; key `1` comes back to the page you used last. **Brief** shows `brief.md` in your project folder, one field per section. Edit a section and Rushes writes it into the file; press **Approve brief** and it sets the file's status line. If your agent rewrites `brief.md`, the page follows without a reload. **Storyboard** works the same way over `storyboard.md`: a row per shot with its still (click it to enlarge), its description, a direction line and a tick to approve it. A line at the foot of each page counts what is approved and what you have edited. When the brief, every script line (if the film has a script) and every shot are approved, the Plan tab in the top bar shows a green check and the row above the page says **Ready to build**, with a prompt to copy. Rushes never stops your agent building before then: it only says what is still waiting.
|
|
95
95
|
|
|
96
|
+
In a project with several films, each film has its own brief, script and storyboard, and every tab shows only the film selected in the top bar (it is in the address, `?film=`, so a reload or a shared link keeps it). The first film keeps `brief.md` and `storyboard.md` at the project root; every other film's are in `films/<film-id>/`. Visuals are the one exception: they are campaign material, so they show on every film, marked **Shared**. Notes, takes and files from before a project had a second film are moved once to its first film.
|
|
97
|
+
|
|
96
98
|
### Voice: compare reads, round by round
|
|
97
99
|
|
|
98
100
|
<img src="docs/assets/screens/voiceover.jpg" alt="The Voice tab. Under the monitor, Round 2's read, Voice A slower, is In use, and Earlier lists Round 1's two reads, Voice A and Voice B, each with its waveform and description. In the notes panel, the note on Round 1's Voice A has a green tick and the agent's reply: Round 2 is Voice A at a slower pace." width="880">
|
|
@@ -138,7 +140,7 @@ Rushes keeps a running log of what happened, in the **Activity** tab of the note
|
|
|
138
140
|
## Why Rushes
|
|
139
141
|
|
|
140
142
|
- **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
|
-
- **Everything in one batch.** **Send** sends every open note from every tab
|
|
143
|
+
- **Everything in one batch.** **Send** sends every open note from every tab of the film you are on, wherever you press it, so nothing waits behind. In a project with several films, a batch is about one film.
|
|
142
144
|
- **Versions keep their history.** Notes follow the work from cut to cut, and you can lock picture when it's done.
|
|
143
145
|
- **Local, with no sign-up.** No account, no API key, nothing uploaded. It runs on your machine.
|
|
144
146
|
- **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.
|
|
@@ -297,7 +299,7 @@ Rushes never sees a password or key, and never signs you in. When an agent isn't
|
|
|
297
299
|
|
|
298
300
|
**The switch.** Above **Send**, a row reads **Send to AI** with the agent's name and a switch. On, Send files the batch as always and hands it to the agent: what it is doing shows on each note and in Activity, its questions arrive as replies on the note, and your answer goes back to it. Off, Send copies the prompt, as before. Under Send, one line says what the agent may do: "Edits files in this project, asks before commands" or "Asks before everything", and "next Send continues the conversation" when there is one to continue.
|
|
299
301
|
|
|
300
|
-
The first time you press Send, a sheet asks "Who should get these notes?" (an agent, or copy a prompt as before), then "What may <agent> do without asking?".
|
|
302
|
+
The first time you press Send, a sheet asks "Who should get these notes?" (an agent, or copy a prompt as before), then "What may <agent> do without asking?". It asks once per Mac, not once per project: your answer is kept as the default, and every new project starts from it, so Send goes straight to your agent there. The last choice you make in the sheet, the agent's menu or the switch turned on is the default; turning Send to AI off on one project leaves it as it is.
|
|
301
303
|
|
|
302
304
|
If the agent fails to start, the notes go back in to do and nothing is copied. If Send to AI is not set up, not signed in or not installed, Send opens the copy dialog with the prompt and says why, with **Set up**: once you finish the sheet it opens, the notes in that dialog go to the agent. A note says it is with the agent by name only while the agent has it. Lines about the brief and the storyboard are not handed to the agent yet: when they changed, Send hands over the notes and opens **Message for your agent** with those lines, saying the agent has the notes but not these lines, for you to copy to it yourself.
|
|
303
305
|
|
|
@@ -305,20 +307,24 @@ The agent's name opens a menu to choose another agent, **Start a fresh conversat
|
|
|
305
307
|
|
|
306
308
|
**New cuts.** When the agent adds a version and nothing holds the picture, the desk switches to it and a toast says so, such as "v3 is in". When something does (a cut or a sound playing on any tab, a note or mark you are making, or a locked picture), the picture stays where it is: the toast offers the cut with **Show**, and the **Cut** menu shows a dot until you look. The agent only adds a version when the picture or sound changed, and it is asked to wait for its commands to finish before it replies, so a run does not leave work going in the background.
|
|
307
309
|
|
|
308
|
-
**Permissions.**
|
|
310
|
+
**Permissions.** The agent's menu, and the sheet's second step, offer four rows, the same for Claude Code and Codex:
|
|
311
|
+
|
|
312
|
+
- **Manual** (always ask): every action asks.
|
|
313
|
+
- **Accept edits** (the default): the agent reads, edits, searches, moves and deletes files inside the project folder without asking. Commands, the network and anything outside the folder ask first, unless an Always rule covers them. The line under Send reads "Edits files in this project, asks before commands"; under Manual it reads "Asks before everything".
|
|
314
|
+
- **Auto** (the agent decides): the agent's own safety reviewer approves or refuses each step (Claude Code's auto mode, Codex's Auto review). Rushes sees only what the agent chooses to ask, and no longer guards `.rushes` and `.git`. If Claude Code's model can't run auto mode, Claude falls back to accepting edits and asking for commands, and Activity says so.
|
|
315
|
+
- **Bypass** (accepts everything): nothing asks and nothing is checked, `.rushes` and `.git` included. Picking it shows a one-line warning. It is never a default: a new project never starts in Bypass.
|
|
309
316
|
|
|
310
|
-
|
|
311
|
-
- **Ask me for everything**: every action asks.
|
|
317
|
+
A change of row applies from the next Send. A batch already running keeps the row it started in; the agent starts again (continuing the conversation) when the next Send needs another mode. Auto and Bypass are chosen only by you, in the menu or the sheet, never by anything in a project. Auto can be your default for new projects, like any row you pick; a brand-new Mac starts in Accept edits.
|
|
312
318
|
|
|
313
|
-
|
|
319
|
+
Under Manual and Accept edits, some folders and files in the project always ask, whatever "Always" rules you keep, even to read them: they hold settings, hooks or tokens. They are `.rushes/`, `.git/`, `.claude/`, `.codex/`, `.mcp.json`, `.vscode/` and `.idea/`. Moving or deleting the project folder itself always asks too.
|
|
314
320
|
|
|
315
321
|
An ask shows what the agent wants to do and the exact command, with **Allow once**, **Always** and **No**. It waits until you answer. It never turns into a yes by itself. When the agent asks, or ends a run with a question, and no Rushes tab is open, your Mac shows a notification saying the agent is waiting in this project.
|
|
316
322
|
|
|
317
323
|
Rushes sees only what the agent asks it. The agent's own permission settings, such as allow rules in Claude Code's settings, can still approve actions without asking, and Rushes never sees those.
|
|
318
324
|
|
|
319
|
-
With Codex, commands that write files or reach the network ask, but commands that only read, such as searches and listings, run without asking.
|
|
325
|
+
With Codex under Manual or Accept edits, commands that write files or reach the network ask, but commands that only read, such as searches and listings, run without asking.
|
|
320
326
|
|
|
321
|
-
**"Always" rules.** **Always** keeps a rule for this project, so the same request runs without asking next time. The button names the rule, such as "Always for npx hyperframes here". The agent's menu lists the rules, and you can remove any of them. Always rules are kept in your user settings, outside the project, so the agent cannot change them. The permission level, the rules, whether you have answered the first-Send sheet and which agent you turned Send to AI on for are in `~/.config/rushes/agent-rules/` (or under `$XDG_CONFIG_HOME`), one file per project. That agent is set only when you turn Send to AI on, in the sheet, the agent's menu or the switch. Copy a prompt and switching off clear it, and changing what it may do leaves it as it is. `.rushes/agent.json` keeps the project's switch, its agent and the conversation to continue. Nothing secret. Send hands notes to an agent only when that switch is on and its agent is the one in your file. Otherwise Send to AI shows as off and Send copies the prompt, so a project folder from someone else, or anything that writes `agent.json`, can't start an agent you didn't choose. A project set up with an earlier build asks once more.
|
|
327
|
+
**"Always" rules.** **Always** keeps a rule for this project, so the same request runs without asking next time. The button names the rule, such as "Always for npx hyperframes here". The agent's menu lists the rules, and you can remove any of them. Always rules are kept in your user settings, outside the project, so the agent cannot change them. The permission level, the rules, whether you have answered the first-Send sheet and which agent you turned Send to AI on for are in `~/.config/rushes/agent-rules/` (or under `$XDG_CONFIG_HOME`), one file per project. That agent is set only when you turn Send to AI on, in the sheet, the agent's menu or the switch. Copy a prompt and switching off clear it, and changing what it may do leaves it as it is. `.rushes/agent.json` keeps the project's switch, its agent and the conversation to continue. Nothing secret. Send hands notes to an agent only when that switch is on and its agent is the one in your file. Otherwise Send to AI shows as off and Send copies the prompt, so a project folder from someone else, or anything that writes `agent.json`, can't start an agent you didn't choose. A project set up with an earlier build asks once more. The default for new projects is `~/.config/rushes/agent-defaults.json` (the agent and what it may do, never Always rules, which stay per project). It is yours, outside every project, so nothing in a project can set it.
|
|
322
328
|
|
|
323
329
|
"Always" trusts one program and subcommand, such as `npx hyperframes`, `npm install` or `git commit`. Later commands that start with the same two words run without asking, whatever their other arguments. That trust covers whatever that program and subcommand can be told to run:
|
|
324
330
|
|
package/dist/cli/demo.js
CHANGED
|
@@ -5,7 +5,7 @@ import { join, resolve } from "node:path";
|
|
|
5
5
|
import { addVariant, addVersion, setShots, shotAt } from "../core/project.js";
|
|
6
6
|
import { addNote } from "../core/notes.js";
|
|
7
7
|
import { setInUse } from "../core/picks.js";
|
|
8
|
-
import { setSections } from "../core/script.js";
|
|
8
|
+
import { filmScriptDraft, setSections } from "../core/script.js";
|
|
9
9
|
import { toManifestPath } from "../core/paths.js";
|
|
10
10
|
import { Store } from "../core/store.js";
|
|
11
11
|
/** A `Runner` over `cmd`, via `child_process.spawn` with no shell. */
|
|
@@ -251,8 +251,9 @@ export async function makeDemo(dir, deps) {
|
|
|
251
251
|
{ id: "s3", start: 15, end: 22.5, current: "Notes, picks and a locked cut travel with the project, not a chat log." },
|
|
252
252
|
{ id: "s4", start: 22.5, end: 30, current: `${PRODUCT}: fewer rounds, and a cut everyone signed off on.` },
|
|
253
253
|
];
|
|
254
|
+
const filmsNow = await store.read("project");
|
|
254
255
|
await store.update("script", (s) => {
|
|
255
|
-
setSections(s, sections, { replace: true });
|
|
256
|
+
setSections(filmScriptDraft(s, filmsNow, videoId), sections, { replace: true });
|
|
256
257
|
});
|
|
257
258
|
// 3. Voice reads, two rounds: Round 1 compares two voices; Round 2 is one voice at a slower pace.
|
|
258
259
|
const scriptText = sections.map((s) => s.current).join(" ");
|
package/dist/cli/main.js
CHANGED
|
@@ -20,6 +20,9 @@ import { setup } from "../setup/setup.js";
|
|
|
20
20
|
import { realSetupEnv } from "../setup/env.js";
|
|
21
21
|
import { HARNESS_IDS } from "../setup/harnesses.js";
|
|
22
22
|
import { runDoctor, realDoctorEnv } from "./doctor.js";
|
|
23
|
+
import { balanceFiles } from "../server/balance.js";
|
|
24
|
+
import { ffmpegAvailable } from "../server/loudness.js";
|
|
25
|
+
import { balanceSummary } from "../core/balance.js";
|
|
23
26
|
export const HELP = `rushes ${VERSION}: a local review desk for video made with AI agents
|
|
24
27
|
|
|
25
28
|
Usage
|
|
@@ -60,6 +63,9 @@ Usage
|
|
|
60
63
|
rushes log add <text> [--area A] add a line to the Change Log
|
|
61
64
|
flags first; text that starts with "-" goes after --:
|
|
62
65
|
rushes log add --area mix -- "-3 dB on the bed"
|
|
66
|
+
rushes balance [--voice F] [--music F] [--sfx F] [--json]
|
|
67
|
+
the house balance for these files: how many dB to move the
|
|
68
|
+
music and effects so they sit against the voice (no server)
|
|
63
69
|
|
|
64
70
|
Options
|
|
65
71
|
--dir DIR project folder (default: current folder); where a command takes [dir], that wins
|
|
@@ -93,6 +99,10 @@ const OPTIONS = {
|
|
|
93
99
|
only: { type: "string" },
|
|
94
100
|
"dry-run": { type: "boolean" },
|
|
95
101
|
"idle-minutes": { type: "string" },
|
|
102
|
+
// §29: `balance --voice F --music F --sfx F`.
|
|
103
|
+
voice: { type: "string" },
|
|
104
|
+
music: { type: "string" },
|
|
105
|
+
sfx: { type: "string" },
|
|
96
106
|
// R17: `mcp --pinned`, the server Send to AI hands its agent: tools work on the given folder only.
|
|
97
107
|
pinned: { type: "boolean" },
|
|
98
108
|
help: { type: "boolean", short: "h" },
|
|
@@ -453,6 +463,26 @@ export async function main(argv, io) {
|
|
|
453
463
|
}
|
|
454
464
|
return usage(io, "rushes add version|format|variant|shots|file ...");
|
|
455
465
|
}
|
|
466
|
+
case "balance": {
|
|
467
|
+
// §29: the same rule the desk's Balance runs, on files, with no server: for the agent that makes the sound.
|
|
468
|
+
const files = Object.fromEntries(["voice", "music", "sfx"].filter((k) => o[k]).map((k) => [k, resolve(io.cwd, o[k])]));
|
|
469
|
+
if (Object.keys(files).length === 0)
|
|
470
|
+
return usage(io, "rushes balance [--voice FILE] [--music FILE] [--sfx FILE] [--json]");
|
|
471
|
+
if (!(await ffmpegAvailable())) {
|
|
472
|
+
io.err("ffmpeg isn't on PATH: install it to measure loudness.");
|
|
473
|
+
return 1;
|
|
474
|
+
}
|
|
475
|
+
const { levels, report } = await balanceFiles(files);
|
|
476
|
+
if (o.json)
|
|
477
|
+
io.out(JSON.stringify({ levels, report, summary: balanceSummary(report) }, null, 2));
|
|
478
|
+
else {
|
|
479
|
+
for (const k of ["voice", "music", "sfx"])
|
|
480
|
+
if (levels[k] !== undefined)
|
|
481
|
+
io.out(`${k.padEnd(6)} ${levels[k] > 0 ? "+" : ""}${levels[k]} dB`);
|
|
482
|
+
io.out(balanceSummary(report));
|
|
483
|
+
}
|
|
484
|
+
return 0;
|
|
485
|
+
}
|
|
456
486
|
case "lock": {
|
|
457
487
|
const [video, lockVersion] = rest;
|
|
458
488
|
if (!video || !lockVersion)
|
|
@@ -483,7 +513,9 @@ export async function main(argv, io) {
|
|
|
483
513
|
// What an audio note is on (M4) and a Picture note's format (§21.4, R4), from the state.
|
|
484
514
|
const state = notes.some((n) => n.stage !== "script" || n.on != null) ? await c.get("/api/state") : null;
|
|
485
515
|
for (const n of notes) {
|
|
486
|
-
|
|
516
|
+
// §31.3: a note on the script names a line of its own film's script.
|
|
517
|
+
const own = n.video ? state?.films?.[n.video]?.script : undefined;
|
|
518
|
+
const label = state ? onLabel(n, own ? { ...state, script: own } : state) : null;
|
|
487
519
|
const on = label ? `${stripControl(label)} ` : "";
|
|
488
520
|
const tag = state ? formatTag(n, state.project?.videos ?? []) : null;
|
|
489
521
|
const fmtCol = tag ? `${stripControl(tag)} ` : "";
|
package/dist/core/agentRules.js
CHANGED
|
@@ -173,9 +173,16 @@ export function canAlways(req, root) {
|
|
|
173
173
|
return inProject(req, root);
|
|
174
174
|
return kind !== "execute" || plainCommand(req.command ?? "");
|
|
175
175
|
}
|
|
176
|
+
/**
|
|
177
|
+
* Whether an ask the agent sent goes through unasked. Manual asks for everything. Accept edits allows edits in the
|
|
178
|
+
* project and the Always rules. In Auto the agent's own reviewer has already passed what it didn't send, and what it does
|
|
179
|
+
* send is treated as under Accept edits. Bypass allows everything (§33): nothing is checked, not even .rushes and .git.
|
|
180
|
+
*/
|
|
176
181
|
export function decide(req, s, root) {
|
|
177
182
|
if (s.permissions === "ask-all")
|
|
178
183
|
return "ask";
|
|
184
|
+
if (s.permissions === "bypass")
|
|
185
|
+
return "allow";
|
|
179
186
|
if (s.always.some((r) => matches(r, req, root)))
|
|
180
187
|
return "allow";
|
|
181
188
|
if (req.kind && PROJECT_KINDS.has(req.kind) && inProject(req, root))
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
// §29: the house balance. Given each take's loudness over time, how far to move the music and effects faders so the
|
|
2
|
+
// three sounds sit against each other: the voice rings true over the music on every spoken line, the music holds a set
|
|
3
|
+
// level, and every effect is heard, not hidden under the bed. Pure: the readings come from ffmpeg (server/balance.ts),
|
|
4
|
+
// and `rushes balance` runs the same rule on files for the agent that makes the sound.
|
|
5
|
+
//
|
|
6
|
+
// The numbers are calibrated by ear on Red's Meet your agents mix (19 Nov 2026): the music he settled on sits level
|
|
7
|
+
// with the voice's integrated loudness, the voice still clears it in the speech band on every line, and the effects
|
|
8
|
+
// pass he wanted heard needed about +10 dB, which puts each hit about 1 dB under the music around it.
|
|
9
|
+
import { LEVEL_MAX, LEVEL_MIN, LEVEL_STEP } from "./schema.js";
|
|
10
|
+
export const BALANCE = {
|
|
11
|
+
/** LU the music's integrated loudness sits under the voice's (0: level with it). */
|
|
12
|
+
musicUnderVoice: 0,
|
|
13
|
+
/** LU the voice must clear the music by, in the speech band, on every spoken line. */
|
|
14
|
+
voiceClearance: 1,
|
|
15
|
+
/** dB each effect's momentary peak sits under the music's short-term level around it. */
|
|
16
|
+
sfxUnderGroove: 1,
|
|
17
|
+
/** With no music in use: dB each effect's peak sits under the voice's integrated loudness. */
|
|
18
|
+
sfxUnderVoice: 6,
|
|
19
|
+
/** With no voice in use: the music's integrated loudness, LUFS. */
|
|
20
|
+
musicAlone: -20,
|
|
21
|
+
/** With neither: each effect's momentary peak, LUFS. */
|
|
22
|
+
sfxAlone: -20,
|
|
23
|
+
/** dBTP the balanced mix may peak at: over it, every sound comes down together (`trimmed`). */
|
|
24
|
+
peakCeiling: -1,
|
|
25
|
+
};
|
|
26
|
+
/** The band a voice is understood in: ffmpeg filters applied before measuring voice and music for clearance. */
|
|
27
|
+
export const SPEECH_BAND = { low: 300, high: 4000 };
|
|
28
|
+
const SILENT = -70;
|
|
29
|
+
const FRAME_S = 0.1;
|
|
30
|
+
const finite = (n) => typeof n === "number" && Number.isFinite(n) && n > SILENT;
|
|
31
|
+
const pow = (db) => 10 ** (db / 10);
|
|
32
|
+
const toDb = (p) => (p > 0 ? 10 * Math.log10(p) : -120);
|
|
33
|
+
/** Loudness of several readings together: their power averaged, not their dB. */
|
|
34
|
+
const energyMean = (dbs) => (dbs.length === 0 ? -120 : toDb(dbs.reduce((a, d) => a + pow(d), 0) / dbs.length));
|
|
35
|
+
/** The frames of a reading by index (frame i covers t ≈ (i + 1) × 0.1 s), so two takes line up frame for frame. */
|
|
36
|
+
function byIndex(frames) {
|
|
37
|
+
const out = new Map();
|
|
38
|
+
for (const f of frames)
|
|
39
|
+
out.set(Math.round(f.t / FRAME_S) - 1, f);
|
|
40
|
+
return out;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Where the voice speaks: frames within 20 LU of its integrated loudness, joined across pauses of 0.4 s or less, and
|
|
44
|
+
* at least 0.3 s long. A breath between words stays inside one line; a gap between sentences ends it.
|
|
45
|
+
*/
|
|
46
|
+
export function spokenLines(voice) {
|
|
47
|
+
if (!finite(voice.integrated))
|
|
48
|
+
return [];
|
|
49
|
+
const floor = Math.max(voice.integrated - 20, SILENT);
|
|
50
|
+
const lines = [];
|
|
51
|
+
let cur = null;
|
|
52
|
+
for (const f of voice.frames) {
|
|
53
|
+
if (f.m <= floor)
|
|
54
|
+
continue;
|
|
55
|
+
const i = Math.round(f.t / FRAME_S) - 1;
|
|
56
|
+
if (cur && f.t - cur.end <= 0.4 + 1e-9) {
|
|
57
|
+
cur.end = f.t;
|
|
58
|
+
cur.frames.push(i);
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
cur = { start: f.t, end: f.t, frames: [i] };
|
|
62
|
+
lines.push(cur);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return lines.filter((l) => l.end - l.start >= 0.3 - 1e-9);
|
|
66
|
+
}
|
|
67
|
+
/** The effects in a pass: everything within 30 dB of the pass's loudest moment (and above -60 LUFS). */
|
|
68
|
+
export function effectHits(sfx) {
|
|
69
|
+
const loudest = Math.max(-120, ...sfx.frames.map((f) => f.m));
|
|
70
|
+
if (loudest <= SILENT)
|
|
71
|
+
return [];
|
|
72
|
+
const floor = Math.max(loudest - 30, -60);
|
|
73
|
+
const hits = [];
|
|
74
|
+
let cur = null;
|
|
75
|
+
for (const f of sfx.frames) {
|
|
76
|
+
if (f.m <= floor)
|
|
77
|
+
continue;
|
|
78
|
+
const i = Math.round(f.t / FRAME_S) - 1;
|
|
79
|
+
if (cur && f.t - cur.end <= 0.3 + 1e-9) {
|
|
80
|
+
cur.end = f.t;
|
|
81
|
+
if (f.m > cur.peak)
|
|
82
|
+
Object.assign(cur, { peak: f.m, t: f.t, index: i });
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
cur = { t: f.t, index: i, peak: f.m, end: f.t };
|
|
86
|
+
hits.push(cur);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return hits.map(({ t, index, peak }) => ({ t, index, peak }));
|
|
90
|
+
}
|
|
91
|
+
const median = (xs) => {
|
|
92
|
+
const s = [...xs].sort((a, b) => a - b);
|
|
93
|
+
return s.length === 0 ? null : s.length % 2 ? s[(s.length - 1) / 2] : (s[s.length / 2 - 1] + s[s.length / 2]) / 2;
|
|
94
|
+
};
|
|
95
|
+
/** A fader setting: on the 0.5 dB step and inside the fader's range. */
|
|
96
|
+
export function toLevel(db) {
|
|
97
|
+
const stepped = Math.round(db / LEVEL_STEP) * LEVEL_STEP;
|
|
98
|
+
return Math.min(LEVEL_MAX, Math.max(LEVEL_MIN, stepped)) + 0; // + 0: never -0
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* The house balance for whichever of voice, music and effects are in use. The voice stays at 0 dB: it is the
|
|
102
|
+
* reference. Music is set level with the voice (BALANCE.musicUnderVoice), then pulled back if the voice would clear it
|
|
103
|
+
* by less than BALANCE.voiceClearance in the speech band on any spoken line. Effects are set so the median hit peaks
|
|
104
|
+
* BALANCE.sfxUnderGroove dB under the music's short-term level at that moment (after the music's own move). A sound
|
|
105
|
+
* that is silent, or wasn't read, gets no level.
|
|
106
|
+
*/
|
|
107
|
+
export function balance(takes) {
|
|
108
|
+
const levels = {};
|
|
109
|
+
const clamped = [];
|
|
110
|
+
const set = (stage, db) => {
|
|
111
|
+
const level = toLevel(db);
|
|
112
|
+
if (db > LEVEL_MAX + LEVEL_STEP / 2 || db < LEVEL_MIN - LEVEL_STEP / 2)
|
|
113
|
+
clamped.push(stage);
|
|
114
|
+
levels[stage] = level;
|
|
115
|
+
return level;
|
|
116
|
+
};
|
|
117
|
+
const voice = takes.voice && finite(takes.voice.full.integrated) ? takes.voice : undefined;
|
|
118
|
+
const music = takes.music && finite(takes.music.full.integrated) ? takes.music : undefined;
|
|
119
|
+
const sfx = takes.sfx && takes.sfx.full.frames.some((f) => f.m > SILENT) ? takes.sfx : undefined;
|
|
120
|
+
const report = { voice: voice ? voice.full.integrated : null, music: null, sfx: null, clamped, trim: 0 };
|
|
121
|
+
if (voice)
|
|
122
|
+
levels.voice = 0;
|
|
123
|
+
// ---- music ----
|
|
124
|
+
let musicGain = 0;
|
|
125
|
+
if (music) {
|
|
126
|
+
const mI = music.full.integrated;
|
|
127
|
+
if (voice) {
|
|
128
|
+
const vI = voice.full.integrated;
|
|
129
|
+
let want = vI - BALANCE.musicUnderVoice - mI;
|
|
130
|
+
let by = "voice";
|
|
131
|
+
const margins = clearances(voice, music);
|
|
132
|
+
if (margins.length > 0) {
|
|
133
|
+
const closest = Math.min(...margins);
|
|
134
|
+
const limit = closest - BALANCE.voiceClearance;
|
|
135
|
+
if (limit < want) {
|
|
136
|
+
want = limit;
|
|
137
|
+
by = "clearance";
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
musicGain = set("music", want);
|
|
141
|
+
report.music = { level: musicGain, by, clearance: margins.length > 0 ? round1(Math.min(...margins) - musicGain) : null };
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
musicGain = set("music", BALANCE.musicAlone - mI);
|
|
145
|
+
report.music = { level: musicGain, by: "alone", clearance: null };
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
// ---- effects ----
|
|
149
|
+
if (sfx) {
|
|
150
|
+
const hits = effectHits(sfx.full);
|
|
151
|
+
const groove = music ? byIndex(music.full.frames) : null;
|
|
152
|
+
const vI = voice ? voice.full.integrated : null;
|
|
153
|
+
let by = music ? "music" : voice ? "voice" : "alone";
|
|
154
|
+
const moves = hits.map((h) => {
|
|
155
|
+
const g = groove?.get(h.index)?.s;
|
|
156
|
+
// A hit where the music is silent (before it starts, say) is set against the voice, or the set level.
|
|
157
|
+
if (finite(g))
|
|
158
|
+
return g + musicGain - BALANCE.sfxUnderGroove - h.peak;
|
|
159
|
+
if (vI !== null)
|
|
160
|
+
return vI - BALANCE.sfxUnderVoice - h.peak;
|
|
161
|
+
return BALANCE.sfxAlone - h.peak;
|
|
162
|
+
});
|
|
163
|
+
const move = median(moves);
|
|
164
|
+
if (move !== null) {
|
|
165
|
+
if (music && hits.every((h) => !finite(groove?.get(h.index)?.s)))
|
|
166
|
+
by = voice ? "voice" : "alone";
|
|
167
|
+
report.sfx = { level: set("sfx", move), hits: hits.length, by };
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return { levels, report };
|
|
171
|
+
}
|
|
172
|
+
/** On each spoken line: how far the voice is over the music in the speech band, LU, with the music at 0 dB. */
|
|
173
|
+
function clearances(voice, music) {
|
|
174
|
+
if (!voice.band || !music.band)
|
|
175
|
+
return [];
|
|
176
|
+
const vb = byIndex(voice.band.frames);
|
|
177
|
+
const mb = byIndex(music.band.frames);
|
|
178
|
+
return spokenLines(voice.full).map((line) => {
|
|
179
|
+
const v = energyMean(line.frames.map((i) => vb.get(i)?.m ?? -120));
|
|
180
|
+
const m = energyMean(line.frames.map((i) => mb.get(i)?.m ?? -120));
|
|
181
|
+
return v - m;
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
const round1 = (n) => Math.round(n * 10) / 10;
|
|
185
|
+
/**
|
|
186
|
+
* A balance brought down so the mix peaks at BALANCE.peakCeiling at most: every sound by the same amount (rounded up to
|
|
187
|
+
* the fader's step), voice included, so they still sit the same against each other. `truePeak` is the balanced mix's,
|
|
188
|
+
* dBTP. Unchanged when it is under the ceiling or unknown.
|
|
189
|
+
*/
|
|
190
|
+
export function trimmed(b, truePeak) {
|
|
191
|
+
if (truePeak === null || !Number.isFinite(truePeak) || truePeak <= BALANCE.peakCeiling)
|
|
192
|
+
return b;
|
|
193
|
+
const by = Math.ceil((truePeak - BALANCE.peakCeiling) / LEVEL_STEP) * LEVEL_STEP;
|
|
194
|
+
const levels = {};
|
|
195
|
+
for (const stage of ["voice", "music", "sfx"])
|
|
196
|
+
if (b.levels[stage] !== undefined)
|
|
197
|
+
levels[stage] = toLevel(b.levels[stage] - by);
|
|
198
|
+
const { music, sfx } = b.report;
|
|
199
|
+
return {
|
|
200
|
+
levels,
|
|
201
|
+
report: { ...b.report, music: music && { ...music, level: levels.music }, sfx: sfx && { ...sfx, level: levels.sfx }, trim: -by },
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
const signed = (n) => `${n > 0 ? "+" : n < 0 ? "\u2212" : ""}${Math.abs(n)} dB`;
|
|
205
|
+
/** What a balance did, in a sentence or two, for the desk's toast, the agent and the CLI. */
|
|
206
|
+
export function balanceSummary(r) {
|
|
207
|
+
const parts = [];
|
|
208
|
+
if (r.music) {
|
|
209
|
+
const why = r.music.by === "alone" ? "at the set level, with no voice in use"
|
|
210
|
+
: r.music.by === "clearance" ? `held back so the voice clears it by ${BALANCE.voiceClearance} LU on every line`
|
|
211
|
+
: "level with the voice";
|
|
212
|
+
parts.push(`Music ${signed(r.music.level)}, ${why}.`);
|
|
213
|
+
}
|
|
214
|
+
if (r.sfx) {
|
|
215
|
+
const against = r.sfx.by === "music" ? "just under the music around them" : r.sfx.by === "voice" ? "under the voice" : "at the set level";
|
|
216
|
+
parts.push(`Effects ${signed(r.sfx.level)}: ${r.sfx.hits} ${r.sfx.hits === 1 ? "hit" : "hits"} ${against}.`);
|
|
217
|
+
}
|
|
218
|
+
if (parts.length === 0)
|
|
219
|
+
parts.push(r.voice !== null ? "Only the voice is in use: nothing to balance against it." : "Nothing in use to balance.");
|
|
220
|
+
if (r.trim < 0)
|
|
221
|
+
parts.push(`Everything ${signed(r.trim)} so the mix doesn't clip.`);
|
|
222
|
+
if (r.clamped.length > 0)
|
|
223
|
+
parts.push(`${r.clamped.map((s) => NAMES[s]).join(" and ")} hit the end of the fader: that take needs re-rendering at a different level.`);
|
|
224
|
+
return parts.join(" ");
|
|
225
|
+
}
|
|
226
|
+
const NAMES = { voice: "Voice", music: "Music", sfx: "Effects" };
|
|
227
|
+
/**
|
|
228
|
+
* The per-frame lines of an ebur128 run (`t: 1.2 TARGET:-23 LUFS M: -20.1 S: -22.3 ...`). `-inf` and `nan` read as
|
|
229
|
+
* silence.
|
|
230
|
+
*/
|
|
231
|
+
export function parseFrames(stderr) {
|
|
232
|
+
const out = [];
|
|
233
|
+
const num = (s) => (s === "-inf" || s === "nan" || s === "inf" ? -120 : Number(s));
|
|
234
|
+
for (const m of stderr.matchAll(/\bt:\s*([\d.]+)\s+TARGET:[^\n]*?\bM:\s*(-?inf|nan|-?[\d.]+)\s+S:\s*(-?inf|nan|-?[\d.]+)/g)) {
|
|
235
|
+
out.push({ t: Number(m[1]), m: num(m[2]), s: num(m[3]) });
|
|
236
|
+
}
|
|
237
|
+
return out;
|
|
238
|
+
}
|
package/dist/core/batches.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { chipOrder, versionFormats } from "./formats.js";
|
|
2
2
|
import { STAGES } from "./schema.js";
|
|
3
|
+
import { noteOnFilm } from "./films.js";
|
|
3
4
|
import { EmptyBatchError } from "./errors.js";
|
|
4
5
|
import { noteInPlay } from "./project.js";
|
|
5
6
|
import { moveNote, noteState } from "./noteState.js";
|
|
@@ -16,13 +17,17 @@ const STAGE_NAMES = {
|
|
|
16
17
|
};
|
|
17
18
|
/**
|
|
18
19
|
* Gather open, unsent items into a batch: to-do notes with no batch yet, and changed or flagged
|
|
19
|
-
* script sections. With a stage, only that tab's; with none (Send), every tab's
|
|
20
|
-
*
|
|
21
|
-
*
|
|
20
|
+
* script sections. With a stage, only that tab's; with none (Send), every tab's. A batch whose items
|
|
21
|
+
* all come from one tab is that tab's batch; one that spans tabs has no stage.
|
|
22
|
+
*
|
|
23
|
+
* §31.2.2: with a film, only that film's notes (and the visuals', which are on every film) and that film's script
|
|
24
|
+
* (`ctx.script` is that film's), and the batch carries the film. With none (a project with no film yet, or an older
|
|
25
|
+
* caller), every note on every film in play, as before.
|
|
22
26
|
*/
|
|
23
27
|
export function createBatch(ctx, stage, now = new Date()) {
|
|
28
|
+
const film = ctx.video ?? null;
|
|
24
29
|
// §26: a shelved film is never asked about; its open notes stay unsent.
|
|
25
|
-
const notes = ctx.notes.notes.filter((n) => (stage === undefined || n.stage === stage) && noteState(n) === "todo" && noteInPlay(n, ctx.project));
|
|
30
|
+
const notes = ctx.notes.notes.filter((n) => (stage === undefined || n.stage === stage) && noteState(n) === "todo" && noteInPlay(n, ctx.project) && noteOnFilm(n, film, ctx.project.videos));
|
|
26
31
|
const sections = stage === undefined || stage === "script" ? ctx.script.sections.filter((s) => isChanged(s) || s.status === "flagged") : [];
|
|
27
32
|
if (notes.length === 0 && sections.length === 0)
|
|
28
33
|
throw new EmptyBatchError(stage);
|
|
@@ -40,8 +45,9 @@ export function createBatch(ctx, stage, now = new Date()) {
|
|
|
40
45
|
sectionIds: sections.map((s) => s.id),
|
|
41
46
|
sentAt: now.toISOString(),
|
|
42
47
|
prompt: only
|
|
43
|
-
? buildPrompt(ctx.project.name, only, id, notes.length, sections.length, only === "picture" ? formatLines(ctx.project, picture) : [])
|
|
44
|
-
: buildWidePrompt(ctx.project, id, notes, sections.length),
|
|
48
|
+
? buildPrompt(ctx.project.name, only, id, notes.length, sections.length, only === "picture" ? formatLines(ctx.project, picture) : [], filmName(ctx.project, film))
|
|
49
|
+
: buildWidePrompt(ctx.project, id, notes, sections.length, film),
|
|
50
|
+
...(film ? { video: film } : {}),
|
|
45
51
|
};
|
|
46
52
|
ctx.batches.batches.push(batch);
|
|
47
53
|
return batch;
|
|
@@ -97,19 +103,29 @@ function stepsFor(stage) {
|
|
|
97
103
|
? '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.'
|
|
98
104
|
: "Use rushes_get_batch, fix each note, then rushes_reply with a fixT for each and rushes_add_version for the new cut.";
|
|
99
105
|
}
|
|
100
|
-
|
|
106
|
+
/** §31.2.2: the film a batch is about, by name, in a project with more than one film (with one, nothing changes). */
|
|
107
|
+
function filmName(project, film) {
|
|
108
|
+
if (!film || project.videos.length < 2)
|
|
109
|
+
return null;
|
|
110
|
+
return project.videos.find((v) => v.id === film)?.name ?? film;
|
|
111
|
+
}
|
|
112
|
+
/** The words that say which film a batch is about, and that it is about that film alone. */
|
|
113
|
+
const filmLine = (name) => `This batch is about the film "${name}" only: its notes and script are that film's. Pass "${name}" as the film wherever a tool asks for one.`;
|
|
114
|
+
export function buildPrompt(project, stage, batchId, notes, sections, extra = [], film = null) {
|
|
101
115
|
const parts = [];
|
|
102
116
|
if (notes)
|
|
103
117
|
parts.push(`${notes} note${notes === 1 ? "" : "s"}`);
|
|
104
118
|
if (sections)
|
|
105
119
|
parts.push(`${sections} script section${sections === 1 ? "" : "s"}`);
|
|
106
|
-
|
|
120
|
+
const on = film ? `${project} › ${film}` : project;
|
|
121
|
+
return `Work through ${STAGE_NAMES[stage]} batch ${batchId} on ${on}: ${parts.join(" and ")}.\n${[...(film ? [filmLine(film)] : []), ...extra, stepsFor(stage)].join("\n")}`;
|
|
107
122
|
}
|
|
108
123
|
/**
|
|
109
124
|
* The prompt for a batch that spans tabs: what is in it, tab by tab with the films each tab's notes
|
|
110
125
|
* are on, then what to do on each tab.
|
|
111
126
|
*/
|
|
112
|
-
export function buildWidePrompt(project, batchId, notes, sections) {
|
|
127
|
+
export function buildWidePrompt(project, batchId, notes, sections, video = null) {
|
|
128
|
+
const film = filmName(project, video);
|
|
113
129
|
const lines = [];
|
|
114
130
|
const counts = [];
|
|
115
131
|
for (const stage of STAGES) {
|
|
@@ -127,8 +143,10 @@ export function buildWidePrompt(project, batchId, notes, sections) {
|
|
|
127
143
|
lines.push(`${TAB_NAMES[stage]}: ${[...extra, stepsFor(stage)].join(" ")}`);
|
|
128
144
|
}
|
|
129
145
|
const total = notes.length + sections;
|
|
130
|
-
const head =
|
|
131
|
-
|
|
146
|
+
const head = film
|
|
147
|
+
? `Work through batch ${batchId} on ${project.name} › ${film}: ${total} item${total === 1 ? "" : "s"} across ${counts.length} tabs. Each note says its tab (stage); on an audio tab, pass the film to rushes_get_picks.`
|
|
148
|
+
: `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.`;
|
|
149
|
+
return [head, ...(film ? [filmLine(film)] : []), ...counts.map((c) => `- ${c}`), ...lines].join("\n");
|
|
132
150
|
}
|
|
133
151
|
export function latestBatch(file) {
|
|
134
152
|
return file.batches[file.batches.length - 1];
|
package/dist/core/exportNotes.js
CHANGED
|
@@ -48,7 +48,9 @@ function noteTime(t, tOut) {
|
|
|
48
48
|
function continued(text, indent) {
|
|
49
49
|
return text.split("\n").join(`\n${indent}`);
|
|
50
50
|
}
|
|
51
|
-
function noteLines(n,
|
|
51
|
+
function noteLines(n, base, videos) {
|
|
52
|
+
// §31.3: a note on the script names a line of its own film's script.
|
|
53
|
+
const ctx = base.scriptOf ? { ...base, script: base.scriptOf(n.video) } : base;
|
|
52
54
|
// What an audio note is on (M4): "Music · Warm keys", "S2 · Take 1", "Whole mix" ...
|
|
53
55
|
const label = onLabel(n, ctx);
|
|
54
56
|
const on = label ? ` · ${label}` : "";
|
|
@@ -95,7 +97,7 @@ function byTimecode(a, b) {
|
|
|
95
97
|
* escaped (this is a file, not HTML), and the same input always produces the same string.
|
|
96
98
|
*/
|
|
97
99
|
export function notesMarkdown(project, notes, now, script = { sections: [] }, picks, visuals) {
|
|
98
|
-
const ctx = { project, script, picks };
|
|
100
|
+
const ctx = typeof script === "function" ? { project, script: { sections: [] }, scriptOf: script, picks } : { project, script, picks };
|
|
99
101
|
// §26: a shelved film has no section; its notes are kept in the project and come back when it is restored.
|
|
100
102
|
notes = notes.filter((n) => noteInPlay(n, project));
|
|
101
103
|
const lines = [`# ${project.name} — notes`, `Exported ${localDateTime(now)}`];
|