rig-review 2.13.0 → 4.0.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 (46) hide show
  1. package/README.md +1 -1
  2. package/docs/PARTS_VIEW.md +1 -1
  3. package/docs/REVIEW_PACKAGE.md +32 -91
  4. package/docs/STABILITY.md +27 -194
  5. package/docs/WORKFLOWS.md +0 -107
  6. package/package.json +1 -1
  7. package/skills/rig-review/SKILL.md +11 -25
  8. package/src/build.ts +2 -2
  9. package/src/direction-inspection.ts +6 -2
  10. package/src/front.ts +4 -193
  11. package/src/interview-scene.ts +3 -3
  12. package/src/job-act.ts +1 -35
  13. package/src/job-api.ts +27 -19
  14. package/src/job-cli.ts +3 -3
  15. package/src/job-contract.ts +14 -50
  16. package/src/job-front.ts +17 -44
  17. package/src/job-host.ts +1 -4
  18. package/src/job-session.ts +22 -10
  19. package/src/job-source.ts +3 -17
  20. package/src/job-store.ts +80 -6
  21. package/src/job-worker.ts +1 -47
  22. package/src/manifest.ts +23 -4
  23. package/src/open.ts +2 -3
  24. package/src/scene-inspection.ts +50 -0
  25. package/src/server.ts +1 -1
  26. package/web/catalog-en.ts +37 -27
  27. package/web/catalog-ko.ts +37 -27
  28. package/web/compare.css +0 -4
  29. package/web/direction-panel.ts +22 -6
  30. package/web/inspector-blocks.ts +8 -4
  31. package/web/job-rig-capture.ts +62 -12
  32. package/web/job-rig-screen.ts +75 -55
  33. package/web/job-session.ts +89 -1091
  34. package/web/main.ts +113 -56
  35. package/web/parts-viewport-provider.ts +8 -3
  36. package/web/retained-frame-stage.ts +7 -7
  37. package/web/rig-host.ts +5 -3
  38. package/web/rig-viewport-provider.ts +2 -0
  39. package/web/scene-plates.ts +57 -4
  40. package/web/styles.css +12 -82
  41. package/web/viewport-capture.ts +12 -2
  42. package/web/workspace-ui.ts +5 -6
  43. package/src/front-worker.ts +0 -2
  44. package/src/job-hub.ts +0 -304
  45. package/src/job-image-set.ts +0 -73
  46. package/web/job-hub.ts +0 -160
package/docs/WORKFLOWS.md CHANGED
@@ -281,11 +281,6 @@ options refuse with `OPEN_OPTION_INVALID`; existing single options retain their
281
281
  behavior. Flags and their literal values are consumed before counting operands.
282
282
  Core's `rigc review` continues forwarding to `open`; Review owns this grammar.
283
283
 
