rig-parts 2.61.0 → 2.63.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
@@ -30,7 +30,7 @@ import { DEFAULT_PROJECT_RULE, DEFAULT_SEAM_RULE, headGarmentOverlaps, headGarme
30
30
  import { proposeNeck } from './tools/neck-propose.ts';
31
31
  import { parseAltArg } from './tools/alternate-cli.ts';
32
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';
33
- import { ACCEPTABLE_BARS, DEFAULT_PACK_SHAPE, DEFAULT_PAGE_EDGES, findRigc, 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, 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';
34
34
  import { ComfyClient, resolveHost, runBackground, runMatte, runPainting, runSeeThrough } from './src/comfy/index.ts';
35
35
  import { coreCfg, DEFAULT_GROW_PX, runForeground } from './src/plate.ts';
36
36
  import { type CharacterConfig, loadClothConfig, loadConfig, loadEarlyConfig, loadPaintConfig } from './src/config.ts';
@@ -55,7 +55,7 @@ import { RETUNE_FILE, RETUNE_SPEC, retuneStage } from './src/retune.ts';
55
55
  import { checkPainting, DEFAULT_PAINTING_FORM, isPaintingForm, PAINTING_FORMS, paintingFormOf } from './src/paintcheck.ts';
56
56
  import { decodePngBytes, readPng, writePng } from './src/raster/png.ts';
57
57
  import { REQUIREMENTS_SENTENCE } from './src/requirements.ts';
58
- import { composeStage, IMAGE_SEP, PLATE, PROVENANCES, SCENE_REPORT_FILE, SCENE_REPORT_SPEC, SCENE_SPEC } from './src/scene.ts';
58
+ import { composeStage, IMAGE_SEP, PLATE, PROVENANCES, SCENE_CAMERA_REPORT_SPEC, SCENE_REPORT_FILE, SCENE_REPORT_SPEC, SCENE_SPEC } from './src/scene.ts';
59
59
  import { buildSheet, defaultCaption, type Tile, tilesFrom } from './src/sheet.ts';
60
60
  import { loadComparison, requiredProblems, structureLines } from './src/structure.ts';
61
61
  import { type ArgvTable, assembleOutputFiles, BUILD_RUN_FILE, CHECK_RUN_FILE, clearComposeRun, clearRunRecord, clearRunStamp, readPackageIdentity, recordArgv, rigOutputFiles, RUN_STAMP_FILE, RUN_STAMP_SPEC, writeRunRecord, writeRunStamp } from './src/runstamp.ts';
@@ -645,7 +645,12 @@ usage:
645
645
  [--requirements <file.json>] [--seam-pairs] [--keep-stills]
646
646
  [--set <name> | --all-sets] [--environment <schedule.json>]
647
647
  [--wind-band <spec.json>] [--json]
648
+ [--loop-seam-bar <channel-delta,pixels> --loop-seam-cap <loops>]
648
649
  --json prints the completed check.json object only, with unchanged exit codes.
650
+ The loop seam flags together require a positive idle period. Core selects
651
+ the first whole-loop warm-up from 0 through the cap whose idle wrap meets
652
+ the RGBA pixel bar at the shipped render's viewport. Incompatible with
653
+ --environment. The keyed endpoint check still applies.
649
654
  check-run.json (rig-run/2, STABILITY) records a completed run: the package,
650
655
  the times, every file written with its sha256, and argv, the command and
651
656
  the options as given, each path relative to --out and --out as ".": these
@@ -1040,6 +1045,8 @@ usage:
1040
1045
  names the flag on the command that ran.
1041
1046
 
1042
1047
  rig-parts compose --scene <scene.json> --out <dir> [--requirements <file.json>] [--accept <bar>[,<bar>...]] [--page-size <px>]
1048
+ [--loop-seam-bar <channel-delta,pixels> --loop-seam-cap <loops>]
1049
+ The loop seam flags measure the composed idle in check/, as for check.
1043
1050
  Bind several finished characters into one rig. The scene file (spec
1044
1051
  "${SCENE_SPEC}") states the canvas {width, height}, an optional plate
1045
1052
  {image, provenance: ${PROVENANCES.join(' | ')}, note?}, the characters
@@ -1075,10 +1082,11 @@ usage:
1075
1082
  rig or motion compose does not know. The result is gated through
1076
1083
  rig-c as rig gates its own (build --profile rig-play --pack, the
1077
1084
  compile and the packed pages on disk); --out receives rig/ (rig.json,
1078
- motion.json, images/) and ${SCENE_REPORT_FILE} (spec "${SCENE_REPORT_SPEC}":
1085
+ motion.json, images/) and ${SCENE_REPORT_FILE} (spec "${SCENE_REPORT_SPEC}"
1086
+ without a camera, "${SCENE_CAMERA_REPORT_SPEC}" with a camera):
1079
1087
  every setting, each character's offset, scale, bounds and shift (and what it
1080
1088
  moved),
1081
- the plate's provenance, the declared and the composed order) only when
1089
+ the plate's provenance, the declared and the composed order, only when
1082
1090
  it is green; then check runs over rig/ into check/, as on a rig it did
1083
1091
  not build (no parts.json: the seam, BREATH_VISIBLE, BLINK_NO_HOLE,
1084
1092
  TIP_OVER_ROOT, STILL_REGIONS_DARK and RECOMPOSITE_HOLES say SKIP and
@@ -1142,7 +1150,10 @@ ${LATER.length === 0 ? '' : `not implemented in this version (each exits 2):\n${
1142
1150
 
1143
1151
  function printRefusal(err: unknown): number {
1144
1152
  if (err instanceof PartsError) {
1145
- for (const p of err.problems) console.log(failLine(p));
1153
+ for (const p of err.problems) {
1154
+ if (p.code === LOOP_SEAM_BAR_UNMET) console.error(p.detail);
1155
+ else console.log(failLine(p));
1156
+ }
1146
1157
  console.log(`refused: ${err.problems.length} problem(s)`);
1147
1158
  return EXIT_REFUSED;
1148
1159
  }
@@ -1283,7 +1294,7 @@ const TAKES = {
1283
1294
  rig: { valued: ['--config', '--parts', '--out', '--idle-keys', '--page-edges', '--pack-shape', '--page-size'], switches: ['--help'] },
1284
1295
  propose: { valued: ['--parts', '--source', '--out', '--from-config', '--compare', '--full', '--head', '--canvas', '--keypoints', '--person', '--wrist-snap', '--grid-rule', '--cloth', '--write-config', '--from', '--bust-landmarks', '--no-bust'], switches: ['--head-box', '--no-back-hair', '--only-missing', '--help'] },
1285
1296
  compare: { valued: ['--left', '--right', '--map'], switches: ['--help'] },
1286
- check: { valued: ['--rig', '--out', '--parts', '--source', '--page-edges', '--pack-shape', '--page-size', '--requirements', '--set', '--environment', '--wind-band'], switches: ['--seam-pairs', '--keep-stills', '--all-sets', '--no-extremes', '--json', '--help'] },
1297
+ check: { valued: ['--rig', '--out', '--parts', '--source', '--page-edges', '--pack-shape', '--page-size', '--requirements', '--set', '--environment', '--wind-band', '--loop-seam-bar', '--loop-seam-cap'], switches: ['--seam-pairs', '--keep-stills', '--all-sets', '--no-extremes', '--json', '--help'] },
1287
1298
  loop: { valued: ['--frames', '--out'], switches: ['--palette', '--help'] },
1288
1299
  assemble: { valued: ['--source', '--full', '--head', '--config', '--out', '--emit-fill-masks', '--seam', '--project', '--alt', '--write-config', '--requirements'], switches: ['--propose-plan', '--help'] },
1289
1300
  'comfy seethrough': { valued: ['--image', '--out', '--resolution', '--steps', '--seed', '--prefix', '--host', '--wait', '--timeout', '--poll', '--config', '--depth-run'], switches: ['--offload', '--no-offload', '--lama', '--nf4', '--help'] },
@@ -1292,7 +1303,7 @@ const TAKES = {
1292
1303
  'comfy plate': { valued: ['--mode', '--painting', '--mask-from', '--occluder', '--out', '--graph', '--model', '--checkpoint-sha256', '--seed', '--grow', '--steps', '--cfg', '--prompt', '--negative', '--host', '--wait', '--timeout', '--poll'], switches: ['--holes', '--help'] },
1293
1304
  inputs: { valued: ['--source', '--config', '--out'], switches: ['--help'] },
1294
1305
  build: { valued: ['--config', '--source', '--full', '--head', '--out', '--seam', '--project', '--page-edges', '--pack-shape', '--page-size', '--requirements', '--idle-keys', '--lead-in', '--alt', '--set', '--environment', '--wind-band'], switches: ['--loop', '--seam-pairs', '--keep-stills', '--all-sets', '--no-extremes', '--help'] },
1295
- compose: { valued: ['--scene', '--out', '--requirements', '--accept', '--page-size'], switches: ['--help'] },
1306
+ compose: { valued: ['--scene', '--out', '--requirements', '--accept', '--page-size', '--loop-seam-bar', '--loop-seam-cap'], switches: ['--help'] },
1296
1307
  'mesh-draft': { valued: ['--config', '--parts', '--out', '--requirements', '--idle-keys', '--page-edges', '--pack-shape', '--page-size'], switches: ['--more-triangles', '--help'] },
1297
1308
  'mesh-stats': { valued: ['--config', '--parts'], switches: ['--help'] },
1298
1309
  remesh: { valued: ['--rig', '--config', '--parts', '--part', '--mesh', '--delta', '--out', '--requirements', '--idle-keys', '--page-edges', '--pack-shape', '--page-size', '--input-check'], switches: ['--record-input-check', '--help'] },
@@ -1636,6 +1647,26 @@ function flags(args: string[], command: Command, required: readonly string[]): M
1636
1647
  return got;
1637
1648
  }
1638
1649
 
1650
+ function parseLoopSeamFlags(values: ReadonlyMap<string, string>): LoopSeamRequest | string | undefined {
1651
+ const bar = values.get('--loop-seam-bar');
1652
+ const capText = values.get('--loop-seam-cap');
1653
+ if (bar === undefined && capText === undefined) return undefined;
1654
+ if (bar === undefined || capText === undefined) return '--loop-seam-bar and --loop-seam-cap must be given together';
1655
+
1656
+ const match = /^(\d+),(\d+)$/.exec(bar);
1657
+ const channelDelta = Number(match?.[1]);
1658
+ const pixelsAbove = Number(match?.[2]);
1659
+ if (!Number.isInteger(channelDelta) || channelDelta > 255 || !Number.isSafeInteger(pixelsAbove)) {
1660
+ return `--loop-seam-bar ${JSON.stringify(bar)}: expected <channel-delta,pixels>, with delta in 0..255 and a nonnegative safe integer pixel count`;
1661
+ }
1662
+ const cap = Number(capText);
1663
+ if (!/^\d+$/.test(capText) || !Number.isSafeInteger(cap)) {
1664
+ return `--loop-seam-cap ${JSON.stringify(capText)}: expected a nonnegative safe integer number of loops`;
1665
+ }
1666
+ if (values.has('--environment')) return '--loop-seam-bar takes no --environment';
1667
+ return { channelDelta, pixelsAbove, cap };
1668
+ }
1669
+
1639
1670
  function cmdCheckParts(args: string[]): number {
1640
1671
  const json = args.filter(arg => arg === '--json').length;
1641
1672
  if (json > 1) return usage('--json is given twice');
@@ -1672,6 +1703,8 @@ function cmdCheck(args: string[]): number {
1672
1703
  );
1673
1704
  if (typeof f === 'string') return usage(f);
1674
1705
  if (allSets === 1 && f.has('--set')) return usage('--set and --all-sets are two modes; give one');
1706
+ const loopSeam = parseLoopSeamFlags(f);
1707
+ if (typeof loopSeam === 'string') return usage(loopSeam);
1675
1708
  const rig = f.get('--rig') as string;
1676
1709
  const out = f.get('--out') as string;
1677
1710
  let fixedClock: string | undefined;
@@ -1687,7 +1720,13 @@ function cmdCheck(args: string[]): number {
1687
1720
  const bin = findRigc(import.meta.dir, process.env.PATH ?? '');
1688
1721
  const startedAt = fixedClock ?? new Date().toISOString();
1689
1722
  const r = checkStage(
1690
- { rig, parts: f.get('--parts'), source: f.get('--source'), out, pageEdges: edges, packShape: shape, ...(size === undefined ? {} : { pageSize: size }), requirements: f.get('--requirements'), seamPairs: seamPairs === 1, keepStills: keepStills === 1, noExtremes: noExtremes === 1, ...(f.has('--set') ? { set: f.get('--set') as string } : {}), allSets: allSets === 1, ...(f.has('--environment') ? { environment: f.get('--environment') as string } : {}), ...(f.has('--wind-band') ? { windBand: f.get('--wind-band') as string } : {}) },
1723
+ {
1724
+ rig, parts: f.get('--parts'), source: f.get('--source'), out, pageEdges: edges, packShape: shape,
1725
+ ...(size === undefined ? {} : { pageSize: size }), requirements: f.get('--requirements'), seamPairs: seamPairs === 1,
1726
+ keepStills: keepStills === 1, noExtremes: noExtremes === 1, ...(f.has('--set') ? { set: f.get('--set') as string } : {}),
1727
+ allSets: allSets === 1, ...(f.has('--environment') ? { environment: f.get('--environment') as string } : {}),
1728
+ ...(f.has('--wind-band') ? { windBand: f.get('--wind-band') as string } : {}), ...(loopSeam === undefined ? {} : { loopSeam }),
1729
+ },
1691
1730
  rigcRunner(bin),
1692
1731
  bin,
1693
1732
  json === 1 ? () => {} : console.log,
@@ -2568,6 +2607,8 @@ function cmdBuild(args: string[]): number {
2568
2607
  function cmdCompose(args: string[]): number {
2569
2608
  const f = flags(args, 'compose', ['--scene', '--out']);
2570
2609
  if (typeof f === 'string') return usage(f);
2610
+ const loopSeam = parseLoopSeamFlags(f);
2611
+ if (typeof loopSeam === 'string') return usage(loopSeam);
2571
2612
  const out = f.get('--out') as string;
2572
2613
  clearComposeRun(out);
2573
2614
  let size: number | undefined;
@@ -2587,7 +2628,11 @@ function cmdCompose(args: string[]): number {
2587
2628
  const req = f.get('--requirements');
2588
2629
  const accept = f.get('--accept');
2589
2630
  const r = composeStage(
2590
- { scene: f.get('--scene') as string, out, ...(size === undefined ? {} : { pageSize: size }), ...(req === undefined ? {} : { requirements: req }), ...(accept === undefined ? {} : { accept: accept.split(',') }) },
2631
+ {
2632
+ scene: f.get('--scene') as string, out, ...(size === undefined ? {} : { pageSize: size }),
2633
+ ...(req === undefined ? {} : { requirements: req }), ...(accept === undefined ? {} : { accept: accept.split(',') }),
2634
+ ...(loopSeam === undefined ? {} : { loopSeam }),
2635
+ },
2591
2636
  { rig: rigcRunner(bin), check: rigcRunner(bin), checkBin: bin, scratch: join(scratch, 'gate') },
2592
2637
  console.log,
2593
2638
  );