rig-parts 2.56.0 → 2.58.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/docs/STABILITY.md CHANGED
@@ -593,7 +593,7 @@ and do not certify visibility. See the
593
593
  | `propose` | `--head-box` with `--full`, `--canvas`; optional `--no-back-hair`, `--write-config` (existing config, issue #356), `--help` (`-h`) |
594
594
  | `propose` | `--parts`, `--source`, `--out`; optional `--compare` or `--from-config` (one of them), `--keypoints`, `--person` and `--wrist-snap` (each with `--keypoints`), `--full`, `--head` (the turn control's depths; not with `--from-config`), `--grid-rule` (`figure` or `part`, the drafted lattice's spacing; not with `--from-config`), `--cloth` (a config whose `cloth` block is the recipe, issue #364; not with `--from-config`), `--write-config` (existing config for an ordinary proposal, issue #356; a new file with `--cloth`, issue #537; not with `--from-config` — additive: without it nothing `propose` writes changes), `--from` (the config the recipe is changed from, only with `--write-config`, issue #571 — additive: without it nothing `--write-config` writes changes), `--only-missing` (only with `--parts` and `--write-config`, not with `--cloth` or `--from-config`, issue #671 — additive: without it nothing `--write-config` writes changes) `--bust-landmarks` (rig-pixel apex_r/apex_l and optional cleavage; a `<file>.provenance.json` beside it is read and checked, and its pending shape needs `--write-config`, issue #1382), or `--no-bust` (non-blank omission reason), one required when drafting a chest-holding torso, both incompatible with `--from-config`; on a sampled body-turn neck config, either with `--write-config` and without `--full` / `--head` writes the chest alone (issue #1436), `--help` (`-h`) |
595
595
  | `propose` | `--parts`, `--source`, `--out`, `--full`, `--head`, `--write-config` together: the [neck draft](AUTHORING.md#a-neck-that-moves-on-its-own) for an existing config with `turn.body` and one neck plan row; reassembles under `<out>/rig`, preserves the sampled turn and drafts a rigid neck unit (issue #826) |
596
- | `bust-landmarks` | `--from-act`, `--parts`, `--config`, `--out`; optional `--write-config` (takes the act's `alpha`, `clearance`, `spacing`, `bone_r` and `bone_l` into the config's existing `meshes.<part>.contour.bust` when the act's three points are the declared ones, a field the act omits removed; the config is untouched when none differs, and when the act moves the points, whose shape is then pending in the record (issue #1443) — additive: without it nothing the command writes changes), `--help` (`-h`) (issue #1382; one `rig-review/act@9` chest row to the landmarks file `propose` reads, with `<out>.provenance.json` beside it) |
596
+ | `bust-landmarks` | `--from-act`, `--parts`, `--config`, `--out`; optional `--write-config` (takes the act's `alpha`, `clearance`, `spacing`, `bone_r` and `bone_l` into the config's existing `meshes.<part>.contour.bust` when the act's three points are the declared ones, a field the act omits removed; the config is untouched when none differs, and when the act moves the points, whose shape is then pending in the record (issue #1443) — additive: without it nothing the command writes changes), `--help` (`-h`) (issue #1382; one `rig-review/act@9` chest row, or the one row of a `rig-review/act@10` chest-landmarks carrier (issue #1539), to the landmarks file `propose` reads, with `<out>.provenance.json` beside it) |
597
597
  | `compare` | `--left`, `--right`; optional `--map`, `--help` (`-h`) |
598
598
  | `rig` | `--config`, `--parts`, `--out`; optional `--idle-keys` (ctl, direct), `--page-edges` (pot, free), `--pack-shape` (rect, polygon), `--page-size`, `--help` (`-h`) |
599
599
  | `check-parts` | `--parts`, `--out`; optional `--json`, `--help` (`-h`) |
@@ -643,8 +643,11 @@ derives a missing cleavage from the config's own `neck` and `hip` bones, and
643
643
  says which source the cleavage came from. A carrier that is not a contour mesh
644
644
  is refused by name, `PROPOSE_BUST_CARRIER_MESH`; the chest flags with `--full` or
645
645
  `--head` stay `PROPOSE_NECK_MODE`. The row digest rule (the sha256 of the row's `edit` with object keys sorted recursively, recomputed and refused on a mismatch) is a copy of review's request digest. The act's grammar is review's. This package reads
646
- `rig-review/act@9` only, and refuses another act version by name until a later
647
- minor version reads it.
646
+ `rig-review/act@9`, and from issue #1539 the `chest-landmarks` carrier of a
647
+ `rig-review/act@10` comment-only act, and refuses another act version by name
648
+ until a later minor version reads it. A record written from an act@10 carries
649
+ `act.carrier_file` under the same spec `rig-parts-bust-landmarks-provenance/1`;
650
+ a record from an act@9 is byte-unchanged.
648
651
 
649
652
  The [command reference](AUTHORING.md#command-reference) describes each mode;
650
653
  [writing proposed config fields](AUTHORING.md#writing-proposed-config-fields)
@@ -752,7 +755,7 @@ part name, `[i]` an entry of a list):
752
755
  - **meshes.&lt;part&gt;.influences** — optional, at least one: `maxInfluences` (a whole number, 1 or more, or null for no cap), `floor` ("cut" or "continuous")
753
756
  - **meshes.&lt;part&gt;.ribs.&lt;chain&gt;** — required: `stations`
754
757
  - **meshes.&lt;part&gt;.contour** — required: `tolerance`, `margin`, `spacing`; optional: `maxEdge`, `budget`, `stray`, `bridges`, `regions`, `bust`
755
- - **meshes.&lt;part&gt;.contour.regions[i]** — required: `name`, `shape`, `bone`, `spacing`, `band`, and `cx`, `cy`, `r` for a circle or `points` for a polygon
758
+ - **meshes.&lt;part&gt;.contour.regions[i]** — required: `name`, `shape`, `bone`, `spacing`, `band`, and `cx`, `cy`, `r` for a circle or `points` for a polygon; optional: `cover`
756
759
  - **meshes.&lt;part&gt;.contour.bust** — required: `apex_r`, `apex_l`, `cleavage`; optional: `alpha`, `clearance`, `bone_r`, `bone_l`, `spacing` (issue #475)
757
760
  - **meshes.&lt;part&gt;.auto** — required: `source`, `sourceBounds`, `targets`, `influences`, `budget`, `minArtSamples`, `motion`; optional: `protect`, `regions`, the three Stage B opt-ins `boundaryRuns`, `retriangulate`, `removalOrder`, and `stimulus`
758
761
  - **meshes.&lt;part&gt;.auto.source** — required: `tolerance`, `margin`, `spacing`; optional: `stray`
@@ -1171,7 +1174,7 @@ execution in historical evidence is inferred from a current export.
1171
1174
  | `parts.json`, `parts/<name>.png` | `assemble`, `build` | one record per part: `from` (`<run>:<tag>` with a See-through v3 tag, `<run>:author:<label>` for a layer the author made — issue #256, read by no role rule — or `painting:<name>` for a patch), `cut_from` on a cut's piece only (the plan part it was cut from, issue #230), `limb` on a limb segment's part only (issue #349: `name`, `segment`, `of`, `bone`, and below a joint `joint`, `range` when the config segment declares one (issue #360), and `cap` — `at`, `width`, `radius`, `box`, `layer_px`, `image_px` with a cap image, `image_layer` after it when that image was a hidden-art layer — issue #359, `<run>:<layer>:hidden` — `missing_px`, `short_px` (`left`, `right`) after it only when `missing_px` is above 0 (issue #557, additive), `excluded_px` after them only on a subset set's limb part whose cap the set exclusion took a pixel of (issue #603, additive: each pixel taken out of the count it was in, so the cap's counts are the written PNG's), then `shape` and `upper_px` under the segment's `cap_shape` — `upper_px` without the shape only when the upper segment gave a pixel (issue #557, additive) — and after them `lower_px`, `lower_kept_px` and `lower_missing_px` under `cap_shape: "ball"` (issue #579, additive), and `edge`, `feather_radius` and `feathered_px` under its `edge`, and `cut_band`, `cut_offset`, `cut_at`, `cut_crossed`, `joint_crossed`, `band_px` and `stroke_luma_max` (when the band has a split) under its `cut_band`, issue #360), the box `x`, `y`, `w`, `h` (rig px), the pixel counts `src/parts.ts` documents (`opaque_px`, `visible_px`, `occluded_px`, `projected_core_px`, `source_px_taken`, `visible_not_projected_px`, `refused_drift_px`, `merged_px` — on a subset set's limb part counted after the set exclusion, issue #603 — `seam_override_px`, and `fringe_pushed_back` when not empty); per-part `taken_layers` (with optional `transport`, issue #973, and optional `split` — `occluder`, `image`, `sha256`, `covered_px`, `visible_px` — on a split take, additive, issue #1242) and `provenance` (`unchanged_layer_px`, `hand_px`, `automatic_px`, `edits`, `automatic`, additive, issue #823); optional top-level [`assembly_config`](#assembly-config-reading), `motion_seams`, `occluder_plates` (one record per `assemble.occluders` entry declaring `plate` — `receipt`, `receipt_sha256`, `occluder_sha256`, `painting_sha256`, `output_sha256`, `mask_sha256`, additive, issue #1237), `occluder_grow` (one record per `assemble.occluders` entry with `grow > 0` — `occluder`, `image`, `grow`, `covered_px_before`, `covered_px_after`, additive, issue #1251), `occluder_guard` (one record per `assemble.occluders` entry with `guard > 0` — `occluder`, `image`, `guard`, `guarded_px_before`, `guarded_px_after`, additive, issue #1259), `alternates` and `cut_ownership` (one row per cut, independent of RGBA equality, issue #823, with optional `under_plate` — `receipt`, `receipt_sha256`, `occluder_sha256`, `painting_sha256`, `output_sha256`, `mask_sha256` — on a `{plate}` under, additive, issue #1230); `rig_size`, `scale_rig_per_source`, `ghost_px`, `recomposite`, and `scene` (`figure_alpha_above`, `figure_px`, `figure_mask`) under `config.scene` only, with the figure's mask `figure_rig.png` beside the recomposite (issue #242), and the same bytes beside `parts.json` when the two directories differ (issue #1177); `single_run_pad` (`file_size`, `side`, `left`, `top`) last, only for one run whose file is not the `seethrough.resolution` square (issue #366) |
1172
1175
  | `rig/rig.json`, `rig/motion.json`, `rig/images/` | `rig`, `build`, `compose` | rig-c's rig spec and motion spec, `spec` `rigc-rig/1` and `rigc-motion/1`: the format is rig-c's, and this package writes only what rig-c's parser accepts; a bone carries `inherit` only where config.bones declares one, rig-c's mode name as written (issue #348) |
1173
1176
  | `rig/mesh_report.json` | `rig`, `build` | one row per mesh: `part`, `vertices`, `triangles`, `hull`, `bones` (the sorted names the attachment's weights bind in the written `rig.json`, in every mode — since 1.49.1 (issue #536) a rig with `turn` or `stops` names the twins and `<link>_d` bones there, where the row named the segment bones they replace: a fix of a wrong name, not a format change; a rig with neither writes the bytes it wrote), `max_influences`, `mean_influences`, `art_coverage`, then `grid` (a lattice); or `mode` "explicit" with `image_sha256` and `region_sha256` (the verified guards; counts and coverage are measured from the supplied mesh, no legacy generator report is adopted); `mode` "contour" with `params`, `contour`, `regions` (`params.maxEdge` and `contour.outlineCut` only when the mesh declares `contour.maxEdge`; `params.bridges` and `contour.bridges` — `islands`, `units`, `joins`, and `faint` only when an island was left out as faint — only when it declares `contour.bridges`); or `mode` "influence" with `influence` (as declared), `reach` (`farthest`, `at`, `nearest`, `capped`, `widest`) and `lattice` (rig-c's `SegmentsLatticeReport`: `cols`, `rows`, `artCells`, `keptCells`, `passes`, `islands`) (issue #378); or `mode` "auto" with `settings`, `source`, `result`, `residuals`, `worst_residual`, `worst_region`, `motion_amplitude`, `termination`, `weights`, `regions`, `deformation`, `quality_report` (rig-c's `mesh-quality-report/1` document whole), `motion_report`, and, only when they apply, `stray_cleared` (after `source`, when `source.stray` is declared), `skinning_residual` and `replay` (`AutoMeshReport` in `src/rig.ts`); in every mode, `exponent` when the mesh declares one (after `grid`, or after `mode`); `influences`, as declared, when a lattice or contour mesh declares it (after `exponent`, or where `exponent` would be); `stray` and `stray_cleared` when a lattice mesh declares `stray` (after `influences`, or where `influences` would be); `ribs` when a contour or auto mesh declares them (after `exponent`, or after `mode`), and then `contour.ribs` (`source.contour.ribs` in the automatic mode) |
1174
- | `check/check.json` and the rest of `check/` | `check`, `build`, `compose` | [Check verdict spec](#check-report-rig-parts-check1) followed by the reference's fields in its order (`gate_spine_html_green`, `rigc_entry`, `pack_mode` (with `page_size` under `--page-size` only, issue #1273, additive), `environment` after it under `--environment` only (issue #538, additive: `path` as given, `sha256`, `steps`), `loop_max_diff`, the seam figures — `seam_mean`, `seam_px_over_40`, `seam_px_over_80` and, from issue #216, `seam_frame_scale`, the frame scale the bar divides the count by), `loop_physics` after `loop_max_diff` when the rig declares a physics constraint, `seam_border` after the seam figures when `parts.json` declares a scene (issue #242), `seam_pairs` after the seam figures when the seam bar fails or `--seam-pairs` asks (each row's picture under `check/seam/`; `--keep-stills` leaves the setup-pose still and its `frames.json` under `check/setup_still/`), then the judgement lines (`BREATH_VISIBLE`, `BLINK_NO_HOLE`, `CHAIN_LAG`, `TIP_OVER_ROOT`, `STILL_REGIONS_DARK`, `TEXTURE_STRETCH`), `ANIMATIONS_DO_NOT_FOLD` after them when `motion.json` holds an animation, the idle included — on every rig with an idle since issue #333 (issues #320, #363: `status`, `animations`, `fps`, `physics_left_out`, `folding` — each `animation`, `slot`, `attachment`, `frames`, `worst_frame`, `worst_triangles`, `triangles`, `physics_on`, `physics_off`, `physics_constraints`, `declared`, `line` — `folding_undeclared`, `declared_not_folding`, `bar`), `FEET_STAY_LEVEL` after it when a `footwear` part rides a bone that hangs from another and `motion.json` holds an animation (issue #348: `status`, `reason` on a SKIP only, `animations`, `fps`, `physics_left_out`, `bar_degrees`, `bar`, `feet` — each `part`, `bone`, `hangs_from`, `status`, `frames_posed`, `worst`), `LIMB_ONE_BONE` after it (and after `STRESS_OFF_CHAIN` where that is written) when `parts.json` holds a limb segment's part (issue #349: `status`, `parts` — each `part`, `limb`, `bone`, `status`, `others`), `SEAM_OVER_RANGE` after it when a limb record carries a `range` (issue #360: `status`, `frame_scale`, `physics_left_out`, `bar` — `mean`, `rig_px_over_40`, `level` — and `joints`, each `part`, `limb`, `segment`, `joint`, `bone`, `range`, `at`, `radius`, `under_px`, `status`, `poses` — each `degrees`, `status`, `mean`, `px_over_40`, `px_over_80`, `rig_px_over_40`, and `step_px` (`left`, `right`) only on a joint whose cap record carries `short_px` (issue #557, additive) — and `unread` on a joint not read), `SEAM_OVER_MOTION` after it when `parts.json` holds a limb segment or `--requirements` a `seam` (issue #493 retains existing pair warnings; issue #686 gates proven body-root pairs only, on gapOpen plus UNDER-owned ghost: `status` — `WARN`, `CLEAR`, `SKIP` or `FAIL` — `reason` on a SKIP only, `fps`, `floor`, `pairs` — each `pair`, `a`, `b`, `declared`, optional `root` (`limb`, `bone`, `parent`) on a proven body-root pair, and `unread` on a pair not read — `animations`, `warnings`, `rows` — each `pair`, `animation`, `status`, `drawn`, `banded`, `opens`, `px`, `max_px`, `under_floor`, and only on new-root rows stock `gapOpen` plus UNDER-owned `ghostA`/`ghostB` cells selected by resolved per-frame draw order gate their summed count against the unchanged strict one-cell floor on the original raw kind boxes (their union when both kinds contribute), never narrowed partition boxes, while `gapCovered` and OVER-owned ghost cells are excluded (issue #711); `cells` retains partition counts, UNDER owner and counted total, `worst` retains frame/count/cell/box, and `roots` retains status, mode `gap-open+under-ghost`, ghost_owner `resolved-draw-order`, pairs, failed, reason and optional unmeasured bindings; eligible candidates whose valid setup bands are all zero retain a named unmeasured root and SKIP bar, including when no pair is selected; measured root FAIL wins over SKIP, while measured PASS plus an unmeasured root remains SKIP; every eligible body drawing with stock setup `banded > 0` is selected, including both when a parent is shared; issue #708 resolves a body slot on its exact generated turn child to the same named carrier only after unique identity-bone/control/per-part-transform proof, without changing pair identity, setup selection or the direct-carrier path; setup-only observation preserves the authored motion and default drawing, root-free inputs add no setup compile/render, and no animation remains SKIP rather than a measured zero; existing internal pair warnings and their exits are unchanged; issue #941 adds optional `required` only under the requirements file's `seam_over_motion.required: true` — `status` (`PASS` or `FAIL`), `mode` `gap-open`, `bar_px` 0, `pairs` (each `pair`, `class` — `body-root`, `internal-joint` or `explicit` — `frames`, `background_frames`, `max_px`) and `failed` — and with it the key is written even when no pair is declared; issue #591 adds optional `worlds` on physics rigs with readable declared pairs and animations: `default` and `still`, each `wind`, `gravity`, `status` (`REPORTED` or `SKIP`), `reason` on SKIP, `dir` only when rendered (relative to check.json: `seam_motion/default` or `seam_motion/still`, the complete retained render with frames.json and each animation's raw seam.json), and `rows` — pair, animation, status, drawn, banded, `gap` and `ghost`, each `max_px` and `worst` only; worst carries `index`, `px`, `cell`, `box`. Per-frame hits stay in the raw sidecars. These raw reference readings add no bar or warning and leave the custom environment reading unchanged), `CLOTH_SETTLES` after it when the rig declares a physics constraint and has an idle (issue #501, a warning and not a bar: `status` — `WARN` or `CLEAR` — `fps`, `frames`, `duration`, `floor_rig_px_per_s`, `floor`, `levers`, `warnings`, `rows` — each `tip`, `root`, `links`, `point`, `settles_at`, `max_rig_px_per_s`, `min_rig_px_per_s`), `PHYSICS_CONTRIBUTES` after it when the rig declares a physics constraint and has an idle and parts (issue #1320, report-only, no bar and no threshold: `status` — `WARN` when a part under physics reads exactly 0, else `CLEAR`; a named `SKIP` writes no key — `off` (what "physics off" means: the same compiled build posed with the poser's physics off, not the spec with its constraints left out), `points`, `world`, `poser`, `fps`, `frames`, `warnings`, `rows` — each `part`, `constraints`, `external_force`, then `vertices`, `frames_read`, `max_rig_px`, `p95_rig_px`, `mean_rig_px`, `max_of_diagonal`, `moves`, or `unmeasured` with its reason), `RECOMPOSITE_HOLES` (its first figure `declared_scene` when `parts.json` declares a scene), `SETUP_POSE_VS_SOURCE`, `WIND_BAND` after it under `--wind-band` only (issue #590, additive: `status` `"REPORTED"`, `spec` `"rig-parts-wind-band/1"`, `path` as given, `sha256`, `steady_wind_only` `true`, `gravity` `[0, 1]`, `min`, `max`, `step`, `steps`, `fps`, `animations`, `max_gap`, `max_ghost`, `holds_from`, `holds_to`, `pairs_holding_all`, and `pairs` — each `pair`, `a`, `b`, `holds_all`, `holds_from`, `holds_to`, `first_break_below`, `first_break_above`, `worst_gap`, `worst_ghost`, `steps`), `skipped`, `config` under `build` only (issue #607, additive: `path` as `--config` was typed, `sha256` of the bytes the build read; `check` and `compose` read no config and write none), a `requirements` block under `--requirements` (or `build`'s `config.requirements`) — `file` first from issue #556, additive: `path` as typed or declared, `sha256`, `keys` — and `PASS`; `check/build/skeleton.json`, `.atlas` and `.png` are the packed artifact rig-c writes, and `check/build-report.json` (`<out>/build-report.json` under standalone `check`) is rig-c's own `build-report/1` (`--report`) for that primary packed compile, written verbatim by `rigc` beside `check/build/` (and listed in `check/build/run.json`'s `outputs[]` as `../build-report.json`) on a failing compile as on a green one (issue #1394; `rig` keeps no compile report because its gate and `--lead-in` compiles are throwaway scratch runs whose outputs are deleted). Missing stock partitions or resolved owner are named refusals, never zero. No whole-box exemption or consumer compositor remains; internal warnings and reference raw readings are unchanged. |
1177
+ | `check/check.json` and the rest of `check/` | `check`, `build`, `compose` | [Check verdict spec](#check-report-rig-parts-check1) followed by the reference's fields in its order (`gate_spine_html_green`, `rigc_entry`, `pack_mode` (with `page_size` under `--page-size` only, issue #1273, additive), `environment` after it under `--environment` only (issues #538, #1554, additive: `path` relative to `check`'s `--out`, `sha256`, `steps`), `loop_max_diff`, the seam figures — `seam_mean`, `seam_px_over_40`, `seam_px_over_80` and, from issue #216, `seam_frame_scale`, the frame scale the bar divides the count by), `loop_physics` after `loop_max_diff` when the rig declares a physics constraint, `seam_border` after the seam figures when `parts.json` declares a scene (issue #242), `seam_pairs` after the seam figures when the seam bar fails or `--seam-pairs` asks (each row's picture under `check/seam/`; `--keep-stills` leaves the setup-pose still and its `frames.json` under `check/setup_still/`), then the judgement lines (`BREATH_VISIBLE`, `BLINK_NO_HOLE`, `CHAIN_LAG`, `TIP_OVER_ROOT`, `STILL_REGIONS_DARK`, `TEXTURE_STRETCH`), `ANIMATIONS_DO_NOT_FOLD` after them when `motion.json` holds an animation, the idle included — on every rig with an idle since issue #333 (issues #320, #363: `status`, `animations`, `fps`, `physics_left_out`, `folding` — each `animation`, `slot`, `attachment`, `frames`, `worst_frame`, `worst_triangles`, `triangles`, `physics_on`, `physics_off`, `physics_constraints`, `declared`, `line` — `folding_undeclared`, `declared_not_folding`, `bar`), `FEET_STAY_LEVEL` after it when a `footwear` part rides a bone that hangs from another and `motion.json` holds an animation (issue #348: `status`, `reason` on a SKIP only, `animations`, `fps`, `physics_left_out`, `bar_degrees`, `bar`, `feet` — each `part`, `bone`, `hangs_from`, `status`, `frames_posed`, `worst`), `LIMB_ONE_BONE` after it (and after `STRESS_OFF_CHAIN` where that is written) when `parts.json` holds a limb segment's part (issue #349: `status`, `parts` — each `part`, `limb`, `bone`, `status`, `others`), `SEAM_OVER_RANGE` after it when a limb record carries a `range` (issue #360: `status`, `frame_scale`, `physics_left_out`, `bar` — `mean`, `rig_px_over_40`, `level` — and `joints`, each `part`, `limb`, `segment`, `joint`, `bone`, `range`, `at`, `radius`, `under_px`, `status`, `poses` — each `degrees`, `status`, `mean`, `px_over_40`, `px_over_80`, `rig_px_over_40`, and `step_px` (`left`, `right`) only on a joint whose cap record carries `short_px` (issue #557, additive) — and `unread` on a joint not read), `SEAM_OVER_MOTION` after it when `parts.json` holds a limb segment or `--requirements` a `seam` (issue #493 retains existing pair warnings; issue #686 gates proven body-root pairs only, on gapOpen plus UNDER-owned ghost: `status` — `WARN`, `CLEAR`, `SKIP` or `FAIL` — `reason` on a SKIP only, `fps`, `floor`, `pairs` — each `pair`, `a`, `b`, `declared`, optional `root` (`limb`, `bone`, `parent`) on a proven body-root pair, and `unread` on a pair not read — `animations`, `warnings`, `rows` — each `pair`, `animation`, `status`, `drawn`, `banded`, `opens`, `px`, `max_px`, `under_floor`, and only on new-root rows stock `gapOpen` plus UNDER-owned `ghostA`/`ghostB` cells selected by resolved per-frame draw order gate their summed count against the unchanged strict one-cell floor on the original raw kind boxes (their union when both kinds contribute), never narrowed partition boxes, while `gapCovered` and OVER-owned ghost cells are excluded (issue #711); `cells` retains partition counts, UNDER owner and counted total, `worst` retains frame/count/cell/box, and `roots` retains status, mode `gap-open+under-ghost`, ghost_owner `resolved-draw-order`, pairs, failed, reason and optional unmeasured bindings; eligible candidates whose valid setup bands are all zero retain a named unmeasured root and SKIP bar, including when no pair is selected; measured root FAIL wins over SKIP, while measured PASS plus an unmeasured root remains SKIP; every eligible body drawing with stock setup `banded > 0` is selected, including both when a parent is shared; issue #708 resolves a body slot on its exact generated turn child to the same named carrier only after unique identity-bone/control/per-part-transform proof, without changing pair identity, setup selection or the direct-carrier path; setup-only observation preserves the authored motion and default drawing, root-free inputs add no setup compile/render, and no animation remains SKIP rather than a measured zero; existing internal pair warnings and their exits are unchanged; issue #941 adds optional `required` only under the requirements file's `seam_over_motion.required: true` — `status` (`PASS` or `FAIL`), `mode` `gap-open`, `bar_px` 0, `pairs` (each `pair`, `class` — `body-root`, `internal-joint` or `explicit` — `frames`, `background_frames`, `max_px`) and `failed` — and with it the key is written even when no pair is declared; issue #591 adds optional `worlds` on physics rigs with readable declared pairs and animations: `default` and `still`, each `wind`, `gravity`, `status` (`REPORTED` or `SKIP`), `reason` on SKIP, `dir` only when rendered (relative to check.json: `seam_motion/default` or `seam_motion/still`, the complete retained render with frames.json and each animation's raw seam.json), and `rows` — pair, animation, status, drawn, banded, `gap` and `ghost`, each `max_px` and `worst` only; worst carries `index`, `px`, `cell`, `box`. Per-frame hits stay in the raw sidecars. These raw reference readings add no bar or warning and leave the custom environment reading unchanged), `CLOTH_SETTLES` after it when the rig declares a physics constraint and has an idle (issue #501, a warning and not a bar: `status` — `WARN` or `CLEAR` — `fps`, `frames`, `duration`, `floor_rig_px_per_s`, `floor`, `levers`, `warnings`, `rows` — each `tip`, `root`, `links`, `point`, `settles_at`, `max_rig_px_per_s`, `min_rig_px_per_s`), `PHYSICS_CONTRIBUTES` after it when the rig declares a physics constraint and has an idle and parts (issue #1320, report-only, no bar and no threshold: `status` — `WARN` when a part under physics reads exactly 0, else `CLEAR`; a named `SKIP` writes no key — `off` (what "physics off" means: the same compiled build posed with the poser's physics off, not the spec with its constraints left out), `points`, `world`, `poser`, `fps`, `frames`, `warnings`, `rows` — each `part`, `constraints`, `external_force`, then `vertices`, `frames_read`, `max_rig_px`, `p95_rig_px`, `mean_rig_px`, `max_of_diagonal`, `moves`, or `unmeasured` with its reason), `RECOMPOSITE_HOLES` (its first figure `declared_scene` when `parts.json` declares a scene), `SETUP_POSE_VS_SOURCE`, `WIND_BAND` after it under `--wind-band` only (issues #590, #1554, additive: `status` `"REPORTED"`, `spec` `"rig-parts-wind-band/1"`, `path` relative to `check`'s `--out`, `sha256`, `steady_wind_only` `true`, `gravity` `[0, 1]`, `min`, `max`, `step`, `steps`, `fps`, `animations`, `max_gap`, `max_ghost`, `holds_from`, `holds_to`, `pairs_holding_all`, and `pairs` — each `pair`, `a`, `b`, `holds_all`, `holds_from`, `holds_to`, `first_break_below`, `first_break_above`, `worst_gap`, `worst_ghost`, `steps`), `skipped`, `config` under `build` only (issue #607, additive: `path` as `--config` was typed, `sha256` of the bytes the build read; `check` and `compose` read no config and write none), a `requirements` block under `--requirements` (or `build`'s `config.requirements`) — `file` first from issues #556 and #1554, additive: `path` relative to `check`'s `--out`, `sha256`, `keys` — and `PASS`; `check/build/skeleton.json`, `.atlas` and `.png` are the packed artifact rig-c writes, and `check/build-report.json` (`<out>/build-report.json` under standalone `check`) is rig-c's own `build-report/1` (`--report`) for that primary packed compile, written verbatim by `rigc` beside `check/build/` (and listed in `check/build/run.json`'s `outputs[]` as `../build-report.json`) on a failing compile as on a green one (issue #1394; `rig` keeps no compile report because its gate and `--lead-in` compiles are throwaway scratch runs whose outputs are deleted). Missing stock partitions or resolved owner are named refusals, never zero. No whole-box exemption or consumer compositor remains; internal warnings and reference raw readings are unchanged. |
1175
1178
  | `part_support_domains.json` | `assemble`, `build` | optional `rig-parts-support-domains/1` independent cut masks and unavailable reasons, with per-domain config-entry provenance and parts/PNG/payload digests; additive beside parts.json, whose bytes and PNGs are unchanged. Legacy output may omit it. `PART_SUPPORT_REPORT` reads pairs in the assembly placement frame and Unowned in actual setup, never as an acceptance gate. |
1176
1179
  | `layers.json`, `<index>_<name>.png` | `layers --export` | the wrapper form `layers` reads (issue #359): `width`, `height`, then `layers` — each `name`, `filename`, `left`, `top`, `right`, `bottom`, `depth_median` (the input's own; `null` for a PSD, the manifest's order then being the draw order) — drawn layers in draw order, then the hidden-art layers; a PNG's name is its index and its layer's name, and the manifest, not the file name, says which layer it is |
1177
1180
  | the template `.psd` | `layers --template` | one empty layer per name `templateLayerNames` (`src/layers.ts`) holds, bottom first; the same canvas writes the same bytes |
@@ -1192,7 +1195,7 @@ execution in historical evidence is inferred from a current export.
1192
1195
  | `compose-run.json` | `compose` | spec `rig-compose-run/1` (issue #1348), separate from `rig-run/1`; a stable contract as of 2.44.0. Written at the `--out` root only after the gate and check are green and no accepted failing character remains, so an `--accept` preview writes none. Fixed keys in order: `spec`, `scene` (`path`, `sha256`), `characters` (each `id`, `build`, `files`, each file `path`, `sha256`, then optional `placement`), `plate` (`path`, `sha256`, or null), `plates` (each `name`, `path`, `sha256`). Scene and plate paths are the supplied and declared paths; character file paths are build-relative. Characters sort by `id`, files by `path`, named plates by `name`, in code-unit order. Each character's files are exactly `check/check.json`, `parts.json`, `rig/rig.json`, `rig/motion.json` and each distinct image the default skin names under `rig/images/`, including a generator's depth image. Every `sha256` is of the raw file bytes compose consumed before the gate. Only a character with `canvas_clip: true` has `placement`, with `canvas_clip: true`, `bounds` and `clipped_bounds` in that order from the scene report. There are no clocks, directory extras, requirements or CLI-option inventory, so identical inputs at identical supplied paths give identical record bytes. Compose owns the name: a file of that name at the `--out` root is deleted at the start of every compose, before stage validation, so a refused rerun leaves none. For scenes without opt-in, legacy outputs retain stable bytes, with the existing nested Core receipt clock comparison described above. |
1193
1196
  | the scene report | `compose` | spec `spine-parts-scene-report/1`; the plate block carries `sha256` of the plate PNG's bytes after `size` (issue #1183, additive under *What "stable" means here*: a new report key in a minor version, so the spec stays `/1`); `pack_mode` records `page_size` only when `--page-size <px>` is given (issue #1352, additive; without `--page-size`, rigc's default 2048 px page and padding 2 on each side bound any plate or region side to at most 2044 px before `CE_ATLAS_REGION_EXCEEDS_PAGE`) |
1194
1197
  | `idle.png`, `idle-indexed.png`, `idle.gif` | `loop`, `build --loop` | APNG and GIF encodings of the rendered idle |
1195
- | `run.json` | `rig`, `assemble` | spec `rig-run/1` (issue #1165, additive): `spec`, `package` (`name`, `version`), `command` (`"rig"` or `"assemble"`), `started_at` and `finished_at` (UTC ISO-8601 millisecond timestamps ending in `Z`, read in the CLI layer), `config` (`path` relative to `--out`, `sha256` of the config file on disk), `inputs` on `assemble` (issue #1316, additive: one `{role, path, sha256}` entry for each of `--source`, `--full` and `--head` that was given, in that order, with `path` relative to the run's cwd and `sha256` of the file or of the directory's `layers.json`), and `outputs` (`path` relative to `--out`, `sha256` of each written output file on disk, sorted by `path` in code-unit order and excluding `run.json` itself); written only after the command's gate is green |
1198
+ | `run.json` | `rig`, `assemble` | spec `rig-run/1` (issue #1165, additive): `spec`, `package` (`name`, `version`), `command` (`"rig"` or `"assemble"`), `started_at` and `finished_at` (UTC ISO-8601 millisecond timestamps ending in `Z`, read in the CLI layer), `config` (`path` relative to `--out`, `sha256` of the config file on disk), `inputs` on `assemble` (issues #1316, #1554, additive: one `{role, path, sha256}` entry for each of `--source`, `--full` and `--head` that was given, in that order, with `path` relative to `--out` by the per-platform link rule — naming `<dir>/layers.json` when given a directory — and `sha256` of the file `path` names), and `outputs` (`path` relative to `--out`, `sha256` of each written output file on disk, sorted by `path` in code-unit order and excluding `run.json` itself); written only after the command's gate is green |
1196
1199
  | the difference inventory (`--out`) | `diff-components` | spec `rig-parts-diff-components/1` by default (issue #1005: `stack`, `painting`, `definition`, `error_px`, `uncovered_error_px`, `components` — each `id`, `px`, `box`, `coverage`, `uncovered_px`, `borders` — and `below_floor`, byte-identical to 2.38.1), and spec `rig-parts-diff-components/2` under `--owners` (issue #1291: adds `owners` — each `{part, px}`, the topmost `parts.json` part above `COVERED_ALPHA` per covered pixel, back to front — before `borders` on every component); `--verify` verifies both `/1` and `/2` reports (with `--owners`, `/2` is required), while a `/1`-only reader (`readDiffComponents(text, input, [DIFF_COMPONENTS_SPEC])`) refuses `/2` by name |
1197
1200
  | the draft comparison (`--out`) | `diff-drafts` | spec `rig-parts-draft-diff/1` (issue #1369), a stable contract as of 2.45.0: fixed keys in order `spec`, `left` and `right` (each `parts_sha256`, `part_count`, `composite_sha256`), `canvas` (`width`, `height`), `order` (`"same"` or `"changed"`), `parts` (one entry per part name in the union of both sides, sorted by `name` in code-unit order: `name`, `status`, then `left` and `right` on the sides that hold the part, each `sha256`, `box`, `index`, then `pixels_equal` and `pixels` on `changed` only), `composite` and `summary`; no clock and no file paths. The command records no threshold and judges nothing; it exits 0 whenever the report is written. [Draft-to-draft assemble comparison](AUTHORING.md#draft-to-draft-assemble-comparison-issue-1369) defines each field. |
1198
1201
  | the external mask receipt (`--out`) | `external-receipt` | spec `rig-parts-external-receipt/1` (issue #1368), a stable contract as of 2.45.0: keys in write order `spec`, `kind` (`"mask"`), `file` and `painting` (each `path` relative to the receipt directory, then `sha256` of the file bytes), `grid` (`width`, `height` of the decoded painting) and `producer` (`tool`, optional `model`, then exactly one of `checkpoint_sha256`, `graph_sha256`, `script_sha256`); UTF-8 JSON, two-space indentation, trailing newline. `--verify` reads it back and writes nothing. The producer is the caller's declaration, not a proof of which tool made the mask. [External mask receipt](AUTHORING.md#external-mask-receipt) defines each field. |
@@ -1400,9 +1403,9 @@ home path). On `assemble`, `inputs` sits between `config` and `outputs` (issue #
1400
1403
  additive): one `{ "role", "path", "sha256" }` entry (keys in that order) for each of
1401
1404
  `--source`, `--full` and `--head` that was given, in the fixed order `source`, `full`,
1402
1405
  `head` (an input not given is absent from the list, never `null` or guessed), with
1403
- `/`-separated `path` relative to the run's working directory and `sha256` of the file
1404
- on disk, or of `<dir>/layers.json` when the input is a directory; `rig` writes no
1405
- `inputs` key. Every `sha256` is computed from the bytes on disk after writing. A refused
1406
+ `/`-separated `path` relative to `--out` by the `rig-run/2` link rule (naming
1407
+ `<dir>/layers.json` when the input is a directory, issue #1554) and `sha256` of the file
1408
+ `path` names on disk; `rig` writes no `inputs` key. Every `sha256` is computed from the bytes on disk after writing. A refused
1406
1409
  run writes no `run.json`. By default, `started_at` and `finished_at` record wall-clock
1407
1410
  time read in `cli.ts` (`src/` remains pure). With that default, `run.json` is outside
1408
1411
  the byte-for-byte
@@ -1432,6 +1435,163 @@ and writes no stamp. `build` and the in-process stages write no `run.json`.
1432
1435
  `rig-run/1` is stable: its keys, their order and their meaning do not change within
1433
1436
  the spec. A key added, removed or redefined is a new spec version.
1434
1437
 
1438
+ ### Run record (`check-run.json` and `build-run.json`, spec `rig-run/2`)
1439
+
1440
+ `check` writes `<out>/check-run.json` whenever the run completed its check report,
1441
+ green or not (issue #1541). `build` originally wrote `<out>/build-run.json` in this
1442
+ format. Its current contract is [the build run record](#build-run-record-build-runjson-spec-rig-run3). The names
1443
+ cannot be a `run.json`: `rig` and `assemble` write `rig-run/1` as `run.json`, and
1444
+ rigc writes its own `run.json` in a packed build directory (`check/build/`). Neither
1445
+ file is in `check.json`, and no byte comparison this package makes reads them.
1446
+
1447
+ ```json
1448
+ {
1449
+ "spec": "rig-run/2",
1450
+ "package": { "name": "@rig-c/parts", "version": "<package.json version>" },
1451
+ "command": "build",
1452
+ "started_at": "2026-11-25T00:00:00.000Z",
1453
+ "finished_at": "2026-11-25T00:00:01.000Z",
1454
+ "config": { "path": "../config.json", "sha256": "<hex>" },
1455
+ "outputs": [
1456
+ { "path": "check/check.json", "sha256": "<hex>" }
1457
+ ],
1458
+ "argv": ["build", "--config", "../config.json", "--source", "../painting.png", "--full", "../layers/full", "--out", "."]
1459
+ }
1460
+ ```
1461
+
1462
+ Key order is fixed as shown: `spec`, `package`, `command`, `started_at`,
1463
+ `finished_at`, `config` (`build` only; `check` reads no config), `outputs`, `argv`.
1464
+ `package` and the two times (`SOURCE_DATE_EPOCH` included) are as in `rig-run/1`.
1465
+ `config` is the config's `sha256` and its path relative to `--out`, using the
1466
+ same directory spelling rule as `argv` below. A config given through a link is
1467
+ recorded by the link's name.
1468
+ `outputs` lists every file under the paths the run cleared and wrote —
1469
+ for `check`, the report files its `wrote` line names and the directories it names
1470
+ (`build/`, `idle_frames/`, …); for `build`, the paths it clears before it starts —
1471
+ sorted by `/`-separated `path` in UTF-16 code-unit order, each with the `sha256` of
1472
+ its bytes. A run record is not listed: `run.json` (rigc's carries its own clock) and
1473
+ any `-run.json`. Two runs of the same inputs from the same layout differ only in
1474
+ `started_at` and `finished_at`.
1475
+
1476
+ `argv` is the command to re-run, then the options as given — not the defaults the
1477
+ run used — in the order of the command's flag table (`check --help` lists it):
1478
+ valued flags first, a repeated `--alt` in the order given, then the switches
1479
+ present. Each path and `--out` are taken from the working directory. On POSIX,
1480
+ the `--out` directory and the path's directory are resolved through their links.
1481
+ On Windows, both directories keep their supplied spelling. The path keeps its
1482
+ own name and is written relative to `--out` with `/` separators. `--out` itself
1483
+ is `.`. A path on another Windows drive is written as given. These arguments
1484
+ reproduce the check when run from the `--out` directory with the same package
1485
+ version. A switch's default is not written, so a later
1486
+ version that changed it would replay differently; that is why the version is in
1487
+ `package`. The record is written after the report, in place, and is never a reason to refuse
1488
+ the check; a run killed while writing it can leave a partial record, and no other
1489
+ file.
1490
+
1491
+ `rig-run/2` is stable on the same terms as `rig-run/1`. The `check` record retains
1492
+ the same format and bytes for the same files, invocation, version and times.
1493
+
1494
+ ### Build run record (`build-run.json`, spec `rig-run/3`)
1495
+
1496
+ `build` writes `<out>/build-run.json` when its check report completes, including a
1497
+ report with failing bars. Issue #1556 advances `spec` to `rig-run/3` and adds
1498
+ `inputs` between `config` and `outputs`. The fixed key order is `spec`, `package`,
1499
+ `command`, `started_at`, `finished_at`, `config`, `inputs`, `outputs`, `argv`.
1500
+ The other fields and the write timing follow the `rig-run/2` build contract above.
1501
+
1502
+ This example shows a build with full and head layer directories and one alternate tuple.
1503
+ The version and digests are illustrative, and the output list is abbreviated.
1504
+
1505
+ ```json
1506
+ {
1507
+ "spec": "rig-run/3",
1508
+ "package": { "name": "@rig-c/parts", "version": "2.57.0" },
1509
+ "command": "build",
1510
+ "started_at": "2026-11-25T00:00:00.000Z",
1511
+ "finished_at": "2026-11-25T00:00:01.000Z",
1512
+ "config": {
1513
+ "path": "../config.json",
1514
+ "sha256": "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff"
1515
+ },
1516
+ "inputs": [
1517
+ {
1518
+ "role": "source",
1519
+ "path": "../painting.png",
1520
+ "sha256": "112233445566778899aabbccddeeff00112233445566778899aabbccddeeff00"
1521
+ },
1522
+ {
1523
+ "role": "full",
1524
+ "path": "../layers/full/layers.json",
1525
+ "sha256": "2233445566778899aabbccddeeff00112233445566778899aabbccddeeff0011"
1526
+ },
1527
+ {
1528
+ "role": "head",
1529
+ "path": "../layers/head/layers.json",
1530
+ "sha256": "33445566778899aabbccddeeff00112233445566778899aabbccddeeff001122"
1531
+ },
1532
+ {
1533
+ "role": "alt[0].source",
1534
+ "path": "../side/painting.png",
1535
+ "sha256": "445566778899aabbccddeeff00112233445566778899aabbccddeeff00112233"
1536
+ },
1537
+ {
1538
+ "role": "alt[0].full",
1539
+ "path": "../side/full/layers.json",
1540
+ "sha256": "5566778899aabbccddeeff00112233445566778899aabbccddeeff0011223344"
1541
+ },
1542
+ {
1543
+ "role": "alt[0].head",
1544
+ "path": "../side/head/layers.json",
1545
+ "sha256": "66778899aabbccddeeff00112233445566778899aabbccddeeff001122334455"
1546
+ }
1547
+ ],
1548
+ "outputs": [
1549
+ {
1550
+ "path": "check/check.json",
1551
+ "sha256": "778899aabbccddeeff00112233445566778899aabbccddeeff00112233445566"
1552
+ }
1553
+ ],
1554
+ "argv": [
1555
+ "build", "--config", "../config.json", "--source", "../painting.png",
1556
+ "--full", "../layers/full", "--head", "../layers/head", "--out", ".",
1557
+ "--alt", "side=../side/painting.png:../side/full:../side/head"
1558
+ ]
1559
+ }
1560
+ ```
1561
+
1562
+ Each entry has keys `role`, `path`, `sha256` in that order. The array follows this
1563
+ order regardless of where each flag appears in `argv`.
1564
+
1565
+ | Order | Role | CLI input | File hashed |
1566
+ | --- | --- | --- | --- |
1567
+ | 1 | `source` | `--source` | Painting PNG |
1568
+ | 2 | `full` | `--full` | `<dir>/layers.json` for a directory, or the supplied manifest or PSD |
1569
+ | 3 | `head` | `--head` | `<dir>/layers.json` for a directory, or the supplied manifest or PSD |
1570
+ | 4 | `requirements` | `--requirements` | Requirements JSON |
1571
+ | 5 | `environment` | `--environment` | Environment schedule JSON |
1572
+ | 6 | `wind-band` | `--wind-band` | Wind-band spec JSON |
1573
+ | For each `--alt` in CLI order, first | `alt[i].source` | Tuple source | Alternate painting PNG |
1574
+ | For each `--alt` in CLI order, second | `alt[i].full` | Tuple full | `<dir>/layers.json` for a directory, or the supplied manifest or PSD |
1575
+ | For each `--alt` in CLI order, third | `alt[i].head` | Tuple head | `<dir>/layers.json` for a directory, or the supplied manifest or PSD |
1576
+
1577
+ `i` is zero-based and counts the `--alt` occurrences. Entries for optional flags
1578
+ or tuple members appear only when supplied. The array inventories CLI file
1579
+ inputs. References declared only inside the config and files referenced by a
1580
+ layer manifest are outside this inventory. `config` binds `--config` separately,
1581
+ and `--out` is the output root.
1582
+
1583
+ The run-record writer reads and hashes the raw bytes on disk of the file named by
1584
+ `path` after the check report completes. Keep input files and link targets unchanged
1585
+ from the start of the build until it exits so these digests describe the bytes the
1586
+ stages read.
1587
+
1588
+ Each path uses the shared `--out` link rule. On POSIX the output directory and
1589
+ the file's parent directory resolve through links, and the final filename is kept,
1590
+ including when that filename is a link. On Windows the path is rebased as spelled. Relative
1591
+ paths use `/` separators. A file on another Windows drive is recorded by its
1592
+ file path as given, with `layers.json` appended when the argument names a directory.
1593
+ The paths are relative to the build's `--out` root.
1594
+
1435
1595
  ## Environment
1436
1596
 
1437
1597
  The installed package reads two environment variables and no other: `PATH`, where
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rig-parts",
3
- "version": "2.56.0",
3
+ "version": "2.58.0",
4
4
  "description": "AI-authored 2D character parts from one anime painting and its See-through layer decomposition: measured parts, weighted-mesh rig specs, verified through rig-c before anything is written. A CLI for agents that cannot see the image.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -75,7 +75,7 @@
75
75
  },
76
76
  "dependencies": {
77
77
  "ag-psd": "^31.0.2",
78
- "@rig-c/core": "3.8.1"
78
+ "@rig-c/core": "3.9.1"
79
79
  },
80
80
  "devDependencies": {
81
81
  "@esotericsoftware/spine-core": "4.3.13",
package/src/build.ts CHANGED
@@ -70,6 +70,7 @@ import { setFocusProblems } from './setfocus.ts';
70
70
  import { createHash } from 'node:crypto';
71
71
  import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, statSync, writeFileSync } from 'node:fs';
72
72
  import { basename, dirname, join, relative, resolve, sep } from 'node:path';
73
+ import { makeOutDir } from './outputpaths.ts';
73
74
  import { type AnimFrame, EncodeError, encodeApng, encodeIndexedApng, INDEXED_DEFAULTS } from './apng.ts';
74
75
  import { assemble, type AssembleResult, boxOf, cutLines, edgeSplitLines, ERROR_LIMIT, type ExcludedCount, excludedLines, setExclusions, islandLines, setIslandSources, type IslandCount, hiddenLines, SINGLE_RUN_FACE_TAGS, singleRunHeadBox, softOcclusionLine, driftLine, limbLines, FIGURE_MASK_FILE, figureMaskLines, figuresLine, groundWarning, holeKindsLine, holeLines, measurePinholes, measureRecomposite, pinholeProblems, pinholesLine, type ProjectRule, recomposite, recompositeRecord, scenePhrase, type SeamRule, sourceInRig, projectedStageFields, stageFields, uncoveredLine, underBox } from './assemble.ts';
75
76
  import { allocationClause, type Reducer, stageBClause, unboundedClause } from './automesh.ts';
@@ -1169,10 +1170,10 @@ export function assembleStage(input: AssembleStageInput, outs: AssembleOutputs,
1169
1170
 
1170
1171
  // Emit only after green: every refusal above has already thrown.
1171
1172
  if (input.resetBuildOutput === true) resetBuildOutput(dirname(outs.partsJson));
1172
- mkdirSync(outs.partsDir, { recursive: true });
1173
- mkdirSync(dirname(outs.partsJson), { recursive: true });
1174
- mkdirSync(dirname(outs.recomposite), { recursive: true });
1175
- mkdirSync(dirname(outs.errorMap), { recursive: true });
1173
+ makeOutDir(outs.partsDir);
1174
+ makeOutDir(dirname(outs.partsJson));
1175
+ makeOutDir(dirname(outs.recomposite));
1176
+ makeOutDir(dirname(outs.errorMap));
1176
1177
  const paintingBytes = encodePngBytes(result.paintingInRig);
1177
1178
  result.parts.painting_in_rig = { path: PAINTING_IN_RIG_FILE,
1178
1179
  sha256: createHash('sha256').update(paintingBytes).digest('hex'), resample: 'lanczos3-rgb-opaque' };
@@ -2427,6 +2428,19 @@ export function requirementText(name: string, line: RequirementLine): string {
2427
2428
  return `${name}: ${line.status} — ${[...(line.status === 'NOT MEASURABLE' ? [String(line.reason)] : []), ...rest.map(([k, v]) => `${k} ${showFigure(v)}`)].join('; ')}`;
2428
2429
  }
2429
2430
 
2431
+ /**
2432
+ * What a completed check wrote under its `--out`, as its `wrote` line names it: the report files in the order the
2433
+ * check wrote them, then the directories it wrote whole (`build`, and `idle_frames`, the requirements, seam and
2434
+ * setup-still directories when they were written). The `check-run.json` record lists the files under these.
2435
+ */
2436
+ export function checkWrote(r: CheckReport, out: string): { written: string[]; dirs: string[] } {
2437
+ return {
2438
+ written: r.written,
2439
+ dirs: ['build', ...(r.idle === null ? [] : ['idle_frames']), ...(r.requirements === null ? [] : [REQUIREMENTS_DIR]),
2440
+ ...(r.figures.seam_pairs === undefined ? [] : [SEAM_DIR]), ...(existsSync(join(out, STILL_DIR)) ? [STILL_DIR] : [])],
2441
+ };
2442
+ }
2443
+
2430
2444
  /**
2431
2445
  * Run the check and print its report. Returns the report; `figures.PASS` says
2432
2446
  * whether every bar was met, and each one that was not is printed as a FAIL
@@ -2520,7 +2534,8 @@ export function checkStage(input: CheckStageInput, rigc: RigcRunner, bin: string
2520
2534
  log(` ${summaryText(r.requirements.summary)}`);
2521
2535
  }
2522
2536
  log(` gate: rig-play ${fig.gate_spine_html_green ? 'green' : 'RED'} (${fig.rigc_entry.entry}${fig.rigc_entry.spine_core === null ? ', rigc\'s own validator' : `, the spine-core ${fig.rigc_entry.spine_core} round trip`})`);
2523
- log(` wrote ${r.written.map((w) => join(input.out, w)).join(', ')}, ${join(input.out, 'build')}/${r.idle === null ? '' : `, ${join(input.out, 'idle_frames')}/`}${r.requirements === null ? '' : `, ${join(input.out, REQUIREMENTS_DIR)}/`}${fig.seam_pairs === undefined ? '' : `, ${join(input.out, SEAM_DIR)}/`}${existsSync(join(input.out, STILL_DIR)) ? `, ${join(input.out, STILL_DIR)}/` : ''}`);
2537
+ const wrote = checkWrote(r, input.out);
2538
+ log(` wrote ${[...wrote.written.map((w) => join(input.out, w)), ...wrote.dirs.map((d) => `${join(input.out, d)}/`)].join(', ')}`);
2524
2539
  for (const p of r.problems) log(failLine(p));
2525
2540
  log(checkSummaryLine(r));
2526
2541
  return r;
@@ -2937,13 +2952,20 @@ export interface BuildRunners {
2937
2952
  scratch: string;
2938
2953
  }
2939
2954
 
2955
+ /** The `rig-run/3` record `build` writes beside its outputs after the check report (issues #1541, #1556). */
2956
+ export const BUILD_RUN_FILE = 'build-run.json';
2940
2957
  /** Every path `build` writes under `--out`, relative — and so every path it clears first. */
2941
- export const BUILD_OWNS: readonly string[] = ['parts', 'parts.json', SOURCE_COVER_FILE, PAINTING_IN_RIG_FILE, 'recomposite_rig.png', ERROR_MAP_FILE, 'rig', 'check', 'idle.gif', 'idle.png', 'idle-indexed.png'];
2958
+ export const BUILD_OWNS: readonly string[] = ['parts', 'parts.json', SOURCE_COVER_FILE, PAINTING_IN_RIG_FILE, 'recomposite_rig.png', ERROR_MAP_FILE, 'rig', 'check', 'idle.gif', 'idle.png', 'idle-indexed.png', BUILD_RUN_FILE];
2959
+ /** The single files a build may also write at the top of its `--out`, cleared with {@link BUILD_OWNS}. */
2960
+ export const BUILD_OWNS_FILES: readonly string[] = [CUT_MATERIAL_SOURCES, EDGE_RESIDUAL_FILE, SUPPORT_DOMAINS_FILE, FIGURE_MASK_FILE];
2942
2961
 
2943
2962
  function resetBuildOutput(out: string): void {
2944
- mkdirSync(out, { recursive: true });
2945
- for (const p of BUILD_OWNS) rmSync(join(out, p), { recursive: true, force: true });
2946
- for (const p of [CUT_MATERIAL_SOURCES, EDGE_RESIDUAL_FILE, SUPPORT_DOMAINS_FILE, FIGURE_MASK_FILE]) rmSync(join(out, p), { force: true });
2963
+ makeOutDir(out);
2964
+ // Bun on Windows returned EINVAL removing a relative path through a junction (BU1556C).
2965
+ // Resolve the spelling against cwd so the path is absolute and keeps the junction.
2966
+ const cleanupOut = sep === '\\' ? resolve(out) : out;
2967
+ for (const p of BUILD_OWNS) rmSync(join(cleanupOut, p), { recursive: true, force: true });
2968
+ for (const p of BUILD_OWNS_FILES) rmSync(join(cleanupOut, p), { force: true });
2947
2969
  }
2948
2970
 
2949
2971
  /** Only selects when cleanup occurs; the real config loader still decides validity. */