rig-parts 2.61.0 → 2.62.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';
@@ -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
@@ -1142,7 +1149,10 @@ ${LATER.length === 0 ? '' : `not implemented in this version (each exits 2):\n${
1142
1149
 
1143
1150
  function printRefusal(err: unknown): number {
1144
1151
  if (err instanceof PartsError) {
1145
- for (const p of err.problems) console.log(failLine(p));
1152
+ for (const p of err.problems) {
1153
+ if (p.code === LOOP_SEAM_BAR_UNMET) console.error(p.detail);
1154
+ else console.log(failLine(p));
1155
+ }
1146
1156
  console.log(`refused: ${err.problems.length} problem(s)`);
1147
1157
  return EXIT_REFUSED;
1148
1158
  }
@@ -1283,7 +1293,7 @@ const TAKES = {
1283
1293
  rig: { valued: ['--config', '--parts', '--out', '--idle-keys', '--page-edges', '--pack-shape', '--page-size'], switches: ['--help'] },
1284
1294
  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
1295
  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'] },
1296
+ 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
1297
  loop: { valued: ['--frames', '--out'], switches: ['--palette', '--help'] },
1288
1298
  assemble: { valued: ['--source', '--full', '--head', '--config', '--out', '--emit-fill-masks', '--seam', '--project', '--alt', '--write-config', '--requirements'], switches: ['--propose-plan', '--help'] },
1289
1299
  '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 +1302,7 @@ const TAKES = {
1292
1302
  '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
1303
  inputs: { valued: ['--source', '--config', '--out'], switches: ['--help'] },
1294
1304
  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'] },
1305
+ compose: { valued: ['--scene', '--out', '--requirements', '--accept', '--page-size', '--loop-seam-bar', '--loop-seam-cap'], switches: ['--help'] },
1296
1306
  'mesh-draft': { valued: ['--config', '--parts', '--out', '--requirements', '--idle-keys', '--page-edges', '--pack-shape', '--page-size'], switches: ['--more-triangles', '--help'] },
1297
1307
  'mesh-stats': { valued: ['--config', '--parts'], switches: ['--help'] },
1298
1308
  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 +1646,26 @@ function flags(args: string[], command: Command, required: readonly string[]): M
1636
1646
  return got;
1637
1647
  }
1638
1648
 
1649
+ function parseLoopSeamFlags(values: ReadonlyMap<string, string>): LoopSeamRequest | string | undefined {
1650
+ const bar = values.get('--loop-seam-bar');
1651
+ const capText = values.get('--loop-seam-cap');
1652
+ if (bar === undefined && capText === undefined) return undefined;
1653
+ if (bar === undefined || capText === undefined) return '--loop-seam-bar and --loop-seam-cap must be given together';
1654
+
1655
+ const match = /^(\d+),(\d+)$/.exec(bar);
1656
+ const channelDelta = Number(match?.[1]);
1657
+ const pixelsAbove = Number(match?.[2]);
1658
+ if (!Number.isInteger(channelDelta) || channelDelta > 255 || !Number.isSafeInteger(pixelsAbove)) {
1659
+ return `--loop-seam-bar ${JSON.stringify(bar)}: expected <channel-delta,pixels>, with delta in 0..255 and a nonnegative safe integer pixel count`;
1660
+ }
1661
+ const cap = Number(capText);
1662
+ if (!/^\d+$/.test(capText) || !Number.isSafeInteger(cap)) {
1663
+ return `--loop-seam-cap ${JSON.stringify(capText)}: expected a nonnegative safe integer number of loops`;
1664
+ }
1665
+ if (values.has('--environment')) return '--loop-seam-bar takes no --environment';
1666
+ return { channelDelta, pixelsAbove, cap };
1667
+ }
1668
+
1639
1669
  function cmdCheckParts(args: string[]): number {
1640
1670
  const json = args.filter(arg => arg === '--json').length;
1641
1671
  if (json > 1) return usage('--json is given twice');
@@ -1672,6 +1702,8 @@ function cmdCheck(args: string[]): number {
1672
1702
  );
1673
1703
  if (typeof f === 'string') return usage(f);
1674
1704
  if (allSets === 1 && f.has('--set')) return usage('--set and --all-sets are two modes; give one');
1705
+ const loopSeam = parseLoopSeamFlags(f);
1706
+ if (typeof loopSeam === 'string') return usage(loopSeam);
1675
1707
  const rig = f.get('--rig') as string;
1676
1708
  const out = f.get('--out') as string;
1677
1709
  let fixedClock: string | undefined;
@@ -1687,7 +1719,13 @@ function cmdCheck(args: string[]): number {
1687
1719
  const bin = findRigc(import.meta.dir, process.env.PATH ?? '');
1688
1720
  const startedAt = fixedClock ?? new Date().toISOString();
1689
1721
  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 } : {}) },
1722
+ {
1723
+ rig, parts: f.get('--parts'), source: f.get('--source'), out, pageEdges: edges, packShape: shape,
1724
+ ...(size === undefined ? {} : { pageSize: size }), requirements: f.get('--requirements'), seamPairs: seamPairs === 1,
1725
+ keepStills: keepStills === 1, noExtremes: noExtremes === 1, ...(f.has('--set') ? { set: f.get('--set') as string } : {}),
1726
+ allSets: allSets === 1, ...(f.has('--environment') ? { environment: f.get('--environment') as string } : {}),
1727
+ ...(f.has('--wind-band') ? { windBand: f.get('--wind-band') as string } : {}), ...(loopSeam === undefined ? {} : { loopSeam }),
1728
+ },
1691
1729
  rigcRunner(bin),
1692
1730
  bin,
1693
1731
  json === 1 ? () => {} : console.log,
@@ -2568,6 +2606,8 @@ function cmdBuild(args: string[]): number {
2568
2606
  function cmdCompose(args: string[]): number {
2569
2607
  const f = flags(args, 'compose', ['--scene', '--out']);
2570
2608
  if (typeof f === 'string') return usage(f);
2609
+ const loopSeam = parseLoopSeamFlags(f);
2610
+ if (typeof loopSeam === 'string') return usage(loopSeam);
2571
2611
  const out = f.get('--out') as string;
2572
2612
  clearComposeRun(out);
2573
2613
  let size: number | undefined;
@@ -2587,7 +2627,11 @@ function cmdCompose(args: string[]): number {
2587
2627
  const req = f.get('--requirements');
2588
2628
  const accept = f.get('--accept');
2589
2629
  const r = composeStage(
2590
- { scene: f.get('--scene') as string, out, ...(size === undefined ? {} : { pageSize: size }), ...(req === undefined ? {} : { requirements: req }), ...(accept === undefined ? {} : { accept: accept.split(',') }) },
2630
+ {
2631
+ scene: f.get('--scene') as string, out, ...(size === undefined ? {} : { pageSize: size }),
2632
+ ...(req === undefined ? {} : { requirements: req }), ...(accept === undefined ? {} : { accept: accept.split(',') }),
2633
+ ...(loopSeam === undefined ? {} : { loopSeam }),
2634
+ },
2591
2635
  { rig: rigcRunner(bin), check: rigcRunner(bin), checkBin: bin, scratch: join(scratch, 'gate') },
2592
2636
  console.log,
2593
2637
  );