rig-parts 2.52.0 → 2.53.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
@@ -55,9 +55,27 @@ See
55
55
 
56
56
  `rig-parts check-parts --parts <assembled-dir> --out <disjoint-report-dir>
57
57
  [--json]` writes `parts-check.json`, spec `rig-parts-parts-check/1`.
58
- Exit 0 is not a quality pass. No #945/#884 defect class is measured yet.
59
- The six quality HOLEs are always present. They name plate ghost, plate structure,
60
- plate smear, stepped fill, invented material and invented-material exposure.
58
+ Exit 0 records input integrity. Plate ghost, plate structure, plate smear,
59
+ stepped fill and invented-material exposure always report HOLEs.
60
+ `PARTS_INVENTED_MATERIAL` reports a measurement for each primary or alternate
61
+ part with a validated `source_visibility` block from assembly. The measurement
62
+ describes visibility within the producing See-through run. Painted-versus-
63
+ invented material remains unknown. When only some parts have a measurement,
64
+ the report keeps those rows and emits one material HOLE whose reason gives the
65
+ count and names every unmeasured part and its primary or alternate set.
66
+ When every part has a measurement, there is no material HOLE. When neither
67
+ the primary set nor any alternate has a measurement, the existing material
68
+ HOLE remains and both the JSON report and command output keep their legacy bytes.
69
+ `PARTS_DRAW_ORDER_INVERTED` reports one measurement for each recorded pair of
70
+ overlapping parts, from the carrying part's `source_overlaps`. It counts the
71
+ pixels where the record shows the part drawn behind and hides the part drawn in
72
+ front. It is never a pass, and a part set with no record has no such row.
73
+ The optional `native_samples` block in an overlap row and its corresponding
74
+ `check-parts` measurement has `overlap_px` then `inverted_px`, in native
75
+ full-run samples (issue #1477). It covers directly attributable material at a
76
+ non-unit registration scale. It does not enter the output-pixel partition or
77
+ change `source_layers`. See the
78
+ [sample coverage rules](AUTHORING.md#draw-order-inversions-source_overlaps-issue-1474).
61
79
 
62
80
  The top-level key order is `spec`, `stage`, `inputs`, `parts`, `refusals`,
63
81
  `reported`, `holes`, `exit_code`. `stage` is `parts`. `inputs` is sorted by
@@ -80,8 +98,20 @@ and allocation reports. Embedded object keys are sorted, and producer array
80
98
  order is retained. `refusals` rows have `code`, `object`, `found`, `required`,
81
99
  `detail`; reused metadata-reader diagnostics retain their code and detail with
82
100
  null structured values when the reader supplies none. A refused input produces
83
- a report and exit 1. `reported` rows have `code`, `set`, `part`, `source`, `count`,
84
- `spans`; unplanned direct cover is reported without a refusal. `holes` rows have
101
+ a report and exit 1. `PARTS_UNPLANNED_SOURCE_COVER` rows in `reported` have
102
+ `code`, `set`, `part`, `source`, `count`, `spans`. Unplanned direct cover is
103
+ reported without a refusal. `PARTS_INVENTED_MATERIAL` rows follow the cover
104
+ rows, with primary parts first and alternate records in manifest order.
105
+ They have `code`, `set`, `part`, `occluded_px`, `undecided_px` in that order.
106
+ `set` is null for a primary part and the set name for an alternate.
107
+ `undecided_px` gives counts for `partial-top`, `depth-tie`, and
108
+ `mixed-source-states` in that order. `PARTS_DRAW_ORDER_INVERTED` rows follow
109
+ the material rows in the same set order, with each part's overlaps in draw
110
+ order. They have `code`, `set`, `part`, `front`, `source_layers`,
111
+ `overlap_px`, `inverted_px`, `agreeing_px`, `unordered_px`, `undecided_px`,
112
+ `unrecorded_px` in that order. `part` is drawn behind `front` in that set's
113
+ draw order: `parts.json` order for the primary set, and for an alternate the
114
+ base order with each front-slot part after its slot's target. `holes` rows have
85
115
  `code`, `object`, `reason`, `line`. Absent source cover or allocation adds its
86
116
  own HOLE; malformed present reports are refused. A HOLE carries no measured zero.
87
117
 
@@ -119,6 +149,7 @@ compare this list with the command's allowlist, and plant an undeclared code.
119
149
  - `PARTS_COUNTS_ADD_UP`
120
150
  - `PARTS_CUT_FROM_KNOWN`
121
151
  - `PARTS_DEPTH_REFERENCE`
152
+ - `PARTS_DRAW_ORDER_INVERTED`
122
153
  - `PARTS_FIELD_PRESENT`
123
154
  - `PARTS_FIELD_TYPE`
124
155
  - `PARTS_FILE_PRESENT`
@@ -431,7 +462,7 @@ array for matching or legacy manifests. See the workflow in
431
462
  `@rig-c/parts/src/parts.ts` exports `partsFileReferences(dir: string):
432
463
  PartsFileReference[]` and the `PartsFileReference` type. `dir` holds the assemble
433
464
  output's `parts.json`. Each row has `path: string`, relative to that directory,
434
- and `role: 'part' | 'alternate' | 'depth' | 'painting' | 'figure_mask'`. The paths use `/`.
465
+ and `role: 'part' | 'alternate' | 'depth' | 'painting' | 'figure_mask' | 'source_state_map'`. The paths use `/`.
435
466
  The complete output-reference fields and their roles are below.
436
467
 
437
468
  | Field | Relative path | Role |
@@ -439,6 +470,7 @@ The complete output-reference fields and their roles are below.
439
470
  | `parts[].name` | `parts/<name>.png` | `part` |
440
471
  | `alternates[].name` with `records[].name` | `parts/<set>_<name>.png` | `alternate` |
441
472
  | Base or alternate record `depth.image` | `parts/<depth.image>` | `depth` |
473
+ | Base or alternate record `source_state_map.image` | `parts/<source_state_map.image>` | `source_state_map` |
442
474
  | `painting_in_rig.path` | Exactly `painting_in_rig.png` | `painting` |
443
475
  | Base or alternate `scene.figure_mask` | Exactly `figure_rig.png` | `figure_mask` |
444
476
 
@@ -554,7 +586,7 @@ and do not certify visibility. See the
554
586
  | `inputs` | `--source`, `--config`, `--out`; optional `--help` (`-h`) |
555
587
  | `comfy` | `paint`: `--config`, `--out`; optional `--seeds`, `--seed0`, `--host`, `--wait`, `--timeout`, `--poll`, `--help` (`-h`) |
556
588
  | `comfy` | `matte`: `--painting`, `--out`, `--node` (`BiRefNetRMBG`), `--model` (`BiRefNet-HR-matting`), `--checkpoint-sha256` (declared, required); optional `--resolution`, `--threshold`, `--host`, `--wait`, `--timeout`, `--poll`, `--help` (`-h`) (issue #1204) |
557
- | `comfy` | `plate`: `--mode` (`background`, `foreground` or `occluder`), `--painting`, `--mask-from` (`seethrough:<dir>`, `figure-mask:<dir>` or `matte:<dir>`; not with `occluder`), `--out`; with `--mode occluder`, `--occluder` (an RGBA PNG on the painting's grid, required) and optional `--holes` (issue #1230), and the background flags below; with `--mode background` also `--checkpoint-sha256` (required) and optional `--graph` (`lama` or `core`), `--model` (required with `core`), `--seed`, `--grow`, `--steps`, `--cfg`, `--prompt`, `--negative` (the last four with `core` only), `--host`, `--wait`, `--timeout`, `--poll`, `--help` (`-h`) (issue #1183, additive) |
589
+ | `comfy` | `plate`: `--mode` (`background`, `foreground` or `occluder`), `--painting`, `--mask-from` (`seethrough:<dir>`, `figure-mask:<dir>`, `matte:<dir>` or `classified:<manifest.json>`; not with `occluder`), `--out`; with `--mode occluder`, `--occluder` (an RGBA PNG on the painting's grid, required) and optional `--holes` (issue #1230), and the background flags below; with `--mode background` also `--checkpoint-sha256` (required) and optional `--graph` (`lama` or `core`), `--model` (required with `core`), `--seed`, `--grow`, `--steps`, `--cfg`, `--prompt`, `--negative` (the last four with `core` only), `--host`, `--wait`, `--timeout`, `--poll`, `--help` (`-h`) (issue #1183, additive) |
558
590
  | `comfy` | `seethrough`: `--image`, `--out`; optional `--resolution`, `--steps`, `--seed`, `--prefix`, `--offload`, `--no-offload`, `--lama`, `--nf4`, `--host`, `--wait`, `--timeout`, `--poll`, `--config` (See-through settings and optional depth block), `--depth-run` (`full` or `head`, required with the block), `--help` (`-h`) |
559
591
  | `assemble` | `--propose-plan` with `--source`, `--full`, `--config`, optional `--head`, `--write-config` (must name `--config` itself, issue #356); or `--source`, `--full`, `--config`, `--out`, optional `--head` (without it, one run: issue #359), `--seam` (near-white, silhouette), `--project` (core, visible), `--alt` (repeatable `<name>=<source>:<full>[:<head>]`, issue #454), `--requirements` (source-bound cut-material evidence only when the file declares `cut_material`, issue #888); or `--emit-fill-masks` (a directory) with `--source`, `--full`, `--config`, optional `--head` (each cut's hidden-band mask on the painting grid, issue #1230); or `--help` (`-h`) |
560
592
  | `head-crop-preflight` | `--full`, `--canvas`, `--head-box` (JSON coordinate array); optional `--help` (`-h`); read-only advice before the head run, original alpha > 8 samples (issue #1082) |
@@ -912,9 +944,9 @@ The field semantics are documented in AUTHORING's source projection cover entry.
912
944
  ### Plate receipt
913
945
 
914
946
  `comfy plate` (issue #1183) writes `receipt.json` beside `plate.png` and
915
- `mask.png`, spec `rig-parts-plate-receipt/1`. Its keys, their order and their
916
- meaning do not change within the spec; a key added, removed or redefined is a
917
- new spec version. Every path in it is relative to the receipt's directory.
947
+ `mask.png`, spec `rig-parts-plate-receipt/1`. The keys, order and meaning are
948
+ fixed for each mode and source variant documented below. Incompatible changes
949
+ require a new spec version. Paths are relative to the receipt's directory.
918
950
 
919
951
  | key | meaning |
920
952
  | --- | --- |
@@ -922,7 +954,8 @@ new spec version. Every path in it is relative to the receipt's directory.
922
954
  | `mode` | `"background"`, `"foreground"` or `"occluder"` (issue #1230, additive) |
923
955
  | `painting` | `{ path, sha256 }` of the painting read |
924
956
  | `occluder` | present only when `mode` is `"occluder"` (issue #1230, additive), right after `painting`: `{ path, sha256 }` of the `--occluder` RGBA image the mask was read from |
925
- | `mask` | `{ source, from, path, sha256 }`: `source` is `"seethrough"`, `"figure-mask"`, `"matte"` or `"occluder"`, `from` the source directory (the occluder image for `"occluder"`), `path` the mask actually used (`mask.png`, opaque white inside) |
957
+ | `mask` | `{ source, from, path, sha256 }`: `source` is `"seethrough"`, `"figure-mask"`, `"matte"`, `"classified"` or `"occluder"`, `from` the source directory (the declaration file for `"classified"` or the occluder image for `"occluder"`), `path` the mask actually used (`mask.png`, opaque white inside) |
958
+ | `mask_classification` | classified sources only (issue #1267, additive): `{manifest_sha256, prop_clips: [{id, clipped_px}]}`. `manifest_sha256` hashes the exact declaration bytes. Each `background-prop` has an entry counting its pixels clipped after background mask growth. Foreground records zero clips for each prop |
926
959
  | `model` | `{ name, checkpoint_sha256, checkpoint_sha256_from }`, or null for `foreground`. `checkpoint_sha256` is the `--checkpoint-sha256` value, lower-cased; `checkpoint_sha256_from` is `"declared"`: the box reports no hash, so this field is **declared, not measured** |
927
960
  | `params` | every parameter of the run, the seed included, in a fixed order per graph: `lama` — `seed`, `grow_px`, `mask_alpha_above`; `core` — `seed`, `grow_px`, `steps`, `cfg` (`--cfg`, default `6`), `sampler`, `scheduler`, `denoise`, `prompt`, `negative`, `mask_alpha_above`; `foreground` — `mask_alpha_above`; `occluder` — the `lama` or `core` list with `holes` (`--holes`) before `mask_alpha_above`, which is `0` |
928
961
  | `graph` | `"rig-parts/plate-background-lama/1"`, `"rig-parts/plate-background-core/1"`, or the fixed local id `"rig-parts/plate-foreground/1"` |
@@ -930,6 +963,8 @@ new spec version. Every path in it is relative to the receipt's directory.
930
963
  | `grid_transform` | present only when `mode` is `"background"` or `"occluder"`, `graph` is `"rig-parts/plate-background-core/1"`, and the painting's width or height is not a multiple of 8 (issue #1209, additive): `{ source: [width, height], padded: [ceil(width/8)*8, ceil(height/8)*8], pad: [0, 0], pad_fill: "edge-replicate", mask_pad_fill: "zero", inverse: "crop" }` in that key order. Omitted for on-grid `core`, `lama`, and `foreground` |
931
964
  | `output` | `{ path, sha256 }` of `plate.png` |
932
965
 
966
+ Existing mask sources retain their defaults and receipt bytes.
967
+
933
968
  The receipt is read back against the bytes on disk before `<out>` is published;
934
969
  a hash that is not its file's refuses the run. `verifyPlateReceipt` also
935
970
  re-derives `grid_transform` from the decoded painting, `mode` and `graph`, and
@@ -941,9 +976,35 @@ zero (`mask_pad_fill: "zero"`, kept as context outside the hole), the box's
941
976
  output is required at `padded` dimensions (`COMFY_PLATE_SIZE` otherwise) and
942
977
  cropped at `[0, 0]` back to `source` before pasting inside the native mask, so
943
978
  pixels outside the hole equal the painting byte for byte. On-grid `core`
944
- paintings retain their original upload bytes, graph and 9-key receipt. Because
979
+ paintings retain their original upload bytes and graph. Existing mask sources
980
+ still write the 9-key receipt for on-grid `core`. Because
945
981
  every painting grid is covered by this transform, `PLATE_CORE_GRID` is retired.
946
982
 
983
+ ### Classified plate mask source
984
+
985
+ `--mask-from classified:<manifest.json>` is additive for background and
986
+ foreground plates (issue #1267). The declaration has these fields.
987
+
988
+ | field | meaning |
989
+ | --- | --- |
990
+ | `spec` | `"rig-parts-plate-components/1"` |
991
+ | `parts_dir` | directory containing `parts.json` and its scene's `figure_rig.png`, relative to the directory containing the declaration |
992
+ | `painting_sha256` | SHA-256 of the exact `--painting` bytes, bound to the source input of the completed `rig-run/1` assemble stamp |
993
+ | `figure_mask_sha256` | SHA-256 of `figure_rig.png`, bound to the stamp's output |
994
+ | `parts_manifest_sha256` | SHA-256 of `parts.json`, bound to the stamp's output |
995
+ | `components` | `[{id, role}]` with exactly one entry per current component ID and role exactly `"background-prop"` or `"figure-accessory"` |
996
+
997
+ Every emitted part PNG must also match the assemble stamp's output hash.
998
+ On the native painting grid, using the existing pixel-centre map, components
999
+ are the 8-connected regions of the scene mask minus the union of emitted part
1000
+ pixels with alpha greater than 8, with no minimum size. An ID is the SHA-256
1001
+ of the UTF-8 compact JSON array of the component's pixel indices sorted in
1002
+ row-major order. Empty declarations with components to classify and declarations
1003
+ missing IDs report the IDs, boxes and counts and a paste-ready `components`
1004
+ array with blank roles. Source failures use `PLATE_COMPONENT_SOURCE` and role
1005
+ assignment failures use `PLATE_COMPONENT_ROLE`. See
1006
+ [Classified plate mask](AUTHORING.md#classified-plate-mask).
1007
+
947
1008
  ### Matte source receipt
948
1009
 
949
1010
  `comfy matte` writes `model-mask.png` (the exact downloaded grayscale model
@@ -1189,6 +1250,13 @@ plate` with `--mask-from seethrough:<dir>` binds every layer file read and
1189
1250
  `--painting` against those hashes and refuses a legacy `meta.json` that lacks
1190
1251
  them.
1191
1252
 
1253
+ When the wrapper supplies readable writer depth for every drawn layer, the
1254
+ adapter also emits a [visibility record](AUTHORING.md#see-through-layer-visibility)
1255
+ for the run's own layers (issue #1469). Its metadata adds the uploaded PNG and
1256
+ submitted graph hashes. Geometry depth remains separately opt-in. Runs without
1257
+ optional writer depth still publish art with a named warning in the console
1258
+ and in `meta.json` as `visibility_warning`.
1259
+
1192
1260
  Non-square inputs are prepared by parts before upload (issues #1197, #1205).
1193
1261
  Their additive `input_transform` records `source: [width,height]`,
1194
1262
  `padded: [side,side]`, `pad: [left,top]` in padded pixels, `scale` (target
@@ -1664,6 +1732,34 @@ original resolution **before** existing Lanczos3 stage resampling. Setup RGBA
1664
1732
  is composited on the native stage grid. Source readers preserve alpha; the
1665
1733
  global RGB-only source helper and checks without this declaration are unchanged.
1666
1734
 
1735
+ The optional `source_exposure` key (issue #1473, additive) declares a limit for
1736
+ `check`'s `SOURCE_EXPOSURE` line: `{"max_px": <a nonnegative integer>}`, the
1737
+ most stage pixels of one recorded-hidden or undecided state one part may show
1738
+ in one frame. No default exists. Declared, a row over it is
1739
+ `CHECK_SOURCE_EXPOSURE` and a reading that cannot be taken is
1740
+ `CHECK_SOURCE_EXPOSURE_UNMEASURED`; the line is PASS or FAIL. Undeclared, the
1741
+ line is written only when some part carries a `source_state_map`, and then it
1742
+ is `REPORTED`, never a pass, and moves no exit code. A rig with no map and no
1743
+ declaration writes no `SOURCE_EXPOSURE` key in `check.json` and prints no line,
1744
+ so its bytes do not change. `SOURCE_EXPOSURE` is not one of `bar_outcomes`'
1745
+ bars, so `bar_outcomes` does not change either. The `check.json` block holds
1746
+ `status`, `instrument`, `reading`, `max_px`, `alternates`, `parts`, `texels`,
1747
+ `frames`, `animations`, `rows` (`part`, `state`, `px`, `frame`, `animation`,
1748
+ `index`, `time`, `row_scope`, `row_kind`, `row_subjects`) and `unmeasured`
1749
+ (`slot`, `part`, `attachment`, `frame`, `reason`, then the same row fields), in
1750
+ that order, then `reason` when no part was read. `texels` is keyed by part
1751
+ name, in `parts.json` order, each value the part's texel count per state.
1752
+
1753
+ `parts.json` records with `source_visibility` gain an optional
1754
+ `source_state_map` (issue #1473, additive), `{ "image", "sha256" }`: the
1755
+ per-texel state map `assemble` writes in `parts/`, bound by the SHA-256 of its
1756
+ bytes. A record without `source_visibility` cannot carry one
1757
+ (`PARTS_FIELD_TYPE`). `check` refuses a map that is missing, changed, malformed
1758
+ or disagrees with its part or its counts, before anything is built
1759
+ (`PARTS_SOURCE_STATE_MAP_PRESENT`, `_SHA256`, `_FORMAT`, `_COUNTS`). The map's
1760
+ codes are listed in the
1761
+ [authoring guide](AUTHORING.md#see-through-layer-visibility).
1762
+
1667
1763
  The optional `motion_seams` key in `spine-parts-requirements/1` (issue #1269,
1668
1764
  additive) is a bar-free array of `{part, neighbour}` declarations. Check reads
1669
1765
  its union with the manifest's motion seams and existing `seam` requirements,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rig-parts",
3
- "version": "2.52.0",
3
+ "version": "2.53.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": {