spine-parts 2.19.4 → 2.20.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/AUTHORING.md CHANGED
@@ -7120,6 +7120,40 @@ and `failed`; the bar counts once among the bars measured. Without the block,
7120
7120
  or with `required: false`, nothing here is read and no exit code, line or byte
7121
7121
  moves; the warnings and the body-root bar above are unchanged either way.
7122
7122
 
7123
+ **Open-cell evidence.** A failing pair gains `open_frames`, one row per animation
7124
+ and failing frame, with `animation`, `index`, `time`, `px`, `cell`, `box`,
7125
+ `classes` and `cells_index`. `classes` holds `figure`, `background` and `other`
7126
+ counts whose sum equals that frame's `gapOpen` px. A cell is `figure` when its
7127
+ `setupTop` slot resolves to a manifest part through its default-skin image,
7128
+ `background` when both setup names are null, and `other` when a nonnull top
7129
+ slot has no witnessed manifest mapping. The bar still holds every class to zero.
7130
+
7131
+ The `required.cells` reference supplies the relative `path` (`seam-cells.json`)
7132
+ and `sha256` of a sidecar beside `check.json`. Its `spec` is
7133
+ `rig-parts-seam-cells/1`; `frames` contains each failing pair-frame exactly once,
7134
+ in pair/animation/frame order. An inline `cells_index` selects its matching
7135
+ sidecar frame. Each sidecar frame retains `pair`, `animation`, `index`, `time`,
7136
+ `px`, `cell`, `box` and `cells`. Cells retain core's world-centre `x`, `y` (y up),
7137
+ `setupTop`, `setupUnder` and the derived `class`. The names describe setup art
7138
+ at that same world cell. Every frame and cell is a registered evidence row with
7139
+ `row_scope`, `row_kind`, `row_subjects`. Frames name the pair; cells name the
7140
+ resolved top part or carry rig scope with empty subjects.
7141
+
7142
+ Only the active render under the required declaration requests `--seam-cells`.
7143
+ Every nonempty `gapOpen` and `gapCovered` hit, including `worst`, must supply
7144
+ `cells.length === px`, finite centres and distinct setup names or null. Covered
7145
+ cells remain in core's raw sidecar. When open cells exist, publication writes
7146
+ the deterministic cell sidecar and its reference together; failure restores
7147
+ both previous files. Clean pairs keep their previous report shape, and a rerun
7148
+ without cell evidence removes a stale sidecar. Counts, tolerances and verdicts
7149
+ are unchanged.
7150
+
7151
+ `readMotionSeamCellSidecar` reads the digest-bound evidence and validates each
7152
+ inline partition and pair-frame reference. A missing file, SHA-256 mismatch,
7153
+ partition mismatch or malformed cell list is `FRAMES_SIDECAR`. The original
7154
+ counted arrays stay in the sidecar so the inline report size grows with failing
7155
+ frames rather than their cell populations.
7156
+
7123
7157
  **What it does not read.** Frames are the 12 fps grid: an opening that lives
7124
7158
  between two ticks is not seen, and neither is a pair nobody declared — those
