rig-review 3.7.0 → 4.0.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 +3 -3
- package/docs/DESIGN.md +145 -74
- package/docs/PANELS.md +20 -12
- package/docs/PARTS_VIEW.md +133 -76
- package/docs/REVIEW_PACKAGE.md +446 -100
- package/docs/STABILITY.md +132 -198
- package/docs/WORKFLOWS.md +41 -120
- package/package.json +4 -3
- package/skills/rig-review/SKILL.md +41 -27
- package/src/build.ts +10 -2
- package/src/cli.ts +17 -16
- package/src/comment-crops.ts +6 -1
- package/src/compare-html.ts +22 -24
- package/src/compare-server.ts +1 -1
- package/src/compare-session.ts +41 -3
- package/src/correction-handoff.ts +27 -4
- package/src/create-pin-gate.ts +3 -0
- package/src/direction-inspection.ts +6 -2
- package/src/feedback-export.ts +68 -1
- package/src/front.ts +5 -200
- package/src/handoff.ts +1 -1
- package/src/interview-routes.ts +1 -1
- package/src/interview-scene.ts +3 -3
- package/src/job-act.ts +77 -73
- package/src/job-api.ts +326 -13
- package/src/job-checkpoint-evidence.ts +113 -0
- package/src/job-cli.ts +27 -14
- package/src/job-contract.ts +284 -62
- package/src/job-front.ts +192 -61
- package/src/job-host.ts +23 -4
- package/src/job-session.ts +109 -24
- package/src/job-source.ts +227 -58
- package/src/job-store.ts +80 -6
- package/src/job-worker.ts +1 -47
- package/src/joined-project.ts +61 -4
- package/src/manifest.ts +32 -4
- package/src/open-workspace.ts +12 -12
- package/src/open.ts +19 -12
- package/src/parts-comment-crops.ts +126 -31
- package/src/parts-comment.ts +351 -28
- package/src/parts-server.ts +19 -7
- package/src/parts-view.ts +588 -109
- package/src/scene-inspection.ts +50 -0
- package/src/server.ts +31 -22
- package/src/session.ts +58 -0
- package/src/stage-comment.ts +48 -1
- package/src/stage-parts.ts +23 -11
- package/web/animation-inspection.ts +1 -1
- package/web/bones-panel.ts +1 -3
- package/web/catalog-en.ts +175 -39
- package/web/catalog-ko.ts +175 -39
- package/web/cloth-panel.ts +1 -2
- package/web/compare.css +3 -13
- package/web/compare.html +3 -3
- package/web/compare.ts +69 -64
- package/web/cuts-panel.ts +1 -3
- package/web/density-strip-panel.ts +1 -2
- package/web/direction-panel.ts +22 -6
- package/web/i18n.ts +13 -1
- package/web/idle-panel.ts +1 -2
- package/web/index.html +1 -5
- package/web/inspection-persistence.ts +2 -1
- package/web/inspector-blocks.ts +149 -40
- package/web/instance-access.ts +24 -5
- package/web/interview-panel.ts +224 -175
- package/web/job-rig-capture.ts +164 -21
- package/web/job-rig-screen.ts +344 -0
- package/web/job-session.ts +611 -1443
- package/web/main.ts +614 -151
- package/web/mesh-panel.ts +1 -2
- package/web/owner-workspace.ts +88 -109
- package/web/part-selection.ts +47 -6
- package/web/part-thumbnails.ts +20 -6
- package/web/parts-render.ts +26 -19
- package/web/parts-viewport-provider.ts +181 -7
- package/web/physics-panel.ts +1 -2
- package/web/readings-panel.ts +1 -2
- package/web/requirements-panel.ts +1 -3
- package/web/retained-frame-stage.ts +105 -0
- package/web/retarget-panel.ts +2 -3
- package/web/rig-fields-panel.ts +1 -2
- package/web/rig-host.ts +64 -0
- package/web/rig-viewport-provider.ts +65 -16
- package/web/scene-plates.ts +57 -4
- package/web/stage-comments.ts +103 -46
- package/web/styles.css +117 -63
- package/web/view-controls.ts +201 -12
- package/web/viewport-capture.ts +12 -2
- package/web/viewport-controller.ts +107 -27
- package/web/viewport-pair.ts +2 -1
- package/web/workspace-preferences.ts +5 -4
- package/web/workspace-ui.ts +151 -19
- package/src/front-worker.ts +0 -2
- package/src/interview-server.ts +0 -54
- package/src/job-hub.ts +0 -304
- package/src/job-image-set.ts +0 -50
- package/web/interview.css +0 -28
- package/web/interview.html +0 -17
- package/web/interview.ts +0 -40
- package/web/job-hub.css +0 -14
- package/web/job-hub.html +0 -5
- package/web/job-hub.ts +0 -179
- package/web/owner-workspace.css +0 -14
- package/web/owner-workspace.html +0 -5
- package/web/parts-flags.ts +0 -48
- package/web/parts.css +0 -104
- package/web/parts.html +0 -49
- package/web/parts.ts +0 -604
- package/web/stage-nav.ts +0 -136
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rig-review",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Local human rig inspection and structured feedback export",
|
|
6
6
|
"license": "MIT",
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"check:demo": "bun run check -- examples/demo/review.json",
|
|
11
11
|
"demo": "bun src/entry.ts examples/demo/review.json --view-only",
|
|
12
12
|
"check:readme": "bun scripts/check-readme.ts",
|
|
13
|
+
"check:screen-copies": "bun scripts/screen-copies.ts",
|
|
13
14
|
"typecheck": "tsc --noEmit",
|
|
14
15
|
"test": "bun test",
|
|
15
16
|
"build": "bun src/build.ts",
|
|
@@ -20,12 +21,12 @@
|
|
|
20
21
|
},
|
|
21
22
|
"dependencies": {
|
|
22
23
|
"@napi-rs/canvas": "1.0.11",
|
|
23
|
-
"@rig-c/play": "
|
|
24
|
+
"@rig-c/play": "1.24.0",
|
|
24
25
|
"@types/pngjs": "6.0.5",
|
|
25
26
|
"pngjs": "7.0.0"
|
|
26
27
|
},
|
|
27
28
|
"devDependencies": {
|
|
28
|
-
"@rig-c/parts": "
|
|
29
|
+
"@rig-c/parts": "2.37.0",
|
|
29
30
|
"@types/bun": "^1.3.0",
|
|
30
31
|
"typescript": "^5.9.3"
|
|
31
32
|
},
|
|
@@ -10,6 +10,35 @@ compatibility: Requires Bun 1.3.0 or later on PATH. The canonical npm package is
|
|
|
10
10
|
Use this to hand separated parts, a rig or a post to a person for inspection,
|
|
11
11
|
or to read back their submitted review.
|
|
12
12
|
|
|
13
|
+
### Interview-stage project without a package
|
|
14
|
+
|
|
15
|
+
When the designated project is at the interview stage and has neither a
|
|
16
|
+
recorded draft nor a non-null `versions[].review_package`, the approved
|
|
17
|
+
single-target form is:
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
rig-review open /path/to/project --project /path/to/project --picks-dir scratch/review-picks
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
The picks directory must already exist and be disjoint from declared inputs.
|
|
24
|
+
Both root operands must resolve to the same project. Demo/build version records
|
|
25
|
+
and unrelated derived evidence are allowed; `derived/` may be absent. Explicit
|
|
26
|
+
version/draft selectors stay strict and never fall back. This form takes no
|
|
27
|
+
additional inspection flags and adds no `feedback` or `control` grammar.
|
|
28
|
+
|
|
29
|
+
The existing Review workspace hosts the interview in its existing modal.
|
|
30
|
+
Model-dependent capabilities are named unavailable (`MODEL_UNAVAILABLE`); no
|
|
31
|
+
manifest, model or package session is synthesized. Project, option-set and input
|
|
32
|
+
hashes bind the inspection, and changed bytes require reopening
|
|
33
|
+
(`INTERVIEW_OPTIONS_STALE`). The joined dialog and standing record form use one shared list | image | survey
|
|
34
|
+
answer builder. There is no interview Note input. Existing saved or historical
|
|
35
|
+
notes remain readable as read-only text and are carried unchanged. Joined picks
|
|
36
|
+
omit `note` when none exists; the job act retains its required string field.
|
|
37
|
+
Historical records, picks/act/verdict schemas and explicit
|
|
38
|
+
version/draft joins retain their existing readers and checks. Use the
|
|
39
|
+
semantic standing cycle for active consumer ingestion; do not construct or
|
|
40
|
+
carry picks files to bypass it. See [project opening stability](https://github.com/rig-c/review/blob/main/docs/STABILITY.md#interview-stage-project-opening).
|
|
41
|
+
|
|
13
42
|
## Open one owner workspace
|
|
14
43
|
|
|
15
44
|
For folder inspections, use **N rigs → one invocation, one owner link**.
|
|
@@ -65,39 +94,25 @@ Leave existing workers under their owner's control. Follow
|
|
|
65
94
|
[workspace lifecycle and restart](https://github.com/rig-c/review/blob/main/docs/WORKFLOWS.md#workspace-lifecycle-and-restart)
|
|
66
95
|
for host reuse, live unresponsive PID refusal and aggregate shutdown behavior.
|
|
67
96
|
|
|
68
|
-
For
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
and
|
|
73
|
-
|
|
74
|
-
generation CAS, source, asks, acts, cursors and grants separate under
|
|
75
|
-
job-api@2/act@2. Follow the
|
|
76
|
-
[embedded workflow and trusted-hook example](https://github.com/rig-c/review/blob/main/docs/WORKFLOWS.md#embedded-semantic-jobs)
|
|
77
|
-
and [public signatures](https://github.com/rig-c/review/blob/main/docs/STABILITY.md#embedded-semantic-job-hub).
|
|
97
|
+
For CLI integrations, use **N reviews → one invocation, one owner URL**.
|
|
98
|
+
Core's `rigc review` passes arguments through unchanged. For semantic jobs, use
|
|
99
|
+
`startJobHost` from `@rig-c/review/job-host` once per designated job and give the person that host's owner URL and one
|
|
100
|
+
what-to-look-at line. Keep each job's identity, generation CAS, source, asks,
|
|
101
|
+
acts, cursors and grants separate under job-api@2/act@2. Follow the
|
|
102
|
+
[public signatures](https://github.com/rig-c/review/blob/main/docs/STABILITY.md#managed-owner-host).
|
|
78
103
|
|
|
79
104
|
Register `readPublished`, `partsEnumerator` and `installWriterBinding` with their
|
|
80
105
|
declared IDs in the owning process. The consumer host owns these implementations
|
|
81
106
|
and private bootstrap channels. General cross-process callback registration is
|
|
82
|
-
deferred.
|
|
83
|
-
supported. An active external standalone owner refuses `JOB_HUB_EXTERNAL_HOST`,
|
|
84
|
-
and a live unresponsive owner refuses `JOB_HUB_HOST_UNRESPONSIVE`.
|
|
107
|
+
deferred.
|
|
85
108
|
|
|
86
109
|
Use `publish`, `ask` and `next` per job. The trusted writer directly fetches
|
|
87
110
|
finalized acts with its separate read-only grant. Human submission stays in the
|
|
88
111
|
Review UI. Semantic `close` ends only that job and revokes its writer grant.
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
count toward the hub's 32-entry application bound. Selected frames are retained
|
|
94
|
-
lazily within that bound, with no hardware performance guarantee.
|
|
95
|
-
|
|
96
|
-
External consumer-owned hub adoption remains pending in
|
|
97
|
-
[Review #512](https://github.com/rig-c/review/issues/512). Keep imagery, questions
|
|
98
|
-
and approvals in the Review UI through supported commands and APIs. Supplied
|
|
99
|
-
sources stay immutable. Agents never construct internal Review state, binding
|
|
100
|
-
files or human acts, and owner capabilities stay in private owner channels.
|
|
112
|
+
Keep imagery, questions and approvals in the Review UI through supported
|
|
113
|
+
commands and APIs. Supplied sources stay immutable. Agents never construct
|
|
114
|
+
internal Review state, binding files or human acts, and owner capabilities stay
|
|
115
|
+
in private owner channels.
|
|
101
116
|
|
|
102
117
|
## Active cycle standing live-job contract
|
|
103
118
|
|
|
@@ -141,7 +156,7 @@ rig-review session close http://127.0.0.1:<port>/jobs/<job-id> \
|
|
|
141
156
|
- **Explicit producer-held freeze and explicit close.** Every `publish` carries an explicit producer-held freeze (`freeze.kind` set to `'producer-held'`, `holdId`, `record` as `JobFileIdentity` or `null` for a declared non-Create root) held until acknowledgment as a caller obligation. Review validates retained bytes, detects a moved record and commits local generation CAS. No watched-root or automatic-close guarantee exists, and only explicit `close` ends an active job.
|
|
142
157
|
- **Exact displayed source, cursor replay and draft retention.** `next` (`after` cursor and bounded abortable `waitMs` that never consumes an act) replays complete durable `JobEvent` items (`published`, `pending`, `act`, `closed`). The daemon derives `JobSourceBinding` from validated retained bytes and the page-scoped `displayedNonce` receipt rather than browser-supplied hashes. When a new publication replaces or updates the displayed source, old local drafts remain retained for their original source binding and are flagged without rebinding onto the new publication.
|
|
143
158
|
- **Five enabled act kinds and two reserved disabled kinds.** Enabled kinds are `interview-picks`, `checkpoint`, `parts-verdict`, `review-verdict` and `signoff`. Reserved kinds `described-correction` (awaiting the joint [Create #182](https://github.com/rig-c/create/issues/182) context allowlist) and `mesh-edit` (awaiting the joint [Parts #1159](https://github.com/rig-c/parts/issues/1159) freeze) stay disabled (`JOB_ACT_KIND_DISABLED`) and cannot be asked or submitted.
|
|
144
|
-
- **Checkpoints, signoffs, plan steps and parts PNGs.** Finalized `checkpoint` acts carry `outcome` `'pass'` or `'fail'` only (`'pending'` stays in the UI draft), require `words` as a string preserved verbatim including empty or whitespace-only text, copy `planStepId` from the validated ask on the daemon while the browser sends `checkpointId`, `outcome` and `words` only, and leave stage derivation to Create (only `'pass'` is eligible for Create's checkpoint sign-off writer). Finalized `signoff` acts carry `decision` `'approved'` only with required `words` preserved verbatim including empty or whitespace-only text, remain separate from verdicts and Create stage transitions, and require `source.plan` with exact displayed step IDs and hashes published by [Create #184](https://github.com/rig-c/create/issues/184) (without Review recomputing `stepHash`) on `plan-approved`, `rigging-interview` and `post-interview`. C4 binds the exact public `partsFileReferences(dir)` array from `@rig-c/parts/src/parts.ts`, whose contract is frozen at Parts 2.25.0. The trusted host resolves an installed version in `JOB_PARTS_ENUMERATOR_RANGE` (`>=2.25.0 <
|
|
159
|
+
- **Checkpoints, signoffs, plan steps and parts PNGs.** Finalized `checkpoint` acts carry `outcome` `'pass'` or `'fail'` only (`'pending'` stays in the UI draft), require `words` as a string preserved verbatim including empty or whitespace-only text, copy `planStepId` from the validated ask on the daemon while the browser sends `checkpointId`, `outcome` and `words` only, and leave stage derivation to Create (only `'pass'` is eligible for Create's checkpoint sign-off writer). Finalized `signoff` acts carry `decision` `'approved'` only with required `words` preserved verbatim including empty or whitespace-only text, remain separate from verdicts and Create stage transitions, and require `source.plan` with exact displayed step IDs and hashes published by [Create #184](https://github.com/rig-c/create/issues/184) (without Review recomputing `stepHash`) on `plan-approved`, `rigging-interview` and `post-interview`. C4 binds the exact public `partsFileReferences(dir)` array from `@rig-c/parts/src/parts.ts`, whose contract is frozen at Parts 2.25.0. The trusted host resolves an installed version in `JOB_PARTS_ENUMERATOR_RANGE` (`>=2.25.0 <3.0.0`), supplies its actual version and official callback through `partsEnumerator`, and declares `partsEnumeratorId`. `JobPartsIdentity.enumeratorVersion` carries that actual version. Manifest paths are work-root-relative and image paths are relative to the manifest directory. Each image carries `path`, bounded-string `role` and raw-byte `sha256`. Review compares the claimed array positionally with the official array, preserving its role/order/duplicate semantics. Upstream roles include `part`, `alternate`, `depth`, `painting` and `figure_mask`. Review bounds shape and paths, refuses traversal/symlinks, decodes PNGs and hashes retained bytes. Missing references refuse with row, role and path, including a missing sibling figure mask when a render copy exists. Unreferenced extras stay outside this parts identity. Composite source hashes use `rig-review-job-source/2`. Create #184 production reader/projection and official-hook wiring remain pending.
|
|
145
160
|
- **No agent file carriage, writer-owned sibling fetch and public host seam.** Agents never build, parse, reshape or carry Review session, picks, verdict or applied-record storage files. [Create #182](https://github.com/rig-c/create/issues/182) and [Create #184](https://github.com/rig-c/create/issues/184) own direct writer publication and `fetch-act` reads using a private writer-owned sibling binding outside `project.json` (`writer-owned-sibling-fetch-capability`, pending Create #184 production reader/writer integration) that is never tracked in version control or unstaged project output, dies at explicit `close` and receives a new grant on each job incarnation. In the public managed-host startup seam (`startJobHost` from `@rig-c/review/job-host`, frozen in [Public API stability](https://github.com/rig-c/review/blob/main/docs/STABILITY.md#managed-owner-host)), hook-bearing host callers declare `readerId`, `bindingId` and `partsEnumeratorId`; equality plus API/act schemas and actual enumerator version govern authenticated active-listener reuse and missing or mismatched IDs refuse by name (`JOB_HOST_OPTION_ID_INVALID`, `JOB_HOST_REUSE_MISMATCH`) with no function hashes. Future mesh acts will be fetched by Create and passed in process to Parts' public exported API owned by [Parts #1159](https://github.com/rig-c/parts/issues/1159) without Parts reading Review or Create storage, while standalone `--delta` remains legacy outside this cycle.
|
|
146
161
|
- **Direction metadata vs playback.** Direction carriage in `#484` is metadata-only (`source.direction` and `direction-review`) and is distinct from [Review #482](https://github.com/rig-c/review/issues/482) preview and [Review #483](https://github.com/rig-c/review/issues/483) actual plated take playback, while [Review #373](https://github.com/rig-c/review/issues/373) stays parked.
|
|
147
162
|
|
|
@@ -174,7 +189,6 @@ The stage buttons navigate within that source binding.
|
|
|
174
189
|
standalone inspection and named limits on direct correction.
|
|
175
190
|
2. **Interview.** In the joined draft workspace choose **2 Interview**. For
|
|
176
191
|
choices bound to a recorded rig, open its package with the Stage 3 command.
|
|
177
|
-
The standalone entry is `rig-review interview <project> --picks-dir <picks-dir>`.
|
|
178
192
|
Beside the bound parts or source image, the person chooses among the saved
|
|
179
193
|
options with the agent's recommendation and rationale, then uses
|
|
180
194
|
**Save explicit picks**. Read the `rig-review/interview-picks@1` file for the
|
package/src/build.ts
CHANGED
|
@@ -6,9 +6,17 @@ export function playBuildConditions(root:string=appRoot):string[] {
|
|
|
6
6
|
try{return /[\\/]src[\\/]index\.ts$/.test(Bun.resolveSync('@rig-c/play',root))?[PLAY_SOURCE_CONDITION]:[];}
|
|
7
7
|
catch{return [];}
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
/** #706: the one entry (`web/index.html`) marked for a screen that opens in Setup with the parts mode only. The marker
|
|
10
|
+
* and asset names are trusted constants; no request or package data is interpolated. */
|
|
11
|
+
export async function setupEntryHtml(screen:'parts'|'stage-parts',assets:{script:string;styles:string}={script:'main.js',styles:'styles.css'},root:string=appRoot):Promise<string> {
|
|
12
|
+
const html=await Bun.file(join(root,'web/index.html')).text();
|
|
13
|
+
const marked=html.replace('<div id="app"></div>',`<div id="app" data-review-screen="${screen}"></div>`).replace('href="styles.css"',`href="${assets.styles}"`).replace('src="main.js"',`src="${assets.script}"`);
|
|
14
|
+
if(marked===html||!marked.includes(`data-review-screen="${screen}"`))throw new Error('SETUP_ENTRY_MARKER_MISSING');
|
|
15
|
+
return marked;
|
|
16
|
+
}
|
|
17
|
+
export async function buildWeb(mode:'single'|'compare'|'parts'|'workspace'='single',root:string=appRoot):Promise<Blob> {
|
|
10
18
|
const conditions=playBuildConditions(root);
|
|
11
|
-
const entry=join(root,mode==='
|
|
19
|
+
const entry=join(root,mode==='workspace'?'web/owner-workspace.ts':mode==='compare'?'web/compare.ts':'web/main.ts');
|
|
12
20
|
const result=await Bun.build({entrypoints:[entry],target:'browser',format:'esm',minify:false,...(conditions.length?{conditions}:{})});
|
|
13
21
|
if(!result.success)throw new Error(result.logs.map(v=>v.message).join('\n'));
|
|
14
22
|
const output=result.outputs.find(v=>v.path.endsWith('.js'));if(!output)throw new Error('frontend bundle: JavaScript output missing');return output;
|
package/src/cli.ts
CHANGED
|
@@ -18,14 +18,14 @@ import { readFeedbackSession, readFeedbackCompareSession } from './session-histo
|
|
|
18
18
|
import { startServer } from './server.ts';
|
|
19
19
|
import { loadCompare } from './compare.ts';
|
|
20
20
|
import { startCompareServer } from './compare-server.ts';
|
|
21
|
-
import { loadPartsView, readVerdict, readPartsVerdictJson, exportPartsVerdict, exportPartsCorrection, assertPartsUnchanged, type PartsViewOptions } from './parts-view.ts';
|
|
21
|
+
import { loadPartsView, readVerdict, readPartsVerdictForCli, readPartsVerdictJson, exportPartsVerdict, exportPartsCorrection, assertPartsUnchanged, assertPartsCanOpen, type PartsViewOptions } from './parts-view.ts';
|
|
22
22
|
import { startPartsServer } from './parts-server.ts';
|
|
23
23
|
import { readSession, parseSession, sessionFile, type Feedback } from './session.ts';
|
|
24
24
|
import { readCompareSession } from './compare-session.ts';
|
|
25
25
|
import { exportReviewStrip, exportCompareStrip, stripJson, writeStripOutput, validateStripOutput } from './strip-export.ts';
|
|
26
26
|
import type { StripInterval, StripRequest } from './strip.ts';
|
|
27
27
|
const handoffUsage='[--config <path> [--parts <dir>] [--source <png> --full <dir> [--head <dir>]] [--keypoints <file>]]';
|
|
28
|
-
const usage='Usage: rig-review open <dir> [<dir> ...] [--animation-for <index> <name>] [--reference <video>] [--compare <dir>] [--animation <name>] [--control] [--direct] [--view-only] [--project <create-root> (--project-version <rig> [--post-version <post>] | --project-draft <id> [--parts-verdict-dir <dir>]) --picks-dir <dir>] '+handoffUsage+'\n --config declares the producer handoff (wins over the review.json "producer" block and discovery of config.json, rig/config.json, ../config.json beside an opened out/); feedback and control take the same flags; --view-only opens without a producer handoff.\n open is managed by default: one owner workspace at 127.0.0.1:4318 (RIG_REVIEW_FRONT_PORT overrides) hosts targets in one process; --animation applies to all targets, --animation-for overrides one 1-based target, and --direct keeps a separate single-target worker.\n rig-review control <dir> [--reference <video>] [--compare <dir>] [--animation <name>] '+handoffUsage+' [--project <create-root> --project-version <rig> --picks-dir <dir> [--post-version <post>]] [--page <id> --expected-revision <n> --command <JSON> --wait-ms <n>]\n rig-review feedback <dir> [--reference <video>] [--compare <dir>] [--animation <name>] '+handoffUsage+' [--project <create-root> --project-version <rig> --picks-dir <dir> [--post-version <post>]] [--format json|issue] [--correction <item id>]\n rig-review <dir> <dir> ... [--animation <name>] [--animation-for <index> <name>] [--port 4318] [--reference <video>] [--view-only] [--control] '+handoffUsage+'\n Foreground multi owns a new workspace in this CLI process; a compatible existing owner is joined and the launcher exits. Multi --port accepts 1..65535; single foreground keeps 4317 and --port 0.\n Usage: bun run review -- <review.json|output-directory> [--port 4317] [--checkpoint ID] [--view-only]\n bun run check -- <review.json|output-directory>\n bun run feedback -- <review.json|output-directory>\n bun run review -- compare <a> <b> --reference <video> --animation <name> [--port 4317]\n bun run check -- compare <a> <b> --reference <video> --animation <name>\n bun run feedback -- compare <a> <b> --reference <video> --animation <name>\n rig-review parts <build root | parts dir | review package> [--rig <file>] [--mesh-report <file>] [--check <file>] [--verdict <file>] [--painting <png>] [--by <name>] [--format json|issue] [--correction <item id> --parts-file <inventory> [--part-note <part>]] [--port <n>]\n rig-review
|
|
28
|
+
const usage='Usage: rig-review open <dir> [<dir> ...] [--animation-for <index> <name>] [--reference <video>] [--compare <dir>] [--animation <name>] [--control] [--direct] [--view-only] [--project <create-root> [(--project-version <rig> [--post-version <post>] | --project-draft <id> [--parts-verdict-dir <dir>])] --picks-dir <dir>] '+handoffUsage+'\n --config declares the producer handoff (wins over the review.json "producer" block and discovery of config.json, rig/config.json, ../config.json beside an opened out/); feedback and control take the same flags; --view-only opens without a producer handoff.\n open is managed by default: one owner workspace at 127.0.0.1:4318 (RIG_REVIEW_FRONT_PORT overrides) hosts targets in one process; --animation applies to all targets, --animation-for overrides one 1-based target, and --direct keeps a separate single-target worker.\n rig-review control <dir> [--reference <video>] [--compare <dir>] [--animation <name>] '+handoffUsage+' [--project <create-root> --project-version <rig> --picks-dir <dir> [--post-version <post>]] [--page <id> --expected-revision <n> --command <JSON> --wait-ms <n>]\n rig-review feedback <dir> [--reference <video>] [--compare <dir>] [--animation <name>] '+handoffUsage+' [--project <create-root> --project-version <rig> --picks-dir <dir> [--post-version <post>]] [--format json|issue] [--correction <item id>]\n rig-review <dir> <dir> ... [--animation <name>] [--animation-for <index> <name>] [--port 4318] [--reference <video>] [--view-only] [--control] '+handoffUsage+'\n Foreground multi owns a new workspace in this CLI process; a compatible existing owner is joined and the launcher exits. Multi --port accepts 1..65535; single foreground keeps 4317 and --port 0.\n Usage: bun run review -- <review.json|output-directory> [--port 4317] [--checkpoint ID] [--view-only]\n bun run check -- <review.json|output-directory>\n bun run feedback -- <review.json|output-directory>\n bun run review -- compare <a> <b> --reference <video> --animation <name> [--port 4317]\n bun run check -- compare <a> <b> --reference <video> --animation <name>\n bun run feedback -- compare <a> <b> --reference <video> --animation <name>\n rig-review parts <build root | parts dir | review package> [--rig <file>] [--mesh-report <file>] [--check <file>] [--verdict <file>] [--painting <png>] [--by <name>] [--format json|issue] [--correction <item id> --parts-file <inventory> [--part-note <part>]] [--port <n>]\n rig-review --version';
|
|
29
29
|
async function stripCommand(args:string[],options:{stateDir?:string}){
|
|
30
30
|
const compare=args[0]==='compare';if(compare)args.shift();const a=args.shift(),b=compare?args.shift():undefined;if(!a||compare&&!b)throw new Error('strip: expected package input(s)');
|
|
31
31
|
let reference:string|undefined,referenceVideo:string|undefined,animation:string|undefined,basis:'a'|'b'|undefined,range:string|undefined,output:string|undefined,jsonOnly=false,all=false;
|
|
@@ -48,23 +48,24 @@ function handoffOption(flag:string):(typeof HANDOFF_FLAGS)[number]|null {const n
|
|
|
48
48
|
const projectFlags = ['--project','--project-version','--picks-dir','--post-version','--project-draft','--parts-verdict-dir'];
|
|
49
49
|
/** The retrieval words for the handoff flags, in their fixed order. */
|
|
50
50
|
const projectWords=(inputs:OpenInputs)=>{const p=inputs.project;return p?[
|
|
51
|
-
'--project',p.root,...(p.draftId
|
|
51
|
+
'--project',p.root,...(p.draftId!==undefined?['--project-draft',p.draftId]:p.version!==undefined?['--project-version',String(p.version)]:[]),'--picks-dir',p.picksDir,
|
|
52
52
|
...(p.partsVerdictDir===undefined?[]:['--parts-verdict-dir',p.partsVerdictDir]),
|
|
53
53
|
...(p.postVersion===undefined?[]:['--post-version',String(p.postVersion)]),
|
|
54
54
|
]:[];};
|
|
55
55
|
const handoffWords=(inputs:OpenInputs)=>HANDOFF_FLAGS.flatMap(f=>inputs[f]!==undefined?['--'+f,inputs[f]!]:[]);
|
|
56
|
-
export function parseOpenInputs(args:string[]):OpenInputs {
|
|
56
|
+
export function parseOpenInputs(args:string[],options:{interview?:boolean}={}):OpenInputs {
|
|
57
57
|
const input=args.shift();if(!input||input.startsWith('--'))throw new Error(usage);const result:OpenInputs={input},seen=new Set<string>();
|
|
58
58
|
let root:string|undefined,version:string|undefined,postVersion:string|undefined,picksDir:string|undefined,draftId:string|undefined,partsVerdictDir:string|undefined;
|
|
59
59
|
while(args.length){const flag=args.shift()!;if(seen.has(flag))throw new Error(`OPEN_OPTION_INVALID ${flag}: Duplicate open option ${flag}`);seen.add(flag);if(flag==='--control'){result.control=true;continue;}if(flag==='--direct'){result.direct=true;continue;}if(flag==='--view-only'){result.viewOnly=true;continue;}const value=args.shift();if(value===undefined||value==='')throw new Error(`OPEN_OPTION_INVALID ${flag}: Missing value for ${flag}`);if(flag==='--reference')result.reference=value;else if(flag==='--compare')result.compare=value;else if(flag==='--animation')result.animation=value;else if(flag==='--project')root=value;else if(flag==='--project-version')version=value;else if(flag==='--picks-dir')picksDir=value;else if(flag==='--project-draft')draftId=value;else if(flag==='--parts-verdict-dir')partsVerdictDir=value;else if(flag==='--post-version')postVersion=value;else if(handoffOption(flag))result[handoffOption(flag)!]=value;else throw new Error(`OPEN_OPTION_INVALID ${flag}: Unknown open option ${flag}`);}
|
|
60
60
|
if(root!==undefined||version!==undefined||picksDir!==undefined||postVersion!==undefined||draftId!==undefined||partsVerdictDir!==undefined){
|
|
61
|
-
if(!root||!picksDir||(Boolean(version)
|
|
61
|
+
if(!root||!picksDir||(Boolean(version)&&Boolean(draftId))||options.interview===false&&!version&&!draftId||result.compare!==undefined||version!==undefined&&(!/^\d+$/.test(version)||!Number.isSafeInteger(Number(version))||Number(version)<1))
|
|
62
62
|
throw new Error('OPEN_OPTION_INVALID --project: single-package open requires --project, --picks-dir and one of --project-version or --project-draft together');
|
|
63
63
|
if(postVersion!==undefined&&(!/^\d+$/.test(postVersion)||!Number.isSafeInteger(Number(postVersion))||Number(postVersion)<1))
|
|
64
64
|
throw new Error('OPEN_OPTION_INVALID --post-version: expected a positive Create post version');
|
|
65
|
-
if(
|
|
65
|
+
if(!version&&postVersion)throw new Error('OPEN_OPTION_INVALID --post-version: requires --project-version');
|
|
66
66
|
if(partsVerdictDir&&(!draftId||result.viewOnly))throw new Error('OPEN_OPTION_INVALID --parts-verdict-dir: requires a writable --project-draft');
|
|
67
|
-
|
|
67
|
+
if(!version&&!draftId&&(result.reference!==undefined||result.animation!==undefined||result.control||result.direct||result.viewOnly||handoffFlags(result)))throw new Error('OPEN_OPTION_INVALID --project: interview-only open takes only the project root, --project and --picks-dir');
|
|
68
|
+
result.project=!version&&!draftId?{root,picksDir}:draftId?{root,draftId,picksDir,...(partsVerdictDir?{partsVerdictDir}:{})}:{root,version:Number(version),picksDir,...(postVersion!==undefined?{postVersion:Number(postVersion)}:{})};
|
|
68
69
|
}
|
|
69
70
|
const problem=checkHandoffFlags(result);if(problem)throw new Error(`OPEN_OPTION_INVALID ${problem.split(':')[0]}: ${problem.slice(problem.indexOf(':')+2)}`);
|
|
70
71
|
if(result.compare!==undefined&&handoffFlags(result))throw new Error('OPEN_OPTION_INVALID --config: compare takes no producer handoff; open one package with --config');
|
|
@@ -105,6 +106,7 @@ export function parseOpenTargets(args: readonly string[]): OpenInputs[] {
|
|
|
105
106
|
if (target > inputs.length) throw new Error(`OPEN_OPTION_INVALID --animation-for: target index ${target} exceeds ${inputs.length} input(s)`);
|
|
106
107
|
}
|
|
107
108
|
const targets = inputs.map(input => parseOpenInputs([input, ...common]));
|
|
109
|
+
if(targets.length>1&&targets.some(target=>target.project&&target.project.version===undefined&&target.project.draftId===undefined))throw new Error('OPEN_OPTION_INVALID --project: interview-only open requires exactly one project root');
|
|
108
110
|
if (targets.length > 1 && targets.some(target => target.compare !== undefined)) {
|
|
109
111
|
throw new Error('OPEN_OPTION_INVALID --compare: multi-target open requires exactly one primary input for comparison');
|
|
110
112
|
}
|
|
@@ -161,7 +163,7 @@ async function controlCommand(args:string[],stateDir?:string){
|
|
|
161
163
|
else if(flag==='--command'){if(value.length>8192)throw new Error('--command: JSON exceeds 8 KiB');options.command=parseControlCommand(JSON.parse(value));}
|
|
162
164
|
else throw new Error(`Unknown control option ${flag}`);
|
|
163
165
|
}
|
|
164
|
-
if(projectOptions.length)inputs.project=parseOpenInputs([input,...projectOptions]).project;
|
|
166
|
+
if(projectOptions.length)inputs.project=parseOpenInputs([input,...projectOptions],{interview:false}).project;
|
|
165
167
|
const result=await controlReview(inputs,options);console.log(JSON.stringify(result,null,2));if(options.command&&(result as {status?:string}).status!=='applied')process.exitCode=2;
|
|
166
168
|
}
|
|
167
169
|
/** Formatting is CLI-only; session lookup/save contracts remain unchanged. */
|
|
@@ -201,8 +203,8 @@ function commandHelpRequested(args:readonly string[],command:'open'|'review'|'ch
|
|
|
201
203
|
}
|
|
202
204
|
return false;
|
|
203
205
|
}
|
|
204
|
-
const partsUsage='Usage: rig-review parts <build root | parts dir | review package> [--rig <file>] [--mesh-report <file>] [--check <file>] [--verdict <file>] [--painting <png>] [--by <name>] [--format json|issue] [--correction <item id> --parts-file <inventory> [--part-note <part>]] [--port <n>]\n A directory holding parts.json (or a build root whose rig/ holds it) opens in parts mode, before rigging;
|
|
205
|
-
/** `rig-review parts` (#348):
|
|
206
|
+
const partsUsage='Usage: rig-review parts <build root | parts dir | review package> [--rig <file>] [--mesh-report <file>] [--check <file>] [--verdict <file>] [--painting <png>] [--by <name>] [--format json|issue] [--correction <item id> --parts-file <inventory> [--part-note <part>]] [--port <n>]\n A directory holding parts.json (or a build root whose rig/ holds it) opens in parts mode, before rigging. Atlas-only inputs refuse PARTS_ATLAS_NOT_CARRIED; open the rig review for inspection.\n --format json|issue still reads saved parts or atlas verdicts. The sign-off is written to parts-review.json beside parts.json, or to --verdict.';
|
|
207
|
+
/** `rig-review parts` (#348): parts inspection in the foreground, or read-only parts/atlas verdict export. */
|
|
206
208
|
async function partsCommand(args:string[]){
|
|
207
209
|
const input=args.shift();if(!input||input==='--help'||input==='-h'){console.log(partsUsage);return;}
|
|
208
210
|
const options:PartsViewOptions={};let port=4317,format:'json'|'issue'|null=null;const seen=new Set<string>();
|
|
@@ -217,16 +219,16 @@ async function partsCommand(args:string[]){
|
|
|
217
219
|
if((itemId||partNote||inventory)&&(!format||!itemId||!inventory))throw new Error('CORRECTION_SELECTOR_INVALID: parts correction requires --format, --correction and --parts-file');
|
|
218
220
|
const pkg=await loadPartsView(input,options);
|
|
219
221
|
if(format&&itemId&&inventory){
|
|
220
|
-
const
|
|
221
|
-
if(!
|
|
222
|
+
const verdict=await readPartsVerdictForCli(pkg);
|
|
223
|
+
if(!verdict)throw new Error('PARTS_VERDICT_UNAVAILABLE: save a current verdict first');
|
|
222
224
|
await assertPartsUnchanged(pkg);
|
|
223
|
-
const verdict=saved.verdict;
|
|
224
225
|
const projected=projectPartsDescription({verdict,source:verdict.source,selector:{stage:'parts-review',kind:'parts',inventory},selection:partNote?{kind:'note',itemId,part:partNote}:{kind:'comment',itemId}});
|
|
225
226
|
process.stdout.write(format==='json'?exportPartsCorrection(verdict,projected):formatCorrectionIssue(projected)+'\n');
|
|
226
227
|
return;
|
|
227
228
|
}
|
|
228
229
|
if(format==='json'){process.stdout.write(await readPartsVerdictJson(pkg));return;}
|
|
229
|
-
if(format){const
|
|
230
|
+
if(format){const verdict=await readPartsVerdictForCli(pkg);if(!verdict)throw new Error('PARTS_VERDICT_UNAVAILABLE: save a verdict first');process.stdout.write(exportPartsVerdict(verdict,format));return;}
|
|
231
|
+
assertPartsCanOpen(pkg);
|
|
230
232
|
const capability=randomBytes(32).toString('hex');
|
|
231
233
|
let outputFailure: Error | null = null;
|
|
232
234
|
let rejectWrite: ((error: Error) => void) | undefined;
|
|
@@ -289,7 +291,6 @@ export async function main(args:string[],options:{stateDir?:string}={}){
|
|
|
289
291
|
const inputs=targets[0]!;const result=await openReview(inputs,options);// Launcher contract (README): stdout is the URL line alone; stderr is diagnostic, control notice, retrieval, in that order.
|
|
290
292
|
console.log(result.url);if(result.build)console.error(buildOpenDiagnostic(result.build));if(result.selection)console.error(animationDiagnostic(result.selection));if(inputs.control)console.error('Inspection control enabled; query the current connected page with rig-review control and the same inputs.');console.error(`Review ${result.reused?'reused':'started'}; feedback: rig-review feedback ${[result.inputs.input,...(result.inputs.compare?['--compare',result.inputs.compare]:[]),...(result.inputs.reference?['--reference',result.inputs.reference]:[]),...(result.inputs.animation?['--animation',result.inputs.animation]:[]),...handoffWords(result.inputs),...projectWords(result.inputs)].map(shellWord).join(' ')}`);return;}
|
|
291
293
|
if(args[0]==='parts')return partsCommand(args.slice(1));
|
|
292
|
-
if(args[0]==='interview')return (await import('./interview-server.ts')).interviewCommand(args.slice(1));
|
|
293
294
|
if(args[0]==='strip'){args.shift();if(args.includes('--help')){console.log(usage+'\nStrip: strip <package> --reference <declared-video-id> --animation <name> (--frames FIRST:LAST | --all-feedback) [--json] [--out path]\n strip compare <a> <b> --reference <video> --animation <name> --basis a|b (--frames FIRST:LAST | --all-feedback) [--json] [--out path]');return;}return stripCommand(args,options);}let command:'review'|'check'|'feedback'='review';if(args[0]==='check'||args[0]==='feedback'){command=args.shift() as 'check'|'feedback';}
|
|
294
295
|
if(args[0]==='--help'||args[0]==='-h'){console.log(usage);return;}
|
|
295
296
|
const foreground = command === 'review' && args[0] !== 'compare' ? parseForegroundTargets(args) : null;
|
|
@@ -329,7 +330,7 @@ export async function main(args:string[],options:{stateDir?:string}={}){
|
|
|
329
330
|
const input=args.shift();if(!input)throw new Error(usage);let port=4317;let checkpoint:string|undefined,reference:string|undefined,compare:string|undefined,animation:string|undefined,viewOnly=false;const handoff:OpenInputs={input},projectOptions:string[]=[];
|
|
330
331
|
while(args.length){const flag=args.shift();if(flag==='--view-only'){if(command!=='review')throw new Error(`Unknown option ${flag}\n${usage}`);viewOnly=true;continue;}const value=args.shift();if(!value)throw new Error(`Missing value for ${flag}`);if(command==='feedback'&&projectFlags.includes(flag!)){projectOptions.push(flag!,value);continue;}if(handoffOption(flag!)){handoff[handoffOption(flag!)!]=value;continue;}if(flag==='--port'){port=Number(value);if(!Number.isInteger(port)||port<0||port>65535)throw new Error('--port: expected integer 0…65535');}else if(flag==='--checkpoint')checkpoint=value;else if(flag==='--reference')reference=value;else if(flag==='--compare')compare=value;else if(flag==='--animation')animation=value;else throw new Error(`Unknown option ${flag}\n${usage}`);}
|
|
331
332
|
const handoffProblem=checkHandoffFlags(handoff);if(handoffProblem)throw new Error(handoffProblem);if(compare&&handoffFlags(handoff))throw new Error('--config: compare takes no producer handoff');
|
|
332
|
-
if(projectOptions.length)handoff.project=parseOpenInputs([input,...projectOptions,...(compare?['--compare',compare]:[])]).project;
|
|
333
|
+
if(projectOptions.length)handoff.project=parseOpenInputs([input,...projectOptions,...(compare?['--compare',compare]:[])],{interview:false}).project;
|
|
333
334
|
if(compare){if(correctionId)throw new Error('CORRECTION_COMPARE_UNSUPPORTED: select a single reviewed package');if(command!=='feedback')throw new Error('--compare: use open or feedback');const loaded=await loadOpenPackage({input,compare,reference,animation});if(loaded.mode!=='compare')throw new Error('Expected comparison');printFeedback(await readFeedbackCompareSession(loaded.p,options.stateDir));return;}
|
|
334
335
|
const base=await loadReferencedReview(input,reference,handoffFlags(handoff));
|
|
335
336
|
const joined=handoff.project?joinProject(base,handoff.project):undefined,p=joined?.review??base;
|
package/src/comment-crops.ts
CHANGED
|
@@ -9,9 +9,14 @@ import {parseStageComment,hasStageComment} from './stage-comment.ts';
|
|
|
9
9
|
import type {Feedback} from './session.ts';
|
|
10
10
|
export interface PngCrop {path:string;sha256:string;png:string;width:number;height:number}
|
|
11
11
|
export function validateCommentCrop(value:unknown):Buffer {return validatePngCrop(parseStageComment(value).crop);}
|
|
12
|
+
/** Shared metadata boundary for sealed records with no inline PNG bytes. Callers own closed keys. */
|
|
13
|
+
export function validatePngCropMetadata(crop:Omit<PngCrop,'png'>):void {
|
|
14
|
+
if(!crop||!Number.isSafeInteger(crop.width)||!Number.isSafeInteger(crop.height)||crop.width<1||crop.height<1||crop.width>16384||crop.height>16384||crop.width*crop.height>16777216||!/^[a-f0-9]{64}$/.test(crop.sha256)||crop.path!==`comment-crops/${crop.sha256}.png`)throw new Error('COMMENT_CROP_INVALID: bounded content-addressed PNG required');
|
|
15
|
+
}
|
|
12
16
|
/** Shared bounded PNG validator; callers own their closed comment codecs. */
|
|
13
17
|
export function validatePngCrop(crop:PngCrop):Buffer {
|
|
14
|
-
|
|
18
|
+
validatePngCropMetadata(crop);
|
|
19
|
+
if(typeof crop.png!=='string'||crop.png.length>90*1024*1024||!/^data:image\/png;base64,[A-Za-z0-9+/]+={0,2}$/.test(crop.png))throw new Error('COMMENT_CROP_INVALID: bounded content-addressed PNG required');
|
|
15
20
|
const bytes=Buffer.from(crop.png.slice('data:image/png;base64,'.length),'base64');
|
|
16
21
|
if(createHash('sha256').update(bytes).digest('hex')!==crop.sha256)throw new Error('COMMENT_CROP_INVALID: PNG signature, dimensions or SHA-256 differ');
|
|
17
22
|
return validatePngBytes(bytes,crop.width,crop.height);
|