284
- Embedded semantic jobs share one owner list through `startJobHub` and
285
- `hub.openJob`. Their trusted callbacks stay in the host process. Follow
286
- [Embedded semantic jobs](#embedded-semantic-jobs) and the
287
- [public hub contract](STABILITY.md#embedded-semantic-job-hub).
288
-
289
284
  ### Launcher contract
290
285
 
291
286
  A launcher may start `rig-review open` as a child process and rely on its stdout,
@@ -503,108 +498,6 @@ The four-stage navigator preserves this entry and its explicit save behavior. Co
503
498
 
504
499
  The managed front forwards a query only to the landing page; every other route refuses one. Stage navigation never changes CLI arguments or package bindings.
505
500
 
506
- ## Embedded semantic jobs
507
-
508
- Use **N reviews → one invocation, one owner URL** for both CLI folder inspection
509
- and embedded semantic jobs. External consumer-owned adoption remains
510
- pending in [Review #512](https://github.com/rig-c/review/issues/512).
511
-
512
- In an embedded consumer, start one hub and register each job from that same
513
- process. Give the human `hub.ownerUrl` and one what-to-look-at line. The hub
514
- owns one PID/listener and a list that selects each job's standing Review UI.
515
- The bootstrap reviewer binding applies to all registered jobs. Each job retains
516
- its separate generation, source, asks, acts, replay cursor and grants under
517
- job-api@2/act@2. View-only CLI folder entries retain their inspection workflow.
518
-
519
- This minimal Bun integration uses public imports. Its `host` argument is an
520
- explicit trusted-hook placeholder supplied by the consumer application. The
521
- consumer implements the publication reader, imports the official installed
522
- Parts enumerator, and installs the writer's private binding through its own
523
- adapter. The example defines their required public types and leaves those
524
- consumer-owned implementations to the host.
525
-
526
- ```ts
527
- import {startJobHub} from '@rig-c/review/job-host';
528
- import type {
529
- JobHubJob, JobHubJobOptions, JobOwnerHub, JobReviewerBinding,
530
- } from '@rig-c/review/job-host';
531
-
532
- type TrustedHostHooks = Required<Pick<JobHubJobOptions,
533
- 'readPublished' | 'readerId' | 'partsEnumerator' | 'partsEnumeratorId' |
534
- 'installWriterBinding' | 'bindingId'>>;
535
-
536
- async function openReviews(host: {
537
- stateDir: string;
538
- reviewer: JobReviewerBinding;
539
- jobs: readonly {
540
- root: string;
541
- fingerprint: string;
542
- hooks: TrustedHostHooks;
543
- }[];
544
- }): Promise<{hub: JobOwnerHub; jobs: JobHubJob[]}> {
545
- const hub = await startJobHub({
546
- stateDir: host.stateDir,
547
- reviewer: host.reviewer,
548
- });
549
- const jobs: JobHubJob[] = [];
550
- try {
551
- for (const job of host.jobs) {
552
- jobs.push(await hub.openJob({
553
- root: job.root,
554
- fingerprint: job.fingerprint,
555
- ...job.hooks,
556
- }));
557
- }
558
- return {hub, jobs};
559
- } catch (error) {
560
- await hub.stop();
561
- throw error;
562
- }
563
- }
564
- ```
565
-
566
- The consumer calls `openReviews` once with its designated jobs and retains the
567
- returned `{hub, jobs}`. Privately hand `hub.ownerUrl` to the person. `stateDir`
568
- is outside all job roots. Keep the host alive until its explicit transport
569
- shutdown and await `hub.stop()` then. The public types and complete lifecycle are in
570
- [Public API stability](STABILITY.md#embedded-semantic-job-hub).
571
-
572
- For each handle in the returned `jobs`, trusted bootstrap uses
573
- `job.session.hostCredentials()` to
574
- deliver only that job's agent credential through a private agent channel.
575
- Use `<origin>/jobs/<jobId>` as the CLI job address. `jobUrl` carries an owner UI
576
- capability and belongs to the owner channel. The hub's private capability
577
- allows owner-list selection. Bootstrap-declared reviewer provenance is distinct
578
- from authenticating the person at the keyboard.
579
-
580
- 1. Freeze the producer's designated record and result through publication
581
- acknowledgment, then `publish` with the job's current generation and an
582
- idempotency key.
583
- 2. `ask` for the exact publication and supported semantic subject. The person
584
- inspects and submits in that job's Review UI.
585
- 3. Use `next` to replay events and their cursor. The trusted writer directly
586
- uses read-only `fetch-act` with its separately installed grant to consume a
587
- finalized act. Check API@2/act@2 and the exact source binding.
588
- 4. Use semantic `close` for that job when its cycle ends. Other jobs and the
589
- owner list continue. The closed entry stays visible in the list.
590
-
591
- Agents use the semantic commands. Supplied sources and compiled assets stay
592
- immutable, and agents never construct internal Review state, human acts or
593
- binding files. Trusted callbacks remain process-local. Compatible active
594
- root/fingerprint registrations reuse the job after hook-ID validation. Legacy
595
- `startJobHost` can attach to a matching hub-owned job. A hub registration that
596
- finds an active standalone owner refuses `JOB_HUB_EXTERNAL_HOST`, while a live
597
- unresponsive descriptor refuses `JOB_HUB_HOST_UNRESPONSIVE`. General
598
- cross-process callback registration is deferred.
599
-
600
- Transport stop preserves active durable jobs and their grants. After restart,
601
- register every required job's callbacks again, refresh the writer binding's
602
- origin, and obtain the new hub owner URL. The hub capability and `workspace`
603
- incarnation query rotate. Each retained active job keeps its identity and grants
604
- until explicit close. The current hub admits at most 32 entries, including
605
- closed retained entries, and lazily retains selected frames. This application
606
- bound has no hardware performance guarantee. Hidden hub members suspend their event subscription after bootstrap and resume from the last delivered cursor when selected.
607
-
608
501
  ## Standing live job workflow
609
502
 
610
503
  The active Create and Parts inspection cycle uses the semantic job contract in `src/job-contract.ts` (`JOB_API_SCHEMA` set to `rig-review/job-api@2`, `JOB_ACT_SCHEMA` set to `rig-review/act@2`, [Review #484](https://github.com/rig-c/review/issues/484)) together with the implemented backend session/store (`src/job-session.ts`, `src/job-source.ts`, `src/job-act.ts`, `src/job-api.ts`), loopback job front and browser window runtime (`src/job-front.ts`, `web/job-session.ts`), and `rig-review session` CLI (`src/entry.ts`, `src/job-cli.ts`). The public installed managed-host entry is `@rig-c/review/job-host` with frozen exports in [Public API stability](STABILITY.md#managed-owner-host), and Create's production publication reader and writer-owned sibling `fetch-act` readback remain pending [Create #184](https://github.com/rig-c/create/issues/184) (publishing a Create root containing `project.json` without a host `readPublished` callback refuses `JOB_SOURCE_UNRETAINABLE` with `CREATE_PUBLICATION_CONTRACT_UNAVAILABLE`). See [Live job contract](REVIEW_PACKAGE.md#live-job-contract) for the full schema and host seam reference.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rig-review",
3
- "version": "2.13.0",
3
+ "version": "4.0.0",
4
4
  "type": "module",
5
5
  "description": "Local human rig inspection and structured feedback export",
6
6
  "license": "MIT",
@@ -94,39 +94,25 @@ Leave existing workers under their owner's control. Follow
94
94
  [workspace lifecycle and restart](https://github.com/rig-c/review/blob/main/docs/WORKFLOWS.md#workspace-lifecycle-and-restart)
95
95
  for host reuse, live unresponsive PID refusal and aggregate shutdown behavior.
96
96
 
97
- For both CLI and embedded integrations, use **N reviews → one invocation, one
98
- owner URL**. Core's `rigc review` passes arguments through unchanged. For
99
- semantic jobs, use `startJobHub` from `@rig-c/review/job-host` once and call
100
- `hub.openJob` per designated job in that process. Give the person `hub.ownerUrl`
101
- and one what-to-look-at line. One PID/listener owns the list and selected Review
102
- UI, with a common trusted bootstrap reviewer. Keep each job's identity,
103
- generation CAS, source, asks, acts, cursors and grants separate under
104
- job-api@2/act@2. Follow the
105
- [embedded workflow and trusted-hook example](https://github.com/rig-c/review/blob/main/docs/WORKFLOWS.md#embedded-semantic-jobs)
106
- 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).
107
103
 
108
104
  Register `readPublished`, `partsEnumerator` and `installWriterBinding` with their
109
105
  declared IDs in the owning process. The consumer host owns these implementations
110
106
  and private bootstrap channels. General cross-process callback registration is
111
- deferred. Compatible legacy `startJobHost` attachment to a hub-owned job remains
112
- supported. An active external standalone owner refuses `JOB_HUB_EXTERNAL_HOST`,
113
- and a live unresponsive owner refuses `JOB_HUB_HOST_UNRESPONSIVE`.
107
+ deferred.
114
108
 
115
109
  Use `publish`, `ask` and `next` per job. The trusted writer directly fetches
116
110
  finalized acts with its separate read-only grant. Human submission stays in the
117
111
  Review UI. Semantic `close` ends only that job and revokes its writer grant.
118
- `await hub.stop()` stops transport, preserving active durable jobs and grants.
119
- On restart, re-register callbacks, refresh writer origins and obtain the new hub
120
- owner URL. The hub capability and `workspace` incarnation rotate, while retained
121
- active job identities and grants persist until close. Closed retained entries
122
- count toward the hub's 32-entry application bound. Selected frames are retained
123
- lazily within that bound, with no hardware performance guarantee.
124
-
125
- External consumer-owned hub adoption remains pending in
126
- [Review #512](https://github.com/rig-c/review/issues/512). Keep imagery, questions
127
- and approvals in the Review UI through supported commands and APIs. Supplied
128
- sources stay immutable. Agents never construct internal Review state, binding
129
- 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.
130
116
 
131
117
  ## Active cycle standing live-job contract
132
118
 
package/src/build.ts CHANGED
@@ -14,9 +14,9 @@ export async function setupEntryHtml(screen:'parts'|'stage-parts',assets:{script
14
14
  if(marked===html||!marked.includes(`data-review-screen="${screen}"`))throw new Error('SETUP_ENTRY_MARKER_MISSING');
15
15
  return marked;
16
16
  }
17
- export async function buildWeb(mode:'single'|'compare'|'parts'|'workspace'|'job-hub'='single',root:string=appRoot):Promise<Blob> {
17
+ export async function buildWeb(mode:'single'|'compare'|'parts'|'workspace'='single',root:string=appRoot):Promise<Blob> {
18
18
  const conditions=playBuildConditions(root);
19
- const entry=join(root,mode==='job-hub'?'web/job-hub.ts':mode==='workspace'?'web/owner-workspace.ts':mode==='compare'?'web/compare.ts':'web/main.ts');
19
+ const entry=join(root,mode==='workspace'?'web/owner-workspace.ts':mode==='compare'?'web/compare.ts':'web/main.ts');
20
20
  const result=await Bun.build({entrypoints:[entry],target:'browser',format:'esm',minify:false,...(conditions.length?{conditions}:{})});
21
21
  if(!result.success)throw new Error(result.logs.map(v=>v.message).join('\n'));
22
22
  const output=result.outputs.find(v=>v.path.endsWith('.js'));if(!output)throw new Error('frontend bundle: JavaScript output missing');return output;
@@ -5,6 +5,8 @@ export const DIRECTION_MAX_BYTES = 256 * 1024;
5
5
  type Binding = { path: string; sha256: string };
6
6
  export interface DirectionInspection {
7
7
  file: Binding;
8
+ model: Binding;
9
+ scene?: Binding & { n: number };
8
10
  joined?: {
9
11
  postVersion: number;
10
12
  projectHash: string;
@@ -12,6 +14,7 @@ export interface DirectionInspection {
12
14
  packageRoot: string;
13
15
  projectModel: Binding;
14
16
  };
17
+ postVersion?: number;
15
18
  rigVersion: number;
16
19
  camera: { space: 'rig-world-y-up'; keys: { time: number; easing: string; box: { x: number; y: number; width: number; height: number } }[] };
17
20
  take: { duration: number; loop: boolean };
@@ -20,7 +23,7 @@ export interface DirectionInspection {
20
23
 
21
24
  /**
22
25
  * Read the inspection subset of Create's rig-create/direction@1 or rig-create/direction@2.
23
- * A direction@2 scene reference is accepted but not inspected.
26
+ * Scene bytes are inspected separately when the manifest declares them.
24
27
  * Create validates scene, project history and citations.
25
28
  */
26
29
  export function readDirectionInspection(value: unknown, file: Binding, model: Binding | null): DirectionInspection {
@@ -73,5 +76,6 @@ export function readDirectionInspection(value: unknown, file: Binding, model: Bi
73
76
  return { source_time };
74
77
  });
75
78
  if (timingKeys.at(-1)?.time !== duration) throw new Error('DIRECTION_SCHEMA: timing must end at take duration');
76
- return { file, rigVersion, camera: { space: camera.space, keys: cameraKeys }, take: { duration, loop: take.loop }, timing: timingKeys };
79
+ const scene = doc.schema === 'rig-create/direction@2' ? object(doc.scene, 'direction.scene') : undefined;
80
+ return { file, model, ...(scene ? { scene: { n: numberField(scene.n, 'direction.scene.n', 1), path: packagePath(scene.path, 'direction.scene.path'), sha256: String(scene.sha256) } } : {}), rigVersion, camera: { space: camera.space, keys: cameraKeys }, take: { duration, loop: take.loop }, timing: timingKeys };
77
81
  }
package/src/front.ts CHANGED
@@ -1,55 +1,9 @@
1
- import { interviewRefusals, interviewRequest } from './interview-routes.ts';
2
- import { directionStale, interviewStale } from './joined-project.ts';
3
- import { picksLimit } from './interview-picks.ts';
4
- import {stageDraftRefusals,stageVerdictLimit,stageVerdictRefusals} from './stage-parts.ts';
5
- /** Managed loopback front: one stable origin (127.0.0.1:4318 by default) routing `/instances/<key>/…` to the
6
- * worker named by that key's private open record. It is a router, not an authority: it never reads packages,
7
- * never serves or logs a capability, and forwards a mutation (rewriting Origin) only with the page capability. */
8
- import type {ServerWebSocket} from 'bun';
9
- import {randomUUID} from 'node:crypto';
10
- import {spawn} from 'node:child_process';
11
- import {lstat,readFile,readdir,realpath,rename,unlink,writeFile,open as openFile} from 'node:fs/promises';
12
- import {dirname,join} from 'node:path';
13
- import {fileURLToPath} from 'node:url';
14
- import {acquireClaim,alive,openFingerprint,readRecord,releaseClaim,running,smallJson,type RecordFile} from './open.ts';
15
- import {playBuildConditions} from './build.ts';
16
- import {capabilityHeader,openKeyHeader,openNonceHeader,sameSecret} from './open-protocol.ts';
17
- import {DEFAULT_CLOSE_GRACE_MS,LIVE_PATH} from './live-lifecycle.ts';
1
+ import {interviewRequest} from './interview-routes.ts';
2
+ import {picksLimit} from './interview-picks.ts';
3
+ import {stageVerdictLimit} from './stage-parts.ts';
4
+ import {LIVE_PATH} from './live-lifecycle.ts';
18
5
  export const defaultFrontPort=4318; // Foreground `review <dir>` keeps 4317.
19
- interface FrontRecord {schema:'rig-review-front/1';origin:string;port:number;nonce:string;fingerprint:string;pid:number}
20
- interface FrontRequest {schema:'rig-review-front-request/1';control:string;request:string;record:string;port:number;nonce:string;fingerprint:string;idleMs:number}
21
- const appRoot=fileURLToPath(new URL('..',import.meta.url));
22
- const sleep=(ms:number)=>new Promise(resolveSleep=>setTimeout(resolveSleep,ms));
23
- const uuid=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/,hex64=/^[a-f0-9]{64}$/;
24
- const frontName=(port:number)=>`front-${port}`;
25
- const noStore={'Cache-Control':'no-store','X-Content-Type-Options':'nosniff','Referrer-Policy':'no-referrer'};
26
- const refuse=(error:string,status:number)=>Response.json({error},{status,headers:noStore});
27
6
  export function frontPort(value?:number):number{const raw=value??(process.env.RIG_REVIEW_FRONT_PORT===undefined?defaultFrontPort:Number(process.env.RIG_REVIEW_FRONT_PORT));if(!Number.isSafeInteger(raw)||raw<(value===0?0:1)||raw>65535)throw new Error('FRONT_PORT: RIG_REVIEW_FRONT_PORT expects an integer 1..65535');return raw;}
28
- function frontValue(value:unknown,port:number):FrontRecord|null{if(!value||typeof value!=='object'||Array.isArray(value))return null;const v=value as Partial<FrontRecord>;return v.schema==='rig-review-front/1'&&Number.isSafeInteger(v.port)&&v.port!>=1&&v.port!<=65535&&(port===0||v.port===port)&&v.origin===`http://127.0.0.1:${v.port}`&&uuid.test(v.nonce??'')&&hex64.test(v.fingerprint??'')&&Number.isSafeInteger(v.pid)&&v.pid!>0?v as FrontRecord:null;}
29
- async function readFront(file:string,port:number):Promise<FrontRecord|null>{try{return frontValue(await smallJson(file),port);}catch(e){if(['ENOENT','ELOOP'].includes((e as NodeJS.ErrnoException).code??'')||e instanceof SyntaxError)return null;throw e;}}
30
- async function frontAlive(row:FrontRecord):Promise<boolean>{try{const response=await fetch(row.origin+'/api/front-status',{headers:{authorization:'Bearer '+row.nonce},redirect:'error',signal:AbortSignal.timeout(1500)});if(!response.ok){void response.body?.cancel();return false;}const v=await response.json() as {schema?:string;nonce?:string;fingerprint?:string};return v.schema==='rig-review-front-status/1'&&v.nonce===row.nonce&&v.fingerprint===row.fingerprint;}catch{return false;}}
31
- /** Ensure this state directory's front on `port`; reuse a verified live one.
32
- * Port 0 binds an OS-assigned port and stores its actual origin in front-0.json. A front from another tool
33
- * build is ours (verified nonce) and is replaced. Any other listener is FRONT_PORT_BUSY, never a fallback. */
34
- export async function ensureFront(options:{control:string;port:number;fingerprint:string;idleMs?:number}):Promise<string>{
35
- const {control,port,fingerprint}=options,name=frontName(port),recordPath=join(control,name+'.json'),nonce=randomUUID(),deadline=performance.now()+20000,idleMs=options.idleMs??DEFAULT_CLOSE_GRACE_MS;
36
- const reuse=async()=>{const row=await readFront(recordPath,port);if(!row||!await frontAlive(row))return null;if(row.fingerprint===fingerprint)return row;
37
- try{process.kill(row.pid,'SIGTERM');}catch{}for(let n=0;n<100&&await frontAlive(row);n++)await sleep(30);return null;};
38
- const ready=await reuse();if(ready)return ready.origin;
39
- const claimed=await acquireClaim(control,name,nonce,reuse,deadline,'FRONT_BUSY: front startup claim did not become ready');if('row' in claimed)return claimed.row.origin;
40
- let request:string|undefined,child:ReturnType<typeof spawn>|undefined,handedOff=false;
41
- try{
42
- const row=await reuse();if(row)return row.origin;
43
- request=join(control,`${name}.${nonce}.request.json`);const log=join(control,`${name}.${nonce}.log`);
44
- const spec:FrontRequest={schema:'rig-review-front-request/1',control,request,record:recordPath,port,nonce,fingerprint,idleMs};await writeFile(request,JSON.stringify(spec),{mode:0o600,flag:'wx'});
45
- const logHandle=await openFile(log,'a',0o600);try{child=spawn(process.execPath,[...playBuildConditions().map(c=>`--conditions=${c}`),join(appRoot,'src/front-worker.ts'),request],{cwd:control,detached:true,stdio:['ignore',logHandle.fd,logHandle.fd],env:process.env});child.unref();}finally{await logHandle.close();}
46
- let exited:string|undefined;child.on('error',error=>{exited=error.message;});child.on('exit',(code,signal)=>{exited=`exit ${code} ${signal??''}`;});
47
- while(performance.now()<deadline){const live=await reuse();if(live){handedOff=true;return live.origin;}
48
- if(exited){if(/FRONT_PORT_BUSY/.test(await readFile(log,'utf8').catch(()=>'')))throw new Error(`FRONT_PORT_BUSY: 127.0.0.1:${port} is held by another listener; use --direct (or set RIG_REVIEW_FRONT_PORT)`);throw new Error(`FRONT_START: ${exited}; front log ${log}`);}
49
- await sleep(30);}
50
- throw new Error(`FRONT_TIMEOUT: front did not become ready; log ${log}`);
51
- }finally{if(child&&!handedOff&&child.exitCode===null&&child.signalCode===null)child.kill('SIGTERM');await releaseClaim(join(control,name+'.claim'),nonce);if(request)await unlink(request).catch(e=>{if(e.code!=='ENOENT')throw e;});}
52
- }
53
7
  interface Route {mutation:boolean;limit:number;timeoutMs:number;control:boolean;live?:boolean}
54
8
  /** Closed allowlist per method. Agent control endpoints, open-status and anything unlisted are refused. */
55
9
  export function frontRoute(mode:'single'|'compare',method:string,path:string):Route|null{
@@ -97,147 +51,4 @@ export async function boundedBody(req:Request,limit:number,timeoutMs=10000):Prom
97
51
  try{return await Promise.race([(async()=>{const chunks:Uint8Array[]=[];let size=0;while(true){const next=await reader.read();if(next.done)break;size+=next.value.length;if(size>limit)throw new Error('FRONT_BODY_LIMIT');chunks.push(next.value);}const bytes=new Uint8Array(size);let at=0;for(const chunk of chunks){bytes.set(chunk,at);at+=chunk.length;}return bytes.buffer;})(),new Promise<never>((_,reject)=>{timer=setTimeout(()=>reject(new Error('FRONT_BODY_TIMEOUT')),timeoutMs);})]);}
98
52
  finally{if(timer)clearTimeout(timer);void reader.cancel().catch(()=>{});}
99
53
  }
100
- /** Owner-only regular record for this key, or null. */
101
- async function instanceRecord(control:string,key:string):Promise<RecordFile|null>{const file=join(control,key+'.json');try{const info=await lstat(file);if(!info.isFile()||(info.mode&0o077)!==0)return null;}catch(e){if((e as NodeJS.ErrnoException).code==='ENOENT')return null;throw e;}return readRecord(file,key);}
102
- /** Worker errors default to front codes unless an inspection refusal is allowlisted. */
103
- const upstreamFailure:Record<number,string>={400:'FRONT_UPSTREAM_REJECTED',403:'FRONT_UPSTREAM_FORBIDDEN',404:'FRONT_UPSTREAM_NOT_FOUND',405:'FRONT_UPSTREAM_METHOD',409:'FRONT_UPSTREAM_CONFLICT'};
104
- const responseHeaders=['content-type','content-length','content-range','accept-ranges','content-disposition','cache-control','content-security-policy','x-content-type-options','referrer-policy'];
105
- // The submitted Apply can supply the check line. Accept the producer's structured
106
- // summary fields, never an arbitrary suffix after the failed-check code.
107
- const submitCheckPrefix = 'EDIT_SUBMIT_UNCHECKED: applied build failed check — ';
108
- const checkBarName = '(?:[A-Z][A-Z0-9_]*|gate|loop|seam)';
109
- const submitCheckSummary = new RegExp(
110
- String.raw`^check: FAIL — \d+ bar\(s\) not met(?:, \d+ declared requirement\(s\) not PASS)?; ` +
111
- String.raw`\d+ of \d+ bar\(s\) measured, \d+ skipped(?: \(${checkBarName}(?:, ${checkBarName})*\))?` +
112
- String.raw`(?:; \d+ warning\(s\) \((?:SEAM_OVER_MOTION(?:, CLOTH_SETTLES)?|CLOTH_SETTLES), not a bar\))?$`
113
- );
114
- const submitCheckFallback = new RegExp(String.raw`^(?:${checkBarName}: FAIL|check exited -?\d+)$`);
115
- const fixedSubmitRefusals = new Set([
116
- 'EDIT_SUBMIT_UNCHECKED: applied mesh has no successful producer check',
117
- 'CORRECTION_CHECK_FAILED: the settled Apply requires a passing producer check',
118
- ]);
119
- function isSubmitCheckRefusal(error: string): boolean {
120
- if(fixedSubmitRefusals.has(error))return true;
121
- if(!error.startsWith(submitCheckPrefix))return false;
122
- const detail=error.slice(submitCheckPrefix.length);
123
- return submitCheckSummary.test(detail)||submitCheckFallback.test(detail);
124
- }
125
- /** Preserve only closed, bounded inspection refusals. */
126
- async function inspectionRefusal(mode:'single'|'compare',method:string,path:string,response:Response,sameFingerprint:boolean):Promise<string|null>{
127
- const stageData=mode==='single'?path==='/api/stage-parts':/^\/api\/compare\/(?:a|b)\/stage-parts$/.test(path);
128
- const interview=mode==='single'&&interviewRequest(path)&&[400,404,409].includes(response.status);
129
- // Both reads race during the single-package page bootstrap.
130
- const direction=sameFingerprint&&mode==='single'&&method==='GET'&&response.status===409&&
131
- (path==='/api/review'||path==='/api/session');
132
- const submit=sameFingerprint&&mode==='single'&&method==='PUT'&&path==='/api/session'&&response.status===400;
133
- const verdict=mode==='single'&&['/api/stage-parts/verdict','/api/stage-parts/export/json','/api/stage-parts/export/issue'].includes(path)&&[400,409].includes(response.status);
134
- if(!(submit||direction||interview||verdict||stageData&&method==='GET'&&response.status===409)||!/^application\/json(?:\s*;|$)/i.test(response.headers.get('content-type')??''))return null;
135
- const limit=512,declared=response.headers.get('content-length');if(declared!==null&&(!/^\d+$/.test(declared)||Number(declared)>limit))return null;
136
- const reader=response.body?.getReader();if(!reader)return null;
137
- try{
138
- const chunks:Uint8Array[]=[];let bytes=0;
139
- for(;;){const {value,done}=await reader.read();if(done)break;bytes+=value.byteLength;if(bytes>limit){void reader.cancel().catch(()=>{});return null;}chunks.push(value);}
140
- const body=new Uint8Array(bytes);let offset=0;for(const chunk of chunks){body.set(chunk,offset);offset+=chunk.byteLength;}
141
- const data:unknown=JSON.parse(new TextDecoder().decode(body)),named='PARTS_ATLAS_UNAVAILABLE: the inspected package has no usable atlas or its source changed.';
142
- if(data===null||typeof data!=='object'||Array.isArray(data)||Object.keys(data).length!==1)return null;
143
- const error=(data as {error?:unknown}).error;
144
- if(submit)return typeof error==='string'&&isSubmitCheckRefusal(error)?error:null;
145
- if(direction)return error===directionStale?directionStale:null;
146
- return typeof error==='string'&&(interview?[...interviewRefusals]:[...(stageData&&response.status===409?[named,...Object.values(stageDraftRefusals),...stageVerdictRefusals]:[]),interviewStale,...(verdict?stageVerdictRefusals:[])] as readonly string[]).some(code=>code===error)?error:null;
147
- }catch{return null;}finally{reader.releaseLock();}
148
- }
149
54
  export const maximumUpstreamStreams=32;
150
- interface FrontLiveRelay {upstream:WebSocket;client:ServerWebSocket<FrontLiveRelay>|null}
151
- export function startFront(options:{control:string;port:number;nonce:string;fingerprint:string}){
152
- let origin:string;let active=0,last=performance.now();
153
- const server=Bun.serve<FrontLiveRelay>({hostname:'127.0.0.1',port:options.port,websocket:{
154
- idleTimeout:0,
155
- open(ws){last=performance.now();ws.data.client=ws;if(ws.data.upstream.readyState!==WebSocket.OPEN){try{ws.close();}catch{}return;}try{ws.send('live');}catch{}},
156
- message(ws,msg){last=performance.now();try{ws.data.upstream.send(msg);}catch{}},
157
- close(ws){last=performance.now();try{ws.data.upstream.close();}catch{}},
158
- },async fetch(req,srv){
159
- last=performance.now();
160
- try{
161
- const url=new URL(req.url);if(url.origin!==origin)return refuse('FRONT_LOOPBACK_REQUIRED',403);
162
- if(url.pathname==='/api/front-status'){if(req.method!=='GET'||!sameSecret(req.headers.get('authorization'),'Bearer '+options.nonce))return refuse('FRONT_STATUS_CAPABILITY_REQUIRED',403);return Response.json({schema:'rig-review-front-status/1',nonce:options.nonce,fingerprint:options.fingerprint},{headers:noStore});}
163
- const match=/^\/instances\/([a-f0-9]{64})(\/.*)$/.exec(url.pathname);if(!match)return refuse('FRONT_ROUTE_REFUSED',404);
164
- const key=match[1]!,path=match[2]!,sentOrigin=req.headers.get('origin');
165
- if(req.headers.get('sec-fetch-site')==='cross-site'||sentOrigin!==null&&sentOrigin!==origin)return refuse('FRONT_SAME_ORIGIN_REQUIRED',403);
166
- const record=await instanceRecord(options.control,key);if(!record)return refuse('FRONT_INSTANCE_UNKNOWN: reopen with rig-review open',404);
167
- const route=frontRoute(record.mode,req.method,path);if(!route)return refuse('FRONT_ROUTE_REFUSED',404);
168
- const landing=path==='/'||path==='/index.html';if(!landing&&!!url.search)return refuse('FRONT_QUERY_REFUSED',400);
169
- if(route.live){
170
- if(sentOrigin!==origin)return refuse('FRONT_SAME_ORIGIN_REQUIRED',403);
171
- if(req.headers.get('upgrade')?.toLowerCase()!=='websocket')return refuse('FRONT_UPGRADE_REQUIRED',426);
172
- const upstreamWs=new WebSocket(record.origin.replace(/^http/,'ws')+path,{headers:{[openNonceHeader]:record.nonce}} as unknown as string[]);
173
- const outcome=await new Promise<'ok'|'replaced'|'timeout'|'closed'>(resolve=>{
174
- const timer=setTimeout(()=>resolve('timeout'),route.timeoutMs);
175
- const finish=(result:'ok'|'replaced'|'timeout'|'closed')=>{clearTimeout(timer);resolve(result);};
176
- req.signal.addEventListener('abort',()=>finish('closed'),{once:true});
177
- upstreamWs.onmessage=ev=>{try{const msg=JSON.parse(String(ev.data)) as {type?:string;key?:string};finish(msg?.type==='live'&&msg?.key===key?'ok':'replaced');}catch{finish('replaced');}};
178
- upstreamWs.onerror=()=>finish('closed');
179
- upstreamWs.onclose=()=>finish('closed');
180
- });
181
- if(outcome!=='ok'){
182
- try{upstreamWs.close();}catch{}
183
- if(outcome==='timeout'&&!req.signal.aborted)return refuse('FRONT_UPSTREAM_TIMEOUT',504);
184
- if(outcome==='replaced')return refuse('FRONT_INSTANCE_REPLACED: reopen with rig-review open',410);
185
- const probe=await fetch(record.origin+'/api/access',{headers:{[openNonceHeader]:record.nonce},redirect:'manual',signal:AbortSignal.timeout(1500)}).catch(()=>null);
186
- void probe?.body?.cancel().catch(()=>{});
187
- return probe?refuse('FRONT_INSTANCE_REPLACED: reopen with rig-review open',410):refuse('FRONT_INSTANCE_EXPIRED: reopen with rig-review open',410);
188
- }
189
- const relay:FrontLiveRelay={upstream:upstreamWs,client:null};
190
- upstreamWs.onmessage=ev=>{try{relay.client?.send(String(ev.data));}catch{}};
191
- upstreamWs.onerror=()=>{try{relay.client?.close();}catch{}};
192
- upstreamWs.onclose=()=>{try{relay.client?.close();}catch{}};
193
- if(!srv.upgrade(req,{data:relay,headers:noStore})){try{upstreamWs.close();}catch{}return refuse('FRONT_UPGRADE_FAILED',400);}
194
- return undefined as unknown as Response;
195
- }
196
- let body:ArrayBuffer|undefined;
197
- if(route.mutation){
198
- // Never rewrite Origin without this instance's capability; the worker compares it again itself.
199
- if(sentOrigin!==origin)return refuse('FRONT_SAME_ORIGIN_REQUIRED',403);
200
- if(!sameSecret(req.headers.get(capabilityHeader),record.capability))return refuse('FRONT_CAPABILITY_REQUIRED: reopen with rig-review open to edit',403);
201
- body=await boundedBody(req,route.limit);
202
- // A stale interview worker must still prove its identity before it receives picks.
203
- // It revalidates the join before saving and returns the specific stale refusal.
204
- if(!await alive(record,(path==='/api/interview/picks'||path==='/api/stage-parts/verdict')))return refuse('FRONT_INSTANCE_EXPIRED: reopen with rig-review open',410);
205
- }
206
- if(active>=maximumUpstreamStreams)return refuse('FRONT_BUSY: too many concurrent upstream streams',503);
207
- const headers=new Headers({[openNonceHeader]:record.nonce});for(const name of ['accept','range','if-range',...(route.mutation?['content-type']:[]),...(route.control?['authorization']:[])]){const value=req.headers.get(name);if(value!==null)headers.set(name,value);}
208
- if(/^\/api\/stage-parts(?:\/(?:image|page)\/\d+|\/verdict|\/export\/(?:json|issue))?$/.test(path)){const build=req.headers.get('X-Review-Stage-Build');if(build!==null){if(build!=='inspected'&&!/^[a-f0-9]{64}$/.test(build))return refuse('FRONT_QUERY_REFUSED',400);headers.set('X-Review-Stage-Build',build);}}
209
- if(route.mutation){headers.set('origin',record.origin);headers.set(capabilityHeader,record.capability);}
210
- active++;let released=false;const abort=new AbortController(),timer=setTimeout(()=>abort.abort(),route.timeoutMs);const release=()=>{if(released)return;released=true;active--;clearTimeout(timer);};
211
- req.signal.addEventListener('abort',()=>abort.abort(),{once:true});
212
- let upstream:Response;
213
- try{upstream=await fetch(record.origin+path+(landing?url.search:''),{method:req.method,headers,...(body?{body}:{}),redirect:'manual',signal:abort.signal});}
214
- catch{release();return abort.signal.aborted&&!req.signal.aborted?refuse('FRONT_UPSTREAM_TIMEOUT',504):refuse('FRONT_INSTANCE_EXPIRED: reopen with rig-review open',410);}
215
- if(upstream.headers.get(openKeyHeader)!==key){void upstream.body?.cancel().catch(()=>{});release();return refuse('FRONT_INSTANCE_REPLACED: reopen with rig-review open',410);}
216
- if(upstream.status>=400&&upstream.status!==416){const named=await inspectionRefusal(record.mode,req.method,path,upstream,record.fingerprint===options.fingerprint);void upstream.body?.cancel().catch(()=>{});release();if(named)return refuse(named,upstream.status);const code=upstreamFailure[upstream.status];return refuse(code??'FRONT_UPSTREAM_FAILED',code?upstream.status:502);}
217
- const out=new Headers();for(const name of responseHeaders){const value=upstream.headers.get(name);if(value!==null)out.set(name,value);}
218
- if(!upstream.body||req.method==='HEAD'){void upstream.body?.cancel().catch(()=>{});release();return new Response(null,{status:upstream.status,headers:out});}
219
- if(timer)clearTimeout(timer);const reader=upstream.body.getReader();
220
- // Media/model streams stay counted until finished or cancelled by the browser.
221
- const stream=new ReadableStream<Uint8Array>({async pull(controller){try{const next=await reader.read();if(next.done){controller.close();release();}else controller.enqueue(next.value);}catch(error){release();controller.error(error);}},cancel(reason){release();abort.abort();return reader.cancel(reason).catch(()=>{});}});
222
- return new Response(stream,{status:upstream.status,headers:out});
223
- }catch(error){const message=error instanceof Error?error.message:'';return refuse(message.startsWith('FRONT_')?message:'FRONT_REQUEST_FAILED',message==='FRONT_BODY_LIMIT'?413:message==='FRONT_BODY_TIMEOUT'?408:400);}
224
- }});
225
- origin=`http://127.0.0.1:${server.port}`;
226
- return {origin,stop:()=>server.stop(true),idleMs:()=>performance.now()-last,active:()=>active};
227
- }
228
- /** A missing directory or record means gone; any other read error (readdir or a record) throws, and the caller keeps
229
- * the front up. A record read that failed with EACCES or ENOTDIR used to count as gone and stopped the front (#354). */
230
- async function liveInstances(control:string):Promise<boolean>{let names:string[];try{names=await readdir(control);}catch(e){if((e as NodeJS.ErrnoException).code==='ENOENT')return false;throw e;}for(const name of names){if(/^[a-f0-9]{64}\.claim$/.test(name))return true;if(/^[a-f0-9]{64}\.json$/.test(name)){const row=await readRecord(join(control,name),name.slice(0,64));if(row&&running(row.pid))return true;}}return false;}
231
- export async function runFront(requestPath:string):Promise<void>{
232
- const spec=await smallJson(requestPath) as FrontRequest;if(spec?.schema!=='rig-review-front-request/1'||!uuid.test(spec.nonce??'')||!hex64.test(spec.fingerprint??'')||!Number.isSafeInteger(spec.port)||spec.port<0||spec.port>65535||!Number.isSafeInteger(spec.idleMs)||spec.idleMs<100)throw new Error('front: invalid request');
233
- const control=await realpath(spec.control);if(dirname(await realpath(requestPath))!==control||spec.request!==requestPath||spec.record!==join(control,frontName(spec.port)+'.json'))throw new Error('front: invalid state locations');
234
- if(await openFingerprint()!==spec.fingerprint)throw new Error('front: tool changed before startup');
235
- let front:ReturnType<typeof startFront>;
236
- try{front=startFront({control,port:spec.port,nonce:spec.nonce,fingerprint:spec.fingerprint});}catch(error){if((error as NodeJS.ErrnoException).code==='EADDRINUSE'||/in use/i.test(error instanceof Error?error.message:''))throw new Error(`FRONT_PORT_BUSY: 127.0.0.1:${spec.port}`);throw error;}
237
- const record:FrontRecord={schema:'rig-review-front/1',origin:front.origin,port:Number(new URL(front.origin).port),nonce:spec.nonce,fingerprint:spec.fingerprint,pid:process.pid},tmp=spec.record+'.'+spec.nonce+'.tmp';await writeFile(tmp,JSON.stringify(record),{mode:0o600,flag:'wx'});await rename(tmp,spec.record);
238
- await unlink(requestPath).catch(e=>{if(e.code!=='ENOENT')throw e;});
239
- let stopped=false;const stop=async(reason:string)=>{if(stopped)return;stopped=true;clearInterval(timer);front.stop();const current=await readFront(spec.record,spec.port).catch(()=>null);if(current?.nonce===spec.nonce)await unlink(spec.record).catch(()=>{});console.log(`review front: exiting — ${reason}.`);process.exit(0);};
240
- // Idle exit only once no request arrived for idleMs and no live worker record remains.
241
- const timer=setInterval(()=>{if(front.idleMs()>=spec.idleMs&&front.active()===0)void liveInstances(control).then(live=>{if(!live)void stop(`no live review instances remain (idle for ${spec.idleMs}ms)`)}).catch(()=>{});},Math.min(250,spec.idleMs));
242
- process.on('SIGTERM',()=>{void stop('received SIGTERM');});process.on('SIGINT',()=>{void stop('received SIGINT');});
243
- }
@@ -1,4 +1,4 @@
1
- /** Private scene option gate, from Create PROJECT rule 4. */
1
+ /** Shared closed scene shape and private option-context gate, from Create PROJECT rule 4. */
2
2
  import {createHash} from 'node:crypto';
3
3
  import {isDeepStrictEqual as equal} from 'node:util';
4
4
  import type {SetRef} from './interview-project.ts';
@@ -40,7 +40,7 @@ function plate(value: unknown): boolean {
40
40
  closed(p.registered, ['kind', 'ref']) && ['input', 'derived'].includes(String(registered.kind)) && text(registered.ref) &&
41
41
  (!('citation' in p) || citation(p.citation));
42
42
  }
43
- function document(value: Data, n: unknown): boolean {
43
+ export function sceneDocumentShape(value: Data, n: unknown): boolean {
44
44
  const rig = object(value.rig), animation = object(rig.animation), acceptance = object(rig.acceptance);
45
45
  const signoff = object(acceptance.signoff), reviewPackage = object(acceptance.review_package), frame = object(value.frame);
46
46
  return closed(value, ['schema', 'n', 'rig', 'frame', 'plates', 'layers']) && value.schema === 'rig-create/scene@1' && count(value.n) && value.n === n &&
@@ -104,6 +104,6 @@ export function sceneAt(project: Data, at: number, read: (ref: SetRef) => Data)
104
104
  const reference = {n: candidate.n, path: candidate.path as string, sha256: candidate.sha256 as string};
105
105
  let scene: Data;
106
106
  try {scene = read(reference);} catch {return stale();}
107
- if (!document(scene, candidate.n)) return stale();
107
+ if (!sceneDocumentShape(scene, candidate.n)) return stale();
108
108
  return {context: {kind: 'scene', scene: reference}, current: current(project, scene, at), document: scene};
109
109
  }
package/src/job-act.ts CHANGED
@@ -21,7 +21,6 @@ import {
21
21
  } from './job-source.ts';
22
22
  import { JobError } from './job-store.ts';
23
23
  import { checkedPath, readRegular } from './interview-project.ts';
24
- import { prepareJobImageSet } from './job-image-set.ts';
25
24
  import {validatePngBytes} from './comment-crops.ts';
26
25
 
27
26
  function words(value: unknown): string {
@@ -101,16 +100,6 @@ export function bindJobAsk(subject: JobSubject | RecordSubject, retained: JobRet
101
100
  return bindJobRecordAsk(subject, retained);
102
101
  }
103
102
  const source = structuredClone(retained.source);
104
- if (source.subject === 'image-set') {
105
- if (subject.kind !== 'review-verdict' || subject.stage !== 'image-review') throw new JobError('JOB_ASK_INVALID');
106
- const identity = prepareJobImageSet(source.imageSet,
107
- path => readRegular(checkedPath(retained.root.path, path), 64 * 1024 * 1024));
108
- if (requestDigest(identity) !== requestDigest({imageSet: source.imageSet,
109
- imageSetDigest: source.imageSetDigest, duplicateHashes: source.duplicateHashes})) {
110
- throw new JobError('JOB_SOURCE_MISMATCH');
111
- }
112
- return {...source, ...identity};
113
- }
114
103
  const declared = retained.subjects.some(candidate => requestDigest(candidate) === requestDigest(subject));
115
104
  switch (subject.kind) {
116
105
  case 'interview-picks': {
@@ -198,7 +187,7 @@ export function prepareJobStill(input: UISubmissionV3, ask: JobPendingAsk, retai
198
187
  } else {
199
188
  if (typeof frame !== 'number' || !Number.isFinite(frame) || frame < 0 ||
200
189
  typeof capture.animation !== 'string' || !capture.animation || capture.animation.length > 512 ||
201
- retained.source.subject === 'image-set' || !retained.source.model) throw new JobError('JOB_STILL_CAPTURE_FAILED');
190
+ !retained.source.model) throw new JobError('JOB_STILL_CAPTURE_FAILED');
202
191
  const model = JSON.parse(readRegular(checkedPath(retained.snapshotRoot, retained.source.model.path), 64 * 1024 * 1024).toString('utf8'));
203
192
  const clip = model.animations?.find((item: {name: string; duration: number}) => item.name === capture.animation);
204
193
  if (!clip || !Number.isFinite(clip.duration) || frame > clip.duration) throw new JobError('JOB_STILL_CAPTURE_FAILED');
@@ -514,29 +503,6 @@ export function finalizeJobAct(options: {
514
503
  };
515
504
  // Image-review and interview-picks keep act@2: Create refuses both under act@6.
516
505
  const comments = {...envelope, schema: JOB_COMMENTS_ACT_SCHEMA};
517
- if (source.subject === 'image-set') {
518
- if (submission.kind !== 'review-verdict' || ask.subject.kind !== 'review-verdict' ||
519
- ask.subject.stage !== 'image-review') throw new JobError('JOB_ACT_INVALID');
520
- const value = jobObject(submission.value, ['stage', 'verdict', 'words', 'imageNotes']);
521
- if (value.stage !== 'image-review') throw new JobError('JOB_ACT_INVALID');
522
- let imageNotes: {name: string; words: string}[] | undefined;
523
- if (value.imageNotes !== undefined) {
524
- if (!Array.isArray(value.imageNotes) || value.imageNotes.length > source.imageSet.images.length) {
525
- throw new JobError('JOB_ACT_INVALID');
526
- }
527
- const names = new Set<string>();
528
- imageNotes = value.imageNotes.map(raw => {
529
- const note = jobObject(raw, ['name', 'words']);
530
- if (typeof note.name !== 'string' || names.has(note.name) ||
531
- !source.imageSet.images.some(image => image.name === note.name)) throw new JobError('JOB_ACT_INVALID');
532
- names.add(note.name);
533
- return {name: note.name, words: words(note.words)};
534
- });
535
- }
536
- return {...envelope, kind: 'review-verdict', source, value: {stage: 'image-review',
537
- verdict: choice(value.verdict, ['pending', 'approved', 'changes-requested'] as const), words: words(value.words),
538
- ...(imageNotes === undefined ? {} : {imageNotes})}};
539
- }
540
506
  switch (submission.kind) {
541
507
  case 'interview-picks': {
542
508
  const value = jobObject(submission.value, ['questionId', 'selections', 'note']);