@rig-c/review 4.9.1 → 4.11.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.
Files changed (51) hide show
  1. package/docs/DESIGN.md +5 -5
  2. package/docs/PANELS.md +3 -1
  3. package/docs/REVIEW_PACKAGE.md +143 -30
  4. package/docs/STABILITY.md +110 -3
  5. package/package.json +2 -2
  6. package/src/chest-landmarks.ts +9 -4
  7. package/src/cloth-recipe.ts +27 -7
  8. package/src/compare-html.ts +1 -1
  9. package/src/feedback-export.ts +2 -2
  10. package/src/feedback-validation.ts +11 -6
  11. package/src/frame-clock.ts +20 -4
  12. package/src/job-act.ts +60 -71
  13. package/src/job-api.ts +302 -46
  14. package/src/job-checkpoint-evidence.ts +17 -0
  15. package/src/job-cli.ts +3 -2
  16. package/src/job-contract.ts +107 -7
  17. package/src/job-front.ts +48 -12
  18. package/src/job-host.ts +7 -1
  19. package/src/job-session.ts +136 -26
  20. package/src/job-source.ts +133 -21
  21. package/src/job-store.ts +7 -4
  22. package/src/manifest.ts +59 -7
  23. package/src/open-workspace-state.ts +6 -1
  24. package/src/open.ts +3 -3
  25. package/src/rebuild.ts +42 -10
  26. package/src/session.ts +9 -4
  27. package/src/stage-comment.ts +2 -1
  28. package/web/catalog-en.ts +31 -6
  29. package/web/catalog-ko.ts +79 -54
  30. package/web/chest-editor.ts +236 -31
  31. package/web/cloth-panel.ts +1 -1
  32. package/web/compare.css +2 -2
  33. package/web/environment-world.ts +9 -0
  34. package/web/i18n.ts +1 -3
  35. package/web/inspection-persistence.ts +19 -6
  36. package/web/interview-panel.ts +13 -80
  37. package/web/job-rig-screen.ts +65 -37
  38. package/web/job-session.ts +204 -64
  39. package/web/label-placement.ts +25 -8
  40. package/web/main.ts +350 -114
  41. package/web/part-selection.ts +2 -1
  42. package/web/parts-viewport-provider.ts +21 -8
  43. package/web/rebuild-client.ts +3 -5
  44. package/web/rig-host.ts +5 -4
  45. package/web/rig-overlays.ts +3 -2
  46. package/web/rig-viewport-provider.ts +10 -6
  47. package/web/stage-comments.ts +24 -21
  48. package/web/styles.css +23 -51
  49. package/web/viewport-controller.ts +4 -0
  50. package/web/workspace-layout.ts +4 -4
  51. package/web/workspace-ui.ts +8 -6
package/docs/STABILITY.md CHANGED
@@ -413,6 +413,7 @@ preserve capability, origin, size, cancellation and replay checks.
413
413
  ## Changelog
414
414
 
