spine-parts 2.26.1 → 2.27.1

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
@@ -229,8 +229,8 @@ control skeleton it draws itself — and records the prompts verbatim beside it.
229
229
  wrapper on one image and writes the wrapper form `layers` reads. The host comes
230
230
  from `--host` or `COMFY_HOST` and has no default; before anything is uploaded
231
231
  the graph is checked against the box's `/object_info`, so a missing node class
232
- or model is refused by name, and the adapter waits for an empty queue rather
233
- than queueing behind someone else's job.
232
+ or model is refused by name, and the adapter appends the job behind any other in
233
+ the queue.
234
234
 
235
235
  The painting graph uses `4x-AnimeSharp.pth`, then Lanczos resizing. The
236
236
  [creator's card](https://huggingface.co/Kim2091/AnimeSharp/blob/7696d95ced82b0c1f2a41f6ac73336133f0a90e1/README.md)
package/cli.ts CHANGED
@@ -24,7 +24,8 @@ import { proposeNeck } from './tools/neck-propose.ts';
24
24
  import { parseAltArg } from './tools/alternate-cli.ts';
25
25
  import { type AlternateCliInput, assembleStage, build, checkStage, ERROR_MAP_FILE, loopStage, readRuns, readSource, rigStage, suppliedCheckFlag } from './src/build.ts';
26
26
  import { ACCEPTABLE_BARS, DEFAULT_PACK_SHAPE, DEFAULT_PAGE_EDGES, findRigc, PACK_SHAPES, rigcRunnerAt, type PackShape, PAGE_EDGES, type PageEdges, 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';
27
- import { ComfyClient, resolveHost, runPainting, runSeeThrough } from './src/comfy/index.ts';
27
+ import { ComfyClient, resolveHost, runBackground, runPainting, runSeeThrough } from './src/comfy/index.ts';
28
+ import { DEFAULT_GROW_PX, runForeground } from './src/plate.ts';
28
29
  import { type CharacterConfig, loadClothConfig, loadConfig, loadEarlyConfig, loadPaintConfig } from './src/config.ts';
29
30
  import { configWriteLines, readConfigWriteTarget, separateConfigWriteTarget, stageConfigWrite, type StagedConfigWrite } from './tools/configwrite.ts';
30
31
  import { failLine, guidePointer, PartsError } from './src/errors.ts';
@@ -49,6 +50,7 @@ import { REQUIREMENTS_SENTENCE } from './src/requirements.ts';
49
50
  import { composeStage, IMAGE_SEP, PLATE, PROVENANCES, SCENE_REPORT_FILE, SCENE_REPORT_SPEC, SCENE_SPEC } from './src/scene.ts';
50
51
  import { buildSheet, defaultCaption, type Tile, tilesFrom } from './src/sheet.ts';
51
52
  import { loadComparison, requiredProblems, structureLines } from './src/structure.ts';
53
+ import { assembleOutputFiles, clearRunStamp, readPackageIdentity, rigOutputFiles, RUN_STAMP_FILE, RUN_STAMP_SPEC, writeRunStamp } from './src/runstamp.ts';
52
54
  import { authorLayerLine } from './src/tags.ts';
53
55
 
54
56
  const EXIT_OK = 0;
@@ -411,7 +413,7 @@ usage:
411
413
  through rig-c (profile rig-play, packed with --page-edges and
412
414
  --pack-shape as for check; rigc's build gates the compile and the packed pages on disk) in a
413
415
  scratch directory first, and --out receives images/*.png, rig.json,
414
- motion.json and mesh_report.json only when it is green. Prints one line
416
+ motion.json, mesh_report.json and ${RUN_STAMP_FILE} (spec "${RUN_STAMP_SPEC}") only when it is green. Prints one line
415
417
  per mesh and the rigc gate lines.
416
418
  --idle-keys says where the idle's keys on a bone a mesh is weighted to go:
417
419
  ctl (the default) keys a same-origin <bone>_ctl parent instead, which
@@ -762,9 +764,9 @@ usage:
762
764
  stack by name, ASSEMBLE_PINHOLES, before writing; otherwise prints its SKIP line.
763
765
  Merge the full-body and head-crop See-through runs into rig-space parts:
764
766
  <out>/rig/parts/<name>.png (each cropped to its alpha box), <out>/rig/parts.json,
765
- <out>/render/recomposite_rig.png and <out>/render/${ERROR_MAP_FILE} (the error
767
+ <out>/render/recomposite_rig.png, <out>/render/${ERROR_MAP_FILE} (the error
766
768
  map: uncovered error px red, covered error px blue, the rest the painting in
767
- light grey). Reads config.seethrough.head_box and
769
+ light grey) and <out>/${RUN_STAMP_FILE} (spec "${RUN_STAMP_SPEC}"). Reads config.seethrough.head_box and
768
770
  .resolution and config.assemble.rig_scale, .plan, .extend_below_crop,
769
771
  .patches — extra parts cut from the painting itself over a rig-pixel box
770
772
  (alpha "silhouette": the painting's figure inside it; "box": all of it),
@@ -841,9 +843,11 @@ usage:
841
843
  wrapper installed, and write the wrapper form \`layers\` reads into <out>
842
844
  (absent or empty): layers.json, parts/<tag>.png, meta.json, previews/.
843
845
  The host is --host or COMFY_HOST and has no default. Checks every node and
844
- input against the box's /object_info before uploading, waits for an empty
845
- queue (at most --wait s), polls /history (at most --timeout s), and
846
- writes <out> only after the layer reader accepts what came back.
846
+ input against the box's /object_info before uploading, appends the job
847
+ behind any other (never in front, nothing cancelled; a job still pending
848
+ after --wait s is refused with its queue place), polls /history (at most
849
+ --timeout s), and writes <out> only after the layer reader accepts what
850
+ came back.
847
851
  --lama turns the wrapper's LaMa inpainting on and --nf4 its nf4
848
852
  quantisation; both are off unless given. Resolution, steps, seed and offload
849
853
  use explicit flags first, then --config's seethrough block, then defaults
@@ -864,6 +868,26 @@ usage:
864
868
  is set. The pose words are generation.pose, or the control skeleton's own.
865
869
  The config needs only key and generation here; the rest comes later.
866
870
 
871
+ rig-parts comfy plate --mode background|foreground --painting <png>
872
+ --mask-from seethrough:<dir>|figure-mask:<dir> --out <dir>
873
+ [--graph lama|core] [--model <name>] [--checkpoint-sha256 <hex>]
874
+ [--seed 0] [--grow 8] [--steps 30] [--prompt <text>] [--negative <text>]
875
+ [--host <url>] [--wait 1800] [--timeout 3600] [--poll 3]
876
+ A step-4 plate with a receipt: <out>/plate.png, mask.png and receipt.json
877
+ (spec rig-parts-plate-receipt/1). The mask comes from a source only — the
878
+ figure layers of a See-through run, or the figure_rig.png an assemble with
879
+ config.scene wrote — on the painting's own grid; with none, the command is
880
+ refused and writes nothing. background inpaints the grown mask on a ComfyUI
881
+ box (--graph lama, the default: the inpaint pack's LaMa model, --model
882
+ big-lama.pt unless named; --graph core: the checkpoint --model names, core
883
+ nodes only), checks every node and model against /object_info before
884
+ uploading, appends the job behind any other (never in front, nothing
885
+ cancelled; a job still pending after --wait s is refused with its queue
886
+ place), and pastes the result into the painting inside the mask only.
887
+ --checkpoint-sha256 is required for background and is recorded as declared.
888
+ foreground runs no box: the painting's pixels inside the mask, transparent
889
+ outside.
890
+
867
891
  rig-parts build --config <config.json> --source <painting.png> --full <dir|psd>
868
892
  [--head <dir|psd>] --out <dir> [--seam near-white|silhouette]
869
893
  [--project core|visible] [--page-edges pot|free]
@@ -1147,6 +1171,7 @@ const TAKES = {
1147
1171
  assemble: { valued: ['--source', '--full', '--head', '--config', '--out', '--seam', '--project', '--alt', '--write-config', '--requirements'], switches: ['--propose-plan'] },
1148
1172
  'comfy seethrough': { valued: ['--image', '--out', '--resolution', '--steps', '--seed', '--prefix', '--host', '--wait', '--timeout', '--poll', '--config', '--depth-run'], switches: ['--offload', '--no-offload', '--lama', '--nf4'] },
1149
1173
  'comfy paint': { valued: ['--config', '--out', '--seeds', '--seed0', '--host', '--wait', '--timeout', '--poll'], switches: [] },
1174
+ 'comfy plate': { valued: ['--mode', '--painting', '--mask-from', '--out', '--graph', '--model', '--checkpoint-sha256', '--seed', '--grow', '--steps', '--prompt', '--negative', '--host', '--wait', '--timeout', '--poll'], switches: [] },
1150
1175
  inputs: { valued: ['--source', '--config', '--out'], switches: [] },
1151
1176
  build: { valued: ['--config', '--source', '--full', '--head', '--out', '--seam', '--project', '--page-edges', '--pack-shape', '--requirements', '--idle-keys', '--lead-in', '--alt', '--set', '--environment', '--wind-band'], switches: ['--loop', '--seam-pairs', '--keep-stills', '--all-sets', '--no-extremes'] },
1152
1177
  compose: { valued: ['--scene', '--out', '--requirements', '--accept'], switches: [] },
@@ -1342,6 +1367,7 @@ function cmdRig(args: string[]): number {
1342
1367
  if (!isPageEdges(edges)) return usage(edges);
1343
1368
  const shape = packShapeOf(packShape ?? undefined);
1344
1369
  if (!isPackShape(shape)) return usage(shape);
1370
+ clearRunStamp(out);
1345
1371
  let bin: string;
1346
1372
  try {
1347
1373
  bin = findRigc(import.meta.dir, process.env.PATH ?? '');
@@ -1349,8 +1375,12 @@ function cmdRig(args: string[]): number {
1349
1375
  return printRefusal(err);
1350
1376
  }
1351
1377
  const scratch = mkdtempSync(join(tmpdir(), 'rig-parts-rig-'));
1378
+ const startedAt = new Date().toISOString();
1352
1379
  try {
1353
- rigStage({ config, parts: partsDir, out, idleKeys: keys, pageEdges: edges, packShape: shape }, rigcRunner(bin), scratch, console.log);
1380
+ const pkg = readPackageIdentity(join(import.meta.dir, 'package.json'));
1381
+ const rig = rigStage({ config, parts: partsDir, out, idleKeys: keys, pageEdges: edges, packShape: shape }, rigcRunner(bin), scratch, console.log);
1382
+ const finishedAt = new Date().toISOString();
1383
+ writeRunStamp({ pkg, command: 'rig', startedAt, finishedAt, outDir: out, configPath: config, outputPaths: rigOutputFiles(rig) });
1354
1384
  return EXIT_OK;
1355
1385
  } catch (err) {
1356
1386
  return printRefusal(err);
@@ -1870,11 +1900,16 @@ function cmdAssemble(args: string[]): number {
1870
1900
  return EXIT_OK;
1871
1901
  }
1872
1902
  const out = flags.get('--out') as string;
1873
- assembleStage(
1903
+ clearRunStamp(out);
1904
+ const pkg = readPackageIdentity(join(import.meta.dir, 'package.json'));
1905
+ const startedAt = new Date().toISOString();
1906
+ const result = assembleStage(
1874
1907
  { source, full, head, config, ...(flags.has('--requirements') ? { requirements: flags.get('--requirements') as string } : {}), ...(seam === undefined ? {} : { seam: seam as SeamRule }), ...(project === undefined ? {} : { project: project as ProjectRule }), ...(alts.length === 0 ? {} : { alts }) },
1875
1908
  { partsJson: join(out, 'rig', 'parts.json'), partsDir: join(out, 'rig', 'parts'), recomposite: join(out, 'render', 'recomposite_rig.png'), errorMap: join(out, 'render', ERROR_MAP_FILE) },
1876
1909
  console.log,
1877
1910
  );
1911
+ const finishedAt = new Date().toISOString();
1912
+ writeRunStamp({ pkg, command: 'assemble', startedAt, finishedAt, outDir: out, configPath: config, outputPaths: assembleOutputFiles(out, result) });
1878
1913
  return EXIT_OK;
1879
1914
  } catch (err) {
1880
1915
  if (staged !== null) {
@@ -1887,7 +1922,7 @@ function cmdAssemble(args: string[]): number {
1887
1922
  }
1888
1923
 
1889
1924
  /** Parse `--flag value` pairs and bare `--switch`es, as the command's {@link TAKES} row names them; a string is a usage error. */
1890
- function comfyFlags(args: string[], command: 'comfy seethrough' | 'comfy paint'): { v: Map<string, string>; on: Set<string> } | string {
1925
+ function comfyFlags(args: string[], command: 'comfy seethrough' | 'comfy paint' | 'comfy plate'): { v: Map<string, string>; on: Set<string> } | string {
1891
1926
  const switches: readonly string[] = TAKES[command].switches;
1892
1927
  const v = new Map<string, string>();
1893
1928
  const on = new Set<string>();
@@ -1923,11 +1958,57 @@ function secondsFlag(v: Map<string, string>, flag: string, fallback: number): nu
1923
1958
  return Number.isFinite(n) && n > 0 ? n : `${flag} ${raw} is not a number of seconds above 0`;
1924
1959
  }
1925
1960
 
1961
+ /** Flags `comfy plate --mode foreground` does not take: it runs no box and no model. */
1962
+ const PLATE_BOX_FLAGS = ['--graph', '--model', '--checkpoint-sha256', '--seed', '--grow', '--steps', '--prompt', '--negative', '--host', '--wait', '--timeout', '--poll'];
1963
+
1964
+ async function cmdComfyPlate(v: Map<string, string>): Promise<number> {
1965
+ const mode = v.get('--mode');
1966
+ if (mode !== 'background' && mode !== 'foreground') return usage(`comfy plate needs --mode background or --mode foreground${mode === undefined ? '' : `; got "${mode}"`}`);
1967
+ const painting = v.get('--painting');
1968
+ if (painting === undefined) return usage('comfy plate needs --painting <png>');
1969
+ const out = v.get('--out');
1970
+ if (out === undefined) return usage('comfy plate needs --out <dir>');
1971
+ try {
1972
+ if (mode === 'foreground') {
1973
+ const extra = PLATE_BOX_FLAGS.filter((x) => v.has(x));
1974
+ if (extra.length > 0) return usage(`comfy plate --mode foreground runs no box and no model; ${extra.join(', ')} ${extra.length === 1 ? 'is' : 'are'} for --mode background`);
1975
+ console.log(`rig-parts comfy plate: foreground ${painting} -> ${out}`);
1976
+ const r = runForeground({ painting, maskFrom: v.get('--mask-from'), out });
1977
+ console.log(` mask from ${r.mask.source} ${r.mask.from}; no box, no model (graph ${r.graph})`);
1978
+ console.log(` wrote ${join(out, r.output.path)} (sha256 ${r.output.sha256}), ${r.mask.path} and receipt.json`);
1979
+ return EXIT_OK;
1980
+ }
1981
+ const graph = v.get('--graph') ?? 'lama';
1982
+ if (graph !== 'lama' && graph !== 'core') return usage(`--graph ${graph} is not lama or core`);
1983
+ const wait = secondsFlag(v, '--wait', 1800);
1984
+ const timeout = secondsFlag(v, '--timeout', 3600);
1985
+ const poll = secondsFlag(v, '--poll', 3);
1986
+ for (const x of [wait, timeout, poll]) if (typeof x === 'string') return usage(x);
1987
+ const seed = intFlag(v, '--seed', 0, 0);
1988
+ const grow = intFlag(v, '--grow', DEFAULT_GROW_PX, 0);
1989
+ const steps = intFlag(v, '--steps', 30, 1);
1990
+ for (const x of [seed, grow, steps]) if (typeof x === 'string') return usage(x);
1991
+ if (graph === 'lama') for (const x of ['--steps', '--prompt', '--negative']) if (v.has(x)) return usage(`${x} is for --graph core; the lama graph takes no prompt and no steps`);
1992
+ console.log(`rig-parts comfy plate: background (${graph}) ${painting} -> ${out}`);
1993
+ // Every local refusal (no source mask, the checksum, the grid) comes before the host is resolved.
1994
+ const r = await runBackground(
1995
+ () => new ComfyClient(resolveHost(v.get('--host'), process.env.COMFY_HOST), { poll: poll as number, request: 30 }),
1996
+ { painting, maskFrom: v.get('--mask-from'), out, graph, model: v.get('--model'), checkpointSha256: v.get('--checkpoint-sha256'), seed: seed as number, growPx: grow as number, steps: steps as number, prompt: v.get('--prompt'), negative: v.get('--negative'), wait: wait as number, timeout: timeout as number },
1997
+ (l) => console.log(l),
1998
+ );
1999
+ console.log(` wrote ${join(out, r.output.path)} (sha256 ${r.output.sha256}), ${r.mask.path} and receipt.json; model ${r.model?.name} (checkpoint sha256 declared), GPU ${r.gpu}`);
2000
+ return EXIT_OK;
2001
+ } catch (err) {
2002
+ return printRefusal(err);
2003
+ }
2004
+ }
2005
+
1926
2006
  async function cmdComfy(args: string[]): Promise<number> {
1927
2007
  const [sub, ...rest] = args;
1928
- if (sub !== 'seethrough' && sub !== 'paint') return usage(`comfy takes seethrough or paint; got ${sub === undefined ? 'nothing' : `"${sub}"`}`);
2008
+ if (sub !== 'seethrough' && sub !== 'paint' && sub !== 'plate') return usage(`comfy takes seethrough, paint or plate; got ${sub === undefined ? 'nothing' : `"${sub}"`}`);
1929
2009
  const f = comfyFlags(rest, `comfy ${sub}`);
1930
2010
  if (typeof f === 'string') return usage(f);
2011
+ if (sub === 'plate') return cmdComfyPlate(f.v);
1931
2012
  const { v, on } = f;
1932
2013
  if (on.has('--offload') && on.has('--no-offload')) return usage('--offload and --no-offload cannot be combined');
1933
2014
  const wait = secondsFlag(v, '--wait', 1800);
package/docs/AUTHORING.md CHANGED
@@ -4207,7 +4207,7 @@ existing hardlinks are refused before artifact output; the ordinary mode names
4207
4207
  | `layers <dir \| layers.json \| file.psd>` | keep the existing columns (`opaque_px` still means alpha >8) and append source-alpha boxes `drawn(a>8)` / `opaque(a>=250)` with exclusive right/bottom; name absent boxes, report the existing body-group union height at **CORE_ALPHA (>=250)** in **input-canvas px**, and show its >8 union separately; no anatomical height, ownership/erosion or painting registration is inferred ([units and rig-scale guidance](AUTHORING.md#4-the-command-order)) |
4208
4208
  | `sheet --source <png> --layers <path>… --out <png>` | a labelled contact sheet of the painting and every layer or part |
4209
4209
  | `assemble --propose-plan … [--write-config <config>]` | propose `assemble.plan` and `extend_below_crop` from the two runs, leaving out an implausible layer with a note naming the rule, naming in a note any full-run body no planned part covers, and naming every layer no row takes with why (empty, taken from the other run only, a plausibility rule; `nose`, never planned, with the row that lets `propose` read the head's pitch). Front/back hair reaching more than 8 rig pixels beyond a side or top edge receives explicit `edges`; each explicit edge has the same strict reach bar. The legacy bottom entry is retained unchanged; qualifying side/top edges receive a separate entry without bottom. With no qualifying side/top edge, the proposal remains unchanged. |
4210
- | `assemble --source --full --head --config --out [--seam] [--project]` | merge the two runs into rig-space parts, `parts.json`, the recomposite and its error map, and list the uncovered holes |
4210
+ | `assemble --source --full --head --config --out [--seam] [--project]` | merge the two runs into rig-space parts, `parts.json`, the recomposite and its error map, and `run.json` (`spec` `rig-run/1`), and list the uncovered holes |
4211
4211
  | `head-crop-preflight --full <run> --canvas WxH --head-box '[left,top,right,bottom]'` | before the head run: JSON on stdout, one advice line per hit tag on stderr, exit 0 even when clipped. Counts original alpha > 8 full-run samples after centre registration through the square pad into painting coordinates: centres below left/top or at/above right/bottom are outside. Fractional boxes are accepted; corner samples count on both edges. No ghost cleanup, resampling, head run or assemble is needed. These counts cannot be compared with `ASSEMBLE_CROP_CLIPPED`, which counts rig pixels at alpha >= 128 after `cleanGhosts`. Preflight reads original samples before the head run exists, so soft fringes and ghost specks can be hits only here. Bottom is distinct because `extend_below_crop` handles it. Zero-hit tags remain in JSON. Existing pipeline outputs stay unchanged; help adds this command and guide reflects these documentation edits. |
4212
4212
  | `propose --head-box --full <run> --canvas WxH [--no-back-hair] [--write-config <config>]` | propose `seethrough.head_box` from the full run, held inside the painting; `--no-back-hair` leaves the back-hair layer out of that proposal |
4213
4213
  | `propose --parts --source --out [--compare <config>] [--write-config <config> [--only-missing]]` | propose bones, meshes, regions and an idle; draw the overlay; print, per bone, which check read it or that none did and why (its role, its kind of segment), and write `basis.json` beside the proposal — what each bone rests on (a joint, a part's mask, a ratio, other bones) and, with `--compare`, whether the config's bone differs |
@@ -4216,7 +4216,7 @@ existing hardlinks are refused before artifact output; the ordinary mode names
4216
4216
  | `propose … --grid-rule figure\|part` | how each drafted lattice's spacing is chosen: `figure` (the default) one spacing for the figure, round(H / 37) rig px, a part already coarser keeping its own, with a note on its calibration and cost; `part` the reference's rule, a tenth of the part's short side (the oracle examples are proposed under it) |
4217
4217
  | `propose --parts --source --out --from-config <config> [--keypoints <file> [--person <id>]]` | draw and LINT the config's current bones (by the joints too, given `--keypoints`); proposes nothing, so takes only these flags (not `--full`, `--head`, `--cloth`, `--write-config`, `--wrist-snap`, `--grid-rule`, `--only-missing` or `--compare`) |
4218
4218
  | `compare --left <file> --right <file> [--map <bonemap.json>]` | compare two skeletons — a config, a proposal or a `rig.json` — bone by bone: origin, parent, tip, length and direction per pair, the bones neither side pairs, the required ones missing, and each side's roles read off the spec; no frame is guessed, and nothing pairs by resemblance (`propose --compare` reads origins only) |
4219
- | `rig --config --parts --out [--idle-keys ctl\|direct]` | author `rig.json` + `motion.json`, written only after rig-c's gate is green; each mesh is in the mode its config entry names — `grid` (the lattice, what `propose` writes), `contour` (the traced outline with declared interior points) or `auto` (the contour mesh at alpha 1 and above, reduced and locally refined by rig-c's `reduceMesh` under the author's declared bounds, written only when its motion against the unreduced source on the idle passes the author's `motion` bounds through rig-c's `compareMeshesInMotion`; [AUTHORING §3](AUTHORING.md)); every chain link is turned along its chain and carries its `length`, so a physics constraint added later has a lever, with every offset under it in the turned frame so nothing moves; `--idle-keys` says whether the idle's keys on mesh-driving bones go through `<bone>_ctl` parents (default) or stay on the bones with `invariants.idleDrivesMeshes` declared; the config's `constraints` go to rigc as written, and a two-bone ik over keyed links needs `--idle-keys direct` (on `rig` or `build`) |
4219
+ | `rig --config --parts --out [--idle-keys ctl\|direct]` | author `rig.json` + `motion.json` (plus `mesh_report.json` and `run.json`, `spec` `rig-run/1`), written only after rig-c's gate is green; each mesh is in the mode its config entry names — `grid` (the lattice, what `propose` writes), `contour` (the traced outline with declared interior points) or `auto` (the contour mesh at alpha 1 and above, reduced and locally refined by rig-c's `reduceMesh` under the author's declared bounds, written only when its motion against the unreduced source on the idle passes the author's `motion` bounds through rig-c's `compareMeshesInMotion`; [AUTHORING §3](AUTHORING.md)); every chain link is turned along its chain and carries its `length`, so a physics constraint added later has a lever, with every offset under it in the turned frame so nothing moves; `--idle-keys` says whether the idle's keys on mesh-driving bones go through `<bone>_ctl` parents (default) or stay on the bones with `invariants.idleDrivesMeshes` declared; the config's `constraints` go to rigc as written, and a two-bone ik over keyed links needs `--idle-keys direct` (on `rig` or `build`) |
4220
4220
  | `check --rig --out [--parts] [--source] [--requirements]` | build packed, gated under `rig-play`, render the idle, measure seam, loop and the six judgement lines (mesh texture stretch among them, from the idle's `render --geometry`), and report the recomposite's holes from `parts.json`; on a rig spec with no `parts.json` or no `idle` (a merged rig, issue #77) the gate still runs and every line that needs the missing input says SKIP by name; `--source <painting.png>` adds `SETUP_POSE_VS_SOURCE`, the setup pose against the painting by assemble's recomposite figures; `--requirements <scene.json>` measures what a scene declares of the motion — a contact, a follow fraction, an aim, a joint range, a mesh's stretch, the seam between two parts over the motion — each against the author's own bar, from rig-c's posed frames, one line each, PASS, FAIL or NOT MEASURABLE (AUTHORING §7, *Declared requirements*) |
4221
4221
  | `loop --frames <dir> --out <file.gif \| file.png> [--palette]` | encode a rendered idle as a looping GIF, lossless APNG, or indexed APNG (`--palette`) |
4222
4222
  | `build --config --source --full --head --out [--seam] [--project] [--loop] [--lead-in <periods>] [--requirements] [--seam-pairs] [--keep-stills] [--idle-keys ctl\|direct]` | assemble, rig and check in one process, stopping at the first refusal; `--requirements`, `--seam-pairs` and `--keep-stills` are forwarded to check, `--idle-keys` to rig; `--lead-in` (with `--loop`) encodes the loop from the last of n + 1 idle periods played back to back, for a rig whose physics does not end where the render starts it |
@@ -5312,7 +5312,7 @@ says why each requirement exists and what breaks without it.
5312
5312
  | <a id="PAINTING_HANDS_APART"></a>`PAINTING_HANDS_APART` | under `--form standee`, the line between the two wrists crosses no background: hands clasped or touching (`SKIP` under `--form illustration`) | a painting with the hands apart and open (PAINTING.md, *Hands*) |
5313
5313
  | <a id="PAINTING_LEGS_APART"></a>`PAINTING_LEGS_APART` | under `--form standee`, the line between the knees, or between the ankles, crosses no background: the legs are one column there (a long skirt over the knees is refused here too; `SKIP` under `--form illustration`) | a painting with the legs apart and a visible gap at the knees and the ankles (PAINTING.md, *Legs*) |
5314
5314
 
5315
- ### The optional ComfyUI adapter (`comfy paint`, `comfy seethrough`)
5315
+ ### The optional ComfyUI adapter (`comfy paint`, `comfy seethrough`, `comfy plate`)
5316
5316
 
5317
5317
  `rig-parts comfy seethrough --image <png> --out <dir> --host <url> --config <config.json>`
5318
5318
  reads `seethrough.resolution`, `.steps`, `.seed` and `.offload` through the early
@@ -5330,12 +5330,60 @@ those settings. Changing a config seed alone cannot change a no-config run.
5330
5330
  | --- | --- | --- |
5331
5331
  | <a id="COMFY_HOST_GIVEN"></a><a id="COMFY_REACHABLE"></a><a id="COMFY_REQUEST_OK"></a>`COMFY_HOST_GIVEN`, `COMFY_REACHABLE`, `COMFY_REQUEST_OK` | no `--host`/`COMFY_HOST`, nothing answering there, or a non-200 answer | the host, or the box |
5332
5332
  | <a id="COMFY_NODE_PRESENT"></a><a id="COMFY_INPUT_KNOWN"></a><a id="COMFY_INPUT_SET"></a><a id="COMFY_CHOICE_PRESENT"></a>`COMFY_NODE_PRESENT`, `COMFY_INPUT_KNOWN`, `COMFY_INPUT_SET`, `COMFY_CHOICE_PRESENT` | the box's `/object_info` lacks a node class the graph uses, an input it sets, an input it must set, or a model file it names | install the node or model on the box, or the config value naming it |
5333
- | <a id="COMFY_QUEUE_EMPTY"></a><a id="COMFY_PROMPT_ACCEPTED"></a><a id="COMFY_HISTORY_WITHIN"></a><a id="COMFY_RUN_OK"></a>`COMFY_QUEUE_EMPTY`, `COMFY_PROMPT_ACCEPTED`, `COMFY_HISTORY_WITHIN`, `COMFY_RUN_OK` | someone else's job kept the queue busy past `--wait`, the box rejected the graph, the job did not finish within `--timeout`, or it ended in error (quoted) | `--wait`/`--timeout`, or what the quoted error names |
5333
+ | <a id="COMFY_QUEUE_BEHIND"></a><a id="COMFY_PROMPT_ACCEPTED"></a><a id="COMFY_HISTORY_WITHIN"></a><a id="COMFY_RUN_OK"></a>`COMFY_QUEUE_BEHIND`, `COMFY_PROMPT_ACCEPTED`, `COMFY_HISTORY_WITHIN`, `COMFY_RUN_OK` | the job was still pending after `--wait` (its queue place is named; it is left on the box), the box rejected the graph, the job did not finish within `--timeout`, or it ended in error (quoted) | `--wait`/`--timeout`, or what the quoted error names |
5334
5334
  | <a id="COMFY_HISTORY_OUTPUTS"></a><a id="COMFY_VIEW_PRESENT"></a><a id="COMFY_MANIFEST_NAMED"></a><a id="COMFY_MANIFEST_IS_THIS_RUN"></a><a id="COMFY_LAYER_NAME"></a>`COMFY_HISTORY_OUTPUTS`, `COMFY_VIEW_PRESENT`, `COMFY_MANIFEST_NAMED`, `COMFY_MANIFEST_IS_THIS_RUN`, `COMFY_LAYER_NAME` | the job's outputs are missing, unreadable, belong to another run, or name a layer that is not a plain file name | the wrapper's version on the box; report it |
5335
5335
  | <a id="COMFY_IMAGE_PRESENT"></a><a id="COMFY_OUT_EMPTY"></a><a id="COMFY_OUT_FREE"></a>`COMFY_IMAGE_PRESENT`, `COMFY_OUT_EMPTY`, `COMFY_OUT_FREE` | no `--image`, an `--out` that already holds files, or a seed whose painting is already on disk | `--image`, `--out`, `--seed0` |
5336
5336
  | <a id="COMFY_PAINTING_SIZE"></a>`COMFY_PAINTING_SIZE` | the painting `comfy paint` got back is not twice the latent (a config with no `generation` block is `CONFIG_FIELD_PRESENT`, §6 *The config*) | `config.generation` |
5337
5337
  | <a id="CONFIG_POSE_CANVAS"></a><a id="CONFIG_POSE_KEYPOINTS"></a><a id="CONFIG_POSE_IN_CANVAS"></a>`CONFIG_POSE_CANVAS`, `CONFIG_POSE_KEYPOINTS`, `CONFIG_POSE_IN_CANVAS` | the pose file `generation.control.skeleton` names states another canvas than `generation.latent`, holds other than the 18 body-18 keypoints, or puts one off its canvas | the pose file (§3, the `generation.control.skeleton` row) |
5338
5338
 
5339
+
5340
+ #### Step-4 plates (`comfy plate`, issue #1183)
5341
+
5342
+ `rig-parts comfy plate --mode background|foreground --painting <png>
5343
+ --mask-from seethrough:<dir>|figure-mask:<dir> --out <dir>` makes the two plates
5344
+ a full-screen scene needs: the background with the figure removed, and a
5345
+ foreground matte with alpha. Only these two. It never makes a character part
5346
+ or a joint.
5347
+
5348
+ - **The mask comes from a source.** `seethrough:<dir>` is a See-through run in
5349
+ the wrapper form, and the figure is every drawn layer's alpha above 8 on the
5350
+ run's canvas. `figure-mask:<dir>` is an assemble output whose `parts.json`
5351
+ declares a `scene`, and the figure is its `figure_rig.png`. The mask is never
5352
+ fitted: a source grid that is not the painting's size is refused. With no
5353
+ source the command refuses by name, writes nothing and reaches no box.
5354
+ - **background** grows the mask by `--grow` px (a square, default 8) and
5355
+ inpaints it on a ComfyUI box. `--graph lama` (the default) uses the
5356
+ comfyui-inpaint-nodes pack and its LaMa model (`--model`, default
5357
+ `big-lama.pt`). `--graph core` uses ComfyUI's own nodes and the checkpoint
5358
+ `--model` names, with `--steps`, `--prompt` and `--negative`; it needs a
5359
+ painting whose sides are multiples of 8. Every node, input and model of the
5360
+ graph is checked against the box's `/object_info` before anything is
5361
+ uploaded, so a box without the pack refuses `lama` and still runs `core`. The
5362
+ job is appended behind any other job: never put in front, nothing reordered,
5363
+ nothing cancelled. A job still pending after `--wait` seconds is refused with
5364
+ its place in the queue and left there. The box's image is pasted into the
5365
+ painting inside the mask only, so every pixel outside it is the painting's,
5366
+ byte for byte. `--checkpoint-sha256` (64 hex characters) is required: the box
5367
+ does not report a hash, so the receipt records the value **as declared, not
5368
+ measured**.
5369
+ - **foreground** runs no box and no model. The plate is the painting's pixels
5370
+ inside the mask, transparent zero outside.
5371
+
5372
+ `<out>` holds `plate.png`, `mask.png` (the mask actually used: opaque white
5373
+ inside, opaque black outside) and `receipt.json`, spec
5374
+ `rig-parts-plate-receipt/1` ([STABILITY](STABILITY.md#plate-receipt)). A receipted
5375
+ plate pass from this command is a recorded source step, not a repair.
5376
+
5377
+ | rule | means | change |
5378
+ | --- | --- | --- |
5379
+ | <a id="PLATE_MASK_SOURCE"></a><a id="PLATE_MASK_GRID"></a><a id="PLATE_MASK_VALUES"></a><a id="PLATE_MASK_EMPTY"></a>`PLATE_MASK_SOURCE`, `PLATE_MASK_GRID`, `PLATE_MASK_VALUES`, `PLATE_MASK_EMPTY` | no `--mask-from`, or a source directory holding no See-through run or no scene figure mask; a source on another grid than the painting; a `figure_rig.png` holding other than opaque white and black; a mask with no figure pixel | run `comfy seethrough` on the painting, or `assemble` with `config.scene`, at the painting's own size |
5380
+ | <a id="PLATE_MASK_RUN"></a>`PLATE_MASK_RUN` | the figure source has no readable `rig-run/1` assemble `run.json`, or its `figure_rig.png`, `parts.json` or declared `painting_in_rig.png` lacks exactly one matching output hash | re-run `assemble` with the source config to regenerate `run.json` and its `rig/` files together |
5381
+ | <a id="PLATE_MASK_PAINTING"></a>`PLATE_MASK_PAINTING` | `parts.json` has an invalid `painting_in_rig` declaration, its recorded painting is missing, undecodable or differs from its declared hash, or the supplied painting differs from the recorded opaque RGB | use the original `--painting` file for this source, or re-run `assemble` to regenerate `parts.json` and `painting_in_rig.png` together |
5382
+ | <a id="PLATE_CHECKPOINT_SHA256"></a><a id="PLATE_MODEL_GIVEN"></a><a id="PLATE_CORE_GRID"></a>`PLATE_CHECKPOINT_SHA256`, `PLATE_MODEL_GIVEN`, `PLATE_CORE_GRID` | `--checkpoint-sha256` absent or not 64 hex characters; `--graph core` without `--model`; a painting off the multiple-of-8 grid under `--graph core` | the flag, or `--graph lama` |
5383
+ | <a id="PLATE_PAINTING_PRESENT"></a><a id="PLATE_OUT_EMPTY"></a>`PLATE_PAINTING_PRESENT`, `PLATE_OUT_EMPTY` | no `--painting` file, or an `--out` that already holds entries | `--painting`, `--out` |
5384
+ | <a id="COMFY_GPU_NAMED"></a><a id="COMFY_PLATE_SIZE"></a>`COMFY_GPU_NAMED`, `COMFY_PLATE_SIZE` | `/system_stats` does not name exactly one device; the box's image is not the painting's size | the box |
5385
+ | <a id="PLATE_RECEIPT_READ"></a><a id="PLATE_RECEIPT_SPEC"></a><a id="PLATE_RECEIPT_KEYS"></a><a id="PLATE_RECEIPT_FILE"></a><a id="PLATE_RECEIPT_HASH"></a>`PLATE_RECEIPT_READ`, `PLATE_RECEIPT_SPEC`, `PLATE_RECEIPT_KEYS`, `PLATE_RECEIPT_FILE`, `PLATE_RECEIPT_HASH` | the receipt read back before it is published is not JSON, not this spec, not in its key order, names a file that is gone, or records a sha256 that is not the file's | nothing to change by hand: the run is refused and `<out>` is not written |
5386
+
5339
5387
  ### assemble
5340
5388
 
5341
5389
  | rule | means | change |
@@ -6770,7 +6818,8 @@ What is composed:
6770
6818
  the px its own `build` measured.
6771
6819
  - **`scene.json`** (`spine-parts-scene-report/1`): the scene file's path as given,
6772
6820
  the canvas, the rig's name (the ids joined by `+`), the pack flags, the plate (its
6773
- image, provenance, note, bone, slot, size, `judged_by: "nothing"`), per character
6821
+ image, provenance, note, bone, slot, size, `sha256` of the PNG's bytes as compose read them — issue #1183, additive —
6822
+ and `judged_by: "nothing"`), per character
6774
6823
  its build, offset, `scale` (only when it is not 1), `rig_size`, `rig_scale`, placed bounds (the union of its part
6775
6824
  boxes, canvas px), shift and what it moved (`shifted`: the first-level bones, the
6776
6825
  regions on `root`, the count of weights bound to `root`), its counts and `accepted`
@@ -8099,6 +8148,7 @@ they do not certify a new toolchain, input or packaging build. No tuning to meet
8099
8148
  | <a id="CONFIG_WAIST_NAME_FREE"></a>`CONFIG_WAIST_NAME_FREE` | The generated bone name already exists; declare an unused name | declare an unused name |
8100
8149
  | <a id="RIG_WAIST_DECLARATION"></a>`RIG_WAIST_DECLARATION` | Actual provenance, pair bindings or drawing ownership do not match the bounded declaration; supply the declared base two-bone mesh/rigid-region pair | supply the declared base pair |
8101
8150
  | <a id="RIG_WAIST_MOTION"></a>`RIG_WAIST_MOTION` | Imported tracks drive the generated waist frame; retain their original authored targets | retain the original authored targets |
8151
+ | <a id="RUN_STAMP_PACKAGE"></a>`RUN_STAMP_PACKAGE` | `package.json` is missing, malformed or lacks a non-empty string `name` or `version` needed for `run.json` (`spec` `rig-run/1`) | restore valid `name` and `version` strings in `package.json` |
8102
8152
 
8103
8153
  ### Depth-driven rigging
8104
8154
 
package/docs/PAINTING.md CHANGED
@@ -407,6 +407,8 @@ To paint one without the character drifting, repaint only the limb:
407
407
  hand); the rest of that run is discarded. The base rig's other parts stay the
408
408
  base painting's.
409
409
 
410
- `comfy paint` does not run an inpainting graph; the demo's hand-detailer pass is
411
- the same idea at hand scale (a masked repaint on the same checkpoint, recorded
412
- beside its painting in rig-c/examples).
410
+ `comfy paint` does not run an inpainting graph, and neither does `comfy plate`
411
+ for this step: `comfy plate` inpaints only a step-4 background plate (the figure
412
+ removed) over a source mask, never a limb or a part. The demo's hand-detailer
413
+ pass is the same idea at hand scale (a masked repaint on the same checkpoint,
414
+ recorded beside its painting in rig-c/examples).
package/docs/STABILITY.md CHANGED
@@ -213,6 +213,7 @@ defaults are the help's too, and none is guessed from the art.
213
213
  | `sheet` | `--source`, `--layers` (repeatable), `--out`; optional `--cell`, `--cols` |
214
214
  | `inputs` | `--source`, `--config`, `--out` |
215
215
  | `comfy` | `paint`: `--config`, `--out`; optional `--seeds`, `--seed0`, `--host`, `--wait`, `--timeout`, `--poll` |
216
+ | `comfy` | `plate`: `--mode` (`background` or `foreground`), `--painting`, `--mask-from` (`seethrough:<dir>` or `figure-mask:<dir>`), `--out`; with `--mode background` also `--checkpoint-sha256` (required) and optional `--graph` (`lama` or `core`), `--model` (required with `core`), `--seed`, `--grow`, `--steps`, `--prompt`, `--negative` (the last three with `core` only), `--host`, `--wait`, `--timeout`, `--poll` (issue #1183, additive) |
216
217
  | `comfy` | `seethrough`: `--image`, `--out`; optional `--resolution`, `--steps`, `--seed`, `--prefix`, `--offload`, `--no-offload`, `--lama`, `--nf4`, `--host`, `--wait`, `--timeout`, `--poll`, `--config` (See-through settings and optional depth block), `--depth-run` (`full` or `head`, required with the block) |
217
218
  | `assemble` | `--propose-plan` with `--source`, `--full`, `--config`, optional `--head`, `--write-config` (must name `--config` itself, issue #356); or `--source`, `--full`, `--config`, `--out`, optional `--head` (without it, one run: issue #359), `--seam` (near-white, silhouette), `--project` (core, visible), `--alt` (repeatable `<name>=<source>:<full>[:<head>]`, issue #454), `--requirements` (source-bound cut-material evidence only when the file declares `cut_material`, issue #888) |
218
219
  | `head-crop-preflight` | `--full`, `--canvas`, `--head-box` (JSON coordinate array); read-only advice before the head run, original alpha > 8 samples (issue #1082) |
@@ -432,6 +433,28 @@ Empty readings remain explicit.
432
433
  The report measures direct cover before projection and downstream processing.
433
434
  The field semantics are documented in AUTHORING's source projection cover entry.
434
435
 
436
+ ### Plate receipt
437
+
438
+ `comfy plate` (issue #1183) writes `receipt.json` beside `plate.png` and
439
+ `mask.png`, spec `rig-parts-plate-receipt/1`. Its keys, their order and their
440
+ meaning do not change within the spec; a key added, removed or redefined is a
441
+ new spec version. Every path in it is relative to the receipt's directory.
442
+
443
+ | key | meaning |
444
+ | --- | --- |
445
+ | `spec` | `"rig-parts-plate-receipt/1"` |
446
+ | `mode` | `"background"` or `"foreground"` |
447
+ | `painting` | `{ path, sha256 }` of the painting read |
448
+ | `mask` | `{ source, from, path, sha256 }`: `source` is `"seethrough"` or `"figure-mask"`, `from` the source directory, `path` the mask actually used (`mask.png`, opaque white inside) |
449
+ | `model` | `{ name, checkpoint_sha256, checkpoint_sha256_from }`, or null for `foreground`. `checkpoint_sha256` is the `--checkpoint-sha256` value, lower-cased; `checkpoint_sha256_from` is `"declared"`: the box reports no hash, so this field is **declared, not measured** |
450
+ | `params` | every parameter of the run, the seed included, in a fixed order per graph: `lama` — `seed`, `grow_px`, `mask_alpha_above`; `core` — `seed`, `grow_px`, `steps`, `cfg`, `sampler`, `scheduler`, `denoise`, `prompt`, `negative`, `mask_alpha_above`; `foreground` — `mask_alpha_above` |
451
+ | `graph` | `"rig-parts/plate-background-lama/1"`, `"rig-parts/plate-background-core/1"`, or the fixed local id `"rig-parts/plate-foreground/1"` |
452
+ | `gpu` | the device `/system_stats` names (the same seed gives other pixels on another GPU), or null for `foreground` |
453
+ | `output` | `{ path, sha256 }` of `plate.png` |
454
+
455
+ The receipt is read back against the bytes on disk before `<out>` is published;
456
+ a hash that is not its file's refuses the run.
457
+
435
458
  ### Head-crop preflight stdout
436
459
 
437
460
  `head-crop-preflight` writes one JSON object followed by a newline on success,
@@ -488,8 +511,9 @@ resolution before resizing; it can differ for non-opaque paintings.
488
511
  | `rig.json`, `motion.json`, `mesh_report.json`, `images/`, `remesh.json` | `remesh` | the input revision's files, `rig.json` and `mesh_report.json` with the part's attachment and row replaced (under `--delta` the row is the input's with its counts, `bones` and influences recomputed and `mode` "delta"), every other file byte for byte; `remesh.json` is spec `rig-parts-remesh/1`: `request` (`part`, `mesh`, `mesh_sha256`, `idle_keys`, `page_edges`, `pack_shape`; under `--delta`, issue #526: `part`, `delta` — the mesh edit as read — `delta_sha256`, `ops`, `applied` — `moved`, `added`, `removed`, `constrained` — `idle_keys`, `page_edges`, `pack_shape`), `versions` (`parts`, `rigc`), `input` (`rig` — `path`, `bytes`, `sha256` per file — `config_sha256`, `parts_json_sha256`), `baseline` (`reproduced`, `not_compared`; under `--delta` `reproduced` holds one sentence: no config is built, the input is the baseline), `target` (`before`, `after`: `vertices`, `triangles`, `hull`), `preserved` (`identical`, `spliced`), `revision` (per file as `input.rig`), `check` (`input`, `revision`: `pass`, `measured`, `not_met`, `skipped`, `physics`, then `line` and `status` — issue #541, additive, the spec stays `rig-parts-remesh/1`: `line` is the last line `check` prints on that tree, byte for byte, and `status` every block's status as that tree's `check.json` records it, by name in the file's order — `gate`, `loop` and `seam` read from their figures, every other block its own `status`, a block the file does not write absent; `scope`) |
489
512
  | `rig.json`, `motion.json`, `mesh_report.json`, `images/`, `retune.json` | `retune` | the input revision's files, `rig.json` with `constraints` and `invariants.detached` replaced and `motion.json` with `animations.idle` replaced by the config's build, every other file byte for byte; `retune.json` is spec `rig-parts-retune/1`: `request` (`idle_keys`, `page_edges`, `pack_shape`), `versions` (`parts`, `rigc`), `input` (`rig` — `path`, `bytes`, `sha256` per file — `config_sha256`, `parts_json_sha256`), `held` (`compared`, `not_compared`), `changed` (`constraints` — each `name`, `type`, `fields` — `added`, `removed`, `idle`: `tracks_changed`, `duration` as before and after), `preserved` (`identical`, `spliced`), `revision` (per file as `input.rig`), `check` (`input`, `revision`: `pass`, `measured`, `not_met`, `skipped`, `physics`, then `line` and `status` — issue #541, additive, the spec stays `rig-parts-retune/1`: `line` is the last line `check` prints on that tree, byte for byte, and `status` every block's status as that tree's `check.json` records it, by name in the file's order — `gate`, `loop` and `seam` read from their figures, every other block its own `status`, a block the file does not write absent; `scope`) |
490
513
  | `input-check.json` | `remesh --record-input-check`, `retune --record-input-check` | spec `rig-parts-input-check/1` (issue #617, additive): `versions` (`parts`, `rigc` — `rigc --version`'s whole output), `options` (`page_edges`, `pack_shape`, `requirements` — null, or `path` as resolved and `sha256`), `rig` and `parts` (`dir` as resolved, `files` — `path`, `bytes`, `sha256` per file: every file under `--rig`; `parts.json` and every file under `parts/`), `check` (the input's check side as `remesh.json` carries it); `--input-check` reads it back, and either command's serves the other |
491
- | the scene report | `compose` | spec `spine-parts-scene-report/1` |
514
+ | the scene report | `compose` | spec `spine-parts-scene-report/1`; the plate block carries `sha256` of the plate PNG's bytes after `size` (issue #1183, additive under *What "stable" means here*: a new report key in a minor version, so the spec stays `/1`) |
492
515
  | `idle.png`, `idle-indexed.png`, `idle.gif` | `loop`, `build --loop` | APNG and GIF encodings of the rendered idle |
516
+ | `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), 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 |
493
517
 
494
518
  Issue #705 pins setup-seam acceptance to one source-relative scale1 union U of the authored stage and all actual drawn base/checked-set still vertices. U is snapped relative to the source origin, including odd-width half phase.
495
519
  The existing seam fields and pair pictures use that grid; source/blink and
@@ -553,6 +577,49 @@ Files authors write for this package, each with a spec id the reader holds:
553
577
  name on purpose: they name a file format, not the tool, and a file written before
554
578
  the rename still reads. They do not change at 1.0.
555
579
 
580
+ ### Run stamp (`run.json`, spec `rig-run/1`)
581
+
582
+ The CLI commands `rig` and `assemble` (when writing `--out`) write `<out>/run.json`
583
+ after all stage gates pass and all other output files are on disk:
584
+
585
+ ```json
586
+ {
587
+ "spec": "rig-run/1",
588
+ "package": { "name": "@rig-c/parts", "version": "<package.json version>" },
589
+ "command": "rig",
590
+ "started_at": "2026-11-07T00:00:00.000Z",
591
+ "finished_at": "2026-11-07T00:00:01.000Z",
592
+ "config": { "path": "../config.json", "sha256": "<hex>" },
593
+ "outputs": [
594
+ { "path": "images/cloth.png", "sha256": "<hex>" },
595
+ { "path": "mesh_report.json", "sha256": "<hex>" },
596
+ { "path": "motion.json", "sha256": "<hex>" },
597
+ { "path": "rig.json", "sha256": "<hex>" }
598
+ ]
599
+ }
600
+ ```
601
+
602
+ Key order is fixed as shown; `outputs` is sorted by `/`-separated `path` in UTF-16
603
+ code-unit order. Every `path` in `config` and `outputs` is relative to the `--out`
604
+ directory (`../`-prefixed when `--config` sits outside `--out`; never an absolute or
605
+ home path). Every `sha256` is computed from the bytes on disk after writing. A refused
606
+ run writes no `run.json`. Because `started_at` and `finished_at` record wall-clock
607
+ time read in `cli.ts` (`src/` remains pure), `run.json` is outside the byte-for-byte
608
+ determinism comparisons (`RG03`, `RG19`, `AS07`); for the same input at the same
609
+ relative `--config` layout, two `run.json` files differ only in `started_at` and
610
+ `finished_at`.
611
+
612
+ `outputs` lists exactly the files the stage wrote in this run, derived from what the
613
+ stage returns, not from a walk of `--out`: a stray or earlier file under `--out` is
614
+ neither hashed nor listed. Before the stage starts, the command removes an earlier
615
+ `<out>/run.json`, so a run the stage refuses, into a reused `--out`, leaves no stamp
616
+ (a usage error, exit 2, stops before that and touches nothing under `--out`). A
617
+ `package.json` without a non-empty `name` and `version` refuses `RUN_STAMP_PACKAGE`
618
+ and writes no stamp. `build` and the in-process stages write no `run.json`.
619
+
620
+ `rig-run/1` is stable: its keys, their order and their meaning do not change within
621
+ the spec. A key added, removed or redefined is a new spec version.
622
+
556
623
  ## Environment
557
624
 
558
625
  The installed package reads two environment variables and no other: `PATH`, where
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spine-parts",
3
- "version": "2.26.1",
3
+ "version": "2.27.1",
4
4
  "description": "AI-authored 2D character parts from one anime painting and its See-through layer decomposition: measured parts, weighted-mesh rig specs, verified through rig-c before anything is written. A CLI for agents that cannot see the image.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/assemble.ts CHANGED
@@ -117,7 +117,7 @@ import { bindDepthRun, copyDepthMaterial, registerDepthRun, transportPartDepth,
117
117
  */
118
118
  import { sourceLimbTarget, nearestTargetPart } from './limbownership.ts';
119
119
  import { type ArmSplit, type BoneEntry, type CharacterConfig, type ConfigConstraint, type ControlSkeleton, controlSkeletonOf, type CropEdge, type Cut, type EarlyConfig, type Extend, type Limb, type MeshSpec, type Patch, type PlanEntry, type RegionSpec, type Run, type SeeThrough, turnMovingPartPair, type TurnSpec } from './config.ts';
120
- import { PartsError, type Problem, refuseIfAny } from './errors.ts';
120
+ import { foldName, PartsError, type Problem, refuseIfAny } from './errors.ts';
121
121
  import { CORE_ALPHA, figuresPhrase, implausibleRules, type Layer, type LayerFigures, layerFigures, type LayerSet, NEAR_WHITE_MIN, OPAQUE_ALPHA_ABOVE, ruleSummary } from './layers.ts';
122
122
  import { padToSquare, squarePad } from './inputs.ts';
123
123
  import type { MotionSeamDeclaration } from './motionseams.ts';
@@ -4792,7 +4792,7 @@ export interface AssembleResult {
4792
4792
 
4793
4793
  /** Issue #953: the edge pixels `paintingEdges` resolved, the part pixels it changed, and the edge pixels it left, by reason. */
4794
4794
  export interface PaintingEdgeReading {
4795
- allocation?: PaintingAllocationReading;
4795
+ allocation: PaintingAllocationReading;
4796
4796
  resolved: number;
4797
4797
  unseparated: number;
4798
4798
  changed: number;
@@ -5912,7 +5912,7 @@ function assembleParts(input: AssembleInput, targets?: ReadonlySet<string>, befo
5912
5912
  order.forEach((d, i) => {
5913
5913
  if (!('patch' in d) && e.changed[i].data.some((v) => v === 1)) edged.set(pieceAt(d).name, e.changed[i]);
5914
5914
  });
5915
- edgeReading = { resolved: e.resolved, unseparated: e.unseparated, changed: e.changed.reduce((a, m) => a + m.data.reduce((x, v) => x + v, 0), 0), skipped: e.skipped, allocation: e.allocation };
5915
+ edgeReading = { resolved: e.resolved, unseparated: e.unseparated, changed: e.changed.reduce((a, m) => a + m.data.reduce((x, v) => x + v, 0), 0), skipped: e.skipped, allocation: e.allocation as PaintingAllocationReading };
5916
5916
  }
5917
5917
  const pushedOf: FringePushed[][] = plan.map(() => []);
5918
5918
  const pushedOfCut: FringePushed[][] = cuts.map(() => []);
@@ -6049,8 +6049,8 @@ function assembleParts(input: AssembleInput, targets?: ReadonlySet<string>, befo
6049
6049
  });
6050
6050
  refuseIfAny(empty);
6051
6051
  const placed: PlacedPart[] = order.map((d) => ('plan' in d ? planned[d.plan] : 'cut' in d ? cutPlaced[d.cut] : 'limb' in d ? limbPlaced[d.limb] : cut[d.patch]) as PlacedPart);
6052
- const artFiles = new Map<string, string>(); for (const p of placed) { const k = `${p.record.name}.png`.toLowerCase(), prev = artFiles.get(k); if (prev !== undefined) refuseIfAny([{ code: 'DEPTH_SHEET_UNAMBIGUOUS', object: `${p.record.name}.png`, detail: `part "${prev}" ("${prev}.png") and part "${p.record.name}" ("${p.record.name}.png") collides with a part artwork filename; choose noncolliding part names before sheet emission` }]); artFiles.set(k, p.record.name); }
6053
- for (const p of placed) if (p.record.depth !== undefined && artFiles.has(p.record.depth.image.toLowerCase())) refuseIfAny([{ code: 'DEPTH_SHEET_UNAMBIGUOUS', object: p.record.depth.image, detail: `part "${p.record.name}" sheet "${p.record.depth.image}" and part "${artFiles.get(p.record.depth.image.toLowerCase())}" ("${artFiles.get(p.record.depth.image.toLowerCase())}.png") collides with a part artwork filename; choose noncolliding part names before sheet emission` }]);
6052
+ const artFiles = new Map<string, string>(); for (const p of placed) { const k = foldName(`${p.record.name}.png`), prev = artFiles.get(k); if (prev !== undefined) refuseIfAny([{ code: 'DEPTH_SHEET_UNAMBIGUOUS', object: `${p.record.name}.png`, detail: `part "${prev}" ("${prev}.png") and part "${p.record.name}" ("${p.record.name}.png") collides with a part artwork filename; choose noncolliding part names before sheet emission` }]); artFiles.set(k, p.record.name); }
6053
+ for (const p of placed) if (p.record.depth !== undefined && artFiles.has(foldName(p.record.depth.image))) refuseIfAny([{ code: 'DEPTH_SHEET_UNAMBIGUOUS', object: p.record.depth.image, detail: `part "${p.record.name}" sheet "${p.record.depth.image}" and part "${artFiles.get(foldName(p.record.depth.image))}" ("${artFiles.get(foldName(p.record.depth.image))}.png") collides with a part artwork filename; choose noncolliding part names before sheet emission` }]);
6054
6054
 
6055
6055
 
6056
6056
  const regionSupport = new Map<string, Mask>();
@@ -21,13 +21,13 @@ import { checkRow, checkSlotRow, checkSlotParts } from './checkrow.ts';
21
21
  * derived from the art: no declaration, no measurement (SKIP, never a pass).
22
22
  */
23
23
  import { existsSync, readFileSync } from 'node:fs';
24
- import { join } from 'node:path';
24
+ import { basename, join } from 'node:path';
25
25
  import { Plate } from '@rig-c/core/plate';
26
26
  import type { Frame, Piece } from '@rig-c/core/render-shared';
27
27
  import { seamSourceAttachment } from './check.ts';
28
28
  import { cropToSpineY } from './coords.ts';
29
29
  import type { Problem } from './errors.ts';
30
- import type { PartsFile } from './parts.ts';
30
+ import { partImageReference, type PartsFile } from './parts.ts';
31
31
  import { readPng } from './raster/png.ts';
32
32
 
33
33
  export const BOUNDARY_COLOUR_LINE = 'BOUNDARY_COLOUR_STEP';
@@ -140,7 +140,7 @@ export function measureBoundaryColour(api: Api, input: BoundaryColourInput, decl
140
140
  if (got === undefined) {
141
141
  const name = image.replace(/\.png$/, '');
142
142
  const rec = records.get(name);
143
- const partPng = join(input.partsDir, `${name}.png`), rigPng = join(input.imagesDir, image);
143
+ const partPng = rec === undefined ? '' : join(input.partsDir, basename(partImageReference(rec).path)), rigPng = join(input.imagesDir, image);
144
144
  if (rec === undefined) got = `parts.json holds no record "${name}" for the image "${image}"`;
145
145
  else if (!existsSync(partPng) || !existsSync(rigPng)) got = `${existsSync(partPng) ? `the rig image "${image}"` : `the parts image "${name}.png"`} is absent`;
146
146
  else {