rushes 0.6.0 → 0.6.2

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.6.0",
4
+ "version": "0.6.2",
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
@@ -101,7 +101,7 @@ When the user makes stills, standalone images or carousels (posts), register the
101
101
 
102
102
  The user drags to mark a region on the picture, clicks for a point, or adds a note for the whole image, and sends a batch. `rushes_get_batch` and `rushes_list_notes` return each Visuals note with a `visual` object: the visual's id and name, its `version`, the `page`, the `ratio` as a label (null when the note is for every ratio), the `shape` (`region`, `pin` or `image`), the `region` or `pin` as fractions of the picture, `words` saying where it is ("left third, top third"), and the `file` to open. A note with no ratio is for every ratio: say in your reply which ratios you fixed.
103
103
 
104
- To answer feedback, change the marked pictures and register the result as a new version of the same visual: call `rushes_add_visual` with `visual` (its id or name) and `pages` listing only the pages that changed or are new, each with its `n`; every other page, and any ratio of a listed page you leave out, carries over from the version before. Pages can be added at the end and never removed. Then `rushes_reply` to each note with `fixVersion` set to that version. You never mark a note done: the user does, with the tick. Rushes keeps each note on the version it was made on, and shows it as "from v1" beside the newer one.
104
+ To answer feedback, change the marked pictures and register the result as a new version of the same visual: call `rushes_add_visual` with `visual` (its id or name) and `pages` listing only the pages that changed or are new, each with its `n`; every other page, and any ratio of a listed page you leave out, carries over from the version before. Pages can be added at the end and never removed. Then `rushes_reply` to each note you fixed with `status: "done"`, a one-line `reply` and `fixVersion` set to that version, as on every other tab. A note you did not fix stays `todo`, with the reason in `reply`. The user can open a note again with the tick. Rushes keeps each note on the version it was made on, and shows it as "from v1" beside the newer one.
105
105
 
106
106
  ## The loop
107
107
 
@@ -83,7 +83,7 @@ export function buildPrompt(project, stage, batchId, notes, sections, extra = []
83
83
  '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. The picks\' levels say where the user wants each lane to sit.'
84
84
  : stage === "visuals"
85
85
  ? // §25.5: the note's picture is named in the batch; the new picture goes in as a new version of the visual.
86
- "Use rushes_get_batch: each note names its visual, version, page and aspect ratio, where on the picture it is (a region or a point, as fractions and in words) and the file to open. Change each marked picture, register the result as a new version with rushes_add_visual (send only the pages that changed), then rushes_reply to each note with fixVersion set to that version. A note with no ratio is for every ratio: say in your reply which ratios you fixed."
86
+ "Use rushes_get_batch: each note names its visual, version, page and aspect ratio, where on the picture it is (a region or a point, as fractions and in words) and the file to open. Change each marked picture, register the result as a new version with rushes_add_visual (send only the pages that changed), then rushes_reply to each note you fixed with status \"done\" and fixVersion set to that version. A note with no ratio is for every ratio: say in your reply which ratios you fixed."
87
87
  : AUDIO_STAGES.includes(stage)
88
88
  ? '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.'
89
89
  : "Use rushes_get_batch, fix each note, then rushes_reply with a fixT for each and rushes_add_version for the new cut.";
@@ -19,8 +19,40 @@ function gif(b) {
19
19
  }
20
20
  /** The start-of-frame markers, which carry the size: every one from C0 to CF except the three that are not frames. */
21
21
  const isFrame = (m) => m >= 0xc0 && m <= 0xcf && m !== 0xc4 && m !== 0xc8 && m !== 0xcc;
22
+ /**
23
+ * The EXIF orientation (1 to 8) in an APP1 segment whose data starts at `at` and is `len` bytes long, or 1 when there is none
24
+ * or it cannot be read. Only IFD0's orientation tag (0x0112) is looked at, and nothing is read outside the segment.
25
+ */
26
+ function exifOrientation(b, at, len) {
27
+ const end = Math.min(b.length, at + len);
28
+ if (!ascii(b, at, "Exif") || b[at + 4] !== 0 || b[at + 5] !== 0)
29
+ return 1;
30
+ const tiff = at + 6;
31
+ const little = ascii(b, tiff, "II");
32
+ if (!little && !ascii(b, tiff, "MM"))
33
+ return 1;
34
+ const u16 = (o) => (little ? u16le(b, o) : u16be(b, o));
35
+ const u32 = (o) => (little ? (u16le(b, o) | (u16le(b, o + 2) << 16)) >>> 0 : u32be(b, o));
36
+ if (tiff + 8 > end || u16(tiff + 2) !== 42)
37
+ return 1;
38
+ const ifd = tiff + u32(tiff + 4);
39
+ if (ifd + 2 > end)
40
+ return 1;
41
+ const count = Math.min(u16(ifd), 256);
42
+ for (let i = 0; i < count; i++) {
43
+ const entry = ifd + 2 + i * 12;
44
+ if (entry + 12 > end)
45
+ return 1;
46
+ if (u16(entry) === 0x0112) {
47
+ const value = u16(entry + 8);
48
+ return value >= 1 && value <= 8 ? value : 1;
49
+ }
50
+ }
51
+ return 1;
52
+ }
22
53
  function jpeg(b) {
23
54
  let at = 2;
55
+ let orientation = 1;
24
56
  while (at + 4 <= b.length) {
25
57
  if (b[at] !== 0xff)
26
58
  return null;
@@ -29,8 +61,16 @@ function jpeg(b) {
29
61
  at++;
30
62
  continue;
31
63
  }
32
- if (isFrame(marker))
33
- return b.length >= at + 9 ? sized(u16be(b, at + 7), u16be(b, at + 5), "jpeg") : null;
64
+ if (isFrame(marker)) {
65
+ if (b.length < at + 9)
66
+ return null;
67
+ const [width, height] = [u16be(b, at + 7), u16be(b, at + 5)];
68
+ // A browser draws a picture stored on its side turned upright, so its shape is the turned one (EXIF orientations 5 to 8).
69
+ return orientation >= 5 ? sized(height, width, "jpeg") : sized(width, height, "jpeg");
70
+ }
71
+ // Another APP1 segment (XMP, say) says nothing about orientation and must not undo what the EXIF one said.
72
+ if (marker === 0xe1)
73
+ orientation = [exifOrientation(b, at + 4, u16be(b, at + 2) - 2), orientation].find((o) => o !== 1) ?? 1;
34
74
  at += 2 + u16be(b, at + 2);
35
75
  }
36
76
  return null;
package/dist/mcp/tools.js CHANGED
@@ -187,7 +187,7 @@ export function createMcpServer(ctx) {
187
187
  }));
