rig-parts 2.68.0 → 2.69.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/README.md CHANGED
@@ -274,6 +274,7 @@ Command details and config saving are in the [command reference](docs/AUTHORING.
274
274
  | `head-crop-preflight` | [Report what a head box would clip, before the head run](docs/AUTHORING.md#command-reference) |
275
275
  | `sheet` | [Make a contact sheet](docs/AUTHORING.md#command-reference) |
276
276
  | `assemble` | [Merge layers into measured parts](docs/AUTHORING.md#command-reference) |
277
+ | `replace-parts` | [Apply receipted PNG edits to a recorded parts set](docs/AUTHORING.md#replace-parts) |
277
278
  | `check-parts` | [Check assembled parts' integrity and write a report](docs/AUTHORING.md#check-parts) |
278
279
  | `diff-components` | [List every place the stacked parts differ from the painting](docs/AUTHORING.md#whole-figure-difference-inventory) |
279
280
  | `diff-drafts` | [Compare two assemble outputs](docs/AUTHORING.md#command-reference) |
package/cli.ts CHANGED
@@ -9,6 +9,7 @@ import { modelArrayMap, serializeModelArrayMap } from './src/modelarray.ts';
9
9
  import { externalReceipt } from './src/externalreceipt.ts';
10
10
  import { BUST_LANDMARKS_ACT_SCHEMA, BUST_LANDMARKS_COMMENT_ACT_SCHEMA, BUST_LANDMARKS_PROVENANCE_SPEC, BUST_LANDMARKS_PROVENANCE_SUFFIX, BUST_POINT_SHAPE_FIELDS, bustShapeClause, type BustSidecar, effectiveBustShape, planBustLandmarks, readBustSidecar, stageBustLandmarks, stageReplacements, type StagedBustLandmarks } from './src/bustlandmarks.ts';
11
11
  import { writeEditedPart } from './tools/edited-part-cli.ts';
12
+ import { replaceParts } from './src/replaceparts.ts';
12
13
  /**
13
14
  * rig-parts — one painting and its See-through layers in, Spine-ready parts
14
15
  * and rig specs out, verified through rig-c.
@@ -46,6 +47,7 @@ import { idleKeysOf, isIdleKeys } from './src/rig.ts';
46
47
  import { bodyCoreBox, bodyOpaqueBox, CORE_ALPHA, depthSkipLine, exportLayers, figuresPhrase, hiddenLayerLine, implausibleRules, layerCoreBox, layerFigures, layerOpaqueBox, type LayerSet, layerSetDiff, type OpaqueBox, OPAQUE_ALPHA_ABOVE, pct, readLayers, readWrapperLayers, ruleSummary, templateLayerNames, templatePsdBytes, times } from './src/layers.ts';
47
48
  import { checkImageSize, choosePerson, KEYPOINTS_SPEC, loadKeypoints, type RigJoints, toRigJoints } from './src/keypoints.ts';
48
49
  import { checkPartsStage } from './src/partscheck.ts';
50
+ import { withinPartsPath } from './src/partsfiles.ts';
49
51
  import { basisLines, branchSqueezeLine, bustCleavage, checkProposal, compare, compareLines, DEFAULT_GRID_RULE, draftTurn, drawLandmarks, FIGURE_GRID_DIVISOR, FRINGE_STEP_PX, GRID_RULES, type GridRule, type BustDraft, type Proposal, HIP_MIN_FRACTION, type DraftLintFinding, lint, lintLine, type PartSet, PROPOSAL_CONFIG_SECTIONS, proposalAsConfig, proposeWithBasis, readBustLandmarks, readPartSet, serializeProposal, withTurn, WRIST_ON_PART_PX } from './src/propose.ts';
50
52
  import { BASIS_FILE, BASIS_SPEC, basisFile, basisLine, coverageLines, legChainChoice, serializeBasis } from './src/diagnostics.ts';
51
53
  import { BEND_DEGREES, BEND_WORST_SHARE, DUST_MAX_PX, DUST_MAX_SHARE, IDLE_BOUND_PX, MESH_DRAFT_REPORT, MESH_DRAFT_SPEC, meshDraftStage, MORE_TRIANGLES_FLAG, relativeConfigPaths, TOLERANCE_FIGURE_DIVISOR } from './src/meshdraft.ts';
@@ -56,10 +58,11 @@ import { RETUNE_FILE, RETUNE_SPEC, retuneStage } from './src/retune.ts';
56
58
  import { checkPainting, DEFAULT_PAINTING_FORM, isPaintingForm, PAINTING_FORMS, paintingFormOf } from './src/paintcheck.ts';
57
59
  import { decodePngBytes, readPng, writePng } from './src/raster/png.ts';
58
60
  import { REQUIREMENTS_SENTENCE } from './src/requirements.ts';
61
+ import { replacementTreeDigest } from './src/replacementrecord.ts';
59
62
  import { type ComposeInput, composeStage, IMAGE_SEP, PLATE, PROVENANCES, refusePreviewLoopSeam, SCENE_CAMERA_REPORT_SPEC, SCENE_REPORT_FILE, SCENE_REPORT_SPEC, SCENE_SPEC } from './src/scene.ts';
60
63
  import { buildSheet, defaultCaption, type Tile, tilesFrom } from './src/sheet.ts';
61
64
  import { loadComparison, requiredProblems, structureLines } from './src/structure.ts';
62
- import { type ArgvTable, assembleOutputFiles, BUILD_RUN_FILE, CHECK_RUN_FILE, clearComposeRun, clearRunRecord, clearRunStamp, readPackageIdentity, recordArgv, rigOutputFiles, RUN_STAMP_FILE, RUN_STAMP_SPEC, writeRunRecord, writeRunStamp } from './src/runstamp.ts';
65
+ import { type ArgvTable, assembleOutputFiles, BUILD_RUN_FILE, CHECK_RUN_FILE, clearComposeRun, clearRunRecord, clearRunStamp, readPackageIdentity, realWhereItExists, recordArgv, rigOutputFiles, RUN_STAMP_FILE, RUN_STAMP_SPEC, type RunStampFileEntry, writeRunRecord, writeRunStamp } from './src/runstamp.ts';
63
66
  import { authorLayerLine } from './src/tags.ts';
64
67
 
65
68
  const EXIT_OK = 0;
@@ -88,6 +91,10 @@ usage:
88
91
  Record both file hashes and the declared editor in one edited_parts receipt.
89
92
  Update only explicitly named configs; build verifies the assembled baseline.
90
93
 
94
+ rig-parts replace-parts --parts <dir> --edits <json> --out <dir> [--source-sha256 <sha256>]
95
+ Derive a new parts set from a recorded set and hash-bound replacement PNGs.
96
+ Write the derivation record and retain independent files byte for byte.
97
+
91
98
  rig-parts diff-components --stack <png> --painting <png> --parts <parts.json> --floor <px>
92
99
  [--threshold <channel>] [--figure <binary-png>] [--owners] (--out <json> | --verify <json>)
93
100
  Exhaustive native difference inventory; default max RGB channel > 40.
@@ -1293,6 +1300,7 @@ function printLayerTable(set: LayerSet): void {
1293
1300
  */
1294
1301
  const TAKES = {
1295
1302
  'edited-part': { valued: ['--config', '--part', '--file', '--from', '--editor', '--producer', '--parts', '--rig-config'], switches: ['--help'] },
1303
+ 'replace-parts': { valued: ['--parts', '--edits', '--out', '--source-sha256'], switches: ['--help'] },
1296
1304
  'external-receipt': { valued: ['--kind', '--file', '--painting', '--producer', '--out', '--verify'], switches: ['--help'] },
1297
1305
  'check-parts': { valued: ['--parts', '--out'], switches: ['--json', '--help'] },
1298
1306
  'bust-landmarks': { valued: ['--from-act', '--parts', '--config', '--out'], switches: ['--write-config', '--help'] },
@@ -1567,6 +1575,31 @@ function runStampClock(): string | undefined {
1567
1575
  return new Date(millis).toISOString();
1568
1576
  }
1569
1577
 
1578
+ /** Capture before clearing or writing outputs. Let the stage report its own input refusals first. */
1579
+ function capturePartsInput(path: string, out: string): () => RunStampFileEntry {
1580
+ let root: string;
1581
+ let sha256: string;
1582
+ try {
1583
+ root = realWhereItExists(resolve(path));
1584
+ sha256 = replacementTreeDigest(root);
1585
+ } catch (error) {
1586
+ return () => { throw error; };
1587
+ }
1588
+ return () => {
1589
+ const finalRoot = realWhereItExists(resolve(path));
1590
+ const outRoot = realWhereItExists(resolve(out));
1591
+ let detail: string | undefined;
1592
+ if (finalRoot !== root) detail = `resolved to ${JSON.stringify(finalRoot)} after the stage; expected ${JSON.stringify(root)}`;
1593
+ // An overlapping output can change the source inventory itself, so its digest is the pre-stage snapshot.
1594
+ else if (!withinPartsPath(root, outRoot) && !withinPartsPath(outRoot, root)) {
1595
+ const after = replacementTreeDigest(root);
1596
+ if (after !== sha256) detail = `SHA-256 ${after} after the stage; expected ${sha256} from before the stage`;
1597
+ }
1598
+ if (detail !== undefined) throw new PartsError([{ code: 'RUN_PARTS_INPUT_CHANGED', object: path, detail }]);
1599
+ return { path, sha256 };
1600
+ };
1601
+ }
1602
+
1570
1603
  function cmdRig(args: string[]): number {
1571
1604
  let fixedClock: string | undefined;
1572
1605
  try { fixedClock = runStampClock(); } catch (err) { return printRefusal(err); }
@@ -1614,6 +1647,7 @@ function cmdRig(args: string[]): number {
1614
1647
  } catch (err) {
1615
1648
  return printRefusal(err);
1616
1649
  }
1650
+ const partsInput = capturePartsInput(partsDir, out);
1617
1651
  clearRunStamp(out);
1618
1652
  let bin: string;
1619
1653
  try {
@@ -1627,7 +1661,7 @@ function cmdRig(args: string[]): number {
1627
1661
  const pkg = readPackageIdentity(join(import.meta.dir, 'package.json'));
1628
1662
  const rig = rigStage({ config, parts: partsDir, out, idleKeys: keys, pageEdges: edges, packShape: shape, ...(size === undefined ? {} : { pageSize: size }) }, rigcRunner(bin), scratch, console.log);
1629
1663
  const finishedAt = fixedClock ?? new Date().toISOString();
1630
- writeRunStamp({ pkg, command: 'rig', startedAt, finishedAt, outDir: out, configPath: config, outputPaths: rigOutputFiles(rig) });
1664
+ writeRunStamp({ pkg, command: 'rig', startedAt, finishedAt, outDir: out, configPath: config, partsInput: partsInput(), outputPaths: rigOutputFiles(rig) });
1631
1665
  return EXIT_OK;
1632
1666
  } catch (err) {
1633
1667
  return printRefusal(err);
@@ -1755,12 +1789,15 @@ function cmdCheck(args: string[]): number {
1755
1789
  try {
1756
1790
  const size = parsePageSize(f.get('--page-size'));
1757
1791
  const pkg = readPackageIdentity(join(import.meta.dir, 'package.json'));
1792
+ const parts = f.get('--parts');
1793
+ const partsHome = parts ?? rig;
1794
+ const partsInput = existsSync(join(resolve(partsHome), 'parts.json')) ? capturePartsInput(partsHome, out) : undefined;
1758
1795
  clearRunRecord(out, CHECK_RUN_FILE);
1759
1796
  const bin = findRigc(import.meta.dir, process.env.PATH ?? '');
1760
1797
  const startedAt = fixedClock ?? new Date().toISOString();
1761
1798
  const r = checkStage(
1762
1799
  {
1763
- rig, parts: f.get('--parts'), source: f.get('--source'), out, pageEdges: edges, packShape: shape,
1800
+ rig, parts, source: f.get('--source'), out, pageEdges: edges, packShape: shape,
1764
1801
  ...(size === undefined ? {} : { pageSize: size }), requirements: f.get('--requirements'), seamPairs: seamPairs === 1,
1765
1802
  keepStills: keepStills === 1, noExtremes: noExtremes === 1, ...(f.has('--set') ? { set: f.get('--set') as string } : {}),
1766
1803
  allSets: allSets === 1, ...(f.has('--environment') ? { environment: f.get('--environment') as string } : {}),
@@ -1770,9 +1807,10 @@ function cmdCheck(args: string[]): number {
1770
1807
  bin,
1771
1808
  json === 1 ? () => {} : console.log,
1772
1809
  );
1773
- // Issue #1541: the record of the run, beside the report it completed; never a refusal of its own.
1810
+ // Issue #1541: the record of the run, beside the report it completed.
1774
1811
  const wrote = checkWrote(r, out);
1775
1812
  writeRunRecord({ pkg, command: 'check', startedAt, finishedAt: fixedClock ?? new Date().toISOString(), outDir: out,
1813
+ partsInput: partsInput?.(),
1776
1814
  outputs: [...wrote.written, ...wrote.dirs.map((d) => `${d}/`)], argv: recordArgv('check', args, CHECK_ARGV, out, process.cwd()) });
1777
1815
  if (json === 1) process.stdout.write(`${JSON.stringify(r.figures, null, 1)}\n`);
1778
1816
  return r.figures.PASS ? EXIT_OK : EXIT_REFUSED;
@@ -2921,6 +2959,21 @@ function cmdEditedPart(args: string[]): number {
2921
2959
  } catch (error) { return printRefusal(error); }
2922
2960
  }
2923
2961
 
2962
+ function cmdReplaceParts(args: string[]): number {
2963
+ const values = flags(args, 'replace-parts', ['--parts', '--edits', '--out']);
2964
+ if (typeof values === 'string') return usage(values);
2965
+ try {
2966
+ replaceParts({
2967
+ parts: values.get('--parts')!,
2968
+ edits: values.get('--edits')!,
2969
+ out: values.get('--out')!,
2970
+ sourceSha256: values.get('--source-sha256'),
2971
+ });
2972
+ console.log('replace-parts: wrote the derived parts set and its replacement record');
2973
+ return EXIT_OK;
2974
+ } catch (error) { return printRefusal(error); }
2975
+ }
2976
+
2924
2977
  function cmdExternalReceipt(args: string[]): number {
2925
2978
  const f = flags(args, 'external-receipt', []);
2926
2979
  if (typeof f === 'string') return usage(f);
@@ -3224,6 +3277,7 @@ function main(argv: string[]): number | Promise<number> {
3224
3277
  if (command === 'depth-map') return cmdDepthMap(rest);
3225
3278
  if (command === 'depth-place') return cmdDepthPlace(rest);
3226
3279
  if (command === 'edited-part') return cmdEditedPart(rest);
3280
+ if (command === 'replace-parts') return cmdReplaceParts(rest);
3227
3281
  if (command === 'external-receipt') return cmdExternalReceipt(rest);
3228
3282
  if (command === 'bust-landmarks') return cmdBustLandmarks(rest);
3229
3283
  if (command === 'depth-bind') return cmdDepthBind(rest);
package/docs/AUTHORING.md CHANGED
@@ -5859,6 +5859,7 @@ row in this page's `rule` and `line` tables; the selftest holds that (`TY16`).
5859
5859
  | rule | means | change |
5860
5860
  | --- | --- | --- |
5861
5861
  | <a id="RUN_STAMP_EPOCH"></a>`RUN_STAMP_EPOCH` | SOURCE_DATE_EPOCH is not canonical non-negative integer seconds at most 253402300799 (9999-12-31T23:59:59Z) | unset the variable for wall-clock stamps or supply integer seconds at most 253402300799 for four-digit-year ISO stamps; 253402300800 and above, empty, signs, fractions, whitespace and leading zeroes are refused before any output is touched |
5862
+ | <a id="RUN_PARTS_INPUT_CHANGED"></a>`RUN_PARTS_INPUT_CHANGED` | the resolved parts directory changed during the stage, or its digest changed with disjoint input and output directories | run against a stable parts directory and write to a separate output directory |
5862
5863
  | <a id="CONFIG_HYBRID_SOURCE"></a>`CONFIG_HYBRID_SOURCE` | the two hybrid neighbours name different source parts | use a single continuous source layer for the joint band |
5863
5864
  | <a id="CONFIG_HYBRID_CUT"></a>`CONFIG_HYBRID_CUT` | a hybrid joint also declares a cut-cap option | remove cap, cap_shape, edge and cut_band at that joint |
5864
5865
  | <a id="ASSEMBLE_HYBRID_SOURCE"></a>`ASSEMBLE_HYBRID_SOURCE` | effective alternate layer selection gives a band different upper and lower source layers | select the same continuous layer for both rigid neighbours |
@@ -6952,6 +6953,95 @@ documents do not ship). Each is an input this package built; none is an author's
6952
6953
  | <a id="COMPARE_WARMUP_UNSUPPORTED"></a>`COMPARE_WARMUP_UNSUPPORTED` | a physics warm-up other than 0 was asked of the comparison; physics resets at time 0 and steps from there | an input this package built, not an author's: report it with the line |
6953
6954
  | <a id="SKINNING_RANGE_UNSUPPORTED"></a>`SKINNING_RANGE_UNSUPPORTED` | `skinningEnvelopeBone` was handed a bone range not declared by the bone's own keys (a physics swing, a range read off a posed schedule), or a bone whose setup scale is not uniform; the bound is not proven, so it is refused | nothing to change for the build: inside the residual clause it means the residual veto was not applied to that bone, and the motion comparison decides |
6954
6955
 
6956
+ ### replace-parts
6957
+
6958
+ Use `replace-parts` when you have a recorded parts set and replacement PNGs
6959
+ edited in the existing part crops. Give it a new, disjoint output directory.
6960
+
6961
+ ```sh
6962
+ rig-parts replace-parts --parts recorded --edits edits.json --out revised
6963
+ ```
6964
+
6965
+ An edit file has this shape (substitute the recorded rig size, part box and
6966
+ PNG hashes).
6967
+
6968
+ ```json
6969
+ {
6970
+ "rig_size": [1920, 1080],
6971
+ "dir": ".",
6972
+ "edits": [
6973
+ {
6974
+ "box": [0, 0, 24, 12],
6975
+ "receipt": {
6976
+ "part": "under",
6977
+ "file": "under.png",
6978
+ "sha256": "<replacement PNG SHA-256>",
6979
+ "from_sha256": "<recorded PNG SHA-256>",
6980
+ "editor": "retouch"
6981
+ }
6982
+ }
6983
+ ]
6984
+ }
6985
+ ```
6986
+
6987
+ `dir` resolves from the edit file's directory and `file` resolves from `dir`.
6988
+ Each edit names one existing part and carries one receipt. The receipt uses
6989
+ the [edited-part author declaration](#edited-rig-space-parts-assembleedited_parts-issue-1278),
6990
+ with either `editor` or `producer`. `from_sha256` is required for each edit and
6991
+ binds the exact encoded source PNG bytes. `sha256` binds the encoded replacement
6992
+ PNG bytes. The command always computes the whole source set's digest. To pin
6993
+ the command to an independently accepted inventory, also pass
6994
+ `--source-sha256 <accepted-digest>`.
6995
+
6996
+ The output uses the recorded rig grid, crop origin and crop extent. The command
6997
+ remeasures the edited part's opaque pixel count and derives change and removal
6998
+ evidence from the two PNGs. Live per-pixel source claims require bound source
6999
+ evidence. For a part with scalar depth, a support change keeps surviving
7000
+ samples and uses them to extend depth over the new support. Depth readings are
7001
+ refreshed when their measured support changes. A retained part's cross-part
7002
+ evidence must still hold at the same rig coordinates, including overlap and
7003
+ draw order and any recorded dependency affected by the edit. All replacements
7004
+ are evaluated together on the final set. The guard protects retained records,
7005
+ so editing both members of a pair in one call can avoid invalidating a
7006
+ retained record for either member. Affected evidence on a third, retained
7007
+ part must still hold.
7008
+
7009
+ The bound painting, source figure mask and retained part assets are copied
7010
+ byte-for-byte. The recomposite reading in `parts.json` is measured against
7011
+ the final stack when the source has a bound painting. A legacy set without a
7012
+ bound painting loses its prior recomposite reading if there is no scene mask
7013
+ binding that requires the reading. Composite preview and error PNGs, prior
7014
+ rigs, and old check reports are omitted. The revised row records fresh
7015
+ `opaque_px` and keeps its original count under `assembly_opaque_px` to scope
7016
+ the assembly counters. Read the `replacement_record` pointer in
7017
+ `revised/parts.json` for the sorted path lists and the source and result
7018
+ digests. Keep the source set to consult its original measurements.
7019
+
7020
+ In Bun, import `replacementTreeDigest` from `@rig-c/parts/replace-parts`.
7021
+ `replacementTreeDigest(recorded)` returns the digest accepted by
7022
+ `--source-sha256`. `replacementTreeDigest(revised, { result: true })`
7023
+ excludes the one record that `revised/parts.json` points to and returns the
7024
+ result digest. Result mode requires both the pointer and its record file.
7025
+ Source mode includes all regular files, including any earlier records.
7026
+
7027
+ | rule | means | change |
7028
+ | --- | --- | --- |
7029
+ | <a id="REPLACE_PART_GRID"></a>`REPLACE_PART_GRID` | The edit declares a different rig grid or box, or the PNG dimensions differ from the recorded crop. | Keep the source rig size, part box and PNG dimensions. |
7030
+ | <a id="REPLACE_PART_UNKNOWN"></a>`REPLACE_PART_UNKNOWN` | The receipt names a part absent from the source set. | Use a recorded source part name. |
7031
+ | <a id="REPLACE_PART_RECEIPT"></a>`REPLACE_PART_RECEIPT` | A required receipt is missing, malformed or fails its byte binding. | Supply one valid receipt per edit with both PNG hashes and an author declaration. |
7032
+ | <a id="REPLACE_PART_SOURCE_HASH"></a>`REPLACE_PART_SOURCE_HASH` | The computed source set digest differs from the supplied `--source-sha256`. | Use the accepted source set. |
7033
+ | <a id="REPLACE_PART_NEIGHBOUR"></a>`REPLACE_PART_NEIGHBOUR` | A retained part's dependency changes or cannot be established at the reported location. | Supply an edit that preserves the retained part's derivation. |
7034
+ | <a id="REPLACE_PART_DEPTH_SUPPORT"></a>`REPLACE_PART_DEPTH_SUPPORT` | A changed depth support has no surviving samples. | Preserve shared depth support from which to extend. |
7035
+ | <a id="REPLACE_PART_INPUT"></a>`REPLACE_PART_INPUT` | The set inventory contains an unreadable or unsupported path, or a file changed after inventory. | Supply a stable tree of readable regular files and directories. |
7036
+ | <a id="REPLACE_PART_OUTPUT"></a>`REPLACE_PART_OUTPUT` | The output already exists, overlaps an input, or cannot be published. | Use a new, writable output directory outside all inputs. |
7037
+ | <a id="REPLACE_PART_RECORD"></a>`REPLACE_PART_RECORD` | The derivation record or its binding is missing or invalid. | Use the matching, complete derived set and its original record. |
7038
+
7039
+ The output is published only after validation. Its record attests derivation
7040
+ from the recorded set. Reproducing the original assembly from its painting
7041
+ and layers is outside the scope of this command. Run `rig` from the revised
7042
+ set with the original assembly config and run `check` on the fresh rig to
7043
+ obtain downstream verification for the revised pixels.
7044
+
6955
7045
  ### check-parts
6956
7046
 
6957
7047
  Run `rig-parts check-parts --parts <assembled-dir> --out <disjoint-report-dir>`
@@ -8574,7 +8664,11 @@ peak's dial value and zero-based sample ordinal. The clip time is the applied
8574
8664
  time, after wrapping where applicable. The clip frame is its index on the
8575
8665
  12 Hz grid. The row says `frame off-grid` and gives the clip time when the
8576
8666
  peak falls between grid frames. It also names the mesh slot, attachment,
8577
- triangle, vertices and edge.
8667
+ triangle, vertices and edge. Beside the edge it states the peak triangle's rest
8668
+ area share, `hull` versus `interior` placement, and the last passing dial sample
8669
+ on each side of the range midpoint (`<bound> (range end)` when a side never
8670
+ fails, `none (midpoint fails)` when sample 6 fails) so a silhouette sliver at an
8671
+ extreme dial angle can be told apart from broad interior stretch.
8578
8672
 
8579
8673
  Stock `check` reports a measured dial `FAIL` at the existing `WARN` level and
8580
8674
  counts slider outcomes separately from the ordinary bars. The dial report is
@@ -11079,7 +11173,7 @@ Internal `SeamSupport.drawings` never enters check JSON. Named requirement
11079
11173
  | `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:4298](../src/check.ts#L4298) |
11080
11174
  | `STRESS_OFF_CHAIN.per_part[].off_chain` | `STRESS_OFF_CHAIN.per_part[].off_chain` | 'part' | evidence | [r.part] | [check.ts:4298](../src/check.ts#L4298) |
11081
11175
  | `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:4266](../src/check.ts#L4266), [check.ts:4284](../src/check.ts#L4284) |
11082
- | `TEXTURE_STRETCH.per_mesh` | `TEXTURE_STRETCH.per_mesh` | part when the supplied mapping resolves a piece; otherwise rig | evidence; finding when exceeds; otherwise evidence | resolved piece for m.slot; otherwise [] | [check.ts:10612](../src/check.ts#L10612), [check.ts:10619](../src/check.ts#L10619) |
11176
+ | `TEXTURE_STRETCH.per_mesh` | `TEXTURE_STRETCH.per_mesh` | part when the supplied mapping resolves a piece; otherwise rig | evidence; finding when exceeds; otherwise evidence | resolved piece for m.slot; otherwise [] | [check.ts:10697](../src/check.ts#L10697), [check.ts:10704](../src/check.ts#L10704) |
11083
11177
  | `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:8925](../src/check.ts#L8925), [check.ts:8930](../src/check.ts#L8930), [check.ts:8951](../src/check.ts#L8951), [check.ts:8962](../src/check.ts#L8962) |
11084
11178
  | `WIND_BAND.pairs` | `WIND_BAND.pairs` | 'pair' | finding when !holdsAll; otherwise evidence | [p.a, p.b] | [check.ts:6844](../src/check.ts#L6844) |
11085
11179
  | `WIND_BAND.pairs[].steps` | `WIND_BAND.pairs[].steps` | 'pair' | finding when !s.holds; otherwise evidence | [p.a, p.b] | [check.ts:6855](../src/check.ts#L6855) |
@@ -11096,7 +11190,7 @@ Internal `SeamSupport.drawings` never enters check JSON. Named requirement
11096
11190
  | `seam_scope.pairs` | `seam_scope.pairs`; `sets.*.seam_scope.pairs` | subjects.length === 0 ? 'rig' : subjects.length === 1 ? 'part' : 'pair' | evidence | subjects | [check.ts:7809](../src/check.ts#L7809) |
11097
11191
  | `seam_scope.population.pairs` | `seam_scope.population.pairs`; `sets.*.seam_scope.population.pairs` | 'pair' | evidence | row.parts | [check.ts:2643](../src/check.ts#L2643) |
11098
11192
  | `seam_scope.population.single_art` | `seam_scope.population.single_art`; `sets.*.seam_scope.population.single_art` | 'part' | evidence | [row.part] | [check.ts:2644](../src/check.ts#L2644) |
11099
- | `slider_stretch.rows` | `slider_stretch.rows` | 'rig' | finding when row.status === 'FAIL'; otherwise evidence | [] | [check.ts:10563](../src/check.ts#L10563) |
11193
+ | `slider_stretch.rows` | `slider_stretch.rows` | 'rig' | finding when row.status === 'FAIL'; otherwise evidence | [] | [check.ts:10640](../src/check.ts#L10640) |
11100
11194
 
11101
11195
  | Serialized type path | Reason for schema exclusion |
11102
11196
  | --- | --- |
package/docs/STABILITY.md CHANGED
@@ -51,6 +51,41 @@ 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) writes a separate parts set and adds a relative
57
+ POSIX `replacement_record` path to its `parts.json`. The path is
58
+ `.parts-replacements/<source-sha256>.json` within the output set.
59
+
60
+ | Field | Meaning |
61
+ | --- | --- |
62
+ | `spec` | Literal `rig-parts-replacement/1`. |
63
+ | `source_sha256` | SHA-256 digest of the source set inventory, computed for every replacement. If supplied, `--source-sha256` must match this digest. |
64
+ | `result_sha256` | SHA-256 digest of the result inventory, including `parts.json` and excluding the new replacement record itself. |
65
+ | `rig_size` | The unchanged rig grid `[width, height]` in pixels. |
66
+ | `replaced` | Per-edit entries carrying `part`, `receipt`, `changed_px`, `changed_counted_px`, `changed_excluded_px`, and `removed_opaque_px`. Optional `removed_opaque_regions` describes connected removals. Optional `historical` holds superseded source measurements. A part with scalar depth also carries `depth` with its before and after SHA-256 values (`from_sha256` and `sha256`), `reseeded`, support and measured reading. Reseeding can return an identical sheet. |
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. The `receipt` carries the edit's author declaration
74
+ and the two encoded PNG hashes. `from_sha256` is required even when the caller
75
+ omits `--source-sha256`. The record binds the revised set to the recorded input
76
+ set. See the [authoring command](AUTHORING.md#replace-parts) for the edit
77
+ file and validation rules.
78
+
79
+ The stable named entry `@rig-c/parts/replace-parts` exports the following
80
+ without loading the CLI.
81
+
82
+ | Export | Contract |
83
+ | --- | --- |
84
+ | `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. |
85
+ | `REPLACEMENT_RECORD_SPEC` | Literal `rig-parts-replacement/1`. |
86
+ | `readReplacementRecord(bytes: Uint8Array): ReplacementRecord` | Parses the UTF-8 JSON record and reports all detected shape problems together. |
87
+ | `ReplacementRecord` | Type of the record described above. |
88
+
54
89
  ## Parts-stage integrity report
55
90
 
56
91
  `rig-parts check-parts --parts <assembled-dir> --out <disjoint-report-dir>
@@ -591,6 +626,7 @@ and do not certify visibility. See the
591
626
  | command | flags |
592
627
  | --- | --- |
593
628
  | `edited-part` | `--config`, `--part`, `--file`, `--from`, exactly one of `--editor` or `--producer`; optional `--parts` (`parts.json`), `--rig-config`, `--help` (`-h`) |
629
+ | `replace-parts` | `--parts`, `--edits`, `--out`; optional `--source-sha256`, `--help` (`-h`) (issue #1635, [replacement record](#parts-replacement-record)) |
594
630
  | `external-receipt` | `--kind` (mask), `--file`, `--painting`, `--producer`, `--out`; or `--verify`; or `--help` (`-h`) |
595
631
  | `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
632
  | `diff-drafts` | `--left`, `--right`, `--out`; optional `--help` (`-h`) (issue #1369; draft-to-draft assemble comparison, `rig-parts-draft-diff/1`) |
@@ -1218,7 +1254,8 @@ execution in historical evidence is inferred from a current export.
1218
1254
  | 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
1255
  | 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
1256
  | `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 |
1257
+ | `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 |
1258
+ | `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
1259
  | 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
1260
  | 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
1261
  | 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 +1560,9 @@ The console prints only the reason after the binding name, for example
1523
1560
  | --- | --- |
1524
1561
  | `slider`, `clip`, `status` | Binding names and the diagnostic outcome, `PASS`, `FAIL`, or `SKIP`. |
1525
1562
  | `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. |
1563
+ | `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). |
1564
+ | `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). |
1565
+ | `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
1566
  | `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
1567
 
1530
1568
  The stock console displays measured `FAIL` rows at the existing `WARN` level.
@@ -1554,6 +1592,7 @@ after all stage gates pass and all other output files are on disk:
1554
1592
  "started_at": "2026-11-07T00:00:00.000Z",
1555
1593
  "finished_at": "2026-11-07T00:00:01.000Z",
1556
1594
  "config": { "path": "../config.json", "sha256": "<hex>" },
1595
+ "parts_input": { "path": "../assembly", "sha256": "<hex>" },
1557
1596
  "outputs": [
1558
1597
  { "path": "images/cloth.png", "sha256": "<hex>" },
1559
1598
  { "path": "mesh_report.json", "sha256": "<hex>" },
@@ -1572,12 +1611,18 @@ additive): one `{ "role", "path", "sha256" }` entry (keys in that order) for eac
1572
1611
  `head` (an input not given is absent from the list, never `null` or guessed), with
1573
1612
  `/`-separated `path` relative to `--out` by the `rig-run/2` link rule (naming
1574
1613
  `<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
1614
+ `path` names on disk; `rig` writes no `inputs` key. Standalone `rig` writes
1615
+ `parts_input` immediately after `config` (issue #1636), with `path` and `sha256`
1616
+ in that order. The directory named by `--parts` is rebased relative to `--out`
1617
+ by the same realpath rule as `config.path`. A directory that coincides with
1618
+ `--out` is recorded as `.`. The digest follows the [parts input snapshot](#parts-input-snapshot)
1619
+ contract. The config, assemble input and output hashes use the file bytes on disk
1620
+ after writing. A refused run writes no `run.json`. By default, `started_at` and
1621
+ `finished_at` record wall-clock
1577
1622
  time read in `cli.ts` (`src/` remains pure). With that default, `run.json` is outside
1578
1623
  the byte-for-byte
1579
1624
  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
1625
+ receipt-relative input layout, two `run.json` files differ only in `started_at` and
1581
1626
  `finished_at`.
1582
1627
 
1583
1628
  Set `SOURCE_DATE_EPOCH` to opt into a fixed clock: both timestamps equal that
@@ -1589,7 +1634,7 @@ fractional, non-numeric, noncanonical and out-of-range values refuse
1589
1634
  `RUN_STAMP_EPOCH`, naming the variable, found value and requirement before any
1590
1635
  output is written or an existing stamp is removed. Unset preserves the existing
1591
1636
  wall-clock path and stamp format. Fixed clocks make stamps byte-identical for
1592
- identical inputs and the same relative config layout.
1637
+ identical inputs and the same receipt-relative input layout.
1593
1638
 
1594
1639
  `outputs` lists exactly the files the stage wrote in this run, derived from what the
1595
1640
  stage returns, not from a walk of `--out`: a stray or earlier file under `--out` is
@@ -1599,13 +1644,14 @@ neither hashed nor listed. Before the stage starts, the command removes an earli
1599
1644
  `package.json` without a non-empty `name` and `version` refuses `RUN_STAMP_PACKAGE`
1600
1645
  and writes no stamp. `build` and the in-process stages write no `run.json`.
1601
1646
 
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.
1647
+ `rig-run/1` preserves the order and meaning of existing keys. The optional
1648
+ `parts_input` is additive and older stamps may omit it.
1604
1649
 
1605
1650
  ### Run record (`check-run.json` and `build-run.json`, spec `rig-run/2`)
1606
1651
 
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
1652
+ `check` writes `<out>/check-run.json` after the check report completes and the
1653
+ parts input snapshot is verified. The record can accompany a report with failing
1654
+ bars (issue #1541). `build` originally wrote `<out>/build-run.json` in this
1609
1655
  format. Its current contract is [the build run record](#build-run-record-build-runjson-spec-rig-run3). The names
1610
1656
  cannot be a `run.json`: `rig` and `assemble` write `rig-run/1` as `run.json`, and
1611
1657
  rigc writes its own `run.json` in a packed build directory (`check/build/`). Neither
@@ -1626,8 +1672,15 @@ file is in `check.json`, and no byte comparison this package makes reads them.
1626
1672
  }
1627
1673
  ```
1628
1674
 
1629
- Key order is fixed as shown: `spec`, `package`, `command`, `started_at`,
1630
- `finished_at`, `config` (`build` only; `check` reads no config), `outputs`, `argv`.
1675
+ The historical `build` key order is shown above. In `check-run.json` the fixed
1676
+ order is `spec`, `package`, `command`, `started_at`, `finished_at`, optional
1677
+ `parts_input`, `outputs`, `argv`. The `parts_input` object contains `path` and
1678
+ `sha256` in that order. Its directory is the explicit `--parts` or, when check
1679
+ reads a `parts.json` beside the rig, the `--rig` directory. The path is rebased
1680
+ relative to `--out` by the `config.path` directory and link rule below, with `.`
1681
+ for `--out` itself. The digest follows the [parts input snapshot](#parts-input-snapshot)
1682
+ contract. When check runs without a parts set, the key is absent and the legacy
1683
+ receipt bytes are preserved at the same clock.
1631
1684
  `package` and the two times (`SOURCE_DATE_EPOCH` included) are as in `rig-run/1`.
1632
1685
  `config` is the config's `sha256` and its path relative to `--out`, using the
1633
1686
  same directory spelling rule as `argv` below. A config given through a link is
@@ -1651,12 +1704,23 @@ is `.`. A path on another Windows drive is written as given. These arguments
1651
1704
  reproduce the check when run from the `--out` directory with the same package
1652
1705
  version. A switch's default is not written, so a later
1653
1706
  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.
1707
+ `package`. The record is written in place after the report and verification of the
1708
+ parts input snapshot. A run killed while writing the record can leave it partial.
1657
1709
 
1658
1710
  `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.
1711
+ the same bytes for the same files, invocation, version and times.
1712
+
1713
+ #### Parts input snapshot
1714
+
1715
+ `parts_input.sha256` is the source-mode digest returned by
1716
+ `replacementTreeDigest` from `@rig-c/parts/replace-parts` on the resolved input
1717
+ directory. It covers all regular files in that directory, including any
1718
+ replacement record. The CLI takes
1719
+ the snapshot before clearing its previous receipt or writing stage outputs. An
1720
+ `--out` that overlaps the input directory can change that inventory during the
1721
+ run, so the record identifies the pre-stage tree. With disjoint directories the
1722
+ CLI also compares the digest after the stage. A change to that digest or to the
1723
+ resolved parts directory refuses the receipt as `RUN_PARTS_INPUT_CHANGED`.
1660
1724
 
1661
1725
  ### Build run record (`build-run.json`, spec `rig-run/3`)
1662
1726
 
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "rig-parts",
3
- "version": "2.68.0",
3
+ "version": "2.69.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
@@ -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[] = [];