@rig-c/review 1.1.1 → 1.2.1

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/docs/DESIGN.md CHANGED
@@ -67,7 +67,7 @@ The single review page is one inspection workspace: a left column, the stage, th
67
67
  - **Rig fields.** In Setup, after Bones: `#rig-fields` (#110). The producer config's small fields as patch ops at their own pointers (`src/rig-fields.ts`, `web/rig-fields-panel.ts`): a rigid part's bone (`/regions/<part>`, a select), a lash's blink still row (`/motion/blink/still/<part>`, a dashed line across the part dragged in whole rig px), a stop's inward / outward bounds (`/stops/<i>`, two filled arcs at the pivot around a dashed rest aim, their ends dragged in whole degrees), an inherit mode per bone (`/bones/<i>/inherit`, a chain's `link_inherit`) and `turn`'s pivot and per-part depth (`/turn/pivot`, `/turn/depths/<part>`, sliders). Stage handles live in `#rig-fields-stage` over the rig viewport (tokens `--rv-field-still`, `-inward`, `-inward-line`, `-outward`, `-outward-line`, `-rest`, `-handle-bg`, `-ink`; the stage stays dark, so both blocks carry the same values). The turn dial holds the drawn build's `turn` bone at x through play's `adjust`, composed with the idle preview, and shows `#rig-fields-dial-label` (*preview — Apply decides*); it is never recorded. Apply is the generic runner's whole-rig `rig` op behind the reproduced baseline; the readout quotes `BLINK_NO_HOLE` and `FEET_STAY_LEVEL` before and after, and **Angle range** runs one #108 reading. Adding a stop and `turn.deform` are out of scope.
68
68
  - **Cloth.** In Setup, after Cuts: `#cloth-panel` (#111). One form per cloth tag the installed reader accepts (`bottomwear`, `back hair`, `front hair` — its own `CLOTH_TARGETS`), holding the recipe's fields as the config states them; each change is a patch op at `/cloth/<tag>/…` (`src/cloth-recipe.ts`, `web/cloth-panel.ts`). **Show links** draws, in rig px of the setup pose, every chain the tag's parts are meshed on from the config's `points` and `tip`, and after an Apply the chains of the config the producer wrote (one label per set). Apply runs `rig-parts propose --cloth --write-config` on the declared parts, painting and keypoints, then builds the written config (`build` when the config declares `limbs`, else `rig --config`) and reloads it under the stage's Environment. Review never merges the producer's draft: it reads only the written config, lists where it differs from its input and refuses one that differs outside the drafted sections. Hand-editing the drafted constraints is the physics block's, after the draft.
69
69
  - **Mesh edit.** In Setup only, the view bar's **Edit mesh** toggle (`#mesh-edit`, `aria-pressed`) opens `#mesh-editor-bar`: sub-modes Modify / Create / Delete / Edges (keys `V` / `C` / `X` / `E`, one pressed), Undo, Redo, Reset, Download JSON and **Apply · Rebuild** (#135: `rig-parts remesh --delta` through the shared runner, the revision loaded in place, the producer's refusal verbatim; while a delta revision is on the stage Reset returns to the inspected build). A package without the compiled model document refuses `MESH_EDIT_MODEL_UNAVAILABLE` and does not open; whole rig refuses `MESH_EDIT_SELECT_SLOT`; a non-mesh or linked-mesh slot `MESH_EDIT_NO_MESH <slot>`. It edits in setup space (#100): the attachment's stored provenance in the model document (`src/setup-mesh.ts`) and geometry from Play's public `readSetupMesh` (`web/setup-pose.ts`, shared with Weights) and drawn over the paused stage with the stage camera. It records a typed delta (`src/mesh-edit.ts`, `basis: "setup"`, the shape `rig-parts remesh --delta` reads) and previews it over the original triangulation on the overlay; Delete removes only constraint edges the delta added (the triangulation is the producer's); it is not a mesher and never retriangulates, writes the package or runs a producer. The chest editor and mesh edit are exclusive: turning one on turns the other off.
70
- - **Inspector.** Two sections and no tab row: **Setup** is the mesh-review composition (selected part, part presets, the modeling-review proposals for mesh density, contour curvature and chest position) and holds no control that seeks or plays; **Animate** has the transport with the Repeat idle toggle, frame navigation, the motion-review proposals and angle inspection with its axis panel, sound cues and report events. Their element ids and saved section names (`rig`, `playback`) are unchanged. Each section opens with a sticky block row (`.block-row`, `web/inspector-blocks.ts`): Setup — Part · Modeling · Chest · Mesh · Weights · Bones · Fields; Animate — Transport (with frame navigation, motion tools and the angle panel) · Sound · Environment · Physics · Idle tracks · Readings · Report, in document order. A button scrolls its block to just under the row inside the section and marks it `aria-current`; the active block then follows scrolling (IntersectionObserver; at the end of the section the last visible block). The row is one line that scrolls sideways when narrow. The active block per section is the only thing the row adds to the inspection draft (`ui.inspectorBlocks`); the scroll offset stays with the Inspector scroll memory, and the control protocol and saved-view link are unchanged. A saved `view` or `feedback` section from older links and drafts restores without selecting a section or opening the dialog.
70
+ - **Inspector.** Two sections and no section tab row: **Setup** is the mesh-review composition (selected part, part presets, the modeling-review proposals for mesh density, contour curvature and chest position) and holds no control that seeks or plays; **Animate** has the transport with the Repeat idle toggle, frame navigation, the motion-review proposals and angle inspection with its axis panel, sound cues and report events. Their element ids and saved section names (`rig`, `playback`) are unchanged. Each section opens with a sticky block row (`.block-row`, `web/inspector-blocks.ts`), a WAI-ARIA tablist: Setup — Part · Modeling · Chest · Mesh · Weights · Bones · Fields · Cuts · Cloth; Animate — Transport (the motion tools and the angle panel) · Sound · Environment · Physics · Idle tracks · Readings · Requirements · Retarget · Report, in document order. Animate's timeline is its own panel beside the blocks, not a tab. Each `role=tab` button controls the `role=tabpanel` block it names: selecting it shows that block alone and hides the others (`hidden`; a block a tab carries, such as the angle panel, by `data-block-hidden`, so its own `hidden` stays its own), and nothing scrolls between blocks. Arrow keys, Home and End move between tabs and select as they go. Hiding writes nothing inside a block, so drafts, pending edits and stage overlays such as the chest editor's are kept while their tab is hidden, and each block keeps its own scroll offset for the session. The row is one line that scrolls sideways when narrow. The active tab per section is the only thing the row adds to the inspection draft (`ui.inspectorBlocks`); the section's scroll offset stays with the Inspector scroll memory, and the control protocol and saved-view link are unchanged. A saved `view` or `feedback` section from older links and drafts restores without selecting a section or opening the dialog.
71
71
  - **Review dialog.** A native modal `<dialog id="review-dialog">` holds the former Feedback section unchanged (review status, reviewed source with the read-only source-file list, selected checkpoint, structured feedback, frame-strip export; every element id kept) and the **Submit review** button (`#save`). **Write review**, a part's or a proposal tool's Add feedback opens it with `showModal()` and pauses playback; Escape or Close dismisses it and focus returns to **Write review**. Its inputs stay in the document while it is closed, so the draft mechanism (autosave, recovery, conflict handling) is unchanged and closing loses nothing. The modal makes the rest of the page inert, so the dialog repeats the footer's message and draft state in its own status line; the footer keeps reporting both.
72
72
  - **Footer.** Message (truncated, full text as tooltip) on the left; player, effective layout, renderer, layers, idle, remote control and draft state in the middle; the numeric view region (behind **View region**) and the source hash on the right. The View region body is a `position:fixed` popover above the 40px footer, right-aligned, its width and height clamped to the viewport and its content scrolling inside, so the footer's clipping never hides it and opening it never scrolls the page.
73
73
 
package/docs/PANELS.md CHANGED
@@ -271,18 +271,18 @@ Rig pixels are the whole figure's frame, which is the crop frame the model's sta
271
271
  **Apply · Rebuild** runs the installed producer on the designated regions and reloads the result on the stage, so the loop is point → rebuild → watch → repeat → submit. Review builds no mesh itself and never runs a manifest command:
272
272
 
273
273
  - **Producer.** `@rig-c/parts`' `rig-parts`, resolved the way `rigc review` resolves `rig-review`: `node_modules/@rig-c/parts/package.json` in the nearest directory walking up from the package, then from the directory `rig-review open` was run in; its `bin` entry is read from that manifest, never from `PATH`. The compiler is resolved walking up from `rig-parts`' own package: `@rig-c/core` first, then legacy `rig-c` only when the scoped package is absent. The selected package name and version are reported as `compiler`. Absent: `MODELING_PRODUCER_NOT_INSTALLED: … — bun add -d @rig-c/parts`; older than the first release with `remesh` (1.40.0): `MODELING_PRODUCER_TOO_OLD <found> 1.40.0`. Review never installs anything.
274
- - **Inputs.** The producer handoff (`docs/REVIEW_PACKAGE.md`, *Producer handoff*): `open --config` (and `--parts`), else the review.json `producer` block, else `config.json`, then `rig/config.json` inside the opened folder, then `../config.json` beside an opened `out/`. The parts directory defaults to `out/` beside the config and holds `parts.json`, `parts/` and the inspected `rig/`. The editor bar shows, before any Apply, how the config was found (declared, discovered, or discovered outside the opened folder), its path and SHA-256, and the baseline. Without a handoff the bar shows `MODELING_INPUT_UNAVAILABLE: config.json — looked at …` and Apply refuses `MODELING_HANDOFF_MISSING`, naming `--config`. The request carries only `{part, regions, configHash}`; the server reads the config, replaces `meshes.<part>.contour.regions` with the designated regions (every other field as written) and runs `rig-parts remesh --rig <out>/rig --config <config> --parts <out> --part <part> --mesh mesh.json --out revision`, then `rigc build --profile rig-play --pack` with the revision's own `--page-edges` / `--pack-shape`, both with the scratch directory as working directory. A region row with equal semi-axes and no clip is sent as the config's circle, any other as the 32-sample polygon. An untouched editor starts from the config's own circle regions and contour numbers.
274
+ - **Inputs.** The producer handoff (`docs/REVIEW_PACKAGE.md`, *Producer handoff*): `open --config` (and `--parts`), else the review.json `producer` block, else `config.json`, then `rig/config.json` inside the opened folder, then `../config.json` beside an opened `out/`. The parts directory defaults to `out/` beside the config and holds `parts.json`, `parts/` and the inspected `rig/`. The editor bar shows, before any Apply, how the config was found (declared, discovered, or discovered outside the opened folder), its path and SHA-256, and the baseline. Without a handoff the bar shows `MODELING_INPUT_UNAVAILABLE: config.json — looked at …` and Apply refuses `MODELING_HANDOFF_MISSING`, naming `--config`. The request carries only `{part, regions, configHash}`; the server reads the config, replaces `meshes.<part>.contour.regions` with the designated regions (every other field as written; on an entry that states only `contour.bust`, the rows seeded from it replace the shorthand too, since the producer refuses `bust_r` / `bust_l` stated twice, `CONFIG_REGION_NAME_UNIQUE`) and runs `rig-parts remesh --rig <out>/rig --config <config> --parts <out> --part <part> --mesh mesh.json --out revision`, then `rigc build --profile rig-play --pack` with the revision's own `--page-edges` / `--pack-shape`, both with the scratch directory as working directory. A region row with equal semi-axes and no clip is sent as the config's circle, any other as the 32-sample polygon. An untouched editor starts from the config's own circle regions and contour numbers, from the contour part that states `contour.bust` when one does (its two derived circles when it writes no regions), else the first with a region the editor can read. The part rebuilt is the contour part whose regions, read as the producer reads them (written regions, then the circles derived from `contour.bust`), name the rows' bones, else the only contour part; otherwise Apply refuses `REBUILD_PART_AMBIGUOUS`.
275
275
  - **Baseline.** Once per session, when the handoff and the producer both resolve, review runs `rig-parts rig --config <config> --parts <parts> --out <state>/baseline/<key>/baseline` and compares every file it writes (rig.json, motion.json, mesh_report.json, sets.json, images/*) with the inspected rig directory: `baseline: reproduced — rig.json <hash> = inspected <hash>`, or `baseline: not reproduced — <first differing path> · <what Apply can still do here>`. The key is the package hash, the handoff record and the producer versions (no clock), so a reopen reuses the result. Ops that rebuild the whole rig refuse `EDIT_BASELINE_MISMATCH <path>` unless the baseline reproduced; `remesh` keeps its own `REMESH_BASELINE_MISMATCH`. A build the config does not reproduce — a hand repair — is not open to every Apply (#148): retune carries a **mesh** repair over but holds every image, so a repair that redrew an image refuses every physics and idle edit (`RETUNE_REQUEST_HELD: images/<part>.png`); remesh from a config entry refuses the repaired parts and re-fits the others; a mesh edit is held to the inspected mesh, not the config; and remesh, its mesh edit and retune all refuse an inspected `rig.json` (or `mesh_report.json`, `motion.json`) that is not the writer's text (`…_INPUT_WRITTEN` — re-serialise it as rig writes it, JSON with one space of indent and a closing newline, in a copy). The baseline line and `EDIT_BASELINE_MISMATCH` name which of these hold here, and a producer refusal review can explain carries `review: …` after the producer's own line (docs/REVIEW_PACKAGE.md, *Baseline reach*). Once it reproduces, `rig-parts check` runs on the baseline output in the background (into `<state>/baseline/<key>/inspected-check/`, with Apply's default `--page-edges free --pack-shape polygon`) and its summary is stored beside the baseline record as `inspected-check.json`; that is the physics readout's BEFORE for the inspected build, and a reopen reads it instead of re-running.
276
276
  - **Scratch.** `<state>/rebuild/<package source hash>/<designation hash>/` under `RIG_REVIEW_STATE_DIR` (refused, by its canonical location, inside the package, its build root or the handoff root), named from the package, the config bytes, the part, the entry and both tool versions — no clock. The same designation again reuses its build and says so; a new one replaces the previous scratch build on the stage (the earlier applied records' builds are kept beside the scratch root for undo, at most eight per package). The inspected package's files are only read.
277
277
  - **Watching.** The producer's lines stream into the editor bar (the latest line and a short log); a refusal shows the producer's first named line verbatim (for example `FAIL REMESH_REQUEST_HELD: …`) and the stage is unchanged. On success the compiled scratch build (served read-only under `/rebuild/<id>/`, its model and pages hashed) replaces the drawn rig in place with the same camera, animation, time and part set; playback resumes with physics when it was running. **Reset** returns the stage to the inspected build. **Undo last Apply** (the *Applied records* list at the top of the Inspector, its depth in the label) returns the stage to the previous applied build, or to the inspected build when none is left; a predecessor whose build was evicted re-runs its recorded step and must come back byte for byte, else `UNDO_PREDECESSOR_CHANGED: <what>` (docs/REVIEW_PACKAGE.md, *Undo across Applies*). A change to the handoff config ends the session's undo stack (reopen): Undo is then refused `FRONT_INSTANCE_EXPIRED`. The Cuts and Cloth blocks mark a pending op applied only while the record on the stage holds it, so after an undo they show the predecessor's ops as applied, and none on the inspected build. The mark shows what the build on the stage carries, not every op applied so far: while a cloth build is on the stage, the Cuts block marks nothing. Whenever the stage holds an applied edit from another panel or job kind, each panel shows a plain-words statement beside its Apply button before the click (`This rebuild starts from the handoff and drops: …`), and after a second panel applies, the superseded panel stops reading as applied while keeping its in-panel edits for re-Apply.
278
278
  - **Record.** The last applied state (`rig-review-applied/1`: part, regions, for a Landmarks Apply also `bust` — the entry as sent, with `regions` its two derived circles — config hash, entry SHA-256, producer and compiler versions, the producer's line and the scratch model's SHA-256) stays in the inspection draft, and feedback added while that build is on the stage carries it as `context.applied`. The review's `reviewedSource` still names the inspected build.
279
279
  - **Config patch.** The same loop takes any config edit as data: `POST /api/rebuild {patch}` with a `rig-review-config-patch/1` document (JSON Pointer ops over the handoff config, refused `EDIT_PATCH_STALE` when made against other config bytes) rebuilds the whole rig (`rig`) or one part (`remesh`) into scratch, compiles it and runs `rig-parts check` on it; the page's `window.rigReviewEditor.applyPatch(patch)` streams, reloads and resets like Apply, and the draft and `context.applied` carry `rig-review-applied/2` (the patch, its hash, the producer's line, check's summary and the diff of every document the producer writes, per file, with the images by hash). Schema and refusals: `docs/REVIEW_PACKAGE.md`, *Config patch and Apply*.
280
280
 
281
- The editor's values are the fields of Setup's **Chest regions · detail** block (R is region 1, L is region 2), which also holds what the bar does not: per region a name, a bone chosen from the loaded model's actual bones, the two semi-axes, a spacing and an optional medial clip x, plus the contour settings (tolerance, margin, spacing, max edge, stray, bridges). Setting R in the bar writes both semi-axes. A region with equal semi-axes and no clip exports as the examples' circle, `{"name", "shape": "circle", "cx", "cy", "r", "bone", "spacing", "band"}`; unequal semi-axes or a clip export as the generator's 32-sample polygon on its 1/256-pixel grid and are drawn filled, without handles.
281
+ The editor's values are the fields of Setup's **Chest regions · detail** block (R is region 1, L is region 2), which also holds what the bar does not: per region a name, a bone chosen from the loaded model's actual bones, the two semi-axes, a spacing and an optional medial clip x, plus the contour settings (tolerance, margin, spacing, max edge, stray, bridges). Max edge and stray may be left empty and bridges unchecked: as in the producer's contour block, each is then absent (no edge is cut, no island is left out, the one-island rule), and the export omits it rather than writing a default; `bridges` is written only as `true`, the one value the producer takes, and a written max edge must be above 0 (#318). Setting R in the bar writes both semi-axes. A region with equal semi-axes and no clip exports as the examples' circle, `{"name", "shape": "circle", "cx", "cy", "r", "bone", "spacing", "band"}`; unequal semi-axes or a clip export as the generator's 32-sample polygon on its 1/256-pixel grid and are drawn filled, without handles.
282
282
 
283
283
  The overlay needs the loaded model to fix the crop: its declared stage must be the crop frame with the root at its bottom centre (`x = -width/2`, `y = 0`) and the drawn root bone must sit at the world origin, so crop `(x, y)` is world `(x - width/2, height - y)`. Otherwise the editor bar and the detail block show `CHEST_REGION_MAPPING_UNAVAILABLE: <what is missing>`, nothing is drawn, and the values still edit numerically and export from a crop size you enter.
284
284
 
285
- **Download JSON** (and the detail block's **Download chest-regions.json**) saves two files in the browser: `chest-regions.json`, formatted exactly as the public example files, and `chest-regions.binding.json`, which names the package source hash, the rig and motion SHA-256 values, the export time, the viewer and runtime versions and the mapping used. An export holds 1–8 regions, the set Apply accepts (#118): a detail row without a centre x is not designated, so one row exports alone; two regions keep the public examples' text byte for byte. Export refuses `CHEST_REGIONS_COUNT`, `CHEST_REGION_NAME_DUPLICATE`, `CHEST_REGION_BONE_UNKNOWN <bone>`, `CHEST_REGION_OUT_OF_CROP <name>`, `CHEST_REGION_OFF_GRID` and `CHEST_REGIONS_OVERLAP <a> <b>` (every pair is tested). Two circles overlap when their centre distance minus both cores is less than the sum of their bands; any other pair is tested through polygons. The generator refuses per mesh vertex, so this check can refuse a pair it would accept, never the reverse.
285
+ **Download JSON** (and the detail block's **Download chest-regions.json**) saves two files in the browser: `chest-regions.json`, formatted exactly as the public example files, and `chest-regions.binding.json`, which names the package source hash, the rig and motion SHA-256 values, the export time, the viewer and runtime versions and the mapping used. An export holds 1–8 regions, the set Apply accepts (#118): a detail row without a centre x is not designated, so one row exports alone; two regions keep the public examples' text byte for byte. Export refuses `CHEST_REGIONS_COUNT`, `CHEST_REGION_NAME_DUPLICATE`, `CHEST_REGION_BONE_UNKNOWN <bone>`, `CHEST_REGION_OUT_OF_CROP <name>`, `CHEST_REGION_OFF_GRID` and `CHEST_REGIONS_OVERLAP <a> <b>` (every pair is tested), and `CHEST_REGIONS_GENERATOR_MISSING` while **Public generator** is empty. That field is the file's own statement of what will read it and the config records none, so a form seeded from the config leaves it empty; it gates export only, and the overlay draws regions that every other rule accepts (#323). Two circles overlap when their centre distance minus both cores is less than the sum of their bands; any other pair is tested through polygons. The generator refuses per mesh vertex, so this check can refuse a pair it would accept, never the reverse.
286
286
 
287
287
  Field values stay in the inspection's local draft. They never enter the review session's feedback, nothing is written into the package, and an export is review evidence, not an approval (see `docs/DESIGN.md`).
288
288
 
@@ -154,7 +154,7 @@ An Apply rebuilds through the installed producer from the files the inspected ri
154
154
 
155
155
  5. **The build's own config, for the `check/` package of a `rig-parts build` output root** (#149): `../config.json` (in the build root), then `../../config.json` (beside it). A `rig-parts build` records no config path or hash, so "the producer's own config for that build" is defined by place, bounded by the build's own files: the opened package root is named `check` and its parent is a build root as recognized above, and the config is the regular file named `config.json` directly in that build root or directly in the folder holding it — the two places `rig-parts build --config <dir>/config.json --out <dir>/out` leaves it. No other parent and no other file name is looked at; a symlink there is refused (`HANDOFF_SYMLINK_ESCAPE`), never followed. The root for this step is the config's folder, the parts directory is the build root, and the record says `"how": "discovered", "outside": true` with the path (`../../config.json`) and SHA-256. Place is not proof that the config built the rig: the session baseline below is that check (`reproduced` or `not-reproduced`, by name). Declaring `--config` at exactly one of those two files (as written, its parent chain canonicalized) is taken the same way with `"how": "declared"`; that file's folder is then the root for `--parts`, `--source`, `--full`, `--head` and `--keypoints`. The build records none of those, so they stay declared-only. When nothing is at either place the refusal lists them: `MODELING_INPUT_UNAVAILABLE: config.json — looked at config.json, rig/config.json, ../config.json (in the build root), ../../config.json (beside the build root); declare it with …`.
156
156
 
157
- Without `--parts` the parts directory is `out/` beside the config (for step 4, the opened `out/` itself; for step 5, the build root). A declared or discovered path that is missing, outside its root (the package root; for step 4 the folder holding `out/`; for step 5 the config's folder), or a symlink that leaves it is refused by name: `HANDOFF_PATH_OUTSIDE_ROOT`, `HANDOFF_SYMLINK_ESCAPE`, `HANDOFF_INPUT_MISSING`, `HANDOFF_INPUT_INVALID`, `HANDOFF_PATH_INVALID` (`open` prefixes `OPEN_HANDOFF_INVALID <flag or path>`). Nothing found is not a load error: `/api/rebuild` reports `MODELING_INPUT_UNAVAILABLE: config.json — looked at config.json, rig/config.json, ../config.json (beside an opened out/); declare it with rig-review open <dir> --config <path> [--parts <dir>] or the review.json "producer" block`, and Apply refuses `MODELING_HANDOFF_MISSING`.
157
+ Without `--parts` the parts directory is `out/` beside the config (for step 4, the opened `out/` itself; for step 5, the build root). A declared or discovered path that is missing, outside its root (the package root; for step 4 the folder holding `out/`; for step 5 the config's folder), or a symlink that leaves it is refused by name: `HANDOFF_PATH_OUTSIDE_ROOT`, `HANDOFF_SYMLINK_ESCAPE`, `HANDOFF_INPUT_MISSING`, `HANDOFF_INPUT_INVALID`, `HANDOFF_PATH_INVALID` (`open` prefixes `OPEN_HANDOFF_INVALID <flag or path>`). `rig-review open` verifies at start (before spawning or reusing a worker) that every inspected package has a compiled `model` that `@rig-c/play` loads and decodes, and in single mode by default also requires a complete producer handoff (`handoffGap`, `producerInputs`, `resolveProducer`, `contourParts`), exiting non-zero with `OPEN_MODEL_UNAVAILABLE: <reason>` when the model or handoff is missing or broken. Passing `--view-only` explicitly permits opening a compiled model that has no producer handoff at all (`handoff === null`), in which case `/api/rebuild` reports the neutral status `"view only, no producer handoff"` (with `viewOnly: true`) and no panel renders a `MODELING_*` error string; a declared or partially-present handoff with a gap still refuses `OPEN_MODEL_UNAVAILABLE: <reason>` even with `--view-only`. When `startServer` runs directly without `--view-only` and no handoff is found, `/api/rebuild` reports `MODELING_INPUT_UNAVAILABLE: config.json — looked at config.json, rig/config.json, ../config.json (beside an opened out/); declare it with rig-review open <dir> --config <path> [--parts <dir>] or the review.json "producer" block`, and Apply refuses `MODELING_HANDOFF_MISSING`.
158
158
 
159
159
  **Hashed files.** The config; the files the config names that the producer resolves against the config's directory (`motion.animations_from`, `generation.control.skeleton`; each must stay inside the root, a missing one is listed in `missing`); `parts.json` and every regular file directly in `parts/`; every regular file directly in the inspected `rig/` (`rig.json`, `motion.json`, `mesh_report.json`, `sets.json`, …) and `rig/images/`; with `--source`/`--full`/`--head`, that PNG and the regular files directly in those directories; with `--keypoints` (#111; the review.json block's `keypoints`), that file — the same path rules as `--source` (literal, inside the root, no symlink escape).
160
160
 
@@ -399,7 +399,7 @@ Only selected-basis report `frameTimes` supplies strip times. A matching report
399
399
 
400
400
  Each interval has its own source-row grid; overlapping groups preserve their feedback ids and repeated frames. Source packages and reference are checked before and after export, including exact model/page/motion bytes through existing package hashes. The PNG footer includes full rig/motion hashes (null stays absent), revisions, viewer/runtime and actual renderer versions. Exports are derived evidence, never a new source or approval. CLI destinations and `.json` sidecars must be new files outside both source roots; parent symlinks and existing targets are refused. Downloads have no arbitrary filesystem destination parameter.
401
401
 
402
- The pure layout reserves a maximum `footerHeight` budget for complete provenance. The native renderer wraps the actual footer text before allocation and uses only that measured height; `rendering.width/height` records the actual PNG extent. Unsupported RGB/dark tint refuses by name (`STRIP_UNSUPPORTED_TINT`) rather than claiming Canvas2D pixel parity for features its published renderer omits.
402
+ The pure layout reserves a maximum `footerHeight` budget for complete provenance. The native renderer wraps the actual footer text before allocation and uses only that measured height; `rendering.width/height` records the actual PNG extent. Unsupported RGB/dark tint refuses by name (`STRIP_UNSUPPORTED_TINT`) rather than claiming Canvas2D pixel parity for features its published renderer omits. Labels and footer use concrete font-family lists, never a generic family (Node Canvas resolves those to the machine's first family); when no family of the mono or sans list is installed, rendering refuses `STRIP_FONT`, naming both lists, before any reference probe or drawing.
403
403
 
404
404
  A strip plan with one clock basis reports `plan.basis:"single"|"a"|"b"`. A comparison batch containing both sides reports `plan.basis:"mixed"`; each group still carries its own `basis` and its own report-derived sample times. Consumers must use the group basis for a mixed plan rather than treating the first group as a batch-wide clock. The selected basis row labels requested producer frames/times; actual PTS and independently calculated actual frames remain separate rendering metadata. Output containment and every parent-directory check use native platform separators, including Windows drive and UNC paths.
405
405
 
package/docs/WORKFLOWS.md CHANGED
@@ -87,7 +87,7 @@ Strip times require the selected report's exact `frameTimes` and matching animat
87
87
 
88
88
  PNG export uses the pinned published `@rig-c/play` canvas player and real Node Canvas2D, with `ffmpeg` (5.1 or later, for `-fps_mode`) and `ffprobe` available on PATH for reference decoding. Missing capabilities fail by name. Each requested sample chooses the nearest actual decoded reference PTS (ties earlier); both rigs seek that actual PTS using the viewer's fixed step. JSON distinguishes requested time, actual PTS, delta, decoded frame index, actual player times and independently known producer frames. Requests outside the common domain refuse instead of clamping. The PNG shows source rows, chronological frame columns, and full source hashes/revisions/tool and renderer versions. Batch groups stack vertically. Exports are bounded to64 intervals,256 total frames,64 megapixels and16384 pixels per dimension; larger selections must be split.
89
89
 
90
- The footer fits its measured text while retaining full hashes. RGB/dark-tint features unsupported by the published Canvas2D path refuse with `STRIP_UNSUPPORTED_TINT`; they are not silently omitted.
90
+ The footer fits its measured text while retaining full hashes. Text is drawn in named families (mono: DejaVu Sans Mono, Liberation Mono, Menlo, Consolas; sans: DejaVu Sans, Liberation Sans, Helvetica, Arial), because Node Canvas resolves `monospace`/`sans-serif` to whatever family the machine lists first; with none of a list installed, export refuses `STRIP_FONT` before decoding or drawing. RGB/dark-tint features unsupported by the published Canvas2D path refuse with `STRIP_UNSUPPORTED_TINT`; they are not silently omitted.
91
91
 
92
92
  ## One-command owner handoff
93
93
 
@@ -2,4 +2,4 @@
2
2
 
3
3
  The SVG, synthetic canonical pose sequence coordinates, and short synthetic sine-wave chime were authored for this repository. They contain no imported or private art.
4
4
 
5
- This package deliberately has no compiled rig. It demonstrates source comparison, checkpoint notes, audio audition, explicit review status, and structured frame/target/category feedback. Playback becomes available when an agent supplies `model` pointing to a gated rigc build's `skeleton.model.json`, with its local page images. The pose sequence demonstrates the canonical `rig-pose-sequence/1` transport shape; its coordinates were authored here and were not extracted or measured from footage. This source sketch is not proof of rig quality.
5
+ This package carries a minimal synthetic compiled rig (`skeleton.model.json` and `lantern.png`) with no producer handoff, opened with `--view-only`. It demonstrates playback inspection, source comparison, checkpoint notes, audio audition, explicit review status, and structured frame/target/category feedback. Producer rebuild panels become available when a package is opened with its producer handoff (`config.json`, `parts.json`, `rig/`). The pose sequence demonstrates the canonical `rig-pose-sequence/1` transport shape; its coordinates were authored here and were not extracted or measured from footage. This synthetic demo is not proof of upstream compile gating or rig quality.
Binary file
@@ -3,6 +3,7 @@
3
3
  "id": "abstract-lantern",
4
4
  "title": "Lantern \u00b7 first inspection",
5
5
  "revision": "source-study-1",
6
+ "model": "skeleton.model.json",
6
7
  "references": [
7
8
  {
8
9
  "id": "source",
@@ -19,14 +20,21 @@
19
20
  "path": "pose.json"
20
21
  }
21
22
  ],
22
- "animations": [],
23
+ "animations": [
24
+ {
25
+ "id": "idle",
26
+ "label": "Idle \u00b7 gentle sway",
27
+ "duration": 1
28
+ }
29
+ ],
23
30
  "checkpoints": [
24
31
  {
25
32
  "id": "silhouette",
26
33
  "title": "Check silhouette and hanging joint",
27
34
  "workspace": "modeling",
28
35
  "reference": "source",
29
- "note": "This original abstract SVG is source material. No compiled model is included; record structured feedback rather than assuming playback."
36
+ "animation": "idle",
37
+ "note": "This original abstract SVG is source material beside a minimal synthetic compiled model. Inspect playback and record structured feedback."
30
38
  },
31
39
  {
32
40
  "id": "joints",
@@ -0,0 +1,183 @@
1
+ {
2
+ "spec": "rigc-compiled/3",
3
+ "referenceScale": 100,
4
+ "stage": {
5
+ "x": 0,
6
+ "y": 0,
7
+ "width": 80,
8
+ "height": 80
9
+ },
10
+ "bones": [
11
+ {
12
+ "name": "root"
13
+ },
14
+ {
15
+ "name": "lantern",
16
+ "parent": "root",
17
+ "x": 0,
18
+ "y": 0
19
+ }
20
+ ],
21
+ "slots": [
22
+ {
23
+ "name": "lantern",
24
+ "bone": "lantern",
25
+ "setup": "lantern"
26
+ }
27
+ ],
28
+ "skins": [
29
+ {
30
+ "name": "default",
31
+ "bones": [],
32
+ "constraints": {
33
+ "ik": [],
34
+ "transform": [],
35
+ "path": [],
36
+ "physics": [],
37
+ "slider": []
38
+ },
39
+ "attachments": {
40
+ "lantern": {
41
+ "lantern": {
42
+ "kind": "region",
43
+ "path": "lantern",
44
+ "width": 20,
45
+ "height": 20,
46
+ "atlas": {
47
+ "width": 20,
48
+ "height": 20,
49
+ "offsetX": 0,
50
+ "offsetY": 0,
51
+ "originalWidth": 20,
52
+ "originalHeight": 20
53
+ }
54
+ }
55
+ }
56
+ }
57
+ }
58
+ ],
59
+ "constraints": [],
60
+ "events": [],
61
+ "animations": [
62
+ {
63
+ "name": "idle",
64
+ "duration": 1,
65
+ "bones": [
66
+ {
67
+ "name": "lantern",
68
+ "timelines": [
69
+ {
70
+ "name": "rotate",
71
+ "keys": [
72
+ {
73
+ "time": 0,
74
+ "value": -4
75
+ },
76
+ {
77
+ "time": 0.5,
78
+ "value": 4
79
+ },
80
+ {
81
+ "time": 1,
82
+ "value": -4
83
+ }
84
+ ]
85
+ }
86
+ ]
87
+ }
88
+ ],
89
+ "slots": [],
90
+ "constraints": {
91
+ "ik": [],
92
+ "transform": [],
93
+ "path": [],
94
+ "physics": [],
95
+ "slider": []
96
+ },
97
+ "attachments": [],
98
+ "drawOrder": [],
99
+ "events": []
100
+ }
101
+ ],
102
+ "editorOrder": {
103
+ "skins": [
104
+ {
105
+ "name": "default",
106
+ "slots": [
107
+ "lantern"
108
+ ]
109
+ }
110
+ ],
111
+ "animations": [
112
+ "idle"
113
+ ]
114
+ },
115
+ "images": [
116
+ {
117
+ "region": "lantern",
118
+ "page": "lantern.png",
119
+ "width": 20,
120
+ "height": 20,
121
+ "hasAlpha": true,
122
+ "isBase": false
123
+ }
124
+ ],
125
+ "pageGrids": [],
126
+ "droppedStates": [],
127
+ "absentParts": [],
128
+ "meshBones": [],
129
+ "meshes": [],
130
+ "physics": [],
131
+ "deformTransforms": [],
132
+ "trackDerivations": [],
133
+ "rig": {
134
+ "archetype": "abstract-lantern",
135
+ "axisBone": null,
136
+ "axisSubtree": [],
137
+ "detached": [],
138
+ "slotOrder": [
139
+ "lantern"
140
+ ],
141
+ "meshKinds": {},
142
+ "meshDeclaredBones": {},
143
+ "meshSoftBones": {},
144
+ "deformMayFold": [],
145
+ "consumerDrivenMix": [],
146
+ "idleDrivesMeshes": null,
147
+ "axes": [],
148
+ "basePlates": [],
149
+ "meshSlotBudget": null,
150
+ "meshTriangleBudget": null,
151
+ "contactDepth": null,
152
+ "capContainmentCeiling": null,
153
+ "massBone": null,
154
+ "inwardUnit": null
155
+ },
156
+ "pages": [
157
+ {
158
+ "name": "lantern.png",
159
+ "width": 20,
160
+ "height": 20,
161
+ "pma": false,
162
+ "scale": null,
163
+ "regions": [
164
+ {
165
+ "name": "lantern",
166
+ "x": 0,
167
+ "y": 0,
168
+ "width": 20,
169
+ "height": 20,
170
+ "offsetX": 0,
171
+ "offsetY": 0,
172
+ "originalWidth": 20,
173
+ "originalHeight": 20,
174
+ "degrees": 0,
175
+ "index": 0
176
+ }
177
+ ]
178
+ }
179
+ ],
180
+ "spine": {
181
+ "sha256": "0000000000000000000000000000000000000000000000000000000000000000"
182
+ }
183
+ }
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@rig-c/review",
3
- "version": "1.1.1",
3
+ "version": "1.2.1",
4
4
  "type": "module",
5
5
  "description": "Local human rig inspection and structured feedback export",
6
6
  "license": "MIT",
7
7
  "scripts": {
8
8
  "review": "bun src/cli.ts",
9
9
  "check": "bun src/cli.ts check",
10
- "demo": "bun src/cli.ts examples/demo/review.json",
10
+ "demo": "bun src/cli.ts examples/demo/review.json --view-only",
11
11
  "check:readme": "bun scripts/check-readme.ts",
12
12
  "typecheck": "tsc --noEmit",
13
13
  "test": "bun test",
@@ -16,7 +16,13 @@ export interface ChestPolygonRegion { name: string; bone: string; shape: 'polygo
16
16
  /** The examples' `config.json` circle (key order as there): core radius r at full weight, linear falloff over band. */
17
17
  export interface ChestCircleRegion { name: string; shape: 'circle'; cx: number; cy: number; r: number; bone: string; spacing: number; band: number }
18
18
  export type ChestRegion = ChestPolygonRegion | ChestCircleRegion;
19
- export interface ChestContour { tolerance: number; margin: number; spacing: number; maxEdge: number; stray: number; bridges: boolean; regions: ChestRegion[] }
19
+ /**
20
+ * The producer's contour block (@rig-c/parts, `meshes.<part>.contour`): `maxEdge`, `stray` and `bridges` are optional
21
+ * there, and an absent one is "none", never a guessed value — no outline edge is cut, no island is left out, a second
22
+ * island refuses (the one-island rule). `bridges` has one value, `true`; the producer refuses `false`. So a document
23
+ * carries each of the three only when it is declared, and review never writes a default for one (#318).
24
+ */
25
+ export interface ChestContour { tolerance: number; margin: number; spacing: number; maxEdge?: number; stray?: number; bridges?: true; regions: ChestRegion[] }
20
26
  export interface ChestMesh { contour: ChestContour; r?: number; segments?: ChestSegment[] }
21
27
  export interface ChestRegionsDocument {
22
28
  spec: typeof CHEST_REGIONS_SPEC;
@@ -40,7 +46,8 @@ export interface ChestRegionsInput {
40
46
  crop: { w: number; h: number };
41
47
  generator: string;
42
48
  mesh?: string;
43
- contour: Omit<ChestContour, 'regions'>;
49
+ /** `bridges` is the detail block's checkbox: `false` (unchecked) is absence, as the producer has no `false`. */
50
+ contour: Omit<ChestContour, 'regions' | 'bridges'> & { bridges?: boolean };
44
51
  regions: ChestRegionInput[];
45
52
  r?: number;
46
53
  segments?: unknown;
@@ -73,6 +80,79 @@ export function ellipsePolygon(center: [number, number], semiAxes: [number, numb
73
80
  return points;
74
81
  }
75
82
 
83
+ /**
84
+ * #315: how far (crop px) a polygon vertex may sit off the fitted ellipse and still read back as that ellipse. The
85
+ * ellipses review and create write are quantized to 1/256 px, so they sit within ~0.003 px; 0.5 px also accepts an
86
+ * ellipse rounded to half pixels and refuses a hand-drawn shape.
87
+ */
88
+ export const CHEST_ELLIPSE_TOLERANCE = 0.5;
89
+ /** The fit has four unknowns (cx, cy, ax, ay); at least two more points than that, or any four points would "fit". */
90
+ export const CHEST_ELLIPSE_MIN_POINTS = 6;
91
+ export type ChestEllipseFit =
92
+ | { ok: true; cx: number; cy: number; ax: number; ay: number; clip?: number; maxOff: number }
93
+ | { ok: false; points: number; maxOff: number | null };
94
+
95
+ /** Radial distance of p from the axis-aligned ellipse (≥ the normal distance, so the test never accepts more). */
96
+ function offEllipse([x, y]: CropPoint, cx: number, cy: number, ax: number, ay: number): number {
97
+ const dx = x - cx, dy = y - cy, d = Math.hypot(dx, dy);
98
+ if (d === 0) return Math.min(ax, ay);
99
+ const c = dx / d, s = dy / d;
100
+ return Math.abs(d - ax * ay / Math.hypot(ay * c, ax * s));
101
+ }
102
+ /** Least squares A·x² + C·y² + D·x + E·y = 1 about the points' mean (inside a closed ring, so never on the curve). */
103
+ function leastSquaresEllipse(points: readonly CropPoint[]): { cx: number; cy: number; ax: number; ay: number } | null {
104
+ const mx = points.reduce((s, p) => s + p[0], 0) / points.length, my = points.reduce((s, p) => s + p[1], 0) / points.length;
105
+ const m = [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]];
106
+ for (const [px, py] of points) {
107
+ const x = px - mx, y = py - my, row = [x * x, y * y, x, y];
108
+ for (let i = 0; i < 4; i++) { for (let j = 0; j < 4; j++) m[i]![j]! += row[i]! * row[j]!; m[i]![4]! += row[i]!; }
109
+ }
110
+ for (let col = 0; col < 4; col++) {
111
+ let pivot = col;
112
+ for (let r = col + 1; r < 4; r++) if (Math.abs(m[r]![col]!) > Math.abs(m[pivot]![col]!)) pivot = r;
113
+ if (Math.abs(m[pivot]![col]!) < 1e-12) return null;
114
+ [m[col], m[pivot]] = [m[pivot]!, m[col]!];
115
+ for (let r = 0; r < 4; r++) {
116
+ if (r === col) continue;
117
+ const f = m[r]![col]! / m[col]![col]!;
118
+ for (let k = col; k < 5; k++) m[r]![k]! -= f * m[col]![k]!;
119
+ }
120
+ }
121
+ const [A, C, D, E] = m.map((row, i) => row[4]! / row[i]!) as [number, number, number, number];
122
+ if (!(A > 0) || !(C > 0)) return null;
123
+ const G = 1 + D * D / (4 * A) + E * E / (4 * C);
124
+ if (!(G > 0)) return null;
125
+ return { cx: mx - D / (2 * A), cy: my - E / (2 * C), ax: Math.sqrt(G / A), ay: Math.sqrt(G / C) };
126
+ }
127
+ /**
128
+ * #315: reads an axis-aligned ellipse back from a polygon by measurement: every vertex lies within
129
+ * CHEST_ELLIPSE_TOLERANCE of the fitted ellipse. A clipped ellipse (ellipsePolygon's `clip`) is recognised when the
130
+ * vertices on its extreme x are left out of the fit, the rest fit, and the clipped ones lie inside the ellipse.
131
+ * Values are quantized to the 1/256 px grid the producer reads.
132
+ */
133
+ export function fitChestEllipse(points: readonly CropPoint[]): ChestEllipseFit {
134
+ if (points.length < CHEST_ELLIPSE_MIN_POINTS) return { ok: false, points: points.length, maxOff: null };
135
+ const measure = (pts: readonly CropPoint[]) => {
136
+ const e = leastSquaresEllipse(pts);
137
+ if (!e) return null;
138
+ const q = { cx: quantize(e.cx), cy: quantize(e.cy), ax: quantize(e.ax), ay: quantize(e.ay) };
139
+ return { ...q, maxOff: Math.max(...pts.map(p => offEllipse(p, q.cx, q.cy, q.ax, q.ay))) };
140
+ };
141
+ const whole = measure(points);
142
+ if (whole && whole.maxOff <= CHEST_ELLIPSE_TOLERANCE) return { ok: true, ...whole };
143
+ const xs = points.map(p => p[0]);
144
+ for (const clip of [Math.max(...xs), Math.min(...xs)]) {
145
+ const clipped = points.filter(p => p[0] === clip), rest = points.filter(p => p[0] !== clip);
146
+ if (clipped.length < 2 || rest.length < CHEST_ELLIPSE_MIN_POINTS) continue;
147
+ const e = measure(rest);
148
+ if (!e || e.maxOff > CHEST_ELLIPSE_TOLERANCE) continue;
149
+ const facing = clip > e.cx ? clip < e.cx + e.ax : clip > e.cx - e.ax;
150
+ const inside = clipped.every(([x, y]) => ((x - e.cx) / e.ax) ** 2 + ((y - e.cy) / e.ay) ** 2 <= 1 + 1e-6);
151
+ if (facing && inside && onGrid(clip)) return { ok: true, ...e, clip };
152
+ }
153
+ return { ok: false, points: points.length, maxOff: whole ? whole.maxOff : null };
154
+ }
155
+
76
156
  function finite(value: unknown, region: string, field: string, min: number, inclusive = true): number {
77
157
  if (typeof value !== 'number' || !Number.isFinite(value) || (inclusive ? value < min : value <= min)) throw new ChestRegionError('CHEST_REGION_VALUE_INVALID', `${region} ${field}`);
78
158
  return value;
@@ -183,10 +263,28 @@ function segmentList(value: unknown): ChestSegment[] {
183
263
  export function buildChestRegions(input: ChestRegionsInput): ChestRegionsDocument {
184
264
  const w = finite(input.crop?.w, 'crop', 'w', 0, false), h = finite(input.crop?.h, 'crop', 'h', 0, false);
185
265
  if (typeof input.generator !== 'string' || !input.generator.trim()) throw new ChestRegionError('CHEST_REGIONS_GENERATOR_MISSING', '');
266
+ const { mesh, meshName } = designate(input, w, h);
267
+ return { spec: CHEST_REGIONS_SPEC, coordinates: coordinatesText({ w, h }, input.regions), publicGenerator: input.generator, mesh: { name: meshName, value: mesh }, ...(input.sourceRule ? { sourceRule: input.sourceRule } : {}) };
268
+ }
269
+
270
+ /**
271
+ * #323: the regions a designation holds, refused by every rule `buildChestRegions` applies except the generator's. The
272
+ * generator is the export file's declaration of who will read it — the config records none — so it gates export, not
273
+ * the overlay that shows the regions.
274
+ */
275
+ export function chestDisplayRegions(input: Omit<ChestRegionsInput, 'generator'>): ChestRegion[] {
276
+ const w = finite(input.crop?.w, 'crop', 'w', 0, false), h = finite(input.crop?.h, 'crop', 'h', 0, false);
277
+ return designate(input, w, h).mesh.contour.regions;
278
+ }
279
+
280
+ function designate(input: Omit<ChestRegionsInput, 'generator'>, w: number, h: number): { mesh: ChestMesh; meshName: string } {
186
281
  if (input.regions.length < 1 || input.regions.length > CHEST_REGIONS_MAX) throw new ChestRegionError('CHEST_REGIONS_COUNT', `${input.regions.length} (1–${CHEST_REGIONS_MAX})`);
187
282
  const c = input.contour;
188
- for (const field of ['tolerance', 'margin', 'spacing', 'maxEdge', 'stray'] as const) finite(c[field], 'contour', field, 0);
189
- if (typeof c.bridges !== 'boolean') throw new ChestRegionError('CHEST_REGION_VALUE_INVALID', 'contour bridges');
283
+ for (const field of ['tolerance', 'margin', 'spacing'] as const) finite(c[field], 'contour', field, 0);
284
+ // #318: absent is the producer's "none"; written, maxEdge is a positive number (the producer's config rule) and stray 0 or more.
285
+ if (c.maxEdge !== undefined) finite(c.maxEdge, 'contour', 'maxEdge', 0, false);
286
+ if (c.stray !== undefined) finite(c.stray, 'contour', 'stray', 0);
287
+ if (c.bridges !== undefined && typeof c.bridges !== 'boolean') throw new ChestRegionError('CHEST_REGION_VALUE_INVALID', 'contour bridges');
190
288
  const names = new Set<string>(), regions: ChestRegion[] = [];
191
289
  for (const region of input.regions) {
192
290
  const name = region.name;
@@ -215,12 +313,12 @@ export function buildChestRegions(input: ChestRegionsInput): ChestRegionsDocumen
215
313
  for (let i = 0; i < regions.length; i++) for (let j = i + 1; j < regions.length; j++) {
216
314
  if (chestRegionsOverlap(regions[i]!, regions[j]!)) throw new ChestRegionError('CHEST_REGIONS_OVERLAP', `${regions[i]!.name} ${regions[j]!.name}`);
217
315
  }
218
- const mesh: ChestMesh = { contour: { tolerance: c.tolerance, margin: c.margin, spacing: c.spacing, maxEdge: c.maxEdge, stray: c.stray, bridges: c.bridges, regions } };
316
+ const mesh: ChestMesh = { contour: { tolerance: c.tolerance, margin: c.margin, spacing: c.spacing, ...(c.maxEdge === undefined ? {} : { maxEdge: c.maxEdge }), ...(c.stray === undefined ? {} : { stray: c.stray }), ...(c.bridges === true ? { bridges: true as const } : {}), regions } };
219
317
  if (input.r !== undefined) mesh.r = finite(input.r, 'mesh', 'r', 0);
220
318
  if (input.segments !== undefined) mesh.segments = segmentList(input.segments);
221
319
  const meshName = input.mesh ?? 'topwear';
222
320
  if (!/^[A-Za-z0-9_-]{1,64}$/.test(meshName)) throw new ChestRegionError('CHEST_REGION_VALUE_INVALID', 'mesh name');
223
- return { spec: CHEST_REGIONS_SPEC, coordinates: coordinatesText({ w, h }, input.regions), publicGenerator: input.generator, mesh: { name: meshName, value: mesh }, ...(input.sourceRule ? { sourceRule: input.sourceRule } : {}) };
321
+ return { mesh, meshName };
224
322
  }
225
323
 
226
324
  /** Python-style JSON text (`json.dumps(value, indent=2)` + newline), the examples' exact formatting; `{float}` marks a Python float. */
@@ -252,7 +350,8 @@ export function serializeChestRegions(doc: ChestRegionsDocument): string {
252
350
  publicGenerator: doc.publicGenerator,
253
351
  [`meshes.${doc.mesh.name}`]: {
254
352
  contour: {
255
- tolerance: contour.tolerance, margin: contour.margin, spacing: contour.spacing, maxEdge: contour.maxEdge, stray: contour.stray, bridges: contour.bridges,
353
+ tolerance: contour.tolerance, margin: contour.margin, spacing: contour.spacing,
354
+ ...(contour.maxEdge === undefined ? {} : { maxEdge: contour.maxEdge }), ...(contour.stray === undefined ? {} : { stray: contour.stray }), ...(contour.bridges === true ? { bridges: true } : {}),
256
355
  regions: contour.regions.map((r): Emit => r.shape === 'circle'
257
356
  ? { name: r.name, shape: r.shape, cx: r.cx, cy: r.cy, r: r.r, bone: r.bone, spacing: r.spacing, band: r.band }
258
357
  : { name: r.name, bone: r.bone, shape: r.shape, points: r.points.map(([x, y]) => [{ float: x }, { float: y }]), spacing: r.spacing, band: r.band }),
package/src/cli.ts CHANGED
@@ -20,7 +20,7 @@ import { readCompareSession } from './compare-session.ts';
20
20
  import { exportReviewStrip, exportCompareStrip, stripJson, writeStripOutput, validateStripOutput } from './strip-export.ts';
21
21
  import type { StripInterval, StripRequest } from './strip.ts';
22
22
  const handoffUsage='[--config <path> [--parts <dir>] [--source <png> --full <dir> [--head <dir>]] [--keypoints <file>]]';
23
- const usage='Usage: rig-review open <dir> [--reference <video>] [--compare <dir>] [--animation <name>] [--control] [--direct] '+handoffUsage+'\n --config declares the producer handoff (wins over the review.json "producer" block and discovery of config.json, rig/config.json, ../config.json beside an opened out/); feedback and control take the same flags.\n open is managed by default: one loopback front at 127.0.0.1:4318 (RIG_REVIEW_FRONT_PORT overrides) serves /instances/<key>/; --direct serves the worker on its own port.\n rig-review control <dir> [--reference <video>] [--compare <dir>] [--animation <name>] '+handoffUsage+' [--page <id> --expected-revision <n> --command <JSON> --wait-ms <n>]\n rig-review feedback <dir> [--reference <video>] [--compare <dir>] [--animation <name>] '+handoffUsage+' [--format json|issue]\n Usage: bun run review -- <review.json|output-directory> [--port 4317] [--checkpoint ID]\n bun run check -- <review.json|output-directory>\n bun run feedback -- <review.json|output-directory>\n bun run review -- compare <a> <b> --reference <video> --animation <name> [--port 4317]\n bun run check -- compare <a> <b> --reference <video> --animation <name>\n bun run feedback -- compare <a> <b> --reference <video> --animation <name>\n rig-review --version';
23
+ const usage='Usage: rig-review open <dir> [--reference <video>] [--compare <dir>] [--animation <name>] [--control] [--direct] [--view-only] '+handoffUsage+'\n --config declares the producer handoff (wins over the review.json "producer" block and discovery of config.json, rig/config.json, ../config.json beside an opened out/); feedback and control take the same flags; --view-only opens without a producer handoff.\n open is managed by default: one loopback front at 127.0.0.1:4318 (RIG_REVIEW_FRONT_PORT overrides) serves /instances/<key>/; --direct serves the worker on its own port.\n rig-review control <dir> [--reference <video>] [--compare <dir>] [--animation <name>] '+handoffUsage+' [--page <id> --expected-revision <n> --command <JSON> --wait-ms <n>]\n rig-review feedback <dir> [--reference <video>] [--compare <dir>] [--animation <name>] '+handoffUsage+' [--format json|issue]\n Usage: bun run review -- <review.json|output-directory> [--port 4317] [--checkpoint ID] [--view-only]\n bun run check -- <review.json|output-directory>\n bun run feedback -- <review.json|output-directory>\n bun run review -- compare <a> <b> --reference <video> --animation <name> [--port 4317]\n bun run check -- compare <a> <b> --reference <video> --animation <name>\n bun run feedback -- compare <a> <b> --reference <video> --animation <name>\n rig-review --version';
24
24
  async function stripCommand(args:string[],options:{stateDir?:string}){
25
25
  const compare=args[0]==='compare';if(compare)args.shift();const a=args.shift(),b=compare?args.shift():undefined;if(!a||compare&&!b)throw new Error('strip: expected package input(s)');
26
26
  let reference:string|undefined,referenceVideo:string|undefined,animation:string|undefined,basis:'a'|'b'|undefined,range:string|undefined,output:string|undefined,jsonOnly=false,all=false;
@@ -44,7 +44,7 @@ function handoffOption(flag:string):(typeof HANDOFF_FLAGS)[number]|null {const n
44
44
  const handoffWords=(inputs:OpenInputs)=>HANDOFF_FLAGS.flatMap(f=>inputs[f]!==undefined?['--'+f,inputs[f]!]:[]);
45
45
  export function parseOpenInputs(args:string[]):OpenInputs {
46
46
  const input=args.shift();if(!input||input.startsWith('--'))throw new Error(usage);const result:OpenInputs={input},seen=new Set<string>();
47
- while(args.length){const flag=args.shift()!;if(seen.has(flag))throw new Error(`OPEN_OPTION_INVALID ${flag}: Duplicate open option ${flag}`);seen.add(flag);if(flag==='--control'){result.control=true;continue;}if(flag==='--direct'){result.direct=true;continue;}const value=args.shift();if(value===undefined||value==='')throw new Error(`OPEN_OPTION_INVALID ${flag}: Missing value for ${flag}`);if(flag==='--reference')result.reference=value;else if(flag==='--compare')result.compare=value;else if(flag==='--animation')result.animation=value;else if(handoffOption(flag))result[handoffOption(flag)!]=value;else throw new Error(`OPEN_OPTION_INVALID ${flag}: Unknown open option ${flag}`);}
47
+ while(args.length){const flag=args.shift()!;if(seen.has(flag))throw new Error(`OPEN_OPTION_INVALID ${flag}: Duplicate open option ${flag}`);seen.add(flag);if(flag==='--control'){result.control=true;continue;}if(flag==='--direct'){result.direct=true;continue;}if(flag==='--view-only'){result.viewOnly=true;continue;}const value=args.shift();if(value===undefined||value==='')throw new Error(`OPEN_OPTION_INVALID ${flag}: Missing value for ${flag}`);if(flag==='--reference')result.reference=value;else if(flag==='--compare')result.compare=value;else if(flag==='--animation')result.animation=value;else if(handoffOption(flag))result[handoffOption(flag)!]=value;else throw new Error(`OPEN_OPTION_INVALID ${flag}: Unknown open option ${flag}`);}
48
48
  const problem=checkHandoffFlags(result);if(problem)throw new Error(`OPEN_OPTION_INVALID ${problem.split(':')[0]}: ${problem.slice(problem.indexOf(':')+2)}`);
49
49
  if(result.compare!==undefined&&handoffFlags(result))throw new Error('OPEN_OPTION_INVALID --config: compare takes no producer handoff; open one package with --config');
50
50
  return result;
@@ -89,7 +89,7 @@ function commandHelpRequested(args:readonly string[],command:'open'|'review'|'ch
89
89
  const handoff=HANDOFF_FLAGS.map(f=>'--'+f),flags=command==='open'?['--reference','--compare','--animation',...handoff]:compare?['--reference','--animation','--port']:['--port','--checkpoint','--reference','--compare','--animation',...handoff];
90
90
  for(let i=compare?3:1;i<args.length;){
91
91
  const flag=args[i];if(flag==='--help'||flag==='-h')return true;
92
- if(command==='open'&&(flag==='--control'||flag==='--direct')){i++;continue;}if(!flags.includes(flag!))return false;i+=2;
92
+ if((command==='open'&&(flag==='--control'||flag==='--direct'||flag==='--view-only'))||(command==='review'&&flag==='--view-only')){i++;continue;}if(!flags.includes(flag!))return false;i+=2;
93
93
  }
94
94
  return false;
95
95
  }
@@ -118,16 +118,16 @@ export async function main(args:string[],options:{stateDir?:string}={}){
118
118
  const stop=(sig:string)=>{server.stop(true);console.log(`review compare: exiting — received ${sig}.`);process.exit(0);};process.once('SIGINT',()=>stop('SIGINT'));process.once('SIGTERM',()=>stop('SIGTERM'));
119
119
  console.log(`Compare ready: http://127.0.0.1:${server.port}/#cap=${capability}\nComparison: ${p.response.title}\nSource SHA-256: ${p.response.sourceHash}\nPress Ctrl+C to stop.`);return;
120
120
  }
121
- const input=args.shift();if(!input)throw new Error(usage);let port=4317;let checkpoint:string|undefined,reference:string|undefined,compare:string|undefined,animation:string|undefined;const handoff:OpenInputs={input};
122
- while(args.length){const flag=args.shift();const value=args.shift();if(!value)throw new Error(`Missing value for ${flag}`);if(handoffOption(flag!)){handoff[handoffOption(flag!)!]=value;continue;}if(flag==='--port'){port=Number(value);if(!Number.isInteger(port)||port<0||port>65535)throw new Error('--port: expected integer 0…65535');}else if(flag==='--checkpoint')checkpoint=value;else if(flag==='--reference')reference=value;else if(flag==='--compare')compare=value;else if(flag==='--animation')animation=value;else throw new Error(`Unknown option ${flag}\n${usage}`);}
121
+ const input=args.shift();if(!input)throw new Error(usage);let port=4317;let checkpoint:string|undefined,reference:string|undefined,compare:string|undefined,animation:string|undefined,viewOnly=false;const handoff:OpenInputs={input};
122
+ while(args.length){const flag=args.shift();if(flag==='--view-only'){if(command!=='review')throw new Error(`Unknown option ${flag}\n${usage}`);viewOnly=true;continue;}const value=args.shift();if(!value)throw new Error(`Missing value for ${flag}`);if(handoffOption(flag!)){handoff[handoffOption(flag!)!]=value;continue;}if(flag==='--port'){port=Number(value);if(!Number.isInteger(port)||port<0||port>65535)throw new Error('--port: expected integer 0…65535');}else if(flag==='--checkpoint')checkpoint=value;else if(flag==='--reference')reference=value;else if(flag==='--compare')compare=value;else if(flag==='--animation')animation=value;else throw new Error(`Unknown option ${flag}\n${usage}`);}
123
123
  const handoffProblem=checkHandoffFlags(handoff);if(handoffProblem)throw new Error(handoffProblem);if(compare&&handoffFlags(handoff))throw new Error('--config: compare takes no producer handoff');
124
124
  if(compare){if(command!=='feedback')throw new Error('--compare: use open or feedback');const loaded=await loadOpenPackage({input,compare,reference,animation});if(loaded.mode!=='compare')throw new Error('Expected comparison');printFeedback(await readFeedbackCompareSession(loaded.p,options.stateDir));return;}
125
- const p=await loadReferencedReview(input,reference,handoffFlags(handoff));// Serving starts on the report's clip when it names one; check and feedback validate only an explicit flag.
125
+ const p=await loadReferencedReview(input,reference,handoffFlags(handoff));if(viewOnly)p.viewOnly=true;// Serving starts on the report's clip when it names one; check and feedback validate only an explicit flag.
126
126
  const fromReport=command==='review'&&animation===undefined&&p.report?.animation!==undefined;
127
127
  const selection=animation!==undefined||fromReport?selectAnimation([{label:'single',catalog:p.feedbackCatalog,report:p.report}],animation,true):null;const initialAnimation=selection?.name;if(command==='feedback'){const saved=await readFeedbackSession(p,options.stateDir);await assertReviewUnchanged(p);printFeedback(saved);return;}if(command==='check'){console.log(`Package valid: ${p.manifest.title}\nRevision: ${p.manifest.revision}\nSource SHA-256: ${p.sourceHash}\nDeclared files: ${p.files.size}\nPlayback: ${p.manifest.model?'compiled model present':'unavailable (no model)'}`);return;}
128
128
  if(checkpoint&&!p.manifest.checkpoints.some(v=>v.id===checkpoint))throw new Error(`Unknown checkpoint ${checkpoint}`);
129
129
  // Foreground serving uses the same `#cap=` fragment handoff as open: the printed link alone can submit.
130
- const capability=randomBytes(32).toString('hex'),server=await startServer(p,{port,stateDir:options.stateDir,initialAnimation,capability,exitOnClose:true});const url=new URL(`http://127.0.0.1:${server.port}/`);if(checkpoint)url.searchParams.set('checkpoint',checkpoint);url.hash='cap='+capability;
130
+ const capability=randomBytes(32).toString('hex'),server=await startServer(p,{port,stateDir:options.stateDir,initialAnimation,capability,exitOnClose:true,viewOnly});const url=new URL(`http://127.0.0.1:${server.port}/`);if(checkpoint)url.searchParams.set('checkpoint',checkpoint);url.hash='cap='+capability;
131
131
  const stop=(sig:string)=>{server.stop(true);console.log(`review: exiting — received ${sig}.`);process.exit(0);};process.once('SIGINT',()=>stop('SIGINT'));process.once('SIGTERM',()=>stop('SIGTERM'));
132
132
  if(fromReport&&selection)console.error(animationDiagnostic(selection));
133
133
  console.log(`Review ready: ${url}\nPackage: ${p.manifest.title} (${p.manifest.revision})\nSource SHA-256: ${p.sourceHash}\nPress Ctrl+C to stop.`);
@@ -56,22 +56,22 @@ const REGIONS: readonly {
56
56
  {
57
57
  key: 'setupBlockRow',
58
58
  placeholder: '<!-- shared:setup-block-row -->',
59
- start: '<nav class="block-row" aria-label="Setup blocks">',
59
+ start: '<nav class="block-row" role="tablist" aria-label="Setup blocks">',
60
60
  end: '<section id="selected-part"',
61
61
  compareEnd: '<section id="selected-part"',
62
62
  },
63
63
  {
64
64
  key: 'setupPanels',
65
65
  placeholder: '<!-- shared:setup-panels -->',
66
- start: '<section id="modeling-tools">',
66
+ start: '<section id="modeling-tools"',
67
67
  end: '</section><section id="inspector-playback"',
68
68
  compareEnd: '</section><section id="inspector-playback"',
69
69
  },
70
70
  {
71
71
  key: 'animateBlockRow',
72
72
  placeholder: '<!-- shared:animate-block-row -->',
73
- start: '<nav class="block-row" aria-label="Animate blocks">',
74
- end: '<section id="motion-tools">',
73
+ start: '<nav class="block-row" role="tablist" aria-label="Animate blocks">',
74
+ end: '<section id="motion-tools"',
75
75
  compareEnd: '<div class="compare-info">',
76
76
  },
77
77
  {
@@ -84,7 +84,7 @@ const REGIONS: readonly {
84
84
  {
85
85
  key: 'animatePanels',
86
86
  placeholder: '<!-- shared:animate-panels -->',
87
- start: '<section id="motion-tools">',
87
+ start: '<section id="motion-tools"',
88
88
  end: '</div></section></div></section></main>',
89
89
  compareEnd: '</div></section><section id="inspector-feedback"',
90
90
  },