rig-parts 2.68.0 → 2.70.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
@@ -51,6 +51,73 @@ It binds the files at invocation and cannot prove that inference used that input
51
51
  See
52
52
  [Per-part provider maps](AUTHORING.md#per-part-provider-maps-897).
53
53
 
54
+ ## Parts replacement record
55
+
56
+ `replace-parts` (issue #1635) and `depth-apply --source-sha256` (issue #1642)
57
+ write a separate parts set and add a relative POSIX `replacement_record` path
58
+ to its `parts.json`. The path is `.parts-replacements/<source-sha256>.json`
59
+ within the output set.
60
+
61
+ | Field | Meaning |
62
+ | --- | --- |
63
+ | `spec` | Literal `rig-parts-replacement/1`. |
64
+ | `source_sha256` | SHA-256 digest of the complete source set inventory, including its active receipt and any earlier receipts. If supplied, `--source-sha256` must match this digest. |
65
+ | `result_sha256` | SHA-256 digest of the result inventory, including `parts.json` and excluding the new replacement record itself. |
66
+ | `rig_size` | The unchanged rig grid `[width, height]` in pixels. |
67
+ | `copied` | Sorted relative POSIX paths for files copied byte-for-byte. |
68
+ | `rederived` | Sorted relative POSIX paths regenerated for the revised set. |
69
+ | `omitted` | Sorted relative POSIX paths from the source set excluded from the revised set. |
70
+
71
+ Both digests hash compact UTF-8 JSON with a trailing LF. The inventory is an
72
+ array of `{path, bytes, sha256}` rows for regular files, with relative POSIX
73
+ paths sorted by code unit.
74
+
75
+ The colour variant omits `change` and carries `replaced`. Each edit records
76
+ `part`, `receipt`, `changed_px`, `changed_counted_px`, `changed_excluded_px`,
77
+ and `removed_opaque_px`. Optional `removed_opaque_regions` describes connected
78
+ removals and optional `historical` holds superseded source measurements.
79
+ A part with scalar depth also carries `depth` with its before and after
80
+ SHA-256 values (`from_sha256` and `sha256`), `reseeded`, support and measured
81
+ reading. Reseeding can return an identical sheet. The `receipt` carries the
82
+ edit's author declaration and both encoded PNG hashes. `from_sha256` is
83
+ required even when the caller omits `--source-sha256`. See the
84
+ [authoring command](AUTHORING.md#replace-parts) for the edit file.
85
+
86
+ The depth variant carries `change: "depth"`, `depth_changes`, and `groups`.
87
+ It omits `replaced`. `depth_changes` is sorted by base part. Each row has
88
+ `part`, `group`, `before`, and `after`. A clear has `group: null` and
89
+ `after: null`. An addition has `before: null`. Each present side has its
90
+ relative sheet `path`, encoded `bytes` and `sha256`, and the manifest's `near`
91
+ and `zScale`. A metadata-only depth change can name the same sheet bytes on
92
+ both sides, in which case the sheet path is `copied`. `groups` is sorted by
93
+ group and each row has `group`, `near`, and `zScale`. Each after side agrees
94
+ with its group's polarity and scale. Paths in `rederived` and `omitted` are
95
+ limited to `parts.json` and the changed, uniquely owned scalar depth sheets.
96
+
97
+ The depth writer verifies the source's active receipt against the source
98
+ before deriving. The result carries the source's receipt history byte for
99
+ byte and its own new active receipt. `rig` checks the active receipt against
100
+ the result alone. To prove lineage, verify the delta against both snapshots.
101
+ Their inventories must match by path, byte length and SHA-256 except for the
102
+ active result receipt, `parts.json`, and the sheets claimed by changed base
103
+ parts. In the two manifests, remove the active pointer and the changed base
104
+ parts' `depth` subtrees and require the remaining values to match. Each
105
+ declared difference must match the actual source and result depth subtrees
106
+ and the bytes of the sheets they own. The writer refuses a source carrying
107
+ `cut_material_sources.json` with [`DEPTH_RECORD_MANIFEST_BOUND`](AUTHORING.md#DEPTH_RECORD_MANIFEST_BOUND).
108
+
109
+ The stable named entry `@rig-c/parts/replace-parts` exports the following
110
+ without loading the CLI.
111
+
112
+ | Export | Contract |
113
+ | --- | --- |
114
+ | `replacementTreeDigest(root: string, options?: { result?: boolean }): string` | Returns the lowercase source inventory digest by default. Result mode discovers and excludes the active record through `parts.json` and requires that record to exist. |
115
+ | `REPLACEMENT_RECORD_SPEC` | Literal `rig-parts-replacement/1`. |
116
+ | `readReplacementRecord(bytes: Uint8Array): ReplacementRecord \| DepthReplacementRecord` | Parses the UTF-8 JSON record and reports shape problems. Narrow on `change === 'depth'` to read the depth variant. |
117
+ | `verifyDepthReplacementDelta(sourceRoot: string, resultRoot: string): DepthReplacementRecord` | Verifies the active depth receipt against the complete source and result parts roots, including the exact change inventory and retained receipt history, then returns the verified receipt. Pass `--out/set` as `resultRoot`. |
118
+ | `createDepthReplacementRecord(sourceRoot: string, resultRoot: string, groups: ReadonlyMap<string, { near: DepthChangeSide['near']; zScale: number }>, partGroups: ReadonlyMap<string, string \| null>): DepthReplacementRecord` | Derives the record from a staged result with the new active pointer set and its receipt file absent. Pass each applied group's declared units and each changed base part's group or `null` for a clear. |
119
+ | `ReplacementRecord`, `DepthReplacementRecord`, `DepthChangeSide` | Exported types for the colour record, depth record, and one present side of a depth change. |
120
+
54
121
  ## Parts-stage integrity report
55
122
 
56
123
  `rig-parts check-parts --parts <assembled-dir> --out <disjoint-report-dir>
@@ -591,6 +658,7 @@ and do not certify visibility. See the
591
658
  | command | flags |
592
659
  | --- | --- |
593
660
  | `edited-part` | `--config`, `--part`, `--file`, `--from`, exactly one of `--editor` or `--producer`; optional `--parts` (`parts.json`), `--rig-config`, `--help` (`-h`) |
661
+ | `replace-parts` | `--parts`, `--edits`, `--out`; optional `--source-sha256`, `--help` (`-h`) (issue #1635, [replacement record](#parts-replacement-record)) |
594
662
  | `external-receipt` | `--kind` (mask), `--file`, `--painting`, `--producer`, `--out`; or `--verify`; or `--help` (`-h`) |
595
663
  | `diff-components` | `--stack`, `--painting`, `--parts`, `--floor`; optional `--threshold`, `--figure`, `--owners`, `--help` (`-h`); exactly one of `--out`, `--verify` (issues #1005, #1291; exhaustive native error inventory, `rig-parts-diff-components/1` by default and `rig-parts-diff-components/2` with `--owners`, and byte-bound reader for both) |
596
664
  | `diff-drafts` | `--left`, `--right`, `--out`; optional `--help` (`-h`) (issue #1369; draft-to-draft assemble comparison, `rig-parts-draft-diff/1`) |
@@ -598,7 +666,7 @@ and do not certify visibility. See the
598
666
  | `depth-prepare` | `--parts`, `--config`, `--out`; optional `--help` (`-h`) (issue #897; separate numeric-depth recipe) |
599
667
  | `depth-map` | `--array`, `--input`, `--kind` (`depth` or `normals`), `--part`, `--out`; optional `--padding` (`LEFT,TOP,RIGHT,BOTTOM`), `--help` (`-h`) (issue #1573; NumPy array to input-frame numeric map) |
600
668
  | `depth-bind` | `--map`, `--input`, `--part`; optional `--help` (`-h`) (issue #1284; exclusive receipt creation from current file bytes) |
601
- | `depth-apply` | `--parts`, `--manifest`, `--config`, `--rig-config`, `--out`; optional `--groups` (a comma-separated list of the recipe's groups to apply, issue #1449), `--help` (`-h`) (issue #897; original character config is read-only) |
669
+ | `depth-apply` | `--parts`, `--manifest`, `--config`, `--rig-config`, `--out`; optional `--groups` (a comma-separated list of the recipe's groups to apply, issue #1449), `--source-sha256` (a recorded source digest, issue #1642), `--help` (`-h`) (issue #897; original character config is read-only) |
602
670
  | `layers` | one positional path: a wrapper directory, a `layers.json` or a `.psd` (a file literally named `-h` is reached as `./-h`); with it, optional `--export` (a directory to write the wrapper form into, issue #359); or `--template` with `--canvas` and no path; or a positional head run with `--full`, `--source`, `--config` together for `PLAN_HEAD_GARMENT_OVERLAP` (issue #826); or `--help` (`-h`) |
603
671
  | `sheet` | `--source`, `--layers` (repeatable), `--out`; optional `--cell`, `--cols`, `--help` (`-h`) |
604
672
  | `inputs` | `--source`, `--config`, `--out`; optional `--help` (`-h`) |
@@ -1194,6 +1262,7 @@ execution in historical evidence is inferred from a current export.
1194
1262
  | `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) |
1195
1263
  | `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` (written when `seam` has no `parts.json`, or when `loop` has no `idle` or omitted physics constraints on a closed physics-off idle, issue #1590), `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. |
1196
1264
  | `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. |
1265
+ | `SETUP_SEAM_TRANSMISSION` in `check.json` | `check`, `build` | written only when a painting is registered on the setup grid (a hash-bound `painting_in_rig` or a declared `setup_painting` source), beside `PART_SUPPORT_REPORT` and before `config`, `requirements` and `PASS` (issue #1634, additive): `{ status: "REPORTED", rows }` sorted by `longest_lighter_run_px` descending, then `under`, then `over`; each row carries `under`, `over`, `longest_lighter_run_px`, `lighter_px`, `world_box`, `edge_length_px`, `sampled_px`, `painting_eligible_px`, `darker_px`, `worst_transmission`, `row_scope` (`"pair"`), `row_kind` (`"evidence"`), `row_subjects` (`[under, over]`). Outside `bar_outcomes`, the warning tally and the exit code; absent without a registered painting |
1197
1266
  | `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 |
1198
1267
  | the template `.psd` | `layers --template` | one empty layer per name `templateLayerNames` (`src/layers.ts`) holds, bottom first; the same canvas writes the same bytes |
1199
1268
  | `proposal.json`, `render/landmarks*.png` | `propose` | the config's four rig sections, `constraints` with `--cloth` (issue #364: a physics constraint per tree link named `<bone>_physics`, a dangling end's `<bone>_translate`, and a skirt swing's transforms `<swing>_<tree>`), `turn` with `--full`/`--head`, `proposed_rig_scale` (issue #354), and `notes` |
@@ -1218,7 +1287,8 @@ execution in historical evidence is inferred from a current export.
1218
1287
  | keyed scene camera | `compose` | optional `camera` in `spine-parts-scene/1` (issue #1596). A camera scene writes `spine-parts-scene-report/2` at the existing `scene.json` path with its keyed camera, sampled coverage and framing verdict, and packed model SHA-256. Scenes without a camera write report /1. Both report specs include `scene_driven` on new writes. The camera path uses Core animation easing and the posed backdrop at each sampled frame. Rig, motion and stock check outputs retain their existing semantics. The compose input receipt stays `rig-compose-run/1`. See [Keyed scene camera](AUTHORING.md#keyed-scene-camera-issue-1596) |
1219
1288
  | physics clips and scene repeats | `compose` | Issue #1615 adds `characters[].with_idle` and top-level `repeats` to `spine-parts-scene/1`. Each physics-only side clip requires literal `false` at any character scale or a safe integer count of at least 1 at scale 1. Numeric declarations fold whole periods into `idle` with exact duration equality. Both values retain `<id>:<clip>` subject to the character's scale checks, and the character report row echoes `with_idle` when declared. A scene repeat count is a safe integer of at least 2 on an authored take. Its duration remains the whole take length. Its tracks, deforms and camera keys use the exact duration divided by the count as their period. Repeated camera keys are expanded in report /2, with coverage on the full take clock and per-frame figure measurements. See [Physics clips and scene repeats](AUTHORING.md#physics-clips-and-scene-repeats-issue-1615) |
1220
1289
  | `idle.png`, `idle-indexed.png`, `idle.gif` | `loop`, `build --loop` | APNG and GIF encodings of the rendered idle |
1221
- | `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 |
1290
+ | `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), `parts_input` on standalone `rig` (`path`, `sha256`, issue #1636), `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 |
1291
+ | `check-run.json` | `check` | spec `rig-run/2`. Fixed keys in order are `spec`, `package`, `command`, `started_at`, `finished_at`, optional `parts_input` (`path`, `sha256`, issue #1636), `outputs` and `argv`. See the [run record contract](#run-record-check-runjson-and-build-runjson-spec-rig-run2). |
1222
1292
  | 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 |
1223
1293
  | 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. |
1224
1294
  | 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. |
@@ -1523,8 +1593,9 @@ The console prints only the reason after the binding name, for example
1523
1593
  | --- | --- |
1524
1594
  | `slider`, `clip`, `status` | Binding names and the diagnostic outcome, `PASS`, `FAIL`, or `SKIP`. |
1525
1595
  | `range`, `sample_count` | Inclusive resolved `[from, max]`, or `null` when no valid bone-driven range resolves, and the number of dial samples read. A complete sweep reads 13 evenly spaced values including both endpoints. Equal endpoints retain `[from, max]` with zero samples. |
1526
- | `peak` | `severity` (raw), `gate` (rounded), `dial_value`, `sample` (zero-based ordinal), `clip_frame` (integer on the clip grid, `null` off-grid), `clip_time_s` (applied time after wrapping), `slot`, `attachment`, `triangle`, `vertices`, and `edge`. Present when a peak was measured. |
1527
- | `reason` | Explains an unmeasured `SKIP`, refused bounds, or an incomplete sweep. A `SKIP` has zero samples and omits `peak`. A measured failing peak remains a `FAIL` when a different sample is missing. |
1596
+ | `last_passing_dial` | `{ lower, upper }` walking outward from midpoint sample 6: each side is the last consecutive passing grid sample (`from` or `max` when that side never fails), or `null` when midpoint sample 6 itself fails (by stretch or pose refusal). Present exactly when `peak` is; a row is `PASS` iff `lower === from` and `upper === max` (issue #1632). |
1597
+ | `peak` | `severity` (raw), `gate` (rounded), `dial_value`, `sample` (zero-based ordinal), `clip_frame` (integer on the clip grid, `null` off-grid), `clip_time_s` (applied time after wrapping), `slot`, `attachment`, `triangle`, `vertices`, `edge`, `area_share` (the peak triangle's rest area over its mesh's total rest area, rounded to 6 decimals), and `on_hull` (`true` iff at least one of the triangle's undirected edges is used by only one triangle of the mesh's rest triangles). Present when a peak was measured (issues #1627, #1632). |
1598
+ | `reason` | Explains an unmeasured `SKIP`, refused bounds, or an incomplete sweep. A `SKIP` has zero samples and omits `last_passing_dial` and `peak`. A measured failing peak remains a `FAIL` when a different sample is missing. |
1528
1599
  | `row_scope`, `row_kind`, `row_subjects` | Standard check-row metadata. The scope is `rig` with no part subjects. A `FAIL` is an advisory finding. |
1529
1600
 
1530
1601
  The stock console displays measured `FAIL` rows at the existing `WARN` level.
@@ -1554,6 +1625,7 @@ after all stage gates pass and all other output files are on disk:
1554
1625
  "started_at": "2026-11-07T00:00:00.000Z",
1555
1626
  "finished_at": "2026-11-07T00:00:01.000Z",
1556
1627
  "config": { "path": "../config.json", "sha256": "<hex>" },
1628
+ "parts_input": { "path": "../assembly", "sha256": "<hex>" },
1557
1629
  "outputs": [
1558
1630
  { "path": "images/cloth.png", "sha256": "<hex>" },
1559
1631
  { "path": "mesh_report.json", "sha256": "<hex>" },
@@ -1572,12 +1644,18 @@ additive): one `{ "role", "path", "sha256" }` entry (keys in that order) for eac
1572
1644
  `head` (an input not given is absent from the list, never `null` or guessed), with
1573
1645
  `/`-separated `path` relative to `--out` by the `rig-run/2` link rule (naming
1574
1646
  `<dir>/layers.json` when the input is a directory, issue #1554) and `sha256` of the file
1575
- `path` names on disk; `rig` writes no `inputs` key. Every `sha256` is computed from the bytes on disk after writing. A refused
1576
- run writes no `run.json`. By default, `started_at` and `finished_at` record wall-clock
1647
+ `path` names on disk; `rig` writes no `inputs` key. Standalone `rig` writes
1648
+ `parts_input` immediately after `config` (issue #1636), with `path` and `sha256`
1649
+ in that order. The directory named by `--parts` is rebased relative to `--out`
1650
+ by the same realpath rule as `config.path`. A directory that coincides with
1651
+ `--out` is recorded as `.`. The digest follows the [parts input snapshot](#parts-input-snapshot)
1652
+ contract. The config, assemble input and output hashes use the file bytes on disk
1653
+ after writing. A refused run writes no `run.json`. By default, `started_at` and
1654
+ `finished_at` record wall-clock
1577
1655
  time read in `cli.ts` (`src/` remains pure). With that default, `run.json` is outside
1578
1656
  the byte-for-byte
1579
1657
  determinism comparisons (`RG03`, `RG19`, `AS07`); for the same input at the same
1580
- relative `--config` layout, two `run.json` files differ only in `started_at` and
1658
+ receipt-relative input layout, two `run.json` files differ only in `started_at` and
1581
1659
  `finished_at`.
1582
1660
 
1583
1661
  Set `SOURCE_DATE_EPOCH` to opt into a fixed clock: both timestamps equal that
@@ -1589,7 +1667,7 @@ fractional, non-numeric, noncanonical and out-of-range values refuse
1589
1667
  `RUN_STAMP_EPOCH`, naming the variable, found value and requirement before any
1590
1668
  output is written or an existing stamp is removed. Unset preserves the existing
1591
1669
  wall-clock path and stamp format. Fixed clocks make stamps byte-identical for
1592
- identical inputs and the same relative config layout.
1670
+ identical inputs and the same receipt-relative input layout.
1593
1671
 
1594
1672
  `outputs` lists exactly the files the stage wrote in this run, derived from what the
1595
1673
  stage returns, not from a walk of `--out`: a stray or earlier file under `--out` is
@@ -1599,13 +1677,14 @@ neither hashed nor listed. Before the stage starts, the command removes an earli
1599
1677
  `package.json` without a non-empty `name` and `version` refuses `RUN_STAMP_PACKAGE`
1600
1678
  and writes no stamp. `build` and the in-process stages write no `run.json`.
1601
1679
 
1602
- `rig-run/1` is stable: its keys, their order and their meaning do not change within
1603
- the spec. A key added, removed or redefined is a new spec version.
1680
+ `rig-run/1` preserves the order and meaning of existing keys. The optional
1681
+ `parts_input` is additive and older stamps may omit it.
1604
1682
 
1605
1683
  ### Run record (`check-run.json` and `build-run.json`, spec `rig-run/2`)
1606
1684
 
1607
- `check` writes `<out>/check-run.json` whenever the run completed its check report,
1608
- green or not (issue #1541). `build` originally wrote `<out>/build-run.json` in this
1685
+ `check` writes `<out>/check-run.json` after the check report completes and the
1686
+ parts input snapshot is verified. The record can accompany a report with failing
1687
+ bars (issue #1541). `build` originally wrote `<out>/build-run.json` in this
1609
1688
  format. Its current contract is [the build run record](#build-run-record-build-runjson-spec-rig-run3). The names
1610
1689
  cannot be a `run.json`: `rig` and `assemble` write `rig-run/1` as `run.json`, and
1611
1690
  rigc writes its own `run.json` in a packed build directory (`check/build/`). Neither
@@ -1626,8 +1705,15 @@ file is in `check.json`, and no byte comparison this package makes reads them.
1626
1705
  }
1627
1706
  ```
1628
1707
 
1629
- Key order is fixed as shown: `spec`, `package`, `command`, `started_at`,
1630
- `finished_at`, `config` (`build` only; `check` reads no config), `outputs`, `argv`.
1708
+ The historical `build` key order is shown above. In `check-run.json` the fixed
1709
+ order is `spec`, `package`, `command`, `started_at`, `finished_at`, optional
1710
+ `parts_input`, `outputs`, `argv`. The `parts_input` object contains `path` and
1711
+ `sha256` in that order. Its directory is the explicit `--parts` or, when check
1712
+ reads a `parts.json` beside the rig, the `--rig` directory. The path is rebased
1713
+ relative to `--out` by the `config.path` directory and link rule below, with `.`
1714
+ for `--out` itself. The digest follows the [parts input snapshot](#parts-input-snapshot)
1715
+ contract. When check runs without a parts set, the key is absent and the legacy
1716
+ receipt bytes are preserved at the same clock.
1631
1717
  `package` and the two times (`SOURCE_DATE_EPOCH` included) are as in `rig-run/1`.
1632
1718
  `config` is the config's `sha256` and its path relative to `--out`, using the
1633
1719
  same directory spelling rule as `argv` below. A config given through a link is
@@ -1651,12 +1737,23 @@ is `.`. A path on another Windows drive is written as given. These arguments
1651
1737
  reproduce the check when run from the `--out` directory with the same package
1652
1738
  version. A switch's default is not written, so a later
1653
1739
  version that changed it would replay differently; that is why the version is in
1654
- `package`. The record is written after the report, in place, and is never a reason to refuse
1655
- the check; a run killed while writing it can leave a partial record, and no other
1656
- file.
1740
+ `package`. The record is written in place after the report and verification of the
1741
+ parts input snapshot. A run killed while writing the record can leave it partial.
1657
1742
 
1658
1743
  `rig-run/2` is stable on the same terms as `rig-run/1`. The `check` record retains
1659
- the same format and bytes for the same files, invocation, version and times.
1744
+ the same bytes for the same files, invocation, version and times.
1745
+
1746
+ #### Parts input snapshot
1747
+
1748
+ `parts_input.sha256` is the source-mode digest returned by
1749
+ `replacementTreeDigest` from `@rig-c/parts/replace-parts` on the resolved input
1750
+ directory. It covers all regular files in that directory, including any
1751
+ replacement record. The CLI takes
1752
+ the snapshot before clearing its previous receipt or writing stage outputs. An
1753
+ `--out` that overlaps the input directory can change that inventory during the
1754
+ run, so the record identifies the pre-stage tree. With disjoint directories the
1755
+ CLI also compares the digest after the stage. A change to that digest or to the
1756
+ resolved parts directory refuses the receipt as `RUN_PARTS_INPUT_CHANGED`.
1660
1757
 
1661
1758
  ### Build run record (`build-run.json`, spec `rig-run/3`)
1662
1759
 
@@ -2457,6 +2554,11 @@ groups against the same manifest and records it in the report's `selection`
2457
2554
  field (`groups`, `leftOut`), written after `cleared` and before `parts`; the
2458
2555
  field is absent without the flag, so those reports keep their bytes, and
2459
2556
  `recipeSha256` and `manifestSha256` are unchanged by a selection. A new depth stage never replaces Core's rig gate.
2557
+ `depth-apply --source-sha256` publishes an atomic bundle with the verified
2558
+ parts set in `--out/set/` and the generated `config.json` and
2559
+ `depth-report.json` beside `set/`. The set holds a depth-only
2560
+ [replacement record](#parts-replacement-record). Omit the flag to use the
2561
+ original flat output layout with the same bytes.
2460
2562
  `relief` is an explicit rig-pixel value, not an implicit width multiplier.
2461
2563
  Part-width and head-referenced calibrations are authored recipe choices;
2462
2564
  changing a calibration requires preparing its recipe again. Compare the same
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "rig-parts",
3
- "version": "2.68.0",
3
+ "version": "2.70.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": {
7
7
  "./assembly-reading": "./src/assembly-reading.ts",
8
8
  "./physics-clips": "./src/physics-clips.ts",
9
+ "./replace-parts": "./src/replacementrecord.ts",
9
10
  "./cloth-targets.json": "./src/cloth-targets.json",
10
11
  "./*": "./*"
11
12
  },
package/src/build.ts CHANGED
@@ -6,7 +6,7 @@ import { withoutCheckRows } from './checkrow.ts';
6
6
  import { readSetupFigureMask } from './setupfiguremask.ts';
7
7
  import { EDGE_RESIDUAL_FILE, edgeResidualLines } from './edgeresidual.ts';
8
8
  import { SUPPORT_DOMAINS_FILE, writeSupportDomains } from './supportdomains.ts';
9
- import { COINCIDE_LINE, supportLines } from './coincide.ts';
9
+ import { COINCIDE_LINE, SETUP_SEAM_TRANSMISSION_LINE, setupSeamTransmissionLine, supportLines } from './coincide.ts';
10
10
  import { DEFAULT_PROJECT_RULE } from './projectrule.ts';
11
11
  import { type PaintingAllocationReading, type PaintingAllocationEvent, EDGE_CONTRAST, PAINTING_ALLOCATION_FILE, PAINTING_EDGE_COVERAGE_TRANSFER } from './paintingedges.ts';
12
12
  import { SETUP_PAINTING_LINE, setupPaintingLines } from './setuppainting.ts';
@@ -116,6 +116,7 @@ import { type LayerSet, readLayers } from './layers.ts';
116
116
  import { placeBoneEntriesForSkeleton, poseBoneEntriesForDrawn, REGISTER_OFFSET_BAR, REGISTER_SCALE_BAR, registeredWithinBar, registerSkeleton, SKELETON_LIMB_BONES, skeletonDrawnLength, skeletonLimbJoints } from './limbs.ts';
117
117
  import { type AlternatePartsRecord, PAINTING_IN_RIG_FILE, FRONT_SUFFIX, type OccluderPlateRecord, type PartRecord, partImageReference, depthImageReference, readParts, readPartsManifest, type RecompositeRecord, type SingleRunPad, tagOf, writeParts } from './parts.ts';
118
118
  import { encodePngBytes, readPng, writePng } from './raster/png.ts';
119
+ import { verifyReplacementRecord } from './replaceparts.ts';
119
120
  import type { Raster } from './raster/types.ts';
120
121
  import { type Mask, newMask } from './raster/types.ts';
121
122
  import { type OtherLimbs, splitLines, capOwnershipLines, type SplitCount } from './assemble.ts';
@@ -1948,6 +1949,7 @@ export interface RigInputs {
1948
1949
  export function readRigInputs(config: string, partsDir: string, assemblyRules?: AssemblyRules): RigInputs {
1949
1950
  const { config: cfg, animations: from } = loadConfigAndAnimations(config);
1950
1951
  const parts = readParts(join(partsDir, 'parts.json'));
1952
+ verifyReplacementRecord(partsDir, parts);
1951
1953
  refuseStaleAssembly(config, parts, cfg, assemblyRules);
1952
1954
  const images = new Map<string, Raster>();
1953
1955
  const depthProblems: Problem[] = [];
@@ -2558,6 +2560,8 @@ export function checkStage(input: CheckStageInput, rigc: RigcRunner, bin: string
2558
2560
  if (artJoints !== undefined) for (const line of artJointLines(artJoints)) log(` ${line}`);
2559
2561
  const partSupport = fig[COINCIDE_LINE];
2560
2562
  if (partSupport !== undefined) for (const line of supportLines(partSupport)) log(` ${line}`);
2563
+ const seamTransmission = fig[SETUP_SEAM_TRANSMISSION_LINE];
2564
+ if (seamTransmission !== undefined) log(setupSeamTransmissionLine(seamTransmission));
2561
2565
  const setupPainting = fig[SETUP_PAINTING_LINE];
2562
2566
  if (setupPainting !== undefined) for (const line of setupPaintingLines(setupPainting)) log(` ${line}`);
2563
2567
  for (const line of boundaryColourLines(r.boundaryColour)) log(` ${line}`);
package/src/check.ts CHANGED
@@ -2,8 +2,8 @@ import { refuseStaleAssembly, type AssemblyRules } from './assembly-reading.ts';
2
2
  import { checkRow, checkSlotRow, checkSlotParts, serializeCheckRows, type CheckRowLabels } from './checkrow.ts';
3
3
  import { readSetupFigureMask } from './setupfiguremask.ts';
4
4
  import { readSetupBackdrop } from './setupbackdrop.ts';
5
- import { COINCIDE_LINE, type SupportReport } from './coincide.ts';
6
- import { observeSupport } from './coincideio.ts';
5
+ import { COINCIDE_LINE, SETUP_SEAM_TRANSMISSION_LINE, type SetupSeamTransmissionReport, type SupportReport } from './coincide.ts';
6
+ import { observeSetupSeamTransmission, observeSupport } from './coincideio.ts';
7
7
  import { SETUP_PAINTING_LINE, SETUP_PAINTING_UNCOVERED_WARNING, UNDECLARED_SETUP_PAINTING_REASON, setupPaintingBounds, setupPaintingLine, setupPaintingWarningCount, type SetupPainting, type SetupPaintingLine, type SetupPaintingObservation } from './setuppainting.ts';
8
8
  import { readMaterialSources } from './cutmaterialio.ts';
9
9
  import { CUT_MATERIAL_LINE, checkJointMaterial, type MaterialLine } from './cutmaterial.ts';
@@ -3002,6 +3002,8 @@ export interface CheckFigures {
3002
3002
  /** Written only when it reads a part under physics (issue #1320): {@link PhysicsContributionLine}, a warning, never a bar. */
3003
3003
  [PHYSICS_CONTRIBUTES_LINE]?: PhysicsContributionLine;
3004
3004
  [COINCIDE_LINE]?: SupportReport;
3005
+ /** Written only when a painting is registered on the setup grid (issue #1634): {@link SetupSeamTransmissionReport}, REPORTED. */
3006
+ [SETUP_SEAM_TRANSMISSION_LINE]?: SetupSeamTransmissionReport;
3005
3007
  RECOMPOSITE_HOLES: ReportedLine;
3006
3008
  /** Issue #933: openings inside the figure over motion across undeclared setup-overlapping layer pairs; omitted when SKIP. */
3007
3009
  figure_openings?: FigureOpeningReading;
@@ -3510,7 +3512,7 @@ export function checkStatuses(fig: Omit<CheckFigures, 'spec' | 'bar_outcomes' |
3510
3512
  const raw = fig as unknown as Record<string, unknown>;
3511
3513
  const out: Record<string, CheckStatus> = { gate: checkBarStatus(raw, 'gate'), loop: checkBarStatus(raw, 'loop'), seam: checkBarStatus(raw, 'seam') };
3512
3514
  for (const n of JUDGEMENT_LINES) out[n] = fig[n].status;
3513
- for (const n of [FOLD_LINE, LEVEL_LINE, STRESS_LINE, LIMB_LINE, SWEEP_LINE, MOTION_SEAM_LINE, CLOTH_LINE, PHYSICS_CONTRIBUTES_LINE, ...REPORTED_LINES, 'figure_openings', SOURCE_LINE, WIND_BAND_LINE, ART_JOINT_LINE, CUT_MATERIAL_LINE, SETUP_PAINTING_LINE, BOUNDARY_COLOUR_LINE, BEHIND_SEAM_LINE, SOURCE_EXPOSURE_LINE, COINCIDE_LINE] as const) {
3515
+ for (const n of [FOLD_LINE, LEVEL_LINE, STRESS_LINE, LIMB_LINE, SWEEP_LINE, MOTION_SEAM_LINE, CLOTH_LINE, PHYSICS_CONTRIBUTES_LINE, ...REPORTED_LINES, 'figure_openings', SOURCE_LINE, WIND_BAND_LINE, COINCIDE_LINE, SETUP_SEAM_TRANSMISSION_LINE, ART_JOINT_LINE, SETUP_PAINTING_LINE, BOUNDARY_COLOUR_LINE, BEHIND_SEAM_LINE, SOURCE_EXPOSURE_LINE, CUT_MATERIAL_LINE] as const) {
3514
3516
  const l = fig[n];
3515
3517
  if (l !== undefined) out[n] = l.status;
3516
3518
  }
@@ -7939,6 +7941,9 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
7939
7941
  const sourceExposure = exposureDeclared === undefined && !hasSourceStateMaps(inp.parts) ? null
7940
7942
  : measureSourceExposure(officialRenderer(), { build: buildDir, stage: inp.stage, parts: inp.parts, partsDir: inp.partsDir, imagesDir: typeof inp.rig.images === 'string' ? resolve(inp.rigDir, inp.rig.images) : join(inp.rigDir, 'images'), rig: inp.rig, fps: IDLE_FPS }, exposureDeclared, problems);
7941
7943
 
7944
+ // Issue #1634: setup seam transmission over shared normal-blend pair edges, only when a painting is registered on the setup grid.
7945
+ const seamTransmission = observeSetupSeamTransmission(buildDir, inp, reqFile?.setup_painting !== undefined);
7946
+
7942
7947
  // 5. the scene's declared requirements (issue #93), only under --requirements
7943
7948
  const reqProblems: Problem[] = [];
7944
7949
  const reqBlock = reqFile === null || reqRecord === null ? null : { file: reqRecord, ...measureRequirements(inp, reqFile, buildDir, out, rigc, reqProblems, seams ?? new Map(), measured) };
@@ -7987,6 +7992,7 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
7987
7992
  ...(Object.keys(skipped).length === 0 ? {} : { skipped }),
7988
7993
  ...(Object.keys(setsFigures).length === 0 ? {} : { sets: setsFigures }),
7989
7994
  ...(partSupport === null ? {} : { [COINCIDE_LINE]: partSupport }),
7995
+ ...(seamTransmission === null ? {} : { [SETUP_SEAM_TRANSMISSION_LINE]: seamTransmission }),
7990
7996
  ...(config === undefined ? {} : { config }),
7991
7997
  ...(artJoints === null ? {} : { [ART_JOINT_LINE]: artJoints }),
7992
7998
  ...(setupPainting === null ? {} : { [SETUP_PAINTING_LINE]: setupPainting }),
@@ -10325,6 +10331,13 @@ export interface SliderStretchPeak {
10325
10331
  triangle: number;
10326
10332
  vertices: StretchAt['vertices'];
10327
10333
  edge: StretchAt['edge'];
10334
+ area_share: number;
10335
+ on_hull: boolean;
10336
+ }
10337
+
10338
+ export interface SliderStretchPassingDial {
10339
+ lower: number | null;
10340
+ upper: number | null;
10328
10341
  }
10329
10342
 
10330
10343
  export interface SliderStretchRow {
@@ -10333,6 +10346,7 @@ export interface SliderStretchRow {
10333
10346
  status: 'PASS' | 'FAIL' | 'SKIP';
10334
10347
  range: [number, number] | null;
10335
10348
  sample_count: number;
10349
+ last_passing_dial?: SliderStretchPassingDial;
10336
10350
  peak?: SliderStretchPeak;
10337
10351
  reason?: string;
10338
10352
  }
@@ -10411,11 +10425,54 @@ function sliderMeshGeometry(mesh: AttachmentRest, pose: AttachmentPose): string
10411
10425
  }
10412
10426
  }
10413
10427
 
10428
+ interface SliderMeshFacts {
10429
+ triangle: (index: number) => { area_share: number; on_hull: boolean };
10430
+ }
10431
+
10432
+ function sliderMeshFacts(mesh: MeshRest): SliderMeshFacts | null {
10433
+ const { vertices: v, triangles: t } = mesh;
10434
+ const twiceAreas: number[] = [];
10435
+ const edgeUses = new Map<string, number>();
10436
+ const edgeKey = (p: number, q: number) => `${Math.min(p, q)},${Math.max(p, q)}`;
10437
+ for (let i = 0; i < t.length; i += 3) {
10438
+ const a = t[i], b = t[i + 1], c = t[i + 2];
10439
+ const twice = Math.abs((v[2 * b] - v[2 * a]) * (v[2 * c + 1] - v[2 * a + 1]) - (v[2 * b + 1] - v[2 * a + 1]) * (v[2 * c] - v[2 * a]));
10440
+ if (!Number.isFinite(twice)) return null;
10441
+ twiceAreas.push(twice);
10442
+ for (const key of new Set([edgeKey(a, b), edgeKey(b, c), edgeKey(c, a)])) {
10443
+ edgeUses.set(key, (edgeUses.get(key) ?? 0) + 1);
10444
+ }
10445
+ }
10446
+ const totalTwiceArea = twiceAreas.reduce((sum, area) => sum + area, 0);
10447
+ if (!Number.isFinite(totalTwiceArea) || totalTwiceArea <= 0) return null;
10448
+ return {
10449
+ triangle: index => {
10450
+ const i = 3 * index;
10451
+ const a = t[i], b = t[i + 1], c = t[i + 2];
10452
+ return {
10453
+ area_share: round6(twiceAreas[index] / totalTwiceArea),
10454
+ on_hull: [edgeKey(a, b), edgeKey(b, c), edgeKey(c, a)].some(key => edgeUses.get(key) === 1),
10455
+ };
10456
+ },
10457
+ };
10458
+ }
10459
+
10460
+ function sliderLastPassingDial(dials: readonly number[], passes: (sample: number) => boolean): SliderStretchPassingDial {
10461
+ const mid = (dials.length - 1) / 2;
10462
+ if (!passes(mid)) return { lower: null, upper: null };
10463
+ const norm = (d: number) => d === 0 ? 0 : d;
10464
+ let lower = norm(dials[mid]);
10465
+ for (let i = mid - 1; i >= 0 && passes(i); i--) lower = norm(dials[i]);
10466
+ let upper = norm(dials[mid]);
10467
+ for (let i = mid + 1; i < dials.length && passes(i); i++) upper = norm(dials[i]);
10468
+ return { lower, upper };
10469
+ }
10470
+
10414
10471
  function measureSliderStretch(api: OfficialRenderer, candidate: Candidate, binding: SliderStretchBinding, range: [number, number], provide: SliderStretchProvider): SliderStretchRow {
10415
10472
  const dials = sliderDialGrid(range);
10416
- const base = { slider: binding.slider, clip: binding.clip, range };
10417
10473
  const poses: SliderPose[] = [];
10418
10474
  const missed = new Set<number>();
10475
+ const sampleExceeds = new Set<number>();
10419
10476
  let incomplete: { sample: number; reason: string } | undefined;
10420
10477
  const miss = (sample: number, dial: number, detail: string) => {
10421
10478
  missed.add(sample);
@@ -10453,6 +10510,7 @@ function measureSliderStretch(api: OfficialRenderer, candidate: Candidate, bindi
10453
10510
  miss(sample, dial, `setup geometry: ${err.message}`);
10454
10511
  }
10455
10512
  const byAttachment = new Map(rest.map(mesh => [JSON.stringify([mesh.slot, mesh.attachment]), mesh]));
10513
+ const byFacts = new Map<string, SliderMeshFacts | null>();
10456
10514
  for (const { sample, dial, time, attachments } of poses) {
10457
10515
  const meshes: MeshRest[] = [];
10458
10516
  const seen = new Set<string>();
@@ -10472,7 +10530,9 @@ function measureSliderStretch(api: OfficialRenderer, candidate: Candidate, bindi
10472
10530
  else meshes.push(mesh);
10473
10531
  }
10474
10532
  let measurable = false;
10475
- for (const { mesh, peak: hit } of measureTextureStretch(meshes, [{ index: sample, attachments }])) {
10533
+ const figures = measureTextureStretch(meshes, [{ index: sample, attachments }]);
10534
+ for (const [meshIndex, { mesh, peak: hit }] of figures.entries()) {
10535
+ const restMesh = meshes[meshIndex];
10476
10536
  const object = `mesh ${JSON.stringify(mesh.slot)} attachment ${JSON.stringify(mesh.attachment)}`;
10477
10537
  const degenerate = mesh.degenerate[0];
10478
10538
  if (degenerate !== undefined) unmeasured(`${object} triangle ${degenerate.triangle} edge ${degenerate.edge.join('-')} has zero setup length`);
@@ -10482,22 +10542,45 @@ function measureSliderStretch(api: OfficialRenderer, candidate: Candidate, bindi
10482
10542
  unmeasured(`${object} triangle ${at.triangle} edge ${at.edge.join('-')} has no finite stretch severity (ratio ${at.ratio})`);
10483
10543
  continue;
10484
10544
  }
10545
+ const key = JSON.stringify([restMesh.slot, restMesh.attachment]);
10546
+ let facts = byFacts.get(key);
10547
+ if (facts === undefined) {
10548
+ facts = sliderMeshFacts(restMesh);
10549
+ byFacts.set(key, facts);
10550
+ }
10551
+ if (facts === null) {
10552
+ unmeasured(`${object} has zero or non-finite rest area`);
10553
+ continue;
10554
+ }
10485
10555
  measurable = true;
10486
10556
  exceeds ||= hit.exceeds;
10557
+ if (hit.exceeds) sampleExceeds.add(sample);
10487
10558
  if (peak !== undefined && raw <= worstSeverity) continue;
10488
10559
  worstSeverity = raw;
10489
10560
  const frame = Math.round(time * IDLE_FPS);
10561
+ const { area_share, on_hull } = facts.triangle(at.triangle);
10490
10562
  peak = {
10491
- severity: round6(raw), gate: rounded, dial_value: dial, sample,
10563
+ severity: round6(raw), gate: rounded, dial_value: dial === 0 ? 0 : dial, sample,
10492
10564
  clip_frame: Number.isSafeInteger(frame) && Math.abs(time - frame / IDLE_FPS) <= TIME_SLACK ? frame : null,
10493
10565
  clip_time_s: time, slot: mesh.slot, attachment: mesh.attachment, triangle: at.triangle, vertices: at.vertices, edge: at.edge,
10566
+ area_share, on_hull,
10494
10567
  };
10495
10568
  }
10496
10569
  if (!measurable) unmeasured('no posed mesh triangle edge could be measured');
10497
10570
  }
10498
10571
  }
10499
- return { ...base, status: incomplete !== undefined || exceeds ? 'FAIL' : 'PASS', sample_count: dials.length - missed.size,
10500
- ...(peak === undefined ? {} : { peak }), ...(incomplete === undefined ? {} : { reason: incomplete.reason }) };
10572
+ return {
10573
+ slider: binding.slider,
10574
+ clip: binding.clip,
10575
+ status: incomplete !== undefined || exceeds ? 'FAIL' : 'PASS',
10576
+ range,
10577
+ sample_count: dials.length - missed.size,
10578
+ ...(peak === undefined ? {} : {
10579
+ last_passing_dial: sliderLastPassingDial(dials, s => !missed.has(s) && !sampleExceeds.has(s)),
10580
+ peak,
10581
+ }),
10582
+ ...(incomplete === undefined ? {} : { reason: incomplete.reason }),
10583
+ };
10501
10584
  }
10502
10585
 
10503
10586
  /** Measure each slider binding on the pre-gated build. Stock check never votes these rows into its verdict. */
@@ -10507,22 +10590,22 @@ export function readSliderStretch(buildDir: string, bindings: readonly SliderStr
10507
10590
  let source: { api: OfficialRenderer; candidate: Candidate; provider: SliderStretchProvider } | { reason: string } | undefined;
10508
10591
  for (const binding of bindings) {
10509
10592
  const { slider, clip, bone, max } = binding;
10510
- const from = finiteSliderNumber(binding.from) ? binding.from : 0;
10593
+ const from = finiteSliderNumber(binding.from) ? (binding.from === 0 ? 0 : binding.from) : 0;
10511
10594
  const base = { slider, clip, range: null, sample_count: 0 };
10512
10595
  const bad = (['from', 'max'] as const).find(key => Object.hasOwn(binding, key) && !finiteSliderNumber(binding[key]));
10513
10596
  if (bad !== undefined) {
10514
10597
  rows.push({ ...base, status: 'FAIL', reason: `declared dial bound ${bad} is ${String(binding[bad])}; requires a finite number` });
10515
10598
  } else if (finiteSliderNumber(max) && from > max) {
10516
- rows.push({ ...base, status: 'FAIL', reason: `declared dial range [${from}, ${max}] is reversed; requires from <= max` });
10599
+ rows.push({ ...base, status: 'FAIL', reason: `declared dial range [${from}, ${max === 0 ? 0 : max}] is reversed; requires from <= max` });
10517
10600
  } else if (Object.hasOwn(binding, 'bone') && (typeof bone !== 'string' || bone.length === 0)) {
10518
10601
  rows.push({ ...base, status: 'FAIL', reason: `declared driving bone is ${String(bone)}; requires a bone name` });
10519
10602
  } else if (bone === undefined || !finiteSliderNumber(max)) {
10520
10603
  const reason = bone === undefined ? 'no declared dial range; the slider is time-driven' : 'no declared dial range; declare max to measure texture stretch';
10521
10604
  rows.push({ ...base, status: 'SKIP', reason });
10522
10605
  } else if (from === max) {
10523
- rows.push({ ...base, status: 'SKIP', range: [from, max], reason: `declared dial range [${from}, ${max}] has equal endpoints` });
10606
+ rows.push({ ...base, status: 'SKIP', range: [from, from], reason: `declared dial range [${from}, ${from}] has equal endpoints` });
10524
10607
  } else {
10525
- const range: [number, number] = [from, max];
10608
+ const range: [number, number] = [from, max === 0 ? 0 : max];
10526
10609
  if (source === undefined) {
10527
10610
  const api = officialRenderer();
10528
10611
  const skeleton = join(buildDir, 'skeleton.json'), atlas = join(buildDir, 'skeleton.atlas');
@@ -10564,15 +10647,23 @@ export function readSliderStretch(buildDir: string, bindings: readonly SliderStr
10564
10647
  };
10565
10648
  }
10566
10649
 
10650
+ function sliderPassingText(value: number | null, bound: number | undefined): string {
10651
+ if (value === null) return 'none (midpoint fails)';
10652
+ return value === bound ? `${value} (range end)` : String(value);
10653
+ }
10654
+
10567
10655
  export function sliderStretchLine(row: SliderStretchRow, advisory = false): string {
10568
10656
  const object = sliderStretchObject(row);
10569
- const { peak, range, reason, sample_count: samples } = row;
10657
+ const { last_passing_dial: reach, peak, range, reason, sample_count: samples } = row;
10570
10658
  const coverage = samples === SLIDER_STRETCH_SAMPLES ? String(samples) : `${samples} of ${SLIDER_STRETCH_SAMPLES}`;
10571
10659
  const grid = range === null || row.status === 'SKIP' ? '' : `${coverage} dial samples in [${range.join(', ')}]`;
10660
+ const reachClause = reach === undefined ? '' :
10661
+ `, last passing dial lower ${sliderPassingText(reach.lower, range?.[0])}, upper ${sliderPassingText(reach.upper, range?.[1])}`;
10572
10662
  const reading = peak === undefined ? grid :
10573
10663
  `peak ${peak.severity.toFixed(6)}x (gate ${peak.gate.toFixed(3)}x, limit ${TEXTURE_STRETCH_CEILING}x), ${grid}, ` +
10574
10664
  `dial ${peak.dial_value}, sample ${peak.sample}, clip frame ${peak.clip_frame ?? 'off-grid'} at ${peak.clip_time_s.toFixed(6)} s, ` +
10575
- `mesh ${JSON.stringify(peak.slot)} attachment ${JSON.stringify(peak.attachment)}, triangle ${peak.triangle} (vertices ${peak.vertices.join(' ')}), edge ${peak.edge.join('-')}`;
10665
+ `mesh ${JSON.stringify(peak.slot)} attachment ${JSON.stringify(peak.attachment)}, triangle ${peak.triangle} (vertices ${peak.vertices.join(' ')}), ` +
10666
+ `edge ${peak.edge.join('-')}, area share ${peak.area_share.toFixed(6)}, ${peak.on_hull ? 'hull' : 'interior'}${reachClause}`;
10576
10667
  const detail = [reading, reason].filter(Boolean).join('; ');
10577
10668
  if (row.status === 'FAIL' && !advisory) return failLine({ code: SLIDER_STRETCH_RULE, object, detail });
10578
10669
  const level = row.status === 'FAIL' ? 'WARN' : row.status;
package/src/checkrow.ts CHANGED
@@ -62,6 +62,7 @@ export const CHECK_ROW_PATHS = {
62
62
  'SEAM_OVER_RANGE.joints[].poses': ['SEAM_OVER_RANGE.joints[].poses'],
63
63
  'SETUP_MATCHES_PAINTING.regions': ['SETUP_MATCHES_PAINTING.regions'],
64
64
  'SETUP_MATCHES_PAINTING.regions[].slots': ['SETUP_MATCHES_PAINTING.regions[].slots'],
65
+ 'SETUP_SEAM_TRANSMISSION.rows': ['SETUP_SEAM_TRANSMISSION.rows'],
65
66
  'SOURCE_EXPOSURE.rows': ['SOURCE_EXPOSURE.rows'],
66
67
  'SOURCE_EXPOSURE.unmeasured': ['SOURCE_EXPOSURE.unmeasured'],
67
68
  'STILL_REGIONS_DARK.*.crossing': ['STILL_REGIONS_DARK.*.crossing'],