415
415
  - Breaking, 4.0.0 (#806): remove `startJobHub` and its `JobHubOptions`, `JobHubJobOptions`, `JobHubJob` and `JobOwnerHub` types; the uncalled semantic-job hub is deleted.
416
+ - Additive (#987): V3 hosts advertise `progress: true` in the `next` capabilities. The HTTP `progress` verb and optional `subscribeJobPage` port implement [job progress](REVIEW_PACKAGE.md#job-progress). `subscribeJob`, the durable event union, cursors and CLI preserve their existing contracts. The owner front opts into the page stream for V3 hosts, with the published web bundle consuming the extra line. Reload an owner page left open across a host upgrade to load the matching bundle.
416
417
 
417
418
  ## Mesh-edit act compatibility
418
419
 
@@ -435,6 +436,25 @@ checks are part of the [act@8 wire contract](REVIEW_PACKAGE.md#mesh-edits-on-req
435
436
  The host facade adds `parseMeshEditsAct`, `JOB_MESH_EDITS_ACT_SCHEMA` and
436
437
  the three mesh edit types listed below.
437
438
 
439
+ ## Chest landmark act compatibility
440
+
441
+ `rig-review/act@9` carries one or more `value.chestLandmarks` rows on a
442
+ compiled rig's Request changes verdict. It accepts optional `meshEdits` and
443
+ @7 comment context. Older decoders refuse @9 with `JOB_ACT_INVALID`.
444
+ Existing decoders and historical @2–@8 bytes retain their contracts. Mesh-only
445
+ submissions still emit @8. See the [act@9 wire contract](REVIEW_PACKAGE.md#chest-landmarks-on-request-changes-act9).
446
+
447
+ The trusted adapter can detect support through
448
+ `JOB_CHEST_LANDMARKS_ACT_SCHEMA`. It supplies the draft's
449
+ `contour.bust` spec and required `source.configHash` for a rig publication.
450
+ Review verifies both against the retained config and binds them into the source
451
+ hash. With the declaration absent, the publication and all historical source
452
+ bindings keep their existing shape.
453
+
454
+ Create must pin a Review release that exports `parseChestLandmarksAct` and
455
+ support @9 before publishing the new declaration. Parts consumes the
456
+ finalized act through the existing writer grant and source checks.
457
+
438
458
  ## Named export inventory
439
459
 
440
460
  The backend rig-still extension retains the original twelve runtime exports and `JOB_ACT_SCHEMA` at act@2. `JobAct` additionally includes `JobRigReviewAct` at act@3 with top-level `JobRigStill` and `JobPartsVerdictAct` at act@5 (`PartsVerdictValue` with pointed `issues` and `words`, while preserving `JobLegacyPartsVerdictValue` at act@2 for historical acts). The facade adds type-only `JobLegacyAct`, `JobRigReviewAct`, `JobPartsVerdictAct`, `JobLegacyPartsVerdictValue`, `PartsVerdictValue`, `JobPanelComposition`, `PanelComponent`, `JobRigStill` and `JobRigCapture` exports, [Review #563](https://github.com/rig-c/review/issues/563) adds five type-only exports (`JobHostListenerIncarnation`, `JobHostReuseBinding`, `JobHostReuseExpectation`, `JobHostAttachField` and `JobHostAttachFailure`), and [Review #555](https://github.com/rig-c/review/issues/555) adds four type-only interview diagnostic exports (`JobInterviewJson`, `JobInterviewRecord`, `JobInterviewDiagnostic` and `JobInterviewDiagnostics`). [Review #588](https://github.com/rig-c/review/issues/588) activates record mode when `readRecordPublished` and `recordReaderId` are supplied to a host or session (`publicationMode: 'record-and-package'`), serving `rig-review/job-api@3` (`JOB_API_V3_SCHEMA`), `rig-review/act@4` (`JOB_RECORD_ACT_SCHEMA`) and normal owner URL model-free record inspection while keeping default package-only hosts and exact `package-only` `job-ui/<jobId>.json` descriptor bytes at @2 and enforcing `publicationMode` / `recordReaderId` reuse compatibility across ordinary reuse and strict `reuseOnly` attachment. It exports six additional record-mode runtime symbols (`JOB_API_V3_SCHEMA`, `JOB_RECORD_ACT_SCHEMA`, `JOB_RECORD_READER_ID`, `parseRecordAct`, `prepareJobRecordAct` and `prepareJobRecordSource`, for eighteen runtime exports total) and the V3/record type surface listed below. The rig and parts-verdict act revision constants, transport limits and the internal `POST /jobs/<jobId>/host` helper remain internal to their modules. Consumer checks distinguish these act revisions as described in [Rig verdict still backend](REVIEW_PACKAGE.md#rig-verdict-still-backend) and [Model-free record mode and source seam](REVIEW_PACKAGE.md#model-free-record-mode-and-source-seam).
@@ -556,6 +576,12 @@ finalized act the live host commits wakes it. A write that adds no deliverable
556
576
  event, such as a display receipt, keeps the wait open, and a refused save
557
577
  commits nothing. No API verb, act field or capability changes.
558
578
 
579
+ [Review #990](https://github.com/rig-c/review/issues/990) then adds
580
+ `parseChestLandmarksAct` and `JOB_CHEST_LANDMARKS_ACT_SCHEMA`
581
+ (`rig-review/act@9`), for thirty-four runtime exports total, plus the type-only
582
+ `JobChestLandmarkValue`, `JobPublishedChestLandmark`, `JobChestLandmarkEdit`
583
+ and `JobChestLandmarksAct`.
584
+
559
585
  The exact runtime exports are listed below. Constants preserve their literal
560
586
  values from the frozen semantic contract.
561
587
 
@@ -566,6 +592,7 @@ values from the frozen semantic contract.
566
592
  - `parseCommentsAct`
567
593
  - `parseContextCommentsAct`
568
594
  - `parseMeshEditsAct`
595
+ - `parseChestLandmarksAct`
569
596
  - `projectComments`
570
597
  - `parseCommentsSession`
571
598
  - `parseCommentsCompareSession`
@@ -574,6 +601,7 @@ values from the frozen semantic contract.
574
601
  - `JOB_COMMENTS_ACT_SCHEMA`
575
602
  - `JOB_COMMENT_CONTEXT_ACT_SCHEMA`
576
603
  - `JOB_MESH_EDITS_ACT_SCHEMA`
604
+ - `JOB_CHEST_LANDMARKS_ACT_SCHEMA`
577
605
  - `REVIEW_COMMENTS_SESSION_SCHEMA`
578
606
  - `REVIEW_COMMENTS_COMPARE_SESSION_SCHEMA`
579
607
  - `PARTS_COMMENTS_VERDICT_SCHEMA`
@@ -675,6 +703,10 @@ without aliases or copied wire shapes.
675
703
  - `JobAskRequestV3`
676
704
  - `JobAskBatchRequestV3`
677
705
  - `JobAskBatchValueV3`
706
+ - `JobProgressRequestV3`
707
+ - `JobProgressValueV3`
708
+ - `JobProgressV3`
709
+ - `JobProgressLineV3`
678
710
  - `JobNextRequest`
679
711
  - `JobNextRequestV3`
680
712
  - `JobCloseRequest`
@@ -716,7 +748,7 @@ without aliases or copied wire shapes.
716
748
  - `JobRecordPicksSubject`
717
749
  - `JobRecordCheckpointSubject`
718
750
  - `JobRecordSignoffSubject`
719
- - `JobRecordReopenSubject`
751
+ - `JobRecordReopenSubject` (read-only compatibility: old records and acts parse; new `reopen` asks refuse with `JOB_ASK_INVALID` and Review neither renders nor builds `reopen`, #989)
720
752
  - `JobRecordPlanSubject`
721
753
  - `JobRecordSubject`
722
754
  - `JobRecordContextBase`
@@ -731,7 +763,7 @@ without aliases or copied wire shapes.
731
763
  - `JobRecordSource`
732
764
  - `JobSourceV3`
733
765
  - `JobRecordSignoffValue`
734
- - `JobRecordReopenValue`
766
+ - `JobRecordReopenValue` (read-only compatibility: exported for historical record and act decoders, #989)
735
767
  - `JobRecordUIActValues`
736
768
  - `JobRecordUISubmission`
737
769
  - `JobRetainedRecordSource`
@@ -751,6 +783,10 @@ without aliases or copied wire shapes.
751
783
  - `JobMeshEditValue`
752
784
  - `JobMeshEdit`
753
785
  - `JobMeshEditsAct`
786
+ - `JobChestLandmarkValue`
787
+ - `JobPublishedChestLandmark`
788
+ - `JobChestLandmarkEdit`
789
+ - `JobChestLandmarksAct`
754
790
  - `ReviewCommentsSession`
755
791
  - `CompareCommentsSession`
756
792
  - `PartsCommentsVerdict`
@@ -766,7 +802,7 @@ Rows are capped at 4096, roles at 128 UTF-16 code units and literal paths at 409
766
802
  ## Installed acceptance
767
803
 
768
804
  `bun run smoke` packs the package and installs that tarball into an empty project.
769
- A consumer checks the thirty-two runtime exports and every listed type, including
805
+ A consumer checks the thirty-four runtime exports and the existing managed-host types, including
770
806
  `JobHostListenerIncarnation`, `JobHostReuseBinding`, `JobHostReuseExpectation`,
771
807
  `JobHostAttachField`, `JobHostAttachFailure`, `JobInterviewJson`,
772
808
  `JobInterviewRecord`, `JobInterviewDiagnostic`, `JobInterviewDiagnostics` and
@@ -778,6 +814,8 @@ proves that `JobCapabilitiesV3` carries `askBatch: true`. In `JobCapabilitiesV3`
778
814
  than the current head: `ask-batch` applies only to a record-retained head
779
815
  publication and a package head refuses `JOB_REQUEST_INVALID`, so a consumer
780
816
  checks the publication's mode as well as the flag.
817
+ The #987 contract tests cover the progress capability and the owner page stream
818
+ against an attached publisher sharing the persisted job.
781
819
  TypeScript checks the installed consumer and the runtime checks the full owner
782
820
  resources, retained publication, semantic ports, declared hooks, enumerator
783
821
  version/row carriage, ordinary reuse, strict `reuseOnly: {expected}` attachment
@@ -816,3 +854,72 @@ the existing modal and record act shape. A declared subject and non-empty displa
816
854
  plan remain required. The record stage type has five members; the public package
817
855
  plan-bound list remains at three. Package interview signoffs and historical acts
818
856
  retain their existing nullable-plan behavior. No schema or runtime export changes.
857
+
858
+ ## Record option sets
859
+
860
+ An `option-set` publication may carry 2 to 64 sets ([Review #1004](https://github.com/rig-c/review/issues/1004)).
861
+ `JobPublishResultV3` gains an optional `sets` (`{questionId, setId}` in order, the
862
+ first equal to the result's own `questionId`/`setId`), and the retained record
863
+ source gains an optional `optionSets` (each set's `questionId`, `setId`,
864
+ `optionSet` and `optionSetFile`). Both are absent for one set, whose source bytes
865
+ and `sourceHash` are unchanged. `JOB_ERROR_CODES` gains
866
+ `JOB_OPTION_SET_DUPLICATE`, refused on publish when the reader declares two
867
+ subjects for one set or `sets` names a set twice. Each ask binds one set, the
868
+ asks of one publication stay pending together, and each answer finalizes one
869
+ `interview-picks` act (`rig-review/act@4`). At K ≥ 2 that act's `selection`
870
+ (`questionId`, `setId`), `optionSet` and `optionSetFile` name the act's own set,
871
+ while `subjects`, `optionSets` and `sourceHash` stay the publication's; an act
872
+ whose per-act fields disagree refuses `JOB_ACT_INVALID` by name. One set's act
873
+ bytes are unchanged. No runtime or type export is added. See the [option-set contract](REVIEW_PACKAGE.md#option-sets).
874
+
875
+ ## Record plan picture
876
+
877
+ A record-plan publication context and its retained source may carry an optional
878
+ `planPicture: {path, sha256}` ([Review #983](https://github.com/rig-c/review/issues/983)):
879
+ one raster member of `files` that the record screen draws first. It is refused
880
+ on option sets and appended to the record digest only when present, so existing
881
+ sources keep their bytes and `sourceHash`. `PlanContext` and `PlanSource` gain the
882
+ optional field; no runtime export or error code is added. See the
883
+ [plan picture contract](REVIEW_PACKAGE.md#plan-picture).
884
+
885
+ ## Package manifest `frames` declaration
886
+
887
+ `rig-review/1` manifests accept an optional `frames` field beside `model`: a
888
+ literal package-relative path to a producer `rigc-frames/1` record inside the
889
+ package. Review reads, validates and hashes the file only when `frames` is
890
+ present, adds its path to `files`, and exposes the parsed record on the loaded
891
+ package as `frames: {path, sha256, sets: [{animation, fps, written, stride,
892
+ duration}]} | null` (`null` when the field is absent). Older manifests without
893
+ `frames` load unchanged with the same `sourceHash` and no runtime or type export
894
+ changes on `@rig-c/review/job-host`. Path validation reuses `packagePath` and
895
+ `safeFile` (`..`, absolute paths, symlinks escaping the package and files
896
+ missing from `sealedPlayback` refuse with the same messages as `model`). A
897
+ declared file missing from the package, unreadable JSON, a `spec` other than
898
+ `rigc-frames/1`, a malformed set field (`sets[].animation`, `fps`, `written`,
899
+ `stride`, `duration`), or two sets naming the same animation refuses by name
900
+ (`FRAMES_MISSING`, `FRAMES_JSON`, `FRAMES_SPEC`, `FRAMES_FIELD`,
901
+ `FRAMES_DUPLICATE_ANIMATION`), never falling back silently.
902
+
903
+ The record is the comment frame clock (#1018). On a package with a compiled
904
+ model, each set is checked against the model animation it names when the
905
+ package loads. The rule is measured from the producer, not from the clip length:
906
+ `@rig-c/core` 3.8.0 `rigc render` samples an animation of duration `D` to
907
+ `round(D * fps) + 1` frames, frame `i` at `i / fps`, writes every `stride`-th one
908
+ from frame 0 and records the last sample's time as `duration`. For example, a
909
+ 0.8 s clip at 12 fps gives 11 frames and `duration` 0.8333, not 0.8, so a set's
910
+ `duration` is not compared with the clip length. A set naming no model animation, a
911
+ `written` other than `floor(round(D * fps) / stride) + 1`, or a `duration` more
912
+ than `1e-9` s from `round(D * fps) / fps` refuses the package by name
913
+ (`FRAMES_ANIMATION_UNKNOWN`, `FRAMES_COUNT_MISMATCH`, `FRAMES_DURATION_MISMATCH`)
914
+ where the other `FRAMES_*` refusals surface, and indexes nothing. The refusal
915
+ names the animation and both figures, the record's and the model's schedule. The tolerance
916
+ covers float rounding only (`i * (1 / fps)` against `i / fps` differs by at most
917
+ `7.3e-12` s over 100,000 frames at 1–240 fps). An accepted set becomes the clock
918
+ for its animation: `written` frames, frame `i` at `i * stride / fps`. The report's
919
+ clock keeps the animation it names; an animation with no set has no clock and its
920
+ comments stay time-only. The page's transport and the server's comment validation
921
+ read the same per-animation clocks from `feedbackCatalog.frameClocks`
922
+ (`[{animation, clock}]`, present only when the package declares `frames` and has a
923
+ compiled model), so a pinned comment on such an animation carries
924
+ `frame: {index, basis: "producer"}`. Packages without `frames` are unchanged, and
925
+ the comment act's shape is unchanged.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rig-c/review",
3
- "version": "4.9.1",
3
+ "version": "4.11.0",
4
4
  "type": "module",
5
5
  "description": "Local human rig inspection and structured feedback export",
6
6
  "license": "MIT",
@@ -26,7 +26,7 @@
26
26
  "pngjs": "7.0.0"
27
27
  },
28
28
  "devDependencies": {
29
- "@rig-c/parts": "2.47.0",
29
+ "@rig-c/parts": "2.49.1",
30
30
  "@types/bun": "^1.3.0",
31
31
  "typescript": "^5.9.3"
32
32
  },
@@ -26,8 +26,10 @@ export const PART_PAD = 4;
26
26
  const GRID = 256;
27
27
 
28
28
  export type RigPoint = [number, number];
29
- /** The `contour.bust` entry as the config holds it; absent optional fields are the producer's defaults. */
30
- export interface BustSpec { apex_r: RigPoint; apex_l: RigPoint; cleavage: RigPoint; alpha?: number; clearance?: number; bone_r?: string; bone_l?: string; spacing?: number }
29
+ /** The published job spec and the landmark reader allow cleavage to be omitted. */
30
+ export interface BustLandmarks { apex_r: RigPoint; apex_l: RigPoint; cleavage?: RigPoint; alpha?: number; clearance?: number; bone_r?: string; bone_l?: string; spacing?: number }
31
+ /** Circle derivation and standalone Apply require all three points. */
32
+ export interface BustSpec extends BustLandmarks { cleavage: RigPoint }
31
33
  /** A derived region in the config's circle shape (key order as parts writes it). */
32
34
  export interface DerivedBustRegion { name: 'bust_r' | 'bust_l'; shape: 'circle'; cx: number; cy: number; r: number; spacing: number; band: number; bone: string }
33
35
  export interface BustDerivation {
@@ -81,10 +83,13 @@ function point(v: unknown, field: string): RigPoint {
81
83
  * positive numbers, `clearance` a number, bone names non-empty strings); the geometry (`CONFIG_BUST_CLEARANCE`) and
82
84
  * whether the bones resolve (`CONFIG_NAME_RESOLVES`) are the producer's to judge. Key order is the producer's.
83
85
  */
84
- export function parseBustSpec(value: unknown, field = 'bust'): BustSpec {
86
+ export function parseBustSpec(value: unknown, field?: string): BustSpec;
87
+ export function parseBustSpec(value: unknown, field: string, allowMissingCleavage: true): BustLandmarks;
88
+ export function parseBustSpec(value: unknown, field = 'bust', allowMissingCleavage = false): BustLandmarks {
85
89
  if (!isObject(value)) return bad(`${field} must be an object`);
86
90
  for (const key of Object.keys(value)) if (!(BUST_SPEC_FIELDS as readonly string[]).includes(key)) bad(`${field}.${key} is not a contour.bust field`);
87
- const out: BustSpec = { apex_r: point(value.apex_r, `${field}.apex_r`), apex_l: point(value.apex_l, `${field}.apex_l`), cleavage: point(value.cleavage, `${field}.cleavage`) };
91
+ const out: BustLandmarks = {apex_r: point(value.apex_r, `${field}.apex_r`), apex_l: point(value.apex_l, `${field}.apex_l`)};
92
+ if (!allowMissingCleavage || Object.hasOwn(value, 'cleavage')) out.cleavage = point(value.cleavage, `${field}.cleavage`);
88
93
  for (const key of ['alpha', 'clearance', 'spacing'] as const) {
89
94
  if (!(key in value)) continue;
90
95
  const n = value[key];
@@ -31,15 +31,35 @@ export function clothPatchKind(ops: readonly Pick<PatchOp, 'path'>[]): 'cloth' |
31
31
  return n === 0 ? 'none' : n === ops.length ? 'cloth' : 'mixed';
32
32
  }
33
33
 
34
+ /** The producer package's typed export key for its cloth target list (#954, paired with rig-c/parts#1433). */
35
+ export const CLOTH_TARGETS_EXPORT = './cloth-targets.json';
36
+ /** The first `@rig-c/parts` release exporting `./cloth-targets.json` (rig-c/parts#1433). */
37
+ export const CLOTH_TARGETS_SINCE = '2.51.0';
38
+ /** The schema of `@rig-c/parts`' `./cloth-targets.json` export. */
39
+ export const CLOTH_TARGETS_SCHEMA = 'rig-parts/cloth-targets@1';
40
+ export const CLOTH_TARGETS_INVALID = 'CLOTH_TARGETS_INVALID';
41
+ export const CLOTH_TARGETS_UNAVAILABLE = 'CLOTH_TARGETS_UNAVAILABLE';
42
+ export const clothTargetsUnavailable = (version: string) => `${CLOTH_TARGETS_UNAVAILABLE}: the installed rig-parts ${version || 'unknown'} has no cloth-targets export (needs ${CLOTH_TARGETS_SINCE})`;
43
+
44
+ export class ClothTargetsError extends Error { constructor(detail: string) { super(`${CLOTH_TARGETS_INVALID}: ${detail}`); } }
45
+
46
+ /** The tags the config's own `cloth` block already declares. */
47
+ export function configClothTags(config: unknown): string[] {
48
+ const cloth = isObject(config) ? config.cloth : undefined;
49
+ return isObject(cloth) ? Object.keys(cloth).filter(k => k !== 'note' && !k.endsWith('_note') && !k.startsWith('x-')) : [];
50
+ }
51
+
34
52
  /**
35
- * The tags the installed reader accepts, read from its own source text (`export const CLOTH_TARGETS = [...]`), or null
36
- * when the text does not state them in that form.
53
+ * The tags the installed reader accepts, validated from its `./cloth-targets.json` export (`rig-parts/cloth-targets@1`).
37
54
  */
38
- export function readClothTargets(sourceText: string): string[] | null {
39
- const m = /export const CLOTH_TARGETS\s*=\s*\[([^\]]*)\]/.exec(sourceText);
40
- if (!m) return null;
41
- const tags = [...m[1]!.matchAll(/'([^']+)'|"([^"]+)"/g)].map(x => x[1] ?? x[2]!);
42
- return tags.length ? tags : null;
55
+ export function parseClothTargets(value: unknown): string[] {
56
+ if (!isObject(value) || value.schema !== CLOTH_TARGETS_SCHEMA || Object.keys(value).some(k => k !== 'schema' && k !== 'targets')) {
57
+ throw new ClothTargetsError(`expected {"schema":${JSON.stringify(CLOTH_TARGETS_SCHEMA)},"targets":[…]}`);
58
+ }
59
+ if (!Array.isArray(value.targets) || !value.targets.length) throw new ClothTargetsError('targets must be a non-empty array of strings');
60
+ const tags = value.targets.map(t => { if (typeof t !== 'string' || !t.trim()) throw new ClothTargetsError('targets must contain non-empty strings'); return t; });
61
+ if (new Set(tags).size !== tags.length) throw new ClothTargetsError('targets must be distinct');
62
+ return tags;
43
63
  }
44
64
 
45
65
  /** One recipe field the form edits: its pointer below `/cloth/<tag>` and how it is typed. The producer judges every value. */