188
188
  server.registerTool("rushes_add_visual", {
189
189
  title: "Add a visual",
190
- description: "Register a still, a standalone image or a carousel so the user can mark it up in the Visuals tab: one visual per post. A new visual (`name`) lists every page in order, each page with its pictures, one per aspect ratio (a png, jpg, webp or gif inside the project; Rushes reads each ratio from the picture's own size). A new version of a visual you already registered (`visual`: its id or name) lists only the pages that changed or are new, each with its page number `n`; every other page, and every ratio of a listed page you leave out, carries over from the version before. Pages can be added at the end and never removed; a new aspect ratio needs a picture on every page. After feedback, fix the marked pictures, register them as a new version, then rushes_reply to each note with fixVersion set to that version (you never mark a note done: the user does). Returns the visual, the version (v1, v2 ...), the page count and the ratios. A notes batch for Visuals (rushes_get_batch) names each note's visual, version, page, ratio and where on the picture it is, with the file to open. Refused, with the reason and nothing changed: a picture outside the project or that is a link, one that is not an image or cannot be read, two pictures of one ratio on a page, pages that disagree about their ratios, a name already used, and a page that is missing for a ratio.",
190
+ description: "Register a still, a standalone image or a carousel so the user can mark it up in the Visuals tab: one visual per post. A new visual (`name`) lists every page in order, each page with its pictures, one per aspect ratio (a png, jpg, webp or gif inside the project; Rushes reads each ratio from the picture's own size). A new version of a visual you already registered (`visual`: its id or name) lists only the pages that changed or are new, each with its page number `n`; every other page, and every ratio of a listed page you leave out, carries over from the version before. Pages can be added at the end and never removed; a new aspect ratio needs a picture on every page. After feedback, fix the marked pictures, register them as a new version, then rushes_reply to each note you fixed with status \"done\" and fixVersion set to that version, as on every other tab (the user can open a note again); leave a note you did not fix as todo and say why in the reply. Returns the visual, the version (v1, v2 ...), the page count and the ratios. A notes batch for Visuals (rushes_get_batch) names each note's visual, version, page, ratio and where on the picture it is, with the file to open. Refused, with the reason and nothing changed: a picture outside the project or that is a link, one that is not an image or cannot be read, two pictures of one ratio on a page, pages that disagree about their ratios, a name already used, and a page that is missing for a ratio.",
191
191
  inputSchema: {
192
192
  project,
193
193
  name: z.string().trim().min(1).max(80).optional().describe("A new visual's name, e.g. \"Launch carousel\". Give this or `visual`, not both."),
@@ -33,7 +33,7 @@ import { buildState, planWarning } from "../core/plan.js";
33
33
  import { broughtInEvent, cutEvent, fileEvent, 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.6.0";
36
+ export const VERSION = "0.6.2";
37
37
  async function body(c, schema) {
38
38
  let json;
39
39
  try {
@@ -1229,10 +1229,14 @@ export function createApp(store, opts = {}) {
1229
1229
  // ---- visuals (§25) ----
1230
1230
  app.post("/api/visuals", async (c) => {
1231
1231
  const b = await body(c, VisualBody);
1232
- // Every picture is read first, in the order given, so a refusal always names the first one and writes nothing.
1232
+ // Every picture is read first, one after the other in the order given, so a refusal always names the first bad one and writes nothing.
1233
1233
  const pages = [];
1234
- for (const p of b.pages)
1235
- pages.push({ n: p.n, files: await Promise.all(p.files.map((f) => readPicture(store.root, f))) });
1234
+ for (const p of b.pages) {
1235
+ const files = [];
1236
+ for (const f of p.files)
1237
+ files.push(await readPicture(store.root, f));
1238
+ pages.push({ n: p.n, files });
1239
+ }
1236
1240
  const { result } = await store.update("visuals", (f) => b.name !== undefined ? registerVisual(f, { name: b.name, kind: b.kind, label: b.label, pages }) : addVisualVersion(f, { visual: b.visual, label: b.label, pages }));
1237
1241
  await log.add(() => visualEvent(result.visual, { id: result.version.id, note: "", file: "", label: result.version.label }), by(c));
1238
1242
  return c.json({ visual: { id: result.visual.id, name: result.visual.name, kind: result.visual.kind }, version: { id: result.version.id, label: result.version.label }, pages: result.version.pages.length, ratios: visualRatios(result.version).map(labelOfId) }, 201);
@@ -16,7 +16,8 @@ const refuse = (code, message, file) => {
16
16
  function inProject(root, file) {
17
17
  const abs = isAbsolute(file) ? normalize(file) : resolve(root, file);
18
18
  const rel = relative(root, abs);
19
- if (rel === "" || rel.startsWith("..") || isAbsolute(rel))
19
+ // "..cover.png" is a name inside the project; only ".." itself or ".." as a path part leads out of it.
20
+ if (rel === "" || rel === ".." || rel.startsWith(".." + sep) || isAbsolute(rel))
20
21
  return null;
21
22
  return rel.split(sep).join("/");
22
23
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rushes",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
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",
@@ -49,7 +49,7 @@ When a user starts briefing in the chat, offer to keep `brief.md` up to date as
49
49
 
50
50
  ## Visuals
51
51
 
52
- For stills, standalone images and carousels, register one visual per post with `rushes_add_visual`: a `name` and `pages`, each page with its pictures, one per aspect ratio, in every aspect ratio the post comes in (Rushes reads each ratio from the picture). The user marks a region, a point or the whole image in the Visuals tab and sends a batch; each note names its visual, version, page, ratio, where on the picture it is (`words`) and the `file` to open. A note with no ratio is for every ratio. Fix the pictures, register a new version with `rushes_add_visual` (`visual` and only the pages that changed, each with `n`), then `rushes_reply` to each note with `fixVersion` set to it. You never mark a note done. The full contract is in `AGENTS.md`.
52
+ For stills, standalone images and carousels, register one visual per post with `rushes_add_visual`: a `name` and `pages`, each page with its pictures, one per aspect ratio, in every aspect ratio the post comes in (Rushes reads each ratio from the picture). The user marks a region, a point or the whole image in the Visuals tab and sends a batch; each note names its visual, version, page, ratio, where on the picture it is (`words`) and the `file` to open. A note with no ratio is for every ratio. Fix the pictures, register a new version with `rushes_add_visual` (`visual` and only the pages that changed, each with `n`), then `rushes_reply` to each note you fixed with `status: "done"` and `fixVersion` set to it (a note you did not fix stays `todo`, with the reason in `reply`). The full contract is in `AGENTS.md`.
53
53
 
54
54
  ## Reviewing and fixing
55
55