7125
7159
  are [`figure_openings`](#figure_openings)'s, which still warns. A frame on which
@@ -8054,7 +8088,7 @@ Internal `SeamSupport.drawings` never enters check JSON. Named requirement
8054
8088
  | `ART_JOINT_DISTANCE.joints` | `ART_JOINT_DISTANCE.joints` | 'rig' | finding when status === 'FAIL'; otherwise evidence | [] | [artjoints.ts:86](../src/artjoints.ts#L86) |
8055
8089
  | `BOUNDARY_COLOUR_STEP.over` | `BOUNDARY_COLOUR_STEP.over` | 'pair' | finding | r.parts | [boundarycolour.ts:221](../src/boundarycolour.ts#L221) |
8056
8090
  | `BOUNDARY_COLOUR_STEP.unmeasured` | `BOUNDARY_COLOUR_STEP.unmeasured` | part when the supplied mapping resolves a piece; otherwise rig | evidence | resolved piece for r.slot; otherwise [] | [boundarycolour.ts:222](../src/boundarycolour.ts#L222) |
8057
- | `CLOTH_SETTLES.rows` | `CLOTH_SETTLES.rows` | 'rig' | finding when speeds.length > 0 && s < speeds.length; otherwise evidence | [] | [check.ts:5812](../src/check.ts#L5812) |
8091
+ | `CLOTH_SETTLES.rows` | `CLOTH_SETTLES.rows` | 'rig' | finding when speeds.length > 0 && s < speeds.length; otherwise evidence | [] | [check.ts:5960](../src/check.ts#L5960) |
8058
8092
  | `CUT_JOINT_MATERIAL.rows` | `CUT_JOINT_MATERIAL.rows` | 'part' | finding when r.status === 'FAIL'; otherwise evidence | [r.part] | [cutmaterial.ts:280](../src/cutmaterial.ts#L280) |
8059
8093
  | `FEET_STAY_LEVEL.feet` | `FEET_STAY_LEVEL.feet` | 'part' | finding when row.status === 'FAIL'; otherwise evidence | [row.part] | [check.ts:3719](../src/check.ts#L3719) |
8060
8094
  | `FEET_STAY_LEVEL.feet[].worst.through` | `FEET_STAY_LEVEL.feet[].worst.through` | 'rig' | evidence | [] | [check.ts:3694](../src/check.ts#L3694) |
@@ -8062,37 +8096,40 @@ Internal `SeamSupport.drawings` never enters check JSON. Named requirement
8062
8096
  | `PART_SUPPORT_REPORT.pairs` | `PART_SUPPORT_REPORT.pairs` | 'pair' | evidence; finding when length > 0; otherwise evidence | [F.name, B.name] | [coincide.ts:114](../src/coincide.ts#L114), [coincide.ts:130](../src/coincide.ts#L130) |
8063
8097
  | `PART_SUPPORT_REPORT.raw_pairs` | `PART_SUPPORT_REPORT.raw_pairs` | 'pair' | evidence | [F.name, B.name] | [coincide.ts:110](../src/coincide.ts#L110) |
8064
8098
  | `PART_SUPPORT_REPORT.unowned.regions` | `PART_SUPPORT_REPORT.unowned.regions` | 'rig' | finding | [] | [coincide.ts:145](../src/coincide.ts#L145) |
8065
- | `SEAM_OVER_MOTION.pairs` | `SEAM_OVER_MOTION.pairs` | 'pair' | evidence | [p.a, p.b] | [check.ts:5209](../src/check.ts#L5209) |
8066
- | `SEAM_OVER_MOTION.required.pairs` | `SEAM_OVER_MOTION.required.pairs` | 'pair' | finding when open > 0; otherwise evidence | [p.a, p.b] | [check.ts:4612](../src/check.ts#L4612) |
8067
- | `SEAM_OVER_MOTION.roots.unmeasured` | `SEAM_OVER_MOTION.roots.unmeasured` | 'part' | evidence | [root.part] | [check.ts:5186](../src/check.ts#L5186) |
8068
- | `SEAM_OVER_MOTION.rows` | `SEAM_OVER_MOTION.rows` | 'pair'; unique ? 'pair' : 'rig' | finding when motionSeamFinding(want.root !== undefined, p.status, p.banded, opens.length); otherwise evidence; finding when motionSeamFinding(rootNames.has(r.pair), r.status, r.banded, r.opens.length); otherwise evidence | [want.a, want.b]; unique ? [pair.a, pair.b] : [] | [check.ts:5143](../src/check.ts#L5143), [check.ts:5215](../src/check.ts#L5215) |
8069
- | `SEAM_OVER_MOTION.rows[].cells` | `SEAM_OVER_MOTION.rows[].cells` | 'pair' | evidence | [want.a, want.b] | [check.ts:5156](../src/check.ts#L5156) |
8070
- | `SEAM_OVER_MOTION.rows[].joint_contact.reasons` | `SEAM_OVER_MOTION.rows[].joint_contact.reasons` | 'pair' | evidence | [want.a, want.b] | [check.ts:5146](../src/check.ts#L5146) |
8099
+ | `SEAM_OVER_MOTION.pairs` | `SEAM_OVER_MOTION.pairs` | 'pair' | evidence | [p.a, p.b] | [check.ts:5357](../src/check.ts#L5357) |
8100
+ | `SEAM_OVER_MOTION.required.pairs` | `SEAM_OVER_MOTION.required.pairs` | 'pair' | finding when open > 0; otherwise evidence | [p.a, p.b] | [check.ts:4681](../src/check.ts#L4681) |
8101
+ | `SEAM_OVER_MOTION.required.pairs[].open_frames` | `SEAM_OVER_MOTION.required.pairs[].open_frames` | 'pair' | evidence | [p.a, p.b] | [check.ts:4673](../src/check.ts#L4673) |
8102
+ | `SEAM_OVER_MOTION.roots.unmeasured` | `SEAM_OVER_MOTION.roots.unmeasured` | 'part' | evidence | [root.part] | [check.ts:5334](../src/check.ts#L5334) |
8103
+ | `SEAM_OVER_MOTION.rows` | `SEAM_OVER_MOTION.rows` | 'pair'; unique ? 'pair' : 'rig' | finding when motionSeamFinding(want.root !== undefined, p.status, p.banded, opens.length); otherwise evidence; finding when motionSeamFinding(rootNames.has(r.pair), r.status, r.banded, r.opens.length); otherwise evidence | [want.a, want.b]; unique ? [pair.a, pair.b] : [] | [check.ts:5291](../src/check.ts#L5291), [check.ts:5363](../src/check.ts#L5363) |
8104
+ | `SEAM_OVER_MOTION.rows[].cells` | `SEAM_OVER_MOTION.rows[].cells` | 'pair' | evidence | [want.a, want.b] | [check.ts:5304](../src/check.ts#L5304) |
8105
+ | `SEAM_OVER_MOTION.rows[].joint_contact.reasons` | `SEAM_OVER_MOTION.rows[].joint_contact.reasons` | 'pair' | evidence | [want.a, want.b] | [check.ts:5294](../src/check.ts#L5294) |
8071
8106
  | `SEAM_OVER_MOTION.rows[].pose_at_worst.joints` | `SEAM_OVER_MOTION.rows[].pose_at_worst.joints` | 'rig' | evidence | [] | [motionseampose.ts:53](../src/motionseampose.ts#L53) |
8072
- | `SEAM_OVER_MOTION.worlds.*.rows` | `SEAM_OVER_MOTION.worlds.*.rows` | 'pair' | evidence | [want.a, want.b] | [check.ts:5140](../src/check.ts#L5140) |
8107
+ | `SEAM_OVER_MOTION.worlds.*.rows` | `SEAM_OVER_MOTION.worlds.*.rows` | 'pair' | evidence | [want.a, want.b] | [check.ts:5288](../src/check.ts#L5288) |
8073
8108
  | `SEAM_OVER_RANGE.joints` | `SEAM_OVER_RANGE.joints` | 'part' | evidence; finding when poses.some(p => p.status === 'FAIL'); otherwise evidence | [j.part] | [check.ts:4335](../src/check.ts#L4335), [check.ts:4381](../src/check.ts#L4381) |
8074
8109
  | `SEAM_OVER_RANGE.joints[].poses` | `SEAM_OVER_RANGE.joints[].poses` | 'part' | finding when fail; otherwise evidence | [j.part] | [check.ts:4379](../src/check.ts#L4379) |
8075
8110
  | `SETUP_MATCHES_PAINTING.regions` | `SETUP_MATCHES_PAINTING.regions` | 'rig' | finding when status === 'FAIL'; otherwise evidence | [] | [setuppainting.ts:174](../src/setuppainting.ts#L174) |
8076
8111
  | `SETUP_MATCHES_PAINTING.regions[].slots` | `SETUP_MATCHES_PAINTING.regions[].slots` | part when the supplied mapping resolves a piece; otherwise rig | evidence | resolved piece for slot; otherwise [] | [setuppainting.ts:175](../src/setuppainting.ts#L175) |
8077
- | `STILL_REGIONS_DARK.*.crossing` | `STILL_REGIONS_DARK.*.crossing` | part when the supplied mapping resolves a piece; otherwise rig | finding | resolved piece for sl.name; otherwise [] | [check.ts:8757](../src/check.ts#L8757) |
8078
- | `STILL_REGIONS_DARK.*.still_slots` | `STILL_REGIONS_DARK.*.still_slots` | part when the supplied mapping resolves a piece; otherwise rig | evidence; finding when r.max > tolerance; otherwise evidence | resolved piece for slot; otherwise [] | [check.ts:8743](../src/check.ts#L8743), [check.ts:8748](../src/check.ts#L8748) |
8112
+ | `STILL_REGIONS_DARK.*.crossing` | `STILL_REGIONS_DARK.*.crossing` | part when the supplied mapping resolves a piece; otherwise rig | finding | resolved piece for sl.name; otherwise [] | [check.ts:8910](../src/check.ts#L8910) |
8113
+ | `STILL_REGIONS_DARK.*.still_slots` | `STILL_REGIONS_DARK.*.still_slots` | part when the supplied mapping resolves a piece; otherwise rig | evidence; finding when r.max > tolerance; otherwise evidence | resolved piece for slot; otherwise [] | [check.ts:8896](../src/check.ts#L8896), [check.ts:8901](../src/check.ts#L8901) |
8079
8114
  | `STRESS_OFF_CHAIN.not_read` | `STRESS_OFF_CHAIN.not_read` | 'part' | evidence | [r.part] | [check.ts:3939](../src/check.ts#L3939) |
8080
8115
  | `STRESS_OFF_CHAIN.per_part` | `STRESS_OFF_CHAIN.per_part` | 'part' | finding when poses.some(p => typeof p.reading === 'number' && p.reading > STRESS_RIGID); otherwise evidence | [r.part] | [check.ts:3927](../src/check.ts#L3927) |
8081
8116
  | `STRESS_OFF_CHAIN.per_part[].off_chain` | `STRESS_OFF_CHAIN.per_part[].off_chain` | 'part' | evidence | [r.part] | [check.ts:3927](../src/check.ts#L3927) |
8082
8117
  | `STRESS_OFF_CHAIN.per_part[].poses` | `STRESS_OFF_CHAIN.per_part[].poses` | 'part' | evidence; finding when shown > STRESS_RIGID; otherwise evidence | [r.part] | [check.ts:3895](../src/check.ts#L3895), [check.ts:3913](../src/check.ts#L3913) |
8083
- | `TEXTURE_STRETCH.per_mesh` | `TEXTURE_STRETCH.per_mesh` | part when the supplied mapping resolves a piece; otherwise rig | evidence; finding when severity > TEXTURE_STRETCH_CEILING; otherwise evidence | resolved piece for m.slot; otherwise [] | [check.ts:9391](../src/check.ts#L9391), [check.ts:9401](../src/check.ts#L9401) |
8084
- | `TIP_OVER_ROOT.parts` | `TIP_OVER_ROOT.parts` | 'part' | evidence; finding when !ok && !(!rigid && hanging.onLink && Math.max(c.root, c.tip) < TIP_TRAVEL_FLOOR); otherwise evidence | [p.name] | [check.ts:8172](../src/check.ts#L8172), [check.ts:8177](../src/check.ts#L8177), [check.ts:8198](../src/check.ts#L8198), [check.ts:8209](../src/check.ts#L8209) |
8085
- | `WIND_BAND.pairs` | `WIND_BAND.pairs` | 'pair' | finding when !holdsAll; otherwise evidence | [p.a, p.b] | [check.ts:6316](../src/check.ts#L6316) |
8086
- | `WIND_BAND.pairs[].steps` | `WIND_BAND.pairs[].steps` | 'pair' | finding when !s.holds; otherwise evidence | [p.a, p.b] | [check.ts:6327](../src/check.ts#L6327) |
8087
- | `figure_openings.openings` | `figure_openings.openings` | 'pair' | finding | [ps.under, ps.above] | [check.ts:5633](../src/check.ts#L5633) |
8088
- | `loop_physics` | `loop_physics` | 'rig' | evidence | [] | [check.ts:7295](../src/check.ts#L7295) |
8089
- | `requirements.lines.* (bone)` | `requirements.lines.*` | 'rig' | finding when line.status === 'FAIL'; otherwise evidence | [] | [check.ts:7591](../src/check.ts#L7591) |
8090
- | `requirements.lines.* (seam)` | `requirements.lines.*` | 'pair' | finding when line.status === 'FAIL'; otherwise evidence | [r.part, r.neighbour] | [check.ts:7591](../src/check.ts#L7591) |
8091
- | `requirements.lines.* (stretch)` | `requirements.lines.*` | part when the supplied mapping resolves a piece; otherwise rig | finding when line.status === 'FAIL'; otherwise evidence | resolved piece for r.slot; otherwise [] | [check.ts:7591](../src/check.ts#L7591) |
8118
+ | `TEXTURE_STRETCH.per_mesh` | `TEXTURE_STRETCH.per_mesh` | part when the supplied mapping resolves a piece; otherwise rig | evidence; finding when severity > TEXTURE_STRETCH_CEILING; otherwise evidence | resolved piece for m.slot; otherwise [] | [check.ts:9544](../src/check.ts#L9544), [check.ts:9554](../src/check.ts#L9554) |
8119
+ | `TIP_OVER_ROOT.parts` | `TIP_OVER_ROOT.parts` | 'part' | evidence; finding when !ok && !(!rigid && hanging.onLink && Math.max(c.root, c.tip) < TIP_TRAVEL_FLOOR); otherwise evidence | [p.name] | [check.ts:8325](../src/check.ts#L8325), [check.ts:8330](../src/check.ts#L8330), [check.ts:8351](../src/check.ts#L8351), [check.ts:8362](../src/check.ts#L8362) |
8120
+ | `WIND_BAND.pairs` | `WIND_BAND.pairs` | 'pair' | finding when !holdsAll; otherwise evidence | [p.a, p.b] | [check.ts:6464](../src/check.ts#L6464) |
8121
+ | `WIND_BAND.pairs[].steps` | `WIND_BAND.pairs[].steps` | 'pair' | finding when !s.holds; otherwise evidence | [p.a, p.b] | [check.ts:6475](../src/check.ts#L6475) |
8122
+ | `figure_openings.openings` | `figure_openings.openings` | 'pair' | finding | [ps.under, ps.above] | [check.ts:5781](../src/check.ts#L5781) |
8123
+ | `loop_physics` | `loop_physics` | 'rig' | evidence | [] | [check.ts:7445](../src/check.ts#L7445) |
8124
+ | `requirements.lines.* (bone)` | `requirements.lines.*` | 'rig' | finding when line.status === 'FAIL'; otherwise evidence | [] | [check.ts:7744](../src/check.ts#L7744) |
8125
+ | `requirements.lines.* (seam)` | `requirements.lines.*` | 'pair' | finding when line.status === 'FAIL'; otherwise evidence | [r.part, r.neighbour] | [check.ts:7744](../src/check.ts#L7744) |
8126
+ | `requirements.lines.* (stretch)` | `requirements.lines.*` | part when the supplied mapping resolves a piece; otherwise rig | finding when line.status === 'FAIL'; otherwise evidence | resolved piece for r.slot; otherwise [] | [check.ts:7744](../src/check.ts#L7744) |
8127
+ | `seam_cells.frames` | `frames` | 'pair' | evidence | [p.a, p.b] | [check.ts:4670](../src/check.ts#L4670) |
8128
+ | `seam_cells.frames[].cells` | `frames[].cells` | part when the supplied mapping resolves a piece; otherwise rig | evidence | resolved piece for cell.setupTop ?? ''; otherwise [] | [check.ts:4630](../src/check.ts#L4630) |
8092
8129
  | `seam_pairs` | `seam_pairs`; `seam_scope.whole_pairs`; `sets.*.seam_pairs`; `sets.*.seam_scope.whole_pairs` | subjects.length === 0 ? 'rig' : subjects.length === 1 ? 'part' : 'pair' | evidence | subjects | [check.ts:2480](../src/check.ts#L2480) |
8093
8130
  | `seam_scope.changes` | `seam_scope.changes`; `sets.*.seam_scope.changes` | 'rig' | evidence | [] | [check.ts:1958](../src/check.ts#L1958) |
8094
8131
  | `seam_scope.domain.states` | `seam_scope.domain.states`; `sets.*.seam_scope.domain.states` | 'rig' | evidence | [] | [check.ts:2043](../src/check.ts#L2043) |
8095
- | `seam_scope.pairs` | `seam_scope.pairs`; `sets.*.seam_scope.pairs` | subjects.length === 0 ? 'rig' : subjects.length === 1 ? 'part' : 'pair' | evidence | subjects | [check.ts:7205](../src/check.ts#L7205) |
8132
+ | `seam_scope.pairs` | `seam_scope.pairs`; `sets.*.seam_scope.pairs` | subjects.length === 0 ? 'rig' : subjects.length === 1 ? 'part' : 'pair' | evidence | subjects | [check.ts:7355](../src/check.ts#L7355) |
8096
8133
  | `seam_scope.population.pairs` | `seam_scope.population.pairs`; `sets.*.seam_scope.population.pairs` | 'pair' | evidence | row.parts | [check.ts:2414](../src/check.ts#L2414) |
8097
8134
  | `seam_scope.population.single_art` | `seam_scope.population.single_art`; `sets.*.seam_scope.population.single_art` | 'part' | evidence | [row.part] | [check.ts:2415](../src/check.ts#L2415) |
8098
8135
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spine-parts",
3
- "version": "2.19.4",
3
+ "version": "2.20.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
  "bin": {
@@ -68,7 +68,7 @@
68
68
  },
69
69
  "dependencies": {
70
70
  "ag-psd": "^31.0.2",
71
- "@rig-c/core": "3.2.1"
71
+ "@rig-c/core": "3.4.1"
72
72
  },
73
73
  "devDependencies": {
74
74
  "@esotericsoftware/spine-core": "4.3.13",
package/src/check.ts CHANGED
@@ -4507,7 +4507,36 @@ export interface MotionBackgroundRow {
4507
4507
  drawn: number;
4508
4508
  banded: number;
4509
4509
  /** rigc's `gapOpen` hits with a cell: background inside the carried setup-overlap band, alpha 0 in the whole skeleton composite. */
4510
- hits: Array<MotionSeamHit & { time: number }>;
4510
+ hits: Array<MotionSeamHit & { time: number; cells?: MotionOpenCell[] }>;
4511
+ }
4512
+
4513
+ /** Setup slot names are retained verbatim; classification uses the manifest's witnessed slot mapping. */
4514
+ export interface MotionOpenCell {
4515
+ x: number;
4516
+ y: number;
4517
+ setupTop: string | null;
4518
+ setupUnder: string | null;
4519
+ class: 'figure' | 'background' | 'other';
4520
+ }
4521
+
4522
+ export interface MotionOpenFrame extends MotionSeamHit {
4523
+ animation: string;
4524
+ time: number;
4525
+ classes: { figure: number; background: number; other: number };
4526
+ cells_index: number;
4527
+ }
4528
+
4529
+ export interface MotionCellFrame extends MotionSeamHit {
4530
+ pair: string;
4531
+ animation: string;
4532
+ time: number;
4533
+ cells: MotionOpenCell[];
4534
+ }
4535
+
4536
+ export const MOTION_CELLS_FILE = 'seam-cells.json';
4537
+ export interface MotionCellSidecar {
4538
+ spec: 'rig-parts-seam-cells/1';
4539
+ frames: MotionCellFrame[];
4511
4540
  }
4512
4541
 
4513
4542
  /** Issue #941: `SEAM_OVER_MOTION`'s `required` block. The bar is 0 background cells on every frame read; it never SKIPs. */
@@ -4516,9 +4545,10 @@ export interface MotionSeamRequired {
4516
4545
  mode: 'gap-open';
4517
4546
  bar_px: 0;
4518
4547
  /** Every declared pair, its class, and the frames read over every animation. */
4519
- pairs: Array<{ pair: string; class: MotionSeamClass; frames: number; background_frames: number; max_px: number }>;
4548
+ pairs: Array<{ pair: string; class: MotionSeamClass; frames: number; background_frames: number; max_px: number; open_frames?: MotionOpenFrame[] }>;
4520
4549
  /** How many refusals the bar added. */
4521
4550
  failed: number;
4551
+ cells?: { path: string; sha256: string };
4522
4552
  }
4523
4553
 
4524
4554
  /** A declared pair's class: a proven root first, then a limb joint, otherwise its explicit declaration. */
@@ -4533,7 +4563,7 @@ export function motionSeamClass(p: MotionSeamPair): MotionSeamClass {
4533
4563
  * the rate asked (stride 1, written = sampled), a file that is not the animation's or the rate's, a pair out of the
4534
4564
  * flag's order, and a `gapOpen` of the wrong shape — unavailable is never a measured zero.
4535
4565
  */
4536
- export function readMotionSeamBackground(dir: string, animations: readonly string[], fps: number, pairs: readonly MotionSeamPair[]): MotionBackgroundRow[] {
4566
+ export function readMotionSeamBackground(dir: string, animations: readonly string[], fps: number, pairs: readonly MotionSeamPair[], cellSlots?: ReadonlyMap<string, string>): MotionBackgroundRow[] {
4537
4567
  const problems: Problem[] = [];
4538
4568
  const bad = (object: string, detail: string): void => { problems.push({ code: 'FRAMES_SIDECAR', object, detail }); };
4539
4569
  const sidecar = readJson(join(dir, 'frames.json'), problems);
@@ -4558,10 +4588,19 @@ export function readMotionSeamBackground(dir: string, animations: readonly strin
4558
4588
  if (!isRecord(p) || p.a !== want.a || p.b !== want.b) { bad(at, `is ${JSON.stringify(isRecord(p) ? `${String(p.a)}|${String(p.b)}` : p)}; "${want.pair}", the flag's entry ${i}, is required`); return; }
4559
4589
  const open = p.gapOpen;
4560
4590
  const frames = isRecord(open) && Array.isArray(open.frames) ? open.frames : null;
4591
+ if (cellSlots !== undefined) {
4592
+ for (const kind of ['gapOpen', 'gapCovered'] as const) {
4593
+ const reading = p[kind];
4594
+ if (!isRecord(reading) || !Array.isArray(reading.frames)) { bad(`${at} ${kind}`, 'requires frames when --seam-cells was requested'); continue; }
4595
+ if (kind === 'gapCovered') for (const [index, hit] of reading.frames.entries()) readMotionOpenCells(hit, `${at} ${kind}.frames[${index}]`, cellSlots, bad);
4596
+ if (reading.worst !== null) readMotionOpenCells(reading.worst, `${at} ${kind}.worst`, cellSlots, bad);
4597
+ }
4598
+ }
4561
4599
  const hits = frames === null ? [] : frames.flatMap((h) => isRecord(h) && Number.isSafeInteger(h.index) && typeof h.index === 'number' && h.index >= 0 && h.index < (set.sampled as number) &&
4562
4600
  Number.isSafeInteger(h.px) && typeof h.px === 'number' && h.px > 0 && typeof h.cell === 'number' && h.cell > 0 && typeof h.time === 'number' && Number.isFinite(h.time) &&
4563
4601
  Array.isArray(h.box) && h.box.length === 4 && h.box.every((v) => typeof v === 'number' && Number.isFinite(v))
4564
- ? [{ index: h.index, px: h.px, cell: h.cell, time: h.time, box: [h.box[0], h.box[1], h.box[2], h.box[3]] as [number, number, number, number] }] : []);
4602
+ ? [{ index: h.index, px: h.px, cell: h.cell, time: h.time, box: [h.box[0], h.box[1], h.box[2], h.box[3]] as [number, number, number, number],
4603
+ ...(cellSlots === undefined ? {} : { cells: readMotionOpenCells(h, `${at} gapOpen frame ${h.index}`, cellSlots, bad) }) }] : []);
4565
4604
  if ((p.status !== 'read' && p.status !== 'skip') || typeof p.drawn !== 'number' || typeof p.banded !== 'number' || frames === null || hits.length !== frames.length || new Set(hits.map((h) => h.index)).size !== hits.length) {
4566
4605
  bad(`${at} gapOpen`, 'requires { frames: [{ index, time, px > 0, cell, box }…] } on every pair, one hit per frame, as rigc-seam/1 writes it from rig-c 2.69.0 — unavailable is not zero background');
4567
4606
  return;
@@ -4573,6 +4612,27 @@ export function readMotionSeamBackground(dir: string, animations: readonly strin
4573
4612
  return rows;
4574
4613
  }
4575
4614
 
4615
+ /** Unavailable cell evidence is refused before any report is emitted. */
4616
+ function readMotionOpenCells(hit: unknown, at: string, slots: ReadonlyMap<string, string>, bad: (object: string, detail: string) => void): MotionOpenCell[] {
4617
+ if (!isRecord(hit) || !Number.isSafeInteger(hit.px) || typeof hit.px !== 'number' || hit.px <= 0 || !Array.isArray(hit.cells) || hit.cells.length !== hit.px) {
4618
+ bad(at, 'requires cells.length === px > 0 when --seam-cells was requested; unavailable is not zero');
4619
+ return [];
4620
+ }
4621
+ const cells: MotionOpenCell[] = [];
4622
+ for (const [index, cell] of hit.cells.entries()) {
4623
+ if (!isRecord(cell) || typeof cell.x !== 'number' || !Number.isFinite(cell.x) || typeof cell.y !== 'number' || !Number.isFinite(cell.y) ||
4624
+ !(cell.setupTop === null || typeof cell.setupTop === 'string' && cell.setupTop.length > 0) ||
4625
+ !(cell.setupUnder === null || typeof cell.setupUnder === 'string' && cell.setupUnder.length > 0) ||
4626
+ cell.setupTop === null && cell.setupUnder !== null || cell.setupTop !== null && cell.setupTop === cell.setupUnder) {
4627
+ bad(`${at}.cells[${index}]`, `requires finite world-centre x/y and distinct setup slot names or null (a null top requires null under); found ${JSON.stringify(cell)}`);
4628
+ continue;
4629
+ }
4630
+ cells.push({ ...checkSlotRow('seam_cells.frames[].cells', false, cell.setupTop ?? '', slots),
4631
+ x: cell.x, y: cell.y, setupTop: cell.setupTop, setupUnder: cell.setupUnder, class: cell.setupTop === null ? 'background' : slots.has(cell.setupTop) ? 'figure' : 'other' });
4632
+ }
4633
+ return cells;
4634
+ }
4635
+
4576
4636
  /**
4577
4637
  * Issue #941: the bar `seam_over_motion.required: true` declares — 0 background cells (rigc's `gapOpen`: gap cells
4578
4638
  * inside the carried setup-overlap band where the whole skeleton composite has alpha 0) on every frame of every
@@ -4580,7 +4640,7 @@ export function readMotionSeamBackground(dir: string, animations: readonly strin
4580
4640
  * that measured nothing is refused too, since a SKIP is never a pass. Problems are pushed, one per pair and
4581
4641
  * animation (with its worst frame) and one per pair or line not measured; the block is returned.
4582
4642
  */
4583
- export function motionSeamRequired(line: MotionSeamLine, rows: readonly MotionBackgroundRow[], requirements: string, problems: Problem[]): MotionSeamRequired {
4643
+ export function motionSeamRequired(line: MotionSeamLine, rows: readonly MotionBackgroundRow[], requirements: string, problems: Problem[], cellEvidence: MotionCellSidecar = { spec: 'rig-parts-seam-cells/1', frames: [] }): MotionSeamRequired {
4584
4644
  const before = problems.length;
4585
4645
  const why = `${requirements} declares seam_over_motion.required: true, so 0 background px is required on every frame of every declared seam pair`;
4586
4646
  const refuse = (object: string, detail: string): void => { problems.push({ code: MOTION_SEAM_REQUIRED_CODE, object, detail }); };
@@ -4594,6 +4654,7 @@ export function motionSeamRequired(line: MotionSeamLine, rows: readonly MotionBa
4594
4654
  let frames = 0;
4595
4655
  let open = 0;
4596
4656
  let max = 0;
4657
+ const openFrames: MotionOpenFrame[] = [];
4597
4658
  if (p.unread !== undefined) refuse(label, `is not read — ${p.unread}; ${why}`);
4598
4659
  else for (const animation of line.animations) {
4599
4660
  const r = rows.find((x) => x.pair === p.pair && x.animation === animation);
@@ -4604,15 +4665,102 @@ export function motionSeamRequired(line: MotionSeamLine, rows: readonly MotionBa
4604
4665
  frames += r.frames;
4605
4666
  open += r.hits.length;
4606
4667
  if (r.hits.length === 0) continue;
4668
+ for (const hit of r.hits) if (hit.cells !== undefined) {
4669
+ const cellsIndex = cellEvidence.frames.length;
4670
+ cellEvidence.frames.push({ ...checkRow('seam_cells.frames', 'pair', false, [p.a, p.b]), pair: p.pair,
4671
+ animation, index: hit.index, time: hit.time, px: hit.px, cell: hit.cell, box: hit.box, cells: hit.cells });
4672
+ const classes = motionCellClasses(hit.cells);
4673
+ openFrames.push({ ...checkRow('SEAM_OVER_MOTION.required.pairs[].open_frames', 'pair', false, [p.a, p.b]),
4674
+ animation, index: hit.index, time: hit.time, px: hit.px, cell: hit.cell, box: hit.box, classes, cells_index: cellsIndex });
4675
+ }
4607
4676
  const worst = r.hits.reduce((b, h) => (h.px > b.px || (h.px === b.px && h.index < b.index) ? h : b));
4608
4677
  max = Math.max(max, worst.px);
4609
4678
  refuse(`${label} in "${animation}" at frame ${worst.index} (t = ${worst.time}s)`,
4610
4679
  `background on ${r.hits.length} of ${r.frames} frame(s) read ${frameRuns(r.hits.map((h) => h.index))}: found ${worst.px} px (rigc gapOpen cells of ${worst.cell} world units, world box [${worst.box.join(', ')}]) on the worst frame, 0 required; ${why}`);
4611
4680
  }
4612
- out.push({ ...checkRow('SEAM_OVER_MOTION.required.pairs', 'pair', open > 0, [p.a, p.b]), pair: p.pair, class: cls, frames, background_frames: open, max_px: max });
4681
+ out.push({ ...checkRow('SEAM_OVER_MOTION.required.pairs', 'pair', open > 0, [p.a, p.b]), pair: p.pair, class: cls, frames, background_frames: open, max_px: max,
4682
+ ...(openFrames.length === 0 ? {} : { open_frames: openFrames }) });
4613
4683
  }
4614
4684
  const failed = problems.length - before;
4615
- return { status: failed === 0 ? 'PASS' : 'FAIL', mode: 'gap-open', bar_px: 0, pairs: out, failed };
4685
+ return { status: failed === 0 ? 'PASS' : 'FAIL', mode: 'gap-open', bar_px: 0, pairs: out, failed,
4686
+ ...(cellEvidence.frames.length === 0 ? {} : { cells: { path: MOTION_CELLS_FILE, sha256: createHash('sha256').update(serializeCheckRows(cellEvidence)).digest('hex') } }) };
4687
+ }
4688
+
4689
+ /** The inline partition counts the same cells as the sidecar, including unresolved setup slots. */
4690
+ function motionCellClasses(cells: readonly MotionOpenCell[]): MotionOpenFrame['classes'] {
4691
+ const counts = { figure: 0, background: 0, other: 0 };
4692
+ for (const cell of cells) counts[cell.class]++;
4693
+ return counts;
4694
+ }
4695
+
4696
+ /** Refuse broken evidence links and partitions rather than silently consuming partial evidence. */
4697
+ export function readMotionSeamCellSidecar(dir: string, required: MotionSeamRequired): MotionCellSidecar | null {
4698
+ if (required.cells === undefined) return null;
4699
+ const bad = (object: string, detail: string): never => {
4700
+ refuseIfAny([{ code: 'FRAMES_SIDECAR', object, detail }]);
4701
+ throw new Error('unreachable');
4702
+ };
4703
+ const reference = required.cells;
4704
+ if (reference.path !== MOTION_CELLS_FILE || !/^[a-f0-9]{64}$/.test(reference.sha256)) bad('SEAM_OVER_MOTION.required.cells', 'requires relative seam-cells.json path and a SHA-256 digest');
4705
+ const path = join(dir, reference.path);
4706
+ let bytes: Buffer;
4707
+ try { bytes = readFileSync(path); }
4708
+ catch { return bad(path, 'referenced cell sidecar is missing or unreadable; unavailable is not zero'); }
4709
+ const digest = createHash('sha256').update(bytes).digest('hex');
4710
+ if (digest !== reference.sha256) bad(path, `SHA-256 is ${digest}; required ${reference.sha256}`);
4711
+ let value: unknown;
4712
+ try { value = JSON.parse(bytes.toString('utf8')) as unknown; }
4713
+ catch { return bad(path, 'requires a JSON rig-parts-seam-cells/1 document'); }
4714
+ if (!isRecord(value) || value.spec !== 'rig-parts-seam-cells/1' || !Array.isArray(value.frames)) return bad(path, 'requires rig-parts-seam-cells/1 frames');
4715
+ const seen = new Set<number>();
4716
+ for (const pair of required.pairs) for (const frame of pair.open_frames ?? []) {
4717
+ const at = `${path} frames[${frame.cells_index}]`;
4718
+ const read: unknown = value.frames[frame.cells_index];
4719
+ if (!Number.isSafeInteger(frame.cells_index) || frame.cells_index < 0 || seen.has(frame.cells_index) || !isRecord(read) ||
4720
+ read.pair !== pair.pair || read.animation !== frame.animation || read.index !== frame.index || read.time !== frame.time || read.px !== frame.px || read.cell !== frame.cell ||
4721
+ JSON.stringify(read.box) !== JSON.stringify(frame.box) || !Array.isArray(read.cells) || read.cells.length !== frame.px) {
4722
+ bad(at, 'requires one matching pair-frame with cells.length === gapOpen px; unavailable is not zero');
4723
+ continue;
4724
+ }
4725
+ seen.add(frame.cells_index);
4726
+ const classes = { figure: 0, background: 0, other: 0 };
4727
+ for (const cell of read.cells) {
4728
+ if (!isRecord(cell) || typeof cell.x !== 'number' || !Number.isFinite(cell.x) || typeof cell.y !== 'number' || !Number.isFinite(cell.y) ||
4729
+ !(cell.setupTop === null || typeof cell.setupTop === 'string' && cell.setupTop.length > 0) ||
4730
+ !(cell.setupUnder === null || typeof cell.setupUnder === 'string' && cell.setupUnder.length > 0) ||
4731
+ !['figure', 'background', 'other'].includes(String(cell.class))) bad(at, 'requires finite world centres, setup names and figure/background/other classes');
4732
+ else classes[cell.class as MotionOpenCell['class']]++;
4733
+ }
4734
+ if (!frame.classes || !Object.values(frame.classes).every(n => Number.isSafeInteger(n) && n >= 0) ||
4735
+ frame.classes.figure + frame.classes.background + frame.classes.other !== frame.px ||
4736
+ frame.classes.figure !== classes.figure || frame.classes.background !== classes.background || frame.classes.other !== classes.other) {
4737
+ bad(at, `inline figure/background/other counts ${JSON.stringify(frame.classes)} must sum to gapOpen px ${frame.px} and match sidecar ${JSON.stringify(classes)}`);
4738
+ }
4739
+ }
4740
+ if (seen.size !== value.frames.length) bad(path, `has ${value.frames.length} frame(s); inline rows reference ${seen.size} distinct frame(s)`);
4741
+ // Every cell and its pair/frame identity was checked above after the digest matched.
4742
+ return value as unknown as MotionCellSidecar;
4743
+ }
4744
+
4745
+ /** Publish check.json and its cell evidence together, restoring previous bytes on refusal. */
4746
+ export function publishMotionSeamCells(dir: string, required: MotionSeamRequired | undefined, evidence: MotionCellSidecar, publish: () => void): void {
4747
+ const path = join(dir, MOTION_CELLS_FILE), check = join(dir, 'check.json');
4748
+ const previous = existsSync(path) ? readFileSync(path) : null;
4749
+ const previousCheck = existsSync(check) ? readFileSync(check) : null;
4750
+ try {
4751
+ if (required?.cells !== undefined) {
4752
+ writeFileSync(path, serializeCheckRows(evidence));
4753
+ readMotionSeamCellSidecar(dir, required);
4754
+ }
4755
+ publish();
4756
+ if (required?.cells === undefined) rmSync(path, { force: true });
4757
+ } catch (error) {
4758
+ if (previous === null) rmSync(path, { force: true });
4759
+ else writeFileSync(path, previous);
4760
+ if (previousCheck === null) rmSync(check, { force: true });
4761
+ else writeFileSync(check, previousCheck);
4762
+ throw error;
4763
+ }
4616
4764
  }
4617
4765
 
4618
4766
  /** Issue #941: the console line for the required block. */
@@ -6948,6 +7096,7 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
6948
7096
  // Issue #941: under seam_over_motion.required, the same render's gapOpen on every frame of every declared pair.
6949
7097
  const seamRequired = seamOverMotionRequired(reqFile);
6950
7098
  let backgroundRows: MotionBackgroundRow[] = [];
7099
+ const motionCellEvidence: MotionCellSidecar = { spec: 'rig-parts-seam-cells/1', frames: [] };
6951
7100
  {
6952
7101
  const fps = IDLE_FPS;
6953
7102
  const seamReqs = reqFile === null || seams === null ? [] : reqFile.requirements.flatMap((r) => (r.kind === 'seam' && seams?.has(r.name) === true ? [{ name: r.name, part: r.part, neighbour: r.neighbour }] : []));
@@ -7007,11 +7156,12 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
7007
7156
  const activeDest = stripped === null ? seamMotionDir : join(seamMotionDir, env === null ? 'default' : 'active');
7008
7157
  const renderedWorlds = new Set<'default' | 'still'>();
7009
7158
  const hasRoots = read.some(p => p.root !== undefined);
7010
- const r = measured(['render', '--candidate', buildDir, '--seam', list, '--fps', String(fps), '--max', String(FOLD_RENDER_MAX), '--geometry', '--out', activeDest]);
7159
+ const r = measured(['render', '--candidate', buildDir, '--seam', list, ...(seamRequired ? ['--seam-cells'] : []), '--fps', String(fps), '--max', String(FOLD_RENDER_MAX), '--geometry', '--out', activeDest]);
7011
7160
  if (r.status !== 0) refuseIfAny(rigcFailed(`render --seam ${list} --fps ${fps}`, r, r.out.split('\n').filter((l) => l.includes('FAIL') || l.includes('rigc:'))));
7012
7161
  const activeWorldRows: MotionSeamWorldRow[] = [];
7013
7162
  motionSeam = motionSeamLine(pairs, animationNames, fps, readMotionSeams(activeDest, animationNames, fps, read, {}, stripped !== null && env === null ? activeWorldRows : undefined, hasRoots ? motionRootDrawOrderReader(activeDest) : undefined), undefined, motionRootProblems, unmeasuredRoots);
7014
- if (seamRequired) backgroundRows = readMotionSeamBackground(activeDest, animationNames, fps, read);
7163
+ if (seamRequired) backgroundRows = readMotionSeamBackground(activeDest, animationNames, fps, read,
7164
+ checkSlotParts(inp.rig, inp.parts?.parts.map(p => p.name) ?? [], inp.parts?.alternates?.map(set => set.name) ?? []));
7015
7165
  enrichMotionSeamPoses(activeDest, inp.rig, inp.parts, pairs, motionSeam.rows);
7016
7166
  if (stripped !== null) {
7017
7167
  const response = environmentResponse(readFileSync(join(buildDir, 'skeleton.json'), 'utf8'));
@@ -7039,7 +7189,7 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
7039
7189
  }
7040
7190
  }
7041
7191
  }
7042
- if (seamRequired && reqFile !== null) motionSeam.required = motionSeamRequired(motionSeam, backgroundRows, reqFile.path, motionRootProblems);
7192
+ if (seamRequired && reqFile !== null) motionSeam.required = motionSeamRequired(motionSeam, backgroundRows, reqFile.path, motionRootProblems, motionCellEvidence);
7043
7193
  const declaredPairKeys = new Set(motionSeam.pairs.map((p) => [p.a, p.b].sort().join('|')));
7044
7194
  const figureOpenings: FigureOpeningReading =
7045
7195
  inp.parts === null
@@ -7370,7 +7520,10 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
7370
7520
  problems.unshift(...barProblems);
7371
7521
  problems.push(...cutMaterialProblems, ...foldProblems, ...levelProblems, ...stressProblems, ...limbProblems, ...sweepProblems, ...motionRootProblems, ...reqProblems);
7372
7522
  figures.PASS = problems.length === 0;
7373
- const publishCheck = (): void => write('check.json', serializeCheckRows(figures));
7523
+ const publishCheck = (): void => {
7524
+ publishMotionSeamCells(out, motionSeam.required, motionCellEvidence, () => write('check.json', serializeCheckRows(figures)));
7525
+ if (motionSeam.required?.cells !== undefined) written.push(MOTION_CELLS_FILE);
7526
+ };
7374
7527
  if (motionSeam.worlds === undefined) publishCheck();
7375
7528
  else publishMotionSeamWorlds(out, seamMotionDir, motionSeam.worlds, publishCheck);
7376
7529
  const extremes = noExtremes ? [] : renderExtremes(buildDir, out, animationNames, idle === null ? extremesFrames : readJson(join(idleDir, 'frames.json'), []), extremesFrames, measured);
package/src/checkrow.ts CHANGED
@@ -19,6 +19,9 @@ export const CHECK_ROW_PATHS = {
19
19
  'PART_SUPPORT_REPORT.unowned.regions': ['PART_SUPPORT_REPORT.unowned.regions'],
20
20
  'SEAM_OVER_MOTION.pairs': ['SEAM_OVER_MOTION.pairs'],
21
21
  'SEAM_OVER_MOTION.required.pairs': ['SEAM_OVER_MOTION.required.pairs'],
22
+ 'SEAM_OVER_MOTION.required.pairs[].open_frames': ['SEAM_OVER_MOTION.required.pairs[].open_frames'],
23
+ 'seam_cells.frames': ['frames'],
24
+ 'seam_cells.frames[].cells': ['frames[].cells'],
22
25
  'SEAM_OVER_MOTION.roots.unmeasured': ['SEAM_OVER_MOTION.roots.unmeasured'],
23
26
  'SEAM_OVER_MOTION.rows': ['SEAM_OVER_MOTION.rows'],
24
27
  'SEAM_OVER_MOTION.rows[].cells': ['SEAM_OVER_MOTION.rows[].cells'],