rig-parts 2.71.0 → 2.73.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/cli.ts CHANGED
@@ -22,7 +22,6 @@ import { replaceParts } from './src/replaceparts.ts';
22
22
  * 1 it refused its input — every refusal is printed as a FAIL line
23
23
  * 2 a usage error, or a command this version does not implement
24
24
  */
25
- import { spawnSync } from 'node:child_process';
26
25
  import { runBuildProcess, processRigcRunner as rigcRunner } from './tools/build-process.ts';
27
26
  import { existsSync, linkSync, mkdirSync, mkdtempSync, readFileSync, realpathSync, rmSync, statSync, writeFileSync } from 'node:fs';
28
27
  import { tmpdir } from 'node:os';
@@ -31,7 +30,7 @@ import { DEFAULT_PROJECT_RULE, DEFAULT_SEAM_RULE, headGarmentOverlaps, headGarme
31
30
  import { proposeNeck } from './tools/neck-propose.ts';
32
31
  import { parseAltArg } from './tools/alternate-cli.ts';
33
32
  import { type AlternateCliInput, assembleStage, build, BUILD_OWNS, BUILD_OWNS_FILES, checkStage, checkWrote, emitFillMasksStage, ERROR_MAP_FILE, loopStage, readRuns, readSource, rigStage, suppliedCheckFlag } from './src/build.ts';
34
- import { ACCEPTABLE_BARS, DEFAULT_PACK_SHAPE, DEFAULT_PAGE_EDGES, findRigc, LOOP_SEAM_BAR_UNMET, type LoopSeamRequest, PACK_PAGE_SIZE, PACK_SHAPES, rigcRunnerAt, type PackShape, PAGE_EDGES, type PageEdges, parsePageSize, PARTS_HOME_SENTENCE, RIGC_GEOMETRY_VERSION, rigcRanClause, type RigcRunner, NO_PARTS_SENTENCE, SEAM_MEAN_BAR, SOURCE_SENTENCE, SEAM_PX_BAR, SEAM_PX_LEVEL, SPINEBOY_YARDSTICK, TEXTURE_STRETCH_CEILING } from './src/check.ts';
33
+ import { ACCEPTABLE_BARS, DEFAULT_PACK_SHAPE, DEFAULT_PAGE_EDGES, findRigc, LOOP_SEAM_BAR_UNMET, type LoopSeamRequest, PACK_PAGE_SIZE, PACK_SHAPES, type PackShape, PAGE_EDGES, type PageEdges, parsePageSize, PARTS_HOME_SENTENCE, RIGC_GEOMETRY_VERSION, rigcRanClause, NO_PARTS_SENTENCE, SEAM_MEAN_BAR, SOURCE_SENTENCE, SEAM_PX_BAR, SEAM_PX_LEVEL, SPINEBOY_YARDSTICK, TEXTURE_STRETCH_CEILING } from './src/check.ts';
35
34
  import { checkClipStretch } from './src/clipstretch.ts';
36
35
  import { ComfyClient, resolveHost, runBackground, runMatte, runPainting, runSeeThrough } from './src/comfy/index.ts';
37
36
  import { coreCfg, DEFAULT_GROW_PX, runForeground } from './src/plate.ts';
@@ -62,7 +61,7 @@ import { replacementTreeDigest } from './src/replacementrecord.ts';
62
61
  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';
63
62
  import { buildSheet, defaultCaption, type Tile, tilesFrom } from './src/sheet.ts';
64
63
  import { loadComparison, requiredProblems, structureLines } from './src/structure.ts';
65
- import { type ArgvTable, assembleOutputFiles, bindAssembleWrapperInputs, 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';
64
+ import { type ArgvTable, assembleOutputFiles, bindAssembleWrapperInputs, BUILD_RUN_FILE, type BuildWrapperRole, CHECK_RUN_FILE, clearComposeRun, clearRunRecord, clearRunStamp, readPackageIdentity, realWhereItExists, recordArgv, rigOutputFiles, RUN_STAMP_FILE, RUN_STAMP_SPEC, type RunStampFileEntry, type RunStampInputEntry, writeRunRecord, writeRunStamp } from './src/runstamp.ts';
66
65
  import { authorLayerLine } from './src/tags.ts';
67
66
 
68
67
  const EXIT_OK = 0;
@@ -947,9 +946,10 @@ usage:
947
946
  --timeout s), and writes <out> only after the layer reader accepts what
948
947
  came back.
949
948
  --lama turns the wrapper's LaMa inpainting on and --nf4 its nf4
950
- quantisation; both are off unless given. Resolution, steps, seed and offload
951
- use explicit flags first, then --config's seethrough block, then defaults
952
- 1024, 30, 42 and false. The resolved resolution must be an integer of at
949
+ quantisation; both are off unless given. Without --config, resolution, steps,
950
+ seed and offload default to 1024, 30, 42 and false; with --config, explicit
951
+ flags override config.seethrough, and an omitted steps, seed or offload with
952
+ no matching flag is refused (CONFIG_FIELD_PRESENT). The resolved resolution must be an integer of at
953
953
  least 64, including config values. --no-offload overrides a config's true; it cannot
954
954
  be combined with --offload. Each value prints its source. No config is
955
955
  discovered automatically: give --config <config.json> to use its settings.
@@ -2512,17 +2512,32 @@ async function cmdComfy(args: string[]): Promise<number> {
2512
2512
  const depthRun = v.get('--depth-run');
2513
2513
  if (sub === 'seethrough' && depthConfig !== undefined && depthRun !== 'full' && depthRun !== 'head') return usage('active config.depth requires --depth-run <full|head>; the source run is not inferred');
2514
2514
  if (sub === 'seethrough' && depthConfig === undefined && depthRun !== undefined) return usage('--depth-run requires --config with an explicit depth block');
2515
- const host = resolveHost(v.get('--host'), process.env.COMFY_HOST);
2516
- const client = new ComfyClient(host, { poll: poll as number, request: 30, wait: wait as number });
2517
2515
  if (sub === 'seethrough') {
2518
2516
  const image = v.get('--image');
2519
2517
  if (image === undefined) return usage('comfy seethrough needs --image <png>');
2520
2518
  const resolution = intFlag(v, '--resolution', early?.seethrough.resolution ?? 1024, 64, 'config.seethrough.resolution');
2521
- const steps = intFlag(v, '--steps', early?.seethrough.steps ?? 30, 1);
2522
- const seed = intFlag(v, '--seed', early?.seethrough.seed ?? 42, 0);
2519
+ const steps = v.has('--steps') || early === undefined ? intFlag(v, '--steps', 30, 1) : early.seethrough.steps;
2520
+ const seed = v.has('--seed') || early === undefined ? intFlag(v, '--seed', 42, 0) : early.seethrough.seed;
2523
2521
  for (const x of [resolution, steps, seed]) if (typeof x === 'string') return usage(x);
2524
2522
  const prefix = v.get('--prefix') ?? 'spine_parts';
2525
2523
  if (!/^[A-Za-z0-9_-]+$/.test(prefix)) return usage(`--prefix ${prefix} is not letters, digits, "_" and "-"`);
2524
+ const cliOffload = on.has('--offload') || on.has('--no-offload');
2525
+ if (early !== undefined) {
2526
+ const missing: Problem[] = [];
2527
+ if (!v.has('--steps') && early.seethrough.steps === undefined) {
2528
+ missing.push({ code: 'CONFIG_FIELD_PRESENT', object: 'config.seethrough.steps', detail: 'is absent and required by comfy seethrough; set config.seethrough.steps or pass --steps <n>' });
2529
+ }
2530
+ if (!v.has('--seed') && early.seethrough.seed === undefined) {
2531
+ missing.push({ code: 'CONFIG_FIELD_PRESENT', object: 'config.seethrough.seed', detail: 'is absent and required by comfy seethrough; set config.seethrough.seed or pass --seed <n>' });
2532
+ }
2533
+ if (!cliOffload && early.seethrough.offload === undefined) {
2534
+ missing.push({ code: 'CONFIG_FIELD_PRESENT', object: 'config.seethrough.offload', detail: 'is absent and required by comfy seethrough; set config.seethrough.offload or pass --offload or --no-offload' });
2535
+ }
2536
+ if (missing.length > 0) throw new PartsError(missing);
2537
+ }
2538
+ const offload = on.has('--offload') ? true : on.has('--no-offload') ? false : (early?.seethrough.offload ?? false);
2539
+ const host = resolveHost(v.get('--host'), process.env.COMFY_HOST);
2540
+ const client = new ComfyClient(host, { poll: poll as number, request: 30, wait: wait as number });
2526
2541
  const run = {
2527
2542
  image,
2528
2543
  out,
@@ -2530,7 +2545,7 @@ async function cmdComfy(args: string[]): Promise<number> {
2530
2545
  resolution: resolution as number,
2531
2546
  steps: steps as number,
2532
2547
  seed: seed as number,
2533
- offload: on.has('--offload') ? true : on.has('--no-offload') ? false : (early?.seethrough.offload ?? false),
2548
+ offload,
2534
2549
  lama: on.has('--lama'),
2535
2550
  quant: on.has('--nf4') ? ('nf4' as const) : ('none' as const),
2536
2551
  wait: wait as number,
@@ -2538,8 +2553,11 @@ async function cmdComfy(args: string[]): Promise<number> {
2538
2553
  ...(depthConfig === undefined ? {} : { depth: { config: depthConfig, run: depthRun as 'full' | 'head', base: dirname(resolve(configPath as string)) } }),
2539
2554
  };
2540
2555
  console.log(`rig-parts comfy seethrough: ${image} -> ${out}`);
2541
- const source = (key: 'resolution' | 'steps' | 'seed' | 'offload'): string =>
2542
- v.has(`--${key}`) || (key === 'offload' && (on.has('--offload') || on.has('--no-offload'))) ? 'cli' : early === undefined ? 'default' : `config.seethrough.${key}`;
2556
+ const source = (key: 'resolution' | 'steps' | 'seed' | 'offload'): string => {
2557
+ if (v.has(`--${key}`) || (key === 'offload' && cliOffload)) return 'cli';
2558
+ if (early !== undefined && Object.hasOwn(early.seethrough, key) && early.seethrough[key] !== undefined) return `config.seethrough.${key}`;
2559
+ return 'default';
2560
+ };
2543
2561
  console.log(` resolution ${run.resolution} (source=${source('resolution')}), steps ${run.steps} (source=${source('steps')}), seed ${run.seed} (source=${source('seed')}), offload ${run.offload} (source=${source('offload')}); lama ${run.lama}, quant ${run.quant}; wait <= ${run.wait} s, timeout ${run.timeout} s`);
2544
2562
  if (early === undefined) console.log(' no config loaded; give --config <config.json> to use config.seethrough settings; explicit CLI flags override them');
2545
2563
  const r = await runSeeThrough(client, run, (l) => console.log(l));
@@ -2547,6 +2565,8 @@ async function cmdComfy(args: string[]): Promise<number> {
2547
2565
  console.log(` wrote ${join(out, 'layers.json')}, meta.json, parts/ (${r.layers.length} PNG) and previews/ (${r.previews.length} PNG); GPU job ended`);
2548
2566
  return EXIT_OK;
2549
2567
  }
2568
+ const host = resolveHost(v.get('--host'), process.env.COMFY_HOST);
2569
+ const client = new ComfyClient(host, { poll: poll as number, request: 30, wait: wait as number });
2550
2570
  if (cfg === null) return usage('comfy paint needs --config <config.json>');
2551
2571
  const seeds = intFlag(v, '--seeds', 1, 1);
2552
2572
  if (typeof seeds === 'string') return usage(seeds);
@@ -2665,10 +2685,15 @@ function cmdBuild(args: string[]): number {
2665
2685
  const startedAt = fixedClock ?? new Date().toISOString();
2666
2686
  const scratch = mkdtempSync(join(tmpdir(), 'rig-parts-build-'));
2667
2687
  try {
2688
+ let wrapperPngs: RunStampInputEntry<BuildWrapperRole>[] | undefined;
2668
2689
  const r = build(
2669
2690
  { config, source, full, head, out, ...(seam === undefined ? {} : { seam: seam as SeamRule }), ...(project === undefined ? {} : { project: project as ProjectRule }), loop, pageEdges: edges, packShape: shape, ...(size === undefined ? {} : { pageSize: size }), ...(requirements === undefined ? {} : { requirements }), idleKeys: keys, ...(leadText === undefined ? {} : { leadIn: Number(leadText) }), seamPairs: on.has('--seam-pairs'), keepStills: on.has('--keep-stills'), noExtremes: on.has('--no-extremes'), ...(alts.length === 0 ? {} : { alts }), ...(flags.has('--set') ? { set: flags.get('--set') as string } : {}), allSets: on.has('--all-sets'), ...(environment === undefined ? {} : { environment }), ...(windBand === undefined ? {} : { windBand }) },
2670
2691
  { rig: rigcRunner(bin), check: rigcRunner(bin), checkBin: bin, scratch: join(scratch, 'rig-gate'), stages: {
2671
- assemble: (input, outputs) => runBuildProcess({ stage: 'assemble', bin, input, outputs }, join(scratch, 'workers')),
2692
+ assemble: (input, outputs) => {
2693
+ const reading = runBuildProcess({ stage: 'assemble', bin, input, outputs }, join(scratch, 'workers'));
2694
+ wrapperPngs = reading?.wrapperPngs;
2695
+ return reading;
2696
+ },
2672
2697
  rig: (input, _rigc, gateScratch) => runBuildProcess({ stage: 'rig', bin, input, scratch: gateScratch }, join(scratch, 'workers')),
2673
2698
  check: (input, _rigc, checkBin) => runBuildProcess({ stage: 'check', bin: checkBin, input }, join(scratch, 'workers')),
2674
2699
  } },
@@ -2679,6 +2704,7 @@ function cmdBuild(args: string[]): number {
2679
2704
  const cwd = process.cwd();
2680
2705
  writeRunRecord({ pkg, command: 'build', startedAt, finishedAt: fixedClock ?? new Date().toISOString(), outDir: out, configPath: config,
2681
2706
  inputs: { cwd, source, full, head, requirements, environment, windBand, alts },
2707
+ ...(wrapperPngs === undefined ? {} : { wrapperPngs }),
2682
2708
  outputs: [...BUILD_OWNS, ...BUILD_OWNS_FILES], argv: recordArgv('build', args, BUILD_ARGV, out, cwd) });
2683
2709
  }
2684
2710
  return r.stoppedAt === null ? EXIT_OK : EXIT_REFUSED;
package/docs/AUTHORING.md CHANGED
@@ -174,7 +174,7 @@ read by no CPU stage).
174
174
  | `generation.*` | the optional `comfy` adapter only; no CPU stage | recorded: checkpoint, LoRAs, sampler, prompt parts, `latent`, `seed`, `control` |
175
175
  | `generation.control.skeleton` | `comfy paint` — the OpenPose control image, drawn at `latent` | **authored**: a built-in standing pose, `"stand_sides"` or `"stand_clasp"`, or (issue #198) any other string, read as a path relative to the config file's directory to a pose file `{"width": W, "height": H, "points": {"nose": [x, y], "neck": [x, y], …}}` — `width` x `height` is the canvas and must be `generation.latent` (the points are not scaled; `CONFIG_POSE_CANVAS`), and `points` holds the 18 body-18 keypoints of `src/skeleton.ts` by name (`nose`, `neck`, `r_shoulder`, `r_elbow`, `r_wrist`, `l_shoulder`, `l_elbow`, `l_wrist`, `r_hip`, `r_knee`, `r_ankle`, `l_hip`, `l_knee`, `l_ankle`, `r_eye`, `l_eye`, `r_ear`, `l_ear`; `r`/`l` the subject's sides), each `[x, y]` in canvas px, x right, y down, `0 <= x <= W`, `0 <= y <= H`. The image is drawn from the file exactly as from a built-in (same renderer, same size), written as `control_pose-<first 12 hex of its sha256>.png`. A pose file carries no words, so `generation.pose` is required beside it (`CONFIG_FIELD_PRESENT`). The file is read wherever the config is read from a path, every problem at once: no such file — a misspelt built-in lands here too — or one that cannot be read (`CONFIG_FILE_PRESENT`), not JSON (`CONFIG_IS_JSON`), not an object, a size that is not a whole positive px count, a point that is not two numbers (`CONFIG_FIELD_TYPE`), a key besides the three (`CONFIG_KEY_KNOWN`) or written twice (`CONFIG_KEY_UNIQUE`), `points` holding other than the 18 names (`CONFIG_POSE_KEYPOINTS`, with the count found and required), a point off the canvas (`CONFIG_POSE_IN_CANVAS`, naming the point and the canvas size) |
176
176
  | `seethrough.resolution` | assemble — each run's canvas must be `resolution` square (`ASSEMBLE_RUN_CANVAS`); with one run (no `--head`, issue #366) the file may be smaller on either side, and is padded to the `resolution` square, centred | recorded from the See-through runs; 1024 in both examples. With one run it is the square the file is read on: at least the file's longer side (`ASSEMBLE_RUN_CANVAS` otherwise), and nothing a part records depends on how much larger |
177
- | `seethrough.steps`, `.seed`, `.offload` | `comfy seethrough --config` | run inputs when `--config <config.json>` is given; explicit CLI flags override them, including `--no-offload` for false |
177
+ | `seethrough.steps`, `.seed`, `.offload` | `comfy seethrough --config` only; no CPU stage | **optional** (issue #1672): See-through run inputs (`steps` integer `>= 1`, `seed` integer `>= 0`, `offload` boolean; `CONFIG_FIELD_TYPE` when malformed). Omitted on an authored layered-file route (§4, *For artists*), where See-through never runs. When `--config <config.json>` is given to `comfy seethrough`, explicit `--steps`, `--seed` and `--offload` / `--no-offload` override them, and an omitted field with no matching flag is refused (`CONFIG_FIELD_PRESENT`) |
178
178
  | `seethrough.head_box` | inputs (cuts the head image there; optional at the first call); assemble — where the head run sits on the painting | **proposed** by `propose --head-box` from the full run, square, source pixels, shifted inside the painting when needed; the head run must then be fed exactly that crop. With one run (no `--head`, issue #359: an artist's own file, §4 *For artists*) it is left out — there is no crop to place — and a config that sets it is refused (`ASSEMBLE_SINGLE_RUN_HEAD_BOX`) |
179
179
  | `seethrough.arm_split` | assemble, `assemble --propose-plan` — separates a single full-run `handwear-r` or `handwear-l` layer that holds both overlapping arms into both arm tags | **authored**, optional (issue #439): `{x?: number, line?: [[x, y], …], order: ["handwear-r", "handwear-l"] \| ["handwear-l", "handwear-r"]}` in `seethrough.resolution` full-run pixels. Exactly one of `x` (image column, `0 <= x <= resolution`) or `line` (a polyline of two or more `[x, y]` points in `[0, resolution]`, interpolated in x along y and clamped above/below its endpoints) is required (`CONFIG_FIELD_PRESENT`, `CONFIG_FIELD_TYPE`), and `order` is `[back_tag, front_tag]`, the draw order of the two separated arm layers (`CONFIG_FIELD_PRESENT`, `CONFIG_FIELD_TYPE`). Pixels at `< splitX(y)` go to `handwear-r` (image left, the subject's right arm) and pixels at `>= splitX(y)` go to `handwear-l` (image right, the subject's left arm). A split line that cuts a horizontal opaque run of the arm layer into more than two segments is refused (`ASSEMBLE_ARM_SPLIT_CUTS_ARM`). Without the declaration, when one arm layer's 8-connected component reaches both wrists under `propose --keypoints`, `propose` emits an `overlapping-arms` `LINT` naming the part, both wrists and `seethrough.arm_split`; absent, no byte of any output moves |
180
180
  | `assemble.seam` | assemble, build | **authored**, optional `"near-white"` or `"silhouette"` (issue #905). An explicit `--seam` overrides the config; otherwise this field overrides the existing `near-white` default. An invalid value is `CONFIG_FIELD_TYPE` at `config.assemble.seam`, including when a CLI override is given. Absent, existing build bytes are unchanged. |
@@ -4320,15 +4320,17 @@ early loader does not read it.
4320
4320
  | loader | steps | requires | the step also refuses without |
4321
4321
  | --- | --- | --- | --- |
4322
4322
  | `paint` | 0 `comfy paint` | `key`, `generation` | — |
4323
- | `layers` | 1 and 4 `inputs`, 6 `assemble --propose-plan` | `key`, `seethrough`, `assemble.rig_scale` | `seethrough.head_box`, for `--propose-plan` only (`ASSEMBLE_FIELD_PRESENT`) |
4324
- | `assemble` | 7 `assemble` | `key`, `seethrough`, `assemble.rig_scale`, `assemble.plan` | `seethrough.head_box` (`ASSEMBLE_FIELD_PRESENT`) |
4323
+ | `layers` | 1 and 4 `inputs`, `comfy seethrough --config`, 6 `assemble --propose-plan` | `key`, `seethrough`, `assemble.rig_scale` | `seethrough.head_box`, for two-run `--propose-plan` (`ASSEMBLE_FIELD_PRESENT`); `seethrough.steps`, `.seed`, `.offload` (or CLI flags), for `comfy seethrough --config` (`CONFIG_FIELD_PRESENT`) |
4324
+ | `assemble` | 7 `assemble` | `key`, `seethrough`, `assemble.rig_scale`, `assemble.plan` | `seethrough.head_box` when `--head` is given (`ASSEMBLE_FIELD_PRESENT`); on the authored layered-file route (no `--head`), `seethrough: { "resolution": N }` |
4325
4325
  | `full` | 8 `propose --from-config`, `propose --compare`, `compare` (a side that states a `key`), `rig`, 9 `build` | `key`, `assemble.rig_scale`, `assemble.plan`, `bones`, `meshes`, `regions`, `motion` | for `build`, the `assemble` row's too: its assemble stage reads through that loader after this one |
4326
4326
  | `cloth` | 8 `propose --cloth` (issue #364) | `key`, `cloth` | every other key must still be one a config knows; only `cloth` is vouched for. Every other loader vouches for `cloth` too when it is present |
4327
4327
 
4328
- A missing field is `CONFIG_FIELD_PRESENT` naming it; a missing `generation` names
4329
- the fields the block holds, and a missing `assemble.plan` names
4330
- `assemble --propose-plan`, which prints one. `build` runs `rig`, so it asks the
4331
- full loader before its assemble stage writes anything.
4328
+ Inside `seethrough`, only `resolution` is required by the loaders, so a config for
4329
+ the authored layered-file route (*For artists* below) holds
4330
+ `seethrough: { "resolution": N }`. A missing field is `CONFIG_FIELD_PRESENT` naming
4331
+ it; a missing `generation` names the fields the block holds, and a missing
4332
+ `assemble.plan` names `assemble --propose-plan`, which prints one. `build` runs
4333
+ `rig`, so it asks the full loader before its assemble stage writes anything.
4332
4334
 
4333
4335
  `comfy paint` records each seed in `painting_<seed>_meta.json` beside the PNG:
4334
4336
 
@@ -4750,8 +4752,9 @@ need that no tag fits is `author:<label>` (§5, *A layer the author made*).
4750
4752
  needs no config field to say whose it is; a `:hidden` layer whose layer the file
4751
4753
  does not hold is refused (`LAYERS_HIDDEN_OF_PRESENT`).
4752
4754
 
4753
- **The commands.** The config holds no `seethrough.head_box`. Leave `--head` out
4754
- everywhere:
4755
+ **The commands.** A config for this route holds `seethrough: { "resolution": N }` (at
4756
+ least the file's longer side; no `steps`, `seed`, `offload` or `head_box`). Leave
4757
+ `--head` out everywhere:
4755
4758
 
4756
4759
  ```sh
4757
4760
  rig-parts layers art.psd
@@ -5956,7 +5959,7 @@ See-through with another seed.
5956
5959
  | <a id="CONFIG_WRITE_CHANGED"></a>`CONFIG_WRITE_CHANGED` | the existing destination no longer matches the snapshot read for `--write-config` when the writer is ready to commit: it is absent, no longer a regular file, or its permissions or text differ. The writer refuses to replace the current destination | keep the current config, reconcile any concurrent edit, and rerun against it |
5957
5960
  | <a id="CONFIG_WRITE_FAILED"></a>`CONFIG_WRITE_FAILED` | a proposed-value splice moved an unintended field, or a config-writing operation failed: reading, checking collisions, staging, writing proposal artifacts, publishing or replacing the destination, or removing the staged temporary. The message names the action and path. Cleanup failures retain the primary failure and name the stranded temporary. Fresh cloth publication precedes temporary cleanup, so a cleanup failure may leave the complete new config present; there is no transaction over every proposal artifact | inspect the named action, destination and temporary; restore access or permissions as needed; remove only the specifically reported stranded temporary, and inspect any published config before retrying |
5958
5961
  | <a id="CONFIG_FILE_PRESENT"></a><a id="CONFIG_IS_JSON"></a>`CONFIG_FILE_PRESENT`, `CONFIG_IS_JSON` | no such file, or not JSON; for a file the config names (`motion.animations_from`, `requirements`), the path is read relative to the config's directory, and the `motion.animations_from` line names the path as typed, that directory and what the two resolved to (issue #569) | `--config`; a file the config names: put it at the resolved path, or write the path from the config's directory |
5959
- | <a id="CONFIG_KEY_KNOWN"></a><a id="CONFIG_KEY_RETIRED"></a><a id="CONFIG_FIELD_PRESENT"></a><a id="CONFIG_FIELD_TYPE"></a>`CONFIG_KEY_KNOWN`, `CONFIG_KEY_RETIRED`, `CONFIG_FIELD_PRESENT`, `CONFIG_FIELD_TYPE` | an unknown key (a retired one says what replaces it), a missing one (a `motion.animations_from` file with no `spec` is told to write `"spec": "rigc-motion/1"` and the whole file's shape, issue #569), a wrong type (`bones[i].link_inherit` must be an object whose values are strings); a project's own record under a plain key, or an annotation (`note`, `<name>_note`) holding something other than a string; in `meshes.<part>.auto` (§3, *An automatic mesh*), a missing or out-of-range number, a Stage B opt-in that is not exactly a value rig-c accepts, or a field the mode does not have — a bound on one of the five allocation rows, or an authored `motionAmplitude` (it is derived, never written); under `comfy paint`, `CONFIG_FIELD_PRESENT` on `config.generation`: a config with no `generation` block (the line names the fields it holds) | the named field; a record goes under a key beginning `x-` (any JSON, read by nothing), a remark under `note` or `<name>_note` (a string) — §3; under `comfy paint`, `config.generation` |
5962
+ | <a id="CONFIG_KEY_KNOWN"></a><a id="CONFIG_KEY_RETIRED"></a><a id="CONFIG_FIELD_PRESENT"></a><a id="CONFIG_FIELD_TYPE"></a>`CONFIG_KEY_KNOWN`, `CONFIG_KEY_RETIRED`, `CONFIG_FIELD_PRESENT`, `CONFIG_FIELD_TYPE` | an unknown key (a retired one says what replaces it), a missing one (a `motion.animations_from` file with no `spec` is told to write `"spec": "rigc-motion/1"` and the whole file's shape, issue #569), a wrong type (`bones[i].link_inherit` must be an object whose values are strings); a project's own record under a plain key, or an annotation (`note`, `<name>_note`) holding something other than a string; in `meshes.<part>.auto` (§3, *An automatic mesh*), a missing or out-of-range number, a Stage B opt-in that is not exactly a value rig-c accepts, or a field the mode does not have — a bound on one of the five allocation rows, or an authored `motionAmplitude` (it is derived, never written); under `comfy paint`, `CONFIG_FIELD_PRESENT` on `config.generation`: a config with no `generation` block (the line names the fields it holds); under `comfy seethrough --config`, `CONFIG_FIELD_PRESENT` on `config.seethrough.steps`, `.seed` or `.offload` when omitted from the config with no matching flag | the named field; a record goes under a key beginning `x-` (any JSON, read by nothing), a remark under `note` or `<name>_note` (a string) — §3; under `comfy paint`, `config.generation`; under `comfy seethrough --config`, set the field in `config.seethrough` or pass `--steps`, `--seed`, `--offload` / `--no-offload` |
5960
5963
  | <a id="CONFIG_KEY_UNIQUE"></a>`CONFIG_KEY_UNIQUE` | a key written twice in an existing config updated by `--write-config`, or in one object of a file the config names — the pose file `generation.control.skeleton` names, or the `motion.animations_from` file; JSON keeps only the last value, so every other would be dropped without a word | that file: each key once |
5961
5964
  | <a id="CONFIG_ANIMATION_NAME_FREE"></a>`CONFIG_ANIMATION_NAME_FREE` | the `motion.animations_from` file holds an animation named `idle`, the animation `config.motion` writes | rename that animation |
5962
5965
  | <a id="CONFIG_HEAD_BOX_SQUARE"></a>`CONFIG_HEAD_BOX_SQUARE` | `seethrough.head_box` is not a non-empty square | `head_box` — take `propose --head-box`'s |
@@ -6051,7 +6054,9 @@ says why each requirement exists and what breaks without it.
6051
6054
  reads `seethrough.resolution`, `.steps`, `.seed` and `.offload` through the early
6052
6055
  layers config loader. Explicit `--resolution`, `--steps`, `--seed` and
6053
6056
  `--offload` / `--no-offload` win over config values; the two offload switches
6054
- cannot be combined. The resolved resolution must be an integer of at least 64,
6057
+ cannot be combined. When `--config` omits `steps`, `seed` or `offload` and no
6058
+ matching CLI flag supplies it, the command refuses with `CONFIG_FIELD_PRESENT`
6059
+ naming the field and the flag before any request. The resolved resolution must be an integer of at least 64,
6055
6060
  including config values; `--resolution 64` overrides a smaller configured
6056
6061
  resolution for this run. Without `--config`, the defaults are resolution 1024,
6057
6062
  steps 30, seed 42 and offload false. No config is discovered automatically,
@@ -8538,9 +8543,10 @@ If a clip passes alone but the idle fails, change one input, such as the
8538
8543
  wind key's peak, and rerun the same command on the edited build and scene.
8539
8544
  Read both lines before running the regular character check and `compose`,
8540
8545
  which still makes the shipping decision. The diagnostic prints only text.
8541
- Exit 0 means every played take was measured and passed and the
8542
- [slider rows](#slider-applied-clip-stretch-issue-1627) report `PASS` or `SKIP`.
8543
- Exit 1 means a failure, refusal or missing required reading. Exit 2 means a usage error.
8546
+ Exit 0 means every played take (`CHECK_CLIP_STRETCH`, including `idle`) was
8547
+ measured and passed; [slider rows](#slider-applied-clip-stretch-issue-1627) are
8548
+ advisory and do not set a failing exit (issue #1648).
8549
+ Exit 1 means a `CHECK_CLIP_STRETCH` failure, refusal or missing required reading. Exit 2 means a usage error.
8544
8550
 
8545
8551
  Literal `false` is accepted at any character scale. The side clip still passes
8546
8552
  through the character's scale checks, which refuse nonzero `wind` or `gravity`
@@ -8675,12 +8681,13 @@ extreme dial angle can be told apart from broad interior stretch.
8675
8681
 
8676
8682
  Stock `check` reports a measured dial `FAIL` at the existing `WARN` level and
8677
8683
  counts slider outcomes separately from the ordinary bars. The dial report is
8678
- advisory. Run `rig-parts check --clip-stretch <scene.json>` to make the scene's
8679
- slider findings count toward the command's exit. A failed or incomplete
8680
- declared sweep exits 1. A slider `SKIP` leaves the exit unchanged.
8684
+ advisory in `check --clip-stretch <scene.json>` as well (issue #1648): the
8685
+ diagnostic prints each `CHECK_SLIDER_STRETCH` row with its `PASS`, `FAIL` or
8686
+ `SKIP` verdict on the composed rig, and none of those rows sets a failing exit.
8681
8687
  A slider-only clip has a dial row only. A separate played role
8682
8688
  explicit in the source or composition produces both a dial row and a played
8683
- row. The declared idle and existing `with_idle` readings still apply.
8689
+ `CHECK_CLIP_STRETCH` row, and the played row still gates the exit. The declared
8690
+ idle and existing `with_idle` readings still apply.
8684
8691
 
8685
8692
  When `rig` writes a rig with a slider, its notice reads
8686
8693
 
package/docs/STABILITY.md CHANGED
@@ -803,7 +803,7 @@ part name, `[i]` an entry of a list):
803
803
  - **generation.sampler** — required: `steps`, `cfg`, `sampler`, `scheduler`
804
804
  - **generation.control** — required: `skeleton`, `strength`, `end_percent`; optional: `model`
805
805
  - **generation.control.skeleton**, the pose file it names when it is no built-in — required: `width`, `height`, `points`
806
- - **seethrough** — required: `resolution`, `steps`, `seed`, `offload`; optional: `head_box`, `arm_split`
806
+ - **seethrough** — required: `resolution`; optional: `steps`, `seed`, `offload` (read by comfy seethrough only), `head_box`, `arm_split`
807
807
  - **seethrough.arm_split** — required: `order`, and one of `x` or `line` (issue #439)
808
808
  - **assemble** — required: `rig_scale`, `plan` (from plain `assemble` on); optional: `seam`, `project`, `ground`, `extend_below_crop`, `patches`, `cuts`, `alternates`, `head_face_underfill`, `yield_refused`, `stage_map`, `keep_under_occluders`, `require_hidden_extent`, `extend_painting`, `edge_splits`, `take`, `editor_receipts`, `edited_parts`, `occluders`. The yield setting accepts a boolean or a nonempty list of final yielding output part names. The list is bound to the assembly config reading.
809
809
  - **assemble.edge_splits[i]** — required: `over`, `under`, `band`
@@ -1463,9 +1463,12 @@ inherit a scene-keyed parent, and a constraint can read a scene-keyed input. See
1463
1463
  ### Check report (`rig-parts-check/1`)
1464
1464
 
1465
1465
  `check --clip-stretch <scene.json>` has its own text and exit status. It exits
1466
- 0 when every played take has a measurable passing peak and all dial rows report
1467
- `PASS` or `SKIP`, 1 on a refusal, failing bar or missing required reading, and
1468
- 2 on usage errors. It writes no `check.json`, `check-run.json`, or scene output.
1466
+ 0 when every played take (`CHECK_CLIP_STRETCH`, including `idle`) has a
1467
+ measurable passing peak, 1 on a refusal, failing `CHECK_CLIP_STRETCH` bar or
1468
+ missing required played-take reading, and 2 on usage errors. `CHECK_SLIDER_STRETCH`
1469
+ rows are still printed with their `PASS`, `FAIL` or `SKIP` verdicts, and are
1470
+ advisory (they do not affect the exit status, issue #1648). It writes no
1471
+ `check.json`, `check-run.json`, or scene output.
1469
1472
  The ordinary check report, verdict and compose admission retain their existing meanings.
1470
1473
  The [slider stretch contract](#slider-stretch-diagnostic-issue-1627) defines
1471
1474
  the dial rows and their effect on the verdict.
@@ -1606,11 +1609,12 @@ or compose admission. The report retains spec `rig-parts-check/1`.
1606
1609
  `check --clip-stretch` opts into the same reset-pose measurement on the composed
1607
1610
  rig, with each dial sampled independently and compared with canonical rest
1608
1611
  using the stock stretch metric. It prints `CHECK_SLIDER_STRETCH` rows using
1609
- composed names. Slider-only clips have dial rows. Clips with an explicitly
1610
- declared played role also have `CHECK_CLIP_STRETCH` rows. The diagnostic still
1611
- writes only text. A failed or incomplete declared sweep exits 1. A slider
1612
- `SKIP` leaves the exit unchanged. Existing played take and idle
1613
- verdicts still apply. See [the authoring guide](AUTHORING.md#slider-applied-clip-stretch-issue-1627).
1612
+ composed names, keeping their `PASS`, `FAIL` and `SKIP` verdict words.
1613
+ Slider-only clips have dial rows. Clips with an explicitly declared played role
1614
+ also have `CHECK_CLIP_STRETCH` rows. The diagnostic still writes only text.
1615
+ `CHECK_SLIDER_STRETCH` rows are advisory here too and leave the exit status
1616
+ unchanged (issue #1648); existing played take and idle `CHECK_CLIP_STRETCH`
1617
+ verdicts decide exit 0 vs 1. See [the authoring guide](AUTHORING.md#slider-applied-clip-stretch-issue-1627).
1614
1618
 
1615
1619
  ### Run stamp (`run.json`, spec `rig-run/1`)
1616
1620
 
@@ -1779,17 +1783,19 @@ resolved parts directory refuses the receipt as `RUN_PARTS_INPUT_CHANGED`.
1779
1783
 
1780
1784
  `build` writes `<out>/build-run.json` when its check report completes, including a
1781
1785
  report with failing bars. Issue #1556 advances `spec` to `rig-run/3` and adds
1782
- `inputs` between `config` and `outputs`. The fixed key order is `spec`, `package`,
1783
- `command`, `started_at`, `finished_at`, `config`, `inputs`, `outputs`, `argv`.
1784
- The other fields and the write timing follow the `rig-run/2` build contract above.
1786
+ `inputs` between `config` and `outputs`; issue #1669 adds optional `wrapper_pngs`
1787
+ between `inputs` and `outputs`. The fixed key order is `spec`, `package`,
1788
+ `command`, `started_at`, `finished_at`, `config`, `inputs`, optional
1789
+ `wrapper_pngs`, `outputs`, `argv`. The other fields and the write timing follow
1790
+ the `rig-run/2` build contract above.
1785
1791
 
1786
1792
  This example shows a build with full and head layer directories and one alternate tuple.
1787
- The version and digests are illustrative, and the output list is abbreviated.
1793
+ The version and digests are illustrative, and the wrapper PNG and output lists are abbreviated.
1788
1794
 
1789
1795
  ```json
1790
1796
  {
1791
1797
  "spec": "rig-run/3",
1792
- "package": { "name": "@rig-c/parts", "version": "2.57.0" },
1798
+ "package": { "name": "@rig-c/parts", "version": "2.71.0" },
1793
1799
  "command": "build",
1794
1800
  "started_at": "2026-11-25T00:00:00.000Z",
1795
1801
  "finished_at": "2026-11-25T00:00:01.000Z",
@@ -1829,6 +1835,28 @@ The version and digests are illustrative, and the output list is abbreviated.
1829
1835
  "sha256": "66778899aabbccddeeff00112233445566778899aabbccddeeff001122334455"
1830
1836
  }
1831
1837
  ],
1838
+ "wrapper_pngs": [
1839
+ {
1840
+ "role": "full",
1841
+ "path": "parts/topwear.png",
1842
+ "sha256": "8899aabbccddeeff00112233445566778899aabbccddeeff0011223344556677"
1843
+ },
1844
+ {
1845
+ "role": "head",
1846
+ "path": "parts/face.png",
1847
+ "sha256": "99aabbccddeeff00112233445566778899aabbccddeeff001122334455667788"
1848
+ },
1849
+ {
1850
+ "role": "alt[0].full",
1851
+ "path": "parts/topwear.png",
1852
+ "sha256": "aabbccddeeff00112233445566778899aabbccddeeff00112233445566778899"
1853
+ },
1854
+ {
1855
+ "role": "alt[0].head",
1856
+ "path": "parts/face.png",
1857
+ "sha256": "bbccddeeff00112233445566778899aabbccddeeff00112233445566778899aa"
1858
+ }
1859
+ ],
1832
1860
  "outputs": [
1833
1861
  {
1834
1862
  "path": "check/check.json",
@@ -1861,9 +1889,29 @@ order regardless of where each flag appears in `argv`.
1861
1889
  `i` is zero-based and counts the `--alt` occurrences. Entries for optional flags
1862
1890
  or tuple members appear only when supplied. The array inventories CLI file
1863
1891
  inputs. References declared only inside the config and files referenced by a
1864
- layer manifest are outside this inventory. `config` binds `--config` separately,
1892
+ layer manifest are outside `inputs`. `config` binds `--config` separately,
1865
1893
  and `--out` is the output root.
1866
1894
 
1895
+ `wrapper_pngs` is additive to `rig-run/3` (issue #1669) and appears whenever the
1896
+ build decodes at least one wrapper manifest across the primary tuple or any `--alt`
1897
+ tuple. Each row is `{ "role", "path", "sha256" }` in that key order, matching
1898
+ `assemble`'s `wrapper_pngs` (#1645). `role` is `full`, `head`, `alt[i].full` or
1899
+ `alt[i].head`, equal to the `role` of the `inputs` row whose manifest the PNG
1900
+ belongs to. `path` is canonical and `/`-separated, relative to that manifest's
1901
+ directory, naming the file actually decoded (including the `parts/<name>.png`
1902
+ fallback when used). `sha256` is the lowercase hex SHA-256 digest of the exact
1903
+ bytes passed to the decoder. Coverage spans every decoded drawn and hidden layer
1904
+ PNG and every decoded `depth_filename` PNG when depth is active, across the
1905
+ primary tuple and every `--alt` tuple; a role whose input is a PSD contributes no
1906
+ rows. Rows sort by role in `inputs` order (`full`, `head`, `alt[0].full`,
1907
+ `alt[0].head`, …) and then by `path` in UTF-16 code-unit order, collapsing
1908
+ repeated reads with the same role, path and digest to one row. Distinct digests
1909
+ for the same role and path refuse the build as `ASSEMBLE_WRAPPER_PNG_CONFLICT`,
1910
+ and a selected path outside the canonical relative form refuses as
1911
+ `ASSEMBLE_WRAPPER_PNG_PATH`, writing no record in either case. An all-PSD build
1912
+ omits `wrapper_pngs`, and an older `rig-run/3` record without `wrapper_pngs`
1913
+ leaves its wrapper PNGs unbound.
1914
+
1867
1915
  The run-record writer reads and hashes the raw bytes on disk of the file named by
1868
1916
  `path` after the check report completes. Keep input files and link targets unchanged
1869
1917
  from the start of the build until it exits so these digests describe the bytes the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rig-parts",
3
- "version": "2.71.0",
3
+ "version": "2.73.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": {
@@ -71,8 +71,9 @@
71
71
  "selftest:pre": "bun selftest.ts --pre",
72
72
  "smoke": "bun scripts/install_smoke.ts",
73
73
  "verify:nova": "bun scripts/verify_nova.ts",
74
- "typecheck": "bunx tsc --noEmit",
75
- "lint": "bunx eslint .",
74
+ "hooks": "([ -e .git ] && [ -f .githooks/pre-commit ] && [ \"$(git config --get core.hooksPath 2>/dev/null)\" != .githooks ] && git rev-parse --git-dir >/dev/null 2>&1 && git config core.hooksPath .githooks >/dev/null 2>&1 || true)",
75
+ "typecheck": "bun run hooks && bunx tsc --noEmit",
76
+ "lint": "bun run hooks && bunx eslint .",
76
77
  "prepublishOnly": "node scripts/prepublish.cjs"
77
78
  },
78
79
  "dependencies": {
@@ -82,8 +83,8 @@
82
83
  "devDependencies": {
83
84
  "@esotericsoftware/spine-core": "4.3.13",
84
85
  "@types/bun": "^1.4.2",
85
- "eslint": "^10.11.0",
86
+ "eslint": "10.11.0",
86
87
  "typescript": "^5.9.3",
87
- "typescript-eslint": "^8.70.1"
88
+ "typescript-eslint": "8.70.1"
88
89
  }
89
90
  }
package/src/assemble.ts CHANGED
@@ -5906,7 +5906,7 @@ function assembleParts(input: AssembleInput, targets?: ReadonlySet<string>, befo
5906
5906
  const cutMaterial: MaterialRow[] = [];
5907
5907
  const materialSources: MaterialSource[] = [];
5908
5908
  plan.forEach(([name], pi) => {
5909
- const mine = cuts.map((q, i) => i).filter((i) => cuts[i].from === name);
5909
+ const mine = cuts.map((_q, i) => i).filter((i) => cuts[i].from === name);
5910
5910
  const b = built[pi];
5911
5911
  if (mine.length === 0 || b === null) return;
5912
5912
  const before = opaqueOf(b.r);
@@ -7097,7 +7097,7 @@ export function bodiesWithPixels(mask: Mask, minPx: number): { bodies: Uncovered
7097
7097
  for (let p = 0; p < opened.data.length; p++) if (mask.data[p] === 0) opened.data[p] = 0;
7098
7098
  const cc = connectedComponents(opened, 8);
7099
7099
  const keep = cc.stats.map((s, l) => l > 0 && s.area > 0 && s.area >= minPx);
7100
- const all = cc.stats.filter((s, l) => keep[l]);
7100
+ const all = cc.stats.filter((_s, l) => keep[l]);
7101
7101
  all.sort((a, b) => b.area - a.area || a.top - b.top || a.left - b.left);
7102
7102
  const pixels = newMask(mask.width, mask.height);
7103
7103
  for (let p = 0; p < pixels.data.length; p++) if (keep[cc.labels[p]]) pixels.data[p] = 1;
package/src/build.ts CHANGED
@@ -1,13 +1,12 @@
1
1
  import { changedAssemblyFields, effectiveAssemblyRules, projectAssemblyConfig, readProjectedAssemblyConfig, type AssemblyLimb, refuseStaleAssembly, type AssemblyRules } from './assembly-reading.ts';
2
2
  import { editedPartFrontColourLines, readEditedParts } from './editedparts.ts';
3
3
  import { SOURCE_COVER_FILE, sourceCoverReport, type SourceCoverSet } from './sourcecover.ts';
4
- import { STAGE_MAP_FILE } from './provenance.ts';
4
+ import { ownershipLines, provenanceLines, STAGE_MAP_FILE } from './provenance.ts';
5
5
  import { withoutCheckRows } from './checkrow.ts';
6
6
  import { readSetupFigureMask } from './setupfiguremask.ts';
7
7
  import { EDGE_RESIDUAL_FILE, edgeResidualLines } from './edgeresidual.ts';
8
8
  import { SUPPORT_DOMAINS_FILE, writeSupportDomains } from './supportdomains.ts';
9
9
  import { COINCIDE_LINE, SETUP_SEAM_TRANSMISSION_LINE, setupSeamTransmissionLine, supportLines } from './coincide.ts';
10
- import { DEFAULT_PROJECT_RULE } from './projectrule.ts';
11
10
  import { type PaintingAllocationReading, type PaintingAllocationEvent, EDGE_CONTRAST, PAINTING_ALLOCATION_FILE, PAINTING_EDGE_COVERAGE_TRANSFER } from './paintingedges.ts';
12
11
  import { SETUP_PAINTING_LINE, setupPaintingLines } from './setuppainting.ts';
13
12
  import { boundaryColourLines } from './boundarycolour.ts';
@@ -20,7 +19,6 @@ import { applyTakenLayers } from './takelayers.ts';
20
19
  import { applyTakenRegions } from './takeregion.ts';
21
20
  import { bindOccluderPlates, occluderStageWarnings, readOccluderInputs } from './occluderstage.ts';
22
21
  import { PLATE_RECEIPT_FILE, type PlateReceipt, verifyPlateReceipt } from './plate.ts';
23
- import { ownershipLines, provenanceLines } from './provenance.ts';
24
22
  import { readSourceDepth } from './depthsheets.ts';
25
23
  import { orderedBaseAnchor } from './baseanchor.ts';
26
24
  import { alternateLayerSources, alternateLayerIslands, alternateLayerOthers } from './alternatelayers.ts';
@@ -72,7 +70,7 @@ import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, statSync, wri
72
70
  import { basename, dirname, join, relative, resolve, sep } from 'node:path';
73
71
  import { makeOutDir } from './outputpaths.ts';
74
72
  import { type AnimFrame, EncodeError, encodeApng, encodeIndexedApng, INDEXED_DEFAULTS } from './apng.ts';
75
- import { assemble, type AssembleResult, boxOf, cutLines, edgeSplitLines, ERROR_LIMIT, type ExcludedCount, excludedLines, setExclusions, islandLines, setIslandSources, type IslandCount, hiddenLines, SINGLE_RUN_FACE_TAGS, singleRunHeadBox, softOcclusionLine, driftLine, limbLines, FIGURE_MASK_FILE, figureMaskLines, figuresLine, groundWarning, holeKindsLine, holeLines, measurePinholes, measureRecomposite, pinholeProblems, pinholesLine, type ProjectRule, recomposite, recompositeRecord, scenePhrase, type SeamRule, sourceInRig, projectedStageFields, stageFields, uncoveredLine, underBox } from './assemble.ts';
73
+ import { assemble, type AssembleResult, boxOf, capOwnershipLines, cutLines, edgeSplitLines, ERROR_LIMIT, type ExcludedCount, excludedLines, setExclusions, islandLines, setIslandSources, type IslandCount, hiddenLines, type OtherLimbs, SINGLE_RUN_FACE_TAGS, singleRunHeadBox, softOcclusionLine, splitLines, type SplitCount, driftLine, limbLines, FIGURE_MASK_FILE, figureMaskLines, figuresLine, groundWarning, holeKindsLine, holeLines, measurePinholes, measureRecomposite, pinholeProblems, pinholesLine, type ProjectRule, recomposite, recompositeRecord, scenePhrase, type SeamRule, sourceInRig, projectedStageFields, stageFields, uncoveredLine, underBox } from './assemble.ts';
76
74
  import { allocationClause, type Reducer, stageBClause, unboundedClause } from './automesh.ts';
77
75
  import { residualClause } from './autoenvelope.ts';
78
76
  import { type AutoMotionCase, failingRows, idleSchedule, localRow, motionClause, motionDeformation, motionDocument, motionInput, motionRowText, motionStimulus, motionVerdict, noStimulusProblem, prepareComparison, type ReplayCandidate, runComparison, runPreparedComparison, sourceSelfFailure, stimulusMotion, withStimulus } from './automotion.ts';
@@ -100,9 +98,8 @@ import {
100
98
  untestedIntervals,
101
99
  } from './autoreplay.ts';
102
100
  import { physicsLines } from './physicscontrib.ts';
103
- import { besideIdleLine, checkSummaryLine, inputFileRecord, type InputFileRecord, CLOTH_LINE, type ClothLine, clothWarnText, figureOpeningLines, frameRuns, MOTION_SEAM_LINE, type MotionSeamLine, type MotionSeamPlant, motionSeamRequiredLine, motionSeamWarnText, motionJointContactLines, FOLD_LINE, type FoldsLine, LEVEL_LINE, type LevelLine, LIMB_LINE, type LimbLine, STRESS_LINE, SWEEP_LINE, type SweepLine, buildGateLines, causeLines, environmentLine, IDLE_FPS, IDLE_MAX_PX, maxRgbDiff, REQUIREMENTS_DIR, type CheckReport, type PackLine, DEFAULT_PACK_SHAPE, DEFAULT_PAGE_EDGES, GATE_PROFILE, JUDGEMENT_LINES, type JudgementLine, packedBuildArgs, packedBuildLabel, type PackMode, parsePageSize, readCheckEnvironment, readWindBand, type PackShape, type PageEdges, readFrameSet, rigcFailed, rigcIdentity, rigcRanClause, REPORTED_LINES, type ReportedLine, type RigcRunner, runCheck, SEAM_DIR, SEAM_MEAN_BAR, seamPairText, seamRigPxText, SOURCE_LINE, SEAM_PX_BAR, SEAM_PX_LEVEL, SEAM_PX_LEVEL_HIGH, SPINEBOY_YARDSTICK, STILL_DIR, WIND_BAND_LINE, windBandLines } from './check.ts';
104
- import { sliderStretchLine, type LoopSeamRequest } from './check.ts';
105
- import { type CharacterConfig, type Cut, type Extend, loadConfigAndAnimations, loadConfigWithBytes, loadEarlyConfig, type Patch, type PlanEntry } from './config.ts';
101
+ import { besideIdleLine, checkSummaryLine, inputFileRecord, type InputFileRecord, CLOTH_LINE, type ClothLine, clothWarnText, figureOpeningLines, frameRuns, type LoopSeamRequest, MOTION_SEAM_LINE, type MotionSeamLine, type MotionSeamPlant, motionSeamRequiredLine, motionSeamWarnText, motionJointContactLines, FOLD_LINE, type FoldsLine, LEVEL_LINE, type LevelLine, LIMB_LINE, type LimbLine, sliderStretchLine, STRESS_LINE, SWEEP_LINE, type SweepLine, buildGateLines, causeLines, environmentLine, IDLE_FPS, IDLE_MAX_PX, maxRgbDiff, REQUIREMENTS_DIR, type CheckReport, type PackLine, DEFAULT_PACK_SHAPE, DEFAULT_PAGE_EDGES, GATE_PROFILE, JUDGEMENT_LINES, type JudgementLine, packedBuildArgs, packedBuildLabel, type PackMode, parsePageSize, readCheckEnvironment, readWindBand, type PackShape, type PageEdges, readFrameSet, rigcFailed, rigcIdentity, rigcRanClause, REPORTED_LINES, type ReportedLine, type RigcRunner, runCheck, SEAM_DIR, SEAM_MEAN_BAR, seamPairText, seamRigPxText, SOURCE_LINE, SEAM_PX_BAR, SEAM_PX_LEVEL, SEAM_PX_LEVEL_HIGH, SPINEBOY_YARDSTICK, STILL_DIR, WIND_BAND_LINE, windBandLines } from './check.ts';
102
+ import { type BoneEntry, type CharacterConfig, type Cut, type Extend, loadConfigAndAnimations, loadConfigWithBytes, loadEarlyConfig, type Patch, type PlanEntry } from './config.ts';
106
103
  import { coreCompileGuideLine, failLine, foldName, PartsError, type Problem, refuseIfAny } from './errors.ts';
107
104
  import { editedConfigImages, editedRunImages, missingReceipts, readEditorReceipts } from './editreceipt.ts';
108
105
  import { untracedPartSources } from './partsource.ts';
@@ -112,16 +109,12 @@ import { CONTROL_SUFFIX, withAnimations } from './motion.ts';
112
109
  import type { PaletteError } from './palette.ts';
113
110
  import { PartVisibility } from './partvisibility.ts';
114
111
  import { readRunVisibility } from './visibility.ts';
115
- import { type LayerSet, readLayers, type WrapperReadings } from './layers.ts';
112
+ import { type LayerSet, OPAQUE_ALPHA_ABOVE, readLayers, type WrapperReadings } from './layers.ts';
116
113
  import { placeBoneEntriesForSkeleton, poseBoneEntriesForDrawn, REGISTER_OFFSET_BAR, REGISTER_SCALE_BAR, registeredWithinBar, registerSkeleton, SKELETON_LIMB_BONES, skeletonDrawnLength, skeletonLimbJoints } from './limbs.ts';
117
114
  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
115
  import { encodePngBytes, readPng, writePng } from './raster/png.ts';
119
116
  import { verifyReplacementRecord } from './replaceparts.ts';
120
- import type { Raster } from './raster/types.ts';
121
- import { type Mask, newMask } from './raster/types.ts';
122
- import { type OtherLimbs, splitLines, capOwnershipLines, type SplitCount } from './assemble.ts';
123
- import type { BoneEntry } from './config.ts';
124
- import { OPAQUE_ALPHA_ABOVE } from './layers.ts';
117
+ import { type Mask, newMask, type Raster } from './raster/types.ts';
125
118
  import { pinholesRequired, readRequirements, type RequirementLine, summaryText } from './requirements.ts';
126
119
  import { type AutoMeshReport, buildRig, DEFAULT_IDLE_KEYS, type FaceAxis, type IdleKeys, type MeshReport, rebindRigMotion, type RigCommand, rigJsonText, type RigOutput, type RigSpec, SETS_FILE, type StrayCleared, type TurnRow } from './rig.ts';
127
120
  import { KEYPOINT_NAMES, type KeypointName, type PosePoints } from './skeleton.ts';
@@ -149,14 +142,20 @@ export function readSource(path: string): Raster {
149
142
  }
150
143
  }
151
144
 
152
- export type AssembleWrapperReadings = Record<'full' | 'head', WrapperReadings>;
145
+ export type BuildWrapperRole = 'full' | 'head' | `alt[${number}].full` | `alt[${number}].head`;
146
+
147
+ export interface AssembleWrapperReadings {
148
+ full: WrapperReadings;
149
+ head: WrapperReadings;
150
+ alts?: Array<{ full: WrapperReadings; head: WrapperReadings }>;
151
+ }
153
152
 
154
153
  /**
155
154
  * Read both runs, collecting the refusals of both before throwing. With no
156
155
  * head run (`head` null, issue #359) the full run is read once and stands for
157
156
  * both, and `single` says so: the stage then holds it to `checkSingleRun`.
158
157
  */
159
- export function readRuns(full: string, head: string | null, recordVisibility = false, wrapperReadings?: AssembleWrapperReadings): {
158
+ export function readRuns(full: string, head: string | null, recordVisibility = false, wrapperReadings?: Record<'full' | 'head', WrapperReadings>): {
160
159
  full: LayerSet; head: LayerSet; single: boolean; visibility?: PartVisibility;
161
160
  } {
162
161
  const problems: Problem[] = [];
@@ -545,7 +544,7 @@ export function frontOrdered<T extends { record: { name: string } }>(items: read
545
544
 
546
545
  /** Bind the pure owner reading to the exact stage inputs. */
547
546
  function sourceCoverSet(result: AssembleResult, set: string | null, painting: string,
548
- runs: ReturnType<typeof readRuns>, wrapperReadings?: AssembleWrapperReadings): SourceCoverSet {
547
+ runs: ReturnType<typeof readRuns>, wrapperReadings?: Record<'full' | 'head', WrapperReadings>): SourceCoverSet {
549
548
  const inputs: SourceCoverSet['inputs'] = [];
550
549
  for (const run of (runs.single ? ['full'] : ['full', 'head']) as Array<'full' | 'head'>) {
551
550
  const layers = runs[run];
@@ -579,7 +578,14 @@ export function assembleStage(input: AssembleStageInput, outs: AssembleOutputs,
579
578
  const { seam, project } = effectiveAssemblyRules(cfg.assemble, input);
580
579
  const { requirements, effectiveSetup } = resolveAssemblyRequirements(input, cfg, project, requirementsFile);
581
580
  const src = readSource(input.source);
582
- const wrapperReadings = onWrapperReadings === undefined ? undefined : { full: { pngs: [] }, head: { pngs: [] } };
581
+ const cliAlts = input.alts ?? [];
582
+ const wrapperReadings: AssembleWrapperReadings | undefined = onWrapperReadings === undefined
583
+ ? undefined
584
+ : {
585
+ full: { pngs: [] },
586
+ head: { pngs: [] },
587
+ ...(cliAlts.length === 0 ? {} : { alts: cliAlts.map(() => ({ full: { pngs: [] }, head: { pngs: [] } })) }),
588
+ };
583
589
  const read = readRuns(input.full, input.head, true, wrapperReadings);
584
590
  // Issue #946: every declared receipt is held to its file, and under `required` every edited image needs one, before anything is assembled.
585
591
  const receipts = readEditorReceipts(cfg.assemble.editor_receipts, input.config);
@@ -617,12 +623,16 @@ export function assembleStage(input: AssembleStageInput, outs: AssembleOutputs,
617
623
 
618
624
  // Issue #454: alternate painting sets, assembled before any file is written.
619
625
  const configDir = dirname(resolve(input.config));
620
- const cliAlts = input.alts ?? [];
621
626
  const cfgAlts = cfg.assemble.alternates ?? [];
622
627
  const cliByName = new Map<string, AlternateCliInput>();
623
- for (const a of cliAlts) cliByName.set(a.name, a);
628
+ const cliIndexByName = new Map<string, number>();
629
+ cliAlts.forEach((a, idx) => {
630
+ cliByName.set(a.name, a);
631
+ cliIndexByName.set(a.name, idx);
632
+ });
624
633
  const mergedAlts: Array<{
625
634
  name: string;
635
+ cliIndex?: number;
626
636
  base_anchor?: NonNullable<typeof cfg.assemble.alternates>[number]['base_anchor'];
627
637
  at: string;
628
638
  source?: string;
@@ -644,6 +654,7 @@ export function assembleStage(input: AssembleStageInput, outs: AssembleOutputs,
644
654
  if (cli !== undefined) cliByName.delete(a.name);
645
655
  return {
646
656
  name: a.name,
657
+ ...(cli === undefined ? {} : { cliIndex: cliIndexByName.get(cli.name) }),
647
658
  base_anchor: a.base_anchor,
648
659
  at: `config.assemble.alternates[${i}] (set "${a.name}")`,
649
660
  source: cli?.source ?? (a.source === undefined ? undefined : resolve(configDir, a.source)),
@@ -665,6 +676,7 @@ export function assembleStage(input: AssembleStageInput, outs: AssembleOutputs,
665
676
  for (const cli of cliByName.values()) {
666
677
  mergedAlts.push({
667
678
  name: cli.name,
679
+ cliIndex: cliIndexByName.get(cli.name),
668
680
  at: `--alt ${cli.name}`,
669
681
  source: cli.source,
670
682
  full: cli.full,
@@ -770,7 +782,8 @@ export function assembleStage(input: AssembleStageInput, outs: AssembleOutputs,
770
782
  const invalidFocus = setFocusProblems(alt.focus, `${alt.at}.focus`, [altSrc.width, altSrc.height]);
771
783
  if (invalidFocus.length > 0) { altProblems.push(...invalidFocus); continue; }
772
784
  }
773
- const altRuns = readRuns(alt.full, alt.head ?? null, true);
785
+ const altWrapperReadings = alt.cliIndex === undefined ? undefined : wrapperReadings?.alts?.[alt.cliIndex];
786
+ const altRuns = readRuns(alt.full, alt.head ?? null, true, altWrapperReadings);
774
787
  altProblems.push(...missingReceipts(receipts, [...editedRunImages(altRuns, `alternate set "${alt.name}" `), ...editedConfigImages(input.config, alt.cuts ?? [], undefined, `${alt.at}.cuts`)]));
775
788
  const hidesSet = new Set(alt.hides ?? []);
776
789
  const declaredSlots = alt.parts !== undefined ? alt.parts.filter((p) => !hidesSet.has(p)) : baseSlots.filter((p) => !hidesSet.has(p));
@@ -90,7 +90,6 @@ export function checkClipStretch(scene: string, scratch: string, rigc: RigcRunne
90
90
  }
91
91
  for (const row of readSliderStretch(build, bindings, provide)?.rows ?? []) {
92
92
  log(sliderStretchLine(row));
93
- if (row.status === 'FAIL') passed = false;
94
93
  }
95
94
  } catch (err) {
96
95
  if (!(err instanceof api.CandidateAtlasError || err instanceof api.CandidatePairError || err instanceof api.CoreInputError ||
package/src/config.ts CHANGED
@@ -194,9 +194,9 @@ export interface SeeThrough {
194
194
  /** Issue #439: arm separation when both arms overlap in the full run. */
195
195
  arm_split?: ArmSplit;
196
196
  resolution: number;
197
- steps: number;
198
- seed: number;
199
- offload: boolean;
197
+ steps?: number;
198
+ seed?: number;
199
+ offload?: boolean;
200
200
  }
201
201
 
202
202
  export type Run = 'full' | 'head';
@@ -2537,7 +2537,7 @@ function checkHeadBox(c: Check, path: string, b: Json): void {
2537
2537
  }
2538
2538
 
2539
2539
  function checkSeeThrough(c: Check, v: Json): void {
2540
- const s = c.object('config.seethrough', v, ['resolution', 'steps', 'seed', 'offload'], ['head_box', 'arm_split']);
2540
+ const s = c.object('config.seethrough', v, ['resolution'], ['steps', 'seed', 'offload', 'head_box', 'arm_split']);
2541
2541
  if (s === null) return;
2542
2542
  const p = 'config.seethrough';
2543
2543
  const res = 'resolution' in s && c.int(`${p}.resolution`, s.resolution, 1) ? (s.resolution as number) : null;
@@ -10,11 +10,10 @@
10
10
  */
11
11
  import type { PlanProposal } from './assemble.ts';
12
12
  import type { HeadBoxProposal } from './headbox.ts';
13
- import type { CharacterConfig } from './config.ts';
14
13
  import { orderedEditedPartReceipt, type EditedPartReceipt } from './editedparts.ts';
15
14
  import type { Proposal, PROPOSAL_CONFIG_SECTIONS } from './propose.ts';
16
15
  import { PartsError } from './errors.ts';
17
- import { parseConfig, parseEarlyConfig, parseProposalSections } from './config.ts';
16
+ import { type CharacterConfig, parseConfig, parseEarlyConfig, parseProposalSections } from './config.ts';
18
17
  import type { ConfigEdit } from './meshdraft.ts';
19
18
 
20
19
  /** Required point fields and optional shape fields of `meshes.<part>.contour.bust`, in the shorthand order `src/config.ts` validates (issues #475, #1428). */
@@ -1,4 +1,4 @@
1
- import { explicitWeightRows, regionBone, type RegionSpec } from './config.ts';
1
+ import { type BoneEntry, explicitWeightRows, type Limb, regionBone, type RegionSpec } from './config.ts';
2
2
  /**
3
3
  * What `propose` looked at, said (issue #86): the coverage lines lint's
4
4
  * per-bone record prints, and the basis file written beside the proposal.
@@ -33,7 +33,6 @@ import { explicitWeightRows, regionBone, type RegionSpec } from './config.ts';
33
33
  * write the same bytes.
34
34
  */
35
35
  import { type Problem, refuseIfAny } from './errors.ts';
36
- import type { BoneEntry, Limb } from './config.ts';
37
36
  import type { RigJoints } from './keypoints.ts';
38
37
  import { BASIS_KINDS, type BasisKind, type BoneBasis, type BoneCoverage, COVERAGE_OUTCOMES, coverageOutcome, expand, FRAME_KEYS, type FrameBasis, type FrameKey, type PartSet, type Placement, type Proposal, type ProposalBasis } from './propose.ts';
39
38
  import { BONE_ROLES, type BoneRole, compareStructure, readSkeleton } from './structure.ts';
package/src/edgesplit.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  /** Painting-edge part split on pre-projection plan rasters (#1231). */
2
- import type { Problem } from './errors.ts';
3
- import { refuseIfAny } from './errors.ts';
2
+ import { type Problem, refuseIfAny } from './errors.ts';
4
3
  import type { Raster } from './raster/types.ts';
5
4
  import { pyRound } from './round.ts';
6
5
 
package/src/meshdraft.ts CHANGED
@@ -59,11 +59,10 @@
59
59
  * Pure in the sense `src/` is held to: no clock, no randomness, no network, no child process. rigc runs as a process,
60
60
  * but the process is injected, exactly as `src/check.ts` and `src/build.ts` take it.
61
61
  */
62
- import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
62
+ import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from 'node:fs';
63
63
  import { dirname, isAbsolute, join, resolve } from 'node:path';
64
- import type { AlphaMask, MeasureRow, MeshQualityReport, MotionSchedule } from '@rig-c/core/mesh';
64
+ import { type AlphaMask, type MeasureRow, type MeshQualityReport, MeshReductionError, type MotionSchedule } from '@rig-c/core/mesh';
65
65
  import { compareMeshesInMotion, type MotionComparisonInput } from '@rig-c/core/meshcompare';
66
- import { MeshReductionError } from '@rig-c/core/mesh';
67
66
  import { explicitFrameId, idleSchedule } from './automotion.ts';
68
67
  import { checkStage, gateThroughRigc, type Log, RIGC_MODEL_DOCUMENT, rigStage } from './build.ts';
69
68
  import { BARS, type CheckReport, type PackShape, type PageEdges, parsePageSize, type RigcRunner } from './check.ts';
@@ -72,7 +71,7 @@ import { relocateConfigReferences } from './configrelocation.ts';
72
71
  import { PartsError, type Problem, problemLine } from './errors.ts';
73
72
  import { IDLE_FPS } from './motion.ts';
74
73
  import { type ContourBridges, FAINT_ALPHA } from './contour.ts';
75
- import { ART_ALPHA, DUST_MAX_PX, DUST_MAX_SHARE, isDust, dustOf, type DustReading } from './mesh.ts';
74
+ import { ART_ALPHA, DUST_MAX_PX, DUST_MAX_SHARE, isDust, dustOf } from './mesh.ts';
76
75
  import { partImageReference, type PartsFile, readParts } from './parts.ts';
77
76
  import { readPng } from './raster/png.ts';
78
77
  import type { Raster } from './raster/types.ts';
@@ -1,6 +1,5 @@
1
1
  /** Explicit painting ownership, after assembly and before output cropping (#848). */
2
- import type { Problem } from './errors.ts';
3
- import { refuseIfAny } from './errors.ts';
2
+ import { type Problem, refuseIfAny } from './errors.ts';
4
3
  import { CORE_ALPHA, OPAQUE_ALPHA_ABOVE } from './layers.ts';
5
4
  import { newMask, type Mask, type Raster } from './raster/types.ts';
6
5
 
package/src/propose.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ART_ALPHA, dustOf, isDust } from './mesh.ts';
2
- import { explicitWeightRows, regionBone, type RegionSpec } from './config.ts';
2
+ import { type BoneEntry, type CharacterConfig, type ConfigConstraint, type ConfigStop, type ContourBustSpec, type ContourSpec, contourRegionsOf, deriveBustRegions, explicitWeightRows, type Limb, type MeshSpec, type PartBinding, parseConfig, type Point, regionBone, type RegionSpec, type Segment, type SkeletonSections, turnRidersByBone } from './config.ts';
3
3
  /**
4
4
  * The propose stage: bone origins, mesh candidate lists, regions and a default
5
5
  * idle, read off the assembled parts — and the overlay a person or an agent
@@ -133,7 +133,6 @@ import { explicitWeightRows, regionBone, type RegionSpec } from './config.ts';
133
133
  import { existsSync } from 'node:fs';
134
134
  import { join } from 'node:path';
135
135
  import { drawText, GLYPH_H } from '@rig-c/core/font5x7';
136
- import { type BoneEntry, type CharacterConfig, type ConfigConstraint, type ConfigStop, type ContourBustSpec, type ContourSpec, contourRegionsOf, deriveBustRegions, type Limb, type MeshSpec, type PartBinding, parseConfig, type Point, type Segment, type SkeletonSections, turnRidersByBone } from './config.ts';
137
136
  export { contourRegionsOf, deriveBustRegions };
138
137
  import { computeExactFrameTransforms, cropToSpineY, normaliseDegrees, toWorld } from './coords.ts';
139
138
  import { PartsError, type Problem, refuseIfAny } from './errors.ts';
@@ -57,8 +57,7 @@ import { resolve } from 'node:path';
57
57
  import { CompileError } from '@rig-c/core/errors';
58
58
  import { splitRigSkin, type RigSkin } from '@rig-c/core/rig';
59
59
  import { cropToSpineY } from './coords.ts';
60
- import type { Problem } from './errors.ts';
61
- import { refuseIfAny } from './errors.ts';
60
+ import { type Problem, refuseIfAny } from './errors.ts';
62
61
  import { type BoneWorld, type GeometryPose, type MeshRest, stretchFigures, stretchSeverity } from './instruments.ts';
63
62
  import { ART_ALPHA } from './mesh.ts';
64
63
  import { alphaAbove, type Raster } from './raster/types.ts';
package/src/rig.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { baseAnchorProblems, orderedBaseAnchor, baseAnchorMoves, type AnchorRegion } from './baseanchor.ts';
2
2
  import { padDepthSheet, padTurnDepthSheet, depthSheetProblems, type PartDepthReference } from './depthsheets.ts';
3
- import { explicitBoneNames, explicitSlotBones, explicitWeightRows, regionBone } from './config.ts';
3
+ import { type AutoSpec, type BoneEntry, type CharacterConfig, type ConfigConstraint, type ConfigStop, CONSTRAINT_FOLLOWS, constraintForRig, contourRegionsOf, type ContourSpec, DEFAULT_BUST_BONE_L, DEFAULT_BUST_BONE_R, explicitBoneNames, explicitSlotBones, explicitWeightRows, type InfluenceMeshSpec, type MeshSpec, type Point, regionBone, type RibsSpec, ROOT_BONE, stopForRig, turnRidersByBone, type WeightRule, weightsABone } from './config.ts';
4
4
  import { explicitAttachment, type ExplicitMeshReport } from './explicitmesh.ts';
5
5
  /**
6
6
  * The rig stage: a character config and its assembled parts in, a rig spec
@@ -137,7 +137,6 @@ import { explicitAttachment, type ExplicitMeshReport } from './explicitmesh.ts';
137
137
  * touches the disk, and the same inputs give the same bytes (key order is the
138
138
  * order the objects are built in, and every number is rounded by `pyRound`).
139
139
  */
140
- import { type AutoSpec, type BoneEntry, type InfluenceMeshSpec, type WeightRule, type CharacterConfig, type MeshSpec, type ConfigConstraint, type ConfigStop, CONSTRAINT_FOLLOWS, constraintForRig, contourRegionsOf, type ContourSpec, DEFAULT_BUST_BONE_L, DEFAULT_BUST_BONE_R, type Point, type RibsSpec, ROOT_BONE, stopForRig, turnRidersByBone, weightsABone } from './config.ts';
141
140
  import { RUNTIME_PI } from '@rig-c/core/core';
142
141
  import { type BoneTransform, computeExactFrameTransforms, computeWorldTransforms, cropToSpineY, normaliseDegrees, paintingToSetupPoint, setupToPaintingPoint, toBoneLocal, toWorld } from './coords.ts';
143
142
  import { foldName, type Problem, refuseIfAny, PartsError } from './errors.ts';
@@ -145,8 +144,7 @@ import { recordedFocusProblems } from './setfocus.ts';
145
144
  import { eyeLineDegrees } from './headframe.ts';
146
145
  import type { RigBoneInherit, RigInvariants, RigStop } from '@rig-c/core/rig';
147
146
  import { f32 } from '@rig-c/core/compile';
148
- import type { MeshCounts, MeshQualityReport, MeshReductionInput, MotionAmplitude, ReducedMesh, Termination } from '@rig-c/core/mesh';
149
- import { bindWeightedVertices, buildGridMesh, buildSegmentsLattice, type EntrySegment, influenceShares, segmentDistance as rigcSegmentDistance, type SegmentsLattice, type SegmentsLatticeReport } from '@rig-c/core/mesh';
147
+ import { bindWeightedVertices, buildGridMesh, buildSegmentsLattice, type EntrySegment, influenceShares, type MeshCounts, type MeshQualityReport, type MeshReductionInput, type MotionAmplitude, type ReducedMesh, segmentDistance as rigcSegmentDistance, type SegmentsLattice, type SegmentsLatticeReport, type Termination } from '@rig-c/core/mesh';
150
148
  import { type AmplitudeRow, amplitudeRow, partAmplitude, withAmplitude } from './autoamplitude.ts';
151
149
  import { type ResidualRow, residualRow, slotEnvelope, withSkinning } from './autoenvelope.ts';
152
150
  import { type AutoMotionCase, type AutoSearch, DEFORM_MAY_FOLD_WHY, type MotionDeformation, type StimulusPose, stimulusAnimationNames } from './automotion.ts';
@@ -181,15 +179,14 @@ import { OPAQUE_ALPHA_ABOVE } from './layers.ts';
181
179
  import { bindFaceSurfaceDeform, BLINK, blinkHoldMisses, blinkSpan, blinkTimes, CONTROL_SUFFIX, controlledBones, IDLE_FPS, idleMotion, type MotionSpec, moveKeysToControls } from './motion.ts';
182
180
  import { type PartRecord, type AlternateSetMap, FRONT_SUFFIX, PAINTING_RUN, type PartsFile, readFrom, tagOf } from './parts.ts';
183
181
  import { waistPairs, waistBand, waistInfluences } from './waist.ts';
184
- import { preserveWaistRest, refineWaistMesh, remapWaistDeforms, storedWorld, waistBottomMesh, waistBottomLayoutOf, type WaistMapping } from './waistmesh.ts';
185
- import { pivotWaistMesh, sharedWaistCopy, type WaistPivotRequest } from './waistmesh.ts';
182
+ import { pivotWaistMesh, preserveWaistRest, refineWaistMesh, remapWaistDeforms, sharedWaistCopy, storedWorld, waistBottomMesh, waistBottomLayoutOf, type WaistMapping, type WaistPivotRequest } from './waistmesh.ts';
186
183
  import { readTag } from './tags.ts';
187
184
  import { EYE_GROUP_TAGS } from './propose.ts';
188
185
  import { alphaAbove, crop, pad, type Raster } from './raster/index.ts';
189
186
  import { pyRound } from './round.ts';
190
187
  import { boneHeat, type HeatDust, heatInfluences, HEAT_LIMITS, heatRow, type HeatRow, latticeSilhouette, tracedSilhouette } from './heat.ts';
191
188
  import type { PosePoints } from './skeleton.ts';
192
- import { applyFaceSurfaceDeform, BODY_REAR_SHIFT_BONE, BODY_YAW_DIAL_BONE, BODYSHIFT_BONE, buildDepth25DTurn, type Depth25DTurnOptions, FACE_RATED_BAND, FACESHIFT_BONE, PITCH_DIAL_BONE, REAR_SHIFT_BONE, resolveTurnGrid, TURN_BONE, TURN_CARRIER_TAG, TURN_GRID_MAX_TRIANGLES_PER_SLOT, TURN_GRID_MAX_TRIANGLES_TOTAL, TURN_PLACES, TURN_RIDER_APART, TURN_RIDER_TAGS, turnRiderDepth, type TurnRole, type TurnSpec, turnConstraintName, turnFractions, turnNearest, turnSurfaceBone, turnTwin, turnUnitBone, YAW_DIAL_BONE } from './turn.ts';
189
+ import { applyFaceSurfaceDeform, BODY_REAR_SHIFT_BONE, BODY_YAW_DIAL_BONE, BODYSHIFT_BONE, buildDepth25DTurn, type Depth25DTurnOptions, FACE_RATED_BAND, FACESHIFT_BONE, PITCH_DIAL_BONE, REAR_SHIFT_BONE, resolveTurnGrid, TURN_BONE, TURN_CARRIER_TAG, TURN_GRID_MAX_TRIANGLES_PER_SLOT, TURN_GRID_MAX_TRIANGLES_TOTAL, TURN_PLACES, TURN_RIDER_APART, TURN_RIDER_TAGS, turnRiderDepth, type TurnSpec, turnConstraintName, turnFractions, turnNearest, turnSurfaceBone, turnTwin, turnUnitBone, YAW_DIAL_BONE } from './turn.ts';
193
190
  import type { CoupledTurnBandReport } from './turnband.ts';
194
191
  import { DISTANCE_EXPONENT, type FloorForm, type Influence, influences, type InfluenceLimits, type MeshInfluences, meshLimits, type Segment } from './weights.ts';
195
192
  import { turnContourBands } from './turnoverlap.ts';
@@ -1637,11 +1634,11 @@ export function buildWaistPairSource(
1637
1634
  /^full:(drape|hand)-[rl]$/.test(from)
1638
1635
  ? ` — the full run's merged arm layer was split into this part (issue #490, from 1.37.0), which a config proposed before 1.37.0 does not name; see ${ARM_SPLIT_MIGRATION}, and add only its plan row and entry with: ${ARM_SPLIT_REMEDY}`
1639
1636
  : '';
1640
- const where = (part: string): string => `parts.json holds ${parts.parts.length} part(s): ${parts.parts.map((p) => p.name).join(', ')}`;
1641
- for (const part of Object.keys(cfg.meshes)) if (!byPart.has(part)) fail('RIG_PART_PRESENT', `config.meshes.${part}`, `names the part "${part}", which is not in parts.json; ${where(part)}`);
1637
+ const where = (): string => `parts.json holds ${parts.parts.length} part(s): ${parts.parts.map((p) => p.name).join(', ')}`;
1638
+ for (const part of Object.keys(cfg.meshes)) if (!byPart.has(part)) fail('RIG_PART_PRESENT', `config.meshes.${part}`, `names the part "${part}", which is not in parts.json; ${where()}`);
1642
1639
  for (const [part, region] of Object.entries(cfg.regions)) {
1643
1640
  const bone = regionBone(region);
1644
- if (!byPart.has(part)) fail('RIG_PART_PRESENT', `config.regions.${part}`, `names the part "${part}", which is not in parts.json; ${where(part)}`);
1641
+ if (!byPart.has(part)) fail('RIG_PART_PRESENT', `config.regions.${part}`, `names the part "${part}", which is not in parts.json; ${where()}`);
1645
1642
  if (!B.has(bone)) fail('RIG_NAME_RESOLVES', `config.regions.${part}`, `names the bone "${bone}", which config.bones does not declare`);
1646
1643
  }
1647
1644
  if (cfg.stops !== undefined) {
@@ -1657,13 +1654,13 @@ export function buildWaistPairSource(
1657
1654
  }
1658
1655
  if (cfg.turn?.roles !== undefined) {
1659
1656
  for (const part of Object.keys(cfg.turn.roles)) {
1660
- if (!byPart.has(part)) fail('RIG_PART_PRESENT', `config.turn.roles.${part}`, `names the part "${part}", which is not in parts.json; ${where(part)}`);
1657
+ if (!byPart.has(part)) fail('RIG_PART_PRESENT', `config.turn.roles.${part}`, `names the part "${part}", which is not in parts.json; ${where()}`);
1661
1658
  else if (!(part in cfg.meshes) && !(part in cfg.regions)) fail('RIG_NAME_RESOLVES', `config.turn.roles.${part}`, `names "${part}", which neither config.meshes nor config.regions attaches`);
1662
1659
  }
1663
1660
  }
1664
1661
  if (cfg.turn?.body !== undefined) {
1665
1662
  for (const part of Object.keys(cfg.turn.body.roles)) {
1666
- if (!byPart.has(part)) fail('RIG_PART_PRESENT', `config.turn.body.roles.${part}`, `names the part "${part}", which is not in parts.json; ${where(part)}`);
1663
+ if (!byPart.has(part)) fail('RIG_PART_PRESENT', `config.turn.body.roles.${part}`, `names the part "${part}", which is not in parts.json; ${where()}`);
1667
1664
  else if (!(part in cfg.meshes) && !(part in cfg.regions)) fail('RIG_NAME_RESOLVES', `config.turn.body.roles.${part}`, `names "${part}", which neither config.meshes nor config.regions attaches`);
1668
1665
  }
1669
1666
  }
package/src/runstamp.ts CHANGED
@@ -2,11 +2,11 @@ import { createHash } from 'node:crypto';
2
2
  import { existsSync, readdirSync, readFileSync, realpathSync, rmSync, statSync, writeFileSync } from 'node:fs';
3
3
  import nodePath, { basename, dirname, join, relative, resolve, sep } from 'node:path';
4
4
  import { type AssembleResult, FIGURE_MASK_FILE } from './assemble.ts';
5
- import { type AssembleWrapperReadings, BUILD_RUN_FILE, ERROR_MAP_FILE } from './build.ts';
5
+ import { type AssembleWrapperReadings, BUILD_RUN_FILE, type BuildWrapperRole, ERROR_MAP_FILE } from './build.ts';
6
6
  import { CUT_MATERIAL_SOURCES } from './cutmaterial.ts';
7
7
  import { EDGE_RESIDUAL_FILE } from './edgeresidual.ts';
8
8
  import { PartsError } from './errors.ts';
9
- import type { WrapperManifestReading } from './layers.ts';
9
+ import type { WrapperManifestReading, WrapperReadings } from './layers.ts';
10
10
  import { LAYOUT_FILE } from './limblayout.ts';
11
11
  import { argvPathFromOut, linkRuleFor, type PlatformPath, realWhereItExists, recordedConfigPath, recordedInputPath } from './outputpaths.ts';
12
12
  import { PAINTING_ALLOCATION_FILE } from './paintingedges.ts';
@@ -69,11 +69,13 @@ export interface RunStampAssembleInputs {
69
69
  head?: string | null;
70
70
  }
71
71
 
72
- type WrapperRole = keyof AssembleWrapperReadings;
73
- type AssembleWrapperInputs = {
74
- manifests: Partial<Record<WrapperRole, WrapperManifestReading>>;
75
- pngs: RunStampInputEntry<WrapperRole>[];
76
- };
72
+ type WrapperRole = 'full' | 'head';
73
+ export type { BuildWrapperRole };
74
+ export interface BoundWrapperInputs<Role extends string = WrapperRole> {
75
+ manifests: Partial<Record<Role, WrapperManifestReading>>;
76
+ pngs: RunStampInputEntry<Role>[];
77
+ }
78
+ type AssembleWrapperInputs = BoundWrapperInputs<WrapperRole>;
77
79
 
78
80
  export interface RunStamp {
79
81
  spec: typeof RUN_STAMP_SPEC;
@@ -142,13 +144,15 @@ export function buildAssembleInputs(inputs: RunStampAssembleInputs, outDir: stri
142
144
  ], outDir, inputs.cwd ?? process.cwd(), manifests);
143
145
  }
144
146
 
145
- /** Validate the primary wrappers' consumed files before assemble can publish its outputs. */
146
- export function bindAssembleWrapperInputs(readings: AssembleWrapperReadings): AssembleWrapperInputs | undefined {
147
- const manifests: AssembleWrapperInputs['manifests'] = {};
148
- const pngs: AssembleWrapperInputs['pngs'] = [];
149
- for (const role of ['full', 'head'] as const) {
150
- const reading = readings[role];
151
- if (reading.manifest === undefined) continue;
147
+ function bindWrapperRoleReadings<Role extends string>(
148
+ entries: ReadonlyArray<readonly [Role, WrapperReadings | undefined]>,
149
+ ): BoundWrapperInputs<Role> | undefined {
150
+ const manifests: Partial<Record<Role, WrapperManifestReading>> = {};
151
+ const pngs: RunStampInputEntry<Role>[] = [];
152
+ let anyManifest = false;
153
+ for (const [role, reading] of entries) {
154
+ if (reading?.manifest === undefined) continue;
155
+ anyManifest = true;
152
156
  manifests[role] = reading.manifest;
153
157
  const dir = dirname(reading.manifest.path);
154
158
  const hashes = new Map<string, string>();
@@ -173,7 +177,27 @@ export function bindAssembleWrapperInputs(readings: AssembleWrapperReadings): As
173
177
  }
174
178
  for (const path of [...hashes.keys()].sort()) pngs.push({ role, path, sha256: hashes.get(path)! });
175
179
  }
176
- return manifests.full === undefined && manifests.head === undefined ? undefined : { manifests, pngs };
180
+ return anyManifest ? { manifests, pngs } : undefined;
181
+ }
182
+
183
+ /** Validate the primary wrappers' consumed files before assemble can publish its outputs. */
184
+ export function bindAssembleWrapperInputs(readings: AssembleWrapperReadings): AssembleWrapperInputs | undefined {
185
+ return bindWrapperRoleReadings<WrapperRole>([
186
+ ['full', readings.full],
187
+ ['head', readings.head],
188
+ ]);
189
+ }
190
+
191
+ /** Validate the primary and `--alt` wrappers' consumed files before build's assemble worker publishes its outputs. */
192
+ export function bindBuildWrapperInputs(readings: AssembleWrapperReadings): BoundWrapperInputs<BuildWrapperRole> | undefined {
193
+ const entries: Array<readonly [BuildWrapperRole, WrapperReadings | undefined]> = [
194
+ ['full', readings.full],
195
+ ['head', readings.head],
196
+ ];
197
+ readings.alts?.forEach((alt, i) => {
198
+ entries.push([`alt[${i}].full`, alt.full], [`alt[${i}].head`, alt.head]);
199
+ });
200
+ return bindWrapperRoleReadings(entries);
177
201
  }
178
202
 
179
203
  function sortCodeUnits(paths: readonly string[]): string[] {
@@ -342,7 +366,13 @@ export type BuildRunInputRole = RunStampInputRole | 'requirements' | 'environmen
342
366
 
343
367
  export type RunRecord =
344
368
  | (RunRecordFields & { spec: typeof RUN_RECORD_SPEC; command: 'check'; parts_input?: RunStampFileEntry })
345
- | (RunRecordFields & { spec: typeof BUILD_RUN_RECORD_SPEC; command: 'build'; config: RunStampFileEntry; inputs: RunStampInputEntry<BuildRunInputRole>[] });
369
+ | (RunRecordFields & {
370
+ spec: typeof BUILD_RUN_RECORD_SPEC;
371
+ command: 'build';
372
+ config: RunStampFileEntry;
373
+ inputs: RunStampInputEntry<BuildRunInputRole>[];
374
+ wrapper_pngs?: RunStampInputEntry<BuildRunInputRole>[];
375
+ });
346
376
 
347
377
  /** One command's flags as its parser takes them: the flag-table order, which values are paths, and values that hold paths inside them. */
348
378
  export interface ArgvTable {
@@ -463,7 +493,12 @@ interface BuildRunInputs extends RunStampAssembleInputs {
463
493
 
464
494
  export type RunRecordInput = RunRecordInputFields & (
465
495
  | { command: 'check'; partsInput?: RunStampFileEntry }
466
- | { command: 'build'; configPath: string; inputs: BuildRunInputs }
496
+ | {
497
+ command: 'build';
498
+ configPath: string;
499
+ inputs: BuildRunInputs;
500
+ wrapperPngs?: readonly RunStampInputEntry<BuildRunInputRole>[];
501
+ }
467
502
  );
468
503
 
469
504
  function buildRunInputs(inputs: BuildRunInputs, outDir: string): RunStampInputEntry<BuildRunInputRole>[] {
@@ -513,6 +548,9 @@ export function buildRunRecord(input: RunRecordInput): RunRecord {
513
548
  ...times,
514
549
  config: { path: recordedConfigPath(input.outDir, input.configPath), sha256: sha256OnDisk(input.configPath) },
515
550
  inputs: buildRunInputs(input.inputs, input.outDir),
551
+ ...(input.wrapperPngs === undefined || input.wrapperPngs.length === 0
552
+ ? {}
553
+ : { wrapper_pngs: input.wrapperPngs.map(({ role, path, sha256 }) => ({ role, path, sha256 })) }),
516
554
  ...tail,
517
555
  };
518
556
  }
package/src/scene.ts CHANGED
@@ -2508,7 +2508,7 @@ export function unprefixedNames(rig: RigSpec, motion: MotionSpec, ids: readonly
2508
2508
  name('invariants.axes name', ax.name, false);
2509
2509
  for (const n of [...ax.through, ...ax.bones]) name(`invariants.axes ${ax.name} bone`, n, false);
2510
2510
  }
2511
- for (const [k, v] of Object.entries(motion.easings)) name('easing', k, false);
2511
+ for (const k of Object.keys(motion.easings)) name('easing', k, false);
2512
2512
  for (const [g, members] of Object.entries(motion.groups)) {
2513
2513
  name('group', g, false);
2514
2514
  for (const m of members) name(`group ${g} member`, m, false);
package/src/structure.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { explicitWeightRows, regionBone } from './config.ts';
1
+ import { type ConfigConstraint, CONSTRAINT_FOLLOWS, contourRegionsOf, explicitWeightRows, parseConfig, parseProposalSections, type Point, regionBone, ROOT_BONE, type SkeletonSections, weightsABone } from './config.ts';
2
2
  /**
3
3
  * A structural comparison of two skeletons (issue #85).
4
4
  *
@@ -73,7 +73,6 @@ import { explicitWeightRows, regionBone } from './config.ts';
73
73
  import { existsSync, readFileSync } from 'node:fs';
74
74
  import { CompileError } from '@rig-c/core/errors';
75
75
  import { parseRigSpec, RIG_SPEC_VERSION, type RigBone as RigcBone, type RigSpec as RigcSpec, splitRigSkin } from '@rig-c/core/rig';
76
- import { type ConfigConstraint, CONSTRAINT_FOLLOWS, contourRegionsOf, parseConfig, parseProposalSections, type Point, ROOT_BONE, type SkeletonSections, weightsABone } from './config.ts';
77
76
  import { computeExactFrameTransforms, cropToSpineY, normaliseDegrees, toWorld } from './coords.ts';
78
77
  import { PartsError, type Problem, refuseIfAny } from './errors.ts';
79
78
  import { edgeLength } from './length.ts';
package/src/turn.ts CHANGED
@@ -31,13 +31,12 @@
31
31
  import { boundaryDepthSamplers, type BoundaryDepths } from './boundarydepth.ts';
32
32
  import { computeWorldTransforms, setupToPaintingPoint, toBoneLocalVector, toWorld, type BoneTransform } from './coords.ts';
33
33
  import { extendDepthSilhouette, sampleDepthFloat, type PartDepthReference } from './depthsheets.ts';
34
- import { type Problem, refuseIfAny } from './errors.ts';
34
+ import { PartsError, type Problem, refuseIfAny } from './errors.ts';
35
35
  import type { Raster } from './raster/index.ts';
36
36
  import { pyRound } from './round.ts';
37
37
  import { turnOverlapOwners } from './turnoverlap.ts';
38
38
  import { coupleTurnBand, type CoupledTurnBandReport, type TurnBandDial } from './turnband.ts';
39
39
  import { sampleTurnTriangleField, turnTriangleCoordinates } from './turnfield.ts';
40
- import { PartsError } from './errors.ts';
41
40
  import { f32 } from '@rig-c/core/compile';
42
41
  import { warnUncoveredBodyTurn } from './turncoverage.ts';
43
42
  import { evaluateDeformTransform } from '@rig-c/core/deformgen';
@@ -1982,7 +1981,6 @@ function buildDepth25DTurnGroup(
1982
1981
  const pt = opts.boneLandmarks.get(bName);
1983
1982
  if (pt !== undefined) {
1984
1983
  const { rec, ext, zRef } = primarySurface;
1985
- const padX = Math.floor((ext.width - rec.w) / 2);
1986
1984
  const padY = Math.floor((ext.height - rec.h) / 2);
1987
1985
  const cheekX = pt[0] < rec.x + rec.w / 2 ? 0 : ext.width - 1;
1988
1986
  const cheekY = Math.max(0, Math.min(ext.height - 1, Math.round(pt[1] - rec.y + padY)));
@@ -2,10 +2,11 @@
2
2
  import { spawnSync } from 'node:child_process';
3
3
  import { existsSync, mkdirSync, readFileSync, realpathSync, rmSync, statSync, writeFileSync } from 'node:fs';
4
4
  import { basename, dirname, extname, isAbsolute, join, relative, resolve, sep } from 'node:path';
5
- import { assembleStage, checkStage, rigStage, type AssembleOutputs, type AssembleStageInput, type CheckStageInput, type RigStageInput } from '../src/build.ts';
5
+ import { assembleStage, checkStage, rigStage, type AssembleOutputs, type AssembleStageInput, type BuildWrapperRole, type CheckStageInput, type RigStageInput } from '../src/build.ts';
6
6
  import { rigcRunnerAt, type CheckReport, type RigcRunner } from '../src/check.ts';
7
7
  import type { Mask } from '../src/raster/types.ts';
8
8
  import { PartsError, type Problem } from '../src/errors.ts';
9
+ import { bindBuildWrapperInputs, type RunStampInputEntry } from '../src/runstamp.ts';
9
10
 
10
11
  /** Preserve native/custom executables; adapt only a proven package-manager script shim. */
11
12
  export function selectedRigcCommand(bin: string, platform: NodeJS.Platform = process.platform): { command: string; prefix: string[] } {
@@ -73,7 +74,7 @@ export type BuildProcessJob =
73
74
  function record(value: unknown): value is Record<string, unknown> {
74
75
  return value !== null && typeof value === 'object' && !Array.isArray(value);
75
76
  }
76
- type AssemblyReading = { supportFigure?: Mask };
77
+ type AssemblyReading = { supportFigure?: Mask; wrapperPngs?: RunStampInputEntry<BuildWrapperRole>[] };
77
78
  type StageReading = CheckReport | AssemblyReading | void;
78
79
 
79
80
  /** Private inter-process source observation, never written to build outputs. */
@@ -87,6 +88,26 @@ function decodeSupportFigure(value: unknown): Mask {
87
88
  if (data.length !== value.width * value.height || data.toString('base64') !== value.alpha_base64 || data.some(p => p !== 0 && p !== 1)) throw new Error('BUILD_STAGE_SUPPORT_FIGURE: canonical binary alpha must fill the native grid');
88
89
  return { width: value.width, height: value.height, data };
89
90
  }
91
+ function isBuildWrapperRole(value: unknown): value is BuildWrapperRole {
92
+ return value === 'full' || value === 'head' || (typeof value === 'string' && /^alt\[(?:0|[1-9][0-9]*)\]\.(?:full|head)$/.test(value));
93
+ }
94
+ function decodeWrapperPngs(value: unknown): RunStampInputEntry<BuildWrapperRole>[] {
95
+ if (!Array.isArray(value) || value.length === 0) return resultError('assemble', 'wrapperPngs must be a non-empty array when present');
96
+ return value.map((entry) => {
97
+ if (
98
+ !record(entry) ||
99
+ Object.keys(entry).join(',') !== 'role,path,sha256' ||
100
+ !isBuildWrapperRole(entry.role) ||
101
+ typeof entry.path !== 'string' ||
102
+ entry.path === '' ||
103
+ typeof entry.sha256 !== 'string' ||
104
+ !/^[0-9a-f]{64}$/.test(entry.sha256)
105
+ ) {
106
+ return resultError('assemble', 'wrapperPngs rows must carry valid role, path and sha256');
107
+ }
108
+ return { role: entry.role, path: entry.path, sha256: entry.sha256 };
109
+ });
110
+ }
90
111
  function problems(value: unknown): value is Problem[] {
91
112
  return Array.isArray(value) && value.length > 0 && value.every((p) => record(p) && typeof p.code === 'string' && typeof p.object === 'string' && typeof p.detail === 'string');
92
113
  }
@@ -126,9 +147,18 @@ export function readBuildReceipt(stage: Stage, status: number | null, signal: st
126
147
  if (status !== 0) throw new Error('BUILD_STAGE_CHILD: ' + stage + ' child — exit ' + status + ' with a completion receipt; no later stage ran');
127
148
  if (stage !== 'check') {
128
149
  if (Object.hasOwn(row, 'report') || Object.hasOwn(row, 'sweepSteps')) return resultError(stage, 'a void stage returned an invented check report');
129
- if (stage === 'assemble' && row.supportFigure !== undefined) return { supportFigure: decodeSupportFigure(row.supportFigure) };
130
- if (row.supportFigure !== undefined) return resultError(stage, 'only assembly returns a source observation');
131
- return;
150
+ if (stage !== 'assemble') {
151
+ if (row.supportFigure !== undefined) return resultError(stage, 'only assembly returns a source observation');
152
+ if (row.wrapperPngs !== undefined) return resultError(stage, 'only assembly returns wrapper PNG readings');
153
+ return;
154
+ }
155
+ const supportFigure = row.supportFigure === undefined ? undefined : decodeSupportFigure(row.supportFigure);
156
+ const wrapperPngs = row.wrapperPngs === undefined ? undefined : decodeWrapperPngs(row.wrapperPngs);
157
+ if (supportFigure === undefined && wrapperPngs === undefined) return;
158
+ return {
159
+ ...(supportFigure === undefined ? {} : { supportFigure }),
160
+ ...(wrapperPngs === undefined ? {} : { wrapperPngs }),
161
+ };
132
162
  }
133
163
  if (!checkReport(row.report)) return resultError(stage, 'check report is incomplete');
134
164
  if (row.sweepSteps !== null && (!Array.isArray(row.sweepSteps) || !row.sweepSteps.every((p) =>
@@ -207,10 +237,31 @@ function worker(args: string[]): number {
207
237
  try {
208
238
  let report: CheckReport | undefined;
209
239
  let supportFigure: Mask | undefined;
210
- if (job.stage === 'assemble') supportFigure = assembleStage(job.input, job.outputs, log).supportFigure;
211
- else if (job.stage === 'rig') rigStage(job.input, runner, job.scratch, log);
240
+ let wrapperPngs: RunStampInputEntry<BuildWrapperRole>[] | undefined;
241
+ if (job.stage === 'assemble') {
242
+ supportFigure = assembleStage(
243
+ job.input,
244
+ job.outputs,
245
+ log,
246
+ (readings) => {
247
+ const bound = bindBuildWrapperInputs(readings);
248
+ wrapperPngs = bound !== undefined && bound.pngs.length > 0 ? bound.pngs : undefined;
249
+ },
250
+ ).supportFigure;
251
+ } else if (job.stage === 'rig') rigStage(job.input, runner, job.scratch, log);
212
252
  else report = checkStage(job.input, runner, job.bin, log);
213
- writeFileSync(args[1], report === undefined ? JSON.stringify({ version: 1, stage: job.stage, kind: 'done', ...(supportFigure === undefined ? {} : { supportFigure: encodeSupportFigure(supportFigure) }) }) : encodeCheckReceipt(report));
253
+ writeFileSync(
254
+ args[1],
255
+ report === undefined
256
+ ? JSON.stringify({
257
+ version: 1,
258
+ stage: job.stage,
259
+ kind: 'done',
260
+ ...(supportFigure === undefined ? {} : { supportFigure: encodeSupportFigure(supportFigure) }),
261
+ ...(wrapperPngs === undefined ? {} : { wrapperPngs }),
262
+ })
263
+ : encodeCheckReceipt(report),
264
+ );
214
265
  return 0;
215
266
  } catch (err) {
216
267
  if (!(err instanceof PartsError)) throw err;